diff --git a/compiler/frontend/src/org/jetbrains/kotlin/parsing/KotlinExpressionParsing.java b/compiler/frontend/src/org/jetbrains/kotlin/parsing/KotlinExpressionParsing.java index 4d969f888b9..d9f1af4fb2d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/parsing/KotlinExpressionParsing.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/parsing/KotlinExpressionParsing.java @@ -803,7 +803,6 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing { * : stringTemplate * : NoEscapeString * : IntegerLiteral - * : LongLiteral * : CharacterLiteral * : FloatLiteral * : "null" diff --git a/grammar/src/expressions.grm b/grammar/src/expressions.grm index 64e454c011f..d49c0f22111 100644 --- a/grammar/src/expressions.grm +++ b/grammar/src/expressions.grm @@ -137,7 +137,6 @@ literalConstant : stringTemplate : NoEscapeString : IntegerLiteral - : HexadecimalLiteral : CharacterLiteral : FloatLiteral : "null" diff --git a/grammar/src/lexical.grm b/grammar/src/lexical.grm index 4201a053694..b0fe25823cd 100644 --- a/grammar/src/lexical.grm +++ b/grammar/src/lexical.grm @@ -2,12 +2,23 @@ # Lexical structure */ +[helper] +LongSuffix + : "L" + ; + +IntegerLiteral + : DecimalLiteral LongSuffix? + : HexadecimalLiteral LongSuffix? + : BinaryLiteral LongSuffix? + ; + [helper] Digit : ["0".."9"] ; -IntegerLiteral +DecimalLiteral : Digit : Digit (Digit | "_")* Digit ; @@ -22,10 +33,19 @@ HexDigit ; HexadecimalLiteral - : "0x" HexDigit - : "0x" HexDigit (HexDigit | "_")* HexDigit + : "0" ("x" | "X") HexDigit + : "0" ("x" | "X") HexDigit (HexDigit | "_")* HexDigit ; +[helper] +BinaryDigit + : ("0" | "1") + ; + +BinaryLiteral + : "0" ("b" | "B") BinaryDigit + : "0" ("b" | "B") BinaryDigit (BinaryDigit | "_")* BinaryDigit + CharacterLiteral : ;