Changeset 104


Ignore:
Timestamp:
06/14/07 16:25:52 (17 years ago)
Author:
kdeugau
Message:

/trunk

Expand %if logic support to basic multi-operator support

(%a == "value"
%a == "othervalue")
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/debbuild

    r103 r104  
    490490
    491491        $expr =~ s/\s+//g;
    492         $expr =~ s/^(\w+)/"$1"/ if $expr !~ /^['"]\w['"]/;
    493         $expr =~ s/(\w+)$/"$1"/ if $expr !~ /['"]\w['"]$/;
     492
     493# For Great w00tness!  New and Improved multilayered logic handling.
     494
     495        my @bits = split /\b/, $expr;
     496        $expr = '';
     497        foreach my $bit (@bits) {
     498          next if $bit eq '"';
     499          $bit =~ s/"//g;
     500          $expr .= qq("$bit") if $bit =~ /^\w+$/;
     501          $expr .= $bit if $bit !~ /^\w+$/;
     502        }
    494503
    495504        # Done in this order so we don't cascade incorrectly.  Yes, those spaces ARE correct in the replacements!
    496         $expr =~ s/==/ eq /;
    497         $expr =~ s/!=/ ne /;
    498         $expr =~ s/<=>/ cmp /;
    499         $expr =~ s/<=/ le /;
    500         $expr =~ s/>=/ ge /;
    501         $expr =~ s/</ lt /;
    502         $expr =~ s/>/ gt /;
     505        $expr =~ s/==/ eq /g;
     506        $expr =~ s/!=/ ne /g;
     507        $expr =~ s/<=>/ cmp /g;
     508        $expr =~ s/<=/ le /g;
     509        $expr =~ s/>=/ ge /g;
     510        $expr =~ s/</ lt /g;
     511        $expr =~ s/>/ gt /g;
    503512
    504513        # Turn it into something that eval's to a number.  Maybe not needed?  O_o
Note: See TracChangeset for help on using the changeset viewer.