]> Cypherpunks repositories - gostls13.git/commitdiff
partial correction for CL 1983043: fix various godoc-related regexp calls
authorRobert Griesemer <gri@golang.org>
Thu, 12 Aug 2010 18:28:50 +0000 (11:28 -0700)
committerRobert Griesemer <gri@golang.org>
Thu, 12 Aug 2010 18:28:50 +0000 (11:28 -0700)
R=rsc
CC=golang-dev
https://golang.org/cl/1987041

src/cmd/godoc/godoc.go
src/pkg/go/doc/comment.go
src/pkg/go/doc/doc.go

index c8af916736b59ce38e859f8ec0513a66d34621a2..150a31dc7dbb9400fb67c6d8c06b2f754bd67407 100644 (file)
@@ -943,9 +943,9 @@ var (
 
 
 func extractString(src []byte, rx *regexp.Regexp) (s string) {
-       m := rx.Find(src)
-       if len(m) >= 4 {
-               s = strings.TrimSpace(string(src[m[2]:m[3]]))
+       m := rx.FindSubmatch(src)
+       if m != nil {
+               s = strings.TrimSpace(string(m[1]))
        }
        return
 }
index 4c792309998929880092d37cfd24a87387f02bf3..cd985d8a7f85a84553c4bf16d268e658cf467b23 100644 (file)
@@ -199,7 +199,7 @@ var (
 // and '' into &rdquo;).
 func emphasize(w io.Writer, line []byte, words map[string]string, nice bool) {
        for {
-               m := matchRx.Find(line)
+               m := matchRx.FindSubmatchIndex(line)
                if m == nil {
                        break
                }
index a5b9aeb66e6967585ca6b0a6c75c523cbb2121e4..64a1170c549f923b940d4b2759cae5303271ef0b 100644 (file)
@@ -309,7 +309,7 @@ func (doc *docReader) addFile(src *ast.File) {
        // collect BUG(...) comments
        for _, c := range src.Comments {
                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
                        if btxt := text[m[1]:]; bug_content.Match(btxt) {
                                // non-empty BUG comment; collect comment without BUG prefix