Skip to content

fix(parser): accept four constructs MRI allows but the parser rejected - #20

Merged
tannevaled merged 1 commit into
mainfrom
fix/robustness-batch
Aug 30, 2026
Merged

tannevaled merged 1 commit into
mainfrom
fix/robustness-batch

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

Four unrelated syntax gaps, each of which made whole ruby/spec files fail to load; all now parse as MRI 4.0.6 does, each with a test:

  • return/break/next *ary — a *splat jump value gathers into an implicit array (return [*ary]), like x = *ary.
  • { |a,| } — a trailing comma in a block parameter list forces array destructuring of a single argument (equivalent to an anonymous rest |a, *|), so [1, 2] yields a == 1.
  • cond ? next : x — a bare value-less control-flow jump is allowed as a ternary arm (reusing valuelessJumpOperand, already used for &&/|| operands).
  • :$~ :$! :$-w :$1 — symbols naming the special / option / match-group global variables now lex, mirroring the global-variable lexer.

go vet, the full suite and the 100% merged-coverage gate stay green.

Four unrelated syntax gaps, each of which made whole ruby/spec files fail
to load; all are now parsed as MRI 4.0.6 does, with tests:

  * `return/break/next *ary` — a `*splat` jump value gathers into an
    implicit array (`return [*ary]`), like `x = *ary`.
  * `{ |a,| }` — a trailing comma in a block parameter list forces array
    destructuring of a single argument (equivalent to an anonymous rest
    `|a, *|`), so `[1, 2]` yields `a == 1`.
  * `cond ? next : x` — a bare value-less control-flow jump is allowed as
    a ternary arm (reusing valuelessJumpOperand, already used for
    `&&`/`||` operands).
  * `:$~` `:$!` `:$-w` `:$1` — symbols naming the special/option/match
    global variables now lex, mirroring the global-variable lexer.

go vet, the full suite and the 100% merged-coverage gate stay green.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit 1c5d470 into main Aug 30, 2026
11 checks passed
@tannevaled
tannevaled deleted the fix/robustness-batch branch August 30, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant