summaryrefslogtreecommitdiff
path: root/usr.bin/oasm/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/oasm/parse.c')
-rw-r--r--usr.bin/oasm/parse.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/usr.bin/oasm/parse.c b/usr.bin/oasm/parse.c
index ba97306..ce5a446 100644
--- a/usr.bin/oasm/parse.c
+++ b/usr.bin/oasm/parse.c
@@ -58,7 +58,9 @@ static const char *tokstr[] = {
[ TT_MROW ] = "mrow",
[ TT_MROD ] = "mrod",
[ TT_MROQ ] = "mroq",
-
+ [ TT_AND ] = "and",
+ [ TT_OR ] = "or",
+ [ TT_XOR ] = "xor",
/* X<n> registers */
[ TT_X0 ] = "x0",
@@ -124,16 +126,18 @@ parse_reg(struct oasm_state *state, struct oasm_token *tok)
case TT_MUL:
case TT_DIV:
case TT_BR:
+ case TT_AND:
+ case TT_OR:
+ case TT_XOR:
state->last = tok->type;
break;
default:
- if (lex_is_mro(state->last)) {
- state->last = tok->type;
+ if (tok_is_mro(state->last)) {
break;
}
p = tokstr[state->last];
- oasm_err("bad instruction '%s' for regop\n", p);
+ oasm_err("bad token '%s' for regop\n", p);
return -1;
}
@@ -167,6 +171,18 @@ parse_tok(struct oasm_state *state, struct oasm_token *tok)
state->last = tok->type;
label_enter(tok->raw, state->pip);
break;
+ case TT_AND:
+ state->last = tok->type;
+ emit_osmx64(&emit_state, tok);
+ break;
+ case TT_OR:
+ state->last = tok->type;
+ emit_osmx64(&emit_state, tok);
+ break;
+ case TT_XOR:
+ state->last = tok->type;
+ emit_osmx64(&emit_state, tok);
+ break;
case TT_HLT:
state->last = tok->type;
emit_osmx64(&emit_state, tok);
@@ -205,7 +221,7 @@ parse_tok(struct oasm_state *state, struct oasm_token *tok)
emit_osmx64(&emit_state, tok);
break;
default:
- if (lex_is_mro(tok->type)) {
+ if (tok_is_mro(tok->type)) {
state->last = tok->type;
emit_osmx64(&emit_state, tok);
return 0;