Lines Matching refs:te
2713 Test_env te; in c_test() local
2715 te.flags = 0; in c_test()
2716 te.isa = ptest_isa; in c_test()
2717 te.getopnd = ptest_getopnd; in c_test()
2718 te.eval = test_eval; in c_test()
2719 te.error = ptest_error; in c_test()
2731 te.pos.wp = wp + 1; in c_test()
2732 te.wp_end = wp + argc; in c_test()
2746 if ((*te.isa)(&te, TM_END)) in c_test()
2749 opnd1 = (*te.getopnd)(&te, TO_NONOP, 1); in c_test()
2750 if ((op = (*te.isa)(&te, TM_BINOP))) { in c_test()
2751 opnd2 = (*te.getopnd)(&te, op, 1); in c_test()
2752 res = (*te.eval)(&te, op, opnd1, in c_test()
2754 if (te.flags & TEF_ERROR) in c_test()
2761 te.pos.wp--; in c_test()
2764 opnd1 = (*te.getopnd)(&te, TO_NONOP, 1); in c_test()
2767 res = (*te.eval)(&te, TO_STNZE, opnd1, in c_test()
2773 if ((*te.isa)(&te, TM_NOT)) { in c_test()
2778 te.pos.wp = owp + 1; in c_test()
2781 return (test_parse(&te)); in c_test()
2805 test_eval(Test_env *te, Test_op op, const char *opnd1, const char *opnd2, in test_eval() argument
2872 te->flags |= TEF_ERROR; in test_eval()
2885 if (te->flags & TEF_DBRACKET) in test_eval()
2889 if (te->flags & TEF_DBRACKET) in test_eval()
2905 te->flags |= TEF_ERROR; in test_eval()
2940 (*te->error)(te, 0, "internal error: unknown op"); in test_eval()
2965 test_parse(Test_env *te) in test_parse() argument
2969 rv = test_oexpr(te, 1); in test_parse()
2971 if (!(te->flags & TEF_ERROR) && !(*te->isa)(te, TM_END)) in test_parse()
2972 (*te->error)(te, 0, "unexpected operator/operand"); in test_parse()
2974 return ((te->flags & TEF_ERROR) ? T_ERR_EXIT : !rv); in test_parse()
2978 test_oexpr(Test_env *te, bool do_eval) in test_oexpr() argument
2982 if ((rv = test_aexpr(te, do_eval))) in test_oexpr()
2984 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_OR)) in test_oexpr()
2985 return (test_oexpr(te, do_eval) || rv); in test_oexpr()
2990 test_aexpr(Test_env *te, bool do_eval) in test_aexpr() argument
2994 if (!(rv = test_nexpr(te, do_eval))) in test_aexpr()
2996 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_AND)) in test_aexpr()
2997 return (test_aexpr(te, do_eval) && rv); in test_aexpr()
3002 test_nexpr(Test_env *te, bool do_eval) in test_nexpr() argument
3004 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_NOT)) in test_nexpr()
3005 return (!test_nexpr(te, do_eval)); in test_nexpr()
3006 return (test_primary(te, do_eval)); in test_nexpr()
3010 test_primary(Test_env *te, bool do_eval) in test_primary() argument
3016 if (te->flags & TEF_ERROR) in test_primary()
3018 if ((*te->isa)(te, TM_OPAREN)) { in test_primary()
3019 rv = test_oexpr(te, do_eval); in test_primary()
3020 if (te->flags & TEF_ERROR) in test_primary()
3022 if (!(*te->isa)(te, TM_CPAREN)) { in test_primary()
3023 (*te->error)(te, 0, "missing closing paren"); in test_primary()
3032 if ((te->flags & TEF_DBRACKET) || (&te->pos.wp[1] < te->wp_end && in test_primary()
3033 !test_isop(TM_BINOP, te->pos.wp[1]))) { in test_primary()
3034 if ((op = (*te->isa)(te, TM_UNOP))) { in test_primary()
3036 opnd1 = (*te->getopnd)(te, op, do_eval); in test_primary()
3038 (*te->error)(te, -1, "missing argument"); in test_primary()
3042 return ((*te->eval)(te, op, opnd1, NULL, do_eval)); in test_primary()
3045 opnd1 = (*te->getopnd)(te, TO_NONOP, do_eval); in test_primary()
3047 (*te->error)(te, 0, "expression expected"); in test_primary()
3050 if ((op = (*te->isa)(te, TM_BINOP))) { in test_primary()
3052 opnd2 = (*te->getopnd)(te, op, do_eval); in test_primary()
3054 (*te->error)(te, -1, "missing second argument"); in test_primary()
3058 return ((*te->eval)(te, op, opnd1, opnd2, do_eval)); in test_primary()
3060 return ((*te->eval)(te, TO_STNZE, opnd1, NULL, do_eval)); in test_primary()
3073 ptest_isa(Test_env *te, Test_meta meta) in ptest_isa() argument
3081 if (te->pos.wp >= te->wp_end) in ptest_isa()
3085 rv = test_isop(meta, *te->pos.wp); in ptest_isa()
3089 rv = !strcmp(*te->pos.wp, tokens[(int)meta]) ? in ptest_isa()
3094 te->pos.wp++; in ptest_isa()
3100 ptest_getopnd(Test_env *te, Test_op op, bool do_eval MKSH_A_UNUSED) in ptest_getopnd() argument
3102 if (te->pos.wp >= te->wp_end) in ptest_getopnd()
3104 return (*te->pos.wp++); in ptest_getopnd()
3108 ptest_error(Test_env *te, int ofs, const char *msg) in ptest_error() argument
3112 te->flags |= TEF_ERROR; in ptest_error()
3113 if ((op = te->pos.wp + ofs >= te->wp_end ? NULL : te->pos.wp[ofs])) in ptest_error()