[Templates-cvs] cvs commit: TT3/lib/Template Parser.pm
cvs@template-toolkit.org
cvs@template-toolkit.org
Wed, 01 Dec 2004 18:28:39 +0000
cvs 04/12/01 18:28:39
Modified: lib/Template Parser.pm
Log:
* more "missing" errors fixed
Revision Changes Path
1.15 +17 -30 TT3/lib/Template/Parser.pm
Index: Parser.pm
===================================================================
RCS file: /template-toolkit/TT3/lib/Template/Parser.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- Parser.pm 2004/12/01 18:22:38 1.14
+++ Parser.pm 2004/12/01 18:28:39 1.15
@@ -18,7 +18,7 @@
# modify it under the same terms as Perl itself.
#
# REVISION
-# $Id: Parser.pm,v 1.14 2004/12/01 18:22:38 abw Exp $
+# $Id: Parser.pm,v 1.15 2004/12/01 18:28:39 abw Exp $
#
#========================================================================
@@ -29,7 +29,7 @@
use Template::Base;
use base qw( Template::Base );
-our $VERSION = sprintf("%d.%02d", q$Revision: 1.14 $ =~ /(\d+)\.(\d+)/);
+our $VERSION = sprintf("%d.%02d", q$Revision: 1.15 $ =~ /(\d+)\.(\d+)/);
our $DEBUG = 0 unless defined $DEBUG;
our $ERROR = '';
our $THROW = 'parser';
@@ -300,7 +300,7 @@
$self->debug("expr test [$expr]\n") if $DEBUG;
- return $self->error("missing ':' after expression following '?'")
+ return $self->missing("':' after expression following '?'")
unless $$textref =~ /$self->{ colon }/cg;
$self->debug("expr true [$true]\n") if $DEBUG;
@@ -525,16 +525,14 @@
# embedded ${ variable }
my $text = $2;
$token = $self->parse_variable(\$text)
- || return $self->missing( $textref,
- "variable in '\${ }'" );
+ || return $self->missing( $textref, "variable in '\${ }'" );
push(@tokens, $token);
}
elsif (defined $3) {
# $variable reference
my $text = $3;
$token = $self->parse_variable(\$text)
- || return $self->missing( $textref,
- 'variable after \$' );
+ || return $self->missing( $textref, 'variable after \$' );
push(@tokens, $token);
}
else {
@@ -582,8 +580,7 @@
$args = $self->parse_args($textref) || return $args;
# moved from parse_args()
- return $self->missing( $textref,
- "missing ')' at end of argument list" )
+ return $self->missing( $textref, "')' at end of argument list" )
unless ($$textref =~ /$ENDPAREN/cog);
}
}
@@ -598,8 +595,7 @@
if ( $$textref =~ /$DOTOP/cog ) {
# TODO: not sure why this is set to $term which is subsequently ignored...
$self->parse_varnodes($textref, $terms)
- || return $self->missing( $textref,
- "missing item after '.'" );
+ || return $self->missing( $textref, "item after '.'" );
}
return [ variable => $terms ];
@@ -623,9 +619,7 @@
do {
($node = $self->parse_varnode($textref))
|| return @$nodes
- ? $self->missing( $textref,
- "missing item after '.'" )
- : $node;
+ ? $self->missing( $textref, "item after '.'" ) : $node;
push(@$nodes, $node);
}
while ($$textref =~ /$DOTOP/cog);
@@ -688,13 +682,11 @@
elsif ($$textref =~ /$EMBED/cog) {
my $text = $1;
($term = $self->parse_variable(\$text))
- || return $self->missing( $textref,
- "missing variable in '\${ }'" );
+ || return $self->missing( $textref, "variable in '\${ }'" );
}
elsif ($$textref =~ /$INTERP/cog) {
($term = $self->parse_variable($textref))
- || return $self->missing( $textref,
- "missing variable after '\$'");
+ || return $self->missing( $textref, "variable after '\$'");
}
else {
return $self->decline('not a variable node');
@@ -704,8 +696,7 @@
$args = $self->parse_args($textref) || return;
# moved from parse_args
- return $self->missing( $textref,
- "missing ')' at end of argument list" )
+ return $self->missing( $textref, "')' at end of argument list" )
unless ($$textref =~ /$ENDPAREN/cog);
}
@@ -732,7 +723,7 @@
my $right = $BRACKETS->{ $left };
# match text up to right bracket
- return $self->error("missing $right after 'qw$left'")
+ return $self->missing("$right after 'qw$left'")
unless $$textref =~ /$regex/gc;
return [ qwlist => $left, $1, $right ];
@@ -875,8 +866,7 @@
if ($$textref =~ /$self->{ assign }/cg) {
$op = $1;
return $self->parse_expression($textref)
- || $self->missing( $textref,
- "expression after '$op'" );
+ || $self->missing( $textref, "expression after '$op'" );
}
else {
return $self->decline('not an assignment');
@@ -902,8 +892,7 @@
$ident = $self->parse_ident($textref) || return;
$expr = $self->parse_assign_expr($textref)
- || return $self->missing( $textref,
- "assignment after identifier '$ident'" );
+ || return $self->missing( $textref, "assignment after identifier '$ident'" );
return [ $ident, $expr ];
}
@@ -1116,8 +1105,7 @@
return $self->error('unexpected end of text in argument list');
}
elsif ($tag_end && ($$textref =~ /$tag_end/cg)) {
- return $self->missing( $textref,
- "')' at end of argument list" );
+ return $self->missing( $textref, "')' at end of argument list" );
}
else {
return $self->unexpected( $textref,
@@ -1215,8 +1203,7 @@
elsif ($$textref =~ /$INTERP/cog) {
$self->debug("parsing filename variable\n") if $DEBUG;
$term = $self->parse_variable($textref)
- || return $self->missing( $textref, $term,
- "missing variable after '\$'");
+ || return $self->missing( $textref, "variable after '\$'");
}
else {
return $self->decline('not a template name');
@@ -1491,7 +1478,7 @@
=head1 VERSION
-$Revision: 1.14 $
+$Revision: 1.15 $
=head1 COPYRIGHT