From db608e087727829c3d6f9b8f02942364bb941c5f Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 1 Feb 2017 21:56:39 -0800 Subject: parser: diagnose more kinds of junk after float. * parser.l (grammar): Add a rule that if a floating-point (of the type that ends in decimal digits with an optional exponent) is immediately followed by a period which is not followed by another period (range syntax), it is trailing junk. For instance 1.0.3 or .2.$, or 1.0. followed by no other input. --- parser.l | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/parser.l b/parser.l index cd573158..39751ed6 100644 --- a/parser.l +++ b/parser.l @@ -308,7 +308,8 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} ({FLO}|{FLODOT}){TOK} | ({FLO}|{FLODOT}){BTOK} | -({FLO}|{FLODOT}){NTOK} { +({FLO}|{FLODOT}){NTOK} | +{FLO}[.][^.]? { val str = string_utf8(yytext); yyerrorf(yyg, lit("trailing junk in floating-point literal: ~a"), str, nao); -- cgit v1.2.3