本文整理汇总了Java中org.antlr.runtime.tree.RewriteRuleTokenStream.add方法的典型用法代码示例。如果您正苦于以下问题:Java RewriteRuleTokenStream.add方法的具体用法?Java RewriteRuleTokenStream.add怎么用?Java RewriteRuleTokenStream.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.antlr.runtime.tree.RewriteRuleTokenStream
的用法示例。
在下文中一共展示了RewriteRuleTokenStream.add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paramStatement
import org.antlr.runtime.tree.RewriteRuleTokenStream; //导入方法依赖的package包/类
public final CFMLParser.paramStatement_return paramStatement() throws RecognitionException {
CFMLParser.paramStatement_return retval = new CFMLParser.paramStatement_return();
retval.start = input.LT(1);
int paramStatement_StartIndex = input.index();
CommonTree root_0 = null;
Token lc=null;
CFMLParser.paramStatementAttributes_return paramStatementAttributes174 = null;
CommonTree lc_tree=null;
RewriteRuleTokenStream stream_PARAM=new RewriteRuleTokenStream(adaptor,"token PARAM");
RewriteRuleSubtreeStream stream_paramStatementAttributes=new RewriteRuleSubtreeStream(adaptor,"rule paramStatementAttributes");
try {
if ( state.backtracking>0 && alreadyParsedRule(input, 39) ) { return retval; }
// E:\\BlueDragon\\OpenBD_ANTLR\\src\\com\\naryx\\tagfusion\\cfm\\parser\\CFML.g:563:3: (lc= PARAM paramStatementAttributes -> ^( PARAMSTATEMENT[$lc] paramStatementAttributes ) )
// E:\\BlueDragon\\OpenBD_ANTLR\\src\\com\\naryx\\tagfusion\\cfm\\parser\\CFML.g:563:5: lc= PARAM paramStatementAttributes
{
lc=(Token)match(input,PARAM,FOLLOW_PARAM_in_paramStatement2992); if (state.failed) return retval;
if ( state.backtracking==0 ) stream_PARAM.add(lc);
pushFollow(FOLLOW_paramStatementAttributes_in_paramStatement2994);
paramStatementAttributes174=paramStatementAttributes();
state._fsp--;
if (state.failed) return retval;
if ( state.backtracking==0 ) stream_paramStatementAttributes.add(paramStatementAttributes174.getTree());
// AST REWRITE
// elements: paramStatementAttributes
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
if ( state.backtracking==0 ) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
root_0 = (CommonTree)adaptor.nil();
// 563:40: -> ^( PARAMSTATEMENT[$lc] paramStatementAttributes )
{
// E:\\BlueDragon\\OpenBD_ANTLR\\src\\com\\naryx\\tagfusion\\cfm\\parser\\CFML.g:563:43: ^( PARAMSTATEMENT[$lc] paramStatementAttributes )
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(PARAMSTATEMENT, lc), root_1);
adaptor.addChild(root_1, stream_paramStatementAttributes.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;}
}
retval.stop = input.LT(-1);
if ( state.backtracking==0 ) {
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
}
catch (RecognitionException e) {
throw e;
}
finally {
if ( state.backtracking>0 ) { memoize(input, 39, paramStatement_StartIndex); }
}
return retval;
}
示例2: equalityOperator3
import org.antlr.runtime.tree.RewriteRuleTokenStream; //导入方法依赖的package包/类
public final CFMLParser.equalityOperator3_return equalityOperator3() throws RecognitionException {
CFMLParser.equalityOperator3_return retval = new CFMLParser.equalityOperator3_return();
retval.start = input.LT(1);
int equalityOperator3_StartIndex = input.index();
CommonTree root_0 = null;
Token lc=null;
Token NOT243=null;
Token CONTAIN244=null;
CommonTree lc_tree=null;
CommonTree NOT243_tree=null;
CommonTree CONTAIN244_tree=null;
RewriteRuleTokenStream stream_CONTAIN=new RewriteRuleTokenStream(adaptor,"token CONTAIN");
RewriteRuleTokenStream stream_NOT=new RewriteRuleTokenStream(adaptor,"token NOT");
RewriteRuleTokenStream stream_DOES=new RewriteRuleTokenStream(adaptor,"token DOES");
try {
if ( state.backtracking>0 && alreadyParsedRule(input, 56) ) { return retval; }
// E:\\BlueDragon\\OpenBD_ANTLR\\src\\com\\naryx\\tagfusion\\cfm\\parser\\CFML.g:657:5: (lc= DOES NOT CONTAIN -> ^( DOESNOTCONTAIN[$lc] ) )
// E:\\BlueDragon\\OpenBD_ANTLR\\src\\com\\naryx\\tagfusion\\cfm\\parser\\CFML.g:657:9: lc= DOES NOT CONTAIN
{
lc=(Token)match(input,DOES,FOLLOW_DOES_in_equalityOperator33845); if (state.failed) return retval;
if ( state.backtracking==0 ) stream_DOES.add(lc);
NOT243=(Token)match(input,NOT,FOLLOW_NOT_in_equalityOperator33847); if (state.failed) return retval;
if ( state.backtracking==0 ) stream_NOT.add(NOT243);
CONTAIN244=(Token)match(input,CONTAIN,FOLLOW_CONTAIN_in_equalityOperator33849); if (state.failed) return retval;
if ( state.backtracking==0 ) stream_CONTAIN.add(CONTAIN244);
// AST REWRITE
// elements:
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
if ( state.backtracking==0 ) {
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
root_0 = (CommonTree)adaptor.nil();
// 657:29: -> ^( DOESNOTCONTAIN[$lc] )
{
// E:\\BlueDragon\\OpenBD_ANTLR\\src\\com\\naryx\\tagfusion\\cfm\\parser\\CFML.g:657:32: ^( DOESNOTCONTAIN[$lc] )
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(DOESNOTCONTAIN, lc), root_1);
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;}
}
retval.stop = input.LT(-1);
if ( state.backtracking==0 ) {
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
}
catch (RecognitionException e) {
throw e;
}
finally {
if ( state.backtracking>0 ) { memoize(input, 56, equalityOperator3_StartIndex); }
}
return retval;
}
示例3: constant
import org.antlr.runtime.tree.RewriteRuleTokenStream; //导入方法依赖的package包/类
public final ParameterizedIndicatorsParser.constant_return constant() throws RecognitionException {
ParameterizedIndicatorsParser.constant_return retval = new ParameterizedIndicatorsParser.constant_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token NumberToken68=null;
CommonTree NumberToken68_tree=null;
RewriteRuleTokenStream stream_NumberToken=new RewriteRuleTokenStream(adaptor,"token NumberToken");
try {
// com/finance/pms/events/calculation/parametrizedindicators/antlr/ParameterizedIndicators.g:193:10: ( NumberToken -> ^( Number NumberToken ) )
// com/finance/pms/events/calculation/parametrizedindicators/antlr/ParameterizedIndicators.g:193:13: NumberToken
{
NumberToken68=(Token)match(input,NumberToken,FOLLOW_NumberToken_in_constant871);
stream_NumberToken.add(NumberToken68);
// AST REWRITE
// elements: NumberToken
// 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();
// 193:25: -> ^( Number NumberToken )
{
// com/finance/pms/events/calculation/parametrizedindicators/antlr/ParameterizedIndicators.g:193:28: ^( Number NumberToken )
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(Number, "Number"), root_1);
adaptor.addChild(root_1, stream_NumberToken.nextNode());
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;
}
示例4: stockhistory
import org.antlr.runtime.tree.RewriteRuleTokenStream; //导入方法依赖的package包/类
public final ParameterizedOperationsParser.stockhistory_return stockhistory() throws RecognitionException {
ParameterizedOperationsParser.stockhistory_return retval = new ParameterizedOperationsParser.stockhistory_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token HistoricalData17=null;
CommonTree HistoricalData17_tree=null;
RewriteRuleTokenStream stream_HistoricalData=new RewriteRuleTokenStream(adaptor,"token HistoricalData");
try {
// com/finance/pms/events/operations/parameterized/antlr/ParameterizedOperations.g:128:14: ( HistoricalData -> ^( StockOperation ^( OperationOutput HistoricalData ) ) )
// com/finance/pms/events/operations/parameterized/antlr/ParameterizedOperations.g:128:16: HistoricalData
{
HistoricalData17=(Token)match(input,HistoricalData,FOLLOW_HistoricalData_in_stockhistory294);
stream_HistoricalData.add(HistoricalData17);
// AST REWRITE
// elements: HistoricalData
// 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();
// 128:31: -> ^( StockOperation ^( OperationOutput HistoricalData ) )
{
// com/finance/pms/events/operations/parameterized/antlr/ParameterizedOperations.g:128:34: ^( StockOperation ^( OperationOutput HistoricalData ) )
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(StockOperation, "StockOperation"), root_1);
// com/finance/pms/events/operations/parameterized/antlr/ParameterizedOperations.g:128:51: ^( OperationOutput HistoricalData )
{
CommonTree root_2 = (CommonTree)adaptor.nil();
root_2 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(OperationOutput, "OperationOutput"), root_2);
adaptor.addChild(root_2, stream_HistoricalData.nextNode());
adaptor.addChild(root_1, root_2);
}
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;
}