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 }