Commit db20eb75 authored by David Gobbi's avatar David Gobbi
Browse files

Fix bug for parsing backslash in string literal.

The string and char literals had a mistake that caused a mis-parse if
a backslash appeared before the terminating quote.  The new patterns
fix the bug, and also allow for multi-line string literals.
parent f04cf077
Pipeline #695 passed with stage
This diff is collapsed.
......@@ -125,12 +125,12 @@ ID [a-zA-Z_\x80-\xff][0-9a-zA-Z_\x80-\xff]*
preprocessor_directive(yytext, yyleng);
}
("u8"|"u"|"U"|"L")?\"([^\"]|\\\")*\"(_{ID})? {
("u8"|"u"|"U"|"L")?\"([^\\"]|\\\r\n|\\\n|\\.)*\"(_{ID})? {
yylval.str = vtkstrndup(yytext, yyleng);
return(STRING_LITERAL);
}
("u8"|"u"|"U"|"L")?\'([^\']|\\\')+\'(_{ID})? {
("u8"|"u"|"U"|"L")?\'([^\\']|\\.)+\'(_{ID})? {
yylval.str = vtkstrndup(yytext, yyleng);
return(CHAR_LITERAL);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment