Lines Matching refs:te

2802 	Test_env te;  in c_test()  local
2806 te.flags = 0; in c_test()
2807 te.isa = ptest_isa; in c_test()
2808 te.getopnd = ptest_getopnd; in c_test()
2809 te.eval = test_eval; in c_test()
2810 te.error = ptest_error; in c_test()
2822 te.pos.wp = wp + 1; in c_test()
2823 te.wp_end = wp + argc; in c_test()
2840 if (ptest_isa(&te, TM_NOT)) { in c_test()
2844 if ((op = ptest_isa(&te, TM_UNOP))) { in c_test()
2846 rv = test_eval(&te, op, *te.pos.wp++, NULL, true); in c_test()
2854 swp = te.pos.wp; in c_test()
2856 lhs = *te.pos.wp++; in c_test()
2857 if ((op = ptest_isa(&te, TM_BINOP))) { in c_test()
2859 rv = test_eval(&te, op, lhs, *te.pos.wp++, true); in c_test()
2863 te.pos.wp = swp; in c_test()
2864 if (ptest_isa(&te, TM_NOT)) { in c_test()
2868 if (ptest_isa(&te, TM_OPAREN)) { in c_test()
2869 swp = te.pos.wp; in c_test()
2871 te.pos.wp++; in c_test()
2873 op = ptest_isa(&te, TM_CPAREN); in c_test()
2875 te.pos.wp = swp; in c_test()
2884 if (ptest_isa(&te, TM_NOT)) { in c_test()
2888 if (ptest_isa(&te, TM_OPAREN)) { in c_test()
2889 swp = te.pos.wp; in c_test()
2891 te.pos.wp++; in c_test()
2892 te.pos.wp++; in c_test()
2894 op = ptest_isa(&te, TM_CPAREN); in c_test()
2896 te.pos.wp = swp; in c_test()
2907 te.pos.wp = wp + 1; in c_test()
2908 return (test_parse(&te)); in c_test()
2932 test_eval(Test_env *te, Test_op op, const char *opnd1, const char *opnd2, in test_eval() argument
2961 te->flags |= TEF_ERROR; in test_eval()
3096 te->flags |= TEF_ERROR; in test_eval()
3116 if (te->flags & TEF_DBRACKET) in test_eval()
3122 if (te->flags & TEF_DBRACKET) in test_eval()
3149 te->flags |= TEF_ERROR; in test_eval()
3202 (*te->error)(te, 0, "internal error: unknown op"); in test_eval()
3207 test_parse(Test_env *te) in test_parse() argument
3211 rv = test_oexpr(te, 1); in test_parse()
3213 if (!(te->flags & TEF_ERROR) && !(*te->isa)(te, TM_END)) in test_parse()
3214 (*te->error)(te, 0, "unexpected operator/operand"); in test_parse()
3216 return ((te->flags & TEF_ERROR) ? T_ERR_EXIT : !rv); in test_parse()
3220 test_oexpr(Test_env *te, bool do_eval) in test_oexpr() argument
3224 if ((rv = test_aexpr(te, do_eval))) in test_oexpr()
3226 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_OR)) in test_oexpr()
3227 return (test_oexpr(te, do_eval) || rv); in test_oexpr()
3232 test_aexpr(Test_env *te, bool do_eval) in test_aexpr() argument
3236 if (!(rv = test_nexpr(te, do_eval))) in test_aexpr()
3238 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_AND)) in test_aexpr()
3239 return (test_aexpr(te, do_eval) && rv); in test_aexpr()
3244 test_nexpr(Test_env *te, bool do_eval) in test_nexpr() argument
3246 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_NOT)) in test_nexpr()
3247 return (!test_nexpr(te, do_eval)); in test_nexpr()
3248 return (test_primary(te, do_eval)); in test_nexpr()
3252 test_primary(Test_env *te, bool do_eval) in test_primary() argument
3258 if (te->flags & TEF_ERROR) in test_primary()
3260 if ((*te->isa)(te, TM_OPAREN)) { in test_primary()
3261 rv = test_oexpr(te, do_eval); in test_primary()
3262 if (te->flags & TEF_ERROR) in test_primary()
3264 if (!(*te->isa)(te, TM_CPAREN)) { in test_primary()
3265 (*te->error)(te, 0, "missing )"); in test_primary()
3274 if ((te->flags & TEF_DBRACKET) || (&te->pos.wp[1] < te->wp_end && in test_primary()
3275 !test_isop(TM_BINOP, te->pos.wp[1]))) { in test_primary()
3276 if ((op = (*te->isa)(te, TM_UNOP))) { in test_primary()
3278 opnd1 = (*te->getopnd)(te, op, do_eval); in test_primary()
3280 (*te->error)(te, -1, "missing argument"); in test_primary()
3284 return ((*te->eval)(te, op, opnd1, NULL, do_eval)); in test_primary()
3287 opnd1 = (*te->getopnd)(te, TO_NONOP, do_eval); in test_primary()
3289 (*te->error)(te, 0, "expression expected"); in test_primary()
3292 if ((op = (*te->isa)(te, TM_BINOP))) { in test_primary()
3294 opnd2 = (*te->getopnd)(te, op, do_eval); in test_primary()
3296 (*te->error)(te, -1, "missing second argument"); in test_primary()
3300 return ((*te->eval)(te, op, opnd1, opnd2, do_eval)); in test_primary()
3302 return ((*te->eval)(te, TO_STNZE, opnd1, NULL, do_eval)); in test_primary()
3315 ptest_isa(Test_env *te, Test_meta meta) in ptest_isa() argument
3323 if (te->pos.wp >= te->wp_end) in ptest_isa()
3327 rv = test_isop(meta, *te->pos.wp); in ptest_isa()
3331 rv = !strcmp(*te->pos.wp, tokens[(int)meta]) ? in ptest_isa()
3336 te->pos.wp++; in ptest_isa()
3342 ptest_getopnd(Test_env *te, Test_op op, bool do_eval MKSH_A_UNUSED) in ptest_getopnd() argument
3344 if (te->pos.wp >= te->wp_end) in ptest_getopnd()
3346 return (*te->pos.wp++); in ptest_getopnd()
3350 ptest_error(Test_env *te, int ofs, const char *msg) in ptest_error() argument
3354 te->flags |= TEF_ERROR; in ptest_error()
3355 if ((op = te->pos.wp + ofs >= te->wp_end ? NULL : te->pos.wp[ofs])) in ptest_error()