mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 16:47:28 +01:00
Parse for loops.
This commit is contained in:
1 parent
17c6c71e53
commit
4164fe2504
3 files changed
+28
-1
No files matched your search
@@ -301,6 +301,25 @@ func (p *parser) parseStatement() (*a.Node, error) {
|
||||
Kind: a.KAssert,
|
||||
RHS: rhs,
|
||||
}, nil
|
||||
|
||||
case t.IDFor:
|
||||
p.src = p.src[1:]
|
||||
lhs, err := (*a.Node)(nil), error(nil)
|
||||
if p.peekID() != t.IDOpenCurly {
|
||||
lhs, err = p.parseExpr()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
block, err := p.parseBlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &a.Node{
|
||||
Kind: a.KFor,
|
||||
LHS: lhs,
|
||||
List2: block,
|
||||
}, nil
|
||||
}
|
||||
|
||||
lhs, err := p.parseExpr()
|
||||
|
||||
Reference in new issue
Block a user