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

Side by Side Diff: third_party/re2/util/pcre.h

Issue 1530113002: Revert of Update re2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
« no previous file with comments | « third_party/re2/util/mutex.h ('k') | third_party/re2/util/pcre.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2003-2010 Google Inc. All Rights Reserved. 1 // Copyright 2003-2010 Google Inc. All Rights Reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // This is a variant of PCRE's pcrecpp.h, originally written at Google. 5 // This is a variant of PCRE's pcrecpp.h, originally written at Google.
6 // The main changes are the addition of the HitLimit method and 6 // The main changes are the addition of the HitLimit method and
7 // compilation as PCRE in namespace re2. 7 // compilation as PCRE in namespace re2.
8 8
9 // C++ interface to the pcre regular-expression library. PCRE supports 9 // C++ interface to the pcre regular-expression library. PCRE supports
10 // Perl-style regular expressions (with extensions like \d, \w, \s, 10 // Perl-style regular expressions (with extensions like \d, \w, \s,
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 #include "util/util.h" 161 #include "util/util.h"
162 #include "re2/stringpiece.h" 162 #include "re2/stringpiece.h"
163 163
164 #ifdef USEPCRE 164 #ifdef USEPCRE
165 #include <pcre.h> 165 #include <pcre.h>
166 namespace re2 { 166 namespace re2 {
167 const bool UsingPCRE = true; 167 const bool UsingPCRE = true;
168 } // namespace re2 168 } // namespace re2
169 #else 169 #else
170 struct pcre; // opaque
171 namespace re2 { 170 namespace re2 {
172 const bool UsingPCRE = false; 171 const bool UsingPCRE = false;
172 struct pcre;
173 struct pcre_extra { int flags, match_limit, match_limit_recursion; };
174 #define pcre_free(x) {}
175 #define PCRE_EXTRA_MATCH_LIMIT 0
176 #define PCRE_EXTRA_MATCH_LIMIT_RECURSION 0
177 #define PCRE_ANCHORED 0
178 #define PCRE_NOTEMPTY 0
179 #define PCRE_ERROR_NOMATCH 1
180 #define PCRE_ERROR_MATCHLIMIT 2
181 #define PCRE_ERROR_RECURSIONLIMIT 3
182 #define PCRE_INFO_CAPTURECOUNT 0
183 #ifndef WIN32
184 #define pcre_compile(a,b,c,d,e) ({ (void)(a); (void)(b); *(c)=""; *(d)=0; (void) (e); ((pcre*)0); })
185 #define pcre_exec(a, b, c, d, e, f, g, h) ({ (void)(a); (void)(b); (void)(c); (v oid)(d); (void)(e); (void)(f); (void)(g); (void)(h); 0; })
186 #define pcre_fullinfo(a, b, c, d) ({ (void)(a); (void)(b); (void)(c); *(d) = 0; 0; })
187 #else
188 #define pcre_compile(a,b,c,d,e) NULL
189 #define pcre_exec(a, b, c, d, e, f, g, h) NULL
190 #define pcre_fullinfo(a, b, c, d) NULL
191 #endif
173 } // namespace re2 192 } // namespace re2
174 #endif 193 #endif
175 194
176 namespace re2 { 195 namespace re2 {
177 196
178 class PCRE_Options; 197 class PCRE_Options;
179 198
180 // Interface for regular expression matching. Also corresponds to a 199 // Interface for regular expression matching. Also corresponds to a
181 // pre-compiled regular expression. An "PCRE" object is safe for 200 // pre-compiled regular expression. An "PCRE" object is safe for
182 // concurrent use by multiple threads. 201 // concurrent use by multiple threads.
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 509
491 string pattern_; 510 string pattern_;
492 Option options_; 511 Option options_;
493 pcre* re_full_; // For full matches 512 pcre* re_full_; // For full matches
494 pcre* re_partial_; // For partial matches 513 pcre* re_partial_; // For partial matches
495 const string* error_; // Error indicator (or empty string) 514 const string* error_; // Error indicator (or empty string)
496 bool report_errors_; // Silences error logging if false 515 bool report_errors_; // Silences error logging if false
497 int match_limit_; // Limit on execution resources 516 int match_limit_; // Limit on execution resources
498 int stack_limit_; // Limit on stack resources (bytes) 517 int stack_limit_; // Limit on stack resources (bytes)
499 mutable int32_t hit_limit_; // Hit limit during execution (bool)? 518 mutable int32_t hit_limit_; // Hit limit during execution (bool)?
500 DISALLOW_COPY_AND_ASSIGN(PCRE); 519 DISALLOW_EVIL_CONSTRUCTORS(PCRE);
501 }; 520 };
502 521
503 // PCRE_Options allow you to set the PCRE::Options, plus any pcre 522 // PCRE_Options allow you to set the PCRE::Options, plus any pcre
504 // "extra" options. The only extras are match_limit, which limits 523 // "extra" options. The only extras are match_limit, which limits
505 // the CPU time of a match, and stack_limit, which limits the 524 // the CPU time of a match, and stack_limit, which limits the
506 // stack usage. Setting a limit to <= 0 lets PCRE pick a sensible default 525 // stack usage. Setting a limit to <= 0 lets PCRE pick a sensible default
507 // that should not cause too many problems in production code. 526 // that should not cause too many problems in production code.
508 // If PCRE hits a limit during a match, it may return a false negative, 527 // If PCRE hits a limit during a match, it may return a false negative,
509 // but (hopefully) it won't crash. 528 // but (hopefully) it won't crash.
510 // 529 //
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 MAKE_INTEGER_PARSER(int, int); 676 MAKE_INTEGER_PARSER(int, int);
658 MAKE_INTEGER_PARSER(unsigned int, uint); 677 MAKE_INTEGER_PARSER(unsigned int, uint);
659 MAKE_INTEGER_PARSER(long, long); 678 MAKE_INTEGER_PARSER(long, long);
660 MAKE_INTEGER_PARSER(unsigned long, ulong); 679 MAKE_INTEGER_PARSER(unsigned long, ulong);
661 MAKE_INTEGER_PARSER(long long, longlong); 680 MAKE_INTEGER_PARSER(long long, longlong);
662 MAKE_INTEGER_PARSER(unsigned long long, ulonglong); 681 MAKE_INTEGER_PARSER(unsigned long long, ulonglong);
663 682
664 #undef MAKE_INTEGER_PARSER 683 #undef MAKE_INTEGER_PARSER
665 684
666 } // namespace re2 685 } // namespace re2
OLDNEW
« no previous file with comments | « third_party/re2/util/mutex.h ('k') | third_party/re2/util/pcre.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698