diff --git a/VMXTemplate/Compiler.pm b/VMXTemplate/Compiler.pm index 438a6e8..9b43391 100644 --- a/VMXTemplate/Compiler.pm +++ b/VMXTemplate/Compiler.pm @@ -15,7 +15,7 @@ sub _Lexer sub _error { my ($self) = @_; - if ($self->YYCurtok ne 'invalid') + if ($self->YYCurtok ne 'error') { $self->{lexer}->warn('Unexpected ' . $self->YYCurtok . ($self->YYCurval ? ' ' . $self->YYCurval : '')); } @@ -465,8 +465,8 @@ sub function_exec my $self = shift; my $block = shift; $self->{lexer}->warn("exec() requires at least 1 parameters"), return "''" if !$block; - my $args = @_ > 1 ? "{ ".join(", ", @_)." }" : (@_ ? $_[0] : ''); - return "\$self->parse_real(\$FILENAME, undef, $block, $args)"; + my $args = @_ > 1 ? "{ ".join(", ", @_)." }" : (@_ ? $_[0] : 'undef'); + return "\$self->_call_block($block, $args, '".addcslashes($self->{lexer}->errorinfo(), "'")."')"; } # Run block from another template: exec_from('file.tpl', 'block'[, args]) diff --git a/VMXTemplate/Lexer.pm b/VMXTemplate/Lexer.pm index 2fc3561..86fd2b1 100644 --- a/VMXTemplate/Lexer.pm +++ b/VMXTemplate/Lexer.pm @@ -243,7 +243,8 @@ sub read_token } # Unknown character $self->warn("Unexpected character '".substr($self->{code}, 0, 1)."'"); - return ('invalid', undef); + $self->skip_error; + return ('error', undef); } } diff --git a/VMXTemplate/Parser.pm b/VMXTemplate/Parser.pm index 06e5194..a236032 100644 --- a/VMXTemplate/Parser.pm +++ b/VMXTemplate/Parser.pm @@ -35,8 +35,8 @@ sub new ACTIONS => { '' => -1, 'literal' => 3, - "{{" => 5, - 'error' => 4, + 'error' => 5, + "{{" => 4, "