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;

      boolean zzR = false;
      int zzCh;
      int zzCharCount;
      for (zzCurrentPosL = zzStartRead  ;
           zzCurrentPosL < zzMarkedPosL ;
           zzCurrentPosL += zzCharCount ) {
        zzCh = Character.codePointAt(zzBufferL, zzCurrentPosL);
        zzCharCount = Character.charCount(zzCh);
        switch (zzCh) {
        case '\u000B':  // fall through
        case '\u000C':  // fall through
        case '\u0085':  // fall through
        case '\u2028':  // fall through
        case '\u2029':
          yycolumn = 0;
          zzR = false;
          break;
        case '\r':
          yycolumn = 0;
          zzR = true;
          break;
        case '\n':
          if (zzR)
            zzR = false;
          else {
            yycolumn = 0;
          }
          break;
        default:
          zzR = false;
          yycolumn += zzCharCount;
        }
      }

      zzAction = -1;

      zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;

      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:
            { goToState(getStateAfterLineStart(0));
            }
          // fall through
          case 44: break;
          case 2:
            { yybegin(getStateAfterLineStart(yylength()));
        return getWhitespaceType();
            }
          // fall through
          case 45: break;
          case 3:
            { myPossiblePlainTextScalarContinue = true;
        return TEXT;
            }
          // fall through
          case 46: break;
          case 4:
            { return getWhitespaceType();
            }
          // fall through
          case 47: break;
          case 5:
            { if(!myPossiblePlainTextScalarContinue && myPrevElementIndent == 0) {
          // It is hard to find clean state in YAML lexer :(
          yybegin(YYINITIAL);
        }
        else {
          yybegin(LINE_START_STATE);
        }
        return EOL;
            }
          // fall through
          case 48: break;
          case 6:
            { return TEXT;
            }
          // fall through
          case 49: break;
          case 7:
            { return COMMENT;
            }
          // fall through
          case 50: break;
          case 8:
            { myPrevElementIndent = yycolumn;
        return COLON;
            }
          // fall through
          case 51: break;
          case 9:
            { myReturnState = yystate();
        yybegin(BS_HEADER_TAIL_STATE);
        myBlockScalarType = SCALAR_TEXT;
        return myBlockScalarType;
            }
          // fall through
          case 52: break;
          case 10:
            { myPrevElementIndent = yycolumn;
        return QUESTION;
            }
          // fall through
          case 53: break;
          case 11:
            { openBrace();
        return LBRACKET;
            }
          // fall through
          case 54: break;
          case 12:
            { closeBrace();
        return RBRACKET;
            }
          // fall through
          case 55: break;
          case 13:
            { openBrace();
        return LBRACE;
            }
          // fall through
          case 56: break;
          case 14:
            { myReturnState = yystate();
        yybegin(BS_HEADER_TAIL_STATE);
        myBlockScalarType = SCALAR_LIST;
        return myBlockScalarType;
            }
          // fall through
          case 57: break;
          case 15:
            { closeBrace();
        return RBRACE;
            }
          // fall through
          case 58: break;
          case 16:
            { return EOL;
            }
          // fall through
          case 59: break;
          case 17:
            { return COMMA;
            }
          // fall through
          case 60: break;
          case 18:
            { yybegin(LINE_START_STATE);
        return EOL;
            }
          // fall through
          case 61: break;
          case 19:
            { goToState(BLOCK_STATE);
            }
          // fall through
          case 62: break;
          case 20:
            { yybegin(myReturnState);
        return ANCHOR;
            }
          // fall through
          case 63: break;
          case 21:
            { yybegin(myReturnState);
        return ALIAS;
            }
          // fall through
          case 64: break;
          case 22:
            { yybegin(myReturnState);
        return COLON;
            }
          // fall through
          case 65: break;
          case 23:
            { goToState(BS_BODY_STATE);
            }
          // fall through
          case 66: break;
          case 24:
            { assert yycolumn > myPrevElementIndent;
        return myBlockScalarType;
            }
          // fall through
          case 67: break;
          case 25:
            { return SCALAR_EOL;
            }
          // fall through
          case 68: break;
          case 26:
            // general lookahead, find correct zzMarkedPos
            { int zzFState = 13;
              int zzFPos = zzStartRead;
              if (zzFin == null || zzFin.size() <= zzBufferL.length()) {
                zzFin = new BitSet(zzBufferL.length()+1);
              }
              BitSet zzFinL = zzFin;
              while (zzFState != -1 && zzFPos < zzMarkedPos) {
                zzFinL.set(zzFPos, ((zzAttrL[zzFState] & 1) == 1));
                zzInput = Character.codePointAt(zzBufferL, zzFPos);
                zzFPos += Character.charCount(zzInput);
                zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMap(zzInput) ];
              }
              if (zzFState != -1) {
                zzFinL.set(zzFPos++, ((zzAttrL[zzFState] & 1) == 1));
              }
              while (zzFPos <= zzMarkedPos) {
                zzFinL.clear(zzFPos++);
              }

              zzFState = 12;
              zzFPos = zzMarkedPos;
              while (!zzFinL.get(zzFPos) || (zzAttrL[zzFState] & 1) != 1) {
                zzInput = Character.codePointBefore(zzBufferL, zzFPos);
                zzFPos -= Character.charCount(zzInput);
                zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMap(zzInput) ];
              };
              zzMarkedPos = zzFPos;
            }
            { return processScalarKey();
            }
          // fall through
          case 69: break;
          case 27:
            // general lookahead, find correct zzMarkedPos
            { int zzFState = 9;
              int zzFPos = zzStartRead;
              if (zzFin == null || zzFin.size() <= zzBufferL.length()) {
                zzFin = new BitSet(zzBufferL.length()+1);
              }
              BitSet zzFinL = zzFin;
              while (zzFState != -1 && zzFPos < zzMarkedPos) {
                zzFinL.set(zzFPos, ((zzAttrL[zzFState] & 1) == 1));
                zzInput = Character.codePointAt(zzBufferL, zzFPos);
                zzFPos += Character.charCount(zzInput);
                zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMap(zzInput) ];
              }
              if (zzFState != -1) {
                zzFinL.set(zzFPos++, ((zzAttrL[zzFState] & 1) == 1));
              }
              while (zzFPos <= zzMarkedPos) {
                zzFinL.clear(zzFPos++);
              }

              zzFState = 10;
              zzFPos = zzMarkedPos;
              while (!zzFinL.get(zzFPos) || (zzAttrL[zzFState] & 1) != 1) {
                zzInput = Character.codePointBefore(zzBufferL, zzFPos);
                zzFPos -= Character.charCount(zzInput);
                zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMap(zzInput) ];
              };
              zzMarkedPos = zzFPos;
            }
            { return TAG;
            }
          // fall through
          case 70: break;
          case 28:
            { return SCALAR_DSTRING;
            }
          // fall through
          case 71: break;
          case 29:
            // lookahead expression with fixed base length
            zzMarkedPos = Character.offsetByCodePoints
                (zzBufferL, zzStartRead, 1);
            { myReturnState = yystate();
        yybegin(ANCHOR_MODE);
        return AMPERSAND;
            }
          // fall through
          case 72: break;
          case 30:
            { return SCALAR_STRING;
            }
          // fall through
          case 73: break;
          case 31:
            // lookahead expression with fixed base length
            zzMarkedPos = Character.offsetByCodePoints
                (zzBufferL, zzStartRead, 1);
            { myReturnState = yystate();
        yybegin(ALIAS_MODE);
        return STAR;
            }
          // fall through
          case 74: break;
          case 32:
            // lookahead expression with fixed base length
            zzMarkedPos = Character.offsetByCodePoints
                (zzBufferL, zzStartRead, 1);
            { myPrevElementIndent = yycolumn;
        return SEQUENCE_MARKER;
            }
          // fall through
          case 75: break;
          case 33:
            // general lookahead, find correct zzMarkedPos
            { int zzFState = 14;
              int zzFPos = zzStartRead;
              if (zzFin == null || zzFin.size() <= zzBufferL.length()) {
                zzFin = new BitSet(zzBufferL.length()+1);
              }
              BitSet zzFinL = zzFin;
              while (zzFState != -1 && zzFPos < zzMarkedPos) {
                zzFinL.set(zzFPos, ((zzAttrL[zzFState] & 1) == 1));
                zzInput = Character.codePointAt(zzBufferL, zzFPos);
                zzFPos += Character.charCount(zzInput);
                zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMap(zzInput) ];
              }
              if (zzFState != -1) {
                zzFinL.set(zzFPos++, ((zzAttrL[zzFState] & 1) == 1));
              }
              while (zzFPos <= zzMarkedPos) {
                zzFinL.clear(zzFPos++);
              }

              zzFState = 12;
              zzFPos = zzMarkedPos;
              while (!zzFinL.get(zzFPos) || (zzAttrL[zzFState] & 1) != 1) {
                zzInput = Character.codePointBefore(zzBufferL, zzFPos);
                zzFPos -= Character.charCount(zzInput);
                zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMap(zzInput) ];
              };
              zzMarkedPos = zzFPos;
            }
            { return processScalarKey();
            }
          // fall through
          case 76: break;
          case 34:
            // general lookahead, find correct zzMarkedPos
            { int zzFState = 13;
              int zzFPos = zzStartRead;
              if (zzFin == null || zzFin.size() <= zzBufferL.length()) {
                zzFin = new BitSet(zzBufferL.length()+1);
              }
              BitSet zzFinL = zzFin;
              while (zzFState != -1 && zzFPos < zzMarkedPos) {
                zzFinL.set(zzFPos, ((zzAttrL[zzFState] & 1) == 1));
                zzInput = Character.codePointAt(zzBufferL, zzFPos);
                zzFPos += Character.charCount(zzInput);
                zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMap(zzInput) ];
              }
              if (zzFState != -1) {
                zzFinL.set(zzFPos++, ((zzAttrL[zzFState] & 1) == 1));
              }
              while (zzFPos <= zzMarkedPos) {
                zzFinL.clear(zzFPos++);
              }

              zzFState = 12;
              zzFPos = zzMarkedPos;
              while (!zzFinL.get(zzFPos) || (zzAttrL[zzFState] & 1) != 1) {
                zzInput = Character.codePointBefore(zzBufferL, zzFPos);
                zzFPos -= Character.charCount(zzInput);
                zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMap(zzInput) ];
              };
              zzMarkedPos = zzFPos;
            }
            { return processScalarKey(BLOCK_STATE);
            }
          // fall through
          case 77: break;
          case 35:
            // lookahead expression with fixed lookahead length
            zzMarkedPos = Character.offsetByCodePoints
                (zzBufferL, zzMarkedPos, -1);
            { int indent = yylength() - 1;
        yypushback(indent);
        if (indent <= myPrevElementIndent) {
          yybegin(getStateAfterBlockScalar());
          return EOL;
        } else {
          return SCALAR_EOL;
        }
            }
          // fall through
          case 78: break;
          case 36:
            { prepareForNewDocument();
        return DOCUMENT_MARKER;
            }
          // fall through
          case 79: break;
          case 37:
            { return DOCUMENT_END;
            }
          // fall through
          case 80: break;
          case 38:
            // general lookahead, find correct zzMarkedPos
            { int zzFState = 11;
              int zzFPos = zzStartRead;
              if (zzFin == null || zzFin.size() <= zzBufferL.length()) {
                zzFin = new BitSet(zzBufferL.length()+1);
              }
              BitSet zzFinL = zzFin;
              while (zzFState != -1 && zzFPos < zzMarkedPos) {
                zzFinL.set(zzFPos, ((zzAttrL[zzFState] & 1) == 1));
                zzInput = Character.codePointAt(zzBufferL, zzFPos);
                zzFPos += Character.charCount(zzInput);
                zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMap(zzInput) ];
              }
              if (zzFState != -1) {
                zzFinL.set(zzFPos++, ((zzAttrL[zzFState] & 1) == 1));
              }
              while (zzFPos <= zzMarkedPos) {
                zzFinL.clear(zzFPos++);
              }

              zzFState = 12;
              zzFPos = zzMarkedPos;
              while (!zzFinL.get(zzFPos) || (zzAttrL[zzFState] & 1) != 1) {
                zzInput = Character.codePointBefore(zzBufferL, zzFPos);
                zzFPos -= Character.charCount(zzInput);
                zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMap(zzInput) ];
              };
              zzMarkedPos = zzFPos;
            }
            { return processScalarKey();
            }
          // fall through
          case 81: break;
          case 39:
            // general lookahead, find correct zzMarkedPos
            { int zzFState = 13;
              int zzFPos = zzStartRead;
              if (zzFin == null || zzFin.size() <= zzBufferL.length()) {
                zzFin = new BitSet(zzBufferL.length()+1);
              }
              BitSet zzFinL = zzFin;
              while (zzFState != -1 && zzFPos < zzMarkedPos) {
                zzFinL.set(zzFPos, ((zzAttrL[zzFState] & 1) == 1));
                zzInput = Character.codePointAt(zzBufferL, zzFPos);
                zzFPos += Character.charCount(zzInput);
                zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMap(zzInput) ];
              }
              if (zzFState != -1) {
                zzFinL.set(zzFPos++, ((zzAttrL[zzFState] & 1) == 1));
              }
              while (zzFPos <= zzMarkedPos) {
                zzFinL.clear(zzFPos++);
              }

              zzFState = 15;
              zzFPos = zzMarkedPos;
              while (!zzFinL.get(zzFPos) || (zzAttrL[zzFState] & 1) != 1) {
                zzInput = Character.codePointBefore(zzBufferL, zzFPos);
                zzFPos -= Character.charCount(zzInput);
                zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMap(zzInput) ];
              };
              zzMarkedPos = zzFPos;
            }
            { return TEXT;
            }
          // fall through
          case 82: break;
          case 40:
            // general lookahead, find correct zzMarkedPos
            { int zzFState = 11;
              int zzFPos = zzStartRead;
              if (zzFin == null || zzFin.size() <= zzBufferL.length()) {
                zzFin = new BitSet(zzBufferL.length()+1);
              }
              BitSet zzFinL = zzFin;
              while (zzFState != -1 && zzFPos < zzMarkedPos) {
                zzFinL.set(zzFPos, ((zzAttrL[zzFState] & 1) == 1));
                zzInput = Character.codePointAt(zzBufferL, zzFPos);
                zzFPos += Character.charCount(zzInput);
                zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMap(zzInput) ];
              }
              if (zzFState != -1) {
                zzFinL.set(zzFPos++, ((zzAttrL[zzFState] & 1) == 1));
              }
              while (zzFPos <= zzMarkedPos) {
                zzFinL.clear(zzFPos++);
              }

              zzFState = 12;
              zzFPos = zzMarkedPos;
              while (!zzFinL.get(zzFPos) || (zzAttrL[zzFState] & 1) != 1) {
                zzInput = Character.codePointBefore(zzBufferL, zzFPos);
                zzFPos -= Character.charCount(zzInput);
                zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMap(zzInput) ];
              };
              zzMarkedPos = zzFPos;
            }
            { return processScalarKey(BLOCK_STATE);
            }
          // fall through
          case 83: break;
          case 41:
            // lookahead expression with fixed base length
            zzMarkedPos = Character.offsetByCodePoints
                (zzBufferL, zzStartRead, 3);
            { goToState(getStateAfterLineStart(0));
            }
          // fall through
          case 84: break;
          case 42:
            // lookahead expression with fixed base length
            zzMarkedPos = Character.offsetByCodePoints
                (zzBufferL, zzStartRead, 1);
            { cleanMyState(); return EOL;
            }
          // fall through
          case 85: break;
          case 43:
            // lookahead expression with fixed base length
            zzMarkedPos = Character.offsetByCodePoints
                (zzBufferL, zzStartRead, 1);
            { return EOL;
            }
          // fall through
          case 86: break;
          default:
            zzScanError(ZZ_NO_MATCH);
          }
      }
    }
  }
public IElementType advance()