Lines Matching defs:p
130 Node *p, *p1;
133 p = reparse(s);
134 p1 = op2(CAT, op2(STAR, op2(ALL, NIL, NIL), NIL), p);
194 penter(Node *p) /* set up parent pointers and leaf indices */
196 switch (type(p)) {
198 left(p) = (Node *) poscnt;
199 point[poscnt++] = p;
202 penter(left(p));
203 parent(left(p)) = p;
207 penter(left(p));
208 penter(right(p));
209 parent(left(p)) = p;
210 parent(right(p)) = p;
213 ERROR "unknown type %d in penter", type(p) FATAL;
219 freetr(Node *p) /* free parse tree */
221 switch (type(p)) {
223 xfree(p);
226 freetr(left(p));
227 xfree(p);
231 freetr(left(p));
232 freetr(right(p));
233 xfree(p);
236 ERROR "unknown type %d in freetr", type(p) FATAL;
242 cclenter(uchar *p)
249 op = p;
251 while ((c = *p++) != 0) {
253 if ((c = *p++) == 't')
267 if (isdigit(*p)) {
268 n = 8 * n + *p++ - '0';
269 if (isdigit(*p))
270 n = 8 * n + *p++ - '0';
276 if (*p != 0) {
278 while ((uchar)c < *p) { /* fails if *p is \\ */
282 p++;
308 register int *p;
318 if ((p = (int *)calloc(1, (setcnt+1) * sizeof (int))) == NULL)
320 f->re[(int)left(v)].lfollow = p;
321 *p = setcnt;
324 *++p = i;
341 * collects initially active leaves of p into setvec
342 * returns 0 or 1 depending on whether p matches empty string
345 first(Node *p)
349 switch (type(p)) {
351 if (setvec[(int)left(p)] != 1) {
352 setvec[(int)left(p)] = 1;
355 if (type(p) == CCL && (*(uchar *)right(p)) == '\0')
360 if (first(left(p)) == 0)
365 (void) first(left(p));
368 if (first(left(p)) == 0 && first(right(p)) == 0)
372 b = first(right(p));
373 if (first(left(p)) == 0 || b == 0)
377 ERROR "unknown type %d in first", type(p) FATAL;
385 Node *p;
389 p = parent(v);
390 switch (type(p)) {
394 follow(p);
399 follow(p);
403 if (v == left(p)) { /* v is left child of p */
404 if (first(right(p)) == 0) {
405 follow(p);
409 follow(p);
412 ERROR "unknown type %d in follow", type(p) FATAL;
428 match(fa *f, uchar *p)
436 if ((ns = f->gototab[s][*p]) != 0)
439 s = cgoto(f, s, *p);
442 } while (*p++ != 0);
447 pmatch(fa *f, uchar *p)
458 patbeg = p;
461 q = p;
464 patlen = q-p;
471 patbeg = p;
478 patlen = q - p - 1; /* don't count $ */
480 patbeg = p;
500 } while (*p++ != 0);
505 nematch(fa *f, uchar *p)
517 while (*p) {
518 q = p;
521 patlen = q-p;
528 patbeg = p;
535 patlen = q - p - 1; /* don't count $ */
537 patbeg = p;
557 p++;
566 reparse(uchar *p)
568 /* parses regular expression pointed to by p */
572 dprintf(("reparse <%s>\n", p));
573 lastre = prestr = p; /* prestr points to string to be parsed */
777 register int *p, *q;
783 p = f->posns[s];
784 for (i = 1; i <= *p; i++) {
785 if ((k = f->re[p[i]].ltype) != FINAL) {
786 if (k == CHAR && c == f->re[p[i]].lval ||
790 member(c, (uchar *)f->re[p[i]].lval) ||
792 !member(c, (uchar *)f->re[p[i]].lval) &&
794 q = f->re[p[i]].lfollow;
813 p = f->posns[i];
814 if ((k = tmpset[0]) != p[0])
817 if (tmpset[j] != p[j])
836 if ((p = (int *)calloc(1, (setcnt + 1) * sizeof (int))) == NULL)
839 f->posns[f->curstat] = p;
842 p[i] = tmpset[i];