From: Matthew Dempsky Date: Tue, 21 Apr 2015 00:17:24 +0000 (-0700) Subject: spec: fix binary expression grammar rule X-Git-Tag: go1.5beta1~614 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=abb818bc03fc19324c9271e8d4dbe5840eea18d2;p=gostls13.git spec: fix binary expression grammar rule The spec explains later in the "Operator precedence" section that * has a higher precedence than +, but the current production rule requires that "1 + 2 * 3" be parsed as "(1 + 2) * 3", instead of the intended "1 + (2 * 3)". The new production rule better matches cmd/internal/gc/go.y's grammar: expr: uexpr | expr LOROR expr | expr LANDAND expr | ... Fixes #10151. Change-Id: I13c9635d6ddf1263cafe7cc63e68f3e5779e24ba Reviewed-on: https://go-review.googlesource.com/9163 Reviewed-by: Robert Griesemer --- diff --git a/doc/go_spec.html b/doc/go_spec.html index d02697bd0a..4e2f911388 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -3305,7 +3305,7 @@ Operators combine operands into expressions.

-Expression = UnaryExpr | Expression binary_op UnaryExpr .
+Expression = UnaryExpr | Expression binary_op Expression .
 UnaryExpr  = PrimaryExpr | unary_op UnaryExpr .
 
 binary_op  = "||" | "&&" | rel_op | add_op | mul_op .