202608271345
This commit is contained in:
1 parent
c41f0b02ff
commit
f65b46a91a
1 file changed
+13
-9
+13
-9
@@ -295,11 +295,13 @@ r8asm::ast_node r8asm::parse(const token_stream &stream) {
|
||||
|
||||
tmp_codeblock_stream.lines = {};
|
||||
|
||||
bool tmp = false;
|
||||
line_number layer = 0;
|
||||
// now it points at %macro line
|
||||
for (it += 1; !(POINTS_AT(it, ENDMACRO) && tmp); it++) {
|
||||
if (POINTS_AT(it, MACRO) || POINTS_AT(it, ENDMACRO))
|
||||
tmp = !tmp;
|
||||
for (it += 1; !(POINTS_AT(it, ENDMACRO) && (layer == 0)); it++) {
|
||||
if (POINTS_AT(it, MACRO))
|
||||
layer++;
|
||||
else if (POINTS_AT(it, ENDMACRO))
|
||||
layer--;
|
||||
tmp_codeblock_stream.lines.push_back(*it);
|
||||
}
|
||||
// now it points at %endmacro line
|
||||
@@ -324,16 +326,18 @@ r8asm::ast_node r8asm::parse(const token_stream &stream) {
|
||||
parse(tmp_codeblock_stream)); // count will be pushed here.
|
||||
tmp_codeblock_stream.lines = {};
|
||||
|
||||
bool tmp = false;
|
||||
line_number layer = 0;
|
||||
// now it points at %rep line
|
||||
for (it += 1; !(POINTS_AT(it, ENDREP) && tmp); it++) {
|
||||
if (POINTS_AT(it, REP) || POINTS_AT(it, ENDREP))
|
||||
tmp = !tmp;
|
||||
for (it += 1; !(POINTS_AT(it, ENDREP) && (layer == 0)); it++) {
|
||||
if (POINTS_AT(it, REP))
|
||||
layer++;
|
||||
else if (POINTS_AT(it, ENDREP))
|
||||
layer++;
|
||||
tmp_codeblock_stream.lines.push_back(*it);
|
||||
}
|
||||
// now it points at %endrep line
|
||||
|
||||
to_return.children.push_back(
|
||||
to_return.children.back().children.push_back(
|
||||
parse(tmp_codeblock_stream)); // codeblock will be pushed here.
|
||||
|
||||
} break;
|
||||
|
||||
Reference in new issue
Block a user