Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+ ruby28.y: add right hand assignment #682

Merged
merged 1 commit into from Apr 30, 2020
Merged

Conversation

@palkan
Copy link
Contributor

palkan commented Apr 29, 2020

Closes #668.

@palkan palkan force-pushed the ruby-next:feat/rhs branch from 639c621 to e0a3e16 Apr 29, 2020
@palkan
Copy link
Contributor Author

palkan commented Apr 29, 2020

Here is an example usage: ruby-next/ruby-next#38

@iliabylich
Copy link
Collaborator

iliabylich commented Apr 29, 2020

@palkan Could you merge #676 first please? There are conflicts and it's better to merge PRs one by one

@palkan
Copy link
Contributor Author

palkan commented Apr 29, 2020

@iliabylich Here is a dual PR for the next grammar: https://github.com/ruby-next/parser/pull/4/files.

(I switched to using a separate grammar file for Ruby Next, which is based on the current master's ruby28.y. Endless def (#676) has been already merged ruby-next#3)

@iliabylich
Copy link
Collaborator

iliabylich commented Apr 29, 2020

I don't follow how's it related to #676 and this PR. They should be merged one by one and #676 is still open.

Could you rebase #676 and mark PR as "ready or review"? If "merge" button is locked for you just LMK and I'll merge it by myself.

@palkan
Copy link
Contributor Author

palkan commented Apr 29, 2020

I don't follow how's it related to #676 and this PR.

Sorry, I thought you meant merging into my fork here, since I don't have merge permissions here.

@palkan palkan marked this pull request as ready for review Apr 29, 2020
@iliabylich
Copy link
Collaborator

iliabylich commented Apr 29, 2020

^ That's what I was talking about 😄 Could you rebase please?

@palkan palkan force-pushed the ruby-next:feat/rhs branch from e0a3e16 to 534941f Apr 30, 2020
@palkan
Copy link
Contributor Author

palkan commented Apr 30, 2020

Done!

Copy link
Collaborator

iliabylich left a comment

LGTM overall

(mrasgn (send (int 13) :divmod (int 5)) (mlhs (lvasgn :a) (lvasgn :b)))
"13.divmod(5) => a,b"
~~~~~~~~~~~~~~~~~~~ expression
^^ operator},

This comment has been minimized.

Copy link
@iliabylich

iliabylich Apr 30, 2020

Collaborator

}, copy-paste artifact?

This comment has been minimized.

Copy link
@palkan

palkan Apr 30, 2020

Author Contributor

Looks so. Fixed.

@palkan palkan force-pushed the ruby-next:feat/rhs branch from 534941f to c84f370 Apr 30, 2020
Copy link
Collaborator

iliabylich left a comment

👍

@iliabylich iliabylich changed the title Right hand assignment + ruby28.y: add right hand assignment Apr 30, 2020
@iliabylich iliabylich merged commit 68c21e2 into whitequark:master Apr 30, 2020
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@iliabylich
Copy link
Collaborator

iliabylich commented Apr 30, 2020

Thanks!

@palkan palkan deleted the ruby-next:feat/rhs branch Apr 30, 2020
koic added a commit to koic/rubocop-ast that referenced this pull request Aug 3, 2020
This PR supports right hand assignment for Ruby 2.8.0-dev (Ruby 3.0).
whitequark/parser#682

## `mrasgn` vs `masgn`

`mrasgn` has the same structure as `masgn` except that the child nodes
are reversed. So this PR adds `mrasgn` to the same constant as `masgn`.

### `mrasign`

```console
% ruby-parse -e '13.divmod(5) => a, b'
warning: parser/current is loading parser/ruby28, which recognizes
warning: 2.8.0-dev-compliant syntax, but you are running 2.8.0.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
(mrasgn
  (send
    (int 13) :divmod
    (int 5))
  (mlhs
    (lvasgn :a)
    (lvasgn :b)))
```

### `masign`

```console
% ruby-parse -e 'a, b = 13.divmod(5)'
warning: parser/current is loading parser/ruby28, which recognizes
warning: 2.8.0-dev-compliant syntax, but you are running 2.8.0.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
(masgn
  (mlhs
    (lvasgn :a)
    (lvasgn :b))
  (send
    (int 13) :divmod
    (int 5)))
```

## `rasgn`

`rasgn` has the same structure as `mrasgn` without `mlhs`.
So PR adds `rasgn` to the same constant as `mrasgn`.

```console
% ruby-parse -e '13.divmod(5) => a'
warning: parser/current is loading parser/ruby28, which recognizes
warning: 2.8.0-dev-compliant syntax, but you are running 2.8.0.
warning: please see
https://github.com/whitequark/parser#compatibility-with-ruby-mri.
(rasgn
  (send
    (int 13) :divmod
    (int 5))
  (lvasgn :a))
```
koic added a commit to koic/rubocop-ast that referenced this pull request Aug 3, 2020
This PR supports right hand assignment for Ruby 2.8.0-dev (Ruby 3.0).
whitequark/parser#682

## `mrasgn` vs `masgn`

`mrasgn` has the same structure as `masgn` except that the child nodes
are reversed. So this PR adds `mrasgn` to the same constant as `masgn`.

### `mrasign`

```console
% ruby-parse -e '13.divmod(5) => a, b'
warning: parser/current is loading parser/ruby28, which recognizes
warning: 2.8.0-dev-compliant syntax, but you are running 2.8.0.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
(mrasgn
  (send
    (int 13) :divmod
    (int 5))
  (mlhs
    (lvasgn :a)
    (lvasgn :b)))
```

### `masign`

```console
% ruby-parse -e 'a, b = 13.divmod(5)'
warning: parser/current is loading parser/ruby28, which recognizes
warning: 2.8.0-dev-compliant syntax, but you are running 2.8.0.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
(masgn
  (mlhs
    (lvasgn :a)
    (lvasgn :b))
  (send
    (int 13) :divmod
    (int 5)))
```

## `rasgn`

`rasgn` has the same structure as `mrasgn` without `mlhs`.
So this PR adds `rasgn` to the same constant as `mrasgn`.

```console
% ruby-parse -e '13.divmod(5) => a'
warning: parser/current is loading parser/ruby28, which recognizes
warning: 2.8.0-dev-compliant syntax, but you are running 2.8.0.
warning: please see
https://github.com/whitequark/parser#compatibility-with-ruby-mri.
(rasgn
  (send
    (int 13) :divmod
    (int 5))
  (lvasgn :a))
```
marcandre added a commit to rubocop-hq/rubocop-ast that referenced this pull request Aug 3, 2020
This PR supports right hand assignment for Ruby 2.8.0-dev (Ruby 3.0).
whitequark/parser#682

## `mrasgn` vs `masgn`

`mrasgn` has the same structure as `masgn` except that the child nodes
are reversed. So this PR adds `mrasgn` to the same constant as `masgn`.

### `mrasign`

```console
% ruby-parse -e '13.divmod(5) => a, b'
warning: parser/current is loading parser/ruby28, which recognizes
warning: 2.8.0-dev-compliant syntax, but you are running 2.8.0.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
(mrasgn
  (send
    (int 13) :divmod
    (int 5))
  (mlhs
    (lvasgn :a)
    (lvasgn :b)))
```

### `masign`

```console
% ruby-parse -e 'a, b = 13.divmod(5)'
warning: parser/current is loading parser/ruby28, which recognizes
warning: 2.8.0-dev-compliant syntax, but you are running 2.8.0.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
(masgn
  (mlhs
    (lvasgn :a)
    (lvasgn :b))
  (send
    (int 13) :divmod
    (int 5)))
```

## `rasgn`

`rasgn` has the same structure as `mrasgn` without `mlhs`.
So this PR adds `rasgn` to the same constant as `mrasgn`.

```console
% ruby-parse -e '13.divmod(5) => a'
warning: parser/current is loading parser/ruby28, which recognizes
warning: 2.8.0-dev-compliant syntax, but you are running 2.8.0.
warning: please see
https://github.com/whitequark/parser#compatibility-with-ruby-mri.
(rasgn
  (send
    (int 13) :divmod
    (int 5))
  (lvasgn :a))
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.