aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-09-05 16:19:45 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-09-05 16:19:45 +0200
commitf32b030bda0bfa13cc664b6b2a769660064b2478 (patch)
treea7dbbc12170731f16c12e82760d82a58de489f1b
parente07efd58188abc7283884af348dbcb9786824a8b (diff)
Add a comment
-rw-r--r--src/lexer.l5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lexer.l b/src/lexer.l
index ec765d9..725e778 100644
--- a/src/lexer.l
+++ b/src/lexer.l
@@ -43,13 +43,16 @@ ws [ \t]
{ws}+ ;
+ /* Throw an error on an invalid token. When in interactive mode we
+ should slurp up all data on the current line after reporting the
+ error so that lexing/parsing doesn’t continue right after the
+ offending token but instead on the next line typed by the user. */
. {
user_error("%s:%d: Unrecognized character ‘%c’",
current_file, yylineno, *yytext);
BEGIN(error);
return YYerror;
}
-
<error>.* { BEGIN(0); }
%%