mirror of
https://github.com/CPunch/Cosmo.git
synced 2026-01-03 14:10:44 +00:00
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:
@@ -49,6 +49,10 @@ CState *cosmoV_newState() {
|
||||
state->iStrings[ISTRING_GETTER] = cosmoO_copyString(state, "__getter", 8);
|
||||
state->iStrings[ISTRING_SETTER] = cosmoO_copyString(state, "__setter", 8);
|
||||
|
||||
// for iterators
|
||||
state->iStrings[ISTRING_ITER] = cosmoO_copyString(state, "__iter", 6);
|
||||
state->iStrings[ISTRING_NEXT] = cosmoO_copyString(state, "__next", 6);
|
||||
|
||||
// set the IString flags
|
||||
for (int i = 0; i < ISTRING_MAX; i++)
|
||||
state->iStrings[i]->isIString = true;
|
||||
|
||||
Reference in New Issue
Block a user