JuliaLang / JuliaLang/JuliaSyntax.jl
Better error message for invalid syntax followed by valid syntax
- Dominant language
- Julia
- Stars
- 293
- Forks
- 50
- PR merge metrics
- No merged PRs in 30d
Description
```julia-repl
julia> import a, b, c=d e, f, g, h
ERROR: ParseError:
# Error @ REPL[50]:1:17
import a, b, c=d e, f, g, h
# └─────────┘ ── extra tokens after end of expression
julia> 1 = 2 3
ERROR: ParseError:
# Error @ REPL[58]:1:6
1 = 2 3
# └┘ ── extra tokens after end of expression
```
I believe that the "extra tokens after end of expression" error should only occur if the expression preceding the extra tokens is complete and valid.
Maybe the real issue here is that this should throw?
```julia
julia> Meta.parse("import a = 1")
:(import a = 1)
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the two REPL examples and the Meta.parse("import a = 1") case described in the issue. Trace how JuliaSyntax classifies invalid syntax followed by additional tokens, then confirm the intended parse or error behavior with focused parser tests; done means the error message is emitted only for a valid preceding expression.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100