my $class = ref($this) || $this;
my $self = {};
bless $self, $class;
- ($self->{'_string'}, $self->{'_type'}, $self->{'_lc'}) = @_;
+ ($self->{'_string'}, $self->{'_type'}, $self->{'_lc'}, $self->{'_path'}) = @_;
return $self;
}
return $this->{'_type'}
}
+sub pathname {
+ my $this = shift;
+ return $this->{'_path'}
+}
+
sub line_number {
my $this = shift;
return $this->{'_lc'}
return $this;
}
+# only meaningful for TEXT_PARAMETRIZED tokens
+sub children {
+ my $this = shift;
+ return $this->{'_kids'};
+}
+
+# only meaningful for TEXT_PARAMETRIZED tokens
+sub set_children {
+ my $this = shift;
+ $this->{'_kids'} = ref $_[0] eq 'ARRAY'? $_[0]: \@_;
+ return $this;
+}
+
+# only meaningful for TEXT_PARAMETRIZED tokens
+# FIXME: DIRECTIVE is not necessarily TMPL_VAR !!
+sub parameters {
+ my $this = shift;
+ return map { $_->type == TmplTokenType::DIRECTIVE? $_: ()} @{$this->{'_kids'}};
+}
+
+# only meaningful for TEXT_PARAMETRIZED tokens
+sub anchors {
+ my $this = shift;
+ return map { $_->type == TmplTokenType::TAG && $_->string =~ /^<a\b/is? $_: ()} @{$this->{'_kids'}};
+}
+
+# only meaningful for TEXT_PARAMETRIZED tokens
+sub form {
+ my $this = shift;
+ return $this->{'_form'};
+}
+
+# only meaningful for TEXT_PARAMETRIZED tokens
+sub set_form {
+ my $this = shift;
+ $this->{'_form'} = $_[0];
+ return $this;
+}
+
###############################################################################
1;