| Age | Commit message (Collapse) | Author |
|
https://github.com/ruby/prism/commit/c00902af23
|
|
https://github.com/ruby/prism/commit/a5c3d634ef
|
|
https://github.com/ruby/prism/commit/a3156e60cc
|
|
https://github.com/ruby/prism/commit/b7cd5c8e74
|
|
https://github.com/ruby/prism/commit/8feb073fe4
|
|
https://github.com/ruby/prism/commit/9dbad71aa3
|
|
https://github.com/ruby/prism/commit/149d01f2c9
|
|
https://github.com/ruby/prism/commit/90f8b33fad
|
|
https://github.com/ruby/prism/commit/372200f970
|
|
https://github.com/ruby/prism/commit/d31cf63d45
|
|
https://github.com/ruby/prism/commit/18dea6ce64
|
|
https://github.com/ruby/prism/commit/a76744be47
|
|
https://github.com/ruby/prism/commit/3fd962f2d3
|
|
https://github.com/ruby/prism/commit/6bd7ae2ed2
|
|
https://github.com/ruby/prism/commit/ceb5a5cf62
|
|
https://github.com/ruby/prism/commit/602d3d2ccb
|
|
https://github.com/ruby/prism/commit/c5c8299485
|
|
https://github.com/ruby/prism/commit/2d635ce46b
|
|
https://github.com/ruby/prism/commit/6611820b7b
|
|
https://github.com/ruby/prism/commit/ef9dca2a4c
|
|
https://github.com/ruby/prism/commit/7f5a09f40e
|
|
https://github.com/ruby/prism/commit/5e47d8eb67
|
|
https://github.com/ruby/prism/commit/a3c8c27c20
|
|
https://github.com/ruby/prism/commit/57c1dd4859
|
|
https://github.com/ruby/prism/commit/788cf7c528
|
|
https://github.com/ruby/prism/commit/6285e31ccc
|
|
https://github.com/ruby/prism/commit/7a277be5fb
|
|
https://github.com/ruby/prism/commit/d0dbf01bef
|
|
https://github.com/ruby/prism/commit/e1e613df16
|
|
https://github.com/ruby/prism/commit/c6c771d1fa
|
|
https://github.com/ruby/prism/commit/500099e896
|
|
https://github.com/ruby/prism/commit/369ffbd57e
|
|
https://github.com/ruby/prism/commit/4ef4032774
|
|
This PR fixes an incorrect parsing for `Prism::Translation::Parser`
when one-line pattern mathing with Ruby 2.7 runtime.
## Expected
Parsing should be done based on the specified Ruby parsing version,
independent of the Ruby runtime version. When parsing for Ruby 3.3,
it should return `:match_pattern_p` node:
```console
$ ruby -rprism -rprism/translation/parser33 -ve 'p Prism::Translation::Parser33.parse("foo in bar")'
ruby 3.0.6p216 (2023-03-30 revision https://github.com/ruby/prism/commit/23a532679b) [x86_64-darwin19]
s(:match_pattern_p,
s(:send, nil, :foo),
s(:match_var, :bar))
```
## Actual
When parsing with Ruby 2.7 runtime, `match_pattern` node is returned,
even though it is expected to parse for Ruby 3.3:
```console
$ ruby -rprism -rprism/translation/parser33 -ve 'p Prism::Translation::Parser33.parse("foo in bar")'
ruby 2.7.8p225 (2023-03-30 revision https://github.com/ruby/prism/commit/1f4d455848) [x86_64-darwin19]
s(:match_pattern,
s(:send, nil, :foo),
s(:match_var, :bar))
```
The cause was the use of `RUBY_VERSION` for condition logic,
which made it dependent on runtime Ruby version.
`Prism::Translation::Parser` supports parsing for Ruby 3.3+.
Therefore, the condition for parsing Ruby 2.7, which is not supported, is being removed.
## Background
Found due to incompatibility with RuboCop's `Layout/SpaceAroundKeyword` and `Style/TernaryParentheses` cops.
https://github.com/ruby/prism/commit/e752e251d2
|
|
https://github.com/ruby/prism/commit/e1a9a1d478
|
|
https://github.com/ruby/prism/commit/959eb506ca
|
|
https://github.com/ruby/prism/commit/8ea7a3270f
|
|
https://github.com/ruby/prism/commit/fa9a30ad91
|
|
https://github.com/ruby/prism/commit/377666a5df
|
|
https://github.com/ruby/prism/commit/865b0d5fbe
|
|
https://github.com/ruby/prism/commit/3e10c46c14
|
|
https://github.com/ruby/prism/commit/9137226a52
|
|
|
|
https://github.com/ruby/prism/commit/120d8c0479
|
|
https://github.com/ruby/prism/commit/a6a552411c
|
|
So that compilers know they need to add to add an anonymous
variable to the local table.
https://github.com/ruby/prism/commit/7f1aadd057
|
|
https://github.com/ruby/prism/commit/ea7e400f85
|
|
"unparser/corpus/literal/def.txt"
See the discussion on https://github.com/ruby/ruby/pull/9923
|
|
The previous commit changes Ripper lex state behavior of `tLABEL`.
For example, Ripper lex state for the second `bar` was changed
by the previous commit.
```
def foo(bar: bar())
end
```
Before the commit, Ripper didn’t add label `bar` id to `vtable`
because `formal_argument` function for Ripper didn’t return id
but returned `VALUE lhs`.
Therefore Ripper didn’t `SET_LEX_STATE(EXPR_END|EXPR_LABEL)` for following `bar`
in `parse_ident` because `lvar_defined` for following `bar` was not true.
Currently Ripper does `SET_LEX_STATE(EXPR_END|EXPR_LABEL)` then
the result of this test case is changed like below.
```
Prism::ParseTest#test_filepath_unparser/corpus/literal/def.txt [ruby/test/prism/parse_test.rb:280]:
<[[80, 13], :on_ident, “bar”, END|LABEL]> expected but was
<[[80, 13], :on_ident, “bar”, ARG]>.
```
Parser sets lex state to `END|LABEL` on master branch.
Therefore previous commit makes Ripper’s behavior aligned with parser’s behavior.
```
$ ruby -v -y -e "def foo(bar: bar())" -e "end"
ruby 3.4.0dev (2024-02-11T23:52:05Z master 697ade7bda) [arm64-darwin21]
...
Reading a token
parser_dispatch_scan_event:11210 (1: 12|1|7)
lex_state: ARG|LABELED -> ARG at line 11113
lex_state: ARG -> END|LABEL at line 11128
parser_dispatch_scan_event:11877 (1: 13|3|4)
Next token is token “local variable or method” (1.13-1.16: bar)
Shifting token “local variable or method” (1.13-1.16: bar)
```
|
|
https://github.com/ruby/prism/commit/17dc6b6281
|