From 4d2463c34a0ff5059ac13013a7e0beb297db8b71 Mon Sep 17 00:00:00 2001 From: acli Date: Tue, 17 Feb 2004 05:42:27 +0000 Subject: [PATCH] Insert the filename of the token into the TmplToken object too --- misc/translator/TmplToken.pm | 7 ++++++- misc/translator/TmplTokenizer.pm | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/misc/translator/TmplToken.pm b/misc/translator/TmplToken.pm index 3a20aa825d..fb04019165 100644 --- a/misc/translator/TmplToken.pm +++ b/misc/translator/TmplToken.pm @@ -32,7 +32,7 @@ sub new { 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; } @@ -46,6 +46,11 @@ sub type { return $this->{'_type'} } +sub pathname { + my $this = shift; + return $this->{'_path'} +} + sub line_number { my $this = shift; return $this->{'_lc'} diff --git a/misc/translator/TmplTokenizer.pm b/misc/translator/TmplTokenizer.pm index b9870d85bc..bd32cf08e3 100644 --- a/misc/translator/TmplTokenizer.pm +++ b/misc/translator/TmplTokenizer.pm @@ -120,6 +120,11 @@ sub new { # Simple getters +sub filename { + my $this = shift; + return $this->{+FILENAME}; +} + sub _handle { my $this = shift; return $this->{+HANDLE}; @@ -355,7 +360,7 @@ sub _next_token_internal { } warn_normal "Unrecognizable token found: $it\n", $this->line_number_start if $kind eq TmplTokenType::UNKNOWN; - return defined $it? (ref $it? $it: TmplToken->new($it, $kind, $this->line_number)): undef; + return defined $it? (ref $it? $it: TmplToken->new($it, $kind, $this->line_number, $this->filename)): undef; } sub next_token { -- 2.39.5