| Age | Commit message (Collapse) | Author |
|
[Backport #21187]
|
|
|
|
|
|
|
|
https://github.com/ruby/prism/commit/817a8e39d9
Notes:
Merged: https://github.com/ruby/ruby/pull/12358
|
|
https://github.com/ruby/prism/commit/f80026883d
Notes:
Merged: https://github.com/ruby/ruby/pull/12358
|
|
https://github.com/ruby/prism/commit/5ea6042408
|
|
Introduce StringQuery to provide methods to access some metadata
about the Ruby lexer.
https://github.com/ruby/prism/commit/d3f55b67b9
|
|
Follow up https://github.com/ruby/prism/pull/2558.
This PR removes deprecated lib/prism/translation/parser/rubocop.rb file.
The file was a workaround to allow setting `TargetRubyVersion: 80_82_73_83_77.xx` until Prism (`Prism::Translation::Parser`) is integrated into RuboCop.
RuboCop already supports Prism (`Prism::Translation::Parser`) as of https://github.com/rubocop/rubocop/pull/12724.
It has been several months since the file was deprecated in ruby/prism#2558.
And, yesterday, Prism 1.0.0 was released, but perhaps the file should have been removed before then.
Although this might be seen as incompatible with semver 1.0.0, I think there is no longer a reason to keep the file.
https://github.com/ruby/prism/commit/646a10270e
|
|
|
|
https://github.com/ruby/prism/commit/86cf82794a
|
|
https://github.com/ruby/prism/commit/08a71f6259
|
|
|
|
https://github.com/ruby/prism/commit/36c6851c85
|
|
https://github.com/ruby/prism/commit/4d8929ff6a
|
|
|
|
https://github.com/ruby/prism/commit/ee73ad757f
|
|
|
|
https://github.com/ruby/prism/commit/a298db68e3
|
|
https://github.com/ruby/prism/commit/080d84fd03
|
|
https://github.com/ruby/prism/commit/c9edeef91a
|
|
We would previously cause a stack overflow if we parsed a file that
was too deeply nested when we were calling inspect. Instead, we now
use a queue of commands to do it linearly so we don't.
https://github.com/ruby/prism/commit/0f21f5bfe1
|
|
https://github.com/ruby/prism/commit/eadb09ef36
|
|
|
|
https://github.com/ruby/prism/commit/f3f9950a74
|
|
|
|
https://github.com/ruby/prism/commit/4da514456f
|
|
https://github.com/ruby/prism/commit/2a583b041b
|
|
https://github.com/ruby/prism/commit/34ba70c4f9
|
|
https://github.com/ruby/prism/commit/716ee0e91a
|
|
https://github.com/ruby/prism/commit/a3156e60cc
|
|
https://github.com/ruby/prism/commit/1fe507fe3d
|
|
https://github.com/ruby/prism/commit/4ef4032774
|
|
Also remove RBS for currently ignored files. Will follow-up when those
check fully in later PRs.
https://github.com/ruby/prism/commit/2cae58f86d
|
|
https://github.com/ruby/prism/commit/5fda7a0760
|
|
https://github.com/ruby/prism/commit/0209d093ec
|
|
https://github.com/ruby/prism/commit/eabed9f4fd
|
|
https://github.com/ruby/prism/commit/865b0d5fbe
|
|
|
|
https://github.com/ruby/prism/commit/207f579e70
|
|
|
|
## Summary
Fixes https://github.com/ruby/prism/pull/2356.
I'm working on integrating Prism into RuboCop.
This PR introduces `Prism::Translation::Parser33` and `Prism::Translation::Parser34`, named
in accordance with the following comments.
https://github.com/rubocop/rubocop/issues/12600#issuecomment-1932707748
Currently, `Prism::Translation::Parser` always operates in Ruby 3.4 mode.
This means it will not parse as Ruby 3.3 even if `TargetRubyVersion: 80_82_73_83_77.33` is specified.
Therefore, the `it` introduced in Ruby 3.4 is parsed incompatibly with Ruby 3.3. In Ruby 3.3,
the expected name for an `lvar` is `:it`, not `:"0it"`.
### Expected AST
The following is an expected AST when parsing Ruby 3.3 code:
```console
$ bundle exec ruby -rprism -rprism/translation/parser33 -ve "p Prism::Translation::Parser33.parse('items.map { it.do_something }')"
ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22]
s(:block,
s(:send,
s(:send, nil, :items), :map),
s(:args),
s(:send,
s(:send, nil, :it), :do_something))
```
### Actual AST
The following is an actual AST when parsing Ruby 3.3 code:
```console
$ ruby -rprism -ve "p Prism::Translation::Parser.parse('items.map { it.do_something }')"
ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22]
s(:block,
s(:send,
s(:send, nil, :items), :map),
s(:args),
s(:send,
s(:lvar, :"0it"), :do_something))
```
`Prism::Translation::Parser33` and `Prism::Translation::Parser34` aim to correspond to Ruby 3.3 and Ruby 3.4, respectively.
And, The hack of specifying `TargetRubyVersion: 80_82_73_83_77.33` is expected to become unnecessary in the future,
but the behavior will be maintained until RuboCop's support is finalized:
https://github.com/rubocop/rubocop/issues/12600#issuecomment-1933657732
## Additional Information
A private method named `convert_for_prism` is prepared to convert the `version` from Parser to the `version` expected by Prism.
For example, a Parser-compatible value is `3.3`, whereas Prism expects `"3.3.0"`.
`Parser#version` is not used in RuboCop, but it's unclear how it is utilized in other libraries that rely on the Parser gem.
Therefore, logic to maintain compatibility between Parser and Prism is implemented.
https://github.com/ruby/prism/commit/62d3991e22
|
|
|
|
https://github.com/ruby/prism/commit/1925b970c7
|
|
https://github.com/ruby/prism/commit/c0331abe4f
|
|
|
|
https://github.com/ruby/prism/commit/1a15b70a8e
|
|
|
|
|
|
https://github.com/ruby/prism/commit/8cdec8070c
|