aboutsummaryrefslogtreecommitdiff
path: root/src/regexp/syntax
diff options
context:
space:
mode:
authorSylvain Zimmer <sylvain@sylvainzimmer.com>2017-09-02 17:38:45 +0200
committerDaniel Martí <mvdan@mvdan.cc>2017-09-08 23:39:37 +0000
commit67da597312556ca8fed27c0ce85ea7a60cb5a783 (patch)
tree5f9ec7e1784d1a13fbbb2bd4866d7ff00529b8e8 /src/regexp/syntax
parent44f7fd030fc0110b7fe727038a72bf6a0646be6f (diff)
downloadgo-67da597312556ca8fed27c0ce85ea7a60cb5a783.tar.xz
regexp: Remove duplicated function wordRune()
Fixes #21742 Change-Id: Ib56b092c490c27a4ba7ebdb6391f1511794710b8 Reviewed-on: https://go-review.googlesource.com/61034 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Diffstat (limited to 'src/regexp/syntax')
-rw-r--r--src/regexp/syntax/prog.go13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/regexp/syntax/prog.go b/src/regexp/syntax/prog.go
index c32ae8d9fa..6c56371b4c 100644
--- a/src/regexp/syntax/prog.go
+++ b/src/regexp/syntax/prog.go
@@ -247,15 +247,6 @@ func (i *Inst) MatchRunePos(r rune) int {
return noMatch
}
-// As per re2's Prog::IsWordChar. Determines whether rune is an ASCII word char.
-// Since we act on runes, it would be easy to support Unicode here.
-func wordRune(r rune) bool {
- return r == '_' ||
- ('A' <= r && r <= 'Z') ||
- ('a' <= r && r <= 'z') ||
- ('0' <= r && r <= '9')
-}
-
// MatchEmptyWidth reports whether the instruction matches
// an empty string between the runes before and after.
// It should only be called when i.Op == InstEmptyWidth.
@@ -270,9 +261,9 @@ func (i *Inst) MatchEmptyWidth(before rune, after rune) bool {
case EmptyEndText:
return after == -1
case EmptyWordBoundary:
- return wordRune(before) != wordRune(after)
+ return IsWordChar(before) != IsWordChar(after)
case EmptyNoWordBoundary:
- return wordRune(before) == wordRune(after)
+ return IsWordChar(before) == IsWordChar(after)
}
panic("unknown empty width arg")
}