Add call operand
This commit is contained in:
@@ -150,9 +150,21 @@ namespace Interpret
|
||||
{
|
||||
throw ExpectedLabel(labelToken);
|
||||
}
|
||||
|
||||
return std::make_unique<JumpStatement>(std::get<std::string>(labelToken.data));
|
||||
}
|
||||
|
||||
case Token::OperandType::CallFunction:
|
||||
{
|
||||
auto labelToken = tokens[operandIndex + 1u];
|
||||
if (labelToken.type != Token::TokenType::Label)
|
||||
{
|
||||
throw ExpectedLabel(labelToken);
|
||||
}
|
||||
|
||||
return std::make_unique<FunctionCallStatement>(std::get<std::string>(labelToken.data));
|
||||
}
|
||||
|
||||
case Token::OperandType::LessThanInteger:
|
||||
{
|
||||
auto statement = std::make_unique<ControlFlowStatement>();
|
||||
@@ -243,9 +255,12 @@ namespace Interpret
|
||||
default:
|
||||
{
|
||||
auto statement = std::make_unique<NoArgumentStatement>();
|
||||
|
||||
|
||||
// TODO throw error?
|
||||
statement->function = [](Execute::Flags & flags, Execute::Registers & registers) { std::puts("ExtractStatement: Extracted unhandled operator type"); };
|
||||
statement->function = [](Execute::Flags & flags, Execute::Registers & registers)
|
||||
{
|
||||
std::puts("ExtractStatement: Extracted unhandled operator type");
|
||||
};
|
||||
return statement;
|
||||
}
|
||||
}
|
||||
@@ -287,6 +302,7 @@ namespace Interpret
|
||||
return 2;
|
||||
|
||||
case Token::OperandType::Jump:
|
||||
case Token::OperandType::CallFunction:
|
||||
case Token::OperandType::Interrupt:
|
||||
case Token::OperandType::PushInteger:
|
||||
case Token::OperandType::PopInteger:
|
||||
|
||||
Reference in New Issue
Block a user