_ms: evaluate expressions

This commit is contained in:
Dr-Carlos 2022-04-16 06:13:34 +09:30
parent 358ce38db5
commit b7d9d82482
1 changed files with 8 additions and 7 deletions

View File

@ -5,20 +5,21 @@
// ms
//---
static FxOS::Symbol parse_ms(Session &, Parser &parser)
static FxOS::Symbol parse_ms(Session &session, Parser &parser)
{
Token t = parser.expect({T::NUM, T::SYSCALL});
FxOS::Symbol s;
if(t.type == T::SYSCALL)
if(parser.lookahead().type == T::SYSCALL) {
s.type = FxOS::Symbol::Syscall;
else
s.value = parser.expect(T::SYSCALL).value.NUM;
} else {
s.type = FxOS::Symbol::Address;
s.value = parser.expr(session.current_space);
}
s.value = t.value.NUM;
s.name = parser.symbol();
parser.end();
return s;
}