Add 'property' alias

It makes the syntax tree more readable.
This commit is contained in:
Bruno BELANYI 2024-04-08 01:49:24 +01:00
parent 644f6483fe
commit 2549f6f0db
6 changed files with 210 additions and 284 deletions

View file

@ -41,14 +41,18 @@ module.exports = grammar({
_old_module: ($) => seq(
field("type", $.identifier),
"{",
optional(commaSeparated(field("property", $._colon_property))),
optional(commaSeparated(
alias(field("property", $._colon_property), $.property)
)),
"}",
),
_new_module: ($) => seq(
$.identifier,
"(",
optional(commaSeparated(field("property", $._equal_property))),
optional(commaSeparated(
alias(field("property", $._equal_property), $.property)
)),
")",
),
@ -175,7 +179,9 @@ module.exports = grammar({
map_expression: ($) => seq(
"{",
optional(commaSeparated(field("property", $._colon_property))),
optional(commaSeparated(
alias(field("property", $._colon_property), $.property)
)),
"}",
),