1 |
wakaba |
1.1 |
Module: |
2 |
|
|
@QName: MDOM|XMLParser |
3 |
|
|
@Namespace: |
4 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/dom/xml-parser# |
5 |
|
|
|
6 |
|
|
@FullName: |
7 |
|
|
@@lang:en |
8 |
|
|
@@@: XML Parser |
9 |
|
|
|
10 |
|
|
@DISCore:author: DISCore|Wakaba |
11 |
|
|
@License: license|Perl+MPL |
12 |
|
|
@Date: |
13 |
wakaba |
1.8 |
$Date: 2006/01/21 17:37:51 $ |
14 |
wakaba |
1.1 |
|
15 |
|
|
@DefaultFor: ManakaiDOM|ManakaiDOMLatest |
16 |
|
|
|
17 |
|
|
@Require: |
18 |
|
|
@@Module: |
19 |
|
|
@@@QName: MDOM|DOMLS |
20 |
|
|
@@@WithFor: ManakaiDOM|ManakaiDOMLatest |
21 |
wakaba |
1.6 |
@@Module: |
22 |
|
|
@@@QName: MDOM|XDoctype |
23 |
|
|
@@@WithFor: ManakaiDOM|ManakaiDOMLatest |
24 |
wakaba |
1.1 |
|
25 |
|
|
Namespace: |
26 |
wakaba |
1.8 |
@c: |
27 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core# |
28 |
wakaba |
1.6 |
@d: |
29 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/dom/xdt# |
30 |
wakaba |
1.1 |
@dis: |
31 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#dis-- |
32 |
wakaba |
1.5 |
@dtest: |
33 |
|
|
http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/DIS#Test/ |
34 |
wakaba |
1.1 |
@dx: |
35 |
|
|
http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException# |
36 |
|
|
@ecore: |
37 |
|
|
http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/Core/ |
38 |
|
|
@f: |
39 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/dom/feature# |
40 |
|
|
@idl: |
41 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/dis/IDL# |
42 |
|
|
@infoset: |
43 |
|
|
http://www.w3.org/2001/04/infoset# |
44 |
|
|
@lang: |
45 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/8/18/lang# |
46 |
|
|
@license: |
47 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/8/18/license# |
48 |
|
|
@LSEV: |
49 |
|
|
http://www.w3.org/2002/DOMLS |
50 |
|
|
@ManakaiDOM: |
51 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom# |
52 |
|
|
@ManakaiDOMLS: |
53 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/mdom-ls# |
54 |
|
|
@MDOM: |
55 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#ManakaiDOM. |
56 |
|
|
@MDOMX: |
57 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception# |
58 |
|
|
@rdf: |
59 |
|
|
http://www.w3.org/1999/02/22-rdf-syntax-ns# |
60 |
|
|
@rdfs: |
61 |
|
|
http://www.w3.org/2000/01/rdf-schema# |
62 |
|
|
@t: |
63 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/dom/tree# |
64 |
wakaba |
1.5 |
@test: |
65 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/dis/Test# |
66 |
wakaba |
1.8 |
@x: |
67 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/dom/xml# |
68 |
wakaba |
1.1 |
@xml: |
69 |
|
|
http://www.w3.org/XML/1998/namespace |
70 |
|
|
@xmlns: |
71 |
|
|
http://www.w3.org/2000/xmlns/ |
72 |
|
|
@xp: |
73 |
|
|
http://suika.fam.cx/~wakaba/archive/2004/dom/xml-parser# |
74 |
|
|
|
75 |
|
|
## -- Features |
76 |
|
|
|
77 |
|
|
ElementTypeBinding: |
78 |
|
|
@Name: FeatureDef |
79 |
|
|
@ElementType: |
80 |
|
|
dis:ResourceDef |
81 |
|
|
@ShadowContent: |
82 |
|
|
@@rdf:type: f|Feature |
83 |
|
|
@@For: =ManakaiDOM|all |
84 |
|
|
|
85 |
|
|
ElementTypeBinding: |
86 |
|
|
@Name: FeatureVerDef |
87 |
|
|
@ElementType: |
88 |
|
|
dis:ResourceDef |
89 |
|
|
@ShadowContent: |
90 |
|
|
@@rdf:type: f|Feature |
91 |
|
|
|
92 |
|
|
ElementTypeBinding: |
93 |
|
|
@Name: featureQName |
94 |
|
|
@ElementType: |
95 |
|
|
f:name |
96 |
|
|
@ShadowContent: |
97 |
|
|
@@ContentType: DISCore|QName |
98 |
|
|
|
99 |
|
|
ResourceDef: |
100 |
|
|
@QName: DOMString |
101 |
|
|
@AliasFor: DOMMain|DOMString |
102 |
|
|
@For: ManakaiDOM|DOM |
103 |
|
|
|
104 |
|
|
ResourceDef: |
105 |
|
|
@QName: Node |
106 |
|
|
@AliasFor: t|Node |
107 |
|
|
@For: ManakaiDOM|DOM |
108 |
|
|
|
109 |
|
|
ResourceDef: |
110 |
|
|
@QName: Element |
111 |
|
|
@AliasFor: t|Element |
112 |
|
|
@For: ManakaiDOM|DOM |
113 |
|
|
|
114 |
|
|
ResourceDef: |
115 |
|
|
@QName: Document |
116 |
|
|
@AliasFor: t|Document |
117 |
|
|
@For: ManakaiDOM|DOM |
118 |
|
|
|
119 |
wakaba |
1.6 |
ResourceDef: |
120 |
|
|
@QName: DocumentXDoctype |
121 |
|
|
@AliasFor: d|DocumentXDoctype |
122 |
|
|
@For: ManakaiDOM|DOM |
123 |
|
|
|
124 |
wakaba |
1.8 |
ResourceDef: |
125 |
|
|
@QName: DTDef |
126 |
|
|
@AliasFor: d|DocumentTypeDefinition |
127 |
|
|
@For: ManakaiDOM|DOM |
128 |
|
|
|
129 |
|
|
ResourceDef: |
130 |
|
|
@QName: ETDef |
131 |
|
|
@AliasFor: d|ElementTypeDefinition |
132 |
|
|
@For: ManakaiDOM|DOM |
133 |
|
|
|
134 |
|
|
ResourceDef: |
135 |
|
|
@QName: ATDef |
136 |
|
|
@AliasFor: d|AttributeDefinition |
137 |
|
|
@For: ManakaiDOM|DOM |
138 |
|
|
|
139 |
wakaba |
1.1 |
ElementTypeBinding: |
140 |
|
|
@Name: ClsDef |
141 |
|
|
@ElementType: |
142 |
|
|
dis:ResourceDef |
143 |
|
|
@ShadowContent: |
144 |
|
|
@@rdf:type: |
145 |
|
|
@@@@: dis|MultipleResource |
146 |
|
|
@@@ForCheck: !ManakaiDOM|ForIF !ManakaiDOM|ForClass |
147 |
|
|
@@resourceFor: |
148 |
|
|
@@@@: ManakaiDOM|ForClass |
149 |
|
|
@@@ForCheck: ManakaiDOM|ManakaiDOM !=ManakaiDOM|ManakaiDOM |
150 |
|
|
@@For: ManakaiDOM|DOM3 |
151 |
|
|
@@For: =ManakaiDOM|ManakaiDOM |
152 |
|
|
|
153 |
|
|
@@rdf:type: |
154 |
|
|
@@@@: DISLang|Class |
155 |
|
|
@@@ForCheck: ManakaiDOM|ForClass |
156 |
|
|
|
157 |
|
|
ElementTypeBinding: |
158 |
|
|
@Name: ClsQName |
159 |
|
|
@ElementType: |
160 |
|
|
dis:QName |
161 |
|
|
@ShadowContent: |
162 |
|
|
@@ForCheck: ManakaiDOM|ForClass |
163 |
|
|
|
164 |
|
|
ElementTypeBinding: |
165 |
|
|
@Name: ClsISA |
166 |
|
|
@ElementType: |
167 |
|
|
dis:ISA |
168 |
|
|
@ShadowContent: |
169 |
|
|
@@ForCheck: ManakaiDOM|ForClass |
170 |
|
|
|
171 |
|
|
ElementTypeBinding: |
172 |
|
|
@Name: nullCase |
173 |
|
|
@ElementType: |
174 |
|
|
dis:ResourceDef |
175 |
|
|
@ShadowContent: |
176 |
|
|
@@rdf:type: ManakaiDOM|InCase |
177 |
|
|
@@Value: |
178 |
|
|
@@@is-null:1 |
179 |
|
|
|
180 |
|
|
ResourceDef: |
181 |
|
|
@QName: LSParser |
182 |
|
|
@AliasFor: DOMLS|LSParser |
183 |
|
|
@For: ManakaiDOM|DOM3 |
184 |
|
|
|
185 |
|
|
ClsDef: |
186 |
|
|
@ClsQName: ManakaiXMLParser |
187 |
|
|
|
188 |
|
|
@Implement: DOMLS|LSParser |
189 |
|
|
|
190 |
|
|
@f:implements: |
191 |
|
|
@@@: DOMLS|LSFeature30 |
192 |
|
|
@@For: ManakaiDOM|DOM3 |
193 |
|
|
|
194 |
|
|
@DISLang:role: DOMLS|ParserRole |
195 |
|
|
|
196 |
wakaba |
1.3 |
@enDesc: |
197 |
|
|
Note that the <Class::ManakaiXMLParser> reports any XML errors |
198 |
|
|
(syntax errors and / or well-formedness constraint errors) |
199 |
|
|
via the <IF::DOMCore:error-handler> registered to |
200 |
|
|
the <A::DOMLS:LSParser.domConfig> object. Each error has |
201 |
|
|
its <A::DOMCore:DOMError.severity>, either <C::DOMCore:SEVERITY_ERROR> |
202 |
|
|
or <C::DOMCore:SEVERITY_FATAL_ERROR>. However, their semantics |
203 |
|
|
are slight different from the ones of <QUOTE::error> and |
204 |
|
|
<QUOTE::fatal error> in XML; in this implemenetation, |
205 |
|
|
<C::DOMCore:SEVERITY_ERROR> implies that the parsing process |
206 |
|
|
can effectively be continued to detect more errors while |
207 |
|
|
<C::DOMCore:SEVERITY_FATAL_ERROR> implies that the error |
208 |
|
|
is serious so that the result document tree and any errors |
209 |
|
|
might be far from the ones obtained when the error would not |
210 |
|
|
be found. |
211 |
|
|
|
212 |
wakaba |
1.1 |
@Attr: |
213 |
|
|
@@Name: domConfig |
214 |
|
|
@@enDesc: |
215 |
|
|
The configuration of the parser. |
216 |
|
|
|
217 |
|
|
@@Get: |
218 |
|
|
@@@Type: DOMCore|DOMConfiguration |
219 |
|
|
@@@enDesc: The DOM configuration object. |
220 |
|
|
@@@PerlDef: |
221 |
|
|
__CODE{DOMCore|getConfigObject:: |
222 |
|
|
$target => $self, |
223 |
|
|
$targetHash => $self, |
224 |
|
|
$targetType => {<IFName::LSParser>}, |
225 |
|
|
$result => $r, |
226 |
|
|
}__; |
227 |
|
|
|
228 |
|
|
@Method: |
229 |
|
|
@@ManakaiDOM:isForInternal:1 |
230 |
|
|
@@ForCheck: ManakaiDOM|ForClass |
231 |
|
|
@@Operator: DISPerl|NewMethod |
232 |
|
|
@@enDesc: |
233 |
|
|
Creates a new instance of the object. |
234 |
|
|
@@Param: |
235 |
|
|
@@@Name: impl |
236 |
|
|
@@@Type: DOMLS|GLSImplementation |
237 |
|
|
@@@enDesc: |
238 |
|
|
The implementation from which the parser is created. |
239 |
|
|
@@Param: |
240 |
|
|
@@@Name: features |
241 |
|
|
@@@Type: DOMString |
242 |
|
|
@@@dis:actualType: f|FeaturesString |
243 |
|
|
@@@enDesc: |
244 |
|
|
The set of features requested for the parser. |
245 |
|
|
@@Return: |
246 |
|
|
@@@Type: DOMMain|DOMObject |
247 |
|
|
@@@dis:actualType: LSParser |
248 |
|
|
@@@enDesc: |
249 |
|
|
The newly created parser. |
250 |
|
|
@@@PerlDef: |
251 |
|
|
$r = bless { |
252 |
|
|
<H::DOMCore:implementation> => $impl, |
253 |
|
|
}, $self; |
254 |
|
|
|
255 |
|
|
@Method: |
256 |
|
|
@@Name: parseString |
257 |
|
|
@@enImplNote: |
258 |
|
|
Non-standard - to be removed |
259 |
|
|
|
260 |
|
|
@@Param: |
261 |
|
|
@@@Name: sourceText |
262 |
|
|
@@@Type: DOMString |
263 |
|
|
@@Return: |
264 |
|
|
@@@Type: Document |
265 |
|
|
@@@PerlDef: |
266 |
|
|
|
267 |
|
|
$self->{char} = []; |
268 |
|
|
$self->{token} = []; |
269 |
wakaba |
1.6 |
$self->{entity} = [{ |
270 |
|
|
reptxt => \$sourceText, |
271 |
|
|
line => 1, |
272 |
|
|
column => 1, |
273 |
|
|
pos => 0, |
274 |
|
|
}]; |
275 |
|
|
$self->{entity_char} = []; |
276 |
|
|
$self->{entity_token} = []; |
277 |
wakaba |
1.3 |
$self->{xml_version} = '1.0'; |
278 |
|
|
$self->{standalone} = false; |
279 |
wakaba |
1.6 |
$self->{general_entity} = {}; |
280 |
|
|
$self->{param_entity} = {}; |
281 |
|
|
$self->{has_error} = false; |
282 |
wakaba |
1.3 |
## Well-formedness constraint Entity Declared takes effect? |
283 |
wakaba |
1.1 |
|
284 |
|
|
__DEEP{ |
285 |
|
|
$r = $self->_parse_DocumentEntity |
286 |
|
|
($self->{<H::DOMCore:implementation>}); |
287 |
|
|
}__; |
288 |
|
|
|
289 |
|
|
@Method: |
290 |
|
|
@@Name: shiftChar |
291 |
|
|
@@ManakaiDOM:isForInternal:1 |
292 |
|
|
@@ForCheck: ManakaiDOM|ForClass |
293 |
|
|
@@enDesc: |
294 |
|
|
Returns the next character. |
295 |
|
|
@@Return: |
296 |
|
|
@@@Type: idl|long||ManakaiDOM|all |
297 |
|
|
@@@enDesc: |
298 |
|
|
The code position number of the next character, if any, |
299 |
wakaba |
1.6 |
or <CODE::-1>. |
300 |
wakaba |
1.1 |
@@@PerlDef: |
301 |
|
|
if (@{$self->{char}}) { |
302 |
|
|
$r = shift @{$self->{char}}; |
303 |
|
|
} else { |
304 |
wakaba |
1.7 |
no warnings 'substr'; |
305 |
|
|
## substr outside length warnings at the end of the string |
306 |
wakaba |
1.6 |
GETCHAR: { |
307 |
|
|
my $char = substr (${$self->{entity}->[-1]->{reptxt}}, |
308 |
|
|
$self->{entity}->[-1]->{pos}, 1); |
309 |
|
|
$self->{entity}->[-1]->{pos}++; |
310 |
|
|
|
311 |
wakaba |
1.7 |
if (defined $char and length $char) { |
312 |
wakaba |
1.6 |
$r = ord $char; |
313 |
|
|
if ($r == 0x000A) { |
314 |
|
|
$self->{entity}->[-1]->{line}++; |
315 |
|
|
$self->{entity}->[-1]->{column} = 1; |
316 |
|
|
} elsif ($r == 0x000D) { |
317 |
|
|
my $next_char = substr (${$self->{entity}->[-1]->{reptxt}}, |
318 |
|
|
$self->{entity}->[-1]->{pos}, 1); |
319 |
|
|
if ($next_char eq "\x0A") { |
320 |
|
|
$self->{entity}->[-1]->{pos}++; |
321 |
|
|
$self->{entity}->[-1]->{column} = 1; |
322 |
|
|
} elsif ($next_char eq "\x85") { |
323 |
|
|
if ($self->{xml_version} eq '1.1') { |
324 |
|
|
$self->{entity}->[-1]->{pos}++; |
325 |
|
|
$self->{entity}->[-1]->{column} = 1; |
326 |
|
|
} else { |
327 |
|
|
$self->{entity}->[-1]->{column} = 0; |
328 |
|
|
} |
329 |
wakaba |
1.3 |
} else { |
330 |
wakaba |
1.6 |
$self->{entity}->[-1]->{column} = 1; |
331 |
|
|
} |
332 |
|
|
$r = 0x000A; |
333 |
|
|
$self->{entity}->[-1]->{line}++; |
334 |
|
|
} elsif ( |
335 |
|
|
not ((0x0020 <= $r and $r <= 0x007E) or |
336 |
|
|
(0x00A0 <= $r and $r <= 0xD7FF) or |
337 |
|
|
(0xE000 <= $r and $r <= 0xFFFD) or |
338 |
|
|
(0x10000 <= $r and $r <= 0x10FFFF)) and |
339 |
|
|
$r != 0x0009 and $r != 0x0085 and |
340 |
|
|
not ($self->{xml_version} eq '1.0' and |
341 |
|
|
(0x007F <= $r and $r <= 0x009F)) |
342 |
|
|
) { |
343 |
|
|
my $location = { |
344 |
|
|
utf32_offset => $self->{entity}->[-1]->{pos}, |
345 |
|
|
line_number => $self->{entity}->[-1]->{line}, |
346 |
|
|
column_number => $self->{entity}->[-1]->{column}, |
347 |
|
|
}; |
348 |
|
|
my $continue = __DOMCore:ERROR{xp|wf-legal-literal-character:: |
349 |
|
|
DOMCore|location => {$location}, |
350 |
|
|
xp|character-number => {$r}, |
351 |
|
|
}__; |
352 |
|
|
unless ($continue) { |
353 |
|
|
__EXCEPTION{DOMLS|PARSE_ERR}__; |
354 |
wakaba |
1.3 |
} |
355 |
wakaba |
1.6 |
$self->{has_error} = true; |
356 |
|
|
$self->{entity}->[-1]->{column}++; |
357 |
|
|
} elsif ($r == 0x0085 or $r == 0x2028) { |
358 |
|
|
$r = 0x000A if $self->{xml_version} eq '1.1'; |
359 |
|
|
$self->{entity}->[-1]->{line}++; |
360 |
|
|
$self->{entity}->[-1]->{column} = 1; |
361 |
wakaba |
1.3 |
} else { |
362 |
wakaba |
1.6 |
$self->{entity}->[-1]->{column}++; |
363 |
wakaba |
1.3 |
} |
364 |
wakaba |
1.6 |
# } elsif (@{$self->{entity}} > 1) { |
365 |
|
|
# pop @{$self->{entity}}; |
366 |
|
|
# redo GETCHAR; |
367 |
|
|
# ## ISSUE: How cope with delimiter scanning & |
368 |
|
|
# ## self-containedness constraints?? |
369 |
wakaba |
1.3 |
} else { |
370 |
wakaba |
1.6 |
$r = -1; |
371 |
wakaba |
1.3 |
} |
372 |
wakaba |
1.6 |
} # GETCHAR |
373 |
wakaba |
1.1 |
} |
374 |
|
|
|
375 |
|
|
@Method: |
376 |
|
|
@@ManakaiDOM:isForInternal: 1 |
377 |
|
|
@@Operator: ManakaiDOM|MUErrorHandler |
378 |
|
|
@@enDesc: |
379 |
|
|
When a <IF::ecore|ErrorInterface||ManakaiDOM|Perl> is <Perl::report>ed, |
380 |
|
|
then this method is invoked. |
381 |
|
|
|
382 |
|
|
The method calls the <cfg::DOMCore|error-handler> if the error is of |
383 |
|
|
<IF::DOMCore|DOMError>. Otherwise, the error is re-thrown so that |
384 |
|
|
corresponding <Perl::catch> clause, if any, can catch the error. |
385 |
|
|
@@Param: |
386 |
|
|
@@@Name: err |
387 |
|
|
@@@Type: ecore|ErrorInterface||ManakaiDOM|Perl |
388 |
|
|
@@@enDesc: |
389 |
|
|
The reported error object. |
390 |
|
|
@@Return: |
391 |
|
|
@@@Type: DISPerl|Any |
392 |
|
|
@@@enDesc: |
393 |
|
|
If the <P::err> is a <IF::DOMCore|DOMError>, then the return value |
394 |
|
|
of the error handler. |
395 |
|
|
|
396 |
|
|
{NOTE:: If the error is thrown, the method never returns. |
397 |
|
|
} |
398 |
|
|
@@@nullCase: |
399 |
|
|
@@@@enDesc: |
400 |
|
|
No error handler. |
401 |
|
|
@@@PerlDef: |
402 |
|
|
if ($err->isa (<IFName::DOMCore|DOMError||ManakaiDOM|ManakaiDOM>)) { |
403 |
|
|
__DEEP{ |
404 |
|
|
A: { |
405 |
|
|
my $cfg = $self-><AG::LSParser.domConfig>; |
406 |
|
|
my $h = $cfg-><M::DOMCore|DOMConfiguration.getParameter> |
407 |
|
|
('error-handler'); |
408 |
|
|
$r = $h-><M::DOMCore|DOMErrorHandler.handleError> ($err); |
409 |
|
|
} # A |
410 |
|
|
}__; |
411 |
|
|
} else { |
412 |
|
|
$err-><M::ecore|ErrorInterface||ManakaiDOM|Perl.throw>; |
413 |
|
|
} |
414 |
|
|
|
415 |
|
|
@DISPerl:dpgDef: |
416 |
|
|
|
417 |
|
|
/* |
418 |
|
|
XML Document Entity |
419 |
|
|
|
420 |
|
|
document := prolog element *Misc |
421 |
|
|
- *Char RestrictedChar *Char ;; [1] |
422 |
|
|
*/ |
423 |
|
|
rule DocumentEntity ($impl) : standalone { |
424 |
|
|
my $doc : return; |
425 |
|
|
|
426 |
|
|
lang:Perl { |
427 |
|
|
$doc = $impl-><M::DOMImpl.createDocument>; |
428 |
|
|
$doc-><AS::Document.strictErrorChecking> (false); |
429 |
|
|
} |
430 |
|
|
|
431 |
|
|
/* |
432 |
|
|
prolog := XMLDecl? *Misc [doctypedecl *Misc] ;; [22] |
433 |
|
|
*/ |
434 |
|
|
?lexmode 'DocumentStart'; |
435 |
|
|
|
436 |
wakaba |
1.3 |
~? (XDO) { |
437 |
|
|
&_XMLDeclaration_ ($doc => $doc); |
438 |
|
|
|
439 |
|
|
~ (PIC) { |
440 |
|
|
?lexmode DocumentProlog; |
441 |
|
|
} else { |
442 |
|
|
?lexmode DocumentProlog; |
443 |
|
|
} |
444 |
|
|
} else { |
445 |
|
|
?lexmode 'DocumentProlog'; |
446 |
|
|
} |
447 |
wakaba |
1.1 |
|
448 |
|
|
// *Misc |
449 |
wakaba |
1.2 |
~* (CDO) { |
450 |
wakaba |
1.1 |
&_CommentDeclaration_ ($doc => $doc, $parent => $doc); |
451 |
|
|
|
452 |
|
|
~ (MDC) { |
453 |
|
|
?lexmode DocumentProlog; |
454 |
|
|
} else { |
455 |
|
|
?lexmode DocumentProlog; |
456 |
|
|
} |
457 |
|
|
} (PIO) { |
458 |
|
|
&_ProcessingInstruction_ ($doc => $doc, $parent => $doc); |
459 |
|
|
|
460 |
|
|
~ (PIC) { |
461 |
|
|
?lexmode 'DocumentProlog'; |
462 |
|
|
} else { |
463 |
|
|
?lexmode DocumentProlog; |
464 |
|
|
} |
465 |
|
|
} (S) { |
466 |
|
|
// |
467 |
|
|
} |
468 |
|
|
|
469 |
|
|
// doctypedecl |
470 |
|
|
~? (MDO) { |
471 |
|
|
&_DocumentTypeDeclaration_ ($doc => $doc); |
472 |
|
|
|
473 |
wakaba |
1.3 |
~ (MDC) { |
474 |
|
|
?lexmode DocumentMisc; |
475 |
|
|
} else { |
476 |
|
|
?lexmode DocumentMisc; |
477 |
|
|
} |
478 |
|
|
} else { |
479 |
|
|
lang:Perl { |
480 |
|
|
$self->{standalone} = true; |
481 |
|
|
} |
482 |
|
|
?lexmode DocumentMisc; |
483 |
wakaba |
1.1 |
} |
484 |
|
|
|
485 |
|
|
// *Misc |
486 |
wakaba |
1.2 |
~* (CDO) { |
487 |
wakaba |
1.1 |
&_CommentDeclaration_ ($doc => $doc, $parent => $doc); |
488 |
|
|
|
489 |
|
|
~ (MDC) { |
490 |
|
|
?lexmode DocumentMisc; |
491 |
|
|
} else { |
492 |
|
|
?lexmode DocumentMisc; |
493 |
|
|
} |
494 |
|
|
} (PIO) { |
495 |
|
|
&_ProcessingInstruction_ ($doc => $doc, $parent => $doc); |
496 |
|
|
|
497 |
|
|
~ (PIC) { |
498 |
|
|
?lexmode 'DocumentMisc'; |
499 |
|
|
} else { |
500 |
|
|
?lexmode DocumentMisc; |
501 |
|
|
} |
502 |
|
|
} (S) { |
503 |
|
|
// |
504 |
|
|
} |
505 |
|
|
|
506 |
|
|
// Document element |
507 |
|
|
~ (STAGO) { |
508 |
|
|
&Element_ ($doc => $doc, $parent => $doc) |
509 |
|
|
: unshift-current-token; |
510 |
|
|
~ (TAGC) { |
511 |
|
|
?lexmode DocumentEnd; |
512 |
|
|
} else { |
513 |
|
|
?lexmode DocumentEnd; |
514 |
|
|
} |
515 |
|
|
} else { |
516 |
|
|
?lexmode 'DocumentEnd'; |
517 |
|
|
} |
518 |
|
|
|
519 |
|
|
// *Misc |
520 |
wakaba |
1.2 |
~* (CDO) { |
521 |
wakaba |
1.1 |
&_CommentDeclaration_ ($doc => $doc, $parent => $doc); |
522 |
|
|
|
523 |
|
|
~ (MDC) { |
524 |
|
|
?lexmode DocumentEnd; |
525 |
|
|
} else { |
526 |
|
|
?lexmode DocumentEnd; |
527 |
|
|
} |
528 |
|
|
} (PIO) { |
529 |
|
|
&_ProcessingInstruction_ ($doc => $doc, $parent => $doc); |
530 |
|
|
~ (PIC) { |
531 |
|
|
?lexmode 'DocumentEnd'; |
532 |
|
|
} else { |
533 |
|
|
?lexmode DocumentEnd; |
534 |
|
|
} |
535 |
|
|
} (S) { |
536 |
|
|
// |
537 |
|
|
} |
538 |
|
|
|
539 |
|
|
~ (#EOF) { } |
540 |
|
|
|
541 |
|
|
lang:Perl { |
542 |
|
|
if ($self->{has_error}) { |
543 |
|
|
__EXCEPTION{DOMLS|PARSE_ERR:: |
544 |
|
|
}__; |
545 |
|
|
} |
546 |
|
|
|
547 |
|
|
$doc-><AS::Document.strictErrorChecking> (true); |
548 |
|
|
} |
549 |
|
|
} // DocumentEntity |
550 |
|
|
|
551 |
|
|
/* |
552 |
|
|
XML Declaration |
553 |
|
|
|
554 |
|
|
XMLDecl := '<?xml' VersionInfo |
555 |
|
|
[EncodingDecl] |
556 |
|
|
[SDDecl] |
557 |
|
|
[S] '?>' ;; [23] |
558 |
|
|
|
559 |
|
|
NOTE: XML declaration is optional in XML 1.0 |
560 |
|
|
while it is required in XML 1.1. |
561 |
|
|
*/ |
562 |
wakaba |
1.3 |
rule _XMLDeclaration_ ($doc) { |
563 |
|
|
?lexmode XMLDeclaration; |
564 |
|
|
|
565 |
|
|
~ (S) { } |
566 |
|
|
|
567 |
|
|
~ (Name == 'version') { |
568 |
|
|
~? (S) { } |
569 |
|
|
~ (VI) { } |
570 |
|
|
~? (S) { } |
571 |
wakaba |
1.1 |
|
572 |
wakaba |
1.3 |
my $ver; |
573 |
|
|
my $bad_token; |
574 |
|
|
|
575 |
|
|
~ (LIT) { |
576 |
|
|
?lexmode AttributeValueLiteral; |
577 |
|
|
|
578 |
|
|
~ (STRING) { |
579 |
|
|
lang:Perl ($version => $token.value) { |
580 |
|
|
$ver = $version; |
581 |
|
|
$bad_token = $token; |
582 |
|
|
} |
583 |
|
|
} |
584 |
|
|
|
585 |
|
|
~ (LIT) { |
586 |
|
|
?lexmode XMLDeclaration; |
587 |
|
|
} |
588 |
|
|
} (LITA) { |
589 |
|
|
?lexmode AttributeValueLiteralA; |
590 |
|
|
|
591 |
|
|
~ (STRING) { |
592 |
|
|
lang:Perl ($version => $token.value) { |
593 |
|
|
$ver = $version; |
594 |
|
|
$bad_token = $token; |
595 |
|
|
} |
596 |
|
|
} |
597 |
|
|
|
598 |
|
|
~ (LITA) { |
599 |
|
|
?lexmode XMLDeclaration; |
600 |
|
|
} |
601 |
|
|
} |
602 |
|
|
|
603 |
|
|
lang:Perl : has-error { |
604 |
|
|
unless ($ver eq '1.0' or $ver eq '1.1') { |
605 |
|
|
my $location; |
606 |
|
|
__CODE{xp|get-location-from-token:: |
607 |
|
|
$token => {$bad_token}, |
608 |
|
|
$result => {$location}, |
609 |
|
|
}__; |
610 |
|
|
my $continue = __DOMCore:ERROR{xp|wf-unsupported-xml-version:: |
611 |
|
|
DOMCore|location => {$location}, |
612 |
|
|
xp|parent => {$doc}, |
613 |
|
|
infoset|version => {$ver}, |
614 |
|
|
xp|error-token => {$bad_token}, |
615 |
|
|
}__; |
616 |
|
|
unless ($continue) { |
617 |
|
|
__EXCEPTION{DOMLS|PARSE_ERR}__; |
618 |
|
|
} |
619 |
|
|
$self->{has_error} = true; |
620 |
|
|
} |
621 |
|
|
$doc-><AS::Document.xmlVersion> ($ver); |
622 |
|
|
$self->{xml_version} = $ver; |
623 |
|
|
} |
624 |
|
|
|
625 |
|
|
~? (S) { } |
626 |
wakaba |
1.1 |
} |
627 |
|
|
|
628 |
wakaba |
1.3 |
~? (Name == 'encoding') { |
629 |
|
|
~? (S) { } |
630 |
|
|
~ (VI) { } |
631 |
|
|
~? (S) { } |
632 |
|
|
|
633 |
|
|
my $ver; |
634 |
|
|
my $bad_token; |
635 |
|
|
|
636 |
|
|
~ (LIT) { |
637 |
|
|
?lexmode AttributeValueLiteral; |
638 |
|
|
|
639 |
|
|
~ (STRING) { |
640 |
|
|
lang:Perl ($version => $token.value) { |
641 |
|
|
$ver = $version; |
642 |
|
|
$bad_token = $token; |
643 |
|
|
} |
644 |
|
|
} |
645 |
|
|
|
646 |
|
|
~ (LIT) { |
647 |
|
|
?lexmode XMLDeclaration; |
648 |
|
|
} |
649 |
|
|
} (LITA) { |
650 |
|
|
?lexmode AttributeValueLiteralA; |
651 |
|
|
|
652 |
|
|
~ (STRING) { |
653 |
|
|
lang:Perl ($version => $token.value) { |
654 |
|
|
$ver = $version; |
655 |
|
|
$bad_token = $token; |
656 |
|
|
} |
657 |
|
|
} |
658 |
|
|
|
659 |
|
|
~ (LITA) { |
660 |
|
|
?lexmode XMLDeclaration; |
661 |
|
|
} |
662 |
|
|
} |
663 |
|
|
|
664 |
|
|
lang:Perl : has-error { |
665 |
|
|
unless ($ver =~ /\A[A-Za-z][A-Za-z0-9._-]*\z/) { |
666 |
|
|
my $location; |
667 |
|
|
__CODE{xp|get-location-from-token:: |
668 |
|
|
$token => {$bad_token}, |
669 |
|
|
$result => {$location}, |
670 |
|
|
}__; |
671 |
|
|
my $continue = __DOMCore:ERROR{xp|wf-malformed-enc-name:: |
672 |
|
|
DOMCore|location => {$location}, |
673 |
|
|
xp|parent => {$doc}, |
674 |
|
|
xp|name => {$ver}, |
675 |
|
|
xp|error-token => {$bad_token}, |
676 |
|
|
}__; |
677 |
|
|
unless ($continue) { |
678 |
|
|
__EXCEPTION{DOMLS|PARSE_ERR}__; |
679 |
|
|
} |
680 |
|
|
$self->{has_error} = true; |
681 |
|
|
} |
682 |
|
|
$doc-><AS::Document.xmlEncoding> ($ver); |
683 |
|
|
} |
684 |
|
|
|
685 |
|
|
~? (S) { } |
686 |
wakaba |
1.1 |
} |
687 |
wakaba |
1.3 |
|
688 |
|
|
~? (Name == 'standalone') { |
689 |
|
|
~? (S) { } |
690 |
|
|
~ (VI) { } |
691 |
|
|
~? (S) { } |
692 |
|
|
|
693 |
|
|
my $ver; |
694 |
|
|
my $bad_token; |
695 |
|
|
|
696 |
|
|
~ (LIT) { |
697 |
|
|
?lexmode AttributeValueLiteral; |
698 |
|
|
|
699 |
|
|
~ (STRING) { |
700 |
|
|
lang:Perl ($version => $token.value) { |
701 |
|
|
$ver = $version; |
702 |
|
|
$bad_token = $token; |
703 |
|
|
} |
704 |
|
|
} |
705 |
|
|
|
706 |
|
|
~ (LIT) { |
707 |
|
|
?lexmode XMLDeclaration; |
708 |
|
|
} |
709 |
|
|
} (LITA) { |
710 |
|
|
?lexmode AttributeValueLiteralA; |
711 |
|
|
|
712 |
|
|
~ (STRING) { |
713 |
|
|
lang:Perl ($version => $token.value) { |
714 |
|
|
$ver = $version; |
715 |
|
|
$bad_token = $token; |
716 |
|
|
} |
717 |
|
|
} |
718 |
wakaba |
1.1 |
|
719 |
wakaba |
1.3 |
~ (LITA) { |
720 |
|
|
?lexmode XMLDeclaration; |
721 |
|
|
} |
722 |
|
|
} |
723 |
|
|
|
724 |
|
|
lang:Perl : has-error { |
725 |
|
|
unless ($ver eq 'yes' or $ver eq 'no') { |
726 |
|
|
my $location; |
727 |
|
|
__CODE{xp|get-location-from-token:: |
728 |
|
|
$token => {$bad_token}, |
729 |
|
|
$result => {$location}, |
730 |
|
|
}__; |
731 |
|
|
my $continue = __DOMCore:ERROR{xp|wf-malformed-xml-standalone:: |
732 |
|
|
DOMCore|location => {$location}, |
733 |
|
|
xp|parent => {$doc}, |
734 |
|
|
xp|name => {$ver}, |
735 |
|
|
xp|error-token => {$bad_token}, |
736 |
|
|
}__; |
737 |
|
|
unless ($continue) { |
738 |
|
|
__EXCEPTION{DOMLS|PARSE_ERR}__; |
739 |
|
|
} |
740 |
|
|
$self->{has_error} = true; |
741 |
|
|
} |
742 |
|
|
$doc-><AS::Document.xmlStandalone> ($ver); |
743 |
|
|
$self->{standalone} = true if $ver eq 'yes'; |
744 |
|
|
} |
745 |
|
|
|
746 |
|
|
~? (S) { } |
747 |
|
|
} |
748 |
|
|
|
749 |
|
|
// ~ (PIC) { } |
750 |
|
|
} // _XMLDeclaration_ |
751 |
wakaba |
1.1 |
|
752 |
|
|
/* |
753 |
|
|
Comment Declaration |
754 |
|
|
|
755 |
|
|
Comment := '<!--' *(Char - '-' / '-' (Char - '-')) |
756 |
|
|
'-->' ;; [15] |
757 |
wakaba |
1.4 |
*/ |
758 |
wakaba |
1.1 |
rule _CommentDeclaration_ ($doc, $parent) { |
759 |
|
|
?lexmode 'CommentDeclaration'; |
760 |
|
|
|
761 |
|
|
~? (STRING) { |
762 |
|
|
lang:Perl ($data => $token.value) { |
763 |
|
|
my $com = $doc-><M::Document.createComment> ($data); |
764 |
|
|
$parent-><M::Node.appendChild> ($com); |
765 |
|
|
} |
766 |
|
|
} else { |
767 |
|
|
lang:Perl { |
768 |
|
|
my $com = $doc-><M::Document.createComment> (''); |
769 |
|
|
$parent-><M::Node.appendChild> ($com); |
770 |
|
|
} |
771 |
|
|
} |
772 |
|
|
|
773 |
|
|
~ (COM) { |
774 |
|
|
?lexmode MarkupDeclaration; |
775 |
|
|
} else { |
776 |
|
|
?lexmode MarkupDeclaration; |
777 |
|
|
} |
778 |
|
|
|
779 |
|
|
// ~ (MDC) { } |
780 |
wakaba |
1.4 |
} // _CommentDeclaration |
781 |
|
|
_ |
782 |
|
|
rule _CommentDeclarationDTD ($doc) { |
783 |
|
|
?lexmode 'CommentDeclaration'; |
784 |
|
|
|
785 |
|
|
~? (STRING) { |
786 |
|
|
// |
787 |
|
|
} |
788 |
|
|
|
789 |
|
|
~ (COM) { |
790 |
|
|
?lexmode MarkupDeclaration; |
791 |
|
|
} else { |
792 |
|
|
?lexmode MarkupDeclaration; |
793 |
|
|
} |
794 |
|
|
|
795 |
|
|
~ (MDC) { |
796 |
|
|
?lexmode DTD; |
797 |
|
|
} else { |
798 |
|
|
?lexmode DTD; |
799 |
|
|
} |
800 |
|
|
} // _CommentDeclarationDTD |
801 |
|
|
|
802 |
wakaba |
1.1 |
/* |
803 |
|
|
Processing Instruction |
804 |
|
|
|
805 |
|
|
PI := '<?' PITarget [S *Char - *Char '?>' *Char] |
806 |
|
|
'?>' ;; [16] |
807 |
|
|
*/ |
808 |
|
|
rule _ProcessingInstruction_ ($doc, $parent) { |
809 |
|
|
?lexmode 'PIName'; |
810 |
|
|
|
811 |
|
|
my $pi; |
812 |
|
|
|
813 |
|
|
~ (Name) { |
814 |
wakaba |
1.3 |
lang:Perl ($name => $token.value) : has-error { |
815 |
wakaba |
1.1 |
if (lc $name eq 'xml') { |
816 |
wakaba |
1.3 |
my $location; |
817 |
|
|
__CODE{xp|get-location-from-token:: |
818 |
|
|
$token => {$token}, |
819 |
|
|
$result => {$location}, |
820 |
|
|
}__; |
821 |
|
|
my $continue = __DOMCore:ERROR{xp|wf-pi-target-is-xml:: |
822 |
|
|
xp|name => {$name}, |
823 |
|
|
DOMCore|location => {$location}, |
824 |
|
|
xp|parent => {$parent}, |
825 |
|
|
}__; |
826 |
|
|
unless ($continue) { |
827 |
|
|
__EXCEPTION{DOMLS|PARSE_ERR:: |
828 |
|
|
}__; |
829 |
|
|
} |
830 |
|
|
$self->{has_error} = true; |
831 |
wakaba |
1.1 |
} |
832 |
|
|
## TODO: Namespace well-formedness |
833 |
|
|
$pi = $doc-><M::Document.createProcessingInstruction> |
834 |
|
|
($name); |
835 |
|
|
} |
836 |
|
|
} |
837 |
|
|
|
838 |
|
|
~ (S) { |
839 |
|
|
?lexmode 'PIData'; |
840 |
|
|
|
841 |
|
|
my $tdata; |
842 |
|
|
|
843 |
|
|
~? (DATA) { |
844 |
|
|
lang:Perl ($data => $token.value) { |
845 |
|
|
$tdata = $data; |
846 |
|
|
} |
847 |
|
|
} else { |
848 |
|
|
lang:Perl { |
849 |
|
|
$tdata = ''; |
850 |
|
|
} |
851 |
|
|
} |
852 |
|
|
|
853 |
|
|
lang:Perl { |
854 |
|
|
$pi-><AS::Node.nodeValue> ($tdata); |
855 |
|
|
} |
856 |
|
|
} |
857 |
|
|
|
858 |
|
|
lang:Perl { |
859 |
|
|
$parent-><M::Node.appendChild> ($pi); |
860 |
|
|
} |
861 |
|
|
|
862 |
|
|
// ~ (PIC) { } |
863 |
|
|
} // _ProcessingInstruction_ |
864 |
wakaba |
1.4 |
|
865 |
wakaba |
1.6 |
/* |
866 |
|
|
Processing instruction in DTD |
867 |
|
|
*/ |
868 |
|
|
rule _ProcessingInstructionDTD ($doc, $doctype) { |
869 |
wakaba |
1.4 |
?lexmode 'PIName'; |
870 |
wakaba |
1.6 |
|
871 |
|
|
my $pi; |
872 |
wakaba |
1.4 |
|
873 |
|
|
~ (Name) { |
874 |
wakaba |
1.6 |
lang:Perl ($name => $token.value) : has-error { |
875 |
|
|
if (lc $name eq 'xml') { |
876 |
|
|
my $location; |
877 |
|
|
__CODE{xp|get-location-from-token:: |
878 |
|
|
$token => {$token}, |
879 |
|
|
$result => {$location}, |
880 |
|
|
}__; |
881 |
|
|
my $continue = __DOMCore:ERROR{xp|wf-pi-target-is-xml:: |
882 |
|
|
xp|name => {$name}, |
883 |
|
|
DOMCore|location => {$location}, |
884 |
|
|
xp|parent => {$doctype}, |
885 |
|
|
}__; |
886 |
|
|
unless ($continue) { |
887 |
|
|
__EXCEPTION{DOMLS|PARSE_ERR:: |
888 |
|
|
}__; |
889 |
|
|
} |
890 |
|
|
$self->{has_error} = true; |
891 |
|
|
} |
892 |
|
|
## TODO: Namespace well-formedness |
893 |
|
|
$pi = $doc-><M::Document.createProcessingInstruction> |
894 |
|
|
($name); |
895 |
|
|
} |
896 |
wakaba |
1.4 |
} |
897 |
|
|
|
898 |
|
|
~ (S) { |
899 |
|
|
?lexmode 'PIData'; |
900 |
|
|
|
901 |
wakaba |
1.6 |
my $tdata; |
902 |
|
|
|
903 |
wakaba |
1.4 |
~? (DATA) { |
904 |
wakaba |
1.6 |
lang:Perl ($data => $token.value) { |
905 |
|
|
$tdata = $data; |
906 |
|
|
} |
907 |
|
|
} else { |
908 |
|
|
lang:Perl { |
909 |
|
|
$tdata = ''; |
910 |
|
|
} |
911 |
|
|
} |
912 |
|
|
|
913 |
|
|
lang:Perl { |
914 |
|
|
$pi-><AS::Node.nodeValue> ($tdata); |
915 |
wakaba |
1.4 |
} |
916 |
|
|
} |
917 |
|
|
|
918 |
wakaba |
1.6 |
lang:Perl { |
919 |
|
|
$doctype-><M::Node.appendChild> ($pi); |
920 |
|
|
} |
921 |
|
|
|
922 |
wakaba |
1.4 |
~ (PIC) { |
923 |
|
|
?lexmode DTD; |
924 |
|
|
} else { |
925 |
|
|
?lexmode DTD; |
926 |
|
|
} |
927 |
|
|
} // _ProcessingInstructionDTD |
928 |
wakaba |
1.1 |
|
929 |
|
|
/* |
930 |
|
|
Element content parsing mode |
931 |
|
|
|
932 |
|
|
element := EmptyElemTag / |
933 |
|
|
STag content ETag ;; [39] |
934 |
|
|
content := (CharData / element / Reference / CDSect / |
935 |
|
|
PI / Comment) ;; [43] |
936 |
|
|
*/ |
937 |
wakaba |
1.6 |
rule Element_ ($doc, $parent, $ns) : standalone { |
938 |
wakaba |
1.1 |
?lexmode 'ElementContent'; |
939 |
|
|
|
940 |
|
|
my $node; // Current "parent" node |
941 |
|
|
my $nodes; // Node stack (w/o $current_node) |
942 |
|
|
my $type; // Current "parent" element type QName |
943 |
|
|
my $types; // Element type stack (w/o $current_type) |
944 |
wakaba |
1.6 |
//my $ns; // Current in-scope namespace bindings |
945 |
wakaba |
1.1 |
my $nses; // Namespace binding stack (w/o $current_ns) |
946 |
|
|
|
947 |
|
|
lang:Perl { |
948 |
|
|
$node = $parent; |
949 |
|
|
$nodes = []; |
950 |
|
|
$type = ''; |
951 |
|
|
$types = []; |
952 |
wakaba |
1.6 |
$ns ||= { |
953 |
wakaba |
1.1 |
xml => <Q::xml:>, |
954 |
|
|
xmlns => <Q::xmlns:>, |
955 |
|
|
}; |
956 |
|
|
$nses = []; |
957 |
|
|
} |
958 |
|
|
|
959 |
|
|
~* : name => CONTENT |
960 |
|
|
(CharData) { |
961 |
|
|
// Character data |
962 |
|
|
lang:Perl ($data => $token.value) { |
963 |
|
|
$node-><M::Node.appendChild> |
964 |
|
|
($doc-><M::Document.createTextNode> ($data)); |
965 |
|
|
} |
966 |
|
|
} (STAGO) { |
967 |
|
|
// Start tag or empty element tag |
968 |
|
|
|
969 |
|
|
?lexmode 'StartTag'; |
970 |
|
|
|
971 |
|
|
~ (Name) { |
972 |
|
|
my $attrs; |
973 |
|
|
lang:Perl ($name => $token.value) { |
974 |
|
|
push @{$types}, $type; |
975 |
|
|
$type = $name; |
976 |
|
|
$attrs = {}; |
977 |
|
|
} |
978 |
|
|
|
979 |
|
|
~? (S) { |
980 |
|
|
&AttributeSpecificationList |
981 |
|
|
($doc => $doc, $attrs => $attrs); |
982 |
|
|
} |
983 |
|
|
|
984 |
|
|
my $el; |
985 |
|
|
|
986 |
|
|
lang:Perl { |
987 |
|
|
push @{$nses}, $ns; |
988 |
|
|
$ns = {%$ns}; |
989 |
|
|
|
990 |
|
|
my %gattr; |
991 |
|
|
my %lattr; |
992 |
|
|
for my $atqname (keys %$attrs) { |
993 |
|
|
my ($pfx, $lname) = split /:/, $atqname; |
994 |
|
|
if (defined $lname) { ## Global attribute |
995 |
|
|
## TODO: Namespace well-formedness (lname is NCName) |
996 |
|
|
if ($pfx eq 'xmlns') { |
997 |
|
|
my $nsuri = $attrs->{$atqname}->{value}; |
998 |
|
|
if ($lname eq 'xml' and |
999 |
|
|
$nsuri ne <Q::xml:>) { |
1000 |
|
|
## TODO: error |
1001 |
|
|
} elsif ($lname eq 'xmlns') { |
1002 |
|
|
## TODO: error |
1003 |
|
|
} |
1004 |
|
|
if ($nsuri eq '') { |
1005 |
|
|
## TODO: error in XML 1.0 |
1006 |
|
|
} elsif ($nsuri eq <Q::xml:> and |
1007 |
|
|
$lname ne 'xml') { |
1008 |
|
|
## TODO: error |
1009 |
|
|
} elsif ($nsuri eq <Q::xmlns:>) { |
1010 |
|
|
## TODO: error |
1011 |
|
|
} |
1012 |
|
|
$ns->{$lname} = $attrs->{$atqname}->{value}; |
1013 |
|
|
delete $ns->{$lname} unless length $ns->{$lname}; |
1014 |
|
|
} elsif ($pfx eq '') { |
1015 |
|
|
## TODO: pfx is not NCName error |
1016 |
|
|
} else { |
1017 |
|
|
if ($gattr{$pfx}->{$lname}) { |
1018 |
|
|
## TODO: Namespace well-formedness error |
1019 |
|
|
} |
1020 |
|
|
} |
1021 |
|
|
$gattr{$pfx}->{$lname} = $attrs->{$atqname}; |
1022 |
|
|
} else { ## Local attribute |
1023 |
|
|
if ($pfx eq 'xmlns') { |
1024 |
|
|
$ns->{''} = $attrs->{xmlns}->{value}; |
1025 |
|
|
delete $ns->{''} unless length $ns->{''}; |
1026 |
|
|
} else { |
1027 |
|
|
$lattr{$pfx} = $attrs->{$atqname}; |
1028 |
|
|
} |
1029 |
|
|
} |
1030 |
|
|
} |
1031 |
|
|
|
1032 |
|
|
my ($pfx, $lname) = split /:/, $type; |
1033 |
|
|
my $nsuri; |
1034 |
|
|
## TODO: lname is NCName? |
1035 |
|
|
if (defined $lname) { ## Prefixed namespace |
1036 |
|
|
if ($pfx eq '') { |
1037 |
|
|
## TODO: pfx is not NCName error |
1038 |
|
|
} |
1039 |
|
|
if (defined $ns->{$pfx}) { |
1040 |
|
|
$nsuri = $ns->{$pfx}; |
1041 |
|
|
} else { |
1042 |
|
|
## TODO: namespace ill-formed |
1043 |
|
|
} |
1044 |
|
|
} else { ## Default namespace |
1045 |
|
|
$nsuri = $ns->{''}; |
1046 |
|
|
} |
1047 |
|
|
|
1048 |
|
|
$el = $doc-><M::Document.createElementNS> |
1049 |
|
|
($nsuri, $type); |
1050 |
|
|
|
1051 |
|
|
if ($attrs->{xmlns}) { |
1052 |
|
|
my $attr = $doc-><M::Document.createAttributeNS> |
1053 |
|
|
(<Q::xmlns:>, 'xmlns'); |
1054 |
|
|
for (@{$attrs->{xmlns}->{nodes}}) { |
1055 |
|
|
$attr-><M::Node.appendChild> ($_); |
1056 |
|
|
} |
1057 |
|
|
$el-><M::Element.setAttributeNodeNS> ($attr); |
1058 |
|
|
} |
1059 |
|
|
|
1060 |
|
|
for my $lname (keys %lattr) { |
1061 |
|
|
my $attr = $doc-><M::Document.createAttributeNS> |
1062 |
|
|
(null, $lname); |
1063 |
|
|
for (@{$lattr{$lname}->{nodes}}) { |
1064 |
|
|
$attr-><M::Node.appendChild> ($_); |
1065 |
|
|
} |
1066 |
|
|
$el-><M::Element.setAttributeNodeNS> ($attr); |
1067 |
|
|
} |
1068 |
|
|
|
1069 |
|
|
for my $pfx (keys %gattr) { |
1070 |
|
|
for my $lname (keys %{$gattr{$pfx}}) { |
1071 |
|
|
my $attr = $doc-><M::Document.createAttributeNS> |
1072 |
|
|
($ns->{$pfx}, $pfx.':'.$lname); |
1073 |
|
|
for (@{$gattr{$pfx}->{$lname}->{nodes}}) { |
1074 |
|
|
$attr-><M::Node.appendChild> ($_); |
1075 |
|
|
} |
1076 |
|
|
$el-><M::Element.setAttributeNodeNS> ($attr); |
1077 |
|
|
} |
1078 |
|
|
} |
1079 |
|
|
|
1080 |
|
|
$node-><M::Node.appendChild> ($el); |
1081 |
|
|
} |
1082 |
|
|
|
1083 |
|
|
~ (TAGC) { |
1084 |
|
|
lang:Perl { |
1085 |
|
|
push @{$nodes}, $node; |
1086 |
|
|
$node = $el; |
1087 |
|
|
} |
1088 |
|
|
?lexmode ElementContent; |
1089 |
wakaba |
1.6 |
} (NESTC) { |
1090 |
|
|
my $is_docel; |
1091 |
wakaba |
1.1 |
lang:Perl { |
1092 |
|
|
$ns = pop @{$nses}; |
1093 |
|
|
$type = pop @{$types}; |
1094 |
wakaba |
1.6 |
$is_docel = (@{$types} == 0); |
1095 |
|
|
} |
1096 |
|
|
|
1097 |
|
|
if-true ($is_docel) { |
1098 |
|
|
return; |
1099 |
|
|
} |
1100 |
|
|
|
1101 |
|
|
~ (TAGC) { |
1102 |
|
|
?lexmode ElementContent; |
1103 |
|
|
} else { |
1104 |
|
|
?lexmode ElementContent; |
1105 |
wakaba |
1.1 |
} |
1106 |
|
|
} else { |
1107 |
|
|
?lexmode ElementContent; |
1108 |
|
|
} |
1109 |
|
|
} else { |
1110 |
|
|
?lexmode ElementContent; |
1111 |
|
|
} |
1112 |
|
|
|
1113 |
|
|
} (ETAGO) { |
1114 |
|
|
// End tag |
1115 |
|
|
|
1116 |
|
|
?lexmode 'EndTag'; |
1117 |
|
|
|
1118 |
|
|
my $is_docel; |
1119 |
|
|
|
1120 |
|
|
~ (Name) { |
1121 |
wakaba |
1.3 |
lang:Perl ($name => $token.value) : has-error { |
1122 |
wakaba |
1.1 |
if ($name eq $type) { |
1123 |
|
|
$type = pop @{$types}; |
1124 |
|
|
if ($type eq '') { |
1125 |
|
|
$is_docel = true; |
1126 |
|
|
} |
1127 |
|
|
$node = pop @{$nodes}; |
1128 |
|
|
$ns = pop @{$nses}; |
1129 |
|
|
} else { |
1130 |
wakaba |
1.3 |
my $location; |
1131 |
|
|
__CODE{xp|get-location-from-token:: |
1132 |
|
|
$token => $token, |
1133 |
|
|
$result => $location, |
1134 |
|
|
}__; |
1135 |
|
|
my $continue = __DOMCore:ERROR{xp|wf-element-type-match:: |
1136 |
|
|
DOMCore:location => {$location}, |
1137 |
|
|
xp|token => {$token}, |
1138 |
|
|
xp|expected-element-type => {$type}, |
1139 |
|
|
xp|actual-element-type => {$name}, |
1140 |
|
|
xp|node => {$node}, |
1141 |
|
|
}__; |
1142 |
|
|
unless ($continue) { |
1143 |
|
|
__EXCEPTION{DOMLS|PARSE_ERR}__; |
1144 |
|
|
} |
1145 |
|
|
$self->{has_error} = true; |
1146 |
wakaba |
1.1 |
} |
1147 |
|
|
} |
1148 |
|
|
} |
1149 |
|
|
|
1150 |
|
|
~? (S) { } |
1151 |
|
|
|
1152 |
|
|
if-true ($is_docel) { |
1153 |
wakaba |
1.3 |
lang:Perl : has-error { |
1154 |
wakaba |
1.1 |
if (@{$types}) { |
1155 |
wakaba |
1.3 |
my $location; |
1156 |
|
|
__CODE{xp|get-location-from-token:: |
1157 |
|
|
$token => $token, |
1158 |
|
|
$result => $location, |
1159 |
|
|
}__; |
1160 |
|
|
for my $type (reverse @{$types}) { |
1161 |
|
|
my $continue = __DOMCore:ERROR{xp|wf-no-end-tag:: |
1162 |
|
|
DOMCore:location => {$location}, |
1163 |
|
|
xp|token => {$token}, |
1164 |
|
|
xp|expected-element-type => {$type}, |
1165 |
|
|
xp|node => {$node}, |
1166 |
|
|
}__; |
1167 |
|
|
unless ($continue) { |
1168 |
|
|
__EXCEPTION{DOMLS|PARSE_ERR}__; |
1169 |
|
|
} |
1170 |
|
|
$node = shift @{$nodes}; |
1171 |
|
|
} |
1172 |
|
|
$self->{has_error} = true; |
1173 |
wakaba |
1.1 |
} |
1174 |
|
|
} |
1175 |
|
|
return; |
1176 |
|
|
} |
1177 |
|
|
|
1178 |
|
|
~ (TAGC) { |
1179 |
|
|
?lexmode ElementContent; |
1180 |
|
|
} else { |
1181 |
|
|
?lexmode 'ElementContent'; |
1182 |
|
|
} |
1183 |
|
|
|
1184 |
|
|
} (HCRO) { |
1185 |
|
|
&_HexadecimalCharacterReference_ |
1186 |
|
|
($doc => $doc, $parent => $node); |
1187 |
|
|
|
1188 |
|
|
~ (REFC) { |
1189 |
|
|
?lexmode 'ElementContent'; |
1190 |
|
|
} else { |
1191 |
|
|
?lexmode ElementContent; |
1192 |
|
|
} |
1193 |
|
|
} (CRO) { |
1194 |
|
|
&_NumericCharacterReference_ |
1195 |
|
|
($doc => $doc, $parent => $node); |
1196 |
|
|
|
1197 |
|
|
~ (REFC) { |
1198 |
|
|
?lexmode 'ElementContent'; |
1199 |
|
|
} else { |
1200 |
|
|
?lexmode ElementContent; |
1201 |
|
|
} |
1202 |
|
|
} (ERO) { |
1203 |
wakaba |
1.6 |
&_GeneralEntityReferenceEC |
1204 |
|
|
($doc => $doc, $parent => $node, $ns => $ns); |
1205 |
wakaba |
1.1 |
} (CDO) { |
1206 |
|
|
&_CommentDeclaration_ ($doc => $doc, $parent => $node); |
1207 |
|
|
|
1208 |
|
|
~ (MDC) { |
1209 |
|
|
?lexmode ElementContent; |
1210 |
|
|
} else { |
1211 |
|
|
?lexmode ElementContent; |
1212 |
|
|
} |
1213 |
|
|
} (CDSO) { |
1214 |
|
|
&_CDATASection_ ($doc => $doc, $parent => $node); |
1215 |
|
|
|
1216 |
|
|
~ (MSE) { |
1217 |
|
|
?lexmode 'ElementContent'; |
1218 |
|
|
} else { |
1219 |
|
|
?lexmode ElementContent; |
1220 |
|
|
} |
1221 |
|
|
} (PIO) { |
1222 |
|
|
&_ProcessingInstruction_ ($doc => $doc, $parent => $node); |
1223 |
|
|
|
1224 |
|
|
~ (PIC) { |
1225 |
|
|
?lexmode 'ElementContent'; |
1226 |
|
|
} else { |
1227 |
|
|
?lexmode ElementContent; |
1228 |
|
|
} |
1229 |
|
|
} |
1230 |
wakaba |
1.3 |
|
1231 |
|
|
~ (#NONE) { } |
1232 |
wakaba |
1.1 |
} // Element_ |
1233 |
|
|
|
1234 |
|
|
rule AttributeSpecificationList ($doc, $attrs) |
1235 |
|
|
: standalone |
1236 |
|
|
{ |
1237 |
|
|
?lexmode 'StartTag'; |
1238 |
|
|
|
1239 |
|
|
my $i; |
1240 |
|
|
lang:Perl { |
1241 |
|
|
$i = 0; |
1242 |
|
|
} |
1243 |
|
|
|
1244 |
|
|
~* (Name) { |
1245 |
|
|
my $atqname; |
1246 |
|
|
lang:Perl ($name => $token.value) { |
1247 |
|
|
$atqname = $name; |
1248 |
|
|
} |
1249 |
|
|
|
1250 |
|
|
my $vals; |
1251 |
|
|
lang:Perl { |
1252 |
|
|
if ($attrs->{$atqname}) { |
1253 |
wakaba |
1.3 |
my $location; |
1254 |
|
|
__CODE{xp|get-location-from-token:: |
1255 |
|
|
$token => $token, |
1256 |
|
|
$result => $location, |
1257 |
|
|
}__; |
1258 |
|
|
my $continue = __DOMCore:ERROR{xp|wf-unique-att-spec:: |
1259 |
|
|
DOMCore:location => {$location}, |
1260 |
|
|
xp|token => {$token}, |
1261 |
|
|
xp|name => {$atqname}, |
1262 |
|
|
}__; |
1263 |
|
|
unless ($continue) { |
1264 |
|
|
__EXCEPTION{DOMLS|PARSE_ERR}__; |
1265 |
|
|
} |
1266 |
|
|
$self->{has_error} = true; |
1267 |
wakaba |
1.1 |
} |
1268 |
|
|
|
1269 |
|
|
$vals = $attrs->{$atqname} = { |
1270 |
|
|
nodes => [], |
1271 |
|
|
value => '', |
1272 |
|
|
index => $i++, |
1273 |
|
|
}; |
1274 |
|
|
} |
1275 |
wakaba |
1.3 |
|
1276 |
|
|
~? (S) { } |
1277 |
|
|
~ (VI) { } |
1278 |
|
|
~? (S) { } |
1279 |
wakaba |
1.1 |
|
1280 |
|
|
~ (LIT) { |
1281 |
|
|
&_AttributeValueSpecification_ |
1282 |
|
|
($doc => $doc, $vals => $vals); |
1283 |
|
|
|
1284 |
|
|
~ (LIT) { |
1285 |
|
|
?lexmode StartTag; |
1286 |
|
|
} else { |
1287 |
|
|
?lexmode StartTag; |
1288 |
|
|
} |
1289 |
|
|
} (LITA) { |
1290 |
|
|
&_AttributeValueSpecificationA_ |
1291 |
|
|
($doc => $doc, $vals => $vals); |
1292 |
|
|
|
1293 |
|
|
~ (LITA) { |
1294 |
|
|
?lexmode StartTag; |
1295 |
|
|
} else { |
1296 |
|
|
?lexmode StartTag; |
1297 |
|
|
} |
1298 |
|
|
} |
1299 |
|
|
} (S) : separator : terminator? { } |
1300 |
|
|
} // AttributeSpecificationList |
1301 |
|
|
|
1302 |
|
|
rule _AttributeValueSpecification_ ($doc, $vals) { |
1303 |
|
|
// ~ (LIT) { } |
1304 |
|
|
?lexmode 'AttributeValueLiteral'; |
1305 |
|
|
|
1306 |
|
|
~* (STRING) { |
1307 |
|
|
lang:Perl ($value => $token.value) { |
1308 |
|
|
$value =~ s/[\x09\x0A\x0D]/ /g; |
1309 |
|
|
my $text = $doc-><M::Document.createTextNode> ($value); |
1310 |
|
|
push @{$vals->{nodes}}, $text; |
1311 |
|
|
$vals->{value} .= $value; |
1312 |
|
|
} |
1313 |
|
|
} (HCRO) { |
1314 |
|
|
&_HexadecimalCharacterReferenceV_ |
1315 |
|
|
($doc => $doc, $vals => $vals); |
1316 |
|
|
|
1317 |
|
|
~ (REFC) { |
1318 |
|
|
?lexmode AttributeValueLiteral; |
1319 |
|
|
} else { |
1320 |
|
|
?lexmode AttributeValueLiteral; |
1321 |
|
|
} |
1322 |
|
|
} (CRO) { |
1323 |
|
|
&_NumericCharacterReferenceV_ |
1324 |
|
|
($doc => $doc, $vals => $vals); |
1325 |
|
|
|
1326 |
|
|
~ (REFC) { |
1327 |
|
|
?lexmode AttributeValueLiteral; |
1328 |
|
|
} else { |
1329 |
|
|
?lexmode AttributeValueLiteral; |
1330 |
|
|
} |
1331 |
|
|
} (ERO) { |
1332 |
|
|
// TODO: Attribute value normalization |
1333 |
|
|
&_GeneralEntityReferenceV_ |
1334 |
|
|
($doc => $doc, $vals => $vals); |
1335 |
|
|
|
1336 |
|
|
~ (REFC) { |
1337 |
|
|
?lexmode AttributeValueLiteral; |
1338 |
|
|
} else { |
1339 |
|
|
?lexmode AttributeValueLiteral; |
1340 |
|
|
} |
1341 |
|
|
} |
1342 |
|
|
|
1343 |
|
|
// ~ (LIT) { } (LITA) { } |
1344 |
|
|
} // _AttributeValueSpecification_ |
1345 |
|
|
|
1346 |
|
|
rule _AttributeValueSpecificationA_ ($doc, $vals) { |
1347 |
|
|
// ~ (LITA) { } |
1348 |
|
|
?lexmode 'AttributeValueLiteralA'; |
1349 |
|
|
|
1350 |
|
|
~* (STRING) { |
1351 |
|
|
lang:Perl ($value => $token.value) { |
1352 |
|
|
$value =~ s/[\x09\x0A\x0D]/ /g; |
1353 |
|
|
my $text = $doc-><M::Document.createTextNode> ($value); |
1354 |
|
|
push @{$vals->{nodes}}, $text; |
1355 |
|
|
$vals->{value} .= $value; |
1356 |
|
|
} |
1357 |
|
|
} (HCRO) { |
1358 |
|
|
&_HexadecimalCharacterReferenceV_ |
1359 |
|
|
($doc => $doc, $vals => $vals); |
1360 |
|
|
|
1361 |
|
|
~ (REFC) { |
1362 |
|
|
?lexmode AttributeValueLiteralA; |
1363 |
|
|
} else { |
1364 |
|
|
?lexmode AttributeValueLiteralA; |
1365 |
|
|
} |
1366 |
|
|
} (CRO) { |
1367 |
|
|
&_NumericCharacterReferenceV_ |
1368 |
|
|
($doc => $doc, $vals => $vals); |
1369 |
|
|
|
1370 |
|
|
~ (REFC) { |
1371 |
|
|
?lexmode AttributeValueLiteralA; |
1372 |
|
|
} else { |
1373 |
|
|
?lexmode AttributeValueLiteralA; |
1374 |
|
|
} |
1375 |
|
|
} (ERO) { |
1376 |
|
|
// TODO: Attribute value normalization |
1377 |
|
|
&_GeneralEntityReferenceV_ |
1378 |
|
|
($doc => $doc, $vals => $vals); |
1379 |
|
|
|
1380 |
|
|
~ (REFC) { |
1381 |
|
|
?lexmode AttributeValueLiteralA; |
1382 |
|
|
} else { |
1383 |
|
|
?lexmode AttributeValueLiteralA; |
1384 |
|
|
} |
1385 |
|
|
} |
1386 |
|
|
|
1387 |
|
|
// ~ (LITA) { } |
1388 |
|
|
} // _AttributeValueSpecificationA_ |
1389 |
|
|
|
1390 |
|
|
/* |
1391 |
|
|
CDATA Section Content Parsing Mode |
1392 |
|
|
*/ |
1393 |
|
|
rule _CDATASection_ ($doc, $parent) { |
1394 |
|
|
?lexmode 'CDATASectionContent'; |
1395 |
|
|
|
1396 |
|
|
my $cdata; |
1397 |
|
|
|
1398 |
wakaba |
1.2 |
~? (CData) { |
1399 |
wakaba |
1.1 |
lang:Perl ($data => $token.value) { |
1400 |
|
|
$cdata = $data; |
1401 |
|
|
} |
1402 |
|
|
} else { |
1403 |
|
|
lang:Perl { |
1404 |
|
|
$cdata = ''; |
1405 |
|
|
} |
1406 |
|
|
} |
1407 |
|
|
|
1408 |
|
|
lang:Perl { |
1409 |
|
|
my $cdsect = $doc-><M::Document.createCDATASection> |
1410 |
|
|
($cdata); |
1411 |
|
|
$parent-><M::Node.appendChild> ($cdsect); |
1412 |
|
|
} |
1413 |
|
|
|
1414 |
|
|
// ~ (MSE) { } |
1415 |
|
|
} // _CDATASection_ |
1416 |
|
|
|
1417 |
|
|
rule _NumericCharacterReference_ ($doc, $parent) { |
1418 |
|
|
?lexmode 'NumericCharacterReference'; |
1419 |
|
|
|
1420 |
|
|
~ (NUMBER) { |
1421 |
wakaba |
1.3 |
lang:Perl ($num => $token.value) : has-error { |
1422 |
|
|
$num += 0; |
1423 |
|
|
unless ( |
1424 |
|
|
($self->{xml_version} eq '1.0' and |
1425 |
|
|
((0x0020 <= $num and $num <= 0xD7FF) or |
1426 |
|
|
(0xE000 <= $num and $num <= 0xFFFD) or |
1427 |
|
|
(0x10000 <= $num and $num <= 0x10FFFF) or |
1428 |
|
|
$num == 0x9 or $num == 0xA or $num == 0xD)) or |
1429 |
|
|
($self->{xml_version} eq '1.1' and |
1430 |
|
|
((0x0001 <= $num and $num <= 0xD7FF) or |
1431 |
|
|
(0xE000 <= $num and $num <= 0xFFFD) or |
1432 |
|
|
(0x10000 <= $num and $num <= 0x10FFFF))) |
1433 |
|
|
) { |
1434 |
|
|
my $location; |
1435 |
|
|
__CODE{xp|get-location-from-token:: |
1436 |
|
|
$token => $token, |
1437 |
|
|
$result => $location, |
1438 |
|
|
}__; |
1439 |
|
|
my $continue = __DOMCore:ERROR{xp|wf-legal-character:: |
1440 |
|
|
DOMCore:location => {$location}, |
1441 |
|
|
xp|token => {$token}, |
1442 |
|
|
xp|character-number => {$num}, |
1443 |
|
|
xp|parent => {$parent}, |
1444 |
|
|
}__; |
1445 |
|
|
unless ($continue) { |
1446 |
|
|
__EXCEPTION{DOMLS|PARSE_ERR}__; |
1447 |
|
|
} |
1448 |
|
|
$self->{has_error} = true; |
1449 |
|
|
} |
1450 |
|
|
my $ncr = $doc-><M::Document.createTextNode> (chr $num); |
1451 |
wakaba |
1.1 |
$parent-><M::Node.appendChild> ($ncr); |
1452 |
|
|
} |
1453 |
|
|
} |
1454 |
|
|
|
1455 |
|
|
// ~ (REFC) { } |
1456 |
|
|
} // _NumericCharacterReference_ |
1457 |
|
|
|
1458 |
|
|
rule _NumericCharacterReferenceV_ ($doc, $vals) { |
1459 |
|
|
?lexmode 'NumericCharacterReference'; |
1460 |
|
|
|
1461 |
|
|
~ (NUMBER) { |
1462 |
wakaba |
1.3 |
lang:Perl ($num => $token.value) : has-error { |
1463 |
|
|
$num += 0; |
1464 |
|
|
unless ( |
1465 |
|
|
($self->{xml_version} eq '1.0' and |
1466 |
|
|
((0x0020 <= $num and $num <= 0xD7FF) or |
1467 |
|
|
(0xE000 <= $num and $num <= 0xFFFD) or |
1468 |
|
|
(0x10000 <= $num and $num <= 0x10FFFF) or |
1469 |
|
|
$num == 0x9 or $num == 0xA or $num == 0xD)) or |
1470 |
|
|
($self->{xml_version} eq '1.1' and |
1471 |
|
|
((0x0001 <= $num and $num <= 0xD7FF) or |
1472 |
|
|
(0xE000 <= $num and $num <= 0xFFFD) or |
1473 |
|
|
(0x10000 <= $num and $num <= 0x10FFFF))) |
1474 |
|
|
) { |
1475 |
|
|
my $location; |
1476 |
|
|
__CODE{xp|get-location-from-token:: |
1477 |
|
|
$token => $token, |
1478 |
|
|
$result => $location, |
1479 |
|
|
}__; |
1480 |
|
|
my $continue = __DOMCore:ERROR{xp|wf-legal-character:: |
1481 |
|
|
DOMCore:location => {$location}, |
1482 |
|
|
xp|token => {$token}, |
1483 |
|
|
xp|character-number => {$num}, |
1484 |
|
|
}__; |
1485 |
|
|
unless ($continue) { |
1486 |
|
|
__EXCEPTION{DOMLS|PARSE_ERR}__; |
1487 |
|
|
} |
1488 |
|
|
$self->{has_error} = true; |
1489 |
|
|
} |
1490 |
wakaba |
1.1 |
my $ncr = $doc-><M::Document.createTextNode> |
1491 |
|
|
(my $char = chr (0+$num)); |
1492 |
|
|
push @{$vals->{nodes}}, $ncr; |
1493 |
|
|
$vals->{value} .= $char; |
1494 |
|
|
} |
1495 |
|
|
} |
1496 |
|
|
|
1497 |
|
|
// ~ (REFC) { } |
1498 |
|
|
} // _NumericCharacterReferenceV_ |
1499 |
|
|
|
1500 |
|
|
rule _HexadecimalCharacterReference_ ($doc, $parent) { |
1501 |
|
|
?lexmode 'HexadecimalCharacterReference'; |
1502 |
|
|
|
1503 |
|
|
~ (Hex) { |
1504 |
wakaba |
1.3 |
lang:Perl ($num => $token.value) : has-error { |
1505 |
|
|
$num += 0; |
1506 |
|
|
unless ( |
1507 |
|
|
($self->{xml_version} eq '1.0' and |
1508 |
|
|
((0x0020 <= $num and $num <= 0xD7FF) or |
1509 |
|
|
(0xE000 <= $num and $num <= 0xFFFD) or |
1510 |
|
|
(0x10000 <= $num and $num <= 0x10FFFF) or |
1511 |
|
|
$num == 0x9 or $num == 0xA or $num == 0xD)) or |
1512 |
|
|
($self->{xml_version} eq '1.1' and |
1513 |
|
|
((0x0001 <= $num and $num <= 0xD7FF) or |
1514 |
|
|
(0xE000 <= $num and $num <= 0xFFFD) or |
1515 |
|
|
(0x10000 <= $num and $num <= 0x10FFFF))) |
1516 |
|
|
) { |
1517 |
|
|
my $location; |
1518 |
|
|
__CODE{xp|get-location-from-token:: |
1519 |
|
|
$token => $token, |
1520 |
|
|
$result => $location, |
1521 |
|
|
}__; |
1522 |
|
|
my $continue = __DOMCore:ERROR{xp|wf-legal-character:: |
1523 |
|
|
DOMCore:location => {$location}, |
1524 |
|
|
xp|token => {$token}, |
1525 |
|
|
xp|character-number => {$num}, |
1526 |
|
|
xp|parent => {$parent}, |
1527 |
|
|
}__; |
1528 |
|
|
unless ($continue) { |
1529 |
|
|
__EXCEPTION{DOMLS|PARSE_ERR}__; |
1530 |
|
|
} |
1531 |
|
|
$self->{has_error} = true; |
1532 |
|
|
} |
1533 |
wakaba |
1.1 |
my $ncr = $doc-><M::Document.createTextNode> |
1534 |
|
|
(chr hex $num); |
1535 |
|
|
$parent-><M::Node.appendChild> ($ncr); |
1536 |
|
|
} |
1537 |
|
|
} |
1538 |
|
|
|
1539 |
|
|
// ~ (REFC) { } |
1540 |
|
|
} // _HexadecimalCharacterReference_ |
1541 |
|
|
|
1542 |
wakaba |
1.3 |
rule _HexadecimalCharacterReferenceV_ ($doc, $vals) { |
1543 |
wakaba |
1.1 |
?lexmode 'HexadecimalCharacterReference'; |
1544 |
|
|
|
1545 |
|
|
~ (Hex) { |
1546 |
wakaba |
1.3 |
lang:Perl ($num => $token.value) : has-error { |
1547 |
|
|
$num += 0; |
1548 |
|
|
unless ( |
1549 |
|
|
($self->{xml_version} eq '1.0' and |
1550 |
|
|
((0x0020 <= $num and $num <= 0xD7FF) or |
1551 |
|
|
(0xE000 <= $num and $num <= 0xFFFD) or |
1552 |
|
|
(0x10000 <= $num and $num <= 0x10FFFF) or |
1553 |
|
|
$num == 0x9 or $num == 0xA or $num == 0xD)) or |
1554 |
|
|
($self->{xml_version} eq '1.1' and |
1555 |
|
|
((0x0001 <= $num and $num <= 0xD7FF) or |
1556 |
|
|
(0xE000 <= $num and $num <= 0xFFFD) or |
1557 |
|
|
(0x10000 <= $num and $num <= 0x10FFFF))) |
1558 |
|
|
) { |
1559 |
|
|
my $location; |
1560 |
|
|
__CODE{xp|get-location-from-token:: |
1561 |
|
|
$token => $token, |
1562 |
|
|
$result => $location, |
1563 |
|
|
}__; |
1564 |
|
|
my $continue = __DOMCore:ERROR{xp|wf-legal-character:: |
1565 |
|
|
DOMCore:location => {$location}, |
1566 |
|
|
xp|token => {$token}, |
1567 |
|
|
xp|character-number => {$num}, |
1568 |
|
|
}__; |
1569 |
|
|
unless ($continue) { |
1570 |
|
|
__EXCEPTION{DOMLS|PARSE_ERR}__; |
1571 |
|
|
} |
1572 |
|
|
$self->{has_error} = true; |
1573 |
|
|
} |
1574 |
wakaba |
1.1 |
my $ncr = $doc-><M::Document.createTextNode> |
1575 |
|
|
(my $char = chr hex $num); |
1576 |
|
|
push @{$vals->{nodes}}, $ncr; |
1577 |
|
|
$vals->{value} .= $char; |
1578 |
|
|
} |
1579 |
|
|
} |
1580 |
|
|
|
1581 |
|
|
// ~ (REFC) { } |
1582 |
|
|
} // _HexadecimalCharacterReferenceV_ |
1583 |
|
|
|
1584 |
wakaba |
1.6 |
/* |
1585 |
|
|
General entity reference in element's content |
1586 |
|
|
*/ |
1587 |
|
|
rule _GeneralEntityReferenceEC ($doc, $parent, $ns) |
1588 |
|
|
: recursive |
1589 |
|
|
{ |
1590 |
wakaba |
1.1 |
?lexmode 'EntityReference'; |
1591 |
|
|
|
1592 |
|
|
~ (Name) { |
1593 |
wakaba |
1.6 |
my $er; |
1594 |
wakaba |
1.1 |
lang:Perl ($name => $token.value) { |
1595 |
|
|
## TODO: Namespace well-formedness |
1596 |
|
|
## TODO: Entity declared constraints |
1597 |
wakaba |
1.6 |
$er = $doc-><M::Document.createEntityReference> |
1598 |
wakaba |
1.1 |
($name); |
1599 |
|
|
$parent-><M::Node.appendChild> ($er); |
1600 |
wakaba |
1.6 |
push @{$self->{entity}}, <Code::getCopyOfEntityState:: |
1601 |
|
|
$entity_type = 'general_entity', |
1602 |
|
|
$entity_name = $name>; |
1603 |
|
|
push @{$self->{entity_token}}, $self->{token}; |
1604 |
|
|
$self->{token} = []; |
1605 |
|
|
push @{$self->{entity_char}}, $self->{char}; |
1606 |
|
|
$self->{char} = []; |
1607 |
|
|
} |
1608 |
|
|
|
1609 |
|
|
?lexmode ElementContent; |
1610 |
|
|
~* (CharData) { |
1611 |
|
|
lang:Perl ($data => $token.value) { |
1612 |
|
|
$er-><M::Node.appendChild> |
1613 |
|
|
($doc-><M::Document.createTextNode> ($data)); |
1614 |
|
|
} |
1615 |
|
|
} (STAGO) { |
1616 |
|
|
&Element_ ($doc => $doc, $parent => $er, $ns => $ns) |
1617 |
|
|
: unshift-current-token; |
1618 |
|
|
~ (TAGC) { |
1619 |
|
|
?lexmode ElementContent; |
1620 |
|
|
} else { |
1621 |
|
|
?lexmode ElementContent; |
1622 |
|
|
} |
1623 |
|
|
} (HCRO) { |
1624 |
|
|
&_HexadecimalCharacterReference_ |
1625 |
|
|
($doc => $doc, $parent => $er); |
1626 |
|
|
|
1627 |
|
|
~ (REFC) { |
1628 |
|
|
?lexmode 'ElementContent'; |
1629 |
|
|
} else { |
1630 |
|
|
?lexmode ElementContent; |
1631 |
|
|
} |
1632 |
|
|
} (CRO) { |
1633 |
|
|
&_NumericCharacterReference_ |
1634 |
|
|
($doc => $doc, $parent => $er); |
1635 |
|
|
|
1636 |
|
|
~ (REFC) { |
1637 |
|
|
?lexmode 'ElementContent'; |
1638 |
|
|
} else { |
1639 |
|
|
?lexmode ElementContent; |
1640 |
|
|
} |
1641 |
|
|
} (ERO) { |
1642 |
|
|
&_GeneralEntityReferenceEC |
1643 |
|
|
($doc => $doc, $parent => $er, $ns => $ns); |
1644 |
|
|
} (CDO) { |
1645 |
|
|
&_CommentDeclaration_ ($doc => $doc, $parent => $er); |
1646 |
|
|
|
1647 |
|
|
~ (MDC) { |
1648 |
|
|
?lexmode ElementContent; |
1649 |
|
|
} else { |
1650 |
|
|
?lexmode ElementContent; |
1651 |
|
|
} |
1652 |
|
|
} (CDSO) { |
1653 |
|
|
&_CDATASection_ ($doc => $doc, $parent => $er); |
1654 |
|
|
|
1655 |
|
|
~ (MSE) { |
1656 |
|
|
?lexmode 'ElementContent'; |
1657 |
|
|
} else { |
1658 |
|
|
?lexmode ElementContent; |
1659 |
|
|
} |
1660 |
|
|
} (PIO) { |
1661 |
|
|
&_ProcessingInstruction_ ($doc => $doc, $parent => $er); |
1662 |
|
|
|
1663 |
|
|
~ (PIC) { |
1664 |
|
|
?lexmode 'ElementContent'; |
1665 |
|
|
} else { |
1666 |
|
|
?lexmode ElementContent; |
1667 |
|
|
} |
1668 |
wakaba |
1.1 |
} |
1669 |
wakaba |
1.6 |
|
1670 |
|
|
~ (#EOF) { } |
1671 |
|
|
lang:Perl { |
1672 |
|
|
$self->{token} = pop @{$self->{entity_token}}; |
1673 |
|
|
$self->{char} = pop @{$self->{entity_char}}; |
1674 |
|
|
pop @{$self->{entity}}; |
1675 |
|
|
} |
1676 |
|
|
|
1677 |
|
|
?lexmode EntityReference; |
1678 |
|
|
?requires-next-token; |
1679 |
wakaba |
1.1 |
} |
1680 |
|
|
|
1681 |
wakaba |
1.6 |
~ (REFC) { |
1682 |
|
|
?lexmode ElementContent; |
1683 |
|
|
} else { |
1684 |
|
|
?lexmode ElementContent; |
1685 |
|
|
} |
1686 |
|
|
} // _GeneralEntityReferenceEC |
1687 |
wakaba |
1.1 |
|
1688 |
|
|
rule _GeneralEntityReferenceV_ ($doc, $vals) { |
1689 |
|
|
// TODO: Expansion |
1690 |
|
|
?lexmode 'EntityReference'; |
1691 |
|
|
|
1692 |
|
|
~ (Name) { |
1693 |
|
|
lang:Perl ($name => $token.value) { |
1694 |
|
|
## TODO: Namespace well-formedness |
1695 |
|
|
## TODO: Entity declared constraints |
1696 |
|
|
my $er = $doc-><M::Document.createEntityReference> |
1697 |
|
|
($name); |
1698 |
|
|
push @{$vals->{nodes}}, $er; |
1699 |
|
|
} |
1700 |
|
|
} |
1701 |
|
|
|
1702 |
|
|
// ~ (REFC) { } |
1703 |
|
|
} // _GeneralEntityReferenceV_ |
1704 |
wakaba |
1.6 |
|
1705 |
|
|
/* |
1706 |
|
|
General entity reference in literal entity value |
1707 |
|
|
*/ |
1708 |
|
|
rule _GeneralEntityReferenceEV_ ($doc, $vals) { |
1709 |
|
|
?lexmode 'EntityReference'; |
1710 |
|
|
|
1711 |
|
|
~ (Name) { |
1712 |
|
|
lang:Perl ($name => $token.value) { |
1713 |
|
|
## TODO: Namespace well-formedness |
1714 |
|
|
## TODO: Entity declared constraints |
1715 |
|
|
push @$vals, $name; |
1716 |
|
|
} |
1717 |
|
|
} |
1718 |
|
|
|
1719 |
|
|
// ~ (REFC) { } |
1720 |
|
|
} // _GeneralEntityReferenceEV_ |
1721 |
wakaba |
1.1 |
|
1722 |
|
|
/* |
1723 |
wakaba |
1.4 |
Document Type Declaration |
1724 |
wakaba |
1.1 |
*/ |
1725 |
wakaba |
1.4 |
rule _DocumentTypeDeclaration_ ($doc) { |
1726 |
|
|
?lexmode MarkupDeclaration; |
1727 |
|
|
|
1728 |
|
|
~ (Name == 'DOCTYPE') { } |
1729 |
|
|
|
1730 |
|
|
~ (S) { } |
1731 |
|
|
|
1732 |
wakaba |
1.6 |
my $node; |
1733 |
wakaba |
1.4 |
// Document type name |
1734 |
wakaba |
1.6 |
my $name; |
1735 |
wakaba |
1.4 |
~ (Name) { |
1736 |
wakaba |
1.6 |
lang:Perl ($v => $token.value) { |
1737 |
|
|
$name = $v; |
1738 |
|
|
} |
1739 |
|
|
} |
1740 |
|
|
lang:Perl { |
1741 |
|
|
$node = $doc-><M::DocumentXDoctype.createDocumentTypeDefinition> ($name); |
1742 |
|
|
$doc-><M::Node.appendChild> ($node); |
1743 |
wakaba |
1.4 |
} |
1744 |
|
|
|
1745 |
|
|
~? (S) { |
1746 |
|
|
~? (Name == 'PUBLIC') { |
1747 |
|
|
~ (S) { } |
1748 |
|
|
|
1749 |
|
|
&PubidLiteral ($doc => $doc); |
1750 |
|
|
|
1751 |
|
|
~ (S) { } |
1752 |
|
|
|
1753 |
|
|
&SystemLiteral ($doc => $doc); |
1754 |
|
|
|
1755 |
|
|
~? (S) { } |
1756 |
|
|
} (Name == 'SYSTEM') { |
1757 |
|
|
~ (S) { } |
1758 |
|
|
|
1759 |
|
|
&SystemLiteral ($doc => $doc); |
1760 |
|
|
|
1761 |
|
|
~? (S) { } |
1762 |
|
|
} |
1763 |
|
|
} |
1764 |
|
|
|
1765 |
|
|
~? (DSO) { |
1766 |
wakaba |
1.6 |
&InternalSubset ($doc => $doc, $doctype => $node); |
1767 |
wakaba |
1.4 |
|
1768 |
|
|
~ (DSC) { |
1769 |
|
|
?lexmode MarkupDeclaration; |
1770 |
|
|
} else { |
1771 |
|
|
?lexmode MarkupDeclaration; |
1772 |
|
|
} |
1773 |
|
|
|
1774 |
|
|
~? (S) { } |
1775 |
|
|
} |
1776 |
|
|
|
1777 |
|
|
// TODO: set $self->{standalone} true if only internal subset |
1778 |
|
|
// with no param ref |
1779 |
|
|
|
1780 |
|
|
// ~ (MDC) { } |
1781 |
|
|
} // _DocumentTypeDeclaration_ |
1782 |
|
|
|
1783 |
|
|
rule PubidLiteral ($doc) { |
1784 |
|
|
~ (LIT) { |
1785 |
|
|
?lexmode SystemLiteral; |
1786 |
|
|
|
1787 |
|
|
~? (STRING) { |
1788 |
|
|
// TODO: Charrange check & normalization is required |
1789 |
|
|
|
1790 |
|
|
} |
1791 |
|
|
|
1792 |
|
|
~ (LIT) { |
1793 |
|
|
?lexmode MarkupDeclaration; |
1794 |
|
|
} else { |
1795 |
|
|
?lexmode MarkupDeclaration; |
1796 |
|
|
} |
1797 |
|
|
} (LITA) { |
1798 |
|
|
?lexmode SystemLiteralA; |
1799 |
|
|
|
1800 |
|
|
~? (STRING) { |
1801 |
|
|
// TODO: Charrange check & normalization is required |
1802 |
|
|
|
1803 |
|
|
} |
1804 |
|
|
|
1805 |
|
|
~ (LITA) { |
1806 |
|
|
?lexmode MarkupDeclaration; |
1807 |
|
|
} else { |
1808 |
|
|
?lexmode MarkupDeclaration; |
1809 |
|
|
} |
1810 |
|
|
} |
1811 |
|
|
} // PubidLiteral |
1812 |
|
|
|
1813 |
|
|
rule SystemLiteral ($doc) { |
1814 |
|
|
~ (LIT) { |
1815 |
|
|
?lexmode SystemLiteral; |
1816 |
|
|
&_SystemLiteral ($doc => $doc); |
1817 |
|
|
} (LITA) { |
1818 |
|
|
?lexmode SystemLiteralA; |
1819 |
|
|
&_SystemLiteral ($doc => $doc); |
1820 |
|
|
} |
1821 |
|
|
} // SystemLiteral |
1822 |
|
|
|
1823 |
|
|
rule _SystemLiteral ($doc) { |
1824 |
|
|
~? (STRING) { |
1825 |
|
|
|
1826 |
|
|
} |
1827 |
|
|
|
1828 |
|
|
~ (LIT) { |
1829 |
|
|
?lexmode MarkupDeclaration; |
1830 |
|
|
} (LITA) { |
1831 |
|
|
?lexmode MarkupDeclaration; |
1832 |
|
|
} else { |
1833 |
|
|
?lexmode MarkupDeclaration; |
1834 |
|
|
} |
1835 |
|
|
} // _SystemLiteral |
1836 |
|
|
|
1837 |
|
|
/* |
1838 |
|
|
DTD Internal Subset |
1839 |
|
|
|
1840 |
|
|
intSubset := *(markupdecl / DeclSep) ;; [28b] |
1841 |
|
|
*/ |
1842 |
wakaba |
1.6 |
rule InternalSubset ($doc, $doctype) { |
1843 |
wakaba |
1.4 |
?lexmode DTD; |
1844 |
|
|
|
1845 |
|
|
~* (MDO) { |
1846 |
|
|
?lexmode MarkupDeclaration; |
1847 |
|
|
|
1848 |
|
|
~ (Name == 'ELEMENT') { |
1849 |
|
|
&_ElementDeclaration ($doc => $doc); |
1850 |
|
|
} (Name == 'ATTLIST') { |
1851 |
wakaba |
1.8 |
&_AttlistDeclaration ($doc => $doc, $doctype => $doctype); |
1852 |
wakaba |
1.4 |
} (Name == 'ENTITY') { |
1853 |
|
|
&_EntityDeclaration ($doc => $doc); |
1854 |
|
|
} (Name == 'NOTATION') { |
1855 |
|
|
&_NotationDeclaration ($doc => $doc); |
1856 |
|
|
} |
1857 |
|
|
} (S) { |
1858 |
|
|
// |
1859 |
|
|
} (CDO) { |
1860 |
|
|
&_CommentDeclarationDTD ($doc => $doc); |
1861 |
|
|
} (PIO) { |
1862 |
wakaba |
1.6 |
&_ProcessingInstructionDTD ($doc => $doc, $doctype => $doctype); |
1863 |
wakaba |
1.4 |
} (PERO) { |
1864 |
|
|
?lexmode EntityReference; |
1865 |
|
|
|
1866 |
|
|
~ (Name) { |
1867 |
|
|
|
1868 |
|
|
} |
1869 |
|
|
|
1870 |
|
|
~ (REFC) { |
1871 |
|
|
?lexmode DTD; |
1872 |
|
|
} else { |
1873 |
|
|
?lexmode DTD; |
1874 |
|
|
} |
1875 |
|
|
} |
1876 |
|
|
} // InternalSubset |
1877 |
|
|
|
1878 |
|
|
rule _ElementDeclaration ($doc) { |
1879 |
|
|
// ~ (MDO) { } |
1880 |
|
|
// ?lexmode MarkupDeclaration |
1881 |
|
|
// ~ (Name == 'Element') { } |
1882 |
|
|
|
1883 |
|
|
~ (S) { } |
1884 |
|
|
|
1885 |
|
|
~ (Name) { |
1886 |
|
|
|
1887 |
|
|
} |
1888 |
|
|
|
1889 |
|
|
?lexmode ElementDeclaration; |
1890 |
|
|
|
1891 |
|
|
~ (S) { } |
1892 |
|
|
|
1893 |
|
|
// contentspec |
1894 |
|
|
~ (MGO) { |
1895 |
|
|
&_ContentModel ($doc => $doc); |
1896 |
|
|
} (Name == 'EMPTY') { |
1897 |
|
|
|
1898 |
|
|
} (Name == 'ANY') { |
1899 |
|
|
|
1900 |
|
|
} |
1901 |
|
|
|
1902 |
|
|
~? (S) { } |
1903 |
|
|
|
1904 |
|
|
~ (MDC) { |
1905 |
|
|
?lexmode DTD; |
1906 |
|
|
} else { |
1907 |
|
|
?lexmode DTD; |
1908 |
|
|
} |
1909 |
|
|
} // _ElementDeclaration |
1910 |
|
|
|
1911 |
|
|
rule _ContentModel ($doc) { |
1912 |
|
|
// ~ (MGO) { } |
1913 |
|
|
|
1914 |
|
|
~? (S) { } |
1915 |
|
|
|
1916 |
|
|
~ (Name) { |
1917 |
|
|
// Element content model |
1918 |
|
|
&_ModelGroup ($doc => $doc) |
1919 |
|
|
: unshift-current-token; |
1920 |
|
|
|
1921 |
|
|
~? (OPT) { |
1922 |
|
|
|
1923 |
|
|
} (REP) { |
1924 |
|
|
|
1925 |
|
|
} (PLUS) { |
1926 |
|
|
|
1927 |
|
|
} |
1928 |
|
|
|
1929 |
|
|
} (MDO) { |
1930 |
|
|
&_ModelGroup ($doc => $doc) |
1931 |
|
|
: unshift-current-token; |
1932 |
|
|
|
1933 |
|
|
~? (OPT) { |
1934 |
|
|
|
1935 |
|
|
} (REP) { |
1936 |
|
|
|
1937 |
|
|
} (PLUS) { |
1938 |
|
|
|
1939 |
|
|
} |
1940 |
|
|
|
1941 |
|
|
} (PCDATA) { |
1942 |
|
|
// Mixed content declaration |
1943 |
|
|
~? (S) { } |
1944 |
|
|
|
1945 |
|
|
~* (OR) { |
1946 |
|
|
~? (S) { } |
1947 |
|
|
|
1948 |
|
|
~ (Name) { |
1949 |
|
|
|
1950 |
|
|
} |
1951 |
|
|
|
1952 |
|
|
~? (S) { } |
1953 |
|
|
} |
1954 |
|
|
|
1955 |
|
|
~ (MGC) { } |
1956 |
|
|
|
1957 |
|
|
~? (REP) { |
1958 |
|
|
|
1959 |
|
|
} else { |
1960 |
|
|
// TODO: error if |Name| |
1961 |
|
|
} |
1962 |
|
|
|
1963 |
|
|
|
1964 |
|
|
} |
1965 |
|
|
} // _ContentModel |
1966 |
|
|
|
1967 |
|
|
rule _ModelGroup ($doc) |
1968 |
|
|
: standalone |
1969 |
|
|
: recursive |
1970 |
|
|
{ |
1971 |
|
|
// ~ (MGO) { } |
1972 |
|
|
// ~? (S) { } |
1973 |
|
|
|
1974 |
|
|
&ContentParticle ($doc => $doc); |
1975 |
|
|
|
1976 |
|
|
~? (S) { } |
1977 |
|
|
|
1978 |
|
|
~? (OR) { |
1979 |
|
|
~? (S) { } |
1980 |
|
|
|
1981 |
|
|
&ContentParticle ($doc => $doc); |
1982 |
|
|
|
1983 |
|
|
~? (S) { } |
1984 |
|
|
|
1985 |
|
|
~* (OR) { |
1986 |
|
|
~? (S) { } |
1987 |
|
|
|
1988 |
|
|
&ContentParticle ($doc => $doc); |
1989 |
|
|
|
1990 |
|
|
~? (S) { } |
1991 |
|
|
} |
1992 |
|
|
|
1993 |
|
|
} (SEQ) { |
1994 |
|
|
~? (S) { } |
1995 |
|
|
|
1996 |
|
|
&ContentParticle ($doc => $doc); |
1997 |
|
|
|
1998 |
|
|
~? (S) { } |
1999 |
|
|
|
2000 |
|
|
~* (SEQ) { |
2001 |
|
|
~? (S) { } |
2002 |
|
|
|
2003 |
|
|
&ContentParticle ($doc => $doc); |
2004 |
|
|
|
2005 |
|
|
~? (S) { } |
2006 |
|
|
} |
2007 |
|
|
|
2008 |
|
|
} |
2009 |
|
|
|
2010 |
|
|
~ (MGC) { } |
2011 |
|
|
} // _ModelGroup |
2012 |
|
|
|
2013 |
|
|
rule ContentParticle ($doc) { |
2014 |
|
|
~ (Name) { |
2015 |
|
|
|
2016 |
|
|
} (MGO) { |
2017 |
|
|
~? (S) { } |
2018 |
|
|
|
2019 |
|
|
&_ModelGroup ($doc => $doc); |
2020 |
|
|
} |
2021 |
|
|
|
2022 |
|
|
~? (OPT) { |
2023 |
|
|
|
2024 |
|
|
} (REP) { |
2025 |
|
|
|
2026 |
|
|
} (PLUS) { |
2027 |
|
|
|
2028 |
|
|
} |
2029 |
|
|
} // ContentParticle |
2030 |
|
|
|
2031 |
wakaba |
1.8 |
/* |
2032 |
|
|
Attribute list declaration |
2033 |
|
|
*/ |
2034 |
|
|
rule _AttlistDeclaration ($doc, $doctype) { |
2035 |
wakaba |
1.4 |
// ~ (MDO) { } |
2036 |
|
|
// ~ (Name == 'ATTLIST') { } |
2037 |
|
|
|
2038 |
|
|
?lexmode AttlistDeclaration; |
2039 |
|
|
|
2040 |
|
|
~ (S) { } |
2041 |
|
|
|
2042 |
wakaba |
1.8 |
my $name; |
2043 |
wakaba |
1.4 |
~ (Name) { |
2044 |
wakaba |
1.8 |
lang:Perl ($v => $token.value) { |
2045 |
|
|
$name = $v; |
2046 |
|
|
} |
2047 |
|
|
} else { |
2048 |
|
|
lang:Perl { $name = '#ILLEGAL' } |
2049 |
|
|
} |
2050 |
wakaba |
1.4 |
|
2051 |
wakaba |
1.8 |
my $docxd; |
2052 |
|
|
my $et; |
2053 |
|
|
lang:Perl { |
2054 |
|
|
$et = $doctype-><M::DTDef.getElementTypeDefinitionNode> ($name); |
2055 |
|
|
unless ($et) { |
2056 |
|
|
$docxd = $doc-><M::Node.getFeature> (<Q::ManakaiDOM:XDoctype>, '3.0'); |
2057 |
|
|
$et = $docxd-><M::DocumentXDoctype.createElementTypeDefinition> |
2058 |
|
|
($name); |
2059 |
|
|
$doctype-><M::DTDef.setElementTypeDefinitionNode> ($et) |
2060 |
|
|
unless $name eq '#ILLEGAL'; |
2061 |
|
|
} |
2062 |
wakaba |
1.4 |
} |
2063 |
|
|
|
2064 |
|
|
~? (S) { } |
2065 |
|
|
|
2066 |
|
|
~* (Name) { |
2067 |
wakaba |
1.8 |
my $at; |
2068 |
|
|
lang:Perl ($v => $token.value) { |
2069 |
|
|
$docxd ||= $doc-><M::Node.getFeature> |
2070 |
|
|
(<Q::ManakaiDOM:XDoctype>, '3.0'); |
2071 |
|
|
$at = $docxd-><M::DocumentXDoctype.createAttributeDefinition> ($v); |
2072 |
|
|
$et-><M::ETDef.setAttributeDefinitionNode> ($at) |
2073 |
|
|
unless exists $et-><AG::ETDef.attributeDefinitions>->{$v}; |
2074 |
|
|
} |
2075 |
wakaba |
1.4 |
|
2076 |
|
|
~ (S) { } |
2077 |
|
|
|
2078 |
|
|
// AttType |
2079 |
|
|
~ (Name == 'NOTATION') { |
2080 |
|
|
~ (S) { } |
2081 |
|
|
|
2082 |
wakaba |
1.8 |
my $kwd; |
2083 |
|
|
lang:Perl { |
2084 |
|
|
$at-><AS::ATDef.declaredType> (<C::ATDef.NOTATION_ATTR>); |
2085 |
|
|
$kwd = $at-><AG::ATDef.allowedTokens>; |
2086 |
|
|
} |
2087 |
|
|
|
2088 |
wakaba |
1.4 |
~ (EGO) { |
2089 |
|
|
~? (S) { } |
2090 |
|
|
|
2091 |
wakaba |
1.8 |
~+ (Name) { |
2092 |
|
|
lang:Perl ($v => $token.value) { |
2093 |
|
|
push @$kwd, $v; |
2094 |
|
|
} |
2095 |
wakaba |
1.4 |
|
2096 |
|
|
~? (S) { } |
2097 |
|
|
} (OR) : separator { |
2098 |
|
|
~? (S) { } |
2099 |
|
|
} |
2100 |
|
|
|
2101 |
|
|
~ (EGC) { } |
2102 |
|
|
} |
2103 |
wakaba |
1.8 |
|
2104 |
wakaba |
1.4 |
} (Name) { |
2105 |
wakaba |
1.8 |
my $type; |
2106 |
|
|
lang:Perl ($v => $token.value) : has-error { |
2107 |
|
|
my $map = { |
2108 |
|
|
CDATA => <C::ATDef.CDATA_ATTR>, |
2109 |
|
|
ID => <C::ATDef.ID_ATTR>, |
2110 |
|
|
IDREF => <C::ATDef.IDREF_ATTR>, |
2111 |
|
|
IDREFS => <C::ATDef.IDREFS_ATTR>, |
2112 |
|
|
ENTITY => <C::ATDef.ENTITY_ATTR>, |
2113 |
|
|
ENTITIES => <C::ATDef.ENTITIES_ATTR>, |
2114 |
|
|
NMTOKEN => <C::ATDef.NMTOKEN_ATTR>, |
2115 |
|
|
NMTOKENS => <C::ATDef.NMTOKENS_ATTR>, |
2116 |
|
|
}; |
2117 |
|
|
if ($map->{$v}) { |
2118 |
|
|
$at-><AS::ATDef.declaredType> ($map->{$v}); |
2119 |
|
|
} else { |
2120 |
|
|
## TODO: Exception |
2121 |
|
|
} |
2122 |
|
|
} |
2123 |
wakaba |
1.4 |
|
2124 |
|
|
} (EGO) { |
2125 |
|
|
?lexmode Enumeration; |
2126 |
|
|
|
2127 |
|
|
~? (S) { } |
2128 |
|
|
|
2129 |
wakaba |
1.8 |
my $kwd; |
2130 |
|
|
lang:Perl { |
2131 |
|
|
$at-><AS::ATDef.declaredType> (<C::ATDef.ENUMERATION_ATTR>); |
2132 |
|
|
$kwd = $at-><AG::ATDef.allowedTokens>; |
2133 |
|
|
} |
2134 |
|
|
|
2135 |
|
|
~+ (Nmtoken) { |
2136 |
|
|
lang:Perl ($v => $token.value) { |
2137 |
|
|
push @$kwd, $v; |
2138 |
|
|
} |
2139 |
wakaba |
1.4 |
|
2140 |
|
|
~? (S) { } |
2141 |
|
|
} (OR) : separator { |
2142 |
|
|
~? (S) { } |
2143 |
|
|
} |
2144 |
|
|
|
2145 |
|
|
~ (EGC) { |
2146 |
|
|
?lexmode AttlistDeclaration; |
2147 |
|
|
} else { |
2148 |
|
|
?lexmode AttlistDeclaration; |
2149 |
|
|
} |
2150 |
|
|
|
2151 |
|
|
} |
2152 |
|
|
|
2153 |
|
|
~ (S) { } |
2154 |
|
|
|
2155 |
|
|
// DefaultDecl |
2156 |
|
|
~ (RNI) { |
2157 |
|
|
~ (Name == 'REQUIRED') { |
2158 |
wakaba |
1.8 |
lang:Perl { |
2159 |
|
|
$at-><AS::ATDef.defaultType> (<C::ATDef.REQUIRED_DEFAULT>); |
2160 |
|
|
} |
2161 |
wakaba |
1.4 |
} (Name == 'IMPLIED') { |
2162 |
wakaba |
1.8 |
lang:Perl { |
2163 |
|
|
$at-><AS::ATDef.defaultType> (<C::ATDef.IMPLIED_DEFAULT>); |
2164 |
|
|
} |
2165 |
wakaba |
1.4 |
} (Name == 'FIXED') { |
2166 |
|
|
~ (S) { } |
2167 |
wakaba |
1.8 |
|
2168 |
|
|
lang:Perl { |
2169 |
|
|
$at-><AS::ATDef.defaultType> (<C::ATDef.FIXED_DEFAULT>); |
2170 |
|
|
} |
2171 |
wakaba |
1.4 |
|
2172 |
|
|
~ (LIT) { |
2173 |
|
|
my $vals; |
2174 |
|
|
lang:Perl { |
2175 |
wakaba |
1.8 |
$vals = {nodes => [], value => ''}; |
2176 |
wakaba |
1.4 |
} |
2177 |
|
|
|
2178 |
|
|
&_AttributeValueSpecification_ ($doc => $doc, $vals => $vals); |
2179 |
|
|
|
2180 |
wakaba |
1.8 |
lang:Perl { |
2181 |
|
|
for (@{$vals->{nodes}}) { |
2182 |
|
|
$at-><M::Node.appendChild> ($_); |
2183 |
|
|
} |
2184 |
|
|
} |
2185 |
|
|
|
2186 |
wakaba |
1.4 |
~ (LIT) { |
2187 |
|
|
?lexmode AttlistDeclaration; |
2188 |
|
|
} else { |
2189 |
|
|
?lexmode AttlistDeclaration; |
2190 |
|
|
} |
2191 |
|
|
} (LITA) { |
2192 |
|
|
my $vals; |
2193 |
|
|
lang:Perl { |
2194 |
wakaba |
1.8 |
$vals = {nodes => [], value => ''}; |
2195 |
wakaba |
1.4 |
} |
2196 |
|
|
|
2197 |
|
|
&_AttributeValueSpecificationA_ ($doc => $doc, $vals => $vals); |
2198 |
|
|
|
2199 |
wakaba |
1.8 |
lang:Perl { |
2200 |
|
|
for (@{$vals->{nodes}}) { |
2201 |
|
|
$at-><M::Node.appendChild> ($_); |
2202 |
|
|
} |
2203 |
|
|
} |
2204 |
|
|
|
2205 |
|
|
~ (LITA) { |
2206 |
wakaba |
1.4 |
?lexmode AttlistDeclaration; |
2207 |
|
|
} else { |
2208 |
|
|
?lexmode AttlistDeclaration; |
2209 |
|
|
} |
2210 |
|
|
} |
2211 |
|
|
} |
2212 |
|
|
|
2213 |
|
|
} (LIT) { |
2214 |
|
|
my $vals; |
2215 |
|
|
lang:Perl { |
2216 |
wakaba |
1.8 |
$at-><AS::ATDef.defaultType> (<C::ATDef.EXPLICIT_DEFAULT>); |
2217 |
|
|
$vals = {nodes => [], value => ''}; |
2218 |
wakaba |
1.4 |
} |
2219 |
|
|
|
2220 |
|
|
&_AttributeValueSpecification_ ($doc => $doc, $vals => $vals); |
2221 |
|
|
|
2222 |
wakaba |
1.8 |
lang:Perl { |
2223 |
|
|
for (@{$vals->{nodes}}) { |
2224 |
|
|
$at-><M::Node.appendChild> ($_); |
2225 |
|
|
} |
2226 |
|
|
} |
2227 |
|
|
|
2228 |
wakaba |
1.4 |
~ (LIT) { |
2229 |
|
|
?lexmode AttlistDeclaration; |
2230 |
|
|
} else { |
2231 |
|
|
?lexmode AttlistDeclaration; |
2232 |
|
|
} |
2233 |
|
|
} (LITA) { |
2234 |
|
|
my $vals; |
2235 |
|
|
lang:Perl { |
2236 |
wakaba |
1.8 |
$at-><AS::ATDef.defaultType> (<C::ATDef.EXPLICIT_DEFAULT>); |
2237 |
|
|
$vals = {nodes => [], value => ''}; |
2238 |
wakaba |
1.4 |
} |
2239 |
|
|
|
2240 |
|
|
&_AttributeValueSpecificationA_ ($doc => $doc, $vals => $vals); |
2241 |
|
|
|
2242 |
wakaba |
1.8 |
lang:Perl { |
2243 |
|
|
for (@{$vals->{nodes}}) { |
2244 |
|
|
$at-><M::Node.appendChild> ($_); |
2245 |
|
|
} |
2246 |
|
|
} |
2247 |
|
|
|
2248 |
wakaba |
1.4 |
~ (LITA) { |
2249 |
|
|
?lexmode AttlistDeclaration; |
2250 |
|
|
} else { |
2251 |
|
|
?lexmode AttlistDeclaration; |
2252 |
|
|
} |
2253 |
|
|
} |
2254 |
|
|
|
2255 |
|
|
} (S) : separator : terminator? { |
2256 |
|
|
// |
2257 |
|
|
} |
2258 |
|
|
|
2259 |
|
|
~ (MDC) { |
2260 |
|
|
?lexmode DTD; |
2261 |
|
|
} else { |
2262 |
|
|
?lexmode DTD; |
2263 |
|
|
} |
2264 |
|
|
} // _AttlistDeclaration |
2265 |
|
|
|
2266 |
|
|
rule _EntityDeclaration ($doc) { |
2267 |
|
|
// ~ (MDO) { } |
2268 |
|
|
// ~ (Name == ENTITY) { } |
2269 |
|
|
|
2270 |
|
|
~ (S) { } |
2271 |
|
|
|
2272 |
wakaba |
1.6 |
my $decl; |
2273 |
|
|
lang:Perl { $decl = {}; } |
2274 |
|
|
|
2275 |
wakaba |
1.4 |
~? (PERO) { |
2276 |
|
|
~ (S) { } |
2277 |
wakaba |
1.6 |
lang:Perl { |
2278 |
|
|
$decl->{is_param_entity} = true; |
2279 |
|
|
} |
2280 |
wakaba |
1.4 |
} |
2281 |
|
|
|
2282 |
|
|
~ (Name) { |
2283 |
wakaba |
1.6 |
lang:Perl ($v => $token.value) { |
2284 |
|
|
$decl->{name} = $v; |
2285 |
|
|
} |
2286 |
wakaba |
1.4 |
} |
2287 |
|
|
|
2288 |
|
|
~ (S) { } |
2289 |
|
|
|
2290 |
|
|
~ (LIT) { |
2291 |
wakaba |
1.6 |
&_EntityValue ($doc => $doc, $decl => $decl); |
2292 |
wakaba |
1.4 |
} (LITA) { |
2293 |
wakaba |
1.6 |
&_EntityValueA ($doc => $doc, $decl => $decl); |
2294 |
wakaba |
1.4 |
} (Name == 'PUBLIC') { |
2295 |
|
|
~ (S) { } |
2296 |
|
|
|
2297 |
wakaba |
1.6 |
&PubidLiteral ($doc => $doc, $decl => $decl); |
2298 |
wakaba |
1.4 |
|
2299 |
|
|
~ (S) { } |
2300 |
|
|
|
2301 |
wakaba |
1.6 |
&SystemLiteral ($doc => $doc, $decl => $decl); |
2302 |
wakaba |
1.4 |
} (Name == 'SYSTEM') { |
2303 |
|
|
~ (S) { } |
2304 |
|
|
|
2305 |
wakaba |
1.6 |
&SystemLiteral ($doc => $doc, $decl => $decl); |
2306 |
wakaba |
1.4 |
} |
2307 |
|
|
|
2308 |
|
|
~? (S) { |
2309 |
|
|
~? (Name == 'NDATA') { |
2310 |
|
|
// TODO: error if parameter entity |
2311 |
|
|
|
2312 |
|
|
~ (S) { } |
2313 |
|
|
|
2314 |
|
|
~ (Name) { |
2315 |
wakaba |
1.6 |
lang:Perl ($v => $token.value) { |
2316 |
|
|
$decl->{notation} = $v; |
2317 |
|
|
} |
2318 |
wakaba |
1.4 |
} |
2319 |
|
|
|
2320 |
|
|
~? (S) { } |
2321 |
|
|
} |
2322 |
|
|
} |
2323 |
|
|
|
2324 |
wakaba |
1.6 |
lang:Perl { |
2325 |
|
|
if ($self->{$decl->{is_param_entity} ? 'param_entity' : 'general_entity'} |
2326 |
|
|
->{$decl->{name}}) { |
2327 |
|
|
## TODO: error |
2328 |
|
|
} else { |
2329 |
|
|
$self->{$decl->{is_param_entity} ? 'param_entity' : 'general_entity'} |
2330 |
|
|
->{$decl->{name}} = $decl; |
2331 |
|
|
} |
2332 |
|
|
} |
2333 |
|
|
|
2334 |
wakaba |
1.4 |
~ (MDC) { |
2335 |
|
|
?lexmode DTD; |
2336 |
|
|
} else { |
2337 |
|
|
?lexmode DTD; |
2338 |
|
|
} |
2339 |
|
|
} // _EntityDeclaration |
2340 |
|
|
|
2341 |
|
|
rule _NotationDeclaration ($doc) { |
2342 |
|
|
// ~ (MDO) { } |
2343 |
|
|
// ~ (Name == NOTATION) { } |
2344 |
|
|
|
2345 |
|
|
~ (S) { } |
2346 |
|
|
|
2347 |
|
|
~ (Name) { |
2348 |
|
|
|
2349 |
|
|
} |
2350 |
|
|
|
2351 |
|
|
~ (S) { } |
2352 |
|
|
|
2353 |
|
|
~ (Name == 'PUBLIC') { |
2354 |
|
|
~ (S) { } |
2355 |
|
|
|
2356 |
|
|
&PubidLiteral ($doc => $doc); |
2357 |
|
|
|
2358 |
|
|
~? (S) { |
2359 |
|
|
~? (LIT) { |
2360 |
|
|
?lexmode SystemLiteral; |
2361 |
|
|
&_SystemLiteral ($doc => $doc); |
2362 |
|
|
|
2363 |
|
|
~? (S) { } |
2364 |
|
|
} (LITA) { |
2365 |
|
|
?lexmode SystemLiteralA; |
2366 |
|
|
&_SystemLiteral ($doc => $doc); |
2367 |
|
|
|
2368 |
|
|
~? (S) { } |
2369 |
|
|
} |
2370 |
|
|
} |
2371 |
|
|
} (Name == 'SYSTEM') { |
2372 |
|
|
~ (S) { } |
2373 |
|
|
|
2374 |
|
|
&SystemLiteral ($doc => $doc); |
2375 |
|
|
|
2376 |
|
|
~? (S) { } |
2377 |
|
|
} |
2378 |
|
|
|
2379 |
|
|
~ (MDC) { |
2380 |
|
|
?lexmode DTD; |
2381 |
|
|
} else { |
2382 |
|
|
?lexmode DTD; |
2383 |
|
|
} |
2384 |
|
|
} // _NotationDeclaration |
2385 |
|
|
|
2386 |
wakaba |
1.6 |
rule _EntityValue ($doc, $decl) { |
2387 |
wakaba |
1.4 |
?lexmode EntityValue; |
2388 |
|
|
|
2389 |
|
|
my $vals; |
2390 |
wakaba |
1.6 |
my $reptxt; |
2391 |
wakaba |
1.4 |
lang:Perl { |
2392 |
|
|
$vals = []; |
2393 |
wakaba |
1.6 |
$reptxt = ''; |
2394 |
wakaba |
1.4 |
} |
2395 |
|
|
|
2396 |
|
|
~* (STRING) { |
2397 |
wakaba |
1.6 |
lang:Perl ($v => $token.value) { |
2398 |
|
|
$reptxt .= $v; |
2399 |
|
|
} |
2400 |
wakaba |
1.4 |
} (PERO) { |
2401 |
|
|
?lexmode EntityDeclaration; |
2402 |
wakaba |
1.6 |
|
2403 |
|
|
// TODO: Expand or wferror if internal subset |
2404 |
wakaba |
1.4 |
|
2405 |
|
|
~ (Name) { |
2406 |
|
|
|
2407 |
|
|
} |
2408 |
|
|
|
2409 |
|
|
~ (REFC) { |
2410 |
|
|
?lexmode EntityValue; |
2411 |
|
|
} else { |
2412 |
|
|
?lexmode EntityValue; |
2413 |
|
|
} |
2414 |
|
|
} (HCRO) { |
2415 |
|
|
&_HexadecimalCharacterReferenceV_ |
2416 |
|
|
($doc => $doc, $vals => $vals); |
2417 |
|
|
|
2418 |
wakaba |
1.6 |
lang:Perl { |
2419 |
|
|
$reptxt .= $vals->[0]-><AG::Node.textContent>; |
2420 |
|
|
$vals = []; |
2421 |
|
|
} |
2422 |
|
|
|
2423 |
wakaba |
1.4 |
~ (REFC) { |
2424 |
|
|
?lexmode EntityValue; |
2425 |
|
|
} else { |
2426 |
|
|
?lexmode EntityValue; |
2427 |
|
|
} |
2428 |
|
|
} (CRO) { |
2429 |
|
|
&_NumericCharacterReferenceV_ |
2430 |
|
|
($doc => $doc, $vals => $vals); |
2431 |
wakaba |
1.6 |
|
2432 |
|
|
lang:Perl { |
2433 |
|
|
$reptxt .= $vals->[0]-><AG::Node.textContent>; |
2434 |
|
|
$vals = []; |
2435 |
|
|
} |
2436 |
wakaba |
1.4 |
|
2437 |
|
|
~ (REFC) { |
2438 |
|
|
?lexmode EntityValue; |
2439 |
|
|
} else { |
2440 |
|
|
?lexmode EntityValue; |
2441 |
|
|
} |
2442 |
|
|
} (ERO) { |
2443 |
wakaba |
1.6 |
&_GeneralEntityReferenceEV_ |
2444 |
wakaba |
1.4 |
($doc => $doc, $vals => $vals); |
2445 |
|
|
|
2446 |
wakaba |
1.6 |
lang:Perl { |
2447 |
|
|
$reptxt .= '&' . $vals->[0] . ';'; |
2448 |
|
|
$vals = []; |
2449 |
|
|
} |
2450 |
|
|
|
2451 |
wakaba |
1.4 |
~ (REFC) { |
2452 |
|
|
?lexmode EntityValue; |
2453 |
|
|
} else { |
2454 |
|
|
?lexmode EntityValue; |
2455 |
|
|
} |
2456 |
|
|
} |
2457 |
|
|
|
2458 |
|
|
~ (LIT) { |
2459 |
|
|
?lexmode MarkupDeclaration; |
2460 |
|
|
} (LITA) { |
2461 |
|
|
?lexmode MarkupDeclaration; |
2462 |
|
|
} else { |
2463 |
|
|
?lexmode MarkupDeclaration; |
2464 |
|
|
} |
2465 |
wakaba |
1.6 |
|
2466 |
|
|
lang:Perl { |
2467 |
|
|
$decl->{reptxt} = \$reptxt; |
2468 |
|
|
} |
2469 |
wakaba |
1.4 |
} // _EntityValue |
2470 |
|
|
|
2471 |
wakaba |
1.6 |
rule _EntityValueA ($doc, $decl) { |
2472 |
wakaba |
1.4 |
?lexmode EntityValueA; |
2473 |
|
|
|
2474 |
|
|
my $vals; |
2475 |
wakaba |
1.6 |
my $reptxt; |
2476 |
wakaba |
1.4 |
lang:Perl { |
2477 |
|
|
$vals = []; |
2478 |
wakaba |
1.6 |
$reptxt = ''; |
2479 |
wakaba |
1.4 |
} |
2480 |
|
|
|
2481 |
|
|
~* (STRING) { |
2482 |
wakaba |
1.6 |
lang:Perl ($v => $token.value) { |
2483 |
|
|
$reptxt .= $v; |
2484 |
|
|
} |
2485 |
wakaba |
1.4 |
} (PERO) { |
2486 |
|
|
?lexmode EntityDeclaration; |
2487 |
|
|
|
2488 |
wakaba |
1.6 |
// TODO: implement this |
2489 |
wakaba |
1.4 |
~ (Name) { |
2490 |
|
|
|
2491 |
|
|
} |
2492 |
|
|
|
2493 |
|
|
~ (REFC) { |
2494 |
|
|
?lexmode EntityValueA; |
2495 |
|
|
} else { |
2496 |
|
|
?lexmode EntityValueA; |
2497 |
|
|
} |
2498 |
|
|
} (HCRO) { |
2499 |
|
|
&_HexadecimalCharacterReferenceV_ |
2500 |
|
|
($doc => $doc, $vals => $vals); |
2501 |
|
|
|
2502 |
wakaba |
1.6 |
lang:Perl { |
2503 |
|
|
$reptxt .= $vals->[0]-><AG::Node.textContent>; |
2504 |
|
|
$vals = []; |
2505 |
|
|
} |
2506 |
|
|
|
2507 |
|
|
|
2508 |
wakaba |
1.4 |
~ (REFC) { |
2509 |
|
|
?lexmode EntityValueA; |
2510 |
|
|
} else { |
2511 |
|
|
?lexmode EntityValueA; |
2512 |
|
|
} |
2513 |
|
|
} (CRO) { |
2514 |
|
|
&_NumericCharacterReferenceV_ |
2515 |
|
|
($doc => $doc, $vals => $vals); |
2516 |
|
|
|
2517 |
wakaba |
1.6 |
lang:Perl { |
2518 |
|
|
$reptxt .= $vals->[0]-><AG::Node.textContent>; |
2519 |
|
|
$vals = []; |
2520 |
|
|
} |
2521 |
|
|
|
2522 |
wakaba |
1.4 |
~ (REFC) { |
2523 |
|
|
?lexmode EntityValueA; |
2524 |
|
|
} else { |
2525 |
|
|
?lexmode EntityValueA; |
2526 |
|
|
} |
2527 |
|
|
} (ERO) { |
2528 |
wakaba |
1.6 |
&_GeneralEntityReferenceEV_ |
2529 |
wakaba |
1.4 |
($doc => $doc, $vals => $vals); |
2530 |
|
|
|
2531 |
wakaba |
1.6 |
lang:Perl { |
2532 |
|
|
$reptxt .= '&' . $vals->[0] . ';'; |
2533 |
|
|
$vals = []; |
2534 |
|
|
} |
2535 |
|
|
|
2536 |
wakaba |
1.4 |
~ (REFC) { |
2537 |
|
|
?lexmode EntityValueA; |
2538 |
|
|
} else { |
2539 |
|
|
?lexmode EntityValueA; |
2540 |
|
|
} |
2541 |
|
|
} |
2542 |
|
|
|
2543 |
|
|
~ (LITA) { |
2544 |
|
|
?lexmode MarkupDeclaration; |
2545 |
|
|
} else { |
2546 |
|
|
?lexmode MarkupDeclaration; |
2547 |
|
|
} |
2548 |
wakaba |
1.6 |
|
2549 |
|
|
lang:Perl { |
2550 |
|
|
$decl->{reptxt} = \$reptxt; |
2551 |
|
|
} |
2552 |
wakaba |
1.4 |
} // _EntityValueA |
2553 |
|
|
|
2554 |
|
|
|
2555 |
|
|
/* |
2556 |
|
|
XML Name |
2557 |
|
|
*/ |
2558 |
|
|
lexmode NameChar { |
2559 |
|
|
$NameStartChar10 := [ |
2560 |
|
|
'_' ':' |
2561 |
|
|
// Letter |
2562 |
|
|
// BaseChar |
2563 |
|
|
U+0041..U+005A U+0061..U+007A U+00C0..U+00D6 |
2564 |
|
|
U+00D8..U+00F6 U+00F8..U+00FF U+0100..U+0131 |
2565 |
|
|
U+0134..U+013E U+0141..U+0148 U+014A..U+017E |
2566 |
|
|
U+0180..U+01C3 U+01CD..U+01F0 U+01F4..U+01F5 |
2567 |
|
|
U+01FA..U+0217 U+0250..U+02A8 U+02BB..U+02C1 |
2568 |
|
|
U+0386 U+0388..U+038A U+038C U+038E..U+03A1 |
2569 |
|
|
U+03A3..U+03CE U+03D0..U+03D6 U+03DA U+03DC |
2570 |
|
|
U+03DE U+03E0 U+03E2..U+03F3 U+0401..U+040C |
2571 |
|
|
U+040E..U+044F U+0451..U+045C U+045E..U+0481 |
2572 |
|
|
U+0490..U+04C4 U+04C7..U+04C8 U+04CB..U+04CC |
2573 |
|
|
U+04D0..U+04EB U+04EE..U+04F5 U+04F8..U+04F9 |
2574 |
|
|
U+0531..U+0556 U+0559 U+0561..U+0586 |
2575 |
|
|
U+05D0..U+05EA U+05F0..U+05F2 U+0621..U+063A |
2576 |
|
|
U+0641..U+064A U+0671..U+06B7 U+06BA..U+06BE |
2577 |
|
|
U+06C0..U+06CE U+06D0..U+06D3 U+06D5 |
2578 |
|
|
U+06E5..U+06E6 U+0905..U+0939 U+093D |
2579 |
|
|
U+0958..U+0961 U+0985..U+098C U+098F..U+0990 |
2580 |
|
|
U+0993..U+09A8 U+09AA..U+09B0 U+09B2 |
2581 |
|
|
U+09B6..U+09B9 U+09DC..U+09DD U+09DF..U+09E1 |
2582 |
|
|
U+09F0..U+09F1 U+0A05..U+0A0A U+0A0F..U+0A10 |
2583 |
|
|
U+0A13..U+0A28 U+0A2A..U+0A30 U+0A32..U+0A33 |
2584 |
|
|
U+0A35..U+0A36 U+0A38..U+0A39 U+0A59..U+0A5C |
2585 |
|
|
U+0A5E U+0A72..U+0A74 U+0A85..U+0A8B U+0A8D |
2586 |
|
|
U+0A8F..U+0A91 U+0A93..U+0AA8 U+0AAA..U+0AB0 |
2587 |
|
|
U+0AB2..U+0AB3 U+0AB5..U+0AB9 U+0ABD U+0AE0 |
2588 |
|
|
U+0B05..U+0B0C U+0B0F..U+0B10 U+0B13..U+0B28 |
2589 |
|
|
U+0B2A..U+0B30 U+0B32..U+0B33 U+0B36..U+0B39 |
2590 |
|
|
U+0B3D U+0B5C..U+0B5D U+0B5F..U+0B61 |
2591 |
|
|
U+0B85..U+0B8A U+0B8E..U+0B90 U+0B92..U+0B95 |
2592 |
|
|
U+0B99..U+0B9A U+0B9C U+0B9E..U+0B9F |
2593 |
|
|
U+0BA3..U+0BA4 U+0BA8..U+0BAA U+0BAE..U+0BB5 |
2594 |
|
|
U+0BB7..U+0BB9 U+0C05..U+0C0C U+0C0E..U+0C10 |
2595 |
|
|
U+0C12..U+0C28 U+0C2A..U+0C33 U+0C35..U+0C39 |
2596 |
|
|
U+0C60..U+0C61 U+0C85..U+0C8C U+0C8E..U+0C90 |
2597 |
|
|
U+0C92..U+0CA8 U+0CAA..U+0CB3 U+0CB5..U+0CB9 |
2598 |
|
|
U+0CDE U+0CE0..U+0CE1 U+0D05..U+0D0C |
2599 |
|
|
U+0D0E..U+0D10 U+0D12..U+0D28 U+0D2A..U+0D39 |
2600 |
|
|
U+0D60..U+0D61 U+0E01..U+0E2E U+0E30 |
2601 |
|
|
U+0E32..U+0E33 U+0E40..U+0E45 U+0E81..U+0E82 |
2602 |
|
|
U+0E84 U+0E87..U+0E88 U+0E8A U+0E8D |
2603 |
|
|
U+0E94..U+0E97 U+0E99..U+0E9F U+0EA1..U+0EA3 |
2604 |
|
|
U+0EA5 U+0EA7 U+0EAA..U+0EAB U+0EAD..U+0EAE |
2605 |
|
|
U+0EB0 U+0EB2..U+0EB3 U+0EBD U+0EC0..U+0EC4 |
2606 |
|
|
U+0F40..U+0F47 U+0F49..U+0F69 U+10A0..U+10C5 |
2607 |
|
|
U+10D0..U+10F6 U+1100 U+1102..U+1103 |
2608 |
|
|
U+1105..U+1107 U+1109 U+110B..U+110C |
2609 |
|
|
U+110E..U+1112 U+113C U+113E U+1140 U+114C |
2610 |
|
|
U+114E U+1150 U+1154..U+1155 U+1159 |
2611 |
|
|
U+115F..U+1161 U+1163 U+1165 U+1167 U+1169 |
2612 |
|
|
U+116D..U+116E U+1172..U+1173 U+1175 U+119E |
2613 |
|
|
U+11A8 U+11AB U+11AE..U+11AF U+11B7..U+11B8 |
2614 |
|
|
U+11BA U+11BC..U+11C2 U+11EB U+11F0 U+11F9 |
2615 |
|
|
U+1E00..U+1E9B U+1EA0..U+1EF9 U+1F00..U+1F15 |
2616 |
|
|
U+1F18..U+1F1D U+1F20..U+1F45 U+1F48..U+1F4D |
2617 |
|
|
U+1F50..U+1F57 U+1F59 U+1F5B U+1F5D |
2618 |
|
|
U+1F5F..U+1F7D U+1F80..U+1FB4 U+1FB6..U+1FBC |
2619 |
|
|
U+1FBE U+1FC2..U+1FC4 U+1FC6..U+1FCC |
2620 |
|
|
U+1FD0..U+1FD3 U+1FD6..U+1FDB U+1FE0..U+1FEC |
2621 |
|
|
U+1FF2..U+1FF4 U+1FF6..U+1FFC U+2126 |
2622 |
|
|
U+212A..U+212B U+212E U+2180..U+2182 |
2623 |
|
|
U+3041..U+3094 U+30A1..U+30FA U+3105..U+312C |
2624 |
|
|
U+AC00..U+D7A3 |
2625 |
|
|
// Ideographic |
2626 |
|
|
U+4E00..U+9FA5 U+3007 U+3021..U+3029 |
2627 |
|
|
]; |
2628 |
|
|
$NameChar10 := [ |
2629 |
|
|
'.' '-' '_' ':' |
2630 |
|
|
// Letter |
2631 |
|
|
// BaseChar |
2632 |
|
|
U+0041..U+005A U+0061..U+007A U+00C0..U+00D6 |
2633 |
|
|
U+00D8..U+00F6 U+00F8..U+00FF U+0100..U+0131 |
2634 |
|
|
U+0134..U+013E U+0141..U+0148 U+014A..U+017E |
2635 |
|
|
U+0180..U+01C3 U+01CD..U+01F0 U+01F4..U+01F5 |
2636 |
|
|
U+01FA..U+0217 U+0250..U+02A8 U+02BB..U+02C1 |
2637 |
|
|
U+0386 U+0388..U+038A U+038C U+038E..U+03A1 |
2638 |
|
|
U+03A3..U+03CE U+03D0..U+03D6 U+03DA U+03DC |
2639 |
|
|
U+03DE U+03E0 U+03E2..U+03F3 U+0401..U+040C |
2640 |
|
|
U+040E..U+044F U+0451..U+045C U+045E..U+0481 |
2641 |
|
|
U+0490..U+04C4 U+04C7..U+04C8 U+04CB..U+04CC |
2642 |
|
|
U+04D0..U+04EB U+04EE..U+04F5 U+04F8..U+04F9 |
2643 |
|
|
U+0531..U+0556 U+0559 U+0561..U+0586 |
2644 |
|
|
U+05D0..U+05EA U+05F0..U+05F2 U+0621..U+063A |
2645 |
|
|
U+0641..U+064A U+0671..U+06B7 U+06BA..U+06BE |
2646 |
|
|
U+06C0..U+06CE U+06D0..U+06D3 U+06D5 |
2647 |
|
|
U+06E5..U+06E6 U+0905..U+0939 U+093D |
2648 |
|
|
U+0958..U+0961 U+0985..U+098C U+098F..U+0990 |
2649 |
|
|
U+0993..U+09A8 U+09AA..U+09B0 U+09B2 |
2650 |
|
|
U+09B6..U+09B9 U+09DC..U+09DD U+09DF..U+09E1 |
2651 |
|
|
U+09F0..U+09F1 U+0A05..U+0A0A U+0A0F..U+0A10 |
2652 |
|
|
U+0A13..U+0A28 U+0A2A..U+0A30 U+0A32..U+0A33 |
2653 |
|
|
U+0A35..U+0A36 U+0A38..U+0A39 U+0A59..U+0A5C |
2654 |
|
|
U+0A5E U+0A72..U+0A74 U+0A85..U+0A8B U+0A8D |
2655 |
|
|
U+0A8F..U+0A91 U+0A93..U+0AA8 U+0AAA..U+0AB0 |
2656 |
|
|
U+0AB2..U+0AB3 U+0AB5..U+0AB9 U+0ABD U+0AE0 |
2657 |
|
|
U+0B05..U+0B0C U+0B0F..U+0B10 U+0B13..U+0B28 |
2658 |
|
|
U+0B2A..U+0B30 U+0B32..U+0B33 U+0B36..U+0B39 |
2659 |
|
|
U+0B3D U+0B5C..U+0B5D U+0B5F..U+0B61 |
2660 |
|
|
U+0B85..U+0B8A U+0B8E..U+0B90 U+0B92..U+0B95 |
2661 |
|
|
U+0B99..U+0B9A U+0B9C U+0B9E..U+0B9F |
2662 |
|
|
U+0BA3..U+0BA4 U+0BA8..U+0BAA U+0BAE..U+0BB5 |
2663 |
|
|
U+0BB7..U+0BB9 U+0C05..U+0C0C U+0C0E..U+0C10 |
2664 |
|
|
U+0C12..U+0C28 U+0C2A..U+0C33 U+0C35..U+0C39 |
2665 |
|
|
U+0C60..U+0C61 U+0C85..U+0C8C U+0C8E..U+0C90 |
2666 |
|
|
U+0C92..U+0CA8 U+0CAA..U+0CB3 U+0CB5..U+0CB9 |
2667 |
|
|
U+0CDE U+0CE0..U+0CE1 U+0D05..U+0D0C |
2668 |
|
|
U+0D0E..U+0D10 U+0D12..U+0D28 U+0D2A..U+0D39 |
2669 |
|
|
U+0D60..U+0D61 U+0E01..U+0E2E U+0E30 |
2670 |
|
|
U+0E32..U+0E33 U+0E40..U+0E45 U+0E81..U+0E82 |
2671 |
|
|
U+0E84 U+0E87..U+0E88 U+0E8A U+0E8D |
2672 |
|
|
U+0E94..U+0E97 U+0E99..U+0E9F U+0EA1..U+0EA3 |
2673 |
|
|
U+0EA5 U+0EA7 U+0EAA..U+0EAB U+0EAD..U+0EAE |
2674 |
|
|
U+0EB0 U+0EB2..U+0EB3 U+0EBD U+0EC0..U+0EC4 |
2675 |
|
|
U+0F40..U+0F47 U+0F49..U+0F69 U+10A0..U+10C5 |
2676 |
|
|
U+10D0..U+10F6 U+1100 U+1102..U+1103 |
2677 |
|
|
U+1105..U+1107 U+1109 U+110B..U+110C |
2678 |
|
|
U+110E..U+1112 U+113C U+113E U+1140 U+114C |
2679 |
|
|
U+114E U+1150 U+1154..U+1155 U+1159 |
2680 |
|
|
U+115F..U+1161 U+1163 U+1165 U+1167 U+1169 |
2681 |
|
|
U+116D..U+116E U+1172..U+1173 U+1175 U+119E |
2682 |
|
|
U+11A8 U+11AB U+11AE..U+11AF U+11B7..U+11B8 |
2683 |
|
|
U+11BA U+11BC..U+11C2 U+11EB U+11F0 U+11F9 |
2684 |
|
|
U+1E00..U+1E9B U+1EA0..U+1EF9 U+1F00..U+1F15 |
2685 |
|
|
U+1F18..U+1F1D U+1F20..U+1F45 U+1F48..U+1F4D |
2686 |
|
|
U+1F50..U+1F57 U+1F59 U+1F5B U+1F5D |
2687 |
|
|
U+1F5F..U+1F7D U+1F80..U+1FB4 U+1FB6..U+1FBC |
2688 |
|
|
U+1FBE U+1FC2..U+1FC4 U+1FC6..U+1FCC |
2689 |
|
|
U+1FD0..U+1FD3 U+1FD6..U+1FDB U+1FE0..U+1FEC |
2690 |
|
|
U+1FF2..U+1FF4 U+1FF6..U+1FFC U+2126 |
2691 |
|
|
U+212A..U+212B U+212E U+2180..U+2182 |
2692 |
|
|
U+3041..U+3094 U+30A1..U+30FA U+3105..U+312C |
2693 |
|
|
U+AC00..U+D7A3 |
2694 |
|
|
// Ideographic |
2695 |
|
|
U+4E00..U+9FA5 U+3007 U+3021..U+3029 |
2696 |
|
|
// Digit |
2697 |
|
|
U+0030..U+0039 U+0660..U+0669 U+06F0..U+06F9 |
2698 |
|
|
U+0966..U+096F U+09E6..U+09EF U+0A66..U+0A6F |
2699 |
|
|
U+0AE6..U+0AEF U+0B66..U+0B6F U+0BE7..U+0BEF |
2700 |
|
|
U+0C66..U+0C6F U+0CE6..U+0CEF U+0D66..U+0D6F |
2701 |
|
|
U+0E50..U+0E59 U+0ED0..U+0ED9 U+0F20..U+0F29 |
2702 |
|
|
// CombiningChar |
2703 |
|
|
U+0300..U+0345 U+0360..U+0361 U+0483..U+0486 |
2704 |
|
|
U+0591..U+05A1 U+05A3..U+05B9 U+05BB..U+05BD |
2705 |
|
|
U+05BF U+05C1..U+05C2 U+05C4 U+064B..U+0652 |
2706 |
|
|
U+0670 U+06D6..U+06DC U+06DD..U+06DF |
2707 |
|
|
U+06E0..U+06E4 U+06E7..U+06E8 U+06EA..U+06ED |
2708 |
|
|
U+0901..U+0903 U+093C U+093E..U+094C U+094D |
2709 |
|
|
U+0951..U+0954 U+0962..U+0963 U+0981..U+0983 |
2710 |
|
|
U+09BC U+09BE U+09BF U+09C0..U+09C4 |
2711 |
|
|
U+09C7..U+09C8 U+09CB..U+09CD U+09D7 |
2712 |
|
|
U+09E2..U+09E3 U+0A02 U+0A3C U+0A3E U+0A3F |
2713 |
|
|
U+0A40..U+0A42 U+0A47..U+0A48 U+0A4B..U+0A4D |
2714 |
|
|
U+0A70..U+0A71 U+0A81..U+0A83 U+0ABC |
2715 |
|
|
U+0ABE..U+0AC5 U+0AC7..U+0AC9 U+0ACB..U+0ACD |
2716 |
|
|
U+0B01..U+0B03 U+0B3C U+0B3E..U+0B43 |
2717 |
|
|
U+0B47..U+0B48 U+0B4B..U+0B4D U+0B56..U+0B57 |
2718 |
|
|
U+0B82..U+0B83 U+0BBE..U+0BC2 U+0BC6..U+0BC8 |
2719 |
|
|
U+0BCA..U+0BCD U+0BD7 U+0C01..U+0C03 |
2720 |
|
|
U+0C3E..U+0C44 U+0C46..U+0C48 U+0C4A..U+0C4D |
2721 |
|
|
U+0C55..U+0C56 U+0C82..U+0C83 U+0CBE..U+0CC4 |
2722 |
|
|
U+0CC6..U+0CC8 U+0CCA..U+0CCD U+0CD5..U+0CD6 |
2723 |
|
|
U+0D02..U+0D03 U+0D3E..U+0D43 U+0D46..U+0D48 |
2724 |
|
|
U+0D4A..U+0D4D U+0D57 U+0E31 U+0E34..U+0E3A |
2725 |
|
|
U+0E47..U+0E4E U+0EB1 U+0EB4..U+0EB9 |
2726 |
|
|
U+0EBB..U+0EBC U+0EC8..U+0ECD U+0F18..U+0F19 |
2727 |
|
|
U+0F35 U+0F37 U+0F39 U+0F3E U+0F3F |
2728 |
|
|
U+0F71..U+0F84 U+0F86..U+0F8B U+0F90..U+0F95 |
2729 |
|
|
U+0F97 U+0F99..U+0FAD U+0FB1..U+0FB7 U+0FB9 |
2730 |
|
|
U+20D0..U+20DC U+20E1 U+302A..U+302F U+3099 |
2731 |
|
|
U+309A |
2732 |
|
|
// Extender |
2733 |
|
|
U+00B7 U+02D0 U+02D1 U+0387 U+0640 U+0E46 |
2734 |
|
|
U+0EC6 U+3005 U+3031..U+3035 U+309D..U+309E |
2735 |
|
|
U+30FC..U+30FE |
2736 |
|
|
]; |
2737 |
wakaba |
1.1 |
|
2738 |
|
|
$NameStartChar11 := [ |
2739 |
|
|
':' '_' |
2740 |
|
|
'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' |
2741 |
|
|
'N' 'O' 'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z' |
2742 |
|
|
'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' |
2743 |
|
|
'n' 'o' 'p' 'q' 'r' 's' 't' 'u' 'v' 'w' 'x' 'y' 'z' |
2744 |
|
|
U+00C0..U+00D6 U+00D8..U+00F6 U+00F8..U+02FF |
2745 |
|
|
U+0370..U+037D U+037F..U+1FFF U+200C..U+200D |
2746 |
|
|
U+2070..U+218F U+2C00..U+2FEF U+3001..U+D7FF |
2747 |
|
|
U+F900..U+FDCF U+FDF0..U+FFFD U+10000..U+EFFFF |
2748 |
|
|
]; |
2749 |
|
|
$NameChar11 := [ |
2750 |
|
|
'-' '.' '0' '1' '2' '3' '4' '5' '6' '7' '8' '9' |
2751 |
|
|
U+00B7 U+0300..U+036F U+203F..U+2040 |
2752 |
|
|
// NameStartChar |
2753 |
|
|
':' '_' |
2754 |
|
|
'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' |
2755 |
|
|
'N' 'O' 'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z' |
2756 |
|
|
'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' |
2757 |
|
|
'n' 'o' 'p' 'q' 'r' 's' 't' 'u' 'v' 'w' 'x' 'y' 'z' |
2758 |
|
|
U+00C0..U+00D6 U+00D8..U+00F6 U+00F8..U+02FF |
2759 |
|
|
U+0370..U+037D U+037F..U+1FFF U+200C..U+200D |
2760 |
|
|
U+2070..U+218F U+2C00..U+2FEF U+3001..U+D7FF |
2761 |
|
|
U+F900..U+FDCF U+FDF0..U+FFFD U+10000..U+EFFFF |
2762 |
|
|
]; |
2763 |
wakaba |
1.4 |
} // NameChar |
2764 |
|
|
|
2765 |
|
|
lexmode Name |
2766 |
|
|
: extends => 'NameChar' |
2767 |
|
|
{ |
2768 |
wakaba |
1.1 |
Name : value := $NameStartChar11 $NameChar11*; |
2769 |
|
|
} // Name |
2770 |
wakaba |
1.4 |
|
2771 |
|
|
lexmode Nmtoken |
2772 |
|
|
: extends => 'NameChar' |
2773 |
|
|
{ |
2774 |
|
|
Nmtoken : value := $NameChar11*; |
2775 |
|
|
} // Nmtoken |
2776 |
wakaba |
1.1 |
|
2777 |
|
|
/* |
2778 |
|
|
Space |
2779 |
|
|
*/ |
2780 |
|
|
lexmode S { |
2781 |
|
|
S := [U+0009 U+000A U+000D U+0020]+; |
2782 |
|
|
} // S |
2783 |
|
|
|
2784 |
|
|
/* |
2785 |
|
|
Document end scanning mode |
2786 |
|
|
*/ |
2787 |
|
|
lexmode DocumentEnd |
2788 |
|
|
: standalone |
2789 |
|
|
: extends => 'S' |
2790 |
|
|
{ |
2791 |
|
|
/* |
2792 |
|
|
Processing instruction |
2793 |
|
|
*/ |
2794 |
|
|
PIO := ['<'] ['?']; |
2795 |
|
|
|
2796 |
|
|
/* |
2797 |
|
|
Comment declaration |
2798 |
|
|
*/ |
2799 |
|
|
CDO := ['<'] ['!'] ['-'] ['-']; |
2800 |
|
|
} // DocumentEnd |
2801 |
|
|
|
2802 |
|
|
/* |
2803 |
|
|
Document misc scanning mode |
2804 |
|
|
|
2805 |
|
|
This mode scans |Misc| constructions as well |
2806 |
|
|
as document element's start tag. |
2807 |
|
|
*/ |
2808 |
|
|
lexmode DocumentMisc |
2809 |
|
|
: standalone |
2810 |
|
|
: extends => 'DocumentEnd' |
2811 |
|
|
{ |
2812 |
|
|
/* |
2813 |
|
|
Document element start tag |
2814 |
|
|
*/ |
2815 |
|
|
STAGO := ['<']; |
2816 |
|
|
} // DocumentMisc |
2817 |
|
|
|
2818 |
|
|
/* |
2819 |
|
|
Document prolog scanning mode |
2820 |
|
|
*/ |
2821 |
|
|
lexmode DocumentProlog |
2822 |
|
|
: standalone |
2823 |
|
|
: extends => 'DocumentMisc' |
2824 |
|
|
{ |
2825 |
|
|
/* |
2826 |
|
|
|DOCTYPE| declaration |
2827 |
|
|
*/ |
2828 |
|
|
MDO := ['<'] ['!']; |
2829 |
|
|
} // DocumentProlog |
2830 |
|
|
|
2831 |
|
|
/* |
2832 |
|
|
Document start scanning mode |
2833 |
|
|
*/ |
2834 |
|
|
lexmode DocumentStart |
2835 |
|
|
: initial |
2836 |
|
|
: standalone |
2837 |
|
|
: extends => 'DocumentProlog' |
2838 |
|
|
{ |
2839 |
|
|
/* |
2840 |
|
|
XML declaration |
2841 |
|
|
*/ |
2842 |
|
|
XDO := ['<'] ['?'] ['x'] ['m'] ['l']; |
2843 |
|
|
} // DocumentStart |
2844 |
|
|
|
2845 |
|
|
/* |
2846 |
|
|
Comment declaration scanning mode |
2847 |
|
|
*/ |
2848 |
|
|
lexmode CommentDeclaration |
2849 |
|
|
: standalone |
2850 |
|
|
{ |
2851 |
|
|
/* |
2852 |
|
|
Comment close |
2853 |
|
|
*/ |
2854 |
|
|
COM := ['-'] ['-']; |
2855 |
|
|
|
2856 |
|
|
/* |
2857 |
|
|
Comment data |
2858 |
|
|
*/ |
2859 |
|
|
$string := ['-']? [^'-']; |
2860 |
|
|
STRING : value := $string+; |
2861 |
|
|
} // CommentDeclaration |
2862 |
|
|
|
2863 |
|
|
/* |
2864 |
|
|
Processing instruction name and |S| scanning mode |
2865 |
|
|
*/ |
2866 |
|
|
lexmode PIName |
2867 |
|
|
: standalone |
2868 |
|
|
: extends => 'Name' |
2869 |
|
|
: extends => 'S' |
2870 |
|
|
{ |
2871 |
|
|
/* |
2872 |
|
|
Processing instruction close |
2873 |
|
|
*/ |
2874 |
|
|
PIC := ['?'] ['>']; |
2875 |
|
|
} // PIName |
2876 |
|
|
|
2877 |
|
|
/* |
2878 |
|
|
Processing instruction data scanning mode |
2879 |
|
|
*/ |
2880 |
|
|
lexmode PIData |
2881 |
|
|
: standalone |
2882 |
|
|
{ |
2883 |
|
|
/* |
2884 |
|
|
Processing instruction close |
2885 |
|
|
*/ |
2886 |
|
|
PIC := ['?'] ['>']; |
2887 |
|
|
|
2888 |
|
|
/* |
2889 |
|
|
Processing instruction target data |
2890 |
|
|
*/ |
2891 |
wakaba |
1.2 |
?default-token DATA : value; |
2892 |
wakaba |
1.1 |
} // PIData |
2893 |
|
|
|
2894 |
|
|
/* |
2895 |
|
|
Content of element scanning mode |
2896 |
|
|
*/ |
2897 |
|
|
lexmode ElementContent |
2898 |
|
|
: standalone |
2899 |
|
|
{ |
2900 |
|
|
/* |
2901 |
|
|
Start tag open |
2902 |
|
|
*/ |
2903 |
|
|
STAGO := ['<']; |
2904 |
|
|
|
2905 |
|
|
/* |
2906 |
|
|
End tag open |
2907 |
|
|
*/ |
2908 |
|
|
ETAGO := ['<'] ['/']; |
2909 |
|
|
|
2910 |
|
|
/* |
2911 |
|
|
Hexadecimal character reference open |
2912 |
|
|
*/ |
2913 |
|
|
HCRO := ['&'] ['#'] ['x']; |
2914 |
|
|
|
2915 |
|
|
/* |
2916 |
|
|
Numeric character reference open |
2917 |
|
|
*/ |
2918 |
|
|
CRO := ['&'] ['#']; |
2919 |
|
|
|
2920 |
|
|
/* |
2921 |
|
|
General entity reference open |
2922 |
|
|
*/ |
2923 |
|
|
ERO := ['&']; |
2924 |
|
|
|
2925 |
|
|
/* |
2926 |
|
|
Comment declaration open |
2927 |
|
|
*/ |
2928 |
|
|
CDO := ['<'] ['!'] ['-'] ['-']; |
2929 |
|
|
|
2930 |
|
|
/* |
2931 |
|
|
CDATA section open |
2932 |
|
|
*/ |
2933 |
|
|
CDSO := ['<'] ['!'] ['['] |
2934 |
|
|
['C'] ['D'] ['A'] ['T'] ['A'] ['[']; |
2935 |
|
|
|
2936 |
|
|
/* |
2937 |
|
|
Processing instruction open |
2938 |
|
|
*/ |
2939 |
|
|
PIO := ['<'] ['?']; |
2940 |
wakaba |
1.2 |
|
2941 |
|
|
/* |
2942 |
|
|
Markup section end |
2943 |
|
|
*/ |
2944 |
|
|
MSE := [']'] [']'] ['>']; |
2945 |
|
|
|
2946 |
|
|
/* |
2947 |
|
|
Character data |
2948 |
|
|
*/ |
2949 |
|
|
/* |
2950 |
|
|
Character data and/or |MSE| |
2951 |
|
|
*/ |
2952 |
|
|
?default-token CharData : value; |
2953 |
wakaba |
1.1 |
} // ElementContent |
2954 |
|
|
|
2955 |
|
|
/* |
2956 |
|
|
CDATA section content scanning mode |
2957 |
|
|
*/ |
2958 |
|
|
lexmode CDATASectionContent |
2959 |
|
|
: standalone |
2960 |
|
|
{ |
2961 |
|
|
/* |
2962 |
|
|
Markup section end |
2963 |
|
|
*/ |
2964 |
|
|
MSE := [']'] [']'] ['>']; |
2965 |
|
|
|
2966 |
|
|
/* |
2967 |
|
|
Character data |
2968 |
wakaba |
1.2 |
*/ |
2969 |
|
|
?default-token CData : value; |
2970 |
wakaba |
1.1 |
} // CDATASectionContent |
2971 |
|
|
|
2972 |
|
|
lexmode EntityReference |
2973 |
|
|
: standalone |
2974 |
|
|
: extends => 'Name' |
2975 |
|
|
{ |
2976 |
|
|
/* |
2977 |
|
|
Reference close |
2978 |
|
|
*/ |
2979 |
|
|
REFC := [';']; |
2980 |
|
|
} // EntityReference |
2981 |
|
|
|
2982 |
|
|
lexmode NumericCharacterReference |
2983 |
|
|
: standalone |
2984 |
|
|
{ |
2985 |
|
|
/* |
2986 |
|
|
Decimal number |
2987 |
|
|
*/ |
2988 |
|
|
$digit := ['0' '1' '2' '3' '4' '5' '6' '7' '8' '9']; |
2989 |
|
|
NUMBER : value := $digit+; |
2990 |
|
|
|
2991 |
|
|
/* |
2992 |
|
|
Reference close |
2993 |
|
|
*/ |
2994 |
|
|
REFC := [';']; |
2995 |
|
|
} // NumericCharacterReference |
2996 |
|
|
|
2997 |
|
|
lexmode HexadecimalCharacterReference |
2998 |
|
|
: standalone |
2999 |
|
|
{ |
3000 |
|
|
/* |
3001 |
|
|
Hexadecimal number |
3002 |
|
|
*/ |
3003 |
|
|
$hexdigit := ['0' '1' '2' '3' '4' '5' '6' '7' '8' '9' |
3004 |
|
|
'A' 'B' 'C' 'D' 'E' 'F' |
3005 |
|
|
'a' 'b' 'c' 'd' 'e' 'f']; |
3006 |
|
|
Hex : value := $hexdigit+; |
3007 |
|
|
|
3008 |
|
|
/* |
3009 |
|
|
Reference close |
3010 |
|
|
*/ |
3011 |
|
|
REFC := [';']; |
3012 |
|
|
} // HexadecimalCharacterReference |
3013 |
|
|
|
3014 |
wakaba |
1.3 |
lexmode XMLDeclaration |
3015 |
|
|
: standalone |
3016 |
|
|
: extends => 'Name' |
3017 |
|
|
: extends => 'S' |
3018 |
|
|
{ |
3019 |
|
|
|
3020 |
|
|
/* |
3021 |
|
|
Value indicator |
3022 |
|
|
*/ |
3023 |
|
|
VI := ['=']; |
3024 |
|
|
|
3025 |
|
|
/* |
3026 |
|
|
Literal open |
3027 |
|
|
*/ |
3028 |
|
|
LIT := ['"']; |
3029 |
|
|
LITA := [U+0027]; |
3030 |
|
|
|
3031 |
|
|
/* |
3032 |
|
|
Processing instruction close |
3033 |
|
|
*/ |
3034 |
|
|
PIC := ['?'] ['>']; |
3035 |
|
|
} // XMLDeclaration |
3036 |
|
|
|
3037 |
wakaba |
1.1 |
lexmode StartTag |
3038 |
|
|
: standalone |
3039 |
|
|
: extends => 'Name' |
3040 |
|
|
: extends => 'S' |
3041 |
|
|
{ |
3042 |
|
|
|
3043 |
|
|
/* |
3044 |
|
|
Value indicator |
3045 |
|
|
*/ |
3046 |
|
|
VI := ['=']; |
3047 |
|
|
|
3048 |
|
|
/* |
3049 |
|
|
Literal open |
3050 |
|
|
*/ |
3051 |
|
|
LIT := ['"']; |
3052 |
|
|
LITA := [U+0027]; |
3053 |
|
|
|
3054 |
|
|
/* |
3055 |
|
|
Tag close |
3056 |
|
|
*/ |
3057 |
|
|
TAGC := ['>']; |
3058 |
|
|
|
3059 |
|
|
/* |
3060 |
wakaba |
1.6 |
Null end-tag enabled start-tag close |
3061 |
wakaba |
1.1 |
*/ |
3062 |
wakaba |
1.6 |
NESTC := ['/']; |
3063 |
wakaba |
1.1 |
} // StartTag |
3064 |
|
|
|
3065 |
|
|
lexmode EndTag |
3066 |
|
|
: standalone |
3067 |
|
|
: extends => 'Name' |
3068 |
|
|
: extends => 'S' |
3069 |
|
|
{ |
3070 |
|
|
/* |
3071 |
|
|
Tag close |
3072 |
|
|
*/ |
3073 |
|
|
TAGC := ['>']; |
3074 |
|
|
} // EndTag |
3075 |
|
|
|
3076 |
|
|
lexmode AttributeValueLiteral_ { |
3077 |
|
|
ERO := ['&']; |
3078 |
|
|
CRO := ['&'] ['#']; |
3079 |
|
|
HCRO := ['&'] ['#'] ['x']; |
3080 |
|
|
} // AttributeValueLiteral_ |
3081 |
|
|
|
3082 |
|
|
lexmode AttributeValueLiteral |
3083 |
|
|
: standalone |
3084 |
|
|
: extends => 'AttributeValueLiteral_' |
3085 |
|
|
{ |
3086 |
|
|
LIT := ['"']; |
3087 |
wakaba |
1.3 |
STRING : value := [^'"' '&' '<']+; |
3088 |
wakaba |
1.1 |
} // AttributeValueLiteral |
3089 |
|
|
|
3090 |
|
|
lexmode AttributeValueLiteralA |
3091 |
|
|
: standalone |
3092 |
|
|
: extends => 'AttributeValueLiteral_' |
3093 |
|
|
{ |
3094 |
wakaba |
1.4 |
LITA := [U+0027]; |
3095 |
wakaba |
1.3 |
STRING : value := [^U+0027 '&' '<']+; |
3096 |
wakaba |
1.1 |
} // AttributeValueLiteralA |
3097 |
wakaba |
1.4 |
|
3098 |
|
|
lexmode EntityValue_ { |
3099 |
|
|
PERO := ['%']; |
3100 |
|
|
ERO := ['&']; |
3101 |
|
|
CRO := ['&'] ['#']; |
3102 |
|
|
HCRO := ['&'] ['#'] ['x']; |
3103 |
|
|
} // EntityValue_ |
3104 |
|
|
|
3105 |
|
|
lexmode EntityValue |
3106 |
|
|
: standalone |
3107 |
|
|
: extends => 'EntityValue_' |
3108 |
|
|
{ |
3109 |
|
|
LIT := ['"']; |
3110 |
|
|
STRING : value := [^'"' '&' '%']+; |
3111 |
|
|
} // EntityValue |
3112 |
|
|
|
3113 |
|
|
lexmode EntityValueA |
3114 |
|
|
: standalone |
3115 |
|
|
: extends => 'EntityValue_' |
3116 |
|
|
{ |
3117 |
|
|
LITA := [U+0027]; |
3118 |
|
|
STRING : value := [^U+0027 '&' '%']+; |
3119 |
|
|
} // EntityValueA |
3120 |
|
|
|
3121 |
|
|
lexmode SystemLiteral |
3122 |
|
|
: standalone |
3123 |
|
|
{ |
3124 |
|
|
LIT := ['"']; |
3125 |
|
|
?default-token STRING : value; |
3126 |
|
|
} // SystemLiteral |
3127 |
|
|
|
3128 |
|
|
lexmode SystemLiteralA |
3129 |
|
|
: standalone |
3130 |
|
|
{ |
3131 |
|
|
LITA := [U+0027]; |
3132 |
|
|
?default-token STRING : value; |
3133 |
|
|
} // SystemLiteralA |
3134 |
|
|
|
3135 |
|
|
lexmode DTD |
3136 |
|
|
: standalone |
3137 |
|
|
: extends => 'S' |
3138 |
|
|
{ |
3139 |
|
|
/* |
3140 |
|
|
Markup declaration open |
3141 |
|
|
*/ |
3142 |
|
|
MDO := ['<'] ['!']; |
3143 |
|
|
|
3144 |
|
|
/* |
3145 |
|
|
Comment declaration open |
3146 |
|
|
*/ |
3147 |
|
|
CDO := ['<'] ['!'] ['-'] ['-']; |
3148 |
|
|
|
3149 |
|
|
/* |
3150 |
|
|
Processing instruction open |
3151 |
|
|
*/ |
3152 |
|
|
PIO := ['<'] ['?']; |
3153 |
|
|
|
3154 |
|
|
/* |
3155 |
|
|
Parameter entity reference open |
3156 |
|
|
*/ |
3157 |
|
|
PERO := ['%']; |
3158 |
|
|
|
3159 |
|
|
/* |
3160 |
|
|
Declaration subset close |
3161 |
|
|
*/ |
3162 |
|
|
DSC := [']']; |
3163 |
|
|
|
3164 |
|
|
/* |
3165 |
|
|
Contition section open |
3166 |
|
|
*/ |
3167 |
|
|
CSO := ['<'] ['!'] ['[']; |
3168 |
|
|
} // DTD |
3169 |
|
|
|
3170 |
|
|
/* |
3171 |
|
|
Markup declaration scanning mode |
3172 |
|
|
|
3173 |
|
|
This mode is used to recognize |MDC| that terminates |
3174 |
|
|
a comment declaration as well as the base |lexmode| |
3175 |
|
|
for e.g. document type declaration scanning mode. |
3176 |
|
|
*/ |
3177 |
|
|
lexmode MarkupDeclaration |
3178 |
|
|
: standalone |
3179 |
|
|
: extends => 'Name' |
3180 |
|
|
: extends => 'S' |
3181 |
|
|
{ |
3182 |
|
|
/* |
3183 |
|
|
Markup declaration close |
3184 |
|
|
*/ |
3185 |
|
|
MDC := ['>']; |
3186 |
|
|
|
3187 |
|
|
/* |
3188 |
|
|
Literal open |
3189 |
|
|
*/ |
3190 |
|
|
LIT := ['"']; |
3191 |
|
|
|
3192 |
|
|
/* |
3193 |
|
|
Alternative literal open |
3194 |
|
|
*/ |
3195 |
|
|
LITA := [U+0027]; |
3196 |
|
|
|
3197 |
|
|
/* |
3198 |
|
|
Parameter entity reference open |
3199 |
|
|
*/ |
3200 |
|
|
PERO := ['%']; |
3201 |
|
|
|
3202 |
|
|
/* |
3203 |
|
|
Declaration subset open |
3204 |
|
|
*/ |
3205 |
|
|
DSO := ['[']; |
3206 |
|
|
} // MarkupDeclaration |
3207 |
|
|
|
3208 |
|
|
lexmode ElementDeclaration |
3209 |
|
|
: standalone |
3210 |
|
|
: extends => 'MarkupDeclaration' |
3211 |
|
|
{ |
3212 |
|
|
/* |
3213 |
|
|
Model group open |
3214 |
|
|
*/ |
3215 |
|
|
MGO := ['(']; |
3216 |
|
|
|
3217 |
|
|
/* |
3218 |
|
|
Model group close |
3219 |
|
|
*/ |
3220 |
|
|
MGC := [')']; |
3221 |
|
|
|
3222 |
|
|
/* |
3223 |
|
|
Reserved name indicator |
3224 |
|
|
*/ |
3225 |
|
|
RNI := ['#']; |
3226 |
|
|
|
3227 |
|
|
/* |
3228 |
|
|
Occurence indicators |
3229 |
|
|
*/ |
3230 |
|
|
OPT := ['?']; |
3231 |
|
|
REP := ['*']; |
3232 |
|
|
PLUS := ['+']; |
3233 |
|
|
|
3234 |
|
|
/* |
3235 |
|
|
Connectors |
3236 |
|
|
*/ |
3237 |
|
|
OR := ['|']; |
3238 |
|
|
SEQ := [',']; |
3239 |
|
|
} // ElementDeclaration |
3240 |
|
|
|
3241 |
|
|
lexmode AttlistDeclaration |
3242 |
|
|
: standalone |
3243 |
|
|
: extends => 'MarkupDeclaration' |
3244 |
|
|
{ |
3245 |
|
|
/* |
3246 |
|
|
Enumeration group open |
3247 |
|
|
*/ |
3248 |
|
|
EGO := ['(']; |
3249 |
|
|
|
3250 |
|
|
/* |
3251 |
|
|
Enumeration group close |
3252 |
|
|
*/ |
3253 |
|
|
EGC := [')']; |
3254 |
|
|
|
3255 |
|
|
/* |
3256 |
|
|
Enumeration choice delimiter |
3257 |
|
|
*/ |
3258 |
|
|
OR := ['|']; |
3259 |
|
|
|
3260 |
|
|
/* |
3261 |
|
|
Reserved name indicator |
3262 |
|
|
*/ |
3263 |
|
|
RNI := ['#']; |
3264 |
|
|
} // AttlistDeclaration |
3265 |
|
|
|
3266 |
|
|
lexmode Enumeration |
3267 |
|
|
: standalone |
3268 |
|
|
: extends => 'Nmtoken' |
3269 |
|
|
: extends => 'S' |
3270 |
|
|
{ |
3271 |
|
|
/* |
3272 |
|
|
Enumeration group close |
3273 |
|
|
*/ |
3274 |
|
|
EGC := [')']; |
3275 |
|
|
|
3276 |
|
|
/* |
3277 |
|
|
Enumeration choice delimiter |
3278 |
|
|
*/ |
3279 |
|
|
OR := ['|']; |
3280 |
|
|
} // Enumeration |
3281 |
|
|
|
3282 |
wakaba |
1.1 |
|
3283 |
|
|
token-error default : default { |
3284 |
|
|
lang:Perl { |
3285 |
wakaba |
1.3 |
my $location; |
3286 |
|
|
__CODE{xp|get-location-from-token:: |
3287 |
|
|
$token => {$token}, |
3288 |
|
|
$result => {$location}, |
3289 |
|
|
}__; |
3290 |
|
|
my $continue = __DOMCore:ERROR{xp|wf-syntax-error:: |
3291 |
wakaba |
1.1 |
xp|error-token => {$token}, |
3292 |
|
|
DOMCore|location => {$location}, |
3293 |
|
|
}__; |
3294 |
|
|
unless ($continue) { |
3295 |
|
|
__EXCEPTION{DOMLS|PARSE_ERR:: |
3296 |
|
|
}__; |
3297 |
|
|
} |
3298 |
|
|
$self->{has_error} = true; |
3299 |
|
|
} |
3300 |
|
|
} // default |
3301 |
wakaba |
1.5 |
|
3302 |
|
|
@XMLTests: |
3303 |
|
|
@@XMLTest: |
3304 |
wakaba |
1.6 |
@@@QName: xp.only.docel.test |
3305 |
wakaba |
1.5 |
@@@DEnt: |
3306 |
|
|
@@@@test:value: |
3307 |
|
|
<p></p> |
3308 |
|
|
@@@test:domTree: |
3309 |
|
|
document { |
3310 |
|
|
xml-version: '1.0'; |
3311 |
wakaba |
1.6 |
xml-encoding: null; |
3312 |
|
|
xml-standalone: false; |
3313 |
|
|
element { |
3314 |
|
|
namespace-uri: null; |
3315 |
|
|
prefix: null; |
3316 |
|
|
local-name: 'p'; |
3317 |
|
|
text-content: ''; |
3318 |
|
|
} |
3319 |
|
|
} |
3320 |
|
|
@@XMLTest: |
3321 |
|
|
@@@QName: xp.only.docel.emptyelemtag.test |
3322 |
|
|
@@@DEnt: |
3323 |
|
|
@@@@test:value: |
3324 |
|
|
<p/> |
3325 |
|
|
@@@test:domTree: |
3326 |
|
|
document { |
3327 |
|
|
xml-version: '1.0'; |
3328 |
|
|
xml-encoding: null; |
3329 |
|
|
xml-standalone: false; |
3330 |
wakaba |
1.5 |
element { |
3331 |
|
|
namespace-uri: null; |
3332 |
|
|
prefix: null; |
3333 |
|
|
local-name: 'p'; |
3334 |
|
|
text-content: ''; |
3335 |
|
|
} |
3336 |
|
|
} |
3337 |
wakaba |
1.6 |
|
3338 |
|
|
@@XMLTest: |
3339 |
|
|
@@@QName: xp.doctype.empty.test |
3340 |
|
|
@@@DEnt: |
3341 |
|
|
@@@@test:value: |
3342 |
|
|
<!DOCTYPE a> |
3343 |
|
|
<a></a> |
3344 |
|
|
@@@test:domTree: |
3345 |
|
|
document { |
3346 |
|
|
xml-version: '1.0'; |
3347 |
|
|
xml-encoding: null; |
3348 |
|
|
xml-standalone: false; |
3349 |
|
|
document-type { |
3350 |
|
|
node-name: 'a'; |
3351 |
|
|
} |
3352 |
|
|
element { |
3353 |
|
|
namespace-uri: null; |
3354 |
|
|
prefix: null; |
3355 |
|
|
local-name: 'a'; |
3356 |
|
|
text-content: ''; |
3357 |
|
|
} |
3358 |
|
|
} |
3359 |
|
|
|
3360 |
|
|
@@XMLTest: |
3361 |
|
|
@@@QName: xp.doctype.intsubset.empty.test |
3362 |
|
|
@@@DEnt: |
3363 |
|
|
@@@@test:value: |
3364 |
|
|
<!DOCTYPE a [ |
3365 |
|
|
|
3366 |
|
|
]> |
3367 |
|
|
<a></a> |
3368 |
|
|
@@@test:domTree: |
3369 |
|
|
document { |
3370 |
|
|
xml-version: '1.0'; |
3371 |
|
|
xml-encoding: null; |
3372 |
|
|
xml-standalone: false; |
3373 |
|
|
document-type { |
3374 |
|
|
node-name: 'a'; |
3375 |
|
|
} |
3376 |
|
|
element { |
3377 |
|
|
namespace-uri: null; |
3378 |
|
|
prefix: null; |
3379 |
|
|
local-name: 'a'; |
3380 |
|
|
text-content: ''; |
3381 |
|
|
} |
3382 |
|
|
} |
3383 |
|
|
|
3384 |
|
|
@@XMLTest: |
3385 |
|
|
@@@QName: xp.doctype.intsubset.pi.test |
3386 |
|
|
@@@DEnt: |
3387 |
|
|
@@@@test:value: |
3388 |
|
|
<!DOCTYPE a [ |
3389 |
|
|
<?pi data ?> |
3390 |
|
|
]> |
3391 |
|
|
<a></a> |
3392 |
|
|
@@@test:domTree: |
3393 |
|
|
document { |
3394 |
|
|
xml-version: '1.0'; |
3395 |
|
|
xml-encoding: null; |
3396 |
|
|
xml-standalone: false; |
3397 |
|
|
document-type { |
3398 |
|
|
node-name: 'a'; |
3399 |
|
|
pi { |
3400 |
|
|
target: 'pi'; |
3401 |
|
|
data: 'data '; |
3402 |
|
|
} |
3403 |
|
|
} |
3404 |
|
|
element { |
3405 |
|
|
namespace-uri: null; |
3406 |
|
|
prefix: null; |
3407 |
|
|
local-name: 'a'; |
3408 |
|
|
text-content: ''; |
3409 |
|
|
} |
3410 |
|
|
} |
3411 |
|
|
@@@enImplNote: |
3412 |
|
|
A DOM PI node in doctype node is a manakai extension. |
3413 |
|
|
|
3414 |
|
|
|
3415 |
|
|
@@XMLTest: |
3416 |
|
|
@@@QName: xp.doctype.intsubset.entity.general.internal.test |
3417 |
|
|
@@@DEnt: |
3418 |
|
|
@@@@test:value: |
3419 |
|
|
<!DOCTYPE a [ |
3420 |
|
|
<!ENTITY entity "entity value"> |
3421 |
|
|
]> |
3422 |
|
|
<a></a> |
3423 |
|
|
@@@test:domTree: |
3424 |
|
|
document { |
3425 |
|
|
xml-version: '1.0'; |
3426 |
|
|
xml-encoding: null; |
3427 |
|
|
xml-standalone: false; |
3428 |
|
|
document-type { |
3429 |
|
|
node-name: 'a'; |
3430 |
|
|
} |
3431 |
|
|
element { |
3432 |
|
|
namespace-uri: null; |
3433 |
|
|
prefix: null; |
3434 |
|
|
local-name: 'a'; |
3435 |
|
|
text-content: ''; |
3436 |
|
|
} |
3437 |
|
|
} |
3438 |
|
|
@@XMLTest: |
3439 |
|
|
@@@QName: xp.doctype.intsubset.entity.parameter.internal.test |
3440 |
|
|
@@@DEnt: |
3441 |
|
|
@@@@test:value: |
3442 |
|
|
<!DOCTYPE a [ |
3443 |
|
|
<!ENTITY % entity "entity value"> |
3444 |
|
|
]> |
3445 |
|
|
<a></a> |
3446 |
|
|
@@@test:domTree: |
3447 |
|
|
document { |
3448 |
|
|
xml-version: '1.0'; |
3449 |
|
|
xml-encoding: null; |
3450 |
|
|
xml-standalone: false; |
3451 |
|
|
document-type { |
3452 |
|
|
node-name: 'a'; |
3453 |
|
|
} |
3454 |
|
|
element { |
3455 |
|
|
namespace-uri: null; |
3456 |
|
|
prefix: null; |
3457 |
|
|
local-name: 'a'; |
3458 |
|
|
text-content: ''; |
3459 |
|
|
} |
3460 |
|
|
} |
3461 |
|
|
|
3462 |
|
|
@@XMLTest: |
3463 |
|
|
@@@QName: xp.doctype.internal.entity.root.element.text.only.test |
3464 |
|
|
@@@DEnt: |
3465 |
|
|
@@@@test:value: |
3466 |
|
|
<!DOCTYPE a [ |
3467 |
|
|
<!ENTITY entity "entity value"> |
3468 |
|
|
]> |
3469 |
|
|
<a>&entity;</a> |
3470 |
|
|
@@@test:domTree: |
3471 |
|
|
document { |
3472 |
|
|
xml-version: '1.0'; |
3473 |
|
|
xml-encoding: null; |
3474 |
|
|
xml-standalone: false; |
3475 |
|
|
document-type { |
3476 |
|
|
node-name: 'a'; |
3477 |
|
|
} |
3478 |
|
|
element { |
3479 |
|
|
namespace-uri: null; |
3480 |
|
|
prefix: null; |
3481 |
|
|
local-name: 'a'; |
3482 |
|
|
general-entity-reference { |
3483 |
|
|
node-name: 'entity'; |
3484 |
|
|
text { |
3485 |
|
|
data: 'entity value'; |
3486 |
|
|
} |
3487 |
|
|
} |
3488 |
|
|
} |
3489 |
|
|
} |
3490 |
|
|
@@XMLTest: |
3491 |
|
|
@@@QName: xp.doctype.internal.entity.root.element.text.mult.test |
3492 |
|
|
@@@DEnt: |
3493 |
|
|
@@@@test:value: |
3494 |
|
|
<!DOCTYPE a [ |
3495 |
|
|
<!ENTITY entity "entity value"> |
3496 |
|
|
]> |
3497 |
|
|
<a>&entity; and &entity;</a> |
3498 |
|
|
@@@test:domTree: |
3499 |
|
|
document { |
3500 |
|
|
xml-version: '1.0'; |
3501 |
|
|
xml-encoding: null; |
3502 |
|
|
xml-standalone: false; |
3503 |
|
|
document-type { |
3504 |
|
|
node-name: 'a'; |
3505 |
|
|
} |
3506 |
|
|
element { |
3507 |
|
|
namespace-uri: null; |
3508 |
|
|
prefix: null; |
3509 |
|
|
local-name: 'a'; |
3510 |
|
|
general-entity-reference { |
3511 |
|
|
node-name: 'entity'; |
3512 |
|
|
text { |
3513 |
|
|
data: 'entity value'; |
3514 |
|
|
} |
3515 |
|
|
} |
3516 |
|
|
text { data: ' and '; } |
3517 |
|
|
general-entity-reference { |
3518 |
|
|
node-name: 'entity'; |
3519 |
|
|
text { |
3520 |
|
|
data: 'entity value'; |
3521 |
|
|
} |
3522 |
|
|
} |
3523 |
|
|
} |
3524 |
|
|
} |
3525 |
|
|
@@XMLTest: |
3526 |
|
|
@@@QName: xp.doctype.internal.entity.root.element.text.element.test |
3527 |
|
|
@@@DEnt: |
3528 |
|
|
@@@@test:value: |
3529 |
|
|
<!DOCTYPE a [ |
3530 |
|
|
<!ENTITY entity "entity <p>value</p> with <e>element</e> "> |
3531 |
|
|
]> |
3532 |
|
|
<a>&entity;</a> |
3533 |
|
|
@@@test:domTree: |
3534 |
|
|
document { |
3535 |
|
|
xml-version: '1.0'; |
3536 |
|
|
xml-encoding: null; |
3537 |
|
|
xml-standalone: false; |
3538 |
|
|
document-type { |
3539 |
|
|
node-name: 'a'; |
3540 |
|
|
} |
3541 |
|
|
element { |
3542 |
|
|
namespace-uri: null; |
3543 |
|
|
prefix: null; |
3544 |
|
|
local-name: 'a'; |
3545 |
|
|
general-entity-reference { |
3546 |
|
|
node-name: 'entity'; |
3547 |
|
|
text { |
3548 |
|
|
data: 'entity '; |
3549 |
|
|
} |
3550 |
|
|
element { |
3551 |
|
|
namespace-uri: null; |
3552 |
|
|
prefix: null; |
3553 |
|
|
local-name: 'p'; |
3554 |
|
|
text { |
3555 |
|
|
data: 'value'; |
3556 |
|
|
} |
3557 |
|
|
} |
3558 |
|
|
text { |
3559 |
|
|
data: ' with '; |
3560 |
|
|
} |
3561 |
|
|
element { |
3562 |
|
|
namespace-uri: null; |
3563 |
|
|
prefix: null; |
3564 |
|
|
local-name: 'e'; |
3565 |
|
|
text { |
3566 |
|
|
data: 'element'; |
3567 |
|
|
} |
3568 |
|
|
} |
3569 |
|
|
text { |
3570 |
|
|
data: ' '; |
3571 |
|
|
} |
3572 |
|
|
} |
3573 |
|
|
} |
3574 |
|
|
} |
3575 |
|
|
@@XMLTest: |
3576 |
|
|
@@@QName: xp.doctype.internal.entity.root.element.text.in.ent.test |
3577 |
|
|
@@@DEnt: |
3578 |
|
|
@@@@test:value: |
3579 |
|
|
<!DOCTYPE a [ |
3580 |
|
|
<!ENTITY entity1 "entity value"> |
3581 |
|
|
<!ENTITY entity2 "e&entity1;n"> |
3582 |
|
|
]> |
3583 |
|
|
<a>&entity2;</a> |
3584 |
|
|
@@@test:domTree: |
3585 |
|
|
document { |
3586 |
|
|
xml-version: '1.0'; |
3587 |
|
|
xml-encoding: null; |
3588 |
|
|
xml-standalone: false; |
3589 |
|
|
document-type { |
3590 |
|
|
node-name: 'a'; |
3591 |
|
|
} |
3592 |
|
|
element { |
3593 |
|
|
namespace-uri: null; |
3594 |
|
|
prefix: null; |
3595 |
|
|
local-name: 'a'; |
3596 |
|
|
general-entity-reference { |
3597 |
|
|
node-name: 'entity2'; |
3598 |
|
|
text { data: 'e'; } |
3599 |
|
|
general-entity-reference { |
3600 |
|
|
node-name: 'entity1'; |
3601 |
|
|
text { |
3602 |
|
|
data: 'entity value'; |
3603 |
|
|
} |
3604 |
|
|
} |
3605 |
|
|
text { data: 'n'; } |
3606 |
|
|
} |
3607 |
wakaba |
1.8 |
} |
3608 |
|
|
} |
3609 |
|
|
@@XMLTest: |
3610 |
|
|
@@@QName: xp.doctype.internal.attr.empty.test |
3611 |
|
|
@@@DEnt: |
3612 |
|
|
@@@@test:value: |
3613 |
|
|
<!DOCTYPE a [ |
3614 |
|
|
<!ATTLIST a> |
3615 |
|
|
]> |
3616 |
|
|
<a></a> |
3617 |
|
|
@@@test:domTree: |
3618 |
|
|
document { |
3619 |
|
|
xml-version: '1.0'; |
3620 |
|
|
xml-encoding: null; |
3621 |
|
|
xml-standalone: false; |
3622 |
|
|
document-type { |
3623 |
|
|
node-name: 'a'; |
3624 |
|
|
element-type-definition { |
3625 |
|
|
node-name: 'a'; |
3626 |
|
|
} |
3627 |
|
|
} |
3628 |
|
|
element { |
3629 |
|
|
namespace-uri: null; |
3630 |
|
|
local-name: 'a'; |
3631 |
|
|
} |
3632 |
|
|
} |
3633 |
|
|
@@XMLTest: |
3634 |
|
|
@@@QName: xp.doctype.internal.attr.cdata.implied.test |
3635 |
|
|
@@@DEnt: |
3636 |
|
|
@@@@test:value: |
3637 |
|
|
<!DOCTYPE a [ |
3638 |
|
|
<!ATTLIST a |
3639 |
|
|
at CDATA #IMPLIED |
3640 |
|
|
> |
3641 |
|
|
]> |
3642 |
|
|
<a></a> |
3643 |
|
|
@@@test:domTree: |
3644 |
|
|
document { |
3645 |
|
|
xml-version: '1.0'; |
3646 |
|
|
xml-encoding: null; |
3647 |
|
|
xml-standalone: false; |
3648 |
|
|
document-type { |
3649 |
|
|
node-name: 'a'; |
3650 |
|
|
element-type-definition { |
3651 |
|
|
node-name: 'a'; |
3652 |
|
|
attribute-definition { |
3653 |
|
|
node-name: 'at'; |
3654 |
|
|
declared-type: const (CDATA_ATTR); |
3655 |
|
|
allowed-tokens: DOMStringList (); |
3656 |
|
|
default-type: const (IMPLIED_DEFAULT); |
3657 |
|
|
text-content: ''; |
3658 |
|
|
} |
3659 |
|
|
} |
3660 |
|
|
} |
3661 |
|
|
element { |
3662 |
|
|
namespace-uri: null; |
3663 |
|
|
local-name: 'a'; |
3664 |
|
|
} |
3665 |
|
|
} |
3666 |
|
|
@@XMLTest: |
3667 |
|
|
@@@QName: xp.doctype.internal.attr.types.implied.test |
3668 |
|
|
@@@DEnt: |
3669 |
|
|
@@@@test:value: |
3670 |
|
|
<!DOCTYPE a [ |
3671 |
|
|
<!ATTLIST a |
3672 |
|
|
at1 ID #IMPLIED |
3673 |
|
|
at2 IDREF #IMPLIED |
3674 |
|
|
at3 IDREFS #IMPLIED |
3675 |
|
|
at4 ENTITY #IMPLIED |
3676 |
|
|
at5 ENTITIES #IMPLIED |
3677 |
|
|
at6 NMTOKEN #IMPLIED |
3678 |
|
|
at7 NMTOKENS #IMPLIED |
3679 |
|
|
at8 NOTATION (n1 | n2|n3) #IMPLIED |
3680 |
|
|
at9 (e1| e2| e3 ) #IMPLIED |
3681 |
|
|
> |
3682 |
|
|
]> |
3683 |
|
|
<a></a> |
3684 |
|
|
@@@test:domTree: |
3685 |
|
|
document { |
3686 |
|
|
xml-version: '1.0'; |
3687 |
|
|
xml-encoding: null; |
3688 |
|
|
xml-standalone: false; |
3689 |
|
|
document-type { |
3690 |
|
|
node-name: 'a'; |
3691 |
|
|
element-type-definition { |
3692 |
|
|
node-name: 'a'; |
3693 |
|
|
attribute-definition { |
3694 |
|
|
node-name: 'at1'; |
3695 |
|
|
declared-type: const (ID_ATTR); |
3696 |
|
|
allowed-tokens: DOMStringList (); |
3697 |
|
|
default-type: const (IMPLIED_DEFAULT); |
3698 |
|
|
text-content: ''; |
3699 |
|
|
} |
3700 |
|
|
attribute-definition { |
3701 |
|
|
node-name: 'at2'; |
3702 |
|
|
declared-type: const (IDREF_ATTR); |
3703 |
|
|
allowed-tokens: DOMStringList (); |
3704 |
|
|
default-type: const (IMPLIED_DEFAULT); |
3705 |
|
|
text-content: ''; |
3706 |
|
|
} |
3707 |
|
|
attribute-definition { |
3708 |
|
|
node-name: 'at3'; |
3709 |
|
|
declared-type: const (IDREFS_ATTR); |
3710 |
|
|
allowed-tokens: DOMStringList (); |
3711 |
|
|
default-type: const (IMPLIED_DEFAULT); |
3712 |
|
|
text-content: ''; |
3713 |
|
|
} |
3714 |
|
|
attribute-definition { |
3715 |
|
|
node-name: 'at4'; |
3716 |
|
|
declared-type: const (ENTITY_ATTR); |
3717 |
|
|
allowed-tokens: DOMStringList (); |
3718 |
|
|
default-type: const (IMPLIED_DEFAULT); |
3719 |
|
|
text-content: ''; |
3720 |
|
|
} |
3721 |
|
|
attribute-definition { |
3722 |
|
|
node-name: 'at5'; |
3723 |
|
|
declared-type: const (ENTITIES_ATTR); |
3724 |
|
|
allowed-tokens: DOMStringList (); |
3725 |
|
|
default-type: const (IMPLIED_DEFAULT); |
3726 |
|
|
text-content: ''; |
3727 |
|
|
} |
3728 |
|
|
attribute-definition { |
3729 |
|
|
node-name: 'at6'; |
3730 |
|
|
declared-type: const (NMTOKEN_ATTR); |
3731 |
|
|
allowed-tokens: DOMStringList (); |
3732 |
|
|
default-type: const (IMPLIED_DEFAULT); |
3733 |
|
|
text-content: ''; |
3734 |
|
|
} |
3735 |
|
|
attribute-definition { |
3736 |
|
|
node-name: 'at7'; |
3737 |
|
|
declared-type: const (NMTOKENS_ATTR); |
3738 |
|
|
allowed-tokens: DOMStringList (); |
3739 |
|
|
default-type: const (IMPLIED_DEFAULT); |
3740 |
|
|
text-content: ''; |
3741 |
|
|
} |
3742 |
|
|
attribute-definition { |
3743 |
|
|
node-name: 'at8'; |
3744 |
|
|
declared-type: const (NOTATION_ATTR); |
3745 |
|
|
allowed-tokens: DOMStringList ('n1', 'n2', 'n3'); |
3746 |
|
|
default-type: const (IMPLIED_DEFAULT); |
3747 |
|
|
text-content: ''; |
3748 |
|
|
} |
3749 |
|
|
attribute-definition { |
3750 |
|
|
node-name: 'at9'; |
3751 |
|
|
declared-type: const (ENUMERATION_ATTR); |
3752 |
|
|
allowed-tokens: DOMStringList ('e1', 'e2', 'e3'); |
3753 |
|
|
default-type: const (IMPLIED_DEFAULT); |
3754 |
|
|
text-content: ''; |
3755 |
|
|
} |
3756 |
|
|
} |
3757 |
|
|
} |
3758 |
|
|
element { |
3759 |
|
|
namespace-uri: null; |
3760 |
|
|
local-name: 'a'; |
3761 |
|
|
} |
3762 |
|
|
} |
3763 |
|
|
@@XMLTest: |
3764 |
|
|
@@@QName: xp.doctype.internal.attr.cdata.defaults.test |
3765 |
|
|
@@@DEnt: |
3766 |
|
|
@@@@test:value: |
3767 |
|
|
<!DOCTYPE a [ |
3768 |
|
|
<!ATTLIST a |
3769 |
|
|
at1 CDATA #IMPLIED |
3770 |
|
|
at2 CDATA #REQUIRED |
3771 |
|
|
at3 CDATA #FIXED "value3" |
3772 |
|
|
at4 CDATA "value4" |
3773 |
|
|
at5 CDATA #FIXED 'value5' |
3774 |
|
|
at6 CDATA 'value6' |
3775 |
|
|
> |
3776 |
|
|
]> |
3777 |
|
|
<a></a> |
3778 |
|
|
@@@test:domTree: |
3779 |
|
|
document { |
3780 |
|
|
xml-version: '1.0'; |
3781 |
|
|
xml-encoding: null; |
3782 |
|
|
xml-standalone: false; |
3783 |
|
|
document-type { |
3784 |
|
|
node-name: 'a'; |
3785 |
|
|
element-type-definition { |
3786 |
|
|
node-name: 'a'; |
3787 |
|
|
attribute-definition { |
3788 |
|
|
node-name: 'at1'; |
3789 |
|
|
declared-type: const (CDATA_ATTR); |
3790 |
|
|
allowed-tokens: DOMStringList (); |
3791 |
|
|
default-type: const (IMPLIED_DEFAULT); |
3792 |
|
|
text-content: ''; |
3793 |
|
|
} |
3794 |
|
|
attribute-definition { |
3795 |
|
|
node-name: 'at2'; |
3796 |
|
|
declared-type: const (CDATA_ATTR); |
3797 |
|
|
allowed-tokens: DOMStringList (); |
3798 |
|
|
default-type: const (REQUIRED_DEFAULT); |
3799 |
|
|
text-content: ''; |
3800 |
|
|
} |
3801 |
|
|
attribute-definition { |
3802 |
|
|
node-name: 'at3'; |
3803 |
|
|
declared-type: const (CDATA_ATTR); |
3804 |
|
|
allowed-tokens: DOMStringList (); |
3805 |
|
|
default-type: const (FIXED_DEFAULT); |
3806 |
|
|
text-content: 'value3'; |
3807 |
|
|
} |
3808 |
|
|
attribute-definition { |
3809 |
|
|
node-name: 'at4'; |
3810 |
|
|
declared-type: const (CDATA_ATTR); |
3811 |
|
|
allowed-tokens: DOMStringList (); |
3812 |
|
|
default-type: const (EXPLICIT_DEFAULT); |
3813 |
|
|
text-content: 'value4'; |
3814 |
|
|
} |
3815 |
|
|
attribute-definition { |
3816 |
|
|
node-name: 'at5'; |
3817 |
|
|
declared-type: const (CDATA_ATTR); |
3818 |
|
|
allowed-tokens: DOMStringList (); |
3819 |
|
|
default-type: const (FIXED_DEFAULT); |
3820 |
|
|
text-content: 'value5'; |
3821 |
|
|
} |
3822 |
|
|
attribute-definition { |
3823 |
|
|
node-name: 'at6'; |
3824 |
|
|
declared-type: const (CDATA_ATTR); |
3825 |
|
|
allowed-tokens: DOMStringList (); |
3826 |
|
|
default-type: const (EXPLICIT_DEFAULT); |
3827 |
|
|
text-content: 'value6'; |
3828 |
|
|
} |
3829 |
|
|
} |
3830 |
|
|
} |
3831 |
|
|
element { |
3832 |
|
|
namespace-uri: null; |
3833 |
|
|
local-name: 'a'; |
3834 |
wakaba |
1.6 |
} |
3835 |
|
|
} |
3836 |
|
|
|
3837 |
wakaba |
1.5 |
@@PerlDef: |
3838 |
|
|
my $impl = $Message::DOM::ImplementationRegistry->get_implementation ({ |
3839 |
|
|
'Core' => '3.0', |
3840 |
|
|
'XML' => '3.0', |
3841 |
|
|
'XMLVersion' => ['1.0', '1.1'], |
3842 |
|
|
}); |
3843 |
|
|
my $parser = <Class::ManakaiXMLParser>->new ($impl); |
3844 |
|
|
|
3845 |
|
|
for my $test_data (@$TestData) { |
3846 |
|
|
$test->start_new_test ($test_data->{uri}); |
3847 |
|
|
my $doc_ent = $test_data->{entity}->{$test_data->{root_uri}}; |
3848 |
|
|
my $doc = $parser->parse_string ($doc_ent->{<H::test:value>}); |
3849 |
|
|
try { |
3850 |
|
|
$test->assert_dom_tree_equals |
3851 |
|
|
(actual_value => $doc, |
3852 |
|
|
expected_hash => $test_data->{dom_tree}); |
3853 |
|
|
$test->ok; |
3854 |
|
|
} catch Message::Util::IF::DTException with { }; |
3855 |
|
|
} |
3856 |
wakaba |
1.6 |
|
3857 |
|
|
@ResourceDef: |
3858 |
|
|
@@QName: getCopyOfEntityState |
3859 |
|
|
@@rdf:type: DISPerl|InlineCode |
3860 |
|
|
@@ForCheck: ManakaiDOM|ForClass |
3861 |
|
|
@@PerlDef: |
3862 |
|
|
{%{$self->{$entity_type}->{$entity_name}}, |
3863 |
|
|
line => 1, column => 1, pos => 0} |
3864 |
wakaba |
1.1 |
##ManakaiXMLParser |
3865 |
wakaba |
1.5 |
|
3866 |
|
|
ElementTypeBinding: |
3867 |
|
|
@Name: XMLTests |
3868 |
|
|
@ElementType: |
3869 |
|
|
dis:ResourceDef |
3870 |
|
|
@ShadowContent: |
3871 |
|
|
@@ForCheck: ManakaiDOM|ForClass |
3872 |
|
|
@@rdf:type: test|ParserTestSet |
3873 |
|
|
|
3874 |
|
|
ElementTypeBinding: |
3875 |
|
|
@Name: XMLTest |
3876 |
|
|
@ElementType: |
3877 |
|
|
dis:ResourceDef |
3878 |
|
|
@ShadowContent: |
3879 |
|
|
@@ForCheck: ManakaiDOM|ForClass |
3880 |
|
|
@@rdf:type: test|ParserTest |
3881 |
|
|
|
3882 |
|
|
ElementTypeBinding: |
3883 |
|
|
@Name: DEnt |
3884 |
|
|
@ElementType: |
3885 |
|
|
dis:ResourceDef |
3886 |
|
|
@ShadowContent: |
3887 |
|
|
@@rdf:type: test|RootEntity |
3888 |
|
|
|
3889 |
|
|
ElementTypeBinding: |
3890 |
|
|
@Name: Ent |
3891 |
|
|
@ElementType: |
3892 |
|
|
dis:ResourceDef |
3893 |
|
|
@ShadowContent: |
3894 |
|
|
@@rdf:type: test|Entity |
3895 |
wakaba |
1.1 |
|
3896 |
wakaba |
1.3 |
ResourceDef: |
3897 |
|
|
@QName: xp|get-location-from-token |
3898 |
|
|
@rdf:type: DISPerl|BlockCode |
3899 |
|
|
@enDesc: |
3900 |
|
|
Creates a <IF::DOMCore:DOMLocator> object from a token. |
3901 |
|
|
@PerlDef: |
3902 |
|
|
$result = { |
3903 |
wakaba |
1.6 |
utf32_offset => $self->{entity}->[-1]->{pos}, |
3904 |
wakaba |
1.3 |
}; |
3905 |
|
|
@For: ManakaiDOM|ManakaiDOM3 |
3906 |
wakaba |
1.1 |
|
3907 |
|
|
ElementTypeBinding: |
3908 |
|
|
@Name: RuleDef |
3909 |
|
|
@ElementType: |
3910 |
|
|
dis:ResourceDef |
3911 |
|
|
@ShadowContent: |
3912 |
|
|
@@ForCheck: ManakaiDOM|ForClass |
3913 |
|
|
@@rdf:type: Muf2003|RuleDefClass |
3914 |
|
|
|
3915 |
|
|
ElementTypeBinding: |
3916 |
|
|
@Name: RuleParam |
3917 |
|
|
@ElementType: |
3918 |
|
|
dis:ResourceDef |
3919 |
|
|
@ShadowContent: |
3920 |
|
|
@@rdf:type: Muf2003|RuleParameter |
3921 |
|
|
|
3922 |
|
|
ElementTypeBinding: |
3923 |
|
|
@Name: enImplNote |
3924 |
|
|
@ElementType: |
3925 |
|
|
dis:ImplNote |
3926 |
|
|
@ShadowContent: |
3927 |
|
|
@@lang:en |
3928 |
|
|
|
3929 |
|
|
ElementTypeBinding: |
3930 |
|
|
@Name: ErrDef |
3931 |
|
|
@ElementType: |
3932 |
|
|
dis:ResourceDef |
3933 |
|
|
@ShadowContent: |
3934 |
|
|
@@rdf:type: DOMCore|DOMErrorType |
3935 |
|
|
@@For: ManakaiDOM|DOM3 |
3936 |
|
|
@@ecore:textFormatter: ManakaiXMLParserExceptionFormatter |
3937 |
|
|
|
3938 |
wakaba |
1.3 |
ElementTypeBinding: |
3939 |
|
|
@Name: WFErrDef |
3940 |
|
|
@ElementType: |
3941 |
|
|
dis:ResourceDef |
3942 |
|
|
@ShadowContent: |
3943 |
|
|
@@rdf:type: DOMCore|DOMErrorType |
3944 |
|
|
@@For: ManakaiDOM|DOM3 |
3945 |
|
|
@@ecore:textFormatter: ManakaiXMLParserExceptionFormatter |
3946 |
|
|
|
3947 |
|
|
WFErrDef: |
3948 |
|
|
@QName: xp|wf-syntax-error |
3949 |
|
|
@enDesc: |
3950 |
|
|
The entity does not match to the production rule; it is not |
3951 |
|
|
well-formed. |
3952 |
|
|
@DOMCore:severity: DOMCore|SEVERITY_FATAL_ERROR |
3953 |
|
|
@enMufDef: |
3954 |
|
|
|%xp-error-token-type;|%xp-error-token-value |
3955 |
|
|
(prefix => { (|}, suffix => {|)}); is not |
3956 |
|
|
allowed%xp-error-lines (prefix => { (|}, suffix => {|)}); |
3957 |
|
|
@ecore:hasParameter: |
3958 |
|
|
@@@: xp|error-token |
3959 |
|
|
@@enDesc: |
3960 |
|
|
The token that is not allowed. |
3961 |
|
|
|
3962 |
|
|
WFErrDef: |
3963 |
|
|
@QName: xp|wf-pi-target-is-xml |
3964 |
|
|
@enDesc: |
3965 |
|
|
A processing instruction has its <CODE::PITarget> of |
3966 |
|
|
<XML::xml> (in any case) which is not allowed. |
3967 |
|
|
@DOMCore:severity: DOMCore|SEVERITY_ERROR |
3968 |
|
|
@enMufDef: |
3969 |
|
|
Processing instruction target name cannot be |%p |
3970 |
|
|
(name => {<Q::xp|name>});| |
3971 |
|
|
@ecore:hasParameter: |
3972 |
|
|
@@@: xp|error-token |
3973 |
|
|
@@enDesc: |
3974 |
|
|
The token that contains the name. |
3975 |
|
|
@ecore:hasParameter: |
3976 |
|
|
@@@: xp|name |
3977 |
|
|
@@enDesc: |
3978 |
|
|
A string that is specified as target name of the |
3979 |
|
|
processing instruction. |
3980 |
|
|
@ecore:hasParameter: xp|parent |
3981 |
|
|
|
3982 |
|
|
WFErrDef: |
3983 |
|
|
@QName: xp|wf-no-end-tag |
3984 |
|
|
@DOMCore:severity: DOMCore|SEVERITY_ERROR |
3985 |
|
|
@enDesc: |
3986 |
|
|
An end-tag is not found. |
3987 |
|
|
@enMufDef: |
3988 |
|
|
End-tag |</%p (name => {<Q::xp|expected-element-type>});>| is required |
3989 |
|
|
@ecore:hasParameter: xp|error-token |
3990 |
|
|
@ecore:hasParameter: |
3991 |
|
|
@@@: xp|node |
3992 |
|
|
@@enDesc: |
3993 |
|
|
The element node that is not closed. |
3994 |
|
|
@ecore:hasParameter: |
3995 |
|
|
@@@: xp|expected-element-type |
3996 |
|
|
@@enDesc: |
3997 |
|
|
The element type name of the element that is not closed. |
3998 |
|
|
|
3999 |
|
|
WFErrDef: |
4000 |
|
|
@QName: xp|wf-unsupported-xml-version |
4001 |
|
|
@DOMCore:severity: DOMCore|SEVERITY_ERROR |
4002 |
|
|
@enDesc: |
4003 |
|
|
The XML version specified in the version declaration is not supported. |
4004 |
|
|
@enMufDef: |
4005 |
|
|
XML version |%p (name => {<Q::infoset|version>});| is not supported |
4006 |
|
|
@ecore:hasParameter: xp|bad-token |
4007 |
|
|
@ecore:hasParameter: |
4008 |
|
|
@@@: xp|parent |
4009 |
|
|
@@enDesc: |
4010 |
|
|
The document node. |
4011 |
|
|
@ecore:hasParameter: |
4012 |
|
|
@@@: infoset|version |
4013 |
|
|
@@enDesc: |
4014 |
|
|
The specified XML version. |
4015 |
|
|
|
4016 |
|
|
WFErrDef: |
4017 |
|
|
@QName: xp|wf-malformed-enc-name |
4018 |
|
|
@DOMCore:severity: DOMCore|SEVERITY_ERROR |
4019 |
|
|
@enDesc: |
4020 |
|
|
An <XA::encoding> pseudo-attribute value does not match |
4021 |
|
|
to the procduction rule <CODE::EncName>. |
4022 |
|
|
@enMufDef: |
4023 |
|
|
Encoding name |%p (name => {<Q::xp|name>});| is not allowed |
4024 |
|
|
@ecore:hasParameter: xp|error-token |
4025 |
|
|
@ecore:hasParameter: |
4026 |
|
|
@@@: xp|parent |
4027 |
|
|
@@enDesc: The document node. |
4028 |
|
|
@ecore:hasParameter: |
4029 |
|
|
@@@: xp|name |
4030 |
|
|
@@enDesc: |
4031 |
|
|
The <XA::encoding> value. |
4032 |
|
|
|
4033 |
|
|
WFErrDef: |
4034 |
|
|
@QName: xp|wf-malformed-xml-standalone |
4035 |
|
|
@DOMCore:severity: DOMCore|SEVERITY_ERROR |
4036 |
|
|
@enDesc: |
4037 |
|
|
An <XA::standalone> pseudo-attribute value is neither <XML::yes> |
4038 |
|
|
or <XML::no>. |
4039 |
|
|
@enMufDef: |
4040 |
|
|
|standalone| pseudo-attribute value |%p (name => {<Q::xp|name>});| |
4041 |
|
|
is not allowed |
4042 |
|
|
@ecore:hasParameter: xp|error-token |
4043 |
|
|
@ecore:hasParameter: |
4044 |
|
|
@@@: xp|parent |
4045 |
|
|
@@enDesc: The document node. |
4046 |
|
|
@ecore:hasParameter: |
4047 |
|
|
@@@: xp|name |
4048 |
|
|
@@enDesc: |
4049 |
|
|
The <XA::standalone> value. |
4050 |
|
|
|
4051 |
|
|
WFErrDef: |
4052 |
|
|
@QName: xp|wf-legal-literal-character |
4053 |
|
|
@DOMCore:severity: DOMCore|SEVERITY_ERROR |
4054 |
|
|
@enDesc: |
4055 |
|
|
Each character in XML entity must match to the production |
4056 |
|
|
rule <CODE::Char - RestrictedChar>. |
4057 |
|
|
@enMufDef: |
4058 |
|
|
Character %character-code-point |
4059 |
|
|
(v => {<Q::xp|character-number>}); is not allowed |
4060 |
|
|
@ecore:hasParameter: |
4061 |
|
|
@@@: xp|character-number |
4062 |
|
|
@@enDesc: |
4063 |
|
|
The code position of the character being referred. |
4064 |
|
|
|
4065 |
|
|
WFErrDef: |
4066 |
|
|
@QName: xp|wf-element-type-match |
4067 |
|
|
@DOMCore:severity: DOMCore|SEVERITY_FATAL_ERROR |
4068 |
wakaba |
1.1 |
@enDesc: |
4069 |
wakaba |
1.3 |
The <CODE::Name> in an element's end-tag must match the element type |
4070 |
|
|
in the start-tag. |
4071 |
|
|
@enMufDef: |
4072 |
|
|
End-tag |</%p (name => {<Q::xp|actual-element-type>});>| does |
4073 |
|
|
not match to start-tag |<%p (name => {<Q::xp|expected-element-type>});>| |
4074 |
|
|
@ecore:hasParameter: xp|error-token |
4075 |
|
|
@ecore:hasParameter: |
4076 |
|
|
@@@: xp|node |
4077 |
|
|
@@enDesc: |
4078 |
|
|
The current opening element node. |
4079 |
|
|
@ecore:hasParameter: |
4080 |
|
|
@@@: xp|expected-element-type |
4081 |
|
|
@@enDesc: |
4082 |
|
|
The element type name of the current element. |
4083 |
|
|
@ecore:hasParameter: |
4084 |
|
|
@@@: xp|actual-element-type |
4085 |
|
|
@@enDesc: |
4086 |
|
|
The <CODE::Name> occurs in the end-tag. |
4087 |
|
|
|
4088 |
|
|
WFErrDef: |
4089 |
|
|
@QName: xp|wf-unique-att-spec |
4090 |
wakaba |
1.1 |
@DOMCore:severity: DOMCore|SEVERITY_ERROR |
4091 |
wakaba |
1.3 |
@enDesc: |
4092 |
|
|
An attribute name <kwd:MUST-NOT> appear more than once in |
4093 |
|
|
the same start-tag or empty-element tag. |
4094 |
wakaba |
1.1 |
@enMufDef: |
4095 |
wakaba |
1.3 |
Attribute |%p (name => {<Q::xp|name>});| is specified more |
4096 |
|
|
than once in the same tag |
4097 |
|
|
@ecore:hasParameter: xp|error-token |
4098 |
|
|
@ecore:hasParameter: |
4099 |
|
|
@@@: xp|name |
4100 |
|
|
@@enDesc: |
4101 |
|
|
The name of the attribute. |
4102 |
|
|
|
4103 |
|
|
WFErrDef: |
4104 |
|
|
@QName: xp|wf-legal-character |
4105 |
|
|
@DOMCore:severity: DOMCore|SEVERITY_ERROR |
4106 |
|
|
@enDesc: |
4107 |
|
|
Characters referred to using character references <kwd:MUST> |
4108 |
|
|
match the production for <CODE::Char>. |
4109 |
|
|
@enMufDef: |
4110 |
|
|
Reference to character %character-code-point |
4111 |
|
|
(v => {<Q::xp|character-number>}); is not allowed |
4112 |
|
|
@ecore:hasParameter: xp|error-token |
4113 |
|
|
@ecore:hasParameter: |
4114 |
|
|
@@@: xp|character-number |
4115 |
|
|
@@enDesc: |
4116 |
|
|
The code position of the character being referred. |
4117 |
|
|
@ecore:hasParameter: |
4118 |
|
|
@@@: xp|parent |
4119 |
|
|
@@enDesc: |
4120 |
|
|
The parent node in which the character reference has |
4121 |
|
|
occurred, if available. |
4122 |
wakaba |
1.1 |
|
4123 |
wakaba |
1.3 |
XWParam: |
4124 |
wakaba |
1.1 |
@QName: xp|error-token |
4125 |
|
|
@enDesc: |
4126 |
|
|
The token where the parser found an error. |
4127 |
|
|
|
4128 |
wakaba |
1.3 |
XWParam: |
4129 |
|
|
@QName: xp|name |
4130 |
|
|
@enDesc: |
4131 |
|
|
A name. |
4132 |
|
|
|
4133 |
|
|
XWParam: |
4134 |
|
|
@QName: xp|parent |
4135 |
|
|
@enDesc: |
4136 |
|
|
The parent node in which the error occurs. |
4137 |
|
|
|
4138 |
|
|
XWParam: |
4139 |
|
|
@QName: xp|node |
4140 |
|
|
@enDesc: |
4141 |
|
|
The current node. |
4142 |
|
|
|
4143 |
|
|
XWParam: |
4144 |
|
|
@QName: xp|actual-element-type |
4145 |
|
|
@enDesc: |
4146 |
|
|
The actual element type name occured in the source. |
4147 |
|
|
|
4148 |
|
|
XWParam: |
4149 |
|
|
@QName: xp|expected-element-type |
4150 |
wakaba |
1.1 |
@enDesc: |
4151 |
wakaba |
1.3 |
The element type name expected. |
4152 |
|
|
|
4153 |
|
|
XWParam: |
4154 |
|
|
@QName: xp|character-number |
4155 |
|
|
@enDesc: |
4156 |
|
|
The character code position. |
4157 |
|
|
|
4158 |
|
|
ElementTypeBinding: |
4159 |
|
|
@Name: XWParam |
4160 |
|
|
@ElementType: |
4161 |
|
|
dis:ResourceDef |
4162 |
|
|
@ShadowContent: |
4163 |
|
|
@@For: =ManakaiDOM|all |
4164 |
|
|
@@rdf:type: ecore|Parameter |
4165 |
wakaba |
1.1 |
|
4166 |
|
|
ElementTypeBinding: |
4167 |
|
|
@Name:enMufDef |
4168 |
|
|
@ElementType: |
4169 |
|
|
ecore:defaultMessage |
4170 |
|
|
@ShadowContent: |
4171 |
|
|
@@lang:en |
4172 |
|
|
@@ContentType: |
4173 |
|
|
lang:muf |
4174 |
|
|
|
4175 |
|
|
ResourceDef: |
4176 |
|
|
@QName: DOMImpl |
4177 |
|
|
@AliasFor: DOMCore|DOMImplementation |
4178 |
|
|
@For: ManakaiDOM|DOM |
4179 |
|
|
|
4180 |
|
|
ElementTypeBinding: |
4181 |
|
|
@Name: Attr |
4182 |
|
|
@ElementType: |
4183 |
|
|
dis:ResourceDef |
4184 |
|
|
@ShadowContent: |
4185 |
|
|
@@rdf:type: DISLang|Attribute |
4186 |
|
|
@@ForCheck: !=ManakaiDOM|ManakaiDOM |
4187 |
|
|
|
4188 |
|
|
ElementTypeBinding: |
4189 |
|
|
@Name: Get |
4190 |
|
|
@ElementType: |
4191 |
|
|
dis:ResourceDef |
4192 |
|
|
@ShadowContent: |
4193 |
|
|
@@rdf:type: DISLang|AttributeGet |
4194 |
|
|
|
4195 |
|
|
ElementTypeBinding: |
4196 |
|
|
@Name: Set |
4197 |
|
|
@ElementType: |
4198 |
|
|
dis:ResourceDef |
4199 |
|
|
@ShadowContent: |
4200 |
|
|
@@rdf:type: DISLang|AttributeSet |
4201 |
|
|
|
4202 |
|
|
ElementTypeBinding: |
4203 |
|
|
@Name: enDesc |
4204 |
|
|
@ElementType: |
4205 |
|
|
dis:Description |
4206 |
|
|
@ShadowContent: |
4207 |
|
|
@@lang:en |
4208 |
|
|
|
4209 |
|
|
ElementTypeBinding: |
4210 |
|
|
@Name: Method |
4211 |
|
|
@ElementType: |
4212 |
|
|
dis:ResourceDef |
4213 |
|
|
@ShadowContent: |
4214 |
|
|
@@rdf:type: DISLang|Method |
4215 |
|
|
@@For: !=ManakaiDOM|ManakaiDOM |
4216 |
|
|
|
4217 |
|
|
ElementTypeBinding: |
4218 |
|
|
@Name: Return |
4219 |
|
|
@ElementType: |
4220 |
|
|
dis:ResourceDef |
4221 |
|
|
@ShadowContent: |
4222 |
|
|
@@rdf:type: DISLang|MethodReturn |
4223 |
|
|
|
4224 |
|
|
ElementTypeBinding: |
4225 |
|
|
@Name: Param |
4226 |
|
|
@ElementType: |
4227 |
|
|
dis:ResourceDef |
4228 |
|
|
@ShadowContent: |
4229 |
|
|
@@rdf:type: DISLang|MethodParameter |
4230 |
|
|
|
4231 |
|
|
ElementTypeBinding: |
4232 |
|
|
@Name: PerlDef |
4233 |
|
|
@ElementType: |
4234 |
|
|
dis:Def |
4235 |
|
|
@ShadowContent: |
4236 |
|
|
@@ContentType: lang|Perl |
4237 |
|
|
|
4238 |
|
|
ElementTypeBinding: |
4239 |
|
|
@Name: PropDef |
4240 |
|
|
@ElementType: |
4241 |
|
|
dis:ResourceDef |
4242 |
|
|
@ShadowContent: |
4243 |
|
|
@@rdf:type: rdf|Property |
4244 |
|
|
|
4245 |
|
|
ClsDef: |
4246 |
|
|
@ClsQName: ManakaiXMLParserExceptionFormatter |
4247 |
|
|
|
4248 |
|
|
@ClsISA: ecore|MUErrorFormatter||ManakaiDOM|Perl |
4249 |
|
|
|
4250 |
|
|
@RuleDef: |
4251 |
|
|
@@Name: xp-error-token-type |
4252 |
|
|
@@enDesc: |
4253 |
|
|
The type of the token the parser is encountered. |
4254 |
|
|
|
4255 |
|
|
@@Method: |
4256 |
|
|
@@@Name: after |
4257 |
|
|
@@@Param: |
4258 |
|
|
@@@@Name: name |
4259 |
|
|
@@@@Type: DOMString |
4260 |
|
|
@@@@enDesc: The name of the method. |
4261 |
|
|
@@@Param: |
4262 |
|
|
@@@@Name: p |
4263 |
|
|
@@@@Type: DISPerl|HASH |
4264 |
|
|
@@@@enDesc: The set of the parameters to the method. |
4265 |
|
|
@@@Param: |
4266 |
|
|
@@@@Name: o |
4267 |
|
|
@@@@Type: DISPerl|HASH |
4268 |
|
|
@@@@enDesc: The option value. |
4269 |
|
|
@@@Return: |
4270 |
|
|
@@@@PerlDef: |
4271 |
|
|
$p->{-result} = $o->{<H::xp|error-token>}->{type} |
4272 |
|
|
if defined $o->{<H::xp|error-token>}->{type}; |
4273 |
|
|
|
4274 |
|
|
@RuleDef: |
4275 |
|
|
@@Name: xp-error-token-value |
4276 |
|
|
@@enDesc: |
4277 |
|
|
The value of the token the parser is encountered, if any. |
4278 |
|
|
|
4279 |
|
|
@@Method: |
4280 |
|
|
@@@Name: after |
4281 |
|
|
@@@Param: |
4282 |
|
|
@@@@Name: name |
4283 |
|
|
@@@@Type: DOMString |
4284 |
|
|
@@@@enDesc: The name of the method. |
4285 |
|
|
@@@Param: |
4286 |
|
|
@@@@Name: p |
4287 |
|
|
@@@@Type: DISPerl|HASH |
4288 |
|
|
@@@@enDesc: The set of the parameters to the method. |
4289 |
|
|
@@@Param: |
4290 |
|
|
@@@@Name: o |
4291 |
|
|
@@@@Type: DISPerl|HASH |
4292 |
|
|
@@@@enDesc: The option value. |
4293 |
|
|
@@@Return: |
4294 |
|
|
@@@@PerlDef: |
4295 |
|
|
$p->{-result} = $o->{<H::xp|error-token>}->{value} |
4296 |
|
|
if defined $o->{<H::xp|error-token>}->{value}; |
4297 |
|
|
|
4298 |
|
|
@RuleDef: |
4299 |
|
|
@@Name: xp-error-lines |
4300 |
|
|
@@enDesc: |
4301 |
|
|
A copy of fragment of the source text that contains the line |
4302 |
|
|
where the error occurred, if available. |
4303 |
|
|
|
4304 |
|
|
@@Method: |
4305 |
|
|
@@@Name: after |
4306 |
|
|
@@@Param: |
4307 |
|
|
@@@@Name: name |
4308 |
|
|
@@@@Type: DOMString |
4309 |
|
|
@@@@enDesc: The name of the method. |
4310 |
|
|
@@@Param: |
4311 |
|
|
@@@@Name: p |
4312 |
|
|
@@@@Type: DISPerl|HASH |
4313 |
|
|
@@@@enDesc: The set of the parameters to the method. |
4314 |
|
|
@@@Param: |
4315 |
|
|
@@@@Name: o |
4316 |
|
|
@@@@Type: DISPerl|HASH |
4317 |
|
|
@@@@enDesc: The option value. |
4318 |
|
|
@@@Return: |
4319 |
|
|
@@@@PerlDef: |
4320 |
|
|
my $pos = $o-><AG::DOMCore|DOMError.location> |
4321 |
|
|
-><AG::DOMCore|DOMLocator.utf32Offset>; |
4322 |
|
|
if ($pos > -1) { |
4323 |
wakaba |
1.6 |
my $src = $o->{<H::ecore|object>}->{entity}->[-1]->{reptxt}; |
4324 |
wakaba |
1.1 |
my $start = $pos; |
4325 |
|
|
$start = rindex ($$src, "\x0A", $start - 1) for 0..2; |
4326 |
|
|
$start++; |
4327 |
|
|
my $end = $pos; |
4328 |
|
|
$end = index ($$src, "\x0A", $end + 1) for 0..2; |
4329 |
|
|
$end = length $$src if $end < 0; |
4330 |
|
|
$p->{-result} = substr $$src, $start, $end - $start; |
4331 |
|
|
} |
4332 |
wakaba |
1.3 |
|
4333 |
|
|
@RuleDef: |
4334 |
|
|
@@Name: character-code-point |
4335 |
|
|
@@enDesc: |
4336 |
|
|
The character code position, in <CODE::U+<VAR::HHHH>> notation. |
4337 |
|
|
|
4338 |
|
|
@@Method: |
4339 |
|
|
@@@Name: after |
4340 |
|
|
@@@Param: |
4341 |
|
|
@@@@Name: name |
4342 |
|
|
@@@@Type: DOMString |
4343 |
|
|
@@@@enDesc: The name of the method. |
4344 |
|
|
@@@Param: |
4345 |
|
|
@@@@Name: p |
4346 |
|
|
@@@@Type: DISPerl|HASH |
4347 |
|
|
@@@@enDesc: The set of the parameters to the method. |
4348 |
|
|
@@@Param: |
4349 |
|
|
@@@@Name: o |
4350 |
|
|
@@@@Type: DISPerl|HASH |
4351 |
|
|
@@@@enDesc: The option value. |
4352 |
|
|
@@@RuleParam: |
4353 |
|
|
@@@@Name: v |
4354 |
|
|
@@@@Type: DISPerl|Number |
4355 |
|
|
@@@@enDesc: |
4356 |
|
|
The name of the error parameter that contains the character code. |
4357 |
|
|
@@@Return: |
4358 |
|
|
@@@@PerlDef: |
4359 |
|
|
$p->{-result} = sprintf 'U+%04X', $o->{$p->{v}}; |
4360 |
wakaba |
1.1 |
##XMLParserExceptionFormatter |