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