/[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.52 - (hide annotations) (download)
Wed Feb 8 08:18:30 2006 UTC (19 years, 5 months ago) by wakaba
Branch: MAIN
Changes since 1.51: +63 -10 lines
++ manakai/bin/ChangeLog	8 Feb 2006 07:59:04 -0000
2006-02-08  Wakaba  <wakaba@suika.fam.cx>

	* dac2test.pl (|test:ParserTest| converter): |c:erred| is supported.

++ manakai/lib/Message/Util/ChangeLog	8 Feb 2006 08:07:42 -0000
2006-02-08  Wakaba  <wakaba@suika.fam.cx>

	* PerlCode.dis (getNameListAttrR): Non-|pc:|-namespace elements
	and their descendants were ignored.
	(getNameListAttrRM): New variant derived from |getNameListAttrR|,
	for |getUsePerlModuleNameList| and |getUseCharClassNameList|.
	(getUsePerlModuleNameList, getUseCharClassNameList): Don't
	include |pc:package| and their descendants to the target.
	(PerlFile.stringify): Outputs |use| statements
	for Perl modules and character classes not part of any package,
	if any.

	* DIS.dis: |lang:tdterr|'s |DVNSValue| convertion is supported.

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

	* DIS.dis (loadModule): Loads a "daem" submodule file
	if exists.

++ manakai/lib/Message/Util/Error/ChangeLog	8 Feb 2006 08:17:54 -0000
2006-02-06  Wakaba  <wakaba@suika.fam.cx>

	* DOMException.dis (ManakaiDOM:WarningClass): Removed.
	(ManakaiDOM:alwaysWarns): Removed.
	(disPerl:WARNING): Removed.
	(ManakaiDOM:ManakaiDOMExceptionOrWarning): Removed.
	(ManakaiDOM:ManakaiDOMWarning): Removed.

++ manakai/lib/Message/Util/DIS/ChangeLog	8 Feb 2006 08:16:38 -0000
2006-02-08  Wakaba  <wakaba@suika.fam.cx>

	* Value.dis: |lang:tdterr| type support is added.

	* Test.dis (failureComment): New method.
	(TFQNames): New token type.
	(rule node): It now accepts empty declaration.

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

	* Test.dis (assertTypedValueEquals): New code fragment
	extracted from |assertDOMTreeEquals| method.
	(assertErrorEquals): New method.

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

	* Test.dis (Require): Requires |Util:DIS| module.
	(parseTDTErrorString): New method.
	(URI, QName): New token types.
	(rule tdterr): New parser rule.
	(dtest:undeclared-namespace-prefix-error): New error.
	(dtest:bad-error-resource-error): New error.

++ manakai/lib/Message/DOM/ChangeLog	8 Feb 2006 08:01:24 -0000
2006-02-08  Wakaba  <wakaba@suika.fam.cx>

	* XMLParser.dis (XMLTests): Tests for |c:erred| is supported.

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

	* DOMCore.dis (c:erred): New property.
	(c:DOMErrorType): It should have been a subset
	of |ecore:AnyErrorCode|.

	* XMLParser.dis (XMLTests): Empty input tests added.

++ manakai/lib/manakai/ChangeLog	8 Feb 2006 08:18:20 -0000
2006-02-06  Wakaba  <wakaba@suika.fam.cx>

	* Test.dis (lang:tdterr): New type.

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24