mirror of
https://github.com/golang/go
synced 2024-11-18 15:44:41 -07:00
text/template: ensures code consistency in lexer
At the end of lexInsideAction(), we return lexInsideAction: this is the default behaviour when we are still parsing an action. But some switch branches return lexInsideAction too. So let's ensure code consistency by always reaching the end of the lexInsideAction function when needed. Change-Id: I7e9d8d6e51f29ecd6db6bdd63b36017845d95368 Reviewed-on: https://go-review.googlesource.com/9441 Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
parent
e2e322d293
commit
b79db4f2fd
@ -313,14 +313,12 @@ func lexInsideAction(l *lexer) stateFn {
|
|||||||
case r == '(':
|
case r == '(':
|
||||||
l.emit(itemLeftParen)
|
l.emit(itemLeftParen)
|
||||||
l.parenDepth++
|
l.parenDepth++
|
||||||
return lexInsideAction
|
|
||||||
case r == ')':
|
case r == ')':
|
||||||
l.emit(itemRightParen)
|
l.emit(itemRightParen)
|
||||||
l.parenDepth--
|
l.parenDepth--
|
||||||
if l.parenDepth < 0 {
|
if l.parenDepth < 0 {
|
||||||
return l.errorf("unexpected right paren %#U", r)
|
return l.errorf("unexpected right paren %#U", r)
|
||||||
}
|
}
|
||||||
return lexInsideAction
|
|
||||||
case r <= unicode.MaxASCII && unicode.IsPrint(r):
|
case r <= unicode.MaxASCII && unicode.IsPrint(r):
|
||||||
l.emit(itemChar)
|
l.emit(itemChar)
|
||||||
return lexInsideAction
|
return lexInsideAction
|
||||||
|
Loading…
Reference in New Issue
Block a user