1 /*-------------------------------------------------------------------------
4 * Declarations for exporting info about a regex's NFA (nondeterministic
7 * The functions declared here provide accessors to extract the NFA state
8 * graph and color character sets of a successfully-compiled regex.
10 * An NFA contains one or more states, numbered 0..N-1. There is an initial
11 * state, as well as a final state --- reaching the final state denotes
12 * successful matching of an input string. Each state except the final one
13 * has some out-arcs that lead to successor states, each arc being labeled
14 * with a color that represents one or more concrete character codes.
15 * (The colors of a state's out-arcs need not be distinct, since this is an
16 * NFA not a DFA.) There are also "pseudocolors" representing start/end of
17 * line and start/end of string. Colors are numbered 0..C-1, but note that
18 * color 0 is "white" (all unused characters) and can generally be ignored.
20 * Portions Copyright (c) 2013-2017, PostgreSQL Global Development Group
21 * Portions Copyright (c) 1998, 1999 Henry Spencer
24 * src/include/regex/regexport.h
26 *-------------------------------------------------------------------------
31 #include "regex/regex.h"
33 /* information about one arc of a regex's NFA */
36 int co; /* label (character-set color) of arc */
37 int to; /* next state number */
41 /* Functions for gathering information about NFA states and arcs */
42 extern int pg_reg_getnumstates(const regex_t *regex);
43 extern int pg_reg_getinitialstate(const regex_t *regex);
44 extern int pg_reg_getfinalstate(const regex_t *regex);
45 extern int pg_reg_getnumoutarcs(const regex_t *regex, int st);
46 extern void pg_reg_getoutarcs(const regex_t *regex, int st,
47 regex_arc_t *arcs, int arcs_len);
49 /* Functions for gathering information about colors */
50 extern int pg_reg_getnumcolors(const regex_t *regex);
51 extern int pg_reg_colorisbegin(const regex_t *regex, int co);
52 extern int pg_reg_colorisend(const regex_t *regex, int co);
53 extern int pg_reg_getnumcharacters(const regex_t *regex, int co);
54 extern void pg_reg_getcharacters(const regex_t *regex, int co,
55 pg_wchar *chars, int chars_len);
57 #endif /* _REGEXPORT_H_ */