unified: Promote enum_type_parameter to named and add fields

This commit is contained in:
Taus
2026-05-12 14:55:35 +00:00
parent 5e14a7574e
commit e1a0e204b1
2 changed files with 15 additions and 13 deletions

View File

@@ -1699,20 +1699,17 @@ module.exports = grammar({
enum_type_parameters: ($) =>
seq(
"(",
optional(
sep1(
seq(
optional(
seq(optional($.wildcard_pattern), $.simple_identifier, ":")
),
$.type,
optional(seq($._equal_sign, $.expression))
),
","
)
),
optional(sep1(field("parameter", $.enum_type_parameter), ",")),
")"
),
enum_type_parameter: ($) =>
seq(
optional(
seq(optional(field("external_name", $.wildcard_pattern)), field("name", $.simple_identifier), ":")
),
field("type", $.type),
optional(seq($._equal_sign, field("default_value", $.expression)))
),
protocol_declaration: ($) =>
prec.right(
seq(

View File

@@ -268,8 +268,13 @@ named:
modifiers?: modifiers
name+: simple_identifier
raw_value*: expression
enum_type_parameter:
default_value?: expression
external_name?: wildcard_pattern
name?: simple_identifier
type: type
enum_type_parameters:
$children*: [expression, type, wildcard_pattern]
parameter*: enum_type_parameter
equality_constraint:
attribute*: attribute
constrained_type: [identifier, nested_type_identifier]