diff --git a/include/r8asm/r8asm.hh b/include/r8asm/r8asm.hh index b14af55..74e9c9f 100644 --- a/include/r8asm/r8asm.hh +++ b/include/r8asm/r8asm.hh @@ -23,6 +23,7 @@ public: OPERATOR, BUILTIN, MACROCALL, + REPEAT, ROT8, CODEBLOCK, }; diff --git a/src/r8asm.cc b/src/r8asm.cc index fff76fa..9482e38 100644 --- a/src/r8asm.cc +++ b/src/r8asm.cc @@ -85,6 +85,16 @@ r8asm::ast::expand_node_to_ins(const ast_node &node) { if (node.value == "btp") dataptr--; } break; + case ast_node_t::REPEAT: { + /* + REPEAT + children[0]: count + children[1]: codeblock + */ + for (data count = expand_node_to_data(node.children[0]); count > 0; count--) + for (const auto &i : expand_node_to_ins(node.children[1])) + to_return.push_back(i); + } case ast_node_t::MACROCALL: { /* MACROCALL