diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-12-02 19:34:41 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-12-02 19:34:41 +0000 |
commit | 506cf9aaead4f5519f5549a918d285365b44e989 (patch) | |
tree | fe0344f264049738dca876a6dd2f69e96621ca17 /libgo/go/regexp/regexp.go | |
parent | bfa9b58039ceacb1bae803fbbfb049b93540f2a7 (diff) | |
download | gcc-506cf9aaead4f5519f5549a918d285365b44e989.zip gcc-506cf9aaead4f5519f5549a918d285365b44e989.tar.gz gcc-506cf9aaead4f5519f5549a918d285365b44e989.tar.bz2 |
libgo: Update to weekly.2011-11-01.
From-SVN: r181938
Diffstat (limited to 'libgo/go/regexp/regexp.go')
-rw-r--r-- | libgo/go/regexp/regexp.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libgo/go/regexp/regexp.go b/libgo/go/regexp/regexp.go index 2325f62..a1b7951 100644 --- a/libgo/go/regexp/regexp.go +++ b/libgo/go/regexp/regexp.go @@ -83,7 +83,7 @@ type Regexp struct { prefix string // required prefix in unanchored matches prefixBytes []byte // prefix, as a []byte prefixComplete bool // prefix is the entire regexp - prefixRune int // first rune in prefix + prefixRune rune // first rune in prefix cond syntax.EmptyOp // empty-width conditions required at start of match numSubexp int longest bool @@ -224,13 +224,13 @@ func (re *Regexp) NumSubexp() int { return re.numSubexp } -const endOfText = -1 +const endOfText rune = -1 // input abstracts different representations of the input text. It provides // one-character lookahead. type input interface { - step(pos int) (rune int, width int) // advance one rune - canCheckPrefix() bool // can we look ahead without losing info? + step(pos int) (r rune, width int) // advance one rune + canCheckPrefix() bool // can we look ahead without losing info? hasPrefix(re *Regexp) bool index(re *Regexp, pos int) int context(pos int) syntax.EmptyOp @@ -245,11 +245,11 @@ func newInputString(str string) *inputString { return &inputString{str: str} } -func (i *inputString) step(pos int) (int, int) { +func (i *inputString) step(pos int) (rune, int) { if pos < len(i.str) { c := i.str[pos] if c < utf8.RuneSelf { - return int(c), 1 + return rune(c), 1 } return utf8.DecodeRuneInString(i.str[pos:]) } @@ -269,7 +269,7 @@ func (i *inputString) index(re *Regexp, pos int) int { } func (i *inputString) context(pos int) syntax.EmptyOp { - r1, r2 := -1, -1 + r1, r2 := endOfText, endOfText if pos > 0 && pos <= len(i.str) { r1, _ = utf8.DecodeLastRuneInString(i.str[:pos]) } @@ -288,11 +288,11 @@ func newInputBytes(str []byte) *inputBytes { return &inputBytes{str: str} } -func (i *inputBytes) step(pos int) (int, int) { +func (i *inputBytes) step(pos int) (rune, int) { if pos < len(i.str) { c := i.str[pos] if c < utf8.RuneSelf { - return int(c), 1 + return rune(c), 1 } return utf8.DecodeRune(i.str[pos:]) } @@ -312,7 +312,7 @@ func (i *inputBytes) index(re *Regexp, pos int) int { } func (i *inputBytes) context(pos int) syntax.EmptyOp { - r1, r2 := -1, -1 + r1, r2 := endOfText, endOfText if pos > 0 && pos <= len(i.str) { r1, _ = utf8.DecodeLastRune(i.str[:pos]) } @@ -333,7 +333,7 @@ func newInputReader(r io.RuneReader) *inputReader { return &inputReader{r: r} } -func (i *inputReader) step(pos int) (int, int) { +func (i *inputReader) step(pos int) (rune, int) { if !i.atEOT && pos != i.pos { return endOfText, 0 |