From 9e63e396a48f20b5708b3de57779be68c80b0c94 Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Thu, 11 Jul 2013 01:22:37 -0700 Subject: [PATCH] Fixed lexing of integer dot identifier --- std/d/lexer.d | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/std/d/lexer.d b/std/d/lexer.d index 46dc4e6..7cf564f 100755 --- a/std/d/lexer.d +++ b/std/d/lexer.d @@ -945,9 +945,30 @@ L_advance: break decimalLoop; if (src.canPeek() && src.peek() == '.') break decimalLoop; - nextCharNonLF(); - foundDot = true; - current.type = TokenType.doubleLiteral; + else + { + // The following bit of silliness tries to tell the + // difference between "int dot identifier" and + // "double identifier". + if (src.canPeek()) + { + switch (src.peek()) + { + case 'u': case 'U': case 'i': case 'L': case 'f': case 'F': + case 'e': case 'E': + break decimalLoop; + default: + goto doubleLiteral; + } + } + else + { + doubleLiteral: + nextCharNonLF(); + foundDot = true; + current.type = TokenType.doubleLiteral; + } + } break; default: break decimalLoop;