本文整理汇总了Java中org.antlr.runtime.ParserRuleReturnScope类的典型用法代码示例。如果您正苦于以下问题:Java ParserRuleReturnScope类的具体用法?Java ParserRuleReturnScope怎么用?Java ParserRuleReturnScope使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParserRuleReturnScope类属于org.antlr.runtime包,在下文中一共展示了ParserRuleReturnScope类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkForSyntaxErrors
import org.antlr.runtime.ParserRuleReturnScope; //导入依赖的package包/类
private static void checkForSyntaxErrors(String text, String type,
SQLParser parser, ParserRuleReturnScope r) {
if (parser.getNumberOfSyntaxErrors() > 0)
throw new SyntaxError("Illegal " + type, text, -1, -1);
CommonToken stop = (CommonToken) r.stop;
if (text != null && stop.getStopIndex() < StringUtil.trimRight(text).length() - 1) {
if (stop.getStopIndex() == 0)
throw new SyntaxError("Syntax error after " + stop.getText(), text);
else
throw new SyntaxError("Syntax error at the beginning ", text);
}
}
示例2: query
import org.antlr.runtime.ParserRuleReturnScope; //导入依赖的package包/类
public final query_return query() throws RecognitionException {
query_return retval = new query_return();
retval.start = input.LT(1);
Object root_0 = null;
ParserRuleReturnScope conditionOr1 =null;
try {
// src/Query.g:93:3: ( conditionOr )
// src/Query.g:93:5: conditionOr
{
root_0 = (Object)adaptor.nil();
pushFollow(FOLLOW_conditionOr_in_query101);
conditionOr1=conditionOr();
state._fsp--;
if (state.failed) return retval;
if ( state.backtracking==0 ) adaptor.addChild(root_0, conditionOr1.getTree());
}
retval.stop = input.LT(-1);
if ( state.backtracking==0 ) {
retval.tree = (Object)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
}
示例3: primary_expression
import org.antlr.runtime.ParserRuleReturnScope; //导入依赖的package包/类
public final ParameterizedIndicatorsParser.primary_expression_return primary_expression() throws RecognitionException {
ParameterizedIndicatorsParser.primary_expression_return retval = new ParameterizedIndicatorsParser.primary_expression_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
ParserRuleReturnScope and_expression39 =null;
try {
// com/finance/pms/events/calculation/parametrizedindicators/antlr/ParameterizedIndicators.g:175:20: ( and_expression )
// com/finance/pms/events/calculation/parametrizedindicators/antlr/ParameterizedIndicators.g:176:2: and_expression
{
root_0 = (CommonTree)adaptor.nil();
pushFollow(FOLLOW_and_expression_in_primary_expression630);
and_expression39=and_expression();
state._fsp--;
adaptor.addChild(root_0, and_expression39.getTree());
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
}
示例4: stateField
import org.antlr.runtime.ParserRuleReturnScope; //导入依赖的package包/类
public final hqlParser.stateField_return stateField() throws RecognitionException {
hqlParser.stateField_return retval = new hqlParser.stateField_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
ParserRuleReturnScope path18 =null;
try {
// hql.g:182:2: ( path )
// hql.g:182:4: path
{
root_0 = (CommonTree)adaptor.nil();
pushFollow(FOLLOW_path_in_stateField701);
path18=path();
state._fsp--;
adaptor.addChild(root_0, path18.getTree());
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
}
示例5: newValue
import org.antlr.runtime.ParserRuleReturnScope; //导入依赖的package包/类
public final hqlParser.newValue_return newValue() throws RecognitionException {
hqlParser.newValue_return retval = new hqlParser.newValue_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
ParserRuleReturnScope concatenation19 =null;
try {
// hql.g:188:2: ( concatenation )
// hql.g:188:4: concatenation
{
root_0 = (CommonTree)adaptor.nil();
pushFollow(FOLLOW_concatenation_in_newValue714);
concatenation19=concatenation();
state._fsp--;
adaptor.addChild(root_0, concatenation19.getTree());
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
}
示例6: logicalExpression
import org.antlr.runtime.ParserRuleReturnScope; //导入依赖的package包/类
public final hqlParser.logicalExpression_return logicalExpression() throws RecognitionException {
hqlParser.logicalExpression_return retval = new hqlParser.logicalExpression_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
ParserRuleReturnScope expression153 =null;
try {
// hql.g:405:2: ( expression )
// hql.g:405:4: expression
{
root_0 = (CommonTree)adaptor.nil();
pushFollow(FOLLOW_expression_in_logicalExpression1866);
expression153=expression();
state._fsp--;
adaptor.addChild(root_0, expression153.getTree());
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
}
示例7: expression
import org.antlr.runtime.ParserRuleReturnScope; //导入依赖的package包/类
public final hqlParser.expression_return expression() throws RecognitionException {
hqlParser.expression_return retval = new hqlParser.expression_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
ParserRuleReturnScope logicalOrExpression154 =null;
try {
// hql.g:410:2: ( logicalOrExpression )
// hql.g:410:4: logicalOrExpression
{
root_0 = (CommonTree)adaptor.nil();
pushFollow(FOLLOW_logicalOrExpression_in_expression1878);
logicalOrExpression154=logicalOrExpression();
state._fsp--;
adaptor.addChild(root_0, logicalOrExpression154.getTree());
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
}
示例8: build
import org.antlr.runtime.ParserRuleReturnScope; //导入依赖的package包/类
public Object build(ClauseType clause, final ParserRuleReturnScope rule)
throws ExpressionBuilderFailure {
try {
return clause.accept(new TreeWalker((Tree) rule.getTree()));
} catch (ExpressionBuilderFailure failure) {
throw failure;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例9: indicatorexpr
import org.antlr.runtime.ParserRuleReturnScope; //导入依赖的package包/类
public final ParameterizedOperationsParser.indicatorexpr_return indicatorexpr() throws RecognitionException {
ParameterizedOperationsParser.indicatorexpr_return retval = new ParameterizedOperationsParser.indicatorexpr_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
ParserRuleReturnScope expression1 =null;
RewriteRuleSubtreeStream stream_expression=new RewriteRuleSubtreeStream(adaptor,"rule expression");
try {
// com/finance/pms/events/operations/parameterized/antlr/ParameterizedOperations.g:117:15: ( expression -> expression )
// com/finance/pms/events/operations/parameterized/antlr/ParameterizedOperations.g:117:17: expression
{
pushFollow(FOLLOW_expression_in_indicatorexpr99);
expression1=expression();
state._fsp--;
stream_expression.add(expression1.getTree());
// AST REWRITE
// elements: expression
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
root_0 = (CommonTree)adaptor.nil();
// 117:28: -> expression
{
adaptor.addChild(root_0, stream_expression.nextTree());
}
retval.tree = root_0;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
}
示例10: expression
import org.antlr.runtime.ParserRuleReturnScope; //导入依赖的package包/类
public final ParameterizedOperationsParser.expression_return expression() throws RecognitionException {
ParameterizedOperationsParser.expression_return retval = new ParameterizedOperationsParser.expression_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
ParserRuleReturnScope nativeop2 =null;
ParserRuleReturnScope userop3 =null;
try {
// com/finance/pms/events/operations/parameterized/antlr/ParameterizedOperations.g:118:12: ( nativeop | userop )
int alt1=2;
int LA1_0 = input.LA(1);
if ( (LA1_0==Nativeop) ) {
alt1=1;
}
else if ( (LA1_0==Userop) ) {
alt1=2;
}
else {
NoViableAltException nvae =
new NoViableAltException("", 1, 0, input);
throw nvae;
}
switch (alt1) {
case 1 :
// com/finance/pms/events/operations/parameterized/antlr/ParameterizedOperations.g:118:14: nativeop
{
root_0 = (CommonTree)adaptor.nil();
pushFollow(FOLLOW_nativeop_in_expression111);
nativeop2=nativeop();
state._fsp--;
adaptor.addChild(root_0, nativeop2.getTree());
}
break;
case 2 :
// com/finance/pms/events/operations/parameterized/antlr/ParameterizedOperations.g:118:25: userop
{
root_0 = (CommonTree)adaptor.nil();
pushFollow(FOLLOW_userop_in_expression115);
userop3=userop();
state._fsp--;
adaptor.addChild(root_0, userop3.getTree());
}
break;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
}
示例11: assignment
import org.antlr.runtime.ParserRuleReturnScope; //导入依赖的package包/类
public final hqlParser.assignment_return assignment() throws RecognitionException {
hqlParser.assignment_return retval = new hqlParser.assignment_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token EQ16=null;
ParserRuleReturnScope stateField15 =null;
ParserRuleReturnScope newValue17 =null;
CommonTree EQ16_tree=null;
try {
// hql.g:176:2: ( stateField EQ ^ newValue )
// hql.g:176:4: stateField EQ ^ newValue
{
root_0 = (CommonTree)adaptor.nil();
pushFollow(FOLLOW_stateField_in_assignment683);
stateField15=stateField();
state._fsp--;
adaptor.addChild(root_0, stateField15.getTree());
EQ16=(Token)match(input,EQ,FOLLOW_EQ_in_assignment685);
EQ16_tree = (CommonTree)adaptor.create(EQ16);
root_0 = (CommonTree)adaptor.becomeRoot(EQ16_tree, root_0);
pushFollow(FOLLOW_newValue_in_assignment688);
newValue17=newValue();
state._fsp--;
adaptor.addChild(root_0, newValue17.getTree());
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
}
示例12: deleteStatement
import org.antlr.runtime.ParserRuleReturnScope; //导入依赖的package包/类
public final hqlParser.deleteStatement_return deleteStatement() throws RecognitionException {
hqlParser.deleteStatement_return retval = new hqlParser.deleteStatement_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token DELETE20=null;
ParserRuleReturnScope optionalFromTokenFromClause21 =null;
ParserRuleReturnScope whereClause22 =null;
CommonTree DELETE20_tree=null;
try {
// hql.g:192:2: ( DELETE ^ ( optionalFromTokenFromClause ) ( whereClause )? )
// hql.g:192:4: DELETE ^ ( optionalFromTokenFromClause ) ( whereClause )?
{
root_0 = (CommonTree)adaptor.nil();
DELETE20=(Token)match(input,DELETE,FOLLOW_DELETE_in_deleteStatement725);
DELETE20_tree = (CommonTree)adaptor.create(DELETE20);
root_0 = (CommonTree)adaptor.becomeRoot(DELETE20_tree, root_0);
// hql.g:193:3: ( optionalFromTokenFromClause )
// hql.g:193:4: optionalFromTokenFromClause
{
pushFollow(FOLLOW_optionalFromTokenFromClause_in_deleteStatement731);
optionalFromTokenFromClause21=optionalFromTokenFromClause();
state._fsp--;
adaptor.addChild(root_0, optionalFromTokenFromClause21.getTree());
}
// hql.g:194:3: ( whereClause )?
int alt5=2;
int LA5_0 = input.LA(1);
if ( (LA5_0==WHERE) ) {
alt5=1;
}
switch (alt5) {
case 1 :
// hql.g:194:4: whereClause
{
pushFollow(FOLLOW_whereClause_in_deleteStatement737);
whereClause22=whereClause();
state._fsp--;
adaptor.addChild(root_0, whereClause22.getTree());
}
break;
}
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
}
示例13: selectStatement
import org.antlr.runtime.ParserRuleReturnScope; //导入依赖的package包/类
public final hqlParser.selectStatement_return selectStatement() throws RecognitionException {
hqlParser.selectStatement_return retval = new hqlParser.selectStatement_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
ParserRuleReturnScope q =null;
RewriteRuleSubtreeStream stream_queryRule=new RewriteRuleSubtreeStream(adaptor,"rule queryRule");
try {
// hql.g:209:2: (q= queryRule -> ^( QUERY[\"query\"] $q) )
// hql.g:209:4: q= queryRule
{
pushFollow(FOLLOW_queryRule_in_selectStatement802);
q=queryRule();
state._fsp--;
stream_queryRule.add(q.getTree());
// AST REWRITE
// elements: q
// token labels:
// rule labels: retval, q
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
RewriteRuleSubtreeStream stream_q=new RewriteRuleSubtreeStream(adaptor,"rule q",q!=null?q.getTree():null);
root_0 = (CommonTree)adaptor.nil();
// 210:2: -> ^( QUERY[\"query\"] $q)
{
// hql.g:210:5: ^( QUERY[\"query\"] $q)
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot(adaptor.create(QUERY, "query"), root_1);
adaptor.addChild(root_1, stream_q.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
}
示例14: insertStatement
import org.antlr.runtime.ParserRuleReturnScope; //导入依赖的package包/类
public final hqlParser.insertStatement_return insertStatement() throws RecognitionException {
hqlParser.insertStatement_return retval = new hqlParser.insertStatement_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token INSERT27=null;
ParserRuleReturnScope intoClause28 =null;
ParserRuleReturnScope selectStatement29 =null;
CommonTree INSERT27_tree=null;
try {
// hql.g:217:2: ( INSERT ^ intoClause selectStatement )
// hql.g:217:4: INSERT ^ intoClause selectStatement
{
root_0 = (CommonTree)adaptor.nil();
INSERT27=(Token)match(input,INSERT,FOLLOW_INSERT_in_insertStatement831);
INSERT27_tree = (CommonTree)adaptor.create(INSERT27);
root_0 = (CommonTree)adaptor.becomeRoot(INSERT27_tree, root_0);
pushFollow(FOLLOW_intoClause_in_insertStatement834);
intoClause28=intoClause();
state._fsp--;
adaptor.addChild(root_0, intoClause28.getTree());
pushFollow(FOLLOW_selectStatement_in_insertStatement836);
selectStatement29=selectStatement();
state._fsp--;
adaptor.addChild(root_0, selectStatement29.getTree());
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
}
示例15: intoClause
import org.antlr.runtime.ParserRuleReturnScope; //导入依赖的package包/类
public final hqlParser.intoClause_return intoClause() throws RecognitionException {
hqlParser.intoClause_return retval = new hqlParser.intoClause_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token INTO30=null;
ParserRuleReturnScope path31 =null;
ParserRuleReturnScope insertablePropertySpec32 =null;
CommonTree INTO30_tree=null;
try {
// hql.g:221:2: ( INTO ^ path insertablePropertySpec )
// hql.g:221:4: INTO ^ path insertablePropertySpec
{
root_0 = (CommonTree)adaptor.nil();
INTO30=(Token)match(input,INTO,FOLLOW_INTO_in_intoClause847);
INTO30_tree = (CommonTree)adaptor.create(INTO30);
root_0 = (CommonTree)adaptor.becomeRoot(INTO30_tree, root_0);
pushFollow(FOLLOW_path_in_intoClause850);
path31=path();
state._fsp--;
adaptor.addChild(root_0, path31.getTree());
WeakKeywords();
pushFollow(FOLLOW_insertablePropertySpec_in_intoClause854);
insertablePropertySpec32=insertablePropertySpec();
state._fsp--;
adaptor.addChild(root_0, insertablePropertySpec32.getTree());
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
}