Skip to content

Commit

Permalink
addressed review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
amchiclet committed Jan 24, 2024
1 parent bf20f0f commit 0df80d8
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lang/semgrep-grammars/src/semgrep-elixir/grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,22 @@ module.exports = grammar(base_grammar, {
// keyword/pairs, such as
// foo(some_arg: 0, ...)
// %{some_item: 0, ...}
// Also note that now there is ambiguity whether foo(...) is an
// identity or pair, we set the pair rule to have a lower
// precedence
pair: ($, previous) => {
return prec(-1, choice(
return choice(
previous,
$.semgrep_ellipsis,
));
);
},

// Note that because of the pair rule above, now there is
// ambiguity whether the ellipsis in foo(...) is an
// ellipsis for positional or keyword arguments. If ... matches
// with the identity rule, it will be considered a positional
// argument. If ... matches with semgrep_ellipsis, it will be
// part of parsing the pair rule, which means its a keyword
// argument. In practice, this doesn't matter because either
// way, they will become ParamEllipsis in the Generic AST
// anyway.
semgrep_ellipsis: $ => prec(-1, '...'),

_expression: ($, previous) => choice(
Expand Down

0 comments on commit 0df80d8

Please sign in to comment.