mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 11:20:44 +07:00
Java: more sensible parse of incomplete binary expression (IDEA-305898)
GitOrigin-RevId: 3d3b59be1621fea7a4702109e1d654b47c5c76f7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bc91c92493
commit
c8215f8fbc
+5
-5
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.lang.java.parser;
|
||||
|
||||
import com.intellij.core.JavaPsiBundle;
|
||||
@@ -196,14 +196,14 @@ public class BasicOldExpressionParser {
|
||||
advanceGtToken(builder, tokenType);
|
||||
|
||||
final PsiBuilder.Marker right = parseExpression(builder, type, mode);
|
||||
if (right == null) {
|
||||
error(builder, JavaPsiBundle.message("expected.expression"));
|
||||
}
|
||||
operandCount++;
|
||||
tokenType = getGtTokenType(builder);
|
||||
if (tokenType == null || !ops.contains(tokenType) || tokenType != currentExprTokenType || right == null) {
|
||||
if (tokenType == null || !ops.contains(tokenType) || tokenType != currentExprTokenType) {
|
||||
// save
|
||||
result = result.precede();
|
||||
if (right == null) {
|
||||
error(builder, JavaPsiBundle.message("expected.expression"));
|
||||
}
|
||||
result.done(operandCount > 2 ? myJavaElementTypeContainer.POLYADIC_EXPRESSION : myJavaElementTypeContainer.BINARY_EXPRESSION);
|
||||
if (right == null) break;
|
||||
currentExprTokenType = tokenType;
|
||||
|
||||
+5
-7
@@ -1000,14 +1000,12 @@ public class BasicPrattExpressionParser {
|
||||
while (true) {
|
||||
advanceBinOpToken(builder, binOpType);
|
||||
PsiBuilder.Marker rhs = parser.tryParseWithPrecedenceAtMost(builder, currentPrecedence - 1, mode);
|
||||
IElementType nextToken = getBinOpToken(builder);
|
||||
if (rhs != null) {
|
||||
operandCount++;
|
||||
if (rhs == null) {
|
||||
error(builder, JavaPsiBundle.message("expected.expression"));
|
||||
}
|
||||
if (rhs == null || nextToken != binOpType) {
|
||||
if (rhs == null) {
|
||||
error(builder, JavaPsiBundle.message("expected.expression"));
|
||||
}
|
||||
operandCount++;
|
||||
IElementType nextToken = getBinOpToken(builder);
|
||||
if (nextToken != binOpType) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user