/[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.69 - (hide annotations) (download)
Sat Dec 2 12:46:25 2006 UTC (18 years, 7 months ago) by wakaba
Branch: MAIN
CVS Tags: manakai-200612
Changes since 1.68: +4 -4 lines
++ manakai/t/ChangeLog	2 Dec 2006 12:46:13 -0000
2006-12-02  Wakaba  <wakaba@suika.fam.cx>

	* Makefile (dom-DOMString.t): New test.

++ manakai/bin/ChangeLog	2 Dec 2006 12:35:25 -0000
2006-12-02  Wakaba  <wakaba@suika.fam.cx>

	* daf.pl: Call |get_dom_implementation|
	instead of obsolete |get_implementation|.

	* grep-dis.pl: |lib/manakai/*.pl| is added.

++ manakai/lib/Message/Util/ChangeLog	2 Dec 2006 12:45:49 -0000
2006-12-02  Wakaba  <wakaba@suika.fam.cx>

	* Makefile: |lib/Message/DOM/DOMString.pm| is added.

++ manakai/lib/Message/DOM/ChangeLog	2 Dec 2006 12:45:20 -0000
2006-12-02  Wakaba  <wakaba@suika.fam.cx>

	* DOMString.dis: New module.

	* DOMString.pm: New file.

	* DOMCore.dis (min): Moved from |DOMFeature.dis|.
	(ImplementationRegistryVariable): Moved from |DOMFeature.dis|.
	Now it references the |DOMImplementationRegistry| object.
	(DOMImplementationRegistryVariable): Moved from |DOMMain.dis|.
	(DOMImplementationRegistry): New interface and
	class, reformed from |ImplementationRegistry| in |DOMFeature.dis|
	and |DOMImplementationRegistry| in |DOMMain.dis|.  Note
	that the class no longer support |get_implementation|
	and |get_implementation_list| methods from
	the |ImplementationRegistry| interface.
	(DOMImplementationList): Class implemented; no
	longer inherits from |ImplementationList|.
	(DOMImplementationSource): Class implemented; no
	longer inherits from |ImplementationSource|.  Note that
	the class no longer support |get_implementation|
	and |get_implementation_list| methods from
	the |ImplementationSource| interface.
	(DOMStringList): Removed.

	* DOMFeature.dis (min, ManakaiDOM:DOMHTMLFeature,
	ManakaiDOM:DOMEventsFeature, ManakaiDOM:DOMXMLFeature,
	ManakaiDOM:DOMXMLFeatureXML11, most part of
	documentation for obsolete DOM Level 3 Minimum Implementation
	module, obsolete property name aliases,
	ImplemenationRegistryVar, ImplementationRegistry,
	DEBUG, MIString, ImplementationList, ImplementationSource,
	ManakaiDOM:implID): Removed.

	* DOMMain.dis (Redefine, RedefinedBy, Redefined): Removed.
	(DOMString): Removed.
	(DOMImplementationRegistryVar, DOMImplementationRegistry): Removed.

	* Makefile: |DOMString.pm| is added.

	* TreeCore.dis (is_default_namespace): |null| was
	returned where a false is expected (|null| is
	a false in Perl, but real |false| is appropriate here).

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24