|
#define | INCOMPATIBLE 1 /* destroys arc */ |
|
#define | SATISFIED 2 /* constraint satisfied */ |
|
#define | COMPATIBLE 3 /* compatible but not satisfied yet */ |
|
#define | REPLACEARC 4 /* replace arc's color with constraint color */ |
|
#define | NEXT() (next(v)) /* advance by one token */ |
|
#define | SEE(t) (v->nexttype == (t)) /* is next token this? */ |
|
#define | EAT(t) (SEE(t) && next(v)) /* if next is this, swallow it */ |
|
#define | VISERR(vv) ((vv)->err != 0) /* have we seen an error yet? */ |
|
#define | ISERR() VISERR(v) |
|
#define | VERR(vv, e) |
|
#define | ERR(e) VERR(v, e) /* record an error */ |
|
#define | NOERR() {if (ISERR()) return;} /* if error seen, return */ |
|
#define | NOERRN() {if (ISERR()) return NULL;} /* NOERR with retval */ |
|
#define | NOERRZ() {if (ISERR()) return 0;} /* NOERR with retval */ |
|
#define | INSIST(c, e) do { if (!(c)) ERR(e); } while (0) /* error if c false */ |
|
#define | NOTE(b) (v->re->re_info |= (b)) /* note visible condition */ |
|
#define | EMPTYARC(x, y) newarc(v->nfa, EMPTY, 0, x, y) |
|
#define | EMPTY 'n' /* no token present */ |
|
#define | EOS 'e' /* end of string */ |
|
#define | PLAIN 'p' /* ordinary character */ |
|
#define | DIGIT 'd' /* digit (in bound) */ |
|
#define | BACKREF 'b' /* back reference */ |
|
#define | COLLEL 'I' /* start of [. */ |
|
#define | ECLASS 'E' /* start of [= */ |
|
#define | CCLASS 'C' /* start of [: */ |
|
#define | END 'X' /* end of [. [= [: */ |
|
#define | CCLASSS 's' /* char class shorthand escape */ |
|
#define | CCLASSC 'c' /* complement char class shorthand escape */ |
|
#define | RANGE 'R' /* - within [] which might be range delim. */ |
|
#define | LACON 'L' /* lookaround constraint subRE */ |
|
#define | AHEAD 'a' /* color-lookahead arc */ |
|
#define | BEHIND 'r' /* color-lookbehind arc */ |
|
#define | WBDRY 'w' /* word boundary constraint */ |
|
#define | NWBDRY 'W' /* non-word-boundary constraint */ |
|
#define | SBEGIN 'A' /* beginning of string (even if not BOL) */ |
|
#define | SEND 'Z' /* end of string (even if not EOL) */ |
|
#define | COLORED(a) |
|
#define | CNOERR() { if (ISERR()) return freev(v, v->err); } |
|
#define | ARCV(t, val) newarc(v->nfa, t, val, lp, rp) |
|
#define | SOME 2 |
|
#define | INF 3 |
|
#define | PAIR(x, y) ((x)*4 + (y)) |
|
#define | REDUCE(x) ( ((x) == DUPINF) ? INF : (((x) > 1) ? SOME : (x)) ) |
|
|
static void | moresubs (struct vars *, int) |
|
static int | freev (struct vars *, int) |
|
static void | makesearch (struct vars *, struct nfa *) |
|
static struct subre * | parse (struct vars *, int, int, struct state *, struct state *) |
|
static struct subre * | parsebranch (struct vars *, int, int, struct state *, struct state *, int) |
|
static struct subre * | parseqatom (struct vars *, int, int, struct state *, struct state *, struct subre *) |
|
static void | nonword (struct vars *, int, struct state *, struct state *) |
|
static void | word (struct vars *, int, struct state *, struct state *) |
|
static void | charclass (struct vars *, enum char_classes, struct state *, struct state *) |
|
static void | charclasscomplement (struct vars *, enum char_classes, struct state *, struct state *) |
|
static int | scannum (struct vars *) |
|
static void | repeat (struct vars *, struct state *, struct state *, int, int) |
|
static void | bracket (struct vars *, struct state *, struct state *) |
|
static void | cbracket (struct vars *, struct state *, struct state *) |
|
static void | brackpart (struct vars *, struct state *, struct state *, bool *) |
|
static const chr * | scanplain (struct vars *) |
|
static void | onechr (struct vars *, chr, struct state *, struct state *) |
|
static void | optimizebracket (struct vars *, struct state *, struct state *) |
|
static void | wordchrs (struct vars *) |
|
static void | processlacon (struct vars *, struct state *, struct state *, int, struct state *, struct state *) |
|
static struct subre * | subre (struct vars *, int, int, struct state *, struct state *) |
|
static void | freesubre (struct vars *, struct subre *) |
|
static void | freesubreandsiblings (struct vars *, struct subre *) |
|
static void | freesrnode (struct vars *, struct subre *) |
|
static void | removecaptures (struct vars *, struct subre *) |
|
static int | numst (struct subre *, int) |
|
static void | markst (struct subre *) |
|
static void | cleanst (struct vars *) |
|
static long | nfatree (struct vars *, struct subre *, FILE *) |
|
static long | nfanode (struct vars *, struct subre *, int, FILE *) |
|
static int | newlacon (struct vars *, struct state *, struct state *, int) |
|
static void | freelacons (struct subre *, int) |
|
static void | rfree (regex_t *) |
|
static int | rcancelrequested (void) |
|
static int | rstacktoodeep (void) |
|
static void | lexstart (struct vars *) |
|
static void | prefixes (struct vars *) |
|
static int | next (struct vars *) |
|
static int | lexescape (struct vars *) |
|
static chr | lexdigits (struct vars *, int, int, int) |
|
static int | brenext (struct vars *, chr) |
|
static void | skip (struct vars *) |
|
static chr | newline (void) |
|
static chr | chrnamed (struct vars *, const chr *, const chr *, chr) |
|
static void | initcm (struct vars *, struct colormap *) |
|
static void | freecm (struct colormap *) |
|
static color | maxcolor (struct colormap *) |
|
static color | newcolor (struct colormap *) |
|
static void | freecolor (struct colormap *, color) |
|
static color | pseudocolor (struct colormap *) |
|
static color | subcolor (struct colormap *, chr) |
|
static color | subcolorhi (struct colormap *, color *) |
|
static color | newsub (struct colormap *, color) |
|
static int | newhicolorrow (struct colormap *, int) |
|
static void | newhicolorcols (struct colormap *) |
|
static void | subcolorcvec (struct vars *, struct cvec *, struct state *, struct state *) |
|
static void | subcoloronechr (struct vars *, chr, struct state *, struct state *, color *) |
|
static void | subcoloronerange (struct vars *, chr, chr, struct state *, struct state *, color *) |
|
static void | subcoloronerow (struct vars *, int, struct state *, struct state *, color *) |
|
static void | okcolors (struct nfa *, struct colormap *) |
|
static void | colorchain (struct colormap *, struct arc *) |
|
static void | uncolorchain (struct colormap *, struct arc *) |
|
static void | rainbow (struct nfa *, struct colormap *, int, color, struct state *, struct state *) |
|
static void | colorcomplement (struct nfa *, struct colormap *, int, struct state *, struct state *, struct state *) |
|
static struct nfa * | newnfa (struct vars *, struct colormap *, struct nfa *) |
|
static void | freenfa (struct nfa *) |
|
static struct state * | newstate (struct nfa *) |
|
static struct state * | newfstate (struct nfa *, int flag) |
|
static void | dropstate (struct nfa *, struct state *) |
|
static void | freestate (struct nfa *, struct state *) |
|
static void | newarc (struct nfa *, int, color, struct state *, struct state *) |
|
static void | createarc (struct nfa *, int, color, struct state *, struct state *) |
|
static struct arc * | allocarc (struct nfa *) |
|
static void | freearc (struct nfa *, struct arc *) |
|
static void | changearcsource (struct arc *, struct state *) |
|
static void | changearctarget (struct arc *, struct state *) |
|
static int | hasnonemptyout (struct state *) |
|
static struct arc * | findarc (struct state *, int, color) |
|
static void | cparc (struct nfa *, struct arc *, struct state *, struct state *) |
|
static void | sortins (struct nfa *, struct state *) |
|
static int | sortins_cmp (const void *, const void *) |
|
static void | sortouts (struct nfa *, struct state *) |
|
static int | sortouts_cmp (const void *, const void *) |
|
static void | moveins (struct nfa *, struct state *, struct state *) |
|
static void | copyins (struct nfa *, struct state *, struct state *) |
|
static void | mergeins (struct nfa *, struct state *, struct arc **, int) |
|
static void | moveouts (struct nfa *, struct state *, struct state *) |
|
static void | copyouts (struct nfa *, struct state *, struct state *) |
|
static void | cloneouts (struct nfa *, struct state *, struct state *, struct state *, int) |
|
static void | delsub (struct nfa *, struct state *, struct state *) |
|
static void | deltraverse (struct nfa *, struct state *, struct state *) |
|
static void | dupnfa (struct nfa *, struct state *, struct state *, struct state *, struct state *) |
|
static void | duptraverse (struct nfa *, struct state *, struct state *) |
|
static void | removeconstraints (struct nfa *, struct state *, struct state *) |
|
static void | removetraverse (struct nfa *, struct state *) |
|
static void | cleartraverse (struct nfa *, struct state *) |
|
static struct state * | single_color_transition (struct state *, struct state *) |
|
static void | specialcolors (struct nfa *) |
|
static long | optimize (struct nfa *, FILE *) |
|
static void | pullback (struct nfa *, FILE *) |
|
static int | pull (struct nfa *, struct arc *, struct state **) |
|
static void | pushfwd (struct nfa *, FILE *) |
|
static int | push (struct nfa *, struct arc *, struct state **) |
|
static int | combine (struct nfa *nfa, struct arc *con, struct arc *a) |
|
static void | fixempties (struct nfa *, FILE *) |
|
static struct state * | emptyreachable (struct nfa *, struct state *, struct state *, struct arc **) |
|
static int | isconstraintarc (struct arc *) |
|
static int | hasconstraintout (struct state *) |
|
static void | fixconstraintloops (struct nfa *, FILE *) |
|
static int | findconstraintloop (struct nfa *, struct state *) |
|
static void | breakconstraintloop (struct nfa *, struct state *) |
|
static void | clonesuccessorstates (struct nfa *, struct state *, struct state *, struct state *, struct arc *, char *, char *, int) |
|
static void | cleanup (struct nfa *) |
|
static void | markreachable (struct nfa *, struct state *, struct state *, struct state *) |
|
static void | markcanreach (struct nfa *, struct state *, struct state *, struct state *) |
|
static long | analyze (struct nfa *) |
|
static void | checkmatchall (struct nfa *) |
|
static bool | checkmatchall_recurse (struct nfa *, struct state *, bool **) |
|
static bool | check_out_colors_match (struct state *, color, color) |
|
static bool | check_in_colors_match (struct state *, color, color) |
|
static void | compact (struct nfa *, struct cnfa *) |
|
static void | carcsort (struct carc *, size_t) |
|
static int | carc_cmp (const void *, const void *) |
|
static void | freecnfa (struct cnfa *) |
|
static void | dumpnfa (struct nfa *, FILE *) |
|
static struct cvec * | newcvec (int, int) |
|
static struct cvec * | clearcvec (struct cvec *) |
|
static void | addchr (struct cvec *, chr) |
|
static void | addrange (struct cvec *, chr, chr) |
|
static struct cvec * | getcvec (struct vars *, int, int) |
|
static void | freecvec (struct cvec *) |
|
static int | pg_wc_isdigit (pg_wchar c) |
|
static int | pg_wc_isalpha (pg_wchar c) |
|
static int | pg_wc_isalnum (pg_wchar c) |
|
static int | pg_wc_isword (pg_wchar c) |
|
static int | pg_wc_isupper (pg_wchar c) |
|
static int | pg_wc_islower (pg_wchar c) |
|
static int | pg_wc_isgraph (pg_wchar c) |
|
static int | pg_wc_isprint (pg_wchar c) |
|
static int | pg_wc_ispunct (pg_wchar c) |
|
static int | pg_wc_isspace (pg_wchar c) |
|
static pg_wchar | pg_wc_toupper (pg_wchar c) |
|
static pg_wchar | pg_wc_tolower (pg_wchar c) |
|
static chr | element (struct vars *, const chr *, const chr *) |
|
static struct cvec * | range (struct vars *, chr, chr, int) |
|
static int | before (chr, chr) |
|
static struct cvec * | eclass (struct vars *, chr, int) |
|
static enum char_classes | lookupcclass (struct vars *, const chr *, const chr *) |
|
static struct cvec * | cclasscvec (struct vars *, enum char_classes, int) |
|
static int | cclass_column_index (struct colormap *, chr) |
|
static struct cvec * | allcases (struct vars *, chr) |
|
static int | cmp (const chr *, const chr *, size_t) |
|
static int | casecmp (const chr *, const chr *, size_t) |
|
int | pg_regcomp (regex_t *re, const chr *string, size_t len, int flags, Oid collation) |
|
static struct subre * parseqatom |
( |
struct vars * |
v, |
|
|
int |
stopper, |
|
|
int |
type, |
|
|
struct state * |
lp, |
|
|
struct state * |
rp, |
|
|
struct subre * |
top |
|
) |
| |
|
static |
Definition at line 794 of file regcomp.c.
804 #define ARCV(t, val) newarc(v->nfa, t, val, lp, rp)
815 struct subre **atomp;
972 if ((
size_t) subno >= v->
nsubs)
1002 if (atom->
capno == 0)
1006 atom->
capno = subno;
1018 v->
subs[subno] = atom;
1097 if (m == 0 && n == 0)
1104 if (atom != NULL && (atom->
flags &
CAP))
1122 f = top->
flags | qprefer | ((atom != NULL) ? atom->
flags : 0);
1125 if (!(m == 1 && n == 1))
1143 atom =
subre(v,
'=', 0, lp, rp);
1154 if (atom->
begin == lp || atom->
end == rp)
1251 atom->
min = (short) m;
1252 atom->
max = (short) n;
1257 else if (m == 1 && n == 1 &&
1298 t =
subre(v,
'.', f, s, atom->
end);
1370 else if (t->
child->
op ==
'=' &&
static void delsub(struct nfa *, struct state *, struct state *)
static void moresubs(struct vars *, int)
static int scannum(struct vars *)
static void processlacon(struct vars *, struct state *, struct state *, int, struct state *, struct state *)
static void repeat(struct vars *, struct state *, struct state *, int, int)
static struct subre * parse(struct vars *, int, int, struct state *, struct state *)
static void moveouts(struct nfa *, struct state *, struct state *)
static void wordchrs(struct vars *)
static void cbracket(struct vars *, struct state *, struct state *)
static void nonword(struct vars *, int, struct state *, struct state *)
static void removeconstraints(struct nfa *, struct state *, struct state *)
static void word(struct vars *, int, struct state *, struct state *)
References AHEAD, ARCV, assert, subre::backno, BACKR, BACKREF, subre::begin, BEHIND, bracket(), BRUSE, CAP, subre::capno, cbracket(), CCLASSC, CCLASSS, vars::cflags, charclass(), charclasscomplement(), subre::child, vars::cm, COLORLESS, COMBINE, delsub(), DIGIT, DUPINF, dupnfa(), EAT, EMPTYARC, subre::end, EOS, ERR, subre::flags, freesrnode(), freesubre(), freesubreandsiblings(), if(), INSIST, ISERR, LACON, subre::latype, LONGER, subre::max, MESSY, subre::min, MIXED, moresubs(), moveins(), moveouts(), newstate(), NEXT, vars::nexttype, vars::nextvalue, vars::nfa, state::nins, vars::nlcolor, NOERRN, nonword(), NOTE, state::nouts, vars::nsubexp, vars::nsubs, NWBDRY, okcolors(), onechr(), subre::op, parse(), parsebranch(), PLAIN, PREF, processlacon(), rainbow(), REG_ADVANCED, REG_ASSERT, REG_BADBR, REG_BADRPT, REG_EPAREN, REG_ESUBREG, REG_EXTENDED, REG_NLANCH, REG_NLSTOP, REG_UPBOTCH, removeconstraints(), repeat(), s2, SBEGIN, scannum(), SEE, SEND, SHORTER, subre::sibling, subre(), vars::subs, generate_unaccent_rules::type, UP, WBDRY, word(), and wordchrs().
Referenced by parsebranch().
int pg_regcomp |
( |
regex_t * |
re, |
|
|
const chr * |
string, |
|
|
size_t |
len, |
|
|
int |
flags, |
|
|
Oid |
collation |
|
) |
| |
Definition at line 328 of file regcomp.c.
335 struct vars *v = &var;
343 FILE *
debug = (FILE *) NULL;
346 #define CNOERR() { if (ISERR()) return freev(v, v->err); }
350 if (re == NULL ||
string == NULL)
442 fprintf(
debug,
"\n\n\n========= TREE FIXED ==========\n");
static void const char fflush(stdout)
void pg_set_regex_collation(Oid collation)
static void removecaptures(struct vars *, struct subre *)
static void lexstart(struct vars *)
static const struct fns functions
static int freev(struct vars *, int)
static void initcm(struct vars *, struct colormap *)
static int casecmp(const chr *, const chr *, size_t)
static color subcolor(struct colormap *, chr)
static struct cvec * newcvec(int, int)
static int cmp(const chr *, const chr *, size_t)
static void dumpnfa(struct nfa *, FILE *)
#define LATYPE_IS_AHEAD(la)
References assert, casecmp(), vars::cflags, guts::cflags, cleanst(), vars::cm, guts::cmap, cmp(), CNOERR, COLORLESS, compact(), vars::cv, vars::cv2, debug, DISCARD, dumpnfa(), EOS, vars::err, fflush(), nfa::final, subre::flags, fprintf, freev(), functions, GUTSMAGIC, i, guts::info, nfa::init, initcm(), j, vars::lacons, guts::lacons, subre::latype, LATYPE_IS_AHEAD, len, lexstart(), guts::magic, makesearch(), MALLOC, markst(), newcvec(), newline(), newnfa(), vars::nfa, nfanode(), nfatree(), vars::nlacons, guts::nlacons, vars::nlcolor, NOTE, vars::now, guts::nsub, vars::nsubexp, vars::nsubs, vars::ntree, guts::ntree, numst(), okcolors(), optimize(), parse(), pg_set_regex_collation(), PLAIN, vars::re, regex_t::re_collation, regex_t::re_csize, regex_t::re_fns, regex_t::re_guts, regex_t::re_info, regex_t::re_magic, regex_t::re_nsub, REG_ADVANCED, REG_ADVF, REG_DUMP, REG_ESPACE, REG_EXPANDED, REG_EXTENDED, REG_ICASE, REG_INVARG, REG_NEWLINE, REG_NLANCH, REG_NLSTOP, REG_NOSUB, REG_PROGRESS, REG_QUOTE, REG_USHORTEST, REMAGIC, removecaptures(), guts::search, SEE, SHORTER, vars::spaceused, specialcolors(), generate_unaccent_rules::stdout, vars::stop, vars::sub10, subcolor(), vars::subs, vars::tree, guts::tree, vars::treechain, vars::treefree, VS, vars::wordchrs, and ZAPCNFA.
Referenced by NIAddAffix(), parse_ident_line(), RE_compile(), RE_compile_and_cache(), and test_re_compile().