Merge pull request 'Improve command classification' (#4) from Dr-Carlos/fxos:classification into master

Reviewed-on: https://gitea.planet-casio.com/Lephenixnoir/fxos/pulls/4
This commit is contained in:
Lephenixnoir 2022-04-15 22:57:40 +02:00
commit a6b66f380d
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;
}