Rob Pike
f913830148
regexp: use Scanner in exec_test
...
R=rsc
CC=golang-dev
https://golang.org/cl/7381046
2013-02-20 13:37:45 -08:00
Andrew Gerrand
5fad786452
regexp: update comment on (*Regexp).Longest
...
Missed this review comment.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7229084
2013-02-04 15:57:32 +11:00
Andrew Gerrand
f41ffc2bf4
regexp: add (*Regexp).Longest
...
Fixes #3696 .
R=rsc
CC=golang-dev
https://golang.org/cl/7133051
2013-02-04 15:28:55 +11:00
Dave Cheney
6a9e956f19
all: use t.Skip{,f}
...
Replace various t.Log{,f} ; return checks with t.Skip{,f}.
R=golang-dev, n13m3y3r, bradfitz, adg, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7193044
2013-01-24 17:32:10 +11:00
Erik St. Martin
54b7ccd514
regexp: fix index panic in Replace
...
When using subexpressions ($1) as replacements, when they either don't exist or values weren't found causes a panic.
This patch ensures that the match location isn't -1, to prevent out of bounds errors.
Fixes #3816 .
R=franciscossouza, rsc
CC=golang-dev
https://golang.org/cl/6931049
2012-12-22 11:14:56 -05:00
Russ Cox
3c6c88319e
regexp: re-enable TestBadCompile
...
The code that was commented out was for the old regexp package.
In the new one the errors and the space of valid regexps are different.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6873063
2012-12-11 12:19:39 -05:00
Brian Ketelsen
1b46e4cd9a
regexp/syntax: export ErrUnexpectedParen
...
Fixes #3712
R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6902069
2012-12-11 12:02:14 -05:00
Rick Arnold
94b3f6d728
regexp: add Split
...
As discussed in issue 2672 and on golang-nuts, this CL adds a Split() method
to regexp. It is based on returning the "opposite" of FindAllString() so that
the returned substrings are everything not matched by the expression.
See: https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/xodBZh9Lh2E
Fixes #2762 .
R=remyoudompheng, r, rsc
CC=golang-dev
https://golang.org/cl/6846048
2012-11-27 12:58:27 -05:00
Volker Dobler
b46de71457
regexp: add examples
...
Update #4125
R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6847107
2012-11-27 10:33:15 -05:00
Andrew Gerrand
e33b9f7815
regexp: add simple package-level example
...
Update #4125
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6846045
2012-11-14 10:43:21 +01:00
Robert Griesemer
465b9c35e5
gofmt: apply gofmt -w src misc
...
Remove trailing whitespace in comments.
No other changes.
R=r
CC=golang-dev
https://golang.org/cl/6815053
2012-10-30 13:38:01 -07:00
Russ Cox
c7e0b8baa6
regexp/syntax: define accepted syntax
...
Update #3953 .
R=bradfitz, campoy
CC=golang-dev
https://golang.org/cl/6543068
2012-09-24 15:33:53 -04:00
Rob Pike
4783ad82da
regexp: fix glitch in doc for FindReaderIndex
...
Fixes #3878 .
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6457054
2012-07-30 12:46:50 -07:00
David G. Andersen
e66d29cdcf
pkg: Removing duplicated words ("of of", etc.), mostly from comments.
...
Ran 'double.pl' on the pkg tree to identify doubled words.
One change to an error string return in x509; the rest are in comments.
Thanks to Matt Jibson for the idea.
R=golang-dev, bsiegert
CC=golang-dev
https://golang.org/cl/6344089
2012-07-09 09:16:10 +10:00
Russ Cox
50452720ba
regexp/syntax: unexport ErrUnexpectedParen
...
This new error is the only API change in the current draft of
Go 1.0.2 CLs. I'd like to include the CL that introduced it,
because it replaces a mysterious 'internal error' with a
useful error message, but I don't want any API changes,
so unexport the error constant for now. It can be
re-exported for Go 1.1.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6294055
2012-06-08 13:05:01 -04:00
Rob Pike
43cf5505fc
regexp: fix a couple of bugs in the documentation
...
Byte slices are not strings.
Fixes #3687 .
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/6257074
2012-05-30 21:57:50 -07:00
Jan Mercl
bd13f6ff8e
regexp/syntax: replace internal error on unexpected ) w/ ErrUnexpectedParen
...
Unbalanced extra right parenthesis produced an internal error instead of
a more descriptive one.
Fixes #3406 .
R=r, rsc
CC=golang-dev
https://golang.org/cl/6201063
2012-05-14 11:50:25 -07:00
Russ Cox
ce63ec93ce
regexp/syntax: delete old package comment
...
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5651057
2012-02-10 01:11:56 -05:00
Rob Pike
1ceb561629
regexp/syntax: add package and Parse commentary
...
Fixes #2954 .
R=golang-dev, bradfitz, rsc, r
CC=golang-dev
https://golang.org/cl/5645077
2012-02-10 15:57:12 +11:00
Brad Fitzpatrick
9cd4a0467a
regexp: name result parameters referenced from docs
...
Fixes #2953
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5653051
2012-02-10 10:22:01 +11:00
Russ Cox
5957f914e2
regexp: fix typo
...
Fixes #2918 .
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5639062
2012-02-08 08:59:59 -05:00
Russ Cox
7201ba2171
regexp: allow substitutions in Replace, ReplaceString
...
Add Expand, ExpandString for access to the substitution functionality.
Fixes #2736 .
R=r, bradfitz, r, rogpeppe, n13m3y3r
CC=golang-dev
https://golang.org/cl/5638046
2012-02-07 23:46:47 -05:00
Nigel Tao
102638cb53
std: add struct field tags to untagged literals.
...
R=rsc, dsymonds, bsiegert, rogpeppe
CC=golang-dev
https://golang.org/cl/5619052
2012-02-03 10:12:25 +11:00
Russ Cox
2050a9e478
build: remove Make.pkg, Make.tool
...
Consequently, remove many package Makefiles,
and shorten the few that remain.
gomake becomes 'go tool make'.
Turn off test phases of run.bash that do not work,
flagged with $BROKEN. Future CLs will restore these,
but this seemed like a big enough CL already.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5601057
2012-01-30 23:43:46 -05:00
Brad Fitzpatrick
73ce14d0aa
regexp: remove vestigial Error type
...
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5573069
2012-01-25 14:50:37 -08:00
Olivier Duperray
e5c1f3870b
pkg: Add & fix Copyright of "hand generated" files
...
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5554064
2012-01-19 10:14:56 -08:00
Russ Cox
21d3721eb8
regexp: add SubexpNames
...
Fixes #2440 .
R=r, dsymonds
CC=golang-dev
https://golang.org/cl/5559043
2012-01-19 01:24:01 -05:00
Rob Pike
6b772462e4
panics: use the new facilities of testing.B instead
...
Lots of panics go away.
Also fix a name error in html/template.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5498045
2011-12-20 10:36:25 -08:00
Russ Cox
a250f37cbc
update tree for new default type rule
...
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5448091
2011-12-08 22:08:03 -05:00
Russ Cox
2f2cc24cd8
regexp: avoid allocation of input interface
...
Matters most for small inputs, because there is no real work
to amortize the allocation effort against.
benchmark old ns/op new ns/op delta
BenchmarkLiteral 613 473 -22.84%
BenchmarkNotLiteral 4981 4931 -1.00%
BenchmarkMatchClass 7289 7122 -2.29%
BenchmarkMatchClass_InRange 6618 6663 +0.68%
BenchmarkReplaceAll 7843 7233 -7.78%
BenchmarkAnchoredLiteralShortNonMatch 329 228 -30.70%
BenchmarkAnchoredLiteralLongNonMatch 322 228 -29.19%
BenchmarkAnchoredShortMatch 838 715 -14.68%
BenchmarkAnchoredLongMatch 824 715 -13.23%
benchmark old MB/s new MB/s speedup
BenchmarkMatchEasy0_32 119.73 196.61 1.64x
BenchmarkMatchEasy0_1K 540.58 538.33 1.00x
BenchmarkMatchEasy0_32K 732.57 714.00 0.97x
BenchmarkMatchEasy0_1M 726.44 708.36 0.98x
BenchmarkMatchEasy0_32M 707.77 691.45 0.98x
BenchmarkMatchEasy1_32 102.12 136.11 1.33x
BenchmarkMatchEasy1_1K 298.31 307.04 1.03x
BenchmarkMatchEasy1_32K 273.56 274.43 1.00x
BenchmarkMatchEasy1_1M 268.42 269.23 1.00x
BenchmarkMatchEasy1_32M 266.15 267.34 1.00x
BenchmarkMatchMedium_32 2.53 3.38 1.34x
BenchmarkMatchMedium_1K 9.37 9.57 1.02x
BenchmarkMatchMedium_32K 9.29 9.67 1.04x
BenchmarkMatchMedium_1M 9.42 9.66 1.03x
BenchmarkMatchMedium_32M 9.41 9.62 1.02x
BenchmarkMatchHard_32 6.66 6.75 1.01x
BenchmarkMatchHard_1K 6.81 6.85 1.01x
BenchmarkMatchHard_32K 6.79 6.85 1.01x
BenchmarkMatchHard_1M 6.82 6.83 1.00x
BenchmarkMatchHard_32M 6.80 6.80 1.00x
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5453076
2011-12-07 15:03:05 -05:00
Russ Cox
2666b815a3
use new strconv API
...
All but 3 cases (in gcimporter.go and hixie.go)
are automatic conversions using gofix.
No attempt is made to use the new Append functions
even though there are definitely opportunities.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5447069
2011-12-05 15:48:46 -05:00
Russ Cox
7a6a9755a9
regexp: fix doc comment
...
Fixes #2432 .
R=r, r
CC=golang-dev
https://golang.org/cl/5376041
2011-11-09 13:46:54 -05:00
Rob Pike
45e3bcb343
renaming_3: gofix -r go1pkgrename src/pkg/[m-z]*
...
R=rsc
CC=golang-dev
https://golang.org/cl/5345045
2011-11-08 15:41:54 -08:00
Russ Cox
492098eb75
all: rename os.Error to error in various non-code contexts
...
R=adg
CC=golang-dev
https://golang.org/cl/5328062
2011-11-01 22:58:09 -04:00
Russ Cox
eb6929299b
src/pkg/[n-z]*: gofix -r error -force=error
...
R=golang-dev, bsiegert, iant
CC=golang-dev
https://golang.org/cl/5294074
2011-11-01 22:05:34 -04:00
Russ Cox
3e52dadfd7
regexp: use rune
...
Public API of syntax tree changes.
R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/5302046
2011-10-25 22:20:57 -07:00
Russ Cox
8f699a3fb9
regexp: speedups
...
MatchEasy0_1K 500000 4207 ns/op 243.35 MB/s
MatchEasy0_1K_Old 500000 4625 ns/op 221.40 MB/s
MatchEasy0_1M 500 3948932 ns/op 265.53 MB/s
MatchEasy0_1M_Old 500 3943926 ns/op 265.87 MB/s
MatchEasy0_32K 10000 122974 ns/op 266.46 MB/s
MatchEasy0_32K_Old 10000 123270 ns/op 265.82 MB/s
MatchEasy0_32M 10 127265400 ns/op 263.66 MB/s
MatchEasy0_32M_Old 10 127123500 ns/op 263.95 MB/s
MatchEasy1_1K 500000 5637 ns/op 181.63 MB/s
MatchEasy1_1K_Old 10000 100690 ns/op 10.17 MB/s
MatchEasy1_1M 200 7683150 ns/op 136.48 MB/s
MatchEasy1_1M_Old 10 145774000 ns/op 7.19 MB/s
MatchEasy1_32K 10000 239887 ns/op 136.60 MB/s
MatchEasy1_32K_Old 500 4508182 ns/op 7.27 MB/s
MatchEasy1_32M 10 247103500 ns/op 135.79 MB/s
MatchEasy1_32M_Old 1 4660191000 ns/op 7.20 MB/s
MatchMedium_1K 10000 160567 ns/op 6.38 MB/s
MatchMedium_1K_Old 10000 158367 ns/op 6.47 MB/s
MatchMedium_1M 10 162928000 ns/op 6.44 MB/s
MatchMedium_1M_Old 10 159699200 ns/op 6.57 MB/s
MatchMedium_32K 500 5090758 ns/op 6.44 MB/s
MatchMedium_32K_Old 500 5005800 ns/op 6.55 MB/s
MatchMedium_32M 1 5233973000 ns/op 6.41 MB/s
MatchMedium_32M_Old 1 5109676000 ns/op 6.57 MB/s
MatchHard_1K 10000 249087 ns/op 4.11 MB/s
MatchHard_1K_Old 5000 364569 ns/op 2.81 MB/s
MatchHard_1M 5 256050000 ns/op 4.10 MB/s
MatchHard_1M_Old 5 372446400 ns/op 2.82 MB/s
MatchHard_32K 200 7944525 ns/op 4.12 MB/s
MatchHard_32K_Old 100 11609380 ns/op 2.82 MB/s
MatchHard_32M 1 8144503000 ns/op 4.12 MB/s
MatchHard_32M_Old 1 11885434000 ns/op 2.82 MB/s
R=r, bradfitz
CC=golang-dev
https://golang.org/cl/5134049
2011-09-28 12:00:31 -04:00
Russ Cox
6c230fbc67
regexp: move to old/regexp, replace with exp/regexp
...
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5127042
2011-09-26 18:33:13 -04:00
Rob Pike
d6f80e1a4c
regexp: document that Regexp is thread-safe.
...
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4667047
2011-06-29 15:41:09 +10:00
Nigel Tao
278952c393
regexp: add a package prefix to error strings.
...
R=r, r
CC=golang-dev
https://golang.org/cl/4630041
2011-06-17 10:50:38 +10:00
Robert Hencke
3fbd478a8a
pkg: spelling tweaks, I-Z
...
also, a few miscellaneous fixes to files outside pkg
R=golang-dev, dsymonds, mikioh.mikioh, r
CC=golang-dev
https://golang.org/cl/4517116
2011-05-30 18:02:59 +10:00
Rob Pike
7db904c1f6
regexp: add support for matching text read from things that implement
...
ReadRune. (If you have a Reader but not a RuneReader, use bufio.)
The matching code is a few percent slower but significantly cleaner.
R=rsc
CC=golang-dev
https://golang.org/cl/4125046
2011-02-03 13:58:40 -08:00
Rob Pike
8a2d706487
regexp tests: make some benchmarks more meaningful
...
The first two "Literal" tests were silly.
Also fix a naming typo in a couple of tests.
R=rsc
CC=golang-dev
https://golang.org/cl/4127045
2011-02-01 17:48:42 -08:00
Ben Lynn
eb56a79e99
regexp: reject bare ?
...
Minor cleanup:
- removed a duplicate test case
- added a function to remove repeated code
- for consistency, replaced "return nil" with a panic at an
unreachable point
Fixes #1428 .
R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/4057042
2011-01-19 13:47:04 -05:00
Rob Pike
6a5a527173
regexp: implement early out for failed anchored search.
...
R=rsc
CC=golang-dev
https://golang.org/cl/3813045
2011-01-04 12:43:52 -08:00
Rob Pike
15cb7ed34f
regexp: fix prefix bug.
...
After a prefix match, the old code advanced the length of the
prefix. This is incorrect since the full match might begin
in the middle of the prefix. (Consider "aaaab+" matching
"aaaaaab").
Fixes #1373
R=rsc
CC=golang-dev
https://golang.org/cl/3795044
2011-01-03 11:35:34 -08:00
Rob Pike
c0d0d4ef05
regexp: fix performance bug, make anchored searches fail fast.
...
The bug was that for an anchored pattern such as ^x, the prefix
scan ignored the anchor, and could scan the whole file if there was
no x present. The fix is to do prefix matching after the anchor;
the cost miniscule; the speedups huge.
R=rsc, gri
CC=golang-dev
https://golang.org/cl/3837042
2011-01-03 11:31:51 -08:00
Rob Pike
a9e7c9381e
regexp: change Expr() to String(); add HasOperator method to Regexp.
...
It reports whether a regular expression has operators
as opposed to matching literal text.
R=rsc, gri
CC=golang-dev
https://golang.org/cl/3731041
2010-12-17 10:23:46 -08:00
Rob Pike
5bd4094d2e
regexp: add HasMeta and regexp.Expr().
...
The former is a boolean function to test whether a string
contains a regular expression metacharacter; the second
returns the string used to compile the regexp.
R=gri, rsc
CC=golang-dev
https://golang.org/cl/3728041
2010-12-16 16:55:26 -08:00
Rob Pike
da1cbe5d11
regexp: simplify code for brackets, per rsc suggestion
...
R=rsc
CC=golang-dev
https://golang.org/cl/3545044
2010-12-14 12:01:35 -08:00