Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1143)

Unified Diff: third_party/re2/re2/parse.cc

Issue 10873029: Migrate WebRequestRedirectByRegExAction to use RE2 and roll RE2 to revision 97:401ab4168e8e (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with ToT Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/re2/re2/dfa.cc ('k') | third_party/re2/re2/prefilter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/re2/re2/parse.cc
diff --git a/third_party/re2/re2/parse.cc b/third_party/re2/re2/parse.cc
index 551555a9ceb960c5079f943bee94105771d9592b..6423fe99889648d78384c6d896b47f10fe8dcd6e 100644
--- a/third_party/re2/re2/parse.cc
+++ b/third_party/re2/re2/parse.cc
@@ -1455,6 +1455,13 @@ static void AddUGroup(CharClassBuilder *cc, UGroup *g, int sign,
// to what's already missing. Too hard, so do in two steps.
CharClassBuilder ccb1;
AddUGroup(&ccb1, g, +1, parse_flags);
+ // If the flags say to take out \n, put it in, so that negating will take it out.
+ // Normally AddRangeFlags does this, but we're bypassing AddRangeFlags.
+ bool cutnl = !(parse_flags & Regexp::ClassNL) ||
+ (parse_flags & Regexp::NeverNL);
+ if (cutnl) {
+ ccb1.AddRange('\n', '\n');
+ }
ccb1.Negate();
cc->AddCharClass(&ccb1);
return;
@@ -1997,8 +2004,13 @@ Regexp* Regexp::Parse(const StringPiece& s, ParseFlags global_flags,
return NULL;
break;
}
- if (!ps.DoLeftParen(NULL))
- return NULL;
+ if (ps.flags() & NeverCapture) {
+ if (!ps.DoLeftParenNoCapture())
+ return NULL;
+ } else {
+ if (!ps.DoLeftParen(NULL))
+ return NULL;
+ }
t.remove_prefix(1); // '('
break;
« no previous file with comments | « third_party/re2/re2/dfa.cc ('k') | third_party/re2/re2/prefilter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698