mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 16:47:28 +01:00
Parse "assert x < y".
This commit is contained in:
1 parent
5169460c2d
commit
17c6c71e53
3 files changed
+29
-11
No files matched your search
+12
-1
@@ -290,7 +290,18 @@ func (p *parser) parseBlock() ([]*a.Node, error) {
|
||||
}
|
||||
|
||||
func (p *parser) parseStatement() (*a.Node, error) {
|
||||
// TODO: parse statements other than x = y.
|
||||
switch x := p.peekID(); x {
|
||||
case t.IDAssert:
|
||||
p.src = p.src[1:]
|
||||
rhs, err := p.parseExpr()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &a.Node{
|
||||
Kind: a.KAssert,
|
||||
RHS: rhs,
|
||||
}, nil
|
||||
}
|
||||
|
||||
lhs, err := p.parseExpr()
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user