blob: f0f7561c9d21fb33b72b45ccae3b4a5b9cf62ece [file] [log] [blame]
Daniel Veillard1e346af1999-02-22 10:33:01 +00001/*
2 * parserInternals.h : internals routines exported by the parser.
3 *
4 * See Copyright for the status of this software.
5 *
6 * Daniel.Veillard@w3.org
7 */
8
9#ifndef __XML_PARSER_INTERNALS_H__
10#define __XML_PARSER_INTERNALS_H__
11
Daniel Veillard361d8452000-04-03 19:48:13 +000012#include <libxml/parser.h>
Daniel Veillard1e346af1999-02-22 10:33:01 +000013
14#ifdef __cplusplus
15extern "C" {
16#endif
17
Daniel Veillardb96e6431999-08-29 21:02:19 +000018#define XML_MAX_NAMELEN 1000
19
Daniel Veillard64068b31999-03-24 20:42:16 +000020/************************************************************************
21 * *
22 * UNICODE version of the macros. *
23 * *
24 ************************************************************************/
25/*
26 * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
27 * | [#x10000-#x10FFFF]
28 * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
29 */
30#define IS_CHAR(c) \
Daniel Veillard496a1cf2000-05-03 14:20:55 +000031 (((c) == 0x09) || ((c) == 0x0A) || ((c) == 0x0D) || \
32 (((c) >= 0x20) && ((c) <= 0xD7FF)) || \
33 (((c) >= 0xE000) && ((c) <= 0xFFFD)) || \
34 (((c) >= 0x10000) && ((c) <= 0x10FFFF)))
Daniel Veillard64068b31999-03-24 20:42:16 +000035
36/*
37 * [3] S ::= (#x20 | #x9 | #xD | #xA)+
38 */
Daniel Veillardfc708e22000-04-08 13:17:27 +000039#define IS_BLANK(c) (((c) == 0x20) || ((c) == 0x09) || ((c) == 0xA) || \
Daniel Veillard64068b31999-03-24 20:42:16 +000040 ((c) == 0x0D))
41
42/*
43 * [85] BaseChar ::= ... long list see REC ...
44 *
45 * VI is your friend !
46 * :1,$ s/\[#x\([0-9A-Z]*\)-#x\([0-9A-Z]*\)\]/ (((c) >= 0x\1) \&\& ((c) <= 0x\2)) ||/
47 * and
48 * :1,$ s/#x\([0-9A-Z]*\)/ ((c) == 0x\1) ||/
49 */
50#define IS_BASECHAR(c) \
51 ((((c) >= 0x0041) && ((c) <= 0x005A)) || \
52 (((c) >= 0x0061) && ((c) <= 0x007A)) || \
53 (((c) >= 0x00C0) && ((c) <= 0x00D6)) || \
54 (((c) >= 0x00D8) && ((c) <= 0x00F6)) || \
55 (((c) >= 0x00F8) && ((c) <= 0x00FF)) || \
Daniel Veillard5e873c42000-04-12 13:27:38 +000056 (((c) >= 0x100) && ( /* accelerator */ \
Daniel Veillard64068b31999-03-24 20:42:16 +000057 (((c) >= 0x0100) && ((c) <= 0x0131)) || \
58 (((c) >= 0x0134) && ((c) <= 0x013E)) || \
59 (((c) >= 0x0141) && ((c) <= 0x0148)) || \
60 (((c) >= 0x014A) && ((c) <= 0x017E)) || \
61 (((c) >= 0x0180) && ((c) <= 0x01C3)) || \
62 (((c) >= 0x01CD) && ((c) <= 0x01F0)) || \
63 (((c) >= 0x01F4) && ((c) <= 0x01F5)) || \
64 (((c) >= 0x01FA) && ((c) <= 0x0217)) || \
65 (((c) >= 0x0250) && ((c) <= 0x02A8)) || \
66 (((c) >= 0x02BB) && ((c) <= 0x02C1)) || \
67 ((c) == 0x0386) || \
68 (((c) >= 0x0388) && ((c) <= 0x038A)) || \
69 ((c) == 0x038C) || \
70 (((c) >= 0x038E) && ((c) <= 0x03A1)) || \
71 (((c) >= 0x03A3) && ((c) <= 0x03CE)) || \
72 (((c) >= 0x03D0) && ((c) <= 0x03D6)) || \
73 ((c) == 0x03DA) || \
74 ((c) == 0x03DC) || \
75 ((c) == 0x03DE) || \
76 ((c) == 0x03E0) || \
77 (((c) >= 0x03E2) && ((c) <= 0x03F3)) || \
78 (((c) >= 0x0401) && ((c) <= 0x040C)) || \
79 (((c) >= 0x040E) && ((c) <= 0x044F)) || \
80 (((c) >= 0x0451) && ((c) <= 0x045C)) || \
81 (((c) >= 0x045E) && ((c) <= 0x0481)) || \
82 (((c) >= 0x0490) && ((c) <= 0x04C4)) || \
83 (((c) >= 0x04C7) && ((c) <= 0x04C8)) || \
84 (((c) >= 0x04CB) && ((c) <= 0x04CC)) || \
85 (((c) >= 0x04D0) && ((c) <= 0x04EB)) || \
86 (((c) >= 0x04EE) && ((c) <= 0x04F5)) || \
87 (((c) >= 0x04F8) && ((c) <= 0x04F9)) || \
88 (((c) >= 0x0531) && ((c) <= 0x0556)) || \
89 ((c) == 0x0559) || \
90 (((c) >= 0x0561) && ((c) <= 0x0586)) || \
91 (((c) >= 0x05D0) && ((c) <= 0x05EA)) || \
92 (((c) >= 0x05F0) && ((c) <= 0x05F2)) || \
93 (((c) >= 0x0621) && ((c) <= 0x063A)) || \
94 (((c) >= 0x0641) && ((c) <= 0x064A)) || \
95 (((c) >= 0x0671) && ((c) <= 0x06B7)) || \
96 (((c) >= 0x06BA) && ((c) <= 0x06BE)) || \
97 (((c) >= 0x06C0) && ((c) <= 0x06CE)) || \
98 (((c) >= 0x06D0) && ((c) <= 0x06D3)) || \
99 ((c) == 0x06D5) || \
100 (((c) >= 0x06E5) && ((c) <= 0x06E6)) || \
Daniel Veillard5e873c42000-04-12 13:27:38 +0000101 (((c) > 0x905) && ( /* accelerator */ \
Daniel Veillard64068b31999-03-24 20:42:16 +0000102 (((c) >= 0x0905) && ((c) <= 0x0939)) || \
103 ((c) == 0x093D) || \
104 (((c) >= 0x0958) && ((c) <= 0x0961)) || \
105 (((c) >= 0x0985) && ((c) <= 0x098C)) || \
106 (((c) >= 0x098F) && ((c) <= 0x0990)) || \
107 (((c) >= 0x0993) && ((c) <= 0x09A8)) || \
108 (((c) >= 0x09AA) && ((c) <= 0x09B0)) || \
109 ((c) == 0x09B2) || \
110 (((c) >= 0x09B6) && ((c) <= 0x09B9)) || \
111 (((c) >= 0x09DC) && ((c) <= 0x09DD)) || \
112 (((c) >= 0x09DF) && ((c) <= 0x09E1)) || \
113 (((c) >= 0x09F0) && ((c) <= 0x09F1)) || \
114 (((c) >= 0x0A05) && ((c) <= 0x0A0A)) || \
115 (((c) >= 0x0A0F) && ((c) <= 0x0A10)) || \
116 (((c) >= 0x0A13) && ((c) <= 0x0A28)) || \
117 (((c) >= 0x0A2A) && ((c) <= 0x0A30)) || \
118 (((c) >= 0x0A32) && ((c) <= 0x0A33)) || \
119 (((c) >= 0x0A35) && ((c) <= 0x0A36)) || \
120 (((c) >= 0x0A38) && ((c) <= 0x0A39)) || \
121 (((c) >= 0x0A59) && ((c) <= 0x0A5C)) || \
122 ((c) == 0x0A5E) || \
123 (((c) >= 0x0A72) && ((c) <= 0x0A74)) || \
124 (((c) >= 0x0A85) && ((c) <= 0x0A8B)) || \
125 ((c) == 0x0A8D) || \
126 (((c) >= 0x0A8F) && ((c) <= 0x0A91)) || \
127 (((c) >= 0x0A93) && ((c) <= 0x0AA8)) || \
128 (((c) >= 0x0AAA) && ((c) <= 0x0AB0)) || \
129 (((c) >= 0x0AB2) && ((c) <= 0x0AB3)) || \
130 (((c) >= 0x0AB5) && ((c) <= 0x0AB9)) || \
131 ((c) == 0x0ABD) || \
132 ((c) == 0x0AE0) || \
133 (((c) >= 0x0B05) && ((c) <= 0x0B0C)) || \
134 (((c) >= 0x0B0F) && ((c) <= 0x0B10)) || \
135 (((c) >= 0x0B13) && ((c) <= 0x0B28)) || \
136 (((c) >= 0x0B2A) && ((c) <= 0x0B30)) || \
137 (((c) >= 0x0B32) && ((c) <= 0x0B33)) || \
138 (((c) >= 0x0B36) && ((c) <= 0x0B39)) || \
139 ((c) == 0x0B3D) || \
140 (((c) >= 0x0B5C) && ((c) <= 0x0B5D)) || \
141 (((c) >= 0x0B5F) && ((c) <= 0x0B61)) || \
142 (((c) >= 0x0B85) && ((c) <= 0x0B8A)) || \
143 (((c) >= 0x0B8E) && ((c) <= 0x0B90)) || \
144 (((c) >= 0x0B92) && ((c) <= 0x0B95)) || \
145 (((c) >= 0x0B99) && ((c) <= 0x0B9A)) || \
146 ((c) == 0x0B9C) || \
147 (((c) >= 0x0B9E) && ((c) <= 0x0B9F)) || \
148 (((c) >= 0x0BA3) && ((c) <= 0x0BA4)) || \
149 (((c) >= 0x0BA8) && ((c) <= 0x0BAA)) || \
150 (((c) >= 0x0BAE) && ((c) <= 0x0BB5)) || \
151 (((c) >= 0x0BB7) && ((c) <= 0x0BB9)) || \
152 (((c) >= 0x0C05) && ((c) <= 0x0C0C)) || \
153 (((c) >= 0x0C0E) && ((c) <= 0x0C10)) || \
154 (((c) >= 0x0C12) && ((c) <= 0x0C28)) || \
155 (((c) >= 0x0C2A) && ((c) <= 0x0C33)) || \
156 (((c) >= 0x0C35) && ((c) <= 0x0C39)) || \
157 (((c) >= 0x0C60) && ((c) <= 0x0C61)) || \
158 (((c) >= 0x0C85) && ((c) <= 0x0C8C)) || \
159 (((c) >= 0x0C8E) && ((c) <= 0x0C90)) || \
160 (((c) >= 0x0C92) && ((c) <= 0x0CA8)) || \
161 (((c) >= 0x0CAA) && ((c) <= 0x0CB3)) || \
162 (((c) >= 0x0CB5) && ((c) <= 0x0CB9)) || \
163 ((c) == 0x0CDE) || \
164 (((c) >= 0x0CE0) && ((c) <= 0x0CE1)) || \
165 (((c) >= 0x0D05) && ((c) <= 0x0D0C)) || \
166 (((c) >= 0x0D0E) && ((c) <= 0x0D10)) || \
167 (((c) >= 0x0D12) && ((c) <= 0x0D28)) || \
168 (((c) >= 0x0D2A) && ((c) <= 0x0D39)) || \
169 (((c) >= 0x0D60) && ((c) <= 0x0D61)) || \
170 (((c) >= 0x0E01) && ((c) <= 0x0E2E)) || \
171 ((c) == 0x0E30) || \
172 (((c) >= 0x0E32) && ((c) <= 0x0E33)) || \
173 (((c) >= 0x0E40) && ((c) <= 0x0E45)) || \
174 (((c) >= 0x0E81) && ((c) <= 0x0E82)) || \
175 ((c) == 0x0E84) || \
176 (((c) >= 0x0E87) && ((c) <= 0x0E88)) || \
177 ((c) == 0x0E8A) || \
178 ((c) == 0x0E8D) || \
179 (((c) >= 0x0E94) && ((c) <= 0x0E97)) || \
180 (((c) >= 0x0E99) && ((c) <= 0x0E9F)) || \
181 (((c) >= 0x0EA1) && ((c) <= 0x0EA3)) || \
182 ((c) == 0x0EA5) || \
183 ((c) == 0x0EA7) || \
184 (((c) >= 0x0EAA) && ((c) <= 0x0EAB)) || \
185 (((c) >= 0x0EAD) && ((c) <= 0x0EAE)) || \
186 ((c) == 0x0EB0) || \
187 (((c) >= 0x0EB2) && ((c) <= 0x0EB3)) || \
188 ((c) == 0x0EBD) || \
189 (((c) >= 0x0EC0) && ((c) <= 0x0EC4)) || \
190 (((c) >= 0x0F40) && ((c) <= 0x0F47)) || \
191 (((c) >= 0x0F49) && ((c) <= 0x0F69)) || \
Daniel Veillard5e873c42000-04-12 13:27:38 +0000192 (((c) > 0x10A0) && ( /* accelerator */ \
Daniel Veillard64068b31999-03-24 20:42:16 +0000193 (((c) >= 0x10A0) && ((c) <= 0x10C5)) || \
194 (((c) >= 0x10D0) && ((c) <= 0x10F6)) || \
195 ((c) == 0x1100) || \
196 (((c) >= 0x1102) && ((c) <= 0x1103)) || \
197 (((c) >= 0x1105) && ((c) <= 0x1107)) || \
198 ((c) == 0x1109) || \
199 (((c) >= 0x110B) && ((c) <= 0x110C)) || \
200 (((c) >= 0x110E) && ((c) <= 0x1112)) || \
201 ((c) == 0x113C) || \
202 ((c) == 0x113E) || \
203 ((c) == 0x1140) || \
204 ((c) == 0x114C) || \
205 ((c) == 0x114E) || \
206 ((c) == 0x1150) || \
207 (((c) >= 0x1154) && ((c) <= 0x1155)) || \
208 ((c) == 0x1159) || \
209 (((c) >= 0x115F) && ((c) <= 0x1161)) || \
210 ((c) == 0x1163) || \
211 ((c) == 0x1165) || \
212 ((c) == 0x1167) || \
213 ((c) == 0x1169) || \
214 (((c) >= 0x116D) && ((c) <= 0x116E)) || \
215 (((c) >= 0x1172) && ((c) <= 0x1173)) || \
216 ((c) == 0x1175) || \
217 ((c) == 0x119E) || \
218 ((c) == 0x11A8) || \
219 ((c) == 0x11AB) || \
220 (((c) >= 0x11AE) && ((c) <= 0x11AF)) || \
221 (((c) >= 0x11B7) && ((c) <= 0x11B8)) || \
222 ((c) == 0x11BA) || \
223 (((c) >= 0x11BC) && ((c) <= 0x11C2)) || \
224 ((c) == 0x11EB) || \
225 ((c) == 0x11F0) || \
226 ((c) == 0x11F9) || \
227 (((c) >= 0x1E00) && ((c) <= 0x1E9B)) || \
228 (((c) >= 0x1EA0) && ((c) <= 0x1EF9)) || \
229 (((c) >= 0x1F00) && ((c) <= 0x1F15)) || \
230 (((c) >= 0x1F18) && ((c) <= 0x1F1D)) || \
231 (((c) >= 0x1F20) && ((c) <= 0x1F45)) || \
232 (((c) >= 0x1F48) && ((c) <= 0x1F4D)) || \
233 (((c) >= 0x1F50) && ((c) <= 0x1F57)) || \
234 ((c) == 0x1F59) || \
235 ((c) == 0x1F5B) || \
236 ((c) == 0x1F5D) || \
237 (((c) >= 0x1F5F) && ((c) <= 0x1F7D)) || \
238 (((c) >= 0x1F80) && ((c) <= 0x1FB4)) || \
239 (((c) >= 0x1FB6) && ((c) <= 0x1FBC)) || \
240 ((c) == 0x1FBE) || \
241 (((c) >= 0x1FC2) && ((c) <= 0x1FC4)) || \
242 (((c) >= 0x1FC6) && ((c) <= 0x1FCC)) || \
243 (((c) >= 0x1FD0) && ((c) <= 0x1FD3)) || \
244 (((c) >= 0x1FD6) && ((c) <= 0x1FDB)) || \
245 (((c) >= 0x1FE0) && ((c) <= 0x1FEC)) || \
246 (((c) >= 0x1FF2) && ((c) <= 0x1FF4)) || \
247 (((c) >= 0x1FF6) && ((c) <= 0x1FFC)) || \
248 ((c) == 0x2126) || \
249 (((c) >= 0x212A) && ((c) <= 0x212B)) || \
250 ((c) == 0x212E) || \
251 (((c) >= 0x2180) && ((c) <= 0x2182)) || \
252 (((c) >= 0x3041) && ((c) <= 0x3094)) || \
253 (((c) >= 0x30A1) && ((c) <= 0x30FA)) || \
254 (((c) >= 0x3105) && ((c) <= 0x312C)) || \
Daniel Veillard5e873c42000-04-12 13:27:38 +0000255 (((c) >= 0xAC00) && ((c) <= 0xD7A3))) /* accelerators */ ))))))
Daniel Veillard64068b31999-03-24 20:42:16 +0000256
257/*
258 * [88] Digit ::= ... long list see REC ...
259 */
260#define IS_DIGIT(c) \
261 ((((c) >= 0x0030) && ((c) <= 0x0039)) || \
Daniel Veillard5e873c42000-04-12 13:27:38 +0000262 (((c) >= 0x660) && ( /* accelerator */ \
Daniel Veillard64068b31999-03-24 20:42:16 +0000263 (((c) >= 0x0660) && ((c) <= 0x0669)) || \
264 (((c) >= 0x06F0) && ((c) <= 0x06F9)) || \
265 (((c) >= 0x0966) && ((c) <= 0x096F)) || \
266 (((c) >= 0x09E6) && ((c) <= 0x09EF)) || \
267 (((c) >= 0x0A66) && ((c) <= 0x0A6F)) || \
268 (((c) >= 0x0AE6) && ((c) <= 0x0AEF)) || \
269 (((c) >= 0x0B66) && ((c) <= 0x0B6F)) || \
270 (((c) >= 0x0BE7) && ((c) <= 0x0BEF)) || \
271 (((c) >= 0x0C66) && ((c) <= 0x0C6F)) || \
272 (((c) >= 0x0CE6) && ((c) <= 0x0CEF)) || \
273 (((c) >= 0x0D66) && ((c) <= 0x0D6F)) || \
274 (((c) >= 0x0E50) && ((c) <= 0x0E59)) || \
275 (((c) >= 0x0ED0) && ((c) <= 0x0ED9)) || \
Daniel Veillard5e873c42000-04-12 13:27:38 +0000276 (((c) >= 0x0F20) && ((c) <= 0x0F29))) /* accelerator */ ))
Daniel Veillard64068b31999-03-24 20:42:16 +0000277
278/*
279 * [87] CombiningChar ::= ... long list see REC ...
280 */
281#define IS_COMBINING(c) \
Daniel Veillard5e873c42000-04-12 13:27:38 +0000282 ((((c) >= 0x300) && ( /* accelerator */ \
283 (((c) >= 0x0300) && ((c) <= 0x0345)) || \
Daniel Veillard64068b31999-03-24 20:42:16 +0000284 (((c) >= 0x0360) && ((c) <= 0x0361)) || \
285 (((c) >= 0x0483) && ((c) <= 0x0486)) || \
286 (((c) >= 0x0591) && ((c) <= 0x05A1)) || \
287 (((c) >= 0x05A3) && ((c) <= 0x05B9)) || \
288 (((c) >= 0x05BB) && ((c) <= 0x05BD)) || \
289 ((c) == 0x05BF) || \
290 (((c) >= 0x05C1) && ((c) <= 0x05C2)) || \
291 ((c) == 0x05C4) || \
292 (((c) >= 0x064B) && ((c) <= 0x0652)) || \
293 ((c) == 0x0670) || \
294 (((c) >= 0x06D6) && ((c) <= 0x06DC)) || \
295 (((c) >= 0x06DD) && ((c) <= 0x06DF)) || \
296 (((c) >= 0x06E0) && ((c) <= 0x06E4)) || \
297 (((c) >= 0x06E7) && ((c) <= 0x06E8)) || \
298 (((c) >= 0x06EA) && ((c) <= 0x06ED)) || \
Daniel Veillard5e873c42000-04-12 13:27:38 +0000299 (((c) > 0x0901) && ( /* accelerator */ \
Daniel Veillard64068b31999-03-24 20:42:16 +0000300 (((c) >= 0x0901) && ((c) <= 0x0903)) || \
301 ((c) == 0x093C) || \
302 (((c) >= 0x093E) && ((c) <= 0x094C)) || \
303 ((c) == 0x094D) || \
304 (((c) >= 0x0951) && ((c) <= 0x0954)) || \
305 (((c) >= 0x0962) && ((c) <= 0x0963)) || \
306 (((c) >= 0x0981) && ((c) <= 0x0983)) || \
307 ((c) == 0x09BC) || \
308 ((c) == 0x09BE) || \
309 ((c) == 0x09BF) || \
310 (((c) >= 0x09C0) && ((c) <= 0x09C4)) || \
311 (((c) >= 0x09C7) && ((c) <= 0x09C8)) || \
312 (((c) >= 0x09CB) && ((c) <= 0x09CD)) || \
313 ((c) == 0x09D7) || \
314 (((c) >= 0x09E2) && ((c) <= 0x09E3)) || \
Daniel Veillard5e873c42000-04-12 13:27:38 +0000315 (((c) > 0x0A02) && ( /* accelerator */ \
Daniel Veillard64068b31999-03-24 20:42:16 +0000316 ((c) == 0x0A02) || \
317 ((c) == 0x0A3C) || \
318 ((c) == 0x0A3E) || \
319 ((c) == 0x0A3F) || \
320 (((c) >= 0x0A40) && ((c) <= 0x0A42)) || \
321 (((c) >= 0x0A47) && ((c) <= 0x0A48)) || \
322 (((c) >= 0x0A4B) && ((c) <= 0x0A4D)) || \
323 (((c) >= 0x0A70) && ((c) <= 0x0A71)) || \
324 (((c) >= 0x0A81) && ((c) <= 0x0A83)) || \
325 ((c) == 0x0ABC) || \
326 (((c) >= 0x0ABE) && ((c) <= 0x0AC5)) || \
327 (((c) >= 0x0AC7) && ((c) <= 0x0AC9)) || \
328 (((c) >= 0x0ACB) && ((c) <= 0x0ACD)) || \
329 (((c) >= 0x0B01) && ((c) <= 0x0B03)) || \
330 ((c) == 0x0B3C) || \
331 (((c) >= 0x0B3E) && ((c) <= 0x0B43)) || \
332 (((c) >= 0x0B47) && ((c) <= 0x0B48)) || \
333 (((c) >= 0x0B4B) && ((c) <= 0x0B4D)) || \
334 (((c) >= 0x0B56) && ((c) <= 0x0B57)) || \
335 (((c) >= 0x0B82) && ((c) <= 0x0B83)) || \
336 (((c) >= 0x0BBE) && ((c) <= 0x0BC2)) || \
337 (((c) >= 0x0BC6) && ((c) <= 0x0BC8)) || \
338 (((c) >= 0x0BCA) && ((c) <= 0x0BCD)) || \
339 ((c) == 0x0BD7) || \
340 (((c) >= 0x0C01) && ((c) <= 0x0C03)) || \
341 (((c) >= 0x0C3E) && ((c) <= 0x0C44)) || \
342 (((c) >= 0x0C46) && ((c) <= 0x0C48)) || \
343 (((c) >= 0x0C4A) && ((c) <= 0x0C4D)) || \
344 (((c) >= 0x0C55) && ((c) <= 0x0C56)) || \
345 (((c) >= 0x0C82) && ((c) <= 0x0C83)) || \
346 (((c) >= 0x0CBE) && ((c) <= 0x0CC4)) || \
347 (((c) >= 0x0CC6) && ((c) <= 0x0CC8)) || \
348 (((c) >= 0x0CCA) && ((c) <= 0x0CCD)) || \
349 (((c) >= 0x0CD5) && ((c) <= 0x0CD6)) || \
350 (((c) >= 0x0D02) && ((c) <= 0x0D03)) || \
351 (((c) >= 0x0D3E) && ((c) <= 0x0D43)) || \
352 (((c) >= 0x0D46) && ((c) <= 0x0D48)) || \
353 (((c) >= 0x0D4A) && ((c) <= 0x0D4D)) || \
354 ((c) == 0x0D57) || \
Daniel Veillard5e873c42000-04-12 13:27:38 +0000355 (((c) > 0x0E31) && ( /* accelerator */ \
Daniel Veillard64068b31999-03-24 20:42:16 +0000356 ((c) == 0x0E31) || \
357 (((c) >= 0x0E34) && ((c) <= 0x0E3A)) || \
358 (((c) >= 0x0E47) && ((c) <= 0x0E4E)) || \
359 ((c) == 0x0EB1) || \
360 (((c) >= 0x0EB4) && ((c) <= 0x0EB9)) || \
361 (((c) >= 0x0EBB) && ((c) <= 0x0EBC)) || \
362 (((c) >= 0x0EC8) && ((c) <= 0x0ECD)) || \
363 (((c) >= 0x0F18) && ((c) <= 0x0F19)) || \
364 ((c) == 0x0F35) || \
365 ((c) == 0x0F37) || \
366 ((c) == 0x0F39) || \
367 ((c) == 0x0F3E) || \
368 ((c) == 0x0F3F) || \
369 (((c) >= 0x0F71) && ((c) <= 0x0F84)) || \
370 (((c) >= 0x0F86) && ((c) <= 0x0F8B)) || \
371 (((c) >= 0x0F90) && ((c) <= 0x0F95)) || \
372 ((c) == 0x0F97) || \
373 (((c) >= 0x0F99) && ((c) <= 0x0FAD)) || \
374 (((c) >= 0x0FB1) && ((c) <= 0x0FB7)) || \
375 ((c) == 0x0FB9) || \
376 (((c) >= 0x20D0) && ((c) <= 0x20DC)) || \
377 ((c) == 0x20E1) || \
378 (((c) >= 0x302A) && ((c) <= 0x302F)) || \
379 ((c) == 0x3099) || \
Daniel Veillard5e873c42000-04-12 13:27:38 +0000380 ((c) == 0x309A)) /* accelerator */ ))))))))
Daniel Veillard64068b31999-03-24 20:42:16 +0000381
382/*
383 * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 |
384 * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] |
385 * [#x309D-#x309E] | [#x30FC-#x30FE]
386 */
387#define IS_EXTENDER(c) \
388 (((c) == 0xb7) || ((c) == 0x2d0) || ((c) == 0x2d1) || \
389 ((c) == 0x387) || ((c) == 0x640) || ((c) == 0xe46) || \
Daniel Veillardcf461992000-03-14 18:30:20 +0000390 ((c) == 0xec6) || ((c) == 0x3005) || \
Daniel Veillard64068b31999-03-24 20:42:16 +0000391 (((c) >= 0x3031) && ((c) <= 0x3035)) || \
392 (((c) >= 0x309b) && ((c) <= 0x309e)) || \
393 (((c) >= 0x30fc) && ((c) <= 0x30fe)))
394
395/*
396 * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]
397 */
398#define IS_IDEOGRAPHIC(c) \
399 ((((c) >= 0x4e00) && ((c) <= 0x9fa5)) || \
400 (((c) >= 0xf900) && ((c) <= 0xfa2d)) || \
401 (((c) >= 0x3021) && ((c) <= 0x3029)) || \
402 ((c) == 0x3007))
403
404/*
405 * [84] Letter ::= BaseChar | Ideographic
406 */
407#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c))
408
Daniel Veillard64068b31999-03-24 20:42:16 +0000409
410/*
411 * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
412 */
413#define IS_PUBIDCHAR(c) \
414 (((c) == 0x20) || ((c) == 0x0D) || ((c) == 0x0A) || \
415 (((c) >= 'a') && ((c) <= 'z')) || \
416 (((c) >= 'A') && ((c) <= 'Z')) || \
417 (((c) >= '0') && ((c) <= '9')) || \
418 ((c) == '-') || ((c) == '\'') || ((c) == '(') || ((c) == ')') || \
419 ((c) == '+') || ((c) == ',') || ((c) == '.') || ((c) == '/') || \
420 ((c) == ':') || ((c) == '=') || ((c) == '?') || ((c) == ';') || \
421 ((c) == '!') || ((c) == '*') || ((c) == '#') || ((c) == '@') || \
422 ((c) == '$') || ((c) == '_') || ((c) == '%'))
423
424#define SKIP_EOL(p) \
425 if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \
426 if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; }
427
428#define MOVETO_ENDTAG(p) \
Daniel Veillardcf461992000-03-14 18:30:20 +0000429 while ((*p) && (*(p) != '>')) (p)++
Daniel Veillard64068b31999-03-24 20:42:16 +0000430
431#define MOVETO_STARTTAG(p) \
Daniel Veillardcf461992000-03-14 18:30:20 +0000432 while ((*p) && (*(p) != '<')) (p)++
Daniel Veillard011b63c1999-06-02 17:44:04 +0000433
434/**
Daniel Veillardd692aa41999-02-28 21:54:31 +0000435 * Parser context
436 */
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000437xmlParserCtxtPtr xmlCreateDocParserCtxt (xmlChar *cur);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000438xmlParserCtxtPtr xmlCreateFileParserCtxt (const char *filename);
439xmlParserCtxtPtr xmlCreateMemoryParserCtxt(char *buffer,
440 int size);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000441xmlParserCtxtPtr xmlNewParserCtxt (void);
Daniel Veillardcf461992000-03-14 18:30:20 +0000442xmlParserCtxtPtr xmlCreateEntityParserCtxt(const xmlChar *URL,
443 const xmlChar *ID,
444 const xmlChar *base);
Daniel Veillard496a1cf2000-05-03 14:20:55 +0000445int xmlSwitchEncoding (xmlParserCtxtPtr ctxt,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000446 xmlCharEncoding enc);
Daniel Veillard496a1cf2000-05-03 14:20:55 +0000447int xmlSwitchToEncoding (xmlParserCtxtPtr ctxt,
448 xmlCharEncodingHandlerPtr handler);
Daniel Veillardcf461992000-03-14 18:30:20 +0000449void xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
Daniel Veillardd692aa41999-02-28 21:54:31 +0000450
Daniel Veillardbc50b591999-03-01 12:28:53 +0000451/**
Daniel Veillard1e346af1999-02-22 10:33:01 +0000452 * Entities
453 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000454void xmlHandleEntity (xmlParserCtxtPtr ctxt,
455 xmlEntityPtr entity);
Daniel Veillard1e346af1999-02-22 10:33:01 +0000456
Daniel Veillardbc50b591999-03-01 12:28:53 +0000457/**
458 * Input Streams
459 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000460xmlParserInputPtr xmlNewEntityInputStream (xmlParserCtxtPtr ctxt,
461 xmlEntityPtr entity);
462void xmlPushInput (xmlParserCtxtPtr ctxt,
463 xmlParserInputPtr input);
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000464xmlChar xmlPopInput (xmlParserCtxtPtr ctxt);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000465void xmlFreeInputStream (xmlParserInputPtr input);
466xmlParserInputPtr xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
467 const char *filename);
Daniel Veillardbc50b591999-03-01 12:28:53 +0000468
469/**
Daniel Veillard1e346af1999-02-22 10:33:01 +0000470 * Namespaces.
471 */
Daniel Veillardcf461992000-03-14 18:30:20 +0000472xmlChar * xmlSplitQName (xmlParserCtxtPtr ctxt,
473 const xmlChar *name,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000474 xmlChar **prefix);
Daniel Veillardcf461992000-03-14 18:30:20 +0000475xmlChar * xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt);
476xmlChar * xmlNamespaceParseQName (xmlParserCtxtPtr ctxt,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000477 xmlChar **prefix);
Daniel Veillardcf461992000-03-14 18:30:20 +0000478xmlChar * xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt);
479xmlChar * xmlParseQuotedString (xmlParserCtxtPtr ctxt);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000480void xmlParseNamespace (xmlParserCtxtPtr ctxt);
Daniel Veillard1e346af1999-02-22 10:33:01 +0000481
Daniel Veillardbc50b591999-03-01 12:28:53 +0000482/**
Daniel Veillard1e346af1999-02-22 10:33:01 +0000483 * Generic production rules
484 */
Daniel Veillardcf461992000-03-14 18:30:20 +0000485xmlChar * xmlScanName (xmlParserCtxtPtr ctxt);
486xmlChar * xmlParseName (xmlParserCtxtPtr ctxt);
487xmlChar * xmlParseNmtoken (xmlParserCtxtPtr ctxt);
488xmlChar * xmlParseEntityValue (xmlParserCtxtPtr ctxt,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000489 xmlChar **orig);
Daniel Veillardcf461992000-03-14 18:30:20 +0000490xmlChar * xmlParseAttValue (xmlParserCtxtPtr ctxt);
491xmlChar * xmlParseSystemLiteral (xmlParserCtxtPtr ctxt);
492xmlChar * xmlParsePubidLiteral (xmlParserCtxtPtr ctxt);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000493void xmlParseCharData (xmlParserCtxtPtr ctxt,
494 int cdata);
Daniel Veillardcf461992000-03-14 18:30:20 +0000495xmlChar * xmlParseExternalID (xmlParserCtxtPtr ctxt,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000496 xmlChar **publicID,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000497 int strict);
498void xmlParseComment (xmlParserCtxtPtr ctxt);
Daniel Veillardcf461992000-03-14 18:30:20 +0000499xmlChar * xmlParsePITarget (xmlParserCtxtPtr ctxt);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000500void xmlParsePI (xmlParserCtxtPtr ctxt);
501void xmlParseNotationDecl (xmlParserCtxtPtr ctxt);
502void xmlParseEntityDecl (xmlParserCtxtPtr ctxt);
503int xmlParseDefaultDecl (xmlParserCtxtPtr ctxt,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000504 xmlChar **value);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000505xmlEnumerationPtr xmlParseNotationType (xmlParserCtxtPtr ctxt);
506xmlEnumerationPtr xmlParseEnumerationType (xmlParserCtxtPtr ctxt);
507int xmlParseEnumeratedType (xmlParserCtxtPtr ctxt,
508 xmlEnumerationPtr *tree);
509int xmlParseAttributeType (xmlParserCtxtPtr ctxt,
510 xmlEnumerationPtr *tree);
511void xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt);
512xmlElementContentPtr xmlParseElementMixedContentDecl
513 (xmlParserCtxtPtr ctxt);
514xmlElementContentPtr xmlParseElementChildrenContentDecl
515 (xmlParserCtxtPtr ctxt);
516int xmlParseElementContentDecl(xmlParserCtxtPtr ctxt,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000517 xmlChar *name,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000518 xmlElementContentPtr *result);
519int xmlParseElementDecl (xmlParserCtxtPtr ctxt);
520void xmlParseMarkupDecl (xmlParserCtxtPtr ctxt);
521int xmlParseCharRef (xmlParserCtxtPtr ctxt);
522xmlEntityPtr xmlParseEntityRef (xmlParserCtxtPtr ctxt);
523void xmlParseReference (xmlParserCtxtPtr ctxt);
524void xmlParsePEReference (xmlParserCtxtPtr ctxt);
525void xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt);
Daniel Veillardcf461992000-03-14 18:30:20 +0000526xmlChar * xmlParseAttribute (xmlParserCtxtPtr ctxt,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000527 xmlChar **value);
Daniel Veillardcf461992000-03-14 18:30:20 +0000528xmlChar * xmlParseStartTag (xmlParserCtxtPtr ctxt);
Daniel Veillarddbfd6411999-12-28 16:35:14 +0000529void xmlParseEndTag (xmlParserCtxtPtr ctxt);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000530void xmlParseCDSect (xmlParserCtxtPtr ctxt);
531void xmlParseContent (xmlParserCtxtPtr ctxt);
532void xmlParseElement (xmlParserCtxtPtr ctxt);
Daniel Veillardcf461992000-03-14 18:30:20 +0000533xmlChar * xmlParseVersionNum (xmlParserCtxtPtr ctxt);
534xmlChar * xmlParseVersionInfo (xmlParserCtxtPtr ctxt);
535xmlChar * xmlParseEncName (xmlParserCtxtPtr ctxt);
536xmlChar * xmlParseEncodingDecl (xmlParserCtxtPtr ctxt);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000537int xmlParseSDDecl (xmlParserCtxtPtr ctxt);
538void xmlParseXMLDecl (xmlParserCtxtPtr ctxt);
Daniel Veillardcf461992000-03-14 18:30:20 +0000539void xmlParseTextDecl (xmlParserCtxtPtr ctxt);
Daniel Veillardb96e6431999-08-29 21:02:19 +0000540void xmlParseMisc (xmlParserCtxtPtr ctxt);
541void xmlParseExternalSubset (xmlParserCtxtPtr ctxt,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000542 const xmlChar *ExternalID,
543 const xmlChar *SystemID);
Daniel Veillard517752b1999-04-05 12:20:10 +0000544/*
Daniel Veillard011b63c1999-06-02 17:44:04 +0000545 * Entities substitution
546 */
547#define XML_SUBSTITUTE_NONE 0
548#define XML_SUBSTITUTE_REF 1
549#define XML_SUBSTITUTE_PEREF 2
550#define XML_SUBSTITUTE_BOTH 3
551
Daniel Veillardcf461992000-03-14 18:30:20 +0000552xmlChar * xmlDecodeEntities (xmlParserCtxtPtr ctxt,
Daniel Veillardb96e6431999-08-29 21:02:19 +0000553 int len,
554 int what,
Daniel Veillarddd6b3671999-09-23 22:19:22 +0000555 xmlChar end,
556 xmlChar end2,
557 xmlChar end3);
Daniel Veillardcf461992000-03-14 18:30:20 +0000558xmlChar * xmlStringDecodeEntities (xmlParserCtxtPtr ctxt,
559 const xmlChar *str,
560 int what,
561 xmlChar end,
562 xmlChar end2,
563 xmlChar end3);
Daniel Veillard011b63c1999-06-02 17:44:04 +0000564
565/*
Daniel Veillard517752b1999-04-05 12:20:10 +0000566 * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP
567 */
Daniel Veillardb96e6431999-08-29 21:02:19 +0000568int nodePush (xmlParserCtxtPtr ctxt,
569 xmlNodePtr value);
570xmlNodePtr nodePop (xmlParserCtxtPtr ctxt);
571int inputPush (xmlParserCtxtPtr ctxt,
572 xmlParserInputPtr value);
573xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt);
Daniel Veillard1e346af1999-02-22 10:33:01 +0000574
Daniel Veillard32bc74e2000-07-14 14:49:25 +0000575/*
576 * Really core function shared with HTML parser
577 */
578int xmlCurrentChar (xmlParserCtxtPtr ctxt,
579 int *len);
580int xmlCopyChar (int len,
581 xmlChar *out,
582 int val);
583void xmlNextChar (xmlParserCtxtPtr ctxt);
584void xmlParserInputShrink (xmlParserInputPtr in);
Daniel Veillardc08a2c61999-09-08 21:35:25 +0000585#ifdef __cplusplus
586}
587#endif
Daniel Veillard1e346af1999-02-22 10:33:01 +0000588#endif /* __XML_PARSER_INTERNALS_H__ */