IElementType (final IElementType tokenType) { assert tokenType == getTokenType(); // Accept header token: '|' or '>' advanceLexer(); // Parse header tail: TEXT is used as placeholder for invalid symbols in this context if (getTokenType() == TEXT) { PsiBuilder.Marker err = myBuilder.mark(); advanceLexer(); err.error(YAMLBundle.message("YAMLParser.invalid.header.symbols")); } if (YAMLElementTypes.EOL_ELEMENTS.contains(getTokenType())) { advanceLexer(); } PsiBuilder.Marker endOfValue = myBuilder.mark(); IElementType type = getTokenType(); // Lexer ensures such input token structure: ( ( INDENT tokenType? )? SCALAR_EOL )* // endOfValue marker is needed to exclude INDENT after last SCALAR_EOL while (type == tokenType || type == INDENT || type == SCALAR_EOL) { advanceLexer(); if (type == tokenType) { if (endOfValue != null) { // this 'if' should be always true because of input token structure endOfValue.drop(); } endOfValue = null; } if (type == SCALAR_EOL) { if (endOfValue != null) { endOfValue.drop(); } endOfValue = myBuilder.mark(); } type = getTokenType(); } if (endOfValue != null) { endOfValue.rollbackTo(); } return tokenType == SCALAR_LIST ? YAMLElementTypes.SCALAR_LIST_VALUE : YAMLElementTypes.SCALAR_TEXT_VALUE; }