Perhaps a FAQ: How to shortcut an alternation if one already commited subrule fails

[email protected] (Karl Gaissmaier) Wed, 31 Mar 2004 13:22:14 +0200
Newsgroups perl.recdescent
Message-ID <[email protected]>
Hi P::RD lovers,

is there a general advice to shortcut an alternation in a rule
if one already commited subrule fails:

Example:

ENTITY : ( COMMENT | OPTION | DECLARATION | SCOPE )(s)

COMMENT : '#' <commit> m/.*/
           | <error?> <reject>

OPTION  : IDENT '=' <commit> VALUE
           { store($item{IDENT}, $item{VALUE}) }
           | <error?> <reject>

DECL    : TYPE NAME '{' <commit> DECL_BODY '}'
           { store($item{TYPE}, $ITEM{NAME}, $ITEM{DECL_BODY}) }
           | <error?> <reject>

SCOPE   : 'scope' <commit> '{' ENTITY(s) '}'
           | <error?> <reject>


I would like to see the immediately failure of ENTITY, if
e.g. the DECL subrule fails after already commited.

Is there a general usage pattern to shortcut the ENTITY rule
if an already commited subrule fails?


Best Regards
	Charly
-- 
Karl Gaissmaier       KIZ/Infrastructure, University of Ulm, Germany
Email:[email protected]           Service Group Network
Tel.: ++49 731 50-22499