diff options
Diffstat (limited to 'src/cmd/godoc/format.go')
-rw-r--r-- | src/cmd/godoc/format.go | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/src/cmd/godoc/format.go b/src/cmd/godoc/format.go index 7e6470846..78dde4166 100644 --- a/src/cmd/godoc/format.go +++ b/src/cmd/godoc/format.go @@ -20,7 +20,6 @@ import ( "template" ) - // ---------------------------------------------------------------------------- // Implementation of FormatSelections @@ -34,13 +33,11 @@ import ( // type Selection func() []int - // A LinkWriter writes some start or end "tag" to w for the text offset offs. // It is called by FormatSelections at the start or end of each link segment. // type LinkWriter func(w io.Writer, offs int, start bool) - // A SegmentWriter formats a text according to selections and writes it to w. // The selections parameter is a bit set indicating which selections provided // to FormatSelections overlap with the text segment: If the n'th bit is set @@ -49,7 +46,6 @@ type LinkWriter func(w io.Writer, offs int, start bool) // type SegmentWriter func(w io.Writer, text []byte, selections int) - // FormatSelections takes a text and writes it to w using link and segment // writers lw and sw as follows: lw is invoked for consecutive segment starts // and ends as specified through the links selection, and sw is invoked for @@ -138,7 +134,6 @@ func FormatSelections(w io.Writer, text []byte, lw LinkWriter, links Selection, flush() } - // A merger merges a slice of Selections and produces a sequence of // consecutive segment change events through repeated next() calls. // @@ -147,7 +142,6 @@ type merger struct { segments [][]int // segments[i] is the next segment of selections[i] } - const infinity int = 2e9 func newMerger(selections []Selection) *merger { @@ -163,7 +157,6 @@ func newMerger(selections []Selection) *merger { return &merger{selections, segments} } - // next returns the next segment change: index specifies the Selection // to which the segment belongs, offs is the segment start or end offset // as determined by the start value. If there are no more segment changes, @@ -208,7 +201,6 @@ func (m *merger) next() (index, offs int, start bool) { return } - // ---------------------------------------------------------------------------- // Implementation of FormatText @@ -232,7 +224,6 @@ func lineSelection(text []byte) Selection { } } - // commentSelection returns the sequence of consecutive comments // in the Go src text as a Selection. // @@ -257,7 +248,6 @@ func commentSelection(src []byte) Selection { } } - // makeSelection is a helper function to make a Selection from a slice of pairs. func makeSelection(matches [][]int) Selection { return func() (seg []int) { @@ -269,7 +259,6 @@ func makeSelection(matches [][]int) Selection { } } - // regexpSelection computes the Selection for the regular expression expr in text. func regexpSelection(text []byte, expr string) Selection { var matches [][]int @@ -279,7 +268,6 @@ func regexpSelection(text []byte, expr string) Selection { return makeSelection(matches) } - var selRx = regexp.MustCompile(`^([0-9]+):([0-9]+)`) // rangeSelection computes the Selection for a text range described @@ -298,7 +286,6 @@ func rangeSelection(str string) Selection { return nil } - // Span tags for all the possible selection combinations that may // be generated by FormatText. Selections are indicated by a bitset, // and the value of the bitset specifies the tag to be used. @@ -320,7 +307,6 @@ var startTags = [][]byte{ var endTag = []byte(`</span>`) - func selectionTag(w io.Writer, text []byte, selections int) { if selections < len(startTags) { if tag := startTags[selections]; len(tag) > 0 { @@ -333,7 +319,6 @@ func selectionTag(w io.Writer, text []byte, selections int) { template.HTMLEscape(w, text) } - // FormatText HTML-escapes text and writes it to w. // Consecutive text segments are wrapped in HTML spans (with tags as // defined by startTags and endTag) as follows: |