JuliaLang / JuliaSyntax.jl

The Julia compiler frontend
Other
272 stars 35 forks source link

Better error for missing commas in array #409

Open inkydragon opened 8 months ago

inkydragon commented 8 months ago
  1. The output of versioninfo()

    julia> versioninfo()
    Julia Version 1.10.0
    Commit 3120989f39b (2023-12-25 18:01 UTC)
    Build Info:
      Official https://julialang.org/ release
    Platform Info:
      OS: Linux (x86_64-linux-gnu)
      CPU: 32 × 13th Gen Intel(R) Core(TM) i9-13900HX
      WORD_SIZE: 64
      LIBM: libopenlibm
      LLVM: libLLVM-15.0.7 (ORCJIT, goldmont)
      Threads: 1 on 32 virtual cores
  2. How you installed Julia: juliaup

  3. MWE

    [
    1.0, 2.0  
    # ......^ missing comma
    1e-6, 1e-8,
    rand(),
    ]

output

julia> [
           1.0, 2.0
           # ......^ missing comma
           1e-6, 1e-8,
           rand(),
       ]
ERROR: ParseError:
# Error @ REPL[135]:4:5
    # ......^ missing comma
#   ┌──────────
    1e-6, 1e-8,
    rand(),
#───────┘ ── Expected `]`
Stacktrace:
 [1] top-level scope
   @ none:1

Maybe add one more suggestion: "Maybe there is a missing comma in the array, please check"