]> Cypherpunks repositories - gostls13.git/commit
spec: fix binary expression grammar rule
authorMatthew Dempsky <mdempsky@google.com>
Tue, 21 Apr 2015 00:17:24 +0000 (17:17 -0700)
committerRobert Griesemer <gri@golang.org>
Wed, 13 May 2015 17:40:38 +0000 (17:40 +0000)
commitabb818bc03fc19324c9271e8d4dbe5840eea18d2
treea1308ed042d222a85084411902d51ad70be2da2d
parent99475dfb5923b775a9ab587ad99cb64de5d1f51c
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 <gri@golang.org>
doc/go_spec.html