Lines Matching refs:re
21 Regexp* re = Parse(src, flags, status); in SimplifyRegexp() local
22 if (re == NULL) in SimplifyRegexp()
24 Regexp* sre = re->Simplify(); in SimplifyRegexp()
25 re->Decref(); in SimplifyRegexp()
106 virtual Regexp* PreVisit(Regexp* re, Regexp* parent_arg, bool* stop);
107 virtual Regexp* PostVisit(Regexp* re,
111 virtual Regexp* Copy(Regexp* re);
112 virtual Regexp* ShortVisit(Regexp* re, Regexp* parent_arg);
125 static Regexp* SimplifyRepeat(Regexp* re, int min, int max,
131 static Regexp* SimplifyCharClass(Regexp* re);
154 Regexp* SimplifyWalker::Copy(Regexp* re) { in Copy() argument
155 return re->Incref(); in Copy()
158 Regexp* SimplifyWalker::ShortVisit(Regexp* re, Regexp* parent_arg) { in ShortVisit() argument
162 return re->Incref(); in ShortVisit()
165 Regexp* SimplifyWalker::PreVisit(Regexp* re, Regexp* parent_arg, bool* stop) { in PreVisit() argument
166 if (re->simple_) { in PreVisit()
168 return re->Incref(); in PreVisit()
173 Regexp* SimplifyWalker::PostVisit(Regexp* re, in PostVisit() argument
178 switch (re->op()) { in PostVisit()
193 re->simple_ = true; in PostVisit()
194 return re->Incref(); in PostVisit()
201 Regexp** subs = re->sub(); in PostVisit()
202 for (int i = 0; i < re->nsub_; i++) { in PostVisit()
211 for (int i = 0; i < re->nsub_; i++) { in PostVisit()
215 re->simple_ = true; in PostVisit()
216 return re->Incref(); in PostVisit()
218 Regexp* nre = new Regexp(re->op(), re->parse_flags()); in PostVisit()
219 nre->AllocSub(re->nsub_); in PostVisit()
221 for (int i = 0; i <re->nsub_; i++) in PostVisit()
229 if (newsub == re->sub()[0]) { in PostVisit()
231 re->simple_ = true; in PostVisit()
232 return re->Incref(); in PostVisit()
234 Regexp* nre = new Regexp(kRegexpCapture, re->parse_flags()); in PostVisit()
237 nre->cap_ = re->cap_; in PostVisit()
252 if (newsub == re->sub()[0]) { in PostVisit()
254 re->simple_ = true; in PostVisit()
255 return re->Incref(); in PostVisit()
259 if (re->op() == newsub->op() && in PostVisit()
260 re->parse_flags() == newsub->parse_flags()) in PostVisit()
263 Regexp* nre = new Regexp(re->op(), re->parse_flags()); in PostVisit()
277 Regexp* nre = SimplifyRepeat(newsub, re->min_, re->max_, in PostVisit()
278 re->parse_flags()); in PostVisit()
285 Regexp* nre = SimplifyCharClass(re); in PostVisit()
291 LOG(ERROR) << "Simplify case not handled: " << re->op(); in PostVisit()
292 return re->Incref(); in PostVisit()
299 Regexp* re = new Regexp(kRegexpConcat, parse_flags); in Concat2() local
300 re->AllocSub(2); in Concat2()
301 Regexp** subs = re->sub(); in Concat2()
304 return re; in Concat2()
313 Regexp* SimplifyWalker::SimplifyRepeat(Regexp* re, int min, int max, in SimplifyRepeat() argument
319 return Regexp::Star(re->Incref(), f); in SimplifyRepeat()
323 return Regexp::Plus(re->Incref(), f); in SimplifyRepeat()
331 nre_subs[i] = re->Incref(); in SimplifyRepeat()
332 nre_subs[min-1] = Regexp::Plus(re->Incref(), f); in SimplifyRepeat()
342 return re->Incref(); in SimplifyRepeat()
355 nre_subs[i] = re->Incref(); in SimplifyRepeat()
360 Regexp* suf = Regexp::Quest(re->Incref(), f); in SimplifyRepeat()
362 suf = Regexp::Quest(Concat2(re->Incref(), suf, f), f); in SimplifyRepeat()
372 LOG(DFATAL) << "Malformed repeat " << re->ToString() << " " << min << " " << max; in SimplifyRepeat()
381 Regexp* SimplifyWalker::SimplifyCharClass(Regexp* re) { in SimplifyCharClass() argument
382 CharClass* cc = re->cc(); in SimplifyCharClass()
386 return new Regexp(kRegexpNoMatch, re->parse_flags()); in SimplifyCharClass()
388 return new Regexp(kRegexpAnyChar, re->parse_flags()); in SimplifyCharClass()
390 return re->Incref(); in SimplifyCharClass()