more tests; add function expressions
This commit is contained in:
43
test/corpus/collections.txt
Normal file
43
test/corpus/collections.txt
Normal file
@@ -0,0 +1,43 @@
|
||||
==================
|
||||
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 (literal_value (string_lit)))))))))))
|
||||
|
||||
==================
|
||||
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 (literal_value (string_lit))))
|
||||
(expression (expr_term (literal_value (string_lit))))))))))))
|
||||
|
||||
86
test/corpus/function_calls.txt
Normal file
86
test/corpus/function_calls.txt
Normal file
@@ -0,0 +1,86 @@
|
||||
==================
|
||||
nonary function call
|
||||
==================
|
||||
|
||||
foo = bar()
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(expr_term
|
||||
(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
|
||||
(literal_value
|
||||
(string_lit)))))))))))
|
||||
|
||||
==================
|
||||
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)))))))))))
|
||||
|
||||
==================
|
||||
multiline function call
|
||||
==================
|
||||
|
||||
foo = bar(
|
||||
"a",
|
||||
"b",
|
||||
"c"
|
||||
)
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(expr_term
|
||||
(function_call
|
||||
(identifier)
|
||||
(function_arguments
|
||||
(expression (expr_term (literal_value (string_lit))))
|
||||
(expression (expr_term (literal_value (string_lit))))
|
||||
(expression (expr_term (literal_value (string_lit)))))))))))
|
||||
|
||||
@@ -118,6 +118,24 @@ foo = "bar"
|
||||
(literal_value
|
||||
(string_lit)))))))
|
||||
|
||||
==================
|
||||
string literal escaped newline
|
||||
==================
|
||||
|
||||
foo = "bar\nbaz"
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(expr_term
|
||||
(literal_value
|
||||
(string_lit)))))))
|
||||
|
||||
|
||||
==================
|
||||
string literal multi line error
|
||||
==================
|
||||
@@ -187,22 +205,3 @@ foo = null
|
||||
(literal_value
|
||||
(null_lit)))))))
|
||||
|
||||
==================
|
||||
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 (literal_value (string_lit)))))))))))
|
||||
86
test/corpus/splat.txt
Normal file
86
test/corpus/splat.txt
Normal file
@@ -0,0 +1,86 @@
|
||||
==================
|
||||
get attr
|
||||
==================
|
||||
|
||||
foo = bar.baz
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(expr_term
|
||||
(expr_term
|
||||
(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))))))))))
|
||||
|
||||
==================
|
||||
attr splat
|
||||
==================
|
||||
|
||||
foo = bar.*.foo
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(expr_term
|
||||
(expr_term
|
||||
(variable_expr
|
||||
(identifier)))
|
||||
(splat
|
||||
(attr_splat
|
||||
(get_attr
|
||||
(identifier)))))))))
|
||||
|
||||
==================
|
||||
full splat
|
||||
==================
|
||||
|
||||
foo = bar[*].foo
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(attribute
|
||||
(identifier)
|
||||
(expression
|
||||
(expr_term
|
||||
(expr_term
|
||||
(variable_expr
|
||||
(identifier)))
|
||||
(splat
|
||||
(full_splat
|
||||
(get_attr
|
||||
(identifier)))))))))
|
||||
Reference in New Issue
Block a user