fmt tests; properly define string literals; work on scanner
This commit is contained in:
@@ -1,28 +1,32 @@
|
||||
==================
|
||||
================================================================================
|
||||
attribute with literal
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = "bar"
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template)))))))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal)))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
attribute with variable
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = bar
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (variable_expr (identifier)))))))
|
||||
|
||||
(expression
|
||||
(variable_expr
|
||||
(identifier))))))
|
||||
|
||||
@@ -1,61 +1,66 @@
|
||||
==================
|
||||
================================================================================
|
||||
basic block
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
block_1 {
|
||||
}
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(block
|
||||
(identifier))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
basic block on one line
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
block_1 {}
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(block
|
||||
(identifier))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
block with attribute
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
block_1 "strlit1" "strlit2" {
|
||||
attr1 = "val1"
|
||||
}
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(block
|
||||
(identifier)
|
||||
(string_lit)
|
||||
(string_lit)
|
||||
(string_lit
|
||||
(template_literal))
|
||||
(string_lit
|
||||
(template_literal))
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template)))))))))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal)))))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
nested block
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
block_1 {
|
||||
block_2 {
|
||||
}
|
||||
}
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
@@ -65,15 +70,15 @@ block_1 {
|
||||
(block
|
||||
(identifier))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
nested block on one line
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
block_1 {
|
||||
block_2 {}
|
||||
}
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
@@ -83,16 +88,16 @@ block_1 {
|
||||
(block
|
||||
(identifier))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
nested blocks
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
block_1 {
|
||||
block_2 {}
|
||||
block_3 {}
|
||||
}
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
|
||||
@@ -1,43 +1,57 @@
|
||||
==================
|
||||
================================================================================
|
||||
collection value tuple
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
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))))
|
||||
(expression (expr_term (template_expr (quoted_template)))))))))))
|
||||
(collection_value
|
||||
(tuple
|
||||
(expression
|
||||
(literal_value
|
||||
(numeric_lit)))
|
||||
(expression
|
||||
(literal_value
|
||||
(numeric_lit)))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal))))))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
collection value object
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
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))))))))))))
|
||||
|
||||
(collection_value
|
||||
(object
|
||||
(object_elem
|
||||
(expression
|
||||
(literal_value
|
||||
(numeric_lit)))
|
||||
(expression
|
||||
(literal_value
|
||||
(numeric_lit))))
|
||||
(object_elem
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal))))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal)))))))))))
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
==================
|
||||
================================================================================
|
||||
simple conditional expression
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = predicate() ? 1: 2
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
@@ -12,7 +12,12 @@ foo = predicate() ? 1: 2
|
||||
(identifier)
|
||||
(expression
|
||||
(conditional
|
||||
(expression (expr_term (function_call (identifier))))
|
||||
(expression (expr_term (literal_value (numeric_lit))))
|
||||
(expression (expr_term (literal_value (numeric_lit)))))))))
|
||||
|
||||
(expression
|
||||
(function_call
|
||||
(identifier)))
|
||||
(expression
|
||||
(literal_value
|
||||
(numeric_lit)))
|
||||
(expression
|
||||
(literal_value
|
||||
(numeric_lit))))))))
|
||||
|
||||
@@ -1,143 +1,182 @@
|
||||
==================
|
||||
================================================================================
|
||||
for tuple expression
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = [for v in ["a", "b"]: v]
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(expr_term
|
||||
(for_expr
|
||||
(for_tuple_expr
|
||||
(for_intro
|
||||
(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)))))))))))
|
||||
(collection_value
|
||||
(tuple
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal))))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal))))))))
|
||||
(expression
|
||||
(variable_expr
|
||||
(identifier)))))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
for tuple expression with index
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = [for i, v in ["a", "b"]: i]
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(expr_term
|
||||
(for_expr
|
||||
(for_tuple_expr
|
||||
(for_intro
|
||||
(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)))))))))))
|
||||
(collection_value
|
||||
(tuple
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal))))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal))))))))
|
||||
(expression
|
||||
(variable_expr
|
||||
(identifier)))))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
for tuple expression with predicate
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
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
|
||||
(for_expr
|
||||
(for_tuple_expr
|
||||
(for_intro
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(collection_value
|
||||
(tuple
|
||||
(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))))))))))))))))
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal))))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal))))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal))))))))
|
||||
(expression
|
||||
(variable_expr
|
||||
(identifier)))
|
||||
(for_cond
|
||||
(expression
|
||||
(function_call
|
||||
(identifier)
|
||||
(function_arguments
|
||||
(expression
|
||||
(variable_expr
|
||||
(identifier)))))))))))))
|
||||
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
for object expression
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = {for i, v in ["a", "b"]: v => i}
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(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)))))))))))
|
||||
(for_expr
|
||||
(for_object_expr
|
||||
(for_intro
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(collection_value
|
||||
(tuple
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal))))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal))))))))
|
||||
(expression
|
||||
(variable_expr
|
||||
(identifier)))
|
||||
(expression
|
||||
(variable_expr
|
||||
(identifier)))))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
for object expression 2
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = {for i, v in ["a", "b"]: v => i...}
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(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))))))))
|
||||
(for_expr
|
||||
(for_object_expr
|
||||
(for_intro
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(collection_value
|
||||
(tuple
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal))))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal))))))))
|
||||
(expression
|
||||
(variable_expr
|
||||
(identifier)))
|
||||
(expression
|
||||
(variable_expr
|
||||
(identifier)))
|
||||
(ellipsis)))))))
|
||||
|
||||
@@ -1,58 +1,64 @@
|
||||
==================
|
||||
================================================================================
|
||||
nonary function call
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = bar()
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (function_call (identifier)))))))
|
||||
(expression
|
||||
(function_call
|
||||
(identifier))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
unary function call
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = bar("foo")
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(expr_term
|
||||
(function_call
|
||||
(identifier)
|
||||
(function_arguments
|
||||
(expression (expr_term (template_expr (quoted_template)))))))))))
|
||||
(function_call
|
||||
(identifier)
|
||||
(function_arguments
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal))))))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
variadic function call
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = bar(x...)
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(expr_term
|
||||
(function_call
|
||||
(identifier)
|
||||
(function_arguments
|
||||
(expression (expr_term (variable_expr (identifier)))) (ellipsis))))))))
|
||||
(function_call
|
||||
(identifier)
|
||||
(function_arguments
|
||||
(expression
|
||||
(variable_expr
|
||||
(identifier)))
|
||||
(ellipsis)))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
multiline function call
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = bar(
|
||||
"a",
|
||||
@@ -60,18 +66,25 @@ foo = bar(
|
||||
"c"
|
||||
)
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(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)))))))))))
|
||||
|
||||
(function_call
|
||||
(identifier)
|
||||
(function_arguments
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal))))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal))))
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal))))))))))
|
||||
|
||||
@@ -1,128 +1,143 @@
|
||||
==================
|
||||
================================================================================
|
||||
numeric literal scientific notation 1
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
pi = 3
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (literal_value (numeric_lit)))))))
|
||||
(expression
|
||||
(literal_value
|
||||
(numeric_lit))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
numeric literal scientific notation 2
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
pi = 3.14
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (literal_value (numeric_lit)))))))
|
||||
(expression
|
||||
(literal_value
|
||||
(numeric_lit))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
numeric literal scientific notation 3
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
big_pi = 3.14e+10
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (literal_value (numeric_lit)))))))
|
||||
(expression
|
||||
(literal_value
|
||||
(numeric_lit))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
numeric literal scientific notation 4
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
big_pi = 3.14E+10
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (literal_value (numeric_lit)))))))
|
||||
(expression
|
||||
(literal_value
|
||||
(numeric_lit))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
numeric literal scientific notation 5
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
small_pi = 3.14e-10
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (literal_value (numeric_lit)))))))
|
||||
(expression
|
||||
(literal_value
|
||||
(numeric_lit))))))
|
||||
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
numeric literal scientific notation 6
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
small_pi = 3.14E-10
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (literal_value (numeric_lit)))))))
|
||||
(expression
|
||||
(literal_value
|
||||
(numeric_lit))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
bool literal true
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = true
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (literal_value (bool_lit)))))))
|
||||
(expression
|
||||
(literal_value
|
||||
(bool_lit))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
bool literal false
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = false
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (literal_value (bool_lit)))))))
|
||||
(expression
|
||||
(literal_value
|
||||
(bool_lit))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
null literal
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = null
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (literal_value (null_lit)))))))
|
||||
|
||||
|
||||
(expression
|
||||
(literal_value
|
||||
(null_lit))))))
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
==================
|
||||
================================================================================
|
||||
unary operator -
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = -3
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
@@ -12,39 +12,44 @@ foo = -3
|
||||
(identifier)
|
||||
(expression
|
||||
(operation
|
||||
(unary_operation (expr_term (literal_value (numeric_lit)))))))))
|
||||
(unary_operation
|
||||
(literal_value
|
||||
(numeric_lit))))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
unary operator !
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = !true
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(operation
|
||||
(unary_operation (expr_term (literal_value (bool_lit)))))))))
|
||||
(expression
|
||||
(operation
|
||||
(unary_operation
|
||||
(literal_value
|
||||
(bool_lit))))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
binary operators +
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = 1+2
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(operation
|
||||
(binary_operation
|
||||
(expr_term (literal_value (numeric_lit)))
|
||||
(expr_term (literal_value (numeric_lit)))))))))
|
||||
|
||||
(expression
|
||||
(operation
|
||||
(binary_operation
|
||||
(literal_value
|
||||
(numeric_lit))
|
||||
(literal_value
|
||||
(numeric_lit))))))))
|
||||
|
||||
@@ -1,86 +1,77 @@
|
||||
==================
|
||||
================================================================================
|
||||
get attr
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = bar.baz
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(expr_term
|
||||
(expr_term
|
||||
(variable_expr
|
||||
(identifier)))
|
||||
(get_attr
|
||||
(identifier)))))))
|
||||
(variable_expr
|
||||
(identifier))
|
||||
(get_attr
|
||||
(identifier))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
get index
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = bar[1]
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(expr_term
|
||||
(expr_term
|
||||
(variable_expr
|
||||
(identifier)))
|
||||
(index
|
||||
(expression
|
||||
(expr_term
|
||||
(literal_value
|
||||
(numeric_lit))))))))))
|
||||
(variable_expr
|
||||
(identifier))
|
||||
(index
|
||||
(expression
|
||||
(literal_value
|
||||
(numeric_lit))))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
attr splat
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = bar.*.foo
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(expr_term
|
||||
(expr_term
|
||||
(variable_expr
|
||||
(identifier)))
|
||||
(variable_expr
|
||||
(identifier))
|
||||
(splat
|
||||
(attr_splat
|
||||
(get_attr
|
||||
(identifier)))))))))
|
||||
(attr_splat))
|
||||
(get_attr
|
||||
(identifier))))))
|
||||
|
||||
==================
|
||||
================================================================================
|
||||
full splat
|
||||
==================
|
||||
================================================================================
|
||||
|
||||
foo = bar[*].foo
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(expr_term
|
||||
(expr_term
|
||||
(variable_expr
|
||||
(identifier)))
|
||||
(variable_expr
|
||||
(identifier))
|
||||
(splat
|
||||
(full_splat
|
||||
(get_attr
|
||||
(identifier)))))))))
|
||||
(full_splat))
|
||||
(get_attr
|
||||
(identifier))))))
|
||||
|
||||
@@ -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)))))))
|
||||
|
||||
@@ -1,13 +1,145 @@
|
||||
==================
|
||||
quoted template expression
|
||||
==================
|
||||
================================================================================
|
||||
simple quoted template expression
|
||||
================================================================================
|
||||
|
||||
foo = "${ var.bar }"
|
||||
|
||||
---
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression (expr_term (template_expr (quoted_template (template_interpolation))))))))
|
||||
(expression
|
||||
(template_expr
|
||||
(quoted_template
|
||||
(template_interpolation
|
||||
(expression
|
||||
(variable_expr
|
||||
(identifier))
|
||||
(get_attr
|
||||
(identifier))))))))))
|
||||
|
||||
================================================================================
|
||||
quoted template expression with escaped strings and fake strip marker
|
||||
================================================================================
|
||||
|
||||
foo = "${ " ~ " }"
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(template_expr
|
||||
(quoted_template
|
||||
(template_interpolation
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal)))))))))))
|
||||
|
||||
================================================================================
|
||||
quoted template with nested quoted template
|
||||
================================================================================
|
||||
|
||||
foo = "p-${ foo("v-${a.b}") }"
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(template_expr
|
||||
(quoted_template
|
||||
(template_literal)
|
||||
(template_interpolation
|
||||
(expression
|
||||
(function_call
|
||||
(identifier)
|
||||
(function_arguments
|
||||
(expression
|
||||
(template_expr
|
||||
(quoted_template
|
||||
(template_literal)
|
||||
(template_interpolation
|
||||
(expression
|
||||
(variable_expr
|
||||
(identifier))
|
||||
(get_attr
|
||||
(identifier)))))))))))))))))
|
||||
|
||||
================================================================================
|
||||
quoted template interpolation with strip markers
|
||||
================================================================================
|
||||
|
||||
foo = "hello ${~ "world" ~} hello"
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(template_expr
|
||||
(quoted_template
|
||||
(template_literal)
|
||||
(template_interpolation
|
||||
(strip_marker)
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal))))
|
||||
(strip_marker))
|
||||
(template_literal)))))))
|
||||
|
||||
================================================================================
|
||||
quoted template object expression in template
|
||||
================================================================================
|
||||
|
||||
foo = "${ {a=b}[a] }"
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(template_expr
|
||||
(quoted_template
|
||||
(template_interpolation
|
||||
(expression
|
||||
(collection_value
|
||||
(object
|
||||
(object_elem
|
||||
(identifier)
|
||||
(expression
|
||||
(variable_expr
|
||||
(identifier))))))
|
||||
(index
|
||||
(expression
|
||||
(variable_expr
|
||||
(identifier))))))))))))
|
||||
|
||||
================================================================================
|
||||
escaped template interpolation start
|
||||
================================================================================
|
||||
|
||||
foo = "hello $${ world"
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(literal_value
|
||||
(string_lit
|
||||
(template_literal)))))))
|
||||
|
||||
Reference in New Issue
Block a user