aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-09-05 16:10:19 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-09-05 16:10:19 +0200
commite07efd58188abc7283884af348dbcb9786824a8b (patch)
treec090229d9834818f0d2550675f560c610949d550
parent0ef367f61d437c1820ce067197b25ae088678d05 (diff)
Don’t parse if a lexing error occurs
-rw-r--r--src/lexer.l6
1 files changed, 6 insertions, 0 deletions
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;
}
+<error>.* { BEGIN(0); }
+
%%