Skip to content

Commit

Permalink
misc: anonymize _identifier_or_anon_field
Browse files Browse the repository at this point in the history
  • Loading branch information
ArArgon committed Jul 30, 2024
1 parent b517046 commit e1b504e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 41 deletions.
7 changes: 4 additions & 3 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,18 +310,19 @@ module.exports = grammar({
alias($.term, 'expr_term'),
),
receiver_call: $ => prec.left(expr_precedence.CALL, seq(
field('receiver', $._dot_or_index_chain), '.', field('func', $.identifier_or_anon_field),
field('receiver', $._dot_or_index_chain), '.', field('func', $._identifier_or_anon_field),
optional(field('type_generics', seq('::', $.type_args))),
field('arguments', $.call_args),
)),
mem_access: $ => prec.left(expr_precedence.CALL, seq($._dot_or_index_chain, '[', field('index', $._expr), ']')),
access_field: $ => prec.left(expr_precedence.FIELD, seq(
field('object', $._dot_or_index_chain), '.', field('field', $.identifier_or_anon_field),
field('object', $._dot_or_index_chain), '.', field('field', $._identifier_or_anon_field),
)),

// Parse an identifier or an positional field
// IdentifierOrAnonField = <Identifier> | (0-9)+
identifier_or_anon_field: $ => choice($.identifier, /\d+/),
_identifier_or_anon_field: $ => choice($.identifier, $.anon_field_index),
anon_field_index: $ => /\d+/,

// Parse an expression term:
// Term =
Expand Down
14 changes: 9 additions & 5 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 14 additions & 17 deletions src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 16 additions & 16 deletions src/parser.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e1b504e

Please sign in to comment.