Hi,
I have implemented a patch for Parser.java that allow the use of integer
literal in limit clause. It allow the use of Limit 3,2 in addition to Limit
$1, $2. My changes are mark by the tag //{{lowhs and //lowhs}}
Regards,
Low Heng Sin ( [EMAIL PROTECTED] )
//{{lowhs
private ParseTreeNode limitParam()
throws InvalidCharException, OQLSyntaxException {
ParseTreeNode retNode = null;
if ( _curToken.getTokenType() == DOLLAR ) {
retNode = match(DOLLAR);
int tokenType = _curToken.getTokenType();
switch (tokenType) {
case LPAREN:
match(LPAREN);
retNode.addChild(match(IDENTIFIER));
match(RPAREN);
retNode.addChild(match(LONG_LITERAL));
break;
case LONG_LITERAL:
retNode.addChild(match(LONG_LITERAL));
break;
default:
//{{lowhs
throw (new OQLSyntaxException("An inapropriate token was
encountered in a limit parameter. ( " + tokenType + " )"));
//lowhs}}
}
} else {
retNode = match(LONG_LITERAL);
}
return retNode;
}
//lowhs}}
/**
* Consumes tokens of limitClause.
*
* @return a Parse tree containing LIMIT as the root, with children
* as limit parameters.
* @throws InvalidCharException passed through from match().
* @throws OQLSyntaxException passed through from match(), or if an
* unknown token is encountered here.
*/
private ParseTreeNode limitClause()
throws InvalidCharException, OQLSyntaxException {
ParseTreeNode retNode = match(KEYWORD_LIMIT);
//{{lowhs
//retNode.addChild(queryParam());
ParseTreeNode tmp = limitParam();
retNode.addChild(tmp);
//lowhs}}
if ( _curToken.getTokenType() == COMMA ) {
retNode.addChild( match( COMMA ) );
//{{lowhs
tmp = limitParam() ;
retNode.addChild( tmp );
//lowhs}}
}
return retNode;
}