-
-
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
Error: JuliaSyntax parser failed — falling back to flisp! #505
Labels
bug
Something isn't working
Comments
Thanks for reporting this issue! This is a MWE reproducer for Julia: Meta.parse(split(InlineString("1 2"))[1]) And this is a MWE reproducer for JuliaSyntax: julia> JuliaSyntax.parsestmt(SyntaxNode, split(InlineString("1 2"))[1])
ERROR: MethodError: no method matching pointer(::SubString{String3})
Closest candidates are:
pointer(::Cwstring)
@ Base c.jl:187
pointer(::Base64.Buffer)
@ Base64 ~/.julia/juliaup/julia-1.10.5+0.aarch64.linux.gnu/share/julia/stdlib/v1.10/Base64/src/buffer.jl:20
pointer(::Cstring)
@ Base c.jl:186
...
Stacktrace:
[1] JuliaSyntax.ParseStream(text::SubString{String3}, index::Int64; version::VersionNumber)
@ JuliaSyntax ~/.julia/packages/JuliaSyntax/BHOG8/src/parse_stream.jl:309
[2] _parse(rule::Symbol, need_eof::Bool, ::Type{…}, text::SubString{…}, index::Int64; version::VersionNumber, ignore_trivia::Bool, filename::Nothing, first_line::Int64, ignore_errors::Bool, ignore_warnings::Bool, kws::@Kwargs{})
@ JuliaSyntax ~/.julia/packages/JuliaSyntax/BHOG8/src/parser_api.jl:80
[3] _parse(rule::Symbol, need_eof::Bool, ::Type{SyntaxNode}, text::SubString{String3}, index::Int64)
@ JuliaSyntax ~/.julia/packages/JuliaSyntax/BHOG8/src/parser_api.jl:77
[4] _parse(rule::Symbol, need_eof::Bool, ::Type{SyntaxNode}, text::SubString{String3})
@ JuliaSyntax ~/.julia/packages/JuliaSyntax/BHOG8/src/parser_api.jl:77
[5] parsestmt(::Type{SyntaxNode}, text::SubString{String3}; kws::@Kwargs{})
@ JuliaSyntax ~/.julia/packages/JuliaSyntax/BHOG8/src/parser_api.jl:140
[6] parsestmt(::Type{SyntaxNode}, text::SubString{String3})
@ JuliaSyntax ~/.julia/packages/JuliaSyntax/BHOG8/src/parser_api.jl:140
[7] top-level scope
@ REPL[4]:1
Some type information was truncated. Use `show(err)` to see complete types. The issue is that JuliaSyntax's # Buffers originating from strings
function ParseStream(text::String, index::Integer=1; version=VERSION)
ParseStream(unsafe_wrap(Vector{UInt8}, text),
text, index, version)
end
function ParseStream(text::SubString, index::Integer=1; version=VERSION) # This should be ::SubString{String}, not ::SubString.
# See also IOBuffer(SubString("x"))
ParseStream(unsafe_wrap(Vector{UInt8}, pointer(text), sizeof(text)),
text, index, version)
end
function ParseStream(text::AbstractString, index::Integer=1; version=VERSION)
ParseStream(String(text), index; version=version)
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I got this error in a large Julia codebase and cannot reproduce the issue on a small instance, but I think it is still useful to share what piece of code failed and how to work around it.
So calling the function
raised the error
at the line containing
Meta.parse(s[1])+Meta.parse(s[2])/60.0
. The error goes away ifs
is a list of Strings:I should point out that this error happens after several calls to the function with varying arguments (the function argument
time
can be aString
orDates.Time
object).Version Info:
The text was updated successfully, but these errors were encountered: