Lines Matching refs:Regexp
18 bool Regexp::SimplifyRegexp(const StringPiece& src, ParseFlags flags, in SimplifyRegexp()
21 Regexp* re = Parse(src, flags, status); in SimplifyRegexp()
24 Regexp* sre = re->Simplify(); in SimplifyRegexp()
42 bool Regexp::ComputeSimple() { in ComputeSimple()
43 Regexp** subs; in ComputeSimple()
103 class SimplifyWalker : public Regexp::Walker<Regexp*> {
106 virtual Regexp* PreVisit(Regexp* re, Regexp* parent_arg, bool* stop);
107 virtual Regexp* PostVisit(Regexp* re,
108 Regexp* parent_arg,
109 Regexp* pre_arg,
110 Regexp** child_args, int nchild_args);
111 virtual Regexp* Copy(Regexp* re);
112 virtual Regexp* ShortVisit(Regexp* re, Regexp* parent_arg);
120 static Regexp* Concat2(Regexp* re1, Regexp* re2, Regexp::ParseFlags flags);
125 static Regexp* SimplifyRepeat(Regexp* re, int min, int max,
126 Regexp::ParseFlags parse_flags);
131 static Regexp* SimplifyCharClass(Regexp* re);
145 Regexp* Regexp::Simplify() { in Simplify()
154 Regexp* SimplifyWalker::Copy(Regexp* re) { in Copy()
158 Regexp* SimplifyWalker::ShortVisit(Regexp* re, Regexp* parent_arg) { in ShortVisit()
165 Regexp* SimplifyWalker::PreVisit(Regexp* re, Regexp* parent_arg, bool* stop) { in PreVisit()
173 Regexp* SimplifyWalker::PostVisit(Regexp* re, in PostVisit()
174 Regexp* parent_arg, in PostVisit()
175 Regexp* pre_arg, in PostVisit()
176 Regexp** child_args, in PostVisit()
201 Regexp** subs = re->sub(); in PostVisit()
203 Regexp* sub = subs[i]; in PostVisit()
204 Regexp* newsub = child_args[i]; in PostVisit()
212 Regexp* newsub = child_args[i]; in PostVisit()
218 Regexp* nre = new Regexp(re->op(), re->parse_flags()); in PostVisit()
220 Regexp** nre_subs = nre->sub(); in PostVisit()
228 Regexp* newsub = child_args[0]; in PostVisit()
234 Regexp* nre = new Regexp(kRegexpCapture, re->parse_flags()); in PostVisit()
245 Regexp* newsub = child_args[0]; in PostVisit()
263 Regexp* nre = new Regexp(re->op(), re->parse_flags()); in PostVisit()
271 Regexp* newsub = child_args[0]; in PostVisit()
277 Regexp* nre = SimplifyRepeat(newsub, re->min_, re->max_, in PostVisit()
285 Regexp* nre = SimplifyCharClass(re); in PostVisit()
297 Regexp* SimplifyWalker::Concat2(Regexp* re1, Regexp* re2, in Concat2()
298 Regexp::ParseFlags parse_flags) { in Concat2()
299 Regexp* re = new Regexp(kRegexpConcat, parse_flags); in Concat2()
301 Regexp** subs = re->sub(); in Concat2()
313 Regexp* SimplifyWalker::SimplifyRepeat(Regexp* re, int min, int max, in SimplifyRepeat()
314 Regexp::ParseFlags f) { in SimplifyRepeat()
319 return Regexp::Star(re->Incref(), f); in SimplifyRepeat()
323 return Regexp::Plus(re->Incref(), f); in SimplifyRepeat()
326 Regexp* nre = new Regexp(kRegexpConcat, f); in SimplifyRepeat()
329 Regexp** nre_subs = nre->sub(); in SimplifyRepeat()
332 nre_subs[min-1] = Regexp::Plus(re->Incref(), f); in SimplifyRepeat()
338 return new Regexp(kRegexpEmptyMatch, f); in SimplifyRepeat()
349 Regexp* nre = NULL; in SimplifyRepeat()
351 nre = new Regexp(kRegexpConcat, f); in SimplifyRepeat()
353 Regexp** nre_subs = nre->sub(); in SimplifyRepeat()
360 Regexp* suf = Regexp::Quest(re->Incref(), f); in SimplifyRepeat()
362 suf = Regexp::Quest(Concat2(re->Incref(), suf, f), f); in SimplifyRepeat()
373 return new Regexp(kRegexpNoMatch, f); in SimplifyRepeat()
381 Regexp* SimplifyWalker::SimplifyCharClass(Regexp* re) { in SimplifyCharClass()
386 return new Regexp(kRegexpNoMatch, re->parse_flags()); in SimplifyCharClass()
388 return new Regexp(kRegexpAnyChar, re->parse_flags()); in SimplifyCharClass()