#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include <stdlib.h>
#include "regex.h"
#include "utils.h"
#include "regex2.h"
#include "cclass.h"
#include "cname.h"
Go to the source code of this file.
Data Structures | |
struct | parse |
Defines | |
#define | NPAREN 10 |
#define | PEEK() (*p->next) |
#define | PEEK2() (*(p->next+1)) |
#define | MORE() (p->next < p->end) |
#define | MORE2() (p->next+1 < p->end) |
#define | SEE(c) (MORE() && PEEK() == (c)) |
#define | SEETWO(a, b) (MORE() && MORE2() && PEEK() == (a) && PEEK2() == (b)) |
#define | EAT(c) ((SEE(c)) ? (NEXT(), 1) : 0) |
#define | EATTWO(a, b) ((SEETWO(a, b)) ? (NEXT2(), 1) : 0) |
#define | NEXT() (p->next++) |
#define | NEXT2() (p->next += 2) |
#define | NEXTn(n) (p->next += (n)) |
#define | GETNEXT() (*p->next++) |
#define | SETERROR(e) seterr(p, (e)) |
#define | REQUIRE(co, e) ((co) || SETERROR(e)) |
#define | MUSTSEE(c, e) (REQUIRE(MORE() && PEEK() == (c), e)) |
#define | MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e)) |
#define | MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e)) |
#define | EMIT(op, sopnd) doemit(p, (sop)(op), (size_t)(sopnd)) |
#define | INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos) |
#define | AHEAD(pos) dofwd(p, pos, HERE()-(pos)) |
#define | ASTERN(sop, pos) EMIT(sop, HERE()-pos) |
#define | HERE() (p->slen) |
#define | THERE() (p->slen - 1) |
#define | THERETHERE() (p->slen - 2) |
#define | DROP(n) (p->slen -= (n)) |
#define | never 0 |
#define | GOODFLAGS(f) ((f)&~REG_DUMP) |
#define | BACKSL (1<<CHAR_BIT) |
#define | N 2 |
#define | INF 3 |
#define | REP(f, t) ((f)*8 + (t)) |
#define | MAP(n) (((n) <= 1) ? (n) : ((n) == INFINITY) ? INF : N) |
Functions | |
static void p_ere | __P ((struct parse *p, int stop)) |
static void p_ere_exp | __P ((struct parse *p)) |
static void p_bre | __P ((struct parse *p, int end1, int end2)) |
static int p_simp_re | __P ((struct parse *p, int starordinary)) |
static void p_b_term | __P ((struct parse *p, cset *cs)) |
static char p_b_coll_elem | __P ((struct parse *p, int endc)) |
static char othercase | __P ((int ch)) |
static void bothcases | __P ((struct parse *p, int ch)) |
static void repeat | __P ((struct parse *p, sopno start, int from, int to)) |
static int seterr | __P ((struct parse *p, int e)) |
static void mcadd | __P ((struct parse *p, cset *cs, char *cp)) |
static void mcsub | __P ((cset *cs, char *cp)) |
static int isinsets | __P ((struct re_guts *g, int c)) |
static int samesets | __P ((struct re_guts *g, int c1, int c2)) |
static void categorize | __P ((struct parse *p, struct re_guts *g)) |
static sopno dupl | __P ((struct parse *p, sopno start, sopno finish)) |
static void doemit | __P ((struct parse *p, sop op, size_t opnd)) |
static void doinsert | __P ((struct parse *p, sop op, size_t opnd, sopno pos)) |
static void dofwd | __P ((struct parse *p, sopno pos, sop value)) |
static void enlarge | __P ((struct parse *p, sopno size)) |
int __stdcall | regcomp (regex_t *preg, const char *pattern, int cflags) |
static void | p_ere (struct parse *p, int stop) |
static void | p_ere_exp (struct parse *p) |
static void | p_str (struct parse *p) |
static void | p_bre (struct parse *p, int end1, int end2) |
static int | p_simp_re (struct parse *p, int starordinary) |
static int | p_count (struct parse *p) |
static void | p_bracket (struct parse *p) |
static void | p_b_term (struct parse *p, cset *cs) |
static void | p_b_cclass (struct parse *p, cset *cs) |
static void | p_b_eclass (struct parse *p, cset *cs) |
static char | p_b_symbol (struct parse *p) |
static char | p_b_coll_elem (struct parse *p, int endc) |
static char | othercase (int ch) |
static void | bothcases (struct parse *p, int ch) |
static void | ordinary (struct parse *p, int ch) |
static void | nonnewline (struct parse *p) |
static void | repeat (struct parse *p, sopno start, int from, int to) |
static int | seterr (struct parse *p, int e) |
static cset * | allocset (struct parse *p) |
static void | freeset (struct parse *p, cset *cs) |
static int | freezeset (struct parse *p, cset *cs) |
static int | firstch (struct parse *p, cset *cs) |
static int | nch (struct parse *p, cset *cs) |
static void | mcadd (struct parse *p, cset *cs, char *cp) |
static void | mcsub (cset *cs, char *cp) |
static int | mcin (cset *cs, char *cp) |
static char * | mcfind (cset *cs, char *cp) |
static void | mcinvert (struct parse *p, cset *cs) |
static void | mccase (struct parse *p, cset *cs) |
static int | isinsets (struct re_guts *g, int c) |
static int | samesets (struct re_guts *g, int c1, int c2) |
static void | categorize (struct parse *p, struct re_guts *g) |
static sopno | dupl (struct parse *p, sopno start, sopno finish) |
static void | doemit (struct parse *p, sop op, size_t opnd) |
static void | doinsert (struct parse *p, sop op, size_t opnd, sopno pos) |
static void | dofwd (struct parse *p, sopno pos, sop value) |
static void | enlarge (struct parse *p, sopno size) |
static void | stripsnug (struct parse *p, struct re_guts *g) |
static void | findmust (struct parse *p, struct re_guts *g) |
static sopno | pluscount (struct parse *p, struct re_guts *g) |
Variables | |
static char | nuls [10] |
|
Definition at line 153 of file regcomp.c. Referenced by p_ere(), p_ere_exp(), and repeat(). |
|
Definition at line 154 of file regcomp.c. Referenced by p_ere(), p_ere_exp(), p_simp_re(), and repeat(). |
|
Referenced by p_simp_re(). |
|
|
|
Definition at line 140 of file regcomp.c. Referenced by p_b_term(), p_bracket(), p_bre(), p_ere(), p_ere_exp(), and p_simp_re(). |
|
Definition at line 141 of file regcomp.c. Referenced by p_b_symbol(), p_b_term(), and p_simp_re(). |
|
Definition at line 151 of file regcomp.c. Referenced by doinsert(), isapi_report(), ordinary(), p_bracket(), p_bre(), p_ere(), p_ere_exp(), p_simp_re(), and repeat(). |
|
Definition at line 145 of file regcomp.c. Referenced by p_b_symbol(), p_count(), p_ere_exp(), p_simp_re(), and p_str(). |
|
|
|
Definition at line 155 of file regcomp.c. Referenced by doinsert(), dupl(), p_bre(), p_ere(), p_ere_exp(), p_simp_re(), and repeat(). |
|
Referenced by repeat(). |
|
Definition at line 152 of file regcomp.c. Referenced by p_ere(), p_ere_exp(), p_simp_re(), and repeat(). |
|
Referenced by repeat(). |
|
Definition at line 136 of file regcomp.c. Referenced by p_b_cclass(), p_b_coll_elem(), p_b_symbol(), p_b_term(), p_bracket(), p_bre(), p_count(), p_ere(), p_ere_exp(), p_simp_re(), and p_str(). |
|
Definition at line 137 of file regcomp.c. Referenced by p_b_term(), and p_ere_exp(). |
|
Definition at line 149 of file regcomp.c. Referenced by p_bracket(), and p_ere_exp(). |
|
|
|
|
|
Referenced by repeat(). |
|
Definition at line 163 of file regcomp.c. Referenced by firstch(). |
|
Definition at line 142 of file regcomp.c. Referenced by p_b_cclass(), p_b_coll_elem(), p_b_term(), p_ere_exp(), and p_simp_re(). |
|
Definition at line 143 of file regcomp.c. Referenced by p_b_term(). |
|
Definition at line 144 of file regcomp.c. Referenced by p_bracket(). |
|
Definition at line 71 of file regcomp.c. Referenced by doinsert(), p_ere_exp(), p_simp_re(), and regcomp(). |
|
Definition at line 134 of file regcomp.c. Referenced by p_b_cclass(), p_b_term(), p_bracket(), p_count(), p_ere(), p_ere_exp(), and p_simp_re(). |
|
Definition at line 135 of file regcomp.c. Referenced by p_b_term(), and p_ere_exp(). |
|
Referenced by repeat(). |
|
Definition at line 147 of file regcomp.c. Referenced by p_b_symbol(), p_b_term(), p_bre(), p_count(), p_ere(), p_ere_exp(), p_simp_re(), and p_str(). |
|
Definition at line 138 of file regcomp.c. Referenced by p_b_term(), and p_ere_exp(). |
|
Definition at line 139 of file regcomp.c. Referenced by p_b_coll_elem(), p_bracket(), p_bre(), and p_simp_re(). |
|
Definition at line 146 of file regcomp.c. Referenced by allocset(), enlarge(), mcadd(), p_b_cclass(), p_b_coll_elem(), p_b_term(), p_ere_exp(), p_simp_re(), repeat(), and stripsnug(). |
|
Definition at line 156 of file regcomp.c. Referenced by p_ere(), p_ere_exp(), and repeat(). |
|
Definition at line 157 of file regcomp.c. Referenced by p_ere_exp(), and repeat(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 1093 of file regcomp.c. References assert, i, if(), memset(), NULL, REG_ESPACE, and SETERROR. Referenced by p_bracket(). |
|
Definition at line 934 of file regcomp.c. References assert, othercase(), and p_bracket(). Referenced by ordinary(). |
|
Definition at line 1402 of file regcomp.c. References for(), isinsets(), and samesets(). |
|
|
|
|
|
|
|
Definition at line 1430 of file regcomp.c. References assert, enlarge(), HERE, len, memcpy(), and ret. Referenced by p_simp_re(), and repeat(). |
|
Definition at line 1542 of file regcomp.c. References NULL, REG_ESPACE, and SETERROR. |
|
Definition at line 1588 of file regcomp.c. References assert, BAD, i, NULL, O_CH, O_QUEST, OCH_, OCHAR, OEND, OLPAREN, OOR2, OP, OPLUS_, OPND, OQUEST_, ORPAREN, and s. |
|
Definition at line 1207 of file regcomp.c. References assert, CHIN, for(), i, and never. Referenced by p_bracket(). |
|
Definition at line 1148 of file regcomp.c. References CHsub, for(), and i. Referenced by freezeset(), and p_bracket(). |
|
Definition at line 1173 of file regcomp.c. References CHIN, for(), freeset(), cset::hash, and i. Referenced by p_bracket(). |
|
Definition at line 1360 of file regcomp.c. References i. Referenced by categorize(). |
|
Definition at line 1246 of file regcomp.c. References NULL, REG_ESPACE, SETERROR, and strcpy(). |
|
Definition at line 1348 of file regcomp.c. Referenced by p_bracket(). |
|
|
|
|
|
Definition at line 1333 of file regcomp.c. Referenced by p_bracket(). |
|
|
|
Definition at line 1226 of file regcomp.c. References CHIN, for(), and i. Referenced by lex_ReadInput(), and p_bracket(). |
|
Definition at line 981 of file regcomp.c. References assert, and p_bracket(). Referenced by p_ere_exp(), and p_simp_re(). |
|
Definition at line 959 of file regcomp.c. References bothcases(), EMIT, OCHAR, othercase(), and REG_ICASE. Referenced by p_bracket(), p_ere_exp(), p_simp_re(), and p_str(). |
|
Definition at line 915 of file regcomp.c. References assert. Referenced by bothcases(), ordinary(), and p_bracket(). |
|
Definition at line 814 of file regcomp.c. References cclasses, if(), len, MORE, cclass::name, NEXT, NULL, PEEK, REG_ECTYPE, and SETERROR. Referenced by p_b_term(). |
|
Definition at line 885 of file regcomp.c. References cnames, cname::code, if(), len, MORE, cname::name, NEXT, NULL, REG_EBRACK, REG_ECOLLATE, SEETWO, and SETERROR. Referenced by p_b_eclass(), and p_b_symbol(). |
|
Definition at line 850 of file regcomp.c. References CHadd, and p_b_coll_elem(). Referenced by p_b_term(). |
|
Definition at line 865 of file regcomp.c. References EATTWO, GETNEXT, MORE, p_b_coll_elem(), REG_EBRACK, REG_ECOLLATE, and REQUIRE. Referenced by p_b_term(). |
|
Definition at line 748 of file regcomp.c. References CHadd, EAT, EATTWO, i, MORE, MORE2, NEXT, NEXT2, p_b_cclass(), p_b_eclass(), p_b_symbol(), PEEK, PEEK2, REG_EBRACK, REG_ECOLLATE, REG_ECTYPE, REG_ERANGE, REQUIRE, SEE, and SETERROR. Referenced by p_bracket(). |
|
Definition at line 673 of file regcomp.c. References allocset(), assert, CHadd, CHIN, CHsub, EAT, EMIT, firstch(), freeset(), freezeset(), i, mccase(), mcinvert(), MORE, cset::multis, MUSTEAT, nch(), NEXTn, NULL, OANYOF, OBOW, OEOW, ordinary(), othercase(), p_b_term(), PEEK, REG_EBRACK, REG_ICASE, REG_NEWLINE, and SEETWO. Referenced by bothcases(), nonnewline(), p_ere_exp(), and p_simp_re(). |
|
Definition at line 499 of file regcomp.c. References DROP, EAT, EMIT, HERE, MORE, OBOL, OEOL, p_simp_re(), REG_EMPTY, REQUIRE, SEETWO, USEBOL, and USEEOL. Referenced by p_simp_re(). |
|
Definition at line 650 of file regcomp.c. References count, DUPMAX, GETNEXT, MORE, PEEK, REG_BADBR, and REQUIRE. Referenced by p_ere_exp(), and p_simp_re(). |
|
Definition at line 283 of file regcomp.c. References AHEAD, ASTERN, EAT, EMIT, HERE, INSERT, MORE, OCH_, OOR1, OOR2, p_ere_exp(), PEEK, REG_EMPTY, REQUIRE, and THERE. Referenced by p_ere_exp(). |
|
Definition at line 329 of file regcomp.c. References AHEAD, assert, ASTERN, count, EAT, EMIT, GETNEXT, HERE, INFINITY, INSERT, MORE, MORE2, MUSTEAT, NEXT, nonnewline(), NPAREN, O_CH, O_PLUS, O_QUEST, OANY, OBOL, OCH_, OEOL, OLPAREN, OOR1, OOR2, OPLUS_, OQUEST_, ordinary(), ORPAREN, p_bracket(), p_count(), p_ere(), PEEK, PEEK2, REG_BADBR, REG_BADRPT, REG_EBRACE, REG_EESCAPE, REG_EMPTY, REG_EPAREN, REG_NEWLINE, repeat(), REQUIRE, SEE, SETERROR, THERE, THERETHERE, USEBOL, and USEEOL. Referenced by p_ere(). |
|
Definition at line 532 of file regcomp.c. References assert, ASTERN, BACKSL, count, dupl(), EAT, EATTWO, EMIT, GETNEXT, HERE, i, INFINITY, INSERT, MORE, NEXT, nonnewline(), NPAREN, O_BACK, O_PLUS, O_QUEST, OANY, OBACK_, OLPAREN, OP, OPLUS_, OQUEST_, ordinary(), ORPAREN, p_bracket(), p_bre(), p_count(), PEEK, REG_BADBR, REG_BADRPT, REG_EBRACE, REG_EESCAPE, REG_EPAREN, REG_ESUBREG, REG_NEWLINE, repeat(), REQUIRE, SEETWO, and SETERROR. Referenced by p_bre(). |
|
Definition at line 478 of file regcomp.c. References GETNEXT, MORE, ordinary(), REG_EMPTY, and REQUIRE. |
|
|
|
Definition at line 179 of file regcomp.c. References free(), parse::g, GOODFLAGS, i, len, NC, NPAREN, NULL, p, REG_ESPACE, REG_EXTENDED, REG_INVARG, REG_NOSPEC, and REG_PEND. Referenced by main(). |
|
Definition at line 1005 of file regcomp.c. References AHEAD, assert, ASTERN, DROP, dupl(), EMIT, HERE, INF, INSERT, MAP, N, O_CH, O_PLUS, OCH_, OOR1, OOR2, OPLUS_, REG_ASSERT, REP, SETERROR, THERE, and THERETHERE. Referenced by p_ere_exp(), and p_simp_re(). |
|
Definition at line 1380 of file regcomp.c. References i. Referenced by categorize(). |
|
Definition at line 1077 of file regcomp.c. References nuls. |
|
Definition at line 1565 of file regcomp.c. References NULL, REG_ESPACE, and SETERROR. |
|
Definition at line 128 of file regcomp.c. Referenced by seterr(). |