JuliaLang / JuliaLang/JuliaSyntax.jl
Better error for trailing commas in `using`
- Dominant language
- Julia
- Stars
- 293
- Forks
- 50
- PR merge metrics
- No merged PRs in 30d
Description
Leaving a trailing comma after the last element of `using` is a mistake I've made a few times. The parser only catches this error later, resulting in a fairly poor error message. For example, it can gobble up the `function` keyword in the next part of the file:
```julia
julia> using A: b,
function foo()
end
ERROR: ParseError:
Error: extra tokens after end of expression
@ REPL[4]:3:9
using A: b,
function foo()
--------^^^^^^---
end
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the Julia REPL example with a trailing comma in `using A: b,` followed by `function foo()`. Start by tracing how the parser handles the `using` statement and the following `function` keyword. Done means the trailing comma produces a direct, useful parse error instead of consuming the next construct and reporting extra tokens later.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100