[antlr-interest] Skip subtree in tree grammar
Gavin Lambert
antlr at mirality.co.nz
Tue May 5 12:39:31 PDT 2009
At 01:38 6/05/2009, Martijn Reuvers wrote:
>Is there an (easy) way to skip a subtree in a tree grammar? For
>example in a conditional expression:
[...]
>bool_function_content[Boolean value]
> : {value != null && value.booleanValue()}? => function_content*
> ;
> catch [FailedPredicateException e] {
> BufferedTreeNodeStream commonInput = (BufferedTreeNodeStream)
>input;
> // This is what I had in mind, but how to skip
the
>current subtree?
> }
If you're using the latest (perhaps forthcoming, I've lost track)
version of ANTLR:
bool_function_content[Boolean value]
: { value != null && value.booleanValue() }? =>
function_content*
| .*
;
If you're using an older version:
skip : . | ^(. skip*) ;
bool_function_content[Boolean value]
: { value != null && value.booleanValue() }? =>
function_content*
| skip*
;
More information about the antlr-interest
mailing list