Update literals in the grammar reference
Add missing long literal suffix Add binary integer literals Introduce IntegerLiteral lexer rule, which is closer to the actual lexer Issue #KT-22713 Fixed
This commit is contained in:
@@ -803,7 +803,6 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
||||
* : stringTemplate
|
||||
* : NoEscapeString
|
||||
* : IntegerLiteral
|
||||
* : LongLiteral
|
||||
* : CharacterLiteral
|
||||
* : FloatLiteral
|
||||
* : "null"
|
||||
|
||||
@@ -137,7 +137,6 @@ literalConstant
|
||||
: stringTemplate
|
||||
: NoEscapeString
|
||||
: IntegerLiteral
|
||||
: HexadecimalLiteral
|
||||
: CharacterLiteral
|
||||
: FloatLiteral
|
||||
: "null"
|
||||
|
||||
+23
-3
@@ -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
|
||||
: <character as in Java>
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user