IElementType (int indent, int minIndent) { if (eof()) { return null; } final PsiBuilder.Marker marker = mark(); parseNodeProperties(); final IElementType tokenType = getTokenType(); final IElementType nodeType; if (tokenType == LBRACE) { nodeType = parseHash(); } else if (tokenType == LBRACKET) { nodeType = parseArray(); } else if (tokenType == SEQUENCE_MARKER) { nodeType = parseSequenceItem(indent); } else if (tokenType == QUESTION) { nodeType = parseExplicitKeyValue(indent); } else if (tokenType == SCALAR_KEY) { nodeType = parseScalarKeyValue(indent); } else if (YAMLElementTypes.SCALAR_VALUES.contains(getTokenType())) { nodeType = parseScalarValue(minIndent); } else if (tokenType == STAR) { PsiBuilder.Marker aliasMarker = mark(); advanceLexer(); // symbol * if (getTokenType() == YAMLTokenTypes.ALIAS) { advanceLexer(); // alias name aliasMarker.done(YAMLElementTypes.ALIAS_NODE); if (getTokenType() == COLON) { // Alias is used as key name eolSeen = false; int indentAddition = getShorthandIndentAddition(); nodeType = parseSimpleScalarKeyValueFromColon(indent, indentAddition); } else { // simple ALIAS_NODE was constructed and marker should be dropped marker.drop(); return YAMLElementTypes.ALIAS_NODE; } } else { // Should be impossible now (because of lexer rules) aliasMarker.drop(); nodeType = null; } } else { advanceLexer(); nodeType = null; } if (nodeType != null) { marker.done(nodeType); } else { marker.drop(); } return nodeType; }