-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Reworking some Julia AST forms #88
Labels
Milestone
Comments
This was referenced Sep 14, 2022
c42f
added a commit
that referenced
this issue
Sep 21, 2022
This allows REPL completion to work correctly. It works by pattern matching the parse tree, rather than hard coding incomplete expression detection into the parser itself. There's still more changes from #88 which would help make this nicer but for now it works. The tests here are somewhat derived from Base, but had to be reviewed and tweaked because they turn out to not really be consistent. For example, "begin;" and "begin" are both the prefix of a block construct, one of them shouldn't come out as `:other`.
This was referenced Oct 21, 2022
This was referenced Oct 31, 2022
This was referenced Mar 14, 2023
This was referenced Mar 28, 2023
c42f
added a commit
that referenced
this issue
Apr 23, 2023
Copy this list from issue #88 to the docs.
I think this is done for now. It's become quite an epic list of changes 😬 There might be more but they can go in separate issues I guess. |
c42f
added a commit
that referenced
this issue
Apr 23, 2023
Copy this list from issue #88 to the docs.
Seems like a considerable increase in consistency! |
Thanks I hope so! It added up to a lot of rearrangement :-) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With JuliaSyntax, we've got our own green tree (
GreenNode
) and AST (SyntaxNode
) which often differ fromExpr
, due to the requirement that children are strictly in source order. Some current differences are described in https://github.com/JuliaLang/JuliaSyntax.jl#tree-differences-between-greennode-and-expr. Given that we've been forced to diverge we might as well make the most of this and reconsider some aspects ofExpr
for two reasons::if
forExpr
users)List of possible changes
Expr
to holdLineNumberNode
. Avoid this!let
argument lists (Always emit a block forlet
binding lists #126)elseif
conditional has a block for the line number->
has a block only for the body line numberK"String"
token. See Always use string nodes wrapping string chunks #94)K"char"
for containing characters along with their delimiters?). See Split char delimiters early and emit K"char" node #121K"
"or add
K"backticks"`?)var""
syntax (useK"var"
? as the head?) (Wrapvar""
nonstandard identifiers in var nodes #127)K"macrocall"
- allow users to easily distinguish macrocalls with parentheses from those without them (Add PARENS_FLAG to tuple, block and macrocall #218)K"parens"
)K"?"
for head of ternary conditional #85)global const
is normalized toconst global
in the parser. Should be done inExpr
conversion (Fix const struct field errors + cleanupglobal const
AST #130)do
seems partially lowered. Should it be flatter likef(x) do y ; body end
being(do (call f) (tuple y) (block body))
? (Parsedo
syntax without desugaring the closure #98)@.
to@__dot__
later, not inside parserCore.@doc
later, not inside parser (Parse docstring attachment asK"doc"
kind #217)a .+ b
is inconsistent with prefix calls likef.(a, b)
(see Rework handling of.
tokenization and dotted operator calls #90).*(x,y) ==> (call .* x y)
vs(.*)(x,y) ==> (call (. *) x y)
ie, there's a dotted symbol vsExpr(:.)
in these cases (see discussion in Rework handling of.
tokenization and dotted operator calls #90)=
vskw
(AST inconsistency between parsing of=
vskw
#99)call
head rather than as a syntactic operator for consistency with suffixed versions likex'ᵀ
(Record fixity of call type in flags #124 )(a=1, b=2; c=3; d=4)
are a weird nested structure. Let's flatten this and bring the multiple sets of `K"parameters" into the parent tuple. (More flattened form for multiple frakentuple parameters #133)try body1 catch exc body2 else body3 finally body4 end
to(try body1 (catch exc body2) (else body3) (finally body4))
(Simplify child layout fortry
#234)import A.b.c
are different from normalA.b.c
. Use a different head for these.mutable
is present in astruct
and whether a module is actuallybaremodule
. These seem more like part of the expression head - would they be better as flags?Considered and rejected for now
:toplevel
expressions occur both at file scope and as;
-delimited expressions at file scope. This seems kind of weird?global x,y
vsglobal x
vsglobal (x,y) = (1,2)
vsglobal (x,y)
? (In particular, the variables might or might not be enclosed in a tuple.)Core.@cmd
later, not inside parsermacrocall
later, not inside parserK"infix_call"
? (considered and decided against in AST inconsistency between parsing of=
vskw
#99 and Record fixity of call type in flags #124)The text was updated successfully, but these errors were encountered: