add precedence to splat operators; test for associativity

This commit is contained in:
mhoffm
2021-06-18 07:29:00 +02:00
parent b793cd7c37
commit 9b79cbda48
5 changed files with 6585 additions and 6476 deletions

View File

@@ -16,8 +16,6 @@ module.exports = grammar({
name: 'hcl',
conflicts: $ => [
[$.attr_splat],
[$.full_splat],
// string literals are just quoted template without template stuff
[$.string_lit, $.quoted_template],
],
@@ -145,18 +143,15 @@ module.exports = grammar({
splat: $ => choice($.attr_splat, $.full_splat),
attr_splat: $ => seq(
'.',
'*',
attr_splat: $ => prec.right(seq(
'.*',
repeat($.get_attr),
),
)),
full_splat: $ => seq(
'[',
'*',
']',
full_splat: $ => prec.right(seq(
'[*]',
repeat(choice($.get_attr, $.index)),
),
)),
for_expr: $ => choice($.for_tuple_expr, $.for_object_expr),