2 * Summary: regular expressions handling
3 * Description: basic API for libxml regular expressions handling used
4 * for XML Schemas and validation.
6 * Copy: See Copyright for the status of this software.
8 * Author: Daniel Veillard
11 #ifndef __XML_REGEXP_H__
12 #define __XML_REGEXP_H__
14 #include <libxml/xmlversion.h>
16 #ifdef LIBXML_REGEXP_ENABLED
25 * A libxml regular expression, they can actually be far more complex
26 * thank the POSIX regex expressions.
28 typedef struct _xmlRegexp xmlRegexp;
29 typedef xmlRegexp *xmlRegexpPtr;
34 * A libxml progressive regular expression evaluation context
36 typedef struct _xmlRegExecCtxt xmlRegExecCtxt;
37 typedef xmlRegExecCtxt *xmlRegExecCtxtPtr;
42 #include <libxml/tree.h>
43 #include <libxml/dict.h>
51 XMLPUBFUN xmlRegexpPtr XMLCALL
52 xmlRegexpCompile (const xmlChar *regexp);
53 XMLPUBFUN void XMLCALL xmlRegFreeRegexp(xmlRegexpPtr regexp);
55 xmlRegexpExec (xmlRegexpPtr comp,
56 const xmlChar *value);
57 XMLPUBFUN void XMLCALL
58 xmlRegexpPrint (FILE *output,
61 xmlRegexpIsDeterminist(xmlRegexpPtr comp);
64 * Callback function when doing a transition in the automata
66 typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec,
74 XMLPUBFUN xmlRegExecCtxtPtr XMLCALL
75 xmlRegNewExecCtxt (xmlRegexpPtr comp,
76 xmlRegExecCallbacks callback,
78 XMLPUBFUN void XMLCALL
79 xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec);
81 xmlRegExecPushString(xmlRegExecCtxtPtr exec,
85 xmlRegExecPushString2(xmlRegExecCtxtPtr exec,
87 const xmlChar *value2,
91 xmlRegExecNextValues(xmlRegExecCtxtPtr exec,
97 xmlRegExecErrInfo (xmlRegExecCtxtPtr exec,
98 const xmlChar **string,
103 #ifdef LIBXML_EXPR_ENABLED
105 * Formal regular expression handling
106 * Its goal is to do some formal work on content models
109 /* expressions are used within a context */
110 typedef struct _xmlExpCtxt xmlExpCtxt;
111 typedef xmlExpCtxt *xmlExpCtxtPtr;
113 XMLPUBFUN void XMLCALL
114 xmlExpFreeCtxt (xmlExpCtxtPtr ctxt);
115 XMLPUBFUN xmlExpCtxtPtr XMLCALL
116 xmlExpNewCtxt (int maxNodes,
119 XMLPUBFUN int XMLCALL
120 xmlExpCtxtNbNodes(xmlExpCtxtPtr ctxt);
121 XMLPUBFUN int XMLCALL
122 xmlExpCtxtNbCons(xmlExpCtxtPtr ctxt);
124 /* Expressions are trees but the tree is opaque */
125 typedef struct _xmlExpNode xmlExpNode;
126 typedef xmlExpNode *xmlExpNodePtr;
138 * 2 core expressions shared by all for the empty language set
139 * and for the set with just the empty token
141 XMLPUBVAR xmlExpNodePtr forbiddenExp;
142 XMLPUBVAR xmlExpNodePtr emptyExp;
145 * Expressions are reference counted internally
147 XMLPUBFUN void XMLCALL
148 xmlExpFree (xmlExpCtxtPtr ctxt,
150 XMLPUBFUN void XMLCALL
151 xmlExpRef (xmlExpNodePtr expr);
154 * constructors can be either manual or from a string
156 XMLPUBFUN xmlExpNodePtr XMLCALL
157 xmlExpParse (xmlExpCtxtPtr ctxt,
159 XMLPUBFUN xmlExpNodePtr XMLCALL
160 xmlExpNewAtom (xmlExpCtxtPtr ctxt,
163 XMLPUBFUN xmlExpNodePtr XMLCALL
164 xmlExpNewOr (xmlExpCtxtPtr ctxt,
166 xmlExpNodePtr right);
167 XMLPUBFUN xmlExpNodePtr XMLCALL
168 xmlExpNewSeq (xmlExpCtxtPtr ctxt,
170 xmlExpNodePtr right);
171 XMLPUBFUN xmlExpNodePtr XMLCALL
172 xmlExpNewRange (xmlExpCtxtPtr ctxt,
173 xmlExpNodePtr subset,
177 * The really interesting APIs
179 XMLPUBFUN int XMLCALL
180 xmlExpIsNillable(xmlExpNodePtr expr);
181 XMLPUBFUN int XMLCALL
182 xmlExpMaxToken (xmlExpNodePtr expr);
183 XMLPUBFUN int XMLCALL
184 xmlExpGetLanguage(xmlExpCtxtPtr ctxt,
186 const xmlChar**langList,
188 XMLPUBFUN int XMLCALL
189 xmlExpGetStart (xmlExpCtxtPtr ctxt,
191 const xmlChar**tokList,
193 XMLPUBFUN xmlExpNodePtr XMLCALL
194 xmlExpStringDerive(xmlExpCtxtPtr ctxt,
198 XMLPUBFUN xmlExpNodePtr XMLCALL
199 xmlExpExpDerive (xmlExpCtxtPtr ctxt,
202 XMLPUBFUN int XMLCALL
203 xmlExpSubsume (xmlExpCtxtPtr ctxt,
206 XMLPUBFUN void XMLCALL
207 xmlExpDump (xmlBufferPtr buf,
209 #endif /* LIBXML_EXPR_ENABLED */
214 #endif /* LIBXML_REGEXP_ENABLED */
216 #endif /*__XML_REGEXP_H__ */