/[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.45 - (hide annotations) (download)
Sat Dec 17 11:58:52 2005 UTC (19 years, 7 months ago) by wakaba
Branch: MAIN
Changes since 1.44: +123 -1 lines
++ manakai/lib/Message/Util/ChangeLog	17 Dec 2005 11:58:46 -0000
2005-12-17  Wakaba  <wakaba@suika.fam.cx>

	* PerlCode.dis (PCWhen): New interface.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24