Reduce.jl
Reduce.jl copied to clipboard
parsing of REDUCE for expression broken in Julia 1.10
The parsing of REDUCE for statements is broken with Julia 1.10 and I am not currently planning on figuring out how to fix it:
julia> Expr(:for, :(i = 2:34), :(product(i))) |> RExpr |> Reduce.parse
:($(Expr(:incomplete, Base.Meta.ParseError("ParseError:\n# Error @ none:1:6\nfor i\n# └ ── premature end of input", Base.JuliaSyntax.ParseError(Base.JuliaSyntax.SourceFile("for i", 0, "none", 1, [1, 6]), Base.JuliaSyntax.Diagnostic[Base.JuliaSyntax.Diagnostic(6, 5, :error, "premature end of input"), Base.JuliaSyntax.Diagnostic(6, 5, :error, "invalid iteration spec: expected one of `=` `in` or `∈`"), Base.JuliaSyntax.Diagnostic(6, 5, :error, "premature end of input"), Base.JuliaSyntax.Diagnostic(6, 5, :error, "Expected `end`")], :other)))) = 2:34 * product(im))
julia> ans |> dump
Expr
head: Symbol =
args: Array{Any}((2,))
1: Expr
head: Symbol incomplete
args: Array{Any}((1,))
1: Base.Meta.ParseError
msg: String "ParseError:\n# Error @ none:1:6\nfor i\n# └ ── premature end of input"
detail: Base.JuliaSyntax.ParseError
source: Base.JuliaSyntax.SourceFile
code: SubString{String}
string: String "for i:=2:34 product(i)"
offset: Int64 0
ncodeunits: Int64 5
byte_offset: Int64 0
filename: String "none"
first_line: Int64 1
line_starts: Array{Int64}((2,)) [1, 6]
diagnostics: Array{Base.JuliaSyntax.Diagnostic}((4,))
1: Base.JuliaSyntax.Diagnostic
first_byte: Int64 6
last_byte: Int64 5
level: Symbol error
message: String "premature end of input"
2: Base.JuliaSyntax.Diagnostic
first_byte: Int64 6
last_byte: Int64 5
level: Symbol error
message: String "invalid iteration spec: expected one of `=` `in` or `∈`"
3: Base.JuliaSyntax.Diagnostic
first_byte: Int64 6
last_byte: Int64 5
level: Symbol error
message: String "premature end of input"
4: Base.JuliaSyntax.Diagnostic
first_byte: Int64 6
last_byte: Int64 5
level: Symbol error
message: String "Expected `end`"
incomplete_tag: Symbol other
2: Expr
head: Symbol call
args: Array{Any}((3,))
1: Symbol :
2: Int64 2
3: Expr
head: Symbol call
args: Array{Any}((3,))
1: Symbol *
2: Int64 34
3: Expr
head: Symbol call
args: Array{Any}((2,))
1: Symbol product
2: Symbol im