Skip to content

Commit 88dcdcd

Browse files
committed
Update and rename the "function_call" rule
- Rename it to "call"; - Create a separate rule for it's identifier; - Create a "function" field.
1 parent dd25903 commit 88dcdcd

File tree

6 files changed

+3512
-3335
lines changed

6 files changed

+3512
-3335
lines changed

grammar.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ module.exports = grammar({
5959
$.empty_statement,
6060
$.variable_assignment,
6161
$.local_variable_declaration,
62-
$.function_call,
62+
$.call,
6363
$.label_statement,
6464
$.goto_statement,
6565
$.break_statement,
@@ -260,19 +260,22 @@ module.exports = grammar({
260260
field_separator: () => choice(",", ";"),
261261

262262
prefix_expression: ($) =>
263-
choice($.variable, $.function_call, $.parenthesized_expression),
263+
choice($.variable, $.call, $.parenthesized_expression),
264264
_prefix_expression: ($) => prec(1, $.prefix_expression),
265+
265266
parenthesized_expression: ($) => seq("(", $.expression, ")"),
266-
function_call: ($) =>
267+
268+
call: ($) =>
267269
seq(
268-
$._prefix_expression,
269-
optional($._method),
270+
field("function", $.call_identifier),
270271
field("arguments", $.argument_list),
271272
),
273+
call_identifier: ($) => seq($._prefix_expression, optional($._method)),
272274
_method: ($) => seq(":", field("method", $.identifier)),
273275
argument_list: ($) =>
274276
choice(seq("(", optional($.expression_list), ")"), $.table, $.string),
275277
expression_list: ($) => _list($.expression, ","),
278+
276279
variable: ($) =>
277280
choice(
278281
field("name", $.identifier),

src/grammar.json

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

src/node-types.json

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

0 commit comments

Comments
 (0)