Lines Matching refs:te
2859 Test_env te; in c_test() local
2863 te.flags = 0; in c_test()
2864 te.isa = ptest_isa; in c_test()
2865 te.getopnd = ptest_getopnd; in c_test()
2866 te.eval = test_eval; in c_test()
2867 te.error = ptest_error; in c_test()
2879 te.pos.wp = wp + 1; in c_test()
2880 te.wp_end = wp + argc; in c_test()
2897 if (ptest_isa(&te, TM_NOT)) { in c_test()
2901 if ((op = ptest_isa(&te, TM_UNOP))) { in c_test()
2903 rv = test_eval(&te, op, *te.pos.wp++, NULL, true); in c_test()
2905 if (te.flags & TEF_ERROR) in c_test()
2913 swp = te.pos.wp; in c_test()
2915 lhs = *te.pos.wp++; in c_test()
2916 if ((op = ptest_isa(&te, TM_BINOP))) { in c_test()
2918 rv = test_eval(&te, op, lhs, *te.pos.wp++, true); in c_test()
2922 te.pos.wp = swp; in c_test()
2923 if (ptest_isa(&te, TM_NOT)) { in c_test()
2927 if (ptest_isa(&te, TM_OPAREN)) { in c_test()
2928 swp = te.pos.wp; in c_test()
2930 te.pos.wp++; in c_test()
2932 op = ptest_isa(&te, TM_CPAREN); in c_test()
2934 te.pos.wp = swp; in c_test()
2943 if (ptest_isa(&te, TM_NOT)) { in c_test()
2947 if (ptest_isa(&te, TM_OPAREN)) { in c_test()
2948 swp = te.pos.wp; in c_test()
2950 te.pos.wp++; in c_test()
2951 te.pos.wp++; in c_test()
2953 op = ptest_isa(&te, TM_CPAREN); in c_test()
2955 te.pos.wp = swp; in c_test()
2966 te.pos.wp = wp + 1; in c_test()
2967 return (test_parse(&te)); in c_test()
2991 test_eval(Test_env *te, Test_op op, const char *opnd1, const char *opnd2, in test_eval() argument
3020 te->flags |= TEF_ERROR; in test_eval()
3155 te->flags |= TEF_ERROR; in test_eval()
3175 if (te->flags & TEF_DBRACKET) in test_eval()
3181 if (te->flags & TEF_DBRACKET) in test_eval()
3208 te->flags |= TEF_ERROR; in test_eval()
3261 (*te->error)(te, 0, "internal error: unknown op"); in test_eval()
3266 test_parse(Test_env *te) in test_parse() argument
3270 rv = test_oexpr(te, 1); in test_parse()
3272 if (!(te->flags & TEF_ERROR) && !(*te->isa)(te, TM_END)) in test_parse()
3273 (*te->error)(te, 0, "unexpected operator/operand"); in test_parse()
3275 return ((te->flags & TEF_ERROR) ? T_ERR_EXIT : !rv); in test_parse()
3279 test_oexpr(Test_env *te, bool do_eval) in test_oexpr() argument
3283 if ((rv = test_aexpr(te, do_eval))) in test_oexpr()
3285 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_OR)) in test_oexpr()
3286 return (test_oexpr(te, do_eval) || rv); in test_oexpr()
3291 test_aexpr(Test_env *te, bool do_eval) in test_aexpr() argument
3295 if (!(rv = test_nexpr(te, do_eval))) in test_aexpr()
3297 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_AND)) in test_aexpr()
3298 return (test_aexpr(te, do_eval) && rv); in test_aexpr()
3303 test_nexpr(Test_env *te, bool do_eval) in test_nexpr() argument
3305 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_NOT)) in test_nexpr()
3306 return (!test_nexpr(te, do_eval)); in test_nexpr()
3307 return (test_primary(te, do_eval)); in test_nexpr()
3311 test_primary(Test_env *te, bool do_eval) in test_primary() argument
3317 if (te->flags & TEF_ERROR) in test_primary()
3319 if ((*te->isa)(te, TM_OPAREN)) { in test_primary()
3320 rv = test_oexpr(te, do_eval); in test_primary()
3321 if (te->flags & TEF_ERROR) in test_primary()
3323 if (!(*te->isa)(te, TM_CPAREN)) { in test_primary()
3324 (*te->error)(te, 0, "missing )"); in test_primary()
3333 if ((te->flags & TEF_DBRACKET) || (&te->pos.wp[1] < te->wp_end && in test_primary()
3334 !test_isop(TM_BINOP, te->pos.wp[1]))) { in test_primary()
3335 if ((op = (*te->isa)(te, TM_UNOP))) { in test_primary()
3337 opnd1 = (*te->getopnd)(te, op, do_eval); in test_primary()
3339 (*te->error)(te, -1, "missing argument"); in test_primary()
3343 return ((*te->eval)(te, op, opnd1, NULL, do_eval)); in test_primary()
3346 opnd1 = (*te->getopnd)(te, TO_NONOP, do_eval); in test_primary()
3348 (*te->error)(te, 0, "expression expected"); in test_primary()
3351 if ((op = (*te->isa)(te, TM_BINOP))) { in test_primary()
3353 opnd2 = (*te->getopnd)(te, op, do_eval); in test_primary()
3355 (*te->error)(te, -1, "missing second argument"); in test_primary()
3359 return ((*te->eval)(te, op, opnd1, opnd2, do_eval)); in test_primary()
3361 return ((*te->eval)(te, TO_STNZE, opnd1, NULL, do_eval)); in test_primary()
3374 ptest_isa(Test_env *te, Test_meta meta) in ptest_isa() argument
3382 if (te->pos.wp >= te->wp_end) in ptest_isa()
3386 rv = test_isop(meta, *te->pos.wp); in ptest_isa()
3390 rv = !strcmp(*te->pos.wp, tokens[(int)meta]) ? in ptest_isa()
3395 te->pos.wp++; in ptest_isa()
3401 ptest_getopnd(Test_env *te, Test_op op, bool do_eval MKSH_A_UNUSED) in ptest_getopnd() argument
3403 if (te->pos.wp >= te->wp_end) in ptest_getopnd()
3405 return (*te->pos.wp++); in ptest_getopnd()
3409 ptest_error(Test_env *te, int ofs, const char *msg) in ptest_error() argument
3413 te->flags |= TEF_ERROR; in ptest_error()
3414 if ((op = te->pos.wp + ofs >= te->wp_end ? NULL : te->pos.wp[ofs])) in ptest_error()