ParsePathNode node = createParseNode(parentNode, builder.getCurrentOffset());
PsiBuilder.Marker marker = builder.mark(node);
int matches = 0;
int matchedTokens = 0;
TokenType tokenType = builder.getTokenType();
boolean isDummyToken = isDummyToken(builder.getTokenText());
boolean isSuppressibleReservedWord =
!elementType.is(ElementTypeAttribute.STATEMENT) &&
isSuppressibleReservedWord(tokenType, node);
if (tokenType != null && !tokenType.isChameleon() && (isDummyToken || isSuppressibleReservedWord || elementType.getLookupCache().canStartWithToken(tokenType))) {
ElementType[] elementTypes = elementType.getElementTypes();
while (node.getCurrentSiblingIndex() < elementTypes.length) {
int index = node.getCurrentSiblingIndex();
// is end of document
if (tokenType == null || tokenType.isChameleon()) {
ParseResultType resultType =
elementType.isOptional(index) && (elementType.isLast(index) || elementType.isOptionalFromIndex(index)) ? ParseResultType.FULL_MATCH :
!elementType.isFirst(index) && !elementType.isOptionalFromIndex(index) && !elementType.isExitIndex(index) ? ParseResultType.PARTIAL_MATCH : ParseResultType.NO_MATCH;
return stepOut(marker, depth, resultType, matchedTokens, node, context);
}