summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-04-02 20:50:58 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-04-02 20:50:58 -0700
commit03d6ca49a78008d368bed9e7a474d7d7eab4ccc6 (patch)
tree43d4b8486a5988dc00e2dad9de002440ec95152c
parente7ead5d24a3304cefab9e411a32d2cff2bba6288 (diff)
downloadtxr-03d6ca49a78008d368bed9e7a474d7d7eab4ccc6.tar.gz
txr-03d6ca49a78008d368bed9e7a474d7d7eab4ccc6.tar.bz2
txr-03d6ca49a78008d368bed9e7a474d7d7eab4ccc6.zip
Bugfix: .1 treated as dot if preceded by space.
Some recent work in supporting .slot syntax (uref dot) broke the treatment of floating point literals. This is because part of the trick is that a uref dot is recognized with leading whitespace as part of the token. But that of course means it steals the match for some floating-point tokens; oops! * parser.l (grammar): All rules for floating-point tokens which can match a leading decimal point now munch optional whitespace first.
-rw-r--r--parser.l8
1 files changed, 4 insertions, 4 deletions
diff --git a/parser.l b/parser.l
index 418ecc48..fbff9bb4 100644
--- a/parser.l
+++ b/parser.l
@@ -296,7 +296,7 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U}
return NUMBER;
}
-<SPECIAL,NESTED,BRACED>{FLO} {
+<SPECIAL,NESTED,BRACED>{WS}{FLO} {
val str = string_own(utf8_dup_from(yytext));
if (yy_top_state(yyscanner) == INITIAL
@@ -308,9 +308,9 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U}
return NUMBER;
}
-<SPECIAL>({FLO}|{FLODOT}){TOK} |
-<BRACED>({FLO}|{FLODOT}){BTOK} |
-<NESTED>({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);