fix string literals; trim trailing whitespace

This commit is contained in:
mhoffm
2021-06-14 23:33:28 +02:00
parent 9606c5fa49
commit 01a4a981da
12 changed files with 3239 additions and 3142 deletions

View File

@@ -6,16 +6,16 @@ foo = [1, 2, "foo"]
---
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(collection_value
(tuple
(expression (expr_term (literal_value (numeric_lit))))
(expression (expr_term (literal_value (numeric_lit))))
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(collection_value
(tuple
(expression (expr_term (literal_value (numeric_lit))))
(expression (expr_term (literal_value (numeric_lit))))
(expression (expr_term (template_expr (quoted_template)))))))))))
==================
@@ -26,18 +26,18 @@ foo = {1: 2, "foo"="bar"}
---
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(collection_value
(object
(object_elem
(expression (expr_term (literal_value (numeric_lit))))
(expression (expr_term (literal_value (numeric_lit)))))
(object_elem
(expression (expr_term (template_expr (quoted_template))))
(expression (expr_term (template_expr (quoted_template))))))))))))
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(collection_value
(object
(object_elem
(expression (expr_term (literal_value (numeric_lit))))
(expression (expr_term (literal_value (numeric_lit)))))
(object_elem
(expression (expr_term (template_expr (quoted_template))))
(expression (expr_term (template_expr (quoted_template))))))))))))

View File

@@ -6,13 +6,13 @@ foo = predicate() ? 1: 2
---
(config_file
(body
(attribute
(identifier)
(expression
(conditional
(config_file
(body
(attribute
(identifier)
(expression
(conditional
(expression (expr_term (function_call (identifier))))
(expression (expr_term (literal_value (numeric_lit))))
(expression (expr_term (literal_value (numeric_lit)))))))))
(expression (expr_term (literal_value (numeric_lit))))
(expression (expr_term (literal_value (numeric_lit)))))))))

View File

@@ -6,23 +6,23 @@ foo = [for v in ["a", "b"]: v]
---
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(for_expr
(for_tuple_expr
(for_intro
(identifier)
(expression
(expr_term
(collection_value
(tuple
(expression (expr_term (template_expr (quoted_template))))
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(for_expr
(for_tuple_expr
(for_intro
(identifier)
(expression
(expr_term
(collection_value
(tuple
(expression (expr_term (template_expr (quoted_template))))
(expression (expr_term (template_expr (quoted_template)))))))))
(expression (expr_term (variable_expr (identifier)))))))))))
(expression (expr_term (variable_expr (identifier)))))))))))
==================
for tuple expression with index
@@ -32,24 +32,24 @@ foo = [for i, v in ["a", "b"]: i]
---
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(for_expr
(for_tuple_expr
(for_intro
(identifier)
(identifier)
(expression
(expr_term
(collection_value
(tuple
(expression (expr_term (template_expr (quoted_template))))
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(for_expr
(for_tuple_expr
(for_intro
(identifier)
(identifier)
(expression
(expr_term
(collection_value
(tuple
(expression (expr_term (template_expr (quoted_template))))
(expression (expr_term (template_expr (quoted_template)))))))))
(expression (expr_term (variable_expr (identifier)))))))))))
(expression (expr_term (variable_expr (identifier)))))))))))
==================
for tuple expression with predicate
@@ -59,35 +59,35 @@ foo = [for i, v in ["a", "b", "c"]: v if pred(i)]
---
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(for_expr
(for_tuple_expr
(for_intro
(identifier)
(identifier)
(expression
(expr_term
(collection_value
(tuple
(expression (expr_term (template_expr (quoted_template))))
(expression (expr_term (template_expr (quoted_template))))
(expression (expr_term (template_expr (quoted_template)))))))))
(expression (expr_term (variable_expr (identifier))))
(for_cond
(expression
(expr_term
(function_call
(identifier)
(function_arguments (expression (expr_term (variable_expr (identifier))))))))))))))))
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(for_expr
(for_tuple_expr
(for_intro
(identifier)
(identifier)
(expression
(expr_term
(collection_value
(tuple
(expression (expr_term (template_expr (quoted_template))))
(expression (expr_term (template_expr (quoted_template))))
(expression (expr_term (template_expr (quoted_template)))))))))
(expression (expr_term (variable_expr (identifier))))
(for_cond
(expression
(expr_term
(function_call
(identifier)
(function_arguments (expression (expr_term (variable_expr (identifier))))))))))))))))
==================
for object expression
for object expression
==================
foo = {for i, v in ["a", "b"]: v => i}
@@ -96,23 +96,23 @@ foo = {for i, v in ["a", "b"]: v => i}
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(for_expr
(for_object_expr
(for_intro
(attribute
(identifier)
(expression
(expr_term
(for_expr
(for_object_expr
(for_intro
(identifier)
(identifier)
(expression
(expr_term
(collection_value
(tuple
(expression (expr_term (template_expr (quoted_template))))
(expression (expr_term (template_expr (quoted_template)))))))))
(expression (expr_term (variable_expr (identifier))))
(expression (expr_term (variable_expr (identifier)))))))))))
(identifier)
(expression
(expr_term
(collection_value
(tuple
(expression (expr_term (template_expr (quoted_template))))
(expression (expr_term (template_expr (quoted_template)))))))))
(expression (expr_term (variable_expr (identifier))))
(expression (expr_term (variable_expr (identifier)))))))))))
==================
for object expression 2
@@ -124,20 +124,20 @@ foo = {for i, v in ["a", "b"]: v => i...}
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(for_expr
(for_object_expr
(for_intro
(attribute
(identifier)
(expression
(expr_term
(for_expr
(for_object_expr
(for_intro
(identifier)
(identifier)
(expression
(expr_term
(collection_value
(tuple
(expression (expr_term (template_expr (quoted_template))))
(expression (expr_term (template_expr (quoted_template)))))))))
(expression (expr_term (variable_expr (identifier))))
(expression (expr_term (variable_expr (identifier)))) (ellipsis))))))))
(identifier)
(expression
(expr_term
(collection_value
(tuple
(expression (expr_term (template_expr (quoted_template))))
(expression (expr_term (template_expr (quoted_template)))))))))
(expression (expr_term (variable_expr (identifier))))
(expression (expr_term (variable_expr (identifier)))) (ellipsis))))))))

View File

@@ -20,16 +20,16 @@ foo = bar("foo")
---
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(function_call
(identifier)
(function_arguments
(expression (expr_term (template_expr (quoted_template)))))))))))
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(function_call
(identifier)
(function_arguments
(expression (expr_term (template_expr (quoted_template)))))))))))
==================
variadic function call
@@ -39,16 +39,16 @@ foo = bar(x...)
---
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(function_call
(identifier)
(function_arguments
(expression (expr_term (variable_expr (identifier)))) (ellipsis))))))))
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(function_call
(identifier)
(function_arguments
(expression (expr_term (variable_expr (identifier)))) (ellipsis))))))))
==================
multiline function call
@@ -62,16 +62,16 @@ foo = bar(
---
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(function_call
(identifier)
(function_arguments
(expression (expr_term (template_expr (quoted_template))))
(expression (expr_term (template_expr (quoted_template))))
(expression (expr_term (template_expr (quoted_template)))))))))))
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(function_call
(identifier)
(function_arguments
(expression (expr_term (template_expr (quoted_template))))
(expression (expr_term (template_expr (quoted_template))))
(expression (expr_term (template_expr (quoted_template)))))))))))

View File

@@ -6,13 +6,13 @@ foo = -3
---
(config_file
(body
(attribute
(identifier)
(expression
(operation
(unary_operation (expr_term (literal_value (numeric_lit)))))))))
(config_file
(body
(attribute
(identifier)
(expression
(operation
(unary_operation (expr_term (literal_value (numeric_lit)))))))))
==================
unary operator !
@@ -22,13 +22,13 @@ foo = !true
---
(config_file
(body
(attribute
(identifier)
(expression
(operation
(unary_operation (expr_term (literal_value (bool_lit)))))))))
(config_file
(body
(attribute
(identifier)
(expression
(operation
(unary_operation (expr_term (literal_value (bool_lit)))))))))
==================
binary operators +
@@ -38,13 +38,13 @@ foo = 1+2
---
(config_file
(body
(attribute
(identifier)
(expression
(operation
(binary_operation
(expr_term (literal_value (numeric_lit)))
(expr_term (literal_value (numeric_lit)))))))))
(config_file
(body
(attribute
(identifier)
(expression
(operation
(binary_operation
(expr_term (literal_value (numeric_lit)))
(expr_term (literal_value (numeric_lit)))))))))

View File

@@ -6,16 +6,16 @@ foo = bar.baz
---
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(expr_term
(variable_expr
(identifier)))
(get_attr
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(expr_term
(variable_expr
(identifier)))
(get_attr
(identifier)))))))
==================
@@ -26,15 +26,15 @@ foo = bar[1]
---
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(expr_term
(variable_expr
(identifier)))
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(expr_term
(variable_expr
(identifier)))
(index
(expression
(expr_term
@@ -49,19 +49,19 @@ foo = bar.*.foo
---
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(expr_term
(variable_expr
(identifier)))
(splat
(attr_splat
(get_attr
(identifier)))))))))
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(expr_term
(variable_expr
(identifier)))
(splat
(attr_splat
(get_attr
(identifier)))))))))
==================
full splat
@@ -71,16 +71,16 @@ foo = bar[*].foo
---
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(expr_term
(variable_expr
(identifier)))
(splat
(full_splat
(get_attr
(identifier)))))))))
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(expr_term
(variable_expr
(identifier)))
(splat
(full_splat
(get_attr
(identifier)))))))))

View File

@@ -90,11 +90,11 @@ foo = "bar\pbaz"
---
(config_file
(body
(attribute
(identifier)
(expression (expr_term (template_expr (quoted_template (ERROR (UNEXPECTED '\')))))))))
(config_file
(body
(attribute
(identifier)
(expression (expr_term (template_expr (quoted_template (ERROR (UNEXPECTED '\')))))))))
==================
string bad escape sequence 2
@@ -104,11 +104,11 @@ foo = "bar\uZZ"
---
(config_file
(body
(attribute
(identifier)
(expression (expr_term (template_expr (quoted_template (ERROR (UNEXPECTED '\')))))))))
(config_file
(body
(attribute
(identifier)
(expression (expr_term (template_expr (quoted_template (ERROR (UNEXPECTED '\')))))))))
==================
string literal multi line error
@@ -221,10 +221,10 @@ foo = "%\n\t"
(config_file
(body
(attribute
(identifier)
(expression (expr_term (template_expr (quoted_template
(escape_sequence)
(escape_sequence))))))))
(identifier)
(expression (expr_term (template_expr (quoted_template
(escape_sequence)
(escape_sequence))))))))
==================
string literal template chars but no template 4
@@ -237,10 +237,10 @@ foo = "%%\n\t"
(config_file
(body
(attribute
(identifier)
(expression (expr_term (template_expr (quoted_template
(escape_sequence)
(escape_sequence))))))))
(identifier)
(expression (expr_term (template_expr (quoted_template
(escape_sequence)
(escape_sequence))))))))
==================
string literal template chars but no template 5
@@ -253,8 +253,8 @@ foo = "$$"
(config_file
(body
(attribute
(identifier)
(expression (expr_term (template_expr (quoted_template)))))))
(identifier)
(expression (expr_term (template_expr (quoted_template)))))))
==================
string literal template chars but no template 6
@@ -267,11 +267,11 @@ foo = "%%{\n\t"
(config_file
(body
(attribute
(identifier)
(expression (expr_term (template_expr (quoted_template
(escape_sequence)
(escape_sequence)
(escape_sequence))))))))
(identifier)
(expression (expr_term (template_expr (quoted_template
(escape_sequence)
(escape_sequence)
(escape_sequence))))))))
==================
string literal escaped template
@@ -284,5 +284,20 @@ foo = "$${ var.bar }"
(config_file
(body
(attribute
(identifier)
(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)))))