From 4beecce473e5107c99aa979715a5758cc28ea0ca Mon Sep 17 00:00:00 2001 From: Zhu Siyuan <3200100491@zju.edu.cn> Date: Sat, 2 Mar 2024 23:51:09 +0800 Subject: [PATCH] [New Lexer] dummy skip and retry recovery --- src/frontend/new_lexer.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/frontend/new_lexer.rs b/src/frontend/new_lexer.rs index d4702bf..a7838a3 100644 --- a/src/frontend/new_lexer.rs +++ b/src/frontend/new_lexer.rs @@ -126,10 +126,6 @@ pub fn lexer<'a>() -> impl Parser<'a, &'a str, Vec>>, ParserEr let comment = single_comment.or(multi_comment); - let recovery = - // filter current unknown token - none_of::<&str, &str, ParserError<'a, char>>(" \t\n\r").repeated(); - // tokens let token = choice(( keywords, @@ -144,8 +140,7 @@ pub fn lexer<'a>() -> impl Parser<'a, &'a str, Vec>>, ParserEr .map_with(| tok, extra| Spanned(tok, extra.span())) .padded_by(comment.repeated()) .padded() - .recover_with(skip_then_retry_until(recovery.ignored(), end())) - .map(| tok | { println!("{:?}", tok); tok}) + .recover_with(skip_then_retry_until(any().ignored(), end())) .repeated() .collect::>>>() } \ No newline at end of file