From 0586f2a850f44e0924e9daa2d779a69cac078c5e Mon Sep 17 00:00:00 2001 From: txtpbfmt team Date: Mon, 2 May 2022 02:33:17 -0700 Subject: [PATCH] experiment to verify GitHub actions PiperOrigin-RevId: 445879707 --- parser/parser.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/parser/parser.go b/parser/parser.go index 2920219..ea0cd49 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -593,7 +593,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-- } @@ -856,9 +856,6 @@ func (p *parser) isValueSep(i int) bool { } func (p *parser) advance(i int) string { - if i > p.length { - i = p.length - } res := p.in[p.index:i] p.index = i strRes := string(res) @@ -1014,7 +1011,7 @@ func (p *parser) readTemplate() string { } } } - if i < p.length && p.in[i] == '%' { + if p.in[i] == '%' { i++ break }