On Mon, Sep 25, 2017 at 10:25:42AM -0400, Brandon Allbery wrote:
: So as to make this not entirely content-free: I would suggest that the
: string language note the line on which it sees a bare newline, and if it
: subsequently hits a syntax error while still parsing that string it could
: output something like perl 5's "Possible runaway multi-line string starting
: on line ..." as a suggestion.

Thing is, rakudo already does this.  It's just that it blew up before
it even got to the second quote and the subsequent two-terms-in-a-raw
syntax error where it would have noticed the runaway string.  I suppose
what we're really asking for is a slightly less fatal error on the
undeclared variable error so that it can get to the syntax error that
usually triggers the heuristic.

In slightly greater detail, we're currently treating an undeclared
variable as a syntax error rather than a semantic error, and we treat
those differently.  Syntax errors are usually treated as immediately
fatal becase they demonstrate we don't know what language we're parsing.
Semantic errors, on the other hand. indicate a known language with
unknown meaning, so we tend to continue parsing even though we know we
will blow up at the end of the parse.  So relaxing this in the parser
from immediately fatal to fatal later may be as easy as changing a .panic
to a .sorry somewhere.


Reply via email to