diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-03-21 07:59:24 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-03-21 07:59:24 -0700 |
commit | e7d17c45b37c145eff23a8fc6e602346f9b65fe3 (patch) | |
tree | 4707fff0bfd23dea474923bf31edac2e56511626 /parser.l | |
parent | e399295ee017de3fe490c4c952701c95baa019e9 (diff) | |
download | txr-e7d17c45b37c145eff23a8fc6e602346f9b65fe3.tar.gz txr-e7d17c45b37c145eff23a8fc6e602346f9b65fe3.tar.bz2 txr-e7d17c45b37c145eff23a8fc6e602346f9b65fe3.zip |
* arith.c (neg): Floating-point support.
* parser.l: FLO and FLODOT cases had to be reordered because
the lex trailing context counts as part of the match length,
causing 3.0 to be matched as three characters with 0 as
the trailing context. The cases are split up to eliminate
a flex warning.
* stream.c (vformat): Support bignum in floating point
conversion. Bugfixes: floating point conversion was
accessing obj->fl.n instead of using n.
Changed some if/else ladders to switches.
Diffstat (limited to 'parser.l')
-rw-r--r-- | parser.l | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -194,8 +194,18 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} return NUMBER; } -<SPECIAL,NESTED,BRACED>{FLODOT}/[^.] | -<SPECIAL,NESTED,BRACED>{FLO} { +<SPECIAL,NESTED,BRACED>{FLO} { + val str = string_own(utf8_dup_from(yytext)); + + if (yy_top_state() == INITIAL + || yy_top_state() == QSILIT) + yy_pop_state(); + + yylval.val = flo_str(str); + return NUMBER; +} + +<SPECIAL,NESTED,BRACED>{FLODOT}/[^.] { val str = string_own(utf8_dup_from(yytext)); if (yy_top_state() == INITIAL |