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

Add "Ellipsis" for Ellipsis #1070

Merged
merged 1 commit into from Jun 29, 2019
Merged

Add "Ellipsis" for Ellipsis #1070

merged 1 commit into from Jun 29, 2019

Conversation

@corona10
Copy link
Contributor

corona10 commented Jun 29, 2019

Currently, only "..." works for Ellipsis type.
This PR will fix the RustPython to work correctly on this code.

a = Ellipsis
b = ...
a is b
Copy link
Member

windelbouwman left a comment

Instead of modifying the lexer, please add the vm.ctx.ellipsis to the builtin symbols.

The ellipsis object lives here: https://github.com/RustPython/RustPython/blob/master/vm/src/pyobject.rs#L359

It should be registered under the name Ellipsis in the builtin module here:

https://github.com/RustPython/RustPython/blob/master/vm/src/builtins.rs#L859

By introducing:

    "Ellipsis" => vm.ctx.ellipsis.clone(),

The reason for this, is that the token::Ellipsis is intended for ... . The word Ellipsis is a simple symbol.

You can leave the test case, which is very good!

parser/src/lexer.rs Outdated Show resolved Hide resolved
Currently, only "..." works for Ellipsis type.
This PR will fix this code to work.
```python
a = Ellipsis
b = ...
a is b
```
@corona10 corona10 force-pushed the corona10:ellipsis branch from f9dd9cf to 8c318dc Jun 29, 2019
@corona10

This comment has been minimized.

Copy link
Contributor Author

corona10 commented Jun 29, 2019

@windelbouwman Thank's for the review. I've updated the PR. Please take a look

@windelbouwman

This comment has been minimized.

Copy link
Member

windelbouwman commented Jun 29, 2019

Perfection!

@windelbouwman windelbouwman merged commit c7004f7 into RustPython:master Jun 29, 2019
1 of 2 checks passed
1 of 2 checks passed
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
RustPython.RustPython Build #20190629.29 succeeded
Details
@corona10 corona10 deleted the corona10:ellipsis branch Jun 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.