Lines Matching refs:re
131 static Prog *Compile(Regexp* re, bool reversed, int64 max_mem);
133 // Compiles alternation of all the re to a new Prog.
134 // Each re has a match with an id equal to its index in the vector.
136 Regexp* re);
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);
668 // We're using WalkExponential; there should be no copying.
676 Frag Compiler::ShortVisit(Regexp* re, Frag) {
682 Frag Compiler::PreVisit(Regexp* re, Frag, bool* stop) {
712 // Given their frags, build and return the frag for this re.
713 Frag Compiler::PostVisit(Regexp* re, Frag, Frag, Frag* child_frags,
721 switch (re->op()) {
733 Frag f = Match(re->match_id());
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);
768 if (re->nrunes() == 0)
771 for (int i = 0; i < re->nrunes(); i++) {
772 Frag f1 = Literal(re->runes()[i], re->parse_flags()&Regexp::FoldCase);
790 CharClass* cc = re->cc();
828 if (re->cap() < 0)
830 return Capture(child_frags[0], re->cap());
850 LOG(DFATAL) << "Missing case in Compiler: " << re->op();
859 Regexp* re = *pre;
865 if (re == NULL || depth >= 4)
867 switch (re->op()) {
871 if (re->nsub() > 0) {
872 sub = re->sub()[0]->Incref();
874 Regexp** subcopy = new Regexp*[re->nsub()];
876 for (int i = 1; i < re->nsub(); i++)
877 subcopy[i] = re->sub()[i]->Incref();
878 *pre = Regexp::Concat(subcopy, re->nsub(), re->parse_flags());
880 re->Decref();
887 sub = re->sub()[0]->Incref();
889 *pre = Regexp::Capture(sub, re->parse_flags(), re->cap());
890 re->Decref();
896 *pre = Regexp::LiteralString(NULL, 0, re->parse_flags());
897 re->Decref();
907 Regexp* re = *pre;
913 if (re == NULL || depth >= 4)
915 switch (re->op()) {
919 if (re->nsub() > 0) {
920 sub = re->sub()[re->nsub() - 1]->Incref();
922 Regexp** subcopy = new Regexp*[re->nsub()];
923 subcopy[re->nsub() - 1] = sub; // already have reference
924 for (int i = 0; i < re->nsub() - 1; i++)
925 subcopy[i] = re->sub()[i]->Incref();
926 *pre = Regexp::Concat(subcopy, re->nsub(), re->parse_flags());
928 re->Decref();
935 sub = re->sub()[0]->Incref();
937 *pre = Regexp::Capture(sub, re->parse_flags(), re->cap());
938 re->Decref();
944 *pre = Regexp::LiteralString(NULL, 0, re->parse_flags());
945 re->Decref();
986 // Compiles re, returning program.
991 Prog* Compiler::Compile(Regexp* re, bool reversed, int64 max_mem) {
994 c.Setup(re->parse_flags(), max_mem, RE2::ANCHOR_BOTH /* unused */);
999 Regexp* sre = re->Simplify();
1091 // Compiles RE set to Prog.
1093 Regexp* re) {
1100 Frag all = c.WalkExponential(re, kNullFrag, 2*c.max_inst_);
1101 re->Decref();
1121 // since we're not going to fall back to the NFA.
1135 Regexp* re) {
1136 return Compiler::CompileSet(options, anchor, re);