]> Cypherpunks repositories - gostls13.git/commitdiff
godoc: don't call flush if position is not valid
authorRobert Griesemer <gri@golang.org>
Mon, 6 Dec 2010 23:34:23 +0000 (15:34 -0800)
committerRobert Griesemer <gri@golang.org>
Mon, 6 Dec 2010 23:34:23 +0000 (15:34 -0800)
(fixes new godoc crash when looking at spec)

R=rsc, r, iant
CC=golang-dev
https://golang.org/cl/3488041

src/cmd/godoc/spec.go

index df36caaa72df4ea87a647d01a5a25c63a198c487..b1c1a883f7b86e2d4b7825d7021b1925e71abf47 100644 (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?