diff options
author | Russ Cox <rsc@golang.org> | 2008-12-18 22:37:22 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2008-12-18 22:37:22 -0800 |
commit | 89995dcecf37b9a21c26783dcf8ab506da237363 (patch) | |
tree | 851fad01a87b8fa071ed46fa0985f1857d9e47ca /src/lib/regexp/regexp.go | |
parent | 924e27f38d133bc7c9978a061b20f950554434ee (diff) | |
download | golang-89995dcecf37b9a21c26783dcf8ab506da237363.tar.gz |
convert *[] to [].
R=r
OCL=21563
CL=21571
Diffstat (limited to 'src/lib/regexp/regexp.go')
-rw-r--r-- | src/lib/regexp/regexp.go | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/lib/regexp/regexp.go b/src/lib/regexp/regexp.go index 3c458dbfb..2176c4ddb 100644 --- a/src/lib/regexp/regexp.go +++ b/src/lib/regexp/regexp.go @@ -582,7 +582,7 @@ func Compiler(str string, ch *chan *RE) { // Public interface has only execute functionality (not yet implemented) export type Regexp interface { - Execute(s string) *[]int + Execute(s string) []int } // Compile in separate goroutine; wait for result @@ -595,12 +595,12 @@ export func Compile(str string) (regexp Regexp, error *os.Error) { type State struct { inst Inst; // next instruction to execute - match *[]int; // pairs of bracketing submatches. 0th is start,end + match []int; // pairs of bracketing submatches. 0th is start,end } // Append new state to to-do list. Leftmost-longest wins so avoid // adding a state that's already active. -func AddState(s *[]State, inst Inst, match *[]int) *[]State { +func AddState(s []State, inst Inst, match []int) []State { index := inst.Index(); l := len(s); pos := match[0]; @@ -625,8 +625,8 @@ func AddState(s *[]State, inst Inst, match *[]int) *[]State { return s; } -func (re *RE) DoExecute(str string, pos int) *[]int { - var s [2]*[]State; // TODO: use a vector when State values (not ptrs) can be vector elements +func (re *RE) DoExecute(str string, pos int) []int { + var s [2][]State; // TODO: use a vector when State values (not ptrs) can be vector elements s[0] = new([]State, 10)[0:0]; s[1] = new([]State, 10)[0:0]; in, out := 0, 1; @@ -708,13 +708,10 @@ func (re *RE) DoExecute(str string, pos int) *[]int { } pos += charwidth; } - if !found { - return nil - } return final.match; } -func (re *RE) Execute(s string) *[]int { +func (re *RE) Execute(s string) []int { return re.DoExecute(s, 0) } |