#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"Include dependency graph for regcomp.c:

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 (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) |
| int | regcomp (regex_t *preg, const char *pattern, int cflags) |
Variables | |
| static char | nuls [10] |
|
|
|
|
|
Definition at line 158 of file regcomp.c. Referenced by p_ere(), p_ere_exp(), p_simp_re(), and repeat(). |
|
|
Referenced by p_simp_re(). |
|
|
|
|
|
|
|
|
Definition at line 145 of file regcomp.c. Referenced by p_b_symbol(), p_b_term(), and p_simp_re(). |
|
|
Definition at line 155 of file regcomp.c. Referenced by doinsert(), ordinary(), p_bracket(), p_bre(), p_ere(), p_ere_exp(), p_simp_re(), and repeat(). |
|
|
Definition at line 149 of file regcomp.c. Referenced by p_b_symbol(), p_count(), p_ere_exp(), p_simp_re(), and p_str(). |
|
|
|
|
|
Definition at line 159 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 156 of file regcomp.c. Referenced by p_ere(), p_ere_exp(), p_simp_re(), patch_stack(), and repeat(). |
|
|
|
|
|
Definition at line 140 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 141 of file regcomp.c. Referenced by p_b_term(), and p_ere_exp(). |
|
|
Definition at line 153 of file regcomp.c. Referenced by p_bracket(), and p_ere_exp(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 167 of file regcomp.c. Referenced by firstch(). |
|
|
|
|
|
Definition at line 147 of file regcomp.c. Referenced by p_b_term(). |
|
|
Definition at line 148 of file regcomp.c. Referenced by p_bracket(). |
|
|
Definition at line 75 of file regcomp.c. Referenced by doinsert(), p_ere_exp(), p_simp_re(), and regcomp(). |
|
|
Definition at line 138 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 139 of file regcomp.c. Referenced by p_b_term(), and p_ere_exp(). |
|
|
Referenced by ack_emit_instruction(), gnu_emit_instruction(), and repeat(). |
|
|
Definition at line 151 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 142 of file regcomp.c. Referenced by p_b_term(), and p_ere_exp(). |
|
|
Definition at line 143 of file regcomp.c. Referenced by p_b_coll_elem(), p_bracket(), p_bre(), and p_simp_re(). |
|
|
Definition at line 150 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 160 of file regcomp.c. Referenced by p_ere(), p_ere_exp(), and repeat(). |
|
|
Definition at line 161 of file regcomp.c. Referenced by p_ere_exp(), and repeat(). |
|
|
Definition at line 1097 of file regcomp.c. References assert, CHAR_BIT, i, if(), malloc(), memset(), nbytes, NULL, realloc(), REG_ESPACE, and SETERROR. Referenced by p_bracket(). |
|
||||||||||||
|
Definition at line 938 of file regcomp.c. References assert, oldend, othercase(), and p_bracket(). Referenced by ordinary(). |
|
||||||||||||
|
Definition at line 1406 of file regcomp.c. References c, cat(), CHAR_MAX, CHAR_MIN, isinsets(), and samesets(). |
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||||||
|
|
|
||||||||||||||||
|
Definition at line 1434 of file regcomp.c. References assert, enlarge(), HERE, and memcpy(). Referenced by p_simp_re(), and repeat(). |
|
||||||||||||
|
Definition at line 1546 of file regcomp.c. References NULL, realloc(), REG_ESPACE, SETERROR, and sp. |
|
||||||||||||
|
Definition at line 1592 of file regcomp.c. References assert, BAD, cp, i, malloc(), NULL, O_CH, O_QUEST, OCH_, OCHAR, OEND, OLPAREN, OOR2, OP, OPLUS_, OPND, OQUEST_, ORPAREN, s, and start. |
|
||||||||||||
|
Definition at line 1211 of file regcomp.c. References assert, CHIN, i, and never. Referenced by getnak(), p_bracket(), wcgetsec(), wcputsec(), and wctx(). |
|
||||||||||||
|
Definition at line 1152 of file regcomp.c. Referenced by freezeset(), and p_bracket(). |
|
||||||||||||
|
Definition at line 1177 of file regcomp.c. References CHIN, freeset(), cset::hash, i, and top. Referenced by p_bracket(). |
|
||||||||||||
|
Definition at line 1364 of file regcomp.c. References CHAR_BIT, col(), i, and ncols. Referenced by categorize(). |
|
||||||||||||||||
|
Definition at line 1250 of file regcomp.c. References malloc(), NULL, oldend, realloc(), REG_ESPACE, SETERROR, strcpy(), and strlen(). |
|
||||||||||||
|
Definition at line 1352 of file regcomp.c. Referenced by p_bracket(). |
|
||||||||||||
|
Definition at line 1315 of file regcomp.c. |
|
||||||||||||
|
|
|
||||||||||||
|
Definition at line 1337 of file regcomp.c. Referenced by p_bracket(). |
|
||||||||||||
|
Definition at line 1276 of file regcomp.c. References assert, fp, free, mcfind(), memmove(), NULL, realloc(), and strlen(). |
|
||||||||||||
|
Definition at line 1230 of file regcomp.c. Referenced by p_bracket(). |
|
|
Definition at line 985 of file regcomp.c. References assert, oldend, and p_bracket(). Referenced by p_ere_exp(), and p_simp_re(). |
|
||||||||||||
|
Definition at line 963 of file regcomp.c. References bothcases(), cap(), EMIT, isalpha, OCHAR, othercase(), and REG_ICASE. Referenced by p_bracket(), p_ere_exp(), p_simp_re(), and p_str(). |
|
|
Definition at line 919 of file regcomp.c. References assert, isalpha, islower, isupper, tolower, and toupper. Referenced by bothcases(), ordinary(), and p_bracket(). |
|
||||||||||||
|
Definition at line 818 of file regcomp.c. References c, cclasses, cp, if(), isalpha, MORE, NEXT, NULL, PEEK, REG_ECTYPE, SETERROR, sp, and strncmp(). Referenced by p_b_term(). |
|
||||||||||||
|
Definition at line 889 of file regcomp.c. References c, cnames, cp, if(), MORE, NEXT, NULL, REG_EBRACK, REG_ECOLLATE, SEETWO, SETERROR, sp, and strncmp(). Referenced by p_b_eclass(), and p_b_symbol(). |
|
||||||||||||
|
Definition at line 854 of file regcomp.c. References c, CHadd, and p_b_coll_elem(). Referenced by p_b_term(). |
|
|
Definition at line 869 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 752 of file regcomp.c. References c, 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, SETERROR, and start. Referenced by p_bracket(). |
|
|
Definition at line 677 of file regcomp.c. References allocset(), assert, c, CHadd, CHIN, CHsub, EAT, EMIT, firstch(), freeset(), freezeset(), i, isalpha, mccase(), mcinvert(), MORE, cset::multis, MUSTEAT, nch(), NEXTn, NULL, OANYOF, OBOW, OEOW, ordinary(), othercase(), p_b_term(), PEEK, REG_EBRACK, REG_ICASE, REG_NEWLINE, SEETWO, and strncmp(). Referenced by bothcases(), nonnewline(), p_ere_exp(), and p_simp_re(). |
|
||||||||||||||||
|
Definition at line 503 of file regcomp.c. References DROP, EAT, EMIT, first, HERE, MORE, OBOL, OEOL, p_simp_re(), REG_EMPTY, REQUIRE, SEETWO, start, USEBOL, and USEEOL. Referenced by p_simp_re(). |
|
|
Definition at line 654 of file regcomp.c. References count, DUPMAX, GETNEXT, isdigit, MORE, PEEK, REG_BADBR, and REQUIRE. Referenced by p_ere_exp(), and p_simp_re(). |
|
||||||||||||
|
Definition at line 287 of file regcomp.c. References AHEAD, ASTERN, c, EAT, EMIT, first, HERE, INSERT, MORE, OCH_, OOR1, OOR2, p_ere_exp(), PEEK, REG_EMPTY, REQUIRE, and THERE. Referenced by p_ere_exp(). |
|
|
Definition at line 333 of file regcomp.c. References AHEAD, assert, ASTERN, c, count, EAT, EMIT, GETNEXT, HERE, INFINITY, INSERT, isdigit, 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, pos, 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 536 of file regcomp.c. References assert, ASTERN, BACKSL, c, count, dupl(), EAT, EATTWO, EMIT, g, GETNEXT, HERE, i, INFINITY, INSERT, isdigit, 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, pos, 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 482 of file regcomp.c. References GETNEXT, MORE, ordinary(), REG_EMPTY, and REQUIRE. |
|
||||||||||||
|
|
|
||||||||||||||||
|
Definition at line 183 of file regcomp.c. References free, g, GOODFLAGS, i, malloc(), NC, NPAREN, NULL, p, REG_ESPACE, REG_EXTENDED, REG_INVARG, REG_NOSPEC, REG_PEND, and strlen(). |
|
||||||||||||||||||||
|
Definition at line 1009 of file regcomp.c. References AHEAD, assert, ASTERN, copy, 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 1384 of file regcomp.c. References CHAR_BIT, col(), i, and ncols. Referenced by categorize(). |
|
||||||||||||
|
Definition at line 1081 of file regcomp.c. References nuls. |
|
||||||||||||
|
Definition at line 1569 of file regcomp.c. References NULL, realloc(), REG_ESPACE, and SETERROR. |
|
|
Definition at line 132 of file regcomp.c. Referenced by seterr(). |
1.4.6