void () { if (isInLayerEndGap()){ myLayerLeftPart = -1; myState = super.getState(); return; } if (isLayerActive()) { final Lexer activeLayerLexer = myCurrentLayerLexer; IElementType layerTokenType = activeLayerLexer.getTokenType(); if (!isStopToken(myCurrentLayerLexer, layerTokenType)) { myCurrentLayerLexer.advance(); layerTokenType = myCurrentLayerLexer.getTokenType(); } else { layerTokenType = null; } if (layerTokenType == null) { int tokenEnd = myCurrentLayerLexer.getTokenEnd(); boolean selfStopping = mySelfStoppingLexers.contains(myCurrentLayerLexer); myCurrentLayerLexer = null; if (!selfStopping) { super.advance(); // In case when we have non-covered gap we should return left part as next token } else if (tokenEnd != myBaseTokenEnd) { myState = IN_LAYER_LEXER_FINISHED_STATE; myLayerLeftPart = tokenEnd; if (LOG.isDebugEnabled()) { LOG.debug("We've got not covered gap from layered lexer: " + activeLayerLexer + "\n on token: " + getBufferSequence().subSequence(myLayerLeftPart, myBaseTokenEnd)); } return; } activateLayerIfNecessary(); } } else { super.advance(); activateLayerIfNecessary(); } myState = isLayerActive() ? IN_LAYER_STATE : super.getState(); }