http://codereview.appspot.com/5971058/diff/1002/src/pkg/regexp/fallback.go#newcode1
src/pkg/regexp/fallback.go:1: // +build !cmd_go_bootstrap
put the build line after the copyright
http://codereview.appspot.com/5971058/diff/3001/src/pkg/regexp/regexp.go
File src/pkg/regexp/regexp.go (right):
http://codereview.appspot.com/5971058/diff/3001/src/pkg/regexp/regexp.go#newcode68
src/pkg/regexp/regexp.go:68: var fallbackCompile func(expr string, err
error) (*Regexp, error)
why fallback and not just override? If we're linking in pcre we might as
well use it. it is the industry standard after all
http://codereview.appspot.com/5971058/diff/1002/src/pkg/regexp/fallback.go#newcode1
src/pkg/regexp/fallback.go:1: // +build !cmd_go_bootstrap
On 2012/04/01 04:07:49, adg wrote:
> put the build line after the copyright
Actually I was bit by this recently, when the copyright was too long.
Russ admitted it was a bit of a bug and recommended +build lines go
before the copyright.
http://codereview.appspot.com/5971058/diff/3001/src/pkg/regexp/regexp.go
File src/pkg/regexp/regexp.go (right):
http://codereview.appspot.com/5971058/diff/3001/src/pkg/regexp/regexp.go#newcode68
src/pkg/regexp/regexp.go:68: var fallbackCompile func(expr string, err
error) (*Regexp, error)
On 2012/04/01 04:07:49, adg wrote:
> why fallback and not just override? If we're linking in pcre we might
as well
> use it. it is the industry standard after all
It helps during bootstrapping, when cgo isn't available. That's about
the only time we need a pure-Go implementation.
Interesting idea.
It could even learn over time (per-*Regexp) which is fastest.
http://codereview.appspot.com/5971058/diff/3001/src/pkg/regexp/fallback.go
File src/pkg/regexp/fallback.go (right):
http://codereview.appspot.com/5971058/diff/3001/src/pkg/regexp/fallback.go#newcode51
src/pkg/regexp/fallback.go:51: var buf [4]byte
s/4/utf8.UTFMax/
http://codereview.appspot.com/5971058/diff/3001/src/pkg/regexp/pcre/pcre.go
File src/pkg/regexp/pcre/pcre.go (right):
http://codereview.appspot.com/5971058/diff/3001/src/pkg/regexp/pcre/pcre.go#newcode26
src/pkg/regexp/pcre/pcre.go:26: // This package provides access to the
Perl Compatible Regular
s/This package/Package pcre/
http://codereview.appspot.com/5971058/diff/3001/src/pkg/regexp/pcre/pcre.go#newcode46
src/pkg/regexp/pcre/pcre.go:46: // package and the flags defined below,
see the PCRE documentation.
Give a link to the PCRE docs?
http://codereview.appspot.com/5971058/diff/3001/src/pkg/regexp/pcre/pcre.go#newcode101
src/pkg/regexp/pcre/pcre.go:101: // A reference to a compiled regular
expression.
Regexp is a reference etc.
http://codereview.appspot.com/5971058/diff/3001/src/pkg/regexp/pcre/pcre.go#newcode107
src/pkg/regexp/pcre/pcre.go:107: // Number of bytes in the compiled
pattern
pcresize returns the number of etc.
Similarly with func comments below.
> It could even learn over time (per-*Regexp) which is fastest.
A little neural net would train quickly for something like this. We
could SWIG wrap some of the well-studied C++ NN codebases for this
purpose.
I'd like you to review this change to
https://go.googlecode.com/hg/
Description:
regexp: implement backtracking with pcre fallback