Legacy IF! support

databind
vitalif 2009-06-27 13:27:56 +00:00 committed by Vitaliy Filippov
parent e903e1a5c5
commit abc2d3a9b8
1 changed files with 9 additions and 3 deletions

View File

@ -468,12 +468,18 @@ sub compile_code_fragment
my $t;
$e =~ s/^\s+//so;
$e =~ s/\s+$//so;
if ($e =~ /^(ELS(?:E\s+)?)?IF\s+/iso)
if ($e =~ /^(ELS(?:E\s+)?)?IF(!?)\s+/iso)
{
$t = $self->compile_expression($');
$t = $';
if ($2)
{
warn "Legacy IF! used, consider changing it to IF NOT";
$t = "NOT $t";
}
$t = $self->compile_expression($t);
unless ($t)
{
warn "Invalid expression: ($')";
warn "Invalid expression: ($t)";
return undef;
}
return $1 ? "} elsif ($t) {\n" : "if ($t) {\n";