exp/regexp/syntax: more escapes, character classes
Still TODO: parsing optimizations
make_perl_groups.pl is copied with minimal modifications
(just to generate Go syntax instead of C++) from RE2.
Google Inc is "The RE2 Author" of that file and is one of
the Go Authors, so copyright changed to the Go Authors instead.
http://codereview.appspot.com/4612041/diff/1003/src/pkg/exp/regexp/syntax/parse.go File src/pkg/exp/regexp/syntax/parse.go (right): http://codereview.appspot.com/4612041/diff/1003/src/pkg/exp/regexp/syntax/parse.go#newcode756 src/pkg/exp/regexp/syntax/parse.go:756: // character or use \008. Don't you mean either ...
13 years, 9 months ago
(2011-06-13 19:09:47 UTC)
#3
http://codereview.appspot.com/4612041/diff/16001/src/pkg/exp/regexp/syntax/make_perl_groups.pl File src/pkg/exp/regexp/syntax/make_perl_groups.pl (right): http://codereview.appspot.com/4612041/diff/16001/src/pkg/exp/regexp/syntax/make_perl_groups.pl#newcode2 src/pkg/exp/regexp/syntax/make_perl_groups.pl:2: # Copyright 2008 The Go Authors. All rights reserved. ...
13 years, 9 months ago
(2011-06-14 14:00:51 UTC)
#6
> http://codereview.appspot.com/4612041/diff/16001/src/pkg/exp/regexp/syntax/make_perl_groups.pl#newcode2 > src/pkg/exp/regexp/syntax/make_perl_groups.pl:2: # Copyright 2008 The Go > Authors. All rights reserved. > ...
13 years, 9 months ago
(2011-06-14 14:31:36 UTC)
#7
> i do think this could be significantly cleaner with some helper methods > like ...
13 years, 9 months ago
(2011-06-14 18:29:51 UTC)
#8
> i do think this could be significantly cleaner with some helper methods
> like accept() and peek(), but we can discuss that in another round.
sounds good.
> this is a monster function and nothing in the loop matters outside. p
> goes in, p comes out. how about making the loop a method? then break
> BigSwitch becomes return and the code is a little more concise. all the
> returns in here are errors, so that helps too
tried this. even in a separate function i still had break BigSwitch
because i want to have just one successful return in the function,
at the end of the switch.
>
http://codereview.appspot.com/4612041/diff/16001/src/pkg/exp/regexp/syntax/pa...
> src/pkg/exp/regexp/syntax/parse.go:560: // is a valid capture name.
> [A-Za-z0-9_]+.
> s/\. /:/
done
>
http://codereview.appspot.com/4612041/diff/16001/src/pkg/exp/regexp/syntax/pa...
> src/pkg/exp/regexp/syntax/parse.go:856: if p.flags&UnicodeGroups == 0 ||
> len(s) < 2 || s[0] != '\\' || s[1] != 'p' && s[1] != 'P' {
> might was well use strings.HasPrefix for some of these.
maybe, but for example here i'd have to call it twice.
they all seem short enough not to bother.
>
http://codereview.appspot.com/4612041/diff/16001/src/pkg/exp/regexp/syntax/pa...
> src/pkg/exp/regexp/syntax/parse.go:860: // Commited to parse or return
> error.
> s/t/tt/
done
*** Submitted as http://code.google.com/p/go/source/detail?r=ecb31be11487 *** exp/regexp/syntax: more escapes, character classes Still TODO: parsing optimizations make_perl_groups.pl ...
13 years, 9 months ago
(2011-06-14 18:30:12 UTC)
#9
*** Submitted as http://code.google.com/p/go/source/detail?r=ecb31be11487 ***
exp/regexp/syntax: more escapes, character classes
Still TODO: parsing optimizations
make_perl_groups.pl is copied with minimal modifications
(just to generate Go syntax instead of C++) from RE2.
Google Inc is "The RE2 Author" of that file and is one of
the Go Authors, so copyright changed to the Go Authors instead.
R=sam.thorogood, r, fvbommel, robert.hencke
CC=golang-dev
http://codereview.appspot.com/4612041
Issue 4612041: code review 4612041: exp/regexp/syntax: more escapes, character classes
(Closed)
Created 13 years, 9 months ago by rsc
Modified 13 years, 9 months ago
Reviewers:
Base URL:
Comments: 9