Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Unexpected parser error

by saintmike (Vicar)
on Feb 22, 2007 at 07:39 UTC ( [id://601499]=note: print w/replies, xml ) Need Help??


in reply to Re: Unexpected parser error
in thread Unexpected parser error

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^3: Unexpected parser error
by shmem (Chancellor) on Feb 22, 2007 at 07:45 UTC
    Write the patch... ;-)

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
Re^3: Unexpected parser error
by ikegami (Patriarch) on Feb 22, 2007 at 21:37 UTC

    What will a newbie think of this misleading error message?

    The error is rather straightforward to analyze. I'd be more concerned about the case with no error message.

    sub function { return 8; } $n = function + 4;

    Do you really think a parser should throw an error if [...] it "guessed wrong" and needs to consider a different (valid) possibility?

    I wonder if the tokenizer is capable of backtracking. Adding that capability would probably have a significant performance hit on the time it takes to compile Perl code.

    Furthermore, I'm not convinced the problem can be fixed. Some cases cannot be fixed (like $n = function + 4;). Even if we were only fixing $n = function / 4;, the fix would necessarily introduce new problems. Consider:

    $n = function /dir(\d+)\/;

    Your "fix" would cause Perl to say
    "Backslash found where operator expected"
    instead of
    "Search pattern not terminated"
    That's worse.

    Would you also like to fix the following, where it appears the "guess" resulted in a perfectly fine regexp?

    sub function { '...' } $x = function / 4; $y = $n / 2;

    There are major implications to trying to fix this last error.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://601499]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-24 23:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found