JuliaSyntax.jl
JuliaSyntax.jl copied to clipboard
Additional :block for non-standard for loops compared to flisp
flisp:
julia> Meta.show_sexpr(Meta.parse("for f() = 1:3; f(); end"))
(:for, (:(=), (:call, :f), (:call, :(:), 1, 3)), (:block,
:(#= none:1 =#),
(:call, :f),
:(#= none:1 =#)
))
JuliaSyntax#main:
julia> Meta.show_sexpr(JuliaSyntax.parse(Expr, "for f() = 1:3; f(); end"))
(:for, (:(=), (:call, :f), (:block,
:(#= line 1 =#),
(:call, :(:), 1, 3)
)), (:block,
:(#= line 1 =#),
(:call, :f),
:(#= line 1 =#)
))
Is this an intentional change?
This was kind of intentional - normally function definitions in short form like f() = 1:3 get a block on the right hand side to hold the definition location of the function.
In a for loop, that definition location just goes missing with the flisp parser for no good reason.