text/template/parse: make atTerminator more efficient
text/template/parse: make atTerminator more efficient

The change https://go.dev/cl/398475 was too complicated and expensive.
Since the whole string is always available, all that's needed
is a call to strings.HasPrefix.

While we're here, change the way lexer.backup works
so it can be called repeatedly to back up more than one
rune, in case that becomes necessary. This change also
requires less state to maintain, as lexer.width was only
there for backup, and prevented multiple steps.

Fixes #52191

Change-Id: I43b64fc66edeb8ba73ba5aa72f3b727c377dc067
Reviewed-on: https://go-review.googlesource.com/c/go/+/406476
Reviewed-by: Daniel Martí <29bf28b42a938ace12a5819da4ed4ba03d82f315@mvdan.cc>
Reviewed-by: Dmitri Shuralyov <d181b7fea0ec87c86ba5a890ab716db52498e3ba@google.com>
Run-TryBot: Rob Pike <4dc7c9ec434ed06502767136789763ec11d2c4b7@golang.org>
TryBot-Result: Gopher Robot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>
Reviewed-by: Ian Lance Taylor <87e9c6d529889242b7e184afb632328636553ab4@google.com>

golang/go,golang/go,nawawi/go,nawawi/go,golang/go,nawawi/go,nawawi/go,nawawi/go,golang/go,golang/go,nawawi/go,golang/go,nawawi/go,golang/go,golang/go,nawawi/go