277 // If we're in the block stack, we're descending down from it now |
276 // If we're in the block stack, we're descending down from it now |
278 if (g_BlockStackCursor > 0) { |
277 if (g_BlockStackCursor > 0) { |
279 BlockInformation* info = &blockstack[g_BlockStackCursor]; |
278 BlockInformation* info = &blockstack[g_BlockStackCursor]; |
280 switch (info->type) { |
279 switch (info->type) { |
281 case BLOCKTYPE_IF: |
280 case BLOCKTYPE_IF: |
282 printf ("end if\n"); |
|
283 // Adjust the closing mark. |
281 // Adjust the closing mark. |
284 w->MoveMark (info->mark1); |
282 w->MoveMark (info->mark1); |
285 break; |
283 break; |
286 case BLOCKTYPE_WHILE: |
284 case BLOCKTYPE_WHILE: |
287 printf ("end while loop\n"); |
|
288 |
|
289 // Write down the instruction to go back to the start of the loop |
285 // Write down the instruction to go back to the start of the loop |
290 w->Write (DH_GOTO); |
286 w->Write (DH_GOTO); |
291 w->AddReference (info->mark1); |
287 w->AddReference (info->mark1); |
292 |
288 |
293 // Move the closing mark here since we're at the end of the while loop |
289 // Move the closing mark here since we're at the end of the while loop |
294 w->MoveMark (info->mark2); |
290 w->MoveMark (info->mark2); |
295 |
|
296 // Offset it by 4 since the parser doesn't like having marks directly afte refs |
|
297 w->OffsetMark (info->mark2, sizeof (word)*2); |
|
298 } |
291 } |
299 |
292 |
300 // Descend down the stack |
293 // Descend down the stack |
301 g_BlockStackCursor--; |
294 g_BlockStackCursor--; |
302 continue; |
295 continue; |