public IElementType perlAdvance() throws IOException {
  CharSequence buffer=getBuffer();
  int tokenStart=getTokenEnd();
  int bufferEnd=getBufferEnd();
  if (bufferEnd == 0 || tokenStart >= bufferEnd) {
    return super.perlAdvance();
  }
 else {
    int currentState=yystate();
    char currentChar=buffer.charAt(tokenStart);
    if (waitingHereDoc() && (tokenStart == 0 || currentChar == '\n')) {
      return captureHereDoc(false);
    }
 else     if (currentState == LEX_FORMAT_WAITING && (tokenStart == 0 || buffer.charAt(tokenStart - 1) == '\n')) {
      IElementType tokenType=captureFormat();
      if (tokenType != null) {
        return tokenType;
      }
    }
 else     if (isOpeningQuoteFor(currentState,currentChar,LEX_QUOTE_LIKE_OPENER_Q,LEX_QUOTE_LIKE_OPENER_QQ,LEX_QUOTE_LIKE_OPENER_QX,LEX_QUOTE_LIKE_OPENER_QW)) {
      return captureString();
    }
 else     if (isOpeningQuoteFor(currentState,currentChar,LEX_REGEX_OPENER)) {
      return parseRegex(tokenStart);
    }
 else     if (isOpeningQuoteFor(currentState,currentChar,LEX_TRANS_OPENER)) {
      return parseTr();
    }
 else     if (currentChar == '\'') {
      return captureString(LEX_QUOTE_LIKE_OPENER_Q);
    }
 else     if (currentChar == '"') {
      return captureString(LEX_QUOTE_LIKE_OPENER_QQ);
    }
 else     if (currentChar == '`') {
      return captureString(LEX_QUOTE_LIKE_OPENER_QX);
    }
 else     if (currentChar == '=' && (tokenStart == 0 || buffer.charAt(tokenStart - 1) == '\n') && bufferEnd > tokenStart + 1 && Character.isLetter(buffer.charAt(tokenStart + 1))) {
      return capturePodBlock();
    }
 else     if (((tokenStart < bufferEnd - STRING_DATA_LENGTH) && StringUtil.equals(buffer.subSequence(tokenStart,tokenStart + STRING_DATA_LENGTH),STRING_DATA)) || ((tokenStart < bufferEnd - STRING_END_LENGTH) && StringUtil.equals(buffer.subSequence(tokenStart,tokenStart + STRING_END_LENGTH),STRING_END))) {
      return parseEndBlock(tokenStart,bufferEnd);
    }
 else     if (currentChar == '#') {
      int currentPosition=tokenStart;
      setTokenStart(tokenStart);
      while (currentPosition < bufferEnd && !isLineCommentEnd(currentPosition)) {
        currentPosition++;
      }
      setTokenEnd(currentPosition);
      if (tokenStart + 1 < bufferEnd && buffer.charAt(tokenStart + 1) == '@') {
        return COMMENT_ANNOTATION;
      }
      return COMMENT_LINE;
    }
  }
  return super.perlAdvance();
}

public IElementType perlAdvance ( ) throws IOException { CharSequence buffer = getBuffer ( ) ; int tokenStart = getTokenEnd ( ) ; int bufferEnd = getBufferEnd ( ) ; if ( bufferEnd == 0 || tokenStart >= bufferEnd ) { return super . perlAdvance ( ) ; } else { int currentState = yystate ( ) ; char currentChar = buffer . charAt ( tokenStart ) ; if ( waitingHereDoc ( ) && ( tokenStart == 0 || currentChar == '\n' ) ) { return captureHereDoc ( false ) ; } else if ( currentState == LEX_FORMAT_WAITING && ( tokenStart == 0 || buffer . charAt ( tokenStart - 1 ) == '\n' ) ) { IElementType tokenType = captureFormat ( ) ; if ( tokenType != null ) { return tokenType ; } } else if ( isOpeningQuoteFor ( currentState , currentChar , LEX_QUOTE_LIKE_OPENER_Q , LEX_QUOTE_LIKE_OPENER_QQ , LEX_QUOTE_LIKE_OPENER_QX , LEX_QUOTE_LIKE_OPENER_QW ) ) { return captureString ( ) ; } else if ( isOpeningQuoteFor ( currentState , currentChar , LEX_REGEX_OPENER ) ) { return parseRegex ( tokenStart ) ; } else if ( isOpeningQuoteFor ( currentState , currentChar , LEX_TRANS_OPENER ) ) { return parseTr ( ) ; } else if ( currentChar == '\'' ) { return captureString ( LEX_QUOTE_LIKE_OPENER_Q ) ; } else if ( currentChar == '"' ) { return captureString ( LEX_QUOTE_LIKE_OPENER_QQ ) ; } else if ( currentChar == '`' ) { return captureString ( LEX_QUOTE_LIKE_OPENER_QX ) ; } else if ( currentChar == '=' && ( tokenStart == 0 || buffer . charAt ( tokenStart - 1 ) == '\n' ) && bufferEnd > tokenStart + 1 && Character . isLetter ( buffer . charAt ( tokenStart + 1 ) ) ) { return capturePodBlock ( ) ; } else if ( ( ( tokenStart < bufferEnd - STRING_DATA_LENGTH ) && StringUtil . equals ( buffer . subSequence ( tokenStart , tokenStart + STRING_DATA_LENGTH ) , STRING_DATA ) ) || ( ( tokenStart < bufferEnd - STRING_END_LENGTH ) && StringUtil . equals ( buffer . subSequence ( tokenStart , tokenStart + STRING_END_LENGTH ) , STRING_END ) ) ) { return parseEndBlock ( tokenStart , bufferEnd ) ; } else if ( currentChar == '#' ) { int currentPosition = tokenStart ; setTokenStart ( tokenStart ) ; while ( currentPosition < bufferEnd && ! isLineCommentEnd ( currentPosition ) ) { currentPosition ++ ; } setTokenEnd ( currentPosition ) ; if ( tokenStart + 1 < bufferEnd && buffer . charAt ( tokenStart + 1 ) == '@' ) { return COMMENT_ANNOTATION ; } return COMMENT_LINE ; } } return super . perlAdvance ( ) ; }
lexers perladvance method . parses some thing here , or just invoking generated flex parser
