Commit 2fd2991e authored by Robert Griesemer's avatar Robert Griesemer

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
parent 5a9ad8b9
...@@ -39,7 +39,9 @@ func (p *ebnfParser) flush() { ...@@ -39,7 +39,9 @@ func (p *ebnfParser) flush() {
func (p *ebnfParser) next() { func (p *ebnfParser) next() {
if p.pos.IsValid() {
p.flush() p.flush()
}
p.pos, p.tok, p.lit = p.scanner.Scan() p.pos, p.tok, p.lit = p.scanner.Scan()
if p.tok.IsKeyword() { if p.tok.IsKeyword() {
// TODO Should keyword mapping always happen outside scanner? // TODO Should keyword mapping always happen outside scanner?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment