Skip to content
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

Failed to parse markdown doc string #503

Closed
domluna opened this issue Sep 9, 2024 · 2 comments
Closed

Failed to parse markdown doc string #503

domluna opened this issue Sep 9, 2024 · 2 comments

Comments

@domluna
Copy link

domluna commented Sep 9, 2024

julia> s = String(read("test/files/PProf.jl"))
"module PProf\n\nexport pprof, @pprof\n\nusing Profile\nusing ProtoBuf\nusing OrderedCollections\n\nusing Profile: clear\n\n\"\"\"\n    PProf.clear()\n\nAlias for `Profile.clear()`\n\"\"\"\nclear\n\n# Load in `deps.jl`, complaining if it does not exist\nconst depsjl_path = joinpath(@__DIR__, \"..\", \"deps\", \"deps.jl\")\nif !isfile(depsjl_path)\n    error(\n        \"PProf not installed properly, run Pkg.build(\\\"PProf\\\"), restart Julia and try again\",\n "  8539 bytes  "rof -http=\$webhost:\$webport \$file`))\nend\n\n\"\"\"\n    pprof_kill()\n\nKills the pprof server if running.\n\"\"\"\nfunction kill()\n    if proc[] !== nothing\n        Base.kill(proc[])\n        proc[] = nothing\n    end\nend\n\n\n\"\"\"\n    @pprof ex\n\nProfiles the expression using `@profile` and starts or restarts `pprof`.\n\"\"\"\nmacro pprof(ex)\n    esc(quote\n        \$Profile.@profile \$ex\n        \$(@__MODULE__).pprof()\n    end)\nend\n\nend # module\n"

julia> using JuliaSyntax

julia> JuliaSyntax.parseall(JuliaSyntax.GreenNode, s)
ERROR: ParseError:
# Error @ line 81:64

  - `data::Vector{UInt}`: The data provided by `Profile.fetch` \[optional\].
#                                                              └┘ ── invalid escape sequence
Stacktrace:
 [1] _parse(rule::Symbol, need_eof::Bool, ::Type{…}, text::String, 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:93
 [2] _parse (repeats 2 times)
   @ ~/.julia/packages/JuliaSyntax/BHOG8/src/parser_api.jl:77 [inlined]
 [3] parseall(::Type{JuliaSyntax.GreenNode}, text::String)
   @ JuliaSyntax ~/.julia/packages/JuliaSyntax/BHOG8/src/parser_api.jl:143
 [4] top-level scope
   @ REPL[19]:1
Some type information was truncated. Use `show(err)` to see complete types.

https://github.com/domluna/JuliaFormatter.jl/blob/master/test/files/PProf.jl

It looks like the issue is markdown formatting. This is an old file so maybe it's formatted incorrectly? This parsed fine with CSTParser.

@pfitzseb
Copy link
Member

pfitzseb commented Sep 9, 2024

This was always technically invalid:

❯ julia +1.0 -q
julia> """
         - `data::Vector{UInt}`: The data provided by `Profile.fetch` \[optional\].
       """
       function pprof() end
ERROR: syntax: invalid escape sequence

@domluna
Copy link
Author

domluna commented Sep 10, 2024

ok good to know. i guess this can be closed then.

@domluna domluna closed this as completed Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants