Lines Matching defs:pat
117 if (ptr->pat == NULL || ptr->pat->rep != NULL) {
122 if (!(ret = orec_pat_cse_can(inf, ptr->pat))) {
131 else if (ptr->pat->next == NULL) {
132 if (ptr->pat->type != Rep_String) {
133 if (ptr->pat->type != Rep_Literal) {
135 if (ptr->pat->type != Rep_CaseString) {
136 if (ptr->pat->type != Rep_CaseLiteral)
141 else if (strlen((char*)ptr->pat->data.str) >= 255)
147 else if (strlen((char*)ptr->pat->data.str) >= 255)
162 if (orec_pat_cse(inf, ptr->pat))
170 else if (alt == inf->alt && alt->pat && alt->pat->rep == NULL) {
172 switch (alt->pat->type) {
176 alt->pat->type = Rep_SearchLiteral;
179 alt->pat->type = Rep_SearchCaseLiteral;
182 alt->pat->type = Rep_SearchString;
185 alt->pat->type = Rep_SearchCaseString;
193 orec_pat(inf, alt->pat);
202 orec_pat(orec_inf *inf, rec_pat *pat)
206 while (pat) {
207 switch (pat->type) {
209 if (pat->next == NULL) {
223 pat->type = Rep_AnyEatAnyTimes;
236 else if (orec_pat_bad_rpt(inf, pat->next))
240 if (pat->next == NULL) {
252 pat->type = Rep_AnyEatMaybe;
265 else if (orec_pat_bad_rpt(inf, pat->next))
269 if (pat->next == NULL) {
281 pat->type = Rep_AnyEatAtLeast;
294 else if (orec_pat_bad_rpt(inf, pat->next))
299 orec_pat_rng(inf, pat);
302 orec_grp(inf, pat->data.grp);
307 pat = pat->next;
314 orec_pat_bad_rpt(orec_inf *inf, rec_pat *pat)
316 switch (pat->type) {
341 if (pat->rep == NULL) {
342 if (pat->data.grp->alt) {
343 for (pat = pat->data.grp->alt->pat; pat; pat = pat->next) {
344 if (orec_pat_bad_rpt(inf, pat))
352 if (pat->rep)
357 if (!inf->ecode && pat && pat->next)
358 orec_pat_bad_forward_rpt(inf, pat->next);
364 orec_pat_bad_forward_rpt(orec_inf *inf, rec_pat *pat)
366 if (pat->rep) {
367 switch (pat->rep->type) {
369 if (pat->rep->mine > 0)
379 else if (pat->type == Rep_Group &&
380 pat->data.grp->alt &&
381 pat->data.grp->alt->pat)
382 orec_pat_bad_forward_rpt(inf, pat->data.grp->alt->pat);
401 orec_pat_rng(orec_inf *inf, rec_pat *pat)
404 rec_pat_t type = pat->type;
405 unsigned char *range = pat->data.rng->range;
421 free(pat->data.rng);
423 pat->data.chr = j[0];
424 pat->type = type == Rep_Range ? Rep_Literal : Rep_LiteralNot;
427 pat->data.cse.upper = j[0];
428 pat->data.cse.lower = j[1];
429 pat->type = type == Rep_Range ? Rep_CaseLiteral : Rep_CaseLiteralNot;
444 if (type != pat->type) {
445 free(pat->data.rng);
446 pat->type = type;
456 orec_pat_cse(orec_inf *inf, rec_pat *pat)
463 if (pat->next == NULL && pat->type == Rep_CaseString)
469 for (ptr = pat, length = 1; ptr; ptr = ptr->next) {
491 for (ptr = pat, length = 0; ptr; ptr = next) {
522 if (ptr != pat)
527 pat->type = type;
528 pat->data.str = str;
529 pat->next = NULL;
541 orec_pat_cse_can(orec_inf *inf, rec_pat *pat)
545 if (pat == NULL)
548 for (ret = 1; pat; pat = pat->next) {
549 if (pat->rep)
551 switch (pat->type) {
579 rec_pat *pat;
597 if ((pat = calloc(1, sizeof(rec_pat))) == NULL) {
604 pat->data.stl = stl;
605 pat->type = Rep_StringList;
609 switch (ptr->pat->type) {
618 len = strlen((char*)ptr->pat->data.str);
625 stl->strs[i] = ptr->pat->data.str;
628 stl->strs[i] = (void*)(long)(ptr->pat->data.str[0]);
631 (ptr->pat->data.str[0] |
632 ((int)ptr->pat->data.str[1] << 8));
633 free(ptr->pat->data.str);
638 stl->strs[i] = (void*)(long)ptr->pat->data.chr;
641 (ptr->pat->data.cse.lower |
642 (ptr->pat->data.cse.upper << 8));
644 free(ptr->pat);
652 alt->pat = pat;