Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(46)

Delta Between Two Patch Sets: src/pkg/go/doc/doc.go

Issue 781041: code review 781041: bytes, strings: IndexOfAny (Closed)
Left Patch Set: code review 781041: bytes, strings: IndexOfAny Created 15 years ago
Right Patch Set: code review 781041: bytes, strings: IndexOfAny Created 15 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/bytes/bytes_test.go ('k') | src/pkg/strings/strings.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // The doc package extracts source code documentation from a Go AST. 5 // The doc package extracts source code documentation from a Go AST.
6 package doc 6 package doc
7 7
8 import ( 8 import (
9 "container/vector" 9 "container/vector"
10 "go/ast" 10 "go/ast"
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 p.Bugs = makeBugDocs(doc.bugs) 558 p.Bugs = makeBugDocs(doc.bugs)
559 return p 559 return p
560 } 560 }
561 561
562 562
563 // ---------------------------------------------------------------------------- 563 // ----------------------------------------------------------------------------
564 // Filtering by name 564 // Filtering by name
565 565
566 // Does s look like a regular expression? 566 // Does s look like a regular expression?
567 func isRegexp(s string) bool { 567 func isRegexp(s string) bool {
568 » return strings.IndexOfAny(s, ".(|)*+?^$[]") >= 0 568 » return strings.IndexAny(s, ".(|)*+?^$[]") >= 0
569 } 569 }
570 570
571 571
572 func match(s string, names []string) bool { 572 func match(s string, names []string) bool {
573 for _, t := range names { 573 for _, t := range names {
574 if isRegexp(t) { 574 if isRegexp(t) {
575 if matched, _ := regexp.MatchString(t, s); matched { 575 if matched, _ := regexp.MatchString(t, s); matched {
576 return true 576 return true
577 } 577 }
578 } 578 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 // TODO: Recognize "Type.Method" as a name. 655 // TODO: Recognize "Type.Method" as a name.
656 // TODO(r): maybe precompile the regexps. 656 // TODO(r): maybe precompile the regexps.
657 // 657 //
658 func (p *PackageDoc) Filter(names []string) { 658 func (p *PackageDoc) Filter(names []string) {
659 p.Consts = filterValueDocs(p.Consts, names) 659 p.Consts = filterValueDocs(p.Consts, names)
660 p.Vars = filterValueDocs(p.Vars, names) 660 p.Vars = filterValueDocs(p.Vars, names)
661 p.Types = filterTypeDocs(p.Types, names) 661 p.Types = filterTypeDocs(p.Types, names)
662 p.Funcs = filterFuncDocs(p.Funcs, names) 662 p.Funcs = filterFuncDocs(p.Funcs, names)
663 p.Doc = "" // don't show top-level package doc 663 p.Doc = "" // don't show top-level package doc
664 } 664 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b