[antlr-interest] tree grammar help
michael.pflug at thomson.com
michael.pflug at thomson.com
Thu Jul 13 13:46:48 PDT 2006
I have a tree grammar with the rule:
: tableName=identifier DOT columnName=identifier ((LITERAL_as)?
alias=identifier)?
We are trying to make the first identifier with DOT optional like this:
: (tableName=identifier DOT)? columnName=identifier ((LITERAL_as)?
alias=identifier)?
The generation passes, but generates a bad IF statement. _t.getType()
can not equal SQL_IDENTIFIER and DOT at the same time
It looks like this:
if ((_t.getType()==SQL_IDENTIFIER) && (_t.getType()==DOT)) {
tableName=identifier(_t);
_t = _retTree;
AST tmp16_AST_in = (AST)_t;
match(_t,DOT);
_t = _t.getNextSibling();
}
else if ((_t.getType()==SQL_IDENTIFIER) &&
(_tokenSet_0.member(_t.getType()))) {
}
else {
throw new NoViableAltException(_t);
}
Any ideas on a grammar that would work?
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060713/b2d69728/attachment.html
More information about the antlr-interest
mailing list