fix: allow empty string literals

This commit is contained in:
Michael Hoffmann
2022-06-02 19:14:44 +02:00
parent 8a13647a4d
commit a87b709739
7 changed files with 9557 additions and 9499 deletions

View File

@@ -7,6 +7,9 @@ housekeeping:
* regenerate parser
* fix clang+windows CI job
fix:
* allow empty string literals
## 0.6.0 - 2021-09-20
feature:

View File

@@ -108,7 +108,7 @@ module.exports = grammar({
string_lit: $ => prec(PREC.string_lit, seq(
$.quoted_template_start,
$.template_literal,
optional($.template_literal),
$.quoted_template_end,
)),

View File

@@ -313,8 +313,16 @@
"name": "quoted_template_start"
},
{
"type": "SYMBOL",
"name": "template_literal"
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "template_literal"
},
{
"type": "BLANK"
}
]
},
{
"type": "SYMBOL",

18970
src/parser.c

File diff suppressed because it is too large Load Diff

View File

@@ -29,6 +29,25 @@ block_1 {}
(block_start)
(block_end))))
================================================================================
basic block with empty type
================================================================================
block_1 "" {
}
--------------------------------------------------------------------------------
(config_file
(body
(block
(identifier)
(string_lit
(quoted_template_start)
(quoted_template_end))
(block_start)
(block_end))))
================================================================================
block with attribute
================================================================================
@@ -166,8 +185,8 @@ locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") }
(template_literal)
(quoted_template_end))))
(expression
(template_expr
(quoted_template
(literal_value
(string_lit
(quoted_template_start)
(quoted_template_end)))))))))
(block_end))))

View File

@@ -126,8 +126,8 @@ resource "azurerm_storage_blob" "proxy_cert" {
(identifier))
(get_attr
(identifier))
(template_expr
(quoted_template
(literal_value
(string_lit
(quoted_template_start)
(quoted_template_end))))))
(expression
@@ -158,8 +158,8 @@ resource "azurerm_storage_blob" "proxy_cert" {
(identifier))
(get_attr
(identifier))
(template_expr
(quoted_template
(literal_value
(string_lit
(quoted_template_start)
(quoted_template_end))))))
(expression
@@ -203,8 +203,8 @@ resource "azurerm_storage_blob" "proxy_cert" {
(identifier))
(get_attr
(identifier))
(template_expr
(quoted_template
(literal_value
(string_lit
(quoted_template_start)
(quoted_template_end))))))
(expression
@@ -259,8 +259,8 @@ resource "azurerm_storage_blob" "proxy_cert" {
(identifier))
(get_attr
(identifier))
(template_expr
(quoted_template
(literal_value
(string_lit
(quoted_template_start)
(quoted_template_end))))))
(expression
@@ -315,8 +315,8 @@ resource "azurerm_storage_blob" "proxy_cert" {
(identifier))
(get_attr
(identifier))
(template_expr
(quoted_template
(literal_value
(string_lit
(quoted_template_start)
(quoted_template_end))))))
(expression
@@ -396,16 +396,16 @@ resource "azurerm_storage_blob" "proxy_cert" {
(identifier))
(get_attr
(identifier))
(template_expr
(quoted_template
(literal_value
(string_lit
(quoted_template_start)
(quoted_template_end)))))
(variable_expr
(identifier))))
(get_attr
(identifier))
(template_expr
(quoted_template
(literal_value
(string_lit
(quoted_template_start)
(quoted_template_end))))))
(expression

View File

@@ -1,3 +1,21 @@
================================================================================
empty string
================================================================================
foo = ""
--------------------------------------------------------------------------------
(config_file
(body
(attribute
(identifier)
(expression
(literal_value
(string_lit
(quoted_template_start)
(quoted_template_end)))))))
================================================================================
unescaped tab
================================================================================