Home | History | Annotate | Download | only in ksh

Lines Matching defs:te

114 	Test_env te;
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)
195 Test_env *te;
208 && ((te->flags & TEF_DBRACKET)
217 test_eval(te, op, opnd1, opnd2, do_eval)
218 Test_env *te;
339 te->flags |= TEF_ERROR;
354 if (te->flags & TEF_DBRACKET)
358 if (te->flags & TEF_DBRACKET)
378 te->flags |= TEF_ERROR;
424 (*te->error)(te, 0, "internal error: unknown op");
467 test_parse(te)
468 Test_env *te;
472 res = test_oexpr(te, 1);
474 if (!(te->flags & TEF_ERROR) && !(*te->isa)(te, TM_END))
475 (*te->error)(te, 0, "unexpected operator/operand");
477 return (te->flags & TEF_ERROR) ? T_ERR_EXIT : !res;
481 test_oexpr(te, do_eval)
482 Test_env *te;
487 res = test_aexpr(te, do_eval);
490 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_OR))
491 return test_oexpr(te, do_eval) || res;
496 test_aexpr(te, do_eval)
497 Test_env *te;
502 res = test_nexpr(te, do_eval);
505 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_AND))
506 return test_aexpr(te, do_eval) && res;
511 test_nexpr(te, do_eval)
512 Test_env *te;
515 if (!(te->flags & TEF_ERROR) && (*te->isa)(te, TM_NOT))
516 return !test_nexpr(te, do_eval);
517 return test_primary(te, do_eval);
521 test_primary(te, do_eval)
522 Test_env *te;
529 if (te->flags & TEF_ERROR)
531 if ((*te->isa)(te, TM_OPAREN)) {
532 res = test_oexpr(te, do_eval);
533 if (te->flags & TEF_ERROR)
535 if (!(*te->isa)(te, TM_CPAREN)) {
536 (*te->error)(te, 0, "missing closing paren");
541 if ((op = (Test_op) (*te->isa)(te, TM_UNOP))) {
543 opnd1 = (*te->getopnd)(te, op, do_eval);
545 (*te->error)(te, -1, "missing argument");
549 return (*te->eval)(te, op, opnd1, (const char *) 0, do_eval);
551 opnd1 = (*te->getopnd)(te, TO_NONOP, do_eval);
553 (*te->error)(te, 0, "expression expected");
556 if ((op = (Test_op) (*te->isa)(te, TM_BINOP))) {
558 opnd2 = (*te->getopnd)(te, op, do_eval);
560 (*te->error)(te, -1, "missing second argument");
564 return (*te->eval)(te, op, opnd1, opnd2, do_eval);
566 if (te->flags & TEF_DBRACKET) {
567 (*te->error)(te, -1, "missing expression operator");
570 return (*te->eval)(te, TO_STNZE, opnd1, (const char *) 0, do_eval);
582 ptest_isa(te, meta)
583 Test_env *te;
592 if (te->pos.wp >= te->wp_end)
596 ret = (int) test_isop(te, meta, *te->pos.wp);
600 ret = strcmp(*te->pos.wp, tokens[(int) meta]) == 0;
604 te->pos.wp++;
610 ptest_getopnd(te, op, do_eval)
611 Test_env *te;
615 if (te->pos.wp >= te->wp_end)
617 return *te->pos.wp++;
621 ptest_eval(te, op, opnd1, opnd2, do_eval)
622 Test_env *te;
628 return test_eval(te, op, opnd1, opnd2, do_eval);
632 ptest_error(te, offset, msg)
633 Test_env *te;
637 const char *op = te->pos.wp + offset >= te->wp_end ?
638 (const char *) 0 : te->pos.wp[offset];
640 te->flags |= TEF_ERROR;