summaryrefslogtreecommitdiff
path: root/nasm.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-06-09 20:45:19 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-06-09 20:45:19 -0700
commit11627049aec88e21b6a9cbdef10984868d4ca3fe (patch)
tree1d6a223214cc0425ea11d3e2314b68d4030c2db6 /nasm.h
parentfcb8909749b2a159ba7f32fec7df8e465a974f77 (diff)
downloadnasm-11627049aec88e21b6a9cbdef10984868d4ca3fe.tar.gz
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 'nasm.h')
-rw-r--r--nasm.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/nasm.h b/nasm.h
index 384fb659..fedf8583 100644
--- a/nasm.h
+++ b/nasm.h
@@ -165,8 +165,14 @@ enum token_type { /* token types, other than chars */
TOKEN_INVALID = -1, /* a placeholder value */
TOKEN_EOS = 0, /* end of string */
TOKEN_EQ = '=', TOKEN_GT = '>', TOKEN_LT = '<', /* aliases */
- TOKEN_ID = 256, TOKEN_NUM, TOKEN_REG, TOKEN_INSN, /* major token types */
- TOKEN_ERRNUM, /* numeric constant with error in */
+ TOKEN_ID = 256, /* identifier */
+ TOKEN_NUM, /* numeric constant */
+ TOKEN_ERRNUM, /* malformed numeric constant */
+ TOKEN_STR, /* string constant */
+ TOKEN_ERRSTR, /* unterminated string constant */
+ TOKEN_FLOAT, /* floating-point constant */
+ TOKEN_REG, /* register name */
+ TOKEN_INSN, /* instruction name */
TOKEN_HERE, TOKEN_BASE, /* $ and $$ */
TOKEN_SPECIAL, /* BYTE, WORD, DWORD, QWORD, FAR, NEAR, etc */
TOKEN_PREFIX, /* A32, O16, LOCK, REPNZ, TIMES, etc */
@@ -175,7 +181,6 @@ enum token_type { /* token types, other than chars */
TOKEN_GE, TOKEN_LE, TOKEN_NE, /* >=, <= and <> (!= is same as <>) */
TOKEN_DBL_AND, TOKEN_DBL_OR, TOKEN_DBL_XOR, /* &&, || and ^^ */
TOKEN_SEG, TOKEN_WRT, /* SEG and WRT */
- TOKEN_FLOAT, /* floating-point constant */
TOKEN_FLOATIZE, /* __floatX__ */
};