Skip to content

Commit

Permalink
mostly fixed receiver handling
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzojive committed Oct 9, 2024
1 parent 081c770 commit 085ea25
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ module.exports = grammar({
// ambiguity between associating type modifiers
[$.not_nullable_type],

[$._receiver_type],
[$._receiver_type, $._type],
[$.receiver_type],
[$.receiver_type, $._type],
],

externals: $ => [
Expand Down Expand Up @@ -340,7 +340,7 @@ module.exports = grammar({
optional(seq("=", $._expression))
),

_receiver_type: $ => seq(
receiver_type: $ => seq(
optional($.type_modifiers),
choice (
$.parenthesized_type,
Expand All @@ -353,7 +353,7 @@ module.exports = grammar({
optional($.modifiers),
"fun",
optional($.type_parameters),
optional(seq($._receiver_type, optional('.'))),
optional(seq(field("receiver", $.receiver_type), optional('.'))),
$.simple_identifier,
$.function_value_parameters,
optional(seq(":", $._type)),
Expand All @@ -373,7 +373,7 @@ module.exports = grammar({
optional($.modifiers),
$.binding_pattern_kind,
optional($.type_parameters),
optional(seq($._receiver_type, optional('.'))),
optional(seq(field("receiver", $.receiver_type), optional('.'))),
choice($.variable_declaration, $.multi_variable_declaration),
optional($.type_constraints),
optional(choice(
Expand Down Expand Up @@ -516,8 +516,7 @@ module.exports = grammar({
_type_projection_modifier: $ => $.variance_modifier,

function_type: $ => seq(
// TODO: [receiverType {NL} '.' {NL}] functionTypeParameters {NL} '->' {NL} type
optional(seq($._receiver_type, ".")), // TODO: Support "real" types
optional(seq(field("receiver", $.receiver_type), ".")),
$.function_type_parameters,
"->",
$._type
Expand Down

0 comments on commit 085ea25

Please sign in to comment.