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
|
* : stringTemplate
|
||||||
* : NoEscapeString
|
* : NoEscapeString
|
||||||
* : IntegerLiteral
|
* : IntegerLiteral
|
||||||
* : LongLiteral
|
|
||||||
* : CharacterLiteral
|
* : CharacterLiteral
|
||||||
* : FloatLiteral
|
* : FloatLiteral
|
||||||
* : "null"
|
* : "null"
|
||||||
|
|||||||
@@ -137,7 +137,6 @@ literalConstant
|
|||||||
: stringTemplate
|
: stringTemplate
|
||||||
: NoEscapeString
|
: NoEscapeString
|
||||||
: IntegerLiteral
|
: IntegerLiteral
|
||||||
: HexadecimalLiteral
|
|
||||||
: CharacterLiteral
|
: CharacterLiteral
|
||||||
: FloatLiteral
|
: FloatLiteral
|
||||||
: "null"
|
: "null"
|
||||||
|
|||||||
+23
-3
@@ -2,12 +2,23 @@
|
|||||||
# Lexical structure
|
# Lexical structure
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
[helper]
|
||||||
|
LongSuffix
|
||||||
|
: "L"
|
||||||
|
;
|
||||||
|
|
||||||
|
IntegerLiteral
|
||||||
|
: DecimalLiteral LongSuffix?
|
||||||
|
: HexadecimalLiteral LongSuffix?
|
||||||
|
: BinaryLiteral LongSuffix?
|
||||||
|
;
|
||||||
|
|
||||||
[helper]
|
[helper]
|
||||||
Digit
|
Digit
|
||||||
: ["0".."9"]
|
: ["0".."9"]
|
||||||
;
|
;
|
||||||
|
|
||||||
IntegerLiteral
|
DecimalLiteral
|
||||||
: Digit
|
: Digit
|
||||||
: Digit (Digit | "_")* Digit
|
: Digit (Digit | "_")* Digit
|
||||||
;
|
;
|
||||||
@@ -22,10 +33,19 @@ HexDigit
|
|||||||
;
|
;
|
||||||
|
|
||||||
HexadecimalLiteral
|
HexadecimalLiteral
|
||||||
: "0x" HexDigit
|
: "0" ("x" | "X") HexDigit
|
||||||
: "0x" HexDigit (HexDigit | "_")* HexDigit
|
: "0" ("x" | "X") HexDigit (HexDigit | "_")* HexDigit
|
||||||
;
|
;
|
||||||
|
|
||||||
|
[helper]
|
||||||
|
BinaryDigit
|
||||||
|
: ("0" | "1")
|
||||||
|
;
|
||||||
|
|
||||||
|
BinaryLiteral
|
||||||
|
: "0" ("b" | "B") BinaryDigit
|
||||||
|
: "0" ("b" | "B") BinaryDigit (BinaryDigit | "_")* BinaryDigit
|
||||||
|
|
||||||
CharacterLiteral
|
CharacterLiteral
|
||||||
: <character as in Java>
|
: <character as in Java>
|
||||||
;
|
;
|
||||||
|
|||||||
Reference in New Issue
Block a user