Lines Matching refs:te
114 Test_env te; local
116 te.flags = 0;
117 te.isa = ptest_isa;
118 te.getopnd = ptest_getopnd;
119 te.eval = ptest_eval;
120 te.error = ptest_error;
132 te.pos.wp = wp + 1;
133 te.wp_end = wp + argc;
147 if ((*te.isa)(&te, TM_END))
150 opnd1 = (*te.getopnd)(&te, TO_NONOP, 1);
151 if ((op = (Test_op) (*te.isa)(&te, TM_BINOP))) {
152 opnd2 = (*te.getopnd)(&te, op, 1);
153 res = (*te.eval)(&te, op, opnd1, opnd2,
155 if (te.flags & TEF_ERROR)
162 te.pos.wp--;
165 opnd1 = (*te.getopnd)(&te, TO_NONOP, 1);
172 res = (*te.eval)(&te, TO_STNZE, opnd1,
178 if ((*te.isa)(&te, TM_NOT)) {
183 te.pos.wp = owp + 1;
186 return test_parse(&te);
194 test_isop(te, meta, s) in test_isop() argument
195 Test_env *te; in test_isop()
208 && ((te->flags & TEF_DBRACKET)
217 test_eval(te, op, opnd1, opnd2, do_eval) in test_eval() argument
218 Test_env *te; in test_eval()
339 te->flags |= TEF_ERROR;
354 if (te->flags & TEF_DBRACKET)
358 if (te->flags & TEF_DBRACKET)
378 te->flags |= TEF_ERROR;
422 (*te->error)(te, 0, "internal error: unknown op");
465 test_parse(te) in test_parse() argument
466 Test_env *te; in test_parse()
470 res = test_oexpr(te, 1);
472 if (!(te->flags & TEF_ERROR) && !(*te->isa)(te, TM_END))
473 (*te->error)(te, 0, "unexpected operator/operand");
475 return (te->flags & TEF_ERROR) ? T_ERR_EXIT : !res;
479 test_oexpr(te, do_eval) in test_oexpr() argument
480 Test_env *te; in test_oexpr()
485 res = test_aexpr(te, do_eval);
488 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_OR))
489 return test_oexpr(te, do_eval) || res;
494 test_aexpr(te, do_eval) in test_aexpr() argument
495 Test_env *te; in test_aexpr()
500 res = test_nexpr(te, do_eval);
503 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_AND))
504 return test_aexpr(te, do_eval) && res;
509 test_nexpr(te, do_eval) in test_nexpr() argument
510 Test_env *te; in test_nexpr()
513 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_NOT))
514 return !test_nexpr(te, do_eval);
515 return test_primary(te, do_eval);
519 test_primary(te, do_eval) in test_primary() argument
520 Test_env *te; in test_primary()
527 if (te->flags & TEF_ERROR)
529 if ((*te->isa)(te, TM_OPAREN)) {
530 res = test_oexpr(te, do_eval);
531 if (te->flags & TEF_ERROR)
533 if (!(*te->isa)(te, TM_CPAREN)) {
534 (*te->error)(te, 0, "missing closing paren");
539 if ((op = (Test_op) (*te->isa)(te, TM_UNOP))) {
541 opnd1 = (*te->getopnd)(te, op, do_eval);
543 (*te->error)(te, -1, "missing argument");
547 return (*te->eval)(te, op, opnd1, (const char *) 0, do_eval);
549 opnd1 = (*te->getopnd)(te, TO_NONOP, do_eval);
551 (*te->error)(te, 0, "expression expected");
554 if ((op = (Test_op) (*te->isa)(te, TM_BINOP))) {
556 opnd2 = (*te->getopnd)(te, op, do_eval);
558 (*te->error)(te, -1, "missing second argument");
562 return (*te->eval)(te, op, opnd1, opnd2, do_eval);
564 if (te->flags & TEF_DBRACKET) {
565 (*te->error)(te, -1, "missing expression operator");
568 return (*te->eval)(te, TO_STNZE, opnd1, (const char *) 0, do_eval);
580 ptest_isa(te, meta) in ptest_isa() argument
581 Test_env *te; in ptest_isa()
590 if (te->pos.wp >= te->wp_end)
594 ret = (int) test_isop(te, meta, *te->pos.wp);
598 ret = strcmp(*te->pos.wp, tokens[(int) meta]) == 0;
602 te->pos.wp++;
608 ptest_getopnd(te, op, do_eval) in ptest_getopnd() argument
609 Test_env *te; in ptest_getopnd()
613 if (te->pos.wp >= te->wp_end)
615 return *te->pos.wp++;
619 ptest_eval(te, op, opnd1, opnd2, do_eval) in ptest_eval() argument
620 Test_env *te; in ptest_eval()
626 return test_eval(te, op, opnd1, opnd2, do_eval);
630 ptest_error(te, offset, msg) in ptest_error() argument
631 Test_env *te; in ptest_error()
635 const char *op = te->pos.wp + offset >= te->wp_end ?
636 (const char *) 0 : te->pos.wp[offset];
638 te->flags |= TEF_ERROR;