| Age | Commit message (Collapse) | Author |
|
Fixes https://github.com/ruby/prism/pull/3736.
https://github.com/ruby/prism/commit/1f5f192ab7
|
|
https://github.com/ruby/prism/commit/69abcdbb18
|
|
When there are nested capture variables inside of a pattern match
that has an alternation pattern, it is a syntax error. Currently it
only adds a syntax error when it is at the top level of the pattern.
|
|
Fixes [Bug #21661]
https://github.com/ruby/prism/commit/475fa46a82
|
|
Should fail even with `-c` option.
|
|
See https://github.com/ruby/ruby/commit/6d81969b475262aba251e99b518181bdf7c5a523
It leaves the old variant around. RuboCop for examples accesses `Prism::Translation::Parser35`
to test against ruby-head. For now I left these simply as an alias
https://github.com/ruby/prism/commit/d0a823f045
|
|
|
|
Fixes [#Bug 21660], followup to https://github.com/ruby/prism/pull/3674
https://github.com/ruby/prism/commit/fb445a49e5
Co-Authored-By: tomoya ishida <tomoyapenguin@gmail.com>
|
|
In the case of attribute writes, there are use cases where you want
to know the location of the = sign. (Internally we actually need
this for translation to the writequark AST.)
https://github.com/ruby/prism/commit/bfc798a7ec
|
|
Followup to https://github.com/ruby/prism/pull/2213
Before:
```sh
$ ruby -ve "puts 42.~@"
ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/prism/commit/dbd83256b1) +PRISM [x86_64-linux]
-e:1:in '<main>': undefined method '~@' for an instance of Integer (NoMethodError)
Did you mean? ~
```
After (matches parse.y):
```sh
$ ./miniruby -ve "puts 42.~@"
ruby 3.5.0dev (2025-10-16T03:40:45Z master https://github.com/ruby/prism/commit/1d95d75c3f) +PRISM [x86_64-linux]
-43
```
https://github.com/ruby/prism/commit/a755bf228f
|
|
This one has been on my mind for a while now.
Currently, there are only tests against the latest syntax version.
This changes the snapshot structure as follows:
* Snapshots at their current location are tested against all syntax versions
* Snapshots inside a version folder like "3.3" are tested against all versions starting from that version
* Snapshots inside a version folder like "3.3-4.2" are tested against all versions in the given range.
This makes sure that as new syntax is added, older versions still work as expected.
I also added a few tests for now valid syntax that should be invalid in older versions (and the other way around as well)
These tests run really fast. So even though it does 3x the work for these, I am still able to run the whole test suite in just 11 seconds.
https://github.com/ruby/prism/commit/5191b1aa68
|
|
https://github.com/ruby/prism/commit/ebf4425d49
|
|
https://github.com/ruby/prism/commit/b72fcc6183
|
|
The docs currently say to use `Prism.parse(foo, version: RUBY_VERSION)` for this.
By specifying "current" instead, we can have prism raise a more specifc error.
Note: Does not use `ruby_version` from `ruby/version.h` because writing a test for that is not really possible.
`RUBY_VERSION` is nicely stubbable for both the c-ext and FFI backend.
https://github.com/ruby/prism/commit/9c5cd205cf
|
|
https://github.com/ruby/prism/commit/e7db2b06ab
|
|
behavior
https://github.com/ruby/prism/commit/0b2710a6c9
|
|
https://github.com/ruby/prism/commit/7574837b7b
|
|
type. Since a endless method is started with `=`, there was ambiguity here. We have to simply reject these in all cases.
This adds a new error for the following reason:
* `def foo arg = nil` is interpreted as a normal method call with optional `arg` without matching `end`
* `def foo *arg = nil; end` is interpreted as a endless method call that has body `nil` with extraneous `end`
`def foo *arg = nil` is somewhere inbetween and I don't know how to otherwise indicate the error.
Now the second case above also shows the newly added error message.
Fixes [Bug #21623]
https://github.com/ruby/prism/commit/e1910d4492
|
|
We need to free the current_block_exits in parse_program when we're done
with it to prevent memory leaks. This fixes the following memory leak detected
when running Ruby using `RUBY_FREE_AT_EXIT=1 ruby -nc -e "break"`:
Direct leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x5bd3c5bc66c8 in realloc (miniruby+0x616c8) (BuildId: https://github.com/ruby/prism/commit/ba6a96e5a060)
#1 0x5bd3c5f91fd9 in pm_node_list_grow prism/templates/src/node.c.erb:35:40
#2 0x5bd3c5f91e9d in pm_node_list_append prism/templates/src/node.c.erb:48:9
#3 0x5bd3c6001fa0 in parse_block_exit prism/prism.c:15788:17
#4 0x5bd3c5fee155 in parse_expression_prefix prism/prism.c:19221:50
#5 0x5bd3c5fe9970 in parse_expression prism/prism.c:22235:23
#6 0x5bd3c5fe0586 in parse_statements prism/prism.c:13976:27
#7 0x5bd3c5fd6792 in parse_program prism/prism.c:22508:40
https://github.com/ruby/prism/commit/fdf9b8d24a
|
|
Basically a redo of https://github.com/ruby/ruby/commit/a1403fb7cbd1fe0df97c932be9814c86081783dc
but respecting the frozen string literal magic comment
Fixes [Bug #21187]
|
|
This allows us to use the "last" of the enums in order to make masks,
etc. This particular commit uses the call flag's last enum field as an
offset so that we can define "private" flags but not accidentally
clobber any newly added call node flags.
https://github.com/ruby/prism/commit/e71aa980d8
|
|
arguments
https://bugs.ruby-lang.org/issues/21168#note-5
The added code samples align with `parse.y`, except for `foo(bar baz do end)` which `parse.y` currently rejects but shouldn't.
https://github.com/ruby/prism/commit/3a4e102d80
|
|
Share the empty source string in `pm_string_mapped_init` and
`pm_string_file_init`.
https://github.com/ruby/prism/commit/f7a9a03a92
|
|
https://github.com/ruby/prism/commit/2ddedf650a
|
|
and also `1 and foo = bar baz`
This is a partial fix for https://github.com/ruby/prism/issues/3106
It still accepts `a = b c and 1`
https://github.com/ruby/prism/commit/7a13d3535b
|
|
If a character literal was followed by a string concatenation, then
the forced encoding of the string concatenation could accidentally
overwrite the explicit encoding of the character literal. We now
handle this properly.
https://github.com/ruby/prism/commit/125c375d74
|
|
It is needed before updating the timestamp for prism/srcs.mk.
|
|
https://github.com/ruby/prism/commit/cac5118884
|
|
This reverts commit https://github.com/ruby/prism/commit/4052d93cf852, reversing
changes made to https://github.com/ruby/prism/commit/47143d17b3f7.
https://github.com/ruby/prism/commit/f117ec6354
|
|
|
|
|
|
https://github.com/ruby/prism/commit/194edab827
|
|
https://github.com/ruby/prism/commit/d1d2161219
|
|
This was a limitation of parse.y that prism intentionally replicated.
https://github.com/ruby/prism/commit/8fd12d594c
|
|
https://github.com/ruby/prism/commit/d2d9a1f1a7
|
|
https://github.com/ruby/prism/commit/3f58fa7705
|
|
https://github.com/ruby/prism/commit/ed8f6307c1
|
|
https://github.com/ruby/prism/commit/0d94291416
|
|
https://github.com/ruby/prism/commit/af9047f378
|
|
https://github.com/ruby/prism/commit/a0cc316e91
|
|
https://github.com/ruby/prism/commit/9b7dfcc3e0
|
|
https://github.com/ruby/prism/commit/c80c4d958e
|
|
https://github.com/ruby/prism/commit/193984b760
|
|
https://github.com/ruby/prism/commit/03ca35b3ab
|
|
This reverts commit 5a2cedd051634d6d1c8fbf48b0327f8cd8eec495.
The CI is telling us to revert the diff:
https://github.com/ruby/ruby/actions/runs/17679836157/job/50251138515
|
|
|
|
The same also applies to `break`/`next`.
https://bugs.ruby-lang.org/issues/21540
https://github.com/ruby/prism/commit/3a38b192e3
|
|
Previously, the location of CallNode was incorrect when it accepts a
block parameter:
```
$ ruby -rprism -e 'pp Prism.parse("foo(&blk)").value.statements.body[0]']
@ CallNode (location: (1,0)-(1,8)) # <=== It should be (1,0)-(1,9)
├── flags: ∅
├── receiver: ∅
├── call_operator_loc: ∅
├── name: :foo
├── message_loc: (1,0)-(1,3) = "foo"
├── opening_loc: (1,3)-(1,4) = "("
├── arguments: ∅
├── closing_loc: (1,8)-(1,9) = ")"
*snip*
$ ruby -rprism -e 'pp Prism.parse("foo(&blk)").value.statements.body[0].slice'
"foo(&blk"
```
Note that the slice lacks the closing parenthesis.
https://github.com/ruby/prism/commit/3c22e6fc39
|
|
|
|
Update included file list automatically.
|