mirror of
https://github.com/odin-lang/Odin.git
synced 2026-07-11 02:19:30 +00:00
Support where clauses for proc groups
This commit is contained in:
@@ -2553,6 +2553,17 @@ parse_operand :: proc(p: ^Parser, lhs: bool) -> ^ast.Expr {
|
||||
for p.curr_tok.kind != .Close_Brace &&
|
||||
p.curr_tok.kind != .EOF {
|
||||
elem := parse_expr(p, false)
|
||||
|
||||
if p.curr_tok.kind == .Where {
|
||||
tok_where := expect_token(p, .Where)
|
||||
cond := parse_expr(p, false)
|
||||
|
||||
be := ast.new(ast.Binary_Expr, elem.pos, end_pos(p.prev_tok))
|
||||
be.left = elem
|
||||
be.op = tok_where
|
||||
be.right = cond
|
||||
elem = be
|
||||
}
|
||||
append(&args, elem)
|
||||
|
||||
allow_token(p, .Comma) or_break
|
||||
|
||||
Reference in New Issue
Block a user