summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-02-01 21:56:39 -0800
committerKaz Kylheku <kaz@kylheku.com>2017-02-01 21:56:39 -0800
commit1d412d9e4bf1bbb5b163a218461c9532eb3ebdac (patch)
tree140a8ae106de10def8599768ff336d253ec0c358
parent1c5251eea75c8b671546679a118d9fb068553fa2 (diff)
downloadtxr-1d412d9e4bf1bbb5b163a218461c9532eb3ebdac.tar.gz
txr-1d412d9e4bf1bbb5b163a218461c9532eb3ebdac.tar.bz2
txr-1d412d9e4bf1bbb5b163a218461c9532eb3ebdac.zip
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.
-rw-r--r--parser.l3
1 files changed, 2 insertions, 1 deletions
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}
<SPECIAL>({FLO}|{FLODOT}){TOK} |
<BRACED>({FLO}|{FLODOT}){BTOK} |
-<NESTED>({FLO}|{FLODOT}){NTOK} {
+<NESTED>({FLO}|{FLODOT}){NTOK} |
+<SPECIAL,NESTED,BRACED>{FLO}[.][^.]? {
val str = string_utf8(yytext);
yyerrorf(yyg, lit("trailing junk in floating-point literal: ~a"), str, nao);