/[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.72 - (hide annotations) (download)
Sat Dec 30 08:27:51 2006 UTC (18 years, 6 months ago) by wakaba
Branch: MAIN
Changes since 1.71: +6 -42 lines
++ manakai/bin/ChangeLog	30 Dec 2006 06:47:17 -0000
2006-12-30  Wakaba  <wakaba@suika.fam.cx>

	* idl2dis.pl: Removed.

++ manakai/lib/Message/Markup/ChangeLog	30 Dec 2006 08:26:03 -0000
	* Atom.dis, SuikaWiki.dis, H2H.dis: |WithFor|
	and |DefaultFor| properties are removed.

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

++ manakai/lib/Message/Util/ChangeLog	30 Dec 2006 08:26:59 -0000
	* PerlCode.dis: |WithFor| and |DefaultFor| are removed.

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

++ manakai/lib/Message/DOM/ChangeLog	30 Dec 2006 08:25:38 -0000
        GenericLS.dis, TreeCore.dis, DOMString.dis,
        XML.dis, Element.dis, Document.dis, TreeStore,dis,
        Traversal.dis, XDoctype.dis, XMLParser.dis, DOMLS.dis,
        SimpleLS.dis, DOMMain.dis, XDP.dis: |WithFor| specifications
	and |DefaultFor|s are removed.

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

	* CharacterData.dis, DOMCore.dis, DOMFeature.dis,
++ manakai/lib/Message/URI/ChangeLog	30 Dec 2006 08:26:32 -0000
	* Generic.dis: |WithFor| and |DefaultFor| are removed.

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

++ manakai/lib/Message/Charset/ChangeLog	30 Dec 2006 08:24:04 -0000
	* Encode.dis (Require): |WithFor| specifications are removed.
	(DefaultFor): Removed.

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

++ manakai/lib/manakai/ChangeLog	30 Dec 2006 07:46:56 -0000
2006-12-30  Wakaba  <wakaba@suika.fam.cx>

	* dis.pl: Removed.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24