JuliaLang / JuliaSyntax.jl

The Julia compiler frontend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`"a +\n\n>:"` and related expressions with `>:` parse incorrectly

c42f opened this issue · comments

Probably related to the case parseall(Expr, "for\n\n<:", ignore_errors=true) in #380, we have this case of misparsing, but without an error:

julia> parseall(Expr, "a +\n\n>:", ignore_errors=true)
:($(Expr(:toplevel, :(#= line 1 =#), :(+a), :(#= line 3 =#), :>:)))

julia> parseall(SyntaxNode, "a +\n\n>:", ignore_errors=true)
line:col│ tree                                   │ file_name
   1:1  │[toplevel]
   1:1  │  [call-i]
   1:1  │    a
   1:3+
   3:1>:

This seems likely to be due to the special handling of >: and <: operators.

A second evil example where we produce incorrect output:

julia> parseall(SyntaxNode, "a +\n>:", ignore_errors=true)
line:col│ tree                                   │ file_name
   1:1  │[toplevel]
   1:1  │  [call-i]
   1:1  │    a
   1:3+
   1:4  │    [>:-pre]
   2:1>: