[antlr-interest] anybody use exception[label]?
Brannon King
BBKing at starbridgesystems.com
Fri Dec 23 08:13:58 PST 2005
>Anybody use the feature where you can attach an exception to a label to
put in a specific try/catch?
I've been using the exception catch in the parser like this:
cornerType :
LP! CORNERTYPE^ i:IDENTIFIER
{ -1 != Arrays.binarySearch(cornerTypes,
i.getText().toUpperCase()) }?
RP!;
exception catch[SemanticException ex]{
throw new SemanticException("line " + i.getLine() + ":"
+ i.getColumn() + ":" + LT(1).getColumn() +
": expecting one of [" +
arrayToString(cornerTypes,", ") + "], found " + i.getText(),
i.getFilename(), i.getLine(), i.getColumn());
}
What advantage would using the label give me? And how would that even
change behavior?
More information about the antlr-interest
mailing list