Replace '_typed_field' by more specific grammar

Instead of re-using a common rule, inline its definition and use
'_field_identifier' where appropriate.

This is useful for more accurate high-lighting.
This commit is contained in:
Bruno BELANYI 2022-06-03 10:40:14 +02:00
parent 5d37bf7bd1
commit da494122ea
5 changed files with 1715 additions and 1573 deletions

View file

@ -272,16 +272,17 @@ module.exports = grammar({
record_type: ($) => seq(
"{",
sepBy(",", $._typed_field),
sepBy(
",",
seq(
field("name", $._field_identifier),
":",
field("type", $._type_identifier),
),
),
"}",
),
_typed_field: ($) => seq(
field("name", $.identifier),
":",
field("type", $.identifier),
),
array_type: ($) => seq(
"array",
"of",
@ -308,7 +309,14 @@ module.exports = grammar({
parameters: ($) => seq(
"(",
sepBy(",", $._typed_field),
sepBy(
",",
seq(
field("name", $.identifier),
":",
field("type", $._type_identifier),
),
),
")",
),