diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-04-18 21:13:24 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-04-18 21:13:24 -0700 |
commit | 264e840b7e10ad7bc28e8649fa841364223e56fa (patch) | |
tree | ae117cb1cbf6ec761e87dbf9a2b11d11f9296cda | |
parent | 362187f4d0c0ff80320cd52634c8b6c245e27ae6 (diff) | |
download | txr-264e840b7e10ad7bc28e8649fa841364223e56fa.tar.gz txr-264e840b7e10ad7bc28e8649fa841364223e56fa.tar.bz2 txr-264e840b7e10ad7bc28e8649fa841364223e56fa.zip |
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.
-rw-r--r-- | parser.l | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -821,12 +821,18 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} yyextra->lineno++; } -<REGEX,SREGEX>{NL} { +<REGEX>{NL} { yyextra->lineno++; yyerrprepf(yyg, lit("newline in regex"), nao); return ERRTOK; } +<SREGEX>{NL} { + yyextra->lineno++; + yylval->chr = yytext[0]; + return REGCHAR; +} + <REGEX,SREGEX>{REGOP} { yylval->chr = yytext[0]; return yytext[0]; |