summaryrefslogtreecommitdiff
path: root/src/lib/regexp/regexp.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2008-11-19 15:16:20 -0800
committerRobert Griesemer <gri@golang.org>2008-11-19 15:16:20 -0800
commit7acff2688260cddc30bde26e1f3758d13aa944db (patch)
tree7b81152f8a85e1e94819db1643e0ca2771907740 /src/lib/regexp/regexp.go
parentc0214c3d90c3d51fd6f6d9f0df18c8b03897c762 (diff)
downloadgolang-7acff2688260cddc30bde26e1f3758d13aa944db.tar.gz
- removed uses of vector in favor of array in a few places
- fixed make.bash R=r DELTA=21 (1 added, 3 deleted, 17 changed) OCL=19624 CL=19629
Diffstat (limited to 'src/lib/regexp/regexp.go')
-rw-r--r--src/lib/regexp/regexp.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/regexp/regexp.go b/src/lib/regexp/regexp.go
index 4b0aefce9..3c458dbfb 100644
--- a/src/lib/regexp/regexp.go
+++ b/src/lib/regexp/regexp.go
@@ -8,7 +8,7 @@ package regexp
import (
"os";
- "vector";
+ "array";
)
export var debug = false;
@@ -50,7 +50,7 @@ type RE struct {
expr string; // the original expression
ch *chan<- *RE; // reply channel when we're done
error *os.Error; // compile- or run-time error; nil if OK
- inst *vector.Vector;
+ inst *array.Array;
start Inst;
nbra int; // number of brackets in expression, for subexpressions
}
@@ -123,8 +123,8 @@ type CharClass struct {
Common;
char int;
negate bool; // is character class negated? ([^a-z])
- // Vector of int, stored pairwise: [a-z] is (a,z); x is (x,x):
- ranges *vector.Vector;
+ // array of int, stored pairwise: [a-z] is (a,z); x is (x,x):
+ ranges *array.IntArray;
}
func (cclass *CharClass) Type() int { return CHARCLASS }
@@ -135,8 +135,8 @@ func (cclass *CharClass) Print() {
print(" (negated)");
}
for i := 0; i < cclass.ranges.Len(); i += 2 {
- l := cclass.ranges.At(i).(int);
- r := cclass.ranges.At(i+1).(int);
+ l := cclass.ranges.At(i);
+ r := cclass.ranges.At(i+1);
if l == r {
print(" [", string(l), "]");
} else {
@@ -147,14 +147,14 @@ func (cclass *CharClass) Print() {
func (cclass *CharClass) AddRange(a, b int) {
// range is a through b inclusive
- cclass.ranges.Append(a);
- cclass.ranges.Append(b);
+ cclass.ranges.Push(a);
+ cclass.ranges.Push(b);
}
func (cclass *CharClass) Matches(c int) bool {
for i := 0; i < cclass.ranges.Len(); i = i+2 {
- min := cclass.ranges.At(i).(int);
- max := cclass.ranges.At(i+1).(int);
+ min := cclass.ranges.At(i);
+ max := cclass.ranges.At(i+1);
if min <= c && c <= max {
return !cclass.negate
}
@@ -164,7 +164,7 @@ func (cclass *CharClass) Matches(c int) bool {
func NewCharClass() *CharClass {
c := new(CharClass);
- c.ranges = vector.New();
+ c.ranges = array.NewIntArray(0);
return c;
}
@@ -220,7 +220,7 @@ func (re *RE) Error(err *os.Error) {
func (re *RE) Add(i Inst) Inst {
i.SetIndex(re.inst.Len());
- re.inst.Append(i);
+ re.inst.Push(i);
return i;
}
@@ -574,7 +574,7 @@ func (re *RE) DoParse() {
func Compiler(str string, ch *chan *RE) {
re := new(RE);
re.expr = str;
- re.inst = vector.New();
+ re.inst = array.New(0);
re.ch = ch;
re.DoParse();
ch <- re;