diff --git a/FIXME.md b/FIXME.md new file mode 100644 index 0000000..6d29f69 --- /dev/null +++ b/FIXME.md @@ -0,0 +1,5 @@ +``` +store = struct {todos: [struct {value:"do some work"}, 9]} + for t in store{ + println(t.key + " " + to_string(t.value)) } # works if the closing bracket is on next line +``` diff --git a/adana-script/src/parser.rs b/adana-script/src/parser.rs index 9129b88..18b8431 100644 --- a/adana-script/src/parser.rs +++ b/adana-script/src/parser.rs @@ -356,13 +356,10 @@ fn parse_foreach(s: &str) -> Res { preceded( tag_no_space(FOR), pair( - alt(( - preceded( - tag_no_space("("), - terminated(parse_for_expr_header, tag_no_space(")")), - ), - parse_for_expr_header, - )), + preceded( + opt(tag_no_space("(")), + terminated(parse_for_expr_header, opt(tag_no_space(")"))), + ), parse_block(parse_instructions), ), ),