Commit 225cdaa
mruby-compiler: eliminate bison shift-reduce conflict for 'in'
Add precedence declarations to resolve the ambiguity between:
- One-line pattern match: `arg in pattern`
- Case/in clause: `case expr; in pattern; end`
When seeing `arg in`, the parser should shift to parse `arg in pattern`
as a complete expression (matching CRuby behavior), not reduce `arg`
to start a case clause.
Changes:
- Add keyword_in to %nonassoc precedence declarations
- Add %prec tLOWEST to the plain `arg` reduction rule
This eliminates all bison shift-reduce conflicts (was 2, now 0).
Co-authored-by: Claude <noreply@anthropic.com>1 parent a91ffcf commit 225cdaa
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2153 | 2153 | | |
2154 | 2154 | | |
2155 | 2155 | | |
2156 | | - | |
| 2156 | + | |
2157 | 2157 | | |
2158 | 2158 | | |
2159 | 2159 | | |
| |||
2447 | 2447 | | |
2448 | 2448 | | |
2449 | 2449 | | |
2450 | | - | |
| 2450 | + | |
2451 | 2451 | | |
2452 | 2452 | | |
2453 | 2453 | | |
| |||
0 commit comments