[Lexer] Restore KtToken constructors without tokenId parameter

Mark them as @Deprecated, ^KT-54745 Fixed
This commit is contained in:
Ivan Kochurkin
2022-10-31 19:26:03 +01:00
committed by Space Team
parent 8483f0a227
commit 952274e046
5 changed files with 54 additions and 0 deletions
@@ -21,6 +21,11 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.lexer.KtToken;
public class KDocToken extends KtToken {
@Deprecated
public KDocToken(@NotNull @NonNls String debugName) {
super(debugName);
}
public KDocToken(@NotNull @NonNls String debugName, int tokenId) {
super(debugName, tokenId);
}
@@ -24,10 +24,20 @@ public class KtKeywordToken extends KtSingleValueToken {
/**
* Generate keyword (identifier that has a keyword meaning in all possible contexts)
*/
@Deprecated
public static KtKeywordToken keyword(String value) {
return keyword(value, value);
}
public static KtKeywordToken keyword(String value, int tokenId) {
return keyword(value, value, tokenId);
}
@Deprecated
public static KtKeywordToken keyword(String debugName, String value) {
return new KtKeywordToken(debugName, value, false);
}
public static KtKeywordToken keyword(String debugName, String value, int tokenId) {
return new KtKeywordToken(debugName, value, false, tokenId);
}
@@ -35,12 +45,23 @@ public class KtKeywordToken extends KtSingleValueToken {
/**
* Generate soft keyword (identifier that has a keyword meaning only in some contexts)
*/
@Deprecated
public static KtKeywordToken softKeyword(String value) {
return new KtKeywordToken(value, value, true);
}
public static KtKeywordToken softKeyword(String value, int tokenId) {
return new KtKeywordToken(value, value, true, tokenId);
}
private final boolean myIsSoft;
@Deprecated
protected KtKeywordToken(@NotNull @NonNls String debugName, @NotNull @NonNls String value, boolean isSoft) {
super(debugName, value);
myIsSoft = isSoft;
}
protected KtKeywordToken(@NotNull @NonNls String debugName, @NotNull @NonNls String value, boolean isSoft, int tokenId) {
super(debugName, value, tokenId);
myIsSoft = isSoft;
@@ -25,6 +25,11 @@ public final class KtModifierKeywordToken extends KtKeywordToken {
/**
* Generate keyword (identifier that has a keyword meaning in all possible contexts)
*/
@Deprecated
public static KtModifierKeywordToken keywordModifier(String value) {
return new KtModifierKeywordToken(value, value, false);
}
public static KtModifierKeywordToken keywordModifier(String value, int tokenId) {
return new KtModifierKeywordToken(value, value, false, tokenId);
}
@@ -32,10 +37,20 @@ public final class KtModifierKeywordToken extends KtKeywordToken {
/**
* Generate soft keyword (identifier that has a keyword meaning only in some contexts)
*/
@Deprecated
public static KtModifierKeywordToken softKeywordModifier(String value) {
return new KtModifierKeywordToken(value, value, true);
}
public static KtModifierKeywordToken softKeywordModifier(String value, int tokenId) {
return new KtModifierKeywordToken(value, value, true, tokenId);
}
@Deprecated
private KtModifierKeywordToken(@NotNull @NonNls String debugName, @NotNull @NonNls String value, boolean isSoft) {
super(debugName, value, isSoft);
}
private KtModifierKeywordToken(@NotNull @NonNls String debugName, @NotNull @NonNls String value, boolean isSoft, int tokenId) {
super(debugName, value, isSoft, tokenId);
}
@@ -22,6 +22,12 @@ import org.jetbrains.annotations.NotNull;
public class KtSingleValueToken extends KtToken {
private final String myValue;
@Deprecated
public KtSingleValueToken(@NotNull @NonNls String debugName, @NotNull @NonNls String value) {
super(debugName);
myValue = value;
}
public KtSingleValueToken(@NotNull @NonNls String debugName, @NotNull @NonNls String value, int tokenId) {
super(debugName, tokenId);
myValue = value;
@@ -22,8 +22,15 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.idea.KotlinLanguage;
public class KtToken extends IElementType {
private static final int INVALID_ID = -1;
public final int tokenId;
@Deprecated
public KtToken(@NotNull @NonNls String debugName) {
this(debugName, INVALID_ID);
}
public KtToken(@NotNull @NonNls String debugName, int tokenId) {
super(debugName, KotlinLanguage.INSTANCE);
this.tokenId = tokenId;