2 * Copyright (C) 1994-1996, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.6 1996-06-04 10:20:10 adam
8 * Added support for character mapping.
10 * Revision 1.5 1996/01/08 09:09:48 adam
11 * Function dfa_parse got 'const' string argument.
13 * Revision 1.4 1995/01/25 11:31:04 adam
14 * Simple error reporting when parsing regular expressions.
16 * Revision 1.3 1995/01/24 16:01:30 adam
17 * Added -ansi to CFLAGS.
18 * New functions and change of data structures.
20 * Revision 1.2 1994/09/26 16:31:23 adam
21 * Minor changes. xmalloc declares xcalloc now.
23 * Revision 1.1 1994/09/26 10:17:43 adam
24 * Dfa-module header files.
35 unsigned char ch[2]; /* transition on ch[0] <= c <= ch[1] to */
36 unsigned short to; /* this state */
40 struct DFA_trans *next; /* next DFA transition block */
41 struct DFA_tran *tran_block; /* pointer to transitions */
42 int ptr; /* index of next transition in tran_block */
43 int size; /* allocated size of tran_block */
47 struct DFA_state *next; /* next entry in free/unmarked/marked list */
48 struct DFA_state *link; /* link to next entry in hash chain */
49 struct DFA_tran *trans; /* transition list */
50 Set set; /* set of positions (important nfa states) */
51 short no; /* no of this state */
52 short tran_no; /* no of transitions to other states */
53 short rule_no; /* if non-zero, this holds accept rule no */
54 short rule_nno; /* accept rule no - except start rules */
59 struct DFA_state **states;
60 struct DFA_states *state_info;
61 struct DFA_parse *parse_info;
64 struct DFA *dfa_init (void);
65 void dfa_set_cmap (struct DFA *dfa,
66 char **(*cmap)(const char **from, int len));
67 int dfa_parse (struct DFA *, const char **);
68 void dfa_mkstate (struct DFA *);
69 void dfa_delete (struct DFA **);
71 void dfa_parse_cmap_clean (struct DFA *d);
72 void dfa_parse_cmap_new (struct DFA *d, const int *cmap);
73 void dfa_parse_cmap_del (struct DFA *d, int from);
74 void dfa_parse_cmap_add (struct DFA *d, int from, int to);
76 extern int debug_dfa_trav;
77 extern int debug_dfa_tran;
78 extern int debug_dfa_followpos;
79 extern int dfa_verbose;
99 #define DFA_ERR_SYNTAX 1