Skip to content

Commit bfd7b50

Browse files
committed
Create a hidden rule for the "method" sequence
1 parent 5b5c966 commit bfd7b50

File tree

3 files changed

+2685
-2670
lines changed

3 files changed

+2685
-2670
lines changed

grammar.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,7 @@ module.exports = grammar({
7979
function_definition_statement: ($) =>
8080
seq("function", field("name", $.function_identifier), $._function_body),
8181
function_identifier: ($) =>
82-
seq(
83-
_list($.identifier, "."),
84-
optional(seq(":", field("method", $.identifier))),
85-
),
82+
seq(_list($.identifier, "."), optional($._method)),
8683

8784
for_generic_statement: ($) =>
8885
seq(
@@ -269,9 +266,10 @@ module.exports = grammar({
269266
function_call: ($) =>
270267
seq(
271268
$._prefix_expression,
272-
optional(seq(":", field("method", $.identifier))),
269+
optional($._method),
273270
field("arguments", $.argument_list),
274271
),
272+
_method: ($) => seq(":", field("method", $.identifier)),
275273
argument_list: ($) =>
276274
choice(seq("(", optional($.expression_list), ")"), $.table, $.string),
277275
expression_list: ($) => _list($.expression, ","),

src/grammar.json

Lines changed: 21 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)