aboutsummaryrefslogtreecommitdiff
path: root/src/text/template/parse/parse.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/text/template/parse/parse.go')
-rw-r--r--src/text/template/parse/parse.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/text/template/parse/parse.go b/src/text/template/parse/parse.go
index 00c258ad5d..87b7618f75 100644
--- a/src/text/template/parse/parse.go
+++ b/src/text/template/parse/parse.go
@@ -210,7 +210,6 @@ func (t *Tree) recover(errp *error) {
panic(e)
}
if t != nil {
- t.lex.drain()
t.stopParse()
}
*errp = e.(error)
@@ -241,10 +240,12 @@ func (t *Tree) stopParse() {
func (t *Tree) Parse(text, leftDelim, rightDelim string, treeSet map[string]*Tree, funcs ...map[string]any) (tree *Tree, err error) {
defer t.recover(&err)
t.ParseName = t.Name
- emitComment := t.Mode&ParseComments != 0
- breakOK := !t.hasFunction("break")
- continueOK := !t.hasFunction("continue")
- lexer := lex(t.Name, text, leftDelim, rightDelim, emitComment, breakOK, continueOK)
+ lexer := lex(t.Name, text, leftDelim, rightDelim)
+ lexer.options = lexOptions{
+ emitComment: t.Mode&ParseComments != 0,
+ breakOK: !t.hasFunction("break"),
+ continueOK: !t.hasFunction("continue"),
+ }
t.startParse(funcs, lexer, treeSet)
t.text = text
t.parse()