1 /* This file is part of the Zebra server.
2 Copyright (C) Index Data
4 Zebra is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 #include <yaz/yconfig.h>
31 unsigned char ch[2]; /* transition on ch[0] <= c <= ch[1] to */
32 unsigned short to; /* this state */
36 struct DFA_trans *next; /* next DFA transition block */
37 struct DFA_tran *tran_block; /* pointer to transitions */
38 int ptr; /* index of next transition in tran_block */
39 int size; /* allocated size of tran_block */
43 struct DFA_state *next; /* next entry in free/unmarked/marked list */
44 struct DFA_state *link; /* link to next entry in hash chain */
45 struct DFA_tran *trans; /* transition list */
46 DFASet set; /* set of positions (important nfa states) */
47 short no; /* no of this state */
48 short tran_no; /* no of transitions to other states */
49 short rule_no; /* if non-zero, this holds accept rule no */
50 short rule_nno; /* accept rule no - except start rules */
55 struct DFA_state **states;
56 struct DFA_states *state_info;
57 struct DFA_parse *parse_info;
60 struct DFA *dfa_init (void);
61 void dfa_anyset_includes_nl(struct DFA *dfa);
62 void dfa_set_cmap (struct DFA *dfa, void *vp,
63 const char **(*cmap)(void *vp, const char **from, int len));
64 int dfa_parse (struct DFA *, const char **);
65 void dfa_mkstate (struct DFA *);
66 void dfa_delete (struct DFA **);
67 int dfa_get_last_rule (struct DFA *);
69 void dfa_parse_cmap_clean (struct DFA *d);
70 void dfa_parse_cmap_new (struct DFA *d, const int *cmap);
71 void dfa_parse_cmap_del (struct DFA *d, int from);
72 void dfa_parse_cmap_add (struct DFA *d, int from, int to);
74 extern int debug_dfa_trav;
75 extern int debug_dfa_tran;
76 extern int debug_dfa_followpos;
77 extern int dfa_verbose;
97 #define DFA_ERR_SYNTAX 1
107 * c-file-style: "Stroustrup"
108 * indent-tabs-mode: nil
110 * vim: shiftwidth=4 tabstop=8 expandtab