Java 类org.antlr.runtime.RuleReturnScope 实例源码

项目:templates4j    文件:TestTreeConstruction.java   
@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);
}
项目:templates4j    文件:TestTreeConstruction.java   
@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);
}
项目:pentaho-kettle    文件:FastSimpleGenericEdifactDirectXMLParser.java   
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;
}