From 8b154a579becffc5c973797ff7ac7b162fd86b30 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 7 Oct 2015 07:07:35 -0700 Subject: Better diagnostic for cramped floating literals. * parser.l: Different text needed for ).1 and a.1 cases, because the insertion of a zero cannot fix the latter. Might as well make the messages more detailed. --- parser.l | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/parser.l b/parser.l index 79c23eec..9a78f988 100644 --- a/parser.l +++ b/parser.l @@ -368,8 +368,11 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} {TOK}/{DOTFLO} | {BTOK}/{DOTFLO} | {NTOK}/{DOTFLO} { + printf("yytext: %s\n", yytext); yyerrorf(yyg, lit("cramped floating-point literal: " - "add 0 or whitespace"), nao); + "space needed between ~a and dot."), + string_own(utf8_dup_from(yytext)), + nao); if (yy_top_state(yyscanner) == INITIAL || yy_top_state(yyscanner) == QSILIT @@ -612,7 +615,9 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} [)\]]/{DOTFLO} { yyerrorf(yyg, lit("cramped floating-point literal: " - "add 0 or whitespace"), nao); + "space or 0 needed between ~a and dot."), + string_own(utf8_dup_from(yytext)), + nao); yy_pop_state(yyscanner); if (yy_top_state(yyscanner) == INITIAL -- cgit v1.2.3