/[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.57 - (hide annotations) (download)
Sun Feb 26 14:32:43 2006 UTC (19 years, 4 months ago) by wakaba
Branch: MAIN
Changes since 1.56: +5 -3 lines
++ manakai/t/ChangeLog	26 Feb 2006 14:32:29 -0000
	* Makefile (distclean): New rule.

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

++ manakai/bin/ChangeLog	26 Feb 2006 14:18:44 -0000
	* daf.pl: Request for |fe:GenericLS| feature was missing.
	Sets the |pc:preserve-line-break| parameter for test
	code as |dac2test.pl| had been.

	* dac.pl, dac2pm.pl, dac2test.pl: Removed.

	* disc.pl, cdis2pm.pl, cdis2rdf.pl: Removed.

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

++ manakai/lib/Message/ChangeLog	26 Feb 2006 14:19:17 -0000
2006-02-26  Wakaba  <wakaba@suika.fam.cx>

	* Makefile (distclean): New rule.

++ manakai/lib/Message/Body/ChangeLog	26 Feb 2006 14:19:35 -0000
2006-02-26  Wakaba  <wakaba@suika.fam.cx>

	* Makefile (distclean): New rule.

++ manakai/lib/Message/Field/ChangeLog	26 Feb 2006 14:24:08 -0000
2006-02-26  Wakaba  <wakaba@suika.fam.cx>

	* Makefile (distclean): New rule.

++ manakai/lib/Message/MIME/ChangeLog	26 Feb 2006 14:24:31 -0000
2006-02-26  Wakaba  <wakaba@suika.fam.cx>

	* Makefile (distclean): New rule.

++ manakai/lib/Message/Markup/ChangeLog	26 Feb 2006 14:24:49 -0000
	* Makefile (distclean): New rule.

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

++ manakai/lib/Message/Util/ChangeLog	26 Feb 2006 14:27:24 -0000
	* PerlCode.dis (PerlStringLiteral.stringify): If some character
	are escaped, the string should have been quoted by |QUOTATION MARK|.

	* Makefile (.discore-all.pm): The parameter for |DIS/DPG.dis|
	module was misplaced.
	(distclean): New rule.
	(clean): Cleans subdirectories, too.

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

++ manakai/lib/Message/Util/DIS/ChangeLog	26 Feb 2006 14:31:14 -0000
	* Perl.dis (plUpdate): Reads |dis:DefaultFor| property
	from the source if it is not available from the module
	in the database, i.e. the |readProperties| method
	is not performed for the module.
	(getPerlInterfaceMemberCode): Renamed
	from |getPerlErrorInterfaceMemberCode|.
	(DISLang:Const.getPerlInterfaceMemberCode): New
	method implementation.  Constants defined in interfaces
	were not reflected to the generated Perl module code
	since the split of |plGeneratePerlModule| method.

	* DPG.dis (Require): Reference to |DIS:Perl| module was missing.

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

++ manakai/lib/Message/DOM/ChangeLog	26 Feb 2006 14:21:51 -0000
	* SimpleLS.dis (Require): Reference to the |MDOM:Tree|
	module was missing.

	* ManakaiDOMLS2003.dis: Some property names was incorrect.

	* Makefile (distclean): New rule.

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

	* DOMLS.dis: Removed from the CVS repository, since
	it has been no longer required to make the |daf| system
	itself.

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

++ manakai/lib/manakai/ChangeLog	26 Feb 2006 14:32:09 -0000
	* Makefile (distclean): New rule.

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

++ manakai/lib/ChangeLog	26 Feb 2006 14:19:00 -0000
2006-02-26  Wakaba  <wakaba@suika.fam.cx>

	* Makefile (distclean): New rule.

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.57 $Date: 2006/02/25 16:49:56 $
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.57 my $escaped = ($r =~ s{([^\x0A\x0D\x20-\x7E])}
2233     {sprintf '\x{%X}', ord $1}ge);
2234     if ($escaped or
2235     $self-><AG::Node.ownerDocument>
2236 wakaba 1.54 -><AG::Document.domConfig>
2237     -><M::DOMCore:DOMConfiguration.getParameter>
2238     (<Q::pc:preserve-line-break>)) {
2239     $r =~ s/\x0D/\\x0D/gs;
2240     $r =~ s/\x0A/\\x0A/gs;
2241     $r =~ s/\@/\\\@/g;
2242     $r =~ s/\$/\\\$/g;
2243     $r =~ s/"/\\"/g;
2244     $r = q<"> . $r . q<">;
2245     } else {
2246     $r = q<'> . $r . q<'>;
2247     }
2248 wakaba 1.35 }__;
2249 wakaba 1.6 ##PerlStringLiteral
2250    
2251 wakaba 1.35 IFClsETDef:
2252 wakaba 1.41 @IFQName: PCList
2253     @CQName: ManakaiPCList
2254     @ETQName: pc|list
2255    
2256     @IFISA: PerlCode
2257 wakaba 1.42 @CISA: ManakaiPCCode
2258 wakaba 1.41
2259     @enDesc:
2260     A <IF::PCList> is a Perl list, i.e. <CHAR::COMMA> separated
2261     list of values.
2262    
2263     @Method:
2264     @@Name: item
2265     @@enDesc:
2266     Returns the <P::index>th item in the list.
2267     @@Param:
2268     @@@Name: index
2269     @@@Type: unsignedLong
2270     @@@enDesc:
2271     The ordinal index of the item.
2272     @@Return:
2273     @@@Type: PerlCodeInlines
2274     @@@enDesc:
2275     The <P::index>th item in the list.
2276     @@@nullCase:
2277     @@@@enDesc:
2278     Either <P::index> is negative or the <P::index> is
2279     greater than the number of the items in the list.
2280     @@@PerlDef:
2281     __DEEP{
2282     $r = $self-><AG::Node.childNodes>-><M::NodeList.item> ($index);
2283     }__;
2284    
2285     @Attr:
2286     @@Name: length
2287     @@enDesc:
2288     The number of items in the list.
2289     @@Type: unsignedLong
2290     @@Get:
2291     @@@PerlDef:
2292     __DEEP{
2293     $r = $self-><AG::Node.childNodes>-><AG::NodeList.length>;
2294     }__;
2295    
2296     @ToStringMethod:
2297     @@Return:
2298     @@@Type: DOMString
2299     @@@enDesc:
2300     Perl code.
2301     @@@PerlDef:
2302     __DEEP{
2303     my @r = map {$_->stringify} @{$self-><AG::Node.childNodes>};
2304     $r = '(' . join (', ', @r) . ')';
2305     }__;
2306     ##PCList
2307    
2308     IFClsETDef:
2309     @IFQName: PCArrayRefLiteral
2310     @CQName: ManakaiPCArrayRefLiteral
2311 wakaba 1.44 @ETQName: pc|arrayRefLiteral
2312 wakaba 1.41
2313     @IFISA: PerlCode
2314 wakaba 1.42 @CISA: ManakaiPCCode
2315 wakaba 1.41
2316     @enDesc:
2317     A <IF::PCArrayRefLiteral> is a Perl array reference literal.
2318    
2319     @Method:
2320     @@Name: item
2321     @@enDesc:
2322     Returns the <P::index>th item in the list.
2323     @@Param:
2324     @@@Name: index
2325     @@@Type: unsignedLong
2326     @@@enDesc:
2327     The ordinal index of the item.
2328     @@Return:
2329     @@@Type: PerlCodeInlines
2330     @@@enDesc:
2331     The <P::index>th item in the list.
2332     @@@nullCase:
2333     @@@@enDesc:
2334     Either <P::index> is negative or the <P::index> is
2335     greater than the number of the items in the list.
2336     @@@PerlDef:
2337     __DEEP{
2338     $r = $self-><AG::Node.childNodes>-><M::NodeList.item> ($index);
2339     }__;
2340    
2341     @Attr:
2342     @@Name: length
2343     @@enDesc:
2344     The number of items in the list.
2345     @@Type: unsignedLong
2346     @@Get:
2347     @@@PerlDef:
2348     __DEEP{
2349     $r = $self-><AG::Node.childNodes>-><AG::NodeList.length>;
2350     }__;
2351    
2352     @ToStringMethod:
2353     @@Return:
2354     @@@Type: DOMString
2355     @@@enDesc:
2356     Perl code.
2357     @@@PerlDef:
2358     __DEEP{
2359     my @r = map {$_->stringify} @{$self-><AG::Node.childNodes>};
2360     $r = '[' . join (', ', @r) . ']';
2361     }__;
2362     ##PCArrayRefLiteral
2363    
2364     IFClsETDef:
2365     @IFQName: PCHashRefLiteral
2366     @CQName: ManakaiPCHashRefLiteral
2367 wakaba 1.44 @ETQName: pc|hashRefLiteral
2368 wakaba 1.41
2369     @IFISA: PerlCode
2370 wakaba 1.42 @CISA: ManakaiPCCode
2371 wakaba 1.41
2372     @enDesc:
2373     A <IF::PCHashRefLiteral> is a Perl hash reference literal.
2374    
2375     @Method:
2376     @@Name: key
2377     @@enDesc:
2378     Returns the <P::index>th key in the list.
2379    
2380     {NOTE:: Although the order of key-value pairs is
2381     preserved in the object, it is not preserved
2382     in Perl source codes and in Perl language.
2383     }
2384     @@Param:
2385     @@@Name: index
2386     @@@Type: unsignedLong
2387     @@@enDesc:
2388     The ordinal index of the key.
2389     @@Return:
2390     @@@Type: PerlCodeInlines
2391     @@@enDesc:
2392     The <P::index>th key in the list.
2393     @@@nullCase:
2394     @@@@enDesc:
2395     Either <P::index> is negative or the <P::index> is
2396     greater than the number of the keys in the list.
2397     @@@PerlDef:
2398     __DEEP{
2399     $r = $self-><AG::Node.childNodes>-><M::NodeList.item> ($index * 2);
2400     }__;
2401    
2402     @Method:
2403     @@Name: value
2404     @@enDesc:
2405     Returns the <P::index>th value in the list.
2406    
2407     {NOTE:: Although the order of key-value pairs is
2408     preserved in the object, it is not preserved
2409     in Perl source codes and in Perl language.
2410     }
2411     @@Param:
2412     @@@Name: index
2413     @@@Type: unsignedLong
2414     @@@enDesc:
2415     The ordinal index of the value.
2416     @@Return:
2417     @@@Type: PerlCodeInlines
2418     @@@enDesc:
2419     The <P::index>th value in the list.
2420     @@@nullCase:
2421     @@@@enDesc:
2422     Either <P::index> is negative or the <P::index> is
2423     greater than the number of the values in the list.
2424    
2425     {NOTE:: <MATH::<A::PCHashRefLiteral.length> - 1>th
2426     value might not be found.
2427     }
2428     @@@PerlDef:
2429     __DEEP{
2430     $r = $self-><AG::Node.childNodes>-><M::NodeList.item> ($index * 2 + 1);
2431     }__;
2432    
2433     @Attr:
2434     @@Name: length
2435     @@enDesc:
2436     The number of key-value pairs in the list.
2437     @@Type: unsignedLong
2438     @@Get:
2439     @@@PerlDef:
2440     __DEEP{
2441     my $length = $self-><AG::Node.childNodes>-><AG::NodeList.length>;
2442     $r = int ($length / 2) + ($length % 2);
2443     }__;
2444    
2445     @Method:
2446     @@Name: setNamedItem
2447     @@enDesc:
2448     Set a named item.
2449     @@Param:
2450     @@@Name: key
2451     @@@Type: DOMString
2452     @@@enDesc:
2453     The key.
2454     @@Param:
2455     @@@Name: value
2456     @@@Type: PerlCodeInlines
2457     @@@enDesc:
2458     The value.
2459     @@Return:
2460     @@@PerlDef:
2461     __DEEP{
2462     my @children = @{$self-><AG::Node.childNodes>};
2463     R: {
2464     while (@children) {
2465     my $ckey = shift @children;
2466     my $cval = shift @children;
2467     if ($ckey-><AG::Node.textContent> eq $key) {
2468     $self-><M::Node.replaceChild> ($value, $cval);
2469     last R;
2470     }
2471     }
2472    
2473     $self-><M::Node.appendChild>
2474     ($self-><AG::Node.ownerDocument>
2475     -><M::Document.createElementNS>
2476     (<Q::pc:>, 'stringLiteral'))
2477     -><AS::Node.textContent> ($key);
2478     $self-><M::Node.appendChild> ($value);
2479     } # R
2480     }__;
2481    
2482     @ToStringMethod:
2483     @@Return:
2484     @@@Type: DOMString
2485     @@@enDesc:
2486     Perl code.
2487     @@@PerlDef:
2488     __DEEP{
2489     my %r = map {$_->stringify} @{$self-><AG::Node.childNodes>};
2490     ## Different values with same key are not preserved.
2491     $r = '{' . join (', ', map {$_ => $r{$_}}
2492     sort {$a cmp $b} keys %r) . '}';
2493     }__;
2494     ##PCHashRefLiteral
2495    
2496     ResourceDef:
2497     @QName: unsignedLong
2498     @AliasFor: idl|unsignedLong||ManakaiDOM|all
2499     @For: ManakaiDOM|DOM
2500    
2501     IFClsETDef:
2502 wakaba 1.25 @IFQName: PerlTokens
2503 wakaba 1.35 @CQName: ManakaiPCTokens
2504     @ETQName: pc|tokens
2505 wakaba 1.12
2506 wakaba 1.25 @IFISA: PerlCode
2507 wakaba 1.35 @CISA: ManakaiPCCode
2508 wakaba 1.25
2509 wakaba 1.6 @enDesc:
2510 wakaba 1.36 Unparsed Perl inline code fragments.
2511 wakaba 1.6
2512     @ToStringMethod:
2513     @@Return:
2514 wakaba 1.43 @@@Type: DOMString
2515 wakaba 1.6 @@@PerlDef:
2516 wakaba 1.35 __DEEP{
2517     $r = $self-><AG::Node.textContent>;
2518     }__;
2519     ##PCTokens
2520 wakaba 1.6
2521 wakaba 1.35 IFClsETDef:
2522 wakaba 1.25 @IFQName: PerlAtom
2523 wakaba 1.35 @CQName: ManakaiPCAtom
2524     @ETQName: pc|atom
2525 wakaba 1.25
2526     @IFISA: PerlCode
2527 wakaba 1.35 @CISA: ManakaiPCTokens
2528 wakaba 1.25
2529 wakaba 1.6 @enDesc:
2530     Unparsed Perl atomic code fragments (such as numeric literal).
2531    
2532 wakaba 1.14 @NumValMethod:
2533     @@Return:
2534 wakaba 1.35 @@@Type: idl|unsignedLong||ManakaiDOM|all
2535 wakaba 1.14 @@@enDesc:
2536     Numeric value of the Perl code.
2537     @@@PerlDef:
2538 wakaba 1.35 __DEEP{
2539     $r = 0 + $self-><AG::Node.textContent>;
2540     }__;
2541 wakaba 1.9
2542 wakaba 1.6 @ToStringMethod:
2543     @@Return:
2544 wakaba 1.35 @@@Type: DOMString
2545 wakaba 1.6 @@@enDesc:
2546     Perl code.
2547     @@@PerlDef:
2548 wakaba 1.35 __DEEP{
2549     $r = $self-><AG::Node.textContent>;
2550     }__;
2551 wakaba 1.6 ##PerlAtom
2552    
2553 wakaba 1.35 IFClsETDef:
2554 wakaba 1.25 @IFQName: PerlVariable
2555 wakaba 1.35 @CQName: ManakaiPCVariable
2556     @ETQName: pc|variable
2557 wakaba 1.25
2558     @IFISA: PerlCode
2559 wakaba 1.35 @CISA: ManakaiPCCode
2560 wakaba 1.25
2561 wakaba 1.6 @enDesc:
2562     Unparsed Perl variable.
2563     \
2564     {NOTE:: Future version of the implementation may
2565     support to specify array index or hash key.
2566     \
2567 wakaba 1.36 }
2568 wakaba 1.6
2569 wakaba 1.35 @ATTR:
2570 wakaba 1.6 @@Name: variableType
2571 wakaba 1.35 @@ATTRQName: pc|variableType
2572 wakaba 1.6 @@enDesc:
2573     Perl variable type (<CODE::$>, <CODE::@>, <CODE::%>,
2574     <CODE::&> or empty string).
2575 wakaba 1.35 @@ReflectCDATA:
2576 wakaba 1.6 @@Get:
2577     @@Set:
2578    
2579 wakaba 1.35 @ATTR:
2580 wakaba 1.6 @@Name: packageName
2581 wakaba 1.35 @@ATTRQName: pc|packageName
2582 wakaba 1.6 @@enDesc:
2583     The name of the package to which this variable belongs.
2584 wakaba 1.35 @@ReflectCDATA:
2585 wakaba 1.6 @@Get:
2586     @@@nullCase:
2587     @@@@enDesc:
2588     This package belongs to the current package or
2589     does not belong to any package.
2590     @@Set:
2591     @@@nullCase:
2592     @@@@enDesc:
2593     This package belongs to the current package or
2594     does not belong to any package.
2595    
2596 wakaba 1.35 @ATTR:
2597 wakaba 1.36 @@Name: pcLocalName
2598 wakaba 1.35 @@ATTRQName: pc|localName
2599 wakaba 1.6 @@enDesc:
2600     The local variable name.
2601 wakaba 1.35 @@ReflectCDATA:
2602 wakaba 1.6 @@Get:
2603     @@Set:
2604    
2605 wakaba 1.35 @ATTR:
2606 wakaba 1.6 @@Name: variableScope
2607 wakaba 1.35 @@ATTRQName: pc|variableScope
2608 wakaba 1.6 @@enDesc:
2609     Scope modifier (<CODE::my> or <CODE::our> or <CODE::local>).
2610 wakaba 1.35 @@ReflectCDATA:
2611 wakaba 1.6 @@Get:
2612     @@@nullCase:
2613     @@@@enDesc:
2614     This variable does not have scope modifier.
2615     @@Set:
2616     @@@nullCase:
2617     @@@@enDesc:
2618     This variable does not have scope modifier.
2619    
2620     @ToStringMethod:
2621     @@Return:
2622 wakaba 1.35 @@@Type: DOMString
2623 wakaba 1.6 @@@enDesc:
2624     Perl code.
2625     @@@PerlDef:
2626 wakaba 1.35 __DEEP{
2627     my $t = $self-><AG::PerlVariable.variableScope>;
2628     $r .= $t . ' ' if length $t;
2629 wakaba 1.55 $r .= $t = $self-><AG::PerlVariable.variableType>;
2630 wakaba 1.35 my $v = $self-><AG::PerlVariable.packageName>;
2631     $r .= $v . '::' if length $v;
2632     $r .= $self-><AG::PerlVariable.pcLocalName>;
2633     $v = $self-><AG::PerlVariable.hashKey>;
2634     if ($t eq '$' and length $v) {
2635     $v =~ s/(['\\])/\\$1/g;
2636     $r .= q<{'> . $v . q<'}>;
2637     }
2638     }__;
2639 wakaba 1.6
2640 wakaba 1.35 @ATTR:
2641 wakaba 1.6 @@Name: hashKey
2642 wakaba 1.35 @@ATTRQName: pc|hashKey
2643 wakaba 1.6 @@enDesc:
2644     The key for hash.
2645     \
2646     {NOTE:: Using Perl code for key is not supported in the current
2647     version of the implementation.
2648     \
2649     }
2650 wakaba 1.35 @@ReflectCDATA:
2651 wakaba 1.6 @@Get:
2652     @@@nullCase:
2653     @@@@enDesc:
2654     This variable is not for hash value access.
2655     @@Set:
2656     @@@nullCase:
2657     @@@@enDesc:
2658     This variable is not for hash value access.
2659 wakaba 1.15 ##PerlVariable
2660 wakaba 1.6
2661 wakaba 1.25 IFClsDef:
2662     @IFQName: PerlCodeUnits
2663 wakaba 1.35 @CQName: ManakaiPCCodeUnits
2664 wakaba 1.25
2665 wakaba 1.35 @CISA: ManakaiPCCode
2666 wakaba 1.25
2667 wakaba 1.6 @enDesc:
2668     A base class implemented by both inline container and
2669     block-level container.
2670    
2671     @Attr:
2672     @@Name: length
2673     @@enDesc:
2674     The number of child code fragments.
2675 wakaba 1.35 @@Type: idl|unsignedLong||ManakaiDOM|all
2676 wakaba 1.6 @@Get:
2677     @@@PerlDef:
2678 wakaba 1.35 __DEEP{
2679     $r = @{$self-><AG::Node.childNodes>};
2680     }__;
2681 wakaba 1.6
2682     @Method:
2683     @@Name: appendStringLiteral
2684     @@enDesc:
2685     Appends a Perl string literal (<CODE::q>).
2686     @@Param:
2687     @@@Name: stringArg
2688 wakaba 1.35 @@@Type: DOMString
2689 wakaba 1.6 @@@enDesc:
2690     A string.
2691     @@Return:
2692 wakaba 1.35 @@@Type: PerlStringLiteral
2693 wakaba 1.6 @@@enDesc:
2694     The newly created Perl string literal object.
2695     @@@PerlDef:
2696 wakaba 1.35 __DEEP{
2697     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
2698     (<Q::pc:>, 'stringLiteral');
2699     $r-><AS::Node.textContent> ($stringArg);
2700     $self-><M::Node.appendChild> ($r);
2701     }__;
2702 wakaba 1.6
2703     @Method:
2704 wakaba 1.41 @@Name: appendNewPCLiteral
2705     @@enDesc:
2706     Creates a <IF::PCLiteral> object and appends it to the node.
2707     @@Param:
2708     @@@Name: value
2709     @@@Type: DISPerl|Any
2710     @@@enDesc: The value.
2711     @@Return:
2712     @@@Type: PerlCode
2713     @@@enDesc:
2714     The newly created object.
2715     @@@PerlDef:
2716     __DEEP{
2717     $r = $self-><AG::Node.ownerDocument>
2718     -><M::PCDocument.createPCLiteral> ($value);
2719     $self-><M::Node.appendChild> ($r);
2720     }__;
2721    
2722     @Method:
2723 wakaba 1.44 @@Name: appendNewPCNumberLiteral
2724     @@enDesc:
2725     Creates a <IF::PCNumberLiteral> object and appends it to the node.
2726     @@Param:
2727     @@@Name: value
2728     @@@Type: DISPerl|NumberValue
2729     @@@enDesc:
2730     The value.
2731     @@Return:
2732     @@@Type: PCNumberLiteral
2733     @@@enDesc:
2734     The newly created node.
2735     @@@PerlDef:
2736     __DEEP{
2737     $r = $self-><AG::Node.ownerDocument>
2738     -><M::PCDocument.createPCNumberLiteral> ($value);
2739     $self-><M::Node.appendChild> ($r);
2740     }__;
2741    
2742     @Method:
2743 wakaba 1.6 @@Name: appendAtom
2744     @@enDesc:
2745     Appends a Perl atomic code fragment.
2746     @@Param:
2747     @@@Name: codeArg
2748 wakaba 1.35 @@@Type: DOMString
2749 wakaba 1.6 @@@enDesc:
2750     An atom.
2751     @@Return:
2752 wakaba 1.35 @@@Type: PerlAtom
2753 wakaba 1.6 @@@enDesc:
2754     The newly created Perl code object.
2755     @@@PerlDef:
2756 wakaba 1.35 __DEEP{
2757     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
2758     (<Q::pc:>, 'atom');
2759     $r-><AS::Node.textContent> ($codeArg);
2760     $self-><M::Node.appendChild> ($r);
2761     }__;
2762 wakaba 1.6
2763     @Method:
2764     @@Name: appendBare
2765     @@enDesc:
2766     Appends a Perl bare code fragment.
2767     @@Param:
2768     @@@Name: codeArg
2769 wakaba 1.35 @@@Type: DOMString
2770 wakaba 1.6 @@@enDesc:
2771 wakaba 1.7 An bare code.
2772 wakaba 1.6 @@Return:
2773 wakaba 1.35 @@@Type: PerlBare
2774 wakaba 1.6 @@@enDesc:
2775     The newly created Perl code object.
2776     @@@PerlDef:
2777 wakaba 1.35 __DEEP{
2778     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
2779     (<Q::pc:>, 'tokens');
2780     $r-><AS::Node.textContent> ($codeArg);
2781     $self-><M::Node.appendChild> ($r);
2782     }__;
2783 wakaba 1.11
2784     @Method:
2785 wakaba 1.44 @@Name: appendNewPCVariable
2786     @@enDesc:
2787     Creates a variable object and appends it to the children list of
2788     the node.
2789     @@Param:
2790     @@@Name: variableTypeArg
2791     @@@Type: DOMString
2792     @@@enDesc:
2793     The variable type prefix such as <Perl::$>, if any, or an empty string.
2794     @@Param:
2795     @@@Name: packageNameArg
2796     @@@Type: DOMString
2797     @@@enDesc:
2798     The name of the package to which the variable belongs.
2799     @@@nullCase:
2800     @@@@enDesc:
2801     The variable does not belong to any package or belongs
2802     to the current package.
2803     @@Param:
2804     @@@Name: localNameArg
2805     @@@Type: DOMString
2806     @@@enDesc:
2807     The local part of the variable name.
2808     @@Return:
2809     @@@Type: PerlVariable
2810     @@@enDesc:
2811     The newly created variable object.
2812     @@@PerlDef:
2813     __DEEP{
2814     $r = $self-><AG::Node.ownerDocument>
2815     -><M::PCDocument.createPCVariable>
2816     ($variableTypeArg, $packageNameArg, $localNameArg);
2817     $self-><M::Node.appendChild> ($r);
2818     }__;
2819    
2820     @Method:
2821     @@Name: appendNewPCDereference
2822     @@enDesc:
2823     Creates a <IF::PCDereference> object and appends it to the child
2824     node list of the node.
2825     @@Param:
2826     @@@Name: variableTypeArg
2827     @@@Type: DOMString
2828     @@@enDesc:
2829     The type of the referenced value, such as <Perl::$>.
2830     @@Return:
2831     @@@Type: PCDereference
2832     @@@enDesc:
2833     The newly created element node.
2834     @@@PerlDef:
2835     __DEEP{
2836     $r = $self-><AG::Node.ownerDocument>
2837 wakaba 1.48 -><M::PCDocument.createPCDereference>
2838     ($variableTypeArg);
2839     $self-><M::Node.appendChild> ($r);
2840     }__;
2841    
2842     @Method:
2843     @@Name: appendNewPCReference
2844     @@enDesc:
2845     Creates a <IF::PCReference> object and appends it to the child
2846     node list of the node.
2847     @@Return:
2848     @@@Type: PCReference
2849     @@@enDesc:
2850     The newly created element node.
2851     @@@PerlDef:
2852     __DEEP{
2853     $r = $self-><AG::Node.ownerDocument>
2854     -><M::PCDocument.createPCReference>;
2855 wakaba 1.44 $self-><M::Node.appendChild> ($r);
2856     }__;
2857    
2858     @Method:
2859 wakaba 1.43 @@Name: appendNewPCExpression
2860     @@enDesc:
2861     Appends a newly created <IF::PCExpression> node.
2862     @@Param:
2863     @@@Name: operatorArg
2864     @@@Type: DOMString
2865     @@@enDesc:
2866     The operator of the expression.
2867     @@Return:
2868     @@@Type: PCExpression
2869     @@@enDesc:
2870     The newly created expression object.
2871     @@@PerlDef:
2872     __DEEP{
2873     $r = $self-><AG::Node.ownerDocument>
2874     -><M::PCDocument.createPCExpression> ($operatorArg);
2875     $self-><M::Node.appendChild> ($r);
2876     }__;
2877    
2878     @Method:
2879 wakaba 1.11 @@Name: appendNewAssignment
2880     @@enDesc:
2881     Appends a newly created <Class::ManakaiPerlAssign> object.
2882     @@Param:
2883     @@@Name: leftArg
2884 wakaba 1.35 @@@Type: PerlCode
2885 wakaba 1.11 @@@enDesc:
2886     A left hand side code fragment object.
2887     @@Param:
2888     @@@Name: rightArg
2889 wakaba 1.35 @@@Type: PerlCode
2890 wakaba 1.11 @@@enDesc:
2891     A right hand side code fragment object.
2892     @@Return:
2893 wakaba 1.36 @@@Type: PerlAssignment
2894 wakaba 1.11 @@@RaiseException:
2895     @@@@@:BAD_CHILD_ERR
2896     @@@@enDesc:
2897     An attempt is made to append a child
2898     that is not valid type.
2899     @@@RaiseException:
2900     @@@@@:IN_USE_NODE_ERR
2901     @@@@enDesc:
2902     An attempt is made to append a node that is
2903     already used elsewhere.
2904     @@@PerlDef:
2905 wakaba 1.35 for my $arg ([leftArg => $leftArg], [rightArg => $rightArg]) {
2906     if ({
2907     atom => 1, tokens => 1, inlineContainer => 1, assignment => true,
2908     inlineUnparsed => 1, variable => 1, stringLiteral => true,
2909 wakaba 1.41 list => true, arrayRefLiteral => true, hashRefLiteral => true,
2910 wakaba 1.35 }->{$arg->[1]-><AG::Node.localName>}) {
2911     if ($arg->[1]-><AG::Node.parentNode>) {
2912     __EXCEPTION{IN_USE_NODE_ERR::
2913     pc:childNode => {$arg->[1]},
2914     MDOMX:param-name => {$arg->[0]},
2915     }__;
2916     }
2917     } else {
2918     __EXCEPTION{BAD_CHILD_ERR::
2919     pc:parentNode => {$self},
2920     pc:childNode => {$arg->[1]},
2921     MDOMX:param-name => {$arg->[0]},
2922     }__;
2923     }
2924     } # left/right
2925    
2926     __DEEP{
2927     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
2928     (<Q::pc:>, 'assignment');
2929     $r-><AS::PerlAssignment.leftCode> ($leftArg);
2930     $r-><AS::PerlAssignment.rightCode> ($rightArg);
2931     $self-><M::Node.appendChild> ($r);
2932     }__;
2933 wakaba 1.43
2934     @Method:
2935 wakaba 1.44 @@Name: appendNewPCApply
2936     @@enDesc:
2937     Creates a <IF::PCApply> object and appends it to the children list
2938     of the node.
2939     @@Return:
2940     @@@Type: PCApply
2941     @@@enDesc: The newly created node.
2942     @@@PerlDef:
2943     __DEEP{
2944     $r = $self-><AG::Node.ownerDocument>-><M::PCDocument.createPCApply>;
2945     $self-><M::Node.appendChild> ($r);
2946     }__;
2947    
2948     @Method:
2949 wakaba 1.43 @@Name: appendNewPCFunctionCall
2950     @@enDesc:
2951     Appends a newly created <IF::PCFunctionCall> node.
2952     @@Param:
2953     @@@Name: packageArg
2954     @@@Type: DOMString
2955     @@@enDesc:
2956     The package name of the function.
2957     @@@nullCase:
2958     @@@@enDesc: No package name.
2959     @@Param:
2960     @@@Name: localNameArg
2961     @@@Type: DOMString
2962     @@@enDesc:
2963     The local part of the function name.
2964     @@Return:
2965     @@@Type: PCFunctionCall
2966     @@@enDesc:
2967     The newly created functin call object.
2968     @@@PerlDef:
2969     __DEEP{
2970     $r = $self-><AG::Node.ownerDocument>
2971     -><M::PCDocument.createPCFunctionCall>
2972     ($packageArg, $localNameArg);
2973     $self-><M::Node.appendChild> ($r);
2974     }__;
2975     ##PCCodeUnits
2976 wakaba 1.6
2977 wakaba 1.35 IFClsETDef:
2978 wakaba 1.25 @IFQName: PerlStatement
2979 wakaba 1.35 @CQName: ManakaiPCStatement
2980     @ETQName: pc|statement
2981 wakaba 1.25
2982     @IFISA: PerlCode
2983     @IFISA: PerlCodeInlines
2984 wakaba 1.35 @CISA: ManakaiPCCodeInlines
2985 wakaba 1.25
2986 wakaba 1.8 @enDesc:
2987 wakaba 1.36 Perl statements.
2988 wakaba 1.8
2989     @ToStringMethod:
2990     @@Return:
2991 wakaba 1.35 @@@Type: DOMString
2992 wakaba 1.8 @@@enDesc:
2993     Perl code.
2994     @@@PerlDef:
2995     $r = $self->SUPER::stringify;
2996 wakaba 1.16 $r .= ";\n" if length $r;
2997 wakaba 1.8 ##PerlStatement
2998 wakaba 1.6
2999 wakaba 1.35 IFClsETDef:
3000 wakaba 1.25 @IFQName: PerlCodeInlines
3001 wakaba 1.35 @CQName: ManakaiPCCodeInlines
3002     @ETQName: pc|inlineContainer
3003 wakaba 1.25
3004 wakaba 1.35 @CISA: ManakaiPCCodeUnits
3005 wakaba 1.25
3006 wakaba 1.6 @enDesc:
3007 wakaba 1.41 Perl inline code block.
3008 wakaba 1.6
3009     @Method:
3010     @@Name: appendCodeFragment
3011     @@enDesc:
3012 wakaba 1.35 Appends a <IF::PerlCode> object.
3013 wakaba 1.6 @@Param:
3014     @@@Name: codeArg
3015 wakaba 1.25 @@@Type: PerlCode
3016 wakaba 1.6 @@@enDesc:
3017     A code fragment object.
3018     @@Return:
3019     @@@RaiseException:
3020     @@@@@:BAD_CHILD_ERR
3021     @@@@enDesc:
3022     An attempt is made to append a child
3023     that is not a <Class::ManakaiPerlUnparsedCode>.
3024     @@@RaiseException:
3025     @@@@@:IN_USE_NODE_ERR
3026     @@@@enDesc:
3027     An attempt is made to append a node that is
3028     already used elsewhere.
3029     @@@PerlDef:
3030 wakaba 1.35 if ({
3031     atom => 1, tokens => 1, inlineContainer => 1, assignment => true,
3032     inlineUnparsed => 1, variable => 1, stringLiteral => true,
3033 wakaba 1.41 list => true, arrayRefLiteral => true, hashRefLiteral => true,
3034 wakaba 1.35 }->{$codeArg-><AG::Node.localName>}) {
3035     if ($codeArg-><AG::Node.parentNode>) {
3036     __EXCEPTION{IN_USE_NODE_ERR::
3037     pc:childNode => {$codeArg},
3038     }__;
3039     }
3040     __DEEP{
3041     $self-><AG::Node.ownerDocument>
3042     -><M::Document.adoptNode> ($codeArg);
3043     $self-><M::Node.appendChild> ($codeArg);
3044     }__;
3045     } else {
3046     __EXCEPTION{BAD_CHILD_ERR::
3047     pc:parentNode => {$self},
3048     pc:childNode => {$codeArg},
3049     }__;
3050     }
3051 wakaba 1.6
3052     @Method:
3053     @@Name: appendCode
3054     @@enDesc:
3055     Appends an unparsed Perl code fragment.
3056     @@Param:
3057     @@@Name: codeArg
3058 wakaba 1.35 @@@Type: DOMString
3059 wakaba 1.6 @@@enDesc:
3060     An unparsed Perl code fragment.
3061     @@Return:
3062 wakaba 1.25 @@@Type: PerlInlineUnparsedCode
3063 wakaba 1.6 @@@enDesc:
3064     The newly created Perl code object.
3065     @@@PerlDef:
3066 wakaba 1.35 __DEEP{
3067     $r = $self-><AG::Node.ownerDocument>-><M::Document.createElementNS>
3068     (<Q::pc:>, 'inlineUnparsed');
3069     $r-><AS::Node.textContent> ($codeArg);
3070     $self-><M::Node.appendChild> ($r);
3071     }__;
3072 wakaba 1.6
3073     @ToStringMethod:
3074     @@Return:
3075 wakaba 1.35 @@@Type: DOMString
3076 wakaba 1.6 @@@enDesc:
3077     Perl code.
3078     @@@PerlDef:
3079 wakaba 1.35 __DEEP{
3080     my @child = @{$self-><AG::Node.childNodes>};
3081     for my $child (@child) {
3082     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3083     $child-><AG::Node.localName> eq 'inlineContainer' and
3084     1 == @child) {
3085     $r .= '(' . $child->stringify . ')';
3086     } else {
3087     $r .= $child->stringify;
3088     }
3089     }
3090     }__;
3091     ##PCCodeInlines
3092 wakaba 1.6
3093 wakaba 1.35 IFClsETDef:
3094 wakaba 1.25 @IFQName: PerlBlock
3095 wakaba 1.44 @CQName: ManakaiPerlBlock
3096 wakaba 1.35 @ETQName: pc|block
3097 wakaba 1.25
3098     @IFISA: PerlCode
3099     @IFISA: PerlCodeStatements
3100 wakaba 1.35 @CISA: ManakaiPCCodeStatements
3101 wakaba 1.25
3102 wakaba 1.8 @enDesc:
3103 wakaba 1.36 Perl block-level code block.
3104 wakaba 1.8
3105     @ToStringMethod:
3106     @@Return:
3107 wakaba 1.35 @@@Type: DOMString
3108 wakaba 1.8 @@@enDesc:
3109     Perl code.
3110     @@@PerlDef:
3111 wakaba 1.43 __DEEP{
3112 wakaba 1.35 my @child = @{$self-><AG::Node.childNodes>};
3113 wakaba 1.43 my $label = $self-><AG::PerlCodeStatements.label>;
3114     if (not $label and @child == 1 and
3115 wakaba 1.35 $child[0]-><AG::Node.localName> eq 'block') {
3116 wakaba 1.39 $r = "\x0A" . $child[0]->stringify . "\x0A";
3117 wakaba 1.43 } elsif (not $label and @child == 1 and
3118 wakaba 1.35 $child[0]-><AG::Node.localName> eq 'unparsed' and
3119     $child[0]-><AG::Node.textContent> =~ /^\s*$/) {
3120     #
3121     } else {
3122 wakaba 1.39 $r = "\x0A";
3123 wakaba 1.35 for my $child (@child) {
3124     if ($child-><AG::Node.localName> eq 'inlineContainer' and
3125     1 == @child) {
3126     $r .= '(' . $child->stringify . ')';
3127     } else {
3128     $r .= $child->stringify;
3129     }
3130     }
3131 wakaba 1.39 $r .= "\x0A";
3132 wakaba 1.35
3133 wakaba 1.39 if ($self-><AG::Node.ownerDocument>
3134     -><AG::Document.domConfig>
3135     -><M::DOMCore:DOMConfiguration.getParameter>
3136     (<Q::pc:line>)) {
3137     my $file = $self-><AG::PerlCode.fileNode>;
3138     my $sfile = $file ? $file-><AG::PerlFile.sourceFile>
3139     : $self->{<H::mn:node>}->{<H::mn:nodeID>};
3140     $r = sprintf qq<\n{\n#line %d "%s [b] (Chunk #%d)"%s>.
3141     qq<#line 1 "%s [/b] (Chunk #%d)"\n;}\n>,
3142 wakaba 1.35 $self-><AG::PerlCodeStatements.sourceLine> || 1,
3143     $self-><AG::PerlCodeStatements.sourceFile> || $sfile,
3144     $file ? $file-><M::PerlFile.getNextChunkNumber> : 0,
3145     $r,
3146     $sfile,
3147     $file ? $file-><M::PerlFile.getNextChunkNumber> : 0
3148 wakaba 1.39 if 2 < length $r;
3149 wakaba 1.41 } else {
3150     $r = "\n{\n$r\n;}\n" if 2 < length $r;
3151 wakaba 1.39 }
3152 wakaba 1.43
3153     $r = "\n" . $label . ':' . $r if $label;
3154     }
3155     }__;
3156 wakaba 1.44 ##PerlBlock
3157 wakaba 1.8
3158 wakaba 1.35 IFClsETDef:
3159 wakaba 1.25 @IFQName: PerlCodeBlocks
3160 wakaba 1.35 @CQName: ManakaiPCCodeBlocks
3161     @ETQName: pc|blockContainer
3162 wakaba 1.25
3163     @IFISA: PerlCodeStatements
3164 wakaba 1.35 @CISA: ManakaiPCCodeStatements
3165 wakaba 1.25
3166 wakaba 1.9 @enDesc:
3167     Perl block-level code container whose content may or may
3168     not semantically be self-contained.
3169    
3170     @ToStringMethod:
3171     @@Return:
3172 wakaba 1.35 @@@Type: DOMString
3173 wakaba 1.9 @@@enDesc:
3174     Perl code.
3175     @@@PerlDef:
3176 wakaba 1.35 my @child = @{$self-><AG::Node.childNodes>};
3177     if (@child == 1 and
3178     {
3179     block => true, blockContainer => true,
3180     }->{$child[0]-><AG::Node.localName>}) {
3181     $r = $child[0]->stringify;
3182     } else {
3183     for my $child (@child) {
3184     if ($child-><AG::Node.localName> eq 'inlineContainer' and
3185     1 == @child) {
3186     $r .= '(' . $child->stringify . ')';
3187     } else {
3188     $r .= $child->stringify;
3189     }
3190     }
3191 wakaba 1.9
3192 wakaba 1.35 __DEEP{
3193 wakaba 1.39 if ($self-><AG::Node.ownerDocument>
3194     -><AG::Document.domConfig>
3195     -><M::DOMCore:DOMConfiguration.getParameter>
3196     (<Q::pc:line>)) {
3197     my $file = $self-><AG::PerlCode.fileNode>;
3198     my $sfile = $file ? $file-><AG::PerlFile.sourceFile>
3199     : $self->{<H::mn:node>}->{<H::mn:nodeID>};
3200     $r = sprintf qq<\n#line %d "%s [bc] (Chunk #%d)"\n%s>.
3201     qq<\n#line 1 "%s [/bc] (Chunk #%d)"\n>,
3202 wakaba 1.35 $self-><AG::PerlCodeStatements.sourceLine> || 1,
3203     $self-><AG::PerlCodeStatements.sourceFile> || $sfile,
3204     $file ? $file-><M::PerlFile.getNextChunkNumber> : 0,
3205     $r,
3206     $sfile,
3207     $file ? $file-><M::PerlFile.getNextChunkNumber> : 0;
3208 wakaba 1.39 }
3209 wakaba 1.35 }__;
3210     }
3211     ##PCCodeBlocks
3212    
3213     IFClsETDef:
3214 wakaba 1.44 @IFQName: PCDereference
3215     @CQName: ManakaiPCDereference
3216     @ETQName: pc|dereference
3217    
3218     @IFISA: PerlCode
3219     @IFISA: PerlCodeInlines
3220     @CISA: ManakaiPCCodeInlines
3221    
3222     @enDesc:
3223     A <IF::PCDereference> object represents a dereference.
3224    
3225     @ATTR:
3226     @@Name: variableType
3227     @@ATTRQName: pc|variableType
3228     @@enDesc:
3229     The type of the value, such as <Perl::$>.
3230     @@ReflectCDATA:
3231     @@Get:
3232     @@Set:
3233    
3234     @ToStringMethod:
3235     @@Return:
3236     @@@Type: DOMString
3237     @@@PerlDef:
3238     __DEEP{
3239     $r = $self-><AG::PCDereference.variableType> . '{';
3240     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3241     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3242     $r .= $child;
3243     }
3244     $r .= '}';
3245     }__;
3246     ##PCDereference
3247    
3248     IFClsETDef:
3249 wakaba 1.48 @IFQName: PCReference
3250     @CQName: ManakaiPCReference
3251     @ETQName: pc|reference
3252    
3253     @IFISA: PerlCode
3254     @IFISA: PerlCodeInlines
3255     @CISA: ManakaiPCCodeInlines
3256    
3257     @enDesc:
3258     A <IF::PCReference> object represents a reference (<Perl::\>) operation.
3259    
3260     @ToStringMethod:
3261     @@Return:
3262     @@@Type: DOMString
3263     @@@PerlDef:
3264     __DEEP{
3265     $r = '\(undef)';
3266     no warnings 'uninitialized';
3267     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3268     next A unless $child-><AG::Node.nodeType> ==
3269     <C::Node.ELEMENT_NODE>;
3270     $r = $child;
3271     unless ({
3272     <Q::pc:variable> => true,
3273     }->{$child-><AG::Node.namespaceURI>.
3274     $child-><AG::Node.localName>}) {
3275 wakaba 1.53 $r = '\('.$r.')';
3276 wakaba 1.48 }
3277     last A;
3278     }
3279     }__;
3280     ##PCReference
3281    
3282     IFClsETDef:
3283 wakaba 1.44 @IFQName: PCApply
3284     @CQName: ManakaiPCApply
3285     @ETQName: pc|apply
3286    
3287     @IFISA: PerlCode
3288     @IFISA: PerlCodeInlines
3289     @CISA: ManakaiPCCodeInlines
3290    
3291     @enDesc:
3292     A <IF::PCApply> object represents a function call.
3293    
3294     The first child element must be an expression results in a function name
3295     (such as bare function or operator name represented
3296     as a <IF::PCVariable> object or an <IF::PCExpression> with
3297     operator <Perl::-<gt>> whose last operand is a method name.
3298    
3299     The second child element, if any, is an expression intended to be
3300     an argument for the function. It is possible to specify more than
3301     one arguments by <IF::PCExpression> with operator <Perl::,>.
3302    
3303     The third child element, if any, is an expression that is put
3304     into the indirect object slot.
3305    
3306     @Attr:
3307     @@Name: function
3308     @@enDesc:
3309     The function child element of the element.
3310     @@Type: PerlCode
3311     @@Get:
3312     @@@nullCase:
3313     @@@@enDesc: There is no child element.
3314     @@@PerlDef:
3315     __DEEP{
3316     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3317     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3318     $r = $child;
3319     last A;
3320     }
3321     }__;
3322    
3323     @Attr:
3324     @@Name: argument
3325     @@enDesc:
3326     The argument child element of the element.
3327     @@Type: PerlCode
3328     @@Get:
3329     @@@nullCase:
3330     @@@@enDesc: There is no argument element.
3331     @@@PerlDef:
3332     __DEEP{
3333     my $x;
3334     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3335     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3336     if ($x) {
3337     $r = $child;
3338     last A;
3339     } else {
3340     $x = true;
3341     }
3342     }
3343     }__;
3344    
3345     @Attr:
3346     @@Name: indirect
3347     @@enDesc:
3348     The indirect object slot child element of the element.
3349     @@Type: PerlCode
3350     @@Get:
3351     @@@nullCase:
3352     @@@@enDesc: There is no indirect object element.
3353     @@@PerlDef:
3354     __DEEP{
3355     my $x = 0;
3356     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3357     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3358     if ($x++ == 2) {
3359     $r = $child;
3360     last A;
3361     }
3362     }
3363     }__;
3364    
3365    
3366     @ToStringMethod:
3367     @@Return:
3368     @@@Type: DOMString
3369     @@@PerlDef:
3370     __DEEP{
3371     my $f;
3372     my $arg;
3373     my $obj;
3374     no warnings 'uninitialized';
3375     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3376     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3377     if (not defined $f) {
3378     $f = ''.$child;
3379     } elsif (not defined $arg) {
3380     $arg = ''.$child;
3381     } else {
3382     $obj = ''.$child;
3383     last A;
3384     }
3385     }
3386    
3387     $r = $f;
3388     $r .= ' ' . $obj if defined $obj;
3389    
3390     if ({
3391     'die' => true,
3392     'last' => true,
3393     'next' => true,
3394     'redo' => true,
3395     'return' => true,
3396     'warn' => true,
3397     }->{$r}) {
3398     $r .= ' ' . $arg;
3399     } else {
3400     $r .= ' (' . $arg . ')';
3401     }
3402     }__;
3403     ##PCApply
3404    
3405     IFClsETDef:
3406 wakaba 1.43 @IFQName: PCExpression
3407     @CQName: ManakaiPCExpression
3408     @ETQName: pc|expression
3409    
3410     @IFISA: PerlCode
3411     @IFISA: PerlCodeInlines
3412     @CISA: ManakaiPCCodeInlines
3413    
3414     @enDesc:
3415     A <IF::PCExpression> object represents a sequence of one or more
3416     expression fragments (operands) separated by the same operator.
3417    
3418     @ATTR:
3419     @@Name: operator
3420     @@ATTRQName: pc|operator
3421     @@enDesc:
3422     The operator.
3423     @@ReflectCDATA:
3424     @@Get:
3425     @@Set:
3426    
3427     @Attr:
3428     @@Name: operandNumber
3429     @@enDesc:
3430     The number of operands.
3431     @@Type: idl|unsignedLong||ManakaiDOM|all
3432     @@Get:
3433     @@@PerlDef:
3434     __DEEP{
3435     $r = @{$self-><AG::Node.childNodes>};
3436     }__;
3437    
3438     @ToStringMethod:
3439     @@Return:
3440     @@@Type: DOMString
3441     @@@PerlDef:
3442     __DEEP{
3443     my @r;
3444     no warnings 'uninitialized';
3445     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3446     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3447 wakaba 1.44 my $xuri = $child-><AG::Node.namespaceURI>
3448     . $child-><AG::Node.localName>;
3449     push @r, [$child.'', $child, $xuri];
3450 wakaba 1.43 }
3451     if (@r > 1) {
3452     my $op = $self-><AG::PCExpression.operator>;
3453     for (@r) {
3454 wakaba 1.44 if ($_->[2] ne <Q::pc:expression> and not {
3455 wakaba 1.45 <Q::pc:apply> => true,
3456 wakaba 1.44 <Q::pc:arrayRefLiteral> => true,
3457     <Q::pc:atom> => true,
3458     <Q::pc:dereference> => true,
3459     <Q::pc:hashRefLiteral> => true,
3460     <Q::pc:numberLiteral> => true,
3461     <Q::pc:stringLiteral> => true,
3462     <Q::pc:tokens> => true,
3463     <Q::pc:variable> => true,
3464     }->{$_->[2]}) {
3465     $_ = '(' . $_->[0] . ')';
3466     } elsif ($_->[2] eq <Q::pc:expression> and
3467     (not {
3468 wakaba 1.46 '**' => {'->' => true},
3469     '=~' => {'->' => true},
3470     '!~' => {'->' => true},
3471     '*' => {'->' => true, '*' => true},
3472     '/' => {'->' => true},
3473     '%' => {'->' => true},
3474     'x' => {'->' => true},
3475     '+' => {'->' => true, '*' => true, '+' => true, '-' => true},
3476     '-' => {'->' => true, '*' => true},
3477     '.' => {'->' => true},
3478     '<' => {'->' => true},
3479     '>' => {'->' => true},
3480     '<=' => {'->' => true},
3481     '>=' => {'->' => true},
3482     'lt' => {'->' => true},
3483     'gt' => {'->' => true},
3484     'le' => {'->' => true},
3485     'gr' => {'->' => true},
3486     '==' => {'->' => true},
3487     '!=' => {'->' => true},
3488     '<=>' => {'->' => true},
3489     'eq' => {'->' => true},
3490     'ne' => {'->' => true},
3491     'cmp' => {'->' => true},
3492     '&&' => {'->' => true, '&&' => true},
3493     '||' => {'->' => true, '||' => true},
3494     '..' => {'->' => true},
3495     '=' => {'->' => true},
3496     ',' => {'->' => true, ',' => true, '=>' => true},
3497     '=>' => {'->' => true, ',' => true, '=>' => true},
3498     'and' => {'->' => true, 'and' => true},
3499     'or' => {'->' => true, 'or' => true},
3500 wakaba 1.43 }->{$op}->{$_->[1]-><AG::PCExpression.operator>}) and
3501     $_->[1]-><AG::PCExpression.operandNumber> > 1) {
3502     $_ = '(' . $_->[0] . ')';
3503     } else {
3504     $_ = $_->[0];
3505     }
3506     }
3507 wakaba 1.44 $op = ' '.$op unless {
3508     ',' => true,
3509     '->' => true,
3510 wakaba 1.46 '..' => true,
3511     '...' => true,
3512 wakaba 1.44 }->{$op};
3513     $op = $op.' ' unless {
3514     '->' => true,
3515 wakaba 1.46 '..' => true,
3516     '...' => true,
3517 wakaba 1.44 }->{$op};
3518     $r = join $op, @r;
3519 wakaba 1.43 } elsif (@r) {
3520     $r = $r[0]->[0];
3521 wakaba 1.48 } elsif ($self-><AG::PCExpression.operator> eq ',') {
3522     $r = '()';
3523 wakaba 1.43 } else {
3524     $r = 'undef';
3525     }
3526     }__;
3527     ##PCExpression
3528    
3529     IFClsETDef:
3530 wakaba 1.25 @IFQName: PerlAssignment
3531 wakaba 1.35 @CQName: ManakaiPCAssignment
3532     @ETQName: pc|assignment
3533 wakaba 1.25
3534     @IFISA: PerlCode
3535 wakaba 1.35 @CISA: ManakaiPCCode
3536 wakaba 1.25
3537 wakaba 1.11 @enDesc:
3538 wakaba 1.36 Perl variable assignment.
3539 wakaba 1.11
3540     @ToStringMethod:
3541     @@Return:
3542 wakaba 1.35 @@@Type: DOMString
3543 wakaba 1.11 @@@enDesc:
3544     Perl code.
3545     @@@PerlDef:
3546 wakaba 1.35 __DEEP{
3547     $r = $self-><AG::PerlAssignment.leftCode>->stringify
3548     . ' = '
3549     . $self-><AG::PerlAssignment.rightCode>->stringify;
3550     }__;
3551    
3552     @Attr:
3553     @@Name: leftCode
3554     @@enDesc:
3555     Left-hand expression.
3556     @@Type: PerlCodeInlines
3557     @@Get:
3558     @@@nullCase:
3559     @@@@enDesc: Left-hand code not yet specified.
3560     @@@PerlDef:
3561     __DEEP{
3562     F: for my $child (@{$self-><AG::Node.childNodes>}) {
3563     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3564     $child-><AG::Node.localName> eq 'left') {
3565     $r = $child-><AG::Node.lastChild>;
3566     last F;
3567     }
3568     }
3569     }__;
3570     @@Set:
3571     @@@PerlDef:
3572     __DEEP{
3573     $self-><AG::Node.ownerDocument>-><M::Document.adoptNode> ($given);
3574     F: {
3575     for my $child (@{$self-><AG::Node.childNodes>}) {
3576     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3577     $child-><AG::Node.localName> eq 'left') {
3578     $child-><AS::Node.textContent> ('');
3579     $child-><M::Node.appendChild> ($given);
3580     last F;
3581     }
3582     }
3583     my $node = $self-><AG::Node.ownerDocument>
3584     -><M::Document.createElementNS>
3585     (<Q::pc:>, 'left');
3586     $node-><M::Node.appendChild> ($given);
3587     $self-><M::Node.appendChild> ($node);
3588     }
3589     }__;
3590    
3591     @Attr:
3592     @@Name: rightCode
3593     @@enDesc:
3594     Right-hand expression.
3595     @@Type: PerlCodeInlines
3596     @@Get:
3597     @@@nullCase:
3598     @@@@enDesc: Right-hand code not yet specified.
3599     @@@PerlDef:
3600     __DEEP{
3601     F: for my $child (@{$self-><AG::Node.childNodes>}) {
3602     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3603     $child-><AG::Node.localName> eq 'right') {
3604     $r = $child-><AG::Node.lastChild>;
3605     last F;
3606     }
3607     }
3608     }__;
3609     @@Set:
3610     @@@PerlDef:
3611     __DEEP{
3612     $self-><AG::Node.ownerDocument>-><M::Document.adoptNode> ($given);
3613     F: {
3614     for my $child (@{$self-><AG::Node.childNodes>}) {
3615     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
3616     $child-><AG::Node.localName> eq 'right') {
3617     $child-><AS::Node.textContent> ('');
3618     $child-><M::Node.appendChild> ($given);
3619     last F;
3620     }
3621     }
3622     my $node = $self-><AG::Node.ownerDocument>
3623     -><M::Document.createElementNS>
3624     (<Q::pc:>, 'right');
3625     $node-><M::Node.appendChild> ($given);
3626     $self-><M::Node.appendChild> ($node);
3627     }
3628     }__;
3629 wakaba 1.11 ##PerlAssignment
3630    
3631 wakaba 1.35 IFClsETDef:
3632 wakaba 1.44 @IFQName: PCCondition
3633     @CQName: ManakaiPCCondition
3634     @ETQName: pc2|condition
3635    
3636     @IFISA: PerlCode
3637     @IFISA: PerlCodeInlines
3638     @CISA: ManakaiPCCodeInlines
3639    
3640     @enDesc:
3641     A <IF::PCCondition> object represents a condition expression
3642     part of an <Perl::if> or <Perl::while> statement.
3643    
3644     @ToStringMethod:
3645     @@Return:
3646     @@@Type: DOMString
3647     @@@PerlDef:
3648     __DEEP{
3649     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3650     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3651     $r .= $child;
3652     }
3653     }__;
3654     ##PCCondition
3655    
3656     IFClsETDef:
3657     @IFQName: PCBlock
3658     @CQName: ManakaiPCBlock
3659     @ETQName: pc2|block
3660    
3661     @IFISA: PerlCode
3662     @IFISA: PerlCodeStatements
3663     @CISA: ManakaiPCCodeStatements
3664    
3665     @enDesc:
3666     A <Q::PCBlock> object represents a Perl code block, i.e.
3667     a set of statements enclosed by <CHAR::{> and <CHAR::}> pair.
3668    
3669     @ToStringMethod:
3670     @@Return:
3671     @@@Type: DOMString
3672     @@@PerlDef:
3673     __DEEP{
3674     my @child = @{$self-><AG::Node.childNodes>};
3675     my $label = $self-><AG::PerlCodeStatements.label>;
3676    
3677     $r = "\x0A";
3678     for my $child (@child) {
3679     if ($child-><AG::Node.localName> eq 'inlineContainer' and
3680     1 == @child) {
3681     $r .= '(' . $child->stringify . ')';
3682     } else {
3683     $r .= $child->stringify;
3684     }
3685     }
3686     $r .= "\x0A";
3687     $r .= ';' unless @child;
3688    
3689     if ($self-><AG::Node.ownerDocument>
3690     -><AG::Document.domConfig>
3691     -><M::DOMCore:DOMConfiguration.getParameter>
3692     (<Q::pc:line>)) {
3693     my $file = $self-><AG::PerlCode.fileNode>;
3694     my $sfile = $file ? $file-><AG::PerlFile.sourceFile>
3695     : $self->{<H::mn:node>}->{<H::mn:nodeID>};
3696     $r = sprintf qq<\n{\n#line %d "%s [b] (Chunk #%d)"%s>.
3697     qq<#line 1 "%s [/b] (Chunk #%d)"\n}\n>,
3698     $self-><AG::PerlCodeStatements.sourceLine> || 1,
3699     $self-><AG::PerlCodeStatements.sourceFile> || $sfile,
3700     $file ? $file-><M::PerlFile.getNextChunkNumber> : 0,
3701     $r,
3702     $sfile,
3703     $file ? $file-><M::PerlFile.getNextChunkNumber> : 0;
3704     } else {
3705     $r = "\n{\n$r\n}\n";
3706     }
3707    
3708     $r = "\n" . $label . ':' . $r . '# ' . $label . "\n"
3709     if length $label;
3710    
3711     }__;
3712     ##PCBlock
3713    
3714     IFClsETDef:
3715 wakaba 1.45 @IFQName: PCWhile
3716     @CQName: ManakaiPCWhile
3717     @ETQName: pc|while
3718    
3719     @IFISA: PerlCode
3720     @CISA: ManakaiPCCode
3721    
3722     @enDesc:
3723     A <IF::PCWhile> object represents a <Perl::while> statement.
3724     It can contain two child elements: <Q::pc2|condition> and <Q::pc2|block>,
3725     each represents the condition expression and the block of the <Perl::while>
3726     statement.
3727    
3728     @ATTR:
3729     @@Name: label
3730     @@ATTRQName: pc|label
3731     @@enDesc:
3732     Label for this block.
3733     @@ReflectCDATA:
3734     @@Get:
3735     @@@nullCase:
3736     @@@@enDesc:
3737     No label.
3738     @@Set:
3739     @@@nullCase:
3740     @@@@enDesc:
3741     No label.
3742    
3743     @Attr:
3744     @@Name: condition
3745     @@enDesc:
3746     The condition object.
3747     @@Type: PCCondition
3748     @@Get:
3749     @@@nullCase:
3750     @@@@enDesc:
3751     There is no condition element.
3752     @@@PerlDef:
3753     __CODE{getChildElementByType::
3754     $namespaceURI => {<Q::pc2:>},
3755     $localName => {'condition'},
3756     $parent => $self,
3757     $result => $r,
3758     }__;
3759    
3760     @Attr:
3761     @@Name: block
3762     @@enDesc:
3763     The code block that is executed while the <A::PCWhile.condition> met.
3764     @@Type: PCBlock
3765     @@Get:
3766     @@@nullCase:
3767     @@@@enDesc:
3768     There is no <Q::pc2:block> child element.
3769     @@@PerlDef:
3770     __CODE{getChildElementByType::
3771     $namespaceURI => {<Q::pc2:>},
3772     $localName => {'block'},
3773     $parent => $self,
3774     $result => $r,
3775     }__;
3776    
3777     @ToStringMethod:
3778     @@Return:
3779     @@@Type: DOMString
3780     @@@PerlDef:
3781     __DEEP{
3782     $r = 'while (';
3783     my $cond = $self-><AG::PCWhile.condition>;
3784     if ($cond) {
3785     $r .= $cond->stringify;
3786     } else {
3787     $r .= '0';
3788     }
3789     $r .= ') ';
3790     my $block = $self-><AG::PCWhile.block>;
3791     if ($block) {
3792     $r .= $block->stringify;
3793     } else {
3794     $r .= "{ }\n";
3795     }
3796    
3797     my $label = $self-><AG::PCWhile.label>;
3798     $r = "\n" . $label . ': ' . $r . ' # ' . $label . "\n"
3799     if length $label;
3800     }__;
3801     ##PCWhile
3802    
3803     IFClsETDef:
3804 wakaba 1.43 @IFQName: PCChoose
3805     @CQName: ManakaiPCChoose
3806     @ETQName: pc|choose
3807    
3808     @IFISA: PerlCode
3809     @CISA: ManakaiPCCode
3810    
3811     @enDesc:
3812     A <IF::PCChoose> object, or a <Q::pc|choose> element, represents
3813     a set of <Perl::if>, <Perl::elsif>, and <Perl::else> statements.
3814    
3815     @Method:
3816     @@Name: getWhen
3817     @@enDesc:
3818     Returns a <IF::PCWhen> by its ordinal index.
3819     @@Param:
3820     @@@Name: index
3821     @@@Type: idl|unsignedLong||ManakaiDOM|all
3822     @@@enDesc:
3823     The ordinal index of the <Q::pc|when> element.
3824     @@Return:
3825     @@@Type: PCWhen
3826     @@@enDesc:
3827     The <P::index>th <Q::pc|when> object.
3828     @@@nullCase:
3829     @@@@enDesc:
3830     There is no <P::index>th element.
3831     @@@PerlDef:
3832     __DEEP{
3833     my $i = 0;
3834     no warnings 'uninitialized';
3835     A: for my $child (@{$self-><AG::Node.childNodes>}) {
3836     if ($child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE> and
3837     $child-><AG::Node.namespaceURI> eq <Q::pc:> and
3838     $child-><AG::Node.localName> eq 'when' and
3839     ++$i == $index) {
3840     $r = $child;
3841     last A;
3842     }
3843     }
3844     }__;
3845    
3846     @Method:
3847     @@Name: appendNewPCWhen
3848     @@enDesc:
3849     Appends a new <Q::pc|when> element.
3850     @@Return:
3851     @@@Type: PCWhen
3852     @@@enDesc:
3853     The newly created <Q::pc|when> element.
3854     @@@PerlDef:
3855     __DEEP{
3856     my $od = $self-><AG::Node.ownerDocument>;
3857     $r = $od-><M::Document.createElementNS> (<Q::pc:>, 'when');
3858     my $cond = $od-><M::Document.createElementNS>
3859 wakaba 1.44 (<Q::pc2:>, 'condition');
3860 wakaba 1.43 $r-><M::Node.appendChild> ($cond);
3861     my $block = $od-><M::Document.createElementNS>
3862 wakaba 1.44 (<Q::pc2:>, 'block');
3863 wakaba 1.43 $r-><M::Node.appendChild> ($block);
3864     $self-><M::Node.insertBefore> ($r, $self-><AG::PCChoose.otherwise>);
3865     }__;
3866    
3867     @Attr:
3868     @@Name: otherwise
3869     @@enDesc:
3870     Returns the <IF::PCOtherwise> by its ordinal index.
3871     @@Type: PCOtherwise
3872     @@Get:
3873     @@@enDesc:
3874     The <Q::pc|otherwise> object.
3875     @@@nullCase:
3876     @@@@enDesc:
3877     There is no <Q::pc|otherwise> element.
3878     @@@PerlDef:
3879     __CODE{getChildElementByType::
3880     $namespaceURI => {<Q::pc:>},
3881     $localName => {'otherwise'},
3882     $parent => $self,
3883     $result => $r,
3884     }__;
3885    
3886     @Method:
3887     @@Name: appendNewPCOtherwise
3888     @@enDesc:
3889     Appends a new <Q::pc|otherwise> element. If there is already the
3890     <Q::pc|otherwise> element, then no element is created and
3891     the element is returned.
3892     @@Return:
3893     @@@Type: PCOtherwise
3894     @@@enDesc:
3895     The <Q::pc|otherwise> element.
3896     @@@PerlDef:
3897     __DEEP{
3898     $r = $self-><AG::PCChoose.otherwise>;
3899     unless ($r) {
3900     my $od = $self-><AG::Node.ownerDocument>;
3901     $r = $od-><M::Document.createElementNS> (<Q::pc:>, 'otherwise');
3902     my $block = $od-><M::Document.createElementNS>
3903 wakaba 1.44 (<Q::pc2:>, 'block');
3904 wakaba 1.43 $r-><M::Node.appendChild> ($block);
3905     $self-><M::Node.appendChild> ($r);
3906     }
3907     }__;
3908    
3909     @ToStringMethod:
3910     @@Return:
3911     @@@Type: DOMString
3912     @@@PerlDef:
3913     __DEEP{
3914     S: for my $child (@{$self-><AG::Node.childNodes>}) {
3915     next S unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
3916     next S unless $child-><AG::Node.namespaceURI> eq <Q::pc:>;
3917     my $ln = $child-><AG::Node.localName>;
3918     if ($ln eq 'when') {
3919     $r .= 'els' if length $r;
3920     $r .= $child->stringify;
3921     } elsif ($ln eq 'otherwise') {
3922     $r .= $child->stringify;
3923     last S;
3924     }
3925     } # S
3926     }__;
3927     ##PCChoose
3928    
3929     IFClsETDef:
3930     @IFQName: PCWhen
3931     @CQName: ManakaiPCWhen
3932     @ETQName: pc|when
3933    
3934     @IFISA: PerlCode
3935     @CISA: ManakaiPCCode
3936    
3937     @enDesc:
3938     A <IF::PCWhen> object, or a <Q::pc|when> element, represents an
3939     <Perl::if> or <Perl::elsif> block.
3940    
3941     @Attr:
3942     @@Name: condition
3943     @@enDesc:
3944 wakaba 1.44 The condition object.
3945     @@Type: PCCondition
3946 wakaba 1.43 @@Get:
3947     @@@nullCase:
3948     @@@@enDesc:
3949 wakaba 1.44 There is no condition element.
3950 wakaba 1.43 @@@PerlDef:
3951     __CODE{getChildElementByType::
3952 wakaba 1.44 $namespaceURI => {<Q::pc2:>},
3953 wakaba 1.43 $localName => {'condition'},
3954     $parent => $self,
3955     $result => $r,
3956     }__;
3957    
3958     @Attr:
3959     @@Name: block
3960     @@enDesc:
3961     The code block that is executed when the <A::PCWhen.condition> met.
3962 wakaba 1.44 @@Type: PCBlock
3963 wakaba 1.43 @@Get:
3964     @@@nullCase:
3965     @@@@enDesc:
3966 wakaba 1.44 There is no <Q::pc2:block> child element.
3967 wakaba 1.43 @@@PerlDef:
3968     __CODE{getChildElementByType::
3969 wakaba 1.44 $namespaceURI => {<Q::pc2:>},
3970 wakaba 1.43 $localName => {'block'},
3971     $parent => $self,
3972     $result => $r,
3973     }__;
3974    
3975     @ToStringMethod:
3976     @@Return:
3977     @@@Type: DOMString
3978     @@@PerlDef:
3979     __DEEP{
3980     $r = 'if (';
3981     my $cond = $self-><AG::PCWhen.condition>;
3982     if ($cond) {
3983     $r .= $cond->stringify;
3984     } else {
3985     $r .= '0';
3986     }
3987     $r .= ') ';
3988     my $block = $self-><AG::PCWhen.block>;
3989     if ($block) {
3990     $r .= $block->stringify;
3991     } else {
3992     $r .= "{ }\n";
3993     }
3994     }__;
3995     ##PCWhen
3996    
3997     IFClsETDef:
3998     @IFQName: PCOtherwise
3999     @CQName: ManakaiPCOtherwise
4000     @ETQName: pc|otherwise
4001    
4002     @IFISA: PerlCode
4003     @CISA: ManakaiPCCode
4004    
4005     @enDesc:
4006     A <IF::PCOtherwise> object, or a <Q::pc|otherwise> element, represents an
4007     <Perl::else> clause.
4008    
4009     @Attr:
4010     @@Name: block
4011     @@enDesc:
4012     The code block that is executed.
4013 wakaba 1.44 @@Type: PCBlock
4014 wakaba 1.43 @@Get:
4015     @@@nullCase:
4016     @@@@enDesc:
4017 wakaba 1.44 There is no <Q::pc2:block> child element.
4018 wakaba 1.43 @@@PerlDef:
4019     __CODE{getChildElementByType::
4020 wakaba 1.44 $namespaceURI => {<Q::pc2:>},
4021 wakaba 1.43 $localName => {'block'},
4022     $parent => $self,
4023     $result => $r,
4024     }__;
4025    
4026     @ToStringMethod:
4027     @@Return:
4028     @@@Type: DOMString
4029     @@@PerlDef:
4030     __DEEP{
4031     my $block = $self-><AG::PCOtherwise.block>;
4032     if ($block) {
4033     $r = 'else ' . $block->stringify;
4034     }
4035     }__;
4036     ##PCOtherwise
4037    
4038     ResourceDef:
4039     @For: ManakaiDOM|ManakaiDOM
4040     @QName: getChildElementByType
4041     @rdf:type: DISPerl|BlockCode
4042     @enDesc:
4043     Returns the first element of a type.
4044     @PerlCDef:
4045     __DEEP{
4046     no warnings 'uninitialized';
4047     A: for my $__child (@{$parent-><AG::Node.childNodes>}) {
4048     if ($__child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE> and
4049     $__child-><AG::Node.namespaceURI> eq $namespaceURI and
4050     $__child-><AG::Node.localName> eq $localName) {
4051     $result = $__child;
4052     last A;
4053     }
4054     }
4055     }__;
4056    
4057     IFClsETDef:
4058 wakaba 1.26 @IFQName: PerlIf
4059 wakaba 1.35 @CQName: ManakaiPCIf
4060     @ETQName: pc|if
4061 wakaba 1.25
4062     @IFISA: PerlCode
4063 wakaba 1.35 @CISA: ManakaiPCCode
4064 wakaba 1.25
4065 wakaba 1.12 @enDesc:
4066     Perl variable assignment.
4067    
4068     @ToStringMethod:
4069     @@Return:
4070 wakaba 1.35 @@@Type: DOMString
4071 wakaba 1.12 @@@enDesc:
4072     Perl code.
4073     @@@PerlDef:
4074 wakaba 1.35 __DEEP{
4075     my $tcode = $self-><AG::PerlIf.trueCode>;
4076     my $fcode = $self-><AG::PerlIf.falseCode>;
4077     my $ccode = $self-><AG::PerlIf.condition>;
4078     if (defined $tcode) {
4079     if (defined $fcode) {
4080     $r = q<if (> . $ccode->stringify . q<) {> . $tcode->stringify .
4081     q<} else {> . $fcode->stringify . qq<}\n>;
4082     } else {
4083 wakaba 1.36 $r = q<if (> . $ccode->stringify . q<) {> . $tcode->stringify .
4084 wakaba 1.35 qq<}\n>;
4085     }
4086     } else {
4087     $r = q<unless (> . $ccode->stringify . q<) {> . $fcode->stringify .
4088     qq<}\n>;
4089     }
4090     }__;
4091    
4092     @Attr:
4093     @@Name: condition
4094     @@enDesc:
4095     Condition expression.
4096     @@Type: PerlCodeInlines
4097     @@Get:
4098     @@@nullCase:
4099     @@@@enDesc: Condition code not yet specified.
4100     @@@PerlDef:
4101     __DEEP{
4102     F: for my $child (@{$self-><AG::Node.childNodes>}) {
4103     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
4104     $child-><AG::Node.localName> eq 'condition') {
4105     $r = $child-><AG::Node.lastChild>;
4106     last F;
4107     }
4108     }
4109     }__;
4110     @@Set:
4111     @@@PerlDef:
4112     __DEEP{
4113     $self-><AG::Node.ownerDocument>-><M::Document.adoptNode> ($given);
4114     F: {
4115     for my $child (@{$self-><AG::Node.childNodes>}) {
4116     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
4117     $child-><AG::Node.localName> eq 'condition') {
4118     $child-><AS::Node.textContent> ('');
4119     $child-><M::Node.appendChild> ($given);
4120     last F;
4121     }
4122     }
4123     my $node = $self-><AG::Node.ownerDocument>
4124     -><M::Document.createElementNS>
4125     (<Q::pc:>, 'condition');
4126     $node-><M::Node.appendChild> ($given);
4127     $self-><M::Node.appendChild> ($node);
4128     }
4129     }__;
4130    
4131     @Attr:
4132     @@Name: trueCode
4133     @@enDesc:
4134     True-case code.
4135     @@Type: PerlCodeBlocks
4136     @@Get:
4137     @@@nullCase:
4138     @@@@enDesc: True-case code not yet specified.
4139     @@@PerlDef:
4140     __DEEP{
4141     F: for my $child (@{$self-><AG::Node.childNodes>}) {
4142     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
4143     $child-><AG::Node.localName> eq 'tr'.'ue') {
4144     $r = $child-><AG::Node.lastChild>;
4145     last F;
4146     }
4147     }
4148     }__;
4149     @@Set:
4150     @@@PerlDef:
4151     __DEEP{
4152     $self-><AG::Node.ownerDocument>-><M::Document.adoptNode> ($given);
4153     F: {
4154     for my $child (@{$self-><AG::Node.childNodes>}) {
4155     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
4156     $child-><AG::Node.localName> eq 'tr'.'ue') {
4157     $child-><AS::Node.textContent> ('');
4158     $child-><M::Node.appendChild> ($given);
4159     last F;
4160     }
4161     }
4162     my $node = $self-><AG::Node.ownerDocument>
4163     -><M::Document.createElementNS>
4164     (<Q::pc:>, 'tr'.'ue');
4165     $node-><M::Node.appendChild> ($given);
4166     $self-><M::Node.appendChild> ($node);
4167     }
4168     }__;
4169    
4170     @Attr:
4171     @@Name: falseCode
4172     @@enDesc:
4173     False-case code.
4174     @@Type: PerlCodeBlocks
4175     @@Get:
4176     @@@nullCase:
4177     @@@@enDesc: True-case code not yet specified.
4178     @@@PerlDef:
4179     __DEEP{
4180     F: for my $child (@{$self-><AG::Node.childNodes>}) {
4181     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
4182     $child-><AG::Node.localName> eq 'fal'.'se') {
4183     $r = $child-><AG::Node.lastChild>;
4184     last F;
4185     }
4186     }
4187     }__;
4188     @@Set:
4189     @@@PerlDef:
4190     __DEEP{
4191     $self-><AG::Node.ownerDocument>-><M::Document.adoptNode> ($given);
4192     F: {
4193     for my $child (@{$self-><AG::Node.childNodes>}) {
4194     if ($child-><AG::Node.namespaceURI> eq <Q::pc:> and
4195     $child-><AG::Node.localName> eq 'fal'.'se') {
4196     $child-><AS::Node.textContent> ('');
4197     $child-><M::Node.appendChild> ($given);
4198     last F;
4199     }
4200     }
4201     my $node = $self-><AG::Node.ownerDocument>
4202     -><M::Document.createElementNS>
4203     (<Q::pc:>, 'fal'.'se');
4204     $node-><M::Node.appendChild> ($given);
4205     $self-><M::Node.appendChild> ($node);
4206     }
4207     }__;
4208 wakaba 1.12 ##PerlIf
4209    
4210     PropDef:
4211     @QName:condition
4212     @enDesc:
4213     Condition.
4214     PropDef:
4215     @QName:true
4216     @enDesc:
4217     If true.
4218     PropDef:
4219     @QName:false
4220     @enDesc:
4221     If false.
4222    
4223 wakaba 1.11 PropDef:
4224     @QName:left
4225     @FullName:
4226     @@lang:en
4227     @@@: Left hand side
4228     PropDef:
4229     @QName:right
4230     @FullName:
4231     @@lang:en
4232     @@@: Right hand side
4233    
4234 wakaba 1.8 PropDef:
4235     @QName:label
4236     @enDesc:
4237     Perl statement / block label.
4238    
4239 wakaba 1.43
4240     IFClsETDef:
4241     @IFQName: PCFunctionCall
4242     @CQName: ManakaiPCFunctionCall
4243     @ETQName: pc|call
4244    
4245     @IFISA: PerlCode
4246     @IFISA: PerlCodeInlines
4247     @CISA: ManakaiPCCodeInlines
4248    
4249     @enDesc:
4250     A <IF::PCFunctionCall> object represents a function call or
4251     function-like statement such as <Perl::next>.
4252    
4253     @ATTR:
4254     @@Name: variableType
4255     @@ATTRQName: pc|variableType
4256     @@enDesc:
4257     The value of the attribute <kwd:MAY> be <Perl::&>,
4258     which introduces a subroutine name.
4259     @@ReflectCDATA:
4260     @@Get:
4261     @@Set:
4262    
4263     @ATTR:
4264     @@Name: packageName
4265     @@ATTRQName: pc|packageName
4266     @@enDesc:
4267     The name of the package to which the subroutine belongs.
4268     @@ReflectCDATA:
4269     @@Get:
4270     @@@nullCase:
4271     @@@@enDesc:
4272     The object belongs to the current package or
4273     does not belong to any package.
4274     @@Set:
4275     @@@nullCase:
4276     @@@@enDesc:
4277     The object belongs to the current package or
4278     does not belong to any package.
4279    
4280     @ATTR:
4281     @@Name: pcLocalName
4282     @@ATTRQName: pc|localName
4283     @@enDesc:
4284     The local part of the subroutine name.
4285     @@ReflectCDATA:
4286     @@Get:
4287     @@Set:
4288    
4289     @ToStringMethod:
4290     @@Return:
4291     @@@Type: DOMString
4292     @@@PerlDef:
4293     __DEEP{
4294     $r .= $self-><AG::PCFunctionCall.variableType>;
4295     my $v = $self-><AG::PCFunctionCall.packageName>;
4296     $r .= $v . '::' if length $v;
4297     $r .= $self-><AG::PCFunctionCall.pcLocalName>;
4298    
4299     my @arg;
4300     no warnings 'uninitialized';
4301     A: for my $child (@{$self-><AG::Node.childNodes>}) {
4302     next A unless $child-><AG::Node.nodeType> == <C::Node.ELEMENT_NODE>;
4303     push @arg, ''.$child;
4304     }
4305     my $arg = join ', ', @arg;
4306     if ({
4307     'die' => true,
4308     'last' => true,
4309     'next' => true,
4310     'redo' => true,
4311 wakaba 1.44 'return' => true,
4312 wakaba 1.43 'warn' => true,
4313 wakaba 1.44 }->{$r}) {
4314 wakaba 1.43 $r .= ' ' . $arg;
4315     } else {
4316     $r .= ' (' . $arg . ')';
4317     }
4318     }__;
4319     ##PCFunctionCall
4320    
4321 wakaba 1.6 ElementTypeBinding:
4322     @Name: RaiseException
4323     @ElementType:
4324 wakaba 1.39 dx:raises
4325    
4326     ## -- Configuration Parameters
4327    
4328     boolCParam:
4329     @QName: pc|line
4330     @nodeProp: pcline
4331     @IsSupportRequired:1
4332     @DOMCore:targetType: DOMCore|Document
4333     @TrueCase:
4334     @@DOMCore:isSupported:1
4335     @@enDesc:
4336     Inserts <Perl::#line> directives.
4337     @FalseCase:
4338     @@DOMCore:isSupported:1
4339     @@IsSupportRequired:1
4340     @@IsDefault:1
4341 wakaba 1.54 @@enDesc:
4342 wakaba 1.39 Does not insert any <Perl::#line> directive.
4343 wakaba 1.54
4344     boolCParam:
4345     @QName: pc|preserve-line-break
4346     @nodeProp: plb
4347     @DOMCore:targetType: DOMCore|Document
4348     @IsSupportRequired:1
4349     @TrueCase:
4350     @@DOMCore:isSupported:1
4351     @@enDesc:
4352     When stringifying a <IF::PerlStringLiteral>, if it contains
4353     <CODE::U+000A> and / or <CODE::U+000D> characters, then
4354     they are escaped (e.g. <Perl::\x0A>).
4355     @@TestC:
4356     @@@QName: cfg.preserve-line-break.true.test
4357     @@@PerlCDef:
4358     my $doc;
4359     __CODE{createPCDocumentForTest:: $doc => $doc}__;
4360    
4361     my $cfg = $doc-><AG::Document.domConfig>;
4362     $cfg-><M::CFG.setParameter> (<Q::pc|preserve-line-break> => true);
4363    
4364     $test->id ('crlf');
4365     my $sl = $doc-><M::PCDocument.createPCLiteral> ("ab\x0D\x0Acd");
4366     my $str = $sl->stringify;
4367     $test->assert_equals ($str, q<"ab\x0D\x0Acd">);
4368    
4369     $test->id ('lf');
4370     my $sl2 = $doc-><M::PCDocument.createPCLiteral> ("ab\x0Acd");
4371     my $str2 = $sl2->stringify;
4372     $test->assert_equals ($str2, q<"ab\x0Acd">);
4373     @FalseCase:
4374     @@DOMCore:isSupported:1
4375     @@IsSupportRequired:1
4376     @@IsDefault:1
4377     @@enDesc:
4378     Line break characters are stringified as is.
4379     @@TestC:
4380     @@@QName: cfg.preserve-line-break.false.test
4381     @@@PerlCDef:
4382     my $doc;
4383     __CODE{createPCDocumentForTest:: $doc => $doc}__;
4384    
4385     my $cfg = $doc-><AG::Document.domConfig>;
4386     $cfg-><M::CFG.setParameter> (<Q::pc|preserve-line-break> => false);
4387    
4388     $test->id ('crlf');
4389     my $sl = $doc-><M::PCDocument.createPCLiteral> ("ab\x0D\x0Acd");
4390     my $str = $sl->stringify;
4391     $test->assert_equals ($str, q<'ab>.qq<\x0D\x0A>.q<cd'>);
4392    
4393     $test->id ('lf');
4394     my $sl2 = $doc-><M::PCDocument.createPCLiteral> ("ab\x0Acd");
4395     my $str2 = $sl2->stringify;
4396     $test->assert_equals ($str2, q<'ab>.qq<\x0A>.q<cd'>);
4397     @TestC:
4398     @@QName: cfg.preserve-line-break.set.test
4399     @@PerlCDef:
4400     my $doc;
4401     __CODE{createPCDocumentForTest:: $doc => $doc}__;
4402    
4403     my $cfg = $doc-><AG::Document.domConfig>;
4404    
4405     $test->id ('default');
4406     $test->assert_false ($cfg-><M::CFG.getParameter>
4407     (<Q::pc|preserve-line-break>));
4408    
4409     $test->id ('set.f.to.t');
4410     $cfg-><M::CFG.setParameter> (<Q::pc|preserve-line-break> => true);
4411     $test->assert_true ($cfg-><M::CFG.getParameter>
4412     (<Q::pc|preserve-line-break>));
4413    
4414     $test->id ('set.t.to.f');
4415     $cfg-><M::CFG.setParameter> (<Q::pc|preserve-line-break> => false);
4416     $test->assert_false ($cfg-><M::CFG.getParameter>
4417     (<Q::pc|preserve-line-break>));
4418    
4419     $cfg-><M::CFG.setParameter> (<Q::pc|preserve-line-break> => true);
4420    
4421     $test->id ('reset');
4422     $cfg-><M::CFG.setParameter> (<Q::pc|preserve-line-break> => null);
4423     $test->assert_false ($cfg-><M::CFG.getParameter>
4424     (<Q::pc|preserve-line-break>));
4425    
4426     ResourceDef:
4427     @QName: CFG
4428     @AliasFor: DOMCore|DOMConfiguration
4429     @For: ManakaiDOM|DOM3
4430 wakaba 1.39
4431     CParam:
4432     @QName: pc|split-resolver
4433     @nodeProp: pcsres
4434     @IsSupportRequired:1
4435     @DOMCore:targetType: DOMCore|Document
4436     @Type: DISPerl|CODE||ManakaiDOM|all
4437     @enDesc:
4438     Splits module file. The parameter value <kwd:MUST> be
4439     a Perl code reference. The serializer would invoke
4440     the code with arguments: a reserved parameter, a <IF::PerlFile>
4441     whose serialization is being split, and a string
4442     that identifies the split part. The code is expected
4443     to return a <IF::DOMLS:LSOutput> object to which the module part
4444     is written. Note that splitting serialized module file
4445     does not affect to the <IF::PerlFile> tree.
4446     @nullCase:
4447     @@enDesc:
4448     Does not split module file.
4449    
4450     ElementTypeBinding:
4451     @Name: nodeProp
4452     @ElementType:
4453     DOMCore:nodeProp
4454     @ShadowContent:
4455     @@For: =ManakaiDOM|all
4456    
4457     ElementTypeBinding:
4458     @Name: CParam
4459     @ElementType:
4460     dis:ResourceDef
4461     @ShadowContent:
4462     @@rdf:type:
4463     @@@@: DOMCore|DOMConfigurationParameter
4464     @@@For: ManakaiDOM|DOM
4465     @@rdf:type:
4466     @@@@: DISCore|Property
4467     @@@For: =ManakaiDOM|all
4468     @@For: ManakaiDOM|DOM3
4469     @@For: =ManakaiDOM|all
4470    
4471     ElementTypeBinding:
4472     @Name: boolCParam
4473     @ElementType:
4474     dis:ResourceDef
4475     @ShadowContent:
4476     @@rdf:type:
4477     @@@@: DOMCore|DOMConfigurationParameter
4478     @@@For: ManakaiDOM|DOM
4479     @@rdf:type:
4480     @@@@: DISCore|Property
4481     @@@For: =ManakaiDOM|all
4482     @@For: ManakaiDOM|DOM3
4483     @@For: =ManakaiDOM|all
4484     @@Type: idl|boolean||ManakaiDOM|all
4485    
4486 wakaba 1.41 ## -- PCDocument
4487    
4488     IFClsDef:
4489     @IFQName: PCDocument
4490     @CQName: ManakaiPCDocument
4491    
4492     @IFISA: Document
4493     @CISA: DOMCore|ManakaiDOMDocument
4494    
4495     @enDesc:
4496     A <IF::PCDocument> is a <IF::Document> that represents a Perl code.
4497    
4498     @s:rootElementType: pc|file
4499    
4500     @Method:
4501     @@Name: createPCLiteral
4502     @@enDesc:
4503     Creates a literal object.
4504 wakaba 1.47
4505     {NOTE:: If a member of <P::value> is a <IF::PerlCode> object,
4506     then it is appended to the tree as is, except when
4507     the object comes from different document than the
4508     document, in which case the object is being adopted
4509     to the document by <M::Document.adoptNode> method.
4510     If that method fails, then the result is undefined.
4511     }
4512 wakaba 1.41 @@Param:
4513     @@@Name: value
4514     @@@Type: DISPerl|Any
4515     @@@enDesc:
4516     The value.
4517     @@@InCase:
4518     @@@@Type: DISPerl|StringValue
4519     @@@@enDesc:
4520     A <IF::PerlStringLiteral> whose value is <P::value> is created.
4521     @@@InCase:
4522     @@@@Type: DISPerl|ARRAY
4523     @@@@enDesc:
4524     A <IF::PCArrayRefLiteral> is created. If <P::value>
4525     has items, then objects are recursively created.
4526     @@@InCase:
4527     @@@@Type: DISPerl|HASH
4528     @@@@enDesc:
4529     A <IF::PCHashRefLiteral> is created. If <P::value>
4530     has key-value pairs, then objects are recursively created.
4531     @@Return:
4532     @@@Type: PerlCode
4533     @@@enDesc: The newly created value object.
4534     @@@PerlDef:
4535     __DEEP{
4536     if (ref $value eq 'HASH' or ref $value eq 'ARRAY') {
4537     $r = $self-><M::Document.createElementNS>
4538     (<Q::pc:>, ref $value eq 'HASH' ? 'hashRefLiteral'
4539     : 'arrayRefLiteral');
4540     for my $v (ref $value eq 'HASH' ? %$value : @$value) {
4541     my $vo;
4542     if (UNIVERSAL::isa ($v, <IFName::PerlCode>)) {
4543 wakaba 1.47 $vo = $self-><M::Document.adoptNode> ($v);
4544 wakaba 1.41 } else {
4545     $vo = $self-><M::PCDocument.createPCLiteral> ($v);
4546     }
4547     $r-><M::Node.appendChild> ($vo);
4548     }
4549 wakaba 1.51 } elsif (defined $value) {
4550 wakaba 1.41 $r = $self-><M::Document.createElementNS>
4551     (<Q::pc:>, 'stringLiteral');
4552     $r-><AS::Node.textContent> ($value);
4553 wakaba 1.51 } else {
4554     $r = $self-><M::Document.createElementNS>
4555     (<Q::pc:>, 'atom');
4556     $r-><AS::Node.textContent> ('undef');
4557 wakaba 1.41 }
4558 wakaba 1.43 }__;
4559 wakaba 1.51 @@Test:
4560     @@@QName: PCDocument.createPCLiteral.undef.test
4561     @@@PerlDef:
4562     my $doc;
4563     __CODE{createPCDocumentForTest:: $doc => $doc}__;
4564    
4565     $test->id ('undef.element');
4566     my $e1 = $doc-><M::PCDocument.createPCLiteral> (null);
4567     $test->assert_isa ($e1, <IFName::PerlAtom>);
4568     $test->assert_equals ($e1-><AG::Node.textContent>, 'undef');
4569    
4570     $test->id ('string.empty.element');
4571     my $e2 = $doc-><M::PCDocument.createPCLiteral> ('');
4572     $test->assert_isa ($e2, <IFName::PerlStringLiteral>);
4573     $test->assert_equals ($e2-><AG::Node.textContent>, '');
4574    
4575     $test->id ('string.zero.element');
4576     my $e3 = $doc-><M::PCDocument.createPCLiteral> ('0');
4577     $test->assert_isa ($e3, <IFName::PerlStringLiteral>);
4578     $test->assert_equals ($e3-><AG::Node.textContent>, '0');
4579 wakaba 1.43
4580     @Method:
4581 wakaba 1.44 @@Name: createPCNumberLiteral
4582     @@enDesc:
4583     Creates a number literal object.
4584     @@Param:
4585     @@@Name: value
4586     @@@Type: DISPerl|NumberValue
4587     @@@enDesc:
4588     The value.
4589     @@Return:
4590     @@@Type: PCNumberValue
4591     @@@enDesc: The newly created value object.
4592     @@@PerlDef:
4593     __DEEP{
4594     $r = $self-><M::Document.createElementNS>
4595     (<Q::pc:>, 'numberLiteral');
4596     $r-><AS::Node.textContent> ($value);
4597     }__;
4598    
4599     @Method:
4600     @@Name: createPCVariable
4601     @@enDesc:
4602     Creates a new <IF::PerlVariable> object.
4603     @@Param:
4604     @@@Name: variableType
4605     @@@Type: DOMString
4606     @@@enDesc:
4607     Variable prefix.
4608     @@@nullCase:
4609     @@@@enDesc:
4610     If the <P::packageName> is <DOM::null>, then
4611     the <P::variableType> is detected by the prefix of
4612     <P::localName>. Otherwise, it is an unprefixed variable
4613     such as file handle.
4614     @@Param:
4615     @@@Name: packageName
4616     @@@Type: DOMString
4617     @@@enDesc:
4618     Package name.
4619     @@@nullCase:
4620     @@@@enDesc:
4621     The variable belongs to the current package or a
4622     lexical-scoped variable.
4623     @@Param:
4624     @@@Name: localName
4625     @@@Type: DOMString
4626     @@@enDesc:
4627     Variable name. If both <P::variableType> and <P::packageName>
4628     is <DOM::null>, the <P::localName> value may be prefixed
4629     by any possible <P::variableType> value.
4630     @@Return:
4631     @@@Type: PerlVariable
4632     @@@enDesc:
4633     Newly created Perl variable object.
4634     @@@PerlDef:
4635     __DEEP{
4636     $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'variable');
4637     if (not $variableType and not $packageName and
4638     $localName =~ s/^(\\?[\$\@%&*])//) {
4639     $variableType = $1;
4640     }
4641     $r-><AS::PerlVariable.variableType> ($variableType)
4642     if defined $variableType;
4643     $r-><AS::PerlVariable.packageName> ($packageName)
4644     if defined $packageName;
4645     $r-><AS::PerlVariable.pcLocalName> ($localName);
4646     }__;
4647    
4648     @Method:
4649     @@Name: createPCDereference
4650     @@enDesc:
4651     Creates a <IF::PCDereference> object.
4652     @@Param:
4653     @@@Name: variableType
4654     @@@Type: DOMString
4655     @@@enDesc:
4656     The type of the referenced value, such as <Perl::$>.
4657     @@Return:
4658     @@@Type: PCDereference
4659     @@@enDesc:
4660     The newly created element node.
4661     @@@PerlDef:
4662     __DEEP{
4663 wakaba 1.48 $r = $self-><M::Document.createElementNS>
4664     (<Q::pc:>, 'dereference');
4665 wakaba 1.44 $r-><AS::PCDereference.variableType> ($variableType);
4666 wakaba 1.48 }__;
4667    
4668     @Method:
4669     @@Name: createPCReference
4670     @@enDesc:
4671     Creates a <IF::PCReference> object.
4672     @@Return:
4673     @@@Type: PCReference
4674     @@@enDesc:
4675     The newly created element node.
4676     @@@PerlDef:
4677     __DEEP{
4678     $r = $self-><M::Document.createElementNS>
4679     (<Q::pc:>, 'reference');
4680 wakaba 1.44 }__;
4681    
4682     @Method:
4683 wakaba 1.43 @@Name: createPCExpression
4684     @@enDesc:
4685     Creates a <Q::pc:expression> element node.
4686     @@Param:
4687     @@@Name: operator
4688     @@@Type: DOMString
4689     @@@enDesc:
4690     The operator of the expression.
4691     @@Return:
4692     @@@Type: PCExpression
4693     @@@enDesc:
4694     The newly created expression object.
4695     @@@PerlDef:
4696     __DEEP{
4697 wakaba 1.44 $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'expression');
4698 wakaba 1.43 $r-><AS::PCExpression.operator> ($operator);
4699     }__;
4700    
4701     @Method:
4702 wakaba 1.44 @@Name: createPCApply
4703     @@enDesc:
4704     Creates a <Q::pc:apply> element node.
4705     @@Return:
4706     @@@Type: PCApply
4707     @@@enDesc: The newly created element node.
4708     @@@PerlDef:
4709     __DEEP{
4710     $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'apply');
4711     }__;
4712    
4713     @Method:
4714 wakaba 1.43 @@Name: createPCFunctionCall
4715     @@enDesc:
4716 wakaba 1.44 Creates a function call element node.
4717 wakaba 1.43 @@Param:
4718     @@@Name: package
4719     @@@Type: DOMString
4720     @@@enDesc:
4721     The package to which the function belongs.
4722     @@@nullCase:
4723     @@@@enDesc: No package name.
4724     @@Param:
4725     @@@Name: localName
4726     @@@Type: DOMString
4727     @@@enDesc:
4728     The local part of the function name.
4729     @@Return:
4730 wakaba 1.44 @@@Type: PCApply
4731 wakaba 1.43 @@@enDesc:
4732     The newly created function object.
4733     @@@PerlDef:
4734     __DEEP{
4735 wakaba 1.44 $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'apply');
4736     my $func = $self-><M::PCDocument.createPCVariable>
4737     ('', $package, $localName);
4738     $r-><M::Node.appendChild> ($func);
4739     }__;
4740    
4741     @Method:
4742 wakaba 1.46 @@Name: createPCStatement
4743     @@enDesc:
4744     Creates a statement object.
4745     @@Return:
4746     @@@Type: PerlStatement
4747     @@@enDesc:
4748     The newly created statement element node.
4749     @@@PerlDef:
4750     __DEEP{
4751     $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'statement');
4752     }__;
4753    
4754     @Method:
4755 wakaba 1.44 @@Name: createPCBlock
4756     @@enDesc:
4757     Creates a <Q::pc2:block> element node.
4758     @@Return:
4759     @@@Type: PCBlock
4760     @@@enDesc:
4761     The newly created <Q::pc2:block> element.
4762     @@@PerlDef:
4763     __DEEP{
4764     $r = $self-><M::Document.createElementNS> (<Q::pc2:>, 'block');
4765 wakaba 1.43 }__;
4766    
4767     @Method:
4768     @@Name: createPCChoose
4769     @@enDesc:
4770     Creates a <Q::pc:choose> element node.
4771     @@Return:
4772     @@@Type: PCChoose
4773     @@@enDesc:
4774     The newly created <Q::pc:choose> element.
4775     @@@PerlDef:
4776     __DEEP{
4777     $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'choose');
4778 wakaba 1.45 }__;
4779    
4780     @Method:
4781     @@Name: createPCWhile
4782     @@enDesc:
4783     Creates a <Q::pc:while> element node.
4784     @@Return:
4785     @@@Type: PCWhile
4786     @@@enDesc:
4787     The newly created <Q::pc:while> element.
4788     @@@PerlDef:
4789     __DEEP{
4790     $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'while');
4791     $r-><M::Node.appendChild>
4792     ($self-><M::Document.createElementNS> (<Q::pc2:>, 'condition'));
4793     $r-><M::Node.appendChild>
4794     ($self-><M::Document.createElementNS> (<Q::pc2:>, 'block'));
4795 wakaba 1.41 }__;
4796 wakaba 1.46
4797     @Method:
4798     @@Name: createPerlSub
4799     @@enDesc:
4800     Creates a new <IF::PerlSub> object.
4801     @@Param:
4802     @@@Name: subName
4803     @@@Type: DOMString
4804     @@@enDesc:
4805     The name of the subroutine to create.
4806     @@@nullCase:
4807     @@@@enDesc:
4808     The subroutine created has no name.
4809     @@Return:
4810     @@@Type: PerlSub
4811     @@@enDesc:
4812     Newly created Perl subroutine object.
4813     @@@PerlDef:
4814     __DEEP{
4815     $r = $self-><M::Document.createElementNS> (<Q::pc:>, 'sub');
4816     $r-><M::PerlSub.addPerlName> ($subName) if defined $subName;
4817     }__;
4818 wakaba 1.51
4819     @ResourceDef:
4820     @@ForCheck: ManakaiDOM|ForClass
4821     @@QName: createPCDocumentForTest
4822     @@rdf:type: DISPerl|BlockCode
4823     @@PerlDef:
4824     my $impl = <Class::ManakaiPCImplementation>->_new;
4825     $doc = $impl-><M::DOMImpl.createDocument> (<Q::pc:>, 'file');
4826 wakaba 1.41 ##PCDocument
4827    
4828 wakaba 1.39 ## -- Implementation
4829 wakaba 1.6
4830 wakaba 1.25 IFClsDef:
4831     @IFQName: PCImplementation
4832 wakaba 1.35 @CQName: ManakaiPCImplementation
4833 wakaba 1.25
4834 wakaba 1.1 @enDesc:
4835     The class that provides factory methods.
4836 wakaba 1.20
4837 wakaba 1.35 @CISA: DOMCore|ManakaiDOMImplementation||ManakaiDOM|ManakaiDOMLatest
4838     @CISA: dx|ManakaiDefaultExceptionHandler||ManakaiDOM|Perl
4839 wakaba 1.17
4840 wakaba 1.35 @f:provides: pc|CoreFeature10
4841 wakaba 1.1
4842     @Method:
4843     @@Name: createPerlFile
4844     @@enDesc:
4845     Creates a Perl code file.
4846     @@Return:
4847 wakaba 1.25 @@@Type: PerlFile
4848 wakaba 1.1 @@@enDesc: A newly created Perl source file object.
4849     @@@PerlDef:
4850 wakaba 1.35 __DEEP{
4851     $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
4852     -><AG::Document.documentElement>;
4853     }__;
4854 wakaba 1.1
4855 wakaba 1.13 @Method:
4856     @@Name: createPerlPackage
4857     @@enDesc:
4858     Creates a new package scope block.
4859     @@Param:
4860     @@@Name: packageName
4861 wakaba 1.35 @@@Type: DOMString
4862 wakaba 1.13 @@@enDesc:
4863     The fully-qualified name of the package to create.
4864     @@Return:
4865 wakaba 1.25 @@@Type: PerlPackage
4866 wakaba 1.13 @@@enDesc:
4867     The newly created package scope object.
4868     @@@PerlDef:
4869 wakaba 1.35 __DEEP{
4870 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
4871 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'package');
4872     $r-><AS::PerlPackage.packageName> ($packageName);
4873     }__;
4874 wakaba 1.13
4875 wakaba 1.1 @IntMethod:
4876 wakaba 1.25 @@ForCheck: ManakaiDOM|ForClass
4877 wakaba 1.1 @@Name: perlComment
4878     @@ManakaiDOM:isStatic:1
4879     @@enDesc:
4880     Generates a Perl comment string.
4881     @@Param:
4882     @@@Name: str
4883 wakaba 1.35 @@@Type: DOMString
4884 wakaba 1.1 @@@enDesc:
4885     A comment text.
4886     @@Return:
4887 wakaba 1.35 @@@Type: DOMString
4888 wakaba 1.1 @@@enDesc:
4889     A Perl comment string.
4890     @@@PerlDef:
4891     $r = $str;
4892     $r =~ s/\n/\n## /g;
4893     $r =~ s/\n## $/\n/s;
4894     $r .= "\n" unless $r =~ /\n$/;
4895     $r = q<## > . $r;
4896    
4897     @IntMethod:
4898 wakaba 1.25 @@ForCheck: ManakaiDOM|ForClass
4899 wakaba 1.1 @@Name: rfc3339DateTime
4900     @@ManakaiDOM:isStatic:1
4901     @@enDesc:
4902     Returns RFC 3339 <CODE::date-time> representation of a date.
4903     @@Param:
4904     @@@Name: perlDate
4905 wakaba 1.35 @@@Type: idl|unsignedLong||ManakaiDOM|all
4906 wakaba 1.1 @@@enDesc:
4907     A Perl representation of date.
4908     @@Return:
4909 wakaba 1.35 @@@Type: DOMString
4910 wakaba 1.1 @@@enDesc:
4911     RFC 3339 date string.
4912     @@@PerlDef:
4913     my @time = gmtime $perlDate;
4914     $r = sprintf q<%04d-%02d-%02dT%02d:%02d:%02d+00:00>,
4915     $time[5] + 1900, $time[4] + 1, @time[3,2,1,0];
4916    
4917     @IntMethod:
4918 wakaba 1.25 @@ForCheck: ManakaiDOM|ForClass
4919 wakaba 1.1 @@Name: versionDateTime
4920     @@ManakaiDOM:isStatic:1
4921     @@enDesc:
4922     Returns date for version.
4923     @@Param:
4924     @@@Name: perlDate
4925 wakaba 1.35 @@@Type: idl|unsignedLong||ManakaiDOM|all
4926 wakaba 1.1 @@@enDesc:
4927     A Perl representation of date.
4928     @@Return:
4929 wakaba 1.35 @@@Type: DOMString
4930 wakaba 1.1 @@@enDesc:
4931     A Perl number literal.
4932     @@@PerlDef:
4933     my @time = gmtime $perlDate;
4934     $r = sprintf q<%04d%02d%02d.%02d%02d>,
4935     $time[5] + 1900, $time[4] + 1, @time[3,2,1];
4936    
4937     @Method:
4938     @@Name: perlLiteral
4939     @@enDesc:
4940     Perl code representation.
4941     @@Param:
4942     @@@Name: val
4943 wakaba 1.35 @@@Type: DISPerl|Any||ManakaiDOM|all
4944 wakaba 1.1 @@@enDesc:
4945     A Perl value.
4946     @@Return:
4947 wakaba 1.35 @@@Type: DOMString
4948 wakaba 1.1 @@@enDesc:
4949     A Perl lexical representation of <P::val>.
4950     @@@PerlDef:
4951     unless (defined $val) {
4952     $r = q<undef>;
4953     } elsif (ref $val eq 'ARRAY') {
4954     __DEEP{
4955 wakaba 1.36 $r = q<[> . <ClassM::ManakaiPCImplementation
4956 wakaba 1.14 .perlList> ($val) . q<]>;
4957 wakaba 1.1 }__;
4958     } elsif (ref $val eq 'HASH') {
4959     __DEEP{
4960 wakaba 1.31 $r = q<{>
4961 wakaba 1.36 . <ClassM::ManakaiPCImplementation.perlList>
4962 wakaba 1.31 ([map {$_ => $val->{$_}} sort {$a cmp $b} keys %$val])
4963     . q<}>;
4964 wakaba 1.1 }__;
4965 wakaba 1.38 } elsif (ref $val eq 'manakai::code') {
4966     $r = $$val;
4967 wakaba 1.1 } else {
4968     $val =~ s/(['\\])/\\$1/g;
4969     $r = q<'> . $val . q<'>;
4970     }
4971    
4972     @Method:
4973     @@Name: perlList
4974     @@enDesc:
4975     Perl code representation of a list.
4976     @@Param:
4977     @@@Name: val
4978 wakaba 1.35 @@@Type: DISPerl|ARRAY||ManakaiDOM|all
4979 wakaba 1.1 @@@enDesc:
4980     A Perl array reference.
4981     @@Return:
4982 wakaba 1.35 @@@Type: DOMString
4983 wakaba 1.1 @@@enDesc:
4984     A Perl lexical representation of <CODE::@$val>.
4985     @@@PerlDef:
4986     __DEEP{
4987 wakaba 1.36 $r = join (q<, >, map {<ClassM::ManakaiPCImplementation
4988 wakaba 1.1 .perlLiteral> ($_)} @{$val});
4989     }__;
4990 wakaba 1.5
4991     @Method:
4992     @@Name: createPerlSub
4993     @@enDesc:
4994 wakaba 1.35 Creates a new <IF::PerlSub> object.
4995 wakaba 1.5 @@Param:
4996     @@@Name: subName
4997 wakaba 1.35 @@@Type: DOMString
4998 wakaba 1.5 @@@enDesc:
4999     The name of the subroutine to create.
5000     @@@nullCase:
5001     @@@@enDesc:
5002     The subroutine created has no name.
5003     @@Return:
5004 wakaba 1.25 @@@Type: PerlSub
5005 wakaba 1.5 @@@enDesc:
5006     Newly created Perl subroutine object.
5007     @@@PerlDef:
5008 wakaba 1.35 __DEEP{
5009 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
5010 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'sub');
5011     $r-><M::PerlSub.addPerlName> ($subName) if defined $subName;
5012     }__;
5013 wakaba 1.5
5014     @Method:
5015     @@Name: createPerlUnparsedCode
5016     @@enDesc:
5017     Creates a new <Class::ManakaiPerlUnparsedCode> object.
5018     @@Param:
5019     @@@Name: codeArg
5020 wakaba 1.35 @@@Type: DOMString
5021 wakaba 1.5 @@@enDesc:
5022     The code fragment.
5023     @@@nullCase:
5024     @@@@enDesc:
5025     The fragment initially has no code.
5026     @@Return:
5027 wakaba 1.25 @@@Type: PerlUnparsedCode
5028 wakaba 1.5 @@@enDesc:
5029     Newly created Perl code object.
5030     @@@PerlDef:
5031 wakaba 1.35 __DEEP{
5032 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
5033 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'unparsed');
5034     $r-><AS::Node.textContent> ($codeArg) if defined $codeArg;
5035     }__;
5036 wakaba 1.6
5037     @Method:
5038     @@Name: createPerlInlineContainer
5039     @@enDesc:
5040 wakaba 1.35 Creates a new <IF::PerlInlineContainer> object.
5041 wakaba 1.6 @@Return:
5042 wakaba 1.25 @@@Type: PerlCodeInlines
5043 wakaba 1.6 @@@enDesc:
5044     Newly created Perl code object.
5045     @@@PerlDef:
5046 wakaba 1.35 __DEEP{
5047 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
5048 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'inlineContainer');
5049     }__;
5050 wakaba 1.6
5051     @Method:
5052     @@Name: createPerlInlineUnparsedCode
5053     @@enDesc:
5054 wakaba 1.35 Creates a new <IF::PerlInlineUnparsedCode> object.
5055 wakaba 1.6 @@Param:
5056     @@@Name: codeArg
5057 wakaba 1.35 @@@Type: DOMString
5058 wakaba 1.6 @@@enDesc:
5059     The code fragment.
5060     @@@nullCase:
5061     @@@@enDesc:
5062     The fragment initially has no code.
5063     @@Return:
5064 wakaba 1.25 @@@Type: PerlInlineUnparsedCode
5065 wakaba 1.6 @@@enDesc:
5066     Newly created Perl code object.
5067     @@@PerlDef:
5068 wakaba 1.35 __DEEP{
5069 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
5070 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'inlineUnparsed');
5071     $r-><AS::Node.textContent> ($codeArg) if defined $codeArg;
5072     }__;
5073 wakaba 1.6
5074     @Method:
5075     @@Name: createPerlBare
5076     @@enDesc:
5077 wakaba 1.35 Creates a new <IF::PerlTokens> object.
5078 wakaba 1.6 @@Param:
5079     @@@Name: codeArg
5080 wakaba 1.35 @@@Type: DOMString
5081 wakaba 1.6 @@@enDesc:
5082     The code fragment.
5083     @@Return:
5084 wakaba 1.25 @@@Type: PerlTokens
5085 wakaba 1.6 @@@enDesc:
5086     Newly created Perl code object.
5087     @@@PerlDef:
5088 wakaba 1.35 __DEEP{
5089 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
5090 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'tokens');
5091     $r-><AS::Node.textContent> ($codeArg) if defined $codeArg;
5092     }__;
5093 wakaba 1.6
5094     @Method:
5095     @@Name: createPerlAtom
5096     @@enDesc:
5097 wakaba 1.35 Creates a new <IF::PerlAtom> object.
5098 wakaba 1.6 @@Param:
5099     @@@Name: codeArg
5100 wakaba 1.35 @@@Type: DOMString
5101 wakaba 1.6 @@@enDesc:
5102     The code fragment.
5103     @@Return:
5104 wakaba 1.25 @@@Type: PerlAtom
5105 wakaba 1.6 @@@enDesc:
5106     Newly created Perl code object.
5107     @@@PerlDef:
5108 wakaba 1.35 __DEEP{
5109 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
5110 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'atom');
5111     $r-><AS::Node.textContent> ($codeArg) if defined $codeArg;
5112     }__;
5113 wakaba 1.6
5114     @Method:
5115     @@Name: createPerlStringLiteral
5116     @@enDesc:
5117 wakaba 1.35 Creates a new <IF::PerlStringLiteral> object.
5118 wakaba 1.6 @@Param:
5119     @@@Name: stringArg
5120 wakaba 1.35 @@@Type: DOMString
5121 wakaba 1.6 @@@enDesc: A string.
5122     @@Return:
5123 wakaba 1.25 @@@Type: PerlStringLiteral
5124 wakaba 1.6 @@@enDesc:
5125     Newly created Perl code object.
5126     @@@PerlDef:
5127 wakaba 1.35 __DEEP{
5128 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
5129 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'stringLiteral');
5130     $r-><AS::Node.textContent> ($stringArg);
5131     }__;
5132 wakaba 1.6
5133     @Method:
5134     @@Name: createPerlVariable
5135     @@enDesc:
5136 wakaba 1.35 Creates a new <IF::PerlVariable> object.
5137 wakaba 1.6 @@Param:
5138     @@@Name: variableType
5139 wakaba 1.35 @@@Type: DOMString
5140 wakaba 1.6 @@@enDesc:
5141     Variable prefix.
5142 wakaba 1.16 @@@nullCase:
5143     @@@@enDesc:
5144     If the <P::packageName> is <DOM::null>, then
5145     the <P::variableType> is detected by the prefix of
5146     <P::localName>. Otherwise, it is an unprefixed variable
5147     such as file handle.
5148 wakaba 1.6 @@Param:
5149     @@@Name: packageName
5150 wakaba 1.35 @@@Type: DOMString
5151 wakaba 1.6 @@@enDesc:
5152     Package name.
5153     @@@nullCase:
5154     @@@@enDesc:
5155     The variable belongs to the current package or a
5156     lexical-scoped variable.
5157     @@Param:
5158     @@@Name: localName
5159 wakaba 1.35 @@@Type: DOMString
5160 wakaba 1.6 @@@enDesc:
5161 wakaba 1.16 Variable name. If both <P::variableType> and <P::packageName>
5162     is <DOM::null>, the <P::localName> value may be prefixed
5163     by any possible <P::variableType> value.
5164 wakaba 1.6 @@Return:
5165 wakaba 1.25 @@@Type: PerlVariable
5166 wakaba 1.6 @@@enDesc:
5167     Newly created Perl variable object.
5168     @@@PerlDef:
5169 wakaba 1.35 __DEEP{
5170 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
5171 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'variable');
5172     if (not $variableType and not $packageName and
5173     $localName =~ s/^(\\?[\$\@%&*])//) {
5174     $variableType = $1;
5175     }
5176     $r-><AS::PerlVariable.variableType> ($variableType)
5177     if defined $variableType;
5178     $r-><AS::PerlVariable.packageName> ($packageName)
5179     if defined $packageName;
5180     $r-><AS::PerlVariable.pcLocalName> ($localName);
5181     }__;
5182 wakaba 1.8
5183     @Method:
5184     @@Name: createPerlBlock
5185     @@enDesc:
5186 wakaba 1.35 Creates a new <IF::PerlBlock> object.
5187 wakaba 1.8 @@Return:
5188 wakaba 1.25 @@@Type: PerlBlock
5189 wakaba 1.8 @@@enDesc:
5190     Newly created Perl code object.
5191     @@@PerlDef:
5192 wakaba 1.35 __DEEP{
5193 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
5194 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'block');
5195     }__;
5196 wakaba 1.9
5197     @Method:
5198     @@Name: createPerlBlockContainer
5199     @@enDesc:
5200     Creates a new <Class::ManakaiPerlBlockContainer> object.
5201     @@Return:
5202 wakaba 1.25 @@@Type: PerlCodeBlocks
5203 wakaba 1.9 @@@enDesc:
5204     Newly created Perl code object.
5205     @@@PerlDef:
5206 wakaba 1.35 __DEEP{
5207 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
5208 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'blockContainer');
5209     }__;
5210 wakaba 1.11
5211     @Method:
5212     @@Name: createPerlStatement
5213     @@enDesc:
5214     Creates a new Perl statement.
5215     @@Param:
5216     @@@Name: codeArg
5217 wakaba 1.35 @@@Type: DOMString
5218 wakaba 1.11 @@@enDesc:
5219     A Perl statement without terminating <Perl::;>.
5220     @@@nullCase:
5221     @@@@enDesc:
5222     No initial content.
5223     @@Return:
5224 wakaba 1.25 @@@Type: PerlStatement
5225 wakaba 1.11 @@@enDesc:
5226     The newly created Perl code object.
5227     @@@PerlDef:
5228 wakaba 1.35 __DEEP{
5229 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
5230 wakaba 1.35 -><M::Document.createElementNS> (<Q::pc:>, 'statement');
5231     if (defined $codeArg) {
5232     $r-><M::PerlCodeUnits.appendBare> ($codeArg);
5233     }
5234     }__;
5235 wakaba 1.12
5236     @Method:
5237     @@Name: createPerlIf
5238     @@enDesc:
5239 wakaba 1.35 Creates a <IF::PerlIf> object.
5240 wakaba 1.12 @@Param:
5241     @@@Name: conditionArg
5242 wakaba 1.35 @@@Type: PerlCodeInlines
5243 wakaba 1.12 @@@enDesc:
5244     Conditoon code fragment object.
5245     @@Param:
5246     @@@Name: trueArg
5247 wakaba 1.35 @@@Type: PerlCodeBlocks
5248 wakaba 1.12 @@@enDesc:
5249     A true code fragment object.
5250     @@@nullCase:
5251     @@@@enDesc: No true code.
5252     @@Param:
5253     @@@Name: falseArg
5254 wakaba 1.35 @@@Type: PerlCodeBlocks
5255 wakaba 1.12 @@@enDesc:
5256     A false code fragment object.
5257     @@@nullCase:
5258     @@@@enDesc: No false code.
5259     @@Return:
5260 wakaba 1.25 @@@Type: PerlIf
5261 wakaba 1.12 @@@RaiseException:
5262     @@@@@:BAD_CHILD_ERR
5263     @@@@enDesc:
5264     An attempt is made to append a child
5265     that is not valid type.
5266     @@@RaiseException:
5267     @@@@@:IN_USE_NODE_ERR
5268     @@@@enDesc:
5269     An attempt is made to append a node that is
5270     already used elsewhere.
5271     @@@PerlDef:
5272 wakaba 1.35 for my $arg ([conditionArg => $conditionArg]) {
5273     if ({
5274     atom => 1, tokens => 1, inlineContainer => 1, assignment => true,
5275     inlineUnparsed => 1, variable => 1, stringLiteral => true,
5276 wakaba 1.41 list => true, arrayRefLiteral => true, hashRefLiteral => true,
5277 wakaba 1.35 }->{$arg->[1]-><AG::Node.localName>}) {
5278     if ($arg->[1]-><AG::Node.parentNode>) {
5279     __EXCEPTION{IN_USE_NODE_ERR::
5280     pc:childNode => {$arg->[1]},
5281     MDOMX:param-name => {$arg->[0]},
5282     }__;
5283     }
5284     } else {
5285     __EXCEPTION{BAD_CHILD_ERR::
5286     pc:parentNode => {$self},
5287     pc:childNode => {$arg->[1]},
5288     MDOMX:param-name => {$arg->[0]},
5289     }__;
5290     }
5291     } # c
5292    
5293     for my $arg ([trueArg => $trueArg],
5294     [falseArg => $falseArg]) {
5295     next unless $arg->[1];
5296     if ({
5297     blockContainer => true,
5298     }->{$arg->[1]-><AG::Node.localName>}) {
5299     if ($arg->[1]-><AG::Node.parentNode>) {
5300     __EXCEPTION{IN_USE_NODE_ERR::
5301     pc:childNode => {$arg->[1]},
5302     MDOMX:param-name => {$arg->[0]},
5303     }__;
5304     }
5305     } else {
5306     __EXCEPTION{BAD_CHILD_ERR::
5307     pc:parentNode => {$self},
5308     pc:childNode => {$arg->[1]},
5309     MDOMX:param-name => {$arg->[0]},
5310     }__;
5311     }
5312     } # t/f
5313    
5314     __DEEP{
5315 wakaba 1.41 $r = $self-><M::DOMImpl.createDocument> (<Q::pc:>, 'file')
5316 wakaba 1.35 -><M::Document.createElementNS>
5317     (<Q::pc:>, 'if');
5318     $r-><AS::PerlIf.condition> ($conditionArg) if $conditionArg;
5319     $r-><AS::PerlIf.trueCode> ($trueArg) if $trueArg;
5320     $r-><AS::PerlIf.falseCode> ($falseArg) if $falseArg;
5321     }__;
5322 wakaba 1.25 ##PCImplementation
5323 wakaba 1.1
5324 wakaba 1.5 ResourceDef:
5325 wakaba 1.35 @QName: DOMImpl
5326     @AliasFor: DOMCore|DOMImplementation
5327 wakaba 1.41 @For: ManakaiDOM|DOM
5328    
5329     ResourceDef:
5330     @QName: NodeList
5331     @AliasFor: DOMCore|NodeList
5332 wakaba 1.35 @For: ManakaiDOM|DOM
5333    
5334     ResourceDef:
5335     @QName: Node
5336     @AliasFor: DOMCore|Node
5337     @For: ManakaiDOM|DOM
5338    
5339     ResourceDef:
5340     @QName: Element
5341     @AliasFor: DOMCore|Element
5342     @For: ManakaiDOM|DOM
5343    
5344     ResourceDef:
5345     @QName: Document
5346     @AliasFor: DOMCore|Document
5347     @For: ManakaiDOM|DOM
5348    
5349 wakaba 1.4 ## -- Exceptions
5350    
5351 wakaba 1.25 ResourceDef:
5352     @rdf:type:
5353     @@@: dis|MultipleResource
5354     @@ForCheck: !ManakaiDOM|ForIF !ManakaiDOM|ForClass
5355     @resourceFor: ManakaiDOM|ForIF
5356     @resourceFor: ManakaiDOM|ForClass
5357    
5358     @For: ManakaiDOM|Perl
5359    
5360     @rdf:type:
5361 wakaba 1.33 @@@: dx|Interface
5362 wakaba 1.25 @@ForCheck: ManakaiDOM|ForIF
5363    
5364     @rdf:type:
5365 wakaba 1.33 @@@: dx|Class
5366 wakaba 1.25 @@ForCheck: ManakaiDOM|ForClass
5367    
5368     @Implement:
5369 wakaba 1.35 @@@: ||ManakaiDOM|ManakaiDOM|ManakaiDOM||ManakaiDOM|ForIF
5370     @@ContentType: DISCore|TFPQNames
5371     @@ForCheck: ManakaiDOM|ForClass
5372     @Implement:
5373     @@@: ||ManakaiDOM|ManakaiDOM|ManakaiDOMLatest||ManakaiDOM|ForIF
5374 wakaba 1.25 @@ContentType: DISCore|TFPQNames
5375     @@ForCheck: ManakaiDOM|ForClass
5376 wakaba 1.35 @dx:implementedBy: ||ManakaiDOM|ManakaiDOMLatest||ManakaiDOM|ForClass
5377 wakaba 1.25
5378 wakaba 1.35 @f:implements: pc|CoreFeature10
5379 wakaba 1.25
5380     @ISA:
5381 wakaba 1.33 @@@: dx|Exception||ManakaiDOM|Perl
5382 wakaba 1.25 @@ForCheck: ManakaiDOM|ForClass
5383    
5384     @IFQName: PCException
5385 wakaba 1.35 @QName:
5386     @@@: ManakaiPCException
5387     @@ForCheck: ManakaiDOM|ForClass
5388 wakaba 1.25
5389 wakaba 1.4 @enDesc:
5390 wakaba 1.25 Exceptions for the <Module::Util:PerlCode> module.
5391    
5392     @ResourceDef:
5393 wakaba 1.33 @@ForCheck: ManakaiDOM|ForIF
5394     @@rdf:type: DISLang|ConstGroup
5395 wakaba 1.25
5396     @@IFQName: PCExceptionCode
5397    
5398 wakaba 1.4 @@enDesc:
5399 wakaba 1.25 Exception codes for <IF::PCException>.
5400    
5401 wakaba 1.33 @@Type: idl|unsignedShort||ManakaiDOM|all
5402     @@rdfs:subClassOf: idl|unsignedShort||ManakaiDOM|all
5403 wakaba 1.25
5404 wakaba 1.5 @@XConstDef:
5405     @@@Name: HIERARCHY_REQUEST_ERR
5406 wakaba 1.27 @@@Value:
5407     @@@@@:3
5408     @@@@ContentType: DISCore|Integer
5409 wakaba 1.5 @@@enDesc:
5410     An attempt is made to break the hierarchy.
5411     @@@XSubTypeDef:
5412     @@@@QName: BAD_CHILD_ERR
5413     @@@@enDesc:
5414     An attempt is made to append a node as a child whose type
5415     is not allowed.
5416     @@@@XParam:
5417     @@@@@QName: childNode
5418     @@@@@enDesc:
5419     The node attempted to append.
5420     @@@@XParam:
5421     @@@@@QName: parentNode
5422     @@@@@enDesc:
5423     The node to whose child list an attempt to append is made.
5424     @@@XSubTypeDef:
5425     @@@@QName: IN_USE_NODE_ERR
5426     @@@@enDesc:
5427     An attempt is made to append a node that has already been used
5428     elsewhere.
5429     @@@@XParam:
5430     @@@@@QName: childNode
5431     @@@@@enDesc:
5432     The node attempted to append.
5433     @@@@XParam:
5434     @@@@@QName: parentNode
5435     @@@@@enDesc:
5436     The parent node of the <XP::childNode>.
5437 wakaba 1.4 @@XConstDef:
5438     @@@Name: NOT_SUPPORTED_ERR
5439 wakaba 1.27 @@@Value:
5440     @@@@@:9
5441     @@@@ContentType: DISCore|Integer
5442 wakaba 1.4 @@@enDesc:
5443     An attempt is made to do something the implementation does not support.
5444     @@@XSubTypeDef:
5445     @@@@QName: UNSUPPORTED_OPERATOR_ERR
5446     @@@@enDesc:
5447     The implementation does not support the specified operator.
5448     @@@@XParam:
5449     @@@@@QName: operator
5450     @@@@@enDesc:
5451     The operator that is not supported.
5452     @@@@enMufDef:
5453     Operator "%p (name => {<Q::pc:operator>});" is not supported
5454 wakaba 1.25 ##PCException
5455 wakaba 1.4
5456     ElementTypeBinding:
5457     @Name: XConstDef
5458     @ElementType:
5459     dis:ResourceDef
5460     @ShadowContent:
5461 wakaba 1.33 @@rdf:type: dx|ErrorCode
5462 wakaba 1.4
5463     ElementTypeBinding:
5464     @Name: XSubTypeDef
5465     @ElementType:
5466     dis:ResourceDef
5467     @ShadowContent:
5468 wakaba 1.33 @@rdf:type: dx|ErrorSubCode
5469 wakaba 1.4
5470     ElementTypeBinding:
5471     @Name: XParam
5472     @ElementType:
5473 wakaba 1.33 ecore:hasParameter
5474 wakaba 1.4
5475     ElementTypeBinding:
5476     @Name: XParamDef
5477     @ElementType:
5478     dis:ResourceDef
5479     @ShadowContent:
5480 wakaba 1.33 @@rdf:type: ecore|Parameter
5481 wakaba 1.27 @@For: =ManakaiDOM|all
5482 wakaba 1.4
5483     ElementTypeBinding:
5484     @Name: enMufDef
5485     @ElementType:
5486 wakaba 1.40 ecore:defaultMessage
5487 wakaba 1.4 @ShadowContent:
5488     @@ContentType:
5489     lang:muf
5490     @@lang:en
5491    
5492 wakaba 1.1 ElementTypeBinding:
5493     @Name: Method
5494     @ElementType:
5495     dis:ResourceDef
5496     @ShadowContent:
5497     @@rdf:type:
5498     DISLang:Method
5499    
5500     ElementTypeBinding:
5501     @Name: ToStringMethod
5502     @ElementType:
5503     dis:ResourceDef
5504     @ShadowContent:
5505     @@rdf:type:
5506     DISLang:Method
5507     @@Operator:
5508     @@@@:
5509     DISPerl:AsStringMethod
5510 wakaba 1.35 @@@ContentType: DISCore|QName
5511 wakaba 1.1 @@Description:
5512     @@@lang:en
5513     @@@@:
5514     Returns the textual Perl source code representation of this object.
5515 wakaba 1.9
5516 wakaba 1.14 ElementTypeBinding:
5517     @Name: NumValMethod
5518     @ElementType:
5519     dis:ResourceDef
5520     @ShadowContent:
5521     @@rdf:type:
5522     DISLang:Method
5523     @@Operator:
5524     @@@@: 0+
5525     @@@ContentType:
5526     lang:Perl
5527     @@Description:
5528     @@@lang:en
5529     @@@@:
5530     Returns the numeric value of this object.
5531 wakaba 1.9
5532     ElementTypeBinding:
5533 wakaba 1.1 @Name: IntMethod
5534     @ElementType:
5535     dis:ResourceDef
5536     @ShadowContent:
5537     @@rdf:type:
5538     DISLang:Method
5539     @@ManakaiDOM:isForInternal:1
5540    
5541     ElementTypeBinding:
5542     @Name: Attr
5543     @ElementType:
5544     dis:ResourceDef
5545     @ShadowContent:
5546     @@rdf:type:
5547     DISLang:Attribute
5548    
5549     ElementTypeBinding:
5550     @Name: Return
5551     @ElementType:
5552     dis:ResourceDef
5553     @ShadowContent:
5554     @@rdf:type:
5555     DISLang:MethodReturn
5556    
5557     ElementTypeBinding:
5558     @Name: Get
5559     @ElementType:
5560     dis:ResourceDef
5561     @ShadowContent:
5562     @@rdf:type:
5563     DISLang:AttributeGet
5564    
5565     ElementTypeBinding:
5566     @Name: Set
5567     @ElementType:
5568     dis:ResourceDef
5569     @ShadowContent:
5570     @@rdf:type:
5571     DISLang:AttributeSet
5572    
5573     ElementTypeBinding:
5574     @Name: Param
5575     @ElementType:
5576     dis:ResourceDef
5577     @ShadowContent:
5578     @@rdf:type:
5579     DISLang:MethodParameter
5580    
5581     ElementTypeBinding:
5582     @Name: PerlDef
5583     @ElementType:
5584     dis:Def
5585     @ShadowContent:
5586     @@ContentType:
5587     lang:Perl
5588 wakaba 1.27 @@ForCheck: ManakaiDOM|ForClass
5589 wakaba 1.28
5590     ElementTypeBinding:
5591     @Name: PerlCDef
5592     @ElementType:
5593     dis:Def
5594     @ShadowContent:
5595     @@ContentType:
5596     lang:Perl
5597 wakaba 1.1
5598     ElementTypeBinding:
5599     @Name: disDef
5600     @ElementType:
5601     dis:Def
5602     @ShadowContent:
5603     @@ContentType:
5604     lang:dis
5605 wakaba 1.27 @@ForCheck: ManakaiDOM|ForClass
5606 wakaba 1.1
5607     ElementTypeBinding:
5608     @Name: InCase
5609     @ElementType:
5610     dis:ResourceDef
5611     @ShadowContent:
5612     @@rdf:type:
5613     ManakaiDOM:InCase
5614    
5615     ElementTypeBinding:
5616     @Name: nullCase
5617     @ElementType:
5618     dis:ResourceDef
5619     @ShadowContent:
5620     @@rdf:type:
5621     ManakaiDOM:InCase
5622     @@Value:
5623     @@@is-null:1
5624    
5625     ElementTypeBinding:
5626     @Name: TrueCase
5627     @ElementType:
5628     dis:ResourceDef
5629     @ShadowContent:
5630     @@rdf:type:
5631     ManakaiDOM:InCase
5632 wakaba 1.27 @@Value:
5633     @@@@:1
5634     @@@ContentType: DISCore|Boolean
5635 wakaba 1.1 @@Type:
5636 wakaba 1.12 DOMMain:boolean::ManakaiDOM:all
5637 wakaba 1.1
5638    
5639     ElementTypeBinding:
5640     @Name: FalseCase
5641     @ElementType:
5642     dis:ResourceDef
5643     @ShadowContent:
5644     @@rdf:type:
5645     ManakaiDOM:InCase
5646 wakaba 1.27 @@Value:
5647     @@@@:0
5648     @@@ContentType: DISCore|Boolean
5649 wakaba 1.1 @@Type:
5650 wakaba 1.12 DOMMain:boolean::ManakaiDOM:all
5651 wakaba 1.1
5652     ElementTypeBinding:
5653     @Name: enDesc
5654     @ElementType:
5655     dis:Description
5656     @ShadowContent:
5657     @@lang:en
5658    
5659     ElementTypeBinding:
5660     @Name: PropDef
5661     @ElementType:
5662     dis:ResourceDef
5663     @ShadowContent:
5664     @@rdf:type:
5665     rdf:Property
5666 wakaba 1.27 @@For: =ManakaiDOM|all
5667 wakaba 1.1
5668     ElementTypeBinding:
5669     @Name: NamedParam
5670     @ElementType:
5671     dis:ResourceDef
5672     @ShadowContent:
5673     @@rdf:type:
5674     DISLang:MethodParameter
5675     @@DISPerl:isNamedParameter:1
5676    

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24