Add the beginnings of the template execution code.  Lots still to do,
including evaluation up the data tree (in this code all fields must be
in dot itself), plus more control structure, but the basics are in place.

R=rsc, r
CC=golang-dev
https://golang.org/cl/4665041
diff --git a/src/pkg/exp/template/parse_test.go b/src/pkg/exp/template/parse_test.go
index f89eaa6..e194c5e 100644
--- a/src/pkg/exp/template/parse_test.go
+++ b/src/pkg/exp/template/parse_test.go
@@ -127,6 +127,8 @@
 		`[(text: "some text")]`},
 	{"emptyMeta", "{{}}", noError,
 		`[(action: [])]`},
+	{"field", "{{.X}}", noError,
+		`[(action: [(command: [F=[X]])])]`},
 	{"simple command", "{{hello}}", noError,
 		`[(action: [(command: [I=hello])])]`},
 	{"multi-word command", "{{hello world}}", noError,
@@ -137,15 +139,20 @@
 		"[(action: [(command: [I=hello S=`quoted text`])])]"},
 	{"pipeline", "{{hello|world}}", noError,
 		`[(action: [(command: [I=hello]) (command: [I=world])])]`},
-	{"simple range", "{{range .x}}hello{{end}}", noError,
-		`[({{range F=.x}} [(text: "hello")])]`},
-	{"nested range", "{{range .x}}hello{{range .y}}goodbye{{end}}{{end}}", noError,
-		`[({{range F=.x}} [(text: "hello")({{range F=.y}} [(text: "goodbye")])])]`},
-	{"range with else", "{{range .x}}true{{else}}false{{end}}", noError,
-		`[({{range F=.x}} [(text: "true")] {{else}} [(text: "false")])]`},
+	{"simple range", "{{range .X}}hello{{end}}", noError,
+		`[({{range [(command: [F=[X]])]}} [(text: "hello")])]`},
+	{"chained field range", "{{range .X.Y.Z}}hello{{end}}", noError,
+		`[({{range [(command: [F=[X Y Z]])]}} [(text: "hello")])]`},
+	{"nested range", "{{range .X}}hello{{range .Y}}goodbye{{end}}{{end}}", noError,
+		`[({{range [(command: [F=[X]])]}} [(text: "hello")({{range [(command: [F=[Y]])]}} [(text: "goodbye")])])]`},
+	{"range with else", "{{range .X}}true{{else}}false{{end}}", noError,
+		`[({{range [(command: [F=[X]])]}} [(text: "true")] {{else}} [(text: "false")])]`},
+	{"range over pipeline", "{{range .X|.M}}true{{else}}false{{end}}", noError,
+		`[({{range [(command: [F=[X]]) (command: [F=[M]])]}} [(text: "true")] {{else}} [(text: "false")])]`},
+	{"range []int", "{{range .SI}}{{.}}{{end}}", noError,
+		`[({{range [(command: [F=[SI]])]}} [(action: [(command: [{{<.>}}])])])]`},
 	// Errors.
 	{"unclosed action", "hello{{range", hasError, ""},
-	{"not a field", "hello{{range x}}{{end}}", hasError, ""},
 	{"missing end", "hello{{range .x}}", hasError, ""},
 	{"missing end after else", "hello{{range .x}}{{else}}", hasError, ""},
 }