full-moon icon indicating copy to clipboard operation
full-moon copied to clipboard

Syntax errors when forgetting an end are annoying to debug

Open Dekkonot opened this issue 5 years ago • 2 comments

In the case that you forget an end somewhere in a Lua file, the error emitted by Full Moon makes it difficult to diagnose where the end should have been. It will say that it encountered an "unexpected token ``" at the end of the file and then list the expected token (an end), without specifying where the end is expected from. For files that are hundreds or potentially thousands of lines long, this can be problematic for what should hopefully be obvious reasons.

Dekkonot avatar Nov 26 '19 04:11 Dekkonot

Is this mostly selene issue?

For:

function add(a, b)
  return a + b

selene (version 0.8.0) reports:

error[parse_error]: unexpected token ``

   ┌── /Users/zummenix/projects/full-moon/full-moon/tests/cases/fail/parser/missing-end/source.lua:4:1 ───
   │
 4 │
   │ ^ expected 'end'
   │

zummenix avatar Oct 11 '20 07:10 zummenix

Yep--I think there's an issue outstanding for it.

Kampfkarren avatar Oct 11 '20 08:10 Kampfkarren