mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 00:55:11 +01:00
Parse "(x + y)".
This commit is contained in:
1 parent
264f444dac
commit
9d3c8b30f1
1 file changed
+11
-1
+11
-1
@@ -296,7 +296,17 @@ func (p *parser) parseExpr() (*a.Node, error) {
|
|||||||
func (p *parser) parseOperand() (*a.Node, error) {
|
func (p *parser) parseOperand() (*a.Node, error) {
|
||||||
switch x := p.peekID(); {
|
switch x := p.peekID(); {
|
||||||
case x == t.IDOpenParen:
|
case x == t.IDOpenParen:
|
||||||
// TODO: parse "(x + y)".
|
p.src = p.src[1:]
|
||||||
|
expr, err := p.parseExpr()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if x := p.peekID(); x != t.IDCloseParen {
|
||||||
|
got := p.m.ByKey(x.Key())
|
||||||
|
return nil, fmt.Errorf("parse: expected \")\", got %q at %s:%d", got, p.filename, p.line())
|
||||||
|
}
|
||||||
|
p.src = p.src[1:]
|
||||||
|
return expr, nil
|
||||||
|
|
||||||
case x.IsUnaryOp():
|
case x.IsUnaryOp():
|
||||||
p.src = p.src[1:]
|
p.src = p.src[1:]
|
||||||
|
|||||||
Reference in new issue
Block a user