/[suikacvs]/messaging/manakai/lib/Message/Markup/SuikaWiki.dis
Suika

Contents of /messaging/manakai/lib/Message/Markup/SuikaWiki.dis

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Thu May 4 13:07:19 2006 UTC (18 years, 6 months ago) by wakaba
Branch: MAIN
++ manakai/t/ChangeLog	4 May 2006 13:07:15 -0000
2006-05-04  Wakaba  <wakaba@suika.fam.cx>

	* Makefile (markup-SuikaWiki.t): New test.

++ manakai/lib/Message/Markup/ChangeLog	4 May 2006 12:56:56 -0000
2006-05-04  Wakaba  <wakaba@suika.fam.cx>

	* SuikaWiki.dis: New module.

	* Makefile: The |SuikaWiki| module is added.

++ manakai/lib/Message/Util/DIS/ChangeLog	4 May 2006 13:06:42 -0000
2006-05-04  Wakaba  <wakaba@suika.fam.cx>

	* DPG.dis: The |nextLexmode| syntax is added.
	(encode_state_name): Use hash value to avoid too long
	label names.

++ manakai/lib/Message/DOM/ChangeLog	4 May 2006 13:05:36 -0000
2006-05-04  Wakaba  <wakaba@suika.fam.cx>

	* SimpleLS.dis: Namespace bugs are fixed.

1 wakaba 1.1 Module:
2     @QName: Markup|SuikaWiki
3     @enFN:
4     SuikaWiki/0.9 and SuikaWiki/0.10 Document Markup Language DOM
5     @enDesc:
6     {TODO::
7    
8     }
9    
10     @Namespace:
11     http://suika.fam.cx/~wakaba/archive/2005/manakai/Markup/SuikaWiki/
12    
13     @DISCore:author: DISCore|Wakaba
14     @License: license|Perl+MPL
15     @Date:
16     $Date: 2006/04/29 11:05:09 $
17    
18     @Require:
19     @@Module:
20     @@@QName: Markup|common
21     @@Module:
22     @@@QName: MDOM|TreeCore
23     @@@WithFor: ManakaiDOM|ManakaiDOMLatest
24     @@Module:
25     @@@WithFor: ManakaiDOM|ManakaiDOM
26     @@Module:
27     @@@WithFor: ManakaiDOM|ManakaiDOMLatest
28     @@Module:
29     @@@QName: Markup|Atom
30     @@@WithFor: ManakaiDOM|ManakaiDOMLatest
31     @DefaultFor: ManakaiDOM|ManakaiDOMLatest
32    
33     Namespace:
34     @aa:
35     http://pc5.2ch.net/test/read.cgi/hp/1096723178/aavocab#
36     @c:
37     http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#
38     @cfg:
39     http://suika.fam.cx/www/2006/dom-config/
40     @dis:
41     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#dis--
42     @doc:
43     http://suika.fam.cx/~wakaba/archive/2005/7/tutorial#
44     @d:
45     http://suika.fam.cx/~wakaba/archive/2004/dom/xdt#
46     @DOMMain:
47     http://suika.fam.cx/~wakaba/archive/2004/dom/main#
48     @dx:
49     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/DOMException#
50     @ecore:
51     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/Error/Core/
52     @f:
53     http://suika.fam.cx/~wakaba/archive/2004/dom/feature#
54     @fe:
55     http://suika.fam.cx/www/2006/feature/
56     @gls:
57     http://suika.fam.cx/~wakaba/archive/2004/dom/gls#
58     @html:
59     http://www.w3.org/1999/xhtml
60     @idl:
61     http://suika.fam.cx/~wakaba/archive/2004/dis/IDL#
62     @kwd:
63     http://suika.fam.cx/~wakaba/archive/2005/rfc2119/
64     @lang:
65     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#
66     @license:
67     http://suika.fam.cx/~wakaba/archive/2004/8/18/license#
68     @ManakaiDOM:
69     http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#
70     @mat:
71     http://suika.fam.cx/~wakaba/archive/2005/manakai/Markup/Atom/
72     @Markup:
73     http://suika.fam.cx/~wakaba/archive/2005/manakai/Markup#
74     @mat:
75     http://suika.fam.cx/~wakaba/archive/2005/manakai/Markup/Atom/
76     @MDOM:
77     http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#ManakaiDOM.
78     @MDOMX:
79     http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#
80     @dlp:
81     http://suika.fam.cx/~wakaba/archive/2004/dis/Perl#
82     @html3:
83     urn:x-suika-fam-cx:markup:ietf:html:3:draft:00:
84     @html5:
85     http://www.w3.org/1999/xhtml
86     @rel:
87     http://www.iana.org/assignments/relation/
88     @s:
89     http://suika.fam.cx/~wakaba/archive/2004/dis/Markup#
90     @sw09:
91     urn:x-suika-fam-cx:markup:suikawiki:0:9:
92     @sw010:
93     urn:x-suika-fam-cx:markup:suikawiki:0:10:
94     @tc:
95     http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/
96     @td:
97     http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/Document/
98     @te:
99     http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/Element/
100     @test:
101     http://suika.fam.cx/~wakaba/archive/2004/dis/Test#
102     @tx:
103     http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/XML/
104     @urigen:
105     http://suika.fam.cx/~wakaba/archive/2005/manakai/URI/Generic/
106     @xhtml2:
107     http://www.w3.org/2002/06/xhtml2/
108     @xml:
109     http://www.w3.org/XML/1998/namespace
110     @xmlns:
111     http://www.w3.org/2000/xmlns/
112    
113     ElementTypeBinding:
114     @Name: CODE
115     @ElementType:
116     dis:ResourceDef
117     @ShadowContent:
118     @@DISCore:resourceType: dlp|BlockCode
119     @@ForCheck: ManakaiDOM|ForClass
120    
121     ElementTypeBinding:
122     @Name: Method
123     @ElementType:
124     dis:ResourceDef
125     @ShadowContent:
126     @@DISCore:resourceType: DISLang|Method
127     @@ForCheck: !=ManakaiDOM|ManakaiDOM
128    
129     ElementTypeBinding:
130     @Name: Param
131     @ElementType:
132     dis:ResourceDef
133     @ShadowContent:
134     @@DISCore:resourceType: DISLang|MethodParameter
135    
136     ElementTypeBinding:
137     @Name: Return
138     @ElementType:
139     dis:ResourceDef
140     @ShadowContent:
141     @@DISCore:resourceType: DISLang|MethodReturn
142    
143     ElementTypeBinding:
144     @Name: Attr
145     @ElementType:
146     dis:ResourceDef
147     @ShadowContent:
148     @@DISCore:resourceType: DISLang|Attribute
149     @@ForCheck: !=ManakaiDOM|ManakaiDOM
150    
151     ElementTypeBinding:
152     @Name: Get
153     @ElementType:
154     dis:ResourceDef
155     @ShadowContent:
156     @@DISCore:resourceType: DISLang|AttributeGet
157    
158     ElementTypeBinding:
159     @Name: Set
160     @ElementType:
161     dis:ResourceDef
162     @ShadowContent:
163     @@DISCore:resourceType: DISLang|AttributeSet
164    
165     ElementTypeBinding:
166     @Name: nullCase
167     @ElementType:
168     dis:ResourceDef
169     @ShadowContent:
170     @@DISCore:resourceType: ManakaiDOM|InCase
171     @@Value:
172     @@@is-null:1
173    
174     ElementTypeBinding:
175     @Name: PerlDef
176     @ElementType:
177     dis:Def
178     @ShadowContent:
179     @@ContentType: lang|Perl
180     @@ForCheck: ManakaiDOM|ForClass
181    
182     ElementTypeBinding:
183     @Name: PerlCDef
184     @ElementType:
185     dis:Def
186     @ShadowContent:
187     @@ContentType: lang|Perl
188    
189     ElementTypeBinding:
190     @Name: enImplNote
191     @ElementType:
192     dis:ImplNote
193     @ShadowContent:
194     @@lang:en
195    
196     ElementTypeBinding:
197     @Name: enFN
198     @ElementType:
199     dis:FullName
200     @ShadowContent:
201     @@lang:en
202    
203     ElementTypeBinding:
204     @Name: IFClsETDef
205     @ElementType:
206     dis:ResourceDef
207     @ShadowContent:
208     @@DISCore:resourceType:
209     @@@@: dis|MultipleResource
210     @@@ForCheck: !ManakaiDOM|ForIF !ManakaiDOM|ForClass !s|ForML
211     @@resourceFor: ManakaiDOM|ForIF
212     @@resourceFor: ManakaiDOM|ForClass
213     @@resourceFor: s|ForML
214     @@For: ManakaiDOM|ManakaiDOM
215    
216     @@DISCore:resourceType:
217     @@@@: DISLang|Interface
218     @@@ForCheck: ManakaiDOM|ForIF
219    
220     @@DISCore:resourceType:
221     @@@@: DISLang|Class
222     @@@ForCheck: ManakaiDOM|ForClass
223     @@Implement:
224     @@@@: ||ManakaiDOM|ManakaiDOM||ManakaiDOM|ForIF
225     @@@ContentType: DISCore|TFPQNames
226     @@@ForCheck: ManakaiDOM|ForClass ManakaiDOM|ManakaiDOM
227     @@Implement:
228     @@@@: ||ManakaiDOM|ManakaiDOMLatest||ManakaiDOM|ForIF
229     @@@ContentType: DISCore|TFPQNames
230     @@@ForCheck: ManakaiDOM|ForClass ManakaiDOM|ManakaiDOMLatest
231    
232     @@s:elementType:
233     @@@@: ||+||s|ForML
234     @@@ContentType: DISCore|TFPQNames
235     @@@DISCore:stopISARecursive:1
236    
237     @@DISCore:resourceType:
238     @@@@: s|ElementType
239     @@@ForCheck: s|ForML
240    
241     @@f:implements: AtomFeature10
242    
243     ElementTypeBinding:
244     @Name: IFClsDef
245     @ElementType:
246     dis:ResourceDef
247     @ShadowContent:
248     @@DISCore:resourceType:
249     @@@@: dis|MultipleResource
250     @@@ForCheck: !ManakaiDOM|ForIF !ManakaiDOM|ForClass !s|ForML
251     @@resourceFor: ManakaiDOM|ForIF
252     @@resourceFor: ManakaiDOM|ForClass
253     @@For: ManakaiDOM|ManakaiDOM
254    
255     @@DISCore:resourceType:
256     @@@@: DISLang|Interface
257     @@@ForCheck: ManakaiDOM|ForIF
258    
259     @@DISCore:resourceType:
260     @@@@: DISLang|Class
261     @@@ForCheck: ManakaiDOM|ForClass
262     @@Implement:
263     @@@@: ||ManakaiDOM|ManakaiDOM||ManakaiDOM|ForIF
264     @@@ContentType: DISCore|TFPQNames
265     @@@ForCheck: ManakaiDOM|ForClass ManakaiDOM|ManakaiDOM
266     @@Implement:
267     @@@@: ||ManakaiDOM|ManakaiDOMLatest||ManakaiDOM|ForIF
268     @@@ContentType: DISCore|TFPQNames
269     @@@ForCheck: ManakaiDOM|ForClass ManakaiDOM|ManakaiDOMLatest
270    
271     @@f:implements: AtomFeature10
272    
273     ElementTypeBinding:
274     @Name: IFQName
275     @ElementType:
276     dis:QName
277     @ShadowContent:
278     @@ForCheck: ManakaiDOM|ForIF
279    
280     ElementTypeBinding:
281     @Name: ClsQName
282     @ElementType:
283     dis:QName
284     @ShadowContent:
285     @@ForCheck: ManakaiDOM|ForClass
286    
287     ElementTypeBinding:
288     @Name: ETRQName
289     @ElementType:
290     dis:QName
291     @ShadowContent:
292     @@ForCheck: s|ForML
293    
294     ElementTypeBinding:
295     @Name: ETQName
296     @ElementType:
297     dis:AppName
298     @ShadowContent:
299     @@ForCheck: s|ForML
300     @@ContentType: DISCore|QName
301    
302     ElementTypeBinding:
303     @Name: IFISA
304     @ElementType:
305     dis:ISA
306     @ShadowContent:
307     @@ForCheck: ManakaiDOM|ForIF
308    
309     ElementTypeBinding:
310     @Name: ClsISA
311     @ElementType:
312     dis:ISA
313     @ShadowContent:
314     @@ForCheck: ManakaiDOM|ForClass
315    
316     ElementTypeBinding:
317     @Name: disDef
318     @ElementType:
319     dis:Def
320     @ShadowContent:
321     @@ContentType:
322     lang:dis
323     @@ForCheck: ManakaiDOM|ForClass
324    
325     ElementTypeBinding:
326     @Name: Code
327     @ElementType:
328     dis:ResourceDef
329     @ShadowContent:
330     @@DISCore:resourceType: dlp|InlineCode
331     @@ForCheck: ManakaiDOM|ForClass
332    
333     ElementTypeBinding:
334     @Name: Test
335     @ElementType:
336     dis:ResourceDef
337     @ShadowContent:
338     @@DISCore:resourceType: test|StandaloneTest
339     @@ForCheck: ManakaiDOM|ForClass
340    
341     ElementTypeBinding:
342     @Name: TestC
343     @ElementType:
344     dis:ResourceDef
345     @ShadowContent:
346     @@DISCore:resourceType: test|StandaloneTest
347    
348     ResourceDef:
349     @QName: Document
350     @AliasFor: td|Document
351     @For: ManakaiDOM|DOM
352    
353     ResourceDef:
354     @QName: Element
355     @AliasFor: te|Element
356     @For: ManakaiDOM|DOM
357    
358     ResourceDef:
359     @QName: Attr
360     @AliasFor: te|Attr
361     @For: ManakaiDOM|DOM
362    
363     ResourceDef:
364     @QName: DOMString
365     @AliasFor: DOMMain|DOMString
366     @For: ManakaiDOM|DOM
367    
368     ResourceDef:
369     @QName: DOMURI
370     @AliasFor: ManakaiDOM|ManakaiDOMURI
371     @For: ManakaiDOM|DOM3
372    
373     ResourceDef:
374     @QName: DOMTimeStamp
375     @AliasFor: DOMMain|DOMTimeStamp
376     @For: ManakaiDOM|DOM2
377    
378     ResourceDef:
379     @QName: boolean
380     @AliasFor: idl|boolean||ManakaiDOM|all
381    
382     ResourceDef:
383     @QName: Node
384     @AliasFor: tc|Node
385     @For: ManakaiDOM|ManakaiDOM
386    
387     ResourceDef:
388     @QName: NodeList
389     @AliasFor: tc|NodeList
390     @For: ManakaiDOM|ManakaiDOM
391    
392     ResourceDef:
393     @QName: StaticNodeList
394     @AliasFor: tc|StaticNodeList
395     @For: ManakaiDOM|ManakaiDOM
396    
397     ElementTypeBinding:
398     @Name: enDesc
399     @ElementType:
400     dis:Description
401     @ShadowContent:
402     @@lang:en
403    
404     ElementTypeBinding:
405     @Name: TrueCase
406     @ElementType:
407     dis:ResourceDef
408     @ShadowContent:
409     @@DISCore:resourceType:
410     ManakaiDOM:InCase
411     @@Value:
412     @@@@: 1
413     @@@ContentType: DISCore|Boolean
414     @@Type: idl|boolean||ManakaiDOM|all
415    
416     ElementTypeBinding:
417     @Name: FalseCase
418     @ElementType:
419     dis:ResourceDef
420     @ShadowContent:
421     @@DISCore:resourceType:
422     ManakaiDOM:InCase
423     @@Value:
424     @@@@: 0
425     @@@ContentType: DISCore|Boolean
426     @@Type: idl|boolean||ManakaiDOM|all
427    
428     ## -- Features
429    
430     ElementTypeBinding:
431     @Name: FeatureDef
432     @ElementType:
433     dis:ResourceDef
434     @ShadowContent:
435     @@DISCore:resourceType: f|Feature
436     @@For: =ManakaiDOM|all
437    
438     ElementTypeBinding:
439     @Name: FeatureVerDef
440     @ElementType:
441     dis:ResourceDef
442     @ShadowContent:
443     @@DISCore:resourceType: f|Feature
444    
445     ElementTypeBinding:
446     @Name: featureQName
447     @ElementType:
448     f:name
449     @ShadowContent:
450     @@ContentType: DISCore|QName
451    
452     FeatureDef:
453     @featureQName: fe|SuikaWikiDML
454     @QName: SWDMLFeature
455     @FeatureVerDef:
456     @@QName: SWDMLFeature010
457     @@Version: 0.10
458     @@f:instanceOf: SWDMLFeature
459     @@f:requires: tx|XMLFeature30
460     @@enDesc:
461     The SuikaWiki Document Markup Language DOM, version 0.10.
462    
463     ## -- Implementation
464    
465     ## TODO:
466    
467     ## -- Elements
468    
469     IFClsDef:
470     @IFQName: SWDMLElement
471     @ClsQName: ManakaiSWDMLElement
472    
473     @IFISA: Element
474     @ClsISA: te|ManakaiDOMElement
475    
476     @s:elementType: AnySW09Element||ManakaiDOM|all
477     @s:elementType: AnySW010Element||ManakaiDOM|all
478     ##SWDMLElement
479    
480     ResourceDef:
481     @QName: AnySW09Element
482     @DISCore:resourceType: s|AnyElementInNS
483     @AppName:
484     @@@: sw09|*
485     @@ContentType: DISCore|QName
486     @ForCheck: =ManakaiDOM|all
487    
488     ResourceDef:
489     @QName: AnySW010Element
490     @DISCore:resourceType: s|AnyElementInNS
491     @AppName:
492     @@@: sw010|*
493     @@ContentType: DISCore|QName
494     @ForCheck: =ManakaiDOM|all
495    
496     IFClsETDef:
497     @IFQName: SWDMLDocumentElement
498     @ETQName: sw09|document
499     @ClsQName: ManakaiSWDMLDocumentElement
500    
501     @IFISA: SWDMLElement
502     @ClsISA: ManakaiSWDMLElement
503    
504     @Attr:
505     @@Name: headElement
506     @@enDesc:
507     The <XE::xhtml2|head> child element of the node.
508     @@Type: SWDMLElement
509     @@Get:
510     @@@enDesc:
511     It <kwd:MUST> <I::return a <XE::xhtml2|head> child element>
512     of the node.
513     @@@nullCase:
514     @@@@enDesc:
515     If the algorithm returns <DOM::null>.
516     @@@NodeReadOnlyError:
517     @@@PerlDef:
518     __CODE{mat|returnChildElement::
519     $node => $self,
520     $namespaceURI => {<Q::xhtml2|>},
521     $localName => 'head',
522     $r => $r,
523     }__;
524    
525     @Attr:
526     @@Name: bodyElement
527     @@enDesc:
528     The <XE::xhtml2|body> child element of the node.
529     @@Type: SWDMLElement
530     @@Get:
531     @@@enDesc:
532     It <kwd:MUST> <I::return a <XE::xhtml2|body> child element>
533     of the node.
534     @@@nullCase:
535     @@@@enDesc:
536     If the algorithm returns <DOM::null>.
537     @@@NodeReadOnlyError:
538     @@@PerlDef:
539     __CODE{mat|returnChildElement::
540     $node => $self,
541     $namespaceURI => {<Q::xhtml2|>},
542     $localName => 'body',
543     $r => $r,
544     }__;
545    
546     @Attr:
547     @@Name: markupLanguageName
548     @@enDesc:
549     The markup language name.
550    
551     It <kwd:MUST> <I::reflect the string value
552     of the <XA::sw09|Name> attribute> of the node. It default
553     value <kwd:MUST> be <CODE::SuikaWiki>.
554     @@Type: DOMString
555     @@Get:
556     @@@nullCase:
557     @@@@enDesc:
558     If the algorithm returns <DOM::null>.
559     @@@PerlDef:
560     __CODE{mat|getReflectAttrStringValue::
561     $node => $self,
562     $namespaceURI => {<Q::sw09|>},
563     $localName => 'Name',
564     $r => $r,
565     $defaultValue => 'SuikaWiki',
566     }__;
567     @@Set:
568     @@@nullCase:
569     @@@@enDesc:
570     Removes the attribute.
571     @@@NodeReadOnlyError:
572     @@@PerlDef:
573     __CODE{mat|setReflectAttrStringValue::
574     $node => $self,
575     $namespaceURI => {<Q::sw09|>},
576     $localName => 'Name',
577     $given => $given,
578     }__;
579    
580     @Attr:
581     @@Name: markupLanguageVersion
582     @@enDesc:
583     The markup language version.
584    
585     It <kwd:MUST> <I::reflect the string value
586     of the <XA::sw09|Version> attribute> of the node. It default
587     value <kwd:MUST> be <CODE::0.9>.
588     @@Type: DOMString
589     @@Get:
590     @@@nullCase:
591     @@@@enDesc:
592     If the algorithm returns <DOM::null>.
593     @@@PerlDef:
594     __CODE{mat|getReflectAttrStringValue::
595     $node => $self,
596     $namespaceURI => {<Q::sw09|>},
597     $localName => 'Version',
598     $r => $r,
599     $defaultValue => '0.9',
600     }__;
601     @@Set:
602     @@@nullCase:
603     @@@@enDesc:
604     Removes the attribute.
605     @@@NodeReadOnlyError:
606     @@@PerlDef:
607     __CODE{mat|setReflectAttrStringValue::
608     $node => $self,
609     $namespaceURI => {<Q::sw09|>},
610     $localName => 'Version',
611     $given => $given,
612     }__;
613     ##SWDMLDocumentElement
614    
615     ElementTypeBinding:
616     @Name: NodeReadOnlyError
617     @ElementType:
618     dx:raises
619     @ShadowContent:
620     @@@: MDOMX|NOMOD_THIS
621     @@Description:
622     @@@lang:en
623     @@@@:
624     If the node or a descendant of it, which
625     is to be modified, is read-only.
626    
627     ## -- Parser
628    
629     IFClsDef:
630     @IFQName: SWDMLParser
631     @ClsQName: ManakaiSWDMLParser
632    
633     @Implement: ecore|MUErrorTarget||ManakaiDOM|Perl
634    
635     @DISLang:role: gls|ParserRole
636    
637     @f:implements: SWDMLFeature010
638     @f:provides:
639     @@@: SWDMLFeature010
640     @@f:through: c|ManakaiDOMImplementation
641    
642     @enDesc:
643     A <IF::SWDMLParser> object parses a SuikaWiki/0.9,
644     SuikaWikiImage/0.9, or SuikaWiki/0.10 textual document and
645     returns it as an object.
646    
647     @Attr:
648     @@Name: domConfig
649     @@enDesc:
650     The configuration of the parser.
651    
652     @@Get:
653     @@@Type: c|DOMConfiguration
654     @@@enDesc: The DOM configuration object.
655     @@@PerlDef:
656     __CODE{c|getConfigObject::
657     $target => $self,
658     $targetHash => $self,
659     $targetType => {<IFName::SWDMLParser>},
660     $result => $r,
661     }__;
662    
663     @Method:
664     @@ManakaiDOM:isForInternal:1
665     @@ForCheck: ManakaiDOM|ForClass
666     @@Operator: DISPerl|NewMethod
667     @@enDesc:
668     Creates a new instance of the object.
669     @@Param:
670     @@@Name: impl
671     @@@Type: gls|GLSImplementation
672     @@@enDesc:
673     The implementation from which the parser is created.
674     @@Param:
675     @@@Name: features
676     @@@Type: DOMString
677     @@@dis:actualType: f|FeaturesString
678     @@@enDesc:
679     The set of features requested for the parser.
680     @@Return:
681     @@@Type: DOMMain|DOMObject
682     @@@enDesc:
683     The newly created parser.
684     @@@PerlDef:
685     $r = bless {
686     <H::f|implementation> => $impl,
687     }, $self;
688    
689     @Method:
690     @@Name: parseString
691     @@enDesc:
692     Parses a string as SWDML textual document and converts it into
693     DOM tree.
694     @@Param:
695     @@@Name: sourceText
696     @@@Type: DOMString
697     @@@enDesc:
698     The text to parse.
699     @@Return:
700     @@@Type: DISPerl|HASH
701     @@@enDesc:
702     An object representation of <P::sourceText>.
703     @@@PerlDef:
704     $self->{scanner} = $self->can ('_scan_Body');
705     $self->{char} = [0x000A];
706     $self->{token} = [];
707     $self->{source} = $sourceText;
708     $self->{location} = {};
709     $self->{doc} = $self->{<H::f|implementation>}
710     ->create_document (<Q::sw09|>, 'document');
711     $self->{doc}->strict_error_checking (false);
712     $self->{docel} = $self->{doc}->document_element;
713     $self->{docel}->set_attribute_ns (<Q::xmlns|>, 'xmlns', <Q::sw09|>);
714     $self->{docel}->set_attribute_ns (<Q::xmlns|>, 'xmlns:h2', <Q::xhtml2|>);
715     $self->{docel}->markup_language_version ('0.10');
716     $self->{docel}->append_child
717     ($self->{doc}->create_element_ns
718     (<Q::xhtml2|>, 'h2:head'));
719     $self->{docel}->append_child
720     ($self->{doc}->create_element_ns
721     (<Q::xhtml2|>, 'h2:body'));
722     __DEEP{
723     $self->_parse_Document;
724     }__;
725    
726     $r = $self->{doc};
727    
728     @Method:
729     @@Name: shiftChar
730     @@ManakaiDOM:isForInternal:1
731     @@ForCheck: ManakaiDOM|ForClass
732     @@enDesc:
733     Returns the next character.
734     @@Return:
735     @@@Type: idl|long||ManakaiDOM|all
736     @@@enDesc:
737     The code position number of the next character, if any,
738     or <CODE::-2>.
739     @@@PerlDef:
740     if (@{$self->{char}}) {
741     $r = shift @{$self->{char}};
742     } else {
743     my $char = substr ($self->{source}, pos ($self->{source}), 1);
744     pos ($self->{source})++;
745    
746     if (length $char) {
747     $r = ord $char;
748     if ($r == 0x000D) {
749     my $char2 = substr ($self->{source}, pos ($self->{source}), 1);
750     if (length $char2) {
751     if (ord $char2 == 0x000A) {
752     pos ($self->{source})++;
753     }
754     push @{$self->{char}}, 0x000A;
755     }
756     } elsif ($r == 0x000A) {
757     $r = 0x000D;
758     push @{$self->{char}}, 0x000A;
759     }
760     } else { ## ISSUE: The last |RE|
761     $r = -1;
762     }
763     }
764    
765     @Method:
766     @@ManakaiDOM:isForInternal: 1
767     @@Operator: ManakaiDOM|MUErrorHandler
768     @@enDesc:
769     When a <IF::ecore|ErrorInterface||ManakaiDOM|Perl> is <Perl::report>ed,
770     then this method is invoked.
771    
772     The method calls the <cfg::DOMCore|error-handler> if the error is of
773     <IF::DOMCore|DOMError>. Otherwise, the error is re-thrown so that
774     corresponding <Perl::catch> clause, if any, can catch the error.
775     @@Param:
776     @@@Name: err
777     @@@Type: ecore|ErrorInterface||ManakaiDOM|Perl
778     @@@enDesc:
779     The reported error object.
780     @@Return:
781     @@@Type: DISPerl|Any
782     @@@enDesc:
783     If the <P::err> is a <IF::DOMCore|DOMError>, then the return value
784     of the error handler.
785    
786     {NOTE:: If the error is thrown, the method never returns.
787     }
788     @@@nullCase:
789     @@@@enDesc:
790     No error handler.
791     @@@PerlDef:
792     if ($err->isa (<IFName::DOMCore|DOMError||ManakaiDOM|ManakaiDOM>)) {
793     __DEEP{
794     A: {
795     my $cfg = $self-><AG::SWDMLParser.domConfig>;
796     my $h = $cfg-><M::DOMCore|DOMConfiguration.getParameter>
797     ('error-handler');
798     $r = $h-><M::DOMCore|DOMErrorHandler.handleError> ($err);
799     } # A
800     }__;
801     } else {
802     $err-><M::ecore|ErrorInterface||ManakaiDOM|Perl.throw>;
803     }
804    
805     @DISPerl:dpgDef:
806    
807     lexmode WSP {
808     $wsp := [U+0009 U+0020];
809    
810     /*
811     U+000D and U+000A characters in source stream are
812     replaced to record separators by |shiftChar|.
813     */
814     $rs := [U+000A];
815     $re := [U+000D];
816     $nonRSRE := [^U+000D U+000A];
817     }
818    
819     lexmode Body
820     : extends => 'WSP'
821     : initial
822     : standalone
823     {
824     $digit := [U+0030..U+0039];
825     $ltagchar := [U+0041..U+005A U+0061..U+007A U+0030..U+0039 '-' '_'];
826     $classchar := [^'(' ')' U+005C U+000D U+000A];
827    
828     magicVersionS : value
829     := $rs ['#'] ['?'] ['S'] ['u'] ['i'] ['k'] ['a']
830     ['W'] ['i'] ['k'] ['i'] ['/'] ['0'] ['.'] ['9'] $wsp*
831     -> MagicParameter;
832     magicVersionI : value
833     := $rs ['#'] ['?'] ['S'] ['u'] ['i'] ['k'] ['a']
834     ['W'] ['i'] ['k'] ['i'] ['I'] ['m'] ['a'] ['g'] ['e']
835     ['/'] ['0'] ['.'] ['9'] $wsp*
836     -> MagicParameter;
837     otherRS : ignore := $rs;
838     headingStart : value := $rs ['*']+ $wsp*;
839     listStart : value := $rs ['-' '=']+ $wsp*;
840     dlistStart : value := $rs [':'] [^':' U+000D U+000A]* [':'] $wsp*;
841     quote : value := $rs ['>']+ $wsp*;
842     eol := $re;
843     anchorNumberDef : value := ['['] $digit+ [']'];
844     anchorNumberRef : value := ['>'] ['>'] $digit+;
845     externalRefStart := ['<'] -> ExternalRefBody;
846     startTag : value := ['['] [U+0041..U+005A]+ ['['];
847     startTagClass : value := ['['] [U+0041..U+005A]+
848     ['('] $classchar* [')'] ['['];
849     startTagClassLang : value := ['['] [U+0041..U+005A]+
850     ['('] $classchar* [')']
851     ['@'] $ltagchar* ['['];
852     startTagLang : value := ['['] [U+0041..U+005A]+ ['@'] $ltagchar* ['['];
853     termStartTag := ['['] ['['];
854     midTag : value := [']'] $wsp* ['['];
855     endTag := [']'] [']'];
856     endTagAnchorNumberRef : value := [']'] ['>'] ['>'] $digit+ [']'];
857     endTagExternalRefStart := [']'] ['<'] -> EndTagExternalRefBody;
858     preEndTag := $rs [']'] ['P'] ['R'] ['E'] [']'] $wsp* $re;
859     insEndTag := $rs [']'] ['I'] ['N'] ['S'] [']'] $wsp* $re;
860     delEndTag := $rs [']'] ['D'] ['E'] ['L'] [']'] $wsp* $re;
861     formStart : value := ['['] ['['] ['#'] [U+0061..U+007A '-']+
862     -> FormBody;
863     emphasis2 := [U+0027] [U+0027];
864     emphasis3 := [U+0027] [U+0027] [U+0027];
865     entityRef : value := ['_'] ['_'] ['&'] ['&']
866     [^'&' U+000D U+000A]+
867     ['&'] ['&'] ['_'] ['_'];
868     obsPreStart : value := $rs $wsp;
869     noteLine := $rs [';'] [';'] $wsp*;
870     todoLine := $rs ['@'] ['@'] $wsp*;
871     tableLine : value := $rs [','] $nonRSRE* $re;
872     imageStart : value := $rs ['_'] ['_'] ['I'] ['M'] ['A'] ['G'] ['E']
873     ['_'] ['_'] $re;
874     ?default-token text : value;
875     }
876    
877     lexmode MagicParameter
878     : extends => 'WSP'
879     : standalone
880     {
881     name : value := [U+0041..U+005A U+0061..U+007A U+0030..U+0039 '-']+;
882     vi := ['='];
883     lit := ['"'] -> MagicParameterValue;
884     s : ignore := $wsp+;
885     eol := $re -> Body;
886     }
887    
888     lexmode MagicParameterValue
889     : standalone
890     {
891     quotedPair : value := [U+005C] .;
892     ?default-token text : value;
893     lit := ['"'] -> MagicParameter;
894     }
895    
896     lexmode ExternalRefBody
897     : standalone
898     {
899     lit := ['"'] -> ExternalRefQuotedStringBody;
900     externalRefEnd := ['>'] -> Body;
901     ?default-token text : value;
902     }
903     lexmode EndTagExternalRefBody
904     : standalone
905     {
906     lit := ['"'] -> EndTagExternalRefQuotedStringBody;
907     endTagExternalRefEnd := ['>'] [']'] -> Body;
908     ?default-token text : value;
909     }
910    
911     lexmode ExternalRefQuotedStringBody
912     : standalone
913     {
914     lit := ['"'] -> ExternalRefBody;
915     quotedPair : value := [U+005C] . /* | ['\'] $rs $re */;
916     ?default-token text : value;
917     }
918     lexmode EndTagExternalRefQuotedStringBody
919     : standalone
920     {
921     lit := ['"'] -> EndTagExternalRefBody;
922     quotedPair : value := [U+005C] . /* | ['\'] $rs $re */;
923     ?default-token text : value;
924     }
925    
926     lexmode FormBody
927     : standalone
928     {
929     lita := [U+0027] -> FormQuotedStringBody;
930     formEnd := [']'] [']'] -> Body;
931     ?default-token text : value;
932     }
933    
934     lexmode FormQuotedStringBody
935     : standalone
936     {
937     lita := [U+0027] -> FormBody;
938     quotedPair := [U+005C] . /* | ['\'] $rs $re */;
939     ?default-token text : value;
940     }
941    
942    
943     rule Document
944     : standalone
945     {
946     ~? (magicVersionS) {
947     lang:Perl {
948     $self->{docel}
949     ->set_attribute_ns (<Q::sw09|>, 'sw9:Name' => 'SuikaWiki');
950     $self->{docel}->set_attribute_ns (<Q::sw09|>, 'sw9:Version' => '0.9');
951     }
952     &MagicParam;
953     } (magicVersionI) {
954     lang:Perl {
955     $self->{docel}
956     ->set_attribute_ns (<Q::sw09|>, 'sw9:Name' => 'SuikaWikiImage');
957     $self->{docel}->set_attribute_ns (<Q::sw09|>, 'sw9:Version' => '0.9');
958     }
959     &MagicParam;
960     }
961    
962     my $parent;
963     /*
964     block For block-level elements.
965     section i For i-th-level sections. Null if no (i-1)-th
966     level section.
967     list i For i-th-level list items. Null if no i-th-level
968     list.
969     text For texts or inline-level elements
970     Null if no container for inlines.
971     */
972     my $state;
973     /*
974     heading Next |eol| closes the heading.
975     section Otherwise.
976     */
977     lang:Perl {
978     $parent->{block} = $self->{docel}->body_element;
979     $parent->{section}->[1] = $parent->{block};
980     $state = 'section';
981     }
982    
983     ~* (text) {
984     lang:Perl ($v => $token.value) {
985     unless (defined $parent->{text}) {
986     $parent->{text} = $parent->{block}
987     ->append_child
988     ($self->{doc}->create_element_ns
989     (<Q::xhtml2|>, 'h2:p'));
990     }
991     $parent->{text}->manakai_append_text ($v);
992     }
993     } (startTag) {
994     my $element_type;
995     my $class_names;
996     my $lang_tag;
997     lang:Perl ($v => $token.value) {
998     $v =~ /([A-Z]+)/;
999     $element_type = $1;
1000     $class_names = '';
1001     }
1002    
1003     &_StartTag ($element_type => $element_type, $class_names => $class_names,
1004     $lang_tag => $lang_tag, $parent => $parent);
1005     } (startTagClass) {
1006     my $element_type;
1007     my $class_names;
1008     my $lang_tag;
1009     lang:Perl ($v => $token.value) {
1010     $v =~ /([A-Z]+)\(([^()]+)/;
1011     $element_type = $1;
1012     $class_names = $2;
1013     }
1014    
1015     &_StartTag ($element_type => $element_type, $class_names => $class_names,
1016     $lang_tag => $lang_tag, $parent => $parent);
1017     } (startTagClassLang) {
1018     my $element_type;
1019     my $class_names;
1020     my $lang_tag;
1021     lang:Perl ($v => $token.value) {
1022     $v =~ /([A-Z]+)\(([^()]+)\@([^\[\]]*)/;
1023     $element_type = $1;
1024     $class_names = $2;
1025     $lang_tag = $2;
1026     }
1027    
1028     &_StartTag ($element_type => $element_type, $class_names => $class_names,
1029     $lang_tag => $lang_tag, $parent => $parent);
1030     } (startTagLang) {
1031     my $element_type;
1032     my $class_names;
1033     my $lang_tag;
1034     lang:Perl ($v => $token.value) {
1035     $v =~ /([A-Z]+)\@([^\[\]]*)/;
1036     $element_type = $1;
1037     $class_names = '';
1038     $lang_tag = $2;
1039     }
1040    
1041     &_StartTag ($element_type => $element_type, $class_names => $class_names,
1042     $lang_tag => $lang_tag, $parent => $parent);
1043     } (eol) {
1044     ~? (eol) {
1045     lang:Perl {
1046     $parent->{block} = $parent->{section}->[-1];
1047     $parent->{text} = null;
1048     $state = 'section';
1049     }
1050     } else {
1051     lang:Perl {
1052     if ($state eq 'heading') {
1053     $parent->{text} = null;
1054     $state = 'section';
1055     } elsif (defined $parent->{text}) {
1056     $parent->{text}->manakai_append_text ("\x0A");
1057     }
1058     }
1059     }
1060     } (listStart) {
1061     lang:Perl ($v => $token.value) {
1062     $v =~ /([-=]+)/;
1063     my $level = length $1;
1064     my $type = substr ($1, -1) eq '-' ? 'ul' : 'ol';
1065     if (defined $parent->{list}->[$level]) {
1066     unless ($parent->{list}->[$level]->local_name eq $type) {
1067     $parent->{list}->[$level]
1068     = $parent->{list}->[$level]->parent_node
1069     ->append_child
1070     ($self->{doc}->create_element_ns
1071     (<Q::xhtml2|>, 'h2:'.$type));
1072     }
1073     } elsif (defined $parent->{list}->[0]) {
1074     my $parent_list = $parent->{list}->[-1];
1075     my $parent_lc = $parent_list->last_child;
1076     if (defined $parent_lc and
1077     $parent_lc->node_type eq <C::Node.ELEMENT_NODE>) {
1078     $parent->{list}->[$level]
1079     = $parent_lc->append_child
1080     ($self->{doc}->create_element_ns
1081     (<Q::xhtml2|>, 'h2:'.$type));
1082     } else {
1083     $parent->{list}->[$level]
1084     = $parent_list->append_child
1085     ($self->{doc}->create_element_ns
1086     (<Q::xhtml2|>, 'h2:li'))
1087     ->append_child
1088     ($self->{doc}->create_element_ns
1089     (<Q::xhtml2|>, 'h2:'.$type));
1090     }
1091     } else {
1092     $parent->{list}->[$level]
1093     = $parent->{block}->append_child
1094     ($self->{doc}->create_element_ns
1095     (<Q::xhtml2|>, 'h2:'.$type));
1096     }
1097     $parent->{block} =
1098     $parent->{text} = $parent->{list}->[$level]
1099     ->append_child
1100     ($self->{doc}->create_element_ns
1101     (<Q::xhtml2|>, 'h2:li'));
1102     $state = 'section';
1103     }
1104     } (headingStart) {
1105     lang:Perl ($v => $token.value) {
1106     $v =~ /(\*+)/;
1107     my $level = length $1;
1108     if (defined $parent->{section}->[$level]) {
1109     if (defined $parent->{section}->[$level + 1]) {
1110     $#{$parent->{section}} = $level;
1111     }
1112     } else {
1113     L: for my $i (2..$level) {
1114     next L if defined $parent->{section}->[$i];
1115     $parent->{section}->[$i]
1116     = $self->{doc}->create_element_ns (<Q::xhtml2|>, 'h2:section');
1117     $parent->{section}->[$i - 1]
1118     ->append_child ($parent->{section}->[$i]);
1119     } # L
1120     }
1121     $parent->{block} =
1122     $parent->{section}->[$level + 1]
1123     = $self->{doc}->create_element_ns (<Q::xhtml2|>, 'h2:section');
1124     $parent->{section}->[$level]
1125     ->append_child ($parent->{section}->[$level + 1]);
1126     $parent->{text} = $self->{doc}->create_element_ns
1127     (<Q::xhtml2|>, 'h2:h');
1128     $parent->{block}->append_child ($parent->{text});
1129     $state = 'heading';
1130     }
1131     }
1132     } // Document
1133    
1134     rule MagicParam {
1135     ~* (name) {
1136     my $param_el;
1137     my $value;
1138     lang:Perl ($v => $token.value) {
1139     $param_el = $self->{doc}->create_element_ns
1140     (<Q::sw09|>, 'parameter');
1141     $param_el->set_attribute_ns (null, 'name', $v);
1142     $value = '';
1143     }
1144    
1145     ~ (vi) { }
1146     ~ (lit) { }
1147     ~* (text) {
1148     lang:Perl ($v => $token.value) {
1149     $value .= $v;
1150     }
1151     } (quotedPair) {
1152     lang:Perl ($v => $token.value) {
1153     $value .= substr ($v, 1);
1154     }
1155     }
1156     ~ (lit) { }
1157    
1158     lang:Perl {
1159     for (split /,/, $value) {
1160     $param_el->append_child ($self->{doc}->create_element_ns
1161     (<Q::sw09|>, 'value'))
1162     ->manakai_append_text ($_);
1163     }
1164    
1165     $self->{docel}->head_element->append_child ($param_el);
1166     }
1167     }
1168    
1169     ~ (eol) { }
1170     } // MagicParam
1171    
1172     rule _StartTag ($parent, $element_type, $class_names, $lang_tag) {
1173     lang:Perl {
1174     unless (defined $parent->{text}) {
1175     $parent->{text} = $parent->{block}
1176     ->append_child
1177     ($self->{doc}->create_element_ns
1178     (<Q::xhtml2|>, 'h2:p'));
1179     }
1180     my @class_names = split /\s+/, $class_names;
1181     my $et = {
1182     ABBR => [<Q::xhtml2|>, 'abbr'],
1183     CODE => [<Q::xhtml2|>, 'code'],
1184     DEL => [<Q::xhtml2|>, 'del'],
1185     DFN => [<Q::xhtml2|>, 'dfn'],
1186     INS => [<Q::xhtml2|>, 'ins'],
1187     KBD => [<Q::xhtml2|>, 'kbd'],
1188     Q => [<Q::xhtml2|>, 'q'],
1189     RUBY => [<Q::xhtml2|>, 'ruby'],
1190     RUBYB=> [<Q::sw09|>, 'rubyb'],
1191     SAMP => [<Q::xhtml2|>, 'samp'],
1192     SUB => [<Q::xhtml2|>, 'sub'],
1193     SUP => [<Q::xhtml2|>, 'sup'],
1194     VAR => [<Q::xhtml2|>, 'var'],
1195     WEAK => [<Q::sw09|>, 'weak'],
1196     AA => [<Q::aa|>, 'aa'],
1197     CITE => [<Q::xhtml2|>, 'cite'],
1198     CSECTION => [<Q::sw010|>, 'csection'],
1199     KEY => [<Q::sw010|>, 'key'],
1200     QN => [<Q::sw010|>, 'qn'],
1201     SPAN => [<Q::xhtml2|>, 'span'],
1202     SRC => [<Q::sw010|>, 'src'],
1203     }->{$element_type};
1204     unless (defined $et) {
1205     $et = [<Q::xhtml2|>, 'code'];
1206     push @class_names, $element_type;
1207     }
1208     $parent->{text}
1209     = $parent->{text}->append_child
1210     ($self->{doc}->create_element_ns
1211     ($et->[0], $et->[1]));
1212     $parent->{text}
1213     ->set_attribute_ns (null, 'class' => join ' ', @class_names)
1214     if @class_names;
1215     $parent->{text}
1216     ->set_attribute_ns (<Q::xml|>, 'xml:lang', $lang_tag)
1217     if defined $lang_tag;
1218     }
1219     } // _StartTag
1220    
1221     @Code:
1222     @@QName: inlineContainerElementTypes
1223     @@PerlDef:
1224     {
1225     abbr => true, code => true, del => true, dfn => true,
1226     ins => true, kbd => true, q => true, samp => true,
1227     sub => true, sup => true, var => true, weak => true,
1228     aa => true, cite => true, csection => true, key => true,
1229     span => true, src => true, anchor => true, nsuri => true,
1230     qname => true, rb => true, rt => true,
1231    
1232     p => true, pre => true, h => true, li => true,
1233     dt => true, dd => true, ed => true, comment-p => true,
1234     td => true, em => true, strong => true,
1235     }
1236    
1237     # document head body section bodytext insert delete
1238     # ul ol dl dr table tbody tr form replace ruby rubyb qn
1239     # anchor-external anchor-internal anchor-end text blockquote
1240    
1241    

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24