Home | History | Annotate | Download | only in src

Lines Matching refs:te

2771 	Test_env te;
2775 te.flags = 0;
2776 te.isa = ptest_isa;
2777 te.getopnd = ptest_getopnd;
2778 te.eval = test_eval;
2779 te.error = ptest_error;
2793 te.pos.wp = wp + 1;
2794 te.wp_end = wp + argc;
2800 * It does, though, inline some calls to '(*te.funcname)()'.
2811 if (ptest_isa(&te, TM_NOT)) {
2815 if ((op = ptest_isa(&te, TM_UNOP))) {
2817 rv = test_eval(&te, op, *te.pos.wp++, NULL, true);
2825 swp = te.pos.wp;
2827 lhs = *te.pos.wp++;
2828 if ((op = ptest_isa(&te, TM_BINOP))) {
2830 rv = test_eval(&te, op, lhs, *te.pos.wp++, true);
2834 te.pos.wp = swp;
2835 if (ptest_isa(&te, TM_NOT)) {
2839 if (ptest_isa(&te, TM_OPAREN)) {
2840 swp = te.pos.wp;
2842 te.pos.wp++;
2844 op = ptest_isa(&te, TM_CPAREN);
2846 te.pos.wp = swp;
2855 if (ptest_isa(&te, TM_NOT)) {
2859 if (ptest_isa(&te, TM_OPAREN)) {
2860 swp = te.pos.wp;
2862 te.pos.wp++;
2863 te.pos.wp++;
2865 op = ptest_isa(&te, TM_CPAREN);
2867 te.pos.wp = swp;
2878 te.pos.wp = wp + 1;
2879 return (test_parse(&te));
2903 test_eval(Test_env *te, Test_op op, const char *opnd1, const char *opnd2,
2932 te->flags |= TEF_ERROR;
3067 te->flags |= TEF_ERROR;
3087 if (te->flags & TEF_DBRACKET)
3093 if (te->flags & TEF_DBRACKET)
3120 te->flags |= TEF_ERROR;
3173 (*te->error)(te, 0, "internal error: unknown op");
3178 test_parse(Test_env *te)
3182 rv = test_oexpr(te, 1);
3184 if (!(te->flags & TEF_ERROR) && !(*te->isa)(te, TM_END))
3185 (*te->error)(te, 0, "unexpected operator/operand");
3187 return ((te->flags & TEF_ERROR) ? T_ERR_EXIT : !rv);
3191 test_oexpr(Test_env *te, bool do_eval)
3195 if ((rv = test_aexpr(te, do_eval)))
3197 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_OR))
3198 return (test_oexpr(te, do_eval) || rv);
3203 test_aexpr(Test_env *te, bool do_eval)
3207 if (!(rv = test_nexpr(te, do_eval)))
3209 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_AND))
3210 return (test_aexpr(te, do_eval) && rv);
3215 test_nexpr(Test_env *te, bool do_eval)
3217 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_NOT))
3218 return (!test_nexpr(te, do_eval));
3219 return (test_primary(te, do_eval));
3223 test_primary(Test_env *te, bool do_eval)
3229 if (te->flags & TEF_ERROR)
3231 if ((*te->isa)(te, TM_OPAREN)) {
3232 rv = test_oexpr(te, do_eval);
3233 if (te->flags & TEF_ERROR)
3235 if (!(*te->isa)(te, TM_CPAREN)) {
3236 (*te->error)(te, 0, "missing )");
3245 if ((te->flags & TEF_DBRACKET) || (&te->pos.wp[1] < te->wp_end &&
3246 !test_isop(TM_BINOP, te->pos.wp[1]))) {
3247 if ((op = (*te->isa)(te, TM_UNOP))) {
3249 opnd1 = (*te->getopnd)(te, op, do_eval);
3251 (*te->error)(te, -1, "missing argument");
3255 return ((*te->eval)(te, op, opnd1, NULL, do_eval));
3258 opnd1 = (*te->getopnd)(te, TO_NONOP, do_eval);
3260 (*te->error)(te, 0, "expression expected");
3263 if ((op = (*te->isa)(te, TM_BINOP))) {
3265 opnd2 = (*te->getopnd)(te, op, do_eval);
3267 (*te->error)(te, -1, "missing second argument");
3271 return ((*te->eval)(te, op, opnd1, opnd2, do_eval));
3273 return ((*te->eval)(te, TO_STNZE, opnd1, NULL, do_eval));
3286 ptest_isa(Test_env *te, Test_meta meta)
3294 if (te->pos.wp >= te->wp_end)
3298 rv = test_isop(meta, *te->pos.wp);
3302 rv = !strcmp(*te->pos.wp, tokens[(int)meta]) ?
3307 te->pos.wp++;
3313 ptest_getopnd(Test_env *te, Test_op op, bool do_eval MKSH_A_UNUSED)
3315 if (te->pos.wp >= te->wp_end)
3317 return (*te->pos.wp++);
3321 ptest_error(Test_env *te, int ofs, const char *msg)
3325 te->flags |= TEF_ERROR;
3326 if ((op = te->pos.wp + ofs >= te->wp_end ? NULL : te->pos.wp[ofs]))