From 773063af1cf3bb5da145335f7d73a56e084a9c3e Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 12 Feb 2014 16:04:43 -0800 Subject: * parser.l: Disallow syntax like 1.0a, flagging it as an invalid floating-point token. The problem is that 1a is allowed, for compatibility with other Lisp dialects (it is a symbol) whereas 1.0a was scanning as 1.0 followed by a, which is inconsistent. Some Lisp dialects embedded dots in symbols, and allow 1.0a as a symbol token. We don't. --- parser.l | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'parser.l') diff --git a/parser.l b/parser.l index 429fb779..d553b56b 100644 --- a/parser.l +++ b/parser.l @@ -213,6 +213,20 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} return NUMBER; } +({FLO}|{FLODOT}){TOK} | +({FLO}|{FLODOT}){BTOK} | +({FLO}|{FLODOT}){NTOK} { + val str = string_utf8(yytext); + + yyerrorf(lit("trailing junk in floating-point literal: ~a"), str, nao); + + if (yy_top_state() == INITIAL + || yy_top_state() == QSILIT) + yy_pop_state(); + + yylval.val = flo_str(str); + return NUMBER; +} {FLO} { val str = string_own(utf8_dup_from(yytext)); -- cgit v1.2.3