From 2dd7ff8560701a1fb64e854d105320a4b86df9a7 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 22 May 2018 23:15:05 -0400 Subject: [PATCH] do not decode escape characters in string literals --- src/parser/parser.l | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/parser/parser.l b/src/parser/parser.l index 533af6e..235767b 100644 --- a/src/parser/parser.l +++ b/src/parser/parser.l @@ -132,13 +132,6 @@ __extension__ return EXTENSION; L?'[^\\]' return CHAR_CONST; L?'\\.' return CHAR_CONST; -L?'\\a' (void)'\a'; return CHAR_CONST; -L?'\\b' (void)'\b'; return CHAR_CONST; -L?'\\f' (void)'\f'; return CHAR_CONST; -L?'\\n' (void)'\n'; return CHAR_CONST; -L?'\\r' (void)'\r'; return CHAR_CONST; -L?'\\t' (void)'\t'; return CHAR_CONST; -L?'\\v' (void)'\v'; return CHAR_CONST; L?'\\x[0-9A-Fa-f]{2}' return CHAR_CONST; L?'\\[0-7]{1,3}' return CHAR_CONST; [0-9]+[uU]?[lL]?[lL]? return INT_CONST; @@ -173,15 +166,7 @@ L?\" { (void)sscanf(yytext + 1, "%o", &val); *build_string += (char)val; } -\\a *build_string += '\a'; -\\b *build_string += '\b'; -\\f *build_string += '\f'; -\\n *build_string += '\n'; -\\r *build_string += '\r'; -\\t *build_string += '\t'; -\\v *build_string += '\v'; -\\. *build_string += (char)yytext[1]; -[^\\\"]+ *build_string += yytext; +[^"]+ *build_string += yytext; } [a-zA-Z_][a-zA-Z_0-9]* {