aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/regexp
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-05-14 22:08:42 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-05-14 22:08:42 +0000
commitf3ab5720f7ce7835a905e6783b5b6720676331fb (patch)
treeb119ee23a08a92b43632e3c7e227b3862c869fba /libgo/go/regexp
parent517f1b3430f929a25694d29dc787ec33e2cbd47f (diff)
downloadgcc-f3ab5720f7ce7835a905e6783b5b6720676331fb.zip
gcc-f3ab5720f7ce7835a905e6783b5b6720676331fb.tar.gz
gcc-f3ab5720f7ce7835a905e6783b5b6720676331fb.tar.bz2
libgo: Use -fgo-pkgpath.
From-SVN: r187485
Diffstat (limited to 'libgo/go/regexp')
-rw-r--r--libgo/go/regexp/all_test.go3
-rw-r--r--libgo/go/regexp/exec_test.go22
-rw-r--r--libgo/go/regexp/export_test.go15
-rw-r--r--libgo/go/regexp/find_test.go4
4 files changed, 32 insertions, 12 deletions
diff --git a/libgo/go/regexp/all_test.go b/libgo/go/regexp/all_test.go
index f7b41a6..39a28df 100644
--- a/libgo/go/regexp/all_test.go
+++ b/libgo/go/regexp/all_test.go
@@ -2,9 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package regexp
+package regexp_test
import (
+ . "regexp"
"strings"
"testing"
)
diff --git a/libgo/go/regexp/exec_test.go b/libgo/go/regexp/exec_test.go
index e668574..a84bedc 100644
--- a/libgo/go/regexp/exec_test.go
+++ b/libgo/go/regexp/exec_test.go
@@ -2,9 +2,11 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package regexp
+package regexp_test
import (
+ . "regexp"
+
"bufio"
"compress/bzip2"
"fmt"
@@ -219,22 +221,22 @@ var run = []func(*Regexp, *Regexp, string) ([]int, string){
}
func runFull(re, refull *Regexp, text string) ([]int, string) {
- refull.longest = false
+ refull.SetLongest(false)
return refull.FindStringSubmatchIndex(text), "[full]"
}
func runPartial(re, refull *Regexp, text string) ([]int, string) {
- re.longest = false
+ re.SetLongest(false)
return re.FindStringSubmatchIndex(text), ""
}
func runFullLongest(re, refull *Regexp, text string) ([]int, string) {
- refull.longest = true
+ refull.SetLongest(true)
return refull.FindStringSubmatchIndex(text), "[full,longest]"
}
func runPartialLongest(re, refull *Regexp, text string) ([]int, string) {
- re.longest = true
+ re.SetLongest(true)
return re.FindStringSubmatchIndex(text), "[longest]"
}
@@ -246,22 +248,22 @@ var match = []func(*Regexp, *Regexp, string) (bool, string){
}
func matchFull(re, refull *Regexp, text string) (bool, string) {
- refull.longest = false
+ refull.SetLongest(false)
return refull.MatchString(text), "[full]"
}
func matchPartial(re, refull *Regexp, text string) (bool, string) {
- re.longest = false
+ re.SetLongest(false)
return re.MatchString(text), ""
}
func matchFullLongest(re, refull *Regexp, text string) (bool, string) {
- refull.longest = true
+ refull.SetLongest(true)
return refull.MatchString(text), "[full,longest]"
}
func matchPartialLongest(re, refull *Regexp, text string) (bool, string) {
- re.longest = true
+ re.SetLongest(true)
return re.MatchString(text), "[longest]"
}
@@ -541,7 +543,7 @@ Reading:
}
}
- re, err := compile(pattern, syn, true)
+ re, err := CompileInternal(pattern, syn, true)
if err != nil {
if shouldCompile {
t.Errorf("%s:%d: %#q did not compile", file, lineno, pattern)
diff --git a/libgo/go/regexp/export_test.go b/libgo/go/regexp/export_test.go
new file mode 100644
index 0000000..25080ad
--- /dev/null
+++ b/libgo/go/regexp/export_test.go
@@ -0,0 +1,15 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package regexp
+
+import "regexp/syntax"
+
+func (re *Regexp) SetLongest(b bool) {
+ re.longest = b
+}
+
+func CompileInternal(expr string, mode syntax.Flags, longest bool) (*Regexp, error) {
+ return compile(expr, mode, longest)
+}
diff --git a/libgo/go/regexp/find_test.go b/libgo/go/regexp/find_test.go
index e07eb7d..2593016 100644
--- a/libgo/go/regexp/find_test.go
+++ b/libgo/go/regexp/find_test.go
@@ -2,9 +2,11 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package regexp
+package regexp_test
import (
+ . "regexp"
+
"fmt"
"strings"
"testing"