On Wed, Jun 25, 2008 at 02:27:27PM -0400, Will Coleda wrote:
> On Wed, Jun 25, 2008 at 1:11 PM, Patrick R. Michaud <[EMAIL PROTECTED]> wrote:
> > On Wed, Jun 25, 2008 at 01:04:43AM -0700, Moritz Lenz wrote:
> >> Rakudo as of r28692 reports a slightly wrong context on reporting parse
> >> failures.
> >>
> >> When trying to parse t/spec/S02-builtin_data_types/lists.t (r21012) it
> >> reports:
> >>
> >> Statement not terminated properly at line 118, near "= [EMAIL PROTECTED];"
> >> current instr.: 'parrot;PGE::Util;die' pc 120
> >> (runtime/parrot/library/PGE/Util.pir:82)
> >>
> >> But line 118 reads like this:
> >> my $arrayref = [EMAIL PROTECTED];
> >>
> >> So there's just a single backslash, while two get reported. I see no
> >> need for extra quoting in the error message.
> >
> > What if there's a newline or other special character in the source
> > at the point of the error?   Should those be quoted?
> 
> If the error is showing "line 118", then a newline -in the source-
> isn't going to show up ^_^

It would show up if the original source was written across two lines, as in:

    my $arrayref =
        [EMAIL PROTECTED];

> I think a better option is probably to escape only non-printables,
> rather than what I am assuming is just using the parrot default of
> escaping for inclusion into another string.

I don't know if you're including newline as a "non-printable".
If we treat newline as printable, then our error message would end
up like:

    Statement not terminated properly at line 188, near "=
        [EMAIL PROTECTED];"

(In this specific instance, where prefix:<\\> is syntactically correct
but Rakudo doesn't recognize it yet, we probably should be failing with
"prefix:<\\> not implemented" instead of a syntax error.  I'll probably
add that later today.  But the question of how we should quote context in 
the case of a true syntax error still remains.)

Pm

Reply via email to