summaryrefslogtreecommitdiffstats
path: root/parser.l
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-04-02 21:07:18 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-04-02 21:07:18 -0700
commitf97195a85409041f9dae13b630e9e2a6418c3cb1 (patch)
tree2662547031b75455c17a6a550d6636a915a9fd69 /parser.l
parentcd0ac0f7d7ad1012f0eb261dd4b036ff85b95ae2 (diff)
downloadtxr-f97195a85409041f9dae13b630e9e2a6418c3cb1.tar.gz
txr-f97195a85409041f9dae13b630e9e2a6418c3cb1.tar.bz2
txr-f97195a85409041f9dae13b630e9e2a6418c3cb1.zip
parser: diagnose syntax like 0.1.2 and .1.1.
Currently (list .1.1) yields (0.1 0.1). This is evading the rule for catching cramped floating-point literals. * parser.l (grammar): Carefully weaken the pattern match in the relevant rule for catching cramped floating-point literals, so it matches these cases.
Diffstat (limited to 'parser.l')
-rw-r--r--parser.l6
1 files changed, 3 insertions, 3 deletions
diff --git a/parser.l b/parser.l
index fbff9bb4..1191618e 100644
--- a/parser.l
+++ b/parser.l
@@ -308,9 +308,9 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U}
return NUMBER;
}
-<SPECIAL>{WS}({FLO}|{FLODOT}){TOK} |
-<BRACED>{WS}({FLO}|{FLODOT}){BTOK} |
-<NESTED>{WS}({FLO}|{FLODOT}){NTOK} |
+<SPECIAL>{WS}({FLO}[.]?|{FLODOT}){TOK} |
+<BRACED>{WS}({FLO}[.]?|{FLODOT}){BTOK} |
+<NESTED>{WS}({FLO}[.]?|{FLODOT}){NTOK} |
<SPECIAL,NESTED,BRACED>{FLO}[.][^.]? {
val str = string_utf8(yytext);