/[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.61 - (hide annotations) (download)
Mon Apr 3 12:53:25 2006 UTC (19 years, 3 months ago) by wakaba
Branch: MAIN
Changes since 1.60: +191 -269 lines
++ manakai/bin/ChangeLog	3 Apr 2006 11:17:32 -0000
2006-04-03  Wakaba  <wakaba@suika.fam.cx>

	* daf.pl (perl-pm): Sets the |impl| argument
	of the |pl_generate_perl_module| method.

++ manakai/lib/Message/Util/ChangeLog	3 Apr 2006 12:18:05 -0000
2006-04-03  Wakaba  <wakaba@suika.fam.cx>

	* Grove.dis (mg:mutations): It is changed from array
	reference to hash reference.

	* PerlCode.dis (replaceVariable): The |pc2:| namespace
	support.
	(IN_USE_NODE_ERR, BAD_CHILD_ERR): Removed.
	(createPCIf, createPCPackage): New methods.
	(createPCFile): Renamed from |createPerlFile|.  Set
	configuration parameters.

++ manakai/lib/Message/Util/DIS/ChangeLog	3 Apr 2006 12:25:32 -0000
2006-04-03  Wakaba  <wakaba@suika.fam.cx>

	* DNLite.dis (plImplementation): Removed.

	* Perl.dis (plImplementation): Removed.
	(plCodeFragment): Changed from attribute to method.
	(plValueCodeFragment, plCodeFragment): The |factory|
	parameter is added.
	(plPreprocessPerlCode, plPreprocessPerlStatement, plAppendThrow):
	The |factory| parameter is added.
	(ManakaiDOM:InputNormalize, dis:GetNodeProp): Removed.
	(plIsDefined): Removed.
	($NS_URI_NO_NULL): Removed.
	(setDefaultValue): Removed.

++ manakai/lib/Message/DOM/ChangeLog	3 Apr 2006 12:04:56 -0000
2006-04-03  Wakaba  <wakaba@suika.fam.cx>

	* DOMMain.dis (GetPropNode, CheckReadOnly): Removed.

	* Node.dis (cfg:dtd-default-attribute): The configuration
	parameter |cfg:dtd-default-attributes| is renamed
	as |cfg:dtd-default-attribute|.
	(Roles): Definitions are changed so that classes
	that implement those classes MUST implement the |Node|
	and its subinterfaces.
	(cfg:dtd-attribute-type): New configuration parameter.

	* Document.dis (adoptNode): Don't throw exception
	if |strictErrorChecking| is |false|.

	* Element.dis (setAttribute, setAttributeNS): Don't
	set [attribute type] if the |cfg:dtd-attribute-type|
	configuration parameter is set to |false|.
	(removeAttribute, removeAttributeNS, removeAttributeNode): Don't
	regenerate default attribute nodes if the |cfg:dtd-default-attribute|
	configuration parameter is set to |false|.

++ manakai/lib/manakai/ChangeLog	3 Apr 2006 12:26:00 -0000
2006-04-03  Wakaba  <wakaba@suika.fam.cx>

	* DISLang.dis (ManakaiDOM:InputNormalize): Removed.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24