2 * Copyright (C) 1994-1997, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.7 1997-09-05 15:29:59 adam
8 * Changed prototype for chr_map_input - added const.
9 * Added support for C++, headers uses extern "C" for public definitions.
11 * Revision 1.6 1996/06/04 10:20:10 adam
12 * Added support for character mapping.
14 * Revision 1.5 1996/01/08 09:09:48 adam
15 * Function dfa_parse got 'const' string argument.
17 * Revision 1.4 1995/01/25 11:31:04 adam
18 * Simple error reporting when parsing regular expressions.
20 * Revision 1.3 1995/01/24 16:01:30 adam
21 * Added -ansi to CFLAGS.
22 * New functions and change of data structures.
24 * Revision 1.2 1994/09/26 16:31:23 adam
25 * Minor changes. xmalloc declares xcalloc now.
27 * Revision 1.1 1994/09/26 10:17:43 adam
28 * Dfa-module header files.
43 unsigned char ch[2]; /* transition on ch[0] <= c <= ch[1] to */
44 unsigned short to; /* this state */
48 struct DFA_trans *next; /* next DFA transition block */
49 struct DFA_tran *tran_block; /* pointer to transitions */
50 int ptr; /* index of next transition in tran_block */
51 int size; /* allocated size of tran_block */
55 struct DFA_state *next; /* next entry in free/unmarked/marked list */
56 struct DFA_state *link; /* link to next entry in hash chain */
57 struct DFA_tran *trans; /* transition list */
58 Set set; /* set of positions (important nfa states) */
59 short no; /* no of this state */
60 short tran_no; /* no of transitions to other states */
61 short rule_no; /* if non-zero, this holds accept rule no */
62 short rule_nno; /* accept rule no - except start rules */
67 struct DFA_state **states;
68 struct DFA_states *state_info;
69 struct DFA_parse *parse_info;
72 struct DFA *dfa_init (void);
73 void dfa_set_cmap (struct DFA *dfa,
74 const char **(*cmap)(const char **from, int len));
75 int dfa_parse (struct DFA *, const char **);
76 void dfa_mkstate (struct DFA *);
77 void dfa_delete (struct DFA **);
79 void dfa_parse_cmap_clean (struct DFA *d);
80 void dfa_parse_cmap_new (struct DFA *d, const int *cmap);
81 void dfa_parse_cmap_del (struct DFA *d, int from);
82 void dfa_parse_cmap_add (struct DFA *d, int from, int to);
84 extern int debug_dfa_trav;
85 extern int debug_dfa_tran;
86 extern int debug_dfa_followpos;
87 extern int dfa_verbose;
107 #define DFA_ERR_SYNTAX 1