From 264e840b7e10ad7bc28e8649fa841364223e56fa Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 18 Apr 2016 21:13:24 -0700 Subject: Bugfix: allow newline in regex parsing from string. * parser.l (grammar): The newline character is incorrectly handled by the same rule under the SREGEX and REGEX states. In the SREGEX state, just return it as a REGCHAR, not forgetting to increment the line number. --- parser.l | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/parser.l b/parser.l index a6df6ae8..5e608c8b 100644 --- a/parser.l +++ b/parser.l @@ -821,12 +821,18 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} yyextra->lineno++; } -{NL} { +{NL} { yyextra->lineno++; yyerrprepf(yyg, lit("newline in regex"), nao); return ERRTOK; } +{NL} { + yyextra->lineno++; + yylval->chr = yytext[0]; + return REGCHAR; +} + {REGOP} { yylval->chr = yytext[0]; return yytext[0]; -- cgit v1.2.3