1
0
mirror of https://github.com/golang/go synced 2024-10-04 04:41:23 -06:00
go/src/pkg/text
Rob Pike 9050550c12 text/template: allow .Field access to parenthesized expressions
Change the grammar so that field access is a proper operator.
This introduces a new node, ChainNode, into the public (but
actually internal) API of text/template/parse. For
compatibility, we only use the new node type for the specific
construct, which was not parseable before. Therefore this
should be backward-compatible.

Before, .X.Y was a token in the lexer; this CL breaks it out
into .Y applied to .X. But for compatibility we mush them
back together before delivering. One day we might remove
that hack; it's the simple TODO in parse.go/operand.

This change also provides grammatical distinction between
        f
and
        (f)
which might permit function values later, but not now.

Fixes #3999.

R=golang-dev, dsymonds, gri, rsc, mikesamuel
CC=golang-dev
https://golang.org/cl/6494119
2012-09-24 13:23:15 +10:00
..
scanner text/scanner: skip first character if it's a BOM 2012-09-07 17:15:42 -07:00
tabwriter doc: various "the the" and other typos 2012-07-08 11:57:04 +10:00
template text/template: allow .Field access to parenthesized expressions 2012-09-24 13:23:15 +10:00