diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-02-12 16:04:43 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-02-12 16:04:43 -0800 |
commit | 773063af1cf3bb5da145335f7d73a56e084a9c3e (patch) | |
tree | 322111bcc79c8406ce6de0227afc25e4928e6c2c | |
parent | e18525f5d6de86773df9d72dd5d5f9e2c6dca581 (diff) | |
download | txr-773063af1cf3bb5da145335f7d73a56e084a9c3e.tar.gz txr-773063af1cf3bb5da145335f7d73a56e084a9c3e.tar.bz2 txr-773063af1cf3bb5da145335f7d73a56e084a9c3e.zip |
* parser.l: Disallow syntax like 1.0a, flagging it as
an invalid floating-point token. The problem is that 1a is allowed,
for compatibility with other Lisp dialects (it is a symbol) whereas
1.0a was scanning as 1.0 followed by a, which is inconsistent.
Some Lisp dialects embedded dots in symbols, and allow 1.0a
as a symbol token. We don't.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | parser.l | 14 |
2 files changed, 23 insertions, 0 deletions
@@ -1,5 +1,14 @@ 2014-02-12 Kaz Kylheku <kaz@kylheku.com> + * parser.l: Disallow syntax like 1.0a, flagging it as + an invalid floating-point token. The problem is that 1a is allowed, + for compatibility with other Lisp dialects (it is a symbol) whereas + 1.0a was scanning as 1.0 followed by a, which is inconsistent. + Some Lisp dialects embedded dots in symbols, and allow 1.0a + as a symbol token. We don't. + +2014-02-12 Kaz Kylheku <kaz@kylheku.com> + * hash.c (struct hash): New member, equal_fun. (hash_equal_op): Short circuited logic: whenever we pull identical cells from either hash, we don't have to go @@ -213,6 +213,20 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} return NUMBER; } +<SPECIAL>({FLO}|{FLODOT}){TOK} | +<BRACED>({FLO}|{FLODOT}){BTOK} | +<NESTED>({FLO}|{FLODOT}){NTOK} { + val str = string_utf8(yytext); + + yyerrorf(lit("trailing junk in floating-point literal: ~a"), str, nao); + + if (yy_top_state() == INITIAL + || yy_top_state() == QSILIT) + yy_pop_state(); + + yylval.val = flo_str(str); + return NUMBER; +} <SPECIAL,NESTED,BRACED>{FLO} { val str = string_own(utf8_dup_from(yytext)); |