* Allow "$" in strings as long as they are not followed by "{". (Too
bad flex doesn't have lexical restrictions, the current solution isn't quite right...)
This commit is contained in:
parent
c9586b6c3f
commit
de90fdf908
3 changed files with 7 additions and 2 deletions
|
@ -77,7 +77,11 @@ inherit { return INHERIT; }
|
||||||
}
|
}
|
||||||
|
|
||||||
\" { BEGIN(STRING); return '"'; }
|
\" { BEGIN(STRING); return '"'; }
|
||||||
<STRING>([^\$\"\\]|\\.)+ {
|
<STRING>([^\$\"\\]|\$[^\{\"]|\\.)+ {
|
||||||
|
/* !!! Not quite right: we want a follow restriction on "$", it
|
||||||
|
shouldn't be followed by a "{". Right now "$\"" will be consumed
|
||||||
|
as part of a string, rather than a "$" followed by the string
|
||||||
|
terminator. Disallow "$\"" for now. */
|
||||||
yylval->t = unescapeStr(yytext); /* !!! alloc */
|
yylval->t = unescapeStr(yytext); /* !!! alloc */
|
||||||
return STR;
|
return STR;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Str("foobar/a/b/c/d/foo/xyzzy/foo.txt/../foo/x/yescape: \"quote\" \n \\end\nof\nlinefoobarblaat")
|
Str("foobar/a/b/c/d/foo/xyzzy/foo.txt/../foo/x/yescape: \"quote\" \n \\end\nof\nlinefoobarblaatfoo$bar")
|
||||||
|
|
|
@ -7,3 +7,4 @@
|
||||||
of
|
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"
|
||||||
|
|
Loading…
Reference in a new issue