aboutsummaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorBen Clayton <bclayton@google.com>2015-07-23 10:16:52 +0100
committerBen Clayton <bclayton@google.com>2015-07-23 10:41:33 +0100
commitf6787866eb78e2870d98596c7747e527dc0086d1 (patch)
tree9eba723cf4bdba33dbb5d8ef4410851f34b3c08c /api
parent001682ed4a7032b7ba0f9cebf80366f3320ecd52 (diff)
downloadgpu-f6787866eb78e2870d98596c7747e527dc0086d1.tar.gz
Fix CST for resolving the unary operators.
We were parsing the operator outside of the branch. Change-Id: I84453d40ae1bada1c10fcef38bd7c388a259db62
Diffstat (limited to 'api')
-rw-r--r--api/parser/operator.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/api/parser/operator.go b/api/parser/operator.go
index 4c0aec9ce..c61cf09f1 100644
--- a/api/parser/operator.go
+++ b/api/parser/operator.go
@@ -75,13 +75,14 @@ func binaryOp(p *parse.Parser, lhs ast.Node) *ast.BinaryOp {
// operator expression
func unaryOp(p *parse.Parser, cst *parse.Branch) *ast.UnaryOp {
op := scanOperator(p)
+ p.Rollback()
if _, found := ast.UnaryOperators[op]; !found {
- p.Rollback()
return nil
}
- p.ParseLeaf(cst, nil)
n := &ast.UnaryOp{Operator: op}
p.ParseBranch(cst, func(p *parse.Parser, cst *parse.Branch) {
+ requireOperator(op, p, cst)
+ p.ParseLeaf(cst, nil)
n.CST = cst
n.Expression = requireExpression(p, cst)
})