@@ -179,18 +179,27 @@ use[ \t\r\n]*"<" { BEGIN(cond_use); LOCATION_COUNT_LINES(parserlloc, yyte
179179
180180\" { BEGIN (cond_string); stringcontents.clear (); }
181181<cond_string >{
182+ %{ /* Termination */ %}
183+ \" { BEGIN(INITIAL); parserlval.text = strdup(stringcontents.c_str()); return TOK_STRING; }
184+ <<EOF>> { parsererror(" Unterminated string" ); return TOK_ERROR; }
185+
186+ %{/* Escape sequences */%}
182187\\ n { stringcontents += '\n '; }
183188\\ t { stringcontents += '\t '; }
184189\\ r { stringcontents += '\r '; }
185190\\\\ { stringcontents += '\\ '; }
186191\\\" { stringcontents += '" ' ; }
187- {UNICODE } { /* parser_error_pos -= strlen(lexertext) - 1; */ stringcontents += lexertext; }
188192\\ x[0-7]{H} { unsigned long i = strtoul(lexertext + 2, NULL, 16); stringcontents += (i == 0 ? ' ' : (unsigned char)(i & 0xff)); }
189193\\ u{H}{4}|\\ U{H}{6} { const auto c = strtoul(lexertext + 2, NULL, 16); stringcontents += str_utf8_wrapper(c).toString(); }
190- [^ \\\n\" ] { stringcontents += lexertext; }
191- [\n\r ] { LOCATION_ADD_LINES (parserlloc, yyleng); }
192- \" { BEGIN (INITIAL); parserlval.text = strdup (stringcontents.c_str ()); return TOK_STRING; }
193- <<EOF>> { parsererror (" Unterminated string" ); return TOK_ERROR; }
194+ \\ { LOG(message_group::Warning, LOCATION(parserlloc), "", "Undefined escape sequence"); }
195+
196+ %{/* Special characters */%}
197+ \n { LOCATION_ADD_LINES(parserlloc, yyleng); }
198+
199+ %{/* Everything else */%}
200+ {UNICODE} { /* parser_error_pos -= strlen(lexertext) - 1; */ stringcontents += lexertext; }
201+ . { stringcontents += lexertext; }
202+
194203}
195204
196205[\t ] { LOCATION_NEXT(parserlloc); }
0 commit comments