コード例 #1
0
  // helper method for writing tag indexes to the stream
  public void appendIndexes() {

    if (tagIndexes.size() == 0) return;

    // System.out.println(tagIndexes);
    for (Object i : tagIndexes) {
      String s = (String) i;
      buf.append("\t\t<index>" + s + "</index>\n");
    }
  }
コード例 #2
0
  // $ANTLR start "composite_data_item"
  // C:\\workspace-sts\\Kettle trunk -
  // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:102:1: composite_data_item : composite_data_item_val ;
  public final FastSimpleGenericEdifactDirectXMLParser.composite_data_item_return
      composite_data_item() throws RecognitionException {
    FastSimpleGenericEdifactDirectXMLParser.composite_data_item_return retval =
        new FastSimpleGenericEdifactDirectXMLParser.composite_data_item_return();
    retval.start = input.LT(1);

    FastSimpleGenericEdifactDirectXMLParser.composite_data_item_val_return
        composite_data_item_val2 = null;

    try {
      // C:\\workspace-sts\\Kettle trunk -
      // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:102:21: ( composite_data_item_val )
      // C:\\workspace-sts\\Kettle trunk -
      // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:102:23: composite_data_item_val
      {
        pushFollow(FOLLOW_composite_data_item_val_in_composite_data_item180);
        composite_data_item_val2 = composite_data_item_val();

        state._fsp--;

        buf.append(TAG_VALUE);
        buf.append(
            sanitizeText(
                (composite_data_item_val2 != null
                    ? input.toString(composite_data_item_val2.start, composite_data_item_val2.stop)
                    : null)));
        buf.append(TAG_VALUE_END);
      }

      retval.stop = input.LT(-1);

    }

    // do not try to recover from parse errors, propagate the error instead
    catch (RecognitionException e) {
      throw e;
    } finally {
      // do for sure before leaving
    }
    return retval;
  }
コード例 #3
0
  // $ANTLR start "data_element_payload"
  // C:\\workspace-sts\\Kettle trunk -
  // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:98:1: data_element_payload : ( composite_data_item ds )* composite_data_item ;
  public final FastSimpleGenericEdifactDirectXMLParser.data_element_payload_return
      data_element_payload() throws RecognitionException {
    FastSimpleGenericEdifactDirectXMLParser.data_element_payload_return retval =
        new FastSimpleGenericEdifactDirectXMLParser.data_element_payload_return();
    retval.start = input.LT(1);

    try {
      // C:\\workspace-sts\\Kettle trunk -
      // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:98:22: ( ( composite_data_item ds )* composite_data_item )
      // C:\\workspace-sts\\Kettle trunk -
      // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:98:24: ( composite_data_item ds )* composite_data_item
      {
        buf.append(TAG_ELEMENT);

        // C:\\workspace-sts\\Kettle trunk -
        // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:99:4: ( composite_data_item ds )*
        loop5:
        do {
          int alt5 = 2;
          int LA5_0 = input.LA(1);

          if ((LA5_0 == TEXT_DATA)) {
            int LA5_1 = input.LA(2);

            if ((LA5_1 == COMPLEX_ELEMENT_ITEM_SEPARATOR)) {
              alt5 = 1;
            }

          } else if ((LA5_0 == COMPLEX_ELEMENT_ITEM_SEPARATOR)) {
            alt5 = 1;
          }

          switch (alt5) {
            case 1:
              // C:\\workspace-sts\\Kettle trunk -
              // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:99:5: composite_data_item ds
              {
                pushFollow(FOLLOW_composite_data_item_in_data_element_payload160);
                composite_data_item();

                state._fsp--;

                pushFollow(FOLLOW_ds_in_data_element_payload162);
                ds();

                state._fsp--;
              }
              break;

            default:
              break loop5;
          }
        } while (true);

        pushFollow(FOLLOW_composite_data_item_in_data_element_payload166);
        composite_data_item();

        state._fsp--;

        buf.append(TAG_ELEMENT_END);
      }

      retval.stop = input.LT(-1);

    }

    // do not try to recover from parse errors, propagate the error instead
    catch (RecognitionException e) {
      throw e;
    } finally {
      // do for sure before leaving
    }
    return retval;
  }
コード例 #4
0
  // $ANTLR start "segment"
  // C:\\workspace-sts\\Kettle trunk -
  // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:91:1: segment : tag ( data_element )* SEGMENT_TERMINATOR ( ' ' | '\\n' | '\\r' | '\\t' )* ;
  public final FastSimpleGenericEdifactDirectXMLParser.segment_return segment()
      throws RecognitionException {
    FastSimpleGenericEdifactDirectXMLParser.segment_return retval =
        new FastSimpleGenericEdifactDirectXMLParser.segment_return();
    retval.start = input.LT(1);

    FastSimpleGenericEdifactDirectXMLParser.tag_return tag1 = null;

    try {
      // C:\\workspace-sts\\Kettle trunk -
      // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:91:11: ( tag ( data_element )* SEGMENT_TERMINATOR ( ' ' | '\\n' | '\\r' | '\\t' )* )
      // C:\\workspace-sts\\Kettle trunk -
      // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:91:13: tag ( data_element )* SEGMENT_TERMINATOR ( ' ' | '\\n' | '\\r' | '\\t' )*
      {
        pushFollow(FOLLOW_tag_in_segment107);
        tag1 = tag();

        state._fsp--;

        buf.append("\t<" + (tag1 != null ? tag1.name : null) + ">\n");
        appendIndexes();

        // C:\\workspace-sts\\Kettle trunk -
        // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:92:4: ( data_element )*
        loop3:
        do {
          int alt3 = 2;
          int LA3_0 = input.LA(1);

          if ((LA3_0 == ELEMENT_SEPARATOR)) {
            alt3 = 1;
          }

          switch (alt3) {
            case 1:
              // C:\\workspace-sts\\Kettle trunk -
              // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:92:4: data_element
              {
                pushFollow(FOLLOW_data_element_in_segment114);
                data_element();

                state._fsp--;
              }
              break;

            default:
              break loop3;
          }
        } while (true);

        match(input, SEGMENT_TERMINATOR, FOLLOW_SEGMENT_TERMINATOR_in_segment117);

        // C:\\workspace-sts\\Kettle trunk -
        // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:92:37: ( ' ' | '\\n' | '\\r' | '\\t' )*
        loop4:
        do {
          int alt4 = 2;
          int LA4_0 = input.LA(1);

          if ((LA4_0 == 9 || (LA4_0 >= 12 && LA4_0 <= 14))) {
            alt4 = 1;
          }

          switch (alt4) {
            case 1:
              // C:\\workspace-sts\\Kettle trunk -
              // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:
              {
                if (input.LA(1) == 9 || (input.LA(1) >= 12 && input.LA(1) <= 14)) {
                  input.consume();
                  state.errorRecovery = false;
                } else {
                  MismatchedSetException mse = new MismatchedSetException(null, input);
                  throw mse;
                }
              }
              break;

            default:
              break loop4;
          }
        } while (true);

        buf.append("\t</" + (tag1 != null ? tag1.name : null) + ">\n");
      }

      retval.stop = input.LT(-1);

    }

    // do not try to recover from parse errors, propagate the error instead
    catch (RecognitionException e) {
      throw e;
    } finally {
      // do for sure before leaving
    }
    return retval;
  }
コード例 #5
0
  // $ANTLR start "edifact"
  // C:\\workspace-sts\\Kettle trunk -
  // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:77:1: edifact : ( una )? ( segment )* ;
  public final FastSimpleGenericEdifactDirectXMLParser.edifact_return edifact()
      throws RecognitionException {
    FastSimpleGenericEdifactDirectXMLParser.edifact_return retval =
        new FastSimpleGenericEdifactDirectXMLParser.edifact_return();
    retval.start = input.LT(1);

    try {
      // C:\\workspace-sts\\Kettle trunk -
      // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:81:4: ( ( una )? ( segment )* )
      // C:\\workspace-sts\\Kettle trunk -
      // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:81:6: ( una )? ( segment )*
      {
        // C:\\workspace-sts\\Kettle trunk -
        // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:81:6: ( una )?
        int alt1 = 2;
        int LA1_0 = input.LA(1);

        if (((LA1_0 >= 10 && LA1_0 <= 11))) {
          alt1 = 1;
        }
        switch (alt1) {
          case 1:
            // C:\\workspace-sts\\Kettle trunk -
            // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:81:6: una
            {
              pushFollow(FOLLOW_una_in_edifact64);
              una();

              state._fsp--;
            }
            break;
        }

        buf = new StringBuilder(8192);
        buf.append(XML_HEAD);
        buf.append(TAG_EDIFACT);

        // C:\\workspace-sts\\Kettle trunk -
        // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:83:4: ( segment )*
        loop2:
        do {
          int alt2 = 2;
          int LA2_0 = input.LA(1);

          if ((LA2_0 == TEXT_DATA)) {
            alt2 = 1;
          }

          switch (alt2) {
            case 1:
              // C:\\workspace-sts\\Kettle trunk -
              // restruct\\engine\\src\\org\\pentaho\\di\\trans\\steps\\edi2xml\\grammar\\FastSimpleGenericEdifactDirectXML.g:83:4: segment
              {
                pushFollow(FOLLOW_segment_in_edifact76);
                segment();

                state._fsp--;
              }
              break;

            default:
              break loop2;
          }
        } while (true);

        buf.append(TAG_EDIFACT_END);
      }

      retval.stop = input.LT(-1);

      // System.out.println(buf.toString());

    }

    // do not try to recover from parse errors, propagate the error instead
    catch (RecognitionException e) {
      throw e;
    } finally {
      // do for sure before leaving
    }
    return retval;
  }