Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
d31ee536
Commit
d31ee536
authored
Aug 12, 2010
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update the tree to use the new regexp methods
R=rsc CC=golang-dev
https://golang.org/cl/1983043
parent
4fb58832
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
14 additions
and
14 deletions
+14
-14
src/cmd/godoc/codewalk.go
src/cmd/godoc/codewalk.go
+2
-2
src/cmd/godoc/godoc.go
src/cmd/godoc/godoc.go
+1
-1
src/cmd/goinstall/download.go
src/cmd/goinstall/download.go
+4
-4
src/pkg/go/doc/comment.go
src/pkg/go/doc/comment.go
+2
-2
src/pkg/go/doc/doc.go
src/pkg/go/doc/doc.go
+1
-1
src/pkg/mime/multipart/multipart.go
src/pkg/mime/multipart/multipart.go
+1
-1
test/bench/regex-dna-parallel.go
test/bench/regex-dna-parallel.go
+2
-2
test/bench/regex-dna.go
test/bench/regex-dna.go
+1
-1
No files found.
src/cmd/godoc/codewalk.go
View file @
d31ee536
...
...
@@ -451,13 +451,13 @@ func addrRegexp(data []byte, lo, hi int, dir byte, pattern string) (int, int, os
// through file, but that seems like overkill.
return
0
,
0
,
os
.
NewError
(
"reverse search not implemented"
)
}
m
:=
re
.
Execute
(
data
[
hi
:
])
m
:=
re
.
FindIndex
(
data
[
hi
:
])
if
len
(
m
)
>
0
{
m
[
0
]
+=
hi
m
[
1
]
+=
hi
}
else
if
hi
>
0
{
// No match. Wrap to beginning of data.
m
=
re
.
Execute
(
data
)
m
=
re
.
FindIndex
(
data
)
}
if
len
(
m
)
==
0
{
return
0
,
0
,
os
.
NewError
(
"no match for "
+
pattern
)
...
...
src/cmd/godoc/godoc.go
View file @
d31ee536
...
...
@@ -943,7 +943,7 @@ var (
func
extractString
(
src
[]
byte
,
rx
*
regexp
.
Regexp
)
(
s
string
)
{
m
:=
rx
.
Execute
(
src
)
m
:=
rx
.
Find
(
src
)
if
len
(
m
)
>=
4
{
s
=
strings
.
TrimSpace
(
string
(
src
[
m
[
2
]
:
m
[
3
]]))
}
...
...
src/cmd/goinstall/download.go
View file @
d31ee536
...
...
@@ -41,13 +41,13 @@ func download(pkg string) (string, os.Error) {
if
strings
.
Index
(
pkg
,
".."
)
>=
0
{
return
""
,
os
.
ErrorString
(
"invalid path (contains ..)"
)
}
if
m
:=
bitbucket
.
MatchStrings
(
pkg
);
m
!=
nil
{
if
m
:=
bitbucket
.
FindStringSubmatch
(
pkg
);
m
!=
nil
{
if
err
:=
vcsCheckout
(
&
hg
,
root
+
m
[
1
],
"http://"
+
m
[
1
],
m
[
1
]);
err
!=
nil
{
return
""
,
err
}
return
root
+
pkg
,
nil
}
if
m
:=
googlecode
.
MatchStrings
(
pkg
);
m
!=
nil
{
if
m
:=
googlecode
.
FindStringSubmatch
(
pkg
);
m
!=
nil
{
var
v
*
vcs
switch
m
[
2
]
{
case
"hg"
:
...
...
@@ -63,7 +63,7 @@ func download(pkg string) (string, os.Error) {
}
return
root
+
pkg
,
nil
}
if
m
:=
github
.
MatchStrings
(
pkg
);
m
!=
nil
{
if
m
:=
github
.
FindStringSubmatch
(
pkg
);
m
!=
nil
{
if
strings
.
HasSuffix
(
m
[
1
],
".git"
)
{
return
""
,
os
.
ErrorString
(
"repository "
+
pkg
+
" should not have .git suffix"
)
}
...
...
@@ -72,7 +72,7 @@ func download(pkg string) (string, os.Error) {
}
return
root
+
pkg
,
nil
}
if
m
:=
launchpad
.
MatchStrings
(
pkg
);
m
!=
nil
{
if
m
:=
launchpad
.
FindStringSubmatch
(
pkg
);
m
!=
nil
{
// Either lp.net/<project>[/<series>[/<path>]]
// or lp.net/~<user or team>/<project>/<branch>[/<path>]
if
err
:=
vcsCheckout
(
&
bzr
,
root
+
m
[
1
],
"https://"
+
m
[
1
],
m
[
1
]);
err
!=
nil
{
...
...
src/pkg/go/doc/comment.go
View file @
d31ee536
...
...
@@ -199,8 +199,8 @@ var (
// and '' into ”).
func
emphasize
(
w
io
.
Writer
,
line
[]
byte
,
words
map
[
string
]
string
,
nice
bool
)
{
for
{
m
:=
matchRx
.
Execute
(
line
)
if
len
(
m
)
==
0
{
m
:=
matchRx
.
Find
(
line
)
if
m
==
nil
{
break
}
// m >= 6 (two parenthesized sub-regexps in matchRx, 1st one is identRx)
...
...
src/pkg/go/doc/doc.go
View file @
d31ee536
...
...
@@ -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
.
Execute
(
text
);
len
(
m
)
>
0
{
if
m
:=
bug_markers
.
Find
(
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
...
...
src/pkg/mime/multipart/multipart.go
View file @
d31ee536
...
...
@@ -103,7 +103,7 @@ func (bp *Part) populateHeaders() os.Error {
if
line
==
"
\n
"
||
line
==
"
\r\n
"
{
return
nil
}
if
matches
:=
headerRegexp
.
MatchStrings
(
line
);
len
(
matches
)
==
3
{
if
matches
:=
headerRegexp
.
FindStringSubmatch
(
line
);
len
(
matches
)
==
3
{
key
:=
matches
[
1
]
value
:=
matches
[
2
]
// TODO: canonicalize headers ala http.Request.Header?
...
...
test/bench/regex-dna-parallel.go
View file @
d31ee536
...
...
@@ -77,8 +77,8 @@ func countMatches(pat string, bytes []byte) int {
re
:=
regexp
.
MustCompile
(
pat
)
n
:=
0
for
{
e
:=
re
.
Execute
(
bytes
)
if
len
(
e
)
==
0
{
e
:=
re
.
FindIndex
(
bytes
)
if
e
==
nil
{
break
}
n
++
...
...
test/bench/regex-dna.go
View file @
d31ee536
...
...
@@ -76,7 +76,7 @@ func countMatches(pat string, bytes []byte) int {
re
:=
regexp
.
MustCompile
(
pat
)
n
:=
0
for
{
e
:=
re
.
Execute
(
bytes
)
e
:=
re
.
FindIndex
(
bytes
)
if
len
(
e
)
==
0
{
break
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment