Commit a91ffcf
mruby-compiler: fix as-pattern parsing with symbol values
Remove non-standard `symbol tASSOC p_as` rule from hash pattern
elements. This rule conflicted with the as-pattern rule and caused
`:foo => x` to be incorrectly parsed as a hash pattern instead of
an as-pattern.
CRuby only supports label syntax (foo:) for hash pattern keys,
not hashrocket syntax (:foo =>). This change aligns mruby with
CRuby behavior and reduces bison shift-reduce conflicts from 2 to 1.
Before: `case :foo; in :foo => x; end` raised NoMethodError
After: `case :foo; in :foo => x; end` binds x to :foo
Co-authored-by: Claude <noreply@anthropic.com>1 parent 4fc81e8 commit a91ffcf
2 files changed
Lines changed: 3213 additions & 3328 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4133 | 4133 | | |
4134 | 4134 | | |
4135 | 4135 | | |
| 4136 | + | |
4136 | 4137 | | |
4137 | 4138 | | |
4138 | 4139 | | |
| |||
4143 | 4144 | | |
4144 | 4145 | | |
4145 | 4146 | | |
4146 | | - | |
4147 | | - | |
4148 | | - | |
4149 | | - | |
4150 | | - | |
4151 | 4147 | | |
4152 | 4148 | | |
4153 | 4149 | | |
| |||
0 commit comments