diff options
Diffstat (limited to 'src/cmd/godoc/spec.go')
-rw-r--r-- | src/cmd/godoc/spec.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/cmd/godoc/spec.go b/src/cmd/godoc/spec.go index a473fc7b4..a863a16cd 100644 --- a/src/cmd/godoc/spec.go +++ b/src/cmd/godoc/spec.go @@ -43,13 +43,13 @@ func (p *ebnfParser) next() { if p.tok.IsKeyword() { // TODO Should keyword mapping always happen outside scanner? // Or should there be a flag to scanner to enable keyword mapping? - p.tok = token.IDENT; + p.tok = token.IDENT } } func (p *ebnfParser) Error(pos token.Position, msg string) { - fmt.Fprintf(p.out, `<span class="alert">error: %s</span>`, msg); + fmt.Fprintf(p.out, `<span class="alert">error: %s</span>`, msg) } @@ -60,7 +60,7 @@ func (p *ebnfParser) errorExpected(pos token.Position, msg string) { // make the error message more specific msg += ", found '" + p.tok.String() + "'"; if p.tok.IsLiteral() { - msg += " "+string(p.lit); + msg += " "+string(p.lit) } } p.Error(pos, msg); @@ -70,7 +70,7 @@ func (p *ebnfParser) errorExpected(pos token.Position, msg string) { func (p *ebnfParser) expect(tok token.Token) token.Position { pos := p.pos; if p.tok != tok { - p.errorExpected(pos, "'" + tok.String() + "'"); + p.errorExpected(pos, "'" + tok.String() + "'") } p.next(); // make progress in any case return pos; @@ -81,9 +81,9 @@ func (p *ebnfParser) parseIdentifier(def bool) { name := string(p.lit); p.expect(token.IDENT); if def { - fmt.Fprintf(p.out, `<a id="%s">%s</a>`, name, name); + fmt.Fprintf(p.out, `<a id="%s">%s</a>`, name, name) } else { - fmt.Fprintf(p.out, `<a href="#%s" class="noline">%s</a>`, name, name); + fmt.Fprintf(p.out, `<a href="#%s" class="noline">%s</a>`, name, name) } p.prev += len(name); // skip identifier when calling flush } @@ -92,7 +92,7 @@ func (p *ebnfParser) parseIdentifier(def bool) { func (p *ebnfParser) parseTerm() bool { switch p.tok { case token.IDENT: - p.parseIdentifier(false); + p.parseIdentifier(false) case token.STRING: p.next(); @@ -117,7 +117,7 @@ func (p *ebnfParser) parseTerm() bool { p.expect(token.RBRACE); default: - return false; + return false } return true; @@ -134,7 +134,7 @@ func (p *ebnfParser) parseExpression() { for { p.parseSequence(); if p.tok != token.OR { - break; + break } p.next(); } @@ -158,7 +158,7 @@ func (p *ebnfParser) parse(out io.Writer, src []byte) { // process source for p.tok != token.EOF { - p.parseProduction(); + p.parseProduction() } p.flush(); } @@ -178,14 +178,14 @@ func linkify(out io.Writer, src []byte) { // i: beginning of EBNF text (or end of source) i := bytes.Index(src, openTag); if i < 0 { - i = n-len(openTag); + i = n-len(openTag) } i += len(openTag); // j: end of EBNF text (or end of source) j := bytes.Index(src[i:n], closeTag); // close marker if j < 0 { - j = n-i; + j = n-i } j += i; |