boolean (@NotNull PsiBuilder builder, IElementType tokenType) { if (!(tokenType == JavaTokenType.IDENTIFIER && PsiKeyword.YIELD.equals(builder.getTokenText()) && getLanguageLevel(builder).isAtLeast(LanguageLevel.JDK_14))) { return false; } // we prefer to parse it as yield stmt wherever possible (even in incomplete syntax) PsiBuilder.Marker maybeYieldStmt = builder.mark(); builder.advanceLexer(); IElementType tokenAfterYield = builder.getTokenType(); if (tokenAfterYield == null || YIELD_STMT_INDICATOR_TOKENS.contains(tokenAfterYield)) { maybeYieldStmt.rollbackTo(); return true; } if (JavaTokenType.PLUSPLUS.equals(tokenAfterYield) || JavaTokenType.MINUSMINUS.equals(tokenAfterYield)) { builder.advanceLexer(); boolean isYieldStmt = !builder.getTokenType().equals(JavaTokenType.SEMICOLON); maybeYieldStmt.rollbackTo(); return isYieldStmt; } maybeYieldStmt.rollbackTo(); return false; }