|
|
@ -38,158 +38,200 @@
|
|
|
|
* forward declarations, up here so forward datatypes etc. are defined early
|
|
|
|
* forward declarations, up here so forward datatypes etc. are defined early
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
/* === regcomp.c === */
|
|
|
|
/* === regcomp.c === */
|
|
|
|
static void moresubs(struct vars *, int);
|
|
|
|
static void moresubs(struct vars *v, int wanted);
|
|
|
|
static int freev(struct vars *, int);
|
|
|
|
static int freev(struct vars *v, int err);
|
|
|
|
static void makesearch(struct vars *, struct nfa *);
|
|
|
|
static void makesearch(struct vars *v, struct nfa *nfa);
|
|
|
|
static struct subre *parse(struct vars *, int, int, struct state *, struct state *);
|
|
|
|
static struct subre *parse(struct vars *v, int stopper, int type,
|
|
|
|
static struct subre *parsebranch(struct vars *, int, int, struct state *, struct state *, int);
|
|
|
|
struct state *init, struct state *final);
|
|
|
|
static struct subre *parseqatom(struct vars *, int, int, struct state *, struct state *, struct subre *);
|
|
|
|
static struct subre *parsebranch(struct vars *v, int stopper, int type,
|
|
|
|
static void nonword(struct vars *, int, struct state *, struct state *);
|
|
|
|
struct state *left, struct state *right,
|
|
|
|
static void word(struct vars *, int, struct state *, struct state *);
|
|
|
|
int partial);
|
|
|
|
static void charclass(struct vars *, enum char_classes,
|
|
|
|
static struct subre *parseqatom(struct vars *v, int stopper, int type,
|
|
|
|
struct state *, struct state *);
|
|
|
|
struct state *lp, struct state *rp,
|
|
|
|
static void charclasscomplement(struct vars *, enum char_classes,
|
|
|
|
struct subre *top);
|
|
|
|
struct state *, struct state *);
|
|
|
|
static void nonword(struct vars *v, int dir, struct state *lp,
|
|
|
|
static int scannum(struct vars *);
|
|
|
|
struct state *rp);
|
|
|
|
static void repeat(struct vars *, struct state *, struct state *, int, int);
|
|
|
|
static void word(struct vars *v, int dir, struct state *lp, struct state *rp);
|
|
|
|
static void bracket(struct vars *, struct state *, struct state *);
|
|
|
|
static void charclass(struct vars *v, enum char_classes cls, struct state *lp,
|
|
|
|
static void cbracket(struct vars *, struct state *, struct state *);
|
|
|
|
struct state *rp);
|
|
|
|
static void brackpart(struct vars *, struct state *, struct state *, bool *);
|
|
|
|
static void charclasscomplement(struct vars *v, enum char_classes cls,
|
|
|
|
static const chr *scanplain(struct vars *);
|
|
|
|
struct state *lp, struct state *rp);
|
|
|
|
static void onechr(struct vars *, chr, struct state *, struct state *);
|
|
|
|
static int scannum(struct vars *v);
|
|
|
|
static void optimizebracket(struct vars *, struct state *, struct state *);
|
|
|
|
static void repeat(struct vars *v, struct state *lp, struct state *rp,
|
|
|
|
static void wordchrs(struct vars *);
|
|
|
|
int m, int n);
|
|
|
|
static void processlacon(struct vars *, struct state *, struct state *, int,
|
|
|
|
static void bracket(struct vars *v, struct state *lp, struct state *rp);
|
|
|
|
struct state *, struct state *);
|
|
|
|
static void cbracket(struct vars *v, struct state *lp, struct state *rp);
|
|
|
|
static struct subre *subre(struct vars *, int, int, struct state *, struct state *);
|
|
|
|
static void brackpart(struct vars *v, struct state *lp, struct state *rp,
|
|
|
|
static void freesubre(struct vars *, struct subre *);
|
|
|
|
bool *have_cclassc);
|
|
|
|
static void freesubreandsiblings(struct vars *, struct subre *);
|
|
|
|
static const chr *scanplain(struct vars *v);
|
|
|
|
static void freesrnode(struct vars *, struct subre *);
|
|
|
|
static void onechr(struct vars *v, chr c, struct state *lp, struct state *rp);
|
|
|
|
static void removecaptures(struct vars *, struct subre *);
|
|
|
|
static void optimizebracket(struct vars *v, struct state *lp, struct state *rp);
|
|
|
|
static int numst(struct subre *, int);
|
|
|
|
static void wordchrs(struct vars *v);
|
|
|
|
static void markst(struct subre *);
|
|
|
|
static void processlacon(struct vars *v, struct state *begin,
|
|
|
|
static void cleanst(struct vars *);
|
|
|
|
struct state *end, int latype,
|
|
|
|
static long nfatree(struct vars *, struct subre *, FILE *);
|
|
|
|
struct state *lp, struct state *rp);
|
|
|
|
static long nfanode(struct vars *, struct subre *, int, FILE *);
|
|
|
|
static struct subre *subre(struct vars *v, int op, int flags,
|
|
|
|
static int newlacon(struct vars *, struct state *, struct state *, int);
|
|
|
|
struct state *begin, struct state *end);
|
|
|
|
static void freelacons(struct subre *, int);
|
|
|
|
static void freesubre(struct vars *v, struct subre *sr);
|
|
|
|
static void rfree(regex_t *);
|
|
|
|
static void freesubreandsiblings(struct vars *v, struct subre *sr);
|
|
|
|
|
|
|
|
static void freesrnode(struct vars *v, struct subre *sr);
|
|
|
|
|
|
|
|
static void removecaptures(struct vars *v, struct subre *t);
|
|
|
|
|
|
|
|
static int numst(struct subre *t, int start);
|
|
|
|
|
|
|
|
static void markst(struct subre *t);
|
|
|
|
|
|
|
|
static void cleanst(struct vars *v);
|
|
|
|
|
|
|
|
static long nfatree(struct vars *v, struct subre *t, FILE *f);
|
|
|
|
|
|
|
|
static long nfanode(struct vars *v, struct subre *t,
|
|
|
|
|
|
|
|
int converttosearch, FILE *f);
|
|
|
|
|
|
|
|
static int newlacon(struct vars *v, struct state *begin, struct state *end,
|
|
|
|
|
|
|
|
int latype);
|
|
|
|
|
|
|
|
static void freelacons(struct subre *subs, int n);
|
|
|
|
|
|
|
|
static void rfree(regex_t *re);
|
|
|
|
static int rcancelrequested(void);
|
|
|
|
static int rcancelrequested(void);
|
|
|
|
static int rstacktoodeep(void);
|
|
|
|
static int rstacktoodeep(void);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef REG_DEBUG
|
|
|
|
#ifdef REG_DEBUG
|
|
|
|
static void dump(regex_t *, FILE *);
|
|
|
|
static void dump(regex_t *re, FILE *f);
|
|
|
|
static void dumpst(struct subre *, FILE *, int);
|
|
|
|
static void dumpst(struct subre *t, FILE *f, int nfapresent);
|
|
|
|
static void stdump(struct subre *, FILE *, int);
|
|
|
|
static void stdump(struct subre *t, FILE *f, int nfapresent);
|
|
|
|
static const char *stid(struct subre *, char *, size_t);
|
|
|
|
static const char *stid(struct subre *t, char *buf, size_t bufsize);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/* === regc_lex.c === */
|
|
|
|
/* === regc_lex.c === */
|
|
|
|
static void lexstart(struct vars *);
|
|
|
|
static void lexstart(struct vars *v);
|
|
|
|
static void prefixes(struct vars *);
|
|
|
|
static void prefixes(struct vars *v);
|
|
|
|
static int next(struct vars *);
|
|
|
|
static int next(struct vars *v);
|
|
|
|
static int lexescape(struct vars *);
|
|
|
|
static int lexescape(struct vars *v);
|
|
|
|
static chr lexdigits(struct vars *, int, int, int);
|
|
|
|
static chr lexdigits(struct vars *v, int base, int minlen, int maxlen);
|
|
|
|
static int brenext(struct vars *, chr);
|
|
|
|
static int brenext(struct vars *v, chr c);
|
|
|
|
static void skip(struct vars *);
|
|
|
|
static void skip(struct vars *v);
|
|
|
|
static chr newline(void);
|
|
|
|
static chr newline(void);
|
|
|
|
static chr chrnamed(struct vars *, const chr *, const chr *, chr);
|
|
|
|
static chr chrnamed(struct vars *v, const chr *startp, const chr *endp,
|
|
|
|
|
|
|
|
chr lastresort);
|
|
|
|
|
|
|
|
|
|
|
|
/* === regc_color.c === */
|
|
|
|
/* === regc_color.c === */
|
|
|
|
static void initcm(struct vars *, struct colormap *);
|
|
|
|
static void initcm(struct vars *v, struct colormap *cm);
|
|
|
|
static void freecm(struct colormap *);
|
|
|
|
static void freecm(struct colormap *cm);
|
|
|
|
static color maxcolor(struct colormap *);
|
|
|
|
static color maxcolor(struct colormap *cm);
|
|
|
|
static color newcolor(struct colormap *);
|
|
|
|
static color newcolor(struct colormap *cm);
|
|
|
|
static void freecolor(struct colormap *, color);
|
|
|
|
static void freecolor(struct colormap *cm, color co);
|
|
|
|
static color pseudocolor(struct colormap *);
|
|
|
|
static color pseudocolor(struct colormap *cm);
|
|
|
|
static color subcolor(struct colormap *, chr);
|
|
|
|
static color subcolor(struct colormap *cm, chr c);
|
|
|
|
static color subcolorhi(struct colormap *, color *);
|
|
|
|
static color subcolorhi(struct colormap *cm, color *pco);
|
|
|
|
static color newsub(struct colormap *, color);
|
|
|
|
static color newsub(struct colormap *cm, color co);
|
|
|
|
static int newhicolorrow(struct colormap *, int);
|
|
|
|
static int newhicolorrow(struct colormap *cm, int oldrow);
|
|
|
|
static void newhicolorcols(struct colormap *);
|
|
|
|
static void newhicolorcols(struct colormap *cm);
|
|
|
|
static void subcolorcvec(struct vars *, struct cvec *, struct state *, struct state *);
|
|
|
|
static void subcolorcvec(struct vars *v, struct cvec *cv, struct state *lp,
|
|
|
|
static void subcoloronechr(struct vars *, chr, struct state *, struct state *, color *);
|
|
|
|
struct state *rp);
|
|
|
|
static void subcoloronerange(struct vars *, chr, chr, struct state *, struct state *, color *);
|
|
|
|
static void subcoloronechr(struct vars *v, chr ch, struct state *lp,
|
|
|
|
static void subcoloronerow(struct vars *, int, struct state *, struct state *, color *);
|
|
|
|
struct state *rp, color *lastsubcolor);
|
|
|
|
static void okcolors(struct nfa *, struct colormap *);
|
|
|
|
static void subcoloronerange(struct vars *v, chr from, chr to,
|
|
|
|
static void colorchain(struct colormap *, struct arc *);
|
|
|
|
struct state *lp, struct state *rp,
|
|
|
|
static void uncolorchain(struct colormap *, struct arc *);
|
|
|
|
color *lastsubcolor);
|
|
|
|
static void rainbow(struct nfa *, struct colormap *, int, color, struct state *, struct state *);
|
|
|
|
static void subcoloronerow(struct vars *v, int rownum, struct state *lp,
|
|
|
|
static void colorcomplement(struct nfa *, struct colormap *, int, struct state *, struct state *, struct state *);
|
|
|
|
struct state *rp, color *lastsubcolor);
|
|
|
|
|
|
|
|
static void okcolors(struct nfa *nfa, struct colormap *cm);
|
|
|
|
|
|
|
|
static void colorchain(struct colormap *cm, struct arc *a);
|
|
|
|
|
|
|
|
static void uncolorchain(struct colormap *cm, struct arc *a);
|
|
|
|
|
|
|
|
static void rainbow(struct nfa *nfa, struct colormap *cm, int type, color but,
|
|
|
|
|
|
|
|
struct state *from, struct state *to);
|
|
|
|
|
|
|
|
static void colorcomplement(struct nfa *nfa, struct colormap *cm, int type,
|
|
|
|
|
|
|
|
struct state *of, struct state *from,
|
|
|
|
|
|
|
|
struct state *to);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef REG_DEBUG
|
|
|
|
#ifdef REG_DEBUG
|
|
|
|
static void dumpcolors(struct colormap *, FILE *);
|
|
|
|
static void dumpcolors(struct colormap *cm, FILE *f);
|
|
|
|
static void dumpchr(chr, FILE *);
|
|
|
|
static void dumpchr(chr c, FILE *f);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/* === regc_nfa.c === */
|
|
|
|
/* === regc_nfa.c === */
|
|
|
|
static struct nfa *newnfa(struct vars *, struct colormap *, struct nfa *);
|
|
|
|
static struct nfa *newnfa(struct vars *v, struct colormap *cm,
|
|
|
|
static void freenfa(struct nfa *);
|
|
|
|
struct nfa *parent);
|
|
|
|
static struct state *newstate(struct nfa *);
|
|
|
|
static void freenfa(struct nfa *nfa);
|
|
|
|
static struct state *newfstate(struct nfa *, int flag);
|
|
|
|
static struct state *newstate(struct nfa *nfa);
|
|
|
|
static void dropstate(struct nfa *, struct state *);
|
|
|
|
static struct state *newfstate(struct nfa *nfa, int flag);
|
|
|
|
static void freestate(struct nfa *, struct state *);
|
|
|
|
static void dropstate(struct nfa *nfa, struct state *s);
|
|
|
|
static void newarc(struct nfa *, int, color, struct state *, struct state *);
|
|
|
|
static void freestate(struct nfa *nfa, struct state *s);
|
|
|
|
static void createarc(struct nfa *, int, color, struct state *, struct state *);
|
|
|
|
static void newarc(struct nfa *nfa, int t, color co,
|
|
|
|
static struct arc *allocarc(struct nfa *);
|
|
|
|
struct state *from, struct state *to);
|
|
|
|
static void freearc(struct nfa *, struct arc *);
|
|
|
|
static void createarc(struct nfa *nfa, int t, color co,
|
|
|
|
static void changearcsource(struct arc *, struct state *);
|
|
|
|
struct state *from, struct state *to);
|
|
|
|
static void changearctarget(struct arc *, struct state *);
|
|
|
|
static struct arc *allocarc(struct nfa *nfa);
|
|
|
|
static int hasnonemptyout(struct state *);
|
|
|
|
static void freearc(struct nfa *nfa, struct arc *victim);
|
|
|
|
static struct arc *findarc(struct state *, int, color);
|
|
|
|
static void changearcsource(struct arc *a, struct state *newfrom);
|
|
|
|
static void cparc(struct nfa *, struct arc *, struct state *, struct state *);
|
|
|
|
static void changearctarget(struct arc *a, struct state *newto);
|
|
|
|
static void sortins(struct nfa *, struct state *);
|
|
|
|
static int hasnonemptyout(struct state *s);
|
|
|
|
static int sortins_cmp(const void *, const void *);
|
|
|
|
static struct arc *findarc(struct state *s, int type, color co);
|
|
|
|
static void sortouts(struct nfa *, struct state *);
|
|
|
|
static void cparc(struct nfa *nfa, struct arc *oa,
|
|
|
|
static int sortouts_cmp(const void *, const void *);
|
|
|
|
struct state *from, struct state *to);
|
|
|
|
static void moveins(struct nfa *, struct state *, struct state *);
|
|
|
|
static void sortins(struct nfa *nfa, struct state *s);
|
|
|
|
static void copyins(struct nfa *, struct state *, struct state *);
|
|
|
|
static int sortins_cmp(const void *a, const void *b);
|
|
|
|
static void mergeins(struct nfa *, struct state *, struct arc **, int);
|
|
|
|
static void sortouts(struct nfa *nfa, struct state *s);
|
|
|
|
static void moveouts(struct nfa *, struct state *, struct state *);
|
|
|
|
static int sortouts_cmp(const void *a, const void *b);
|
|
|
|
static void copyouts(struct nfa *, struct state *, struct state *);
|
|
|
|
static void moveins(struct nfa *nfa, struct state *oldState,
|
|
|
|
static void cloneouts(struct nfa *, struct state *, struct state *, struct state *, int);
|
|
|
|
struct state *newState);
|
|
|
|
static void delsub(struct nfa *, struct state *, struct state *);
|
|
|
|
static void copyins(struct nfa *nfa, struct state *oldState,
|
|
|
|
static void deltraverse(struct nfa *, struct state *, struct state *);
|
|
|
|
struct state *newState);
|
|
|
|
static void dupnfa(struct nfa *, struct state *, struct state *, struct state *, struct state *);
|
|
|
|
static void mergeins(struct nfa *nfa, struct state *s,
|
|
|
|
static void duptraverse(struct nfa *, struct state *, struct state *);
|
|
|
|
struct arc **arcarray, int arccount);
|
|
|
|
static void removeconstraints(struct nfa *, struct state *, struct state *);
|
|
|
|
static void moveouts(struct nfa *nfa, struct state *oldState,
|
|
|
|
static void removetraverse(struct nfa *, struct state *);
|
|
|
|
struct state *newState);
|
|
|
|
static void cleartraverse(struct nfa *, struct state *);
|
|
|
|
static void copyouts(struct nfa *nfa, struct state *oldState,
|
|
|
|
static struct state *single_color_transition(struct state *, struct state *);
|
|
|
|
struct state *newState);
|
|
|
|
static void specialcolors(struct nfa *);
|
|
|
|
static void cloneouts(struct nfa *nfa, struct state *old, struct state *from,
|
|
|
|
static long optimize(struct nfa *, FILE *);
|
|
|
|
struct state *to, int type);
|
|
|
|
static void pullback(struct nfa *, FILE *);
|
|
|
|
static void delsub(struct nfa *nfa, struct state *lp, struct state *rp);
|
|
|
|
static int pull(struct nfa *, struct arc *, struct state **);
|
|
|
|
static void deltraverse(struct nfa *nfa, struct state *leftend,
|
|
|
|
static void pushfwd(struct nfa *, FILE *);
|
|
|
|
struct state *s);
|
|
|
|
static int push(struct nfa *, struct arc *, struct state **);
|
|
|
|
static void dupnfa(struct nfa *nfa, struct state *start, struct state *stop,
|
|
|
|
|
|
|
|
struct state *from, struct state *to);
|
|
|
|
|
|
|
|
static void duptraverse(struct nfa *nfa, struct state *s, struct state *stmp);
|
|
|
|
|
|
|
|
static void removeconstraints(struct nfa *nfa, struct state *start, struct state *stop);
|
|
|
|
|
|
|
|
static void removetraverse(struct nfa *nfa, struct state *s);
|
|
|
|
|
|
|
|
static void cleartraverse(struct nfa *nfa, struct state *s);
|
|
|
|
|
|
|
|
static struct state *single_color_transition(struct state *s1,
|
|
|
|
|
|
|
|
struct state *s2);
|
|
|
|
|
|
|
|
static void specialcolors(struct nfa *nfa);
|
|
|
|
|
|
|
|
static long optimize(struct nfa *nfa, FILE *f);
|
|
|
|
|
|
|
|
static void pullback(struct nfa *nfa, FILE *f);
|
|
|
|
|
|
|
|
static int pull(struct nfa *nfa, struct arc *con,
|
|
|
|
|
|
|
|
struct state **intermediates);
|
|
|
|
|
|
|
|
static void pushfwd(struct nfa *nfa, FILE *f);
|
|
|
|
|
|
|
|
static int push(struct nfa *nfa, struct arc *con,
|
|
|
|
|
|
|
|
struct state **intermediates);
|
|
|
|
|
|
|
|
|
|
|
|
#define INCOMPATIBLE 1 /* destroys arc */
|
|
|
|
#define INCOMPATIBLE 1 /* destroys arc */
|
|
|
|
#define SATISFIED 2 /* constraint satisfied */
|
|
|
|
#define SATISFIED 2 /* constraint satisfied */
|
|
|
|
#define COMPATIBLE 3 /* compatible but not satisfied yet */
|
|
|
|
#define COMPATIBLE 3 /* compatible but not satisfied yet */
|
|
|
|
#define REPLACEARC 4 /* replace arc's color with constraint color */
|
|
|
|
#define REPLACEARC 4 /* replace arc's color with constraint color */
|
|
|
|
static int combine(struct nfa *nfa, struct arc *con, struct arc *a);
|
|
|
|
static int combine(struct nfa *nfa, struct arc *con, struct arc *a);
|
|
|
|
static void fixempties(struct nfa *, FILE *);
|
|
|
|
static void fixempties(struct nfa *nfa, FILE *f);
|
|
|
|
static struct state *emptyreachable(struct nfa *, struct state *,
|
|
|
|
static struct state *emptyreachable(struct nfa *nfa, struct state *s,
|
|
|
|
struct state *, struct arc **);
|
|
|
|
struct state *lastfound,
|
|
|
|
static int isconstraintarc(struct arc *);
|
|
|
|
struct arc **inarcsorig);
|
|
|
|
static int hasconstraintout(struct state *);
|
|
|
|
static int isconstraintarc(struct arc *a);
|
|
|
|
static void fixconstraintloops(struct nfa *, FILE *);
|
|
|
|
static int hasconstraintout(struct state *s);
|
|
|
|
static int findconstraintloop(struct nfa *, struct state *);
|
|
|
|
static void fixconstraintloops(struct nfa *nfa, FILE *f);
|
|
|
|
static void breakconstraintloop(struct nfa *, struct state *);
|
|
|
|
static int findconstraintloop(struct nfa *nfa, struct state *s);
|
|
|
|
static void clonesuccessorstates(struct nfa *, struct state *, struct state *,
|
|
|
|
static void breakconstraintloop(struct nfa *nfa, struct state *sinitial);
|
|
|
|
struct state *, struct arc *,
|
|
|
|
static void clonesuccessorstates(struct nfa *nfa, struct state *ssource,
|
|
|
|
char *, char *, int);
|
|
|
|
struct state *sclone,
|
|
|
|
static void cleanup(struct nfa *);
|
|
|
|
struct state *spredecessor,
|
|
|
|
static void markreachable(struct nfa *, struct state *, struct state *, struct state *);
|
|
|
|
struct arc *refarc, char *curdonemap,
|
|
|
|
static void markcanreach(struct nfa *, struct state *, struct state *, struct state *);
|
|
|
|
char *outerdonemap, int nstates);
|
|
|
|
static long analyze(struct nfa *);
|
|
|
|
static void cleanup(struct nfa *nfa);
|
|
|
|
static void checkmatchall(struct nfa *);
|
|
|
|
static void markreachable(struct nfa *nfa, struct state *s,
|
|
|
|
static bool checkmatchall_recurse(struct nfa *, struct state *, bool **);
|
|
|
|
struct state *okay, struct state *mark);
|
|
|
|
static bool check_out_colors_match(struct state *, color, color);
|
|
|
|
static void markcanreach(struct nfa *nfa, struct state *s, struct state *okay,
|
|
|
|
static bool check_in_colors_match(struct state *, color, color);
|
|
|
|
struct state *mark);
|
|
|
|
static void compact(struct nfa *, struct cnfa *);
|
|
|
|
static long analyze(struct nfa *nfa);
|
|
|
|
static void carcsort(struct carc *, size_t);
|
|
|
|
static void checkmatchall(struct nfa *nfa);
|
|
|
|
static int carc_cmp(const void *, const void *);
|
|
|
|
static bool checkmatchall_recurse(struct nfa *nfa, struct state *s,
|
|
|
|
static void freecnfa(struct cnfa *);
|
|
|
|
bool **haspaths);
|
|
|
|
static void dumpnfa(struct nfa *, FILE *);
|
|
|
|
static bool check_out_colors_match(struct state *s, color co1, color co2);
|
|
|
|
|
|
|
|
static bool check_in_colors_match(struct state *s, color co1, color co2);
|
|
|
|
|
|
|
|
static void compact(struct nfa *nfa, struct cnfa *cnfa);
|
|
|
|
|
|
|
|
static void carcsort(struct carc *first, size_t n);
|
|
|
|
|
|
|
|
static int carc_cmp(const void *a, const void *b);
|
|
|
|
|
|
|
|
static void freecnfa(struct cnfa *cnfa);
|
|
|
|
|
|
|
|
static void dumpnfa(struct nfa *nfa, FILE *f);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef REG_DEBUG
|
|
|
|
#ifdef REG_DEBUG
|
|
|
|
static void dumpstate(struct state *, FILE *);
|
|
|
|
static void dumpstate(struct state *, FILE *);
|
|
|
@ -199,12 +241,12 @@ static void dumpcnfa(struct cnfa *, FILE *);
|
|
|
|
static void dumpcstate(int, struct cnfa *, FILE *);
|
|
|
|
static void dumpcstate(int, struct cnfa *, FILE *);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/* === regc_cvec.c === */
|
|
|
|
/* === regc_cvec.c === */
|
|
|
|
static struct cvec *newcvec(int, int);
|
|
|
|
static struct cvec *newcvec(int nchrs, int nranges);
|
|
|
|
static struct cvec *clearcvec(struct cvec *);
|
|
|
|
static struct cvec *clearcvec(struct cvec *cv);
|
|
|
|
static void addchr(struct cvec *, chr);
|
|
|
|
static void addchr(struct cvec *cv, chr c);
|
|
|
|
static void addrange(struct cvec *, chr, chr);
|
|
|
|
static void addrange(struct cvec *cv, chr from, chr to);
|
|
|
|
static struct cvec *getcvec(struct vars *, int, int);
|
|
|
|
static struct cvec *getcvec(struct vars *v, int nchrs, int nranges);
|
|
|
|
static void freecvec(struct cvec *);
|
|
|
|
static void freecvec(struct cvec *cv);
|
|
|
|
|
|
|
|
|
|
|
|
/* === regc_pg_locale.c === */
|
|
|
|
/* === regc_pg_locale.c === */
|
|
|
|
static int pg_wc_isdigit(pg_wchar c);
|
|
|
|
static int pg_wc_isdigit(pg_wchar c);
|
|
|
@ -221,16 +263,18 @@ static pg_wchar pg_wc_toupper(pg_wchar c);
|
|
|
|
static pg_wchar pg_wc_tolower(pg_wchar c);
|
|
|
|
static pg_wchar pg_wc_tolower(pg_wchar c);
|
|
|
|
|
|
|
|
|
|
|
|
/* === regc_locale.c === */
|
|
|
|
/* === regc_locale.c === */
|
|
|
|
static chr element(struct vars *, const chr *, const chr *);
|
|
|
|
static chr element(struct vars *v, const chr *startp, const chr *endp);
|
|
|
|
static struct cvec *range(struct vars *, chr, chr, int);
|
|
|
|
static struct cvec *range(struct vars *v, chr a, chr b, int cases);
|
|
|
|
static int before(chr, chr);
|
|
|
|
static int before(chr x, chr y);
|
|
|
|
static struct cvec *eclass(struct vars *, chr, int);
|
|
|
|
static struct cvec *eclass(struct vars *v, chr c, int cases);
|
|
|
|
static enum char_classes lookupcclass(struct vars *, const chr *, const chr *);
|
|
|
|
static enum char_classes lookupcclass(struct vars *v, const chr *startp,
|
|
|
|
static struct cvec *cclasscvec(struct vars *, enum char_classes, int);
|
|
|
|
const chr *endp);
|
|
|
|
static int cclass_column_index(struct colormap *, chr);
|
|
|
|
static struct cvec *cclasscvec(struct vars *v, enum char_classes cclasscode,
|
|
|
|
static struct cvec *allcases(struct vars *, chr);
|
|
|
|
int cases);
|
|
|
|
static int cmp(const chr *, const chr *, size_t);
|
|
|
|
static int cclass_column_index(struct colormap *cm, chr c);
|
|
|
|
static int casecmp(const chr *, const chr *, size_t);
|
|
|
|
static struct cvec *allcases(struct vars *v, chr c);
|
|
|
|
|
|
|
|
static int cmp(const chr *x, const chr *y, size_t len);
|
|
|
|
|
|
|
|
static int casecmp(const chr *x, const chr *y, size_t len);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* internal variables, bundled for easy passing around */
|
|
|
|
/* internal variables, bundled for easy passing around */
|
|
|
|