/[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.44 - (hide annotations) (download)
Fri Dec 16 15:08:55 2005 UTC (19 years, 7 months ago) by wakaba
Branch: MAIN
Changes since 1.43: +547 -34 lines
++ manakai/lib/Message/Util/ChangeLog	16 Dec 2005 15:05:50 -0000
2005-12-16  Wakaba  <wakaba@suika.fam.cx>

	* PerlCode.dis (PCNumberLiteral, PCDereference, PCApply): New interfaces.
	(arrayRefLiteral, hashRefLiteral): Typos in element type names fixed.
	(PCExpression.stringify): Outputs children other than expression.
	Inserts space before and after operators if desired.

2005-12-15  Wakaba  <wakaba@suika.fam.cx>

	* PerlCode.dis (PCCondition, PCBlock): New interface.
	(ManakaiPCBlock): Renamed as |ManakaiPerlCodeBlock| to
	distingulish new |ManakaiPCBlock| class implementing new |PCBlock|
	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.44 $Date: 2005/12/14 11:57:13 $
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.12 @@Name: appendNewIf
1688     @@enDesc:
1689     Appends a newly created <Class::ManakaiPerlIf> object.
1690     @@Param:
1691     @@@Name: conditionArg
1692 wakaba 1.25 @@@Type: PerlCode
1693 wakaba 1.12 @@@enDesc:
1694     Conditoon code fragment object.
1695     @@Param:
1696     @@@Name: trueArg
1697 wakaba 1.25 @@@Type: PerlCode
1698 wakaba 1.12 @@@enDesc:
1699     A true code fragment object.
1700     @@@nullCase:
1701     @@@@enDesc: No true code.
1702     @@Param:
1703     @@@Name: falseArg
1704 wakaba 1.25 @@@Type: PerlCode
1705 wakaba 1.12 @@@enDesc:
1706     A false code fragment object.
1707     @@@nullCase:
1708     @@@@enDesc: No false code.
1709     @@Return:
1710 wakaba 1.36 @@@Type: PerlIf
1711 wakaba 1.35 @@@enDesc:
1712     The newly created element.
1713 wakaba 1.12 @@@RaiseException:
1714     @@@@@:BAD_CHILD_ERR
1715     @@@@enDesc:
1716     An attempt is made to append a child
1717     that is not valid type.
1718     @@@RaiseException:
1719     @@@@@:IN_USE_NODE_ERR
1720     @@@@enDesc:
1721     An attempt is made to append a node that is
1722     already used elsewhere.
1723     @@@PerlDef:
1724 wakaba 1.35 for my $arg ([conditionArg => $conditionArg]) {
1725     if ({
1726     atom => 1, tokens => 1, inlineContainer => 1, assignment => true,
1727     inlineUnparsed => 1, variable => 1, stringLiteral => true,
1728 wakaba 1.41 list => true, arrayRefLiteral => true, hashRefLiteral => true,
1729 wakaba 1.35 }->{$arg->[1]-><AG::Node.localName>}) {
1730     if ($arg->[1]-><AG::Node.parentNode>) {
1731     __EXCEPTION{IN_USE_NODE_ERR::
1732     pc:childNode => {$arg->[1]},
1733     MDOMX:param-name => {$arg->[0]},
1734     }__;
1735     }
1736     } else {
1737     __EXCEPTION{BAD_CHILD_ERR::
1738     pc:parentNode => {$self},
1739     pc:childNode => {$arg->[1]},
1740     MDOMX:param-name => {$arg->[0]},
1741     }__;
1742     }
1743     } # c
1744 wakaba 1.6
1745 wakaba 1.35 for my $arg ([trueArg => $trueArg],
1746     [falseArg => $falseArg]) {
1747     next unless $arg->[1];
1748     if ({
1749     blockContainer => true,
1750     }->{$arg->[1]-><AG::Node.localName>}) {
1751     if ($arg->[1]-><AG::Node.parentNode>) {
1752     __EXCEPTION{IN_USE_NODE_ERR::
1753     pc:childNode => {$arg->[1]},
1754     MDOMX:param-name => {$arg->[0]},
1755     }__;
1756     }
1757     } else {
1758     __EXCEPTION{BAD_CHILD_ERR::
1759     pc:parentNode => {$self},
1760     pc:childNode => {$arg->[1]},
1761     MDOMX:param-name => {$arg->[0]},
1762     }__;
1763     }
1764     } # t/f
1765    
1766     __DEEP{
1767     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
1768     (<Q::pc:>, 'if');
1769     $r-><AS::PerlIf.condition> ($conditionArg);
1770     $r-><AS::PerlIf.trueCode> ($trueArg) if $trueArg;
1771     $r-><AS::PerlIf.falseCode> ($falseArg) if $falseArg;
1772     $self-><M::Node.appendChild> ($r);
1773     }__;
1774     ##PCIf
1775    
1776     IFClsETDef:
1777 wakaba 1.25 @IFQName: PerlSub
1778 wakaba 1.35 @CQName: ManakaiPCSub
1779     @ETQName: pc|sub
1780 wakaba 1.25
1781     @IFISA: PerlCode
1782    
1783     @IFISA: PerlCodeStatements
1784 wakaba 1.35 @CISA: ManakaiPCCodeStatements
1785 wakaba 1.25
1786 wakaba 1.6 @enDesc:
1787 wakaba 1.36 Perl subroutines.
1788 wakaba 1.20
1789 wakaba 1.6 @Attr:
1790 wakaba 1.35 @@Name: pcLocalName
1791 wakaba 1.6 @@enDesc:
1792     The name of this subroutine.
1793 wakaba 1.35 @@Type: DOMString
1794 wakaba 1.6 @@Get:
1795     @@@nullCase:
1796     @@@@enDesc:
1797     This subroutine has no name.
1798 wakaba 1.35 @@@PerlDef:
1799     __DEEP{
1800     $r = $self-><M::PerlSub.getPerlNameList>->[0];
1801     }__;
1802 wakaba 1.6
1803 wakaba 1.35 @Method:
1804     @@Name: addPerlName
1805     @@enDesc:
1806     Adds a subroutine name.
1807     @@Param:
1808     @@@Name: subName
1809     @@@Type: DOMString
1810     @@@enDesc: The name to add.
1811     @@Return:
1812     @@@PerlDef:
1813     __DEEP{
1814     __CODE{addNameListAttr::
1815     $node => {$self},
1816     $attrName => 'localName',
1817     $newName => {$subName},
1818     }__;
1819     }__;
1820    
1821     @Method:
1822     @@Name: getPerlNameList
1823     @@enDesc:
1824     Returns a list of names of the subroutine.
1825     @@Return:
1826     @@@Type: DISPerl|ARRAY||ManakaiDOM|all
1827     @@@enDesc:
1828     An unordered snapshot list of names.
1829     @@@PerlDef:
1830     __DEEP{
1831     __CODE{getNameListAttr::
1832     $node => {$self},
1833     $attrName => 'localName',
1834     $result => {$r},
1835     }__;
1836     }__;
1837    
1838     @Method:
1839     @@Name: hasPerlName
1840     @@enDesc:
1841     Returns whether the subroutine has a name or not.
1842     @@Param:
1843     @@@Name: subName
1844     @@@Type: DOMString
1845     @@@enDesc: The name.
1846     @@Return:
1847     @@@Type: idl|boolean||ManakaiDOM|all
1848     @@@PerlDef:
1849     __DEEP{
1850     my $l;
1851     __CODE{getNameListAttr::
1852     $node => {$self},
1853     $attrName => 'localName',
1854     $result => {$l},
1855     }__;
1856     F: for (@$l) {
1857     if ($_ eq $subName) {
1858     $r = true;
1859     last F;
1860     }
1861     }
1862     }__;
1863    
1864     @Method:
1865     @@Name: addPerlOperator
1866     @@enDesc:
1867     Adds an operator overloaded by the method.
1868     @@Param:
1869     @@@Name: op
1870     @@@Type: DOMString
1871     @@@enDesc: The operator to add.
1872     @@Return:
1873     @@@PerlDef:
1874     __DEEP{
1875     __CODE{addNameListAttr::
1876     $node => {$self},
1877     $attrName => 'operator',
1878     $newName => {$op},
1879     }__;
1880     }__;
1881    
1882     @Method:
1883     @@Name: getPerlOperatorList
1884     @@enDesc:
1885     Returns a list of operators of the subroutine.
1886     @@Return:
1887     @@@Type: DISPerl|ARRAY||ManakaiDOM|all
1888     @@@enDesc:
1889     An unordered snapshot list of operators.
1890     @@@PerlDef:
1891     __DEEP{
1892     __CODE{getNameListAttr::
1893     $node => {$self},
1894     $attrName => 'operator',
1895     $result => {$r},
1896     }__;
1897     }__;
1898    
1899     @Method:
1900     @@Name: hasPerlOperator
1901     @@enDesc:
1902     Returns whether the subroutine has an operator or not.
1903     @@Param:
1904     @@@Name: op
1905     @@@Type: DOMString
1906     @@@enDesc: The operator.
1907     @@Return:
1908     @@@Type: idl|boolean||ManakaiDOM|all
1909     @@@PerlDef:
1910     __DEEP{
1911     my $l;
1912     __CODE{getNameListAttr::
1913     $node => {$self},
1914     $attrName => 'operator',
1915     $result => {$l},
1916     }__;
1917     F: for (@$l) {
1918     if ($_ eq $op) {
1919     $r = true;
1920     last F;
1921     }
1922     }
1923     }__;
1924    
1925     @ATTR:
1926 wakaba 1.6 @@Name: prototype
1927 wakaba 1.35 @@ATTRQName: pc|prototype
1928 wakaba 1.6 @@enDesc:
1929     The prototype of this subroutine.
1930 wakaba 1.35 @@ReflectCDATA:
1931 wakaba 1.6 @@Get:
1932     @@@nullCase:
1933     @@@@enDesc:
1934     No prototype is set.
1935     @@Set:
1936     @@@nullCase:
1937     @@@@enDesc:
1938     No prototype declaration.
1939 wakaba 1.42
1940     @@Test:
1941     @@@ForCheck: ManakaiDOM|ForClass
1942     @@@enDesc:
1943     Getting value after setting empty value must return an empty string.
1944     @@@PerlDef:
1945     my $impl = <Class::ManakaiPCImplementation>->_new;
1946     my $sub = $impl-><M::PCImplementation.createPerlSub> ("sub_name");
1947     $test->assert_not_null ($sub);
1948    
1949     $sub-><AS::PerlSub.prototype> ('');
1950     $test->assert_string (actual_value => $sub-><AG::PerlSub.prototype>,
1951     expected_value => '');
1952     $test->assert_true ($sub->stringify =~ /^sub sub_name \(\)/);
1953 wakaba 1.6
1954 wakaba 1.4 @ToStringMethod:
1955     @@Return:
1956 wakaba 1.35 @@@Type: DOMString
1957 wakaba 1.4 @@@enDesc:
1958     Perl code.
1959     @@@PerlDef:
1960 wakaba 1.35 __DEEP{
1961     $r = q<sub>;
1962     my $nm = $self-><M::PerlSub.getPerlNameList>;
1963     $r .= q< > . $nm->[0] if @$nm;
1964 wakaba 1.42 if ($self-><M::Element.hasAttributeNS> (<Q::pc:>, 'prototype')) {
1965     $r .= q< (> . $self-><AG::PerlSub.prototype> . q<)>;
1966     }
1967 wakaba 1.35 $r .= qq< {\n>;
1968     for my $child (@{$self-><AG::Node.childNodes>}) {
1969     $r .= $child->stringify;
1970     }
1971     $r .= qq<}\n>;
1972     }__;
1973 wakaba 1.14
1974     @NumValMethod:
1975     @@Return:
1976 wakaba 1.35 @@@Type: idl|unsignedLong||ManakaiDOM|all
1977 wakaba 1.14 @@@PerlDef:
1978 wakaba 1.35 __DEEP{
1979     $r = 0 + $self-><AG::Node.lastChild>;
1980     }__;
1981     ##PCSub
1982 wakaba 1.1
1983 wakaba 1.42 ElementTypeBinding:
1984     @Name: Test
1985     @ElementType:
1986     dis:ResourceDef
1987     @ShadowContent:
1988     @@rdf:type: test|StandaloneTest
1989    
1990 wakaba 1.5 XParamDef:
1991     @QName: parentNode
1992     @enDesc:
1993     Parent node.
1994    
1995     XParamDef:
1996     @QName: childNode
1997     @enDesc:
1998     Child node.
1999    
2000 wakaba 1.35 IFClsETDef:
2001 wakaba 1.25 @IFQName: PerlUnparsedCode
2002 wakaba 1.35 @CQName: ManakaiPCUnparsedCode
2003     @ETQName: pc|unparsed
2004 wakaba 1.25
2005     @IFISA: PerlCode
2006 wakaba 1.35 @CISA: ManakaiPCCode
2007 wakaba 1.25
2008 wakaba 1.1 @enDesc:
2009     Unparsed Perl code fragments.
2010 wakaba 1.5
2011 wakaba 1.35 @ATTR:
2012 wakaba 1.5 @@Name: sourceFile
2013 wakaba 1.35 @@ATTRQName: pc|sourceFile
2014 wakaba 1.5 @@enDesc:
2015     The source file name of this fragment.
2016 wakaba 1.35 @@ReflectCDATA:
2017 wakaba 1.5 @@Get:
2018     @@@enDesc:
2019     Any string identifying the source.
2020     @@@nullCase:
2021     @@@@enDesc: No source file name is set.
2022     @@Set:
2023     @@@nullCase:
2024     @@@@enDesc: No (or unknown) source file.
2025    
2026 wakaba 1.35 @ATTR:
2027 wakaba 1.5 @@Name: sourceLine
2028 wakaba 1.35 @@ATTRQName: pc|sourceLine
2029 wakaba 1.5 @@enDesc:
2030     Source file line number of the first line of this fragment.
2031 wakaba 1.35 @@ReflectCDATA:
2032 wakaba 1.5 @@Get:
2033     @@Set:
2034 wakaba 1.6
2035     @ToStringMethod:
2036     @@Return:
2037 wakaba 1.35 @@@Type: DOMString
2038 wakaba 1.6 @@@enDesc:
2039     Perl code.
2040     @@@PerlDef:
2041 wakaba 1.35 __DEEP{
2042 wakaba 1.39 $r = "\x0A" . $self-><AG::Node.textContent> . "\x0A";
2043 wakaba 1.35 my $file = $self-><AG::PerlCode.fileNode>;
2044 wakaba 1.38 my $src_file = $file ? $file-><AG::PerlFile.sourceFile>
2045     : $self->{<H::mn:node>}->{<H::mn:nodeID>};
2046 wakaba 1.39 if ($self-><AG::Node.ownerDocument>
2047     -><AG::Document.domConfig>
2048     -><M::DOMCore:DOMConfiguration.getParameter>
2049     (<Q::pc:line>)) {
2050     my $nxt_cnum = $file ? $file-><M::PerlFile.getNextChunkNumber> : 0;
2051     $r = sprintf qq<\n#line %d "%s [u] (Chunk #%d)"%s>.
2052     qq<#line 1 "%s [/u] (Chunk #%d)"\n>,
2053 wakaba 1.35 $self-><AG::PerlUnparsedCode.sourceLine> || 1,
2054     $self-><AG::PerlUnparsedCode.sourceFile> || $src_file,
2055     $file ? $file-><M::PerlFile.getNextChunkNumber> : 0,
2056 wakaba 1.39 $r,
2057 wakaba 1.35 $src_file,
2058     $file ? $file-><M::PerlFile.getNextChunkNumber> : 0;
2059 wakaba 1.39 }
2060 wakaba 1.35 }__;
2061 wakaba 1.1 ##PerlUnparsedCode
2062    
2063 wakaba 1.35 IFClsETDef:
2064 wakaba 1.25 @IFQName: PerlInlineUnparsedCode
2065 wakaba 1.35 @CQName: ManakaiPCInlineUnparsedCode
2066     @ETQName: pc|inlineUnparsed
2067 wakaba 1.25
2068     @IFISA: PerlCode
2069 wakaba 1.35 @CISA: ManakaiPCCode
2070 wakaba 1.25
2071 wakaba 1.6 @enDesc:
2072 wakaba 1.36 Unparsed Perl inline code fragments.
2073 wakaba 1.6
2074 wakaba 1.36 @ToStringMethod:
2075 wakaba 1.9 @@Return:
2076 wakaba 1.36 @@@Type: DOMString
2077     @@@enDesc:
2078     Perl code.
2079 wakaba 1.35 @@@disDef:
2080     @@@@DISPerl:cloneCode: DOMCore|ManakaiDOMNode.textContent.get
2081 wakaba 1.36 ##PCInlineUnparsedCode
2082 wakaba 1.6
2083 wakaba 1.35 IFClsETDef:
2084 wakaba 1.44 @IFQName: PCNumberLiteral
2085     @CQName: ManakaiPCNumberLiteral
2086     @ETQName: pc|numberLiteral
2087    
2088     @IFISA: PerlCode
2089     @CISA: ManakaiPCCode
2090    
2091     @enDesc:
2092     A <IF::PCNumberLiteral> object represents a Perl number literal.
2093     The <A::Node.textContent> of a <IF::PCNumberLiteral> object
2094     is a Perl source code representation of the number for the object.
2095    
2096     @ToStringMethod:
2097     @@Return:
2098     @@@Type: DOMString
2099     @@@PerlDef:
2100     __DEEP{
2101     $r = $self-><AG::Node.textContent>;
2102     }__;
2103     ##PCNumberLiteral
2104    
2105     IFClsETDef:
2106 wakaba 1.25 @IFQName: PerlStringLiteral
2107 wakaba 1.35 @CQName: ManakaiPCPerlStringLiteral
2108     @ETQName: pc|stringLiteral
2109 wakaba 1.25
2110     @IFISA: PerlCode
2111 wakaba 1.35 @CISA: ManakaiPCCode
2112 wakaba 1.25
2113 wakaba 1.6 @enDesc:
2114 wakaba 1.36 Perl string literal.
2115 wakaba 1.6
2116 wakaba 1.14 @NumValMethod:
2117     @@Return:
2118 wakaba 1.35 @@@Type: idl|unsignedLong||ManakaiDOM|all
2119 wakaba 1.14 @@@enDesc:
2120     Numeric value of the Perl code.
2121     @@@PerlDef:
2122 wakaba 1.35 __DEEP{
2123     $r = 0 + $self-><AG::Node.textContent>;
2124     }__;
2125 wakaba 1.14
2126 wakaba 1.6 @ToStringMethod:
2127     @@Return:
2128 wakaba 1.35 @@@Type: DOMString
2129 wakaba 1.6 @@@enDesc:
2130     Perl code.
2131     @@@PerlDef:
2132 wakaba 1.35 __DEEP{
2133     $r = $self-><AG::Node.textContent>;
2134     $r =~ s/(['\\])/\\$1/g;
2135     $r = q<'> . $r . q<'>;
2136     }__;
2137 wakaba 1.6 ##PerlStringLiteral
2138    
2139 wakaba 1.35 IFClsETDef:
2140 wakaba 1.41 @IFQName: PCList
2141     @CQName: ManakaiPCList
2142     @ETQName: pc|list
2143    
2144     @IFISA: PerlCode
2145 wakaba 1.42 @CISA: ManakaiPCCode
2146 wakaba 1.41
2147     @enDesc:
2148     A <IF::PCList> is a Perl list, i.e. <CHAR::COMMA> separated
2149     list of values.
2150    
2151     @Method:
2152     @@Name: item
2153     @@enDesc:
2154     Returns the <P::index>th item in the list.
2155     @@Param:
2156     @@@Name: index
2157     @@@Type: unsignedLong
2158     @@@enDesc:
2159     The ordinal index of the item.
2160     @@Return:
2161     @@@Type: PerlCodeInlines
2162     @@@enDesc:
2163     The <P::index>th item in the list.
2164     @@@nullCase:
2165     @@@@enDesc:
2166     Either <P::index> is negative or the <P::index> is
2167     greater than the number of the items in the list.
2168     @@@PerlDef:
2169     __DEEP{
2170     $r = $self-><AG::Node.childNodes>-><M::NodeList.item> ($index);
2171     }__;
2172    
2173     @Attr:
2174     @@Name: length
2175     @@enDesc:
2176     The number of items in the list.
2177     @@Type: unsignedLong
2178     @@Get:
2179     @@@PerlDef:
2180     __DEEP{
2181     $r = $self-><AG::Node.childNodes>-><AG::NodeList.length>;
2182     }__;
2183    
2184     @ToStringMethod:
2185     @@Return:
2186     @@@Type: DOMString
2187     @@@enDesc:
2188     Perl code.
2189     @@@PerlDef:
2190     __DEEP{
2191     my @r = map {$_->stringify} @{$self-><AG::Node.childNodes>};
2192     $r = '(' . join (', ', @r) . ')';
2193     }__;
2194     ##PCList
2195    
2196     IFClsETDef:
2197     @IFQName: PCArrayRefLiteral
2198     @CQName: ManakaiPCArrayRefLiteral
2199 wakaba 1.44 @ETQName: pc|arrayRefLiteral
2200 wakaba 1.41
2201     @IFISA: PerlCode
2202 wakaba 1.42 @CISA: ManakaiPCCode
2203 wakaba 1.41
2204     @enDesc:
2205     A <IF::PCArrayRefLiteral> is a Perl array reference literal.
2206    
2207     @Method:
2208     @@Name: item
2209     @@enDesc:
2210     Returns the <P::index>th item in the list.
2211     @@Param:
2212     @@@Name: index
2213     @@@Type: unsignedLong
2214     @@@enDesc:
2215     The ordinal index of the item.
2216     @@Return:
2217     @@@Type: PerlCodeInlines
2218     @@@enDesc:
2219     The <P::index>th item in the list.
2220     @@@nullCase:
2221     @@@@enDesc:
2222     Either <P::index> is negative or the <P::index> is
2223     greater than the number of the items in the list.
2224     @@@PerlDef:
2225     __DEEP{
2226     $r = $self-><AG::Node.childNodes>-><M::NodeList.item> ($index);
2227     }__;
2228    
2229     @Attr:
2230     @@Name: length
2231     @@enDesc:
2232     The number of items in the list.
2233     @@Type: unsignedLong
2234     @@Get:
2235     @@@PerlDef:
2236     __DEEP{
2237     $r = $self-><AG::Node.childNodes>-><AG::NodeList.length>;
2238     }__;
2239    
2240     @ToStringMethod:
2241     @@Return:
2242     @@@Type: DOMString
2243     @@@enDesc:
2244     Perl code.
2245     @@@PerlDef:
2246     __DEEP{
2247     my @r = map {$_->stringify} @{$self-><AG::Node.childNodes>};
2248     $r = '[' . join (', ', @r) . ']';
2249     }__;
2250     ##PCArrayRefLiteral
2251    
2252     IFClsETDef:
2253     @IFQName: PCHashRefLiteral
2254     @CQName: ManakaiPCHashRefLiteral
2255 wakaba 1.44 @ETQName: pc|hashRefLiteral
2256 wakaba 1.41
2257     @IFISA: PerlCode
2258 wakaba 1.42 @CISA: ManakaiPCCode
2259 wakaba 1.41
2260     @enDesc:
2261     A <IF::PCHashRefLiteral> is a Perl hash reference literal.
2262    
2263     @Method:
2264     @@Name: key
2265     @@enDesc:
2266     Returns the <P::index>th key in the list.
2267    
2268     {NOTE:: Although the order of key-value pairs is
2269     preserved in the object, it is not preserved
2270     in Perl source codes and in Perl language.
2271     }
2272     @@Param:
2273     @@@Name: index
2274     @@@Type: unsignedLong
2275     @@@enDesc:
2276     The ordinal index of the key.
2277     @@Return:
2278     @@@Type: PerlCodeInlines
2279     @@@enDesc:
2280     The <P::index>th key in the list.
2281     @@@nullCase:
2282     @@@@enDesc:
2283     Either <P::index> is negative or the <P::index> is
2284     greater than the number of the keys in the list.
2285     @@@PerlDef:
2286     __DEEP{
2287     $r = $self-><AG::Node.childNodes>-><M::NodeList.item> ($index * 2);
2288     }__;
2289    
2290     @Method:
2291     @@Name: value
2292     @@enDesc:
2293     Returns the <P::index>th value in the list.
2294    
2295     {NOTE:: Although the order of key-value pairs is
2296     preserved in the object, it is not preserved
2297     in Perl source codes and in Perl language.
2298     }
2299     @@Param:
2300     @@@Name: index
2301     @@@Type: unsignedLong
2302     @@@enDesc:
2303     The ordinal index of the value.
2304     @@Return:
2305     @@@Type: PerlCodeInlines
2306     @@@enDesc:
2307     The <P::index>th value in the list.
2308     @@@nullCase:
2309     @@@@enDesc:
2310     Either <P::index> is negative or the <P::index> is
2311     greater than the number of the values in the list.
2312    
2313     {NOTE:: <MATH::<A::PCHashRefLiteral.length> - 1>th
2314     value might not be found.
2315     }
2316     @@@PerlDef:
2317     __DEEP{
2318     $r = $self-><AG::Node.childNodes>-><M::NodeList.item> ($index * 2 + 1);
2319     }__;
2320    
2321     @Attr:
2322     @@Name: length
2323     @@enDesc:
2324     The number of key-value pairs in the list.
2325     @@Type: unsignedLong
2326     @@Get:
2327     @@@PerlDef:
2328     __DEEP{
2329     my $length = $self-><AG::Node.childNodes>-><AG::NodeList.length>;
2330     $r = int ($length / 2) + ($length % 2);
2331     }__;
2332    
2333     @Method:
2334     @@Name: setNamedItem
2335     @@enDesc:
2336     Set a named item.
2337     @@Param:
2338     @@@Name: key
2339     @@@Type: DOMString
2340     @@@enDesc:
2341     The key.
2342     @@Param:
2343     @@@Name: value
2344     @@@Type: PerlCodeInlines
2345     @@@enDesc:
2346     The value.
2347     @@Return:
2348     @@@PerlDef:
2349     __DEEP{
2350     my @children = @{$self-><AG::Node.childNodes>};
2351     R: {
2352     while (@children) {
2353     my $ckey = shift @children;
2354     my $cval = shift @children;
2355     if ($ckey-><AG::Node.textContent> eq $key) {
2356     $self-><M::Node.replaceChild> ($value, $cval);
2357     last R;
2358     }
2359     }
2360    
2361     $self-><M::Node.appendChild>
2362     ($self-><AG::Node.ownerDocument>
2363     -><M::Document.createElementNS>
2364     (<Q::pc:>, 'stringLiteral'))
2365     -><AS::Node.textContent> ($key);
2366     $self-><M::Node.appendChild> ($value);
2367     } # R
2368     }__;
2369    
2370     @ToStringMethod:
2371     @@Return:
2372     @@@Type: DOMString
2373     @@@enDesc:
2374     Perl code.
2375     @@@PerlDef:
2376     __DEEP{
2377     my %r = map {$_->stringify} @{$self-><AG::Node.childNodes>};
2378     ## Different values with same key are not preserved.
2379     $r = '{' . join (', ', map {$_ => $r{$_}}
2380     sort {$a cmp $b} keys %r) . '}';
2381     }__;
2382     ##PCHashRefLiteral
2383    
2384     ResourceDef:
2385     @QName: unsignedLong
2386     @AliasFor: idl|unsignedLong||ManakaiDOM|all
2387     @For: ManakaiDOM|DOM
2388    
2389     IFClsETDef:
2390 wakaba 1.25 @IFQName: PerlTokens
2391 wakaba 1.35 @CQName: ManakaiPCTokens
2392     @ETQName: pc|tokens
2393 wakaba 1.12
2394 wakaba 1.25 @IFISA: PerlCode
2395 wakaba 1.35 @CISA: ManakaiPCCode
2396 wakaba 1.25
2397 wakaba 1.6 @enDesc:
2398 wakaba 1.36 Unparsed Perl inline code fragments.
2399 wakaba 1.6
2400     @ToStringMethod:
2401     @@Return:
2402 wakaba 1.43 @@@Type: DOMString
2403 wakaba 1.6 @@@PerlDef:
2404 wakaba 1.35 __DEEP{
2405     $r = $self-><AG::Node.textContent>;
2406     }__;
2407     ##PCTokens
2408 wakaba 1.6
2409 wakaba 1.35 IFClsETDef:
2410 wakaba 1.25 @IFQName: PerlAtom
2411 wakaba 1.35 @CQName: ManakaiPCAtom
2412     @ETQName: pc|atom
2413 wakaba 1.25
2414     @IFISA: PerlCode
2415 wakaba 1.35 @CISA: ManakaiPCTokens
2416 wakaba 1.25
2417 wakaba 1.6 @enDesc:
2418     Unparsed Perl atomic code fragments (such as numeric literal).
2419    
2420 wakaba 1.14 @NumValMethod:
2421     @@Return:
2422 wakaba 1.35 @@@Type: idl|unsignedLong||ManakaiDOM|all
2423 wakaba 1.14 @@@enDesc:
2424     Numeric value of the Perl code.
2425     @@@PerlDef:
2426 wakaba 1.35 __DEEP{
2427     $r = 0 + $self-><AG::Node.textContent>;
2428     }__;
2429 wakaba 1.9
2430 wakaba 1.6 @ToStringMethod:
2431     @@Return:
2432 wakaba 1.35 @@@Type: DOMString
2433 wakaba 1.6 @@@enDesc:
2434     Perl code.
2435     @@@PerlDef:
2436 wakaba 1.35 __DEEP{
2437     $r = $self-><AG::Node.textContent>;
2438     }__;
2439 wakaba 1.6 ##PerlAtom
2440    
2441 wakaba 1.35 IFClsETDef:
2442 wakaba 1.25 @IFQName: PerlVariable
2443 wakaba 1.35 @CQName: ManakaiPCVariable
2444     @ETQName: pc|variable
2445 wakaba 1.25
2446     @IFISA: PerlCode
2447 wakaba 1.35 @CISA: ManakaiPCCode
2448 wakaba 1.25
2449 wakaba 1.6 @enDesc:
2450     Unparsed Perl variable.
2451     \
2452     {NOTE:: Future version of the implementation may
2453     support to specify array index or hash key.
2454     \
2455 wakaba 1.36 }
2456 wakaba 1.6
2457 wakaba 1.35 @ATTR:
2458 wakaba 1.6 @@Name: variableType
2459 wakaba 1.35 @@ATTRQName: pc|variableType
2460 wakaba 1.6 @@enDesc:
2461     Perl variable type (<CODE::$>, <CODE::@>, <CODE::%>,
2462     <CODE::&> or empty string).
2463 wakaba 1.35 @@ReflectCDATA:
2464 wakaba 1.6 @@Get:
2465     @@Set:
2466    
2467 wakaba 1.35 @ATTR:
2468 wakaba 1.6 @@Name: packageName
2469 wakaba 1.35 @@ATTRQName: pc|packageName
2470 wakaba 1.6 @@enDesc:
2471     The name of the package to which this variable belongs.
2472 wakaba 1.35 @@ReflectCDATA:
2473 wakaba 1.6 @@Get:
2474     @@@nullCase:
2475     @@@@enDesc:
2476     This package belongs to the current package or
2477     does not belong to any package.
2478     @@Set:
2479     @@@nullCase:
2480     @@@@enDesc:
2481     This package belongs to the current package or
2482     does not belong to any package.
2483    
2484 wakaba 1.35 @ATTR:
2485 wakaba 1.36 @@Name: pcLocalName
2486 wakaba 1.35 @@ATTRQName: pc|localName
2487 wakaba 1.6 @@enDesc:
2488     The local variable name.
2489 wakaba 1.35 @@ReflectCDATA:
2490 wakaba 1.6 @@Get:
2491     @@Set:
2492    
2493 wakaba 1.35 @ATTR:
2494 wakaba 1.6 @@Name: variableScope
2495 wakaba 1.35 @@ATTRQName: pc|variableScope
2496 wakaba 1.6 @@enDesc:
2497     Scope modifier (<CODE::my> or <CODE::our> or <CODE::local>).
2498 wakaba 1.35 @@ReflectCDATA:
2499 wakaba 1.6 @@Get:
2500     @@@nullCase:
2501     @@@@enDesc:
2502     This variable does not have scope modifier.
2503     @@Set:
2504     @@@nullCase:
2505     @@@@enDesc:
2506     This variable does not have scope modifier.
2507    
2508     @ToStringMethod:
2509     @@Return:
2510 wakaba 1.35 @@@Type: DOMString
2511 wakaba 1.6 @@@enDesc:
2512     Perl code.
2513     @@@PerlDef:
2514 wakaba 1.35 __DEEP{
2515     my $t = $self-><AG::PerlVariable.variableScope>;
2516     $r .= $t . ' ' if length $t;
2517     $r .= $self-><AG::PerlVariable.variableType>;
2518     my $v = $self-><AG::PerlVariable.packageName>;
2519     $r .= $v . '::' if length $v;
2520     $r .= $self-><AG::PerlVariable.pcLocalName>;
2521     $v = $self-><AG::PerlVariable.hashKey>;
2522     if ($t eq '$' and length $v) {
2523     $v =~ s/(['\\])/\\$1/g;
2524     $r .= q<{'> . $v . q<'}>;
2525     }
2526     }__;
2527 wakaba 1.6
2528 wakaba 1.35 @ATTR:
2529 wakaba 1.6 @@Name: hashKey
2530 wakaba 1.35 @@ATTRQName: pc|hashKey
2531 wakaba 1.6 @@enDesc:
2532     The key for hash.
2533     \
2534     {NOTE:: Using Perl code for key is not supported in the current
2535     version of the implementation.
2536     \
2537     }
2538 wakaba 1.35 @@ReflectCDATA:
2539 wakaba 1.6 @@Get:
2540     @@@nullCase:
2541     @@@@enDesc:
2542     This variable is not for hash value access.
2543     @@Set:
2544     @@@nullCase:
2545     @@@@enDesc:
2546     This variable is not for hash value access.
2547 wakaba 1.15 ##PerlVariable
2548 wakaba 1.6
2549 wakaba 1.25 IFClsDef:
2550     @IFQName: PerlCodeUnits
2551 wakaba 1.35 @CQName: ManakaiPCCodeUnits
2552 wakaba 1.25
2553 wakaba 1.35 @CISA: ManakaiPCCode
2554 wakaba 1.25
2555 wakaba 1.6 @enDesc:
2556     A base class implemented by both inline container and
2557     block-level container.
2558    
2559     @Attr:
2560     @@Name: length
2561     @@enDesc:
2562     The number of child code fragments.
2563 wakaba 1.35 @@Type: idl|unsignedLong||ManakaiDOM|all
2564 wakaba 1.6 @@Get:
2565     @@@PerlDef:
2566 wakaba 1.35 __DEEP{
2567     $r = @{$self-><AG::Node.childNodes>};
2568     }__;
2569 wakaba 1.6
2570     @Method:
2571     @@Name: appendStringLiteral
2572     @@enDesc:
2573     Appends a Perl string literal (<CODE::q>).
2574     @@Param:
2575     @@@Name: stringArg
2576 wakaba 1.35 @@@Type: DOMString
2577 wakaba 1.6 @@@enDesc:
2578     A string.
2579     @@Return:
2580 wakaba 1.35 @@@Type: PerlStringLiteral
2581 wakaba 1.6 @@@enDesc:
2582     The newly created Perl string literal object.
2583     @@@PerlDef:
2584 wakaba 1.35 __DEEP{
2585     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
2586     (<Q::pc:>, 'stringLiteral');
2587     $r-><AS::Node.textContent> ($stringArg);
2588     $self-><M::Node.appendChild> ($r);
2589     }__;
2590 wakaba 1.6
2591     @Method:
2592 wakaba 1.41 @@Name: appendNewPCLiteral
2593     @@enDesc:
2594     Creates a <IF::PCLiteral> object and appends it to the node.
2595     @@Param:
2596     @@@Name: value
2597     @@@Type: DISPerl|Any
2598     @@@enDesc: The value.
2599     @@Return:
2600     @@@Type: PerlCode
2601     @@@enDesc:
2602     The newly created object.
2603     @@@PerlDef:
2604     __DEEP{
2605     $r = $self-><AG::Node.ownerDocument>
2606     -><M::PCDocument.createPCLiteral> ($value);
2607     $self-><M::Node.appendChild> ($r);
2608     }__;
2609    
2610     @Method:
2611 wakaba 1.44 @@Name: appendNewPCNumberLiteral
2612     @@enDesc:
2613     Creates a <IF::PCNumberLiteral> object and appends it to the node.
2614     @@Param:
2615     @@@Name: value
2616     @@@Type: DISPerl|NumberValue
2617     @@@enDesc:
2618     The value.
2619     @@Return:
2620     @@@Type: PCNumberLiteral
2621     @@@enDesc:
2622     The newly created node.
2623     @@@PerlDef:
2624     __DEEP{
2625     $r = $self-><AG::Node.ownerDocument>
2626     -><M::PCDocument.createPCNumberLiteral> ($value);
2627     $self-><M::Node.appendChild> ($r);
2628     }__;
2629    
2630     @Method:
2631 wakaba 1.6 @@Name: appendAtom
2632     @@enDesc:
2633     Appends a Perl atomic code fragment.
2634     @@Param:
2635     @@@Name: codeArg
2636 wakaba 1.35 @@@Type: DOMString
2637 wakaba 1.6 @@@enDesc:
2638     An atom.
2639     @@Return:
2640 wakaba 1.35 @@@Type: PerlAtom
2641 wakaba 1.6 @@@enDesc:
2642     The newly created Perl code object.
2643     @@@PerlDef:
2644 wakaba 1.35 __DEEP{
2645     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
2646     (<Q::pc:>, 'atom');
2647     $r-><AS::Node.textContent> ($codeArg);
2648     $self-><M::Node.appendChild> ($r);
2649     }__;
2650 wakaba 1.6
2651     @Method:
2652     @@Name: appendBare
2653     @@enDesc:
2654     Appends a Perl bare code fragment.
2655     @@Param:
2656     @@@Name: codeArg
2657 wakaba 1.35 @@@Type: DOMString
2658 wakaba 1.6 @@@enDesc:
2659 wakaba 1.7 An bare code.
2660 wakaba 1.6 @@Return:
2661 wakaba 1.35 @@@Type: PerlBare
2662 wakaba 1.6 @@@enDesc:
2663     The newly created Perl code object.
2664     @@@PerlDef:
2665 wakaba 1.35 __DEEP{
2666     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
2667     (<Q::pc:>, 'tokens');
2668     $r-><AS::Node.textContent> ($codeArg);
2669     $self-><M::Node.appendChild> ($r);
2670     }__;
2671 wakaba 1.11
2672     @Method:
2673 wakaba 1.44 @@Name: appendNewPCVariable
2674     @@enDesc:
2675     Creates a variable object and appends it to the children list of
2676     the node.
2677     @@Param:
2678     @@@Name: variableTypeArg
2679     @@@Type: DOMString
2680     @@@enDesc:
2681     The variable type prefix such as <Perl::$>, if any, or an empty string.
2682     @@Param:
2683     @@@Name: packageNameArg
2684     @@@Type: DOMString
2685     @@@enDesc:
2686     The name of the package to which the variable belongs.
2687     @@@nullCase:
2688     @@@@enDesc:
2689     The variable does not belong to any package or belongs
2690     to the current package.
2691     @@Param:
2692     @@@Name: localNameArg
2693     @@@Type: DOMString
2694     @@@enDesc:
2695     The local part of the variable name.
2696     @@Return:
2697     @@@Type: PerlVariable
2698     @@@enDesc:
2699     The newly created variable object.
2700     @@@PerlDef:
2701     __DEEP{
2702     $r = $self-><AG::Node.ownerDocument>
2703     -><M::PCDocument.createPCVariable>
2704     ($variableTypeArg, $packageNameArg, $localNameArg);
2705     $self-><M::Node.appendChild> ($r);
2706     }__;
2707    
2708     @Method:
2709     @@Name: appendNewPCDereference
2710     @@enDesc:
2711     Creates a <IF::PCDereference> object and appends it to the child
2712     node list of the node.
2713     @@Param:
2714     @@@Name: variableTypeArg
2715     @@@Type: DOMString
2716     @@@enDesc:
2717     The type of the referenced value, such as <Perl::$>.
2718     @@Return:
2719     @@@Type: PCDereference
2720     @@@enDesc:
2721     The newly created element node.
2722     @@@PerlDef:
2723     __DEEP{
2724     $r = $self-><AG::Node.ownerDocument>
2725     -><M::PCDocument.createPCDereference> ($variableTypeArg);
2726     $self-><M::Node.appendChild> ($r);
2727     }__;
2728    
2729     @Method:
2730 wakaba 1.43 @@Name: appendNewPCExpression
2731     @@enDesc:
2732     Appends a newly created <IF::PCExpression> node.
2733     @@Param:
2734     @@@Name: operatorArg
2735     @@@Type: DOMString
2736     @@@enDesc:
2737     The operator of the expression.
2738     @@Return:
2739     @@@Type: PCExpression
2740     @@@enDesc:
2741     The newly created expression object.
2742     @@@PerlDef:
2743     __DEEP{
2744     $r = $self-><AG::Node.ownerDocument>
2745     -><M::PCDocument.createPCExpression> ($operatorArg);
2746     $self-><M::Node.appendChild> ($r);
2747     }__;
2748    
2749     @Method:
2750 wakaba 1.11 @@Name: appendNewAssignment
2751     @@enDesc:
2752     Appends a newly created <Class::ManakaiPerlAssign> object.
2753     @@Param:
2754     @@@Name: leftArg
2755 wakaba 1.35 @@@Type: PerlCode
2756 wakaba 1.11 @@@enDesc:
2757     A left hand side code fragment object.
2758     @@Param:
2759     @@@Name: rightArg
2760 wakaba 1.35 @@@Type: PerlCode
2761 wakaba 1.11 @@@enDesc:
2762     A right hand side code fragment object.
2763     @@Return:
2764 wakaba 1.36 @@@Type: PerlAssignment
2765 wakaba 1.11 @@@RaiseException:
2766     @@@@@:BAD_CHILD_ERR
2767     @@@@enDesc:
2768     An attempt is made to append a child
2769     that is not valid type.
2770     @@@RaiseException:
2771     @@@@@:IN_USE_NODE_ERR
2772     @@@@enDesc:
2773     An attempt is made to append a node that is
2774     already used elsewhere.
2775     @@@PerlDef:
2776 wakaba 1.35 for my $arg ([leftArg => $leftArg], [rightArg => $rightArg]) {
2777     if ({
2778     atom => 1, tokens => 1, inlineContainer => 1, assignment => true,
2779     inlineUnparsed => 1, variable => 1, stringLiteral => true,
2780 wakaba 1.41 list => true, arrayRefLiteral => true, hashRefLiteral => true,
2781 wakaba 1.35 }->{$arg->[1]-><AG::Node.localName>}) {
2782     if ($arg->[1]-><AG::Node.parentNode>) {
2783     __EXCEPTION{IN_USE_NODE_ERR::
2784     pc:childNode => {$arg->[1]},
2785     MDOMX:param-name => {$arg->[0]},
2786     }__;
2787     }
2788     } else {
2789     __EXCEPTION{BAD_CHILD_ERR::
2790     pc:parentNode => {$self},
2791     pc:childNode => {$arg->[1]},
2792     MDOMX:param-name => {$arg->[0]},
2793     }__;
2794     }
2795     } # left/right
2796    
2797     __DEEP{
2798     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
2799     (<Q::pc:>, 'assignment');
2800     $r-><AS::PerlAssignment.leftCode> ($leftArg);
2801     $r-><AS::PerlAssignment.rightCode> ($rightArg);
2802     $self-><M::Node.appendChild> ($r);
2803     }__;
2804 wakaba 1.43
2805     @Method:
2806 wakaba 1.44 @@Name: appendNewPCApply
2807     @@enDesc:
2808     Creates a <IF::PCApply> object and appends it to the children list
2809     of the node.
2810     @@Return:
2811     @@@Type: PCApply
2812     @@@enDesc: The newly created node.
2813     @@@PerlDef:
2814     __DEEP{
2815     $r = $self-><AG::Node.ownerDocument>-><M::PCDocument.createPCApply>;
2816     $self-><M::Node.appendChild> ($r);
2817     }__;
2818    
2819     @Method:
2820 wakaba 1.43 @@Name: appendNewPCFunctionCall
2821     @@enDesc:
2822     Appends a newly created <IF::PCFunctionCall> node.
2823     @@Param:
2824     @@@Name: packageArg
2825     @@@Type: DOMString
2826     @@@enDesc:
2827     The package name of the function.
2828     @@@nullCase:
2829     @@@@enDesc: No package name.
2830     @@Param:
2831     @@@Name: localNameArg
2832     @@@Type: DOMString
2833     @@@enDesc:
2834     The local part of the function name.
2835     @@Return:
2836     @@@Type: PCFunctionCall
2837     @@@enDesc:
2838     The newly created functin call object.
2839     @@@PerlDef:
2840     __DEEP{
2841     $r = $self-><AG::Node.ownerDocument>
2842     -><M::PCDocument.createPCFunctionCall>
2843     ($packageArg, $localNameArg);
2844     $self-><M::Node.appendChild> ($r);
2845     }__;
2846     ##PCCodeUnits
2847 wakaba 1.6
2848 wakaba 1.35 IFClsETDef:
2849 wakaba 1.25 @IFQName: PerlStatement
2850 wakaba 1.35 @CQName: ManakaiPCStatement
2851     @ETQName: pc|statement
2852 wakaba 1.25
2853     @IFISA: PerlCode
2854     @IFISA: PerlCodeInlines
2855 wakaba 1.35 @CISA: ManakaiPCCodeInlines
2856 wakaba 1.25
2857 wakaba 1.8 @enDesc:
2858 wakaba 1.36 Perl statements.
2859 wakaba 1.8
2860     @ToStringMethod:
2861     @@Return:
2862 wakaba 1.35 @@@Type: DOMString
2863 wakaba 1.8 @@@enDesc:
2864     Perl code.
2865     @@@PerlDef:
2866     $r = $self->SUPER::stringify;
2867 wakaba 1.16 $r .= ";\n" if length $r;
2868 wakaba 1.8 ##PerlStatement
2869 wakaba 1.6
2870 wakaba 1.35 IFClsETDef:
2871 wakaba 1.25 @IFQName: PerlCodeInlines
2872 wakaba 1.35 @CQName: ManakaiPCCodeInlines
2873     @ETQName: pc|inlineContainer
2874 wakaba 1.25
2875 wakaba 1.35 @CISA: ManakaiPCCodeUnits
2876 wakaba 1.25
2877 wakaba 1.6 @enDesc:
2878 wakaba 1.41 Perl inline code block.
2879 wakaba 1.6
2880     @Method:
2881     @@Name: appendCodeFragment
2882     @@enDesc:
2883 wakaba 1.35 Appends a <IF::PerlCode> object.
2884 wakaba 1.6 @@Param:
2885     @@@Name: codeArg
2886 wakaba 1.25 @@@Type: PerlCode
2887 wakaba 1.6 @@@enDesc:
2888     A code fragment object.
2889     @@Return:
2890     @@@RaiseException:
2891     @@@@@:BAD_CHILD_ERR
2892     @@@@enDesc:
2893     An attempt is made to append a child
2894     that is not a <Class::ManakaiPerlUnparsedCode>.
2895     @@@RaiseException:
2896     @@@@@:IN_USE_NODE_ERR
2897     @@@@enDesc:
2898     An attempt is made to append a node that is
2899     already used elsewhere.
2900     @@@PerlDef:
2901 wakaba 1.35 if ({
2902     atom => 1, tokens => 1, inlineContainer => 1, assignment => true,
2903     inlineUnparsed => 1, variable => 1, stringLiteral => true,
2904 wakaba 1.41 list => true, arrayRefLiteral => true, hashRefLiteral => true,
2905 wakaba 1.35 }->{$codeArg-><AG::Node.localName>}) {
2906     if ($codeArg-><AG::Node.parentNode>) {
2907     __EXCEPTION{IN_USE_NODE_ERR::
2908     pc:childNode => {$codeArg},
2909     }__;
2910     }
2911     __DEEP{
2912     $self-><AG::Node.ownerDocument>
2913     -><M::Document.adoptNode> ($codeArg);
2914     $self-><M::Node.appendChild> ($codeArg);
2915     }__;
2916     } else {
2917     __EXCEPTION{BAD_CHILD_ERR::
2918     pc:parentNode => {$self},
2919     pc:childNode => {$codeArg},
2920     }__;
2921     }
2922 wakaba 1.6
2923     @Method:
2924     @@Name: appendCode
2925     @@enDesc:
2926     Appends an unparsed Perl code fragment.
2927     @@Param:
2928     @@@Name: codeArg
2929 wakaba 1.35 @@@Type: DOMString
2930 wakaba 1.6 @@@enDesc:
2931     An unparsed Perl code fragment.
2932     @@Return:
2933 wakaba 1.25 @@@Type: PerlInlineUnparsedCode
2934 wakaba 1.6 @@@enDesc:
2935     The newly created Perl code object.
2936     @@@PerlDef:
2937 wakaba 1.35 __DEEP{
2938     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
2939     (<Q::pc:>, 'inlineUnparsed');
2940     $r-><AS::Node.textContent> ($codeArg);
2941     $self-><M::Node.appendChild> ($r);
2942     }__;
2943 wakaba 1.6
2944     @ToStringMethod:
2945     @@Return:
2946 wakaba 1.35 @@@Type: DOMString
2947 wakaba 1.6 @@@enDesc:
2948     Perl code.
2949     @@@PerlDef:
2950 wakaba 1.35 __DEEP{
2951     my @child = @{$self-><AG::Node.childNodes>};
2952     for my $child (@child) {
2953     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
2954     $child-><AG::Node.localName> eq 'inlineContainer' and
2955     1 == @child) {
2956     $r .= '(' . $child->stringify . ')';
2957     } else {
2958     $r .= $child->stringify;
2959     }
2960     }
2961     }__;
2962     ##PCCodeInlines
2963 wakaba 1.6
2964 wakaba 1.35 IFClsETDef:
2965 wakaba 1.25 @IFQName: PerlBlock
2966 wakaba 1.44 @CQName: ManakaiPerlBlock
2967 wakaba 1.35 @ETQName: pc|block
2968 wakaba 1.25
2969     @IFISA: PerlCode
2970     @IFISA: PerlCodeStatements
2971 wakaba 1.35 @CISA: ManakaiPCCodeStatements
2972 wakaba 1.25
2973 wakaba 1.8 @enDesc:
2974 wakaba 1.36 Perl block-level code block.
2975 wakaba 1.8
2976     @ToStringMethod:
2977     @@Return:
2978 wakaba 1.35 @@@Type: DOMString
2979 wakaba 1.8 @@@enDesc:
2980     Perl code.
2981     @@@PerlDef:
2982 wakaba 1.43 __DEEP{
2983 wakaba 1.35 my @child = @{$self-><AG::Node.childNodes>};
2984 wakaba 1.43 my $label = $self-><AG::PerlCodeStatements.label>;
2985     if (not $label and @child == 1 and
2986 wakaba 1.35 $child[0]-><AG::Node.localName> eq 'block') {
2987 wakaba 1.39 $r = "\x0A" . $child[0]->stringify . "\x0A";
2988 wakaba 1.43 } elsif (not $label and @child == 1 and
2989 wakaba 1.35 $child[0]-><AG::Node.localName> eq 'unparsed' and
2990     $child[0]-><AG::Node.textContent> =~ /^\s*$/) {
2991     #
2992     } else {
2993 wakaba 1.39 $r = "\x0A";
2994 wakaba 1.35 for my $child (@child) {
2995     if ($child-><AG::Node.localName> eq 'inlineContainer' and
2996     1 == @child) {
2997     $r .= '(' . $child->stringify . ')';
2998     } else {
2999     $r .= $child->stringify;
3000     }
3001     }
3002 wakaba 1.39 $r .= "\x0A";
3003 wakaba 1.35
3004 wakaba 1.39 if ($self-><AG::Node.ownerDocument>
3005     -><AG::Document.domConfig>
3006     -><M::DOMCore:DOMConfiguration.getParameter>
3007     (<Q::pc:line>)) {
3008     my $file = $self-><AG::PerlCode.fileNode>;
3009     my $sfile = $file ? $file-><AG::PerlFile.sourceFile>
3010     : $self->{<H::mn:node>}->{<H::mn:nodeID>};
3011     $r = sprintf qq<\n{\n#line %d "%s [b] (Chunk #%d)"%s>.
3012     qq<#line 1 "%s [/b] (Chunk #%d)"\n;}\n>,
3013 wakaba 1.35 $self-><AG::PerlCodeStatements.sourceLine> || 1,
3014     $self-><AG::PerlCodeStatements.sourceFile> || $sfile,
3015     $file ? $file-><M::PerlFile.getNextChunkNumber> : 0,
3016     $r,
3017     $sfile,
3018     $file ? $file-><M::PerlFile.getNextChunkNumber> : 0
3019 wakaba 1.39 if 2 < length $r;
3020 wakaba 1.41 } else {
3021     $r = "\n{\n$r\n;}\n" if 2 < length $r;
3022 wakaba 1.39 }
3023 wakaba 1.43
3024     $r = "\n" . $label . ':' . $r if $label;
3025     }
3026     }__;
3027 wakaba 1.44 ##PerlBlock
3028 wakaba 1.8
3029 wakaba 1.35 IFClsETDef:
3030 wakaba 1.25 @IFQName: PerlCodeBlocks
3031 wakaba 1.35 @CQName: ManakaiPCCodeBlocks
3032     @ETQName: pc|blockContainer
3033 wakaba 1.25
3034     @IFISA: PerlCodeStatements
3035 wakaba 1.35 @CISA: ManakaiPCCodeStatements
3036 wakaba 1.25
3037 wakaba 1.9 @enDesc:
3038     Perl block-level code container whose content may or may
3039     not semantically be self-contained.
3040    
3041     @ToStringMethod:
3042     @@Return:
3043 wakaba 1.35 @@@Type: DOMString
3044 wakaba 1.9 @@@enDesc:
3045     Perl code.
3046     @@@PerlDef:
3047 wakaba 1.35 my @child = @{$self-><AG::Node.childNodes>};
3048     if (@child == 1 and
3049     {
3050     block => true, blockContainer => true,
3051     }->{$child[0]-><AG::Node.localName>}) {
3052     $r = $child[0]->stringify;
3053     } else {
3054     for my $child (@child) {
3055     if ($child-><AG::Node.localName> eq 'inlineContainer' and
3056     1 == @child) {
3057     $r .= '(' . $child->stringify . ')';
3058     } else {
3059     $r .= $child->stringify;
3060     }
3061     }
3062 wakaba 1.9
3063 wakaba 1.35 __DEEP{
3064 wakaba 1.39 if ($self-><AG::Node.ownerDocument>
3065     -><AG::Document.domConfig>
3066     -><M::DOMCore:DOMConfiguration.getParameter>
3067     (<Q::pc:line>)) {
3068     my $file = $self-><AG::PerlCode.fileNode>;
3069     my $sfile = $file ? $file-><AG::PerlFile.sourceFile>
3070     : $self->{<H::mn:node>}->{<H::mn:nodeID>};
3071     $r = sprintf qq<\n#line %d "%s [bc] (Chunk #%d)"\n%s>.
3072     qq<\n#line 1 "%s [/bc] (Chunk #%d)"\n>,
3073 wakaba 1.35 $self-><AG::PerlCodeStatements.sourceLine> || 1,
3074     $self-><AG::PerlCodeStatements.sourceFile> || $sfile,
3075     $file ? $file-><M::PerlFile.getNextChunkNumber> : 0,
3076     $r,
3077     $sfile,
3078     $file ? $file-><M::PerlFile.getNextChunkNumber> : 0;
3079 wakaba 1.39 }
3080 wakaba 1.35 }__;
3081     }
3082     ##PCCodeBlocks
3083    
3084     IFClsETDef:
3085 wakaba 1.44 @IFQName: PCDereference
3086     @CQName: ManakaiPCDereference
3087     @ETQName: pc|dereference
3088    
3089     @IFISA: PerlCode
3090     @IFISA: PerlCodeInlines
3091     @CISA: ManakaiPCCodeInlines
3092    
3093     @enDesc:
3094     A <IF::PCDereference> object represents a dereference.
3095    
3096     @ATTR:
3097     @@Name: variableType
3098     @@ATTRQName: pc|variableType
3099     @@enDesc:
3100     The type of the value, such as <Perl::$>.
3101     @@ReflectCDATA:
3102     @@Get:
3103     @@Set:
3104    
3105     @ToStringMethod:
3106     @@Return:
3107     @@@Type: DOMString
3108     @@@PerlDef:
3109     __DEEP{
3110     $r = $self-><AG::PCDereference.variableType> . '{';
3111     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3112     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3113     $r .= $child;
3114     }
3115     $r .= '}';
3116     }__;
3117     ##PCDereference
3118    
3119     IFClsETDef:
3120     @IFQName: PCApply
3121     @CQName: ManakaiPCApply
3122     @ETQName: pc|apply
3123    
3124     @IFISA: PerlCode
3125     @IFISA: PerlCodeInlines
3126     @CISA: ManakaiPCCodeInlines
3127    
3128     @enDesc:
3129     A <IF::PCApply> object represents a function call.
3130    
3131     The first child element must be an expression results in a function name
3132     (such as bare function or operator name represented
3133     as a <IF::PCVariable> object or an <IF::PCExpression> with
3134     operator <Perl::-<gt>> whose last operand is a method name.
3135    
3136     The second child element, if any, is an expression intended to be
3137     an argument for the function. It is possible to specify more than
3138     one arguments by <IF::PCExpression> with operator <Perl::,>.
3139    
3140     The third child element, if any, is an expression that is put
3141     into the indirect object slot.
3142    
3143     @Attr:
3144     @@Name: function
3145     @@enDesc:
3146     The function child element of the element.
3147     @@Type: PerlCode
3148     @@Get:
3149     @@@nullCase:
3150     @@@@enDesc: There is no child element.
3151     @@@PerlDef:
3152     __DEEP{
3153     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3154     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3155     $r = $child;
3156     last A;
3157     }
3158     }__;
3159    
3160     @Attr:
3161     @@Name: argument
3162     @@enDesc:
3163     The argument child element of the element.
3164     @@Type: PerlCode
3165     @@Get:
3166     @@@nullCase:
3167     @@@@enDesc: There is no argument element.
3168     @@@PerlDef:
3169     __DEEP{
3170     my $x;
3171     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3172     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3173     if ($x) {
3174     $r = $child;
3175     last A;
3176     } else {
3177     $x = true;
3178     }
3179     }
3180     }__;
3181    
3182     @Attr:
3183     @@Name: indirect
3184     @@enDesc:
3185     The indirect object slot child element of the element.
3186     @@Type: PerlCode
3187     @@Get:
3188     @@@nullCase:
3189     @@@@enDesc: There is no indirect object element.
3190     @@@PerlDef:
3191     __DEEP{
3192     my $x = 0;
3193     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3194     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3195     if ($x++ == 2) {
3196     $r = $child;
3197     last A;
3198     }
3199     }
3200     }__;
3201    
3202    
3203     @ToStringMethod:
3204     @@Return:
3205     @@@Type: DOMString
3206     @@@PerlDef:
3207     __DEEP{
3208     my $f;
3209     my $arg;
3210     my $obj;
3211     no warnings 'uninitialized';
3212     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3213     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3214     if (not defined $f) {
3215     $f = ''.$child;
3216     } elsif (not defined $arg) {
3217     $arg = ''.$child;
3218     } else {
3219     $obj = ''.$child;
3220     last A;
3221     }
3222     }
3223    
3224     $r = $f;
3225     $r .= ' ' . $obj if defined $obj;
3226    
3227     if ({
3228     'die' => true,
3229     'last' => true,
3230     'next' => true,
3231     'redo' => true,
3232     'return' => true,
3233     'warn' => true,
3234     }->{$r}) {
3235     $r .= ' ' . $arg;
3236     } else {
3237     $r .= ' (' . $arg . ')';
3238     }
3239     }__;
3240     ##PCApply
3241    
3242     IFClsETDef:
3243 wakaba 1.43 @IFQName: PCExpression
3244     @CQName: ManakaiPCExpression
3245     @ETQName: pc|expression
3246    
3247     @IFISA: PerlCode
3248     @IFISA: PerlCodeInlines
3249     @CISA: ManakaiPCCodeInlines
3250    
3251     @enDesc:
3252     A <IF::PCExpression> object represents a sequence of one or more
3253     expression fragments (operands) separated by the same operator.
3254    
3255     @ATTR:
3256     @@Name: operator
3257     @@ATTRQName: pc|operator
3258     @@enDesc:
3259     The operator.
3260     @@ReflectCDATA:
3261     @@Get:
3262     @@Set:
3263    
3264     @Attr:
3265     @@Name: operandNumber
3266     @@enDesc:
3267     The number of operands.
3268     @@Type: idl|unsignedLong||ManakaiDOM|all
3269     @@Get:
3270     @@@PerlDef:
3271     __DEEP{
3272     $r = @{$self-><AG::Node.childNodes>};
3273     }__;
3274    
3275     @ToStringMethod:
3276     @@Return:
3277     @@@Type: DOMString
3278     @@@PerlDef:
3279     __DEEP{
3280     my @r;
3281     no warnings 'uninitialized';
3282     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3283     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3284 wakaba 1.44 my $xuri = $child-><AG::Node.namespaceURI>
3285     . $child-><AG::Node.localName>;
3286     push @r, [$child.'', $child, $xuri];
3287 wakaba 1.43 }
3288     if (@r > 1) {
3289     my $op = $self-><AG::PCExpression.operator>;
3290     for (@r) {
3291 wakaba 1.44 if ($_->[2] ne <Q::pc:expression> and not {
3292     <Q::pc:arrayRefLiteral> => true,
3293     <Q::pc:atom> => true,
3294     <Q::pc:dereference> => true,
3295     <Q::pc:hashRefLiteral> => true,
3296     <Q::pc:numberLiteral> => true,
3297     <Q::pc:stringLiteral> => true,
3298     <Q::pc:tokens> => true,
3299     <Q::pc:variable> => true,
3300     }->{$_->[2]}) {
3301     $_ = '(' . $_->[0] . ')';
3302     } elsif ($_->[2] eq <Q::pc:expression> and
3303     (not {
3304 wakaba 1.43 '+' => {'+' => true, '-' => true, '*' => true},
3305     '-' => {},
3306     '*' => {'*' => true},
3307     '/' => {},
3308     '&&' => {'&&' => true},
3309     '||' => {'||' => true},
3310     'and' => {'and' => true},
3311     'or' => {'or' => true},
3312     }->{$op}->{$_->[1]-><AG::PCExpression.operator>}) and
3313     $_->[1]-><AG::PCExpression.operandNumber> > 1) {
3314     $_ = '(' . $_->[0] . ')';
3315     } else {
3316     $_ = $_->[0];
3317     }
3318     }
3319 wakaba 1.44 $op = ' '.$op unless {
3320     ',' => true,
3321     '->' => true,
3322     }->{$op};
3323     $op = $op.' ' unless {
3324     '->' => true,
3325     }->{$op};
3326     $r = join $op, @r;
3327 wakaba 1.43 } elsif (@r) {
3328     $r = $r[0]->[0];
3329     } else {
3330     $r = 'undef';
3331     }
3332     }__;
3333     ##PCExpression
3334    
3335     IFClsETDef:
3336 wakaba 1.25 @IFQName: PerlAssignment
3337 wakaba 1.35 @CQName: ManakaiPCAssignment
3338     @ETQName: pc|assignment
3339 wakaba 1.25
3340     @IFISA: PerlCode
3341 wakaba 1.35 @CISA: ManakaiPCCode
3342 wakaba 1.25
3343 wakaba 1.11 @enDesc:
3344 wakaba 1.36 Perl variable assignment.
3345 wakaba 1.11
3346     @ToStringMethod:
3347     @@Return:
3348 wakaba 1.35 @@@Type: DOMString
3349 wakaba 1.11 @@@enDesc:
3350     Perl code.
3351     @@@PerlDef:
3352 wakaba 1.35 __DEEP{
3353     $r = $self-><AG::PerlAssignment.leftCode>->stringify
3354     . ' = '
3355     . $self-><AG::PerlAssignment.rightCode>->stringify;
3356     }__;
3357    
3358     @Attr:
3359     @@Name: leftCode
3360     @@enDesc:
3361     Left-hand expression.
3362     @@Type: PerlCodeInlines
3363     @@Get:
3364     @@@nullCase:
3365     @@@@enDesc: Left-hand code not yet specified.
3366     @@@PerlDef:
3367     __DEEP{
3368     F: for my $child (@{$self-><AG::Node.childNodes>}) {
3369     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3370     $child-><AG::Node.localName> eq 'left') {
3371     $r = $child-><AG::Node.lastChild>;
3372     last F;
3373     }
3374     }
3375     }__;
3376     @@Set:
3377     @@@PerlDef:
3378     __DEEP{
3379     $self-><AG::Node.ownerDocument>-><M::Document.adoptNode> ($given);
3380     F: {
3381     for my $child (@{$self-><AG::Node.childNodes>}) {
3382     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3383     $child-><AG::Node.localName> eq 'left') {
3384     $child-><AS::Node.textContent> ('');
3385     $child-><M::Node.appendChild> ($given);
3386     last F;
3387     }
3388     }
3389     my $node = $self-><AG::Node.ownerDocument>
3390     -><M::Document.createElementNS>
3391     (<Q::pc:>, 'left');
3392     $node-><M::Node.appendChild> ($given);
3393     $self-><M::Node.appendChild> ($node);
3394     }
3395     }__;
3396    
3397     @Attr:
3398     @@Name: rightCode
3399     @@enDesc:
3400     Right-hand expression.
3401     @@Type: PerlCodeInlines
3402     @@Get:
3403     @@@nullCase:
3404     @@@@enDesc: Right-hand code not yet specified.
3405     @@@PerlDef:
3406     __DEEP{
3407     F: for my $child (@{$self-><AG::Node.childNodes>}) {
3408     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3409     $child-><AG::Node.localName> eq 'right') {
3410     $r = $child-><AG::Node.lastChild>;
3411     last F;
3412     }
3413     }
3414     }__;
3415     @@Set:
3416     @@@PerlDef:
3417     __DEEP{
3418     $self-><AG::Node.ownerDocument>-><M::Document.adoptNode> ($given);
3419     F: {
3420     for my $child (@{$self-><AG::Node.childNodes>}) {
3421     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3422     $child-><AG::Node.localName> eq 'right') {
3423     $child-><AS::Node.textContent> ('');
3424     $child-><M::Node.appendChild> ($given);
3425     last F;
3426     }
3427     }
3428     my $node = $self-><AG::Node.ownerDocument>
3429     -><M::Document.createElementNS>
3430     (<Q::pc:>, 'right');
3431     $node-><M::Node.appendChild> ($given);
3432     $self-><M::Node.appendChild> ($node);
3433     }
3434     }__;
3435 wakaba 1.11 ##PerlAssignment
3436    
3437 wakaba 1.35 IFClsETDef:
3438 wakaba 1.44 @IFQName: PCCondition
3439     @CQName: ManakaiPCCondition
3440     @ETQName: pc2|condition
3441    
3442     @IFISA: PerlCode
3443     @IFISA: PerlCodeInlines
3444     @CISA: ManakaiPCCodeInlines
3445    
3446     @enDesc:
3447     A <IF::PCCondition> object represents a condition expression
3448     part of an <Perl::if> or <Perl::while> statement.
3449    
3450     @ToStringMethod:
3451     @@Return:
3452     @@@Type: DOMString
3453     @@@PerlDef:
3454     __DEEP{
3455     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3456     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3457     $r .= $child;
3458     }
3459     }__;
3460     ##PCCondition
3461    
3462     IFClsETDef:
3463     @IFQName: PCBlock
3464     @CQName: ManakaiPCBlock
3465     @ETQName: pc2|block
3466    
3467     @IFISA: PerlCode
3468     @IFISA: PerlCodeStatements
3469     @CISA: ManakaiPCCodeStatements
3470    
3471     @enDesc:
3472     A <Q::PCBlock> object represents a Perl code block, i.e.
3473     a set of statements enclosed by <CHAR::{> and <CHAR::}> pair.
3474    
3475     @ToStringMethod:
3476     @@Return:
3477     @@@Type: DOMString
3478     @@@PerlDef:
3479     __DEEP{
3480     my @child = @{$self-><AG::Node.childNodes>};
3481     my $label = $self-><AG::PerlCodeStatements.label>;
3482    
3483     $r = "\x0A";
3484     for my $child (@child) {
3485     if ($child-><AG::Node.localName> eq 'inlineContainer' and
3486     1 == @child) {
3487     $r .= '(' . $child->stringify . ')';
3488     } else {
3489     $r .= $child->stringify;
3490     }
3491     }
3492     $r .= "\x0A";
3493     $r .= ';' unless @child;
3494    
3495     if ($self-><AG::Node.ownerDocument>
3496     -><AG::Document.domConfig>
3497     -><M::DOMCore:DOMConfiguration.getParameter>
3498     (<Q::pc:line>)) {
3499     my $file = $self-><AG::PerlCode.fileNode>;
3500     my $sfile = $file ? $file-><AG::PerlFile.sourceFile>
3501     : $self->{<H::mn:node>}->{<H::mn:nodeID>};
3502     $r = sprintf qq<\n{\n#line %d "%s [b] (Chunk #%d)"%s>.
3503     qq<#line 1 "%s [/b] (Chunk #%d)"\n}\n>,
3504     $self-><AG::PerlCodeStatements.sourceLine> || 1,
3505     $self-><AG::PerlCodeStatements.sourceFile> || $sfile,
3506     $file ? $file-><M::PerlFile.getNextChunkNumber> : 0,
3507     $r,
3508     $sfile,
3509     $file ? $file-><M::PerlFile.getNextChunkNumber> : 0;
3510     } else {
3511     $r = "\n{\n$r\n}\n";
3512     }
3513    
3514     $r = "\n" . $label . ':' . $r . '# ' . $label . "\n"
3515     if length $label;
3516    
3517     }__;
3518     ##PCBlock
3519    
3520     IFClsETDef:
3521 wakaba 1.43 @IFQName: PCChoose
3522     @CQName: ManakaiPCChoose
3523     @ETQName: pc|choose
3524    
3525     @IFISA: PerlCode
3526     @CISA: ManakaiPCCode
3527    
3528     @enDesc:
3529     A <IF::PCChoose> object, or a <Q::pc|choose> element, represents
3530     a set of <Perl::if>, <Perl::elsif>, and <Perl::else> statements.
3531    
3532     @Method:
3533     @@Name: getWhen
3534     @@enDesc:
3535     Returns a <IF::PCWhen> by its ordinal index.
3536     @@Param:
3537     @@@Name: index
3538     @@@Type: idl|unsignedLong||ManakaiDOM|all
3539     @@@enDesc:
3540     The ordinal index of the <Q::pc|when> element.
3541     @@Return:
3542     @@@Type: PCWhen
3543     @@@enDesc:
3544     The <P::index>th <Q::pc|when> object.
3545     @@@nullCase:
3546     @@@@enDesc:
3547     There is no <P::index>th element.
3548     @@@PerlDef:
3549     __DEEP{
3550     my $i = 0;
3551     no warnings 'uninitialized';
3552     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3553     if ($child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE> and
3554     $child-><AG::Node.namespaceURI> eq <Q::pc:> and
3555     $child-><AG::Node.localName> eq 'when' and
3556     ++$i == $index) {
3557     $r = $child;
3558     last A;
3559     }
3560     }
3561     }__;
3562    
3563     @Method:
3564     @@Name: appendNewPCWhen
3565     @@enDesc:
3566     Appends a new <Q::pc|when> element.
3567     @@Return:
3568     @@@Type: PCWhen
3569     @@@enDesc:
3570     The newly created <Q::pc|when> element.
3571     @@@PerlDef:
3572     __DEEP{
3573     my $od = $self-><AG::Node.ownerDocument>;
3574     $r = $od-><M::Document.createElementNS> (<Q::pc:>, 'when');
3575     my $cond = $od-><M::Document.createElementNS>
3576 wakaba 1.44 (<Q::pc2:>, 'condition');
3577 wakaba 1.43 $r-><M::Node.appendChild> ($cond);
3578     my $block = $od-><M::Document.createElementNS>
3579 wakaba 1.44 (<Q::pc2:>, 'block');
3580 wakaba 1.43 $r-><M::Node.appendChild> ($block);
3581     $self-><M::Node.insertBefore> ($r, $self-><AG::PCChoose.otherwise>);
3582     }__;
3583    
3584     @Attr:
3585     @@Name: otherwise
3586     @@enDesc:
3587     Returns the <IF::PCOtherwise> by its ordinal index.
3588     @@Type: PCOtherwise
3589     @@Get:
3590     @@@enDesc:
3591     The <Q::pc|otherwise> object.
3592     @@@nullCase:
3593     @@@@enDesc:
3594     There is no <Q::pc|otherwise> element.
3595     @@@PerlDef:
3596     __CODE{getChildElementByType::
3597     $namespaceURI => {<Q::pc:>},
3598     $localName => {'otherwise'},
3599     $parent => $self,
3600     $result => $r,
3601     }__;
3602    
3603     @Method:
3604     @@Name: appendNewPCOtherwise
3605     @@enDesc:
3606     Appends a new <Q::pc|otherwise> element. If there is already the
3607     <Q::pc|otherwise> element, then no element is created and
3608     the element is returned.
3609     @@Return:
3610     @@@Type: PCOtherwise
3611     @@@enDesc:
3612     The <Q::pc|otherwise> element.
3613     @@@PerlDef:
3614     __DEEP{
3615     $r = $self-><AG::PCChoose.otherwise>;
3616     unless ($r) {
3617     my $od = $self-><AG::Node.ownerDocument>;
3618     $r = $od-><M::Document.createElementNS> (<Q::pc:>, 'otherwise');
3619     my $block = $od-><M::Document.createElementNS>
3620 wakaba 1.44 (<Q::pc2:>, 'block');
3621 wakaba 1.43 $r-><M::Node.appendChild> ($block);
3622     $self-><M::Node.appendChild> ($r);
3623     }
3624     }__;
3625    
3626     @ToStringMethod:
3627     @@Return:
3628     @@@Type: DOMString
3629     @@@PerlDef:
3630     __DEEP{
3631     S: for my $child (@{$self-><AG::Node.childNodes>}) {
3632     next S unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3633     next S unless $child-><AG::Node.namespaceURI> eq <Q::pc:>;
3634     my $ln = $child-><AG::Node.localName>;
3635     if ($ln eq 'when') {
3636     $r .= 'els' if length $r;
3637     $r .= $child->stringify;
3638     } elsif ($ln eq 'otherwise') {
3639     $r .= $child->stringify;
3640     last S;
3641     }
3642     } # S
3643     }__;
3644     ##PCChoose
3645    
3646     IFClsETDef:
3647     @IFQName: PCWhen
3648     @CQName: ManakaiPCWhen
3649     @ETQName: pc|when
3650    
3651     @IFISA: PerlCode
3652     @CISA: ManakaiPCCode
3653    
3654     @enDesc:
3655     A <IF::PCWhen> object, or a <Q::pc|when> element, represents an
3656     <Perl::if> or <Perl::elsif> block.
3657    
3658     @Attr:
3659     @@Name: condition
3660     @@enDesc:
3661 wakaba 1.44 The condition object.
3662     @@Type: PCCondition
3663 wakaba 1.43 @@Get:
3664     @@@nullCase:
3665     @@@@enDesc:
3666 wakaba 1.44 There is no condition element.
3667 wakaba 1.43 @@@PerlDef:
3668     __CODE{getChildElementByType::
3669 wakaba 1.44 $namespaceURI => {<Q::pc2:>},
3670 wakaba 1.43 $localName => {'condition'},
3671     $parent => $self,
3672     $result => $r,
3673     }__;
3674    
3675     @Attr:
3676     @@Name: block
3677     @@enDesc:
3678     The code block that is executed when the <A::PCWhen.condition> met.
3679 wakaba 1.44 @@Type: PCBlock
3680 wakaba 1.43 @@Get:
3681     @@@nullCase:
3682     @@@@enDesc:
3683 wakaba 1.44 There is no <Q::pc2:block> child element.
3684 wakaba 1.43 @@@PerlDef:
3685     __CODE{getChildElementByType::
3686 wakaba 1.44 $namespaceURI => {<Q::pc2:>},
3687 wakaba 1.43 $localName => {'block'},
3688     $parent => $self,
3689     $result => $r,
3690     }__;
3691    
3692     @ToStringMethod:
3693     @@Return:
3694     @@@Type: DOMString
3695     @@@PerlDef:
3696     __DEEP{
3697     $r = 'if (';
3698     my $cond = $self-><AG::PCWhen.condition>;
3699     if ($cond) {
3700     $r .= $cond->stringify;
3701     } else {
3702     $r .= '0';
3703     }
3704     $r .= ') ';
3705     my $block = $self-><AG::PCWhen.block>;
3706     if ($block) {
3707     $r .= $block->stringify;
3708     } else {
3709     $r .= "{ }\n";
3710     }
3711     }__;
3712     ##PCWhen
3713    
3714     IFClsETDef:
3715     @IFQName: PCOtherwise
3716     @CQName: ManakaiPCOtherwise
3717     @ETQName: pc|otherwise
3718    
3719     @IFISA: PerlCode
3720     @CISA: ManakaiPCCode
3721    
3722     @enDesc:
3723     A <IF::PCOtherwise> object, or a <Q::pc|otherwise> element, represents an
3724     <Perl::else> clause.
3725    
3726     @Attr:
3727     @@Name: block
3728     @@enDesc:
3729     The code block that is executed.
3730 wakaba 1.44 @@Type: PCBlock
3731 wakaba 1.43 @@Get:
3732     @@@nullCase:
3733     @@@@enDesc:
3734 wakaba 1.44 There is no <Q::pc2:block> child element.
3735 wakaba 1.43 @@@PerlDef:
3736     __CODE{getChildElementByType::
3737 wakaba 1.44 $namespaceURI => {<Q::pc2:>},
3738 wakaba 1.43 $localName => {'block'},
3739     $parent => $self,
3740     $result => $r,
3741     }__;
3742    
3743     @ToStringMethod:
3744     @@Return:
3745     @@@Type: DOMString
3746     @@@PerlDef:
3747     __DEEP{
3748     my $block = $self-><AG::PCOtherwise.block>;
3749     if ($block) {
3750     $r = 'else ' . $block->stringify;
3751     }
3752     }__;
3753     ##PCOtherwise
3754    
3755     ResourceDef:
3756     @For: ManakaiDOM|ManakaiDOM
3757     @QName: getChildElementByType
3758     @rdf:type: DISPerl|BlockCode
3759     @enDesc:
3760     Returns the first element of a type.
3761     @PerlCDef:
3762     __DEEP{
3763     no warnings 'uninitialized';
3764     A: for my $__child (@{$parent-><AG::Node.childNodes>}) {
3765     if ($__child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE> and
3766     $__child-><AG::Node.namespaceURI> eq $namespaceURI and
3767     $__child-><AG::Node.localName> eq $localName) {
3768     $result = $__child;
3769     last A;
3770     }
3771     }
3772     }__;
3773    
3774     IFClsETDef:
3775 wakaba 1.26 @IFQName: PerlIf
3776 wakaba 1.35 @CQName: ManakaiPCIf
3777     @ETQName: pc|if
3778 wakaba 1.25
3779     @IFISA: PerlCode
3780 wakaba 1.35 @CISA: ManakaiPCCode
3781 wakaba 1.25
3782 wakaba 1.12 @enDesc:
3783     Perl variable assignment.
3784    
3785     @ToStringMethod:
3786     @@Return:
3787 wakaba 1.35 @@@Type: DOMString
3788 wakaba 1.12 @@@enDesc:
3789     Perl code.
3790     @@@PerlDef:
3791 wakaba 1.35 __DEEP{
3792     my $tcode = $self-><AG::PerlIf.trueCode>;
3793     my $fcode = $self-><AG::PerlIf.falseCode>;
3794     my $ccode = $self-><AG::PerlIf.condition>;
3795     if (defined $tcode) {
3796     if (defined $fcode) {
3797     $r = q<if (> . $ccode->stringify . q<) {> . $tcode->stringify .
3798     q<} else {> . $fcode->stringify . qq<}\n>;
3799     } else {
3800 wakaba 1.36 $r = q<if (> . $ccode->stringify . q<) {> . $tcode->stringify .
3801 wakaba 1.35 qq<}\n>;
3802     }
3803     } else {
3804     $r = q<unless (> . $ccode->stringify . q<) {> . $fcode->stringify .
3805     qq<}\n>;
3806     }
3807     }__;
3808    
3809     @Attr:
3810     @@Name: condition
3811     @@enDesc:
3812     Condition expression.
3813     @@Type: PerlCodeInlines
3814     @@Get:
3815     @@@nullCase:
3816     @@@@enDesc: Condition code not yet specified.
3817     @@@PerlDef:
3818     __DEEP{
3819     F: for my $child (@{$self-><AG::Node.childNodes>}) {
3820     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3821     $child-><AG::Node.localName> eq 'condition') {
3822     $r = $child-><AG::Node.lastChild>;
3823     last F;
3824     }
3825     }
3826     }__;
3827     @@Set:
3828     @@@PerlDef:
3829     __DEEP{
3830     $self-><AG::Node.ownerDocument>-><M::Document.adoptNode> ($given);
3831     F: {
3832     for my $child (@{$self-><AG::Node.childNodes>}) {
3833     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3834     $child-><AG::Node.localName> eq 'condition') {
3835     $child-><AS::Node.textContent> ('');
3836     $child-><M::Node.appendChild> ($given);
3837     last F;
3838     }
3839     }
3840     my $node = $self-><AG::Node.ownerDocument>
3841     -><M::Document.createElementNS>
3842     (<Q::pc:>, 'condition');
3843     $node-><M::Node.appendChild> ($given);
3844     $self-><M::Node.appendChild> ($node);
3845     }
3846     }__;
3847    
3848     @Attr:
3849     @@Name: trueCode
3850     @@enDesc:
3851     True-case code.
3852     @@Type: PerlCodeBlocks
3853     @@Get:
3854     @@@nullCase:
3855     @@@@enDesc: True-case code not yet specified.
3856     @@@PerlDef:
3857     __DEEP{
3858     F: for my $child (@{$self-><AG::Node.childNodes>}) {
3859     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3860     $child-><AG::Node.localName> eq 'tr'.'ue') {
3861     $r = $child-><AG::Node.lastChild>;
3862     last F;
3863     }
3864     }
3865     }__;
3866     @@Set:
3867     @@@PerlDef:
3868     __DEEP{
3869     $self-><AG::Node.ownerDocument>-><M::Document.adoptNode> ($given);
3870     F: {
3871     for my $child (@{$self-><AG::Node.childNodes>}) {
3872     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3873     $child-><AG::Node.localName> eq 'tr'.'ue') {
3874     $child-><AS::Node.textContent> ('');
3875     $child-><M::Node.appendChild> ($given);
3876     last F;
3877     }
3878     }
3879     my $node = $self-><AG::Node.ownerDocument>
3880     -><M::Document.createElementNS>
3881     (<Q::pc:>, 'tr'.'ue');
3882     $node-><M::Node.appendChild> ($given);
3883     $self-><M::Node.appendChild> ($node);
3884     }
3885     }__;
3886    
3887     @Attr:
3888     @@Name: falseCode
3889     @@enDesc:
3890     False-case code.
3891     @@Type: PerlCodeBlocks
3892     @@Get:
3893     @@@nullCase:
3894     @@@@enDesc: True-case code not yet specified.
3895     @@@PerlDef:
3896     __DEEP{
3897     F: for my $child (@{$self-><AG::Node.childNodes>}) {
3898     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3899     $child-><AG::Node.localName> eq 'fal'.'se') {
3900     $r = $child-><AG::Node.lastChild>;
3901     last F;
3902     }
3903     }
3904     }__;
3905     @@Set:
3906     @@@PerlDef:
3907     __DEEP{
3908     $self-><AG::Node.ownerDocument>-><M::Document.adoptNode> ($given);
3909     F: {
3910     for my $child (@{$self-><AG::Node.childNodes>}) {
3911     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3912     $child-><AG::Node.localName> eq 'fal'.'se') {
3913     $child-><AS::Node.textContent> ('');
3914     $child-><M::Node.appendChild> ($given);
3915     last F;
3916     }
3917     }
3918     my $node = $self-><AG::Node.ownerDocument>
3919     -><M::Document.createElementNS>
3920     (<Q::pc:>, 'fal'.'se');
3921     $node-><M::Node.appendChild> ($given);
3922     $self-><M::Node.appendChild> ($node);
3923     }
3924     }__;
3925 wakaba 1.12 ##PerlIf
3926    
3927     PropDef:
3928     @QName:condition
3929     @enDesc:
3930     Condition.
3931     PropDef:
3932     @QName:true
3933     @enDesc:
3934     If true.
3935     PropDef:
3936     @QName:false
3937     @enDesc:
3938     If false.
3939    
3940 wakaba 1.11 PropDef:
3941     @QName:left
3942     @FullName:
3943     @@lang:en
3944     @@@: Left hand side
3945     PropDef:
3946     @QName:right
3947     @FullName:
3948     @@lang:en
3949     @@@: Right hand side
3950    
3951 wakaba 1.8 PropDef:
3952     @QName:label
3953     @enDesc:
3954     Perl statement / block label.
3955    
3956 wakaba 1.43
3957     IFClsETDef:
3958     @IFQName: PCFunctionCall
3959     @CQName: ManakaiPCFunctionCall
3960     @ETQName: pc|call
3961    
3962     @IFISA: PerlCode
3963     @IFISA: PerlCodeInlines
3964     @CISA: ManakaiPCCodeInlines
3965    
3966     @enDesc:
3967     A <IF::PCFunctionCall> object represents a function call or
3968     function-like statement such as <Perl::next>.
3969    
3970     @ATTR:
3971     @@Name: variableType
3972     @@ATTRQName: pc|variableType
3973     @@enDesc:
3974     The value of the attribute <kwd:MAY> be <Perl::&>,
3975     which introduces a subroutine name.
3976     @@ReflectCDATA:
3977     @@Get:
3978     @@Set:
3979    
3980     @ATTR:
3981     @@Name: packageName
3982     @@ATTRQName: pc|packageName
3983     @@enDesc:
3984     The name of the package to which the subroutine belongs.
3985     @@ReflectCDATA:
3986     @@Get:
3987     @@@nullCase:
3988     @@@@enDesc:
3989     The object belongs to the current package or
3990     does not belong to any package.
3991     @@Set:
3992     @@@nullCase:
3993     @@@@enDesc:
3994     The object belongs to the current package or
3995     does not belong to any package.
3996    
3997     @ATTR:
3998     @@Name: pcLocalName
3999     @@ATTRQName: pc|localName
4000     @@enDesc:
4001     The local part of the subroutine name.
4002     @@ReflectCDATA:
4003     @@Get:
4004     @@Set:
4005    
4006     @ToStringMethod:
4007     @@Return:
4008     @@@Type: DOMString
4009     @@@PerlDef:
4010     __DEEP{
4011     $r .= $self-><AG::PCFunctionCall.variableType>;
4012     my $v = $self-><AG::PCFunctionCall.packageName>;
4013     $r .= $v . '::' if length $v;
4014     $r .= $self-><AG::PCFunctionCall.pcLocalName>;
4015    
4016     my @arg;
4017     no warnings 'uninitialized';
4018     A: for my $child (@{$self-><AG::Node.childNodes>}) {
4019     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
4020     push @arg, ''.$child;
4021     }
4022     my $arg = join ', ', @arg;
4023     if ({
4024     'die' => true,
4025     'last' => true,
4026     'next' => true,
4027     'redo' => true,
4028 wakaba 1.44 'return' => true,
4029 wakaba 1.43 'warn' => true,
4030 wakaba 1.44 }->{$r}) {
4031 wakaba 1.43 $r .= ' ' . $arg;
4032     } else {
4033     $r .= ' (' . $arg . ')';
4034     }
4035     }__;
4036     ##PCFunctionCall
4037    
4038 wakaba 1.6 ElementTypeBinding:
4039     @Name: RaiseException
4040     @ElementType:
4041 wakaba 1.39 dx:raises
4042    
4043     ## -- Configuration Parameters
4044    
4045     boolCParam:
4046     @QName: pc|line
4047     @nodeProp: pcline
4048     @IsSupportRequired:1
4049     @DOMCore:targetType: DOMCore|Document
4050     @TrueCase:
4051     @@DOMCore:isSupported:1
4052     @@enDesc:
4053     Inserts <Perl::#line> directives.
4054     @FalseCase:
4055     @@DOMCore:isSupported:1
4056     @@IsSupportRequired:1
4057     @@IsDefault:1
4058     Does not insert any <Perl::#line> directive.
4059    
4060     CParam:
4061     @QName: pc|split-resolver
4062     @nodeProp: pcsres
4063     @IsSupportRequired:1
4064     @DOMCore:targetType: DOMCore|Document
4065     @Type: DISPerl|CODE||ManakaiDOM|all
4066     @enDesc:
4067     Splits module file. The parameter value <kwd:MUST> be
4068     a Perl code reference. The serializer would invoke
4069     the code with arguments: a reserved parameter, a <IF::PerlFile>
4070     whose serialization is being split, and a string
4071     that identifies the split part. The code is expected
4072     to return a <IF::DOMLS:LSOutput> object to which the module part
4073     is written. Note that splitting serialized module file
4074     does not affect to the <IF::PerlFile> tree.
4075     @nullCase:
4076     @@enDesc:
4077     Does not split module file.
4078    
4079     ElementTypeBinding:
4080     @Name: nodeProp
4081     @ElementType:
4082     DOMCore:nodeProp
4083     @ShadowContent:
4084     @@For: =ManakaiDOM|all
4085    
4086     ElementTypeBinding:
4087     @Name: CParam
4088     @ElementType:
4089     dis:ResourceDef
4090     @ShadowContent:
4091     @@rdf:type:
4092     @@@@: DOMCore|DOMConfigurationParameter
4093     @@@For: ManakaiDOM|DOM
4094     @@rdf:type:
4095     @@@@: DISCore|Property
4096     @@@For: =ManakaiDOM|all
4097     @@For: ManakaiDOM|DOM3
4098     @@For: =ManakaiDOM|all
4099    
4100     ElementTypeBinding:
4101     @Name: boolCParam
4102     @ElementType:
4103     dis:ResourceDef
4104     @ShadowContent:
4105     @@rdf:type:
4106     @@@@: DOMCore|DOMConfigurationParameter
4107     @@@For: ManakaiDOM|DOM
4108     @@rdf:type:
4109     @@@@: DISCore|Property
4110     @@@For: =ManakaiDOM|all
4111     @@For: ManakaiDOM|DOM3
4112     @@For: =ManakaiDOM|all
4113     @@Type: idl|boolean||ManakaiDOM|all
4114    
4115 wakaba 1.41 ## -- PCDocument
4116    
4117     IFClsDef:
4118     @IFQName: PCDocument
4119     @CQName: ManakaiPCDocument
4120    
4121     @IFISA: Document
4122     @CISA: DOMCore|ManakaiDOMDocument
4123    
4124     @enDesc:
4125     A <IF::PCDocument> is a <IF::Document> that represents a Perl code.
4126    
4127     @s:rootElementType: pc|file
4128    
4129     @Method:
4130     @@Name: createPCLiteral
4131     @@enDesc:
4132     Creates a literal object.
4133     @@Param:
4134     @@@Name: value
4135     @@@Type: DISPerl|Any
4136     @@@enDesc:
4137     The value.
4138     @@@InCase:
4139     @@@@Type: DISPerl|StringValue
4140     @@@@enDesc:
4141     A <IF::PerlStringLiteral> whose value is <P::value> is created.
4142     @@@InCase:
4143     @@@@Type: DISPerl|ARRAY
4144     @@@@enDesc:
4145     A <IF::PCArrayRefLiteral> is created. If <P::value>
4146     has items, then objects are recursively created.
4147     @@@InCase:
4148     @@@@Type: DISPerl|HASH
4149     @@@@enDesc:
4150     A <IF::PCHashRefLiteral> is created. If <P::value>
4151     has key-value pairs, then objects are recursively created.
4152     @@Return:
4153     @@@Type: PerlCode
4154     @@@enDesc: The newly created value object.
4155     @@@PerlDef:
4156     __DEEP{
4157     if (ref $value eq 'HASH' or ref $value eq 'ARRAY') {
4158     $r = $self-><M::Document.createElementNS>
4159     (<Q::pc:>, ref $value eq 'HASH' ? 'hashRefLiteral'
4160     : 'arrayRefLiteral');
4161     for my $v (ref $value eq 'HASH' ? %$value : @$value) {
4162     my $vo;
4163     if (UNIVERSAL::isa ($v, <IFName::PerlCode>)) {
4164     $vo = $v;
4165     } else {
4166     $vo = $self-><M::PCDocument.createPCLiteral> ($v);
4167     }
4168     $r-><M::Node.appendChild> ($vo);
4169     }
4170     } else {
4171     $r = $self-><M::Document.createElementNS>
4172     (<Q::pc:>, 'stringLiteral');
4173     $r-><AS::Node.textContent> ($value);
4174     }
4175 wakaba 1.43 }__;
4176    
4177     @Method:
4178 wakaba 1.44 @@Name: createPCNumberLiteral
4179     @@enDesc:
4180     Creates a number literal object.
4181     @@Param:
4182     @@@Name: value
4183     @@@Type: DISPerl|NumberValue
4184     @@@enDesc:
4185     The value.
4186     @@Return:
4187     @@@Type: PCNumberValue
4188     @@@enDesc: The newly created value object.
4189     @@@PerlDef:
4190     __DEEP{
4191     $r = $self-><M::Document.createElementNS>
4192     (<Q::pc:>, 'numberLiteral');
4193     $r-><AS::Node.textContent> ($value);
4194     }__;
4195    
4196     @Method:
4197     @@Name: createPCVariable
4198     @@enDesc:
4199     Creates a new <IF::PerlVariable> object.
4200     @@Param:
4201     @@@Name: variableType
4202     @@@Type: DOMString
4203     @@@enDesc:
4204     Variable prefix.
4205     @@@nullCase:
4206     @@@@enDesc:
4207     If the <P::packageName> is <DOM::null>, then
4208     the <P::variableType> is detected by the prefix of
4209     <P::localName>. Otherwise, it is an unprefixed variable
4210     such as file handle.
4211     @@Param:
4212     @@@Name: packageName
4213     @@@Type: DOMString
4214     @@@enDesc:
4215     Package name.
4216     @@@nullCase:
4217     @@@@enDesc:
4218     The variable belongs to the current package or a
4219     lexical-scoped variable.
4220     @@Param:
4221     @@@Name: localName
4222     @@@Type: DOMString
4223     @@@enDesc:
4224     Variable name. If both <P::variableType> and <P::packageName>
4225     is <DOM::null>, the <P::localName> value may be prefixed
4226     by any possible <P::variableType> value.
4227     @@Return:
4228     @@@Type: PerlVariable
4229     @@@enDesc:
4230     Newly created Perl variable object.
4231     @@@PerlDef:
4232     __DEEP{
4233     $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'variable');
4234     if (not $variableType and not $packageName and
4235     $localName =~ s/^(\\?[\$\@%&*])//) {
4236     $variableType = $1;
4237     }
4238     $r-><AS::PerlVariable.variableType> ($variableType)
4239     if defined $variableType;
4240     $r-><AS::PerlVariable.packageName> ($packageName)
4241     if defined $packageName;
4242     $r-><AS::PerlVariable.pcLocalName> ($localName);
4243     }__;
4244    
4245     @Method:
4246     @@Name: createPCDereference
4247     @@enDesc:
4248     Creates a <IF::PCDereference> object.
4249     @@Param:
4250     @@@Name: variableType
4251     @@@Type: DOMString
4252     @@@enDesc:
4253     The type of the referenced value, such as <Perl::$>.
4254     @@Return:
4255     @@@Type: PCDereference
4256     @@@enDesc:
4257     The newly created element node.
4258     @@@PerlDef:
4259     __DEEP{
4260     $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'dereference');
4261     $r-><AS::PCDereference.variableType> ($variableType);
4262     }__;
4263    
4264     @Method:
4265 wakaba 1.43 @@Name: createPCExpression
4266     @@enDesc:
4267     Creates a <Q::pc:expression> element node.
4268     @@Param:
4269     @@@Name: operator
4270     @@@Type: DOMString
4271     @@@enDesc:
4272     The operator of the expression.
4273     @@Return:
4274     @@@Type: PCExpression
4275     @@@enDesc:
4276     The newly created expression object.
4277     @@@PerlDef:
4278     __DEEP{
4279 wakaba 1.44 $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'expression');
4280 wakaba 1.43 $r-><AS::PCExpression.operator> ($operator);
4281     }__;
4282    
4283     @Method:
4284 wakaba 1.44 @@Name: createPCApply
4285     @@enDesc:
4286     Creates a <Q::pc:apply> element node.
4287     @@Return:
4288     @@@Type: PCApply
4289     @@@enDesc: The newly created element node.
4290     @@@PerlDef:
4291     __DEEP{
4292     $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'apply');
4293     }__;
4294    
4295     @Method:
4296 wakaba 1.43 @@Name: createPCFunctionCall
4297     @@enDesc:
4298 wakaba 1.44 Creates a function call element node.
4299 wakaba 1.43 @@Param:
4300     @@@Name: package
4301     @@@Type: DOMString
4302     @@@enDesc:
4303     The package to which the function belongs.
4304     @@@nullCase:
4305     @@@@enDesc: No package name.
4306     @@Param:
4307     @@@Name: localName
4308     @@@Type: DOMString
4309     @@@enDesc:
4310     The local part of the function name.
4311     @@Return:
4312 wakaba 1.44 @@@Type: PCApply
4313 wakaba 1.43 @@@enDesc:
4314     The newly created function object.
4315     @@@PerlDef:
4316     __DEEP{
4317 wakaba 1.44 $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'apply');
4318     my $func = $self-><M::PCDocument.createPCVariable>
4319     ('', $package, $localName);
4320     $r-><M::Node.appendChild> ($func);
4321     }__;
4322    
4323     @Method:
4324     @@Name: createPCBlock
4325     @@enDesc:
4326     Creates a <Q::pc2:block> element node.
4327     @@Return:
4328     @@@Type: PCBlock
4329     @@@enDesc:
4330     The newly created <Q::pc2:block> element.
4331     @@@PerlDef:
4332     __DEEP{
4333     $r = $self-><M::Document.createElementNS> (<Q::pc2:>, 'block');
4334 wakaba 1.43 }__;
4335    
4336     @Method:
4337     @@Name: createPCChoose
4338     @@enDesc:
4339     Creates a <Q::pc:choose> element node.
4340     @@Return:
4341     @@@Type: PCChoose
4342     @@@enDesc:
4343     The newly created <Q::pc:choose> element.
4344     @@@PerlDef:
4345     __DEEP{
4346     $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'choose');
4347 wakaba 1.41 }__;
4348     ##PCDocument
4349    
4350 wakaba 1.39 ## -- Implementation
4351 wakaba 1.6
4352 wakaba 1.25 IFClsDef:
4353     @IFQName: PCImplementation
4354 wakaba 1.35 @CQName: ManakaiPCImplementation
4355 wakaba 1.25
4356 wakaba 1.1 @enDesc:
4357     The class that provides factory methods.
4358 wakaba 1.20
4359 wakaba 1.35 @CISA: DOMCore|ManakaiDOMImplementation||ManakaiDOM|ManakaiDOMLatest
4360     @CISA: dx|ManakaiDefaultExceptionHandler||ManakaiDOM|Perl
4361 wakaba 1.17
4362 wakaba 1.35 @f:provides: pc|CoreFeature10
4363 wakaba 1.1
4364     @Method:
4365     @@Name: createPerlFile
4366     @@enDesc:
4367     Creates a Perl code file.
4368     @@Return:
4369 wakaba 1.25 @@@Type: PerlFile
4370 wakaba 1.1 @@@enDesc: A newly created Perl source file object.
4371     @@@PerlDef:
4372 wakaba 1.35 __DEEP{
4373     $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
4374     -><AG::Document.documentElement>;
4375     }__;
4376 wakaba 1.1
4377 wakaba 1.13 @Method:
4378     @@Name: createPerlPackage
4379     @@enDesc:
4380     Creates a new package scope block.
4381     @@Param:
4382     @@@Name: packageName
4383 wakaba 1.35 @@@Type: DOMString
4384 wakaba 1.13 @@@enDesc:
4385     The fully-qualified name of the package to create.
4386     @@Return:
4387 wakaba 1.25 @@@Type: PerlPackage
4388 wakaba 1.13 @@@enDesc:
4389     The newly created package scope object.
4390     @@@PerlDef:
4391 wakaba 1.35 __DEEP{
4392 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
4393 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'package');
4394     $r-><AS::PerlPackage.packageName> ($packageName);
4395     }__;
4396 wakaba 1.13
4397 wakaba 1.1 @IntMethod:
4398 wakaba 1.25 @@ForCheck: ManakaiDOM|ForClass
4399 wakaba 1.1 @@Name: perlComment
4400     @@ManakaiDOM:isStatic:1
4401     @@enDesc:
4402     Generates a Perl comment string.
4403     @@Param:
4404     @@@Name: str
4405 wakaba 1.35 @@@Type: DOMString
4406 wakaba 1.1 @@@enDesc:
4407     A comment text.
4408     @@Return:
4409 wakaba 1.35 @@@Type: DOMString
4410 wakaba 1.1 @@@enDesc:
4411     A Perl comment string.
4412     @@@PerlDef:
4413     $r = $str;
4414     $r =~ s/\n/\n## /g;
4415     $r =~ s/\n## $/\n/s;
4416     $r .= "\n" unless $r =~ /\n$/;
4417     $r = q<## > . $r;
4418    
4419     @IntMethod:
4420 wakaba 1.25 @@ForCheck: ManakaiDOM|ForClass
4421 wakaba 1.1 @@Name: rfc3339DateTime
4422     @@ManakaiDOM:isStatic:1
4423     @@enDesc:
4424     Returns RFC 3339 <CODE::date-time> representation of a date.
4425     @@Param:
4426     @@@Name: perlDate
4427 wakaba 1.35 @@@Type: idl|unsignedLong||ManakaiDOM|all
4428 wakaba 1.1 @@@enDesc:
4429     A Perl representation of date.
4430     @@Return:
4431 wakaba 1.35 @@@Type: DOMString
4432 wakaba 1.1 @@@enDesc:
4433     RFC 3339 date string.
4434     @@@PerlDef:
4435     my @time = gmtime $perlDate;
4436     $r = sprintf q<%04d-%02d-%02dT%02d:%02d:%02d+00:00>,
4437     $time[5] + 1900, $time[4] + 1, @time[3,2,1,0];
4438    
4439     @IntMethod:
4440 wakaba 1.25 @@ForCheck: ManakaiDOM|ForClass
4441 wakaba 1.1 @@Name: versionDateTime
4442     @@ManakaiDOM:isStatic:1
4443     @@enDesc:
4444     Returns date for version.
4445     @@Param:
4446     @@@Name: perlDate
4447 wakaba 1.35 @@@Type: idl|unsignedLong||ManakaiDOM|all
4448 wakaba 1.1 @@@enDesc:
4449     A Perl representation of date.
4450     @@Return:
4451 wakaba 1.35 @@@Type: DOMString
4452 wakaba 1.1 @@@enDesc:
4453     A Perl number literal.
4454     @@@PerlDef:
4455     my @time = gmtime $perlDate;
4456     $r = sprintf q<%04d%02d%02d.%02d%02d>,
4457     $time[5] + 1900, $time[4] + 1, @time[3,2,1];
4458    
4459     @Method:
4460     @@Name: perlLiteral
4461     @@enDesc:
4462     Perl code representation.
4463     @@Param:
4464     @@@Name: val
4465 wakaba 1.35 @@@Type: DISPerl|Any||ManakaiDOM|all
4466 wakaba 1.1 @@@enDesc:
4467     A Perl value.
4468     @@Return:
4469 wakaba 1.35 @@@Type: DOMString
4470 wakaba 1.1 @@@enDesc:
4471     A Perl lexical representation of <P::val>.
4472     @@@PerlDef:
4473     unless (defined $val) {
4474     $r = q<undef>;
4475     } elsif (ref $val eq 'ARRAY') {
4476     __DEEP{
4477 wakaba 1.36 $r = q<[> . <ClassM::ManakaiPCImplementation
4478 wakaba 1.14 .perlList> ($val) . q<]>;
4479 wakaba 1.1 }__;
4480     } elsif (ref $val eq 'HASH') {
4481     __DEEP{
4482 wakaba 1.31 $r = q<{>
4483 wakaba 1.36 . <ClassM::ManakaiPCImplementation.perlList>
4484 wakaba 1.31 ([map {$_ => $val->{$_}} sort {$a cmp $b} keys %$val])
4485     . q<}>;
4486 wakaba 1.1 }__;
4487 wakaba 1.38 } elsif (ref $val eq 'manakai::code') {
4488     $r = $$val;
4489 wakaba 1.1 } else {
4490     $val =~ s/(['\\])/\\$1/g;
4491     $r = q<'> . $val . q<'>;
4492     }
4493    
4494     @Method:
4495     @@Name: perlList
4496     @@enDesc:
4497     Perl code representation of a list.
4498     @@Param:
4499     @@@Name: val
4500 wakaba 1.35 @@@Type: DISPerl|ARRAY||ManakaiDOM|all
4501 wakaba 1.1 @@@enDesc:
4502     A Perl array reference.
4503     @@Return:
4504 wakaba 1.35 @@@Type: DOMString
4505 wakaba 1.1 @@@enDesc:
4506     A Perl lexical representation of <CODE::@$val>.
4507     @@@PerlDef:
4508     __DEEP{
4509 wakaba 1.36 $r = join (q<, >, map {<ClassM::ManakaiPCImplementation
4510 wakaba 1.1 .perlLiteral> ($_)} @{$val});
4511     }__;
4512 wakaba 1.5
4513     @Method:
4514     @@Name: createPerlSub
4515     @@enDesc:
4516 wakaba 1.35 Creates a new <IF::PerlSub> object.
4517 wakaba 1.5 @@Param:
4518     @@@Name: subName
4519 wakaba 1.35 @@@Type: DOMString
4520 wakaba 1.5 @@@enDesc:
4521     The name of the subroutine to create.
4522     @@@nullCase:
4523     @@@@enDesc:
4524     The subroutine created has no name.
4525     @@Return:
4526 wakaba 1.25 @@@Type: PerlSub
4527 wakaba 1.5 @@@enDesc:
4528     Newly created Perl subroutine object.
4529     @@@PerlDef:
4530 wakaba 1.35 __DEEP{
4531 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
4532 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'sub');
4533     $r-><M::PerlSub.addPerlName> ($subName) if defined $subName;
4534     }__;
4535 wakaba 1.5
4536     @Method:
4537     @@Name: createPerlUnparsedCode
4538     @@enDesc:
4539     Creates a new <Class::ManakaiPerlUnparsedCode> object.
4540     @@Param:
4541     @@@Name: codeArg
4542 wakaba 1.35 @@@Type: DOMString
4543 wakaba 1.5 @@@enDesc:
4544     The code fragment.
4545     @@@nullCase:
4546     @@@@enDesc:
4547     The fragment initially has no code.
4548     @@Return:
4549 wakaba 1.25 @@@Type: PerlUnparsedCode
4550 wakaba 1.5 @@@enDesc:
4551     Newly created Perl code object.
4552     @@@PerlDef:
4553 wakaba 1.35 __DEEP{
4554 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
4555 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'unparsed');
4556     $r-><AS::Node.textContent> ($codeArg) if defined $codeArg;
4557     }__;
4558 wakaba 1.6
4559     @Method:
4560     @@Name: createPerlInlineContainer
4561     @@enDesc:
4562 wakaba 1.35 Creates a new <IF::PerlInlineContainer> object.
4563 wakaba 1.6 @@Return:
4564 wakaba 1.25 @@@Type: PerlCodeInlines
4565 wakaba 1.6 @@@enDesc:
4566     Newly created Perl code object.
4567     @@@PerlDef:
4568 wakaba 1.35 __DEEP{
4569 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
4570 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'inlineContainer');
4571     }__;
4572 wakaba 1.6
4573     @Method:
4574     @@Name: createPerlInlineUnparsedCode
4575     @@enDesc:
4576 wakaba 1.35 Creates a new <IF::PerlInlineUnparsedCode> object.
4577 wakaba 1.6 @@Param:
4578     @@@Name: codeArg
4579 wakaba 1.35 @@@Type: DOMString
4580 wakaba 1.6 @@@enDesc:
4581     The code fragment.
4582     @@@nullCase:
4583     @@@@enDesc:
4584     The fragment initially has no code.
4585     @@Return:
4586 wakaba 1.25 @@@Type: PerlInlineUnparsedCode
4587 wakaba 1.6 @@@enDesc:
4588     Newly created Perl code object.
4589     @@@PerlDef:
4590 wakaba 1.35 __DEEP{
4591 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
4592 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'inlineUnparsed');
4593     $r-><AS::Node.textContent> ($codeArg) if defined $codeArg;
4594     }__;
4595 wakaba 1.6
4596     @Method:
4597     @@Name: createPerlBare
4598     @@enDesc:
4599 wakaba 1.35 Creates a new <IF::PerlTokens> object.
4600 wakaba 1.6 @@Param:
4601     @@@Name: codeArg
4602 wakaba 1.35 @@@Type: DOMString
4603 wakaba 1.6 @@@enDesc:
4604     The code fragment.
4605     @@Return:
4606 wakaba 1.25 @@@Type: PerlTokens
4607 wakaba 1.6 @@@enDesc:
4608     Newly created Perl code object.
4609     @@@PerlDef:
4610 wakaba 1.35 __DEEP{
4611 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
4612 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'tokens');
4613     $r-><AS::Node.textContent> ($codeArg) if defined $codeArg;
4614     }__;
4615 wakaba 1.6
4616     @Method:
4617     @@Name: createPerlAtom
4618     @@enDesc:
4619 wakaba 1.35 Creates a new <IF::PerlAtom> object.
4620 wakaba 1.6 @@Param:
4621     @@@Name: codeArg
4622 wakaba 1.35 @@@Type: DOMString
4623 wakaba 1.6 @@@enDesc:
4624     The code fragment.
4625     @@Return:
4626 wakaba 1.25 @@@Type: PerlAtom
4627 wakaba 1.6 @@@enDesc:
4628     Newly created Perl code object.
4629     @@@PerlDef:
4630 wakaba 1.35 __DEEP{
4631 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
4632 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'atom');
4633     $r-><AS::Node.textContent> ($codeArg) if defined $codeArg;
4634     }__;
4635 wakaba 1.6
4636     @Method:
4637     @@Name: createPerlStringLiteral
4638     @@enDesc:
4639 wakaba 1.35 Creates a new <IF::PerlStringLiteral> object.
4640 wakaba 1.6 @@Param:
4641     @@@Name: stringArg
4642 wakaba 1.35 @@@Type: DOMString
4643 wakaba 1.6 @@@enDesc: A string.
4644     @@Return:
4645 wakaba 1.25 @@@Type: PerlStringLiteral
4646 wakaba 1.6 @@@enDesc:
4647     Newly created Perl code object.
4648     @@@PerlDef:
4649 wakaba 1.35 __DEEP{
4650 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
4651 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'stringLiteral');
4652     $r-><AS::Node.textContent> ($stringArg);
4653     }__;
4654 wakaba 1.6
4655     @Method:
4656     @@Name: createPerlVariable
4657     @@enDesc:
4658 wakaba 1.35 Creates a new <IF::PerlVariable> object.
4659 wakaba 1.6 @@Param:
4660     @@@Name: variableType
4661 wakaba 1.35 @@@Type: DOMString
4662 wakaba 1.6 @@@enDesc:
4663     Variable prefix.
4664 wakaba 1.16 @@@nullCase:
4665     @@@@enDesc:
4666     If the <P::packageName> is <DOM::null>, then
4667     the <P::variableType> is detected by the prefix of
4668     <P::localName>. Otherwise, it is an unprefixed variable
4669     such as file handle.
4670 wakaba 1.6 @@Param:
4671     @@@Name: packageName
4672 wakaba 1.35 @@@Type: DOMString
4673 wakaba 1.6 @@@enDesc:
4674     Package name.
4675     @@@nullCase:
4676     @@@@enDesc:
4677     The variable belongs to the current package or a
4678     lexical-scoped variable.
4679     @@Param:
4680     @@@Name: localName
4681 wakaba 1.35 @@@Type: DOMString
4682 wakaba 1.6 @@@enDesc:
4683 wakaba 1.16 Variable name. If both <P::variableType> and <P::packageName>
4684     is <DOM::null>, the <P::localName> value may be prefixed
4685     by any possible <P::variableType> value.
4686 wakaba 1.6 @@Return:
4687 wakaba 1.25 @@@Type: PerlVariable
4688 wakaba 1.6 @@@enDesc:
4689     Newly created Perl variable object.
4690     @@@PerlDef:
4691 wakaba 1.35 __DEEP{
4692 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
4693 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'variable');
4694     if (not $variableType and not $packageName and
4695     $localName =~ s/^(\\?[\$\@%&*])//) {
4696     $variableType = $1;
4697     }
4698     $r-><AS::PerlVariable.variableType> ($variableType)
4699     if defined $variableType;
4700     $r-><AS::PerlVariable.packageName> ($packageName)
4701     if defined $packageName;
4702     $r-><AS::PerlVariable.pcLocalName> ($localName);
4703     }__;
4704 wakaba 1.8
4705     @Method:
4706     @@Name: createPerlBlock
4707     @@enDesc:
4708 wakaba 1.35 Creates a new <IF::PerlBlock> object.
4709 wakaba 1.8 @@Return:
4710 wakaba 1.25 @@@Type: PerlBlock
4711 wakaba 1.8 @@@enDesc:
4712     Newly created Perl code object.
4713     @@@PerlDef:
4714 wakaba 1.35 __DEEP{
4715 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
4716 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'block');
4717     }__;
4718 wakaba 1.9
4719     @Method:
4720     @@Name: createPerlBlockContainer
4721     @@enDesc:
4722     Creates a new <Class::ManakaiPerlBlockContainer> object.
4723     @@Return:
4724 wakaba 1.25 @@@Type: PerlCodeBlocks
4725 wakaba 1.9 @@@enDesc:
4726     Newly created Perl code object.
4727     @@@PerlDef:
4728 wakaba 1.35 __DEEP{
4729 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
4730 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'blockContainer');
4731     }__;
4732 wakaba 1.11
4733     @Method:
4734     @@Name: createPerlStatement
4735     @@enDesc:
4736     Creates a new Perl statement.
4737     @@Param:
4738     @@@Name: codeArg
4739 wakaba 1.35 @@@Type: DOMString
4740 wakaba 1.11 @@@enDesc:
4741     A Perl statement without terminating <Perl::;>.
4742     @@@nullCase:
4743     @@@@enDesc:
4744     No initial content.
4745     @@Return:
4746 wakaba 1.25 @@@Type: PerlStatement
4747 wakaba 1.11 @@@enDesc:
4748     The newly created Perl code object.
4749     @@@PerlDef:
4750 wakaba 1.35 __DEEP{
4751 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
4752 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'statement');
4753     if (defined $codeArg) {
4754     $r-><M::PerlCodeUnits.appendBare> ($codeArg);
4755     }
4756     }__;
4757 wakaba 1.12
4758     @Method:
4759     @@Name: createPerlIf
4760     @@enDesc:
4761 wakaba 1.35 Creates a <IF::PerlIf> object.
4762 wakaba 1.12 @@Param:
4763     @@@Name: conditionArg
4764 wakaba 1.35 @@@Type: PerlCodeInlines
4765 wakaba 1.12 @@@enDesc:
4766     Conditoon code fragment object.
4767     @@Param:
4768     @@@Name: trueArg
4769 wakaba 1.35 @@@Type: PerlCodeBlocks
4770 wakaba 1.12 @@@enDesc:
4771     A true code fragment object.
4772     @@@nullCase:
4773     @@@@enDesc: No true code.
4774     @@Param:
4775     @@@Name: falseArg
4776 wakaba 1.35 @@@Type: PerlCodeBlocks
4777 wakaba 1.12 @@@enDesc:
4778     A false code fragment object.
4779     @@@nullCase:
4780     @@@@enDesc: No false code.
4781     @@Return:
4782 wakaba 1.25 @@@Type: PerlIf
4783 wakaba 1.12 @@@RaiseException:
4784     @@@@@:BAD_CHILD_ERR
4785     @@@@enDesc:
4786     An attempt is made to append a child
4787     that is not valid type.
4788     @@@RaiseException:
4789     @@@@@:IN_USE_NODE_ERR
4790     @@@@enDesc:
4791     An attempt is made to append a node that is
4792     already used elsewhere.
4793     @@@PerlDef:
4794 wakaba 1.35 for my $arg ([conditionArg => $conditionArg]) {
4795     if ({
4796     atom => 1, tokens => 1, inlineContainer => 1, assignment => true,
4797     inlineUnparsed => 1, variable => 1, stringLiteral => true,
4798 wakaba 1.41 list => true, arrayRefLiteral => true, hashRefLiteral => true,
4799 wakaba 1.35 }->{$arg->[1]-><AG::Node.localName>}) {
4800     if ($arg->[1]-><AG::Node.parentNode>) {
4801     __EXCEPTION{IN_USE_NODE_ERR::
4802     pc:childNode => {$arg->[1]},
4803     MDOMX:param-name => {$arg->[0]},
4804     }__;
4805     }
4806     } else {
4807     __EXCEPTION{BAD_CHILD_ERR::
4808     pc:parentNode => {$self},
4809     pc:childNode => {$arg->[1]},
4810     MDOMX:param-name => {$arg->[0]},
4811     }__;
4812     }
4813     } # c
4814    
4815     for my $arg ([trueArg => $trueArg],
4816     [falseArg => $falseArg]) {
4817     next unless $arg->[1];
4818     if ({
4819     blockContainer => true,
4820     }->{$arg->[1]-><AG::Node.localName>}) {
4821     if ($arg->[1]-><AG::Node.parentNode>) {
4822     __EXCEPTION{IN_USE_NODE_ERR::
4823     pc:childNode => {$arg->[1]},
4824     MDOMX:param-name => {$arg->[0]},
4825     }__;
4826     }
4827     } else {
4828     __EXCEPTION{BAD_CHILD_ERR::
4829     pc:parentNode => {$self},
4830     pc:childNode => {$arg->[1]},
4831     MDOMX:param-name => {$arg->[0]},
4832     }__;
4833     }
4834     } # t/f
4835    
4836     __DEEP{
4837 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
4838 wakaba 1.35 -><M::Document.createElementNS>
4839     (<Q::pc:>, 'if');
4840     $r-><AS::PerlIf.condition> ($conditionArg) if $conditionArg;
4841     $r-><AS::PerlIf.trueCode> ($trueArg) if $trueArg;
4842     $r-><AS::PerlIf.falseCode> ($falseArg) if $falseArg;
4843     }__;
4844 wakaba 1.25 ##PCImplementation
4845 wakaba 1.1
4846 wakaba 1.5 ResourceDef:
4847 wakaba 1.35 @QName: DOMImpl
4848     @AliasFor: DOMCore|DOMImplementation
4849 wakaba 1.41 @For: ManakaiDOM|DOM
4850    
4851     ResourceDef:
4852     @QName: NodeList
4853     @AliasFor: DOMCore|NodeList
4854 wakaba 1.35 @For: ManakaiDOM|DOM
4855    
4856     ResourceDef:
4857     @QName: Node
4858     @AliasFor: DOMCore|Node
4859     @For: ManakaiDOM|DOM
4860    
4861     ResourceDef:
4862     @QName: Element
4863     @AliasFor: DOMCore|Element
4864     @For: ManakaiDOM|DOM
4865    
4866     ResourceDef:
4867     @QName: Document
4868     @AliasFor: DOMCore|Document
4869     @For: ManakaiDOM|DOM
4870    
4871 wakaba 1.4 ## -- Exceptions
4872    
4873 wakaba 1.25 ResourceDef:
4874     @rdf:type:
4875     @@@: dis|MultipleResource
4876     @@ForCheck: !ManakaiDOM|ForIF !ManakaiDOM|ForClass
4877     @resourceFor: ManakaiDOM|ForIF
4878     @resourceFor: ManakaiDOM|ForClass
4879    
4880     @For: ManakaiDOM|Perl
4881    
4882     @rdf:type:
4883 wakaba 1.33 @@@: dx|Interface
4884 wakaba 1.25 @@ForCheck: ManakaiDOM|ForIF
4885    
4886     @rdf:type:
4887 wakaba 1.33 @@@: dx|Class
4888 wakaba 1.25 @@ForCheck: ManakaiDOM|ForClass
4889    
4890     @Implement:
4891 wakaba 1.35 @@@: ||ManakaiDOM|ManakaiDOM|ManakaiDOM||ManakaiDOM|ForIF
4892     @@ContentType: DISCore|TFPQNames
4893     @@ForCheck: ManakaiDOM|ForClass
4894     @Implement:
4895     @@@: ||ManakaiDOM|ManakaiDOM|ManakaiDOMLatest||ManakaiDOM|ForIF
4896 wakaba 1.25 @@ContentType: DISCore|TFPQNames
4897     @@ForCheck: ManakaiDOM|ForClass
4898 wakaba 1.35 @dx:implementedBy: ||ManakaiDOM|ManakaiDOMLatest||ManakaiDOM|ForClass
4899 wakaba 1.25
4900 wakaba 1.35 @f:implements: pc|CoreFeature10
4901 wakaba 1.25
4902     @ISA:
4903 wakaba 1.33 @@@: dx|Exception||ManakaiDOM|Perl
4904 wakaba 1.25 @@ForCheck: ManakaiDOM|ForClass
4905    
4906     @IFQName: PCException
4907 wakaba 1.35 @QName:
4908     @@@: ManakaiPCException
4909     @@ForCheck: ManakaiDOM|ForClass
4910 wakaba 1.25
4911 wakaba 1.4 @enDesc:
4912 wakaba 1.25 Exceptions for the <Module::Util:PerlCode> module.
4913    
4914     @ResourceDef:
4915 wakaba 1.33 @@ForCheck: ManakaiDOM|ForIF
4916     @@rdf:type: DISLang|ConstGroup
4917 wakaba 1.25
4918     @@IFQName: PCExceptionCode
4919    
4920 wakaba 1.4 @@enDesc:
4921 wakaba 1.25 Exception codes for <IF::PCException>.
4922    
4923 wakaba 1.33 @@Type: idl|unsignedShort||ManakaiDOM|all
4924     @@rdfs:subClassOf: idl|unsignedShort||ManakaiDOM|all
4925 wakaba 1.25
4926 wakaba 1.5 @@XConstDef:
4927     @@@Name: HIERARCHY_REQUEST_ERR
4928 wakaba 1.27 @@@Value:
4929     @@@@@:3
4930     @@@@ContentType: DISCore|Integer
4931 wakaba 1.5 @@@enDesc:
4932     An attempt is made to break the hierarchy.
4933     @@@XSubTypeDef:
4934     @@@@QName: BAD_CHILD_ERR
4935     @@@@enDesc:
4936     An attempt is made to append a node as a child whose type
4937     is not allowed.
4938     @@@@XParam:
4939     @@@@@QName: childNode
4940     @@@@@enDesc:
4941     The node attempted to append.
4942     @@@@XParam:
4943     @@@@@QName: parentNode
4944     @@@@@enDesc:
4945     The node to whose child list an attempt to append is made.
4946     @@@XSubTypeDef:
4947     @@@@QName: IN_USE_NODE_ERR
4948     @@@@enDesc:
4949     An attempt is made to append a node that has already been used
4950     elsewhere.
4951     @@@@XParam:
4952     @@@@@QName: childNode
4953     @@@@@enDesc:
4954     The node attempted to append.
4955     @@@@XParam:
4956     @@@@@QName: parentNode
4957     @@@@@enDesc:
4958     The parent node of the <XP::childNode>.
4959 wakaba 1.4 @@XConstDef:
4960     @@@Name: NOT_SUPPORTED_ERR
4961 wakaba 1.27 @@@Value:
4962     @@@@@:9
4963     @@@@ContentType: DISCore|Integer
4964 wakaba 1.4 @@@enDesc:
4965     An attempt is made to do something the implementation does not support.
4966     @@@XSubTypeDef:
4967     @@@@QName: UNSUPPORTED_OPERATOR_ERR
4968     @@@@enDesc:
4969     The implementation does not support the specified operator.
4970     @@@@XParam:
4971     @@@@@QName: operator
4972     @@@@@enDesc:
4973     The operator that is not supported.
4974     @@@@enMufDef:
4975     Operator "%p (name => {<Q::pc:operator>});" is not supported
4976 wakaba 1.25 ##PCException
4977 wakaba 1.4
4978     ElementTypeBinding:
4979     @Name: XConstDef
4980     @ElementType:
4981     dis:ResourceDef
4982     @ShadowContent:
4983 wakaba 1.33 @@rdf:type: dx|ErrorCode
4984 wakaba 1.4
4985     ElementTypeBinding:
4986     @Name: XSubTypeDef
4987     @ElementType:
4988     dis:ResourceDef
4989     @ShadowContent:
4990 wakaba 1.33 @@rdf:type: dx|ErrorSubCode
4991 wakaba 1.4
4992     ElementTypeBinding:
4993     @Name: XParam
4994     @ElementType:
4995 wakaba 1.33 ecore:hasParameter
4996 wakaba 1.4
4997     ElementTypeBinding:
4998     @Name: XParamDef
4999     @ElementType:
5000     dis:ResourceDef
5001     @ShadowContent:
5002 wakaba 1.33 @@rdf:type: ecore|Parameter
5003 wakaba 1.27 @@For: =ManakaiDOM|all
5004 wakaba 1.4
5005     ElementTypeBinding:
5006     @Name: enMufDef
5007     @ElementType:
5008 wakaba 1.40 ecore:defaultMessage
5009 wakaba 1.4 @ShadowContent:
5010     @@ContentType:
5011     lang:muf
5012     @@lang:en
5013    
5014 wakaba 1.1 ElementTypeBinding:
5015     @Name: Method
5016     @ElementType:
5017     dis:ResourceDef
5018     @ShadowContent:
5019     @@rdf:type:
5020     DISLang:Method
5021    
5022     ElementTypeBinding:
5023     @Name: ToStringMethod
5024     @ElementType:
5025     dis:ResourceDef
5026     @ShadowContent:
5027     @@rdf:type:
5028     DISLang:Method
5029     @@Operator:
5030     @@@@:
5031     DISPerl:AsStringMethod
5032 wakaba 1.35 @@@ContentType: DISCore|QName
5033 wakaba 1.1 @@Description:
5034     @@@lang:en
5035     @@@@:
5036     Returns the textual Perl source code representation of this object.
5037 wakaba 1.9
5038 wakaba 1.14 ElementTypeBinding:
5039     @Name: NumValMethod
5040     @ElementType:
5041     dis:ResourceDef
5042     @ShadowContent:
5043     @@rdf:type:
5044     DISLang:Method
5045     @@Operator:
5046     @@@@: 0+
5047     @@@ContentType:
5048     lang:Perl
5049     @@Description:
5050     @@@lang:en
5051     @@@@:
5052     Returns the numeric value of this object.
5053 wakaba 1.9
5054     ElementTypeBinding:
5055 wakaba 1.1 @Name: IntMethod
5056     @ElementType:
5057     dis:ResourceDef
5058     @ShadowContent:
5059     @@rdf:type:
5060     DISLang:Method
5061     @@ManakaiDOM:isForInternal:1
5062    
5063     ElementTypeBinding:
5064     @Name: Attr
5065     @ElementType:
5066     dis:ResourceDef
5067     @ShadowContent:
5068     @@rdf:type:
5069     DISLang:Attribute
5070    
5071     ElementTypeBinding:
5072     @Name: Return
5073     @ElementType:
5074     dis:ResourceDef
5075     @ShadowContent:
5076     @@rdf:type:
5077     DISLang:MethodReturn
5078    
5079     ElementTypeBinding:
5080     @Name: Get
5081     @ElementType:
5082     dis:ResourceDef
5083     @ShadowContent:
5084     @@rdf:type:
5085     DISLang:AttributeGet
5086    
5087     ElementTypeBinding:
5088     @Name: Set
5089     @ElementType:
5090     dis:ResourceDef
5091     @ShadowContent:
5092     @@rdf:type:
5093     DISLang:AttributeSet
5094    
5095     ElementTypeBinding:
5096     @Name: Param
5097     @ElementType:
5098     dis:ResourceDef
5099     @ShadowContent:
5100     @@rdf:type:
5101     DISLang:MethodParameter
5102    
5103     ElementTypeBinding:
5104     @Name: PerlDef
5105     @ElementType:
5106     dis:Def
5107     @ShadowContent:
5108     @@ContentType:
5109     lang:Perl
5110 wakaba 1.27 @@ForCheck: ManakaiDOM|ForClass
5111 wakaba 1.28
5112     ElementTypeBinding:
5113     @Name: PerlCDef
5114     @ElementType:
5115     dis:Def
5116     @ShadowContent:
5117     @@ContentType:
5118     lang:Perl
5119 wakaba 1.1
5120     ElementTypeBinding:
5121     @Name: disDef
5122     @ElementType:
5123     dis:Def
5124     @ShadowContent:
5125     @@ContentType:
5126     lang:dis
5127 wakaba 1.27 @@ForCheck: ManakaiDOM|ForClass
5128 wakaba 1.1
5129     ElementTypeBinding:
5130     @Name: InCase
5131     @ElementType:
5132     dis:ResourceDef
5133     @ShadowContent:
5134     @@rdf:type:
5135     ManakaiDOM:InCase
5136    
5137     ElementTypeBinding:
5138     @Name: nullCase
5139     @ElementType:
5140     dis:ResourceDef
5141     @ShadowContent:
5142     @@rdf:type:
5143     ManakaiDOM:InCase
5144     @@Value:
5145     @@@is-null:1
5146    
5147     ElementTypeBinding:
5148     @Name: TrueCase
5149     @ElementType:
5150     dis:ResourceDef
5151     @ShadowContent:
5152     @@rdf:type:
5153     ManakaiDOM:InCase
5154 wakaba 1.27 @@Value:
5155     @@@@:1
5156     @@@ContentType: DISCore|Boolean
5157 wakaba 1.1 @@Type:
5158 wakaba 1.12 DOMMain:boolean::ManakaiDOM:all
5159 wakaba 1.1
5160    
5161     ElementTypeBinding:
5162     @Name: FalseCase
5163     @ElementType:
5164     dis:ResourceDef
5165     @ShadowContent:
5166     @@rdf:type:
5167     ManakaiDOM:InCase
5168 wakaba 1.27 @@Value:
5169     @@@@:0
5170     @@@ContentType: DISCore|Boolean
5171 wakaba 1.1 @@Type:
5172 wakaba 1.12 DOMMain:boolean::ManakaiDOM:all
5173 wakaba 1.1
5174     ElementTypeBinding:
5175     @Name: enDesc
5176     @ElementType:
5177     dis:Description
5178     @ShadowContent:
5179     @@lang:en
5180    
5181     ElementTypeBinding:
5182     @Name: PropDef
5183     @ElementType:
5184     dis:ResourceDef
5185     @ShadowContent:
5186     @@rdf:type:
5187     rdf:Property
5188 wakaba 1.27 @@For: =ManakaiDOM|all
5189 wakaba 1.1
5190     ElementTypeBinding:
5191     @Name: NamedParam
5192     @ElementType:
5193     dis:ResourceDef
5194     @ShadowContent:
5195     @@rdf:type:
5196     DISLang:MethodParameter
5197     @@DISPerl:isNamedParameter:1
5198    

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24