pike.git / src / modules / Regexp / pike_regexp.c

version» Context lines:

pike.git/src/modules/Regexp/pike_regexp.c:1:   /* -  * $Id: pike_regexp.c,v 1.16 2000/09/02 23:52:23 marcus Exp $ +  * $Id: pike_regexp.c,v 1.17 2000/09/08 16:02:29 grubba Exp $    *    * regexp.c - regular expression matching    *    * DESCRIPTION    *    * Underneath the reformatting and comment blocks which were added to    * make it consistent with the rest of the code, you will find a    * modified version of Henry Specer's regular expression library.    * Henry's functions were modified to provide the minimal regular    * expression matching, as required by P1003. Henry's code was
pike.git/src/modules/Regexp/pike_regexp.c:387:    int flags;       *flagp = HASWIDTH; /* Tentatively. */       /* Make an OPEN node, if parenthesized. */    if (paren) {    if (regnpar >= NSUBEXP)    FAIL("too many ()");    parno = regnpar;    regnpar++; -  ret = regnode(OPEN + parno); +  ret = regnode((char)(OPEN + parno));    } else    ret = (char *)NULL;       /* Pick up the branches, linking them together. */    br = regbranch(&flags);    if (br == (char *)NULL)    return ((char *)NULL);    if (ret != (char *)NULL)    regtail(ret, br); /* OPEN -> first. */    else
pike.git/src/modules/Regexp/pike_regexp.c:414:    br = regbranch(&flags);    if (br == (char *)NULL)    return ((char *)NULL);    regtail(ret, br); /* BRANCH -> BRANCH. */    if (!(flags & HASWIDTH))    *flagp &= ~HASWIDTH;    *flagp |= flags & SPSTART;    }       /* Make a closing node, and hook it on the end. */ -  ender = regnode((paren) ? CLOSE + parno : END); +  ender = regnode((paren) ? (char)(CLOSE + parno) : END);    regtail(ret, ender);       /* Hook the tails of the branches to the closing node. */    for (br = ret; br != (char *)NULL; br = regnext(br))    regoptail(br, ender);       /* Check for proper termination. */    if (paren && *regparse++ != RBRAC) {    FAIL("unmatched ()");    } else if (!paren && *regparse != '\0') {
pike.git/src/modules/Regexp/pike_regexp.c:572:    case LSQBRAC:{    register int class;    register int classend;       if (*regparse == CARET) { /* Complement of range. */    ret = regnode(ANYBUT);    regparse++;    } else    ret = regnode(ANYOF);    if (*regparse == RSQBRAC || *regparse == '-') -  regc(*regparse++); +  regc((char)(*regparse++));    while (*regparse != '\0' && *regparse != RSQBRAC) {    if (*regparse == '-') {    regparse++;    if (*regparse == RSQBRAC || *regparse == '\0')    regc('-');    else {    class = (CHARBITS & *(regparse - 2)) + 1;    classend = (CHARBITS & *(regparse));    if (class > classend + 1)    FAIL("invalid [] range");    for (; class <= classend; class++) -  regc(class); +  regc((char)class);    regparse++;    }    } else -  regc(*regparse++); +  regc((char)(*regparse++));    }    regc('\0');    if (*regparse != RSQBRAC)    FAIL("unmatched []");    regparse++;    *flagp |= HASWIDTH | SIMPLE;    }    break;    case LBRAC:    ret = reg(1, &flags);
pike.git/src/modules/Regexp/pike_regexp.c:630:    FAIL("internal disaster");    }    ender = *(regparse + len);    if (len > 1 && ISMULT(ender))    len--; /* Back off clear of * operand. */    *flagp |= HASWIDTH;    if (len == 1)    *flagp |= SIMPLE;    ret = regnode(EXACTLY);    while (len > 0) { -  regc(*regparse++); +  regc((char)(*regparse++));    len--;    }    regc('\0');    }    break;    }       return (ret);   }