From 3d8b15d9dba5971049277df9e7715c686a4dcb53 Mon Sep 17 00:00:00 2001 From: Nikolas Havrikov <29175267+havrikov@users.noreply.github.com> Date: Sat, 26 Aug 2017 15:07:35 +0200 Subject: [PATCH] Fixed trailing underscores in numeric literals (#1264) This change prohibits such illegal numeric literals as 13_37_ or 0xCAFE_BABE_ (note the trailing underscore). --- grammar/src/lexical.grm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/grammar/src/lexical.grm b/grammar/src/lexical.grm index 4194b344265..6040e291aee 100644 --- a/grammar/src/lexical.grm +++ b/grammar/src/lexical.grm @@ -7,7 +7,9 @@ Digit : ["0".."9"]; IntegerLiteral - : Digit (Digit | "_")* + : Digit + : Digit (Digit | "_")* Digit + ; FloatLiteral : ; @@ -17,7 +19,9 @@ HexDigit : Digit | ["A".."F", "a".."f"]; HexadecimalLiteral - : "0x" HexDigit (HexDigit | "_")*; + : "0x" HexDigit + : "0x" HexDigit (HexDigit | "_")* HexDigit + ; CharacterLiteral : ; @@ -136,4 +140,4 @@ internal protected catch finally -*/ \ No newline at end of file +*/