| Age | Commit message (Collapse) | Author |
|
Prism::Translation::Ripper"
This reverts commit 58f1127b51cf4fbb1f334f8701a041f40701dca2.
|
|
Prism::Translation::Ripper"
This reverts commit 35a7b5159f39de2cac848c072674e5350cc41aa4.
This broke syntax_suggest.
https://github.com/ruby/ruby/actions/runs/21167011751/job/60874111912
|
|
Prism::Translation::Ripper
* Handle line continuations.
* Handle space at the end of file in LexCompat.
https://github.com/ruby/prism/commit/32bd13eb7d
Co-authored-by: Earlopain <14981592+Earlopain@users.noreply.github.com>
|
|
accesses to offsets
https://github.com/ruby/prism/commit/ff81a29ba5
|
|
`RipperTest` already does this (added in https://github.com/ruby/prism/pull/3849)
Since it doesn't use the token classes, it also lists out all the excludes instead of just claiming some are passing.
https://github.com/ruby/prism/commit/e86a28263c
|
|
https://github.com/ruby/prism/commit/2792ac78ca
|
|
The filter class is a 1:1 copy of ruby.
rdoc has 32 test failures. It seems to expect `on_sp` in some cases to render code as written.
https://github.com/ruby/prism/commit/74bb12c825
|
|
It's public API and trivial to implement.
https://github.com/ruby/prism/commit/e77545f8b5
|
|
Followup to https://github.com/ruby/prism/pull/3827
It sets the start to the opening but it should instead just
continue on as usual.
Fixes https://github.com/ruby/prism/issues/3851
Notice how the AST actually contains "123" in both the body and end keyword.
https://github.com/ruby/prism/commit/8f69c5af08
|
|
This is everything that `irb` uses. It works in their test-suite, but there are 20 failures when using the shim that I haven't looked into at all.
`parse` is not used by `irb`. `scan` is, and it's basically `parse` but also including errors. `irb` doesn't seem to care about the errors, so I didn't implement that.
https://github.com/ruby/prism/commit/2c5826b39f
|
|
It is for example used by `irb`, `rdoc`, `syntax_suggest`
https://github.com/ruby/prism/commit/255aeb2485
|
|
One per version seems excessive.
Do note that `rubocop-ast` used to require individual parser files. I wouldn't consider that to be part of the API since everything is autoloaded.
From a GitHub code search, I didn't find anyone else doing it like that.
https://github.com/ruby/prism/commit/458f622c34
|
|
Denominators can contain underscores in fraction part as well as other
numeric literals.
[Bug #21831]: https://bugs.ruby-lang.org/issues/21831
https://github.com/ruby/prism/commit/e247cb58c7
|
|
Ripper exposes Ripper::Lexer:State in its output, which is a bit of a problem. To make this work, I basically copy-pasted the implementation.
I'm unsure if that is acceptable and added a test to make sure that these values never go out of sync.
I don't imagine them changing often, prism maps them 1:1 for its own usage.
This also fixed the shim by accident. `Ripper.lex` went to `Translation::Ripper.lex` when it should have been the original. Removing the need for the original resolves that issue.
https://github.com/ruby/prism/commit/2c0bea076d
|
|
Ripper is either not used or loaded where it is actually needed
https://github.com/ruby/prism/commit/a73a4fb00c
|
|
This commit adds an `expect1_opening` function that expects a token and
attaches the error to the opening token location rather than the current
position. This is useful for errors about missing closing tokens, where
we want to point to the line with the opening token rather than the end
of the file.
For example:
```ruby
def foo
def bar
def baz
^ expected an `end` to close the `def` statement
^ expected an `end` to close the `def` statement
^ expected an `end` to close the `def` statement
```
This would previously produce three identical errors at the end of the
file. After this commit, they would be reported at the opening token
location:
```ruby
def foo
^~~ expected an `end` to close the `def` statement
def bar
^~~ expected an `end` to close the `def` statement
def baz
^~~ expected an `end` to close the `def` statement
```
I considered using the end of the line where the opening token is
located, but in some cases that would be less useful than the opening
token location itself. For example:
```ruby
def foo def bar def baz
```
Here the end of the line where the opening token is located would be the
same for each of the unclosed `def` nodes.
https://github.com/ruby/prism/commit/2d7829f060
|
|
https://github.com/ruby/prism/commit/166764f794
|
|
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
|