switch (op1) {<?php /*nobr*/ ?>
<?php foreach ($oper as $prec1 => $ops1) : ?>
- <?php foreach ($ops1 as $op1) : ?>
+ <?php foreach ($ops1 as $op1) : $check = NAN; ?>
case PSI_T_<?=$op1?>:
switch (op2) {<?php /*nobr*/ ?>
<?php foreach ($oper as $prec2 => $ops2) : ?>
<?php foreach ($ops2 as $op2) : ?>
+ <?php
+ if ($prec1 == $prec2) :
+ $ret = 0;
+ elseif ($prec1 > $prec2) :
+ $ret = 1;
+ else :
+ $ret = -1;
+ endif;
+ ?>
+ <?php if (!is_nan($check) && $check !== $ret) : ?>
- case PSI_T_<?=$op2?>:
- return <?=$prec1==$prec2?0:($prec1>$prec2?1:-1)?>;<?php /*nobr */ ?>
+ return <?=$check?>;
+ <?php endif; ?>
+ <?php $check = $ret; ?>
+
+ case PSI_T_<?=$op2?>:<?php /*nobr*/ ?>
<?php endforeach; ?>
<?php endforeach; ?>
+ return <?=$ret?>;<?php /*nobr*/ ?>
+
default:
assert(0);
break;