fmt tests; properly define string literals; work on scanner
This commit is contained in:
@@ -1,303 +1,229 @@
|
||||
==================
|
||||
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 '\')))))))))
|
||||
(expression
|
||||
(template_expr
|
||||
(quoted_template
|
||||
(template_literal
|
||||
(ERROR
|
||||
(UNEXPECTED '\')))))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
string literal multi line error
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = "
|
||||
bar"
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template (ERROR (UNEXPECTED 'b')))))))))
|
||||
(expression
|
||||
(template_expr
|
||||
(quoted_template
|
||||
(ERROR
|
||||
(UNEXPECTED 'b'))
|
||||
(template_literal)))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
string literal unescaped tab
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = "foo bar"
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template (ERROR (UNEXPECTED 'b')))))))))
|
||||
(expression
|
||||
(template_expr
|
||||
(quoted_template
|
||||
(template_literal
|
||||
(ERROR
|
||||
(UNEXPECTED 'b')))))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
string literal unescaped backslash
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = "foo\bar"
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template (ERROR (UNEXPECTED '\')))))))))
|
||||
(expression
|
||||
(template_expr
|
||||
(quoted_template
|
||||
(template_literal
|
||||
(ERROR
|
||||
(UNEXPECTED '\')))))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
string literal escaped backslash at end
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = "foo\\"
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template (escape_sequence))))))))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal)))))))
|
||||
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
string literal escaped template interpolation
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = "$${foo.bar}"
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template (escape_sequence))))))))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal)))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
string literal template chars but no template 1
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = "$$$"
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template)))))))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal)))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
string literal template chars but no template 2
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = "100%"
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template)))))))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal)))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
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))))))))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal)))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
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))))))))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal)))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
string literal template chars but no template 5
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = "$$"
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template)))))))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal)))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
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))))))))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal)))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
string literal escaped template
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = "$${ var.bar }"
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template (escape_sequence))))))))
|
||||
|
||||
==================
|
||||
proper quoted template in string literal position errors
|
||||
==================
|
||||
|
||||
resource "${var.bar}" {
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(block
|
||||
(identifier)
|
||||
(string_lit (ERROR)))))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal)))))))
|
||||
|
||||
Reference in New Issue
Block a user