Commit bee148bf authored by Shenghou Ma's avatar Shenghou Ma

text/template/parse: don't show itemType in error messages

so that the user don't need to decipher something like this:
template: main:1: expected %!s(parse.itemType=14) in end; got "|"
now they get this:
template: main:1: unexpected "|" in end

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7128054
parent 5b5d3efc
......@@ -151,7 +151,7 @@ func (t *Tree) error(err error) {
func (t *Tree) expect(expected itemType, context string) item {
token := t.nextNonSpace()
if token.typ != expected {
t.errorf("expected %s in %s; got %s", expected, context, token)
t.unexpected(token, context)
}
return token
}
......@@ -160,7 +160,7 @@ func (t *Tree) expect(expected itemType, context string) item {
func (t *Tree) expectOneOf(expected1, expected2 itemType, context string) item {
token := t.nextNonSpace()
if token.typ != expected1 && token.typ != expected2 {
t.errorf("expected %s or %s in %s; got %s", expected1, expected2, context, token)
t.unexpected(token, context)
}
return token
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment