• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* libxml2 - Library for parsing XML documents
2  * Copyright (C) 2006-2019 Free Software Foundation, Inc.
3  *
4  * This file is not part of the GNU gettext program, but is used with
5  * GNU gettext.
6  *
7  * The original copyright notice is as follows:
8  */
9 
10 /*
11  * Copyright (C) 1998-2012 Daniel Veillard.  All Rights Reserved.
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a copy
14  * of this software and associated documentation files (the "Software"), to deal
15  * in the Software without restriction, including without limitation the rights
16  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17  * copies of the Software, and to permit persons to whom the Software is fur-
18  * nished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included in
21  * all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
25  * NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
26  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29  * THE SOFTWARE.
30  *
31  * Author: Daniel Veillard
32  */
33 
34 /*
35  * Summary: API to build regexp automata
36  * Description: the API to build regexp automata
37  */
38 
39 #ifndef __XML_AUTOMATA_H__
40 #define __XML_AUTOMATA_H__
41 
42 #include <libxml/xmlversion.h>
43 #include <libxml/tree.h>
44 
45 #ifdef LIBXML_REGEXP_ENABLED
46 #ifdef LIBXML_AUTOMATA_ENABLED
47 #include <libxml/xmlregexp.h>
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 /**
54  * xmlAutomataPtr:
55  *
56  * A libxml automata description, It can be compiled into a regexp
57  */
58 typedef struct _xmlAutomata xmlAutomata;
59 typedef xmlAutomata *xmlAutomataPtr;
60 
61 /**
62  * xmlAutomataStatePtr:
63  *
64  * A state int the automata description,
65  */
66 typedef struct _xmlAutomataState xmlAutomataState;
67 typedef xmlAutomataState *xmlAutomataStatePtr;
68 
69 /*
70  * Building API
71  */
72 XMLPUBFUN xmlAutomataPtr XMLCALL
73 		    xmlNewAutomata		(void);
74 XMLPUBFUN void XMLCALL
75 		    xmlFreeAutomata		(xmlAutomataPtr am);
76 
77 XMLPUBFUN xmlAutomataStatePtr XMLCALL
78 		    xmlAutomataGetInitState	(xmlAutomataPtr am);
79 XMLPUBFUN int XMLCALL
80 		    xmlAutomataSetFinalState	(xmlAutomataPtr am,
81 						 xmlAutomataStatePtr state);
82 XMLPUBFUN xmlAutomataStatePtr XMLCALL
83 		    xmlAutomataNewState		(xmlAutomataPtr am);
84 XMLPUBFUN xmlAutomataStatePtr XMLCALL
85 		    xmlAutomataNewTransition	(xmlAutomataPtr am,
86 						 xmlAutomataStatePtr from,
87 						 xmlAutomataStatePtr to,
88 						 const xmlChar *token,
89 						 void *data);
90 XMLPUBFUN xmlAutomataStatePtr XMLCALL
91 		    xmlAutomataNewTransition2	(xmlAutomataPtr am,
92 						 xmlAutomataStatePtr from,
93 						 xmlAutomataStatePtr to,
94 						 const xmlChar *token,
95 						 const xmlChar *token2,
96 						 void *data);
97 XMLPUBFUN xmlAutomataStatePtr XMLCALL
98                     xmlAutomataNewNegTrans	(xmlAutomataPtr am,
99 						 xmlAutomataStatePtr from,
100 						 xmlAutomataStatePtr to,
101 						 const xmlChar *token,
102 						 const xmlChar *token2,
103 						 void *data);
104 
105 XMLPUBFUN xmlAutomataStatePtr XMLCALL
106 		    xmlAutomataNewCountTrans	(xmlAutomataPtr am,
107 						 xmlAutomataStatePtr from,
108 						 xmlAutomataStatePtr to,
109 						 const xmlChar *token,
110 						 int min,
111 						 int max,
112 						 void *data);
113 XMLPUBFUN xmlAutomataStatePtr XMLCALL
114 		    xmlAutomataNewCountTrans2	(xmlAutomataPtr am,
115 						 xmlAutomataStatePtr from,
116 						 xmlAutomataStatePtr to,
117 						 const xmlChar *token,
118 						 const xmlChar *token2,
119 						 int min,
120 						 int max,
121 						 void *data);
122 XMLPUBFUN xmlAutomataStatePtr XMLCALL
123 		    xmlAutomataNewOnceTrans	(xmlAutomataPtr am,
124 						 xmlAutomataStatePtr from,
125 						 xmlAutomataStatePtr to,
126 						 const xmlChar *token,
127 						 int min,
128 						 int max,
129 						 void *data);
130 XMLPUBFUN xmlAutomataStatePtr XMLCALL
131 		    xmlAutomataNewOnceTrans2	(xmlAutomataPtr am,
132 						 xmlAutomataStatePtr from,
133 						 xmlAutomataStatePtr to,
134 						 const xmlChar *token,
135 						 const xmlChar *token2,
136 						 int min,
137 						 int max,
138 						 void *data);
139 XMLPUBFUN xmlAutomataStatePtr XMLCALL
140 		    xmlAutomataNewAllTrans	(xmlAutomataPtr am,
141 						 xmlAutomataStatePtr from,
142 						 xmlAutomataStatePtr to,
143 						 int lax);
144 XMLPUBFUN xmlAutomataStatePtr XMLCALL
145 		    xmlAutomataNewEpsilon	(xmlAutomataPtr am,
146 						 xmlAutomataStatePtr from,
147 						 xmlAutomataStatePtr to);
148 XMLPUBFUN xmlAutomataStatePtr XMLCALL
149 		    xmlAutomataNewCountedTrans	(xmlAutomataPtr am,
150 						 xmlAutomataStatePtr from,
151 						 xmlAutomataStatePtr to,
152 						 int counter);
153 XMLPUBFUN xmlAutomataStatePtr XMLCALL
154 		    xmlAutomataNewCounterTrans	(xmlAutomataPtr am,
155 						 xmlAutomataStatePtr from,
156 						 xmlAutomataStatePtr to,
157 						 int counter);
158 XMLPUBFUN int XMLCALL
159 		    xmlAutomataNewCounter	(xmlAutomataPtr am,
160 						 int min,
161 						 int max);
162 
163 XMLPUBFUN xmlRegexpPtr XMLCALL
164 		    xmlAutomataCompile		(xmlAutomataPtr am);
165 XMLPUBFUN int XMLCALL
166 		    xmlAutomataIsDeterminist	(xmlAutomataPtr am);
167 
168 #ifdef __cplusplus
169 }
170 #endif
171 
172 #endif /* LIBXML_AUTOMATA_ENABLED */
173 #endif /* LIBXML_REGEXP_ENABLED */
174 
175 #endif /* __XML_AUTOMATA_H__ */
176