| OLD | NEW |
| 1 // Copyright 2006 The RE2 Authors. All Rights Reserved. | 1 // Copyright 2006 The RE2 Authors. 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 // --- SPONSORED LINK -------------------------------------------------- | 5 // --- SPONSORED LINK -------------------------------------------------- |
| 6 // If you want to use this library for regular expression matching, | 6 // If you want to use this library for regular expression matching, |
| 7 // you should use re2/re2.h, which provides a class RE2 that | 7 // you should use re2/re2.h, which provides a class RE2 that |
| 8 // mimics the PCRE interface provided by PCRE's C++ wrappers. | 8 // mimics the PCRE interface provided by PCRE's C++ wrappers. |
| 9 // This header describes the low-level interface used to implement RE2 | 9 // This header describes the low-level interface used to implement RE2 |
| 10 // and may change in backwards-incompatible ways from time to time. | 10 // and may change in backwards-incompatible ways from time to time. |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 void set_tmp(string* tmp) { delete tmp_; tmp_ = tmp; } | 190 void set_tmp(string* tmp) { delete tmp_; tmp_ = tmp; } |
| 191 enum RegexpStatusCode code() const { return code_; } | 191 enum RegexpStatusCode code() const { return code_; } |
| 192 const StringPiece& error_arg() const { return error_arg_; } | 192 const StringPiece& error_arg() const { return error_arg_; } |
| 193 bool ok() const { return code() == kRegexpSuccess; } | 193 bool ok() const { return code() == kRegexpSuccess; } |
| 194 | 194 |
| 195 // Copies state from status. | 195 // Copies state from status. |
| 196 void Copy(const RegexpStatus& status); | 196 void Copy(const RegexpStatus& status); |
| 197 | 197 |
| 198 // Returns text equivalent of code, e.g.: | 198 // Returns text equivalent of code, e.g.: |
| 199 // "Bad character class" | 199 // "Bad character class" |
| 200 static const string& CodeText(enum RegexpStatusCode code); | 200 static string CodeText(enum RegexpStatusCode code); |
| 201 | 201 |
| 202 // Returns text describing error, e.g.: | 202 // Returns text describing error, e.g.: |
| 203 // "Bad character class: [z-a]" | 203 // "Bad character class: [z-a]" |
| 204 string Text() const; | 204 string Text() const; |
| 205 | 205 |
| 206 private: | 206 private: |
| 207 enum RegexpStatusCode code_; // Kind of error | 207 enum RegexpStatusCode code_; // Kind of error |
| 208 StringPiece error_arg_; // Piece of regexp containing syntax error. | 208 StringPiece error_arg_; // Piece of regexp containing syntax error. |
| 209 string* tmp_; // Temporary storage, possibly where error_arg_
is. | 209 string* tmp_; // Temporary storage, possibly where error_arg_
is. |
| 210 | 210 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 // s - DotNL | 292 // s - DotNL |
| 293 // U - NonGreedy | 293 // U - NonGreedy |
| 294 // line ends: \A \z | 294 // line ends: \A \z |
| 295 // \Q and \E to disable/enable metacharacters | 295 // \Q and \E to disable/enable metacharacters |
| 296 // (?P<name>expr) for named captures | 296 // (?P<name>expr) for named captures |
| 297 // \C to match any single byte | 297 // \C to match any single byte |
| 298 UnicodeGroups = 1<<10, // Allow \p{Han} for Unicode Han group | 298 UnicodeGroups = 1<<10, // Allow \p{Han} for Unicode Han group |
| 299 // and \P{Han} for its negation. | 299 // and \P{Han} for its negation. |
| 300 NeverNL = 1<<11, // Never match NL, even if the regexp mentions | 300 NeverNL = 1<<11, // Never match NL, even if the regexp mentions |
| 301 // it explicitly. | 301 // it explicitly. |
| 302 NeverCapture = 1<<12, // Parse all parens as non-capturing. |
| 302 | 303 |
| 303 // As close to Perl as we can get. | 304 // As close to Perl as we can get. |
| 304 LikePerl = ClassNL | OneLine | PerlClasses | PerlB | PerlX | | 305 LikePerl = ClassNL | OneLine | PerlClasses | PerlB | PerlX | |
| 305 UnicodeGroups, | 306 UnicodeGroups, |
| 306 | 307 |
| 307 // Internal use only. | 308 // Internal use only. |
| 308 WasDollar = 1<<15, // on kRegexpEndText: was $ in regexp text | 309 WasDollar = 1<<15, // on kRegexpEndText: was $ in regexp text |
| 309 }; | 310 }; |
| 310 | 311 |
| 311 // Get. No set, Regexps are logically immutable once created. | 312 // Get. No set, Regexps are logically immutable once created. |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 inline Regexp::ParseFlags operator~(Regexp::ParseFlags a) | 624 inline Regexp::ParseFlags operator~(Regexp::ParseFlags a) |
| 624 { | 625 { |
| 625 return static_cast<Regexp::ParseFlags>(~static_cast<int>(a)); | 626 return static_cast<Regexp::ParseFlags>(~static_cast<int>(a)); |
| 626 } | 627 } |
| 627 | 628 |
| 628 | 629 |
| 629 | 630 |
| 630 } // namespace re2 | 631 } // namespace re2 |
| 631 | 632 |
| 632 #endif // RE2_REGEXP_H__ | 633 #endif // RE2_REGEXP_H__ |
| OLD | NEW |