Re: question on directive <commit> and subrules

[email protected] (Dave McD)
Newsgroups perl.recdescent
Message-ID <[email protected]>
Thanks guys.  I like your idea Marcel.  That seems to
be the cleanest way to propagate a failure up after a
<commit> on a subrule.

Dave MC

--- Marcel Grunauer <[email protected]>
wrote:
> On Donnerstag, Februar 7, 2002, at 02:14  Uhr,
> damian wrote:
> 
> > Usually by "anchoring" the end of the match. That
> might be:
> >
> >   myrule: 'stuff' mysubrule(?) ...!ID
> 
> it seems necessary to return a { 1 } here, as the
> rule
> fails otherwise, presumably because of the negative
> lookahead:
> 
>    myrule: 'stuff' mysubrule(?) ...!ID { 1 }
> 
> >   mysubrule: ID <commit> '[' ']'
> >            | <error?> <reject>
> >
> > or
> >
> >   myrule: 'stuff' mysubrule(?) /\s*\Z/
> >
> >   mysubrule: ID <commit> '[' ']'
> >            | <error?> <reject>
> >
> >
> > or whatever addition confirms that there really
> wasn't anything else
> > after 'stuff'.
> 
> another option would be the use of a rulevar:
> 
>    myrule : <rulevar: local $failed>
>    myrule : 'stuff' mysubrule(?) <reject:$failed>
> 
>    mysubrule: ID <commit> '[' ']'
>             | <error?> { $failed++ }
> 
> this way you don't have to specify a potentially
> complex negative
> lookahead, and the method works over several levels
> of subrules
> as well.
> 
> marcel
> 
> 


__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.