diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2016-06-18 10:08:00 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2016-06-18 10:08:00 +0300 |
commit | 45c143f157d7225fac7df014d80fc73085e1a126 (patch) | |
tree | f99559c7e1d0e225fe09ac7d108c80082fb957ff /src/meta1-lex.l | |
parent | 6669c8843b3cad84d4de63584b2675bc1b1c8ef5 (diff) | |
download | grecs-45c143f157d7225fac7df014d80fc73085e1a126.tar.gz grecs-45c143f157d7225fac7df014d80fc73085e1a126.tar.bz2 |
Fix handling of undefined escape sequences.
* src/lineacc.c (grecs_line_acc_grow_char_unescape): If the escape
sequence is not defined, add the character itself and return 1.
Return 0 otherwise.
(grecs_line_acc_grow_unescape_last): Take pointer to locus as third
argument. If not NULL, print warning about undefined escape sequences.
All callers updated.
* src/parser.c (grecs_parse): Unless grecs_trace_flags is already set,
set it from the value of GRECS_DEBUG environment variable.
Diffstat (limited to 'src/meta1-lex.l')
-rw-r--r-- | src/meta1-lex.l | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/meta1-lex.l b/src/meta1-lex.l index 75603d3..7f6fa78 100644 --- a/src/meta1-lex.l +++ b/src/meta1-lex.l @@ -80,9 +80,11 @@ X [0-9a-fA-F] \"[^\\"\n]*\\. { BEGIN(STR); grecs_line_begin(); grecs_line_acc_grow_unescape_last(yytext + 1, - yyleng - 1); } + yyleng - 1, + &yylloc); } <STR>[^\\"\n]*\\x{X}{1,2} { meta1_line_add_unescape_hex(yytext, yyleng); } -<STR>[^\\"\n]*\\. { grecs_line_acc_grow_unescape_last(yytext, yyleng); } +<STR>[^\\"\n]*\\. { grecs_line_acc_grow_unescape_last(yytext, yyleng, + &yylloc); } <STR>[^\\"\n]*\" { BEGIN(INITIAL); if (yyleng > 1) grecs_line_add(yytext, yyleng - 1); |