in reply to Parse::RecDescent grammar and Parenthesis
Actions are transformed into do blocks within the subroutine that implements each rule. That means that if an action executes a return, the entire surrounding subroutine (i.e. the entire rule) returns. Immediately.
In that case, subsequent items in the current production are not considered, nor are subsequent productions in the current rule. So typically, you get a "match", but not of the entire input. Or you get a "failed-to-match" on the next rule, even though the production that was supposed to match the previous input seems to succeed.
Hmmmmm. This is becoming a frequently encountered trap as more and more people are using the module. That usually indicates that the original design is flawed (because the module isn't DWIMing). I suspect that a near-future release may translate:
not to:{ action() }
but to:do { action() }
so as to make the behaviour of embedded returns conform to people's expection.{ action() }->()
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Parse::RecDescent grammar and Parenthesis
by Masem (Monsignor) on Dec 18, 2001 at 07:26 UTC |