Lines Matching refs:te
2609 Test_env te; in c_test() local
2614 te.flags = 0; in c_test()
2615 te.isa = ptest_isa; in c_test()
2616 te.getopnd = ptest_getopnd; in c_test()
2617 te.eval = test_eval; in c_test()
2618 te.error = ptest_error; in c_test()
2630 te.pos.wp = wp + 1; in c_test()
2631 te.wp_end = wp + argc; in c_test()
2648 if (ptest_isa(&te, TM_NOT)) { in c_test()
2652 if ((op = ptest_isa(&te, TM_UNOP))) { in c_test()
2654 rv = test_eval(&te, op, *te.pos.wp++, NULL, true); in c_test()
2656 if (te.flags & TEF_ERROR) in c_test()
2664 swp = te.pos.wp; in c_test()
2666 lhs = *te.pos.wp++; in c_test()
2667 if ((op = ptest_isa(&te, TM_BINOP))) { in c_test()
2669 rv = test_eval(&te, op, lhs, *te.pos.wp++, true); in c_test()
2672 if (ptest_isa(&te, tm = TM_AND) || ptest_isa(&te, tm = TM_OR)) { in c_test()
2674 argc = test_eval(&te, TO_STNZE, lhs, NULL, true); in c_test()
2675 rv = test_eval(&te, TO_STNZE, *te.pos.wp++, NULL, true); in c_test()
2683 te.pos.wp = swp; in c_test()
2684 if (ptest_isa(&te, TM_NOT)) { in c_test()
2688 if (ptest_isa(&te, TM_OPAREN)) { in c_test()
2689 swp = te.pos.wp; in c_test()
2691 te.pos.wp++; in c_test()
2693 op = ptest_isa(&te, TM_CPAREN); in c_test()
2695 te.pos.wp = swp; in c_test()
2704 if (ptest_isa(&te, TM_NOT)) { in c_test()
2708 if (ptest_isa(&te, TM_OPAREN)) { in c_test()
2709 swp = te.pos.wp; in c_test()
2711 te.pos.wp++; in c_test()
2712 te.pos.wp++; in c_test()
2714 op = ptest_isa(&te, TM_CPAREN); in c_test()
2716 te.pos.wp = swp; in c_test()
2727 te.pos.wp = wp + 1; in c_test()
2728 return (test_parse(&te)); in c_test()
2760 test_eval(Test_env *te, Test_op op, const char *opnd1, const char *opnd2, in test_eval() argument
2790 te->flags |= TEF_ERROR; in test_eval()
2929 te->flags |= TEF_ERROR; in test_eval()
2949 if (te->flags & TEF_DBRACKET) { in test_eval()
2958 if (te->flags & TEF_DBRACKET) { in test_eval()
3019 te->flags |= TEF_ERROR; in test_eval()
3041 (*te->error)(te, 0, "internal error: unknown op"); in test_eval()
3046 test_parse(Test_env *te) in test_parse() argument
3050 rv = test_oexpr(te, 1); in test_parse()
3052 if (!(te->flags & TEF_ERROR) && !(*te->isa)(te, TM_END)) in test_parse()
3053 (*te->error)(te, 0, "unexpected operator/operand"); in test_parse()
3055 return ((te->flags & TEF_ERROR) ? T_ERR_EXIT : !rv); in test_parse()
3059 test_oexpr(Test_env *te, bool do_eval) in test_oexpr() argument
3063 if ((rv = test_aexpr(te, do_eval))) in test_oexpr()
3065 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_OR)) in test_oexpr()
3066 return (test_oexpr(te, do_eval) || rv); in test_oexpr()
3071 test_aexpr(Test_env *te, bool do_eval) in test_aexpr() argument
3075 if (!(rv = test_nexpr(te, do_eval))) in test_aexpr()
3077 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_AND)) in test_aexpr()
3078 return (test_aexpr(te, do_eval) && rv); in test_aexpr()
3083 test_nexpr(Test_env *te, bool do_eval) in test_nexpr() argument
3085 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_NOT)) in test_nexpr()
3086 return (!test_nexpr(te, do_eval)); in test_nexpr()
3087 return (test_primary(te, do_eval)); in test_nexpr()
3091 test_primary(Test_env *te, bool do_eval) in test_primary() argument
3097 if (te->flags & TEF_ERROR) in test_primary()
3099 if ((*te->isa)(te, TM_OPAREN)) { in test_primary()
3100 rv = test_oexpr(te, do_eval); in test_primary()
3101 if (te->flags & TEF_ERROR) in test_primary()
3103 if (!(*te->isa)(te, TM_CPAREN)) { in test_primary()
3104 (*te->error)(te, 0, "missing )"); in test_primary()
3113 if ((te->flags & TEF_DBRACKET) || (&te->pos.wp[1] < te->wp_end && in test_primary()
3114 !test_isop(TM_BINOP, te->pos.wp[1]))) { in test_primary()
3115 if ((op = (*te->isa)(te, TM_UNOP))) { in test_primary()
3117 opnd1 = (*te->getopnd)(te, op, do_eval); in test_primary()
3119 (*te->error)(te, -1, Tno_args); in test_primary()
3123 return ((*te->eval)(te, op, opnd1, NULL, do_eval)); in test_primary()
3126 opnd1 = (*te->getopnd)(te, TO_NONOP, do_eval); in test_primary()
3128 (*te->error)(te, 0, "expression expected"); in test_primary()
3131 if ((op = (*te->isa)(te, TM_BINOP))) { in test_primary()
3133 opnd2 = (*te->getopnd)(te, op, do_eval); in test_primary()
3135 (*te->error)(te, -1, "missing second argument"); in test_primary()
3139 return ((*te->eval)(te, op, opnd1, opnd2, do_eval)); in test_primary()
3141 return ((*te->eval)(te, TO_STNZE, opnd1, NULL, do_eval)); in test_primary()
3154 ptest_isa(Test_env *te, Test_meta meta) in ptest_isa() argument
3162 if (te->pos.wp >= te->wp_end) in ptest_isa()
3166 rv = test_isop(meta, *te->pos.wp); in ptest_isa()
3170 rv = !strcmp(*te->pos.wp, tokens[(int)meta]) ? in ptest_isa()
3175 te->pos.wp++; in ptest_isa()
3181 ptest_getopnd(Test_env *te, Test_op op, bool do_eval MKSH_A_UNUSED) in ptest_getopnd() argument
3183 if (te->pos.wp >= te->wp_end) in ptest_getopnd()
3185 return (*te->pos.wp++); in ptest_getopnd()
3189 ptest_error(Test_env *te, int ofs, const char *msg) in ptest_error() argument
3193 te->flags |= TEF_ERROR; in ptest_error()
3194 if ((op = te->pos.wp + ofs >= te->wp_end ? NULL : te->pos.wp[ofs])) in ptest_error()