17 |
/* along with this program; if not, write to the Free Software */ |
/* along with this program; if not, write to the Free Software */ |
18 |
/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
/* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
19 |
|
|
|
/* $Id$ */ |
|
|
|
|
20 |
/** |
/** |
21 |
* \file regexp.h |
* \file regexp.h |
22 |
* \brief Regular Expression fonctions |
* \brief Regular Expression fonctions |
27 |
#ifndef _TREE_H_ |
#ifndef _TREE_H_ |
28 |
#define _TREE_H_ |
#define _TREE_H_ |
29 |
#if defined(__cplusplus) |
#if defined(__cplusplus) |
30 |
extern "C" |
extern "C" |
31 |
{ |
{ |
32 |
#endif |
#endif |
33 |
|
|
34 |
#define NODE_TOP 0 |
#define NODE_TOP 0 |
35 |
#define NODE_VAR 1 |
#define NODE_VAR 1 |
40 |
|
|
41 |
typedef struct node { |
typedef struct node { |
42 |
int type; |
int type; |
43 |
char var; |
char var; |
44 |
struct node *fg; |
struct node *fg; |
45 |
struct node *fd; |
struct node *fd; |
46 |
int numero; |
int numero; |
47 |
int position; |
int position; |
48 |
int annulable; |
int annulable; |
53 |
/** |
/** |
54 |
* maximum number of accepted terminals in regular expressions |
* maximum number of accepted terminals in regular expressions |
55 |
*/ |
*/ |
56 |
#define REGEXP_MAX 32 |
#define REGEXP_MAX 32 |
57 |
|
|
58 |
/** |
/** |
59 |
* special terminals that should not appear in the dictionary |
* special terminals that should not appear in the dictionary |
60 |
*/ |
*/ |
61 |
#define RE_EPSILON (DIC_LETTERS + 0) |
#define RE_EPSILON (DIC_LETTERS + 0) |
62 |
#define RE_FINAL_TOK (DIC_LETTERS + 1) |
#define RE_FINAL_TOK (DIC_LETTERS + 1) |
65 |
#define RE_CONS_MATCH (DIC_LETTERS + 4) |
#define RE_CONS_MATCH (DIC_LETTERS + 4) |
66 |
#define RE_USR1_MATCH (DIC_LETTERS + 5) |
#define RE_USR1_MATCH (DIC_LETTERS + 5) |
67 |
#define RE_USR2_MATCH (DIC_LETTERS + 6) |
#define RE_USR2_MATCH (DIC_LETTERS + 6) |
68 |
|
|
69 |
/** |
/** |
70 |
* number of lists for regexp letter match \n |
* number of lists for regexp letter match \n |
71 |
* 0 : all tiles \n |
* 0 : all tiles \n |
72 |
* 1 : vowels \n |
* 1 : vowels \n |
77 |
*/ |
*/ |
78 |
#define DIC_SEARCH_REGE_LIST (REGEXP_MAX) |
#define DIC_SEARCH_REGE_LIST (REGEXP_MAX) |
79 |
|
|
80 |
/** |
/** |
81 |
* Structure used for Dic_search_RegE \n |
* Structure used for Dic_search_RegE \n |
82 |
* this structure is used to explicit letters list that will be matched |
* this structure is used to explicit letters list that will be matched |
83 |
* against special tokens in the regular expression search |
* against special tokens in the regular expression search |
84 |
*/ |
*/ |
85 |
struct search_RegE_list_t { |
struct search_RegE_list_t { |
86 |
/** special symbol associated with the list */ |
/** special symbol associated with the list */ |
87 |
char symbl[DIC_SEARCH_REGE_LIST]; |
char symbl[DIC_SEARCH_REGE_LIST]; |
88 |
/** 0 or 1 if list is valid */ |
/** 0 or 1 if list is valid */ |
89 |
int valid[DIC_SEARCH_REGE_LIST]; |
int valid[DIC_SEARCH_REGE_LIST]; |
90 |
/** 0 or 1 if letter is present in the list */ |
/** 0 or 1 if letter is present in the list */ |
91 |
char letters[DIC_SEARCH_REGE_LIST][DIC_LETTERS]; |
char letters[DIC_SEARCH_REGE_LIST][DIC_LETTERS]; |
92 |
}; |
}; |
93 |
|
|
94 |
#define RE_LIST_ALL_MATCH 0 |
#define RE_LIST_ALL_MATCH 0 |
103 |
* The fonction is called by bison grammar rules |
* The fonction is called by bison grammar rules |
104 |
*/ |
*/ |
105 |
NODE* regexp_createNODE(int type,char v,NODE *fg,NODE *fd); |
NODE* regexp_createNODE(int type,char v,NODE *fg,NODE *fd); |
106 |
|
|
107 |
/** |
/** |
108 |
* delete regexp syntactic tree |
* delete regexp syntactic tree |
109 |
*/ |
*/ |
145 |
|
|
146 |
#if defined(__cplusplus) |
#if defined(__cplusplus) |
147 |
} |
} |
148 |
#endif |
#endif |
149 |
#endif /* _TREE_H_ */ |
#endif /* _TREE_H_ */ |