mirror of
https://github.com/Noratrieb/dilaria.git
synced 2026-01-14 17:35:03 +01:00
error tokens instead of result
This commit is contained in:
parent
5ae747d513
commit
11b735d728
3 changed files with 49 additions and 36 deletions
|
|
@ -18,7 +18,13 @@ pub fn run_program(program: &str) {
|
|||
let ast_alloc = Bump::new();
|
||||
|
||||
let lexer = lex::Lexer::new(program);
|
||||
let ast = parse::parse(lexer, &ast_alloc);
|
||||
let ast = parse::parse(
|
||||
lexer.map(|token| match &token.kind {
|
||||
TokenType::Error(err) => Err(err.clone()),
|
||||
_ => Ok(token),
|
||||
}),
|
||||
&ast_alloc,
|
||||
);
|
||||
|
||||
match ast {
|
||||
Ok(ast) => process_ast(program, ast),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue