Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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í <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Run-TryBot: Rob Pike <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
- Loading branch information