/[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.71 - (hide annotations) (download)
Sat Dec 30 04:42:58 2006 UTC (18 years, 6 months ago) by wakaba
Branch: MAIN
Changes since 1.70: +3 -9 lines
++ manakai/lib/Message/Markup/ChangeLog	30 Dec 2006 04:39:04 -0000
2006-12-30  Wakaba  <wakaba@suika.fam.cx>

	* Atom.dis, SuikaWiki.dis: References
	to the |ManakaiDOM:ManakaiDOM| mode are removed.

++ manakai/lib/Message/Util/ChangeLog	30 Dec 2006 04:39:32 -0000
	* DIS.dis, PerlCode.dis: References to the |ManakaiDOM:ManakaiDOM|
	mode are removed.

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

++ manakai/lib/Message/Util/DIS/ChangeLog	30 Dec 2006 04:42:43 -0000
	* DPG.dis, Perl.dis, Value.dis, Test.dis: References
	to |ManakaiDOM:ManakaiDOM| modes are removed.

	* Perl.dis (plCodeFragment): |local|ize
	the |DIS:plCodeFragment| cache to avoid
	ancestor nodes of the cached fragment
	are destroyed so that the cached nodes
	become invalid.

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

++ manakai/lib/Message/DOM/ChangeLog	30 Dec 2006 04:37:29 -0000
	* CharacterData.dis, DOMCore.dis, DOMFeature.dis,
	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: References
	to the |ManakaiDOM:ManakaiDOM|, |ManakaiDOM:ManakaiDOM1|,
	|ManakaiDOM:ManakaiDOM2|, and |ManakaiDOM:ManakaiDOM3|
	modes are removed.

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

++ manakai/lib/Message/URI/ChangeLog	30 Dec 2006 04:35:39 -0000
2006-12-30  Wakaba  <wakaba@suika.fam.cx>

	* Generic.dis (Require): Reference to the |ManakaiDOM:ManakaiDOM|
	mode is removed.

++ manakai/lib/Message/Charset/ChangeLog	30 Dec 2006 04:35:23 -0000
2006-12-30  Wakaba  <wakaba@suika.fam.cx>

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24