X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=scripts%2Fgen_calc_oper.php;fp=scripts%2Fgen_calc_oper.php;h=126e9ac83000c3cef244fb0890972700b0fe8a39;hp=0000000000000000000000000000000000000000;hb=52ed5940ed0ab3cafd36fbded2e83c92563e7b2b;hpb=acb84297d3ceeb57c97e0ac4da1881eba6aee18e diff --git a/scripts/gen_calc_oper.php b/scripts/gen_calc_oper.php new file mode 100644 index 0000000..126e9ac --- /dev/null +++ b/scripts/gen_calc_oper.php @@ -0,0 +1,63 @@ + + + +static inline int psi_calc_oper(token_t op1, token_t op2) +{ + if (PSI_T_LPAREN == op2) { + return -1; + } else if (PSI_T_LPAREN == op1) { + return 1; + } else if (op1 == op2) { + return 0; + } else if (!op1) { + return 1; + } else if (!op2) { + return -1; + } + + switch (op1) { + $ops1) : ?> + + + case PSI_T_: + switch (op2) { + $ops2) : ?> + + + case PSI_T_: + return $prec2?1:-1)?>; + + + + default: + assert(0); + break; + } + break; + + + + default: + assert(0); + break; + } + return 0; +}