Revert "KT-35811: Type parameter angle brackets followed by equal sign are parsed incorrectly if whitespace is missing"

This reverts commit a2077f9063.
This commit is contained in:
Denis.Zharkov
2022-08-04 17:50:00 +02:00
parent 2ae2a7e442
commit 11a26e540e
20 changed files with 388 additions and 706 deletions
@@ -283,6 +283,7 @@ LONELY_BACKTICK=`
"++" { return KtTokens.PLUSPLUS ; }
"--" { return KtTokens.MINUSMINUS; }
"<=" { return KtTokens.LTEQ ; }
">=" { return KtTokens.GTEQ ; }
"==" { return KtTokens.EQEQ ; }
"!=" { return KtTokens.EXCLEQ ; }
"&&" { return KtTokens.ANDAND ; }
File diff suppressed because it is too large Load Diff
@@ -30,7 +30,7 @@ import org.jetbrains.kotlin.lexer.KtTokens;
import static org.jetbrains.kotlin.lexer.KtTokens.*;
public class SemanticWhitespaceAwarePsiBuilderImpl extends PsiBuilderAdapter implements SemanticWhitespaceAwarePsiBuilder {
private final TokenSet complexTokens = TokenSet.create(SAFE_ACCESS, ELVIS, EXCLEXCL, GTEQ);
private final TokenSet complexTokens = TokenSet.create(SAFE_ACCESS, ELVIS, EXCLEXCL);
private final Stack<Boolean> joinComplexTokens = new Stack<>();
private final Stack<Boolean> newlinesEnabled = new Stack<>();
@@ -155,10 +155,6 @@ public class SemanticWhitespaceAwarePsiBuilderImpl extends PsiBuilderAdapter imp
IElementType nextRawToken = rawLookup(rawLookupSteps);
if (nextRawToken == EXCL) return EXCLEXCL;
}
else if (rawTokenType == GT){
IElementType nextRawToken = rawLookup(rawLookupSteps);
if (nextRawToken == EQ) return GTEQ;
}
return rawTokenType;
}
@@ -185,11 +181,9 @@ public class SemanticWhitespaceAwarePsiBuilderImpl extends PsiBuilderAdapter imp
if (!joinComplexTokens()) return super.getTokenText();
IElementType tokenType = getTokenType();
if (complexTokens.contains(tokenType)) {
if (tokenType == ELVIS) return "?:";
if (tokenType == SAFE_ACCESS) return "?.";
if (tokenType == EXCLEXCL) return "!!";
if (tokenType == GTEQ) return ">=";
}
if (tokenType == ELVIS) return "?:";
if (tokenType == SAFE_ACCESS) return "?.";
}
return super.getTokenText();
}