handle quoted template expressions and template interpolations
This commit is contained in:
288
test/corpus/strings.txt
Normal file
288
test/corpus/strings.txt
Normal file
@@ -0,0 +1,288 @@
|
||||
==================
|
||||
string literal one line
|
||||
==================
|
||||
|
||||
foo = "bar"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template)))))))
|
||||
|
||||
==================
|
||||
string literal escaped newline
|
||||
==================
|
||||
|
||||
foo = "bar\nbaz"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template (escape_sequence))))))))
|
||||
|
||||
==================
|
||||
string literal escaped tab
|
||||
==================
|
||||
|
||||
foo = "bar\tbaz"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template (escape_sequence))))))))
|
||||
|
||||
==================
|
||||
string literal escaped "
|
||||
==================
|
||||
|
||||
foo = "bar\"baz"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template (escape_sequence))))))))
|
||||
|
||||
==================
|
||||
string literal escaped \
|
||||
==================
|
||||
|
||||
foo = "bar\\baz"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template (escape_sequence))))))))
|
||||
|
||||
==================
|
||||
string literal escaped \uFFFF
|
||||
==================
|
||||
|
||||
foo = "bar\uFFFFbaz"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template (escape_sequence))))))))
|
||||
|
||||
==================
|
||||
string bad escape sequence
|
||||
==================
|
||||
|
||||
foo = "bar\pbaz"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template (ERROR (UNEXPECTED '\')))))))))
|
||||
|
||||
==================
|
||||
string bad escape sequence 2
|
||||
==================
|
||||
|
||||
foo = "bar\uZZ"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template (ERROR (UNEXPECTED '\')))))))))
|
||||
|
||||
==================
|
||||
string literal multi line error
|
||||
==================
|
||||
|
||||
foo = "
|
||||
bar"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template (ERROR (UNEXPECTED 'b')))))))))
|
||||
|
||||
==================
|
||||
string literal unescaped tab
|
||||
==================
|
||||
|
||||
foo = "foo bar"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template (ERROR (UNEXPECTED 'b')))))))))
|
||||
|
||||
==================
|
||||
string literal unescaped backslash
|
||||
==================
|
||||
|
||||
foo = "foo\bar"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template (ERROR (UNEXPECTED '\')))))))))
|
||||
|
||||
==================
|
||||
string literal escaped backslash at end
|
||||
==================
|
||||
|
||||
foo = "foo\\"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template (escape_sequence))))))))
|
||||
|
||||
|
||||
==================
|
||||
string literal escaped template interpolation
|
||||
==================
|
||||
|
||||
foo = "$${foo.bar}"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template (escape_sequence))))))))
|
||||
|
||||
==================
|
||||
string literal template chars but no template 1
|
||||
==================
|
||||
|
||||
foo = "$$$"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template)))))))
|
||||
|
||||
==================
|
||||
string literal template chars but no template 2
|
||||
==================
|
||||
|
||||
foo = "100%"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template)))))))
|
||||
|
||||
==================
|
||||
string literal template chars but no template 3
|
||||
==================
|
||||
|
||||
foo = "%\n\t"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template
|
||||
(escape_sequence)
|
||||
(escape_sequence))))))))
|
||||
|
||||
==================
|
||||
string literal template chars but no template 4
|
||||
==================
|
||||
|
||||
foo = "%%\n\t"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template
|
||||
(escape_sequence)
|
||||
(escape_sequence))))))))
|
||||
|
||||
==================
|
||||
string literal template chars but no template 5
|
||||
==================
|
||||
|
||||
foo = "$$"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template)))))))
|
||||
|
||||
==================
|
||||
string literal template chars but no template 6
|
||||
==================
|
||||
|
||||
foo = "%%{\n\t"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template
|
||||
(escape_sequence)
|
||||
(escape_sequence)
|
||||
(escape_sequence))))))))
|
||||
|
||||
==================
|
||||
string literal escaped template
|
||||
==================
|
||||
|
||||
foo = "$${ var.bar }"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template (escape_sequence))))))))
|
||||
Reference in New Issue
Block a user