Separates extractor for each S-expression version#23
Open
chiastolite wants to merge 1 commit intotodesking:masterfrom
Open
Separates extractor for each S-expression version#23chiastolite wants to merge 1 commit intotodesking:masterfrom
chiastolite wants to merge 1 commit intotodesking:masterfrom
Conversation
massign structure patterns changed for Ruby 2.5 or later.
```
$ docker run -it --rm rubylang/all-ruby env ALL_RUBY_SINCE=ruby-2.4 ./all-ruby -rpp -rripper -e 'pp Ripper.sexp("a, (b, c) = foo")'
ruby-2.4.0 [:program,
[[:massign,
[[:@Ident, "a", [1, 0]],
[:mlhs_paren, [[:@Ident, "b", [1, 4]], [:@Ident, "c", [1, 7]]]]],
[:vcall, [:@Ident, "foo", [1, 12]]]]]]
...
ruby-2.4.9 [:program,
[[:massign,
[[:@Ident, "a", [1, 0]],
[:mlhs_paren, [[:@Ident, "b", [1, 4]], [:@Ident, "c", [1, 7]]]]],
[:vcall, [:@Ident, "foo", [1, 12]]]]]]
ruby-2.5.0-preview1 [:program,
[[:massign,
[[:var_field, [:@Ident, "a", [1, 0]]],
[:mlhs,
[:var_field, [:@Ident, "b", [1, 4]]],
[:var_field, [:@Ident, "c", [1, 7]]]]],
[:vcall, [:@Ident, "foo", [1, 12]]]]]]
...
ruby-2.7.0-rc2 [:program,
[[:massign,
[[:var_field, [:@Ident, "a", [1, 0]]],
[:mlhs,
[:var_field, [:@Ident, "b", [1, 4]]],
[:var_field, [:@Ident, "c", [1, 7]]]]],
[:vcall, [:@Ident, "foo", [1, 12]]]]]]
```
```
$ docker run -it --rm rubylang/all-ruby env ALL_RUBY_SINCE=ruby-2.4 ./all-ruby -rpp -rripper -e 'pp Ripper.sexp("a,*b=1,2")'
ruby-2.4.0 [:program,
[[:massign,
[:mlhs_add_star, [[:@Ident, "a", [1, 0]]], [:@Ident, "b", [1, 3]]],
[:mrhs_new_from_args, [[:@int, "1", [1, 5]]], [:@int, "2", [1, 7]]]]]]
...
ruby-2.4.9 [:program,
[[:massign,
[:mlhs_add_star, [[:@Ident, "a", [1, 0]]], [:@Ident, "b", [1, 3]]],
[:mrhs_new_from_args, [[:@int, "1", [1, 5]]], [:@int, "2", [1, 7]]]]]]
ruby-2.5.0-preview1 [:program,
[[:massign,
[[:var_field, [:@Ident, "a", [1, 0]]],
[:rest_param, [:var_field, [:@Ident, "b", [1, 3]]]]],
[:mrhs_new_from_args, [[:@int, "1", [1, 5]]], [:@int, "2", [1, 7]]]]]]
...
ruby-2.7.0-rc2 [:program,
[[:massign,
[[:var_field, [:@Ident, "a", [1, 0]]],
[:rest_param, [:var_field, [:@Ident, "b", [1, 3]]]]],
[:mrhs_new_from_args, [[:@int, "1", [1, 5]]], [:@int, "2", [1, 7]]]]]]
```
```
$ docker run -it --rm rubylang/all-ruby env ALL_RUBY_SINCE=ruby-2.4 ./all-ruby -rpp -rripper -e 'pp Ripper.sexp("a,b=1,2")'
ruby-2.4.0 [:program,
[[:massign,
[[:@Ident, "a", [1, 0]], [:@Ident, "b", [1, 2]]],
[:mrhs_new_from_args, [[:@int, "1", [1, 4]]], [:@int, "2", [1, 6]]]]]]
...
ruby-2.4.9 [:program,
[[:massign,
[[:@Ident, "a", [1, 0]], [:@Ident, "b", [1, 2]]],
[:mrhs_new_from_args, [[:@int, "1", [1, 4]]], [:@int, "2", [1, 6]]]]]]
ruby-2.5.0-preview1 [:program,
[[:massign,
[[:var_field, [:@Ident, "a", [1, 0]]],
[:var_field, [:@Ident, "b", [1, 2]]]],
[:mrhs_new_from_args, [[:@int, "1", [1, 4]]], [:@int, "2", [1, 6]]]]]]
...
ruby-2.7.0-preview1 [:program,
[[:massign,
[[:var_field, [:@Ident, "a", [1, 0]]],
[:var_field, [:@Ident, "b", [1, 2]]]],
[:mrhs_new_from_args, [[:@int, "1", [1, 4]]], [:@int, "2", [1, 6]]]]]]
```
This was referenced Jan 4, 2020
Collaborator
|
Thank you for your pull request, and sorry for my absence. |
Author
|
This PR contains updating todesking/patm for Named capture which supported from 2.0. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
massignstructure patterns changed for Ruby 2.5 or later.So I propose to separate
RubyHlLvar::Extractorby Ruby's version.This makes easier to introduce pattern matching for Ruby 2.7.