From e07efd58188abc7283884af348dbcb9786824a8b Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Thu, 5 Sep 2024 16:10:19 +0200 Subject: Don’t parse if a lexing error occurs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lexer.l | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/lexer.l b/src/lexer.l index 8100405..ec765d9 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -17,6 +17,8 @@ extern const char *current_file; ws [ \t] +%x error + %% ¬|! { return NOT; } @@ -44,6 +46,10 @@ ws [ \t] . { user_error("%s:%d: Unrecognized character ‘%c’", current_file, yylineno, *yytext); + BEGIN(error); + return YYerror; } +.* { BEGIN(0); } + %% -- cgit v1.2.3