• 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
..
scanner Loading commit data...
tabwriter Loading commit data...
template Loading commit data...