// $ANTLR start "STRING_LITERAL"
  public final void mSTRING_LITERAL() throws RecognitionException {
    try {
      int _type = STRING_LITERAL;
      int _channel = DEFAULT_TOKEN_CHANNEL;
      int c;

      // TWS_VARIABLES.g:51:3: ( '\"' (c=~ ( '\"' | '\\r' | '\\n' ) )* '\"' )
      // TWS_VARIABLES.g:51:5: '\"' (c=~ ( '\"' | '\\r' | '\\n' ) )* '\"'
      {
        match('\"');
        StringBuilder b = new StringBuilder();
        // TWS_VARIABLES.g:53:5: (c=~ ( '\"' | '\\r' | '\\n' ) )*
        loop1:
        while (true) {
          int alt1 = 2;
          int LA1_0 = input.LA(1);
          if (((LA1_0 >= '\u0000' && LA1_0 <= '\t')
              || (LA1_0 >= '\u000B' && LA1_0 <= '\f')
              || (LA1_0 >= '\u000E' && LA1_0 <= '!')
              || (LA1_0 >= '#' && LA1_0 <= '\uFFFF'))) {
            alt1 = 1;
          }

          switch (alt1) {
            case 1:
              // TWS_VARIABLES.g:53:7: c=~ ( '\"' | '\\r' | '\\n' )
              {
                c = input.LA(1);
                if ((input.LA(1) >= '\u0000' && input.LA(1) <= '\t')
                    || (input.LA(1) >= '\u000B' && input.LA(1) <= '\f')
                    || (input.LA(1) >= '\u000E' && input.LA(1) <= '!')
                    || (input.LA(1) >= '#' && input.LA(1) <= '\uFFFF')) {
                  input.consume();
                } else {
                  MismatchedSetException mse = new MismatchedSetException(null, input);
                  recover(mse);
                  throw mse;
                }
                b.appendCodePoint(c);
              }
              break;

            default:
              break loop1;
          }
        }

        match('\"');
        setText(b.toString());
      }

      state.type = _type;
      state.channel = _channel;
    } finally {
      // do for sure before leaving
    }
  }
 public String show() {
   StringBuilder buf = new StringBuilder();
   if (imports != null) buf.append(" : " + imports);
   for (String name : templates.keySet()) {
     CompiledST c = rawGetTemplate(name);
     if (c.isAnonSubtemplate || c == NOT_FOUND_ST) continue;
     int slash = name.lastIndexOf('/');
     name = name.substring(slash + 1, name.length());
     buf.append(name);
     buf.append('(');
     if (c.formalArguments != null)
       buf.append(Misc.join(c.formalArguments.values().iterator(), ","));
     buf.append(')');
     buf.append(" ::= <<" + Misc.newline);
     buf.append(c.template + Misc.newline);
     buf.append(">>" + Misc.newline);
   }
   return buf.toString();
 }
  // 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");
    }
  }
  // $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;
  }
  // $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;
  }
  // $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;
  }
  // $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;
  }