* 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:
Eelco Dolstra 2006-09-01 12:04:06 +00:00
parent c9586b6c3f
commit de90fdf908
3 changed files with 7 additions and 2 deletions

View file

@ -77,7 +77,11 @@ inherit { return INHERIT; }
}
\" { 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 */
return STR;
}

View file

@ -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")

View file

@ -7,3 +7,4 @@
of
line"
+ "foo${if true then "b${"a" + "r"}" else "xyzzy"}blaat"
+ "foo$bar"