-
Notifications
You must be signed in to change notification settings - Fork 12
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
E.g. while loop not working #7
Comments
Wait for several minutes. I'm going out for some food. |
That's not caused by |
Updated , check if resolved? |
Yes, forks (checked in 1.1.0), while not for "True" (not too important for me I think, I can work around):
FYI. I'll look more at your package, but even though abandoned, I will try out too https://github.com/TotalVerb/PythonSyntax.jl It's not a substitute, while in a way if it supports more syntax, but I'll look at it at least for fun, and maybe there's something of value to know there? |
Okay, in fact you can check https://github.com/python/cpython/blob/master/Parser/Python.asdl to see what I haven't implemented yet. |
To support In Python 3.8+,
in other Python 3.x versions, it's a
And you can install Python 3.7.3 (default, Mar 27 2019, 22:11:17)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.6.1 -- An enhanced Interactive Python. Type '?' for help.
> from ast import parse as p
> from astpretty import pprint as pp
> def ppp(x): pp(p(x))
> ppp("True")
Module(
body=[
Expr(
lineno=1,
col_offset=0,
value=NameConstant(lineno=1, col_offset=0, value=True),
),
],
) Then it'll be translated into such a json in Py2Jl.jl: Dict(
:class => "Module",
:body => [
Dict(:value =>
Dict(:value => true,
:class => "NameConstant",
:lineno => 1,
:colno => 0
),
:class => "Expr",
:lineno => 1,
:colno => 0)
]) I then make a translation for such a Python 3.7 AST of Record(:class => "NameConstant", value) -> value In fact for Python 3.8+ , the way to support True is almost the same: Record(:class => "Constant", value) -> value Then I add a corresponding test: py2jl"""
def __BOND_repl():
SENTINEL = 10
while True:
break
return SENTINEL
"""
@testset "True" begin
@test __BOND_repl() == 10
end
end |
That's quite simple, isn't it? |
I thought I should let you know (and also that 1.2.0-rc3 is out): I saw in PR 31882 at Julia: I never really found out why "LoadError" was happening. or was sure what it means in general. I may look more into there there (or here). [I didn't want to put in a link here, only the number, in case it makes a link and distracts discussion there. So you have to copy paste to see the PR.] |
I just |
E.g. what doesn't work (and predictably "unexpected EOF while parsing" with one line shorter, and different error with, from the original, "while True:" ..):
The text was updated successfully, but these errors were encountered: