settings: Add support for multi-line strings
Unterminated strings are now an error.
This commit is contained in:
@@ -119,16 +119,11 @@ static void include_files(parser_helper_t *ctx);
|
||||
<str>{
|
||||
"\"" |
|
||||
<<EOF>> |
|
||||
\n |
|
||||
\\ {
|
||||
if (!streq(yytext, "\""))
|
||||
{
|
||||
if (streq(yytext, "\n"))
|
||||
{ /* put the newline back to fix the line numbers */
|
||||
unput('\n');
|
||||
yy_set_bol(0);
|
||||
}
|
||||
PARSER_DBG1(yyextra, "unterminated string detected");
|
||||
return STRING_ERROR;
|
||||
}
|
||||
if (yy_top_state(yyscanner) == inc)
|
||||
{ /* string include */
|
||||
@@ -148,7 +143,7 @@ static void include_files(parser_helper_t *ctx);
|
||||
\\t yyextra->string_add(yyextra, "\t");
|
||||
\\\r?\n /* merge lines that end with EOL characters */
|
||||
\\. yyextra->string_add(yyextra, yytext+1);
|
||||
[^\\\n"]+ {
|
||||
[^\\"]+ {
|
||||
yyextra->string_add(yyextra, yytext);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ static int yylex(YYSTYPE *lvalp, parser_helper_t *ctx)
|
||||
struct kv_t *kv;
|
||||
}
|
||||
%token <s> NAME STRING
|
||||
%token NEWLINE
|
||||
%token NEWLINE STRING_ERROR
|
||||
|
||||
/* ...and other symbols */
|
||||
%type <s> value valuepart
|
||||
|
||||
Reference in New Issue
Block a user