Added iterable objects

__iter and __next are now reserved IStrings, OP_NEXT and OP_ITER have also been added. A new token (TOKEN_IN) has been added to the lexer. The parser now supports the for each loop (for i, ... in <object> do ... end).
savedPushed has been removed from the CCompilerState struct.
This commit is contained in:
2020-12-15 21:21:51 -06:00
parent 4f3f594b82
commit e5eca7bed6
9 changed files with 181 additions and 9 deletions

View File

@@ -132,6 +132,10 @@ int disasmInstr(CChunk *chunk, int offset, int indent) {
return simpleInstruction("OP_SETOBJECT", offset);
case OP_INVOKE:
return u8u8OperandInstruction("OP_INVOKE", chunk, offset);
case OP_ITER:
return simpleInstruction("OP_ITER", offset);
case OP_NEXT:
return u8u16OperandInstruction("OP_NEXT", chunk, offset);
case OP_ADD:
return simpleInstruction("OP_ADD", offset);
case OP_SUB: