summaryrefslogtreecommitdiff
path: root/src/cmd/godoc/spec.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/godoc/spec.go')
-rw-r--r--src/cmd/godoc/spec.go14
1 files changed, 0 insertions, 14 deletions
diff --git a/src/cmd/godoc/spec.go b/src/cmd/godoc/spec.go
index 444e36e08..3f69add86 100644
--- a/src/cmd/godoc/spec.go
+++ b/src/cmd/godoc/spec.go
@@ -18,7 +18,6 @@ import (
"io"
)
-
type ebnfParser struct {
out io.Writer // parser output
src []byte // parser source
@@ -30,14 +29,12 @@ type ebnfParser struct {
lit string // token literal
}
-
func (p *ebnfParser) flush() {
offs := p.file.Offset(p.pos)
p.out.Write(p.src[p.prev:offs])
p.prev = offs
}
-
func (p *ebnfParser) next() {
if p.pos.IsValid() {
p.flush()
@@ -50,12 +47,10 @@ func (p *ebnfParser) next() {
}
}
-
func (p *ebnfParser) Error(pos token.Position, msg string) {
fmt.Fprintf(p.out, `<span class="alert">error: %s</span>`, msg)
}
-
func (p *ebnfParser) errorExpected(pos token.Pos, msg string) {
msg = "expected " + msg
if pos == p.pos {
@@ -69,7 +64,6 @@ func (p *ebnfParser) errorExpected(pos token.Pos, msg string) {
p.Error(p.file.Position(pos), msg)
}
-
func (p *ebnfParser) expect(tok token.Token) token.Pos {
pos := p.pos
if p.tok != tok {
@@ -79,7 +73,6 @@ func (p *ebnfParser) expect(tok token.Token) token.Pos {
return pos
}
-
func (p *ebnfParser) parseIdentifier(def bool) {
name := p.lit
p.expect(token.IDENT)
@@ -91,7 +84,6 @@ func (p *ebnfParser) parseIdentifier(def bool) {
p.prev += len(name) // skip identifier when calling flush
}
-
func (p *ebnfParser) parseTerm() bool {
switch p.tok {
case token.IDENT:
@@ -127,7 +119,6 @@ func (p *ebnfParser) parseTerm() bool {
return true
}
-
func (p *ebnfParser) parseSequence() {
if !p.parseTerm() {
p.errorExpected(p.pos, "term")
@@ -136,7 +127,6 @@ func (p *ebnfParser) parseSequence() {
}
}
-
func (p *ebnfParser) parseExpression() {
for {
p.parseSequence()
@@ -147,7 +137,6 @@ func (p *ebnfParser) parseExpression() {
}
}
-
func (p *ebnfParser) parseProduction() {
p.parseIdentifier(true)
p.expect(token.ASSIGN)
@@ -157,7 +146,6 @@ func (p *ebnfParser) parseProduction() {
p.expect(token.PERIOD)
}
-
func (p *ebnfParser) parse(fset *token.FileSet, out io.Writer, src []byte) {
// initialize ebnfParser
p.out = out
@@ -173,14 +161,12 @@ func (p *ebnfParser) parse(fset *token.FileSet, out io.Writer, src []byte) {
p.flush()
}
-
// Markers around EBNF sections
var (
openTag = []byte(`<pre class="ebnf">`)
closeTag = []byte(`</pre>`)
)
-
func linkify(out io.Writer, src []byte) {
fset := token.NewFileSet()
for len(src) > 0 {