/[suikacvs]/messaging/manakai/t/markup-xml-parser-base.t
Suika

Diff of /messaging/manakai/t/markup-xml-parser-base.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by wakaba, Sat May 8 07:37:04 2004 UTC revision 1.1.2.6 by wakaba, Mon May 31 00:48:44 2004 UTC
# Line 0  Line 1 
1    #!/usr/bin/perl -w
2    use strict;
3    use Test;
4    use Message::Markup::XML::QName qw/NULL_URI DEFAULT_PFX/;
5    use Message::Markup::XML::Node;
6    use Message::Markup::XML::Parser::Base;
7    BEGIN {
8      our $NS =
9      {
10       (DEFAULT_PFX) => Message::Markup::XML::Parser::Base::URI_CONFIG,
11       tree => q<http://suika.fam.cx/~wakaba/-temp/2004/2/22/Parser/TreeConstruct/>,
12       test => q<mid:t.markup-xml-parser-base.t+2004.5.20@manakai.suika.fam.cx#>,
13      };
14    }
15    use Message::Util::QName::General [qw/ExpandedURI/], our $NS;
16    
17    sub match ($$;%) {
18      my ($result, $expect, %opt) = @_;
19      my $c = +{
20        parse_attribute_specification => sub {
21          no warnings 'uninitialized';
22          qq<<r $_[0] xmlns=""></r>>;
23        },
24      }->{$opt{method}} || sub {shift};
25      if (ref $expect) {
26        for (@$expect) {
27          return 1 if $result eq $c->($_);
28        }
29      } else {
30        $result eq $c->($expect);
31      }
32    }
33    
34    my @a =
35    (
36     {
37      t => q{"foo"},
38      method => 'parse_attribute_value_specification',
39      option => {ExpandedURI q<match-or-error> => 1},
40      result => q(1),
41     },
42     {
43      t => q{'foo'},
44      method => 'parse_attribute_value_specification',
45      option => {ExpandedURI q<match-or-error> => 1},
46      result => q(1),
47     },
48     {
49      t => q{"foo},
50      method => 'parse_attribute_value_specification',
51      option => {ExpandedURI q<match-or-error> => 1},
52      result => q(0:4:SYNTAX_ALITC_REQUIRED),
53     },
54     {
55      t => q{'foo},
56      method => 'parse_attribute_value_specification',
57      option => {ExpandedURI q<match-or-error> => 1},
58      result => q(0:4:SYNTAX_ALITAC_REQUIRED),
59     },
60     {
61      t => q{foo},
62      method => 'parse_attribute_value_specification',
63      option => {ExpandedURI q<match-or-error> => 1},
64      result => q(0:0:SYNTAX_ATTRIBUTE_VALUE),
65     },
66     {
67      t => q{foo},
68      method => 'parse_attribute_value_specification',
69      option => {ExpandedURI q<match-or-error> => 0},
70      result => q(0:0:SYNTAX_ATTRIBUTE_VALUE),
71     },
72     {
73      t => q{>},
74      method => 'parse_attribute_value_specification',
75      option => {ExpandedURI q<match-or-error> => 0},
76      result => q(1),
77     },
78     {
79      t => q{"foo<bar"},
80      method => 'parse_attribute_value_specification',
81      result => q(0:4:SYNTAX_NO_LESS_THAN_IN_ATTR_VAL),
82     },
83     {
84      t => q{'foo<bar'},
85      method => 'parse_attribute_value_specification',
86      result => q(0:4:SYNTAX_NO_LESS_THAN_IN_ATTR_VAL),
87     },
88     {
89      t => q{"foo&amp;bar"},
90      method => 'parse_attribute_value_specification',
91      option => {
92                 ExpandedURI q<use-reference> => 1,
93                 ExpandedURI q<allow-general-entity-reference> => 1,
94                 ExpandedURI q<allow-numeric-character-reference> => 1,
95                 ExpandedURI q<allow-hex-character-reference> => 1,
96                },
97      result => q(1),
98     },
99     {
100      t => q{'foo&amp;bar'},
101      method => 'parse_attribute_value_specification',
102      option => {
103                 ExpandedURI q<use-reference> => 1,
104                 ExpandedURI q<allow-general-entity-reference> => 1,
105                 ExpandedURI q<allow-numeric-character-reference> => 1,
106                 ExpandedURI q<allow-hex-character-reference> => 1,
107                },
108      result => q(1),
109     },
110     {
111      t => q{"foo&#1234;bar"},
112      method => 'parse_attribute_value_specification',
113      option => {
114                 ExpandedURI q<use-reference> => 1,
115                 ExpandedURI q<allow-general-entity-reference> => 1,
116                 ExpandedURI q<allow-numeric-character-reference> => 1,
117                 ExpandedURI q<allow-hex-character-reference> => 1,
118                },
119      result => q(1),
120     },
121     {
122      t => q{'foo&#1234;bar'},
123      method => 'parse_attribute_value_specification',
124      result => q(1),
125      option => {
126                 ExpandedURI q<use-reference> => 1,
127                 ExpandedURI q<allow-general-entity-reference> => 1,
128                 ExpandedURI q<allow-numeric-character-reference> => 1,
129                 ExpandedURI q<allow-hex-character-reference> => 1,
130                },
131     },
132     {
133      t => q{"foo&#xE234;bar"},
134      method => 'parse_attribute_value_specification',
135      option => {
136                 ExpandedURI q<use-reference> => 1,
137                 ExpandedURI q<allow-general-entity-reference> => 1,
138                 ExpandedURI q<allow-numeric-character-reference> => 1,
139                 ExpandedURI q<allow-hex-character-reference> => 1,
140                },
141      result => q(1),
142     },
143     {
144      t => q{'foo&#xE234;bar'},
145      method => 'parse_attribute_value_specification',
146      option => {
147                 ExpandedURI q<use-reference> => 1,
148                 ExpandedURI q<allow-general-entity-reference> => 1,
149                 ExpandedURI q<allow-numeric-character-reference> => 1,
150                 ExpandedURI q<allow-hex-character-reference> => 1,
151                },
152      result => q(1),
153     },
154     {
155      t => q{"foo&#SPACE;bar"},
156      method => 'parse_attribute_value_specification',
157      option => {
158                 ExpandedURI q<use-reference> => 1,
159                 ExpandedURI q<allow-general-entity-reference> => 1,
160                 ExpandedURI q<allow-numeric-character-reference> => 1,
161                 ExpandedURI q<allow-hex-character-reference> => 1,
162                },
163      result => q(0:6:SYNTAX_NAMED_CHARACTER_REFERENCE),
164     },
165     {
166      t => q{"foo&#XE234;bar"},
167      method => 'parse_attribute_value_specification',
168      option => {
169                 ExpandedURI q<use-reference> => 1,
170                 ExpandedURI q<allow-general-entity-reference> => 1,
171                 ExpandedURI q<allow-numeric-character-reference> => 1,
172                 ExpandedURI q<allow-hex-character-reference> => 1,
173                },
174      result => q(0:6:SYNTAX_HCRO_CASE),
175     },
176     {
177      t => q{"foo& bar"},
178      method => 'parse_attribute_value_specification',
179      result => q(0:5:SYNTAX_HASH_OR_NAME_REQUIRED),
180     },
181     {
182      t => q{'foo&# bar'},
183      method => 'parse_attribute_value_specification',
184      result => q(0:6:SYNTAX_X_OR_DIGIT_REQUIRED),
185     },
186     {
187      t => q{"foo&#x bar"},
188      method => 'parse_attribute_value_specification',
189      result => q(0:7:SYNTAX_HEXDIGIT_REQUIRED),
190     },
191     {
192      t => q{"foo&#x0120 bar"},
193      method => 'parse_attribute_value_specification',
194      option => {
195                 ExpandedURI q<use-reference> => 1,
196                 ExpandedURI q<allow-general-entity-reference> => 1,
197                 ExpandedURI q<allow-numeric-character-reference> => 1,
198                 ExpandedURI q<allow-hex-character-reference> => 1,
199                },
200      result => q(0:11:SYNTAX_REFC_REQUIRED),
201     },
202     {
203      t => q{"foo&#0120 bar"},
204      method => 'parse_attribute_value_specification',
205      option => {
206                 ExpandedURI q<use-reference> => 1,
207                 ExpandedURI q<allow-general-entity-reference> => 1,
208                 ExpandedURI q<allow-numeric-character-reference> => 1,
209                 ExpandedURI q<allow-hex-character-reference> => 1,
210                },
211      result => q(0:10:SYNTAX_REFC_REQUIRED),
212     },
213     {
214      t => q{"foo&amp bar"},
215      method => 'parse_attribute_value_specification',
216      option => {
217                 ExpandedURI q<use-reference> => 1,
218                 ExpandedURI q<allow-general-entity-reference> => 1,
219                 ExpandedURI q<allow-numeric-character-reference> => 1,
220                 ExpandedURI q<allow-hex-character-reference> => 1,
221                },
222      result => q(0:8:SYNTAX_REFC_REQUIRED),
223     },
224     {
225      t => q{foo="bar"},
226      method => 'parse_attribute_specification',
227      result => q(1),
228     },
229     {
230      t => q{"bar"},
231      method => 'parse_attribute_specification',
232      option => {ExpandedURI q<match-or-error> => 1},
233      result => q(0:0:SYNTAX_ATTR_NAME_REQUIRED),
234     },
235     {
236      t => q{"bar"},
237      method => 'parse_attribute_specification',
238      option => {ExpandedURI q<match-or-error> => 0},
239      result => q(1),
240      output => q(),
241     },
242     {
243      t => qq{foo \t= \x0D"bar"},
244      method => 'parse_attribute_specification',
245      result => q(1),
246      output => q(foo="bar"),
247     },
248     {
249      t => q{foo"bar"},
250      method => 'parse_attribute_specification',
251      result => q(0:3:SYNTAX_VI_REQUIRED),
252     },
253     {
254      t => q{foo=},
255      method => 'parse_attribute_specification',
256      result => q(0:4:SYNTAX_ALITO_OR_ALITAO_REQUIRED),
257     },
258     {
259      t => q{foo:bar='baz'},
260      method => 'parse_attribute_specification',
261      result => q(1),
262      output => [q(foo:bar="baz"), q(foo:bar='baz')],
263     },
264     {
265      t => q{:bar='baz'},
266      method => 'parse_attribute_specification',
267      result => q(1),
268      output => [q(:bar="baz"), q(:bar='baz')],
269     },
270     {
271      t => q{r='baz'},
272      method => 'parse_attribute_specification',
273      result => q(1),
274      output => [q(r="baz"), q(r='baz')],
275     },
276     {
277      t => q{r!='baz'},
278      method => 'parse_attribute_specification',
279      result => q(0:1:SYNTAX_VI_REQUIRED),
280     },
281     {
282      t => q{<foo>},
283      method => 'parse_start_tag',
284      result => q(1),
285     },
286     {
287      t => q{<foo   >},
288      method => 'parse_start_tag',
289      result => q(1),
290     },
291     {
292      t => q{<foo},
293      method => 'parse_start_tag',
294      result => q(0:4:SYNTAX_STAGC_OR_NESTC_REQUIRED),
295     },
296     {
297      t => q{<foo bar="baz">},
298      method => 'parse_start_tag',
299      result => q(1),
300     },
301     {
302      t => q{<foo bar="baz" baz="bar">},
303      method => 'parse_start_tag',
304      result => q(1),
305     },
306     {
307      t => q{<foo bar="baz"baz="bar">},
308      method => 'parse_start_tag',
309      result => q(0:14:SYNTAX_S_REQUIRED_BETWEEN_ATTR_SPEC),
310     },
311     {
312      t => q{<foo bar="bazbaz="bar">},
313      method => 'parse_start_tag',
314      result => q(0:18:SYNTAX_S_REQUIRED_BETWEEN_ATTR_SPEC),
315     },
316     {
317      t => q{<foo "baz"baz="bar">},
318      method => 'parse_start_tag',
319      result => q(0:5:SYNTAX_STAGC_OR_NESTC_REQUIRED),
320     },
321     {
322      t => q{<foo="bar">},
323      method => 'parse_start_tag',
324      result => q(0:4:SYNTAX_STAGC_OR_NESTC_REQUIRED),
325     },
326     {
327      t => q{<foo a=bar>},
328      method => 'parse_start_tag',
329      result => q(0:7:SYNTAX_ATTRIBUTE_VALUE),
330     },
331     {
332      t => q{<foo/>},
333      method => 'parse_start_tag',
334      result => q(1),
335     },
336     {
337      t => q{<foo/},
338      method => 'parse_start_tag',
339      result => q(0:5:SYNTAX_NET_REQUIRED),
340     },
341     {
342      t => q{<foo    />},
343      method => 'parse_start_tag',
344      result => q(1),
345     },
346     {
347      t => q{</foo>},
348      method => 'parse_start_tag',
349      result => q(0:1:SYNTAX_ELEMENT_TYPE_NAME_FOLLOWING_STAGO_REQUIRED),
350     },
351     {
352      t => q{<},
353      method => 'parse_start_tag',
354      result => q(0:1:SYNTAX_ELEMENT_TYPE_NAME_FOLLOWING_STAGO_REQUIRED),
355     },
356     {
357      t => q{<<},
358      method => 'parse_start_tag',
359      result => q(0:1:SYNTAX_ELEMENT_TYPE_NAME_FOLLOWING_STAGO_REQUIRED),
360     },
361    
362     {
363      t => q{<e>text</e>},
364      method => 'parse_element',
365      option => {},
366      result => q(1),
367     },
368     {
369      t => q{<e>text<tag>text</tag>text<tag/>text</e>},
370      method => 'parse_element',
371      option => {},
372      result => q(1),
373     },
374     {
375      t => q{<e>text<tag</e>},
376      method => 'parse_element',
377      result => q(0:11:SYNTAX_STAGC_OR_NESTC_REQUIRED),
378     },
379     {
380      t => q{<e>text&ref;and&#1234;text</e>},
381      method => 'parse_element',
382      result => q(1),
383     },
384    
385     {
386      t => q{<foo></foo bar="baz">},
387      method => 'parse_element',
388      result => q(0:11:SYNTAX_ETAGC_REQUIRED),
389     },
390     {
391      t => q{<foo></foo/>},
392      method => 'parse_element',
393      result => q(0:10:SYNTAX_ETAGC_REQUIRED),
394     },
395     {
396      t => q{<foo></foo},
397      method => 'parse_element',
398      result => q(0:10:SYNTAX_ETAGC_REQUIRED),
399     },
400     {
401      t => q{<foo></b>},
402      method => 'parse_element',
403      result => q(0:7:WFC_ELEMENT_TYPE_MATCH),
404     },
405     {
406      t => q{<e></},
407      method => 'parse_element',
408      option => {ExpandedURI q<allow_end_tag> => 0},
409      result => q(0:5:SYNTAX_ELEMENT_TYPE_NAME_FOLLOWING_ETAGO_REQUIRED),
410     },
411     {
412      t => q{<foo>aa},
413      method => 'parse_element',
414      result => q(0:7:SYNTAX_END_TAG_REQUIRED),
415     },
416    
417     {
418      t => q{<!-- comment -->},
419      method => 'parse_markup_declaration',
420      result => 1,
421     },
422     {
423      t => q{<!-- comment- -->},
424      method => 'parse_markup_declaration',
425      result => 1,
426     },
427     {
428      t => q{<!-- comment-> -->},
429      method => 'parse_markup_declaration',
430      result => 1,
431     },
432     {
433      t => q{<!-- comment},
434      method => 'parse_markup_declaration',
435      result => q(0:12:SYNTAX_COMC_REQUIRED),
436     },
437     {
438      t => q{<!-- comment --},
439      method => 'parse_markup_declaration',
440      result => q(0:15:SYNTAX_MDC_FOR_COMMENT_REQUIRED),
441     },
442     {
443      t => q{<!-- comment --->},
444      method => 'parse_markup_declaration',
445      result => q(0:15:SYNTAX_MDC_FOR_COMMENT_REQUIRED),
446     },
447     {
448      t => q{<!--- comment -->},
449      method => 'parse_markup_declaration',
450      result => 1,
451     },
452     {
453      t => q{<!-- comment ----},
454      method => 'parse_markup_declaration',
455      result => q(0:15:SYNTAX_MULTIPLE_COMMENT),
456     },
457     {
458      t => q{<!-- comment ----aa-->},
459      method => 'parse_markup_declaration',
460      result => q(0:15:SYNTAX_MULTIPLE_COMMENT),
461     },
462     {
463      t => q{<!-- comment -- >},
464      method => 'parse_markup_declaration',
465      result => q(0:15:SYNTAX_S_IN_COMMENT_DECLARATION),
466     },
467    
468     {
469      t => q{<e><!-- comment --></e>},
470      method => 'parse_element',
471      result => 1,
472     },
473     {
474      t => q{<e>bb<!-- comment -->aa</e>},
475      method => 'parse_element',
476      result => 1,
477     },
478     {
479      t => q{<e>bb<!-- comment -->aa<!--c--></e>},
480      method => 'parse_element',
481      result => 1,
482     },
483    
484     {
485      t => q{<?pi?>},
486      method => 'parse_processing_instruction',
487      result => 1,
488     },
489     {
490      t => q{<?pi target-data?>},
491      method => 'parse_processing_instruction',
492      result => 1,
493     },
494     {
495      t => q{<?pi target-data ?>},
496      method => 'parse_processing_instruction',
497      result => 1,
498     },
499     {
500      t => q{<?pi target-data="something"?>},
501      method => 'parse_processing_instruction',
502      result => 1,
503     },
504     {
505      t => q{<?pi target-data="some?>},
506      method => 'parse_processing_instruction',
507      result => 1,
508     },
509     {
510      t => q{<? system-data ?>},
511      method => 'parse_processing_instruction',
512      result => q(0:2:SYNTAX_TARGET_NAME_REQUIRED),
513     },
514     {
515      t => q{<?pi},
516      method => 'parse_processing_instruction',
517      result => q(0:4:SYNTAX_PIC_REQUIRED),
518     },
519     {
520      t => q{<?pi!?>},
521      method => 'parse_processing_instruction',
522      result => q(0:4:SYNTAX_PIC_REQUIRED),
523     },
524    
525     {
526      t => q{<e><?pi?>foo</e>},
527      method => 'parse_element',
528      result => q(1),
529     },
530     {
531      t => q{<e>bar<?pi?>foo</e>},
532      method => 'parse_element',
533      result => q(1),
534     },
535    
536     {
537      t => q{<!foo>},
538      method => 'parse_markup_declaration',
539      result => q(0:2:SYNTAX_UNKNOWN_MARKUP_DECLARATION),
540     },
541    
542     {
543      t => q{<!DOCTYPE>},
544      method => 'parse_markup_declaration',
545      result => q(0:9:SYNTAX_DOCTYPE_PS_REQUIRED),
546     },
547     {
548      t => q{<!DOCTYPE >},
549      method => 'parse_markup_declaration',
550      result => q(0:10:SYNTAX_DOCTYPE_NAME_REQUIRED),
551     },
552     {
553      t => q{<!DOCTYPE name>},
554      method => 'parse_markup_declaration',
555      result => q(1),
556     },
557     {
558      t => q{<!DOCTYPE #IMPLIED>},
559      method => 'parse_markup_declaration',
560      result => q(0:11:SYNTAX_DOCTYPE_IMPLIED),
561     },
562     {
563      t => q{<!DOCTYPE #keyword>},
564      method => 'parse_markup_declaration',
565      result => q(0:11:SYNTAX_DOCTYPE_RNI_KEYWORD),
566     },
567     {
568      t => q{<!DOCTYPE#IMPLIED>},
569      method => 'parse_markup_declaration',
570      result => q(0:9:SYNTAX_DOCTYPE_PS_REQUIRED),
571     },
572     {
573      t => q{<!DOCTYPE name >},
574      method => 'parse_markup_declaration',
575      result => q(1),
576     },
577     {
578      t => q{<!DOCTYPE name PUBLIC>},
579      method => 'parse_markup_declaration',
580      result => q(0:21:SYNTAX_DOCTYPE_PS_REQUIRED),
581     },
582     {
583      t => q{<!DOCTYPE name PUBLIC >},
584      method => 'parse_markup_declaration',
585      result => q(0:22:SYNTAX_PUBID_LITERAL_REQUIRED),
586     },
587     {
588      t => q{<!DOCTYPE name PUBLIC[]>},
589      method => 'parse_markup_declaration',
590      result => q(0:21:SYNTAX_DOCTYPE_PS_REQUIRED),
591     },
592     {
593      t => q{<!DOCTYPE name PUBLIC []>},
594      method => 'parse_markup_declaration',
595      result => q(0:22:SYNTAX_PUBID_LITERAL_REQUIRED),
596     },
597     {
598      t => q{<!DOCTYPE name PUBLIC"pubid">},
599      method => 'parse_markup_declaration',
600      result => q(0:21:SYNTAX_DOCTYPE_PS_REQUIRED),
601     },
602     {
603      t => q{<!DOCTYPE name PUBLIC "pubid">},
604      method => 'parse_markup_declaration',
605      result => q(0:29:SYNTAX_DOCTYPE_PS_REQUIRED),
606     },
607     {
608      t => q{<!DOCTYPE name PUBLIC 'pubid'>},
609      method => 'parse_markup_declaration',
610      result => q(0:29:SYNTAX_DOCTYPE_PS_REQUIRED),
611     },
612     {
613      t => q{<!DOCTYPE name PUBLIC "pubid},
614      method => 'parse_markup_declaration',
615      result => q(0:28:SYNTAX_PUBLIT_MLITC_REQUIRED),
616     },
617     {
618      t => q{<!DOCTYPE name PUBLIC 'pubid},
619      method => 'parse_markup_declaration',
620      result => q(0:28:SYNTAX_PUBLIT_MLITAC_REQUIRED),
621     },
622     {
623      t => q{<!DOCTYPE name PUBLIC "pubid" >},
624      method => 'parse_markup_declaration',
625      result => q(0:30:SYNTAX_SYSTEM_LITERAL_REQUIRED),
626     },
627     {
628      t => q{<!DOCTYPE name PUBLIC 'pubid' >},
629      method => 'parse_markup_declaration',
630      result => q(0:30:SYNTAX_SYSTEM_LITERAL_REQUIRED),
631     },
632     {
633      t => q{<!DOCTYPE name PUBLIC "pub<id" "">},
634      method => 'parse_markup_declaration',
635      result => q(0:26:SYNTAX_PUBID_LITERAL_INVALID_CHAR),
636     },
637     {
638      t => q{<!DOCTYPE name PUBLIC "pubid" "sysid">},
639      method => 'parse_markup_declaration',
640      result => q(1),
641     },
642     {
643      t => q{<!DOCTYPE name PUBLIC "pubid" "sysid" >},
644      method => 'parse_markup_declaration',
645      result => q(1),
646     },
647     {
648      t => q{<!DOCTYPE name PUBLIC "pubid" "sys<>id">},
649      method => 'parse_markup_declaration',
650      result => q(1),
651     },
652     {
653      t => q{<!DOCTYPE name PUBLIC "pubid" 'sysid'>},
654      method => 'parse_markup_declaration',
655      result => q(1),
656     },
657     {
658      t => q{<!DOCTYPE name PUBLIC "pubid" 'sysid' >},
659      method => 'parse_markup_declaration',
660      result => q(1),
661     },
662     {
663      t => q{<!DOCTYPE name PUBLIC "pubid" "sysid>},
664      method => 'parse_markup_declaration',
665      result => q(0:37:SYNTAX_SLITC_REQUIRED),
666     },
667     {
668      t => q{<!DOCTYPE name PUBLIC "pubid" 'sysid>},
669      method => 'parse_markup_declaration',
670      result => q(0:37:SYNTAX_SLITAC_REQUIRED),
671     },
672    
673     {
674      t => q{<!DOCTYPE name SYSTEM>},
675      method => 'parse_markup_declaration',
676      result => q(0:21:SYNTAX_DOCTYPE_PS_REQUIRED),
677     },
678     {
679      t => q{<!DOCTYPE name SYSTEM >},
680      method => 'parse_markup_declaration',
681      result => q(0:22:SYNTAX_SYSTEM_LITERAL_REQUIRED),
682     },
683     {
684      t => q{<!DOCTYPE name SYSTEM[]>},
685      method => 'parse_markup_declaration',
686      result => q(0:21:SYNTAX_DOCTYPE_PS_REQUIRED),
687     },
688     {
689      t => q{<!DOCTYPE name SYSTEM []>},
690      method => 'parse_markup_declaration',
691      result => q(0:22:SYNTAX_SYSTEM_LITERAL_REQUIRED),
692     },
693     {
694      t => q{<!DOCTYPE name SYSTEM"sysid">},
695      method => 'parse_markup_declaration',
696      result => q(0:21:SYNTAX_DOCTYPE_PS_REQUIRED),
697     },
698     {
699      t => q{<!DOCTYPE name SYSTEM'sysid'>},
700      method => 'parse_markup_declaration',
701      result => q(0:21:SYNTAX_DOCTYPE_PS_REQUIRED),
702     },
703     {
704      t => q{<!DOCTYPE name SYSTEM "sysid">},
705      method => 'parse_markup_declaration',
706      result => q(1),
707     },
708     {
709      t => q{<!DOCTYPE name SYSTEM "sysid" >},
710      method => 'parse_markup_declaration',
711      result => q(1),
712     },
713     {
714      t => q{<!DOCTYPE name SYSTEM 'sysid'>},
715      method => 'parse_markup_declaration',
716      result => q(1),
717     },
718     {
719      t => q{<!DOCTYPE name SYSTEM 'sysid' >},
720      method => 'parse_markup_declaration',
721      result => q(1),
722     },
723     {
724      t => q{<!DOCTYPE name SYSTEM "sysid},
725      method => 'parse_markup_declaration',
726      result => q(0:28:SYNTAX_SLITC_REQUIRED),
727     },
728     {
729      t => q{<!DOCTYPE name SYSTEM 'sysid},
730      method => 'parse_markup_declaration',
731      result => q(0:28:SYNTAX_SLITAC_REQUIRED),
732     },
733     {
734      t => q{<!DOCTYPE name system},
735      method => 'parse_markup_declaration',
736      result => q(0:15:SYNTAX_MARKUP_DECLARATION_UNKNOWN_KEYWORD),
737     },
738    
739     {
740      t => q{<!DOCTYPE name[]>},
741      method => 'parse_markup_declaration',
742      result => q(1),
743     },
744     {
745      t => q{<!DOCTYPE name []>},
746      method => 'parse_markup_declaration',
747      result => q(1),
748     },
749     {
750      t => q{<!DOCTYPE name[ ]   >},
751      method => 'parse_markup_declaration',
752      result => q(1),
753     },
754     {
755      t => q{<!DOCTYPE name []    >},
756      method => 'parse_markup_declaration',
757      result => q(1),
758     },
759     {
760      t => q{<!DOCTYPE name PUBLIC "pubid" "sysid"[]>},
761      method => 'parse_markup_declaration',
762      result => q(1),
763     },
764     {
765      t => q{<!DOCTYPE name PUBLIC "pubid" "sysid" []>},
766      method => 'parse_markup_declaration',
767      result => q(1),
768     },
769     {
770      t => q{<!DOCTYPE name PUBLIC "pubid" 'sysid'[]>},
771      method => 'parse_markup_declaration',
772      result => q(1),
773     },
774     {
775      t => q{<!DOCTYPE name PUBLIC "pubid" 'sysid' []>},
776      method => 'parse_markup_declaration',
777      result => q(1),
778     },
779     {
780      t => q{<!DOCTYPE name PUBLIC "pubid" 'sysid'[] >},
781      method => 'parse_markup_declaration',
782      result => q(1),
783     },
784     {
785      t => q{<!DOCTYPE name PUBLIC "pubid" 'sysid' []>},
786      method => 'parse_markup_declaration',
787      result => q(1),
788     },
789     {
790      t => q{<!DOCTYPE name [] SYSTEM 'sysid'},
791      method => 'parse_markup_declaration',
792      result => q(0:18:SYNTAX_MDC_REQUIRED),
793     },
794    
795     {
796      t => q{<!DOCTYPE name SYSTEM ""[ <!-- --> ]>},
797      method => 'parse_markup_declaration',
798      result => q(1),
799     },
800     {
801      t => q{<!DOCTYPE name SYSTEM ""[ <!-- --> ]   >},
802      method => 'parse_markup_declaration',
803      result => q(1),
804     },
805     {
806      t => q{<!DOCTYPE name SYSTEM ""[ <!-- --> <!> ]>},
807      method => 'parse_markup_declaration',
808      result => q(0:35:SYNTAX_EMPTY_COMMENT_DECLARATION),
809     },
810     {
811      t => q{<!DOCTYPE name SYSTEM ""[ <!-- -- -- --> ]>},
812      method => 'parse_markup_declaration',
813      result => q(0:33:SYNTAX_S_IN_COMMENT_DECLARATION),
814     },
815     {
816      t => q{<!DOCTYPE name SYSTEM ""[ <!-- --> ]  },
817      method => 'parse_markup_declaration',
818      result => q(0:38:SYNTAX_MDC_REQUIRED),
819     },
820     {
821      t => q{<!DOCTYPE name []aaa>},
822      method => 'parse_markup_declaration',
823      result => q(0:17:SYNTAX_MDC_REQUIRED),
824     },
825     {
826      t => q{<!DOCTYPE name PUBLIC "pub" "sys"aaa>},
827      method => 'parse_markup_declaration',
828      result => q(0:33:SYNTAX_MDC_REQUIRED),
829     },
830     {
831      t => q{<!DOCTYPE name SYSTEM "sys"aaa>},
832      method => 'parse_markup_declaration',
833      result => q(0:27:SYNTAX_MDC_REQUIRED),
834     },
835     {
836      t => q{<!DOCTYPE name []      >},
837      method => 'parse_markup_declaration',
838      result => q(1),
839     },
840     {
841      t => q{<!DOCTYPE name SYSTEM "sys"    >},
842      method => 'parse_markup_declaration',
843      result => q(1),
844     },
845     {
846      t => q{<!DOCTYPE %param;  >},
847      method => 'parse_markup_declaration',
848      result => q(0:10:SYNTAX_PARAENT_REF_NOT_ALLOWED),
849     },
850     {
851      t => q{<!DOCTYPE --%param; -- >},
852      method => 'parse_markup_declaration',
853      result => q(0:10:SYNTAX_PS_COMMENT),
854     },
855    
856     {
857      t => q{abcdefg},
858      method => 'parse_rpdata',
859      result => q(1),
860     },
861     {
862      t => q{abcd&#125;efg},
863      method => 'parse_rpdata',
864      result => q(1),
865     },
866     {
867      t => q{abcd&#x125;efg},
868      method => 'parse_rpdata',
869      result => q(1),
870     },
871     {
872      t => q{abcd&e5;efg},
873      method => 'parse_rpdata',
874      result => q(1),
875     },
876     {
877      t => q{abcd%e5;efg},
878      method => 'parse_rpdata',
879      result => q(1),
880     },
881     {
882      t => q{abcd&e5efg},
883      method => 'parse_rpdata',
884      result => q(0:10:SYNTAX_REFC_REQUIRED),
885     },
886     {
887      t => q{abcd&#xe5e a},
888      method => 'parse_rpdata',
889      result => q(0:10:SYNTAX_REFC_REQUIRED),
890     },
891     {
892      t => q{abcd%e5efg},
893      method => 'parse_rpdata',
894      result => q(0:10:SYNTAX_REFC_REQUIRED),
895     },
896     {
897      t => q{abcd% e5efg},
898      method => 'parse_rpdata',
899      result => q(0:5:SYNTAX_PARAENT_NAME_REQUIRED),
900     },
901    
902     {
903      t => q{<!ENTITY "a">},
904      method => 'parse_entity_declaration',
905      result => q(0:9:SYNTAX_ENTITY_NAME_REQUIRED),
906     },
907     {
908      t => q{<!ENTITY a "a">},
909      method => 'parse_entity_declaration',
910      result => q(1),
911     },
912     {
913      t => q{<!ENTITY % "a">},
914      method => 'parse_entity_declaration',
915      result => q(0:11:SYNTAX_ENTITY_PARAM_NAME_REQUIRED),
916     },
917     {
918      t => q{<!ENTITY % a "a">},
919      method => 'parse_entity_declaration',
920      result => q(1),
921     },
922     {
923      t => q{<!ENTITY #DEFAULT "a">},
924      method => 'parse_entity_declaration',
925      result => q(0:10:SYNTAX_ENTITY_DEFAULT),
926     },
927     {
928      t => q{<!ENTITY #ALL "a">},
929      method => 'parse_entity_declaration',
930      result => q(0:10:SYNTAX_ENTITY_RNI_KEYWORD),
931     },
932     {
933      t => q{<!ENTITY % #DEFAULT "a">},
934      method => 'parse_entity_declaration',
935      result => q(0:11:SYNTAX_ENTITY_PARAM_NAME_REQUIRED),
936     },
937    
938     {
939      t => q{<!ENTITY a "abcde">},
940      method => 'parse_entity_declaration',
941      result => q(1),
942     },
943     {
944      t => q{<!ENTITY a "ab&a;cde">},
945      method => 'parse_entity_declaration',
946      result => q(1),
947     },
948     {
949      t => q{<!ENTITY a "ab%a;cde">},
950      method => 'parse_entity_declaration',
951      result => q(1),
952     },
953     {
954      t => q{<!ENTITY a "ab<c'de">},
955      method => 'parse_entity_declaration',
956      result => q(1),
957     },
958     {
959      t => q{<!ENTITY a 'ab<c"de'>},
960      method => 'parse_entity_declaration',
961      result => q(1),
962     },
963     {
964      t => q{<!ENTITY a "abcde>},
965      method => 'parse_entity_declaration',
966      result => q(0:18:SYNTAX_PLITC_REQUIRED),
967     },
968     {
969      t => q{<!ENTITY a 'abcde>},
970      method => 'parse_entity_declaration',
971      result => q(0:18:SYNTAX_PLITAC_REQUIRED),
972     },
973     {
974      t => q{<!ENTITY a "abcde"    >},
975      method => 'parse_entity_declaration',
976      result => q(1),
977     },
978     {
979      t => q{<!ENTITY a "abcde"aa>},
980      method => 'parse_entity_declaration',
981      result => q(0:18:SYNTAX_MDC_REQUIRED),
982     },
983     {
984      t => q{<!ENTITY a "abcde" aa>},
985      method => 'parse_entity_declaration',
986      result => q(0:19:SYNTAX_MDC_REQUIRED),
987     },
988     {
989      t => q{<!ENTITY % pa "abcde" >},
990      method => 'parse_entity_declaration',
991      result => q(1),
992     },
993    
994     {
995      t => q{<!ENTITY a SYSTEM "sys">},
996      method => 'parse_entity_declaration',
997      result => q(1),
998     },
999     {
1000      t => q{<!ENTITY a SYSTEM "sys"  >},
1001      method => 'parse_entity_declaration',
1002      result => q(1),
1003     },
1004     {
1005      t => q{<!ENTITY a PUBLIC "pub" "sys">},
1006      method => 'parse_entity_declaration',
1007      result => q(1),
1008     },
1009     {
1010      t => q{<!ENTITY a PUBLIC "pub" "sys"  >},
1011      method => 'parse_entity_declaration',
1012      result => q(1),
1013     },
1014     {
1015      t => q{<!ENTITY %    a PUBLIC "pub" "sys"  >},
1016      method => 'parse_entity_declaration',
1017      result => q(1),
1018     },
1019     {
1020      t => q{<!ENTITY a PUBLIC "pub" >},
1021      method => 'parse_entity_declaration',
1022      result => q(0:24:SYNTAX_SYSTEM_LITERAL_REQUIRED),
1023     },
1024     {
1025      t => q{<!ENTITY a PUBLIC >},
1026      method => 'parse_entity_declaration',
1027      result => q(0:18:SYNTAX_PUBID_LITERAL_REQUIRED),
1028     },
1029     {
1030      t => q{<!ENTITY a SYSTEM >},
1031      method => 'parse_entity_declaration',
1032      result => q(0:18:SYNTAX_SYSTEM_LITERAL_REQUIRED),
1033     },
1034     {
1035      t => q{<!ENTITY a SYSTEM "sys" "what?">},
1036      method => 'parse_entity_declaration',
1037      result => q(0:24:SYNTAX_MDC_REQUIRED),
1038     },
1039     {
1040      t => q{<!ENTITY a PUBLIC "pub" "sys" "what?">},
1041      method => 'parse_entity_declaration',
1042      result => q(0:30:SYNTAX_MDC_REQUIRED),
1043     },
1044     {
1045      t => q{<!ENTITY a PUBLIC "pub""sys">},
1046      method => 'parse_entity_declaration',
1047      result => q(0:23:SYNTAX_ENTITY_PS_REQUIRED),
1048     },
1049     {
1050      t => q{<!ENTITY a PUBLIC"pub" "sys">},
1051      method => 'parse_entity_declaration',
1052      result => q(0:17:SYNTAX_ENTITY_PS_REQUIRED),
1053     },
1054     {
1055      t => q{<!ENTITY a SYSTEM"sys">},
1056      method => 'parse_entity_declaration',
1057      result => q(0:17:SYNTAX_ENTITY_PS_REQUIRED),
1058     },
1059     {
1060      t => q{<!ENTITY a KEYWORD>},
1061      method => 'parse_entity_declaration',
1062      result => q(0:11:SYNTAX_ENTITY_TEXT_KEYWORD),
1063     },
1064     {
1065      t => q{<!ENTITY a CDATA "cdata">},
1066      method => 'parse_entity_declaration',
1067      result => q(0:11:SYNTAX_ENTITY_TEXT_PRE_KEYWORD),
1068     },
1069     {
1070      t => q{<!ENTITY a "cdata" CDATA>},
1071      method => 'parse_entity_declaration',
1072      result => q(0:19:SYNTAX_MDC_REQUIRED),
1073     },
1074     {
1075      t => q{<!ENTITY a SYSTEM "sys" NDATA notation>},
1076      method => 'parse_entity_declaration',
1077      result => q(1),
1078     },
1079     {
1080      t => q{<!ENTITY a SYSTEM "sys" NDATA notation     >},
1081      method => 'parse_entity_declaration',
1082      result => q(1),
1083     },
1084     {
1085      t => q{<!ENTITY a SYSTEM "sys"NDATA notation>},
1086      method => 'parse_entity_declaration',
1087      result => q(0:23:SYNTAX_ENTITY_PS_REQUIRED),
1088     },
1089     {
1090      t => q{<!ENTITY a SYSTEM "sys" NDATAnotation>},
1091      method => 'parse_entity_declaration',
1092      result => q(0:24:SYNTAX_ENTITY_DATA_TYPE_UNKNOWN_KEYWORD),
1093     },
1094     {
1095      t => q{<!ENTITY a SYSTEM "sys" NDATA notation  aa   >},
1096      method => 'parse_entity_declaration',
1097      result => q(0:40:SYNTAX_MDC_REQUIRED),
1098     },
1099     {
1100      t => q{<!ENTITY a SYSTEM "sys" NDATA >},
1101      method => 'parse_entity_declaration',
1102      result => q(0:30:SYNTAX_ENTITY_DATA_TYPE_NOTATION_NAME_REQUIRED),
1103     },
1104     {
1105      t => q{<!ENTITY a SYSTEM "sys" NDATA #>},
1106      method => 'parse_entity_declaration',
1107      result => q(0:30:SYNTAX_ENTITY_DATA_TYPE_NOTATION_NAME_REQUIRED),
1108     },
1109     {
1110      t => q{<!ENTITY a SYSTEM "sys" CDATA a>},
1111      method => 'parse_entity_declaration',
1112      result => q(0:24:SYNTAX_ENTITY_DATA_TYPE_SGML_KEYWORD),
1113     },
1114     {
1115      t => q{<!ENTITY a SYSTEM "sys" SDATA a>},
1116      method => 'parse_entity_declaration',
1117      result => q(0:24:SYNTAX_ENTITY_DATA_TYPE_SGML_KEYWORD),
1118     },
1119     {
1120      t => q{<!ENTITY a SYSTEM "sys" SUBDOC a>},
1121      method => 'parse_entity_declaration',
1122      result => q(0:24:SYNTAX_ENTITY_DATA_TYPE_SGML_KEYWORD),
1123     },
1124     {
1125      t => q{<!ENTITY a SYSTEM "sys" NDATA b [ attr=val ]>},
1126      method => 'parse_entity_declaration',
1127      result => q(0:32:SYNTAX_MDC_REQUIRED),
1128     },
1129    
1130     {
1131      entity => {b => ''},
1132      t => q{<!ENTITY a "%b;">},
1133      method => 'parse_entity_declaration',
1134      result => q(1),
1135     },
1136     {
1137      entity => {b => ''},
1138      t => q{<!ENTITY a %b; "aa">},
1139      method => 'parse_entity_declaration',
1140      result => q(1),
1141     },
1142     {
1143      entity => {b => '"aa"'},
1144      t => q{<!ENTITY a %b;>},
1145      method => 'parse_entity_declaration',
1146      result => q(1),
1147     },
1148     {
1149      entity => {b => q<SYSTEM "foo">},
1150      t => q{<!ENTITY a %b;>},
1151      method => 'parse_entity_declaration',
1152      result => q(1),
1153     },
1154     {
1155      entity => {b => q<  PUBLIC "pub" 'sys'  >},
1156      t => q{<!ENTITY a %b;>},
1157      method => 'parse_entity_declaration',
1158      result => q(1),
1159     },
1160     {
1161      entity => {b => 'SYSTEM'},
1162      t => q{<!ENTITY a %b;>},
1163      method => 'parse_entity_declaration',
1164      result => q(0:14:SYNTAX_ENTITY_PS_REQUIRED),
1165     },
1166     {
1167      entity => {b => "SYSTEM"},
1168      t => q{<!ENTITY a %b; >},
1169      method => 'parse_entity_declaration',
1170      result => q(0:15:SYNTAX_SYSTEM_LITERAL_REQUIRED),
1171     },
1172     {
1173      entity => {b => q<  SYSTEM "foo" >},
1174      t => q{<!ENTITY a %b; >},
1175      method => 'parse_entity_declaration',
1176      result => q(1),
1177     },
1178     {
1179      entity => {b => q<  SYSTEM %c; >,
1180                 c => q< "sys" >},
1181      t => q{<!ENTITY a %b; >},
1182      method => 'parse_entity_declaration',
1183      result => q(1),
1184     },
1185     {
1186      entity => {b => q<SYSTEM %c; >,
1187                 c => q< "sys" >},
1188      t => q{<!ENTITY%b; >},
1189      method => 'parse_entity_declaration',
1190      result => q(1),
1191     },
1192     {
1193      entity => {b => q[SYSTEM %c; > ],
1194                 c => q< "sys" >},
1195      t => q{<!ENTITY%b; >},
1196      method => 'parse_entity_declaration',
1197      result => q(0:11:SYNTAX_MARKUP_DECLARATION_TOO_MANY_PARAM),
1198     },
1199    
1200     {
1201      t => q{<!ENTITY --comment-->},
1202      method => 'parse_entity_declaration',
1203      result => q(0:9:SYNTAX_PS_COMMENT),
1204     },
1205     {
1206      t => q{<!ENTITY a --comment-->},
1207      method => 'parse_entity_declaration',
1208      result => q(0:11:SYNTAX_PS_COMMENT),
1209     },
1210     {
1211      t => q{<!ENTITY a "a" --comment-->},
1212      method => 'parse_entity_declaration',
1213      result => q(0:15:SYNTAX_PS_COMMENT),
1214     },
1215    
1216     {
1217      t => q{<!ELEMENT el ANY>},
1218      method => 'parse_element_declaration',
1219      result => q(1),
1220     },
1221     {
1222      t => q{<!ELEMENT el EMPTY   >},
1223      method => 'parse_element_declaration',
1224      result => q(1),
1225     },
1226     {
1227      t => q{<!ELEMENT el CDATA>},
1228      method => 'parse_element_declaration',
1229      result => q(0:13:SYNTAX_ELEMENT_SGML_CONTENT_KEYWORD),
1230     },
1231     {
1232      t => q{<!ELEMENT el RCDATA>},
1233      method => 'parse_element_declaration',
1234      result => q(0:13:SYNTAX_ELEMENT_SGML_CONTENT_KEYWORD),
1235     },
1236     {
1237      t => q{<!ELEMENT el foo>},
1238      method => 'parse_element_declaration',
1239      result => q(0:13:SYNTAX_ELEMENT_UNKNOWN_CONTENT_KEYWORD),
1240     },
1241     {
1242      t => q{<!ELEMENT el ANY foo>},
1243      method => 'parse_element_declaration',
1244      result => q(0:17:SYNTAX_MDC_REQUIRED),
1245     },
1246     {
1247      t => q{<!ELEMENT el - - ANY>},
1248      method => 'parse_element_declaration',
1249      result => q(0:13:SYNTAX_ELEMENT_TAG_MIN),
1250     },
1251     {
1252      t => q{<!ELEMENT el o - ANY>},
1253      method => 'parse_element_declaration',
1254      result => q(0:13:SYNTAX_ELEMENT_TAG_MIN),
1255     },
1256     {
1257      t => q{<!ELEMENT (el) o - ANY>},
1258      method => 'parse_element_declaration',
1259      result => q(0:10:SYNTAX_ELEMENT_DECLARATION_TYPE_NAME_GROUP),
1260     },
1261     {
1262      t => q{<!ELEMENT el 1 o - ANY>},
1263      method => 'parse_element_declaration',
1264      result => q(0:13:SYNTAX_ELEMENT_RANK_SUFFIX),
1265     },
1266     {
1267      t => q{<!ELEMENT>},
1268      method => 'parse_element_declaration',
1269      result => q(0:9:SYNTAX_ELEMENT_PS_REQUIRED),
1270     },
1271     {
1272      t => q{<!ELEMENT >},
1273      method => 'parse_element_declaration',
1274      result => q(0:10:SYNTAX_ELEMENT_DECLARATION_TYPE_NAME_REQUIRED),
1275     },
1276     {
1277      t => q{<!ELEMENT e>},
1278      method => 'parse_element_declaration',
1279      result => q(0:11:SYNTAX_ELEMENT_PS_REQUIRED),
1280     },
1281     {
1282      t => q{<!ELEMENT e >},
1283      method => 'parse_element_declaration',
1284      result => q(0:12:SYNTAX_ELEMENT_MODEL_OR_MIN_OR_RANK_REQUIRED),
1285     },
1286     {
1287      t => q{<!ELEMENT e ANY},
1288      method => 'parse_element_declaration',
1289      result => q(0:15:SYNTAX_MDC_REQUIRED),
1290     },
1291    
1292     {
1293      t => q<(a)>,
1294      method => 'parse_model_group',
1295      result => 1,
1296     },
1297     {
1298      t => q<(a,b)>,
1299      method => 'parse_model_group',
1300      result => 1,
1301     },
1302     {
1303      t => q<(a,b,c)>,
1304      method => 'parse_model_group',
1305      result => 1,
1306     },
1307     {
1308      t => q<(   a , b  )>,
1309      method => 'parse_model_group',
1310      result => 1,
1311     },
1312     {
1313      t => q<(   a , b  >,
1314      method => 'parse_model_group',
1315      result => '0:11:SYNTAX_MODEL_GROUP_GRPC_REQUIRED',
1316     },
1317      {
1318      t => q<(   a ,   >,
1319      method => 'parse_model_group',
1320      result => '0:10:SYNTAX_MODEL_GROUP_ITEM_REQUIRED',
1321     },
1322    
1323     {
1324      t => q<( a+ )>,
1325      method => 'parse_model_group',
1326      result => 1,
1327     },
1328     {
1329      t => q<( a* )>,
1330      method => 'parse_model_group',
1331      result => 1,
1332     },
1333     {
1334      t => q<( a? )>,
1335      method => 'parse_model_group',
1336      result => 1,
1337     },
1338     {
1339      t => q<( a?, b )>,
1340      method => 'parse_model_group',
1341      result => 1,
1342     },
1343     {
1344      t => q<( a?, b, c+ )>,
1345      method => 'parse_model_group',
1346      result => 1,
1347     },
1348     {
1349      t => q<( a?, b*, c+ )>,
1350      method => 'parse_model_group',
1351      result => 1,
1352     },
1353     {
1354      t => q<( a?>,
1355      method => 'parse_model_group',
1356      result => '0:4:SYNTAX_MODEL_GROUP_GRPC_REQUIRED',
1357     },
1358     {
1359      t => q<( a ?>,
1360      method => 'parse_model_group',
1361      result => '0:4:SYNTAX_MODEL_GROUP_GRPC_REQUIRED',
1362     },
1363    
1364     {
1365      t => q<( a | b )>,
1366      method => 'parse_model_group',
1367      result => 1,
1368     },
1369     {
1370      t => q<( a & b )>,
1371      method => 'parse_model_group',
1372      result => '0:4:SYNTAX_CONNECTOR',
1373     },
1374    
1375     {
1376      t => q<( a , b )*>,
1377      method => 'parse_model_group',
1378      result => 1,
1379     },
1380     {
1381      t => q<( a , b )+>,
1382      method => 'parse_model_group',
1383      result => 1,
1384     },
1385     {
1386      t => q<( a , b )?>,
1387      method => 'parse_model_group',
1388      result => 1,
1389     },
1390     {
1391      t => q<( a , (b)* )>,
1392      method => 'parse_model_group',
1393      result => 1,
1394     },
1395     {
1396      t => q<( a , (b, c)* )>,
1397      method => 'parse_model_group',
1398      result => 1,
1399     },
1400     {
1401      t => q<( a , (b, (c, d)+)* )>,
1402      method => 'parse_model_group',
1403      result => 1,
1404     },
1405     {
1406      t => q<( a , ([b, %ry; ], (c, d)+)* )>,
1407      method => 'parse_model_group',
1408      result => '0:7:SYNTAX_DATA_TAG_GROUP',
1409     },
1410    
1411     {
1412      t => q<( a -- , b -- )>,
1413      method => 'parse_model_group',
1414      result => '0:4:SYNTAX_PS_COMMENT',
1415     },
1416     {
1417      entity => {
1418        b => q<, b>,
1419      },
1420      t => q<( a %b; )>,
1421      method => 'parse_model_group',
1422      result => 1,
1423     },
1424     {
1425      entity => {
1426        b => q<, >,
1427      },
1428      t => q<( a %b; )>,
1429      method => 'parse_model_group',
1430      result => '0:8:SYNTAX_MODEL_GROUP_ITEM_REQUIRED',
1431     },
1432     {
1433      entity => {
1434        b => q<, (b) >,
1435      },
1436      t => q<( a %b; )>,
1437      method => 'parse_model_group',
1438      result => 1,
1439     },
1440     {
1441      entity => {
1442        b => q<, (b >,
1443      },
1444      t => q<( a %b; ))>,
1445      method => 'parse_model_group',
1446      result => '0:5:SYNTAX_MODEL_GROUP_GRPC_REQUIRED',
1447     },
1448     {
1449      entity => {
1450        b => q<, b) >,
1451      },
1452      t => q<( a %b; >,
1453      method => 'parse_model_group',
1454      result => '0:3:SYNTAX_MARKUP_DECLARATION_TOO_MANY_PARAM',
1455     },
1456    
1457     {
1458      t => q<( #PCDATA )* >,
1459      method => 'parse_model_group',
1460      result => 1,
1461     },
1462     {
1463      t => q<( #PCDATA ) >,
1464      method => 'parse_model_group',
1465      result => 1,
1466     },
1467     {
1468      t => q<( #PCDATA | a )* >,
1469      method => 'parse_model_group',
1470      result => 1,
1471     },
1472     {
1473      t => q<( #PCDATA | a | b)* >,
1474      method => 'parse_model_group',
1475      result => 1,
1476     },
1477     {
1478      t => q<( #PCDATA )+ >,
1479      method => 'parse_model_group',
1480      result => '0:11:SYNTAX_MODEL_GROUP_PCDATA_OCCUR',
1481     },
1482     {
1483      t => q<( #PCDATA | a )+ >,
1484      method => 'parse_model_group',
1485      result => '0:15:SYNTAX_MODEL_GROUP_MIXED_OCCUR',
1486     },
1487     {
1488      t => q<( #PCDATA , a )* >,
1489      method => 'parse_model_group',
1490      result => '0:10:SYNTAX_MODEL_GROUP_MIXED_CONNECTOR',
1491     },
1492     {
1493      t => q<( #PCDATA | (a) )* >,
1494      method => 'parse_model_group',
1495      result => '0:12:SYNTAX_MODEL_GROUP_MIXED_NESTED',
1496     },
1497     {
1498      t => q<( b | #PCDATA )* >,
1499      method => 'parse_model_group',
1500      result => '0:7:SYNTAX_MODEL_GROUP_PCDATA_POSITION',
1501     },
1502     {
1503      t => q<( b | #foo )* >,
1504      method => 'parse_model_group',
1505      result => '0:7:SYNTAX_MODEL_GROUP_UNKNOWN_KEYWORD',
1506     },
1507     {
1508      t => q<( #PCDATA | a , b ) >,
1509      method => 'parse_model_group',
1510      result => '0:14:SYNTAX_MODEL_GROUP_CONNECTOR_MATCH',
1511     },
1512     {
1513      t => q<( a , b | a) >,
1514      method => 'parse_model_group',
1515      result => '0:8:SYNTAX_MODEL_GROUP_CONNECTOR_MATCH',
1516     },
1517    
1518     {
1519      t => q<<!ELEMENT e ( a , b , a) >>,
1520      method => 'parse_element_declaration',
1521      result => '1',
1522     },
1523     {
1524      t => q<<!ELEMENT e ( a , b  >>,
1525      method => 'parse_element_declaration',
1526      result => '0:21:SYNTAX_MODEL_GROUP_GRPC_REQUIRED',
1527     },
1528     {
1529      entity => {b => q<(a, b>},
1530      t => q<<!ELEMENT e %b; ) >>,
1531      method => 'parse_element_declaration',
1532      result => '0:5:SYNTAX_MODEL_GROUP_GRPC_REQUIRED',
1533     },
1534     {
1535      entity => {b => q[(a, b )>]},
1536      t => q[<!ELEMENT e %b; ],
1537      method => 'parse_element_declaration',
1538      result => '0:7:SYNTAX_MARKUP_DECLARATION_TOO_MANY_PARAM',
1539     },
1540    
1541     {
1542      t => q<<!NOTATION n PUBLIC "pub">>,
1543      method => 'parse_notation_declaration',
1544      result => 1,
1545     },
1546     {
1547      t => q<<!NOTATION n PUBLIC "pub" "sys"  >>,
1548      method => 'parse_notation_declaration',
1549      result => 1,
1550     },
1551     {
1552      t => q<<!NOTATION n SYSTEM "sys">>,
1553      method => 'parse_notation_declaration',
1554      result => 1,
1555     },
1556     {
1557      t => q[<!NOTATION n SYSTEM "sys"],
1558      method => 'parse_notation_declaration',
1559      result => '0:25:SYNTAX_MDC_REQUIRED',
1560     },
1561     {
1562      t => q[<!NOTATION n SYSTEM "sys>],
1563      method => 'parse_notation_declaration',
1564      result => '0:25:SYNTAX_SLITC_REQUIRED',
1565     },
1566     {
1567      t => q[<!NOTATION n ],
1568      method => 'parse_notation_declaration',
1569      result => '0:13:SYNTAX_NOTATION_EXTERNAL_IDENTIFIER_REQUIRED',
1570     },
1571     {
1572      t => q[<!NOTATION>],
1573      method => 'parse_notation_declaration',
1574      result => '0:10:SYNTAX_NOTATION_PS_REQUIRED',
1575     },
1576     {
1577      t => q[<!NOTATION >],
1578      method => 'parse_notation_declaration',
1579      result => '0:11:SYNTAX_NOTATION_NAME_REQUIRED',
1580     },
1581     {
1582      t => q[<!NOTATION n>],
1583      method => 'parse_notation_declaration',
1584      result => '0:12:SYNTAX_NOTATION_PS_REQUIRED',
1585     },
1586     {
1587      t => q[<!NOTATION n SYSTEM >],
1588      method => 'parse_notation_declaration',
1589      result => '0:20:SYNTAX_SYSTEM_LITERAL_REQUIRED',
1590     },
1591     {
1592      entity => {n => q<not SYSTEM %sys;>, sys => q< "sys" >},
1593      t => q[<!NOTATION %n;>],
1594      method => 'parse_notation_declaration',
1595      result => 1,
1596     },
1597    
1598     {
1599      t => q[<!ATTLIST a>],
1600      method => 'parse_attlist_declaration',
1601      result => 1,
1602     },
1603     {
1604      t => q[<!ATTLIST attr  >],
1605      method => 'parse_attlist_declaration',
1606      result => 1,
1607     },
1608     {
1609      t => q[<!ATTLIST el <],
1610      method => 'parse_attlist_declaration',
1611      result => '0:13:SYNTAX_MDC_REQUIRED',
1612     },
1613     {
1614      t => q[<!ATTLIST >],
1615      method => 'parse_attlist_declaration',
1616      result => '0:10:SYNTAX_ATTLIST_ASSOCIATED_NAME_REQUIRED',
1617     },
1618     {
1619      t => q[<!ATTLIST>],
1620      method => 'parse_attlist_declaration',
1621      result => '0:9:SYNTAX_ATTLIST_PS_REQUIRED',
1622     },
1623    
1624     {
1625      t => q[<!ATTLIST foo a CDATA #IMPLIED>],
1626      method => 'parse_attlist_declaration',
1627      result => 1,
1628     },
1629     {
1630      t => q[<!ATTLIST foo a CDATA #REQUIRED>],
1631      method => 'parse_attlist_declaration',
1632      result => 1,
1633     },
1634     {
1635      t => q[<!ATTLIST foo a NMTOKEN #IMPLIED>],
1636      method => 'parse_attlist_declaration',
1637      result => 1,
1638     },
1639     {
1640      t => q[<!ATTLIST foo a ID #IMPLIED>],
1641      method => 'parse_attlist_declaration',
1642      result => 1,
1643     },
1644     {
1645      t => q[<!ATTLIST foo a IDREF #IMPLIED>],
1646      method => 'parse_attlist_declaration',
1647      result => 1,
1648     },
1649     {
1650      t => q[<!ATTLIST foo a IDREFS #IMPLIED>],
1651      method => 'parse_attlist_declaration',
1652      result => 1,
1653     },
1654     {
1655      t => q[<!ATTLIST foo a NMTOKENS #IMPLIED>],
1656      method => 'parse_attlist_declaration',
1657      result => 1,
1658     },
1659     {
1660      t => q[<!ATTLIST foo a NMTOKENS #IMPLIED b CDATA #REQUIRED>],
1661      method => 'parse_attlist_declaration',
1662      result => 1,
1663     },
1664     {
1665      t => q[<!ATTLIST foo a NMTOKENS #IMPLIED a NMTOKENS #IMPLIED
1666                           b CDATA #REQUIRED id ID #IMPLIED>],
1667      method => 'parse_attlist_declaration',
1668      result => 1,
1669     },
1670     {
1671      t => q[<!ATTLIST foo a NMTOKENS #CURRENT>],
1672      method => 'parse_attlist_declaration',
1673      result => '0:26:SYNTAX_ATTRDEF_DEFAULT_SGML_KEYWORD',
1674     },
1675     {
1676      t => q[<!ATTLIST foo a NMTOKENS #NEW>],
1677      method => 'parse_attlist_declaration',
1678      result => '0:26:SYNTAX_ATTRDEF_DEFAULT_UNKNOWN_KEYWORD',
1679     },
1680     {
1681      t => q[<!ATTLIST foo a NMTOKENS >],
1682      method => 'parse_attlist_declaration',
1683      result => '0:25:SYNTAX_ATTRDEF_DEFAULT_REQUIRED',
1684     },
1685     {
1686      t => q[<!ATTLIST foo a NMTOKENS#IMPLIED>],
1687      method => 'parse_attlist_declaration',
1688      result => '0:24:SYNTAX_ATTLIST_PS_REQUIRED',
1689     },
1690     {
1691      t => q[<!ATTLIST foo a NAME #IMPLIED>],
1692      method => 'parse_attlist_declaration',
1693      result => '0:16:SYNTAX_ATTRDEF_TYPE_SGML_KEYWORD',
1694     },
1695     {
1696      t => q[<!ATTLIST foo a URI #IMPLIED>],
1697      method => 'parse_attlist_declaration',
1698      result => '0:16:SYNTAX_ATTRDEF_TYPE_UNKNOWN_KEYWORD',
1699     },
1700     {
1701      t => q[<!ATTLIST foo a #IMPLIED>],
1702      method => 'parse_attlist_declaration',
1703      result => '0:16:SYNTAX_ATTRDEF_TYPE_REQUIRED',
1704     },
1705     {
1706      t => q[<!ATTLIST foo a#IMPLIED>],
1707      method => 'parse_attlist_declaration',
1708      result => '0:15:SYNTAX_ATTLIST_PS_REQUIRED',
1709     },
1710     {
1711      t => q[<!ATTLIST foo a CDATA #IMPLIED ab>],
1712      method => 'parse_attlist_declaration',
1713      result => '0:33:SYNTAX_ATTLIST_PS_REQUIRED',
1714     },
1715     {
1716      t => q[<!ATTLIST foo a CDATA "def">],
1717      method => 'parse_attlist_declaration',
1718      result => 1,
1719     },
1720     {
1721      t => q[<!ATTLIST foo a CDATA #FIXED "def">],
1722      method => 'parse_attlist_declaration',
1723      result => 1,
1724     },
1725     {
1726      t => q[<!ATTLIST foo a (a) #IMPLIED>],
1727      method => 'parse_attlist_declaration',
1728      result => 1,
1729     },
1730     {
1731      t => q[<!ATTLIST foo a (a|b) #IMPLIED>],
1732      method => 'parse_attlist_declaration',
1733      result => 1,
1734     },
1735     {
1736      t => q[<!ATTLIST foo a  (a|b|c) #IMPLIED>],
1737      method => 'parse_attlist_declaration',
1738      result => 1,
1739     },
1740     {
1741      t => q[<!ATTLIST foo a  (a|b|c #IMPLIED>],
1742      method => 'parse_attlist_declaration',
1743      result => '0:24:SYNTAX_ATTRDEF_TYPE_GROUP_GRPC_REQUIRED',
1744     },
1745     {
1746      t => q[<!ATTLIST foo a  (a,b) #IMPLIED>],
1747      method => 'parse_attlist_declaration',
1748      result => '0:19:SYNTAX_CONNECTOR',
1749     },
1750     {
1751      t => q[<!ATTLIST foo a  (a+|b) #IMPLIED>],
1752      method => 'parse_attlist_declaration',
1753      result => '0:19:SYNTAX_ATTRDEF_TYPE_GROUP_GRPC_REQUIRED',
1754     },
1755     {
1756      t => q[<!ATTLIST foo a  (a|(b)) #IMPLIED>],
1757      method => 'parse_attlist_declaration',
1758      result => '0:20:SYNTAX_ATTRDEF_TYPE_GROUP_NMTOKEN_REQUIRED',
1759     },
1760     {
1761      t => q[<!ATTLIST foo a  (a|b)* #IMPLIED>],
1762      method => 'parse_attlist_declaration',
1763      result => '0:22:SYNTAX_ATTLIST_PS_REQUIRED',
1764     },
1765     {
1766      t => q[<!ATTLIST foo a  (a|b|c ) "c">],
1767      method => 'parse_attlist_declaration',
1768      result => 1,
1769     },
1770     {
1771      t => q[<!ATTLIST foo a NOTATION ( a|b|c ) "c">],
1772      method => 'parse_attlist_declaration',
1773      result => 1,
1774     },
1775     {
1776      t => q[<!ATTLIST foo a NOTATION ( a|b|c ) 'c&lt;b&#33;!&#x4a;b'>],
1777      method => 'parse_attlist_declaration',
1778      result => 1,
1779     },
1780     {
1781      t => q[<!ATTLIST foo a NOTATION ( a|b|c ) 'c<b'>],
1782      method => 'parse_attlist_declaration',
1783      result => '0:37:SYNTAX_NO_LESS_THAN_IN_ATTR_VAL',
1784     },
1785    
1786     {
1787      t => q{<![INCLUDE[<!---->]]>},
1788      method => 'parse_marked_section',
1789      option => {
1790        ExpandedURI q<allow-section> => {INCLUDE => 1,},
1791      },
1792      result => 1,
1793     },
1794     {
1795      t => q{<![  INCLUDE  [<!---->]]>},
1796      method => 'parse_marked_section',
1797      option => {
1798        ExpandedURI q<allow-section> => {INCLUDE => 1,},
1799        ExpandedURI q<allow-section-ps> => 1,
1800      },
1801      result => 1,
1802     },
1803     {
1804      t => q{<![  INCLUDE  [<!---->]>},
1805      method => 'parse_marked_section',
1806      option => {
1807        ExpandedURI q<allow-section> => {INCLUDE => 1,},
1808        ExpandedURI q<allow-section-ps> => 1,
1809      },
1810      result => '0:24:SYNTAX_MSE_REQUIRED',
1811     },
1812     {
1813      t => q{<![  INCLUDE  <!---->]>},
1814      method => 'parse_marked_section',
1815      option => {
1816        ExpandedURI q<allow-section> => {INCLUDE => 1,},
1817        ExpandedURI q<allow-section-ps> => 1,
1818      },
1819      result => '0:14:SYNTAX_MSO_REQUIRED',
1820     },
1821     {
1822      t => q{<![  INCLUDE  IGNORE[<!---->]]>},
1823      method => 'parse_marked_section',
1824      option => {
1825        ExpandedURI q<allow-section> => {INCLUDE => 1, IGNORE => 1},
1826        ExpandedURI q<allow-section-ps> => 1,
1827      },
1828      result => '0:14:SYNTAX_MARKED_SECTION_KEYWORDS',
1829     },
1830     {
1831      t => q{<![RCDATA[<!---->]]>},
1832      method => 'parse_marked_section',
1833      option => {
1834        ExpandedURI q<allow-section> => {INCLUDE => 1, IGNORE => 1},
1835        ExpandedURI q<allow-section-ps> => 1,
1836      },
1837      result => '0:3:SYNTAX_MARKED_SECTION_KEYWORD',
1838     },
1839     {
1840      t => q{<![DATA[<!---->]]>},
1841      method => 'parse_marked_section',
1842      option => {
1843        ExpandedURI q<allow-section> => {INCLUDE => 1, IGNORE => 1},
1844        ExpandedURI q<allow-section-ps> => 1,
1845      },
1846      result => '0:3:SYNTAX_MARKED_SECTION_KEYWORD',
1847     },
1848     {
1849      t => q{<![IGNORE[<!---->]]>},
1850      method => 'parse_marked_section',
1851      option => {
1852        ExpandedURI q<allow-section> => {INCLUDE => 1, IGNORE => 1},
1853        ExpandedURI q<allow-section-ps> => 1,
1854      },
1855      result => 1,
1856     },
1857     {
1858      t => q{<![IGNORE[<!---->},
1859      method => 'parse_marked_section',
1860      option => {
1861        ExpandedURI q<allow-section> => {INCLUDE => 1, IGNORE => 1},
1862        ExpandedURI q<allow-section-ps> => 1,
1863      },
1864      result => '0:17:SYNTAX_MSE_REQUIRED',
1865     },
1866     {
1867      t => q{<![IGNORE[<!----><![IGNORE[ ]]>...]]>},
1868      method => 'parse_marked_section',
1869      option => {
1870        ExpandedURI q<allow-section> => {INCLUDE => 1, IGNORE => 1},
1871        ExpandedURI q<allow-section-ps> => 1,
1872      },
1873      result => 1,
1874     },
1875     {
1876      t => q{<![IGNORE[<!----><![IGNORE[ <e><![CDATA[a&b ]]></e> ]]>...]]>},
1877      method => 'parse_marked_section',
1878      option => {
1879        ExpandedURI q<allow-section> => {INCLUDE => 1, IGNORE => 1},
1880        ExpandedURI q<allow-section-ps> => 1,
1881      },
1882      result => 1,
1883     },
1884     {
1885      t => q{<![IGNORE[<!----><![IGNORE[ <e><![CDATA[a&b ]]></e> ]>...]]>},
1886      method => 'parse_marked_section',
1887      option => {
1888        ExpandedURI q<allow-section> => {INCLUDE => 1, IGNORE => 1},
1889        ExpandedURI q<allow-section-ps> => 1,
1890      },
1891      result => '0:60:SYNTAX_MSE_REQUIRED',
1892     },
1893     {
1894      t => q{<![IGNORE[<!----><![ <e]]>.]]>},
1895      method => 'parse_marked_section',
1896      option => {
1897        ExpandedURI q<allow-section> => {INCLUDE => 1, IGNORE => 1},
1898        ExpandedURI q<allow-section-ps> => 1,
1899      },
1900      result => 1,
1901     },
1902     {
1903      t => q{<![  [<!----><![ <e]]>.]]>},
1904      method => 'parse_marked_section',
1905      option => {
1906        ExpandedURI q<allow-section> => {INCLUDE => 1, IGNORE => 1},
1907        ExpandedURI q<allow-section-ps> => 1,
1908      },
1909      result => '0:5:SYNTAX_MARKED_SECTION_KEYWORD_REQUIRED',
1910     },
1911     {
1912      t => q{<![[<!----><![ <e]]>.]]>},
1913      method => 'parse_marked_section',
1914      option => {
1915        ExpandedURI q<allow-section> => {INCLUDE => 1, IGNORE => 1},
1916        ExpandedURI q<allow-section-ps> => 1,
1917      },
1918      result => '0:3:SYNTAX_MARKED_SECTION_KEYWORD_REQUIRED',
1919     },
1920     {
1921      entity => {kwd => ' INCLUDE '},
1922      t => q{<![%kwd; [ <!-- --> ]]>},
1923      method => 'parse_marked_section',
1924      option => {
1925        ExpandedURI q<allow-section> => {INCLUDE => 1, IGNORE => 1},
1926        ExpandedURI q<allow-section-ps> => 1,
1927        ExpandedURI q<allow-param-entref> => 1,
1928      },
1929      result => 1,
1930     },
1931     {
1932      entity => {kwd => ' INCLUDE ', kwd2 => '%kwd3;', kwd3 => ''},
1933      t => q{<![%kwd; %kwd2; [ <!-- --> ]]>},
1934      method => 'parse_marked_section',
1935      option => {
1936        ExpandedURI q<allow-section> => {INCLUDE => 1, IGNORE => 1},
1937        ExpandedURI q<allow-section-ps> => 1,
1938        ExpandedURI q<allow-param-entref> => 1,
1939      },
1940      result => 1,
1941     },
1942     {
1943      entity => {kwd => ' INCLUDE ', kwd2 => ' -- comment --'},
1944      t => q{<![%kwd; %kwd2; [ <!-- --> ]]>},
1945      method => 'parse_marked_section',
1946      option => {
1947        ExpandedURI q<allow-section> => {INCLUDE => 1, IGNORE => 1},
1948        ExpandedURI q<allow-section-ps> => 1,
1949        ExpandedURI q<allow-param-entref> => 1,
1950      },
1951      result => '0:1:SYNTAX_PS_COMMENT',
1952     },
1953     {
1954      t => q{<![INCLUDE[ <!-- -- ]]>},
1955      method => 'parse_marked_section',
1956      option => {
1957        ExpandedURI q<allow-section> => {INCLUDE => 1, IGNORE => 1},
1958        ExpandedURI q<allow-section-ps> => 1,
1959        ExpandedURI q<section-content-parser> => 'parse_doctype_subset',
1960      },
1961      result => '0:19:SYNTAX_S_IN_COMMENT_DECLARATION',
1962     },
1963    
1964     {
1965      t => q{<![CDATA[ <!-- -- ]]>},
1966      method => 'parse_marked_section',
1967      option => {
1968        ExpandedURI q<allow-section> => {CDATA => 1},
1969      },
1970      result => 1,
1971     },
1972     {
1973      t => q{<![CDATA [ <!-- -- ]]>},
1974      method => 'parse_marked_section',
1975      option => {
1976        ExpandedURI q<allow-section> => {CDATA => 1},
1977      },
1978      result => '0:8:SYNTAX_MARKED_SECTION_STATUS_PS',
1979     },
1980     {
1981      t => q{<![ CDATA[ <!-- -- ]]>},
1982      method => 'parse_marked_section',
1983      option => {
1984        ExpandedURI q<allow-section> => {CDATA => 1},
1985      },
1986      result => '0:3:SYNTAX_MARKED_SECTION_STATUS_PS',
1987     },
1988     {
1989      t => q{<![CDATA[ <!-- ]]-]>- ]]>},
1990      method => 'parse_marked_section',
1991      option => {
1992        ExpandedURI q<allow-section> => {CDATA => 1},
1993      },
1994      result => 1,
1995     },
1996     {
1997      entity => {kwd => 'CDATA'},
1998      t => q{<![%kwd;[ <!-- ]]-]>- ]]>},
1999      method => 'parse_marked_section',
2000      option => {
2001        ExpandedURI q<allow-section> => {CDATA => 1},
2002        ExpandedURI q<allow-param-entref> => 1,
2003      },
2004      result => '0:3:SYNTAX_MARKED_SECTION_STATUS_PS',
2005     },
2006    
2007     {
2008      t => q{<!----> <!ENTITY e "entity text">
2009             <!ELEMENT el ANY> <!ATTLIST el foo CDATA "bar">
2010             <?pi ?> <![ INCLUDE
2011             [ <!ATTLIST el bar ID #IMPLIED> ]]>
2012            <!NOTATION n SYSTEM "not">},
2013      method => 'parse_doctype_subset',
2014      option => {
2015        ExpandedURI q<allow-section> => {INCLUDE => 1},
2016        ExpandedURI q<allow-param-entref> => 1,
2017      },
2018      result => 1,
2019     },
2020     {
2021      t => q{<!----> <!ENTITY e "entity text">
2022             <!DOCTYPE doc []>},
2023      method => 'parse_doctype_subset',
2024      option => {
2025        ExpandedURI q<allow-section> => {CDATA => 1},
2026      },
2027      result => '1:9:SYNTAX_MARKUP_DECLARATION_NOT_ALLOWED',
2028     },
2029     {
2030      t => q{<!----> <!ENTITY e "entity text"> ]>},
2031      method => 'parse_doctype_subset',
2032      option => {
2033        ExpandedURI q<allow-section> => {CDATA => 1},
2034      },
2035      result => '0:34:SYNTAX_DOCTYPE_SUBSET_INVALID_CHAR',
2036     },
2037    
2038     {
2039      t => q{<!DOCTYPE d [<!----> <!ENTITY e "entity text"> ]>},
2040      method => 'parse_doctype_declaration',
2041      result => 1,
2042     },
2043     {
2044      t => q{<!DOCTYPE d [<!----> <![INCLUDE[<!ENTITY e "entity text">]]> ]>},
2045      method => 'parse_doctype_declaration',
2046      result => '0:21:SYNTAX_MARKED_SECTION_NOT_ALLOWED',
2047     },
2048     {
2049      entity => {d => {replace => q<  <![INCLUDE[<!ENTITY e "entity text">]]>>,
2050                       external => 0}},
2051      t => q{<!DOCTYPE d [<!----> %d; <!-- --> ]>},
2052      method => 'parse_doctype_declaration',
2053      result => '0:2:SYNTAX_MARKED_SECTION_NOT_ALLOWED',
2054     },
2055     {
2056      entity => {d => {replace => q{  <![INCLUDE[<!ENTITY e "entity text">]]>},
2057                       external => 1}},
2058      t => q{<!DOCTYPE d [<!----> %d; <!-- --> ]>},
2059      method => 'parse_doctype_declaration',
2060      result => 1,
2061     },
2062     {
2063      entity => {d => {replace
2064                         => q{<![INCLUDE[<!ENTITY e -- SYSTEM -- "entity text">]]>},
2065                       external => 1}},
2066      t => q{<!DOCTYPE d [<!----> %d; ]>},
2067      method => 'parse_doctype_declaration',
2068      result => '0:22:SYNTAX_PS_COMMENT',
2069     },
2070    
2071             {
2072              t => q{<?xml?>},
2073              method => 'parse_processing_instruction',
2074              result => q(0:0:SYNTAX_XML_DECLARATION_IN_MIDDLE),
2075             },
2076             {
2077              t => q{<?XML?>},
2078              method => 'parse_processing_instruction',
2079              result => q(0:2:SYNTAX_PI_TARGET_XML),
2080             },
2081             {
2082              t => q{<?XmL?>},
2083              method => 'parse_processing_instruction',
2084              result => q(0:2:SYNTAX_PI_TARGET_XML),
2085             },
2086             {
2087              t => q{<?XmL1?>},
2088              method => 'parse_processing_instruction',
2089              result => 1,
2090             },
2091    
2092             {
2093              t => q{<?xml?>},
2094              method => 'parse_xml_declaration',
2095              option => {ExpandedURI q<allow-xml-declaration> => 1},
2096              result => q(0:5:SYNTAX_XML_VERSION_REQUIRED),
2097             },
2098             {
2099              t => q{<?xml ?>},
2100              method => 'parse_xml_declaration',
2101              option => {ExpandedURI q<allow-xml-declaration> => 1},
2102              result => q(0:6:SYNTAX_XML_VERSION_REQUIRED),
2103             },
2104             {
2105              t => q{<?xml ?>},
2106              method => 'parse_xml_declaration',
2107              option => {ExpandedURI q<allow-text-declaration> => 1},
2108              result => q(0:6:SYNTAX_XML_ENCODING_REQUIRED),
2109             },
2110             {
2111              t => q{<?xml ?>},
2112              method => 'parse_xml_declaration',
2113              option => {ExpandedURI q<allow-xml-declaration> => 1,
2114                         ExpandedURI q<allow-text-declaration> => 1},
2115              result => q(0:6:SYNTAX_XML_ENCODING_REQUIRED),
2116             },
2117     {
2118      t => q{<?xml version="1.0"?>},
2119      method => 'parse_xml_declaration',
2120      option => {ExpandedURI q<allow-xml-declaration> => 1},
2121      result => 1,
2122     },
2123     {
2124      t => q{<?xml version="1.0" ?>},
2125      method => 'parse_xml_declaration',
2126      option => {ExpandedURI q<allow-xml-declaration> => 1},
2127      result => 1,
2128     },
2129     {
2130      t => qq{<?xml \tversion  =  "1.0"?>},
2131      method => 'parse_xml_declaration',
2132      option => {ExpandedURI q<allow-xml-declaration> => 1},
2133      result => 1,
2134     },
2135     {
2136      t => q{<?xml version='1.0' ?>},
2137      method => 'parse_xml_declaration',
2138      option => {ExpandedURI q<allow-xml-declaration> => 1},
2139      result => 1,
2140     },
2141     {
2142      t => q{<?xml version="1.0"encoding="iso-2022-jp"?>},
2143      method => 'parse_xml_declaration',
2144      option => {ExpandedURI q<allow-xml-declaration> => 1},
2145      result => q(0:19:SYNTAX_S_REQUIRED_BETWEEN_ATTR_SPEC),
2146     },
2147     {
2148      t => q{<?xml version="1.0?>},
2149      method => 'parse_xml_declaration',
2150      option => {ExpandedURI q<allow-xml-declaration> => 1},
2151      result => q(0:18:SYNTAX_ALITC_REQUIRED),
2152     },
2153             {
2154              t => q{<?xml version=1.0?>},
2155              method => 'parse_xml_declaration',
2156              option => {ExpandedURI q<allow-xml-declaration> => 1},
2157              result => q(0:14:SYNTAX_ALITO_OR_ALITAO_REQUIRED),
2158             },
2159             {
2160              t => q{<?xml version="1.1"?>},
2161              method => 'parse_xml_declaration',
2162              option => {ExpandedURI q<allow-xml-declaration> => 1},
2163              result => 1,
2164             },
2165             {
2166              t => q{<?xml version="1.2"?>},
2167              method => 'parse_xml_declaration',
2168              option => {ExpandedURI q<allow-xml-declaration> => 1},
2169              result => q(0:15:SYNTAX_XML_VERSION_UNSUPPORTED),
2170             },
2171             {
2172              t => q{<?xml version="1+2"?>},
2173              method => 'parse_xml_declaration',
2174              option => {ExpandedURI q<allow-xml-declaration> => 1},
2175              result => q(0:15:SYNTAX_XML_VERSION_INVALID),
2176             },
2177             {
2178              t => q{<?xml version=""?>},
2179              method => 'parse_xml_declaration',
2180              option => {ExpandedURI q<allow-xml-declaration> => 1},
2181              result => q(0:15:SYNTAX_XML_VERSION_INVALID),
2182             },
2183            
2184             {
2185              t => q{<?xml encoding=""?>},
2186              method => 'parse_xml_declaration',
2187              option => {ExpandedURI q<allow-text-declaration> => 1},
2188              result => q(0:16:SYNTAX_XML_ENCODING_INVALID),
2189             },
2190             {
2191              t => q{<?xml  encoding = 'iso-2022-jp'?>},
2192              method => 'parse_xml_declaration',
2193              option => {ExpandedURI q<allow-text-declaration> => 1},
2194              result => 1,
2195             },
2196             {
2197              t => q{<?xml  encoding = 'iso-2022-jp'?>},
2198              method => 'parse_xml_declaration',
2199              option => {ExpandedURI q<allow-xml-declaration> => 1},
2200              result => q(0:7:SYNTAX_XML_VERSION_REQUIRED),
2201             },
2202             {
2203              t => q{<?xml  encoding = 'iso+2022+jp'?>},
2204              method => 'parse_xml_declaration',
2205              option => {ExpandedURI q<allow-text-declaration> => 1},
2206              result => q(0:19:SYNTAX_XML_ENCODING_INVALID),
2207             },
2208             {
2209              t => q{<?xml encoding = ""?>},
2210              method => 'parse_xml_declaration',
2211              option => {ExpandedURI q<allow-text-declaration> => 1},
2212              result => q(0:18:SYNTAX_XML_ENCODING_INVALID),
2213             },
2214             {
2215              t => q{<?xml  encoding = 'iso-2022-jp' version="1.0"?>},
2216              method => 'parse_xml_declaration',
2217              option => {ExpandedURI q<allow-xml-declaration> => 1},
2218              result => q(0:7:SYNTAX_XML_VERSION_REQUIRED),
2219             },
2220             {
2221              t => q{<?xml version="1.0" encoding = 'iso-2022-jp'?>},
2222              method => 'parse_xml_declaration',
2223              option => {ExpandedURI q<allow-xml-declaration> => 1},
2224              result => 1,
2225             },
2226             {
2227              t => q{<?xml version="1.0" encoding = 'iso-2022-jp'?>},
2228              method => 'parse_xml_declaration',
2229              option => {ExpandedURI q<allow-text-declaration> => 1},
2230              result => 1,
2231             },
2232             {
2233              t => q{<?xml version="1.0" encoding = 'iso-2022-jp'?>},
2234              method => 'parse_xml_declaration',
2235              option => {ExpandedURI q<allow-xml-declaration> => 1,
2236                         ExpandedURI q<allow-text-declaration> => 1},
2237              result => 1,
2238             },
2239            
2240             {
2241              t => q{<?xml version="1.0" encoding = 'UTF-8' standalone="yes" ?>},
2242              method => 'parse_xml_declaration',
2243              option => {ExpandedURI q<allow-xml-declaration> => 1,
2244                         ExpandedURI q<allow-text-declaration> => 1},
2245              result => 1,
2246             },
2247             {
2248              t => q{<?xml version="1.0" encoding = 'UTF-8' standalone="no" ?>},
2249              method => 'parse_xml_declaration',
2250              option => {ExpandedURI q<allow-xml-declaration> => 1,
2251                         ExpandedURI q<allow-text-declaration> => 1},
2252              result => 1,
2253             },
2254             {
2255              t => q{<?xml version="1.0" encoding = 'UTF-8' standalone="no" ?>},
2256              method => 'parse_xml_declaration',
2257              option => {ExpandedURI q<allow-text-declaration> => 1},
2258              result => q(0:39:SYNTAX_XML_STANDALONE),
2259             },
2260             {
2261              t => q{<?xml version="1.0" encoding = 'UTF-8' standalone="unknown" ?>},
2262              method => 'parse_xml_declaration',
2263              option => {ExpandedURI q<allow-xml-declaration> => 1},
2264              result => q(0:51:SYNTAX_XML_STANDALONE_INVALID),
2265             },
2266             {
2267              t => qq{<?xml version="1.1" encoding = 'UTF-8' \tstandalone="no" ?>},
2268              method => 'parse_xml_declaration',
2269              option => {ExpandedURI q<allow-xml-declaration> => 1},
2270              result => q(0:38:SYNTAX_XML_STANDALONE_S),
2271             },
2272             {
2273              t => qq{<?xml standalone = "yes" ?>},
2274              method => 'parse_xml_declaration',
2275              option => {ExpandedURI q<allow-xml-declaration> => 1},
2276              result => q(0:6:SYNTAX_XML_VERSION_REQUIRED),
2277             },
2278             {
2279              t => qq{<?xml standalone = "yes" ?>},
2280              method => 'parse_xml_declaration',
2281              option => {ExpandedURI q<allow-text-declaration> => 1},
2282              result => q(0:6:SYNTAX_XML_ENCODING_REQUIRED),
2283             },
2284             {
2285              t => qq{<?xml encoding="iso-2022-jp" standalone = "yes" ?>},
2286              method => 'parse_xml_declaration',
2287              option => {ExpandedURI q<allow-text-declaration> => 1},
2288              result => q(0:29:SYNTAX_XML_STANDALONE),
2289             },
2290             {
2291              t => qq{<?xml version="1.1" encode="iso-2022-jp" ?>},
2292              method => 'parse_xml_declaration',
2293              option => {ExpandedURI q<allow-xml-declaration> => 1},
2294              result => q(0:20:SYNTAX_XML_UNKNOWN_ATTR),
2295             },
2296             {
2297              t => q{<?xml <#version="1.&#x31;" ?>},
2298              method => 'parse_xml_declaration',
2299              option => {ExpandedURI q<allow-xml-declaration> => 1},
2300              result => q(0:6:SYNTAX_ATTR_SPEC_REQUIRED),
2301             },
2302             {
2303              t => qq{<?xml version="&version;" ?>},
2304              method => 'parse_xml_declaration',
2305              option => {ExpandedURI q<allow-xml-declaration> => 1},
2306              result => q(0:15:SYNTAX_XML_VERSION_INVALID),
2307             },
2308             {
2309              t => q{<?xml version="  1.&#x31;" ?>},
2310              method => 'parse_xml_declaration',
2311              option => {ExpandedURI q<allow-xml-declaration> => 1},
2312              result => q(0:15:SYNTAX_XML_VERSION_INVALID),
2313             },
2314             {
2315              t => qq{<?xml version="-&#31;-" ?>},
2316              method => 'parse_xml_declaration',
2317              option => {ExpandedURI q<allow-xml-declaration> => 1},
2318              result => q(0:15:SYNTAX_XML_VERSION_INVALID),
2319             },
2320    
2321     {
2322      t => q{<el>data</el>},
2323      method => 'parse_document_entity',
2324      result => 1,
2325     },
2326     {
2327      t => q{
2328    
2329    <el>data</el>
2330    
2331    },
2332      method => 'parse_document_entity',
2333      result => 1,
2334     },
2335     {
2336      t => q{<?xml version="1.0"?>
2337    
2338    <el>data</el>
2339    
2340    },
2341      method => 'parse_document_entity',
2342      result => 1,
2343     },
2344     {
2345      t => q{<?xml version="1.0"?>
2346    
2347    <el>data</el>
2348    <!--
2349    comment -->
2350    },
2351      method => 'parse_document_entity',
2352      result => 1,
2353     },
2354     {
2355      t => q{<?xml-stylesheet href="1.0"?>
2356    
2357    <el>data</el>
2358    <!--
2359    comment -->
2360    },
2361      method => 'parse_document_entity',
2362      result => 1,
2363     },
2364     {
2365      t => q{<!DOCTYPE el []>
2366    <el>data</el>
2367    <!--
2368    comment -->
2369    },
2370      method => 'parse_document_entity',
2371      result => 1,
2372     },
2373     {
2374      t => q{<el>a</el>
2375    <el>data</el>
2376    <!--
2377    comment -->
2378    },
2379      method => 'parse_document_entity',
2380      result => '1:0:SYNTAX_MULTIPLE_DOCUMENT_ELEMENTS',
2381     },
2382     {
2383      t => q{a<el>a</el>},
2384      method => 'parse_document_entity',
2385      result => '0:0:SYNTAX_CDATA_OUTSIDE_DOCUMENT_ELEMENT',
2386     },
2387     {
2388      t => q{<el>a</el>
2389      b},
2390      method => 'parse_document_entity',
2391      result => '1:2:SYNTAX_CDATA_OUTSIDE_DOCUMENT_ELEMENT',
2392     },
2393     {
2394      t => q{<el>a</el>
2395      <?xml version="1.0"?>},
2396      method => 'parse_document_entity',
2397      result => '1:2:SYNTAX_XML_DECLARATION_IN_MIDDLE',
2398     },
2399     {
2400      t => q{
2401      <?xml version="1.0"?> <el/>},
2402      method => 'parse_document_entity',
2403      result => '1:2:SYNTAX_XML_DECLARATION_IN_MIDDLE',
2404     },
2405     {
2406      t => q{<!DOCTYPE el []>
2407      <?xml version="1.0"?> <el/>},
2408      method => 'parse_document_entity',
2409      result => '1:2:SYNTAX_XML_DECLARATION_IN_MIDDLE',
2410     },
2411     {
2412      t => q{<el/><!DOCTYPE el []>},
2413      method => 'parse_document_entity',
2414      result => '0:5:SYNTAX_MARKUP_DECLARATION_NOT_ALLOWED',
2415     },
2416     {
2417      t => q{<el/><![IGNORE[]]>},
2418      method => 'parse_document_entity',
2419      result => '0:5:SYNTAX_MARKED_SECTION_NOT_ALLOWED',
2420     },
2421     {
2422      t => q{<el/>< },
2423      method => 'parse_document_entity',
2424      result => '0:5:SYNTAX_CDATA_OUTSIDE_DOCUMENT_ELEMENT',
2425     },
2426     {
2427      t => q{<!-- -->},
2428      method => 'parse_document_entity',
2429      result => '0:8:SYNTAX_NO_DOCUMENT_ELEMENT',
2430     },
2431     {
2432      t => q{<el><!-- -->},
2433      method => 'parse_document_entity',
2434      result => '0:12:SYNTAX_END_TAG_REQUIRED',
2435     },
2436     {
2437      t => q{<?xml?><el><!-- --></el>},
2438      method => 'parse_document_entity',
2439      result => '0:5:SYNTAX_XML_VERSION_REQUIRED',
2440     },
2441    );
2442    
2443    plan tests => scalar @a;
2444    
2445    my $first_error;
2446    my $first_error_detail;
2447    my $parser = new test_parser;
2448    $parser->{error}->{option}->{report} = sub {
2449      my $err = shift;
2450      $err->{-object}->set_position ($err->{source}, diff => $err->{position_diff});
2451      unless ($first_error) {
2452        $first_error = join ':', $err->{-object}->get_position ($err->{source}),
2453                              $err->{-type};
2454        $first_error_detail = $err->stringify;
2455      }
2456    };
2457    for (@a) {
2458      $first_error = '';
2459      $first_error_detail = '';
2460      my $method = $_->{method};
2461      pos ($_->{t}) = 0;
2462      $parser->{ExpandedURI q<test:entity>} = $_->{entity} || {};
2463      $parser->$method (
2464        \$_->{t}, {},
2465        %{$_->{option}||{ExpandedURI q<allow-declaration>=>{qw/DOCTYPE 1 ENTITY 1 ELEMENT 1 NOTATION 1 ATTLIST 1 comment 1 section 1/},
2466                         ExpandedURI q<allow-param-entref> => 1,
2467                         ExpandedURI q<use-reference> => 1}},
2468      );
2469      ok $first_error || 1, $_->{result}, $first_error_detail;
2470    }
2471    
2472    package test_parser;
2473    BEGIN {
2474      push our @ISA, 'Message::Markup::XML::Parser::Base';
2475      use Message::Util::QName::General [qw/ExpandedURI/], $main::NS;
2476    }
2477    
2478    sub parameter_entity_reference_in_parameter_start ($$$$%) {
2479      my ($self, $src, $p, $pp, %opt) = @_;
2480      for my $reptxt ($self->{ExpandedURI q<test:entity>}
2481                           ->{$pp->{ExpandedURI q<entity-name>}}) {
2482        push @{$opt{ExpandedURI q<source>}}, \$reptxt if $reptxt;
2483      }
2484    }
2485    
2486    sub parameter_entity_reference_in_subset_start ($$$$%) {
2487      my ($self, $src, $p, $pp, %opt) = @_;
2488      for my $reptxt ($self->{ExpandedURI q<test:entity>}
2489                           ->{$pp->{ExpandedURI q<entity-name>}}) {
2490        if (ref $reptxt eq 'HASH') {
2491          pos $reptxt->{replace} = 0;
2492          push @{$opt{ExpandedURI q<source>}}, \($reptxt->{replace});
2493          $self->{error}->set_flag
2494            ((\$reptxt->{replace}),
2495             ExpandedURI q<is-external-entity> => $reptxt->{external});
2496        } else {
2497          pos $reptxt = 0;
2498          push @{$opt{ExpandedURI q<source>}}, \$reptxt if $reptxt;
2499        }
2500      }
2501    }
2502    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.2.6

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24  
Google Analytics is used in this page; Cookies are used. 忍者AdMax is used in this page; Cookies are used. Privacy policy.