1
0
mirror of https://github.com/golang/go synced 2024-11-20 09:04:44 -07:00

godoc: don't call flush if position is not valid

(fixes new godoc crash when looking at spec)

R=rsc, r, iant
CC=golang-dev
https://golang.org/cl/3488041
This commit is contained in:
Robert Griesemer 2010-12-06 15:34:23 -08:00
parent 5a9ad8b9e3
commit 2fd2991eac

View File

@ -39,7 +39,9 @@ func (p *ebnfParser) flush() {
func (p *ebnfParser) next() {
p.flush()
if p.pos.IsValid() {
p.flush()
}
p.pos, p.tok, p.lit = p.scanner.Scan()
if p.tok.IsKeyword() {
// TODO Should keyword mapping always happen outside scanner?