/[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.56 - (hide annotations) (download)
Sat Feb 25 16:49:56 2006 UTC (19 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.55: +6 -1 lines
++ manakai/bin/ChangeLog	25 Feb 2006 16:31:38 -0000
2006-02-26  Wakaba  <wakaba@suika.fam.cx>

	* dac2pm.pl (--dafx-file-suffix): New dummy option.

	* daf.pl: New script.

++ manakai/lib/Message/Util/ChangeLog	25 Feb 2006 16:40:55 -0000
2006-02-26  Wakaba  <wakaba@suika.fam.cx>

	* PerlCode.dis (Require): Missing reference to the |DISlib:DISMarkup|
	module is added.

2006-02-25  Wakaba  <wakaba@suika.fam.cx>

	* DIS.dis (lookupNamespacePrefix): Resolves prefix by
	namespace resolver if available.
	(disNamespaceResolver): New attribute.
	(loadModule): Sets |revision| attribute of the created module.
	(ownerModuleRef): Setter is added.
	(addTypeURI): Set |ownerModule| attribute if possible.
	(ManakaiDISModuleLite): The class no longer inherits |DISAnyResource|
	class and |ManakaiDefaultExceptionHandler| class.
	(mergeAsAlias): New |noEqualityCheck| parameter is added.

	* Makefile: New variables for |DAF| are added.

++ manakai/lib/Message/Util/DIS/ChangeLog	25 Feb 2006 16:45:17 -0000
2006-02-26  Wakaba  <wakaba@suika.fam.cx>

	* Perl.dis (plLoadDISDatabaseModule): Do nothing if the
	module is already loaded.
	(plUpdateModule): Parameter |moduleURI| is changed
	to |modules| so that multiple modules can be updated once.
	Don't try to read index file if it is not exist.

2006-02-25  Wakaba  <wakaba@suika.fam.cx>

	* DNLite.dis (convertDISDocumentToDNLDocument): New
	|baseNamespaceBinding| parameter is added.

	* Perl.dis (plLoadDISDatabase): Removes |c:error-handler|
	property (it is |null| if specified).
	(plStore): New |noMainDatabase| parameter is added.  Don't
	write resources that are not |isDefined|.  Copies |DIS:revision|
	property of modules to database index file.
	(plLoadDISDatabaseModule): Notify before and after
	a file is read.  Don't throw |DIS:RESOURCE_ALREADY_DEFINED_ERR|
	if the resource already in the database is not |isDefined|.
	(plLoadDISDatabaseIndex): Notify before and after
        a file is read.
	(plDatabaseModuleResolver): New attribute accessor.

++ manakai/lib/Message/DOM/ChangeLog	25 Feb 2006 16:33:00 -0000
2006-02-25  Wakaba  <wakaba@suika.fam.cx>

	* DOMFeature.dis (Require): Missing reference to |DISlib:Test|
	module is added.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24