-
-
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
Newlines handled differently compared to old parser #316
Comments
Hmm yes the flisp parser is less greedy here with consuming any trailing whitespace. I don't think there's a real right or wrong here, but being more compatible is better than less. Also it makes sense to not read a (potentially) big chunk of whitespace until the caller asks for it. So it's worth looking into changing this. |
This might be related, or maybe not, but I just noticed that the manual build has heaps of errors of the form:
Simply running |
I think this is unrelated, and should already have been fixed in #317 - we just need to bump the JuliaSyntax version upstream in Julia? |
This issue is the source of CI failures on CodeTracking (which is the lowest-level package in the debugger & Revise stacks). I can presumably fix the issue in CodeTracking, but if this is something that should be changed here, I thought it best to check. MWE that mimics the test failure in CodeTracking: julia 1.9Does not include the comment that follows the method definition: julia> stmtstr = """
plus(a, b) = a + b
# Issue #81
f() = nothing
"""
"plus(a, b) = a + b\n\n# Issue #81\nf() = nothing\n"
julia> ex, iend = Meta.parse(stmtstr, 1)
(:(plus(a, b) = begin
#= none:1 =#
a + b
end), 20)
julia> stmtstr[iend:end] # the comment is still "left over"
"\n# Issue #81\nf() = nothing\n" julia 1.10Does include the comment: julia> ex, iend = Meta.parse(stmtstr, 1)
(:(plus(a, b) = begin
#= none:1 =#
a + b
end), 33)
julia> stmtstr[iend:end] # the comment got consumed as part of that previous method definition
"f() = nothing\n" Again, I'm not certain what the right answer is either. Feel free to close this issue and if so I will fix it in CodeTracking. |
Sorry I dropped the ball on this one :( I think we can just be compatible - if you have the bandwidth to tackle this @timholy that would be amazing. I'm drowning a bit right now 😬 |
I am not really sure if this is a bug, or maybe it's a bug in the original parser, but it looks like newlines are handled differently in JuliaSyntax.
This broke Documenter's tests (for some reason it's blacklisted in PkgEval), since we do some exact string checks there for parsed sub-expressions, so the cursor value changes threw those tests off. It's not a problem to handle this with version guards (JuliaDocs/Documenter.jl#2146), but it would be good to know whether this change might change back at some point or not.
Here are some
Meta.parse
calls in 1.9 vs today's master:Slightly more interesting case with a comment line:
The text was updated successfully, but these errors were encountered: