simplify whitespace handling; support hexadecimal numeric literals; allow empty configs

This commit is contained in:
mhoffm
2021-06-20 00:03:58 +02:00
parent b1c3109853
commit 22d0a7253c
15 changed files with 12984 additions and 13226 deletions

View File

@@ -10,8 +10,7 @@ block_1 {
(config_file
(body
(block
(identifier)
(body))))
(identifier))))
================================================================================
basic block on one line
@@ -69,8 +68,7 @@ block_1 {
(identifier)
(body
(block
(identifier)
(body))))))
(identifier))))))
================================================================================
nested block on one line
@@ -122,20 +120,22 @@ locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") }
(config_file
(body
(one_line_block
(block
(identifier)
(identifier)
(expression
(function_call
(body
(attribute
(identifier)
(function_arguments
(expression
(function_call
(identifier)))
(expression
(literal_value
(string_lit
(template_literal))))
(expression
(template_expr
(quoted_template)))))))))
(expression
(function_call
(identifier)
(function_arguments
(expression
(function_call
(identifier)))
(expression
(literal_value
(string_lit
(template_literal))))
(expression
(template_expr
(quoted_template)))))))))))

View File

@@ -365,3 +365,4 @@ worker_groups = [
(expression
(literal_value
(numeric_lit)))))))))))))

View File

@@ -1,3 +1,19 @@
================================================================================
numeric literal hex 1
================================================================================
pi = 0x314F
--------------------------------------------------------------------------------
(config_file
(body
(attribute
(identifier)
(expression
(literal_value
(numeric_lit))))))
================================================================================
numeric literal scientific notation 1
================================================================================

View File

@@ -11,32 +11,12 @@ foo = "bar\uZZ"
(attribute
(identifier)
(expression
(literal_value
(string_lit
(template_expr
(quoted_template
(template_literal
(ERROR
(UNEXPECTED '\')))))))))
================================================================================
literal multi line error
================================================================================
foo = "
bar"
--------------------------------------------------------------------------------
(config_file
(body
(attribute
(identifier)
(expression
(literal_value
(string_lit
(ERROR
(UNEXPECTED '\n'))
(template_literal)))))))
================================================================================
unescaped tab
================================================================================
@@ -67,8 +47,8 @@ foo = "foo\bar"
(attribute
(identifier)
(expression
(literal_value
(string_lit
(template_expr
(quoted_template
(template_literal
(ERROR
(UNEXPECTED '\')))))))))