1
0
mirror of https://github.com/golang/go synced 2024-11-19 03:04:42 -07:00

cmd/yacc/testdata/expr: fix handling of negative numbers

Fixes #10129.

Change-Id: I9f56c483726f14b6c1909740549de236d5bf9cfb
Reviewed-on: https://go-review.googlesource.com/7340
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Matthew Dempsky 2015-03-10 19:47:13 -07:00 committed by Ian Lance Taylor
parent e498181942
commit b2843becab

View File

@ -56,29 +56,29 @@ expr:
}
| '-' expr
{
$$.Neg($2)
$$ = $2.Neg($2)
}
expr1:
expr2
| expr1 '+' expr2
{
$$.Add($1, $3)
$$ = $1.Add($1, $3)
}
| expr1 '-' expr2
{
$$.Sub($1, $3)
$$ = $1.Sub($1, $3)
}
expr2:
expr3
| expr2 '*' expr3
{
$$.Mul($1, $3)
$$ = $1.Mul($1, $3)
}
| expr2 '/' expr3
{
$$.Quo($1, $3)
$$ = $1.Quo($1, $3)
}
expr3: