• Daniel Martí's avatar
    text/template: simplify line tracking in the lexer · 98fd6680
    Daniel Martí authored
    First, move the strings.Count logic out of emit, since only itemText
    requires that. Use it in those call sites. itemLeftDelim and
    itemRightDelim cannot contain newlines, as they're the "{{" and "}}"
    tokens.
    
    Secondly, introduce a startLine lexer field so that we don't have to
    keep track of it elsewhere. That's also a requirement to move the
    strings.Count out of emit, as emit modifies the start position field.
    
    Change-Id: I69175f403487607a8e5b561b3f1916ee9dc3c0c6
    Reviewed-on: https://go-review.googlesource.com/132275
    Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarRob Pike <r@golang.org>
    98fd6680
Name
Last commit
Last update
..
parse Loading commit data...
testdata Loading commit data...
doc.go Loading commit data...
example_test.go Loading commit data...
examplefiles_test.go Loading commit data...
examplefunc_test.go Loading commit data...
exec.go Loading commit data...
exec_test.go Loading commit data...
funcs.go Loading commit data...
helper.go Loading commit data...
multi_test.go Loading commit data...
option.go Loading commit data...
template.go Loading commit data...