[Templates-cvs] cvs commit: TT3/lib/Template Parser.pm

cvs@template-toolkit.org cvs@template-toolkit.org
Fri, 12 Nov 2004 18:32:43 +0000


cvs         04/11/12 18:32:43

  Modified:    lib/Template Parser.pm
  Log:
  * modified parse_directive()
  
  Revision  Changes    Path
  1.3       +19 -19    TT3/lib/Template/Parser.pm
  
  Index: Parser.pm
  ===================================================================
  RCS file: /template-toolkit/TT3/lib/Template/Parser.pm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Parser.pm	2004/11/10 18:01:02	1.2
  +++ Parser.pm	2004/11/12 18:32:43	1.3
  @@ -20,7 +20,7 @@
   #   modify it under the same terms as Perl itself.
   #
   # REVISION
  -#   $Id: Parser.pm,v 1.2 2004/11/10 18:01:02 abw Exp $
  +#   $Id: Parser.pm,v 1.3 2004/11/12 18:32:43 abw Exp $
   #
   #========================================================================
   
  @@ -31,7 +31,7 @@
   use Template::Base;
   use base qw( Template::Base );
   
  -our $VERSION = sprintf("%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/);
  +our $VERSION = sprintf("%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/);
   our $DEBUG   = 0 unless defined $DEBUG;
   our $ERROR   = '';
   our $THROW   = 'parser';
  @@ -156,11 +156,11 @@
   
   
   #------------------------------------------------------------------------
  -# parse_directive($text)
  +# parse_directive($text, $handler, $match)
   #------------------------------------------------------------------------
   
   sub parse_directive {
  -    my ($self, $textref, @args) = @_;
  +    my ($self, $textref, $handler, $match) = @_;
       my ($directive, $keyword);
   
       $self->debug("parse_directive()\n") if $DEBUG;
  @@ -176,12 +176,12 @@
           $keyword = $1;
   
           if ($directive = $self->{ directives }->{ $keyword }) {
  -            $self->debug("directive keyword: $keyword\n") if $DEBUG;
  +            $self->debug("directive: $keyword => $directive\n") if $DEBUG;
  +            $match ||= { };
  +            local $match->{ keyword } = $keyword;
   
  -            # TODO: must support more types of directive
  -
               # call delegate to parse rest of directive
  -            return $directive->parse($textref, $self, $keyword, @args)
  +            return $directive->parse($textref, $handler, $match)
                   || $self->error($directive->error());
           }
           else {
  @@ -214,11 +214,11 @@
           # call directive object to attempt to parse remainder of directive
           # text, allowing for the fact that it may decline (return 0) if 
           # it doesn't look like a directive of the appropriate type.
  -        my $result = $directive->parse($textref, $self, '', @args);
  +#        my $result = $directive->parse($textref, $self, '', @args);
   
  -        return $result if $result;                  # OK
  -        return $self->error($directive->error())    # ERROR
  -            unless defined $result;
  +#        return $result if $result;                  # OK
  +#        return $self->error($directive->error())    # ERROR
  +#            unless defined $result;
       }
   
       return $self->decline('not a directive');
  @@ -1225,11 +1225,11 @@
   }
   
   
  -sub decline {
  -    my $self = shift;
  -    $self->error(@_);
  -    return 0;
  -}
  +#sub decline {
  +#    my $self = shift;
  +#    $self->error(@_);
  +#    return 0;
  +#}
   
   
   1;
  @@ -1325,7 +1325,7 @@
   
   =head1 VERSION
   
  -$Revision: 1.2 $
  +$Revision: 1.3 $
   
   =head1 COPYRIGHT
   
  @@ -1376,7 +1376,7 @@
   
   =head1 VERSION
   
  -$Revision: 1.2 $
  +$Revision: 1.3 $
   
   =head1 COPYRIGHT