Simple error reporting when parsing regular expressions.
[idzebra-moved-to-github.git] / dfa / dfap.h
1 /*
2  * Copyright (C) 1994, Index Data I/S 
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: dfap.h,v $
7  * Revision 1.2  1995-01-25 11:30:50  adam
8  * Simple error reporting when parsing regular expressions.
9  * Memory usage reduced.
10  *
11  * Revision 1.1  1995/01/24  16:02:53  adam
12  * New private header file in dfa module (dfap.h).
13  * Module no longer uses yacc to parse regular expressions.
14  *
15  */
16
17 #ifndef DFAP_H
18 #define DFAP_H
19
20 #include <dfa.h>
21
22 struct DFA_parse {
23     struct Tnode *root;       /* root of regular syntax tree */
24     int position;             /* no of positions so far */
25     int rule;                 /* no of rules so far */
26     BSetHandle *charset;      /* character set type */
27     BSet anyset;              /* character recognized by `.' */
28     int use_Tnode;            /* used Tnodes */
29     int max_Tnode;            /* allocated Tnodes */
30     struct Tblock *start;     /* start block of Tnodes */
31     struct Tblock *end;       /* end block of Tnodes */
32 };
33
34 typedef struct DFA_stateb_ {
35     struct DFA_stateb_ *next;
36     struct DFA_state *state_block;
37 } DFA_stateb;
38
39 struct DFA_states {
40     struct DFA_state *freelist;   /* chain of unused (but allocated) states */
41     struct DFA_state *unmarked;   /* chain of unmarked DFA states */
42     struct DFA_state *marked;     /* chain of marked DFA states */
43     DFA_stateb *statemem;         /* state memory */
44     int no;                       /* no of states (unmarked+marked) */
45     SetType st;                   /* Position set type */
46     int hash;                     /* no hash entries in hasharray */
47     struct DFA_state **hasharray; /* hash pointers */
48     struct DFA_state **sortarray; /* sorted DFA states */
49     struct DFA_trans *transmem;   /* transition memory */
50 };
51
52 int         init_DFA_states (struct DFA_states **dfasp, SetType st, int hash);
53 int         rm_DFA_states   (struct DFA_states **dfasp);
54 int         add_DFA_state   (struct DFA_states *dfas, Set *s,
55                              struct DFA_state **sp);
56 struct DFA_state *get_DFA_state  (struct DFA_states *dfas);
57 void        sort_DFA_states (struct DFA_states *dfas);
58 void        add_DFA_tran    (struct DFA_states *, struct DFA_state *,
59                              int, int, int);
60
61 #endif