unified: Add fields to inheritance specifiers and calls

This commit is contained in:
Taus
2026-05-12 14:07:58 +00:00
parent 853a98842d
commit 732cc7bee0
2 changed files with 7 additions and 8 deletions

View File

@@ -877,8 +877,8 @@ module.exports = grammar({
),
expr_hack_at_ternary_binary_call: ($) =>
seq(
$.expression,
alias($.expr_hack_at_ternary_binary_call_suffix, $.call_suffix)
field("function", $.expression),
field("suffix", alias($.expr_hack_at_ternary_binary_call_suffix, $.call_suffix))
),
expr_hack_at_ternary_binary_call_suffix: ($) =>
prec(PRECS.call_suffix, $.value_arguments),
@@ -1551,7 +1551,7 @@ module.exports = grammar({
_inheritance_specifiers: ($) =>
prec.left(sep1($._annotated_inheritance_specifier, choice(",", "&"))),
_annotated_inheritance_specifier: ($) =>
seq(repeat(field("attribute", $.attribute)), $.inheritance_specifier),
seq(repeat(field("attribute", $.attribute)), field("inherits", $.inheritance_specifier)),
inheritance_specifier: ($) =>
prec.left(
field(

View File

@@ -154,9 +154,8 @@ named:
rhs: expression
boolean_literal:
call_expression:
$children*: [call_suffix, expression]
function?: expression
suffix?: call_suffix
function: expression
suffix: call_suffix
call_suffix:
$children+: [lambda_literal, value_arguments]
name*: simple_identifier
@@ -180,10 +179,10 @@ named:
$children*: multiline_comment
member*: type_level_declaration
class_declaration:
$children*: inheritance_specifier
attribute*: attribute
body: [class_body, enum_class_body]
declaration_kind: ["actor", "class", "enum", "extension", "struct"]
inherits*: inheritance_specifier
modifiers*: [attribute, inheritance_modifier, modifiers, ownership_modifier, property_behavior_modifier]
name: [type_identifier, unannotated_type]
type_constraints?: type_constraints
@@ -481,10 +480,10 @@ named:
protocol_composition_type:
type+: unannotated_type
protocol_declaration:
$children*: inheritance_specifier
attribute*: attribute
body: protocol_body
declaration_kind: "protocol"
inherits*: inheritance_specifier
modifiers?: modifiers
name: type_identifier
type_constraints?: type_constraints