summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/oasm/include/oasm/lex.h1
-rw-r--r--usr.bin/oasm/lex.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/usr.bin/oasm/include/oasm/lex.h b/usr.bin/oasm/include/oasm/lex.h
index 9e293e6..1bb8641 100644
--- a/usr.bin/oasm/include/oasm/lex.h
+++ b/usr.bin/oasm/include/oasm/lex.h
@@ -113,6 +113,7 @@ typedef enum {
struct oasm_token {
tt_t type;
uint8_t is_reg : 1;
+ uint16_t imm;
char *raw;
};
diff --git a/usr.bin/oasm/lex.c b/usr.bin/oasm/lex.c
index c2a7a1f..f8427e0 100644
--- a/usr.bin/oasm/lex.c
+++ b/usr.bin/oasm/lex.c
@@ -297,6 +297,10 @@ lex_tok(struct oasm_state *state, struct oasm_token *ttp)
/* Immediate operand? */
if ((tok = token_operand(p)) != TT_UNKNOWN) {
+ if (tok == TT_IMM) {
+ ttp->imm = atoi(&p[1]);
+ }
+
ttp->type = tok;
ttp->raw = p;
return 0;