diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-06-09 20:45:19 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-06-09 20:45:19 -0700 |
commit | 11627049aec88e21b6a9cbdef10984868d4ca3fe (patch) | |
tree | 1d6a223214cc0425ea11d3e2314b68d4030c2db6 /stdscan.c | |
parent | fcb8909749b2a159ba7f32fec7df8e465a974f77 (diff) | |
download | nasm-11627049aec88e21b6a9cbdef10984868d4ca3fe.tar.gz nasm-11627049aec88e21b6a9cbdef10984868d4ca3fe.tar.bz2 nasm-11627049aec88e21b6a9cbdef10984868d4ca3fe.zip |
Make strings a first-class token type; defer evaluation
Make strings a proper, first-class token type, instead of relying on
the "TOKEN_NUM with tv_charptr" hack. Only convert a string to a
number if requested in an expression context; this also makes it
possible to actually issue a warning when it overflows.
Diffstat (limited to 'stdscan.c')
-rw-r--r-- | stdscan.c | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -177,17 +177,13 @@ int stdscan(void *private_data, struct tokenval *tv) } else if (*stdscan_bufptr == '\'' || *stdscan_bufptr == '"' || *stdscan_bufptr == '`') { /* a quoted string */ - bool rn_warn; char start_quote = *stdscan_bufptr; tv->t_charptr = stdscan_bufptr; tv->t_inttwo = nasm_unquote(tv->t_charptr, &stdscan_bufptr); if (*stdscan_bufptr != start_quote) - return tv->t_type = TOKEN_ERRNUM; + return tv->t_type = TOKEN_ERRSTR; stdscan_bufptr++; /* Skip final quote */ - tv->t_integer = readstrnum(tv->t_charptr, tv->t_inttwo, &rn_warn); - /* Issue: can't readily check rn_warn, because we might be in - a db family context... */ - return tv->t_type = TOKEN_NUM; + return tv->t_type = TOKEN_STR; } else if (*stdscan_bufptr == ';') { /* a comment has happened - stay */ return tv->t_type = 0; |