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

#10 Ellipsis (...) should be expr #15

Merged
merged 2 commits into from
Apr 27, 2016
Merged

Conversation

isaiah
Copy link
Collaborator

@isaiah isaiah commented Apr 20, 2016

No description provided.

@fwierzbicki
Copy link
Member

Hi Isaiah, thanks for looking at this! There is a corner case that needs to be handled that I don't have a good answer for:

from ...foo import bar

Fails with

$ ./dist/bin/jython -S foo.py
  File "foo.py", line 1
    from ...foo import bar
        ^
SyntaxError: no viable alternative at input '...'

The parser should create a node tree that looks like:
('Module', ('body', ('ImportFrom (1,0)', ('module', 'foo'), ('names', ('alias', ('name', 'bar'), ('asname', None))), ('level', 3))))

BTW an easy way to generate the above is with a helper script at:

ast/astview.py

The script needs to be modified since pprint doesn't work right now - just remove pprint and use a basic print instead. My github credentials are goofed up right now, as soon as find some time this week I'll update astview.py this way. Anyway, if I put some code into a file called foo.py and run:

python3 ast/astview.py foo.py

I'll get the node tree as Python3 sees it, then

./dist/bin/jython -S ast/astvew.py foo.py

can be used to spot any differences. I'm guessing that you must have noticed that Jython3's site.py is broken and so we have to use -S for now.

@isaiah
Copy link
Collaborator Author

isaiah commented Apr 26, 2016

Hi @fwierzbicki , turns out I went too far with the ellipsis fix, it works once I replaced the ELLIPSIS token with DOT DOT DOT.

As for pprint in astview.py, don't worry about it, it's because site.py is broken in the master branch, I have [a branch[(https://github.com/isaiah/jython3) that has site.py working and astview.py works fine.

Thanks for pointing out the astview utility, it helped a lot.

@fwierzbicki
Copy link
Member

Hi @isaiah - Great! Which pull request includes the fix to site.py? I'll be sure to look at that one next!

@isaiah
Copy link
Collaborator Author

isaiah commented Apr 27, 2016

@fwierzbicki This is the one #19, it includes all the changes I did in order to get site.py working, the other pull requestes are code that cherry-picked from that branch.

@fwierzbicki
Copy link
Member

Ah, the entire set of pull requests gets us to site.py functioning. Great! I'll work through them as quick as I can, thanks.

@fwierzbicki fwierzbicki merged commit ba36c50 into jython:master Apr 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants