本文整理汇总了Java中org.antlr.runtime.RuleReturnScope类的典型用法代码示例。如果您正苦于以下问题:Java RuleReturnScope类的具体用法?Java RuleReturnScope怎么用?Java RuleReturnScope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RuleReturnScope类属于org.antlr.runtime包,在下文中一共展示了RuleReturnScope类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test_template1
import org.antlr.runtime.RuleReturnScope; //导入依赖的package包/类
@Test public void test_template1() throws Exception {
// gunit test on line 16
RuleReturnScope rstruct = (RuleReturnScope)execParser("template", "<[]>", 16);
Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(EXPR [)";
assertEquals("testing rule template", expecting, actual);
}
示例2: test_template2
import org.antlr.runtime.RuleReturnScope; //导入依赖的package包/类
@Test public void test_template2() throws Exception {
// gunit test on line 17
RuleReturnScope rstruct = (RuleReturnScope)execParser("template", "<[a,b]>", 17);
Object actual = ((Tree)rstruct.getTree()).toStringTree();
Object expecting = "(EXPR ([ a b))";
assertEquals("testing rule template", expecting, actual);
}
示例3: tag
import org.antlr.runtime.RuleReturnScope; //导入依赖的package包/类
public final FastSimpleGenericEdifactDirectXMLParser.tag_return tag() throws RecognitionException {
FastSimpleGenericEdifactDirectXMLParser.tag_return retval =
new FastSimpleGenericEdifactDirectXMLParser.tag_return();
retval.start = input.LT( 1 );
List<Object> list_i = null;
FastSimpleGenericEdifactDirectXMLParser.tag_name_return tag_name3 = null;
RuleReturnScope i = null;
try {
// C:\\workspace-sts\\Kettle trunk -
// restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\
// FastSimpleGenericEdifactDirectXML.g:108:41:
// ( tag_name ( ds i+= tag_index_id )* )
// C:\\workspace-sts\\Kettle trunk -
// restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\
// FastSimpleGenericEdifactDirectXML.g:108:43:
// tag_name ( ds i+= tag_index_id )*
pushFollow( FOLLOW_tag_name_in_tag208 );
tag_name3 = tag_name();
state._fsp--;
tagIndexes.clear();
// C:\\workspace-sts\\Kettle trunk -
// restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\
// FastSimpleGenericEdifactDirectXML.g:108:74:
// ( ds i+= tag_index_id )*
loop7: do {
int alt7 = 2;
int LA7_0 = input.LA( 1 );
if ( ( LA7_0 == COMPLEX_ELEMENT_ITEM_SEPARATOR ) ) {
alt7 = 1;
}
switch ( alt7 ) {
case 1:
// C:\\workspace-sts\\Kettle trunk -
// restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\
// FastSimpleGenericEdifactDirectXML.g:108:75:
// ds i+= tag_index_id
pushFollow( FOLLOW_ds_in_tag213 );
ds();
state._fsp--;
pushFollow( FOLLOW_tag_index_id_in_tag217 );
i = tag_index_id();
state._fsp--;
if ( list_i == null ) {
list_i = new ArrayList<Object>();
}
list_i.add( i.getTemplate() );
break;
default:
break loop7;
}
} while ( true );
retval.name = ( tag_name3 != null ? input.toString( tag_name3.start, tag_name3.stop ) : null ).trim();
retval.stop = input.LT( -1 );
} catch ( RecognitionException e ) {
// do not try to recover from parse errors, propagate the error instead
throw e;
}
return retval;
}