• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:append

2 // Use of this source code is governed by a BSD-style
16 #include "re2/walker-inl.h"
72 switch (re->op()) { in PreVisit()
92 t_->append("(?:"); in PreVisit()
98 t_->append("(?:"); in PreVisit()
103 t_->append("("); in PreVisit()
104 if (re->cap() == 0) in PreVisit()
106 if (re->name()) { in PreVisit()
107 t_->append("?P<"); in PreVisit()
108 t_->append(*re->name()); in PreVisit()
109 t_->append(">"); in PreVisit()
119 t_->append("(?:"); in PreVisit()
131 t->append(1, '\\'); in AppendLiteral()
132 t->append(1, static_cast<char>(r)); in AppendLiteral()
134 r -= 'a' - 'A'; in AppendLiteral()
135 t->append(1, '['); in AppendLiteral()
136 t->append(1, static_cast<char>(r)); in AppendLiteral()
137 t->append(1, static_cast<char>(r) + 'a' - 'A'); in AppendLiteral()
138 t->append(1, ']'); in AppendLiteral()
146 // For regexps with children, append any unary suffixes or ).
150 switch (re->op()) { in PostVisit()
153 // [^0-Runemax] excludes everything. in PostVisit()
154 t_->append("[^\\x00-\\x{10ffff}]"); in PostVisit()
158 // Append (?:) to make empty string visible, in PostVisit()
161 t_->append("(?:)"); in PostVisit()
165 AppendLiteral(t_, re->rune(), in PostVisit()
166 (re->parse_flags() & Regexp::FoldCase) != 0); in PostVisit()
170 for (int i = 0; i < re->nrunes(); i++) in PostVisit()
171 AppendLiteral(t_, re->runes()[i], in PostVisit()
172 (re->parse_flags() & Regexp::FoldCase) != 0); in PostVisit()
174 t_->append(")"); in PostVisit()
179 t_->append(")"); in PostVisit()
185 if ((*t_)[t_->size()-1] == '|') in PostVisit()
186 t_->erase(t_->size()-1); in PostVisit()
190 t_->append(")"); in PostVisit()
194 t_->append("*"); in PostVisit()
195 if (re->parse_flags() & Regexp::NonGreedy) in PostVisit()
196 t_->append("?"); in PostVisit()
198 t_->append(")"); in PostVisit()
202 t_->append("+"); in PostVisit()
203 if (re->parse_flags() & Regexp::NonGreedy) in PostVisit()
204 t_->append("?"); in PostVisit()
206 t_->append(")"); in PostVisit()
210 t_->append("?"); in PostVisit()
211 if (re->parse_flags() & Regexp::NonGreedy) in PostVisit()
212 t_->append("?"); in PostVisit()
214 t_->append(")"); in PostVisit()
218 if (re->max() == -1) in PostVisit()
219 t_->append(StringPrintf("{%d,}", re->min())); in PostVisit()
220 else if (re->min() == re->max()) in PostVisit()
221 t_->append(StringPrintf("{%d}", re->min())); in PostVisit()
223 t_->append(StringPrintf("{%d,%d}", re->min(), re->max())); in PostVisit()
224 if (re->parse_flags() & Regexp::NonGreedy) in PostVisit()
225 t_->append("?"); in PostVisit()
227 t_->append(")"); in PostVisit()
231 t_->append("."); in PostVisit()
235 t_->append("\\C"); in PostVisit()
239 t_->append("^"); in PostVisit()
243 t_->append("$"); in PostVisit()
247 t_->append("(?-m:^)"); in PostVisit()
251 if (re->parse_flags() & Regexp::WasDollar) in PostVisit()
252 t_->append("(?-m:$)"); in PostVisit()
254 t_->append("\\z"); in PostVisit()
258 t_->append("\\b"); in PostVisit()
262 t_->append("\\B"); in PostVisit()
266 if (re->cc()->size() == 0) { in PostVisit()
267 t_->append("[^\\x00-\\x{10ffff}]"); in PostVisit()
270 t_->append("["); in PostVisit()
272 // non-character 0xFFFE. in PostVisit()
273 CharClass* cc = re->cc(); in PostVisit()
274 if (cc->Contains(0xFFFE)) { in PostVisit()
275 cc = cc->Negate(); in PostVisit()
276 t_->append("^"); in PostVisit()
278 for (CharClass::iterator i = cc->begin(); i != cc->end(); ++i) in PostVisit()
279 AppendCCRange(t_, i->lo, i->hi); in PostVisit()
280 if (cc != re->cc()) in PostVisit()
281 cc->Delete(); in PostVisit()
282 t_->append("]"); in PostVisit()
287 t_->append(")"); in PostVisit()
294 t_->append("(?HaveMatch:%d)", re->match_id()); in PostVisit()
298 // If the parent is an alternation, append the | for it. in PostVisit()
300 t_->append("|"); in PostVisit()
308 if (strchr("[]^-\\", r)) in AppendCCChar()
309 t->append("\\"); in AppendCCChar()
310 t->append(1, static_cast<char>(r)); in AppendCCChar()
318 t->append("\\r"); in AppendCCChar()
322 t->append("\\t"); in AppendCCChar()
326 t->append("\\n"); in AppendCCChar()
330 t->append("\\f"); in AppendCCChar()
346 t->append("-"); in AppendCCRange()