Dollar symbols were failing to parse when not followed by a non-brace,
non-dollar, non-EOF token and causing expected tests to fail. This
simplifies the rules to allow the remaining tests to succeed.
Fix and reinstate the final few failing tests, and add another.
Allow any escape sequence to be matched so that invalid sequences
produce a meaningful error message instead of a generic "cannot parse":
ast: interpolate: interpolating: V: \?
unhandled escape sequence token: \?
Tidy the related Makefile rule for generating the ragel parser.
Signed-off-by: Joe Groocock <me@frebib.net>
63 lines
848 B
Plaintext
63 lines
848 B
Plaintext
# escaping examples
|
|
|
|
test "A: \${test}" {}
|
|
|
|
test "B: \$" {}
|
|
|
|
$c1 = "This is c1"
|
|
test "C: ${c1}" {}
|
|
|
|
test "D: \\\$" {}
|
|
|
|
test "E: {}" {}
|
|
|
|
test "F: hello" {}
|
|
|
|
$g1 = "This is g1"
|
|
test "G: ${g1} EOF" {}
|
|
|
|
test "H: {hhh} EOF" {}
|
|
|
|
$i_i = "This is ii"
|
|
test "I: ${i_i} EOF" {}
|
|
|
|
# is this okay?
|
|
test "J: $ is a dollar sign" {}
|
|
|
|
test "K: $ {zzz} EOF" {}
|
|
|
|
$l1 = "This is l1"
|
|
test "L: $$${l1} EOF" {}
|
|
|
|
test "M: $ $$" {}
|
|
|
|
test "N: hello \" world" {}
|
|
|
|
test "O: hello \"\" world" {}
|
|
|
|
test "P: hello \\ world" {}
|
|
|
|
test "Q: hello \\\\ world" {}
|
|
|
|
$r1 = "This is r1"
|
|
test "R: \\${r1} EOF" {}
|
|
|
|
test "S: \\$ EOF" {}
|
|
|
|
test "T: newline\nEOF" {}
|
|
|
|
test "U: tab\t\\\ttabEOF" {}
|
|
|
|
# test "V: " {}
|
|
|
|
test "W: \\$" {}
|
|
|
|
$x1 = "This is x1"
|
|
test "X: $${x1} EOF" {}
|
|
|
|
$unused = "i am unused"
|
|
$y1 = "{unused}"
|
|
test "Y: $${y1} EOF" {} # check there isn't double parsing
|
|
|
|
test "Z: $$$" {}
|