17 |
|
# : Add tags to the parse given by label |
18 |
|
# checktag(tagname, hashref, param) : check for existence of param in |
19 |
|
# hashref from a tag call |
20 |
+ |
# includeparse(local_parsename, objparsename, activedoc) : copy the parse from |
21 |
+ |
# one object to another |
22 |
+ |
# currentparsename([name]) : get/set current parse name |
23 |
|
# newdoc(file) : Return an new object of the appropriate type |
24 |
|
# getfile(url) : get a processedfile object given a url |
25 |
|
# activatedoc(url) : Return the object ref for a doc described by the given url |
68 |
|
|
69 |
|
my $file=$self->file(); |
70 |
|
if ( $file ) { |
71 |
+ |
$self->{currentparsename}=$parselabel; |
72 |
|
$self->{currentparser}=$self->{parsers}{$parselabel}; |
73 |
|
$self->{parsers}{$parselabel}->parse($file,@_); |
74 |
|
delete $self->{currentparser}; |
75 |
+ |
$self->{currentparsename}=""; |
76 |
|
} |
77 |
|
else { |
78 |
|
print "Cannot parse - file not known\n"; |
79 |
|
} |
80 |
|
} |
81 |
|
|
82 |
+ |
sub currentparsename { |
83 |
+ |
my $self=shift; |
84 |
+ |
@_?$self->{currentparsename}=shift |
85 |
+ |
:$self->{currentparsename}; |
86 |
+ |
} |
87 |
+ |
|
88 |
|
sub newparse { |
89 |
|
my $self=shift; |
90 |
|
my $parselabel=shift; |
94 |
|
$self->{parsers}{$parselabel}->addgrouptags(); |
95 |
|
} |
96 |
|
|
97 |
+ |
sub includeparse { |
98 |
+ |
my $self=shift; |
99 |
+ |
my $parselabel=shift; |
100 |
+ |
my $remoteparselabel=shift; |
101 |
+ |
my $activedoc=shift; |
102 |
+ |
|
103 |
+ |
# Some error trapping |
104 |
+ |
if ( ! exists $self->{parsers}{$parselabel} ) { |
105 |
+ |
$self->error("Unknown local parse name specified"); |
106 |
+ |
} |
107 |
+ |
if ( ! exists $activedoc->{parsers}{$remoteparselabel} ) { |
108 |
+ |
$self->error("Unknown parse name specified in remote obj $activedoc"); |
109 |
+ |
} |
110 |
+ |
|
111 |
+ |
# |
112 |
+ |
my $rp=$activedoc->{parsers}{$remoteparselabel}; |
113 |
+ |
$self->{parsers}{$parselabel}->includeparse($rp); |
114 |
+ |
} |
115 |
+ |
|
116 |
|
sub addtag { |
117 |
|
my $self=shift; |
118 |
|
my $parselabel=shift; |