mirror of
https://github.com/Kugelschieber/asl.git
synced 2026-01-18 12:00:25 +00:00
Issue #18, but syntax is: foreach (variable) => (expression) {...}.
This commit is contained in:
@@ -199,9 +199,14 @@ func (c *Compiler) parseFor() {
|
||||
|
||||
func (c *Compiler) parseForeach() {
|
||||
c.expect("foreach")
|
||||
element := c.get().Token
|
||||
c.next()
|
||||
c.expect("=")
|
||||
c.expect(">")
|
||||
expr := c.parseExpression(false)
|
||||
c.expect("{")
|
||||
c.appendOut("{", true)
|
||||
c.appendOut(element+" = _x;", true)
|
||||
c.parseBlock()
|
||||
c.expect("}")
|
||||
c.appendOut("} forEach ("+expr+");", true)
|
||||
|
||||
Reference in New Issue
Block a user