1
0
mirror of https://github.com/golang/go synced 2024-11-22 03:44:39 -07:00

partial correction for CL 1983043: fix various godoc-related regexp calls

R=rsc
CC=golang-dev
https://golang.org/cl/1987041
This commit is contained in:
Robert Griesemer 2010-08-12 11:28:50 -07:00
parent 079a117469
commit 10ae88f4ab
3 changed files with 5 additions and 5 deletions

View File

@ -943,9 +943,9 @@ var (
func extractString(src []byte, rx *regexp.Regexp) (s string) { func extractString(src []byte, rx *regexp.Regexp) (s string) {
m := rx.Find(src) m := rx.FindSubmatch(src)
if len(m) >= 4 { if m != nil {
s = strings.TrimSpace(string(src[m[2]:m[3]])) s = strings.TrimSpace(string(m[1]))
} }
return return
} }

View File

@ -199,7 +199,7 @@ var (
// and '' into ”). // and '' into ”).
func emphasize(w io.Writer, line []byte, words map[string]string, nice bool) { func emphasize(w io.Writer, line []byte, words map[string]string, nice bool) {
for { for {
m := matchRx.Find(line) m := matchRx.FindSubmatchIndex(line)
if m == nil { if m == nil {
break break
} }

View File

@ -309,7 +309,7 @@ func (doc *docReader) addFile(src *ast.File) {
// collect BUG(...) comments // collect BUG(...) comments
for _, c := range src.Comments { for _, c := range src.Comments {
text := c.List[0].Text text := c.List[0].Text
if m := bug_markers.Find(text); m != nil { if m := bug_markers.FindIndex(text); m != nil {
// found a BUG comment; maybe empty // found a BUG comment; maybe empty
if btxt := text[m[1]:]; bug_content.Match(btxt) { if btxt := text[m[1]:]; bug_content.Match(btxt) {
// non-empty BUG comment; collect comment without BUG prefix // non-empty BUG comment; collect comment without BUG prefix