JuliaLang / JuliaLang/JuliaSyntax.jl
Ambiguity parsing operators with suffixes ending in subscript/superscript letter
- Dominant language
- Julia
- Stars
- 293
- Forks
- 50
- PR merge metrics
- No merged PRs in 30d
Description
Per [this discussion](https://github.com/JuliaLang/julia/pull/60286#discussion_r2579071094), there's an ambiguity in an expression like `1 +ᵃx` — which could mean either `1 +ᵃ x` or `1 + ᵃx`. As of this writing, [the manual says](https://docs.julialang.org/en/v1/manual/variables/#man-allowed-variable-names) (emphasis mine)
> A space is *required* between an operator that ends with a subscript/superscript letter and a subsequent variable name. For example, if `+ᵃ` is an operator, then `+ᵃx` *must* be written as `+ᵃ x` to distinguish it from `+ ᵃx` where `ᵃx` is the variable name.
Those emphasized words would suggest that a missing space would raise an error, just as `1.+x` does — but that is not the case. The current behavior in both the native Julia parser and in JuliaSyntax is to parse `+ᵃx` as `+ᵃ x`. @stevengj suggests it should be an error.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.