public IElementType advance() throws java.io.IOException
  {
    int zzInput;
    int zzAction;

    // cached fields:
    int zzCurrentPosL;
    int zzMarkedPosL;
    int zzEndReadL = zzEndRead;
    CharSequence zzBufferL = zzBuffer;

    int [] zzTransL = ZZ_TRANS;
    int [] zzRowMapL = ZZ_ROWMAP;
    int [] zzAttrL = ZZ_ATTRIBUTE;

    while (true) {
      zzMarkedPosL = zzMarkedPos;

      if (zzMarkedPosL > zzStartRead) {
        switch (zzBufferL.charAt(zzMarkedPosL-1)) {
        case '\n':
        case '\u000B':  // fall through
        case '\u000C':  // fall through
        case '\u0085':  // fall through
        case '\u2028':  // fall through
        case '\u2029':  // fall through
          zzAtBOL = true;
          break;
        case '\r': 
          if (zzMarkedPosL < zzEndReadL)
            zzAtBOL = zzBufferL.charAt(zzMarkedPosL) != '\n';
          else if (zzAtEOF)
            zzAtBOL = false;
          else {
            boolean eof = zzRefill();
            zzMarkedPosL = zzMarkedPos;
            zzEndReadL = zzEndRead;
            zzBufferL = zzBuffer;
            if (eof) 
              zzAtBOL = false;
            else 
              zzAtBOL = zzBufferL.charAt(zzMarkedPosL) != '\n';
          }
          break;
        default:
          zzAtBOL = false;
        }
      }
      zzAction = -1;

      zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;

      if (zzAtBOL)
        zzState = ZZ_LEXSTATE[zzLexicalState+1];
      else
        zzState = ZZ_LEXSTATE[zzLexicalState];

      // set up zzAction for empty match case:
      int zzAttributes = zzAttrL[zzState];
      if ( (zzAttributes & 1) == 1 ) {
        zzAction = zzState;
      }


      zzForAction: {
        while (true) {

          if (zzCurrentPosL < zzEndReadL) {
            zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL);
            zzCurrentPosL += Character.charCount(zzInput);
          }
          else if (zzAtEOF) {
            zzInput = YYEOF;
            break zzForAction;
          }
          else {
            // store back cached positions
            zzCurrentPos  = zzCurrentPosL;
            zzMarkedPos   = zzMarkedPosL;
            boolean eof = zzRefill();
            // get translated positions and possibly new buffer
            zzCurrentPosL  = zzCurrentPos;
            zzMarkedPosL   = zzMarkedPos;
            zzBufferL      = zzBuffer;
            zzEndReadL     = zzEndRead;
            if (eof) {
              zzInput = YYEOF;
              break zzForAction;
            }
            else {
              zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL);
              zzCurrentPosL += Character.charCount(zzInput);
            }
          }
          int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMap(zzInput) ];
          if (zzNext == -1) break zzForAction;
          zzState = zzNext;

          zzAttributes = zzAttrL[zzState];
          if ( (zzAttributes & 1) == 1 ) {
            zzAction = zzState;
            zzMarkedPosL = zzCurrentPosL;
            if ( (zzAttributes & 8) == 8 ) break zzForAction;
          }

        }
      }

      // store back cached position
      zzMarkedPos = zzMarkedPosL;

      if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
        zzAtEOF = true;
        return null;
      }
      else {
        switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
          case 1:
            { return BAD_CHARACTER;
            }
          // fall through
          case 138: break;
          case 2:
            { return WHITESPACE;
            }
          // fall through
          case 139: break;
          case 3:
            { return LINEFEED;
            }
          // fall through
          case 140: break;
          case 4:
            { return BANG;
            }
          // fall through
          case 141: break;
          case 5:
            { pushState(STRING_EXPRESSION); return OPEN_QUOTE;
            }
          // fall through
          case 142: break;
          case 6:
            { return COMMENT;
            }
          // fall through
          case 143: break;
          case 7:
            { return DOLLAR;
            }
          // fall through
          case 144: break;
          case 8:
            { return WORD;
            }
          // fall through
          case 145: break;
          case 9:
            { return AMP;
            }
          // fall through
          case 146: break;
          case 10:
            { return RAW_STRING;
            }
          // fall through
          case 147: break;
          case 11:
            { if (!isPreviousChar('$') && yystate() != CONDITIONAL_EXPRESSION)
                                      pushState(PARENTHESES_COMMAND_SUBSTITUTION);
                                    pushParentheses(PARENTHESES); return LEFT_PAREN;
            }
          // fall through
          case 148: break;
          case 12:
            { if (shouldCloseLgGtParen()) {
                                      popParentheses();
                                      return RIGHT_PAREN;
                                    }
                                    if (shouldCloseSingleParen())
                                      popParentheses();
                                    popState(PARENTHESES_COMMAND_SUBSTITUTION);
                                    if (yystate() == CASE_PATTERN) popState();
                                    return RIGHT_PAREN;
            }
          // fall through
          case 149: break;
          case 13:
            { return INT;
            }
          // fall through
          case 150: break;
          case 14:
            { return SEMI;
            }
          // fall through
          case 151: break;
          case 15:
            { return LT;
            }
          // fall through
          case 152: break;
          case 16:
            { return ASSIGN;
            }
          // fall through
          case 153: break;
          case 17:
            { return GT;
            }
          // fall through
          case 154: break;
          case 18:
            { pushState(CONDITIONAL_EXPRESSION); return LEFT_SQUARE;
            }
          // fall through
          case 155: break;
          case 19:
            { switch (yystate()) {
                                      case OLD_ARITHMETIC_EXPRESSION: popState(); return ARITH_SQUARE_RIGHT;
                                      case CONDITIONAL_EXPRESSION: popState(); return RIGHT_SQUARE;
                                      default: return RIGHT_SQUARE; }
            }
          // fall through
          case 156: break;
          case 20:
            { if (yystate() == BACKQUOTE_COMMAND_SUBSTITUTION) { popState(); isBackquoteOpen = false; return CLOSE_BACKQUOTE; }
                                    else { pushState(BACKQUOTE_COMMAND_SUBSTITUTION); isBackquoteOpen = true; return OPEN_BACKQUOTE; }
            }
          // fall through
          case 157: break;
          case 21:
            { return LEFT_CURLY;
            }
          // fall through
          case 158: break;
          case 22:
            { return PIPE;
            }
          // fall through
          case 159: break;
          case 23:
            { return RIGHT_CURLY;
            }
          // fall through
          case 160: break;
          case 24:
            { return MOD;
            }
          // fall through
          case 161: break;
          case 25:
            { return MULT;
            }
          // fall through
          case 162: break;
          case 26:
            { return PLUS;
            }
          // fall through
          case 163: break;
          case 27:
            { return COMMA;
            }
          // fall through
          case 164: break;
          case 28:
            { return MINUS;
            }
          // fall through
          case 165: break;
          case 29:
            { return DIV;
            }
          // fall through
          case 166: break;
          case 30:
            { return COLON;
            }
          // fall through
          case 167: break;
          case 31:
            { return QMARK;
            }
          // fall through
          case 168: break;
          case 32:
            { return XOR;
            }
          // fall through
          case 169: break;
          case 33:
            { return BITWISE_NEGATION;
            }
          // fall through
          case 170: break;
          case 34:
            { popState(); return LINEFEED;
            }
          // fall through
          case 171: break;
          case 35:
            { if (isQuoteOpen) { isQuoteOpen = false; return CLOSE_QUOTE; }
                                    else { isQuoteOpen = true; return OPEN_QUOTE; }
            }
          // fall through
          case 172: break;
          case 36:
            { popState(); return SEMI;
            }
          // fall through
          case 173: break;
          case 37:
            { return EVAL_CONTENT;
            }
          // fall through
          case 174: break;
          case 38:
            { popState(); yypushback(yylength());
            }
          // fall through
          case 175: break;
          case 39:
            { if (isBackquoteOpen) { popState(); yypushback(yylength()); }
                                   else { pushState(BACKQUOTE_COMMAND_SUBSTITUTION); isBackquoteOpen = true; return OPEN_BACKQUOTE; }
            }
          // fall through
          case 176: break;
          case 40:
            { if (isBackquoteOpen) { popState(); yypushback(yylength()); }
                                    else { pushState(BACKQUOTE_COMMAND_SUBSTITUTION); isBackquoteOpen = true; return OPEN_BACKQUOTE; }
            }
          // fall through
          case 177: break;
          case 41:
            { popState(); return RIGHT_PAREN;
            }
          // fall through
          case 178: break;
          case 42:
            { return STRING_CONTENT;
            }
          // fall through
          case 179: break;
          case 43:
            { popState(); return CLOSE_QUOTE;
            }
          // fall through
          case 180: break;
          case 44:
            { pushState(BACKQUOTE_COMMAND_SUBSTITUTION); isBackquoteOpen = true; return OPEN_BACKQUOTE;
            }
          // fall through
          case 181: break;
          case 45:
            { if (regexGroups <= 0 && regexStart != getTokenStart()) { regexStart = -1; popState(); }; return WHITESPACE;
            }
          // fall through
          case 182: break;
          case 46:
            { regexGroups++; return WORD;
            }
          // fall through
          case 183: break;
          case 47:
            { if (regexGroups <= 0) { regexGroups = 0; popState(); return RIGHT_PAREN; } else { regexGroups--; return WORD; }
            }
          // fall through
          case 184: break;
          case 48:
            { if (herestringStartPosition != getTokenStart()) { herestringStartPosition=-1; popState(); } return WHITESPACE;
            }
          // fall through
          case 185: break;
          case 49:
            { herestringStartPosition=-1; popState(); return LINEFEED;
            }
          // fall through
          case 186: break;
          case 50:
            { herestringStartPosition=-1; popState(); yypushback(1);
            }
          // fall through
          case 187: break;
          case 51:
            { if ((yycharat(yylength()-1) == '\'' || yycharat(yylength()-1) == '"') && yylength() > 2)
                                      heredocMarker = yytext().subSequence(1, yylength()-1).toString();
                                    else heredocMarker = yytext().toString();
                                    heredocMarker = heredocMarker.replaceAll("(\\\\)(.)", "$2");
                                    yybegin(HERE_DOC_PIPELINE);
                                    return HEREDOC_MARKER_START;
            }
          // fall through
          case 188: break;
          case 52:
            { if (yytext().toString().equals(heredocMarker))
                                  { heredocMarker = null; heredocWithWhiteSpaceIgnore = false; popState(); return HEREDOC_MARKER_END; }
                                    else { yypushback(yylength()); yybegin(HERE_DOC_BODY); }
            }
          // fall through
          case 189: break;
          case 53:
            { if (!heredocWithWhiteSpaceIgnore) yybegin(HERE_DOC_BODY); return HEREDOC_CONTENT;
            }
          // fall through
          case 190: break;
          case 54:
            { yypushback(yylength()); yybegin(HERE_DOC_BODY);
            }
          // fall through
          case 191: break;
          case 55:
            { yybegin(HERE_DOC_END_MARKER); return LINEFEED;
            }
          // fall through
          case 192: break;
          case 56:
            { return HEREDOC_CONTENT;
            }
          // fall through
          case 193: break;
          case 57:
            { yybegin(HERE_DOC_END_MARKER); return HEREDOC_CONTENT;
            }
          // fall through
          case 194: break;
          case 58:
            { popState(PARAMETER_EXPANSION_WITHOUT_SEPARATOR); return WORD;
            }
          // fall through
          case 195: break;
          case 59:
            { popState(PARAMETER_EXPANSION_WITHOUT_SEPARATOR); return WHITESPACE;
            }
          // fall through
          case 196: break;
          case 60:
            { popState(PARAMETER_EXPANSION_WITHOUT_SEPARATOR); return LINEFEED;
            }
          // fall through
          case 197: break;
          case 61:
            { pushState(PARAMETER_EXPANSION_WITHOUT_SEPARATOR); return PARAM_SEPARATOR;
            }
          // fall through
          case 198: break;
          case 62:
            { pushState(PARAMETER_EXPANSION_EXPR); return PARAM_SEPARATOR;
            }
          // fall through
          case 199: break;
          case 63:
            { popState(PARAMETER_EXPANSION_WITHOUT_SEPARATOR); return INT;
            }
          // fall through
          case 200: break;
          case 64:
            { popState(PARAMETER_EXPANSION_WITHOUT_SEPARATOR); pushState(CONDITIONAL_EXPRESSION); return LEFT_SQUARE;
            }
          // fall through
          case 201: break;
          case 65:
            { popState(PARAMETER_EXPANSION_WITHOUT_SEPARATOR);             return LEFT_CURLY;
            }
          // fall through
          case 202: break;
          case 66:
            { if (yystate() == PARAMETER_EXPANSION_WITHOUT_SEPARATOR)
                                        { popState(); yypushback(yylength()); }
                                        else { popState(); return RIGHT_CURLY; }
            }
          // fall through
          case 203: break;
          case 67:
            { popState(); return WORD;
            }
          // fall through
          case 204: break;
          case 68:
            { return VAR;
            }
          // fall through
          case 205: break;
          case 69:
            { pushState(PARENTHESES_COMMAND_SUBSTITUTION); yypushback(1); return DOLLAR;
            }
          // fall through
          case 206: break;
          case 70:
            { pushState(OLD_ARITHMETIC_EXPRESSION); return ARITH_SQUARE_LEFT;
            }
          // fall through
          case 207: break;
          case 71:
            { pushState(PARAMETER_EXPANSION); yypushback(1); return DOLLAR;
            }
          // fall through
          case 208: break;
          case 72:
            { return AND_AND;
            }
          // fall through
          case 209: break;
          case 73:
            { return FILEDESCRIPTOR;
            }
          // fall through
          case 210: break;
          case 74:
            { return REDIRECT_AMP_GREATER;
            }
          // fall through
          case 211: break;
          case 75:
            { return PLUS_ASSIGN;
            }
          // fall through
          case 212: break;
          case 76:
            { return OCTAL;
            }
          // fall through
          case 213: break;
          case 77:
            { return REDIRECT_LESS_AMP;
            }
          // fall through
          case 214: break;
          case 78:
            { pushParentheses(LT_GT_PARENTHESES); return INPUT_PROCESS_SUBSTITUTION;
            }
          // fall through
          case 215: break;
          case 79:
            { if (yystate() != HERE_DOC_PIPELINE)
                                    { pushState(HERE_DOC_START_MARKER); return HEREDOC_MARKER_TAG; }
                                    else return SHIFT_LEFT;
            }
          // fall through
          case 216: break;
          case 80:
            { return REDIRECT_LESS_GREATER;
            }
          // fall through
          case 217: break;
          case 81:
            { return REDIRECT_GREATER_AMP;
            }
          // fall through
          case 218: break;
          case 82:
            { pushParentheses(LT_GT_PARENTHESES); return OUTPUT_PROCESS_SUBSTITUTION;
            }
          // fall through
          case 219: break;
          case 83:
            { return SHIFT_RIGHT;
            }
          // fall through
          case 220: break;
          case 84:
            { return REDIRECT_GREATER_BAR;
            }
          // fall through
          case 221: break;
          case 85:
            // lookahead expression with fixed lookahead length
            zzMarkedPos = Character.offsetByCodePoints
                (zzBufferL, zzMarkedPos, -1);
            { return WORD;
            }
          // fall through
          case 222: break;
          case 86:
            { pushState(CONDITIONAL_EXPRESSION); return LEFT_DOUBLE_BRACKET;
            }
          // fall through
          case 223: break;
          case 87:
            { popState(CONDITIONAL_EXPRESSION); return RIGHT_DOUBLE_BRACKET;
            }
          // fall through
          case 224: break;
          case 88:
            { return DO;
            }
          // fall through
          case 225: break;
          case 89:
            { popState(IF_CONDITION); return FI;
            }
          // fall through
          case 226: break;
          case 90:
            { pushState(IF_CONDITION); return IF;
            }
          // fall through
          case 227: break;
          case 91:
            { return IN;
            }
          // fall through
          case 228: break;
          case 92:
            { return PIPE_AMP;
            }
          // fall through
          case 229: break;
          case 93:
            { return OR_OR;
            }
          // fall through
          case 230: break;
          case 94:
            { if (getTokenStart() == 0) return SHEBANG; else return COMMENT;
            }
          // fall through
          case 231: break;
          case 95:
            { return NE;
            }
          // fall through
          case 232: break;
          case 96:
            { return MOD_ASSIGN;
            }
          // fall through
          case 233: break;
          case 97:
            { return BIT_AND_ASSIGN;
            }
          // fall through
          case 234: break;
          case 98:
            { return EXPONENT;
            }
          // fall through
          case 235: break;
          case 99:
            { return MULT_ASSIGN;
            }
          // fall through
          case 236: break;
          case 100:
            { return PLUS_PLUS;
            }
          // fall through
          case 237: break;
          case 101:
            { return MINUS_MINUS;
            }
          // fall through
          case 238: break;
          case 102:
            { return MINUS_ASSIGN;
            }
          // fall through
          case 239: break;
          case 103:
            { return DIV_ASSIGN;
            }
          // fall through
          case 240: break;
          case 104:
            { return SHIFT_LEFT;
            }
          // fall through
          case 241: break;
          case 105:
            { return LE;
            }
          // fall through
          case 242: break;
          case 106:
            { return EQ;
            }
          // fall through
          case 243: break;
          case 107:
            { regexStart = getTokenEnd(); regexGroups = 0; pushState(REGULAR_EXPRESSION); return REGEXP;
            }
          // fall through
          case 244: break;
          case 108:
            { return GE;
            }
          // fall through
          case 245: break;
          case 109:
            { return BIT_XOR_ASSIGN;
            }
          // fall through
          case 246: break;
          case 110:
            { return BIT_OR_ASSIGN;
            }
          // fall through
          case 247: break;
          case 111:
            { pushState(CASE_PATTERN);    return CASE_END;
            }
          // fall through
          case 248: break;
          case 112:
            { if (yystate() == CASE_CONDITION) {pushState(CASE_PATTERN); return IN; } else return WORD;
            }
          // fall through
          case 249: break;
          case 113:
            { popState(PARAMETER_EXPANSION_WITHOUT_SEPARATOR); return OCTAL;
            }
          // fall through
          case 250: break;
          case 114:
            { popState(PARAMETER_EXPANSION_WITHOUT_SEPARATOR); pushState(CONDITIONAL_EXPRESSION); return LEFT_DOUBLE_BRACKET;
            }
          // fall through
          case 251: break;
          case 115:
            { return REDIRECT_AMP_GREATER_GREATER;
            }
          // fall through
          case 252: break;
          case 116:
            { return HEX;
            }
          // fall through
          case 253: break;
          case 117:
            { if (yystate() != HERE_DOC_PIPELINE)
                                    { pushState(HERE_DOC_START_MARKER); heredocWithWhiteSpaceIgnore = true; return HEREDOC_MARKER_TAG; }
                                    else return SHIFT_LEFT;
            }
          // fall through
          case 254: break;
          case 118:
            { herestringStartPosition = getTokenEnd(); pushState(HERE_STRING); return REDIRECT_HERE_STRING;
            }
          // fall through
          case 255: break;
          case 119:
            // lookahead expression with fixed lookahead length
            zzMarkedPos = Character.offsetByCodePoints
                (zzBufferL, zzMarkedPos, -2);
            { return WORD;
            }
          // fall through
          case 256: break;
          case 120:
            { pushState(LET_EXPRESSION); return LET;
            }
          // fall through
          case 257: break;
          case 121:
            { return SHIFT_LEFT_ASSIGN;
            }
          // fall through
          case 258: break;
          case 122:
            { return SHIFT_RIGHT_ASSIGN;
            }
          // fall through
          case 259: break;
          case 123:
            { return LET;
            }
          // fall through
          case 260: break;
          case 124:
            { popState(PARAMETER_EXPANSION_WITHOUT_SEPARATOR); return HEX;
            }
          // fall through
          case 261: break;
          case 125:
            { pushState(CASE_CONDITION); return CASE;
            }
          // fall through
          case 262: break;
          case 126:
            { popState(OTHER_CONDITIONS); return DONE;
            }
          // fall through
          case 263: break;
          case 127:
            { return ELIF;
            }
          // fall through
          case 264: break;
          case 128:
            { return ELSE;
            }
          // fall through
          case 265: break;
          case 129:
            { popState(CASE_CONDITION); return ESAC;
            }
          // fall through
          case 266: break;
          case 130:
            { pushState(EVAL_EXPRESSION); return EVAL;
            }
          // fall through
          case 267: break;
          case 131:
            // lookahead expression with fixed base length
            zzMarkedPos = Character.offsetByCodePoints
                (zzBufferL, zzStartRead, 3);
            { pushState(OTHER_CONDITIONS); return FOR;
            }
          // fall through
          case 268: break;
          case 132:
            { pushState(TEST_EXPRESSION); return TEST;
            }
          // fall through
          case 269: break;
          case 133:
            { return THEN;
            }
          // fall through
          case 270: break;
          case 134:
            { pushState(OTHER_CONDITIONS); return UNTIL;
            }
          // fall through
          case 271: break;
          case 135:
            { pushState(OTHER_CONDITIONS); return WHILE;
            }
          // fall through
          case 272: break;
          case 136:
            { pushState(OTHER_CONDITIONS); return SELECT;
            }
          // fall through
          case 273: break;
          case 137:
            { return FUNCTION;
            }
          // fall through
          case 274: break;
          default:
            zzScanError(ZZ_NO_MATCH);
          }
      }
    }
  }
public IElementType advance()