Skip to content

Commit

Permalink
Add one-line pattern matching
Browse files Browse the repository at this point in the history
  • Loading branch information
aibaars committed Oct 7, 2021
1 parent 6e58b43 commit 4b044f4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,17 @@ module.exports = grammar({
alias($.yield_command, $.yield),
alias($.break_command, $.break),
alias($.next_command, $.next),
$.match_pattern,
$.test_pattern,
$._arg
),

match_pattern: $ => seq($._arg, '=>', $.p_expr),

test_pattern: $ => seq($._arg, 'in', $.p_expr),

p_expr: $ => 'TODO',

_arg: $ => choice(
$._primary,
$.assignment,
Expand Down

0 comments on commit 4b044f4

Please sign in to comment.