/[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.54 - (hide annotations) (download)
Thu Feb 9 10:23:20 2006 UTC (19 years, 5 months ago) by wakaba
Branch: MAIN
Changes since 1.53: +110 -2 lines
++ manakai/bin/ChangeLog	9 Feb 2006 10:13:54 -0000
2006-02-09  Wakaba  <wakaba@suika.fam.cx>

	* dac2test.pl: Set |pc:preserve-line-break| configuration
	parameter |true|.

++ manakai/lib/Message/Util/ChangeLog	9 Feb 2006 10:20:03 -0000
2006-02-09  Wakaba  <wakaba@suika.fam.cx>

	* PerlCode.dis (PerlStringLiteral.stringify): |pc:preserve-line-break|
	configuration parameter support is added.
	(pc:preserve-line-break): New configuration option.

	* DIS.dis (readProperties): |DISCore:UString| lextype support added.

++ manakai/lib/Message/Util/DIS/ChangeLog	9 Feb 2006 10:22:14 -0000
2006-02-09  Wakaba  <wakaba@suika.fam.cx>

	* Test.dis (printComment): Escapes non-ASCII-printable characters.

	* DPG.dis (state_to_code): Adds set-|$token->{location_d}|-code
	to adjast column number when |@dch| is in use.

++ manakai/lib/Message/DOM/ChangeLog	9 Feb 2006 10:18:41 -0000
2006-02-09  Wakaba  <wakaba@suika.fam.cx>

	* XMLParser.dis (CommentDeclaration): |STRING| is now
	defined as a |?default-token|.
	(XMLTests): Tests for |Char - RestrictedChar| matchness,
	comment declarations, cdata sections, and |MSE| in |content|
	added.
	(XMLTests/PerlDef): Bug fixed: |pop| -> |shift|.
	(get-location-from-token): |$token->{location_d}|
	for |?default-token| column counting support added.

	* DOMCore.dis (c:erred): It is now a |DISCore:OrderedList| property.

++ manakai/lib/manakai/ChangeLog	9 Feb 2006 10:23:11 -0000
2006-02-09  Wakaba  <wakaba@suika.fam.cx>

	* DISCore.dis (DISCore:UString): New lextype.

	* Test.dis (test:value): Default |dis:dataType| changed
	to |DISCore:UString|.
	(test:EntityValueString): Removed (it was never used).

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24