summaryrefslogtreecommitdiff
path: root/src/lib/regexp
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2009-04-17 00:08:24 -0700
committerRob Pike <r@golang.org>2009-04-17 00:08:24 -0700
commit3696e3e558a5be76b8af9698ff0e56719e47ec59 (patch)
treec20f34ec6f9dea967a511f65b239c5e8637fec8f /src/lib/regexp
parentdf02778ccda228c665179d0ff3dac77217ad6633 (diff)
downloadgolang-3696e3e558a5be76b8af9698ff0e56719e47ec59.tar.gz
Step 1 of the Big Error Shift: make os.Error an interface and replace *os.Errors with os.Errors.
lib/template updated to use new setup; its clients also updated. Step 2 will make os's error support internally much cleaner. R=rsc OCL=27586 CL=27586
Diffstat (limited to 'src/lib/regexp')
-rw-r--r--src/lib/regexp/all_test.go4
-rw-r--r--src/lib/regexp/regexp.go8
2 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/regexp/all_test.go b/src/lib/regexp/all_test.go
index 1a5285eb7..a9f275893 100644
--- a/src/lib/regexp/all_test.go
+++ b/src/lib/regexp/all_test.go
@@ -32,7 +32,7 @@ var good_re = []string{
// TODO: nice to do this with a map
type stringError struct {
re string;
- err *os.Error;
+ err os.Error;
}
var bad_re = []stringError{
stringError{ `*`, regexp.ErrBareClosure },
@@ -85,7 +85,7 @@ var matches = []tester {
tester{ `a*(|(b))c*`, "aacc", vec{0,4, 2,2, -1,-1} },
}
-func compileTest(t *testing.T, expr string, error *os.Error) *regexp.Regexp {
+func compileTest(t *testing.T, expr string, error os.Error) *regexp.Regexp {
re, err := regexp.Compile(expr);
if err != error {
t.Error("compiling `", expr, "`; unexpected error: ", err.String());
diff --git a/src/lib/regexp/regexp.go b/src/lib/regexp/regexp.go
index 3ec3ff83a..135dcc368 100644
--- a/src/lib/regexp/regexp.go
+++ b/src/lib/regexp/regexp.go
@@ -70,7 +70,7 @@ func (c *common) setIndex(i int) { c._index = i }
type Regexp struct {
expr string; // the original expression
ch chan<- *Regexp; // reply channel when we're done
- error *os.Error; // compile- or run-time error; nil if OK
+ error os.Error; // compile- or run-time error; nil if OK
inst *vector.Vector;
start instr;
nbra int; // number of brackets in expression, for subexpressions
@@ -233,7 +233,7 @@ func (nop *_Nop) kind() int { return _NOP }
func (nop *_Nop) print() { print("nop") }
// report error and exit compiling/executing goroutine
-func (re *Regexp) setError(err *os.Error) {
+func (re *Regexp) setError(err os.Error) {
re.error = err;
re.ch <- re;
sys.Goexit();
@@ -586,7 +586,7 @@ func compiler(str string, ch chan *Regexp) {
// Compile parses a regular expression and returns, if successful, a Regexp
// object that can be used to match against text.
-func Compile(str string) (regexp *Regexp, error *os.Error) {
+func Compile(str string) (regexp *Regexp, error os.Error) {
// Compile in a separate goroutine and wait for the result.
ch := make(chan *Regexp);
go compiler(str, ch);
@@ -754,7 +754,7 @@ func (re *Regexp) MatchStrings(s string) (a []string) {
// Match checks whether a textual regular expression
// matches a substring. More complicated queries need
// to use Compile and the full Regexp interface.
-func Match(pattern string, s string) (matched bool, error *os.Error) {
+func Match(pattern string, s string) (matched bool, error os.Error) {
re, err := Compile(pattern);
if err != nil {
return false, err