simplify object elements

This commit is contained in:
mhoffm
2021-06-18 07:20:55 +02:00
parent f4b4b4f026
commit b793cd7c37
5 changed files with 3653 additions and 3709 deletions

View File

@@ -16,8 +16,6 @@ module.exports = grammar({
name: 'hcl', name: 'hcl',
conflicts: $ => [ conflicts: $ => [
[$.body],
[$.object_elem, $.variable_expr],
[$.attr_splat], [$.attr_splat],
[$.full_splat], [$.full_splat],
// string literals are just quoted template without template stuff // string literals are just quoted template without template stuff
@@ -136,7 +134,7 @@ module.exports = grammar({
_object_end: $ => '}', _object_end: $ => '}',
object_elem: $ => seq( object_elem: $ => seq(
choice($.identifier, $.expression), $.expression,
choice('=', ':'), choice('=', ':'),
$.expression, $.expression,
), ),

View File

@@ -414,17 +414,8 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "CHOICE", "type": "SYMBOL",
"members": [ "name": "expression"
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SYMBOL",
"name": "expression"
}
]
}, },
{ {
"type": "CHOICE", "type": "CHOICE",
@@ -1219,13 +1210,6 @@
} }
], ],
"conflicts": [ "conflicts": [
[
"body"
],
[
"object_elem",
"variable_expr"
],
[ [
"attr_splat" "attr_splat"
], ],

View File

@@ -507,10 +507,6 @@
{ {
"type": "expression", "type": "expression",
"named": true "named": true
},
{
"type": "identifier",
"named": true
} }
] ]
} }

File diff suppressed because it is too large Load Diff

View File

@@ -118,7 +118,9 @@ foo = "${ {a=b}[a] }"
(collection_value (collection_value
(object (object
(object_elem (object_elem
(identifier) (expression
(variable_expr
(identifier)))
(expression (expression
(variable_expr (variable_expr
(identifier)))))) (identifier))))))