summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-10-07 07:07:35 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-10-07 07:07:35 -0700
commit8b154a579becffc5c973797ff7ac7b162fd86b30 (patch)
tree3b92af1056e456c62d7627b28b975c6d71209475
parent5724fbcb5afd122b2f846b7f04e853254e729c7c (diff)
downloadtxr-8b154a579becffc5c973797ff7ac7b162fd86b30.tar.gz
txr-8b154a579becffc5c973797ff7ac7b162fd86b30.tar.bz2
txr-8b154a579becffc5c973797ff7ac7b162fd86b30.zip
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.
-rw-r--r--parser.l9
1 files 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}
<SPECIAL,QSPECIAL>{TOK}/{DOTFLO} |
<BRACED>{BTOK}/{DOTFLO} |
<NESTED>{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}
<SPECIAL,QSPECIAL,NESTED>[)\]]/{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