Home | History | Annotate | Download | only in re2

Lines Matching refs:Regexp

17 // Any operation that traverses the Regexp structures should be written
18 // using Regexp::Walker (see walker-inl.h), not recursively, because deeply nested
27 // Regexp::Parse parses regular expressions encoded in UTF-8.
39 // Regexp::Parse. In particular, many of the basic Perl additions
42 // If parsed with the flag Regexp::Latin1, both the regular expression
48 // Once Regexp has parsed a regular expression, it provides methods
53 // To call a sublibrary, Regexp does not simply prepare a
55 // sublibrary. Instead, Regexp prepares, from its own parsed form, the
61 // to be that used by Regexp's parser, not the syntax expected
62 // by the sublibrary. Regexp might accept a restricted or
64 // the sublibrary. As long as Regexp can translate from its
82 // Unlike other regular expression libraries, Regexp makes its parsed
159 // Keep in sync with string list in regexp.cc
173 kRegexpTrailingBackslash, // at end of regexp
178 kRegexpBadUTF8, // invalid UTF-8 in regexp
208 StringPiece error_arg_; // Piece of regexp containing syntax error.
267 class Regexp {
274 Literal = 1<<1, // Treat s as literal string instead of a regexp.
282 Latin1 = 1<<5, // Regexp and text are in Latin1, not UTF-8.
300 NeverNL = 1<<11, // Never match NL, even if the regexp mentions
309 WasDollar = 1<<15, // on kRegexpEndText: was $ in regexp text
319 Regexp** sub() {
337 Regexp* Incref();
345 static Regexp* Parse(const StringPiece& s, ParseFlags flags,
348 // Returns a _new_ simplified version of the current regexp.
349 // Does not edit the current regexp.
355 Regexp* Simplify();
358 // Parses the regexp src and then simplifies it and sets *dst to the
365 // Returns the number of capturing groups in the regexp.
370 // or NULL if the regexp contains no named capture groups.
375 // names or NULL if the regexp contains no named capture groups. The
379 // Returns a string representation of the current regexp,
386 static Regexp* Plus(Regexp* sub, ParseFlags flags);
387 static Regexp* Star(Regexp* sub, ParseFlags flags);
388 static Regexp* Quest(Regexp* sub, ParseFlags flags);
389 static Regexp* Concat(Regexp** subs, int nsubs, ParseFlags flags);
390 static Regexp* Alternate(Regexp** subs, int nsubs, ParseFlags flags);
391 static Regexp* Capture(Regexp* sub, ParseFlags flags, int cap);
392 static Regexp* Repeat(Regexp* sub, ParseFlags flags, int min, int max);
393 static Regexp* NewLiteral(Rune rune, ParseFlags flags);
394 static Regexp* NewCharClass(CharClass* cc, ParseFlags flags);
395 static Regexp* LiteralString(Rune* runes, int nrunes, ParseFlags flags);
396 static Regexp* HaveMatch(int match_id, ParseFlags flags);
399 static Regexp* AlternateNoFactor(Regexp** subs, int nsubs, ParseFlags flags);
401 // Debugging function. Returns string format for regexp
402 // that makes structure clear. Does NOT use regexp syntax.
417 // when running this regexp. Most regexps do mimic PCRE exactly, but a few
419 // of the Prog than the Regexp, but the computation is much easier to do
420 // on the Regexp. See mimics_pcre.cc for the exact conditions.
426 // Whether every match of this regexp must be anchored and
428 // case-folding). If so, returns the prefix and the sub-regexp that
430 bool RequiredPrefix(string* prefix, bool *foldcase, Regexp** suffix);
434 explicit Regexp(RegexpOp op, ParseFlags parse_flags);
438 ~Regexp();
445 friend bool ParseCharClass(StringPiece* s, Regexp** out_re,
449 friend bool RegexpEqualTestingOnly(Regexp*, Regexp*);
451 // Computes whether Regexp is already simple.
456 // a particular Regexp.
457 static Regexp* ConcatOrAlternate(RegexpOp op, Regexp** subs, int nsubs,
463 static Rune* LeadingString(Regexp* re, int* nrune, ParseFlags* flags);
467 static void RemoveLeadingString(Regexp* re, int n);
469 // Returns the leading regexp in re's top-level concatenation.
470 // The returned Regexp* points at re or a sub-expression of re,
472 static Regexp* LeadingRegexp(Regexp* re);
476 static Regexp* RemoveLeadingRegexp(Regexp* re);
480 static int FactorAlternation(Regexp** sub, int nsub, ParseFlags flags);
481 static int FactorAlternationRecursive(Regexp** sub, int nsub,
487 static bool Equal(Regexp* a, Regexp* b);
494 submany_ = new Regexp*[n];
502 void Swap(Regexp *that);
508 // Is this regexp structure already simple
519 // regexp structures that are dags rather than trees to avoid
522 // The standard regexp routines will never generate a
538 Regexp** submany_; // if nsub_ > 1
539 Regexp* subone_; // if nsub_ == 1
543 Regexp* down_;
571 DISALLOW_EVIL_CONSTRUCTORS(Regexp);
597 void AddRangeFlags(Rune lo, Rune hi, Regexp::ParseFlags parse_flags);
609 inline Regexp::ParseFlags operator|(Regexp::ParseFlags a, Regexp::ParseFlags b)
611 return static_cast<Regexp::ParseFlags>(static_cast<int>(a) | static_cast<int>(b));
614 inline Regexp::ParseFlags operator^(Regexp::ParseFlags a, Regexp::ParseFlags b)
616 return static_cast<Regexp::ParseFlags>(static_cast<int>(a) ^ static_cast<int>(b));
619 inline Regexp::ParseFlags operator&(Regexp::ParseFlags a, Regexp::ParseFlags b)
621 return static_cast<Regexp::ParseFlags>(static_cast<int>(a) & static_cast<int>(b));
624 inline Regexp::ParseFlags operator~(Regexp::ParseFlags a)
626 return static_cast<Regexp::ParseFlags>(~static_cast<int>(a));