equal
deleted
inserted
replaced
286 $val =~ s/________LE________/\<\=/g; |
286 $val =~ s/________LE________/\<\=/g; |
287 $val =~ s/________GE________/\>\=/g; |
287 $val =~ s/________GE________/\>\=/g; |
288 $val =~ s/\{TRUE\}/(1)/g; |
288 $val =~ s/\{TRUE\}/(1)/g; |
289 $val =~ s/\{FALSE\}/(0)/g; |
289 $val =~ s/\{FALSE\}/(0)/g; |
290 |
290 |
291 my @lops = split( /(\s*\:LAND\:\s*|\s*\:LOR\:\s*|\s*\:LNOT\:\s*|\s*\:DEF\:\s*)/, $val ); |
291 my @lops = split( /(\s*\:LAND\:\s*|\s*\:LOR\:\s*|\s*\:LNOT\:\s*|\s*\:DEF\:\s*|\s*\(\s*|\s*\)\s*)/, $val ); |
292 foreach (@lops) { |
292 foreach (@lops) { |
293 s/\s*\:LAND\:\s*/\:LAND\:/go; |
293 s/\s*\:LAND\:\s*/\:LAND\:/go; |
294 s/\s*\:LOR\:\s*/\:LOR\:/go; |
294 s/\s*\:LOR\:\s*/\:LOR\:/go; |
295 s/\s*\:LNOT\:\s*/\:LNOT\:/go; |
295 s/\s*\:LNOT\:\s*/\:LNOT\:/go; |
296 s/\s*\:DEF\:\s*/\:DEF\:/go; |
296 s/\s*\:DEF\:\s*/\:DEF\:/go; |
|
297 s/\s*\(\s*/\(/go; |
|
298 s/\s*\)\s*/\)/go; |
297 } |
299 } |
298 my @lops2; |
300 my @lops2; |
299 while (scalar (@lops)) { |
301 while (scalar (@lops)) { |
300 my $x = shift @lops; |
302 my $x = shift @lops; |
301 if ($x eq ':DEF:') { |
303 if ($x eq ':DEF:') { |
318 } |
320 } |
319 my @lops3; |
321 my @lops3; |
320 while (scalar (@lops2)) { |
322 while (scalar (@lops2)) { |
321 my $x = shift @lops2; |
323 my $x = shift @lops2; |
322 if ($x eq ':LNOT:') { |
324 if ($x eq ':LNOT:') { |
323 my $operand; |
325 my $operand= shift @lops2; |
324 while (1) { |
326 while( @lops2 && $operand =~ /^\s*$/) { |
325 $operand = shift @lops2; |
327 $operand = shift @lops2; |
326 last if ($operand !~ /^\s*$/); |
328 } |
327 } |
329 if($operand eq '(') { |
328 push @lops3, "(0==($operand))"; |
330 my $balance = 1; |
|
331 my $compound = $operand; |
|
332 while($balance > 0 && @lops2) { |
|
333 $operand = shift @lops2; |
|
334 if($operand eq '(') { |
|
335 ++$balance; |
|
336 } |
|
337 elsif ($operand eq ')') { |
|
338 --$balance; |
|
339 } |
|
340 $compound .= $operand; |
|
341 } |
|
342 push @lops3, "(0==$compound)"; |
|
343 } |
|
344 else { |
|
345 push @lops3, "(0==($operand))"; |
|
346 } |
329 } else { |
347 } else { |
330 push @lops3, $x; |
348 push @lops3, $x; |
331 } |
349 } |
332 } |
350 } |
333 return join('',@lops3); |
351 return join('',@lops3); |