[prev in list] [next in list] [prev in thread] [next in thread]
List: antlr-interest
Subject: [antlr-interest] Validating predicates in @after
From: Felix Dorner <felix_do () web ! de>
Date: 2008-04-30 7:27:18
Message-ID: 48181F56.6040906 () web ! de
[Download RAW message or body]
Hey again..
In expression rules you often have alternatives that consist of
subexpressions, like:
expression :
| ^(binop expression expression)
| ^(unaryop expression)
...
my current validation grammar looks like this:
| ..
^(binop e1=expression e2=expression)
{$e1.start.evalsTo != null}?
{$e2.start.evalsTo != null}?
| ^(unaryop e1=expression)
{$e1.start.evalsTo != null}?
so there's a lot of repetitive code here. Rather than doing that, I'd
like to verify right befor expression returns that its "evalTo" isn't
null (i.e. it's a valid expression). Is this the only way to do this:?
@after {
if ($start.evalType() == null){
throw new FailedPredicateException(input, expression,
"$start.evalType != null");
}
}
Thanks again,
Felix
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic