Merge Parser::instructions() into EVMDialect

This commit is contained in:
Alex Beregszaszi
2020-07-29 13:15:54 +01:00
parent d41fc31046
commit 24bb6252ac
3 changed files with 15 additions and 36 deletions
-21
View File
@@ -61,27 +61,6 @@ unique_ptr<Block> Parser::parse(std::shared_ptr<Scanner> const& _scanner, bool _
return nullptr;
}
std::map<string, evmasm::Instruction> const& Parser::instructions()
{
// Allowed instructions, lowercase names.
static map<string, evmasm::Instruction> s_instructions;
if (s_instructions.empty())
{
for (auto const& instruction: evmasm::c_instructions)
{
if (
instruction.second == evmasm::Instruction::JUMPDEST ||
evmasm::isPushInstruction(instruction.second)
)
continue;
string name = instruction.first;
transform(name.begin(), name.end(), name.begin(), [](unsigned char _c) { return tolower(_c); });
s_instructions[name] = instruction.second;
}
}
return s_instructions;
}
Block Parser::parseBlock()
{
RecursionGuard recursionGuard(*this);