From 41ddf7782b2be31f25d6ec863544fe486a5c679c Mon Sep 17 00:00:00 2001 From: Ethel Morgan Date: Tue, 11 Jul 2023 16:47:58 +0100 Subject: [PATCH] Fix lexer bug for zero-length strings ("") --- core/grammar/klexer4.mll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/grammar/klexer4.mll b/core/grammar/klexer4.mll index e58900022..bd31ef53e 100644 --- a/core/grammar/klexer4.mll +++ b/core/grammar/klexer4.mll @@ -68,7 +68,7 @@ rule token = parse | integer as n { INT (int_of_string n) } | real as f { FLOAT (float_of_string f) } | '\'' ([^'\n' '\'']+ as x) '\''{ LABEL(x) } - | '\"' ([^'\n' '\"']+ as x) '\"'{ STRING(x) } + | '\"' ([^'\n' '\"']* as x) '\"'{ STRING(x) } | '\'' ([^'\n' '\'']+ as s) (eof | '\n') { raise (ExceptionDefn.Syntax_Error ("Unterminated label: "^s,