-
Notifications
You must be signed in to change notification settings - Fork 1.2k
That #%$! syntax error two functions down #3772
Description
Original bug ID: 3772
Reporter: administrator
Status: acknowledged
Resolution: open
Priority: normal
Severity: feature
Category: lexing and parsing
Child of: #5068
Monitored by: n8gray
Bug description
Full_Name: Florian Hars
Version: All
OS: Linux
Submission from: p54901fad.dip0.t-ipconnect.de (84.144.31.173)
If you happen to have a dangling semicolon at the end of a let binding, the
syntax error is reported after the end of the let binding following the
semicolon, at a completly error free function or even the end of the file.
I understand that this is just how the parser works, and if you've seen this a
few times, you know just what do to: scroll up to the end of the binding before
the binding that precedes the location of the syntax error. But it would still
be nice if the compiler would issue something like the "This '(' might be
unmatched" it issues if a closing paranthesis is missing (unless the missing
paranthesis is the last thing in a let binding, in which case you get a syntax
error at the beginning of the binding following the binding after the error).
The rule might be something like: if you are expecting an "in", but get a "let"
instead issue something like (if the dangling ; is in line 28)
File "foo.ml", line 80, characters 0-3:
Syntax error
File "foo.ml", line 30, characters 0-3:
The binding before this might be incompletely terminated.