mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
special case: recognize '[^\n]' and make it as fast as '.'
R=rsc DELTA=25 (23 added, 1 deleted, 1 changed) OCL=32793 CL=32799
This commit is contained in:
parent
3776f31144
commit
5a4d431dd1
2 changed files with 24 additions and 2 deletions
|
|
@ -27,6 +27,7 @@ var good_re = []string{
|
|||
`[]`,
|
||||
`[abc]`,
|
||||
`[^1234]`,
|
||||
`[^\n]`,
|
||||
}
|
||||
|
||||
// TODO: nice to do this with a map
|
||||
|
|
@ -72,6 +73,7 @@ var matches = []tester {
|
|||
tester{ `[a-z]+`, "abcd", vec{0,4} },
|
||||
tester{ `[^a-z]+`, "ab1234cd", vec{2,6} },
|
||||
tester{ `[a\-\]z]+`, "az]-bcz", vec{0,4} },
|
||||
tester{ `[^\n]+`, "abcd\n", vec{0,4} },
|
||||
tester{ `[日本語]+`, "日本語日本語", vec{0,18} },
|
||||
tester{ `()`, "", vec{0,0, 0,0} },
|
||||
tester{ `(a)`, "a", vec{0,1, 0,1} },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue