-
Notifications
You must be signed in to change notification settings - Fork 36
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
Parsing error? #333
Comments
Same thing seems to show up many places. https://github.com/SciML/OrdinaryDiffEq.jl/runs/5853304680?check_suite_focus=true#step:4:104 etc. |
The culprit here seems to be a format character at the start of the file, which Julia's parser just ignores: julia> CSTParser.parse("\ufeffusing Test")
1:13 errortoken
1:3 errortoken( CSTParser.UnexpectedToken)
1:3 errortoken( CSTParser.Unknown)
4:13 using
4:7 1:0 OP: .
4:7 Test
julia> Meta.parse("\ufeffusing Test")
:(using Test) |
|
Nvm, this actually is UTF-8 with BOM:
It's somewhat arguable that we should support that. |
Julia itself just treats U+FEFF as a space: julia> Meta.parse("[1\ufeff2]")
:([1 2]) That's a simple approach that allows it as a BOM as well since parsing doesn't care about space at the beginning of a file. |
JuliaLang/Tokenize.jl#197 does that. |
Maybe it would make sense to treat a leading BOM as a special token that JuliaFormatter knows to retain. Or the logic could be changed from deleting leading whitespace to trimming leading whitespace to just the BOM if there is a BOM. |
https://github.com/SciML/ModelingToolkit.jl/runs/5852797241?check_suite_focus=true#step:4:143
It seems to point to https://github.com/SciML/ModelingToolkit.jl/blob/v8.6.0/test/error_handling.jl#L60
@KristofferC said
The text was updated successfully, but these errors were encountered: