diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-03-19 02:00:45 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-03-19 02:00:45 -0700 |
commit | 16414f430caa17fccb2e15611a367bb9236ac0ee (patch) | |
tree | a7245ff2952647a5106406f99c0dcf243a9a9d58 /parser.l | |
parent | 9d06c8e9b36e94295c62eb0598cff7afae0c5a45 (diff) | |
download | txr-16414f430caa17fccb2e15611a367bb9236ac0ee.tar.gz txr-16414f430caa17fccb2e15611a367bb9236ac0ee.tar.bz2 txr-16414f430caa17fccb2e15611a367bb9236ac0ee.zip |
* configure (uintptr): New variable. Indicates whether unsigned
version of intptr_t is available and should be generated in config.h
as uintptr_t.
* eval.c (eval_init): New intrinsic functions floatp,
integerp, flo-str.
* gc.c (finalize): Handle FLNUM case. Rearranged
cases so that all trivially returning cases are
together.
(mark): Handle FLNUM case.
* hash.c (hash_double): New function.
(equal_hash): Handle FLNUM via hash_double.
(eql_hash): Likewise.
* lib.c: <math.h> is included.
(float_s): New symbol variable.
(code2type, equal): Handle FLNUM case in switch.
(integerp): New function; does the same thing
as integerp before.
(numberp): Returns t for floats.
(flo, floatp, flo_str): New functions.
(obj_init): Initialize new float_s variable.
(obj_print, obj_pprint): Handle FLNUM case in switch.
Printing does not work yet; needs work in stream.c.
* lib.h (enum type): New enumeration FLNUM.
(struct flonum): New struct type.
(union obj): New member, fl.
(float_s, flo, floatp, integerp, flo_str): Declared.
* parser.l (FLO): New token pattern definition.
Scans to a NUMBER token.
Corrected uses of yylval.num to yylval.val.
* parser.y (%union): Removed num member from yystype.
Diffstat (limited to 'parser.l')
-rw-r--r-- | parser.l | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -150,6 +150,7 @@ static wchar_t num_esc(char *num) SYM [a-zA-Z0-9_]+ NUM [+\-]?[0-9]+ +FLO [+\-]?[0-9]+([.][0-9]+)?([eE][+-]?[0-9]+)? BSCHR [a-zA-Z0-9!$%&*+\-<=>?\\^_~] BSYM {BSCHR}({BSCHR}|#)* NSCHR [a-zA-Z0-9!$%&*+\-<=>?\\^_~/] @@ -185,7 +186,18 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} || yy_top_state() == QSILIT) yy_pop_state(); - yylval.num = int_str(str, num(10)); + yylval.val = int_str(str, num(10)); + return NUMBER; +} + +<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; } @@ -195,7 +207,7 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} if (yy_top_state() == INITIAL || yy_top_state() == QSILIT) yy_pop_state(); - yylval.num = int_str(str, num(10)); + yylval.val = int_str(str, num(10)); return METANUM; } |