4 #use warnings; FIXME - Bug 2505
8 use vars
qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
10 ###############################################################################
14 TmplToken.pm - Object representing a scanner token for .tmpl files
18 This is a class representing a token scanned from an HTML::Template .tmpl file.
22 ###############################################################################
29 ###############################################################################
33 my $class = ref($this) || $this;
36 ($self->{'_string'}, $self->{'_type'}, $self->{'_lc'}, $self->{'_path'}) = @_;
42 return $this->{'_string'}
47 return $this->{'_type'}
52 return $this->{'_path'}
62 return $this->{'_attr'};
67 $this->{'_attr'} = ref $_[0] eq 'HASH'?
$_[0]: \
@_;
71 # only meaningful for TEXT_PARAMETRIZED tokens
74 return $this->{'_kids'};
77 # only meaningful for TEXT_PARAMETRIZED tokens
80 $this->{'_kids'} = ref $_[0] eq 'ARRAY'?
$_[0]: \
@_;
84 # only meaningful for TEXT_PARAMETRIZED tokens
85 # FIXME: DIRECTIVE is not necessarily TMPL_VAR !!
86 sub parameters_and_fields
{
88 return map { $_->type == C4
::TmplTokenType
::DIRECTIVE?
$_:
89 ($_->type == C4
::TmplTokenType
::TAG
90 && $_->string =~ /^<input\b/is)?
$_: ()}
94 # only meaningful for TEXT_PARAMETRIZED tokens
97 return map { $_->type == C4
::TmplTokenType
::TAG
&& $_->string =~ /^<a\b/is?
$_: ()} @
{$this->{'_kids'}};
100 # only meaningful for TEXT_PARAMETRIZED tokens
103 return $this->{'_form'};
106 # only meaningful for TEXT_PARAMETRIZED tokens
109 $this->{'_form'} = $_[0];
115 return defined $this->{'_js_data'} && ref($this->{'_js_data'}) eq 'ARRAY';
120 return $this->{'_js_data'};
125 $this->{'_js_data'} = $_[0];
133 return $this->type == C4
::TmplTokenType
::TAG
;
138 return $this->type == C4
::TmplTokenType
::CDATA
;
143 return $this->type == C4
::TmplTokenType
::TEXT
;
146 sub text_parametrized_p
{
148 return $this->type == C4
::TmplTokenType
::TEXT_PARAMETRIZED
;
153 return $this->type == C4
::TmplTokenType
::DIRECTIVE
;
156 ###############################################################################