mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
Fix the parsing of "$"'s in strings.
This commit is contained in:
parent
65e4dcd69b
commit
467977f203
3 changed files with 8 additions and 7 deletions
|
@ -129,12 +129,11 @@ or { return OR_KW; }
|
||||||
\} { POP_STATE(); return '}'; }
|
\} { POP_STATE(); return '}'; }
|
||||||
|
|
||||||
\" { PUSH_STATE(STRING); return '"'; }
|
\" { PUSH_STATE(STRING); return '"'; }
|
||||||
<STRING>([^\$\"\\]|\$[^\{\"]|\\.)+ {
|
<STRING>([^\$\"\\]|\$[^\{\"\\]|\\.|\$\\.)*\$/\" |
|
||||||
/* !!! Not quite right: we want a follow restriction on
|
<STRING>([^\$\"\\]|\$[^\{\"\\]|\\.|\$\\.)+ {
|
||||||
"$", it shouldn't be followed by a "{". Right now
|
/* It is impossible to match strings ending with '$' with one
|
||||||
"$\"" will be consumed as part of a string, rather
|
regex because trailing contexts are only valid at the end
|
||||||
than a "$" followed by the string terminator.
|
of a rule. (A sane but undocumented limitation.) */
|
||||||
Disallow "$\"" for now. */
|
|
||||||
yylval->e = unescapeStr(data->symbols, yytext);
|
yylval->e = unescapeStr(data->symbols, yytext);
|
||||||
return STR;
|
return STR;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
"foobar/a/b/c/d/foo/xyzzy/foo.txt/../foo/x/yescape: \"quote\" \n \\end\nof\nlinefoobarblaatfoo$bar"
|
"foobar/a/b/c/d/foo/xyzzy/foo.txt/../foo/x/yescape: \"quote\" \n \\end\nof\nlinefoobarblaatfoo$bar$\"$\"$"
|
||||||
|
|
|
@ -8,3 +8,5 @@ of
|
||||||
line"
|
line"
|
||||||
+ "foo${if true then "b${"a" + "r"}" else "xyzzy"}blaat"
|
+ "foo${if true then "b${"a" + "r"}" else "xyzzy"}blaat"
|
||||||
+ "foo$bar"
|
+ "foo$bar"
|
||||||
|
+ "$\"$\""
|
||||||
|
+ "$"
|
||||||
|
|
Loading…
Reference in a new issue