/[suikacvs]/messaging/manakai/lib/Message/Util/PerlCode.dis
Suika

Contents of /messaging/manakai/lib/Message/Util/PerlCode.dis

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.74 - (hide annotations) (download)
Sat Dec 30 13:25:36 2006 UTC (18 years, 7 months ago) by wakaba
Branch: MAIN
Changes since 1.73: +2 -4 lines
++ manakai/lib/Message/Util/DIS/ChangeLog	30 Dec 2006 13:23:58 -0000
	* Perl.dis (plCodeFragment): Support for |f:provides|
	is removed.

2006-12-30  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/Message/DOM/ChangeLog	30 Dec 2006 13:22:55 -0000
	* DOMFeature.dis (ForDef): Removed.
	(f:provides, f:through): Removed.
	(Version): Removed.
	(implementFeature): Removed.

2006-12-30  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/manakai/ChangeLog	30 Dec 2006 13:25:24 -0000
	* DISIDL.dis, Java.dis, ECMAScript.dis,
	Document.dis, DISPerl.dis, XML.dis (ForDef): Removed.

	* DISMarkup.dis (ForET): Removed.

	* |DefaultFor| properties are removed.

	* DISCore.dis (DefaultFor): Removed.

2006-12-30  Wakaba  <wakaba@suika.fam.cx>

1 wakaba 1.1 Module:
2     @QName:
3     Util:PerlCode
4     @FullName:
5     @@lang: en
6     @@@:
7     Perl Code Constructor
8     @Namespace:
9     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/PerlCode#
10    
11     @Description:
12     @@lang:en
13     @@@:
14     This module provides an object-oriented interface to construct
15     Perl code.
16    
17 wakaba 1.30 @DISCore:author: DISCore|Wakaba
18 wakaba 1.1 @License:
19     @@@:
20     license:Perl+MPL
21     @@Original:
22     @@@FullName:
23     manakai <CODE::lib/manakai/genlib.pl>
24     @@@Year:2004
25 wakaba 1.30 @@@DISCore:author: DISCore|Wakaba
26 wakaba 1.1 @Date:
27 wakaba 1.74 $Date: 2006/12/30 12:00:44 $
28 wakaba 1.1
29     @Require:
30     @@Module:
31 wakaba 1.73 @@@QName: Util|common
32     @@Module:
33 wakaba 1.35 @@@QName: MDOM|DOMCore
34 wakaba 1.56 @@Module:
35     @@@QName: DISlib|DISMarkup
36 wakaba 1.1
37     Namespace:
38 wakaba 1.59 @c:
39     http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#
40 wakaba 1.61 @cfg:
41     http://suika.fam.cx/www/2006/dom-config/
42 wakaba 1.1 @DIS:
43     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/DIS#
44     @dis:
45     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#dis--
46 wakaba 1.56 @DISlib:
47     http://suika.fam.cx/~wakaba/archive/2004/dis/
48 wakaba 1.66 @domperl:
49     http://suika.fam.cx/~wakaba/archive/2006/dom/perl/
50 wakaba 1.33 @f:
51     http://suika.fam.cx/~wakaba/archive/2004/dom/feature#
52     @idl:
53     http://suika.fam.cx/~wakaba/archive/2004/dis/IDL#
54 wakaba 1.25 @kwd:
55     http://suika.fam.cx/~wakaba/archive/2005/rfc2119/
56 wakaba 1.1 @lang:
57     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#
58     @license:
59     http://suika.fam.cx/~wakaba/archive/2004/8/18/license#
60     @ManakaiDOM:
61     http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#
62 wakaba 1.5 @MDOM:
63     http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#ManakaiDOM.
64 wakaba 1.1 @MDOMX:
65     http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#
66     @pc:
67     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/PerlCode#
68 wakaba 1.44 @pc2:
69     http://suika.fam.cx/~wakaba/archive/2005/12/pc/
70 wakaba 1.1 @rdf:
71     http://www.w3.org/1999/02/22-rdf-syntax-ns#
72 wakaba 1.35 @s:
73     http://suika.fam.cx/~wakaba/archive/2004/dis/Markup#
74 wakaba 1.59 @tc:
75     http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/TreeCore/
76 wakaba 1.60 @td:
77     http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/Document/
78     @te:
79     http://suika.fam.cx/~wakaba/archive/2005/manakai/DOM/Element/
80 wakaba 1.42 @test:
81     http://suika.fam.cx/~wakaba/archive/2004/dis/Test#
82 wakaba 1.1 @Util:
83     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/
84    
85     ## -- Features
86    
87     ElementTypeBinding:
88     @Name: FeatureDef
89     @ElementType:
90     dis:ResourceDef
91     @ShadowContent:
92 wakaba 1.59 @@DISCore:resourceType: f|Feature
93 wakaba 1.1
94     ElementTypeBinding:
95     @Name: FeatureVerDef
96     @ElementType:
97     dis:ResourceDef
98     @ShadowContent:
99 wakaba 1.59 @@DISCore:resourceType: f|Feature
100 wakaba 1.1
101     ElementTypeBinding:
102     @Name: featureQName
103     @ElementType:
104 wakaba 1.59 f:name
105 wakaba 1.1 @ShadowContent:
106 wakaba 1.29 @@ContentType: DISCore|QName
107 wakaba 1.1
108     FeatureDef:
109     @QName: CoreFeature
110     @featureQName:
111     Util:PerlCode
112     @FeatureVerDef:
113     @@QName: CoreFeature10
114 wakaba 1.74 @@f:version: 1.0
115 wakaba 1.1 @@ISA: CoreFeature
116     @@FullName:
117     @@@lang:en
118     @@@@:
119     Perl Code Constructor, version 1.0
120     @@Description:
121     @@@lang:en
122     @@@@:
123     Perl Code Constructor, version 1.0.
124    
125 wakaba 1.25 ElementTypeBinding:
126     @Name: IFClsDef
127     @ElementType:
128     dis:ResourceDef
129     @ShadowContent:
130     @@rdf:type:
131     @@@@: dis|MultipleResource
132     @@@ForCheck: !ManakaiDOM|ForIF !ManakaiDOM|ForClass
133     @@resourceFor: ManakaiDOM|ForIF
134 wakaba 1.62 @@resourceFor:
135     @@@@: ManakaiDOM|ForClass
136 wakaba 1.35
137     @@rdf:type:
138     @@@@: DISLang|Interface
139     @@@ForCheck: ManakaiDOM|ForIF
140    
141     @@rdf:type:
142     @@@@: DISLang|Class
143     @@@ForCheck: ManakaiDOM|ForClass
144 wakaba 1.71
145 wakaba 1.35 @@Implement:
146 wakaba 1.72 @@@@: ||+||ManakaiDOM|ForIF
147 wakaba 1.35 @@@ContentType: DISCore|TFPQNames
148 wakaba 1.72 @@@ForCheck: ManakaiDOM|ForClass
149 wakaba 1.35
150     @@f:implements: pc|CoreFeature10
151    
152     ElementTypeBinding:
153     @Name: IFClsETDef
154     @ElementType:
155     dis:ResourceDef
156     @ShadowContent:
157     @@rdf:type:
158     @@@@: dis|MultipleResource
159     @@@ForCheck: !ManakaiDOM|ForIF !ManakaiDOM|ForClass !s|ForML
160     @@resourceFor: ManakaiDOM|ForIF
161 wakaba 1.36 @@resourceFor: ManakaiDOM|ForClass
162 wakaba 1.35 @@resourceFor: s|ForML
163 wakaba 1.25
164     @@rdf:type:
165 wakaba 1.35 @@@@: DISLang|Interface
166     @@@ForCheck: ManakaiDOM|ForIF
167 wakaba 1.25
168     @@rdf:type:
169 wakaba 1.35 @@@@: DISLang|Class
170 wakaba 1.25 @@@ForCheck: ManakaiDOM|ForClass
171 wakaba 1.71
172 wakaba 1.35 @@Implement:
173 wakaba 1.72 @@@@: ||+||ManakaiDOM|ForIF
174 wakaba 1.25 @@@ContentType: DISCore|TFPQNames
175 wakaba 1.72 @@@ForCheck: ManakaiDOM|ForClass
176 wakaba 1.36
177 wakaba 1.35 @@s:elementType:
178     @@@@: ||+||s|ForML
179     @@@ContentType: DISCore|TFPQNames
180     @@@DISCore:stopISARecursive:1
181    
182     @@rdf:type:
183     @@@@: s|ElementType
184     @@@ForCheck: s|ForML
185 wakaba 1.25
186 wakaba 1.35 @@f:implements: pc|CoreFeature10
187 wakaba 1.25
188     ElementTypeBinding:
189     @Name: IFQName
190     @ElementType:
191     dis:QName
192     @ShadowContent:
193     @@ForCheck: ManakaiDOM|ForIF
194    
195     ElementTypeBinding:
196 wakaba 1.35 @Name: CQName
197     @ElementType:
198     dis:QName
199     @ShadowContent:
200 wakaba 1.36 @@ForCheck: ManakaiDOM|ForClass
201 wakaba 1.25
202     ElementTypeBinding:
203     @Name: IFISA
204     @ElementType:
205     dis:ISA
206     @ShadowContent:
207     @@ForCheck: ManakaiDOM|ForIF
208    
209     ElementTypeBinding:
210 wakaba 1.35 @Name: CISA
211     @ElementType:
212     dis:ISA
213     @ShadowContent:
214 wakaba 1.36 @@ForCheck: ManakaiDOM|ForClass
215 wakaba 1.25
216 wakaba 1.1 ## -- Classes
217    
218 wakaba 1.25 IFClsDef:
219     @IFQName: PerlCode
220 wakaba 1.35 @CQName: ManakaiPCCode
221 wakaba 1.25
222 wakaba 1.60 @CISA: te|ManakaiDOMElement
223 wakaba 1.59
224 wakaba 1.73 @s:elementType: AnyPCElement
225     @s:elementType: AnyPC2Element
226 wakaba 1.25
227 wakaba 1.1 @enDesc:
228     A class on which another Perl code classes are constructed based.
229    
230 wakaba 1.59 @Test:
231     @@QName: Document.createElementNS.PerlCode.pc1.test
232     @@PerlDef:
233     my $doc;
234     __CODE{createPCDocumentForTest:: $doc => $doc}__;
235    
236     my $el1 = $doc-><M::Document.createElementNS>
237     (<Q::pc:>, 'pc:NoSuchElementType');
238    
239     $test->id ('pc.Element');
240     $test->assert_isa ($el1, <IFName::Element>);
241    
242     $test->id ('pc.PerlCode');
243     $test->assert_isa ($el1, <IFName::PerlCode>);
244     @Test:
245     @@QName: Document.createElementNS.PerlCode.pc2.test
246     @@PerlDef:
247     my $doc;
248     __CODE{createPCDocumentForTest:: $doc => $doc}__;
249    
250     my $el2 = $doc-><M::Document.createElementNS>
251     (<Q::pc2:>, 'pc2:NoSuchElementType');
252    
253     $test->id ('pc2.Element');
254     $test->assert_isa ($el2, <IFName::Element>);
255    
256     $test->id ('pc2.PerlCode');
257     $test->assert_isa ($el2, <IFName::PerlCode>);
258    
259 wakaba 1.1 @Attr:
260 wakaba 1.6 @@Name: fileNode
261     @@enDesc:
262     The root <QUOTE::file> node of the tree to which this node belongs.
263 wakaba 1.25 @@Type: PerlCode
264 wakaba 1.6 @@Get:
265     @@@enDesc:
266     The <QUOTE::file> node of the tree.
267     @@@nullCase:
268     @@@@enDesc:
269     This node does not belong to any file tree.
270     @@@PerlDef:
271 wakaba 1.35 __DEEP{
272     $r = $self-><AG::Node.ownerDocument>
273     -><AG::Document.documentElement>;
274     if ($r) {
275     unless (defined $r-><AG::Node.namespaceURI> and
276     $r-><AG::Node.namespaceURI> eq <Q::pc:> and
277     $r-><AG::Node.localName> eq 'file') {
278     $r = null;
279     }
280     }
281     }__;
282 wakaba 1.6
283     @Method:
284     @@Name: replaceVariable
285     @@enDesc:
286     Replaces a variable.
287     \
288     {NOTE:: For objects of type <Class::ManakaiPerlFile>,
289 wakaba 1.11 <Class::ManakaiPerlPackageScope>,
290     <Class::ManakaiPerlSub> and
291     <Class::ManakaiPerlVariable>, the result is undefined.
292 wakaba 1.6 \
293     }
294     @@Param:
295     @@@Name: originalVariable
296     @@@Type:
297 wakaba 1.73 lang:Perl
298 wakaba 1.6 @@@enDesc:
299     Original variable specification, including prefix.
300     \
301     {NOTE:: Qualified name variable and hash key is not supported.
302     \
303     }
304     @@Param:
305     @@@Name: newValue
306 wakaba 1.11 @@@Type:
307 wakaba 1.73 DOMMain:any
308 wakaba 1.6 @@@enDesc:
309     New value to replace.
310 wakaba 1.11 @@@InCase:
311 wakaba 1.25 @@@@Type: PerlCode
312 wakaba 1.11 @@@@enDesc:
313     New Perl code fragment to replace by.
314     @@@InCase:
315     @@@@Type:
316 wakaba 1.73 lang:Perl
317 wakaba 1.11 @@@@enDesc:
318     Inline Perl code fragment string to replace by.
319 wakaba 1.6 @@Return:
320     @@@PerlDef:
321 wakaba 1.35 my $ln = $self-><AG::Node.localName>;
322     if ($ln eq 'unparsed' or
323     $ln eq 'inlineUnparsed') {
324     my $new_var = ref $newValue ? $newValue->stringify : ''.$newValue;
325     my $val = $self-><AG::Node.textContent>;
326     $val =~ s/\Q$originalVariable\E\b/$new_var/g;
327     $self-><AS::Node.textContent> ($val);
328     } elsif ($ln eq 'stringLiteral' or $ln eq 'atom' or
329     $ln eq 'tokens') {
330     #
331     } elsif ($self-><M::Node.hasChildNodes>) {
332     __DEEP{
333     my @child_nodes = @{$self-><AG::Node.childNodes>};
334     for my $child_node (@child_nodes) {
335 wakaba 1.61 my $nsuri = $child_node-><AG::Node.namespaceURI>;
336     if (defined $nsuri and
337     ($nsuri eq <Q::pc:> or $nsuri eq <Q::pc2:>)) {
338 wakaba 1.35 if ($child_node-><AG::Node.localName> eq 'variable') {
339     if (substr ($originalVariable, 0, 1) eq
340     $child_node-><AG::PerlVariable.variableType> and
341     not defined $child_node-><AG::PerlVariable.packageName> and
342     substr ($originalVariable, 1) eq
343     $child_node-><AG::PerlVariable.pcLocalName> and
344     not defined $child_node-><AG::PerlVariable.hashKey>) {
345     if (ref $newValue) {
346     $self-><M::Node.replaceChild> ($child_node => $newValue);
347     } else { ## ISSUE: Is this correct?
348     $child_node-><M::PerlCodeInlines.appendCode> ($newValue);
349     }
350     }
351     } else { ## Non-variable child
352     $child_node-><M::PerlCode.replaceVariable>
353     ($originalVariable => $newValue);
354     }
355     } else {
356     #
357     }
358     }
359     }__;
360     } # has child
361    
362     @ResourceDef:
363 wakaba 1.36 @@ForCheck: ManakaiDOM|ForClass
364 wakaba 1.35 @@QName: addNameListAttr
365     @@rdf:type: DISPerl|BlockCode
366     @@PerlDef:
367 wakaba 1.50 my $__v = $node-><M::Element.getAttributeNS> (<Q::pc:>, $attrName);
368 wakaba 1.35 my %__mn = map {$_ => true}
369 wakaba 1.50 split /\s+/, defined $__v ? $__v : '';
370 wakaba 1.35 $__mn{$newName} = true;
371     $node-><M::Element.setAttributeNS>
372     (<Q::pc:>, 'pc:'.$attrName => join ' ', keys %__mn);
373    
374 wakaba 1.13
375     @Method:
376     @@Name: addUsePerlModuleName
377     @@enDesc:
378     Adds a Perl module into the list of Perl modules
379     <Perl::use>d by this code fragment.
380     @@Param:
381     @@@Name: moduleName
382 wakaba 1.35 @@@Type: DOMString
383 wakaba 1.13 @@@enDesc:
384     The name of the module package that should be <Perl::use>d.
385     @@Return:
386     @@@PerlDef:
387 wakaba 1.35 __DEEP{
388     __CODE{addNameListAttr::
389     $node => {$self},
390     $attrName => 'useModuleName',
391     $newName => {$moduleName},
392     }__;
393     }__;
394 wakaba 1.13
395     @Method:
396 wakaba 1.22 @@Name: addUseCharClassName
397     @@enDesc:
398     Adds a Perl module into the list of Perl character classes
399     <Perl::use>d by this code fragment.
400     @@Param:
401     @@@Name: moduleName
402 wakaba 1.35 @@@Type: DOMString
403 wakaba 1.22 @@@enDesc:
404     The name of the module package that should be <Perl::use>d.
405     @@Param:
406     @@@Name: charClassName
407 wakaba 1.35 @@@Type: DOMString
408 wakaba 1.22 @@@enDesc:
409     The name of the character class.
410     @@Return:
411     @@@PerlDef:
412 wakaba 1.35 __DEEP{
413     __CODE{addNameListAttr::
414     $node => {$self},
415     $attrName => 'useCharClassName',
416     $newName => {$moduleName.'.'.$charClassName},
417     }__;
418     }__;
419 wakaba 1.22
420     @Method:
421 wakaba 1.19 @@Name: addRequirePerlModuleName
422     @@enDesc:
423     Adds a Perl module into the list of Perl modules
424     <Perl::require>d by this code fragment.
425     @@Param:
426     @@@Name: moduleName
427 wakaba 1.35 @@@Type: DOMString
428 wakaba 1.19 @@@enDesc:
429     The name of the module package that should be <Perl::require>d.
430     @@Return:
431     @@@PerlDef:
432 wakaba 1.35 __DEEP{
433     __CODE{addNameListAttr::
434     $node => {$self},
435     $attrName => 'requireModuleName',
436     $newName => {$moduleName},
437     }__;
438     }__;
439 wakaba 1.19
440     @Method:
441 wakaba 1.33 @@Name: addExceptionInterfacePackageName
442     @@enDesc:
443     Adds a Perl exception interface into the list of Perl packages.
444     @@Param:
445     @@@Name: moduleName
446 wakaba 1.35 @@@Type: DOMString
447 wakaba 1.33 @@@enDesc:
448     The name of the interface package.
449     @@Return:
450     @@@PerlDef:
451 wakaba 1.35 __DEEP{
452     __CODE{addNameListAttr::
453     $node => {$self},
454     $attrName => 'exceptionInterfaceName',
455     $newName => {$moduleName},
456     }__;
457     }__;
458    
459     @ResourceDef:
460 wakaba 1.36 @@ForCheck: ManakaiDOM|ForClass
461 wakaba 1.35 @@QName: getNameListAttrR
462     @@rdf:type: DISPerl|BlockCode
463     @@PerlDef:
464     my @__nodes = ($node);
465     my %__result;
466     while (@__nodes) {
467     my $__cnode = shift @__nodes;
468 wakaba 1.52 if ($__cnode-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>) {
469     my $__v = $__cnode-><M::Element.getAttributeNS>
470     (<Q::pc:>, $attrName);
471     for (split /\s+/, defined $__v ? $__v : '') {
472     $__result{$_} = true;
473     }
474     push @__nodes, @{$__cnode-><AG::Node.childNodes>};
475     }
476     }
477     $result = [sort {$a cmp $b} keys %__result];
478     @ResourceDef:
479     @@ForCheck: ManakaiDOM|ForClass
480     @@QName: getNameListAttrRM
481     @@rdf:type: DISPerl|BlockCode
482     @@enDesc:
483     Except <Q::pc:require> subtree.
484     @@PerlDef:
485     my @__nodes = ();
486     my %__result;
487     {
488     my $__cnode = $node;
489     if ($__cnode-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>) {
490     my $__v = $__cnode-><M::Element.getAttributeNS>
491     (<Q::pc:>, $attrName);
492     for (split /\s+/, defined $__v ? $__v : '') {
493     $__result{$_} = true;
494     }
495     push @__nodes, @{$__cnode-><AG::Node.childNodes>};
496     }
497     }
498     N: while (@__nodes) {
499     my $__cnode = shift @__nodes;
500     if ($__cnode-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>) {
501     if (defined $__cnode-><AG::Node.namespaceURI> and
502     $__cnode-><AG::Node.namespaceURI> eq <Q::pc:> and
503     $__cnode-><AG::Node.localName> eq 'package') {
504     next N;
505     }
506 wakaba 1.50 my $__v = $__cnode-><M::Element.getAttributeNS>
507     (<Q::pc:>, $attrName);
508     for (split /\s+/, defined $__v ? $__v : '') {
509 wakaba 1.35 $__result{$_} = true;
510     }
511     push @__nodes, @{$__cnode-><AG::Node.childNodes>};
512     }
513     }
514     $result = [sort {$a cmp $b} keys %__result];
515     @ResourceDef:
516 wakaba 1.36 @@ForCheck: ManakaiDOM|ForClass
517 wakaba 1.35 @@QName: getNameListAttr
518     @@rdf:type: DISPerl|BlockCode
519     @@PerlDef:
520 wakaba 1.50 my %__result;
521     my $__v = $node-><M::Element.getAttributeNS> (<Q::pc:>, $attrName);
522     for (split /\s+/, defined $__v ? $__v : '') {
523 wakaba 1.35 $__result{$_} = true;
524     }
525     $result = [sort {$a cmp $b} keys %__result];
526 wakaba 1.33
527     @Method:
528 wakaba 1.15 @@Name: getUsePerlModuleNameList
529     @@enDesc:
530     Returns a list of Perl modules names that is <Perl::use>d
531 wakaba 1.52 by this code fragment, including all descendant nodes
532     except <Q::pc:package> nodes and their descendant nodes.
533 wakaba 1.15 @@Return:
534 wakaba 1.73 @@@Type: DISPerl|ARRAY
535 wakaba 1.15 @@@enDesc:
536     A list of module names. Note that the list is <EM::dead>;
537     any modification to it does not affect to the code fragment
538     and vice versa.
539     @@@PerlDef:
540 wakaba 1.35 __DEEP{
541 wakaba 1.52 __CODE{getNameListAttrRM::
542 wakaba 1.35 $node => {$self},
543     $attrName => 'useModuleName',
544     $result => {$r},
545     }__;
546     }__;
547 wakaba 1.15
548     @Method:
549 wakaba 1.22 @@Name: getUseCharClassNameList
550     @@enDesc:
551     Returns a list of Perl character class names that is <Perl::use>d
552 wakaba 1.52 by this code fragment, including all descendant nodes
553     except <Q::pc:package> nodes and their descendant nodes.
554 wakaba 1.22 @@Return:
555 wakaba 1.73 @@@Type: DISPerl|HASH
556 wakaba 1.22 @@@enDesc:
557     A list of module names. Note that the list is <EM::dead>;
558     any modification to it does not affect to the code fragment
559     and vice versa.
560     @@@PerlDef:
561 wakaba 1.35 my $mc;
562     __DEEP{
563 wakaba 1.52 __CODE{getNameListAttrRM::
564 wakaba 1.35 $node => {$self},
565     $attrName => 'useCharClassName',
566     $result => {$mc},
567     }__;
568     }__;
569     for (@$mc) {
570     my ($m, $c) = split /\./, $_, 2;
571     $r->{$m}->{$c} = true;
572     }
573 wakaba 1.22
574     @Method:
575 wakaba 1.19 @@Name: getRequirePerlModuleNameList
576     @@enDesc:
577     Returns a list of Perl modules names that is <Perl::require>d
578     by this code fragment, including all descendant nodes.
579     @@Return:
580 wakaba 1.73 @@@Type: DISPerl|ARRAY
581 wakaba 1.19 @@@enDesc:
582     A list of module names. Note that the list is <EM::dead>;
583     any modification to it does not affect to the code fragment
584     and vice versa.
585     @@@PerlDef:
586 wakaba 1.35 __DEEP{
587     __CODE{getNameListAttrR::
588     $node => {$self},
589     $attrName => 'requireModuleName',
590     $result => {$r},
591     }__;
592     }__;
593 wakaba 1.19
594     @Method:
595 wakaba 1.33 @@Name: getExceptionInterfacePackageNameList
596     @@enDesc:
597     Returns a list of Perl exception interface package names
598     by this code fragment, including all descendant nodes.
599     @@Return:
600 wakaba 1.73 @@@Type: DISPerl|ARRAY
601 wakaba 1.33 @@@enDesc:
602     A list of package names. Note that the list is <EM::dead>;
603     any modification to it does not affect to the code fragment
604     and vice versa.
605     @@@PerlDef:
606 wakaba 1.35 __DEEP{
607     __CODE{getNameListAttrR::
608     $node => {$self},
609     $attrName => 'exceptionInterfaceName',
610     $result => {$r},
611     }__;
612     }__;
613 wakaba 1.33
614     @Method:
615 wakaba 1.13 @@Name: disAddRequireURI
616     @@enDesc:
617     Adds a <QUOTE::dis> resource into the list of <Perl::require>d
618     resources of this code fragment.
619     @@Param:
620     @@@Name: uriArg
621 wakaba 1.35 @@@Type: DOMString
622 wakaba 1.13 @@@enDesc:
623     The URI reference of the resource to add.
624     @@Return:
625     @@@PerlDef:
626 wakaba 1.35 __DEEP{
627     __CODE{addNameListAttr::
628     $node => {$self},
629     $attrName => 'requireResourceURI',
630     $newName => {$uriArg},
631     }__;
632     }__;
633 wakaba 1.15
634     @Method:
635     @@Name: disGetRequireURIList
636     @@enDesc:
637     Returns a list of <QUOTE::dis> resource URI references that is
638     <Perl::require>d by this code fragment, including all descendant nodes.
639     @@Return:
640 wakaba 1.73 @@@Type: DISPerl|ARRAY
641 wakaba 1.15 @@@enDesc:
642     A list of resource URI references. Note that the list is <EM::dead>;
643     any modification to it does not affect to the code fragment
644     and vice versa.
645     @@@PerlDef:
646 wakaba 1.35 __DEEP{
647     __CODE{getNameListAttrR::
648     $node => {$self},
649     $attrName => 'requireResourceURI',
650     $result => {$r},
651     }__;
652     }__;
653    
654     @Method:
655 wakaba 1.36 @@ForCheck: ManakaiDOM|ForClass
656 wakaba 1.35 @@Operator: DISPerl|CloneMethod
657     @@Return:
658     @@@Type: PerlCode
659     @@@PerlDef:
660     __DEEP{
661     $r = $self-><M::Node.cloneNode> (true);
662     }__;
663 wakaba 1.66
664     @Method:
665     @@Name: addImplementedFeature
666     @@enDesc:
667     Adds a pair of feature name and version to the list
668     of features implemented by the code.
669     @@Param:
670     @@@Name: name
671     @@@Type: DOMString
672     @@@enDesc:
673     The name of the feature.
674     @@Param:
675     @@@Name: version
676     @@@Type: DOMString
677     @@@enDesc:
678     The version of the feature.
679     @@Return:
680     @@@PerlDef:
681     __DEEP{
682     my $feature = $self->owner_document->create_element_ns
683     (<Q::pc|>, 'hasFeature');
684     $feature->feature_name ($name);
685     $feature->feature_version ($version);
686     $self->append_child ($feature);
687     }__;
688    
689     @@Test:
690     @@@QName: PCElement.addImplementedFeature.1.test
691     @@@PerlDef:
692     my $doc;
693     __CODE{createPCDocumentForTest:: $doc => $doc}__;
694    
695     my $pack = $doc->create_pc_package ('PackageName');
696     $pack->add_implemented_feature ('feature-name', 'feature-version');
697    
698     $test->id ('child');
699     my $feature = $pack->last_child;
700     $test->assert_not_null ($feature);
701    
702     $test->id ('namespaceURI');
703     $test->assert_equals ($feature->namespace_uri, <Q::pc|>);
704    
705     $test->id ('localName');
706     $test->assert_equals ($feature->local_name, 'hasFeature');
707    
708     $test->id ('featureName');
709     $test->assert_equals ($feature->feature_name, 'feature-name');
710    
711     $test->id ('featureVersion');
712     $test->assert_equals ($feature->feature_version, 'feature-version');
713    
714     @Method:
715     @@Name: addImplementedElementType
716     @@enDesc:
717     Adds an element type to the list
718     of element type specific interfaces implemented by the code.
719     @@Param:
720     @@@Name: namespaceURI
721     @@@Type: DOMString
722     @@@enDesc:
723     The namespace URI of the element type.
724     @@@nullCase:
725     @@@@enDesc:
726     The element type does not belong to any namespace.
727     @@Param:
728     @@@Name: localName
729     @@@Type: DOMString
730     @@@enDesc:
731     The local name of the element type.
732     @@Return:
733     @@@PerlDef:
734     __DEEP{
735     my $et = $self->owner_document->create_element_ns
736     (<Q::pc|>, 'elementType');
737     $et->pc_namespace_uri ($namespaceURI);
738     $et->pc_local_name ($localName);
739     $self->append_child ($et);
740     }__;
741    
742     @@Test:
743     @@@QName: PCElement.addImplementedElementType.1.test
744     @@@PerlDef:
745     my $doc;
746     __CODE{createPCDocumentForTest:: $doc => $doc}__;
747    
748     my $pack = $doc->create_pc_package ('PackageName');
749     $pack->add_implemented_element_type ('feature-name', 'feature-version');
750    
751     $test->id ('child');
752     my $feature = $pack->last_child;
753     $test->assert_not_null ($feature);
754    
755     $test->id ('namespaceURI');
756     $test->assert_equals ($feature->namespace_uri, <Q::pc|>);
757    
758     $test->id ('localName');
759     $test->assert_equals ($feature->local_name, 'elementType');
760    
761     $test->id ('pcNamespaceURI');
762     $test->assert_equals ($feature->pc_namespace_uri, 'feature-name');
763    
764     $test->id ('pcLocalName');
765     $test->assert_equals ($feature->pc_local_name, 'feature-version');
766     @@Test:
767     @@@QName: PCElement.addImplementedElementType.2.test
768     @@@PerlDef:
769     my $doc;
770     __CODE{createPCDocumentForTest:: $doc => $doc}__;
771    
772     my $pack = $doc->create_pc_package ('PackageName');
773     $pack->add_implemented_element_type (undef, 'feature-version');
774    
775     $test->id ('child');
776     my $feature = $pack->last_child;
777     $test->assert_not_null ($feature);
778    
779     $test->id ('namespaceURI');
780 wakaba 1.67 $test->assert_equals ($feature->namespace_uri, <Q::pc|>);
781 wakaba 1.66
782     $test->id ('localName');
783     $test->assert_equals ($feature->local_name, 'elementType');
784    
785     $test->id ('pcNamespaceURI');
786 wakaba 1.67 $test->assert_equals ($feature->pc_namespace_uri, '');
787 wakaba 1.66
788     $test->id ('pcLocalName');
789     $test->assert_equals ($feature->pc_local_name, 'feature-version');
790    
791     @ToStringMethod:
792     @@Return:
793     @@@Type: DOMString
794     @@@PerlDef:
795     __DEEP{
796     for (@{$self->child_nodes}) {
797     $r .= $_;
798     }
799     }__;
800     ##PCCode
801 wakaba 1.1
802 wakaba 1.59 ResourceDef:
803     @QName: AnyPCElement
804     @DISCore:resourceType: s|AnyElementInNS
805     @AppName:
806     @@@: pc|*
807     @@ContentType: DISCore|QName
808    
809     ResourceDef:
810     @QName: AnyPC2Element
811     @DISCore:resourceType: s|AnyElementInNS
812     @AppName:
813     @@@: pc2|*
814     @@ContentType: DISCore|QName
815    
816 wakaba 1.35 ElementTypeBinding:
817     @Name: ETQName
818     @ElementType:
819     dis:AppName
820     @ShadowContent:
821     @@ForCheck: s|ForML
822     @@ContentType: DISCore|QName
823    
824     IFClsETDef:
825 wakaba 1.25 @IFQName: PerlFile
826 wakaba 1.35 @CQName: ManakaiPCFile
827     @ETQName: pc|file
828 wakaba 1.41 @QName:
829     @@@: pc|file
830     @@ForCheck: s|ForML
831 wakaba 1.25
832     @IFISA: PerlCode
833    
834     @IFISA: PerlCodeStatements
835 wakaba 1.35 @CISA: ManakaiPCCodeStatements
836 wakaba 1.25
837 wakaba 1.1 @enDesc:
838     Perl source code files.
839    
840     @Method:
841     @@Name: appendNewPackage
842     @@enDesc:
843     Appends a new package scope block.
844     @@Param:
845     @@@Name: packageName
846 wakaba 1.35 @@@Type: DOMString
847 wakaba 1.1 @@@enDesc:
848     The fully-qualified name of the package to create.
849     @@Return:
850 wakaba 1.25 @@@Type: PerlPackage
851 wakaba 1.1 @@@enDesc:
852     The newly created package scope object.
853     @@@PerlDef:
854 wakaba 1.35 __DEEP{
855     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
856     (<Q::pc:>, 'package');
857     $r-><AS::PerlPackage.packageName> ($packageName);
858     $self-><M::Node.appendChild> ($r);
859     }__;
860 wakaba 1.1
861     @Method:
862     @@Name: getLastPackage
863     @@enDesc:
864     Gets the last package scope block of a name.
865     @@Param:
866     @@@Name: packageName
867 wakaba 1.36 @@@@Type: DOMString
868 wakaba 1.1 @@@@enDesc:
869     The fully-qualified name of the package to get.
870     @@NamedParam:
871     @@@Name: makeNewPackage
872 wakaba 1.73 @@@Type: idl|boolean
873 wakaba 1.1 @@@enDesc:
874     Whether a new package scope object should be created if
875     no package of <P::packageName> found.
876     @@@TrueCase:
877     @@@@enDesc:
878     Makes a new object if not found.
879     @@@FalseCase:
880     @@@@enDesc:
881     Don't make a new object.
882     @@Return:
883 wakaba 1.25 @@@Type: PerlPackage
884 wakaba 1.1 @@@enDesc:
885     The last package scope object whose name is equal to
886     <P::packageName>.
887     @@@nullCase:
888     @@@@enDesc:
889     There is no <P::packageName> package object and
890     the <P::makeNewPackage> parameter is set to <DOM::false>.
891     @@@PerlDef:
892 wakaba 1.35 __DEEP{
893     for my $child (@{$self-><AG::Node.childNodes>}) {
894     if ($child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE> and
895     defined $child-><AG::Node.namespaceURI> and
896     $child-><AG::Node.namespaceURI> eq <Q::pc:> and
897     $child-><AG::Node.localName> eq 'package') {
898 wakaba 1.50 my $v = $child-><M::Element.getAttributeNS>
899     (<Q::pc:>, 'packageName');
900     if (defined $v and $v eq $packageName) {
901 wakaba 1.35 $r = $child;
902     }
903     }
904     }
905     if (not $r and $makeNewPackage) {
906     $r = $self-><M::PerlFile.appendNewPackage> ($packageName);
907     }
908     }__;
909 wakaba 1.1
910 wakaba 1.35 @ATTR:
911 wakaba 1.1 @@Name: sourceFile
912 wakaba 1.35 @@ATTRQName: pc|sourceFile
913 wakaba 1.1 @@enDesc:
914     The file name of the source file from which this
915     Perl code is primary generated.
916 wakaba 1.35 @@ReflectCDATA:
917 wakaba 1.1 @@Get:
918     @@Set:
919    
920 wakaba 1.35 @ATTR:
921 wakaba 1.1 @@Name: sourceModule
922 wakaba 1.35 @@ATTRQName: pc|sourceModule
923 wakaba 1.1 @@enDesc:
924     The name URI reference of the source module that this package defines.
925 wakaba 1.35 @@ReflectCDATA:
926 wakaba 1.1 @@Get:
927     @@Set:
928    
929 wakaba 1.35 @ATTR:
930 wakaba 1.1 @@Name: sourceFor
931 wakaba 1.35 @@ATTRQName: pc|sourceFor
932 wakaba 1.1 @@enDesc:
933     The URI reference of the source module <QUOTE::for> for which this
934     package is.
935 wakaba 1.35 @@ReflectCDATA:
936 wakaba 1.1 @@Get:
937     @@Set:
938    
939     @ToStringMethod:
940     @@Return:
941 wakaba 1.35 @@@Type: DOMString
942 wakaba 1.1 @@@enDesc:
943     The Perl code generated.
944     @@@PerlDef:
945 wakaba 1.35 __DEEP{
946     ## -- Header
947     $r = qq<#!/usr/bin/perl \n>;
948 wakaba 1.36 $r .= <ClassM::ManakaiPCImplementation.perlComment>
949 wakaba 1.35 (q<This file is automatically generated>);
950 wakaba 1.36 $r .= <ClassM::ManakaiPCImplementation.perlComment>
951     (q< at >.<ClassM::ManakaiPCImplementation
952 wakaba 1.35 .rfc3339DateTime> (time).q<,>);
953 wakaba 1.36 $r .= <ClassM::ManakaiPCImplementation.perlComment>
954 wakaba 1.35 (q< from file ">.$self-><AG::PerlFile.sourceFile>.q<",>);
955 wakaba 1.36 $r .= <ClassM::ManakaiPCImplementation.perlComment>
956 wakaba 1.35 (q[ module <].$self-><AG::PerlFile.sourceModule>.q[>,]);
957 wakaba 1.36 $r .= <ClassM::ManakaiPCImplementation.perlComment>
958 wakaba 1.35 (q[ for <].$self-><AG::PerlFile.sourceFor>.q[>.]);
959 wakaba 1.36 $r .= <ClassM::ManakaiPCImplementation.perlComment>
960 wakaba 1.35 (q<Don't edit by hand!>);
961     $r .= qq<use strict;\n>;
962     $self-><AS::PerlFile.currentPackage> ('main');
963    
964 wakaba 1.52 ## -- |require| Perl Modules
965 wakaba 1.35 my $req = $self-><M::PerlCode.getRequirePerlModuleNameList>;
966     for my $pack (sort {$a cmp $b} @$req) {
967     $r .= qq<require $pack;\n>;
968     }
969    
970 wakaba 1.52 ## -- |use| Perl Modules
971     for my $pack (sort {$a cmp $b} @{$self-><M::PerlCode
972     .getUsePerlModuleNameList>}) {
973     $r .= 'use ' . $pack . ";\n";
974     }
975    
976     ## -- |use| Character Classes
977     my $cls = $self-><M::PerlCode.getUseCharClassNameList>;
978     for my $pack (sort {$a cmp $b} keys %$cls) {
979     $r .= 'use ' . $pack . ' ' .
980     <ClassM::ManakaiPCImplementation.perlList>
981     ([sort {$a cmp $b} grep {$cls->{$pack}->{$_}}
982     keys %{$cls->{$pack}}]) . ";\n";
983     }
984    
985 wakaba 1.35 ## -- Packages and global objects
986     my $pack = {};
987     for my $child (@{$self-><AG::Node.childNodes>}) {
988     $r .= $child->stringify;
989     if ($child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE> and
990     defined $child-><AG::Node.namespaceURI> and
991     $child-><AG::Node.namespaceURI> eq <Q::pc:> and
992     $child-><AG::Node.localName> eq 'package') {
993     for my $ipack (@{$child-><M::PerlPackage
994     .getImplementPackageNameList>}) {
995     $pack->{$ipack} ||= true; # not defined
996     }
997     $pack->{$child-><AG::PerlPackage.packageName>} = []; # defined
998     }
999     }
1000    
1001     ## -- Exception interface packages
1002     for (sort {$a cmp $b} @{$self-><M::PerlCode
1003     .getExceptionInterfacePackageNameList>}) {
1004     next if ref $pack->{$_};
1005     $pack->{$_} = [];
1006     $r .= sprintf q<push @%s::ISA, 'Message::Util::Error' >.
1007     q<unless @%s::ISA;%s>, $_, $_, "\n";
1008     }
1009    
1010     ## -- Enables interface packages
1011     my @packs = map {'$' . $_ . '::'}
1012     sort {$a cmp $b}
1013     grep {not ref $pack->{$_} and $pack->{$_}}
1014     keys %$pack;
1015     $r .= q<for (>. join (', ', @packs) . qq<){}\n> if @packs;
1016    
1017     ## -- Footer
1018 wakaba 1.36 $r .= <ClassM::ManakaiPCImplementation.perlComment>
1019 wakaba 1.35 (q[License: <].$self-><AG::PerlFile.licenseURI>.qq[>\n]);
1020     $r .= qq<1;\n>;
1021     }__;
1022 wakaba 1.1
1023 wakaba 1.59 @ATTR:
1024 wakaba 1.1 @@Name: currentPackage
1025 wakaba 1.59 @@ATTRQName: pc|currentPackage
1026 wakaba 1.1 @@enDesc:
1027     The current Perl package (used in stringify method).
1028 wakaba 1.59 @@ReflectCDATA:
1029 wakaba 1.1 @@Get:
1030     @@Set:
1031    
1032 wakaba 1.35 @ATTR:
1033 wakaba 1.2 @@Name: licenseURI
1034 wakaba 1.36 @@ATTRQName: pc|license
1035 wakaba 1.2 @@enDesc:
1036     The license term URI reference for this code.
1037 wakaba 1.35 @@ReflectCDATA:
1038 wakaba 1.2 @@Get:
1039     @@Set:
1040 wakaba 1.1 ##PerlFile
1041    
1042 wakaba 1.35 ElementTypeBinding:
1043     @Name: ReflectCDATA
1044     @ElementType:
1045     dis:Type
1046     @ShadowContent:
1047     @@@: DOMString
1048     @ShadowSibling:
1049     @@actualType: CDATADOMString
1050    
1051 wakaba 1.64 ElementTypeBinding:
1052     @Name: ReflectCDATA2
1053     @ElementType:
1054     dis:Type
1055     @ShadowContent:
1056     @@@: DOMString
1057     @ShadowSibling:
1058     @@actualType: CDATADOMString2
1059    
1060 wakaba 1.35 ResourceDef:
1061     @QName: DOMString
1062 wakaba 1.73 @AliasFor: DOMMain|DOMString
1063 wakaba 1.35
1064     ReflectTypeDef:
1065     @QName: CDATADOMString
1066     @enDesc:
1067 wakaba 1.64 <TYPE::DOMString> for DOM attributes reflecting
1068 wakaba 1.35 <SGML::CDATA> element attributes.
1069 wakaba 1.59 @subsetOf: DOMString
1070 wakaba 1.35 @ResourceDef:
1071 wakaba 1.64 @@DISCore:resourceType: DOMMain|ReflectGet
1072 wakaba 1.35 @@enDesc:
1073     The DOM attribute returns the current value of the element attribute
1074     in a transparent, case-sensitive manner.
1075     \
1076     If the element attribute is absent, the default value, if any,
1077     or an empty string is returned.
1078     @@PerlCDef:
1079 wakaba 1.59 __DEEP{
1080     $r = $self-><M::Element.getAttributeNS> ($NS_URI, $LOCAL_NAME);
1081     $r = '' unless defined $r;
1082 wakaba 1.35 }__;
1083 wakaba 1.37
1084 wakaba 1.35 @ResourceDef:
1085     @@QName: CDATADOMStringSet
1086 wakaba 1.64 @@DISCore:resourceType: DOMMain|ReflectSet
1087     @@enDesc:
1088     The corresponding element attribute is set to the given value,
1089     in a transparent, case-sensitive manner.
1090     @@ImplNote:
1091     @@@lang:en
1092     @@@@:
1093     What will happen if the <DOM::null> value is given?
1094     @@PerlCDef:
1095     __DEEP{
1096     if (defined $given) {
1097     $self-><M::Element.setAttributeNS>
1098     ($NS_URI, $QNAME, $given);
1099     } else {
1100     $self-><M::Element.removeAttributeNS> ($NS_URI, $LOCAL_NAME);
1101     }
1102     }__;
1103    
1104     ReflectTypeDef:
1105     @QName: CDATADOMString2
1106     @enDesc:
1107     <TYPE::DOMString> for DOM attributes reflecting
1108     <SGML::CDATA> element attributes.
1109     @subsetOf: DOMString
1110     @ResourceDef:
1111     @@DISCore:resourceType: DOMMain|ReflectGet
1112     @@enDesc:
1113     The DOM attribute returns the current value of the element attribute
1114     in a transparent, case-sensitive manner.
1115     \
1116     If the element attribute is absent, the default value, if any,
1117     or <DOM::null> is returned.
1118     @@PerlCDef:
1119     __DEEP{
1120     $r = $self-><M::Element.getAttributeNS> ($NS_URI, $LOCAL_NAME);
1121     }__;
1122    
1123     @ResourceDef:
1124     @@DISCore:resourceType: DOMMain|ReflectSet
1125 wakaba 1.35 @@enDesc:
1126     The corresponding element attribute is set to the given value,
1127     in a transparent, case-sensitive manner.
1128     @@ImplNote:
1129     @@@lang:en
1130     @@@@:
1131     What will happen if the <DOM::null> value is given?
1132     @@PerlCDef:
1133 wakaba 1.59 __DEEP{
1134     if (defined $given) {
1135     $self-><M::Element.setAttributeNS>
1136     ($NS_URI, $QNAME, $given);
1137     } else {
1138     $self-><M::Element.removeAttributeNS> ($NS_URI, $LOCAL_NAME);
1139     }
1140     }__;
1141 wakaba 1.35
1142     ElementTypeBinding:
1143     @Name: ReflectTypeDef
1144     @ElementType:
1145     dis:ResourceDef
1146     @ShadowContent:
1147     @@rdf:type: DISLang|DataType
1148    
1149     ElementTypeBinding:
1150     @Name: ATTR
1151     @ElementType:
1152     dis:ResourceDef
1153     @ShadowContent:
1154     @@rdf:type:
1155     @@@@: s|Attribute
1156     @@@ForCheck: s|ForML
1157     @@rdf:type:
1158     @@@@: DISLang|Attribute
1159     @@@ForCheck: ManakaiDOM|ForClass
1160     @@rdf:type:
1161     @@@@: DISLang|Attribute
1162     @@@ForCheck: ManakaiDOM|ForIF
1163     @@DocAttr:
1164     @@@@: ||+||s|ForML
1165     @@@ContentType: DISCore|TFPQNames
1166     @@@ForCheck: ManakaiDOM|ForClass
1167     @@DocAttr:
1168     @@@@: ||+||s|ForML
1169     @@@ContentType: DISCore|TFPQNames
1170     @@@ForCheck: ManakaiDOM|ForIF
1171    
1172     ElementTypeBinding:
1173     @Name: ATTRQName
1174     @ElementType:
1175     dis:AppName
1176     @ShadowContent:
1177     @@ForCheck: s|ForML
1178     @@ContentType: DISCore|QName
1179    
1180     IFClsETDef:
1181 wakaba 1.25 @IFQName: PerlPackage
1182 wakaba 1.35 @CQName: ManakaiPCPackage
1183     @ETQName: pc|package
1184 wakaba 1.25
1185     @IFISA: PerlCode
1186    
1187     @IFISA: PerlCodeStatements
1188 wakaba 1.35 @CISA: ManakaiPCCodeStatements
1189 wakaba 1.16
1190     @enDesc:
1191     A Perl lexical lines for which a <Perl::package> declaration
1192     in effect.
1193 wakaba 1.1
1194 wakaba 1.35 @ATTR:
1195 wakaba 1.1 @@Name: packageName
1196 wakaba 1.35 @@ATTRQName: pc|packageName
1197     @@ReflectCDATA:
1198 wakaba 1.1 @@enDesc:
1199     The fully-qualified package name.
1200     @@Get:
1201 wakaba 1.35 @@Set:
1202 wakaba 1.1
1203     @Method:
1204     @@Name: getSub
1205     @@enDesc:
1206     Gets a subroutine.
1207     @@Param:
1208     @@@Name: subName
1209 wakaba 1.36 @@@Type: DOMString
1210 wakaba 1.1 @@@enDesc:
1211     The name of subroutine to get.
1212     @@NamedParam:
1213     @@@Name: makeNewNode
1214 wakaba 1.73 @@@Type: idl|boolean
1215 wakaba 1.1 @@@enDesc:
1216     Whether a new subroutine object should be created,
1217     if it is not exist, or not.
1218     @@Return:
1219 wakaba 1.25 @@@Type: PerlSub
1220 wakaba 1.1 @@@enDesc:
1221     The subroutine object.
1222 wakaba 1.4 @@@nullCase:
1223     @@@@enDesc:
1224     Either the specified subroutine is not found and
1225     the <P::makeNewNode> parameter is set to <DOM::false> or
1226     the subroutine is defined as an alias.
1227 wakaba 1.1 @@@PerlDef:
1228 wakaba 1.35 __DEEP{
1229     F: {
1230     for my $child (@{$self-><AG::Node.childNodes>}) {
1231     if ($child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE> and
1232     defined $child-><AG::Node.namespaceURI> and
1233     $child-><AG::Node.namespaceURI> eq <Q::pc:> and
1234     $child-><AG::Node.localName> eq 'sub') {
1235     if ($child-><M::PerlSub.hasPerlName> ($subName)) {
1236     $r = $child;
1237     last F;
1238     }
1239     }
1240     }
1241     if ($makeNewNode) {
1242     $r = $self-><AG::Node.ownerDocument>
1243     -><M::Document.createElementNS>
1244     (<Q::pc:>, 'sub');
1245     $r-><M::PerlSub.addPerlName> ($subName);
1246     $self-><M::Node.appendChild> ($r);
1247     }
1248     } # F
1249     }__;
1250 wakaba 1.1
1251 wakaba 1.4 @Method:
1252 wakaba 1.13 @@Name: addISAPackage
1253 wakaba 1.1 @@enDesc:
1254     Adds a class package that this class inherits.
1255     @@Param:
1256     @@@Name: packageName
1257 wakaba 1.35 @@@Type: DOMString
1258 wakaba 1.1 @@@enDesc:
1259     The name of package to add.
1260     @@Return:
1261     @@@PerlDef:
1262 wakaba 1.50 __DEEP{
1263     my $v = $self-><M::Element.getAttributeNS> (<Q::pc:>, 'extends');
1264     $self-><M::Element.setAttributeNS>
1265 wakaba 1.35 (<Q::pc:>, 'pc:extends' =>
1266 wakaba 1.50 join ' ', (split /\s+/, defined $v ? $v : ''), $packageName);
1267     }__;
1268 wakaba 1.35
1269     @Method:
1270     @@Name: getISAPackageNameList
1271     @@enDesc:
1272     Returns a list of names of packages extended by the package.
1273     @@Return:
1274 wakaba 1.73 @@@Type: DISPerl|ARRAY
1275 wakaba 1.35 @@@enDesc:
1276     An ordered snapshot list of superpackage names.
1277     @@@PerlDef:
1278     __DEEP{
1279 wakaba 1.50 my $v = $self-><M::Element.getAttributeNS> (<Q::pc:>, 'extends');
1280     $r = [split /\s+/, defined $v ? $v : ''];
1281 wakaba 1.35 }__;
1282 wakaba 1.1
1283     @Method:
1284 wakaba 1.65 @@Name: addRevISAPackage
1285     @@enDesc:
1286     Adds a class package name into the list of the package
1287     name of classes extending this class.
1288     @@Param:
1289     @@@Name: packageName
1290     @@@Type: DOMString
1291     @@@enDesc:
1292     The package name of the class added to the list.
1293     @@Return:
1294     @@@PerlDef:
1295     __DEEP{
1296     my $v = $self->get_attribute_ns (<Q::pc:>, 'extending-classes');
1297     $self->set_attribute_ns
1298     (<Q::pc:>, 'pc:extending-classes' =>
1299     join ' ', (split /\s+/, defined $v ? $v : ''), $packageName);
1300     }__;
1301    
1302     @Method:
1303     @@Name: getRevISAPackageNameList
1304     @@enDesc:
1305     Returns a snapshot list of the package names
1306     of the classes extending this class.
1307     @@Return:
1308 wakaba 1.73 @@@Type: DISPerl|ARRAY
1309 wakaba 1.65 @@@enDesc:
1310     An ordered snapshot list of superpackage names.
1311     @@@PerlDef:
1312     __DEEP{
1313     my $v = $self->get_attribute_ns (<Q::pc:>, 'extending-classes');
1314     $r = [split /\s+/, defined $v ? $v : ''];
1315     }__;
1316    
1317     @Method:
1318 wakaba 1.1 @@Name: addImplementPackage
1319     @@enDesc:
1320     Adds a interface package that this class implements.
1321     @@Param:
1322     @@@Name: packageName
1323 wakaba 1.35 @@@Type: DOMString
1324 wakaba 1.1 @@@enDesc:
1325     The name of package to add.
1326     @@Return:
1327     @@@PerlDef:
1328 wakaba 1.35 __DEEP{
1329     __CODE{addNameListAttr::
1330     $node => {$self},
1331     $attrName => 'implements',
1332     $newName => {$packageName},
1333     }__;
1334     }__;
1335    
1336     @Method:
1337     @@Name: getImplementPackageNameList
1338     @@enDesc:
1339     Returns a list of names of packages implemented by the package.
1340     @@Return:
1341 wakaba 1.73 @@@Type: DISPerl|ARRAY
1342 wakaba 1.35 @@@enDesc:
1343     An unordered snapshot list of interface packages.
1344     @@@PerlDef:
1345     __DEEP{
1346     __CODE{getNameListAttr::
1347     $node => {$self},
1348     $attrName => 'implements',
1349     $result => {$r},
1350     }__;
1351     }__;
1352 wakaba 1.1
1353     @ToStringMethod:
1354     @@Return:
1355 wakaba 1.35 @@@Type: DOMString
1356 wakaba 1.1 @@@enDesc:
1357     Perl code.
1358     @@@PerlDef:
1359 wakaba 1.35 __DEEP{
1360     my $file = $self-><AG::PerlCode.fileNode>;
1361    
1362     ## Package name
1363     my $pn = $self-><AG::PerlPackage.packageName>;
1364     $r .= q<package > . $pn . ";\n";
1365     $file-><AS::PerlFile.currentPackage> ($pn) if $file;
1366    
1367     ## Package version
1368     $r .= 'our $VERSION = '.
1369 wakaba 1.36 <ClassM::ManakaiPCImplementation.versionDateTime> (time).
1370 wakaba 1.35 ";\n";
1371    
1372     ## Inheritance
1373     my @isa = (@{$self-><M::PerlPackage.getISAPackageNameList>},
1374     sort {$a cmp $b} @{$self-><M::PerlPackage
1375     .getImplementPackageNameList>});
1376     if (@isa) {
1377     $r .= 'push our @ISA, ' .
1378 wakaba 1.36 <ClassM::ManakaiPCImplementation.perlList> (\@isa) .
1379 wakaba 1.35 ";\n";
1380     }
1381    
1382 wakaba 1.65 for my $pack_name (@{$self->get_rev_isa_package_name_list}) {
1383     $r .= 'push @' . $pack_name . '::ISA, q<' . $pn .
1384 wakaba 1.66 "> unless $pack_name->isa (q<$pn>);\n";
1385 wakaba 1.65 }
1386    
1387 wakaba 1.52 ## |use| Perl Modules
1388 wakaba 1.35 for my $pack (sort {$a cmp $b} @{$self-><M::PerlCode
1389     .getUsePerlModuleNameList>}) {
1390     $r .= 'use ' . $pack . ";\n";
1391     }
1392    
1393 wakaba 1.52 ## |use| Character Classes
1394 wakaba 1.35 my $cls = $self-><M::PerlCode.getUseCharClassNameList>;
1395     for my $pack (sort {$a cmp $b} keys %$cls) {
1396     $r .= 'use ' . $pack . ' ' .
1397 wakaba 1.36 <ClassM::ManakaiPCImplementation.perlList>
1398 wakaba 1.35 ([sort {$a cmp $b} grep {$cls->{$pack}->{$_}}
1399     keys %{$cls->{$pack}}]) . ";\n";
1400     }
1401    
1402     ## Package-scope objects
1403     my $has_bool;
1404     my $op = '';
1405     for my $child (@{$self-><AG::Node.childNodes>}) {
1406     if ($child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE> and
1407     defined $child-><AG::Node.namespaceURI> and
1408     $child-><AG::Node.namespaceURI> eq <Q::pc:>) {
1409     my $ln = $child-><AG::Node.localName>;
1410     if ($ln eq 'sub') {
1411     my $names = $child-><M::PerlSub.getPerlNameList>;
1412     my $ops = $child-><M::PerlSub.getPerlOperatorList>;
1413     if (@$names) {
1414     $r .= $child->stringify;
1415     if (@$names > 1) {
1416     $r .= sprintf q<*%s = \&%s;%s>,
1417     $_, $names->[0], "\n" for @$names[1..$#$names];
1418     }
1419     for (@$ops) {
1420     $op .= sprintf q['%s' => '%s', %s],
1421     $_ => $names->[0], "\n";
1422     $has_bool = true if $_ eq 'bool';
1423     }
1424     } else {
1425     my $v = $child->stringify;
1426     for (@$ops) {
1427     $op .= sprintf q['%s' => %s, %s], $_ => $v, "\n";
1428     $has_bool = true if $_ eq 'bool';
1429     }
1430     }
1431     } else {
1432     $r .= $child->stringify;
1433     }
1434 wakaba 1.49 } elsif ($child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>) {
1435     $r .= $child;
1436     }
1437 wakaba 1.35 } # children
1438    
1439     if (length $op) {
1440     $r .= "use overload \n";
1441     $r .= "bool => sub () {1}, \n" unless $has_bool;
1442     $r .= $op . "fallback => 1;\n";
1443     }
1444    
1445     ## -- Exports
1446     my $xport = $self-><M::PerlPackage.getExportList>;
1447     if (map {values %$_} values %$xport) {
1448     $r .= q[our %EXPORT_TAG = (] .
1449 wakaba 1.36 <ClassM::ManakaiPCImplementation.perlList>
1450 wakaba 1.35 ([map {$_ => [sort {$a cmp $b} keys %{$xport->{$_}}]}
1451     sort {$a cmp $b} grep {length}
1452     keys %$xport]) . qq[);\n];
1453     $r .= q[our @EXPORT_OK = (] .
1454 wakaba 1.36 <ClassM::ManakaiPCImplementation.perlList>
1455 wakaba 1.35 ([map {sort {$a cmp $b} keys %{$xport->{$_}}}
1456     sort {$a cmp $b} keys %$xport]) . qq[);\n];
1457     $r .= q[use Exporter; push our @ISA, 'Exporter';] . qq[\n];
1458     }
1459     }__;
1460    
1461     @Method:
1462     @@Name: getExportList
1463     @@enDesc:
1464     Returns a list of export tag and names.
1465     @@Return:
1466 wakaba 1.73 @@@Type: DISPerl|HASH
1467 wakaba 1.35 @@@enDesc:
1468     Snapshot list of lists.
1469     @@@PerlDef:
1470     my $mc;
1471     __DEEP{
1472     __CODE{getNameListAttr::
1473     $node => {$self},
1474     $attrName => 'export',
1475     $result => {$mc},
1476     }__;
1477     }__;
1478     for (@$mc) {
1479     my ($m, $c) = split /\./, $_, 2;
1480     $r->{$m}->{$c} = true;
1481     }
1482 wakaba 1.18
1483     @Method:
1484     @@Name: addExport
1485     @@enDesc:
1486 wakaba 1.26 Adds a name to the list of exported items (<Perl::@EXPORT_OK>).
1487 wakaba 1.18 @@Param:
1488     @@@Name: exportTag
1489 wakaba 1.35 @@@Type: DOMString
1490 wakaba 1.18 @@@enDesc:
1491     The name of the tag (without <CHAR::COLON> prefix).
1492     The <P::exportName> is added both to <Perl::@EXPORT_OK>
1493     and <Perl::$EXPORT_OK{<P::exportTag>}>.
1494     @@@nullCase:
1495     @@@@enDesc:
1496     The <P::exportName> is added only to the <Perl::@EXPORT_OK>.
1497     @@Param:
1498     @@@Name: exportName
1499 wakaba 1.35 @@@Type: DOMString
1500 wakaba 1.18 @@@enDesc:
1501     The name to be exported.
1502     @@Return:
1503     @@@PerlDef:
1504 wakaba 1.35 __DEEP{
1505     __CODE{addNameListAttr::
1506     $node => {$self},
1507     $attrName => 'export',
1508     $newName => {$exportTag.'.'.$exportName},
1509     }__;
1510     }__;
1511 wakaba 1.36 ##PCPackage
1512 wakaba 1.4
1513 wakaba 1.35 IFClsETDef:
1514 wakaba 1.25 @IFQName: PerlCodeStatements
1515 wakaba 1.35 @CQName: ManakaiPCCodeStatements
1516     @ETQName:
1517     @@@: pc|statementContainer
1518     @@ImplNote:
1519     @@@lang:en
1520     @@@@: Dummy.
1521 wakaba 1.25
1522     @IFISA: PerlCodeUnits
1523 wakaba 1.35 @CISA: ManakaiPCCodeUnits
1524 wakaba 1.36
1525 wakaba 1.1 @enDesc:
1526 wakaba 1.6 A base class for node types that contains zero or more
1527     statements and/or blocks.
1528 wakaba 1.1
1529     @Method:
1530     @@Name: appendCode
1531     @@enDesc:
1532     Appends an unparsed Perl code fragment.
1533     @@Param:
1534     @@@Name: codeArg
1535 wakaba 1.35 @@@Type: DOMString
1536 wakaba 1.1 @@@enDesc:
1537     An unparsed Perl code fragment.
1538     @@Return:
1539 wakaba 1.25 @@@Type: PerlUnparsedCode
1540 wakaba 1.1 @@@enDesc:
1541     The newly created Perl code object.
1542     @@@PerlDef:
1543 wakaba 1.35 __DEEP{
1544     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
1545     (<Q::pc:>, 'unparsed');
1546     $r-><AS::Node.textContent> ($codeArg);
1547     $self-><M::Node.appendChild> ($r);
1548     }__;
1549 wakaba 1.1
1550 wakaba 1.35 @ATTR:
1551 wakaba 1.8 @@Name: label
1552 wakaba 1.35 @@ATTRQName: pc|label
1553 wakaba 1.8 @@enDesc:
1554     Label for this block.
1555 wakaba 1.35 @@ReflectCDATA:
1556 wakaba 1.8 @@Get:
1557     @@@nullCase:
1558     @@@@enDesc:
1559     No label.
1560     @@Set:
1561     @@@nullCase:
1562     @@@@enDesc:
1563     No label.
1564    
1565     @Method:
1566     @@Name: appendBlock
1567     @@enDesc:
1568     Appends a Perl block code.
1569     @@Return:
1570 wakaba 1.25 @@@Type: PerlBlock
1571 wakaba 1.8 @@@enDesc:
1572     The newly created Perl code object.
1573     @@@PerlDef:
1574 wakaba 1.35 __DEEP{
1575     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
1576     (<Q::pc:>, 'block');
1577     $self-><M::Node.appendChild> ($r);
1578     }__;
1579 wakaba 1.8
1580     @Method:
1581     @@Name: appendStatement
1582     @@enDesc:
1583     Appends a Perl statement.
1584     @@Param:
1585     @@@Name: codeArg
1586 wakaba 1.36 @@@Type: DOMString
1587 wakaba 1.8 @@@enDesc:
1588     A Perl statement without terminating <Perl::;>.
1589     @@@nullCase:
1590     @@@@enDesc:
1591     No initial content.
1592     @@Return:
1593 wakaba 1.25 @@@Type: PerlStatement
1594 wakaba 1.8 @@@enDesc:
1595     The newly created Perl code object.
1596     @@@PerlDef:
1597 wakaba 1.35 __DEEP{
1598     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
1599     (<Q::pc:>, 'statement');
1600     if (defined $codeArg) {
1601     $r-><M::PerlCodeUnits.appendBare> ($codeArg);
1602     }
1603     $self-><M::Node.appendChild> ($r);
1604     }__;
1605 wakaba 1.12
1606     @Method:
1607 wakaba 1.44 @@Name: appendNewPCBlock
1608     @@enDesc:
1609     Creates a <Q::pc2:block> and appends it to the node.
1610     @@Return:
1611     @@@Type: PCBlock
1612     @@@enDesc:
1613     The newly created block element.
1614     @@@PerlDef:
1615     __DEEP{
1616     $r = $self-><AG::Node.ownerDocument>-><M::PCDocument.createPCBlock>;
1617     $self-><M::Node.appendChild> ($r);
1618     }__;
1619    
1620     @Method:
1621     @@Name: appendNewPCChoose
1622     @@enDesc:
1623     Creates a <Q::pc:choose> and appends it to the node.
1624     @@Return:
1625     @@@Type: PCChoose
1626     @@@enDesc:
1627     The newly created choose element.
1628     @@@PerlDef:
1629     __DEEP{
1630     $r = $self-><AG::Node.ownerDocument>-><M::PCDocument.createPCChoose>;
1631     $self-><M::Node.appendChild> ($r);
1632     }__;
1633    
1634     @Method:
1635 wakaba 1.45 @@Name: appendNewPCWhile
1636     @@enDesc:
1637     Creates a <Q::pc:while> and appends it to the node.
1638     @@Return:
1639     @@@Type: PCWhile
1640     @@@enDesc:
1641     The newly created while element.
1642     @@@PerlDef:
1643     __DEEP{
1644     $r = $self-><AG::Node.ownerDocument>-><M::PCDocument.createPCWhile>;
1645     $self-><M::Node.appendChild> ($r);
1646     }__;
1647    
1648     @Method:
1649 wakaba 1.12 @@Name: appendNewIf
1650     @@enDesc:
1651     Appends a newly created <Class::ManakaiPerlIf> object.
1652     @@Param:
1653     @@@Name: conditionArg
1654 wakaba 1.25 @@@Type: PerlCode
1655 wakaba 1.12 @@@enDesc:
1656     Conditoon code fragment object.
1657     @@Param:
1658     @@@Name: trueArg
1659 wakaba 1.25 @@@Type: PerlCode
1660 wakaba 1.12 @@@enDesc:
1661     A true code fragment object.
1662     @@@nullCase:
1663     @@@@enDesc: No true code.
1664     @@Param:
1665     @@@Name: falseArg
1666 wakaba 1.25 @@@Type: PerlCode
1667 wakaba 1.12 @@@enDesc:
1668     A false code fragment object.
1669     @@@nullCase:
1670     @@@@enDesc: No false code.
1671     @@Return:
1672 wakaba 1.36 @@@Type: PerlIf
1673 wakaba 1.35 @@@enDesc:
1674     The newly created element.
1675 wakaba 1.61 @@@PerlDef:
1676 wakaba 1.35 __DEEP{
1677     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
1678     (<Q::pc:>, 'if');
1679     $r-><AS::PerlIf.condition> ($conditionArg);
1680     $r-><AS::PerlIf.trueCode> ($trueArg) if $trueArg;
1681     $r-><AS::PerlIf.falseCode> ($falseArg) if $falseArg;
1682     $self-><M::Node.appendChild> ($r);
1683     }__;
1684     ##PCIf
1685    
1686     IFClsETDef:
1687 wakaba 1.25 @IFQName: PerlSub
1688 wakaba 1.35 @CQName: ManakaiPCSub
1689     @ETQName: pc|sub
1690 wakaba 1.25
1691     @IFISA: PerlCode
1692    
1693     @IFISA: PerlCodeStatements
1694 wakaba 1.35 @CISA: ManakaiPCCodeStatements
1695 wakaba 1.25
1696 wakaba 1.6 @enDesc:
1697 wakaba 1.36 Perl subroutines.
1698 wakaba 1.20
1699 wakaba 1.6 @Attr:
1700 wakaba 1.35 @@Name: pcLocalName
1701 wakaba 1.6 @@enDesc:
1702     The name of this subroutine.
1703 wakaba 1.35 @@Type: DOMString
1704 wakaba 1.6 @@Get:
1705     @@@nullCase:
1706     @@@@enDesc:
1707     This subroutine has no name.
1708 wakaba 1.35 @@@PerlDef:
1709     __DEEP{
1710     $r = $self-><M::PerlSub.getPerlNameList>->[0];
1711     }__;
1712 wakaba 1.6
1713 wakaba 1.35 @Method:
1714     @@Name: addPerlName
1715     @@enDesc:
1716     Adds a subroutine name.
1717     @@Param:
1718     @@@Name: subName
1719     @@@Type: DOMString
1720     @@@enDesc: The name to add.
1721     @@Return:
1722     @@@PerlDef:
1723     __DEEP{
1724     __CODE{addNameListAttr::
1725     $node => {$self},
1726     $attrName => 'localName',
1727     $newName => {$subName},
1728     }__;
1729     }__;
1730    
1731     @Method:
1732     @@Name: getPerlNameList
1733     @@enDesc:
1734     Returns a list of names of the subroutine.
1735     @@Return:
1736 wakaba 1.73 @@@Type: DISPerl|ARRAY
1737 wakaba 1.35 @@@enDesc:
1738     An unordered snapshot list of names.
1739     @@@PerlDef:
1740     __DEEP{
1741     __CODE{getNameListAttr::
1742     $node => {$self},
1743     $attrName => 'localName',
1744     $result => {$r},
1745     }__;
1746     }__;
1747    
1748     @Method:
1749     @@Name: hasPerlName
1750     @@enDesc:
1751     Returns whether the subroutine has a name or not.
1752     @@Param:
1753     @@@Name: subName
1754     @@@Type: DOMString
1755     @@@enDesc: The name.
1756     @@Return:
1757 wakaba 1.73 @@@Type: idl|boolean
1758 wakaba 1.35 @@@PerlDef:
1759     __DEEP{
1760     my $l;
1761     __CODE{getNameListAttr::
1762     $node => {$self},
1763     $attrName => 'localName',
1764     $result => {$l},
1765     }__;
1766     F: for (@$l) {
1767     if ($_ eq $subName) {
1768     $r = true;
1769     last F;
1770     }
1771     }
1772     }__;
1773    
1774     @Method:
1775 wakaba 1.47 @@Name: clearPerlName
1776     @@enDesc:
1777     Removes all Perl name associated to the <IF::PerlSub>.
1778     @@Return:
1779     @@@PerlDef:
1780     __DEEP{
1781     $self-><M::Element.removeAttributeNS> (<Q::pc:>, 'localName');
1782     }__;
1783    
1784     @Method:
1785 wakaba 1.35 @@Name: addPerlOperator
1786     @@enDesc:
1787     Adds an operator overloaded by the method.
1788     @@Param:
1789     @@@Name: op
1790     @@@Type: DOMString
1791     @@@enDesc: The operator to add.
1792     @@Return:
1793     @@@PerlDef:
1794     __DEEP{
1795     __CODE{addNameListAttr::
1796     $node => {$self},
1797     $attrName => 'operator',
1798     $newName => {$op},
1799     }__;
1800     }__;
1801    
1802     @Method:
1803     @@Name: getPerlOperatorList
1804     @@enDesc:
1805     Returns a list of operators of the subroutine.
1806     @@Return:
1807 wakaba 1.73 @@@Type: DISPerl|ARRAY
1808 wakaba 1.35 @@@enDesc:
1809     An unordered snapshot list of operators.
1810     @@@PerlDef:
1811     __DEEP{
1812     __CODE{getNameListAttr::
1813     $node => {$self},
1814     $attrName => 'operator',
1815     $result => {$r},
1816     }__;
1817     }__;
1818    
1819     @Method:
1820     @@Name: hasPerlOperator
1821     @@enDesc:
1822     Returns whether the subroutine has an operator or not.
1823     @@Param:
1824     @@@Name: op
1825     @@@Type: DOMString
1826     @@@enDesc: The operator.
1827     @@Return:
1828 wakaba 1.73 @@@Type: idl|boolean
1829 wakaba 1.35 @@@PerlDef:
1830     __DEEP{
1831     my $l;
1832     __CODE{getNameListAttr::
1833     $node => {$self},
1834     $attrName => 'operator',
1835     $result => {$l},
1836     }__;
1837     F: for (@$l) {
1838     if ($_ eq $op) {
1839     $r = true;
1840     last F;
1841     }
1842     }
1843     }__;
1844    
1845     @ATTR:
1846 wakaba 1.6 @@Name: prototype
1847 wakaba 1.35 @@ATTRQName: pc|prototype
1848 wakaba 1.6 @@enDesc:
1849     The prototype of this subroutine.
1850 wakaba 1.64 @@ReflectCDATA2:
1851 wakaba 1.6 @@Get:
1852     @@@nullCase:
1853     @@@@enDesc:
1854     No prototype is set.
1855     @@Set:
1856     @@@nullCase:
1857     @@@@enDesc:
1858     No prototype declaration.
1859 wakaba 1.42
1860     @@Test:
1861 wakaba 1.51 @@@QName: PCSub.prototype.empty.test
1862 wakaba 1.42 @@@enDesc:
1863     Getting value after setting empty value must return an empty string.
1864     @@@PerlDef:
1865 wakaba 1.62 my $doc;
1866     __CODE{createPCDocumentForTest:: $doc => $doc}__;
1867    
1868     my $sub = $doc-><M::PCDocument.createPerlSub> ("sub_name");
1869    
1870     $test->id ('PerlSub');
1871 wakaba 1.42 $test->assert_not_null ($sub);
1872    
1873 wakaba 1.62 $test->id ('default');
1874     $test->assert_null ($sub-><AG::PerlSub.prototype>);
1875    
1876 wakaba 1.42 $sub-><AS::PerlSub.prototype> ('');
1877 wakaba 1.62
1878     $test->id ('attribute');
1879 wakaba 1.42 $test->assert_string (actual_value => $sub-><AG::PerlSub.prototype>,
1880     expected_value => '');
1881 wakaba 1.62
1882     $test->id ('stringify');
1883 wakaba 1.42 $test->assert_true ($sub->stringify =~ /^sub sub_name \(\)/);
1884 wakaba 1.6
1885 wakaba 1.4 @ToStringMethod:
1886     @@Return:
1887 wakaba 1.35 @@@Type: DOMString
1888 wakaba 1.4 @@@enDesc:
1889     Perl code.
1890     @@@PerlDef:
1891 wakaba 1.35 __DEEP{
1892     $r = q<sub>;
1893     my $nm = $self-><M::PerlSub.getPerlNameList>;
1894     $r .= q< > . $nm->[0] if @$nm;
1895 wakaba 1.42 if ($self-><M::Element.hasAttributeNS> (<Q::pc:>, 'prototype')) {
1896     $r .= q< (> . $self-><AG::PerlSub.prototype> . q<)>;
1897     }
1898 wakaba 1.35 $r .= qq< {\n>;
1899     for my $child (@{$self-><AG::Node.childNodes>}) {
1900     $r .= $child->stringify;
1901     }
1902     $r .= qq<}\n>;
1903     }__;
1904 wakaba 1.14
1905     @NumValMethod:
1906     @@Return:
1907 wakaba 1.73 @@@Type: idl|unsignedLong
1908 wakaba 1.14 @@@PerlDef:
1909 wakaba 1.35 __DEEP{
1910     $r = 0 + $self-><AG::Node.lastChild>;
1911     }__;
1912 wakaba 1.47 ##PerlSub
1913 wakaba 1.1
1914 wakaba 1.42 ElementTypeBinding:
1915     @Name: Test
1916     @ElementType:
1917     dis:ResourceDef
1918     @ShadowContent:
1919 wakaba 1.59 @@DISCore:resourceType: test|StandaloneTest
1920 wakaba 1.51 @@ForCheck: ManakaiDOM|ForClass
1921 wakaba 1.42
1922 wakaba 1.54 ElementTypeBinding:
1923     @Name: TestC
1924     @ElementType:
1925     dis:ResourceDef
1926     @ShadowContent:
1927     @@rdf:type: test|StandaloneTest
1928    
1929 wakaba 1.35 IFClsETDef:
1930 wakaba 1.25 @IFQName: PerlUnparsedCode
1931 wakaba 1.35 @CQName: ManakaiPCUnparsedCode
1932     @ETQName: pc|unparsed
1933 wakaba 1.25
1934     @IFISA: PerlCode
1935 wakaba 1.35 @CISA: ManakaiPCCode
1936 wakaba 1.25
1937 wakaba 1.1 @enDesc:
1938     Unparsed Perl code fragments.
1939 wakaba 1.5
1940 wakaba 1.6 @ToStringMethod:
1941     @@Return:
1942 wakaba 1.35 @@@Type: DOMString
1943 wakaba 1.6 @@@enDesc:
1944     Perl code.
1945     @@@PerlDef:
1946 wakaba 1.35 __DEEP{
1947 wakaba 1.39 $r = "\x0A" . $self-><AG::Node.textContent> . "\x0A";
1948 wakaba 1.35 }__;
1949 wakaba 1.1 ##PerlUnparsedCode
1950    
1951 wakaba 1.35 IFClsETDef:
1952 wakaba 1.25 @IFQName: PerlInlineUnparsedCode
1953 wakaba 1.35 @CQName: ManakaiPCInlineUnparsedCode
1954     @ETQName: pc|inlineUnparsed
1955 wakaba 1.25
1956     @IFISA: PerlCode
1957 wakaba 1.35 @CISA: ManakaiPCCode
1958 wakaba 1.25
1959 wakaba 1.6 @enDesc:
1960 wakaba 1.36 Unparsed Perl inline code fragments.
1961 wakaba 1.6
1962 wakaba 1.36 @ToStringMethod:
1963 wakaba 1.9 @@Return:
1964 wakaba 1.36 @@@Type: DOMString
1965     @@@enDesc:
1966     Perl code.
1967 wakaba 1.59 @@@PerlDef:
1968     __DEEP{
1969     $r = $self-><AG::Node.textContent>;
1970     }__;
1971 wakaba 1.36 ##PCInlineUnparsedCode
1972 wakaba 1.6
1973 wakaba 1.35 IFClsETDef:
1974 wakaba 1.44 @IFQName: PCNumberLiteral
1975     @CQName: ManakaiPCNumberLiteral
1976     @ETQName: pc|numberLiteral
1977    
1978     @IFISA: PerlCode
1979     @CISA: ManakaiPCCode
1980    
1981     @enDesc:
1982     A <IF::PCNumberLiteral> object represents a Perl number literal.
1983     The <A::Node.textContent> of a <IF::PCNumberLiteral> object
1984     is a Perl source code representation of the number for the object.
1985    
1986     @ToStringMethod:
1987     @@Return:
1988     @@@Type: DOMString
1989     @@@PerlDef:
1990     __DEEP{
1991     $r = $self-><AG::Node.textContent>;
1992     }__;
1993     ##PCNumberLiteral
1994    
1995     IFClsETDef:
1996 wakaba 1.25 @IFQName: PerlStringLiteral
1997 wakaba 1.35 @CQName: ManakaiPCPerlStringLiteral
1998     @ETQName: pc|stringLiteral
1999 wakaba 1.25
2000     @IFISA: PerlCode
2001 wakaba 1.35 @CISA: ManakaiPCCode
2002 wakaba 1.25
2003 wakaba 1.6 @enDesc:
2004 wakaba 1.36 Perl string literal.
2005 wakaba 1.6
2006 wakaba 1.14 @NumValMethod:
2007     @@Return:
2008 wakaba 1.73 @@@Type: idl|unsignedLong
2009 wakaba 1.14 @@@enDesc:
2010     Numeric value of the Perl code.
2011     @@@PerlDef:
2012 wakaba 1.35 __DEEP{
2013     $r = 0 + $self-><AG::Node.textContent>;
2014     }__;
2015 wakaba 1.14
2016 wakaba 1.6 @ToStringMethod:
2017     @@Return:
2018 wakaba 1.35 @@@Type: DOMString
2019 wakaba 1.6 @@@enDesc:
2020     Perl code.
2021     @@@PerlDef:
2022 wakaba 1.35 __DEEP{
2023     $r = $self-><AG::Node.textContent>;
2024     $r =~ s/(['\\])/\\$1/g;
2025 wakaba 1.57 my $escaped = ($r =~ s{([^\x0A\x0D\x20-\x7E])}
2026     {sprintf '\x{%X}', ord $1}ge);
2027     if ($escaped or
2028     $self-><AG::Node.ownerDocument>
2029 wakaba 1.54 -><AG::Document.domConfig>
2030 wakaba 1.59 -><M::CFG.getParameter>
2031 wakaba 1.54 (<Q::pc:preserve-line-break>)) {
2032     $r =~ s/\x0D/\\x0D/gs;
2033     $r =~ s/\x0A/\\x0A/gs;
2034     $r =~ s/\@/\\\@/g;
2035     $r =~ s/\$/\\\$/g;
2036     $r =~ s/"/\\"/g;
2037     $r = q<"> . $r . q<">;
2038     } else {
2039     $r = q<'> . $r . q<'>;
2040     }
2041 wakaba 1.35 }__;
2042 wakaba 1.6 ##PerlStringLiteral
2043    
2044 wakaba 1.35 IFClsETDef:
2045 wakaba 1.41 @IFQName: PCList
2046     @CQName: ManakaiPCList
2047     @ETQName: pc|list
2048    
2049     @IFISA: PerlCode
2050 wakaba 1.42 @CISA: ManakaiPCCode
2051 wakaba 1.41
2052     @enDesc:
2053     A <IF::PCList> is a Perl list, i.e. <CHAR::COMMA> separated
2054     list of values.
2055    
2056     @Method:
2057     @@Name: item
2058     @@enDesc:
2059     Returns the <P::index>th item in the list.
2060     @@Param:
2061     @@@Name: index
2062     @@@Type: unsignedLong
2063     @@@enDesc:
2064     The ordinal index of the item.
2065     @@Return:
2066     @@@Type: PerlCodeInlines
2067     @@@enDesc:
2068     The <P::index>th item in the list.
2069     @@@nullCase:
2070     @@@@enDesc:
2071     Either <P::index> is negative or the <P::index> is
2072     greater than the number of the items in the list.
2073     @@@PerlDef:
2074     __DEEP{
2075     $r = $self-><AG::Node.childNodes>-><M::NodeList.item> ($index);
2076     }__;
2077    
2078     @Attr:
2079     @@Name: length
2080     @@enDesc:
2081     The number of items in the list.
2082     @@Type: unsignedLong
2083     @@Get:
2084     @@@PerlDef:
2085     __DEEP{
2086     $r = $self-><AG::Node.childNodes>-><AG::NodeList.length>;
2087     }__;
2088    
2089     @ToStringMethod:
2090     @@Return:
2091     @@@Type: DOMString
2092     @@@enDesc:
2093     Perl code.
2094     @@@PerlDef:
2095     __DEEP{
2096     my @r = map {$_->stringify} @{$self-><AG::Node.childNodes>};
2097     $r = '(' . join (', ', @r) . ')';
2098     }__;
2099     ##PCList
2100    
2101     IFClsETDef:
2102     @IFQName: PCArrayRefLiteral
2103     @CQName: ManakaiPCArrayRefLiteral
2104 wakaba 1.44 @ETQName: pc|arrayRefLiteral
2105 wakaba 1.41
2106     @IFISA: PerlCode
2107 wakaba 1.42 @CISA: ManakaiPCCode
2108 wakaba 1.41
2109     @enDesc:
2110     A <IF::PCArrayRefLiteral> is a Perl array reference literal.
2111    
2112     @Method:
2113     @@Name: item
2114     @@enDesc:
2115     Returns the <P::index>th item in the list.
2116     @@Param:
2117     @@@Name: index
2118     @@@Type: unsignedLong
2119     @@@enDesc:
2120     The ordinal index of the item.
2121     @@Return:
2122     @@@Type: PerlCodeInlines
2123     @@@enDesc:
2124     The <P::index>th item in the list.
2125     @@@nullCase:
2126     @@@@enDesc:
2127     Either <P::index> is negative or the <P::index> is
2128     greater than the number of the items in the list.
2129     @@@PerlDef:
2130     __DEEP{
2131     $r = $self-><AG::Node.childNodes>-><M::NodeList.item> ($index);
2132     }__;
2133    
2134     @Attr:
2135     @@Name: length
2136     @@enDesc:
2137     The number of items in the list.
2138     @@Type: unsignedLong
2139     @@Get:
2140     @@@PerlDef:
2141     __DEEP{
2142     $r = $self-><AG::Node.childNodes>-><AG::NodeList.length>;
2143     }__;
2144    
2145     @ToStringMethod:
2146     @@Return:
2147     @@@Type: DOMString
2148     @@@enDesc:
2149     Perl code.
2150     @@@PerlDef:
2151     __DEEP{
2152     my @r = map {$_->stringify} @{$self-><AG::Node.childNodes>};
2153 wakaba 1.58 $r = '[' . join (",\n", @r) . ']';
2154 wakaba 1.41 }__;
2155     ##PCArrayRefLiteral
2156    
2157     IFClsETDef:
2158     @IFQName: PCHashRefLiteral
2159     @CQName: ManakaiPCHashRefLiteral
2160 wakaba 1.44 @ETQName: pc|hashRefLiteral
2161 wakaba 1.41
2162     @IFISA: PerlCode
2163 wakaba 1.42 @CISA: ManakaiPCCode
2164 wakaba 1.41
2165     @enDesc:
2166     A <IF::PCHashRefLiteral> is a Perl hash reference literal.
2167    
2168     @Method:
2169     @@Name: key
2170     @@enDesc:
2171     Returns the <P::index>th key in the list.
2172    
2173     {NOTE:: Although the order of key-value pairs is
2174     preserved in the object, it is not preserved
2175     in Perl source codes and in Perl language.
2176     }
2177     @@Param:
2178     @@@Name: index
2179     @@@Type: unsignedLong
2180     @@@enDesc:
2181     The ordinal index of the key.
2182     @@Return:
2183     @@@Type: PerlCodeInlines
2184     @@@enDesc:
2185     The <P::index>th key in the list.
2186     @@@nullCase:
2187     @@@@enDesc:
2188     Either <P::index> is negative or the <P::index> is
2189     greater than the number of the keys in the list.
2190     @@@PerlDef:
2191     __DEEP{
2192     $r = $self-><AG::Node.childNodes>-><M::NodeList.item> ($index * 2);
2193     }__;
2194    
2195     @Method:
2196     @@Name: value
2197     @@enDesc:
2198     Returns the <P::index>th value in the list.
2199    
2200     {NOTE:: Although the order of key-value pairs is
2201     preserved in the object, it is not preserved
2202     in Perl source codes and in Perl language.
2203     }
2204     @@Param:
2205     @@@Name: index
2206     @@@Type: unsignedLong
2207     @@@enDesc:
2208     The ordinal index of the value.
2209     @@Return:
2210     @@@Type: PerlCodeInlines
2211     @@@enDesc:
2212     The <P::index>th value in the list.
2213     @@@nullCase:
2214     @@@@enDesc:
2215     Either <P::index> is negative or the <P::index> is
2216     greater than the number of the values in the list.
2217    
2218     {NOTE:: <MATH::<A::PCHashRefLiteral.length> - 1>th
2219     value might not be found.
2220     }
2221     @@@PerlDef:
2222     __DEEP{
2223     $r = $self-><AG::Node.childNodes>-><M::NodeList.item> ($index * 2 + 1);
2224     }__;
2225    
2226     @Attr:
2227     @@Name: length
2228     @@enDesc:
2229     The number of key-value pairs in the list.
2230     @@Type: unsignedLong
2231     @@Get:
2232     @@@PerlDef:
2233     __DEEP{
2234     my $length = $self-><AG::Node.childNodes>-><AG::NodeList.length>;
2235     $r = int ($length / 2) + ($length % 2);
2236     }__;
2237    
2238     @Method:
2239     @@Name: setNamedItem
2240     @@enDesc:
2241     Set a named item.
2242     @@Param:
2243     @@@Name: key
2244     @@@Type: DOMString
2245     @@@enDesc:
2246     The key.
2247     @@Param:
2248     @@@Name: value
2249     @@@Type: PerlCodeInlines
2250     @@@enDesc:
2251     The value.
2252     @@Return:
2253     @@@PerlDef:
2254     __DEEP{
2255     my @children = @{$self-><AG::Node.childNodes>};
2256     R: {
2257     while (@children) {
2258     my $ckey = shift @children;
2259     my $cval = shift @children;
2260     if ($ckey-><AG::Node.textContent> eq $key) {
2261     $self-><M::Node.replaceChild> ($value, $cval);
2262     last R;
2263     }
2264     }
2265    
2266     $self-><M::Node.appendChild>
2267     ($self-><AG::Node.ownerDocument>
2268     -><M::Document.createElementNS>
2269     (<Q::pc:>, 'stringLiteral'))
2270     -><AS::Node.textContent> ($key);
2271     $self-><M::Node.appendChild> ($value);
2272     } # R
2273     }__;
2274    
2275     @ToStringMethod:
2276     @@Return:
2277     @@@Type: DOMString
2278     @@@enDesc:
2279     Perl code.
2280     @@@PerlDef:
2281     __DEEP{
2282     my %r = map {$_->stringify} @{$self-><AG::Node.childNodes>};
2283     ## Different values with same key are not preserved.
2284 wakaba 1.58 $r = '{' . join (",\n", map {$_ => $r{$_}}
2285 wakaba 1.41 sort {$a cmp $b} keys %r) . '}';
2286     }__;
2287     ##PCHashRefLiteral
2288    
2289     ResourceDef:
2290     @QName: unsignedLong
2291 wakaba 1.73 @AliasFor: idl|unsignedLong
2292 wakaba 1.41
2293     IFClsETDef:
2294 wakaba 1.25 @IFQName: PerlTokens
2295 wakaba 1.35 @CQName: ManakaiPCTokens
2296     @ETQName: pc|tokens
2297 wakaba 1.12
2298 wakaba 1.25 @IFISA: PerlCode
2299 wakaba 1.35 @CISA: ManakaiPCCode
2300 wakaba 1.25
2301 wakaba 1.6 @enDesc:
2302 wakaba 1.36 Unparsed Perl inline code fragments.
2303 wakaba 1.6
2304     @ToStringMethod:
2305     @@Return:
2306 wakaba 1.43 @@@Type: DOMString
2307 wakaba 1.6 @@@PerlDef:
2308 wakaba 1.35 __DEEP{
2309     $r = $self-><AG::Node.textContent>;
2310     }__;
2311     ##PCTokens
2312 wakaba 1.6
2313 wakaba 1.35 IFClsETDef:
2314 wakaba 1.25 @IFQName: PerlAtom
2315 wakaba 1.35 @CQName: ManakaiPCAtom
2316     @ETQName: pc|atom
2317 wakaba 1.25
2318     @IFISA: PerlCode
2319 wakaba 1.35 @CISA: ManakaiPCTokens
2320 wakaba 1.25
2321 wakaba 1.6 @enDesc:
2322     Unparsed Perl atomic code fragments (such as numeric literal).
2323    
2324 wakaba 1.14 @NumValMethod:
2325     @@Return:
2326 wakaba 1.73 @@@Type: idl|unsignedLong
2327 wakaba 1.14 @@@enDesc:
2328     Numeric value of the Perl code.
2329     @@@PerlDef:
2330 wakaba 1.35 __DEEP{
2331     $r = 0 + $self-><AG::Node.textContent>;
2332     }__;
2333 wakaba 1.9
2334 wakaba 1.6 @ToStringMethod:
2335     @@Return:
2336 wakaba 1.35 @@@Type: DOMString
2337 wakaba 1.6 @@@enDesc:
2338     Perl code.
2339     @@@PerlDef:
2340 wakaba 1.35 __DEEP{
2341     $r = $self-><AG::Node.textContent>;
2342     }__;
2343 wakaba 1.6 ##PerlAtom
2344    
2345 wakaba 1.35 IFClsETDef:
2346 wakaba 1.25 @IFQName: PerlVariable
2347 wakaba 1.35 @CQName: ManakaiPCVariable
2348     @ETQName: pc|variable
2349 wakaba 1.25
2350     @IFISA: PerlCode
2351 wakaba 1.35 @CISA: ManakaiPCCode
2352 wakaba 1.25
2353 wakaba 1.6 @enDesc:
2354     Unparsed Perl variable.
2355     \
2356     {NOTE:: Future version of the implementation may
2357     support to specify array index or hash key.
2358     \
2359 wakaba 1.36 }
2360 wakaba 1.6
2361 wakaba 1.35 @ATTR:
2362 wakaba 1.6 @@Name: variableType
2363 wakaba 1.35 @@ATTRQName: pc|variableType
2364 wakaba 1.6 @@enDesc:
2365     Perl variable type (<CODE::$>, <CODE::@>, <CODE::%>,
2366     <CODE::&> or empty string).
2367 wakaba 1.35 @@ReflectCDATA:
2368 wakaba 1.6 @@Get:
2369     @@Set:
2370    
2371 wakaba 1.35 @ATTR:
2372 wakaba 1.6 @@Name: packageName
2373 wakaba 1.35 @@ATTRQName: pc|packageName
2374 wakaba 1.6 @@enDesc:
2375     The name of the package to which this variable belongs.
2376 wakaba 1.35 @@ReflectCDATA:
2377 wakaba 1.6 @@Get:
2378     @@@nullCase:
2379     @@@@enDesc:
2380     This package belongs to the current package or
2381     does not belong to any package.
2382     @@Set:
2383     @@@nullCase:
2384     @@@@enDesc:
2385     This package belongs to the current package or
2386     does not belong to any package.
2387    
2388 wakaba 1.35 @ATTR:
2389 wakaba 1.36 @@Name: pcLocalName
2390 wakaba 1.35 @@ATTRQName: pc|localName
2391 wakaba 1.6 @@enDesc:
2392     The local variable name.
2393 wakaba 1.35 @@ReflectCDATA:
2394 wakaba 1.6 @@Get:
2395     @@Set:
2396    
2397 wakaba 1.35 @ATTR:
2398 wakaba 1.6 @@Name: variableScope
2399 wakaba 1.35 @@ATTRQName: pc|variableScope
2400 wakaba 1.6 @@enDesc:
2401     Scope modifier (<CODE::my> or <CODE::our> or <CODE::local>).
2402 wakaba 1.35 @@ReflectCDATA:
2403 wakaba 1.6 @@Get:
2404     @@@nullCase:
2405     @@@@enDesc:
2406     This variable does not have scope modifier.
2407     @@Set:
2408     @@@nullCase:
2409     @@@@enDesc:
2410     This variable does not have scope modifier.
2411    
2412     @ToStringMethod:
2413     @@Return:
2414 wakaba 1.35 @@@Type: DOMString
2415 wakaba 1.6 @@@enDesc:
2416     Perl code.
2417     @@@PerlDef:
2418 wakaba 1.35 __DEEP{
2419     my $t = $self-><AG::PerlVariable.variableScope>;
2420     $r .= $t . ' ' if length $t;
2421 wakaba 1.55 $r .= $t = $self-><AG::PerlVariable.variableType>;
2422 wakaba 1.35 my $v = $self-><AG::PerlVariable.packageName>;
2423     $r .= $v . '::' if length $v;
2424     $r .= $self-><AG::PerlVariable.pcLocalName>;
2425     $v = $self-><AG::PerlVariable.hashKey>;
2426     if ($t eq '$' and length $v) {
2427     $v =~ s/(['\\])/\\$1/g;
2428     $r .= q<{'> . $v . q<'}>;
2429     }
2430     }__;
2431 wakaba 1.6
2432 wakaba 1.35 @ATTR:
2433 wakaba 1.6 @@Name: hashKey
2434 wakaba 1.35 @@ATTRQName: pc|hashKey
2435 wakaba 1.6 @@enDesc:
2436     The key for hash.
2437     \
2438     {NOTE:: Using Perl code for key is not supported in the current
2439     version of the implementation.
2440     \
2441     }
2442 wakaba 1.35 @@ReflectCDATA:
2443 wakaba 1.6 @@Get:
2444     @@@nullCase:
2445     @@@@enDesc:
2446     This variable is not for hash value access.
2447     @@Set:
2448     @@@nullCase:
2449     @@@@enDesc:
2450     This variable is not for hash value access.
2451 wakaba 1.15 ##PerlVariable
2452 wakaba 1.6
2453 wakaba 1.25 IFClsDef:
2454     @IFQName: PerlCodeUnits
2455 wakaba 1.35 @CQName: ManakaiPCCodeUnits
2456 wakaba 1.25
2457 wakaba 1.35 @CISA: ManakaiPCCode
2458 wakaba 1.25
2459 wakaba 1.6 @enDesc:
2460     A base class implemented by both inline container and
2461     block-level container.
2462    
2463     @Attr:
2464     @@Name: length
2465     @@enDesc:
2466     The number of child code fragments.
2467 wakaba 1.73 @@Type: idl|unsignedLong
2468 wakaba 1.6 @@Get:
2469     @@@PerlDef:
2470 wakaba 1.35 __DEEP{
2471     $r = @{$self-><AG::Node.childNodes>};
2472     }__;
2473 wakaba 1.6
2474     @Method:
2475     @@Name: appendStringLiteral
2476     @@enDesc:
2477     Appends a Perl string literal (<CODE::q>).
2478     @@Param:
2479     @@@Name: stringArg
2480 wakaba 1.35 @@@Type: DOMString
2481 wakaba 1.6 @@@enDesc:
2482     A string.
2483     @@Return:
2484 wakaba 1.35 @@@Type: PerlStringLiteral
2485 wakaba 1.6 @@@enDesc:
2486     The newly created Perl string literal object.
2487     @@@PerlDef:
2488 wakaba 1.35 __DEEP{
2489     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
2490     (<Q::pc:>, 'stringLiteral');
2491     $r-><AS::Node.textContent> ($stringArg);
2492     $self-><M::Node.appendChild> ($r);
2493     }__;
2494 wakaba 1.6
2495     @Method:
2496 wakaba 1.41 @@Name: appendNewPCLiteral
2497     @@enDesc:
2498     Creates a <IF::PCLiteral> object and appends it to the node.
2499     @@Param:
2500     @@@Name: value
2501     @@@Type: DISPerl|Any
2502     @@@enDesc: The value.
2503     @@Return:
2504     @@@Type: PerlCode
2505     @@@enDesc:
2506     The newly created object.
2507     @@@PerlDef:
2508     __DEEP{
2509     $r = $self-><AG::Node.ownerDocument>
2510     -><M::PCDocument.createPCLiteral> ($value);
2511     $self-><M::Node.appendChild> ($r);
2512     }__;
2513    
2514     @Method:
2515 wakaba 1.44 @@Name: appendNewPCNumberLiteral
2516     @@enDesc:
2517     Creates a <IF::PCNumberLiteral> object and appends it to the node.
2518     @@Param:
2519     @@@Name: value
2520     @@@Type: DISPerl|NumberValue
2521     @@@enDesc:
2522     The value.
2523     @@Return:
2524     @@@Type: PCNumberLiteral
2525     @@@enDesc:
2526     The newly created node.
2527     @@@PerlDef:
2528     __DEEP{
2529     $r = $self-><AG::Node.ownerDocument>
2530     -><M::PCDocument.createPCNumberLiteral> ($value);
2531     $self-><M::Node.appendChild> ($r);
2532     }__;
2533    
2534     @Method:
2535 wakaba 1.6 @@Name: appendAtom
2536     @@enDesc:
2537     Appends a Perl atomic code fragment.
2538     @@Param:
2539     @@@Name: codeArg
2540 wakaba 1.35 @@@Type: DOMString
2541 wakaba 1.6 @@@enDesc:
2542     An atom.
2543     @@Return:
2544 wakaba 1.35 @@@Type: PerlAtom
2545 wakaba 1.6 @@@enDesc:
2546     The newly created Perl code object.
2547     @@@PerlDef:
2548 wakaba 1.35 __DEEP{
2549     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
2550     (<Q::pc:>, 'atom');
2551     $r-><AS::Node.textContent> ($codeArg);
2552     $self-><M::Node.appendChild> ($r);
2553     }__;
2554 wakaba 1.6
2555     @Method:
2556     @@Name: appendBare
2557     @@enDesc:
2558     Appends a Perl bare code fragment.
2559     @@Param:
2560     @@@Name: codeArg
2561 wakaba 1.35 @@@Type: DOMString
2562 wakaba 1.6 @@@enDesc:
2563 wakaba 1.7 An bare code.
2564 wakaba 1.6 @@Return:
2565 wakaba 1.35 @@@Type: PerlBare
2566 wakaba 1.6 @@@enDesc:
2567     The newly created Perl code object.
2568     @@@PerlDef:
2569 wakaba 1.35 __DEEP{
2570     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
2571     (<Q::pc:>, 'tokens');
2572     $r-><AS::Node.textContent> ($codeArg);
2573     $self-><M::Node.appendChild> ($r);
2574     }__;
2575 wakaba 1.11
2576     @Method:
2577 wakaba 1.44 @@Name: appendNewPCVariable
2578     @@enDesc:
2579     Creates a variable object and appends it to the children list of
2580     the node.
2581     @@Param:
2582     @@@Name: variableTypeArg
2583     @@@Type: DOMString
2584     @@@enDesc:
2585     The variable type prefix such as <Perl::$>, if any, or an empty string.
2586     @@Param:
2587     @@@Name: packageNameArg
2588     @@@Type: DOMString
2589     @@@enDesc:
2590     The name of the package to which the variable belongs.
2591     @@@nullCase:
2592     @@@@enDesc:
2593     The variable does not belong to any package or belongs
2594     to the current package.
2595     @@Param:
2596     @@@Name: localNameArg
2597     @@@Type: DOMString
2598     @@@enDesc:
2599     The local part of the variable name.
2600     @@Return:
2601     @@@Type: PerlVariable
2602     @@@enDesc:
2603     The newly created variable object.
2604     @@@PerlDef:
2605     __DEEP{
2606     $r = $self-><AG::Node.ownerDocument>
2607     -><M::PCDocument.createPCVariable>
2608     ($variableTypeArg, $packageNameArg, $localNameArg);
2609     $self-><M::Node.appendChild> ($r);
2610     }__;
2611    
2612     @Method:
2613     @@Name: appendNewPCDereference
2614     @@enDesc:
2615     Creates a <IF::PCDereference> object and appends it to the child
2616     node list of the node.
2617     @@Param:
2618     @@@Name: variableTypeArg
2619     @@@Type: DOMString
2620     @@@enDesc:
2621     The type of the referenced value, such as <Perl::$>.
2622     @@Return:
2623     @@@Type: PCDereference
2624     @@@enDesc:
2625     The newly created element node.
2626     @@@PerlDef:
2627     __DEEP{
2628     $r = $self-><AG::Node.ownerDocument>
2629 wakaba 1.48 -><M::PCDocument.createPCDereference>
2630     ($variableTypeArg);
2631     $self-><M::Node.appendChild> ($r);
2632     }__;
2633    
2634     @Method:
2635     @@Name: appendNewPCReference
2636     @@enDesc:
2637     Creates a <IF::PCReference> object and appends it to the child
2638     node list of the node.
2639     @@Return:
2640     @@@Type: PCReference
2641     @@@enDesc:
2642     The newly created element node.
2643     @@@PerlDef:
2644     __DEEP{
2645     $r = $self-><AG::Node.ownerDocument>
2646     -><M::PCDocument.createPCReference>;
2647 wakaba 1.44 $self-><M::Node.appendChild> ($r);
2648     }__;
2649    
2650     @Method:
2651 wakaba 1.43 @@Name: appendNewPCExpression
2652     @@enDesc:
2653     Appends a newly created <IF::PCExpression> node.
2654     @@Param:
2655     @@@Name: operatorArg
2656     @@@Type: DOMString
2657     @@@enDesc:
2658     The operator of the expression.
2659     @@Return:
2660     @@@Type: PCExpression
2661     @@@enDesc:
2662     The newly created expression object.
2663     @@@PerlDef:
2664     __DEEP{
2665     $r = $self-><AG::Node.ownerDocument>
2666     -><M::PCDocument.createPCExpression> ($operatorArg);
2667     $self-><M::Node.appendChild> ($r);
2668     }__;
2669    
2670     @Method:
2671 wakaba 1.11 @@Name: appendNewAssignment
2672     @@enDesc:
2673     Appends a newly created <Class::ManakaiPerlAssign> object.
2674     @@Param:
2675     @@@Name: leftArg
2676 wakaba 1.35 @@@Type: PerlCode
2677 wakaba 1.11 @@@enDesc:
2678     A left hand side code fragment object.
2679     @@Param:
2680     @@@Name: rightArg
2681 wakaba 1.35 @@@Type: PerlCode
2682 wakaba 1.11 @@@enDesc:
2683     A right hand side code fragment object.
2684     @@Return:
2685 wakaba 1.36 @@@Type: PerlAssignment
2686 wakaba 1.61 @@@PerlDef:
2687 wakaba 1.35 __DEEP{
2688     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
2689     (<Q::pc:>, 'assignment');
2690     $r-><AS::PerlAssignment.leftCode> ($leftArg);
2691     $r-><AS::PerlAssignment.rightCode> ($rightArg);
2692     $self-><M::Node.appendChild> ($r);
2693     }__;
2694 wakaba 1.43
2695     @Method:
2696 wakaba 1.44 @@Name: appendNewPCApply
2697     @@enDesc:
2698     Creates a <IF::PCApply> object and appends it to the children list
2699     of the node.
2700     @@Return:
2701     @@@Type: PCApply
2702     @@@enDesc: The newly created node.
2703     @@@PerlDef:
2704     __DEEP{
2705     $r = $self-><AG::Node.ownerDocument>-><M::PCDocument.createPCApply>;
2706     $self-><M::Node.appendChild> ($r);
2707     }__;
2708    
2709     @Method:
2710 wakaba 1.43 @@Name: appendNewPCFunctionCall
2711     @@enDesc:
2712     Appends a newly created <IF::PCFunctionCall> node.
2713     @@Param:
2714     @@@Name: packageArg
2715     @@@Type: DOMString
2716     @@@enDesc:
2717     The package name of the function.
2718     @@@nullCase:
2719     @@@@enDesc: No package name.
2720     @@Param:
2721     @@@Name: localNameArg
2722     @@@Type: DOMString
2723     @@@enDesc:
2724     The local part of the function name.
2725     @@Return:
2726     @@@Type: PCFunctionCall
2727     @@@enDesc:
2728     The newly created functin call object.
2729     @@@PerlDef:
2730     __DEEP{
2731     $r = $self-><AG::Node.ownerDocument>
2732     -><M::PCDocument.createPCFunctionCall>
2733     ($packageArg, $localNameArg);
2734     $self-><M::Node.appendChild> ($r);
2735     }__;
2736     ##PCCodeUnits
2737 wakaba 1.6
2738 wakaba 1.35 IFClsETDef:
2739 wakaba 1.25 @IFQName: PerlStatement
2740 wakaba 1.35 @CQName: ManakaiPCStatement
2741     @ETQName: pc|statement
2742 wakaba 1.25
2743     @IFISA: PerlCode
2744     @IFISA: PerlCodeInlines
2745 wakaba 1.35 @CISA: ManakaiPCCodeInlines
2746 wakaba 1.25
2747 wakaba 1.8 @enDesc:
2748 wakaba 1.36 Perl statements.
2749 wakaba 1.8
2750     @ToStringMethod:
2751     @@Return:
2752 wakaba 1.35 @@@Type: DOMString
2753 wakaba 1.8 @@@enDesc:
2754     Perl code.
2755     @@@PerlDef:
2756     $r = $self->SUPER::stringify;
2757 wakaba 1.16 $r .= ";\n" if length $r;
2758 wakaba 1.8 ##PerlStatement
2759 wakaba 1.6
2760 wakaba 1.35 IFClsETDef:
2761 wakaba 1.25 @IFQName: PerlCodeInlines
2762 wakaba 1.35 @CQName: ManakaiPCCodeInlines
2763     @ETQName: pc|inlineContainer
2764 wakaba 1.25
2765 wakaba 1.35 @CISA: ManakaiPCCodeUnits
2766 wakaba 1.25
2767 wakaba 1.6 @enDesc:
2768 wakaba 1.41 Perl inline code block.
2769 wakaba 1.6
2770     @Method:
2771     @@Name: appendCode
2772     @@enDesc:
2773     Appends an unparsed Perl code fragment.
2774     @@Param:
2775     @@@Name: codeArg
2776 wakaba 1.35 @@@Type: DOMString
2777 wakaba 1.6 @@@enDesc:
2778     An unparsed Perl code fragment.
2779     @@Return:
2780 wakaba 1.25 @@@Type: PerlInlineUnparsedCode
2781 wakaba 1.6 @@@enDesc:
2782     The newly created Perl code object.
2783     @@@PerlDef:
2784 wakaba 1.35 __DEEP{
2785     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
2786     (<Q::pc:>, 'inlineUnparsed');
2787     $r-><AS::Node.textContent> ($codeArg);
2788     $self-><M::Node.appendChild> ($r);
2789     }__;
2790 wakaba 1.6
2791     @ToStringMethod:
2792     @@Return:
2793 wakaba 1.35 @@@Type: DOMString
2794 wakaba 1.6 @@@enDesc:
2795     Perl code.
2796     @@@PerlDef:
2797 wakaba 1.35 __DEEP{
2798     my @child = @{$self-><AG::Node.childNodes>};
2799     for my $child (@child) {
2800     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
2801     $child-><AG::Node.localName> eq 'inlineContainer' and
2802     1 == @child) {
2803     $r .= '(' . $child->stringify . ')';
2804     } else {
2805     $r .= $child->stringify;
2806     }
2807     }
2808     }__;
2809     ##PCCodeInlines
2810 wakaba 1.6
2811 wakaba 1.35 IFClsETDef:
2812 wakaba 1.25 @IFQName: PerlBlock
2813 wakaba 1.44 @CQName: ManakaiPerlBlock
2814 wakaba 1.35 @ETQName: pc|block
2815 wakaba 1.25
2816     @IFISA: PerlCode
2817     @IFISA: PerlCodeStatements
2818 wakaba 1.35 @CISA: ManakaiPCCodeStatements
2819 wakaba 1.25
2820 wakaba 1.8 @enDesc:
2821 wakaba 1.36 Perl block-level code block.
2822 wakaba 1.8
2823     @ToStringMethod:
2824     @@Return:
2825 wakaba 1.35 @@@Type: DOMString
2826 wakaba 1.8 @@@enDesc:
2827     Perl code.
2828     @@@PerlDef:
2829 wakaba 1.43 __DEEP{
2830 wakaba 1.35 my @child = @{$self-><AG::Node.childNodes>};
2831 wakaba 1.43 my $label = $self-><AG::PerlCodeStatements.label>;
2832     if (not $label and @child == 1 and
2833 wakaba 1.35 $child[0]-><AG::Node.localName> eq 'block') {
2834 wakaba 1.39 $r = "\x0A" . $child[0]->stringify . "\x0A";
2835 wakaba 1.43 } elsif (not $label and @child == 1 and
2836 wakaba 1.35 $child[0]-><AG::Node.localName> eq 'unparsed' and
2837     $child[0]-><AG::Node.textContent> =~ /^\s*$/) {
2838     #
2839     } else {
2840 wakaba 1.39 $r = "\x0A";
2841 wakaba 1.35 for my $child (@child) {
2842     if ($child-><AG::Node.localName> eq 'inlineContainer' and
2843     1 == @child) {
2844     $r .= '(' . $child->stringify . ')';
2845     } else {
2846     $r .= $child->stringify;
2847     }
2848     }
2849 wakaba 1.39 $r .= "\x0A";
2850 wakaba 1.35
2851 wakaba 1.59 $r = "\n{\n$r\n;}\n" if 2 < length $r;
2852 wakaba 1.43
2853     $r = "\n" . $label . ':' . $r if $label;
2854     }
2855     }__;
2856 wakaba 1.44 ##PerlBlock
2857 wakaba 1.8
2858 wakaba 1.35 IFClsETDef:
2859 wakaba 1.25 @IFQName: PerlCodeBlocks
2860 wakaba 1.35 @CQName: ManakaiPCCodeBlocks
2861     @ETQName: pc|blockContainer
2862 wakaba 1.25
2863     @IFISA: PerlCodeStatements
2864 wakaba 1.35 @CISA: ManakaiPCCodeStatements
2865 wakaba 1.25
2866 wakaba 1.9 @enDesc:
2867     Perl block-level code container whose content may or may
2868     not semantically be self-contained.
2869    
2870     @ToStringMethod:
2871     @@Return:
2872 wakaba 1.35 @@@Type: DOMString
2873 wakaba 1.9 @@@enDesc:
2874     Perl code.
2875     @@@PerlDef:
2876 wakaba 1.35 my @child = @{$self-><AG::Node.childNodes>};
2877     if (@child == 1 and
2878     {
2879     block => true, blockContainer => true,
2880     }->{$child[0]-><AG::Node.localName>}) {
2881     $r = $child[0]->stringify;
2882     } else {
2883     for my $child (@child) {
2884     if ($child-><AG::Node.localName> eq 'inlineContainer' and
2885     1 == @child) {
2886     $r .= '(' . $child->stringify . ')';
2887     } else {
2888     $r .= $child->stringify;
2889     }
2890     }
2891     }
2892     ##PCCodeBlocks
2893    
2894     IFClsETDef:
2895 wakaba 1.44 @IFQName: PCDereference
2896     @CQName: ManakaiPCDereference
2897     @ETQName: pc|dereference
2898    
2899     @IFISA: PerlCode
2900     @IFISA: PerlCodeInlines
2901     @CISA: ManakaiPCCodeInlines
2902    
2903     @enDesc:
2904     A <IF::PCDereference> object represents a dereference.
2905    
2906     @ATTR:
2907     @@Name: variableType
2908     @@ATTRQName: pc|variableType
2909     @@enDesc:
2910     The type of the value, such as <Perl::$>.
2911     @@ReflectCDATA:
2912     @@Get:
2913     @@Set:
2914    
2915     @ToStringMethod:
2916     @@Return:
2917     @@@Type: DOMString
2918     @@@PerlDef:
2919     __DEEP{
2920     $r = $self-><AG::PCDereference.variableType> . '{';
2921     A: for my $child (@{$self-><AG::Node.childNodes>}) {
2922     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
2923     $r .= $child;
2924     }
2925     $r .= '}';
2926     }__;
2927     ##PCDereference
2928    
2929     IFClsETDef:
2930 wakaba 1.48 @IFQName: PCReference
2931     @CQName: ManakaiPCReference
2932     @ETQName: pc|reference
2933    
2934     @IFISA: PerlCode
2935     @IFISA: PerlCodeInlines
2936     @CISA: ManakaiPCCodeInlines
2937    
2938     @enDesc:
2939     A <IF::PCReference> object represents a reference (<Perl::\>) operation.
2940    
2941     @ToStringMethod:
2942     @@Return:
2943     @@@Type: DOMString
2944     @@@PerlDef:
2945     __DEEP{
2946     $r = '\(undef)';
2947     no warnings 'uninitialized';
2948     A: for my $child (@{$self-><AG::Node.childNodes>}) {
2949     next A unless $child-><AG::Node.nodeType> ==
2950     <C::Node.ELEMENT_NODE>;
2951     $r = $child;
2952     unless ({
2953     <Q::pc:variable> => true,
2954     }->{$child-><AG::Node.namespaceURI>.
2955     $child-><AG::Node.localName>}) {
2956 wakaba 1.53 $r = '\('.$r.')';
2957 wakaba 1.48 }
2958     last A;
2959     }
2960     }__;
2961     ##PCReference
2962    
2963     IFClsETDef:
2964 wakaba 1.44 @IFQName: PCApply
2965     @CQName: ManakaiPCApply
2966     @ETQName: pc|apply
2967    
2968     @IFISA: PerlCode
2969     @IFISA: PerlCodeInlines
2970     @CISA: ManakaiPCCodeInlines
2971    
2972     @enDesc:
2973     A <IF::PCApply> object represents a function call.
2974    
2975     The first child element must be an expression results in a function name
2976     (such as bare function or operator name represented
2977     as a <IF::PCVariable> object or an <IF::PCExpression> with
2978     operator <Perl::-<gt>> whose last operand is a method name.
2979    
2980     The second child element, if any, is an expression intended to be
2981     an argument for the function. It is possible to specify more than
2982     one arguments by <IF::PCExpression> with operator <Perl::,>.
2983    
2984     The third child element, if any, is an expression that is put
2985     into the indirect object slot.
2986    
2987     @Attr:
2988     @@Name: function
2989     @@enDesc:
2990     The function child element of the element.
2991     @@Type: PerlCode
2992     @@Get:
2993     @@@nullCase:
2994     @@@@enDesc: There is no child element.
2995     @@@PerlDef:
2996     __DEEP{
2997     A: for my $child (@{$self-><AG::Node.childNodes>}) {
2998     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
2999     $r = $child;
3000     last A;
3001     }
3002     }__;
3003    
3004     @Attr:
3005     @@Name: argument
3006     @@enDesc:
3007     The argument child element of the element.
3008     @@Type: PerlCode
3009     @@Get:
3010     @@@nullCase:
3011     @@@@enDesc: There is no argument element.
3012     @@@PerlDef:
3013     __DEEP{
3014     my $x;
3015     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3016     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3017     if ($x) {
3018     $r = $child;
3019     last A;
3020     } else {
3021     $x = true;
3022     }
3023     }
3024     }__;
3025    
3026     @Attr:
3027     @@Name: indirect
3028     @@enDesc:
3029     The indirect object slot child element of the element.
3030     @@Type: PerlCode
3031     @@Get:
3032     @@@nullCase:
3033     @@@@enDesc: There is no indirect object element.
3034     @@@PerlDef:
3035     __DEEP{
3036     my $x = 0;
3037     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3038     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3039     if ($x++ == 2) {
3040     $r = $child;
3041     last A;
3042     }
3043     }
3044     }__;
3045    
3046    
3047     @ToStringMethod:
3048     @@Return:
3049     @@@Type: DOMString
3050     @@@PerlDef:
3051     __DEEP{
3052     my $f;
3053     my $arg;
3054     my $obj;
3055     no warnings 'uninitialized';
3056     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3057     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3058     if (not defined $f) {
3059     $f = ''.$child;
3060     } elsif (not defined $arg) {
3061     $arg = ''.$child;
3062     } else {
3063     $obj = ''.$child;
3064     last A;
3065     }
3066     }
3067    
3068     $r = $f;
3069     $r .= ' ' . $obj if defined $obj;
3070    
3071     if ({
3072     'die' => true,
3073     'last' => true,
3074     'next' => true,
3075     'redo' => true,
3076     'return' => true,
3077     'warn' => true,
3078     }->{$r}) {
3079     $r .= ' ' . $arg;
3080     } else {
3081     $r .= ' (' . $arg . ')';
3082     }
3083     }__;
3084     ##PCApply
3085    
3086     IFClsETDef:
3087 wakaba 1.43 @IFQName: PCExpression
3088     @CQName: ManakaiPCExpression
3089     @ETQName: pc|expression
3090    
3091     @IFISA: PerlCode
3092     @IFISA: PerlCodeInlines
3093     @CISA: ManakaiPCCodeInlines
3094    
3095     @enDesc:
3096     A <IF::PCExpression> object represents a sequence of one or more
3097     expression fragments (operands) separated by the same operator.
3098    
3099     @ATTR:
3100     @@Name: operator
3101     @@ATTRQName: pc|operator
3102     @@enDesc:
3103     The operator.
3104     @@ReflectCDATA:
3105     @@Get:
3106     @@Set:
3107    
3108     @Attr:
3109     @@Name: operandNumber
3110     @@enDesc:
3111     The number of operands.
3112 wakaba 1.73 @@Type: idl|unsignedLong
3113 wakaba 1.43 @@Get:
3114     @@@PerlDef:
3115     __DEEP{
3116     $r = @{$self-><AG::Node.childNodes>};
3117     }__;
3118    
3119     @ToStringMethod:
3120     @@Return:
3121     @@@Type: DOMString
3122     @@@PerlDef:
3123     __DEEP{
3124     my @r;
3125     no warnings 'uninitialized';
3126     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3127     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3128 wakaba 1.44 my $xuri = $child-><AG::Node.namespaceURI>
3129     . $child-><AG::Node.localName>;
3130     push @r, [$child.'', $child, $xuri];
3131 wakaba 1.43 }
3132     if (@r > 1) {
3133     my $op = $self-><AG::PCExpression.operator>;
3134     for (@r) {
3135 wakaba 1.44 if ($_->[2] ne <Q::pc:expression> and not {
3136 wakaba 1.45 <Q::pc:apply> => true,
3137 wakaba 1.44 <Q::pc:arrayRefLiteral> => true,
3138     <Q::pc:atom> => true,
3139     <Q::pc:dereference> => true,
3140     <Q::pc:hashRefLiteral> => true,
3141     <Q::pc:numberLiteral> => true,
3142     <Q::pc:stringLiteral> => true,
3143     <Q::pc:tokens> => true,
3144     <Q::pc:variable> => true,
3145     }->{$_->[2]}) {
3146     $_ = '(' . $_->[0] . ')';
3147     } elsif ($_->[2] eq <Q::pc:expression> and
3148     (not {
3149 wakaba 1.46 '**' => {'->' => true},
3150     '=~' => {'->' => true},
3151     '!~' => {'->' => true},
3152     '*' => {'->' => true, '*' => true},
3153     '/' => {'->' => true},
3154     '%' => {'->' => true},
3155     'x' => {'->' => true},
3156     '+' => {'->' => true, '*' => true, '+' => true, '-' => true},
3157     '-' => {'->' => true, '*' => true},
3158     '.' => {'->' => true},
3159     '<' => {'->' => true},
3160     '>' => {'->' => true},
3161     '<=' => {'->' => true},
3162     '>=' => {'->' => true},
3163     'lt' => {'->' => true},
3164     'gt' => {'->' => true},
3165     'le' => {'->' => true},
3166     'gr' => {'->' => true},
3167     '==' => {'->' => true},
3168     '!=' => {'->' => true},
3169     '<=>' => {'->' => true},
3170     'eq' => {'->' => true},
3171     'ne' => {'->' => true},
3172     'cmp' => {'->' => true},
3173     '&&' => {'->' => true, '&&' => true},
3174     '||' => {'->' => true, '||' => true},
3175     '..' => {'->' => true},
3176     '=' => {'->' => true},
3177     ',' => {'->' => true, ',' => true, '=>' => true},
3178     '=>' => {'->' => true, ',' => true, '=>' => true},
3179     'and' => {'->' => true, 'and' => true},
3180     'or' => {'->' => true, 'or' => true},
3181 wakaba 1.43 }->{$op}->{$_->[1]-><AG::PCExpression.operator>}) and
3182     $_->[1]-><AG::PCExpression.operandNumber> > 1) {
3183     $_ = '(' . $_->[0] . ')';
3184     } else {
3185     $_ = $_->[0];
3186     }
3187     }
3188 wakaba 1.44 $op = ' '.$op unless {
3189     ',' => true,
3190     '->' => true,
3191 wakaba 1.46 '..' => true,
3192     '...' => true,
3193 wakaba 1.44 }->{$op};
3194     $op = $op.' ' unless {
3195     '->' => true,
3196 wakaba 1.46 '..' => true,
3197     '...' => true,
3198 wakaba 1.44 }->{$op};
3199     $r = join $op, @r;
3200 wakaba 1.43 } elsif (@r) {
3201     $r = $r[0]->[0];
3202 wakaba 1.48 } elsif ($self-><AG::PCExpression.operator> eq ',') {
3203     $r = '()';
3204 wakaba 1.43 } else {
3205     $r = 'undef';
3206     }
3207     }__;
3208     ##PCExpression
3209    
3210     IFClsETDef:
3211 wakaba 1.25 @IFQName: PerlAssignment
3212 wakaba 1.35 @CQName: ManakaiPCAssignment
3213     @ETQName: pc|assignment
3214 wakaba 1.25
3215     @IFISA: PerlCode
3216 wakaba 1.35 @CISA: ManakaiPCCode
3217 wakaba 1.25
3218 wakaba 1.11 @enDesc:
3219 wakaba 1.36 Perl variable assignment.
3220 wakaba 1.11
3221     @ToStringMethod:
3222     @@Return:
3223 wakaba 1.35 @@@Type: DOMString
3224 wakaba 1.11 @@@enDesc:
3225     Perl code.
3226     @@@PerlDef:
3227 wakaba 1.35 __DEEP{
3228     $r = $self-><AG::PerlAssignment.leftCode>->stringify
3229     . ' = '
3230     . $self-><AG::PerlAssignment.rightCode>->stringify;
3231     }__;
3232    
3233     @Attr:
3234     @@Name: leftCode
3235     @@enDesc:
3236     Left-hand expression.
3237     @@Type: PerlCodeInlines
3238     @@Get:
3239     @@@nullCase:
3240     @@@@enDesc: Left-hand code not yet specified.
3241     @@@PerlDef:
3242     __DEEP{
3243     F: for my $child (@{$self-><AG::Node.childNodes>}) {
3244     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3245     $child-><AG::Node.localName> eq 'left') {
3246     $r = $child-><AG::Node.lastChild>;
3247     last F;
3248     }
3249     }
3250     }__;
3251     @@Set:
3252     @@@PerlDef:
3253     __DEEP{
3254     F: {
3255     for my $child (@{$self-><AG::Node.childNodes>}) {
3256     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3257     $child-><AG::Node.localName> eq 'left') {
3258     $child-><AS::Node.textContent> ('');
3259     $child-><M::Node.appendChild> ($given);
3260     last F;
3261     }
3262     }
3263     my $node = $self-><AG::Node.ownerDocument>
3264     -><M::Document.createElementNS>
3265     (<Q::pc:>, 'left');
3266     $node-><M::Node.appendChild> ($given);
3267     $self-><M::Node.appendChild> ($node);
3268     }
3269     }__;
3270    
3271     @Attr:
3272     @@Name: rightCode
3273     @@enDesc:
3274     Right-hand expression.
3275     @@Type: PerlCodeInlines
3276     @@Get:
3277     @@@nullCase:
3278     @@@@enDesc: Right-hand code not yet specified.
3279     @@@PerlDef:
3280     __DEEP{
3281     F: for my $child (@{$self-><AG::Node.childNodes>}) {
3282     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3283     $child-><AG::Node.localName> eq 'right') {
3284     $r = $child-><AG::Node.lastChild>;
3285     last F;
3286     }
3287     }
3288     }__;
3289     @@Set:
3290     @@@PerlDef:
3291     __DEEP{
3292     F: {
3293     for my $child (@{$self-><AG::Node.childNodes>}) {
3294     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3295     $child-><AG::Node.localName> eq 'right') {
3296     $child-><AS::Node.textContent> ('');
3297     $child-><M::Node.appendChild> ($given);
3298     last F;
3299     }
3300     }
3301     my $node = $self-><AG::Node.ownerDocument>
3302     -><M::Document.createElementNS>
3303     (<Q::pc:>, 'right');
3304     $node-><M::Node.appendChild> ($given);
3305     $self-><M::Node.appendChild> ($node);
3306     }
3307     }__;
3308 wakaba 1.11 ##PerlAssignment
3309    
3310 wakaba 1.35 IFClsETDef:
3311 wakaba 1.44 @IFQName: PCCondition
3312     @CQName: ManakaiPCCondition
3313     @ETQName: pc2|condition
3314    
3315     @IFISA: PerlCode
3316     @IFISA: PerlCodeInlines
3317     @CISA: ManakaiPCCodeInlines
3318    
3319     @enDesc:
3320     A <IF::PCCondition> object represents a condition expression
3321     part of an <Perl::if> or <Perl::while> statement.
3322    
3323     @ToStringMethod:
3324     @@Return:
3325     @@@Type: DOMString
3326     @@@PerlDef:
3327     __DEEP{
3328     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3329     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3330     $r .= $child;
3331     }
3332     }__;
3333     ##PCCondition
3334    
3335     IFClsETDef:
3336     @IFQName: PCBlock
3337     @CQName: ManakaiPCBlock
3338     @ETQName: pc2|block
3339    
3340     @IFISA: PerlCode
3341     @IFISA: PerlCodeStatements
3342     @CISA: ManakaiPCCodeStatements
3343    
3344     @enDesc:
3345     A <Q::PCBlock> object represents a Perl code block, i.e.
3346     a set of statements enclosed by <CHAR::{> and <CHAR::}> pair.
3347    
3348     @ToStringMethod:
3349     @@Return:
3350     @@@Type: DOMString
3351     @@@PerlDef:
3352     __DEEP{
3353     my @child = @{$self-><AG::Node.childNodes>};
3354     my $label = $self-><AG::PerlCodeStatements.label>;
3355    
3356     $r = "\x0A";
3357     for my $child (@child) {
3358     if ($child-><AG::Node.localName> eq 'inlineContainer' and
3359     1 == @child) {
3360     $r .= '(' . $child->stringify . ')';
3361     } else {
3362     $r .= $child->stringify;
3363     }
3364     }
3365     $r .= "\x0A";
3366     $r .= ';' unless @child;
3367    
3368 wakaba 1.59 $r = "\n{\n$r\n}\n";
3369 wakaba 1.44
3370     $r = "\n" . $label . ':' . $r . '# ' . $label . "\n"
3371     if length $label;
3372    
3373     }__;
3374     ##PCBlock
3375    
3376     IFClsETDef:
3377 wakaba 1.45 @IFQName: PCWhile
3378     @CQName: ManakaiPCWhile
3379     @ETQName: pc|while
3380    
3381     @IFISA: PerlCode
3382     @CISA: ManakaiPCCode
3383    
3384     @enDesc:
3385     A <IF::PCWhile> object represents a <Perl::while> statement.
3386     It can contain two child elements: <Q::pc2|condition> and <Q::pc2|block>,
3387     each represents the condition expression and the block of the <Perl::while>
3388     statement.
3389    
3390     @ATTR:
3391     @@Name: label
3392     @@ATTRQName: pc|label
3393     @@enDesc:
3394     Label for this block.
3395     @@ReflectCDATA:
3396     @@Get:
3397     @@@nullCase:
3398     @@@@enDesc:
3399     No label.
3400     @@Set:
3401     @@@nullCase:
3402     @@@@enDesc:
3403     No label.
3404    
3405     @Attr:
3406     @@Name: condition
3407     @@enDesc:
3408     The condition object.
3409     @@Type: PCCondition
3410     @@Get:
3411     @@@nullCase:
3412     @@@@enDesc:
3413     There is no condition element.
3414     @@@PerlDef:
3415     __CODE{getChildElementByType::
3416     $namespaceURI => {<Q::pc2:>},
3417     $localName => {'condition'},
3418     $parent => $self,
3419     $result => $r,
3420     }__;
3421    
3422     @Attr:
3423     @@Name: block
3424     @@enDesc:
3425     The code block that is executed while the <A::PCWhile.condition> met.
3426     @@Type: PCBlock
3427     @@Get:
3428     @@@nullCase:
3429     @@@@enDesc:
3430     There is no <Q::pc2:block> child element.
3431     @@@PerlDef:
3432     __CODE{getChildElementByType::
3433     $namespaceURI => {<Q::pc2:>},
3434     $localName => {'block'},
3435     $parent => $self,
3436     $result => $r,
3437     }__;
3438    
3439     @ToStringMethod:
3440     @@Return:
3441     @@@Type: DOMString
3442     @@@PerlDef:
3443     __DEEP{
3444     $r = 'while (';
3445     my $cond = $self-><AG::PCWhile.condition>;
3446     if ($cond) {
3447     $r .= $cond->stringify;
3448     } else {
3449     $r .= '0';
3450     }
3451     $r .= ') ';
3452     my $block = $self-><AG::PCWhile.block>;
3453     if ($block) {
3454     $r .= $block->stringify;
3455     } else {
3456     $r .= "{ }\n";
3457     }
3458    
3459     my $label = $self-><AG::PCWhile.label>;
3460     $r = "\n" . $label . ': ' . $r . ' # ' . $label . "\n"
3461     if length $label;
3462     }__;
3463     ##PCWhile
3464    
3465     IFClsETDef:
3466 wakaba 1.43 @IFQName: PCChoose
3467     @CQName: ManakaiPCChoose
3468     @ETQName: pc|choose
3469    
3470     @IFISA: PerlCode
3471     @CISA: ManakaiPCCode
3472    
3473     @enDesc:
3474     A <IF::PCChoose> object, or a <Q::pc|choose> element, represents
3475     a set of <Perl::if>, <Perl::elsif>, and <Perl::else> statements.
3476    
3477     @Method:
3478     @@Name: getWhen
3479     @@enDesc:
3480     Returns a <IF::PCWhen> by its ordinal index.
3481     @@Param:
3482     @@@Name: index
3483 wakaba 1.73 @@@Type: idl|unsignedLong
3484 wakaba 1.43 @@@enDesc:
3485     The ordinal index of the <Q::pc|when> element.
3486     @@Return:
3487     @@@Type: PCWhen
3488     @@@enDesc:
3489     The <P::index>th <Q::pc|when> object.
3490     @@@nullCase:
3491     @@@@enDesc:
3492     There is no <P::index>th element.
3493     @@@PerlDef:
3494     __DEEP{
3495     my $i = 0;
3496     no warnings 'uninitialized';
3497     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3498     if ($child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE> and
3499     $child-><AG::Node.namespaceURI> eq <Q::pc:> and
3500     $child-><AG::Node.localName> eq 'when' and
3501     ++$i == $index) {
3502     $r = $child;
3503     last A;
3504     }
3505     }
3506     }__;
3507    
3508     @Method:
3509     @@Name: appendNewPCWhen
3510     @@enDesc:
3511     Appends a new <Q::pc|when> element.
3512     @@Return:
3513     @@@Type: PCWhen
3514     @@@enDesc:
3515     The newly created <Q::pc|when> element.
3516     @@@PerlDef:
3517     __DEEP{
3518     my $od = $self-><AG::Node.ownerDocument>;
3519     $r = $od-><M::Document.createElementNS> (<Q::pc:>, 'when');
3520     my $cond = $od-><M::Document.createElementNS>
3521 wakaba 1.44 (<Q::pc2:>, 'condition');
3522 wakaba 1.43 $r-><M::Node.appendChild> ($cond);
3523     my $block = $od-><M::Document.createElementNS>
3524 wakaba 1.44 (<Q::pc2:>, 'block');
3525 wakaba 1.43 $r-><M::Node.appendChild> ($block);
3526     $self-><M::Node.insertBefore> ($r, $self-><AG::PCChoose.otherwise>);
3527     }__;
3528    
3529     @Attr:
3530     @@Name: otherwise
3531     @@enDesc:
3532     Returns the <IF::PCOtherwise> by its ordinal index.
3533     @@Type: PCOtherwise
3534     @@Get:
3535     @@@enDesc:
3536     The <Q::pc|otherwise> object.
3537     @@@nullCase:
3538     @@@@enDesc:
3539     There is no <Q::pc|otherwise> element.
3540     @@@PerlDef:
3541     __CODE{getChildElementByType::
3542     $namespaceURI => {<Q::pc:>},
3543     $localName => {'otherwise'},
3544     $parent => $self,
3545     $result => $r,
3546     }__;
3547    
3548     @Method:
3549     @@Name: appendNewPCOtherwise
3550     @@enDesc:
3551     Appends a new <Q::pc|otherwise> element. If there is already the
3552     <Q::pc|otherwise> element, then no element is created and
3553     the element is returned.
3554     @@Return:
3555     @@@Type: PCOtherwise
3556     @@@enDesc:
3557     The <Q::pc|otherwise> element.
3558     @@@PerlDef:
3559     __DEEP{
3560     $r = $self-><AG::PCChoose.otherwise>;
3561     unless ($r) {
3562     my $od = $self-><AG::Node.ownerDocument>;
3563     $r = $od-><M::Document.createElementNS> (<Q::pc:>, 'otherwise');
3564     my $block = $od-><M::Document.createElementNS>
3565 wakaba 1.44 (<Q::pc2:>, 'block');
3566 wakaba 1.43 $r-><M::Node.appendChild> ($block);
3567     $self-><M::Node.appendChild> ($r);
3568     }
3569     }__;
3570    
3571     @ToStringMethod:
3572     @@Return:
3573     @@@Type: DOMString
3574     @@@PerlDef:
3575     __DEEP{
3576     S: for my $child (@{$self-><AG::Node.childNodes>}) {
3577     next S unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3578     next S unless $child-><AG::Node.namespaceURI> eq <Q::pc:>;
3579     my $ln = $child-><AG::Node.localName>;
3580     if ($ln eq 'when') {
3581     $r .= 'els' if length $r;
3582     $r .= $child->stringify;
3583     } elsif ($ln eq 'otherwise') {
3584     $r .= $child->stringify;
3585     last S;
3586     }
3587     } # S
3588     }__;
3589     ##PCChoose
3590    
3591     IFClsETDef:
3592     @IFQName: PCWhen
3593     @CQName: ManakaiPCWhen
3594     @ETQName: pc|when
3595    
3596     @IFISA: PerlCode
3597     @CISA: ManakaiPCCode
3598    
3599     @enDesc:
3600     A <IF::PCWhen> object, or a <Q::pc|when> element, represents an
3601     <Perl::if> or <Perl::elsif> block.
3602    
3603     @Attr:
3604     @@Name: condition
3605     @@enDesc:
3606 wakaba 1.44 The condition object.
3607     @@Type: PCCondition
3608 wakaba 1.43 @@Get:
3609     @@@nullCase:
3610     @@@@enDesc:
3611 wakaba 1.44 There is no condition element.
3612 wakaba 1.43 @@@PerlDef:
3613     __CODE{getChildElementByType::
3614 wakaba 1.44 $namespaceURI => {<Q::pc2:>},
3615 wakaba 1.43 $localName => {'condition'},
3616     $parent => $self,
3617     $result => $r,
3618     }__;
3619    
3620     @Attr:
3621     @@Name: block
3622     @@enDesc:
3623     The code block that is executed when the <A::PCWhen.condition> met.
3624 wakaba 1.44 @@Type: PCBlock
3625 wakaba 1.43 @@Get:
3626     @@@nullCase:
3627     @@@@enDesc:
3628 wakaba 1.44 There is no <Q::pc2:block> child element.
3629 wakaba 1.43 @@@PerlDef:
3630     __CODE{getChildElementByType::
3631 wakaba 1.44 $namespaceURI => {<Q::pc2:>},
3632 wakaba 1.43 $localName => {'block'},
3633     $parent => $self,
3634     $result => $r,
3635     }__;
3636    
3637     @ToStringMethod:
3638     @@Return:
3639     @@@Type: DOMString
3640     @@@PerlDef:
3641     __DEEP{
3642     $r = 'if (';
3643     my $cond = $self-><AG::PCWhen.condition>;
3644     if ($cond) {
3645     $r .= $cond->stringify;
3646     } else {
3647     $r .= '0';
3648     }
3649     $r .= ') ';
3650     my $block = $self-><AG::PCWhen.block>;
3651     if ($block) {
3652     $r .= $block->stringify;
3653     } else {
3654     $r .= "{ }\n";
3655     }
3656     }__;
3657     ##PCWhen
3658    
3659     IFClsETDef:
3660     @IFQName: PCOtherwise
3661     @CQName: ManakaiPCOtherwise
3662     @ETQName: pc|otherwise
3663    
3664     @IFISA: PerlCode
3665     @CISA: ManakaiPCCode
3666    
3667     @enDesc:
3668     A <IF::PCOtherwise> object, or a <Q::pc|otherwise> element, represents an
3669     <Perl::else> clause.
3670    
3671     @Attr:
3672     @@Name: block
3673     @@enDesc:
3674     The code block that is executed.
3675 wakaba 1.44 @@Type: PCBlock
3676 wakaba 1.43 @@Get:
3677     @@@nullCase:
3678     @@@@enDesc:
3679 wakaba 1.44 There is no <Q::pc2:block> child element.
3680 wakaba 1.43 @@@PerlDef:
3681     __CODE{getChildElementByType::
3682 wakaba 1.44 $namespaceURI => {<Q::pc2:>},
3683 wakaba 1.43 $localName => {'block'},
3684     $parent => $self,
3685     $result => $r,
3686     }__;
3687    
3688     @ToStringMethod:
3689     @@Return:
3690     @@@Type: DOMString
3691     @@@PerlDef:
3692     __DEEP{
3693     my $block = $self-><AG::PCOtherwise.block>;
3694     if ($block) {
3695     $r = 'else ' . $block->stringify;
3696     }
3697     }__;
3698     ##PCOtherwise
3699    
3700     ResourceDef:
3701     @QName: getChildElementByType
3702     @rdf:type: DISPerl|BlockCode
3703     @enDesc:
3704     Returns the first element of a type.
3705     @PerlCDef:
3706     __DEEP{
3707     no warnings 'uninitialized';
3708     A: for my $__child (@{$parent-><AG::Node.childNodes>}) {
3709     if ($__child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE> and
3710     $__child-><AG::Node.namespaceURI> eq $namespaceURI and
3711     $__child-><AG::Node.localName> eq $localName) {
3712     $result = $__child;
3713     last A;
3714     }
3715     }
3716     }__;
3717    
3718     IFClsETDef:
3719 wakaba 1.26 @IFQName: PerlIf
3720 wakaba 1.35 @CQName: ManakaiPCIf
3721     @ETQName: pc|if
3722 wakaba 1.25
3723     @IFISA: PerlCode
3724 wakaba 1.35 @CISA: ManakaiPCCode
3725 wakaba 1.25
3726 wakaba 1.12 @enDesc:
3727     Perl variable assignment.
3728    
3729     @ToStringMethod:
3730     @@Return:
3731 wakaba 1.35 @@@Type: DOMString
3732 wakaba 1.12 @@@enDesc:
3733     Perl code.
3734     @@@PerlDef:
3735 wakaba 1.35 __DEEP{
3736     my $tcode = $self-><AG::PerlIf.trueCode>;
3737     my $fcode = $self-><AG::PerlIf.falseCode>;
3738     my $ccode = $self-><AG::PerlIf.condition>;
3739     if (defined $tcode) {
3740     if (defined $fcode) {
3741     $r = q<if (> . $ccode->stringify . q<) {> . $tcode->stringify .
3742     q<} else {> . $fcode->stringify . qq<}\n>;
3743     } else {
3744 wakaba 1.36 $r = q<if (> . $ccode->stringify . q<) {> . $tcode->stringify .
3745 wakaba 1.35 qq<}\n>;
3746     }
3747     } else {
3748     $r = q<unless (> . $ccode->stringify . q<) {> . $fcode->stringify .
3749     qq<}\n>;
3750     }
3751     }__;
3752    
3753     @Attr:
3754     @@Name: condition
3755     @@enDesc:
3756     Condition expression.
3757     @@Type: PerlCodeInlines
3758     @@Get:
3759     @@@nullCase:
3760     @@@@enDesc: Condition code not yet specified.
3761     @@@PerlDef:
3762     __DEEP{
3763     F: for my $child (@{$self-><AG::Node.childNodes>}) {
3764     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3765     $child-><AG::Node.localName> eq 'condition') {
3766     $r = $child-><AG::Node.lastChild>;
3767     last F;
3768     }
3769     }
3770     }__;
3771     @@Set:
3772     @@@PerlDef:
3773     __DEEP{
3774     F: {
3775     for my $child (@{$self-><AG::Node.childNodes>}) {
3776     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3777     $child-><AG::Node.localName> eq 'condition') {
3778     $child-><AS::Node.textContent> ('');
3779     $child-><M::Node.appendChild> ($given);
3780     last F;
3781     }
3782     }
3783     my $node = $self-><AG::Node.ownerDocument>
3784     -><M::Document.createElementNS>
3785     (<Q::pc:>, 'condition');
3786     $node-><M::Node.appendChild> ($given);
3787     $self-><M::Node.appendChild> ($node);
3788     }
3789     }__;
3790    
3791     @Attr:
3792     @@Name: trueCode
3793     @@enDesc:
3794     True-case code.
3795     @@Type: PerlCodeBlocks
3796     @@Get:
3797     @@@nullCase:
3798     @@@@enDesc: True-case code not yet specified.
3799     @@@PerlDef:
3800     __DEEP{
3801     F: for my $child (@{$self-><AG::Node.childNodes>}) {
3802     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3803     $child-><AG::Node.localName> eq 'tr'.'ue') {
3804     $r = $child-><AG::Node.lastChild>;
3805     last F;
3806     }
3807     }
3808     }__;
3809     @@Set:
3810     @@@PerlDef:
3811     __DEEP{
3812     F: {
3813     for my $child (@{$self-><AG::Node.childNodes>}) {
3814     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3815     $child-><AG::Node.localName> eq 'tr'.'ue') {
3816     $child-><AS::Node.textContent> ('');
3817     $child-><M::Node.appendChild> ($given);
3818     last F;
3819     }
3820     }
3821     my $node = $self-><AG::Node.ownerDocument>
3822     -><M::Document.createElementNS>
3823     (<Q::pc:>, 'tr'.'ue');
3824     $node-><M::Node.appendChild> ($given);
3825     $self-><M::Node.appendChild> ($node);
3826     }
3827     }__;
3828    
3829     @Attr:
3830     @@Name: falseCode
3831     @@enDesc:
3832     False-case code.
3833     @@Type: PerlCodeBlocks
3834     @@Get:
3835     @@@nullCase:
3836     @@@@enDesc: True-case code not yet specified.
3837     @@@PerlDef:
3838     __DEEP{
3839     F: for my $child (@{$self-><AG::Node.childNodes>}) {
3840     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3841     $child-><AG::Node.localName> eq 'fal'.'se') {
3842     $r = $child-><AG::Node.lastChild>;
3843     last F;
3844     }
3845     }
3846     }__;
3847     @@Set:
3848     @@@PerlDef:
3849     __DEEP{
3850     F: {
3851     for my $child (@{$self-><AG::Node.childNodes>}) {
3852     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3853     $child-><AG::Node.localName> eq 'fal'.'se') {
3854     $child-><AS::Node.textContent> ('');
3855     $child-><M::Node.appendChild> ($given);
3856     last F;
3857     }
3858     }
3859     my $node = $self-><AG::Node.ownerDocument>
3860     -><M::Document.createElementNS>
3861     (<Q::pc:>, 'fal'.'se');
3862     $node-><M::Node.appendChild> ($given);
3863     $self-><M::Node.appendChild> ($node);
3864     }
3865     }__;
3866 wakaba 1.12 ##PerlIf
3867    
3868 wakaba 1.43 IFClsETDef:
3869     @IFQName: PCFunctionCall
3870     @CQName: ManakaiPCFunctionCall
3871     @ETQName: pc|call
3872    
3873     @IFISA: PerlCode
3874     @IFISA: PerlCodeInlines
3875     @CISA: ManakaiPCCodeInlines
3876    
3877     @enDesc:
3878     A <IF::PCFunctionCall> object represents a function call or
3879     function-like statement such as <Perl::next>.
3880    
3881     @ATTR:
3882     @@Name: variableType
3883     @@ATTRQName: pc|variableType
3884     @@enDesc:
3885     The value of the attribute <kwd:MAY> be <Perl::&>,
3886     which introduces a subroutine name.
3887     @@ReflectCDATA:
3888     @@Get:
3889     @@Set:
3890    
3891     @ATTR:
3892     @@Name: packageName
3893     @@ATTRQName: pc|packageName
3894     @@enDesc:
3895     The name of the package to which the subroutine belongs.
3896     @@ReflectCDATA:
3897     @@Get:
3898     @@@nullCase:
3899     @@@@enDesc:
3900     The object belongs to the current package or
3901     does not belong to any package.
3902     @@Set:
3903     @@@nullCase:
3904     @@@@enDesc:
3905     The object belongs to the current package or
3906     does not belong to any package.
3907    
3908     @ATTR:
3909     @@Name: pcLocalName
3910     @@ATTRQName: pc|localName
3911     @@enDesc:
3912     The local part of the subroutine name.
3913     @@ReflectCDATA:
3914     @@Get:
3915     @@Set:
3916    
3917     @ToStringMethod:
3918     @@Return:
3919     @@@Type: DOMString
3920     @@@PerlDef:
3921     __DEEP{
3922     $r .= $self-><AG::PCFunctionCall.variableType>;
3923     my $v = $self-><AG::PCFunctionCall.packageName>;
3924     $r .= $v . '::' if length $v;
3925     $r .= $self-><AG::PCFunctionCall.pcLocalName>;
3926    
3927     my @arg;
3928     no warnings 'uninitialized';
3929     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3930     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3931     push @arg, ''.$child;
3932     }
3933     my $arg = join ', ', @arg;
3934     if ({
3935     'die' => true,
3936     'last' => true,
3937     'next' => true,
3938     'redo' => true,
3939 wakaba 1.44 'return' => true,
3940 wakaba 1.43 'warn' => true,
3941 wakaba 1.44 }->{$r}) {
3942 wakaba 1.43 $r .= ' ' . $arg;
3943     } else {
3944     $r .= ' (' . $arg . ')';
3945     }
3946     }__;
3947     ##PCFunctionCall
3948    
3949 wakaba 1.66 IFClsETDef:
3950     @IFQName: PCHasFeature
3951     @CQName: ManakaiPCHasFeature
3952     @ETQName: pc|hasFeature
3953    
3954     @IFISA: PerlCode
3955    
3956     @IFISA: PerlCodeStatements
3957     @CISA: ManakaiPCCodeStatements
3958    
3959     @enDesc:
3960     The <XE::pc|hasFeature> element is used to indicate
3961     that the code contained in the parent element implements
3962     a feature identified by attributes of the
3963     <XE::pc|hasFeature> element.
3964    
3965     @ATTR:
3966     @@Name: featureName
3967     @@ATTRQName: pc|featureName
3968     @@enDesc:
3969     The name of the feature.
3970     @@ReflectCDATA:
3971     @@Get:
3972     @@Set:
3973    
3974     @ATTR:
3975     @@Name: featureVersion
3976     @@ATTRQName: pc|featureVersion
3977     @@enDesc:
3978     The version of the feature.
3979     @@ReflectCDATA:
3980     @@Get:
3981     @@Set:
3982    
3983     @ToStringMethod:
3984     @@Return:
3985     @@@Type: DOMString
3986     @@@PerlDef: \
3987     ##PCHasFeature
3988    
3989     IFClsETDef:
3990     @IFQName: PCElementType
3991     @CQName: ManakaiPCElementType
3992     @ETQName: pc|elementType
3993    
3994     @IFISA: PerlCode
3995    
3996     @IFISA: PerlCodeStatements
3997     @CISA: ManakaiPCCodeStatements
3998    
3999     @enDesc:
4000     The <XE::pc|hasFeature> element is used to indicate
4001     that the code contained in the parent element implements
4002     the interface for an interface identified by attributes of the
4003     <XE::pc|elementType> element.
4004    
4005     @ATTR:
4006     @@Name: pcNamespaceURI
4007     @@ATTRQName: pc|namespaceURI
4008     @@enDesc:
4009     The namespace URI of the element type.
4010     @@ReflectCDATA:
4011     @@Get:
4012     @@Set:
4013    
4014     @ATTR:
4015     @@Name: pcLocalName
4016     @@ATTRQName: pc|localName
4017     @@enDesc:
4018     The local name of the element type.
4019     @@ReflectCDATA:
4020     @@Get:
4021     @@Set:
4022    
4023     @ToStringMethod:
4024     @@Return:
4025     @@@Type: DOMString
4026     @@@PerlDef: \
4027     ##PCElementType
4028    
4029 wakaba 1.39 ## -- Configuration Parameters
4030    
4031     boolCParam:
4032 wakaba 1.54 @QName: pc|preserve-line-break
4033     @nodeProp: plb
4034 wakaba 1.59 @c:targetType: tc|Document
4035 wakaba 1.54 @IsSupportRequired:1
4036     @TrueCase:
4037 wakaba 1.59 @@c:isSupported:1
4038 wakaba 1.54 @@enDesc:
4039     When stringifying a <IF::PerlStringLiteral>, if it contains
4040     <CODE::U+000A> and / or <CODE::U+000D> characters, then
4041     they are escaped (e.g. <Perl::\x0A>).
4042     @@TestC:
4043     @@@QName: cfg.preserve-line-break.true.test
4044     @@@PerlCDef:
4045     my $doc;
4046     __CODE{createPCDocumentForTest:: $doc => $doc}__;
4047    
4048     my $cfg = $doc-><AG::Document.domConfig>;
4049     $cfg-><M::CFG.setParameter> (<Q::pc|preserve-line-break> => true);
4050    
4051     $test->id ('crlf');
4052     my $sl = $doc-><M::PCDocument.createPCLiteral> ("ab\x0D\x0Acd");
4053     my $str = $sl->stringify;
4054     $test->assert_equals ($str, q<"ab\x0D\x0Acd">);
4055    
4056     $test->id ('lf');
4057     my $sl2 = $doc-><M::PCDocument.createPCLiteral> ("ab\x0Acd");
4058     my $str2 = $sl2->stringify;
4059     $test->assert_equals ($str2, q<"ab\x0Acd">);
4060     @FalseCase:
4061 wakaba 1.59 @@c:isSupported:1
4062 wakaba 1.54 @@IsSupportRequired:1
4063     @@IsDefault:1
4064     @@enDesc:
4065     Line break characters are stringified as is.
4066     @@TestC:
4067     @@@QName: cfg.preserve-line-break.false.test
4068     @@@PerlCDef:
4069     my $doc;
4070     __CODE{createPCDocumentForTest:: $doc => $doc}__;
4071    
4072     my $cfg = $doc-><AG::Document.domConfig>;
4073     $cfg-><M::CFG.setParameter> (<Q::pc|preserve-line-break> => false);
4074    
4075     $test->id ('crlf');
4076     my $sl = $doc-><M::PCDocument.createPCLiteral> ("ab\x0D\x0Acd");
4077     my $str = $sl->stringify;
4078     $test->assert_equals ($str, q<'ab>.qq<\x0D\x0A>.q<cd'>);
4079    
4080     $test->id ('lf');
4081     my $sl2 = $doc-><M::PCDocument.createPCLiteral> ("ab\x0Acd");
4082     my $str2 = $sl2->stringify;
4083     $test->assert_equals ($str2, q<'ab>.qq<\x0A>.q<cd'>);
4084     @TestC:
4085     @@QName: cfg.preserve-line-break.set.test
4086     @@PerlCDef:
4087     my $doc;
4088     __CODE{createPCDocumentForTest:: $doc => $doc}__;
4089    
4090     my $cfg = $doc-><AG::Document.domConfig>;
4091    
4092     $test->id ('default');
4093     $test->assert_false ($cfg-><M::CFG.getParameter>
4094     (<Q::pc|preserve-line-break>));
4095    
4096     $test->id ('set.f.to.t');
4097     $cfg-><M::CFG.setParameter> (<Q::pc|preserve-line-break> => true);
4098     $test->assert_true ($cfg-><M::CFG.getParameter>
4099     (<Q::pc|preserve-line-break>));
4100    
4101     $test->id ('set.t.to.f');
4102     $cfg-><M::CFG.setParameter> (<Q::pc|preserve-line-break> => false);
4103     $test->assert_false ($cfg-><M::CFG.getParameter>
4104     (<Q::pc|preserve-line-break>));
4105    
4106     $cfg-><M::CFG.setParameter> (<Q::pc|preserve-line-break> => true);
4107    
4108     $test->id ('reset');
4109     $cfg-><M::CFG.setParameter> (<Q::pc|preserve-line-break> => null);
4110     $test->assert_false ($cfg-><M::CFG.getParameter>
4111     (<Q::pc|preserve-line-break>));
4112    
4113     ResourceDef:
4114     @QName: CFG
4115 wakaba 1.59 @AliasFor: c|DOMConfiguration
4116 wakaba 1.39
4117     CParam:
4118     @QName: pc|split-resolver
4119     @nodeProp: pcsres
4120     @IsSupportRequired:1
4121 wakaba 1.59 @c:targetType: tc|Document
4122 wakaba 1.73 @Type: DISPerl|CODE
4123 wakaba 1.39 @enDesc:
4124     Splits module file. The parameter value <kwd:MUST> be
4125     a Perl code reference. The serializer would invoke
4126     the code with arguments: a reserved parameter, a <IF::PerlFile>
4127     whose serialization is being split, and a string
4128     that identifies the split part. The code is expected
4129     to return a <IF::DOMLS:LSOutput> object to which the module part
4130     is written. Note that splitting serialized module file
4131     does not affect to the <IF::PerlFile> tree.
4132     @nullCase:
4133     @@enDesc:
4134     Does not split module file.
4135    
4136     ElementTypeBinding:
4137     @Name: nodeProp
4138     @ElementType:
4139 wakaba 1.59 tc:nodeStemKey
4140 wakaba 1.39
4141     ElementTypeBinding:
4142     @Name: CParam
4143     @ElementType:
4144     dis:ResourceDef
4145     @ShadowContent:
4146     @@rdf:type:
4147 wakaba 1.59 @@@@: c|DOMConfigurationParameter
4148 wakaba 1.39 @@rdf:type:
4149     @@@@: DISCore|Property
4150    
4151     ElementTypeBinding:
4152     @Name: boolCParam
4153     @ElementType:
4154     dis:ResourceDef
4155     @ShadowContent:
4156     @@rdf:type:
4157 wakaba 1.59 @@@@: c|DOMConfigurationParameter
4158 wakaba 1.39 @@rdf:type:
4159     @@@@: DISCore|Property
4160 wakaba 1.73 @@Type: idl|boolean
4161 wakaba 1.39
4162 wakaba 1.41 ## -- PCDocument
4163    
4164     IFClsDef:
4165     @IFQName: PCDocument
4166     @CQName: ManakaiPCDocument
4167    
4168 wakaba 1.66 @domperl:implementedByObjectsOf: Document
4169     @domperl:classImplementedByObjectsOf: td|ManakaiDOMDocument
4170 wakaba 1.41
4171     @enDesc:
4172     A <IF::PCDocument> is a <IF::Document> that represents a Perl code.
4173    
4174 wakaba 1.59 @Test:
4175     @@QName: DOMImplementation.createDocument.PCDocument.test
4176     @@PerlDef:
4177     my $impl;
4178     __CODE{tc|createImplForTest:: $impl => $impl}__;
4179    
4180     my $doc = $impl-><M::DOMImpl.createDocument> (<Q::pc:>, 'pc:file');
4181    
4182     $test->id ('Document');
4183     $test->assert_isa ($doc, <IFName::Document>);
4184    
4185     $test->id ('PCDocument');
4186     $test->assert_isa ($doc, <IFName::PCDocument>);
4187    
4188     my $de = $doc-><AG::Document.documentElement>;
4189    
4190     $test->id ('documentElement.Element');
4191     $test->assert_isa ($de, <IFName::Element>);
4192    
4193     $test->id ('documentElement.PerlFile');
4194     $test->assert_isa ($de, <IFName::PerlFile>);
4195    
4196 wakaba 1.41 @Method:
4197     @@Name: createPCLiteral
4198     @@enDesc:
4199     Creates a literal object.
4200 wakaba 1.47
4201     {NOTE:: If a member of <P::value> is a <IF::PerlCode> object,
4202 wakaba 1.62 then it is appended to the tree as is.
4203 wakaba 1.47 }
4204 wakaba 1.41 @@Param:
4205     @@@Name: value
4206 wakaba 1.73 @@@Type: DISPerl|Any
4207 wakaba 1.41 @@@enDesc:
4208     The value.
4209     @@@InCase:
4210 wakaba 1.73 @@@@Type: DISPerl|String
4211 wakaba 1.41 @@@@enDesc:
4212     A <IF::PerlStringLiteral> whose value is <P::value> is created.
4213     @@@InCase:
4214 wakaba 1.73 @@@@Type: DISPerl|ARRAY
4215 wakaba 1.41 @@@@enDesc:
4216     A <IF::PCArrayRefLiteral> is created. If <P::value>
4217     has items, then objects are recursively created.
4218     @@@InCase:
4219 wakaba 1.73 @@@@Type: DISPerl|HASH
4220 wakaba 1.41 @@@@enDesc:
4221     A <IF::PCHashRefLiteral> is created. If <P::value>
4222     has key-value pairs, then objects are recursively created.
4223     @@Return:
4224     @@@Type: PerlCode
4225     @@@enDesc: The newly created value object.
4226     @@@PerlDef:
4227     __DEEP{
4228     if (ref $value eq 'HASH' or ref $value eq 'ARRAY') {
4229     $r = $self-><M::Document.createElementNS>
4230     (<Q::pc:>, ref $value eq 'HASH' ? 'hashRefLiteral'
4231     : 'arrayRefLiteral');
4232     for my $v (ref $value eq 'HASH' ? %$value : @$value) {
4233 wakaba 1.62 unless (UNIVERSAL::isa ($v, <IFName::PerlCode>)) {
4234 wakaba 1.63 $v = $self-><M::PCDocument.createPCLiteral> ($v);
4235 wakaba 1.41 }
4236 wakaba 1.64 $r-><M::Node.appendChild> ($v);
4237 wakaba 1.41 }
4238 wakaba 1.51 } elsif (defined $value) {
4239 wakaba 1.41 $r = $self-><M::Document.createElementNS>
4240     (<Q::pc:>, 'stringLiteral');
4241     $r-><AS::Node.textContent> ($value);
4242 wakaba 1.51 } else {
4243     $r = $self-><M::Document.createElementNS>
4244     (<Q::pc:>, 'atom');
4245     $r-><AS::Node.textContent> ('undef');
4246 wakaba 1.41 }
4247 wakaba 1.43 }__;
4248 wakaba 1.51 @@Test:
4249     @@@QName: PCDocument.createPCLiteral.undef.test
4250     @@@PerlDef:
4251     my $doc;
4252     __CODE{createPCDocumentForTest:: $doc => $doc}__;
4253    
4254     $test->id ('undef.element');
4255     my $e1 = $doc-><M::PCDocument.createPCLiteral> (null);
4256     $test->assert_isa ($e1, <IFName::PerlAtom>);
4257     $test->assert_equals ($e1-><AG::Node.textContent>, 'undef');
4258    
4259     $test->id ('string.empty.element');
4260     my $e2 = $doc-><M::PCDocument.createPCLiteral> ('');
4261     $test->assert_isa ($e2, <IFName::PerlStringLiteral>);
4262     $test->assert_equals ($e2-><AG::Node.textContent>, '');
4263    
4264     $test->id ('string.zero.element');
4265     my $e3 = $doc-><M::PCDocument.createPCLiteral> ('0');
4266     $test->assert_isa ($e3, <IFName::PerlStringLiteral>);
4267     $test->assert_equals ($e3-><AG::Node.textContent>, '0');
4268 wakaba 1.43
4269     @Method:
4270 wakaba 1.44 @@Name: createPCNumberLiteral
4271     @@enDesc:
4272     Creates a number literal object.
4273     @@Param:
4274     @@@Name: value
4275     @@@Type: DISPerl|NumberValue
4276     @@@enDesc:
4277     The value.
4278     @@Return:
4279     @@@Type: PCNumberValue
4280     @@@enDesc: The newly created value object.
4281     @@@PerlDef:
4282     __DEEP{
4283     $r = $self-><M::Document.createElementNS>
4284     (<Q::pc:>, 'numberLiteral');
4285     $r-><AS::Node.textContent> ($value);
4286     }__;
4287    
4288     @Method:
4289     @@Name: createPCVariable
4290     @@enDesc:
4291     Creates a new <IF::PerlVariable> object.
4292     @@Param:
4293     @@@Name: variableType
4294     @@@Type: DOMString
4295     @@@enDesc:
4296     Variable prefix.
4297     @@@nullCase:
4298     @@@@enDesc:
4299     If the <P::packageName> is <DOM::null>, then
4300     the <P::variableType> is detected by the prefix of
4301     <P::localName>. Otherwise, it is an unprefixed variable
4302     such as file handle.
4303     @@Param:
4304     @@@Name: packageName
4305     @@@Type: DOMString
4306     @@@enDesc:
4307     Package name.
4308     @@@nullCase:
4309     @@@@enDesc:
4310     The variable belongs to the current package or a
4311     lexical-scoped variable.
4312     @@Param:
4313     @@@Name: localName
4314     @@@Type: DOMString
4315     @@@enDesc:
4316     Variable name. If both <P::variableType> and <P::packageName>
4317     is <DOM::null>, the <P::localName> value may be prefixed
4318     by any possible <P::variableType> value.
4319     @@Return:
4320     @@@Type: PerlVariable
4321     @@@enDesc:
4322     Newly created Perl variable object.
4323     @@@PerlDef:
4324     __DEEP{
4325     $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'variable');
4326     if (not $variableType and not $packageName and
4327     $localName =~ s/^(\\?[\$\@%&*])//) {
4328     $variableType = $1;
4329     }
4330     $r-><AS::PerlVariable.variableType> ($variableType)
4331     if defined $variableType;
4332     $r-><AS::PerlVariable.packageName> ($packageName)
4333     if defined $packageName;
4334     $r-><AS::PerlVariable.pcLocalName> ($localName);
4335     }__;
4336    
4337     @Method:
4338     @@Name: createPCDereference
4339     @@enDesc:
4340     Creates a <IF::PCDereference> object.
4341     @@Param:
4342     @@@Name: variableType
4343     @@@Type: DOMString
4344     @@@enDesc:
4345     The type of the referenced value, such as <Perl::$>.
4346     @@Return:
4347     @@@Type: PCDereference
4348     @@@enDesc:
4349     The newly created element node.
4350     @@@PerlDef:
4351     __DEEP{
4352 wakaba 1.48 $r = $self-><M::Document.createElementNS>
4353     (<Q::pc:>, 'dereference');
4354 wakaba 1.44 $r-><AS::PCDereference.variableType> ($variableType);
4355 wakaba 1.48 }__;
4356    
4357     @Method:
4358     @@Name: createPCReference
4359     @@enDesc:
4360     Creates a <IF::PCReference> object.
4361     @@Return:
4362     @@@Type: PCReference
4363     @@@enDesc:
4364     The newly created element node.
4365     @@@PerlDef:
4366     __DEEP{
4367     $r = $self-><M::Document.createElementNS>
4368     (<Q::pc:>, 'reference');
4369 wakaba 1.44 }__;
4370    
4371     @Method:
4372 wakaba 1.43 @@Name: createPCExpression
4373     @@enDesc:
4374     Creates a <Q::pc:expression> element node.
4375     @@Param:
4376     @@@Name: operator
4377     @@@Type: DOMString
4378     @@@enDesc:
4379     The operator of the expression.
4380     @@Return:
4381     @@@Type: PCExpression
4382     @@@enDesc:
4383     The newly created expression object.
4384     @@@PerlDef:
4385     __DEEP{
4386 wakaba 1.44 $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'expression');
4387 wakaba 1.43 $r-><AS::PCExpression.operator> ($operator);
4388     }__;
4389    
4390     @Method:
4391 wakaba 1.44 @@Name: createPCApply
4392     @@enDesc:
4393     Creates a <Q::pc:apply> element node.
4394     @@Return:
4395     @@@Type: PCApply
4396     @@@enDesc: The newly created element node.
4397     @@@PerlDef:
4398     __DEEP{
4399     $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'apply');
4400     }__;
4401    
4402     @Method:
4403 wakaba 1.43 @@Name: createPCFunctionCall
4404     @@enDesc:
4405 wakaba 1.44 Creates a function call element node.
4406 wakaba 1.43 @@Param:
4407     @@@Name: package
4408     @@@Type: DOMString
4409     @@@enDesc:
4410     The package to which the function belongs.
4411     @@@nullCase:
4412     @@@@enDesc: No package name.
4413     @@Param:
4414     @@@Name: localName
4415     @@@Type: DOMString
4416     @@@enDesc:
4417     The local part of the function name.
4418     @@Return:
4419 wakaba 1.44 @@@Type: PCApply
4420 wakaba 1.43 @@@enDesc:
4421     The newly created function object.
4422     @@@PerlDef:
4423     __DEEP{
4424 wakaba 1.44 $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'apply');
4425     my $func = $self-><M::PCDocument.createPCVariable>
4426     ('', $package, $localName);
4427     $r-><M::Node.appendChild> ($func);
4428     }__;
4429    
4430     @Method:
4431 wakaba 1.46 @@Name: createPCStatement
4432     @@enDesc:
4433     Creates a statement object.
4434     @@Return:
4435     @@@Type: PerlStatement
4436     @@@enDesc:
4437     The newly created statement element node.
4438     @@@PerlDef:
4439     __DEEP{
4440     $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'statement');
4441     }__;
4442    
4443     @Method:
4444 wakaba 1.44 @@Name: createPCBlock
4445     @@enDesc:
4446     Creates a <Q::pc2:block> element node.
4447     @@Return:
4448     @@@Type: PCBlock
4449     @@@enDesc:
4450     The newly created <Q::pc2:block> element.
4451     @@@PerlDef:
4452     __DEEP{
4453     $r = $self-><M::Document.createElementNS> (<Q::pc2:>, 'block');
4454 wakaba 1.43 }__;
4455    
4456     @Method:
4457     @@Name: createPCChoose
4458     @@enDesc:
4459     Creates a <Q::pc:choose> element node.
4460     @@Return:
4461     @@@Type: PCChoose
4462     @@@enDesc:
4463     The newly created <Q::pc:choose> element.
4464     @@@PerlDef:
4465     __DEEP{
4466     $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'choose');
4467 wakaba 1.45 }__;
4468    
4469     @Method:
4470     @@Name: createPCWhile
4471     @@enDesc:
4472     Creates a <Q::pc:while> element node.
4473     @@Return:
4474     @@@Type: PCWhile
4475     @@@enDesc:
4476     The newly created <Q::pc:while> element.
4477     @@@PerlDef:
4478     __DEEP{
4479     $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'while');
4480     $r-><M::Node.appendChild>
4481     ($self-><M::Document.createElementNS> (<Q::pc2:>, 'condition'));
4482     $r-><M::Node.appendChild>
4483     ($self-><M::Document.createElementNS> (<Q::pc2:>, 'block'));
4484 wakaba 1.41 }__;
4485 wakaba 1.46
4486     @Method:
4487     @@Name: createPerlSub
4488     @@enDesc:
4489     Creates a new <IF::PerlSub> object.
4490     @@Param:
4491     @@@Name: subName
4492     @@@Type: DOMString
4493     @@@enDesc:
4494     The name of the subroutine to create.
4495     @@@nullCase:
4496     @@@@enDesc:
4497     The subroutine created has no name.
4498     @@Return:
4499     @@@Type: PerlSub
4500     @@@enDesc:
4501     Newly created Perl subroutine object.
4502     @@@PerlDef:
4503     __DEEP{
4504     $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'sub');
4505     $r-><M::PerlSub.addPerlName> ($subName) if defined $subName;
4506     }__;
4507 wakaba 1.51
4508     @ResourceDef:
4509     @@ForCheck: ManakaiDOM|ForClass
4510     @@QName: createPCDocumentForTest
4511     @@rdf:type: DISPerl|BlockCode
4512     @@PerlDef:
4513 wakaba 1.67 my $impl = <Class::c|ManakaiDOMImplementation>->_new;
4514 wakaba 1.51 $doc = $impl-><M::DOMImpl.createDocument> (<Q::pc:>, 'file');
4515 wakaba 1.61
4516     @Method:
4517     @@Name: createPCIf
4518     @@enDesc:
4519     Creates a <IF::PerlIf> object.
4520     @@Param:
4521     @@@Name: conditionArg
4522     @@@Type: PerlCodeInlines
4523     @@@enDesc:
4524     Condition code fragment object.
4525     @@Param:
4526     @@@Name: trueArg
4527     @@@Type: PerlCodeBlocks
4528     @@@enDesc:
4529     A true code fragment object.
4530     @@@nullCase:
4531     @@@@enDesc: No true code.
4532     @@Param:
4533     @@@Name: falseArg
4534     @@@Type: PerlCodeBlocks
4535     @@@enDesc:
4536     A false code fragment object.
4537     @@@nullCase:
4538     @@@@enDesc: No false code.
4539     @@Return:
4540     @@@Type: PerlIf
4541     @@@PerlDef:
4542     __DEEP{
4543     $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'if');
4544     $r-><AS::PerlIf.condition> ($conditionArg) if defined $conditionArg;
4545     $r-><AS::PerlIf.trueCode> ($trueArg) if defined $trueArg;
4546     $r-><AS::PerlIf.falseCode> ($falseArg) if defined $falseArg;
4547     }__;
4548    
4549     @@Test:
4550     @@@QName: PCDocument.createPCIf.noarg.test
4551     @@@PerlDef:
4552     my $doc;
4553     __CODE{createPCDocumentForTest:: $doc => $doc}__;
4554    
4555     my $e1 = $doc-><M::Document.createElementNS> (null, 'e1');
4556    
4557     my $if = $doc-><M::PCDocument.createPCIf> ($e1);
4558    
4559     $test->assert_isa ($if, <IFName::PerlIf>);
4560    
4561     $test->id ('condition');
4562     $test->assert_equals ($if-><AG::PerlIf.condition>, $e1);
4563    
4564     $test->id ('trueCode');
4565     $test->assert_null ($if-><AG::PerlIf.trueCode>);
4566    
4567     $test->id ('falseCode');
4568     $test->assert_null ($if-><AG::PerlIf.falseCode>);
4569     @@Test:
4570     @@@QName: PCDocument.createPCIf.args.test
4571     @@@PerlDef:
4572     my $doc;
4573     __CODE{createPCDocumentForTest:: $doc => $doc}__;
4574    
4575     my $e1 = $doc-><M::Document.createElementNS> (null, 'e1');
4576     my $e2 = $doc-><M::Document.createElementNS> (null, 'e2');
4577     my $e3 = $doc-><M::Document.createElementNS> (null, 'e3');
4578    
4579     my $if = $doc-><M::PCDocument.createPCIf> ($e1, $e2, $e3);
4580    
4581     $test->id ('return');
4582     $test->assert_isa ($if, <IFName::PerlIf>);
4583    
4584     $test->id ('condition');
4585     $test->assert_equals ($if-><AG::PerlIf.condition>, $e1);
4586    
4587     $test->id ('trueCode');
4588     $test->assert_equals ($if-><AG::PerlIf.trueCode>, $e2);
4589    
4590     $test->id ('falseCode');
4591     $test->assert_equals ($if-><AG::PerlIf.falseCode>, $e3);
4592    
4593     @Method:
4594     @@Name: createPCPackage
4595     @@enDesc:
4596     Creates a new package scope block.
4597     @@Param:
4598     @@@Name: packageName
4599     @@@Type: DOMString
4600     @@@enDesc:
4601     The fully-qualified name of the package to create.
4602     @@Return:
4603     @@@Type: PerlPackage
4604     @@@enDesc:
4605     The newly created package scope object.
4606     @@@PerlDef:
4607     __DEEP{
4608     $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'package');
4609     $r-><AS::PerlPackage.packageName> ($packageName);
4610     }__;
4611    
4612     @@Test:
4613     @@@QName: PCDocument.createPCPackage
4614     @@@PerlDef:
4615     my $doc;
4616     __CODE{createPCDocumentForTest:: $doc => $doc}__;
4617    
4618     my $pack = $doc-><M::PCDocument.createPCPackage> ('Package::Name');
4619    
4620     $test->id ('package');
4621     $test->assert_isa ($pack, <IFName::PerlPackage>);
4622    
4623     $test->id ('packageName');
4624     $test->assert_equals ($pack-><AG::PerlPackage.packageName>,
4625     'Package::Name');
4626 wakaba 1.65
4627     @Method:
4628     @@Name: getAutoloadDefinitionList
4629     @@enDesc:
4630     Returns a set of definitions for autoloading.
4631     @@Return:
4632 wakaba 1.73 @@@Type: DISPerl|HASH
4633 wakaba 1.65 @@@PerlDef:
4634     __DEEP{
4635     my $file = $self->document_element;
4636     my $first_pack;
4637     my $first_pack_name;
4638     for my $pack (@{$file ? $file->child_nodes : []}) {
4639 wakaba 1.66 next unless $pack->can ('package_name');
4640 wakaba 1.65 unless (defined $first_pack) {
4641     $first_pack = $pack;
4642     $first_pack_name = $first_pack->package_name;
4643     }
4644 wakaba 1.66
4645     for my $feature (@{$pack->get_elements_by_tag_name_ns
4646     (<Q::pc|>, 'hasFeature')}) {
4647     $r->{feature}->{$feature->feature_name}
4648     ->{$feature->feature_version} = {
4649     module => $first_pack_name,
4650     };
4651     }
4652    
4653     for my $feature (@{$pack->get_elements_by_tag_name_ns
4654     (<Q::pc|>, 'elementType')}) {
4655     my $nsuri = $feature->pc_namespace_uri;
4656     $r->{element_type}->{defined $nsuri ? $nsuri : ''}
4657     ->{$feature->pc_local_name} = {
4658     module => $first_pack_name,
4659     };
4660     }
4661    
4662 wakaba 1.65 my $rev_isa = $pack->get_rev_isa_package_name_list;
4663     next unless @$rev_isa;
4664     my $pack_name = $pack->package_name;
4665 wakaba 1.66
4666 wakaba 1.65 for my $mem (@{$pack->child_nodes}) {
4667     next unless $mem->can ('get_perl_name_list');
4668     my $proto = $mem->prototype;
4669     for my $name (@{$mem->get_perl_name_list}) {
4670     $r->{method}->{$_}->{$name} = {
4671     module => $first_pack_name,
4672     class => $pack_name,
4673     prototype => $proto,
4674     } for @$rev_isa;
4675     }
4676     }
4677     }
4678     }__;
4679    
4680     @@ImplNote:
4681     {TODO::
4682     Test
4683     }
4684 wakaba 1.41 ##PCDocument
4685    
4686 wakaba 1.39 ## -- Implementation
4687 wakaba 1.6
4688 wakaba 1.25 IFClsDef:
4689     @IFQName: PCImplementation
4690 wakaba 1.35 @CQName: ManakaiPCImplementation
4691 wakaba 1.25
4692 wakaba 1.1 @enDesc:
4693     The class that provides factory methods.
4694 wakaba 1.20
4695 wakaba 1.66 @domperl:implementedByObjectsOf: DOMImpl
4696     @domperl:classImplementedByObjectsOf:
4697 wakaba 1.73 c|ManakaiDOMImplementation
4698 wakaba 1.1
4699 wakaba 1.59 @Test:
4700     @@QName: ImplementationRegistry.PCImplementation.1.0.test
4701     @@PerlDef:
4702     my $impl = $Message::DOM::ImplementationRegistry
4703 wakaba 1.69 ->get_dom_implementation ({<Q::Util|PerlCode> => '1.0'});
4704 wakaba 1.59
4705 wakaba 1.67 $test->assert_isa ($impl, <ClassName::ManakaiPCImplementation>);
4706 wakaba 1.59 @Test:
4707     @@QName: ImplementationRegistry.PCImplementation.empty.test
4708     @@PerlDef:
4709     my $impl = $Message::DOM::ImplementationRegistry
4710 wakaba 1.69 ->get_dom_implementation ({<Q::Util|PerlCode> => ''});
4711 wakaba 1.59
4712 wakaba 1.67 $test->assert_isa ($impl, <ClassName::ManakaiPCImplementation>);
4713 wakaba 1.59 @Test:
4714     @@QName: ImplementationRegistry.PCImplementation.null.test
4715     @@PerlDef:
4716     my $impl = $Message::DOM::ImplementationRegistry
4717 wakaba 1.69 ->get_dom_implementation ({<Q::Util|PerlCode> => null});
4718 wakaba 1.59
4719 wakaba 1.67 $test->assert_isa ($impl, <ClassName::ManakaiPCImplementation>);
4720 wakaba 1.59
4721 wakaba 1.1 @Method:
4722 wakaba 1.70 @@Name: createPCDocument
4723 wakaba 1.1 @@enDesc:
4724 wakaba 1.70 Creates a Perl document,
4725 wakaba 1.1 @@Return:
4726 wakaba 1.70 @@@Type: PCDocument
4727 wakaba 1.61 @@@enDesc:
4728 wakaba 1.70 {P:: The newly created <IF::PCDocument> object where:
4729 wakaba 1.61
4730     - The <A::Document.strictErrorChecking> attribute
4731     is set to <DOM::false>.
4732    
4733     - The <Q::cfg|dtd-default-attribute> configuration
4734     parameter is set to <DOM::false>.
4735    
4736     - The <Q::cfg|dtd-attribute-type> configuration
4737     parameter is set to <DOM::false>.
4738    
4739 wakaba 1.70 - The <A::Node.childNodes> list contains an
4740     <IF::Element> node whose <A::Node.namespaceURI>
4741     is <URI^^DISCore|QName::pc|> and <A::Node.localName>
4742     is <XE::file>.
4743 wakaba 1.61 }
4744     @@@PerlDef:
4745     __DEEP{
4746 wakaba 1.70 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file');
4747 wakaba 1.61
4748 wakaba 1.70 $r-><AS::Document.strictErrorChecking> (false);
4749     my $cfg = $r-><AG::Document.domConfig>;
4750     $cfg-><M::CFG.setParameter>
4751 wakaba 1.61 (<Q::cfg|dtd-default-attribute> => false);
4752 wakaba 1.70 $cfg-><M::CFG.setParameter>
4753 wakaba 1.61 (<Q::cfg|dtd-attribute-type> => false);
4754     }__;
4755    
4756     @@Test:
4757 wakaba 1.70 @@@QName: PCImplementation.createPCDocument.test
4758 wakaba 1.1 @@@PerlDef:
4759 wakaba 1.61 my $impl;
4760     __CODE{tc|createImplForTest:: $impl => $impl}__;
4761    
4762 wakaba 1.70 my $pcdoc = $impl->create_pc_document;
4763 wakaba 1.61
4764     $test->id ('od.interface');
4765 wakaba 1.70 $test->assert_isa ($pcdoc, <IFName::PCDocument>);
4766 wakaba 1.61
4767     $test->id ('strictErrorChecking');
4768 wakaba 1.70 $test->assert_false ($pcdoc->strict_error_checking);
4769 wakaba 1.61
4770 wakaba 1.70 my $cfg = $pcdoc->dom_config;
4771 wakaba 1.61
4772     $test->id ('cfg.dtd-default-attribute');
4773     $test->assert_false ($cfg->get_parameter
4774     (<Q::cfg|dtd-default-attribute>));
4775    
4776     $test->id ('cfg.dtd-attribute-type');
4777     $test->assert_false ($cfg->get_parameter
4778     (<Q::cfg|dtd-attribute-type>));
4779 wakaba 1.70
4780     $test->id ('document_element.interface');
4781     $test->assert_isa ($pcdoc->document_element, <IFName::PerlFile>);
4782    
4783     $test->id ('document_element.parent_node');
4784     $test->assert_equals ($pcdoc->document_element->parent_node, $pcdoc);
4785 wakaba 1.1
4786     @IntMethod:
4787 wakaba 1.25 @@ForCheck: ManakaiDOM|ForClass
4788 wakaba 1.1 @@Name: perlComment
4789     @@ManakaiDOM:isStatic:1
4790     @@enDesc:
4791     Generates a Perl comment string.
4792     @@Param:
4793     @@@Name: str
4794 wakaba 1.35 @@@Type: DOMString
4795 wakaba 1.1 @@@enDesc:
4796     A comment text.
4797     @@Return:
4798 wakaba 1.35 @@@Type: DOMString
4799 wakaba 1.1 @@@enDesc:
4800     A Perl comment string.
4801     @@@PerlDef:
4802     $r = $str;
4803     $r =~ s/\n/\n## /g;
4804     $r =~ s/\n## $/\n/s;
4805     $r .= "\n" unless $r =~ /\n$/;
4806     $r = q<## > . $r;
4807    
4808     @IntMethod:
4809 wakaba 1.25 @@ForCheck: ManakaiDOM|ForClass
4810 wakaba 1.1 @@Name: rfc3339DateTime
4811     @@ManakaiDOM:isStatic:1
4812     @@enDesc:
4813     Returns RFC 3339 <CODE::date-time> representation of a date.
4814     @@Param:
4815     @@@Name: perlDate
4816 wakaba 1.73 @@@Type: idl|unsignedLong
4817 wakaba 1.1 @@@enDesc:
4818     A Perl representation of date.
4819     @@Return:
4820 wakaba 1.35 @@@Type: DOMString
4821 wakaba 1.1 @@@enDesc:
4822     RFC 3339 date string.
4823     @@@PerlDef:
4824     my @time = gmtime $perlDate;
4825     $r = sprintf q<%04d-%02d-%02dT%02d:%02d:%02d+00:00>,
4826     $time[5] + 1900, $time[4] + 1, @time[3,2,1,0];
4827    
4828     @IntMethod:
4829 wakaba 1.25 @@ForCheck: ManakaiDOM|ForClass
4830 wakaba 1.1 @@Name: versionDateTime
4831     @@ManakaiDOM:isStatic:1
4832     @@enDesc:
4833     Returns date for version.
4834     @@Param:
4835     @@@Name: perlDate
4836 wakaba 1.73 @@@Type: idl|unsignedLong
4837 wakaba 1.1 @@@enDesc:
4838     A Perl representation of date.
4839     @@Return:
4840 wakaba 1.35 @@@Type: DOMString
4841 wakaba 1.1 @@@enDesc:
4842     A Perl number literal.
4843     @@@PerlDef:
4844     my @time = gmtime $perlDate;
4845     $r = sprintf q<%04d%02d%02d.%02d%02d>,
4846     $time[5] + 1900, $time[4] + 1, @time[3,2,1];
4847    
4848     @Method:
4849     @@Name: perlLiteral
4850     @@enDesc:
4851     Perl code representation.
4852     @@Param:
4853     @@@Name: val
4854 wakaba 1.73 @@@Type: DISPerl|Any
4855 wakaba 1.1 @@@enDesc:
4856     A Perl value.
4857     @@Return:
4858 wakaba 1.35 @@@Type: DOMString
4859 wakaba 1.1 @@@enDesc:
4860     A Perl lexical representation of <P::val>.
4861     @@@PerlDef:
4862     unless (defined $val) {
4863     $r = q<undef>;
4864     } elsif (ref $val eq 'ARRAY') {
4865     __DEEP{
4866 wakaba 1.36 $r = q<[> . <ClassM::ManakaiPCImplementation
4867 wakaba 1.14 .perlList> ($val) . q<]>;
4868 wakaba 1.1 }__;
4869     } elsif (ref $val eq 'HASH') {
4870     __DEEP{
4871 wakaba 1.31 $r = q<{>
4872 wakaba 1.36 . <ClassM::ManakaiPCImplementation.perlList>
4873 wakaba 1.31 ([map {$_ => $val->{$_}} sort {$a cmp $b} keys %$val])
4874     . q<}>;
4875 wakaba 1.1 }__;
4876 wakaba 1.38 } elsif (ref $val eq 'manakai::code') {
4877     $r = $$val;
4878 wakaba 1.1 } else {
4879     $val =~ s/(['\\])/\\$1/g;
4880     $r = q<'> . $val . q<'>;
4881     }
4882    
4883     @Method:
4884     @@Name: perlList
4885     @@enDesc:
4886     Perl code representation of a list.
4887     @@Param:
4888     @@@Name: val
4889 wakaba 1.73 @@@Type: DISPerl|ARRAY
4890 wakaba 1.1 @@@enDesc:
4891     A Perl array reference.
4892     @@Return:
4893 wakaba 1.35 @@@Type: DOMString
4894 wakaba 1.1 @@@enDesc:
4895     A Perl lexical representation of <CODE::@$val>.
4896     @@@PerlDef:
4897     __DEEP{
4898 wakaba 1.58 $r = join (qq<,\n>, map {<ClassM::ManakaiPCImplementation
4899 wakaba 1.1 .perlLiteral> ($_)} @{$val});
4900     }__;
4901 wakaba 1.25 ##PCImplementation
4902 wakaba 1.1
4903 wakaba 1.5 ResourceDef:
4904 wakaba 1.35 @QName: DOMImpl
4905 wakaba 1.59 @AliasFor: c|DOMImplementation
4906 wakaba 1.41
4907     ResourceDef:
4908     @QName: NodeList
4909 wakaba 1.59 @AliasFor: tc|NodeList
4910 wakaba 1.35
4911     ResourceDef:
4912     @QName: Node
4913 wakaba 1.59 @AliasFor: tc|Node
4914 wakaba 1.35
4915     ResourceDef:
4916     @QName: Element
4917 wakaba 1.68 @AliasFor: te|Element
4918 wakaba 1.35
4919     ResourceDef:
4920     @QName: Document
4921 wakaba 1.68 @AliasFor: td|Document
4922 wakaba 1.35
4923 wakaba 1.1 ElementTypeBinding:
4924     @Name: Method
4925     @ElementType:
4926     dis:ResourceDef
4927     @ShadowContent:
4928     @@rdf:type:
4929     DISLang:Method
4930    
4931     ElementTypeBinding:
4932     @Name: ToStringMethod
4933     @ElementType:
4934     dis:ResourceDef
4935     @ShadowContent:
4936     @@rdf:type:
4937     DISLang:Method
4938     @@Operator:
4939     @@@@:
4940     DISPerl:AsStringMethod
4941 wakaba 1.35 @@@ContentType: DISCore|QName
4942 wakaba 1.1 @@Description:
4943     @@@lang:en
4944     @@@@:
4945     Returns the textual Perl source code representation of this object.
4946 wakaba 1.9
4947 wakaba 1.14 ElementTypeBinding:
4948     @Name: NumValMethod
4949     @ElementType:
4950     dis:ResourceDef
4951     @ShadowContent:
4952     @@rdf:type:
4953     DISLang:Method
4954     @@Operator:
4955     @@@@: 0+
4956     @@@ContentType:
4957     lang:Perl
4958     @@Description:
4959     @@@lang:en
4960     @@@@:
4961     Returns the numeric value of this object.
4962 wakaba 1.9
4963     ElementTypeBinding:
4964 wakaba 1.1 @Name: IntMethod
4965     @ElementType:
4966     dis:ResourceDef
4967     @ShadowContent:
4968     @@rdf:type:
4969     DISLang:Method
4970     @@ManakaiDOM:isForInternal:1
4971    
4972     ElementTypeBinding:
4973     @Name: Attr
4974     @ElementType:
4975     dis:ResourceDef
4976     @ShadowContent:
4977     @@rdf:type:
4978     DISLang:Attribute
4979    
4980     ElementTypeBinding:
4981     @Name: Return
4982     @ElementType:
4983     dis:ResourceDef
4984     @ShadowContent:
4985     @@rdf:type:
4986     DISLang:MethodReturn
4987    
4988     ElementTypeBinding:
4989     @Name: Get
4990     @ElementType:
4991     dis:ResourceDef
4992     @ShadowContent:
4993     @@rdf:type:
4994     DISLang:AttributeGet
4995    
4996     ElementTypeBinding:
4997     @Name: Set
4998     @ElementType:
4999     dis:ResourceDef
5000     @ShadowContent:
5001     @@rdf:type:
5002     DISLang:AttributeSet
5003    
5004     ElementTypeBinding:
5005     @Name: Param
5006     @ElementType:
5007     dis:ResourceDef
5008     @ShadowContent:
5009     @@rdf:type:
5010     DISLang:MethodParameter
5011    
5012     ElementTypeBinding:
5013     @Name: PerlDef
5014     @ElementType:
5015     dis:Def
5016     @ShadowContent:
5017     @@ContentType:
5018     lang:Perl
5019 wakaba 1.27 @@ForCheck: ManakaiDOM|ForClass
5020 wakaba 1.28
5021     ElementTypeBinding:
5022     @Name: PerlCDef
5023     @ElementType:
5024     dis:Def
5025     @ShadowContent:
5026     @@ContentType:
5027     lang:Perl
5028 wakaba 1.1
5029     ElementTypeBinding:
5030     @Name: disDef
5031     @ElementType:
5032     dis:Def
5033     @ShadowContent:
5034     @@ContentType:
5035     lang:dis
5036 wakaba 1.27 @@ForCheck: ManakaiDOM|ForClass
5037 wakaba 1.1
5038     ElementTypeBinding:
5039     @Name: InCase
5040     @ElementType:
5041     dis:ResourceDef
5042     @ShadowContent:
5043     @@rdf:type:
5044     ManakaiDOM:InCase
5045    
5046     ElementTypeBinding:
5047     @Name: nullCase
5048     @ElementType:
5049     dis:ResourceDef
5050     @ShadowContent:
5051     @@rdf:type:
5052     ManakaiDOM:InCase
5053     @@Value:
5054     @@@is-null:1
5055    
5056     ElementTypeBinding:
5057     @Name: TrueCase
5058     @ElementType:
5059     dis:ResourceDef
5060     @ShadowContent:
5061     @@rdf:type:
5062     ManakaiDOM:InCase
5063 wakaba 1.27 @@Value:
5064     @@@@:1
5065     @@@ContentType: DISCore|Boolean
5066 wakaba 1.1 @@Type:
5067 wakaba 1.73 DOMMain:boolean
5068 wakaba 1.1
5069    
5070     ElementTypeBinding:
5071     @Name: FalseCase
5072     @ElementType:
5073     dis:ResourceDef
5074     @ShadowContent:
5075     @@rdf:type:
5076     ManakaiDOM:InCase
5077 wakaba 1.27 @@Value:
5078     @@@@:0
5079     @@@ContentType: DISCore|Boolean
5080 wakaba 1.1 @@Type:
5081 wakaba 1.73 DOMMain:boolean
5082 wakaba 1.1
5083     ElementTypeBinding:
5084     @Name: enDesc
5085     @ElementType:
5086     dis:Description
5087     @ShadowContent:
5088     @@lang:en
5089    
5090     ElementTypeBinding:
5091     @Name: NamedParam
5092     @ElementType:
5093     dis:ResourceDef
5094     @ShadowContent:
5095     @@rdf:type:
5096     DISLang:MethodParameter
5097     @@DISPerl:isNamedParameter:1
5098    

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24