/[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.9 - (hide annotations) (download)
Sat Apr 2 07:43:15 2005 UTC (20 years, 3 months ago) by wakaba
Branch: MAIN
Changes since 1.8: +409 -46 lines
PerlCode clone methods implemented

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     @Author:
18     @@FullName: Wakaba
19     @@Mail: w@suika.fam.cx
20     @License:
21     @@@:
22     license:Perl+MPL
23     @@Original:
24     @@@FullName:
25     manakai <CODE::lib/manakai/genlib.pl>
26     @@@Year:2004
27     @@@Author:
28     @@@@FullName:Wakaba
29     @@@@Mail:w@suika.fam.cx
30     @Date:
31     @@@:
32 wakaba 1.9 $Date: 2005/04/01 07:58:46 $
33 wakaba 1.1 @@ContentType:
34     dis:Date.RCS
35    
36     @Require:
37     @@Module:
38     @@@Name: ManakaiNode
39     @@@WithFor:
40     ManakaiDOM:Perl
41     @@Module:
42     @@@Name: DOMBoot
43 wakaba 1.5 @@@QName:
44     MDOM:DOMBoot
45 wakaba 1.1 @@@WithFor:
46     ManakaiDOM:ManakaiDOMLatest
47     @@Module:
48     @@@Name: DOMMetaImpl
49 wakaba 1.5 @@@QName:
50     MDOM:DOMMetaImpl
51 wakaba 1.1 @@@WithFor:
52     ManakaiDOM:ManakaiDOMLatest
53    
54     @DefaultFor:
55     ManakaiDOM:Perl
56    
57     Namespace:
58     @DIS:
59     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/DIS#
60     @dis:
61     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#dis--
62     @dis2pm:
63     http://suika.fam.cx/~wakaba/archive/2004/11/8/dis2pm#
64     @DISlib:
65     http://suika.fam.cx/~wakaba/archive/2004/dis/
66     @DOMCore:
67     http://suika.fam.cx/~wakaba/archive/2004/8/18/dom-core#
68     @DOMLS:
69     http://suika.fam.cx/~wakaba/archive/2004/dom/ls#
70     @DOMMain:
71     http://suika.fam.cx/~wakaba/archive/2004/dom/main#
72     @infoset:
73     http://www.w3.org/2001/04/infoset#
74     @lang:
75     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#
76     @license:
77     http://suika.fam.cx/~wakaba/archive/2004/8/18/license#
78     @ManakaiDOM:
79     http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#
80     @Markup:
81     http://suika.fam.cx/~wakaba/archive/2005/manakai/Markup#
82 wakaba 1.5 @MDOM:
83     http://suika.fam.cx/~wakaba/archive/2004/8/18/manakai-dom#ManakaiDOM.
84 wakaba 1.1 @MDOMX:
85     http://suika.fam.cx/~wakaba/archive/2004/8/4/manakai-dom-exception#
86     @owl:
87     http://www.w3.org/2002/07/owl#
88     @pc:
89     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/PerlCode#
90     @Perl:
91     http://suika.fam.cx/~wakaba/archive/2004/8/18/lang#Perl--
92     @rdf:
93     http://www.w3.org/1999/02/22-rdf-syntax-ns#
94     @rdfs:
95     http://www.w3.org/2000/01/rdf-schema#
96     @swcfg21:
97     http://suika.fam.cx/~wakaba/archive/2005/swcfg21#
98     @TreeCore:\
99     @Util:
100     http://suika.fam.cx/~wakaba/archive/2005/manakai/Util/
101    
102     ## -- Features
103    
104     ElementTypeBinding:
105     @Name: FeatureDef
106     @ElementType:
107     dis:ResourceDef
108     @ShadowContent:
109     @@rdf:type:
110     DOMMain:DOMFeature
111     @@AliasFor:
112     @@@@:
113     ::ManakaiDOM:all
114     @@@For:
115     !=ManakaiDOM:all
116    
117     ElementTypeBinding:
118     @Name: FeatureVerDef
119     @ElementType:
120     dis:ResourceDef
121     @ShadowContent:
122     @@rdf:type:
123     DOMMain:DOMFeature
124    
125     ElementTypeBinding:
126     @Name: featureQName
127     @ElementType:
128     dis:AppName
129     @ShadowContent:
130     @@ContentType:
131     dis:TypeQName
132    
133     FeatureDef:
134     @QName: CoreFeature
135     @featureQName:
136     Util:PerlCode
137     @FeatureVerDef:
138     @@QName: CoreFeature10
139     @@Version: 1.0
140     @@ISA: CoreFeature
141     @@FullName:
142     @@@lang:en
143     @@@@:
144     Perl Code Constructor, version 1.0
145     @@Description:
146     @@@lang:en
147     @@@@:
148     Perl Code Constructor, version 1.0.
149    
150     ## -- Classes
151    
152     ClsDef:
153     @ClsQName: ManakaiPerlCodeFragment
154     @ClsISA:
155     ManakaiDOM:ManakaiDOMNodeReference::ManakaiDOM:Perl
156     @enDesc:
157     A class on which another Perl code classes are constructed based.
158    
159     @IntMethod:
160     @@Operator:
161     @@@@:
162     ManakaiDOM:MUErrorHandler
163     @@@ContentType:
164     dis:TypeQName
165     @@Description:
166     @@@lang:en
167     @@@@:
168     This method is a generic error handler; all manakai exceptions
169     and warnings associated to an object are once reported to this method
170     and then delivered to appropriate entities.
171     \
172     If the error is an exception (such as <X::DOMCore:DOMException> or
173     <X::ManakaiDOM:ManakaiDOMImplementationException>), it is
174     simply thrown. If the error is only a warning, it is reported
175     via the <IF::DOMCore:DOMError> interface.
176     \
177     See <PerlModule::Message::Util::Error> documentation for more
178     information on the error reporting mechanism.
179     \
180     {NOTE:: This kind of methods are named as <Perl::___report_error>
181     in the convention of <PerlModule::Message::Util::Error>.
182     \
183     }
184     @@Param:
185     @@@Name:err
186     @@@Type:
187     ManakaiDOM:ManakaiDOMExceptionOrWarning::ManakaiDOM:Perl
188     @@@Description:
189     @@@@lang:en
190     @@@@@:
191     An exception object that describes what kind of error it is
192     and how it should be recovered.
193     \
194     {NOTE:: Exception objects in manakai implementation
195     inherit the class <PerlModule::Message::Util::Error>,
196     that in turn inherits <PerlModule::Error>.
197     \
198     }
199     @@Return:
200     @@@PerlDef:
201     if ($err->isa (<ClassName::ManakaiDOM:ManakaiDOMException
202     ::ManakaiDOM:Perl>)) {
203     $err->throw;
204     } else {
205     \## TODO: Implement warning reporting
206     warn $err->stringify;
207     }
208    
209     @Attr:
210     @@Name: parentNode
211     @@enDesc:
212     The parent construction of this object.
213     @@Get:
214     @@@Type: ManakaiPerlCodeFragment
215 wakaba 1.5 @@@nullCase:
216     @@@@enDesc:
217     This object has no parent.
218 wakaba 1.1 @@@PerlDef:
219     $r = $self->{<Q::TreeCore:node>}->{<Q::pc:parent>};
220 wakaba 1.6 $r = <ClassM::ManakaiPerlCodeFragment.getNodeReference> ($r) if $r;
221    
222     @Attr:
223     @@Name: fileNode
224     @@enDesc:
225     The root <QUOTE::file> node of the tree to which this node belongs.
226     @@Type: ManakaiPerlCodeFragment
227     @@Get:
228     @@@enDesc:
229     The <QUOTE::file> node of the tree.
230     @@@nullCase:
231     @@@@enDesc:
232     This node does not belong to any file tree.
233     @@@PerlDef:
234     $r = $self->{<Q::TreeCore:node>}->{<Q::pc:parent>};
235     {
236     if ($r->{<Q::pc:parent>}) {
237     $r = $r->{<Q::pc:parent>};
238     redo;
239     }
240     };
241     if ($r) {
242     if ($r->{<Q::pc:nodeType>} eq 'file') {
243     __DEEP{
244     $r = <ClassM::ManakaiPerlCodeFragment.getNodeReference> ($r);
245     }__;
246     } else {
247     $r = null;
248     }
249     } elsif ($self->{<Q::TreeCore:node>}->{<Q::pc:nodeType>} eq 'file') {
250     $r = $self;
251     }
252    
253     @IntMethod:
254     @@Name: getNodeReference
255     @@ManakaiDOM:isStatic:1
256     @@enDesc:
257     Gets a node reference for a node object.
258     @@Param:
259     @@@Name: object
260     @@@Type:
261     ManakaiDOM:ManakaiDOMNodeReference::ManakaiDOM:Perl
262     @@@enDesc:
263     A node object.
264     @@Return:
265     @@@Type:
266     ManakaiDOM:ManakaiDOMNodeReference::ManakaiDOM:Perl
267     @@@PerlDef:
268     my $nt = $object->{<Q::pc:nodeType>};
269     my $pack;
270 wakaba 1.9 __CODE{pc:nodeTypeToPackageName::
271     $nodeType => $nt, $packageName => $pack, $object => $object}__;
272 wakaba 1.6 __CODE{ManakaiNode:getNewReference::
273     $object => $object, $ref => $r, $class => $pack}__;
274    
275     @Method:
276     @@Name: replaceVariable
277     @@enDesc:
278     Replaces a variable.
279     \
280     {NOTE:: For objects of type <Class::ManakaiPerlFile>,
281     <Class::ManakaiPerlPackageScope> and
282     <Class::ManakaiPerlSub>, the result is undefined.
283     \
284     }
285     @@Param:
286     @@@Name: originalVariable
287     @@@Type:
288     lang:Perl::ManakaiDOM:all
289     @@@enDesc:
290     Original variable specification, including prefix.
291     \
292     {NOTE:: Qualified name variable and hash key is not supported.
293     \
294     }
295     @@Param:
296     @@@Name: newValue
297     @@@Type: ManakaiPerlCodeFragment
298     @@@enDesc:
299     New value to replace.
300     @@Return:
301     @@@PerlDef:
302     my $node = $self->{<Q::TreeCore:node>};
303     if ($node->{<Q::pc:nodeType>} eq 'unparsed' or
304     $node->{<Q::pc:nodeType>} eq 'inunparsed') {
305     my $newVariable = $newValue->stringify;
306     $node->{<Q::pc:code>} =~ s/\Q$originalVariable\E\b/$newVariable/g;
307     } elsif ($node->{<Q::pc:nodeType>} eq 'variable') {
308     if (substr ($originalVariable, 0, 1) eq
309     $node->{<Q::pc:variableType>} and
310     not $node->{<Q::pc:packageName>} and
311     substr ($originalVariable, 1) eq
312     $node->{<Q::pc:localName>} and
313     not $node->{<Q::pc:hashKey>}) {
314     $node->{<Q::pc:localName>} = substr ($originalVariable, 1);
315     }
316     } elsif ($node->{<Q::pc:childNodes>}) {
317     __DEEP{
318     for my $cno (@{$node->{<Q::pc:childNodes>}}) {
319     my $cn;
320     __CODE{ManakaiNode:getWeakReference::
321     $object => $cno, $ref => $cn,
322     $class => {<ClassName::ManakaiPerlCodeFragment>},
323     }__;
324     $cn-><M::ManakaiPerlCodeFragment.replaceVariable>
325     ($originalVariable => $newValue);
326     }
327     }__;
328     }
329 wakaba 1.1 ##PerlCodeFragment
330    
331 wakaba 1.9 ResourceDef:
332     @QName: nodeTypeToPackageName
333     @rdf:type:
334     dis2pm:BlockCode
335     @enDesc:
336     Gets Perl class package name from a node type string.
337     @PerlDef:
338     if ($nodeType eq 'unparsed') {
339     $packageName = <ClassName::ManakaiPerlUnparsedCode>;
340     } elsif ($nodeType eq 'bare') {
341     $packageName = <ClassName::ManakaiPerlBare>;
342     } elsif ($nodeType eq 'atom') {
343     $packageName = <ClassName::ManakaiPerlAtom>;
344     } elsif ($nodeType eq 'variable') {
345     $packageName = <ClassName::ManakaiPerlVariable>;
346     } elsif ($nodeType eq 'inunparsed') {
347     $packageName = <ClassName::ManakaiPerlInlineUnparsedCode>;
348     } elsif ($nodeType eq 'incontainer') {
349     $packageName = <ClassName::ManakaiPerlInlineContainer>;
350     } elsif ($nodeType eq 'statement') {
351     $packageName = <ClassName::ManakaiPerlStatement>;
352     } elsif ($nodeType eq 'string') {
353     $packageName = <ClassName::ManakaiPerlStringLiteral>;
354     } elsif ($nodeType eq 'blockcontainer') {
355     $packageName = <ClassName::ManakaiPerlBlockContainer>;
356     } elsif ($nodeType eq 'block') {
357     $packageName = <ClassName::ManakaiPerlBlock>;
358     } elsif ($nodeType eq 'sub') {
359     $packageName = <ClassName::ManakaiPerlSub>;
360     } elsif ($nodeType eq 'package') {
361     $packageName = <ClassName::ManakaiPerlPackageScope>;
362     } elsif ($nodeType eq 'file') {
363     $packageName = <ClassName::ManakaiPerlFile>;
364     } else {
365     __ASSERT{DISPerl:invariant::
366     msg => {qq[Node type: "$nodeType" ].
367     qq[(ref: "@{[ref $object]}")]},
368     }__;
369     }
370    
371    
372 wakaba 1.6 PropDef:
373     @QName: nodeType
374     @enDesc:
375     Node type.
376    
377 wakaba 1.1 ClsDef:
378     @ClsQName: ManakaiPerlFile
379     @ClsISA: ManakaiPerlCodeFragment
380     @enDesc:
381     Perl source code files.
382    
383     @IntMethod:
384     @@Name:newObject
385     @@ManakaiDOM:isStatic:1
386     @@Description:
387     @@@lang:en
388     @@@@:
389     Creates a new instance object for <Class::ManakaiPerlFile>.
390     @@Return:
391     @@@Type:
392     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
393     @@@Description:
394     @@@@lang:en
395     @@@@@:
396     The newly created node object.
397     @@@PerlDef:
398     @@@@@:
399     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
400     ::ManakaiDOM:Perl.new>;
401     push @{$node->{<Q::TreeCore:subnode>}}, <Q::pc:childNodes>;
402     $node->{<Q::pc:childNodes>} = [];
403     $node->{<Q::pc:sourceFile>} = '';
404     $node->{<Q::pc:sourceModule>} = '';
405     $node->{<Q::pc:sourceFor>} = '';
406     $node->{<Q::pc:currentPackage>} = 'main';
407     $node->{<Q::pc:currentChunk>} = 0;
408 wakaba 1.6 $node->{<Q::pc:nodeType>} = 'file';
409 wakaba 1.1 @@@@ImplNote:
410     @@@@@lang:en
411     @@@@@@:
412     Properties: <Q::pc:sourceFile>,
413     <Q::pc:sourceModule>, <Q::pc:sourceFor>, <Q::childNodes>,
414 wakaba 1.6 <Q::pc:currentPackage>, <Q::pc:currentChunk>,
415     <Q::pc:nodeType>.
416 wakaba 1.1
417     @Method:
418     @@Name: appendNewPackage
419     @@enDesc:
420     Appends a new package scope block.
421     @@Param:
422     @@@Name: packageName
423     @@@Type:
424     Perl:package-name::ManakaiDOM:all
425     @@@enDesc:
426     The fully-qualified name of the package to create.
427     @@Return:
428     @@@Type: ManakaiPerlPackageScope
429     @@@enDesc:
430     The newly created package scope object.
431     @@@PerlDef:
432     $r = <ClassM::ManakaiPerlPackageScope.newObject>;
433     $r->{<Q::pc:packageName>} = $packageName;
434     $self->{<Q::TreeCore:node>}
435     -><M::ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
436     .importTree> ($r);
437     push @{$self->{<Q::TreeCore:node>}->{<Q::pc:childNodes>}}, $r;
438     $r->{<Q::pc:parent>} = $self->{<Q::TreeCore:node>};
439 wakaba 1.6 __CODE{ManakaiNode:getNewReference::
440     $object => $r, $ref => $r,
441     $class => {<ClassName::ManakaiPerlPackageScope>}}__;
442 wakaba 1.1
443     @Method:
444     @@Name: getFirstPackage
445     @@enDesc:
446     Gets the first package scope block of a name.
447     @@Param:
448     @@@Name: packageName
449     @@@@Type:
450     Perl:package-name::ManakaiDOM:all
451     @@@@enDesc:
452     The fully-qualified name of the package to get.
453     @@NamedParam:
454     @@@Name: makeNewPackage
455     @@@Type:
456     DOMMain:boolean
457     @@@enDesc:
458     Whether a new package scope object should be created if
459     no package of <P::packageName> found.
460     @@@TrueCase:
461     @@@@enDesc:
462     Makes a new object if not found.
463     @@@FalseCase:
464     @@@@enDesc:
465     Don't make a new object.
466     @@Return:
467     @@@Type: ManakaiPerlPackageScope
468     @@@enDesc:
469     The first package scope object whose name is equal to
470     <P::packageName>.
471     @@@nullCase:
472     @@@@enDesc:
473     There is no <P::packageName> package object and
474     the <P::makeNewPackage> parameter is set to <DOM::false>.
475     @@@PerlDef:
476     for my $cn (@{$self->{<Q::TreeCore:node>}->{<Q::pc:childNodes>}}) {
477     if ($cn->{<Q::pc:packageName>} eq $packageName) {
478     $r = $cn;
479     last;
480     }
481     }
482     if ($r) {
483 wakaba 1.6 __CODE{ManakaiNode:getNewReference::
484     $object => $r, $ref => $r,
485     $class => {<ClassName::ManakaiPerlPackageScope>}}__;
486 wakaba 1.1 } elsif ($makeNewPackage) {
487     __DEEP{
488     $r = $self-><M::ManakaiPerlFile.appendNewPackage> ($packageName);
489     }__;
490     }
491    
492     @Method:
493     @@Name: getLastPackage
494     @@enDesc:
495     Gets the last package scope block of a name.
496     @@Param:
497     @@@Name: packageName
498     @@@@Type:
499     Perl:package-name::ManakaiDOM:all
500     @@@@enDesc:
501     The fully-qualified name of the package to get.
502     @@NamedParam:
503     @@@Name: makeNewPackage
504     @@@Type:
505     DOMMain:boolean
506     @@@enDesc:
507     Whether a new package scope object should be created if
508     no package of <P::packageName> found.
509     @@@TrueCase:
510     @@@@enDesc:
511     Makes a new object if not found.
512     @@@FalseCase:
513     @@@@enDesc:
514     Don't make a new object.
515     @@Return:
516     @@@Type: ManakaiPerlPackageScope
517     @@@enDesc:
518     The last package scope object whose name is equal to
519     <P::packageName>.
520     @@@nullCase:
521     @@@@enDesc:
522     There is no <P::packageName> package object and
523     the <P::makeNewPackage> parameter is set to <DOM::false>.
524     @@@PerlDef:
525     for my $cn (reverse @{$self->{<Q::TreeCore:node>}
526     ->{<Q::pc:childNodes>}}) {
527     if ($cn->{<Q::pc:packageName>} eq $packageName) {
528     $r = $cn;
529     last;
530     }
531     }
532     if ($r) {
533 wakaba 1.6 __CODE{ManakaiNode:getNewReference::
534     $object => $r, $ref => $r,
535     $class => {<ClassName::ManakaiPerlPackageScope>}}__;
536 wakaba 1.1 } elsif ($makeNewPackage) {
537     __DEEP{
538     $r = $self-><M::ManakaiPerlFile.appendNewPackage> ($packageName);
539     }__;
540     }
541    
542     @Attr:
543     @@Name: length
544     @@enDesc:
545     The number of child code fragments.
546     @@Type:
547     DOMMain:unsigned-long
548     @@Get:
549     @@@PerlDef:
550 wakaba 1.4 $r = @{$self->{<Q::TreeCore:node>}->{<Q::pc:childNodes>}};
551 wakaba 1.1
552     @Attr:
553     @@Name: sourceFile
554     @@enDesc:
555     The file name of the source file from which this
556     Perl code is primary generated.
557     @@Get:
558     @@@Type:
559     DISLang:String
560     @@@disDef:
561     @@@@GetProp: sourceFile
562     @@Set:
563     @@@Type:
564     DISLang:String
565     @@@disDef:
566     @@@@SetProp: sourceFile
567    
568     @Attr:
569     @@Name: sourceModule
570     @@enDesc:
571     The name URI reference of the source module that this package defines.
572     @@Get:
573     @@@Type:
574     DISLang:String
575     @@@disDef:
576     @@@@GetProp: sourceModule
577     @@Set:
578     @@@Type:
579     DISLang:String
580     @@@disDef:
581     @@@@SetProp: sourceModule
582    
583     @Attr:
584     @@Name: sourceFor
585     @@enDesc:
586     The URI reference of the source module <QUOTE::for> for which this
587     package is.
588     @@Get:
589     @@@Type:
590     DISLang:String
591     @@@disDef:
592     @@@@GetProp: sourceFor
593     @@Set:
594     @@@Type:
595     DISLang:String
596     @@@disDef:
597     @@@@SetProp: sourceFor
598    
599     @ToStringMethod:
600     @@Return:
601     @@@Type:
602     DISLang:String
603     @@@enDesc:
604     The Perl code generated.
605     @@@PerlDef:
606     __DEEP{
607     my $node = $self->{<Q::TreeCore:node>};
608     ## -- Header
609     $r = qq<#!/usr/bin/perl \n>;
610     $r .= <ClassM::ManakaiPerlCodeImplementation.perlComment>
611     (q<This file is automatically generated>);
612     $r .= <ClassM::ManakaiPerlCodeImplementation.perlComment>
613     (q< at >.<ClassM::ManakaiPerlCodeImplementation
614     .rfc3339DateTime> (time).q<,>);
615     $r .= <ClassM::ManakaiPerlCodeImplementation.perlComment>
616     (q< from file ">.$node->{<Q::sourceFile>}.q<",>);
617     $r .= <ClassM::ManakaiPerlCodeImplementation.perlComment>
618     (q[ module <].$node->{<Q::sourceModule>}.q[>,]);
619     $r .= <ClassM::ManakaiPerlCodeImplementation.perlComment>
620     (q[ for <].$node->{<Q::sourceFor>}.q[>.]);
621     $r .= <ClassM::ManakaiPerlCodeImplementation.perlComment>
622     (q<Don't edit by hand!>);
623     $r .= qq<use strict;\n>;
624     $self-><AS::ManakaiPerlFile.currentPackage> ('main');
625 wakaba 1.6 $self-><AS::ManakaiPerlFile.currentChunkNumber> (0);
626 wakaba 1.1
627     ## -- Packages
628     my $pack = {};
629     for my $sp (@{$node->{<Q::pc:childNodes>}}) {
630 wakaba 1.6 my $spe;
631     __CODE{ManakaiNode:getWeakReference::
632     $object => $sp, $ref => $spe,
633     $class => {<ClassName::ManakaiPerlPackageScope>}}__;
634 wakaba 1.1 $r .= $spe->stringify;
635     for my $ipack (keys %{$sp->{<Q::dis:Implement>}}) {
636     $pack->{$ipack} ||= true; # not defined
637     }
638     $pack->{$sp->{<Q::pc:packageName>}} = []; # defined
639     }
640    
641     ## -- Enables interface packages
642 wakaba 1.3 my @packs = map {'$' . $_ . '::'}
643     grep {not ref $pack->{$_} and $pack->{$_}}
644     keys %$pack;
645     $r .= q<for (>. join (', ', @packs) . qq<){}\n> if @packs;
646 wakaba 1.1
647     ## -- Footer
648     $r .= <ClassM::ManakaiPerlCodeImplementation.perlComment>
649 wakaba 1.2 (q[License: <].$node->{<Q::dis:License>}.qq[>\n]);
650 wakaba 1.1 $r .= qq<1;\n>;
651     }__;
652    
653     @Attr:
654     @@Name: currentPackage
655     @@enDesc:
656     The current Perl package (used in stringify method).
657     @@Type:
658     Perl:package-name::ManakaiDOM:all
659     @@Get:
660     @@@disDef:
661     @@@@GetProp: currentPackage
662     @@Set:
663     @@@disDef:
664     @@@@SetProp: currentPackage
665    
666     @Attr:
667 wakaba 1.6 @@Name: currentChunkNumber
668 wakaba 1.1 @@enDesc:
669 wakaba 1.6 The current code chunk number (used in stringify method).
670 wakaba 1.1 @@Type:
671     DOMMain:unsigned-long::ManakaiDOM:all
672     @@Get:
673     @@@disDef:
674     @@@@GetProp: currentChunk
675     @@Set:
676     @@@disDef:
677     @@@@SetProp: currentChunk
678 wakaba 1.6
679     @Method:
680     @@Name: getNextChunkNumber
681     @@enDesc:
682     Increments the current chunk number of this file
683     and returns it.
684     @@Return:
685     @@@Type:
686     DOMMain:unsigned-long::ManakaiDOM:all
687     @@@enDesc:
688     The next chunk number.
689     @@@PerlDef:
690     $r = ++$self->{<Q::TreeCore:node>}->{<Q::pc:currentChunk>};
691 wakaba 1.2
692     @Attr:
693     @@Name: licenseURI
694     @@enDesc:
695     The license term URI reference for this code.
696     @@Type:
697     DISLang:String::ManakaiDOM:all
698     @@Get:
699     @@@disDef:
700     @@@@GetProp:
701     dis:License
702     @@Set:
703     @@@disDef:
704     @@@@SetProp:
705     dis:License
706 wakaba 1.1 ##PerlFile
707    
708     PropDef:
709     @QName: sourceModule
710     @enDesc:
711     The soruce module name URI reference.
712    
713     PropDef:
714     @QName: sourceFor
715     @enDesc:
716     The source module <QUOTE::for> URI reference.
717    
718     PropDef:
719     @QName: currentPackage
720     @enDesc:
721     The current Perl package name (used for stringify).
722    
723     PropDef:
724     @QName: currentChunk
725     @enDesc:
726     The current code chunk (used for stringify).
727    
728     ClsDef:
729     @ClsQName: ManakaiPerlPackageScope
730     @ClsISA: ManakaiPerlCodeFragment
731    
732     @Attr:
733     @@Name: packageName
734     @@Type:
735     Perl:package-name
736     @@enDesc:
737     The fully-qualified package name.
738     @@Get:
739     @@@disDef:
740     @@@@GetProp: packageName
741    
742     @IntMethod:
743     @@Name:newObject
744     @@ManakaiDOM:isStatic:1
745     @@Description:
746     @@@lang:en
747     @@@@:
748     Creates a new instance object for <Class::ManakaiPerlPackageScope>.
749     @@Return:
750     @@@Type:
751     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
752     @@@Description:
753     @@@@lang:en
754     @@@@@:
755     The newly created node object.
756     @@@PerlDef:
757     @@@@@:
758     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
759     ::ManakaiDOM:Perl.new>;
760 wakaba 1.4 push @{$node->{<Q::TreeCore:subnode2>}}, <Q::pc:sub>,
761     <Q::dis2pm:overload>;
762 wakaba 1.1 push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
763     $node->{<Q::pc:sub>} = {};
764     $node->{<Q::dis:ISA>} = [];
765     $node->{<Q::dis:Implement>} = {};
766 wakaba 1.4 $node->{<Q::dis2pm:overload>} = {};
767 wakaba 1.6 $node->{<Q::pc:nodeType>} = 'package';
768     @@@@ImplNote:
769     @@@@@lang:en
770     @@@@@@:
771     Properties: <Q::pc:sub>, <Q::dis2pm:overload>,
772     <Q::dis:ISA>, <Q::dis:Implement>,
773     <Q::pc:nodeType>.
774 wakaba 1.1
775     @Method:
776     @@Name: getSub
777     @@enDesc:
778     Gets a subroutine.
779     @@Param:
780     @@@Name: subName
781     @@@Type:
782     DISPerl:SubName::ManakaiDOM:all
783     @@@enDesc:
784     The name of subroutine to get.
785     @@NamedParam:
786     @@@Name: makeNewNode
787     @@@Type:
788     DOMMain:boolean
789     @@@enDesc:
790     Whether a new subroutine object should be created,
791     if it is not exist, or not.
792     @@Return:
793     @@@Type: ManakaiPerlSub
794     @@@enDesc:
795     The subroutine object.
796 wakaba 1.4 @@@nullCase:
797     @@@@enDesc:
798     Either the specified subroutine is not found and
799     the <P::makeNewNode> parameter is set to <DOM::false> or
800     the subroutine is defined as an alias.
801 wakaba 1.1 @@@PerlDef:
802     if ($self->{<Q::TreeCore:node>}->{<Q::pc:sub>}->{$subName}) {
803 wakaba 1.4 $r = ref $self->{<Q::TreeCore:node>}->{<Q::pc:sub>}->{$subName}
804     ? $self->{<Q::TreeCore:node>}->{<Q::pc:sub>}->{$subName} : null;
805 wakaba 1.1 } elsif ($makeNewNode) {
806     $r = $self->{<Q::TreeCore:node>}->{<Q::pc:sub>}->{$subName}
807     = <ClassM::ManakaiPerlSub.newObject>;
808     $self->{<Q::TreeCore:node>}
809     -><M::ManakaiDOM:ManakaiDOMNodeObject
810     ::ManakaiDOM:Perl.importTree> ($r);
811     $r->{<Q::pc:parent>} = $self->{<Q::TreeCore:node>};
812     $r->{<Q::pc:localName>} = $subName;
813     }
814 wakaba 1.6 if ($r) {
815     __CODE{ManakaiNode:getNewReference::
816     $object => $r, $ref => $r,
817     $class => {<ClassName::ManakaiPerlSub>}}__;
818     }
819 wakaba 1.1
820 wakaba 1.4 @Method:
821 wakaba 1.5 @@Name: setSub
822     @@enDesc:
823     Sets a subrotine.
824     @@Param:
825     @@@Name: subName
826     @@@Type:
827     DISLang:String::ManakaiDOM:all
828     @@@enDesc:
829     The name of the subroutine.
830     \
831     {NOTE:: The <P::subName> value must be equal to the
832     <A::ManakaiPerlSub.localName> of the <P::subArg>.
833     @@Param:
834     @@@Name: subArg
835     @@@Type: ManakaiPerlSub
836     @@@enDesc:
837     The subroutine object.
838     @@Return:
839     @@@RaiseException:
840     @@@@@:IN_USE_NODE_ERR
841     @@@@enDesc:
842     An attempt is made to set a subroutine that is
843     already used elsewhere.
844     @@@PerlDef:
845     my $ops = $self->{<Q::TreeCore:node>}->{<Q::pc:sub>};
846     if (ref $ops->{$subName}) {
847     CORE::delete $ops->{<Q::pc:parent>};
848     $ops->{$subName}
849     -><M::ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl.orphanate>;
850     }
851     if ($subArg->{<Q::TreeCore:node>}->{<Q::pc:parent>}) {
852     __EXCEPTION{IN_USE_NODE_ERR::
853     pc:parentNode => {$subArg->{<Q::TreeCore:node>}
854     ->{<Q::pc:parent>}},
855     pc:childNode => {$subArg},
856     }__;
857     }
858     $self->{<Q::TreeCore:node>}-><M::MNodeObject.importTree>
859     ($subArg->{<Q::TreeCore:node>});
860     $ops->{$subName} = $subArg->{<Q::TreeCore:node>};
861     $subArg->{<Q::TreeCore:node>}->{<Q::pc:parent>}
862     = $self->{<Q::TreeCore:node>};
863    
864     @Method:
865 wakaba 1.4 @@Name: getSubAliasName
866     @@enDesc:
867     Gets the real name of a subroutine.
868     @@Param:
869     @@@Name: subName
870     @@@Type:
871     DISLang:String::ManakaiDOM:all
872     @@@enDesc:
873     The name of the alias subroutine.
874     @@Return:
875     @@@Type:
876     DISLang:String::ManakaiDOM:all
877     @@@enDesc:
878     The real name.
879     @@@nullCase:
880     @@@@enDesc:
881     The specified name is used.
882     @@@InCase:
883     @@@@Value:\#CODE
884     @@@@enDesc:
885     The specified name is not an alias.
886     @@@PerlDef:
887     if ($self->{<Q::TreeCore:node>}->{<Q::sub>}->{$subName}) {
888     $r = ref $self->{<Q::TreeCore:node>}
889     ->{<Q::sub>}->{$subName}
890     ? q<#CODE> : $self->{<Q::TreeCore:node>}
891     ->{<Q::sub>}->{$subName};
892     }
893    
894     @Method:
895     @@Name: setSubAliasName
896     @@enDesc:
897     Sets a subroutine name as an alias of another subroutine.
898     @@Param:
899     @@@Name: aliasName
900     @@@Type:
901     DISLang:String::ManakaiDOM:all
902     @@@enDesc:
903     The alias name.
904     @@Param:
905     @@@Name: realName
906     @@@Type:
907     DISLang:String::ManakaiDOM:all
908     @@@enDesc:
909     The real name.
910     @@Return:
911     @@@UnknownOperatorException:
912     @@@PerlDef:
913     my $ops = $self->{<Q::TreeCore:node>}->{<Q::sub>};
914     if (ref $ops->{$aliasName}) {
915     CORE::delete $ops->{<Q::pc:parent>};
916     $ops->{$aliasName}
917     -><M::ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl.orphanate>;
918     }
919     $ops->{$aliasName} = $realName;
920    
921     @Method:
922     @@Name: getOverloadSub
923     @@enDesc:
924     Gets an overloading subroutine.
925     @@Param:
926     @@@Name: opName
927     @@@Type:
928     DISLang:String::ManakaiDOM:all
929     @@@enDesc:
930     The name of the overloaded operator.
931     @@NamedParam:
932     @@@Name: makeNewNode
933     @@@Type:
934     DOMMain:boolean
935     @@@enDesc:
936     Whether a new subroutine object should be created,
937     if it is not exist, or not.
938     @@Return:
939     @@@Type: ManakaiPerlSub
940     @@@enDesc:
941     The subroutine object.
942     @@@nullCase:
943     @@@@enDesc:
944     Either the specified subroutine is not found and
945     the <P::makeNewNode> parameter is set to <DOM::false> or
946     the specified operator is overloaded by specifying method name.
947     @@@UnknownOperatorException:
948     @@@PerlDef:
949     unless (<Code::operatorNameList>->{$opName}) {
950     __EXCEPTION{UNSUPPORTED_OPERATOR_ERR::
951     pc:operator => {$opName},
952     }__;
953     }
954     if ($self->{<Q::TreeCore:node>}->{<Q::dis2pm:operator>}->{$opName}) {
955     $r = ref $self->{<Q::TreeCore:node>}
956     ->{<Q::dis2pm:operator>}->{$opName}
957     ? $self->{<Q::TreeCore:node>}
958     ->{<Q::dis2pm:operator>}->{$opName} : null;
959     } elsif ($makeNewNode) {
960     $r = $self->{<Q::TreeCore:node>}->{<Q::dis2pm:operator>}->{$opName}
961     = <ClassM::ManakaiPerlSub.newObject>;
962     $self->{<Q::TreeCore:node>}
963     -><M::ManakaiDOM:ManakaiDOMNodeObject
964     ::ManakaiDOM:Perl.importTree> ($r);
965     $r->{<Q::pc:parent>} = $self->{<Q::TreeCore:node>};
966     }
967 wakaba 1.6 if ($r) {
968     __CODE{ManakaiNode:getNewReference::
969     $object => $r, $ref => $r,
970     $class => {<ClassName::ManakaiPerlSub>}}__;
971     }
972 wakaba 1.4
973     @Method:
974 wakaba 1.5 @@Name: setOverloadSub
975     @@enDesc:
976     Sets an overloading subrotine.
977     @@Param:
978     @@@Name: opName
979     @@@Type:
980     DISLang:String::ManakaiDOM:all
981     @@@enDesc:
982     The name of the opeartor to overload.
983     @@Param:
984     @@@Name: subArg
985     @@@Type: ManakaiPerlSub
986     @@@enDesc:
987     The subroutine object.
988     @@Return:
989     @@@UnknownOperatorException:
990     @@@RaiseException:
991     @@@@@:IN_USE_NODE_ERR
992     @@@@enDesc:
993     An attempt is made to set a subroutine that is
994     already used elsewhere.
995     @@@PerlDef:
996     unless (<Code::operatorNameList>->{$opName}) {
997     __EXCEPTION{UNSUPPORTED_OPERATOR_ERR::
998     pc:operator => {$opName},
999     }__;
1000     }
1001     my $ops = $self->{<Q::TreeCore:node>}->{<Q::dis2pm:operator>};
1002     if (ref $ops->{$opName}) {
1003     CORE::delete $ops->{<Q::pc:parent>};
1004     $ops->{$opName}
1005     -><M::ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl.orphanate>;
1006     }
1007     if ($subArg->{<Q::TreeCore:node>}->{<Q::pc:parent>}) {
1008     __EXCEPTION{IN_USE_NODE_ERR::
1009     pc:parentNode => {$self},
1010     pc:childNode => {$subArg},
1011     }__;
1012     }
1013     $self->{<Q::TreeCore:node>}-><M::MNodeObject.importTree>
1014     ($subArg->{<Q::TreeCore:node>});
1015     $ops->{$opName} = $subArg->{<Q::TreeCore:node>};
1016     $subArg->{<Q::TreeCore:node>}->{<Q::pc:parent>}
1017     = $self->{<Q::TreeCore:node>};
1018    
1019    
1020     @Method:
1021 wakaba 1.4 @@Name: getOverloadMethodName
1022     @@enDesc:
1023     Gets an overloading method name.
1024     @@Param:
1025     @@@Name: opName
1026     @@@Type:
1027     DISLang:String::ManakaiDOM:all
1028     @@@enDesc:
1029     The name of the overloaded operator.
1030     @@Return:
1031     @@@Type:
1032     DISLang:String::ManakaiDOM:all
1033     @@@enDesc:
1034     The method name.
1035     @@@nullCase:
1036     @@@@enDesc:
1037     The specified operator is not overloaded.
1038     @@@InCase:
1039     @@@@Value:\#CODE
1040     @@@@enDesc:
1041     The operator is overloaded by an anonymous subroutine.
1042     @@@PerlDef:
1043     if ($self->{<Q::TreeCore:node>}->{<Q::dis2pm:operator>}->{$opName}) {
1044     $r = ref $self->{<Q::TreeCore:node>}
1045     ->{<Q::dis2pm:operator>}->{$opName}
1046     ? q<#CODE> : $self->{<Q::TreeCore:node>}
1047     ->{<Q::dis2pm:operator>}->{$opName};
1048     }
1049    
1050     @Method:
1051     @@Name: setOverloadMethodName
1052     @@enDesc:
1053     Sets an overloading method name.
1054     @@Param:
1055     @@@Name: opName
1056     @@@Type:
1057     DISLang:String::ManakaiDOM:all
1058     @@@enDesc:
1059     The name of the overloaded operator.
1060     @@Param:
1061     @@@Name: methodName
1062     @@@Type:
1063     DISLang:String::ManakaiDOM:all
1064     @@@enDesc:
1065     The name of the method by which overloads an operator.
1066     \
1067     {NOTE:: The method may or may not belong to this package.
1068     \
1069     }
1070     @@Return:
1071     @@@UnknownOperatorException:
1072     @@@PerlDef:
1073     unless (<Code::operatorNameList>->{$opName}) {
1074     __EXCEPTION{UNSUPPORTED_OPERATOR_ERR::
1075     pc:operator => {$opName},
1076     }__;
1077     }
1078     my $ops = $self->{<Q::TreeCore:node>}->{<Q::dis2pm:operator>};
1079     if (ref $ops->{$opName}) {
1080     CORE::delete $ops->{<Q::pc:parent>};
1081     $ops->{$opName}
1082     -><M::ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl.orphanate>;
1083     }
1084     $ops->{$opName} = $methodName;
1085    
1086 wakaba 1.1 @Attr:
1087     @@Name: length
1088     @@enDesc:
1089     The number of child code fragments.
1090     @@Type:
1091     DOMMain:unsigned-long
1092     @@Get:
1093     @@@PerlDef:
1094 wakaba 1.4 $r = keys (%{$self->{<Q::TreeCore:node>}->{<Q::pc:sub>}})
1095     + keys (%{$self->{<Q::TreeCore:node>}->{<Q::dis2pm:operator>}});
1096 wakaba 1.1
1097     @Method:
1098     @@Name: addIsaPackage
1099     @@enDesc:
1100     Adds a class package that this class inherits.
1101     @@Param:
1102     @@@Name: packageName
1103     @@@Type:
1104     Perl:package-name::ManakaiDOM:all
1105     @@@enDesc:
1106     The name of package to add.
1107     @@Return:
1108     @@@PerlDef:
1109     push @{$self->{<Q::TreeCore:node>}->{<Q::dis:ISA>}}, $packageName;
1110    
1111     @Method:
1112     @@Name: addImplementPackage
1113     @@enDesc:
1114     Adds a interface package that this class implements.
1115     @@Param:
1116     @@@Name: packageName
1117     @@@Type:
1118     Perl:package-name::ManakaiDOM:all
1119     @@@enDesc:
1120     The name of package to add.
1121     @@Return:
1122     @@@PerlDef:
1123     $self->{<Q::TreeCore:node>}->{<Q::dis:Implement>}->{$packageName} = true;
1124    
1125     @ToStringMethod:
1126     @@Return:
1127     @@@Type:
1128     DISLang:String
1129     @@@enDesc:
1130     Perl code.
1131     @@@PerlDef:
1132     my $file = $self-><AG::ManakaiPerlCodeFragment.parentNode>;
1133     my $node = $self->{<Q::TreeCore:node>};
1134     my $pn = $node->{<Q::pc:packageName>};
1135     $r .= q<package > . $pn . ";\n";
1136     __DEEP{
1137     $file-><AS::ManakaiPerlFile.currentPackage> ($pn);
1138     $r .= 'our $VERSION = '.
1139     <ClassM::ManakaiPerlCodeImplementation.versionDateTime> (time).
1140     ";\n";
1141     }__;
1142     my @isa = (@{$node->{<Q::dis:ISA>}},
1143     sort keys %{$node->{<Q::dis:Implement>}});
1144     if (@isa) {
1145     $r .= 'push our @ISA, ' .
1146     <ClassM::ManakaiPerlCodeImplementation.perlList> (\@isa) .
1147     ";\n";
1148     }
1149 wakaba 1.4 for my $cnk (keys %{$node->{<Q::pc:sub>}}) {
1150     my $cno = $node->{<Q::pc:sub>}->{$cnk};
1151     if (ref $cno) {
1152 wakaba 1.6 my $cn;
1153     __CODE{ManakaiNode:getWeakReference::
1154     $object => $cno, $ref => $cn,
1155     $class => {<ClassName::ManakaiPerlSub>}}__;
1156 wakaba 1.4 $r .= $cn->stringify;
1157     } else {
1158     $r .= qq<*$cnk = \&$cno;\n>;
1159     }
1160     }
1161     my $op = '';
1162     for my $cnk (keys %{$node->{<Q::dis2pm:operator>}}) {
1163     my $cno = $node->{<Q::dis2pm:operator>}->{$cnk};
1164     if (ref $cno) {
1165 wakaba 1.6 my $cn;
1166     __CODE{ManakaiNode:getWeakReference::
1167     $object => $cno, $ref => $cn,
1168     $class => {<ClassName::ManakaiPerlSub>}}__;
1169 wakaba 1.4 $op .= <ClassM::ManakaiPerlCodeImplementation.perlLiteral> ($cnk)
1170     . ' => ' . $cn->stringify . ', ';
1171     } elsif (defined $cno) {
1172     $op .= <ClassM::ManakaiPerlCodeImplementation.perlList>
1173     ([$cnk => $cno]) . ', ';
1174     }
1175     }
1176     $r .= 'use overload ' . $op . qq[fallback => 1;\n] if $op;
1177 wakaba 1.1 ##PerlPackageScope
1178    
1179 wakaba 1.4 PropDef:
1180     @QName:
1181     dis2pm:operator
1182     @enDesc:
1183     Overloaded operators.
1184    
1185     ElementTypeBinding:
1186     @Name: UnknownOperatorException
1187     @ElementType:
1188     ManakaiDOM:raises
1189     @ShadowContent:
1190     @@@:UNSUPPORTED_OPERATOR_ERR
1191     @@enDesc:
1192     An attempt is made to overload an unknown operator.
1193    
1194     XParamDef:
1195     @QName:
1196     pc:operator
1197     @enDesc:
1198     An operator to overload.
1199    
1200     ResourceDef:
1201     @QName: operatorNameList
1202     @enDesc:
1203     The list of valid operators for <PerlModule::operator> pragma.
1204     @rdf:type:
1205     dis2pm:InlineCode
1206     @PerlDef:
1207     {qw[
1208     + 1 - 1 * 1 / 1 % 1 ** 1 << 1 >> 1 x 1 . 1
1209     += 1 -= 1 *= 1 /= 1 %= 1 **= 1 <<= 1 >>= 1 x= 1 .= 1
1210     < 1 <= 1 > 1 >= 1 == 1 != 1 <=> 1
1211     lt 1 le 1 gt 1 ge 1 eq 1 ne 1 cmp 1
1212     & 1 | 1 ^ 1 neg 1 ! 1 ~ 1
1213     ++ 1 -- 1 = 1
1214     atan2 1 cos 1 sin 1 exp 1 abs 1 log 1 sqrt 1
1215     bool 1 "" 1 0+ 1 ${} 1 @{} 1 %{} 1 &{} 1 *{} 1 <> 1
1216     nomethod 1
1217     ]}
1218    
1219 wakaba 1.1 ClsDef:
1220 wakaba 1.6 @ClsQName: ManakaiPerlStatementContainer
1221     @ClsISA: ManakaiPerlAnyContainer
1222 wakaba 1.1 @enDesc:
1223 wakaba 1.6 A base class for node types that contains zero or more
1224     statements and/or blocks.
1225 wakaba 1.1
1226     @Attr:
1227     @@Name: currentSourceFile
1228     @@enDesc:
1229     The current source file name that is referred when
1230     a code fragment is added.
1231     @@Type:
1232     DISLang:String
1233     @@Get:
1234     @@@nullCase:
1235     @@@@enDesc: No source file name is set.
1236     @@@disDef:
1237     @@@@GetProp: sourceFile
1238     @@Set:
1239     @@@nullCase:
1240     @@@@enDesc: No (or unknown) source file.
1241     @@@disDef:
1242     @@@@SetProp: sourceFile
1243    
1244     @Attr:
1245     @@Name: currentSourceLine
1246     @@enDesc:
1247     The current line number in source file that is referred when
1248     a code fragment is added.
1249     @@Type:
1250 wakaba 1.6 DOMMain:unsigned-long::ManakaiDOM:all
1251 wakaba 1.1 @@Get:
1252     @@@disDef:
1253     @@@@GetProp: sourceLine
1254     @@Set:
1255     @@@disDef:
1256     @@@@SetProp: sourceLine
1257    
1258     @Method:
1259 wakaba 1.5 @@Name: appendCodeFragment
1260     @@enDesc:
1261     Appends a <Class::ManakaiPerlCodeFragment> object.
1262     @@Param:
1263     @@@Name: codeArg
1264     @@@Type: ManakaiPerlCodeFragment
1265     @@@enDesc:
1266     A code fragment object.
1267     @@Return:
1268     @@@RaiseException:
1269     @@@@@:BAD_CHILD_ERR
1270     @@@@enDesc:
1271     An attempt is made to append a child
1272     that is not a <Class::ManakaiPerlUnparsedCode>.
1273     @@@RaiseException:
1274     @@@@@:IN_USE_NODE_ERR
1275     @@@@enDesc:
1276     An attempt is made to append a node that is
1277     already used elsewhere.
1278     @@@PerlDef:
1279 wakaba 1.6 if ({
1280     unparsed => 1, if => 1, statement => 1, block => 1,
1281 wakaba 1.9 blockcontainer => true,
1282 wakaba 1.6 inunparsed => 1, variable => 1, bare => 1, atom => 1,
1283     incontainer => 1, string => 1, assign => 1,
1284     }->{$codeArg->{<Q::TreeCore:node>}->{<Q::pc:nodeType>}}) {
1285 wakaba 1.5 if ($codeArg->{<Q::TreeCore:node>}->{<Q::pc:parent>}) {
1286     __EXCEPTION{IN_USE_NODE_ERR::
1287     pc:parentNode => {$codeArg->{<Q::TreeCore:node>}
1288     ->{<Q::pc:parent>}},
1289     pc:childNode => {$codeArg},
1290     }__;
1291     }
1292     $self->{<Q::TreeCore:node>}-><M::MNodeObject.importTree>
1293     ($codeArg->{<Q::TreeCore:node>});
1294     push @{$self->{<Q::TreeCore:node>}->{<Q::pc:childNodes>}},
1295     $codeArg->{<Q::TreeCore:node>};
1296     $codeArg->{<Q::TreeCore:node>}->{<Q::pc:parent>}
1297     = $self->{<Q::TreeCore:node>};
1298     } else {
1299     __EXCEPTION{BAD_CHILD_ERR::
1300     pc:parentNode => {$self},
1301     pc:childNode => {$codeArg},
1302     }__;
1303     }
1304    
1305     @Method:
1306 wakaba 1.1 @@Name: appendCode
1307     @@enDesc:
1308     Appends an unparsed Perl code fragment.
1309     @@Param:
1310     @@@Name: codeArg
1311     @@@Type:
1312     lang:Perl::ManakaiDOM:all
1313     @@@enDesc:
1314     An unparsed Perl code fragment.
1315     @@Return:
1316     @@@Type: ManakaiPerlUnparsedCode
1317     @@@enDesc:
1318     The newly created Perl code object.
1319     @@@PerlDef:
1320     $r = <ClassM::ManakaiPerlUnparsedCode.newObject>;
1321     my $node = $self->{<Q::TreeCore:node>};
1322     $r->{<Q::sourceFile>} = $node->{<Q::sourceFile>};
1323     $r->{<Q::sourceLine>} = $node->{<Q::sourceLine>};
1324     $r->{<Q::code>} = $codeArg;
1325     $node->{<Q::sourceLine>} += ($codeArg =~ tr/\x0A/\x0A/);
1326 wakaba 1.6 $node-><M::ManakaiDOM:ManakaiDOMNodeObject
1327     ::ManakaiDOM:Perl.importTree> ($r);
1328     push @{$node->{<Q::pc:childNodes>}}, $r;
1329     $r->{<Q::pc:parent>} = $node;
1330     __CODE{ManakaiNode:getNewReference::
1331     $object => $r, $ref => $r,
1332     $class =>{<ClassName::ManakaiPerlUnparsedCode>},
1333     }__;
1334 wakaba 1.1
1335     @Method:
1336     @@Name: skipLines
1337     @@enDesc:
1338     Skips lines in a code.
1339     @@Param:
1340     @@@Name: codeArg
1341     @@@Type:
1342     lang:Perl::ManakaiDOM:all
1343     @@@enDesc:
1344     A code fragment, which is counted lines.
1345     @@Return:
1346     @@@PerlDef:
1347     $self->{<Q::TreeCore:node>}->{<Q::sourceLine>}
1348     += ($codeArg =~ tr/\x0A/\x0A/);
1349 wakaba 1.4
1350 wakaba 1.6 @ImplNote:
1351     @@lang:en
1352     @@@:
1353     A <Class::ManakaiPerlStatementContainer> object must have
1354     a property:
1355     <Q::pc:childNodes>.
1356 wakaba 1.8
1357     @Attr:
1358     @@Name: label
1359     @@enDesc:
1360     Label for this block.
1361     @@Type:
1362     DISLang:String::ManakaiDOM:all
1363     @@Get:
1364     @@@nullCase:
1365     @@@@enDesc:
1366     No label.
1367     @@@disDef:
1368     @@@@GetProp:label
1369     @@Set:
1370     @@@nullCase:
1371     @@@@enDesc:
1372     No label.
1373     @@@disDef:
1374     @@@@SetProp:label
1375    
1376     @Method:
1377     @@Name: appendBlock
1378     @@enDesc:
1379     Appends a Perl block code.
1380     @@Return:
1381     @@@Type: ManakaiPerlBlock
1382     @@@enDesc:
1383     The newly created Perl code object.
1384     @@@PerlDef:
1385     $r = <ClassM::ManakaiPerlBlock.newObject>;
1386     my $node = $self->{<Q::TreeCore:node>};
1387     $node-><M::ManakaiDOM:ManakaiDOMNodeObject
1388     ::ManakaiDOM:Perl.importTree> ($r);
1389     push @{$node->{<Q::pc:childNodes>}}, $r;
1390     $r->{<Q::pc:parent>} = $node;
1391     if (defined wantarray) {
1392     __CODE{ManakaiNode:getNewReference::
1393     $object => $r, $ref => $r,
1394     $class =>{<ClassName::ManakaiPerlBlock>},
1395     }__;
1396     }
1397    
1398     @Method:
1399     @@Name: appendStatement
1400     @@enDesc:
1401     Appends a Perl statement.
1402     @@Param:
1403     @@@Name: codeArg
1404     @@@Type:
1405     lang:Perl::ManakaiDOM:all
1406     @@@enDesc:
1407     A Perl statement without terminating <Perl::;>.
1408     @@@nullCase:
1409     @@@@enDesc:
1410     No initial content.
1411     @@Return:
1412     @@@Type: ManakaiPerlStatement
1413     @@@enDesc:
1414     The newly created Perl code object.
1415     @@@PerlDef:
1416     $r = <ClassM::ManakaiPerlStatement.newObject>;
1417     my $node = $self->{<Q::TreeCore:node>};
1418     $node-><M::ManakaiDOM:ManakaiDOMNodeObject
1419     ::ManakaiDOM:Perl.importTree> ($r);
1420     push @{$node->{<Q::pc:childNodes>}}, $r;
1421     $r->{<Q::pc:parent>} = $node;
1422     if (defined wantarray or defined $codeArg) {
1423     __CODE{ManakaiNode:getNewReference::
1424     $object => $r, $ref => $r,
1425     $class =>{<ClassName::ManakaiPerlStatement>},
1426     }__;
1427     if (defined $codeArg) {
1428     __DEEP{
1429     $r-><M::ManakaiPerlAnyContainer.appendBare> ($codeArg);
1430     }__;
1431     }
1432     }
1433 wakaba 1.6 ##PerlStatementContainer
1434    
1435     ClsDef:
1436     @ClsQName: ManakaiPerlSub
1437     @ClsISA: ManakaiPerlStatementContainer
1438     @enDesc:
1439     Perl subroutines.
1440    
1441     @IntMethod:
1442     @@Name:newObject
1443     @@ManakaiDOM:isStatic:1
1444     @@Description:
1445     @@@lang:en
1446     @@@@:
1447     Creates a new instance object for <Class::ManakaiPerlSub>.
1448     @@Return:
1449     @@@Type:
1450     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
1451     @@@Description:
1452     @@@@lang:en
1453     @@@@@:
1454     The newly created node object.
1455     @@@PerlDef:
1456     @@@@@:
1457     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
1458     ::ManakaiDOM:Perl.new>;
1459     push @{$node->{<Q::TreeCore:subnode>}}, <Q::pc:childNodes>;
1460     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
1461     $node->{<Q::pc:childNodes>} = [];
1462     $node->{<Q::pc:sourceLine>} = 0;
1463     $node->{<Q::pc:nodeType>} = 'sub';
1464     @@@@ImplNote:
1465     @@@@@lang:en
1466     @@@@@@:
1467     Optional properties: <Q::pc:localName>,
1468     <Q::pc:sourceFile>, <Q::pc:sourceLine>,
1469     <Q::pc:nodeType>.
1470    
1471     @Attr:
1472     @@Name: localName
1473     @@enDesc:
1474     The name of this subroutine.
1475     @@Type:
1476     DISPerl:SubName
1477     @@Get:
1478     @@@nullCase:
1479     @@@@enDesc:
1480     This subroutine has no name.
1481     @@@disDef:
1482     @@@@GetProp: localName
1483     @@Set:
1484     @@@enDesc:
1485     Sets the name of this subroutine.
1486     \
1487     {NOTE:: Setting this attribute does not change the
1488     name by which the subroutine is registerred to
1489     the parent object.
1490     \
1491     }
1492     @@@nullCase:
1493     @@@@enDesc:
1494     This subroutine has no name.
1495     @@@disDef:
1496     @@@@SetProp: localName
1497    
1498     @Attr:
1499     @@Name: prototype
1500     @@enDesc:
1501     The prototype of this subroutine.
1502     @@Type:
1503     DISPerl:SubPrototype
1504     @@Get:
1505     @@@disDef:
1506     @@@@GetProp: prototype
1507     @@@nullCase:
1508     @@@@enDesc:
1509     No prototype is set.
1510     @@Set:
1511     @@@disDef:
1512     @@@@SetProp: prototype
1513     @@@nullCase:
1514     @@@@enDesc:
1515     No prototype declaration.
1516    
1517 wakaba 1.4 @ToStringMethod:
1518     @@Return:
1519     @@@Type:
1520     DISLang:String
1521     @@@enDesc:
1522     Perl code.
1523     @@@PerlDef:
1524     my $node = $self->{<Q::TreeCore:node>};
1525     $r = q<sub>;
1526     $r .= ' ' . $node->{<Q::pc:localName>}
1527     if defined $node->{<Q::pc:localName>};
1528     $r .= ' (' . $node->{<Q::pc:prototype>} . ')'
1529     if defined $node->{<Q::pc:prototype>};
1530     $r .= " {\n";
1531 wakaba 1.6 for my $cno (@{$node->{<Q::pc:childNodes>}}) {
1532 wakaba 1.7 my $cn = <ClassM::ManakaiPerlCodeFragment.getNodeReference> ($cno);
1533 wakaba 1.6 $r .= $cn->stringify;
1534     }
1535 wakaba 1.4 $r .= "}\n";
1536 wakaba 1.1 ##PerlSub
1537    
1538 wakaba 1.5 XParamDef:
1539     @QName: parentNode
1540     @enDesc:
1541     Parent node.
1542    
1543     XParamDef:
1544     @QName: childNode
1545     @enDesc:
1546     Child node.
1547    
1548 wakaba 1.1 ClsDef:
1549     @ClsQName: ManakaiPerlUnparsedCode
1550     @ClsISA: ManakaiPerlCodeFragment
1551     @enDesc:
1552     Unparsed Perl code fragments.
1553    
1554     @IntMethod:
1555     @@Name:newObject
1556     @@ManakaiDOM:isStatic:1
1557     @@Description:
1558     @@@lang:en
1559     @@@@:
1560     Creates a new instance object for <Class::ManakaiPerlUnparsedCode>.
1561     @@Return:
1562     @@@Type:
1563     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
1564     @@@Description:
1565     @@@@lang:en
1566     @@@@@:
1567     The newly created node object.
1568     @@@PerlDef:
1569     @@@@@:
1570     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
1571     ::ManakaiDOM:Perl.new>;
1572     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
1573     $node->{<Q::pc:code>} = '';
1574 wakaba 1.6 $node->{<Q::pc:nodeType>} = 'unparsed';
1575 wakaba 1.1 @@@@ImplNote:
1576     @@@@@lang:en
1577     @@@@@@:
1578 wakaba 1.9 Properties: <Q::pc:nodeType>, <Q::pc:code>,
1579     <Q::pc:sourceFile>, <Q::pc:sourceLine>.
1580    
1581     @IntCloneMethod:
1582     @@Return:
1583     @@@Type:
1584     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
1585     @@@PerlDef:
1586     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
1587     ::ManakaiDOM:Perl.new>;
1588     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
1589     for my $prop (<Q::pc:sourceFile>, <Q::pc:sourceLine>, <Q::pc:code>) {
1590     $node->{$prop} = $nodeObject->{$prop};
1591     }
1592     $node->{<Q::pc:nodeType>} = 'unparsed';
1593 wakaba 1.5
1594     @Attr:
1595     @@Name: code
1596     @@enDesc:
1597     Perl code.
1598     @@Type:
1599     lang:Perl::ManakaiDOM:all
1600     @@Get:
1601     @@@disDef:
1602     @@@@GetProp: code
1603     @@Set:
1604     @@@disDef:
1605     @@@@SetProp: code
1606    
1607     @Attr:
1608     @@Name: sourceFile
1609     @@enDesc:
1610     The source file name of this fragment.
1611     @@Type:
1612     DISLang:String
1613     @@Get:
1614     @@@enDesc:
1615     Any string identifying the source.
1616     @@@nullCase:
1617     @@@@enDesc: No source file name is set.
1618     @@@disDef:
1619     @@@@GetProp: sourceFile
1620     @@Set:
1621     @@@nullCase:
1622     @@@@enDesc: No (or unknown) source file.
1623     @@@disDef:
1624     @@@@SetProp: sourceFile
1625    
1626     @Attr:
1627     @@Name: sourceLine
1628     @@enDesc:
1629     Source file line number of the first line of this fragment.
1630     @@Type:
1631     DOMMain:unsigned-long
1632     @@Get:
1633     @@@disDef:
1634     @@@@GetProp: sourceLine
1635     @@Set:
1636     @@@disDef:
1637     @@@@SetProp: sourceLine
1638 wakaba 1.6
1639     @ToStringMethod:
1640     @@Return:
1641     @@@Type:
1642     DISLang:String
1643     @@@enDesc:
1644     Perl code.
1645     @@@PerlDef:
1646     my $node = $self->{<Q::TreeCore:node>};
1647     __DEEP{
1648     my $file = $self-><AG::ManakaiPerlCodeFragment.fileNode>;
1649 wakaba 1.9 $r = sprintf (qq<\n#line %d "%s (Chunk #%d)"\n>,
1650 wakaba 1.6 $node->{<Q::pc:sourceLine>},
1651     $node->{<Q::pc:sourceFile>},
1652     $file-><M::ManakaiPerlFile.getNextChunkNumber>)
1653     . $node->{<Q::pc:code>}
1654 wakaba 1.9 . sprintf (qq<\n#line 1 "%s (Chunk #%d)"\n>,
1655 wakaba 1.6 $file-><AG::ManakaiPerlFile.sourceFile>,
1656     $file-><M::ManakaiPerlFile.getNextChunkNumber>);
1657     }__;
1658 wakaba 1.1 ##PerlUnparsedCode
1659    
1660     ClsDef:
1661 wakaba 1.6 @ClsQName: ManakaiPerlInlineUnparsedCode
1662     @ClsISA: ManakaiPerlCodeFragment
1663     @enDesc:
1664     Unparsed Perl inline code fragments.
1665    
1666     @IntMethod:
1667     @@Name:newObject
1668     @@ManakaiDOM:isStatic:1
1669     @@Description:
1670     @@@lang:en
1671     @@@@:
1672     Creates a new instance object for
1673     <Class::ManakaiPerlInlineUnparsedCode>.
1674     @@Return:
1675     @@@Type:
1676     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
1677     @@@Description:
1678     @@@@lang:en
1679     @@@@@:
1680     The newly created node object.
1681     @@@PerlDef:
1682     @@@@@:
1683     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
1684     ::ManakaiDOM:Perl.new>;
1685     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
1686     $node->{<Q::pc:code>} = '';
1687     $node->{<Q::pc:nodeType>} = 'inunparsed';
1688     @@@@ImplNote:
1689     @@@@@lang:en
1690     @@@@@@:
1691     Properties: <Q::pc:nodeType>, <Q::pc:code>.
1692    
1693 wakaba 1.9 @IntCloneMethod:
1694     @@Return:
1695     @@@Type:
1696     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
1697     @@@PerlDef:
1698     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
1699     ::ManakaiDOM:Perl.new>;
1700     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
1701     for my $prop (<Q::pc:code>) {
1702     $node->{$prop} = $nodeObject->{$prop};
1703     }
1704     $node->{<Q::pc:nodeType>} = 'inunparsed';
1705    
1706 wakaba 1.6 @Attr:
1707     @@Name: code
1708     @@enDesc:
1709     Perl code.
1710     @@Type:
1711     lang:Perl::ManakaiDOM:all
1712     @@Get:
1713     @@@disDef:
1714     @@@@GetProp: code
1715     @@Set:
1716     @@@disDef:
1717     @@@@SetProp: code
1718    
1719     @ToStringMethod:
1720     @@Return:
1721     @@@Type:
1722     DISLang:String
1723     @@@enDesc:
1724     Perl code.
1725     @@@PerlDef:
1726     my $node = $self->{<Q::TreeCore:node>};
1727     $r = $node->{<Q::pc:code>};
1728     ##PerlInlineUnparsedCode
1729    
1730     ClsDef:
1731     @ClsQName: ManakaiPerlStringLiteral
1732     @ClsISA: ManakaiPerlCodeFragment
1733     @enDesc:
1734     Perl string literal.
1735    
1736     @IntMethod:
1737     @@Name:newObject
1738     @@ManakaiDOM:isStatic:1
1739     @@Description:
1740     @@@lang:en
1741     @@@@:
1742     Creates a new instance object for
1743     <Class::ManakaiPerlStringLiteral>.
1744     @@Return:
1745     @@@Type:
1746     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
1747     @@@Description:
1748     @@@@lang:en
1749     @@@@@:
1750     The newly created node object.
1751     @@@PerlDef:
1752     @@@@@:
1753     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
1754     ::ManakaiDOM:Perl.new>;
1755     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
1756     $node->{<Q::infoset:data>} = '';
1757     $node->{<Q::pc:nodeType>} = 'string';
1758     @@@@ImplNote:
1759     @@@@@lang:en
1760     @@@@@@:
1761     Properties: <Q::pc:nodeType>, <Q::infoset:data>.
1762    
1763 wakaba 1.9 @IntCloneMethod:
1764     @@Return:
1765     @@@Type:
1766     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
1767     @@@PerlDef:
1768     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
1769     ::ManakaiDOM:Perl.new>;
1770     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
1771     for my $prop (<Q::infoset:data>) {
1772     $node->{$prop} = $nodeObject->{$prop};
1773     }
1774     $node->{<Q::pc:nodeType>} = 'string';
1775    
1776 wakaba 1.6 @Attr:
1777     @@Name: data
1778     @@enDesc:
1779     String data.
1780     @@Type:
1781     DISLang:String::ManakaiDOM:all
1782     @@Get:
1783     @@@disDef:
1784     @@@@GetProp:
1785     infoset:data
1786     @@Set:
1787     @@@disDef:
1788     @@@@SetProp:
1789     infoset:data
1790    
1791     @ToStringMethod:
1792     @@Return:
1793     @@@Type:
1794     DISLang:String
1795     @@@enDesc:
1796     Perl code.
1797     @@@PerlDef:
1798     my $node = $self->{<Q::TreeCore:node>};
1799     $r = $node->{<Q::infoset:data>};
1800     $r =~ s/(['\\])/\\$1/g;
1801     $r = q<'> . $r . q<'>;
1802     ##PerlStringLiteral
1803    
1804     ClsDef:
1805     @ClsQName: ManakaiPerlBare
1806     @ClsISA: ManakaiPerlCodeFragment
1807     @enDesc:
1808     Unparsed Perl inline code fragments.
1809    
1810     @IntMethod:
1811     @@Name:newObject
1812     @@ManakaiDOM:isStatic:1
1813     @@Description:
1814     @@@lang:en
1815     @@@@:
1816     Creates a new instance object for
1817     <Class::ManakaiPerlInlineBare>.
1818     @@Return:
1819     @@@Type:
1820     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
1821     @@@Description:
1822     @@@@lang:en
1823     @@@@@:
1824     The newly created node object.
1825     @@@PerlDef:
1826     @@@@@:
1827     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
1828     ::ManakaiDOM:Perl.new>;
1829     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
1830     $node->{<Q::pc:code>} = '';
1831     $node->{<Q::pc:nodeType>} = 'bare';
1832     @@@@ImplNote:
1833     @@@@@lang:en
1834     @@@@@@:
1835     Properties: <Q::pc:nodeType>, <Q::pc:code>.
1836    
1837 wakaba 1.9 @IntCloneMethod:
1838     @@Return:
1839     @@@Type:
1840     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
1841     @@@PerlDef:
1842     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
1843     ::ManakaiDOM:Perl.new>;
1844     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
1845     for my $prop (<Q::pc:code>) {
1846     $node->{$prop} = $nodeObject->{$prop};
1847     }
1848     $node->{<Q::pc:nodeType>} = 'bare';
1849    
1850 wakaba 1.6 @Attr:
1851     @@Name: code
1852     @@enDesc:
1853     Perl code.
1854     @@Type:
1855     lang:Perl::ManakaiDOM:all
1856     @@Get:
1857     @@@disDef:
1858     @@@@GetProp: code
1859     @@Set:
1860     @@@disDef:
1861     @@@@SetProp: code
1862    
1863     @ToStringMethod:
1864     @@Return:
1865     @@@Type:
1866     DISLang:String
1867     @@@enDesc:
1868     Perl code.
1869     @@@PerlDef:
1870     my $node = $self->{<Q::TreeCore:node>};
1871     $r = $node->{<Q::pc:code>};
1872     ##PerlBare
1873    
1874     ClsDef:
1875     @ClsQName: ManakaiPerlAtom
1876     @ClsISA: ManakaiPerlBare
1877     @enDesc:
1878     Unparsed Perl atomic code fragments (such as numeric literal).
1879    
1880     @IntMethod:
1881     @@Name:newObject
1882     @@ManakaiDOM:isStatic:1
1883     @@Description:
1884     @@@lang:en
1885     @@@@:
1886     Creates a new instance object for
1887     <Class::ManakaiPerlAtom>.
1888     @@Return:
1889     @@@Type:
1890     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
1891     @@@Description:
1892     @@@@lang:en
1893     @@@@@:
1894     The newly created node object.
1895     @@@PerlDef:
1896     @@@@@:
1897     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
1898     ::ManakaiDOM:Perl.new>;
1899     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
1900     $node->{<Q::pc:code>} = '';
1901     $node->{<Q::pc:nodeType>} = 'atom';
1902     @@@@ImplNote:
1903     @@@@@lang:en
1904     @@@@@@:
1905     Properties: <Q::pc:nodeType>, <Q::pc:code>.
1906    
1907 wakaba 1.9 @IntCloneMethod:
1908     @@Return:
1909     @@@Type:
1910     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
1911     @@@PerlDef:
1912     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
1913     ::ManakaiDOM:Perl.new>;
1914     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
1915     for my $prop (<Q::pc:code>) {
1916     $node->{$prop} = $nodeObject->{$prop};
1917     }
1918     $node->{<Q::pc:nodeType>} = 'atom';
1919    
1920 wakaba 1.6 @ToStringMethod:
1921     @@Return:
1922     @@@Type:
1923     DISLang:String
1924     @@@enDesc:
1925     Perl code.
1926     @@@PerlDef:
1927     my $node = $self->{<Q::TreeCore:node>};
1928     $r = $node->{<Q::pc:code>};
1929     ##PerlAtom
1930    
1931     ClsDef:
1932     @ClsQName: ManakaiPerlVariable
1933     @ClsISA: ManakaiPerlCodeFragment
1934     @enDesc:
1935     Unparsed Perl variable.
1936     \
1937     {NOTE:: Future version of the implementation may
1938     support to specify array index or hash key.
1939     \
1940     }
1941    
1942     @IntMethod:
1943     @@Name:newObject
1944     @@ManakaiDOM:isStatic:1
1945     @@Description:
1946     @@@lang:en
1947     @@@@:
1948     Creates a new instance object for
1949     <Class::ManakaiPerlVariable>.
1950     @@Return:
1951     @@@Type:
1952     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
1953     @@@Description:
1954     @@@@lang:en
1955     @@@@@:
1956     The newly created node object.
1957     @@@PerlDef:
1958     @@@@@:
1959     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
1960     ::ManakaiDOM:Perl.new>;
1961     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
1962     $node->{<Q::pc:variableType>} = '';
1963     $node->{<Q::pc:nodeType>} = 'variable';
1964     @@@@ImplNote:
1965     @@@@@lang:en
1966     @@@@@@:
1967     Properties: <Q::pc:nodeType>, <Q::pc:variableType>,
1968     <Q::packageName>, <Q::localName> (required),
1969 wakaba 1.9 <Q::variableScope>, <Q::hashKey>.
1970    
1971     @IntCloneMethod:
1972     @@Return:
1973     @@@Type:
1974     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
1975     @@@PerlDef:
1976     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
1977     ::ManakaiDOM:Perl.new>;
1978     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
1979     for my $prop (<Q::pc:variableType>, <Q::packageName>,
1980     <Q::localName>, <Q::variableScope>, <Q::hashKey>) {
1981     $node->{$prop} = $nodeObject->{$prop};
1982     }
1983     $node->{<Q::pc:nodeType>} = 'variable';
1984 wakaba 1.6
1985     @Attr:
1986     @@Name: variableType
1987     @@enDesc:
1988     Perl variable type (<CODE::$>, <CODE::@>, <CODE::%>,
1989     <CODE::&> or empty string).
1990     @@Type:
1991     lang:Perl::ManakaiDOM:all
1992     @@Get:
1993     @@@disDef:
1994     @@@@GetProp: variableType
1995     @@Set:
1996     @@@disDef:
1997     @@@@SetProp: variableType
1998    
1999     @Attr:
2000     @@Name: packageName
2001     @@enDesc:
2002     The name of the package to which this variable belongs.
2003     @@Type:
2004     Perl:package-name::ManakaiDOM:all
2005     @@Get:
2006     @@@nullCase:
2007     @@@@enDesc:
2008     This package belongs to the current package or
2009     does not belong to any package.
2010     @@@disDef:
2011     @@@@GetProp: packageName
2012     @@Set:
2013     @@@nullCase:
2014     @@@@enDesc:
2015     This package belongs to the current package or
2016     does not belong to any package.
2017     @@@disDef:
2018     @@@@SetProp: variableType
2019    
2020     @Attr:
2021     @@Name: localName
2022     @@enDesc:
2023     The local variable name.
2024     @@Type:
2025     lang:Perl::ManakaiDOM:all
2026     @@Get:
2027     @@@disDef:
2028     @@@@GetProp: localName
2029     @@Set:
2030     @@@disDef:
2031     @@@@SetProp: localName
2032    
2033     @Attr:
2034     @@Name: variableScope
2035     @@enDesc:
2036     Scope modifier (<CODE::my> or <CODE::our> or <CODE::local>).
2037     @@Type:
2038     lang:Perl::ManakaiDOM:all
2039     @@Get:
2040     @@@nullCase:
2041     @@@@enDesc:
2042     This variable does not have scope modifier.
2043     @@@disDef:
2044     @@@@GetProp: variableScope
2045     @@Set:
2046     @@@nullCase:
2047     @@@@enDesc:
2048     This variable does not have scope modifier.
2049     @@@disDef:
2050     @@@@SetProp: variableScope
2051    
2052     @ToStringMethod:
2053     @@Return:
2054     @@@Type:
2055     DISLang:String
2056     @@@enDesc:
2057     Perl code.
2058     @@@PerlDef:
2059     my $node = $self->{<Q::TreeCore:node>};
2060     $r = $node->{<Q::pc:variableType>};
2061     $r .= $node->{<Q::pc:packageName>} . '::'
2062     if defined $node->{<Q::pc:packageName>};
2063     $r .= $node->{<Q::pc:localName>};
2064     if ($node->{<Q::pc:variableType>} eq '$' and
2065     defined $node->{<Q::pc:hashKey>}) {
2066     my $hashKey = $node->{<Q::pc:hashKey>};
2067     $hashKey =~ s/(['\\])/\\$1/g;
2068     $r .= q<{'> . $hashKey . q<'}>;
2069     }
2070    
2071     @Attr:
2072     @@Name: hashKey
2073     @@enDesc:
2074     The key for hash.
2075     \
2076     {NOTE:: Using Perl code for key is not supported in the current
2077     version of the implementation.
2078     \
2079     }
2080     @@Type:
2081     DISLang:String::ManakaiDOM:all
2082     @@Get:
2083     @@@nullCase:
2084     @@@@enDesc:
2085     This variable is not for hash value access.
2086     @@@disDef:
2087     @@@@GetProp: hashKey
2088     @@Set:
2089     @@@nullCase:
2090     @@@@enDesc:
2091     This variable is not for hash value access.
2092     @@@disDef:
2093     @@@@SetProp: hashKey
2094     ##PerlInlineUnparsedCode
2095    
2096     PropDef:
2097     @QName: variableScope
2098     @enDesc:
2099     Variable scope (<CODE::local>, <CODE::my> or <CODE::our>).
2100    
2101     PropDef:
2102     @QName: variableType
2103     @enDesc:
2104     Variable type prefix.
2105    
2106     PropDef:
2107     @QName: hashKey
2108     @enDesc:
2109     Hash key string.
2110    
2111     ClsDef:
2112     @ClsQName: ManakaiPerlAnyContainer
2113     @ClsISA: ManakaiPerlCodeFragment
2114     @enDesc:
2115     A base class implemented by both inline container and
2116     block-level container.
2117    
2118     @Attr:
2119     @@Name: length
2120     @@enDesc:
2121     The number of child code fragments.
2122     @@Type:
2123     DOMMain:unsigned-long
2124     @@Get:
2125     @@@PerlDef:
2126     $r = @{$self->{<Q::TreeCore:node>}->{<Q::pc:childNodes>}};
2127    
2128     @Method:
2129     @@Name: appendStringLiteral
2130     @@enDesc:
2131     Appends a Perl string literal (<CODE::q>).
2132     @@Param:
2133     @@@Name: stringArg
2134     @@@Type:
2135     DISLang:String::ManakaiDOM:all
2136     @@@enDesc:
2137     A string.
2138     @@Return:
2139     @@@Type: ManakaiPerlStringLiteral
2140     @@@enDesc:
2141     The newly created Perl string literal object.
2142     @@@PerlDef:
2143     $r = <ClassM::ManakaiPerlStringLiteral.newObject>;
2144     my $node = $self->{<Q::TreeCore:node>};
2145     $r->{<Q::infoset:data>} = $stringArg;
2146     $node-><M::ManakaiDOM:ManakaiDOMNodeObject
2147     ::ManakaiDOM:Perl.importTree> ($r);
2148     push @{$node->{<Q::pc:childNodes>}}, $r;
2149     $r->{<Q::pc:parent>} = $node;
2150     if (defined wantarray) {
2151     __CODE{ManakaiNode:getNewReference::
2152     $object => $r, $ref => $r,
2153     $class =>{<ClassName::ManakaiPerlStringLiteral>},
2154     }__;
2155     }
2156    
2157    
2158     @Method:
2159     @@Name: appendAtom
2160     @@enDesc:
2161     Appends a Perl atomic code fragment.
2162     @@Param:
2163     @@@Name: codeArg
2164     @@@Type:
2165     lang:Perl::ManakaiDOM:all
2166     @@@enDesc:
2167     An atom.
2168     @@Return:
2169     @@@Type: ManakaiPerlAtom
2170     @@@enDesc:
2171     The newly created Perl code object.
2172     @@@PerlDef:
2173     $r = <ClassM::ManakaiPerlAtom.newObject>;
2174     my $node = $self->{<Q::TreeCore:node>};
2175 wakaba 1.7 $r->{<Q::pc:code>} = $codeArg;
2176 wakaba 1.6 $node-><M::ManakaiDOM:ManakaiDOMNodeObject
2177     ::ManakaiDOM:Perl.importTree> ($r);
2178     push @{$node->{<Q::pc:childNodes>}}, $r;
2179     $r->{<Q::pc:parent>} = $node;
2180     if (defined wantarray) {
2181     __CODE{ManakaiNode:getNewReference::
2182     $object => $r, $ref => $r,
2183     $class =>{<ClassName::ManakaiPerlAtom>},
2184     }__;
2185     }
2186    
2187    
2188     @Method:
2189     @@Name: appendBare
2190     @@enDesc:
2191     Appends a Perl bare code fragment.
2192     @@Param:
2193     @@@Name: codeArg
2194     @@@Type:
2195     lang:Perl::ManakaiDOM:all
2196     @@@enDesc:
2197 wakaba 1.7 An bare code.
2198 wakaba 1.6 @@Return:
2199     @@@Type: ManakaiPerlBare
2200     @@@enDesc:
2201     The newly created Perl code object.
2202     @@@PerlDef:
2203     $r = <ClassM::ManakaiPerlBare.newObject>;
2204     my $node = $self->{<Q::TreeCore:node>};
2205 wakaba 1.7 $r->{<Q::pc:code>} = $codeArg;
2206 wakaba 1.6 $node-><M::ManakaiDOM:ManakaiDOMNodeObject
2207     ::ManakaiDOM:Perl.importTree> ($r);
2208     push @{$node->{<Q::pc:childNodes>}}, $r;
2209     $r->{<Q::pc:parent>} = $node;
2210     if (defined wantarray) {
2211     __CODE{ManakaiNode:getNewReference::
2212     $object => $r, $ref => $r,
2213     $class =>{<ClassName::ManakaiPerlBare>},
2214     }__;
2215     }
2216 wakaba 1.8 ##PerlAnyContainer
2217 wakaba 1.6
2218 wakaba 1.8 ClsDef:
2219     @ClsQName: ManakaiPerlStatement
2220     @ClsISA: ManakaiPerlInlineContainer
2221     @enDesc:
2222     Perl statements.
2223    
2224     @IntMethod:
2225     @@Name:newObject
2226     @@ManakaiDOM:isStatic:1
2227     @@Description:
2228     @@@lang:en
2229     @@@@:
2230     Creates a new instance object for
2231     <Class::ManakaiPerlStatement>.
2232     @@Return:
2233     @@@Type:
2234     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
2235     @@@Description:
2236     @@@@lang:en
2237     @@@@@:
2238     The newly created node object.
2239     @@@PerlDef:
2240     @@@@@:
2241     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
2242     ::ManakaiDOM:Perl.new>;
2243     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
2244     $node->{<Q::pc:childNodes>} = [];
2245     $node->{<Q::pc:nodeType>} = 'statement';
2246     @@@@ImplNote:
2247     @@@@@lang:en
2248     @@@@@@:
2249 wakaba 1.9 Properties: <Q::pc:nodeType>, <Q::pc:childNodes>, <Q::pc:parent>.
2250    
2251     @IntCloneMethod:
2252     @@Return:
2253     @@@Type:
2254     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
2255     @@@PerlDef:
2256     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
2257     ::ManakaiDOM:Perl.new>;
2258     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
2259     $node->{<Q::pc:nodeType>} = 'statement';
2260     $node->{<Q::pc:childNodes>} = [];
2261     for my $cno (@{$nodeObject->{<Q::pc:childNodes>}}) {
2262     my $pack;
2263     my $nt = $cno->{<Q::pc:nodeType>};
2264     __CODE{pc:nodeTypeToPackageName::
2265     $nodeType => $nt, $packageName => $pack, $object => $cno}__;
2266     ## NOTE: Method name written directly
2267     my $cno_clone = $pack->_make_clone_object;
2268     push @{$node->{<Q::pc:childNodes>}}, $cno_clone;
2269     $cno_clone->{<Q::pc:parent>} = $node;
2270     ## NOTE: Tree ID is not updated yet.
2271     }
2272 wakaba 1.8
2273     @ToStringMethod:
2274     @@Return:
2275     @@@Type:
2276     DISLang:String
2277     @@@enDesc:
2278     Perl code.
2279     @@@PerlDef:
2280     $r = $self->SUPER::stringify;
2281     $r .= ';' if length $r;
2282     ##PerlStatement
2283 wakaba 1.6
2284     ClsDef:
2285     @ClsQName: ManakaiPerlInlineContainer
2286     @ClsISA: ManakaiPerlAnyContainer
2287     @enDesc:
2288     Unparsed Perl inline code block.
2289    
2290     @IntMethod:
2291     @@Name:newObject
2292     @@ManakaiDOM:isStatic:1
2293     @@Description:
2294     @@@lang:en
2295     @@@@:
2296     Creates a new instance object for
2297     <Class::ManakaiPerlInlineContainer>.
2298     @@Return:
2299     @@@Type:
2300     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
2301     @@@Description:
2302     @@@@lang:en
2303     @@@@@:
2304     The newly created node object.
2305     @@@PerlDef:
2306     @@@@@:
2307     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
2308     ::ManakaiDOM:Perl.new>;
2309     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
2310     $node->{<Q::pc:childNodes>} = [];
2311     $node->{<Q::pc:nodeType>} = 'incontainer';
2312     @@@@ImplNote:
2313     @@@@@lang:en
2314     @@@@@@:
2315 wakaba 1.9 Properties: <Q::pc:nodeType>, <Q::pc:childNodes>,
2316     <Q::pc:parent>.
2317    
2318     @IntCloneMethod:
2319     @@Return:
2320     @@@Type:
2321     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
2322     @@@PerlDef:
2323     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
2324     ::ManakaiDOM:Perl.new>;
2325     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
2326     $node->{<Q::pc:nodeType>} = 'incontainer';
2327     $node->{<Q::pc:childNodes>} = [];
2328     for my $cno (@{$nodeObject->{<Q::pc:childNodes>}}) {
2329     my $pack;
2330     my $nt = $cno->{<Q::pc:nodeType>};
2331     __CODE{pc:nodeTypeToPackageName::
2332     $nodeType => $nt, $packageName => $pack, $object => $cno}__;
2333     ## NOTE: Method name written directly
2334     my $cno_clone = $pack->_make_clone_object;
2335     push @{$node->{<Q::pc:childNodes>}}, $cno_clone;
2336     $cno_clone->{<Q::pc:parent>} = $node;
2337     ## NOTE: Tree ID is not updated yet.
2338     }
2339 wakaba 1.6
2340     @Method:
2341     @@Name: appendCodeFragment
2342     @@enDesc:
2343     Appends a <Class::ManakaiPerlCodeFragment> object.
2344     @@Param:
2345     @@@Name: codeArg
2346     @@@Type: ManakaiPerlCodeFragment
2347     @@@enDesc:
2348     A code fragment object.
2349     @@Return:
2350     @@@RaiseException:
2351     @@@@@:BAD_CHILD_ERR
2352     @@@@enDesc:
2353     An attempt is made to append a child
2354     that is not a <Class::ManakaiPerlUnparsedCode>.
2355     @@@RaiseException:
2356     @@@@@:IN_USE_NODE_ERR
2357     @@@@enDesc:
2358     An attempt is made to append a node that is
2359     already used elsewhere.
2360     @@@PerlDef:
2361     if ({
2362     atom => 1, bare => 1, incontainer => 1,
2363     inunparsed => 1, variable => 1,
2364     }->{$codeArg->{<Q::TreeCore:node>}->{<Q::pc:nodeType>}}) {
2365     if ($codeArg->{<Q::TreeCore:node>}->{<Q::pc:parent>}) {
2366     __EXCEPTION{IN_USE_NODE_ERR::
2367     pc:parentNode => {$codeArg->{<Q::TreeCore:node>}
2368     ->{<Q::pc:parent>}},
2369     pc:childNode => {$codeArg},
2370     }__;
2371     }
2372     $self->{<Q::TreeCore:node>}-><M::MNodeObject.importTree>
2373     ($codeArg->{<Q::TreeCore:node>});
2374     push @{$self->{<Q::TreeCore:node>}->{<Q::pc:childNodes>}},
2375     $codeArg->{<Q::TreeCore:node>};
2376     $codeArg->{<Q::TreeCore:node>}->{<Q::pc:parent>}
2377     = $self->{<Q::TreeCore:node>};
2378     } else {
2379     __EXCEPTION{BAD_CHILD_ERR::
2380     pc:parentNode => {$self},
2381     pc:childNode => {$codeArg},
2382     }__;
2383     }
2384    
2385     @Method:
2386     @@Name: appendCode
2387     @@enDesc:
2388     Appends an unparsed Perl code fragment.
2389     @@Param:
2390     @@@Name: codeArg
2391     @@@Type:
2392     lang:Perl::ManakaiDOM:all
2393     @@@enDesc:
2394     An unparsed Perl code fragment.
2395     @@Return:
2396     @@@Type: ManakaiPerlInlineUnparsedCode
2397     @@@enDesc:
2398     The newly created Perl code object.
2399     @@@PerlDef:
2400     $r = <ClassM::ManakaiPerlInlineUnparsedCode.newObject>;
2401     my $node = $self->{<Q::TreeCore:node>};
2402     $r->{<Q::code>} = $codeArg;
2403     $node-><M::ManakaiDOM:ManakaiDOMNodeObject
2404     ::ManakaiDOM:Perl.importTree> ($r);
2405     push @{$node->{<Q::pc:childNodes>}}, $r;
2406     $r->{<Q::pc:parent>} = $node;
2407     if (defined wantarray) {
2408     __CODE{ManakaiNode:getNewReference::
2409     $object => $r, $ref => $r,
2410     $class =>{<ClassName::ManakaiPerlInlineUnparsedCode>},
2411     }__;
2412     }
2413    
2414     @ToStringMethod:
2415     @@Return:
2416     @@@Type:
2417     DISLang:String
2418     @@@enDesc:
2419     Perl code.
2420     @@@PerlDef:
2421     for my $cno (@{$self->{<Q::TreeCore:node>}->{<Q::pc:childNodes>}}) {
2422 wakaba 1.7 my $cn = <ClassM::ManakaiPerlCodeFragment.getNodeReference> ($cno);
2423 wakaba 1.6 if ($cno->{<Q::pc:nodeType>} eq 'incontainer' and
2424     \ @{$self->{<Q::TreeCore:node>}->{<Q::pc:childNodes>}} == 1) {
2425     $r .= '(' . $cn->stringify . ')';
2426     } else {
2427     $r .= $cn->stringify;
2428     }
2429     }
2430     ##PerlInlineContainer
2431    
2432 wakaba 1.8 ClsDef:
2433     @ClsQName: ManakaiPerlBlock
2434     @ClsISA: ManakaiPerlStatementContainer
2435     @enDesc:
2436     Perl block-level code block.
2437    
2438     @IntMethod:
2439     @@Name:newObject
2440     @@ManakaiDOM:isStatic:1
2441     @@Description:
2442     @@@lang:en
2443     @@@@:
2444     Creates a new instance object for
2445     <Class::ManakaiPerlBlock>.
2446     @@Return:
2447     @@@Type:
2448     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
2449     @@@Description:
2450     @@@@lang:en
2451     @@@@@:
2452     The newly created node object.
2453     @@@PerlDef:
2454     @@@@@:
2455     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
2456     ::ManakaiDOM:Perl.new>;
2457     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
2458     $node->{<Q::pc:childNodes>} = [];
2459     $node->{<Q::pc:nodeType>} = 'block';
2460     @@@@ImplNote:
2461     @@@@@lang:en
2462     @@@@@@:
2463 wakaba 1.9 Properties: <Q::pc:nodeType>, <Q::pc:childNodes>, <Q::pc:label>,
2464     <Q::pc:parent>.
2465    
2466     @IntCloneMethod:
2467     @@Return:
2468     @@@Type:
2469     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
2470     @@@PerlDef:
2471     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
2472     ::ManakaiDOM:Perl.new>;
2473     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
2474     $node->{<Q::pc:nodeType>} = 'block';
2475     $node->{<Q::pc:childNodes>} = [];
2476     for my $cno (@{$nodeObject->{<Q::pc:childNodes>}}) {
2477     my $pack;
2478     my $nt = $cno->{<Q::pc:nodeType>};
2479     __CODE{pc:nodeTypeToPackageName::
2480     $nodeType => $nt, $packageName => $pack, $object => $cno}__;
2481     ## NOTE: Method name written directly
2482     my $cno_clone = $pack->_make_clone_object ($cno);
2483     push @{$node->{<Q::pc:childNodes>}}, $cno_clone;
2484     $cno_clone->{<Q::pc:parent>} = $node;
2485     ## NOTE: Tree ID is not updated yet.
2486     }
2487     $node->{<Q::pc:label>} = $nodeObject->{<Q::pc:label>};
2488 wakaba 1.8
2489     @ToStringMethod:
2490     @@Return:
2491     @@@Type:
2492     DISLang:String
2493     @@@enDesc:
2494     Perl code.
2495     @@@PerlDef:
2496 wakaba 1.9 my $node = $self->{<Q::TreeCore:node>};
2497     if (@{$node->{<Q::pc:childNodes>}} == 1 and
2498     $node->{<Q::pc:childNodes>}->[0]->{<Q::pc:nodeType>} eq 'block') {
2499     my $cn;
2500     __CODE{ManakaiNode:getWeakReference::
2501     $object => {$node->{<Q::pc:childNodes>}->[0]},
2502     $ref => $cn,
2503     $class => {<ClassName::ManakaiPerlBlock>}}__;
2504     $r = $cn->stringify;
2505     } else {
2506     for my $cno (@{$node->{<Q::pc:childNodes>}}) {
2507     my $cn = <ClassM::ManakaiPerlCodeFragment.getNodeReference> ($cno);
2508     if ($cno->{<Q::pc:nodeType>} eq 'incontainer' and
2509     \ @{$node->{<Q::pc:childNodes>}} == 1) {
2510     $r .= '(' . $cn->stringify . ')';
2511     } else {
2512     $r .= $cn->stringify;
2513     }
2514 wakaba 1.8 }
2515 wakaba 1.9 __DEEP{
2516     my $file = $self-><AG::ManakaiPerlCodeFragment.fileNode>;
2517     $r = sprintf (qq<\n{\n#line %d "%s (Chunk #%d)"\n>,
2518     $node->{<Q::pc:sourceLine>},
2519     $node->{<Q::pc:sourceFile>},
2520     $file-><M::ManakaiPerlFile.getNextChunkNumber>)
2521     . $r
2522     . sprintf (qq<\n#line 1 "%s (Chunk #%d)"\n}\n>,
2523     $file-><AG::ManakaiPerlFile.sourceFile>,
2524     $file-><M::ManakaiPerlFile.getNextChunkNumber>);
2525     }__;
2526 wakaba 1.8 }
2527    
2528     ##PerlBlock
2529    
2530 wakaba 1.9 ClsDef:
2531     @ClsQName: ManakaiPerlBlockContainer
2532     @ClsISA: ManakaiPerlStatementContainer
2533     @enDesc:
2534     Perl block-level code container whose content may or may
2535     not semantically be self-contained.
2536    
2537     @IntMethod:
2538     @@Name:newObject
2539     @@ManakaiDOM:isStatic:1
2540     @@Description:
2541     @@@lang:en
2542     @@@@:
2543     Creates a new instance object for
2544     <Class::ManakaiPerlBlockContainer>.
2545     @@Return:
2546     @@@Type:
2547     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
2548     @@@Description:
2549     @@@@lang:en
2550     @@@@@:
2551     The newly created node object.
2552     @@@PerlDef:
2553     @@@@@:
2554     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
2555     ::ManakaiDOM:Perl.new>;
2556     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
2557     $node->{<Q::pc:childNodes>} = [];
2558     $node->{<Q::pc:nodeType>} = 'blockcontainer';
2559     @@@@ImplNote:
2560     @@@@@lang:en
2561     @@@@@@:
2562     Properties: <Q::pc:nodeType>, <Q::pc:childNodes>, <Q::pc:label>,
2563     <Q::pc:parent>.
2564    
2565     @IntCloneMethod:
2566     @@Return:
2567     @@@Type:
2568     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
2569     @@@PerlDef:
2570     my $node = $r = <ClassM::ManakaiDOM:ManakaiDOMNodeObject
2571     ::ManakaiDOM:Perl.new>;
2572     push @{$node->{<Q::TreeCore:origin>}}, <Q::pc:parent>;
2573     $node->{<Q::pc:nodeType>} = 'blockcontainer';
2574     $node->{<Q::pc:childNodes>} = [];
2575     for my $cno (@{$nodeObject->{<Q::pc:childNodes>}}) {
2576     my $pack;
2577     my $nt = $cno->{<Q::pc:nodeType>};
2578     __CODE{pc:nodeTypeToPackageName::
2579     $nodeType => $nt, $packageName => $pack, $object => $cno}__;
2580     ## NOTE: Method name written directly
2581     my $cno_clone = $pack->_make_clone_object ($cno);
2582     push @{$node->{<Q::pc:childNodes>}}, $cno_clone;
2583     $cno_clone->{<Q::pc:parent>} = $node;
2584     ## NOTE: Tree ID is not updated yet.
2585     }
2586     $node->{<Q::pc:label>} = $nodeObject->{<Q::pc:label>};
2587    
2588     @ToStringMethod:
2589     @@Return:
2590     @@@Type:
2591     DISLang:String
2592     @@@enDesc:
2593     Perl code.
2594     @@@PerlDef:
2595     my $node = $self->{<Q::TreeCore:node>};
2596     if (@{$node->{<Q::pc:childNodes>}} == 1 and
2597     {
2598     block => true, blockcontainer => true,
2599     }->{$node->{<Q::pc:childNodes>}->[0]->{<Q::pc:nodeType>}}) {
2600     my $cn;
2601     __CODE{ManakaiNode:getWeakReference::
2602     $object => {$node->{<Q::pc:childNodes>}->[0]},
2603     $ref => $cn,
2604     $class => {<ClassName::ManakaiPerlBlock>}}__;
2605     $r = $cn->stringify;
2606     } else {
2607     for my $cno (@{$node->{<Q::pc:childNodes>}}) {
2608     my $cn = <ClassM::ManakaiPerlCodeFragment.getNodeReference> ($cno);
2609     if ($cno->{<Q::pc:nodeType>} eq 'incontainer' and
2610     \ @{$node->{<Q::pc:childNodes>}} == 1) {
2611     $r .= '(' . $cn->stringify . ')';
2612     } else {
2613     $r .= $cn->stringify;
2614     }
2615     }
2616     __DEEP{
2617     my $file = $self-><AG::ManakaiPerlCodeFragment.fileNode>;
2618     $r = sprintf (qq<\n#line %d "%s (Chunk #%d)"\n>,
2619     $node->{<Q::pc:sourceLine>},
2620     $node->{<Q::pc:sourceFile>},
2621     $file-><M::ManakaiPerlFile.getNextChunkNumber>)
2622     . $r
2623     . sprintf (qq<\n#line 1 "%s (Chunk #%d)"\n>,
2624     $file-><AG::ManakaiPerlFile.sourceFile>,
2625     $file-><M::ManakaiPerlFile.getNextChunkNumber>);
2626     }__;
2627     }
2628    
2629     ##PerlBlockContainer
2630    
2631 wakaba 1.8 PropDef:
2632     @QName:label
2633     @enDesc:
2634     Perl statement / block label.
2635    
2636 wakaba 1.6 ElementTypeBinding:
2637     @Name: RaiseException
2638     @ElementType:
2639     ManakaiDOM:raises
2640    
2641     ClsDef:
2642     @ClsQName: ManakaiPerlCodeImplementation
2643 wakaba 1.1 @enDesc:
2644     The class that provides factory methods.
2645    
2646     @Role:
2647     @@@:
2648     DOMCore:DOMImplementation::ManakaiDOM:ManakaiDOM
2649     @@compat:
2650     DOMCore:ManakaiDOMImplementation::ManakaiDOM:ManakaiDOMLatest
2651    
2652     @Method:
2653     @@Name: createPerlFile
2654     @@enDesc:
2655     Creates a Perl code file.
2656     @@Return:
2657     @@@Type: ManakaiPerlFile
2658     @@@enDesc: A newly created Perl source file object.
2659     @@@PerlDef:
2660     $r = <ClassM::ManakaiPerlFile.newObject>;
2661 wakaba 1.6 __CODE{ManakaiNode:getNewReference::
2662     $object => $r, $ref => $r,
2663     $class => {<ClassName::ManakaiPerlFile>}}__;
2664 wakaba 1.1
2665     @IntMethod:
2666     @@Name: perlComment
2667     @@ManakaiDOM:isStatic:1
2668     @@enDesc:
2669     Generates a Perl comment string.
2670     @@Param:
2671     @@@Name: str
2672     @@@Type:
2673     DISLang:String
2674     @@@enDesc:
2675     A comment text.
2676     @@Return:
2677     @@@Type:
2678     DISLang:String
2679     @@@enDesc:
2680     A Perl comment string.
2681     @@@PerlDef:
2682     $r = $str;
2683     $r =~ s/\n/\n## /g;
2684     $r =~ s/\n## $/\n/s;
2685     $r .= "\n" unless $r =~ /\n$/;
2686     $r = q<## > . $r;
2687    
2688     @IntMethod:
2689     @@Name: rfc3339DateTime
2690     @@ManakaiDOM:isStatic:1
2691     @@enDesc:
2692     Returns RFC 3339 <CODE::date-time> representation of a date.
2693     @@Param:
2694     @@@Name: perlDate
2695     @@@Type:
2696     DOMMain:unsigned-long
2697     @@@enDesc:
2698     A Perl representation of date.
2699     @@Return:
2700     @@@Type:
2701     DISLang:String
2702     @@@enDesc:
2703     RFC 3339 date string.
2704     @@@PerlDef:
2705     my @time = gmtime $perlDate;
2706     $r = sprintf q<%04d-%02d-%02dT%02d:%02d:%02d+00:00>,
2707     $time[5] + 1900, $time[4] + 1, @time[3,2,1,0];
2708    
2709     @IntMethod:
2710     @@Name: versionDateTime
2711     @@ManakaiDOM:isStatic:1
2712     @@enDesc:
2713     Returns date for version.
2714     @@Param:
2715     @@@Name: perlDate
2716     @@@Type:
2717     DOMMain:unsigned-long
2718     @@@enDesc:
2719     A Perl representation of date.
2720     @@Return:
2721     @@@Type:
2722     DISLang:String
2723     @@@enDesc:
2724     A Perl number literal.
2725     @@@PerlDef:
2726     my @time = gmtime $perlDate;
2727     $r = sprintf q<%04d%02d%02d.%02d%02d>,
2728     $time[5] + 1900, $time[4] + 1, @time[3,2,1];
2729    
2730     @Method:
2731     @@Name: perlLiteral
2732     @@enDesc:
2733     Perl code representation.
2734     @@Param:
2735     @@@Name: val
2736     @@@Type:
2737     DOMMain:any
2738     @@@enDesc:
2739     A Perl value.
2740     @@Return:
2741     @@@Type:
2742     DISLang:String
2743     @@@enDesc:
2744     A Perl lexical representation of <P::val>.
2745     @@@PerlDef:
2746     unless (defined $val) {
2747     $r = q<undef>;
2748     } elsif (ref $val eq 'ARRAY') {
2749     __DEEP{
2750     $r = q<[> . <ClassM::ManakaiPerlCodeImplementation
2751     .perlLiteral> ($val) . q<]>;
2752     }__;
2753     } elsif (ref $val eq 'HASH') {
2754     __DEEP{
2755     $r = q<{> . <ClassM::ManakaiPerlCodeImplementation
2756     .perlLiteral> ([%$val]) . q<}>;
2757     }__;
2758     } else {
2759     $val =~ s/(['\\])/\\$1/g;
2760     $r = q<'> . $val . q<'>;
2761     }
2762    
2763     @Method:
2764     @@Name: perlList
2765     @@enDesc:
2766     Perl code representation of a list.
2767     @@Param:
2768     @@@Name: val
2769     @@@Type:
2770     Perl:ARRAY
2771     @@@enDesc:
2772     A Perl array reference.
2773     @@Return:
2774     @@@Type:
2775     DISLang:String
2776     @@@enDesc:
2777     A Perl lexical representation of <CODE::@$val>.
2778     @@@PerlDef:
2779     __DEEP{
2780     $r = join (q<, >, map {<ClassM::ManakaiPerlCodeImplementation
2781     .perlLiteral> ($_)} @{$val});
2782     }__;
2783 wakaba 1.5
2784     @Method:
2785     @@Name: createPerlSub
2786     @@enDesc:
2787     Creates a new <Class::ManakaiPerlSub> object.
2788     @@Param:
2789     @@@Name: subName
2790     @@@Type:
2791     DISLang:String
2792     @@@enDesc:
2793     The name of the subroutine to create.
2794     @@@nullCase:
2795     @@@@enDesc:
2796     The subroutine created has no name.
2797     @@Return:
2798     @@@Type:ManakaiPerlSub
2799     @@@enDesc:
2800     Newly created Perl subroutine object.
2801     @@@PerlDef:
2802     __DEEP{
2803 wakaba 1.6 $r = <ClassM::ManakaiPerlSub.newObject>;
2804     __CODE{ManakaiNode:getNewReference::
2805     $object => $r, $ref => $r,
2806     $class => {<ClassName::ManakaiPerlSub>}}__;
2807     $r-><AS::ManakaiPerlSub.localName> ($subName) if defined $subName;
2808 wakaba 1.5 }__;
2809    
2810     @Method:
2811     @@Name: createPerlUnparsedCode
2812     @@enDesc:
2813     Creates a new <Class::ManakaiPerlUnparsedCode> object.
2814     @@Param:
2815     @@@Name: codeArg
2816     @@@Type:
2817     lang:Perl::ManakaiDOM:all
2818     @@@enDesc:
2819     The code fragment.
2820     @@@nullCase:
2821     @@@@enDesc:
2822     The fragment initially has no code.
2823     @@Return:
2824     @@@Type:ManakaiPerlUnparsedCode
2825     @@@enDesc:
2826     Newly created Perl code object.
2827     @@@PerlDef:
2828     __DEEP{
2829 wakaba 1.6 $r = <ClassM::ManakaiPerlUnparsedCode.newObject>;
2830     __CODE{ManakaiNode:getNewReference::
2831     $object => $r, $ref => $r,
2832     $class => {<ClassName::ManakaiPerlUnparsedCode>}}__;
2833 wakaba 1.7 $r-><AS::ManakaiPerlUnparsedCode.code> ($codeArg) if defined $codeArg;
2834 wakaba 1.6 }__;
2835    
2836     @Method:
2837     @@Name: createPerlInlineContainer
2838     @@enDesc:
2839     Creates a new <Class::ManakaiPerlInlineContainer> object.
2840     @@Return:
2841     @@@Type:ManakaiPerlInlineContainer
2842     @@@enDesc:
2843     Newly created Perl code object.
2844     @@@PerlDef:
2845     __DEEP{
2846     $r = <ClassM::ManakaiPerlInlineContainer.newObject>;
2847     __CODE{ManakaiNode:getNewReference::
2848     $object => $r, $ref => $r,
2849     $class => {<ClassName::ManakaiPerlInlineContainer>}}__;
2850     }__;
2851    
2852     @Method:
2853     @@Name: createPerlInlineUnparsedCode
2854     @@enDesc:
2855     Creates a new <Class::ManakaiPerlInlineUnparsedCode> object.
2856     @@Param:
2857     @@@Name: codeArg
2858     @@@Type:
2859     lang:Perl::ManakaiDOM:all
2860     @@@enDesc:
2861     The code fragment.
2862     @@@nullCase:
2863     @@@@enDesc:
2864     The fragment initially has no code.
2865     @@Return:
2866     @@@Type:ManakaiPerlInlineUnparsedCode
2867     @@@enDesc:
2868     Newly created Perl code object.
2869     @@@PerlDef:
2870     __DEEP{
2871     $r = <ClassM::ManakaiPerlInlineUnparsedCode.newObject>;
2872     __CODE{ManakaiNode:getNewReference::
2873     $object => $r, $ref => $r,
2874     $class => {<ClassName::ManakaiPerlInlineUnparsedCode>}}__;
2875 wakaba 1.7 $r-><AS::ManakaiPerlInlineUnparsedCode.code> ($codeArg)
2876 wakaba 1.6 if defined $codeArg;
2877     }__;
2878    
2879     @Method:
2880     @@Name: createPerlBare
2881     @@enDesc:
2882     Creates a new <Class::ManakaiPerlBare> object.
2883     @@Param:
2884     @@@Name: codeArg
2885     @@@Type:
2886     lang:Perl::ManakaiDOM:all
2887     @@@enDesc:
2888     The code fragment.
2889     @@Return:
2890     @@@Type:ManakaiPerlBare
2891     @@@enDesc:
2892     Newly created Perl code object.
2893     @@@PerlDef:
2894     __DEEP{
2895     $r = <ClassM::ManakaiPerlBare.newObject>;
2896     __CODE{ManakaiNode:getNewReference::
2897     $object => $r, $ref => $r,
2898     $class => {<ClassName::ManakaiPerlBare>}}__;
2899 wakaba 1.7 $r-><AS::ManakaiPerlBare.code> ($codeArg);
2900 wakaba 1.6 }__;
2901    
2902     @Method:
2903     @@Name: createPerlAtom
2904     @@enDesc:
2905     Creates a new <Class::ManakaiPerlAtom> object.
2906     @@Param:
2907     @@@Name: codeArg
2908     @@@Type:
2909     lang:Perl::ManakaiDOM:all
2910     @@@enDesc:
2911     The code fragment.
2912     @@Return:
2913     @@@Type:ManakaiPerlAtom
2914     @@@enDesc:
2915     Newly created Perl code object.
2916     @@@PerlDef:
2917     __DEEP{
2918     $r = <ClassM::ManakaiPerlAtom.newObject>;
2919     __CODE{ManakaiNode:getNewReference::
2920     $object => $r, $ref => $r,
2921     $class => {<ClassName::ManakaiPerlAtom>}}__;
2922 wakaba 1.7 $r-><AS::ManakaiPerlBare.code> ($codeArg);
2923 wakaba 1.6 }__;
2924    
2925     @Method:
2926     @@Name: createPerlStringLiteral
2927     @@enDesc:
2928     Creates a new <Class::ManakaiPerlStringLiteral> object.
2929     @@Param:
2930     @@@Name: stringArg
2931     @@@Type:
2932     DISLang:String::ManakaiDOM:all
2933     @@@enDesc: A string.
2934     @@Return:
2935     @@@Type:ManakaiPerlStringLiteral
2936     @@@enDesc:
2937     Newly created Perl code object.
2938     @@@PerlDef:
2939     __DEEP{
2940     $r = <ClassM::ManakaiPerlStringLiteral.newObject>;
2941     __CODE{ManakaiNode:getNewReference::
2942     $object => $r, $ref => $r,
2943     $class => {<ClassName::ManakaiPerlStringLiteral>}}__;
2944 wakaba 1.7 $r-><AS::ManakaiPerlStringLiteral.data> ($stringArg);
2945 wakaba 1.6 }__;
2946    
2947     @Method:
2948     @@Name: createPerlVariable
2949     @@enDesc:
2950     Creates a new <Class::ManakaiPerlVariable> object.
2951     @@Param:
2952     @@@Name: variableType
2953     @@@Type:
2954     DISLang:String::ManakaiDOM:all
2955     @@@enDesc:
2956     Variable prefix.
2957     @@Param:
2958     @@@Name: packageName
2959     @@@Type:
2960     Perl:package-name::ManakaiDOM:all
2961     @@@enDesc:
2962     Package name.
2963     @@@nullCase:
2964     @@@@enDesc:
2965     The variable belongs to the current package or a
2966     lexical-scoped variable.
2967     @@Param:
2968     @@@Name: localName
2969     @@@Type:
2970     DISLang:String::ManakaiDOM:all
2971     @@@enDesc:
2972     Variable name.
2973     @@Return:
2974     @@@Type:ManakaiPerlVariable
2975     @@@enDesc:
2976     Newly created Perl variable object.
2977     @@@PerlDef:
2978     __DEEP{
2979     $r = <ClassM::ManakaiPerlVariable.newObject>;
2980     __CODE{ManakaiNode:getNewReference::
2981     $object => $r, $ref => $r,
2982     $class => {<ClassName::ManakaiPerlVariable>}}__;
2983 wakaba 1.7 $r-><AS::ManakaiPerlVariable.variableType> ($variableType);
2984     $r-><AS::ManakaiPerlVariable.packageName> ($packageName);
2985     $r-><AS::ManakaiPerlVariable.localName> ($localName);
2986 wakaba 1.8 }__;
2987    
2988     @Method:
2989     @@Name: createPerlBlock
2990     @@enDesc:
2991     Creates a new <Class::ManakaiPerlBlock> object.
2992     @@Return:
2993     @@@Type:ManakaiPerlBlock
2994     @@@enDesc:
2995     Newly created Perl code object.
2996     @@@PerlDef:
2997     __DEEP{
2998     $r = <ClassM::ManakaiPerlBlock.newObject>;
2999     __CODE{ManakaiNode:getNewReference::
3000     $object => $r, $ref => $r,
3001     $class => {<ClassName::ManakaiPerlBlock>}}__;
3002 wakaba 1.5 }__;
3003 wakaba 1.9
3004     @Method:
3005     @@Name: createPerlBlockContainer
3006     @@enDesc:
3007     Creates a new <Class::ManakaiPerlBlockContainer> object.
3008     @@Return:
3009     @@@Type:ManakaiPerlBlockContainer
3010     @@@enDesc:
3011     Newly created Perl code object.
3012     @@@PerlDef:
3013     __DEEP{
3014     $r = <ClassM::ManakaiPerlBlockContainer.newObject>;
3015     __CODE{ManakaiNode:getNewReference::
3016     $object => $r, $ref => $r,
3017     $class => {<ClassName::ManakaiPerlBlockContainer>}}__;
3018     }__;
3019 wakaba 1.1 ##PerlCodeImplementation
3020    
3021 wakaba 1.5 ResourceDef:
3022     @QName: MNodeObject
3023     @rdf:type:
3024     ManakaiDOM:Class
3025     @AliasFor:
3026     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
3027    
3028 wakaba 1.1 PropDef:
3029     @QName: code
3030     @enDesc: Perl code.
3031    
3032     PropDef:
3033     @QName: sourceFile
3034     @enDesc:
3035     Source file.
3036    
3037     PropDef:
3038     @QName: sourceLine
3039     @enDesc:
3040     Source line number.
3041    
3042     PropDef:
3043     @QName: prototype
3044     @enDesc:
3045     Prototype of subroutine.
3046    
3047     PropDef:
3048     @QName: parent
3049     @enDesc:
3050     Higher-level object.
3051    
3052     PropDef:
3053     @QName: sub
3054     @enDesc:
3055     Perl subroutines.
3056    
3057     PropDef:
3058     @QName: packageName
3059     @Type:
3060     Perl:package-name
3061     @enDesc:
3062     The fully qualified names of packages.
3063    
3064     PropDef:
3065     @QName: childNodes
3066     @enDesc:
3067     Child code fragments.
3068    
3069     PropDef:
3070     @QName: localName
3071     @enDesc:
3072     Scoped names.
3073 wakaba 1.4
3074     ## -- Exceptions
3075    
3076     ExceptionDef:
3077     @ClsQName: ManakaiPerlCodeException
3078     @enDesc:
3079     Exceptions for the <Module::PerlCode> module.
3080     @ClsISA:
3081     ManakaiDOM:ManakaiDOMException::ManakaiDOM:Perl
3082     @XConstGroupDef:
3083     @@ClsQName: ManakaiPerlCodeExceptionCode
3084     @@enDesc:
3085     Exception codes for <Class::ManakaiPerlCodeException>.
3086 wakaba 1.5 @@XConstDef:
3087     @@@Name: HIERARCHY_REQUEST_ERR
3088     @@@Value:3
3089     @@@enDesc:
3090     An attempt is made to break the hierarchy.
3091     @@@XSubTypeDef:
3092     @@@@QName: BAD_CHILD_ERR
3093     @@@@enDesc:
3094     An attempt is made to append a node as a child whose type
3095     is not allowed.
3096     @@@@XParam:
3097     @@@@@QName: childNode
3098     @@@@@enDesc:
3099     The node attempted to append.
3100     @@@@XParam:
3101     @@@@@QName: parentNode
3102     @@@@@enDesc:
3103     The node to whose child list an attempt to append is made.
3104     @@@XSubTypeDef:
3105     @@@@QName: IN_USE_NODE_ERR
3106     @@@@enDesc:
3107     An attempt is made to append a node that has already been used
3108     elsewhere.
3109     @@@@XParam:
3110     @@@@@QName: childNode
3111     @@@@@enDesc:
3112     The node attempted to append.
3113     @@@@XParam:
3114     @@@@@QName: parentNode
3115     @@@@@enDesc:
3116     The parent node of the <XP::childNode>.
3117 wakaba 1.4 @@XConstDef:
3118     @@@Name: NOT_SUPPORTED_ERR
3119     @@@Value:9
3120     @@@enDesc:
3121     An attempt is made to do something the implementation does not support.
3122     @@@XSubTypeDef:
3123     @@@@QName: UNSUPPORTED_OPERATOR_ERR
3124     @@@@enDesc:
3125     The implementation does not support the specified operator.
3126     @@@@XParam:
3127     @@@@@QName: operator
3128     @@@@@enDesc:
3129     The operator that is not supported.
3130     @@@@enMufDef:
3131     Operator "%p (name => {<Q::pc:operator>});" is not supported
3132    
3133     ElementTypeBinding:
3134     @Name: ExceptionDef
3135     @ElementType:
3136     dis:ResourceDef
3137     @ShadowContent:
3138     @@rdf:type:
3139     ManakaiDOM:ExceptionClass
3140     @@AliasFor:
3141     @@@@:
3142     ::ManakaiDOM:Perl
3143     @@@For:
3144     !=ManakaiDOM:Perl
3145     @@ForCheck:
3146     ManakaiDOM:Perl
3147     @@DOMMain:implementFeature: CoreFeature10
3148    
3149     ElementTypeBinding:
3150     @Name: XConstGroupDef
3151     @ElementType:
3152     dis:ResourceDef
3153     @ShadowContent:
3154     @@rdf:type:
3155     ManakaiDOM:ConstGroup
3156     @@Type:
3157     DOMMain:unsigned-short::ManakaiDOM:all
3158     @@rdfs:subClassOf:
3159     DOMMain:unsigned-short::ManakaiDOM:all
3160    
3161     ElementTypeBinding:
3162     @Name: XConstDef
3163     @ElementType:
3164     dis:ResourceDef
3165     @ShadowContent:
3166     @@rdf:type:
3167     ManakaiDOM:Const
3168    
3169     ElementTypeBinding:
3170     @Name: XSubTypeDef
3171     @ElementType:
3172     dis:ResourceDef
3173     @ShadowContent:
3174     @@rdf:type:
3175     ManakaiDOM:ExceptionOrWarningSubType
3176    
3177     ElementTypeBinding:
3178     @Name: XParam
3179     @ElementType:
3180     ManakaiDOM:exceptionOrWarningParameter
3181    
3182     ElementTypeBinding:
3183     @Name: XParamDef
3184     @ElementType:
3185     dis:ResourceDef
3186     @ShadowContent:
3187     @@rdf:type:
3188     DOMMain:XWParameter
3189     @@AliasFor:
3190     @@@For:
3191     !=ManakaiDOM:all
3192     @@@@:
3193     ::ManakaiDOM:all
3194    
3195     ElementTypeBinding:
3196     @Name: enMufDef
3197     @ElementType:
3198     dis:Def
3199     @ShadowContent:
3200     @@ContentType:
3201     lang:muf
3202     @@lang:en
3203    
3204 wakaba 1.1
3205     ElementTypeBinding:
3206     @Name: ClsDef
3207     @ElementType:
3208     dis:ResourceDef
3209     @ShadowContent:
3210     @@rdf:type:
3211     ManakaiDOM:Class
3212     @@AliasFor:
3213     @@@@:
3214     ::ManakaiDOM:Perl
3215     @@@For:
3216     !=ManakaiDOM:Perl
3217     @@ForCheck:
3218     ManakaiDOM:Perl
3219     @@DOMMain:implementFeature: CoreFeature10
3220    
3221     ElementTypeBinding:
3222     @Name: ClsQName
3223     @ElementType:
3224     dis:QName
3225    
3226     ElementTypeBinding:
3227     @Name: ClsISA
3228     @ElementType:
3229     dis:ISA
3230    
3231     ElementTypeBinding:
3232     @Name: Method
3233     @ElementType:
3234     dis:ResourceDef
3235     @ShadowContent:
3236     @@rdf:type:
3237     DISLang:Method
3238    
3239     ElementTypeBinding:
3240     @Name: ToStringMethod
3241     @ElementType:
3242     dis:ResourceDef
3243     @ShadowContent:
3244     @@rdf:type:
3245     DISLang:Method
3246     @@Operator:
3247     @@@@:
3248     DISPerl:AsStringMethod
3249     @@@ContentType:
3250     dis:TypeQName
3251     @@Description:
3252     @@@lang:en
3253     @@@@:
3254     Returns the textual Perl source code representation of this object.
3255 wakaba 1.9
3256    
3257     ElementTypeBinding:
3258     @Name: IntCloneMethod
3259     @ElementType:
3260     dis:ResourceDef
3261     @ShadowContent:
3262     @@rdf:type:
3263     DISLang:Method
3264     @@Name: makeCloneObject
3265     @@Description:
3266     @@@lang:en
3267     @@@@:
3268     Returns the node object of a deep clone of a node object.
3269     @@ManakaiDOM:isStatic:1
3270     @@ManakaiDOM:isForInternal:1
3271     @@ResourceDef:
3272     @@@rdf:type:
3273     DISLang:MethodParameter
3274     @@@Name: nodeObject
3275     @@@Type:
3276     ManakaiDOM:ManakaiDOMNodeObject::ManakaiDOM:Perl
3277     @@@Description:
3278     @@@@lang:en
3279     @@@@@: Node object to copy.
3280     @ShadowSibling:
3281     @@ResourceDef:
3282     @@@rdf:type:
3283     DISLang:Method
3284     @@@Operator:
3285     @@@@@:
3286     DISPerl:CloneMethod
3287     @@@@ContentType:
3288     dis:TypeQName
3289     @@@Description:
3290     @@@@lang:en
3291     @@@@@:
3292     Generates a deep clone of this node and returns it.
3293     @@@ResourceDef:
3294     @@@@rdf:type:
3295     DISLang:MethodReturn
3296     @@@@Type: ManakaiPerlCodeFragment
3297     @@@@Description:
3298     @@@@@lang:en
3299     @@@@@@:
3300     The newly created clone node.
3301     \
3302     {NOTE:: The <A::.parentNode> attribute of the clone
3303     is set to <DOM::null>.
3304     \
3305     }
3306     @@@@Def:
3307     @@@@@ContentType:
3308     lang:Perl
3309     @@@@@@:
3310     ## NOTE: Method name directly written
3311     my $ro = $self->_make_clone_object ($self->{<Q::TreeCore:node>});
3312     $ro-><M::ManakaiDOM:ManakaiDOMNodeObject
3313     ::ManakaiDOM:Perl.changeTreeID>
3314     (<Code::ManakaiDOM:generateUniqueID
3315     ::ManakaiDOM:Perl>);
3316     $r = <ClassM::ManakaiPerlCodeFragment.getNodeReference> ($ro);
3317 wakaba 1.1
3318     ElementTypeBinding:
3319     @Name: IntMethod
3320     @ElementType:
3321     dis:ResourceDef
3322     @ShadowContent:
3323     @@rdf:type:
3324     DISLang:Method
3325     @@ManakaiDOM:isForInternal:1
3326    
3327     ElementTypeBinding:
3328     @Name: Attr
3329     @ElementType:
3330     dis:ResourceDef
3331     @ShadowContent:
3332     @@rdf:type:
3333     DISLang:Attribute
3334    
3335     ElementTypeBinding:
3336     @Name: Return
3337     @ElementType:
3338     dis:ResourceDef
3339     @ShadowContent:
3340     @@rdf:type:
3341     DISLang:MethodReturn
3342    
3343     ElementTypeBinding:
3344     @Name: Get
3345     @ElementType:
3346     dis:ResourceDef
3347     @ShadowContent:
3348     @@rdf:type:
3349     DISLang:AttributeGet
3350    
3351     ElementTypeBinding:
3352     @Name: Set
3353     @ElementType:
3354     dis:ResourceDef
3355     @ShadowContent:
3356     @@rdf:type:
3357     DISLang:AttributeSet
3358    
3359     ElementTypeBinding:
3360     @Name: Param
3361     @ElementType:
3362     dis:ResourceDef
3363     @ShadowContent:
3364     @@rdf:type:
3365     DISLang:MethodParameter
3366    
3367     ElementTypeBinding:
3368     @Name: PerlDef
3369     @ElementType:
3370     dis:Def
3371     @ShadowContent:
3372     @@ContentType:
3373     lang:Perl
3374    
3375     ElementTypeBinding:
3376     @Name: disDef
3377     @ElementType:
3378     dis:Def
3379     @ShadowContent:
3380     @@ContentType:
3381     lang:dis
3382    
3383     ElementTypeBinding:
3384     @Name: InCase
3385     @ElementType:
3386     dis:ResourceDef
3387     @ShadowContent:
3388     @@rdf:type:
3389     ManakaiDOM:InCase
3390    
3391     ElementTypeBinding:
3392     @Name: nullCase
3393     @ElementType:
3394     dis:ResourceDef
3395     @ShadowContent:
3396     @@rdf:type:
3397     ManakaiDOM:InCase
3398     @@Value:
3399     @@@is-null:1
3400    
3401     ElementTypeBinding:
3402     @Name: TrueCase
3403     @ElementType:
3404     dis:ResourceDef
3405     @ShadowContent:
3406     @@rdf:type:
3407     ManakaiDOM:InCase
3408     @@Value:true
3409     @@Type:
3410     DOMMain:boolean
3411    
3412    
3413     ElementTypeBinding:
3414     @Name: FalseCase
3415     @ElementType:
3416     dis:ResourceDef
3417     @ShadowContent:
3418     @@rdf:type:
3419     ManakaiDOM:InCase
3420     @@Value:false
3421     @@Type:
3422     DOMMain:boolean
3423    
3424     ElementTypeBinding:
3425     @Name: enDesc
3426     @ElementType:
3427     dis:Description
3428     @ShadowContent:
3429     @@lang:en
3430    
3431     ElementTypeBinding:
3432     @Name: PropDef
3433     @ElementType:
3434     dis:ResourceDef
3435     @ShadowContent:
3436     @@rdf:type:
3437     rdf:Property
3438     @@AliasFor:
3439     @@@@:
3440     ::ManakaiDOM:all
3441     @@@For:
3442     !=ManakaiDOM:all
3443    
3444     ElementTypeBinding:
3445     @Name: NamedParam
3446     @ElementType:
3447     dis:ResourceDef
3448     @ShadowContent:
3449     @@rdf:type:
3450     DISLang:MethodParameter
3451     @@DISPerl:isNamedParameter:1
3452    

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24