Skip to content

Commit

Permalink
Fix corner case for ctrl_match with _ and match_guard (#118)
Browse files Browse the repository at this point in the history
New test case of "match" with _ and if condition:

```nu
match $x {
   _ if $x == 4 => {},
   _ => {}
}
```

It will previously cause parsing error:

```lisp
(nu_script ; [0, 0] - [4, 0]
  (ERROR ; [0, 0] - [3, 1]
    (val_variable ; [0, 6] - [0, 8]
      name: (identifier)) ; [0, 7] - [0, 8]
    (val_variable ; [1, 7] - [1, 9]
      name: (identifier)) ; [1, 8] - [1, 9]
    (val_number) ; [1, 13] - [1, 14]
    (ERROR) ; [1, 15] - [1, 16]
    (expr_binary ; [1, 18] - [2, 9]
      lhs: (val_record) ; [1, 18] - [1, 20]
      (ERROR) ; [2, 2] - [2, 5]
      rhs: (val_record)))) ; [2, 7] - [2, 9]
```
  • Loading branch information
blindFS authored Sep 25, 2024
1 parent 705f776 commit ac6dcd1
Show file tree
Hide file tree
Showing 5 changed files with 238,623 additions and 238,565 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
1 change: 1 addition & 0 deletions grammar.js
13 changes: 13 additions & 0 deletions src/grammar.json
477,144 changes: 238,580 additions & 238,564 deletions src/parser.c
28 changes: 28 additions & 0 deletions test/corpus/ctrl/match.nu

0 comments on commit ac6dcd1

Please sign in to comment.