From d817c1a02b3070af3358d7bc840c8597942919f1 Mon Sep 17 00:00:00 2001 From: txtpbfmt team Date: Mon, 4 Apr 2022 03:57:08 -0700 Subject: [PATCH] Internal change PiperOrigin-RevId: 439274596 --- parser/parser.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parser/parser.go b/parser/parser.go index 9204ed2..2450039 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -492,7 +492,7 @@ func (p *parser) parse(isRoot bool) (result []*ast.Node, endPos ast.Position, er // endPos points at the closing brace, but we should rather return the position // of the first character after the previous item. Therefore let's rewind a bit: - for endPos.Byte > 0 && p.in[endPos.Byte-1] == ' ' { + for p.in[endPos.Byte-1] == ' ' { endPos.Byte-- endPos.Column-- } @@ -906,7 +906,7 @@ func (p *parser) readTemplate() string { } } } - if i < p.length && p.in[i] == '%' { + if p.in[i] == '%' { i++ break }