Currently, StdLib's [Iterable.zs](https://github.com/ZenCodeLang/StdLibs/blob/master/src/main/zencode/stdlib/src/Iterable.zs) defines the Iterator-Member like so: ```zs for(item as T) as Iterator<T> => iterate(); ``` However, the parser expects: ```zs for(T) { // What to do in here? } ``` Defined in ParsedDefinitionMember: ```java case K_FOR: { tokens.next(); tokens.required(T_BROPEN, "( expected"); List<IParsedType> loopVariableTypes = new ArrayList<>(); if (tokens.optional(T_BRCLOSE) == null) { do { loopVariableTypes.add(IParsedType.parse(tokens)); } while (tokens.optional(T_COMMA) != null); tokens.required(T_BRCLOSE, ") expected"); } ParsedFunctionBody body = ParsedStatement.parseFunctionBody(tokens); return new ParsedIterator(start, modifiers, annotations, loopVariableTypes, body); } ``` We need to define how the iterator members should look like and how it should behave. Acceptance Criteria: - [ ] The syntax is defined - [ ] The header in stdlibs is adapted to whatever syntax we adopt - [ ] There exist tests that cover the basic iterator functionality - [ ] Defining an iterator - [ ] Calling it - [ ] Overloading iterators with multiple variables - [ ] Doing that on a generic data type like List<T>
Activity