Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Unexpected parser error

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


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

You forgot to put the parentheses on the end of function().
No, I didn't.

That's why I wrote "Sure, function can be disambiguated to function()".

My point: If 'function' is known as a function name at this point, perl should be smart enough to throw out the possibility that "function / 4" is a regular expression because that's an insane assumption.

Replies are listed 'Best First'.
Re^3: Unexpected parser error
by diotalevi (Canon) on Feb 22, 2007 at 07:19 UTC

    Ok, given that you know perl knows that function is variadic, you know it's going to try to put everything following it into its parameter list. My understanding is that the parser is only able to look ahead one token at a time. The fact that it got two tokens ahead before it found out it couldn't parse things means it just couldn't continue. It isn't capable of backing up from function( / 4; to function() / 4;. You'll just have to provide that information to perl soon enough for the parser to use it. Sorry. Either use the parameter list or set the prototype.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-03-29 12:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found