aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2018-12-22 23:09:54 -0800
committerH. Peter Anvin <hpa@zytor.com>2018-12-24 12:45:58 -0800
commit11599f49da963a0cf71970ad69fe66de981d35ee (patch)
tree0426512f6a8204d5a121b3e33caad33d525f22a7 /include
parente7c75e55212c8e88b5574ff746a375146bc02373 (diff)
downloadnasm-11599f49da963a0cf71970ad69fe66de981d35ee.tar.gz
nasm-11599f49da963a0cf71970ad69fe66de981d35ee.tar.xz
nasm-11599f49da963a0cf71970ad69fe66de981d35ee.zip
Factor out size tokens and annotate with the corresponding size
There is space in the token table to explicitly encode the size corresponding to a size token. We might as well do so... Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'include')
-rw-r--r--include/nasm.h36
1 files changed, 26 insertions, 10 deletions
diff --git a/include/nasm.h b/include/nasm.h
index eb376b16..c2a80562 100644
--- a/include/nasm.h
+++ b/include/nasm.h
@@ -167,7 +167,8 @@ enum token_type { /* token types, other than chars */
TOKEN_INSN, /* instruction name */
TOKEN_HERE, /* $ */
TOKEN_BASE, /* $$ */
- TOKEN_SPECIAL, /* BYTE, WORD, DWORD, QWORD, FAR, NEAR, etc */
+ TOKEN_SIZE, /* BYTE, WORD, DWORD, QWORD, etc */
+ TOKEN_SPECIAL, /* REL, FAR, NEAR, STRICT, NOSPLIT, etc */
TOKEN_PREFIX, /* A32, O16, LOCK, REPNZ, TIMES, etc */
TOKEN_SHL, /* << or <<< */
TOKEN_SHR, /* >> */
@@ -1081,25 +1082,40 @@ extern const struct dfmt *dfmt;
#define TYS_ELEMENTS(x) ((x) << 8)
+/* Sizes corresponding to various tokens */
+enum byte_sizes {
+ SIZE_BYTE = 1,
+ SIZE_WORD = 2,
+ SIZE_DWORD = 4,
+ SIZE_QWORD = 8,
+ SIZE_TWORD = 10,
+ SIZE_OWORD = 16,
+ SIZE_YWORD = 32,
+ SIZE_ZWORD = 64
+};
+
enum special_tokens {
- SPECIAL_ENUM_START = PREFIX_ENUM_LIMIT,
- S_ABS = SPECIAL_ENUM_START,
- S_BYTE,
+ SIZE_ENUM_START = PREFIX_ENUM_LIMIT,
+ S_BYTE = SIZE_ENUM_START,
+ S_WORD,
S_DWORD,
+ S_QWORD,
+ S_TWORD,
+ S_OWORD,
+ S_YWORD,
+ S_ZWORD,
+ SIZE_ENUM_LIMIT,
+
+ SPECIAL_ENUM_START = SIZE_ENUM_LIMIT,
+ S_ABS = SPECIAL_ENUM_START,
S_FAR,
S_LONG,
S_NEAR,
S_NOSPLIT,
- S_OWORD,
- S_QWORD,
S_REL,
S_SHORT,
S_STRICT,
S_TO,
- S_TWORD,
- S_WORD,
- S_YWORD,
- S_ZWORD,
SPECIAL_ENUM_LIMIT
};