Lines Matching refs:Regexp
8 // This file's external interface is just Regexp::CompileToProg.
13 #include "re2/regexp.h"
22 // See http://swtch.com/~rsc/regexp/regexp1.html for inspiration.
122 class Compiler : public Regexp::Walker<Frag> {
127 // Compiles Regexp to a new Prog.
131 static Prog *Compile(Regexp* re, bool reversed, int64 max_mem);
136 Regexp* re);
138 // Interface for Regexp::Walker, which helps traverse the Regexp.
142 // The Compiler traverses the Regexp parse tree, visiting
146 Frag PreVisit(Regexp* re, Frag parent_arg, bool* stop);
147 Frag PostVisit(Regexp* re, Frag parent_arg, Frag pre_arg, Frag* child_args,
149 Frag ShortVisit(Regexp* re, Frag parent_arg);
211 void Setup(Regexp::ParseFlags, int64, RE2::Anchor);
292 // see http://swtch.com/~rsc/regexp/regexp1.html for
676 Frag Compiler::ShortVisit(Regexp* re, Frag) {
682 Frag Compiler::PreVisit(Regexp* re, Frag, bool* stop) {
713 Frag Compiler::PostVisit(Regexp* re, Frag, Frag, Frag* child_frags,
755 return Star(child_frags[0], re->parse_flags()&Regexp::NonGreedy);
758 return Plus(child_frags[0], re->parse_flags()&Regexp::NonGreedy);
761 return Quest(child_frags[0], re->parse_flags()&Regexp::NonGreedy);
764 return Literal(re->rune(), re->parse_flags()&Regexp::FoldCase);
772 Frag f1 = Literal(re->runes()[i], re->parse_flags()&Regexp::FoldCase);
855 // Is this regexp required to start at the beginning of the text?
858 static bool IsAnchorStart(Regexp** pre, int depth) {
859 Regexp* re = *pre;
860 Regexp* sub;
862 // the stack on a deeply nested regexp. As the comment
874 Regexp** subcopy = new Regexp*[re->nsub()];
878 *pre = Regexp::Concat(subcopy, re->nsub(), re->parse_flags());
889 *pre = Regexp::Capture(sub, re->parse_flags(), re->cap());
896 *pre = Regexp::LiteralString(NULL, 0, re->parse_flags());
903 // Is this regexp required to start at the end of the text?
906 static bool IsAnchorEnd(Regexp** pre, int depth) {
907 Regexp* re = *pre;
908 Regexp* sub;
910 // the stack on a deeply nested regexp. As the comment
922 Regexp** subcopy = new Regexp*[re->nsub()];
926 *pre = Regexp::Concat(subcopy, re->nsub(), re->parse_flags());
937 *pre = Regexp::Capture(sub, re->parse_flags(), re->cap());
944 *pre = Regexp::LiteralString(NULL, 0, re->parse_flags());
951 void Compiler::Setup(Regexp::ParseFlags flags, int64 max_mem,
955 if (flags & Regexp::Latin1)
991 Prog* Compiler::Compile(Regexp* re, bool reversed, int64 max_mem) {
999 Regexp* sre = re->Simplify();
1008 // Generate fragment for entire regexp.
1078 // Converts Regexp to Prog.
1079 Prog* Regexp::CompileToProg(int64 max_mem) {
1083 Prog* Regexp::CompileToReverseProg(int64 max_mem) {
1093 Regexp* re) {
1096 Regexp::ParseFlags pf = static_cast<Regexp::ParseFlags>(options.ParseFlags());
1135 Regexp* re) {