We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
parseatom
Printing errors arising from parseatom sometimes fails, but not parsestmt or parseall.
parsestmt
parseall
MWE:
julia> exc = try JuliaSyntax.parseatom(Expr, ")") ; catch e ; e end JuliaSyntax.ParseError(SourceFile("", 0, nothing, 1, [1, 1]), JuliaSyntax.Diagnostic[JuliaSyntax.Diagnostic(1, 0, :error, "unexpected `)`"), JuliaSyntax.Diagnostic(1, 1, :error, "unexpected text after parsing atom")], :none) julia> showerror(stdout, exc) ParseError: # Error @ line 1:1 ERROR: BoundsError: attempt to access empty SubString{String} at index [0] Stacktrace: [1] checkbounds(s::SubString{String}, I::Int64) @ Base ./strings/basic.jl:216 [inlined] [2] getindex(s::SubString{String}, i::Int64) @ Base ./strings/substring.jl:91 [3] getindex(source::SourceFile, i::Int64) @ JuliaSyntax ~/.julia/dev/JuliaSyntax/src/source_files.jl:120 [4] highlight(io::Base.TTY, source::SourceFile, range::UnitRange{…}; color::Tuple{…}, context_lines_before::Int64, context_lines_inner::Int64, context_lines_after::Int64, note::String, notecolor::Symbol) @ JuliaSyntax ~/.julia/dev/JuliaSyntax/src/source_files.jl:222 [5] kwcall(::NamedTuple, ::typeof(JuliaSyntax.highlight), io::IO, source::SourceFile, range::UnitRange) @ JuliaSyntax ~/.julia/dev/JuliaSyntax/src/source_files.jl:190 [inlined] [6] show_diagnostic(io::Base.TTY, diagnostic::JuliaSyntax.Diagnostic, source::SourceFile) @ JuliaSyntax ~/.julia/dev/JuliaSyntax/src/diagnostics.jl:76 [7] showerror(io::Base.TTY, err::JuliaSyntax.ParseError; limit::Bool) @ JuliaSyntax ~/.julia/dev/JuliaSyntax/src/parser_api.jl:21 [inlined] [8] showerror(io::Base.TTY, err::JuliaSyntax.ParseError) @ JuliaSyntax ~/.julia/dev/JuliaSyntax/src/parser_api.jl:18 [9] top-level scope @ REPL[108]:1 Some type information was truncated. Use `show(err)` to see complete types.
Found in JuliaLang/julia#50245
The text was updated successfully, but these errors were encountered:
Actually this can also happen with parsestmt if there's trailing text
julia> exc = try JuliaSyntax.parsestmt(Expr, "x\nz") ; catch e ; e end JuliaSyntax.ParseError(SourceFile("x", 0, nothing, 1, [1, 2]), JuliaSyntax.Diagnostic[JuliaSyntax.Diagnostic(3, 3, :error, "unexpected text after parsing statement")], :none) julia> showerror(stdout, exc) ParseError: ERROR: BoundsError: attempt to access 1-codeunit SubString{String} at index [2] Stacktrace: [1] _nextind_str(s::SubString{String}, i::Int64) @ Base ./strings/string.jl:177 [2] nextind(s::SubString{String}, i::Int64) @ Base ./strings/substring.jl:104 [inlined] [3] source_location(source::SourceFile, byte_index::Int64) @ JuliaSyntax ~/.julia/dev/JuliaSyntax/src/source_files.jl:64 [4] show_diagnostic(io::Base.TTY, diagnostic::JuliaSyntax.Diagnostic, source::SourceFile) @ JuliaSyntax ~/.julia/dev/JuliaSyntax/src/diagnostics.jl:61 [5] show_diagnostics(io::Base.TTY, diagnostics::Vector{JuliaSyntax.Diagnostic}, source::SourceFile) @ JuliaSyntax ~/.julia/dev/JuliaSyntax/src/diagnostics.jl:86 [6] showerror(io::Base.TTY, err::JuliaSyntax.ParseError) @ JuliaSyntax ~/.julia/dev/JuliaSyntax/src/parser_api.jl:20 [7] top-level scope @ REPL[122]:1
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Printing errors arising from
parseatom
sometimes fails, but notparsestmt
orparseall
.MWE:
Found in JuliaLang/julia#50245
The text was updated successfully, but these errors were encountered: