| Age | Commit message (Collapse) | Author |
|
Redo of https://github.com/ruby/prism/pull/3669 with more tests
https://github.com/ruby/prism/commit/48b403ea79
|
|
https://github.com/ruby/prism/commit/138db9ccc4
|
|
* assert_raise's 2nd argument is the failure message,
shown when the expected exception is not raised.
It's not the expected message.
See https://github.com/test-unit/test-unit/issues/347
https://github.com/ruby/prism/commit/e3df994d47
|
|
The lexer did not jump to the `heredoc_end`, causing the heredoc end delimiter
to be parsed twice.
Normally the heredocs get flushed when a newline is encountered. But because
the newline is part of the string delimiter, that codepath is not taken.
Fixes [Bug #21758]
https://github.com/ruby/prism/commit/7440eb4b11
|
|
Mostly not having to list version-specific excludes when testing against ripper/parse.y
Also don't test new syntax additions against the parser gems. The version support
for them may (or may not) be expanded but we shouldn't bother while the ruby version
hasn't even released yet.
(ruby_parser translation is not versioned, so let as is for now)
I also removed excludes that have since been implemented by parse.y
https://github.com/ruby/prism/commit/e5a0221c37
|
|
The unicode version has been updated upstream, which means new
codepoints mapped to alpha/alnum/isupper flags. We need to update
our tables to match.
I'm purposefully not adding a version check here, since that is
such a large amount of code. It's possible that we could include
different tables depending on a macro (like UNICODE_VERSION) or
something to that effect, but it's such a minimal impact on the
running of the actual parser that I don't think it's necessary.
https://github.com/ruby/prism/commit/78925fe5b6
|
|
If we are about to delete a call operator write argument, it needs
to be removed from the list of block exits as well.
https://github.com/ruby/prism/commit/ebc91c2e39
|
|
https://github.com/ruby/prism/commit/e3e2b1ed04
|
|
When a pattern match is using a string as a hash pattern key and is
using it incorrectly, we were previously assuming it was a symbol.
In the case of an error, that's not the case. So we need to add a
missing node in this case.
https://github.com/ruby/prism/commit/f0b06d6269
|
|
https://github.com/ruby/prism/commit/fef2c20777
|
|
They were being parsed as `p((p a, &block) => value)`.
When we get to this point, we must not just have parsed a command call, always consuming the `=>` is not correct.
Closes [Bug #21622]
https://github.com/ruby/prism/commit/796ab0edf4
|
|
related to #2667
https://github.com/ruby/prism/commit/44f075bae4
|
|
https://github.com/ruby/prism/commit/b00d098f9a
|
|
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>
|
|
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
|
|
https://github.com/ruby/prism/commit/17a6a19bbae5c8b438a94816ed67c3852547d859 broke ruby/ruby CI
because some tests are only run against parse.y
This will catch that in the future.
https://github.com/ruby/prism/commit/98e1cd5c04
|
|
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/34428946db
|
|
https://github.com/ruby/prism/commit/44c4306247
|
|
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
|
|
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
|
|
to https://github.com/ruby/prism/commit/c89ca2af12ba20b4fd2c5ff43ebe25da1d81d8db
|
|
https://github.com/ruby/prism/commit/d1b22f59a0
|
|
https://github.com/ruby/prism/commit/cb27f5a70a
|
|
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
|
|
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
|
|
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
|
|
This was a limitation of parse.y that prism intentionally replicated.
https://github.com/ruby/prism/commit/8fd12d594c
|
|
https://github.com/ruby/prism/commit/3f58fa7705
|
|
The same also applies to `break`/`next`.
https://bugs.ruby-lang.org/issues/21540
https://github.com/ruby/prism/commit/3a38b192e3
|
|
Generally I have been good about safely accessing the tokens but failed
to properly guard against no tokens in places
where it could theoretically happen through invalid syntax.
I added a test case for one occurance, other changes are theoretical only.
https://github.com/ruby/prism/commit/4a3866af19
|
|
https://github.com/ruby/prism/commit/a6b448b10f
|
|
https://github.com/ruby/prism/commit/659d769621
|
|
Currently Prism returns `42` for code like this:
```ruby
42.tap { it = it; p it } # => 42
```
But parse.y returns `nil`:
```ruby
42.tap { it = it; p it } # => nil
```
In parse.y, it on the right-hand side is parsed as a local variable.
In Prism, it was parsed as the implicit block parameter it, which caused this inconsistent behavior.
This change makes the right-hand side it to be parsed as a local variable, aligning with parse.y's behavior.
Bug ticket: https://bugs.ruby-lang.org/issues/21139
https://github.com/ruby/prism/commit/cf3bbf9d2c
|
|
https://github.com/ruby/prism/commit/915f6b3ae9
|
|
https://github.com/ruby/prism/commit/27d284bbb8
|
|
https://github.com/ruby/prism/commit/f5ded5104d
|
|
command calls
https://github.com/ruby/prism/commit/d9151b8a82
|
|
A command-call-like `not true` must be rejected after `&&` and `||`.
https://bugs.ruby-lang.org/issues/21337
https://github.com/ruby/prism/commit/0513cf22ad
|
|
https://github.com/ruby/prism/commit/7362b114a3
|
|
https://github.com/ruby/prism/commit/c2e372a8d8
|
|
Previously, endless method definitions in assignment contexts like
`x = def f = p 1` would fail to parse because command calls (method
calls without parentheses) were only accepted when the surrounding
binding power was less than `PM_BINDING_POWER_COMPOSITION`.
This fix specifically checks for assignment context and allows command
calls in those cases while maintaining the existing behavior for other
contexts. This ensures that:
- `x = def f = p 1` parses correctly (previously failed)
- `private def f = puts "Hello"` still produces the expected error
https://github.com/ruby/prism/commit/722af59ba3
|
|
Strings concatenated with backslash may end up being frozen when they
shouldn't be. This commit fixes the issue. It required a change
upstream in Prism, but also a change to the Prism compiler in CRuby.
https://github.com/ruby/prism/pull/3606
[Bug #21187]
|
|
This reverts commit a495e6a44ce8cff17461b250e32ab63e409a642d.
This break extension builds:
```
/Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:321:in 'String#replace': can't modify frozen String: "$(SDKROOT)$(prefix)/include" (FrozenError)
from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:321:in 'RbConfig.expand'
from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:314:in 'block in RbConfig.expand'
from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:307:in 'String#gsub'
from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:307:in 'RbConfig.expand'
from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:314:in 'block in RbConfig.expand'
from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:307:in 'String#gsub'
from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:307:in 'RbConfig.expand'
from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:314:in 'block in RbConfig.expand'
from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:307:in 'String#gsub'
from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:307:in 'RbConfig.expand'
from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:325:in 'block in <module:RbConfig>'
from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:324:in 'Hash#each_value'
from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:324:in '<module:RbConfig>'
from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:11:in '<top (required)>'
from ./ext/extmk.rb:42:in 'Kernel#require'
from ./ext/extmk.rb:42:in '<main>'
make[1]: *** [ext/configure-ext.mk:70: ext/json/exts.mk] Error 1
```
|