1 /* $OpenBSD: syn.c,v 1.30 2015/09/01 13:12:31 tedu Exp $ */
4 * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009,
5 * 2011, 2012, 2013, 2014, 2015, 2016
6 * mirabilos <m@mirbsd.org>
8 * Provided that these terms and disclaimer and all copyright notices
9 * are retained or reproduced in an accompanying document, permission
10 * is granted to deal in this work without restriction, including un-
11 * limited rights to use, publicly perform, distribute, sell, modify,
12 * merge, give away, or sublicence.
14 * This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
15 * the utmost extent permitted by applicable law, neither express nor
16 * implied; without malicious intent or gross negligence. In no event
17 * may a licensor, author or contributor be held liable for indirect,
18 * direct, other damage, loss, or other issues arising in any way out
19 * of dealing in the work, even if advised of the possibility of such
20 * damage or existence of a defect, except proven that it results out
21 * of said person's immediate fault when using the work as intended.
26 __RCSID("$MirOS: src/bin/mksh/syn.c,v 1.114 2016/08/04 20:32:14 tg Exp $");
28 struct nesting_state {
29 int start_token; /* token than began nesting (eg, FOR) */
30 int start_line; /* line nesting began on */
33 struct yyrecursive_state {
34 struct ioword *old_heres[HERES];
35 struct yyrecursive_state *next;
36 struct ioword **old_herep;
43 static void yyparse(void);
44 static struct op *pipeline(int);
45 static struct op *andor(void);
46 static struct op *c_list(bool);
47 static struct ioword *synio(int);
48 static struct op *nested(int, int, int);
49 static struct op *get_command(int);
50 static struct op *dogroup(void);
51 static struct op *thenpart(void);
52 static struct op *elsepart(void);
53 static struct op *caselist(void);
54 static struct op *casepart(int);
55 static struct op *function_body(char *, bool);
56 static char **wordlist(void);
57 static struct op *block(int, struct op *, struct op *);
58 static struct op *newtp(int);
59 static void syntaxerr(const char *) MKSH_A_NORETURN;
60 static void nesting_push(struct nesting_state *, int);
61 static void nesting_pop(struct nesting_state *);
62 static int inalias(struct source *) MKSH_A_PURE;
63 static Test_op dbtestp_isa(Test_env *, Test_meta);
64 static const char *dbtestp_getopnd(Test_env *, Test_op, bool);
65 static int dbtestp_eval(Test_env *, Test_op, const char *,
67 static void dbtestp_error(Test_env *, int, const char *) MKSH_A_NORETURN;
69 static struct op *outtree; /* yyparse output */
70 static struct nesting_state nesting; /* \n changed to ; */
72 static bool reject; /* token(cf) gets symbol again */
73 static int symbol; /* yylex value */
74 static int sALIAS = ALIAS; /* 0 in yyrecursive */
76 #define REJECT (reject = true)
77 #define ACCEPT (reject = false)
78 #define token(cf) ((reject) ? (ACCEPT, symbol) : (symbol = yylex(cf)))
79 #define tpeek(cf) ((reject) ? (symbol) : (REJECT, symbol = yylex(cf)))
80 #define musthave(c,cf) do { if (token(cf) != (c)) syntaxerr(NULL); } while (/* CONSTCOND */ 0)
82 static const char Tcbrace[] = "}";
83 static const char Tesac[] = "esac";
92 outtree = c_list(source->type == SSTRING);
94 if (c == 0 && !outtree)
95 outtree = newtp(TEOF);
96 else if (c != '\n' && c != 0)
103 struct op *t, *p, *tl = NULL;
107 while (token(0) == '|') {
108 if ((p = get_command(CONTIN)) == NULL)
111 t = tl = block(TPIPE, t, p);
113 tl = tl->right = block(TPIPE, tl->right, p);
128 while ((c = token(0)) == LOGAND || c == LOGOR) {
129 if ((p = pipeline(CONTIN)) == NULL)
131 t = block(c == LOGAND? TAND: TOR, t, p);
141 struct op *t = NULL, *p, *tl = NULL;
145 while (/* CONSTCOND */ 1) {
148 * Token has always been read/rejected at this point, so
149 * we don't worry about what flags to pass token()
153 if (c == '\n' && (multi || inalias(source))) {
155 /* ignore blank lines */
159 else if (c == '&' || c == COPROC)
160 p = block(c == '&' ? TASYNC : TCOPROC, p, NULL);
166 t = tl = block(TLIST, t, p);
168 tl = tl->right = block(TLIST, tl->right, p);
176 static const char IONDELIM_delim[] = { CHAR, '<', CHAR, '<', EOS };
178 static struct ioword *
182 static struct ioword *nextiop;
185 if (nextiop != NULL) {
191 if (tpeek(cf) != REDIR)
195 ishere = (iop->ioflag & IOTYPE) == IOHERE;
196 if (iop->ioflag & IOHERESTR) {
198 } else if (ishere && tpeek(HEREDELIM) == '\n') {
200 yylval.cp = wdcopy(IONDELIM_delim, ATEMP);
201 iop->ioflag |= IOEVAL | IONDELIM;
203 musthave(LWORD, ishere ? HEREDELIM : 0);
205 iop->delim = yylval.cp;
206 if (*ident != 0 && !(iop->ioflag & IOHERESTR)) {
208 iop->ioflag |= IOEVAL;
210 if (herep > &heres[HERES - 1])
211 yyerror(Tf_toomany, "<<");
214 iop->ioname = yylval.cp;
216 if (iop->ioflag & IOBASH) {
219 nextiop = alloc(sizeof(*iop), ATEMP);
220 nextiop->ioname = cp = alloc(3, ATEMP);
222 *cp++ = digits_lc[iop->unit % 10];
225 iop->ioflag &= ~IOBASH;
227 nextiop->ioflag = IODUP;
228 nextiop->delim = NULL;
229 nextiop->heredoc = NULL;
235 nested(int type, int smark, int emark)
238 struct nesting_state old_nesting;
240 nesting_push(&old_nesting, smark);
242 musthave(emark, KEYWORD|sALIAS);
243 nesting_pop(&old_nesting);
244 return (block(type, t, NULL));
247 static const char let_cmd[] = {
248 QCHAR, 'l', CHAR, 'e', CHAR, 't', CHAR, ']', EOS
250 static const char setA_cmd0[] = {
251 QCHAR, 's', CHAR, 'e', CHAR, 't', EOS
253 static const char setA_cmd1[] = {
254 CHAR, '-', CHAR, 'A', EOS
256 static const char setA_cmd2[] = {
257 CHAR, '-', CHAR, '-', EOS
264 int c, iopn = 0, syniocf, lno;
265 struct ioword *iop, **iops;
267 struct nesting_state old_nesting;
269 /* NUFILE is small enough to leave this addition unchecked */
270 iops = alloc2((NUFILE + 1), sizeof(struct ioword *), ATEMP);
274 syniocf = KEYWORD|sALIAS;
275 switch (c = token(cf|KEYWORD|sALIAS|CMDASN)) {
287 syniocf &= ~(KEYWORD|sALIAS);
289 t->lineno = source->line;
290 goto get_command_begin;
291 while (/* CONSTCOND */ 1) {
292 bool check_assign_cmd;
294 if (XPsize(args) == 0) {
296 check_assign_cmd = true;
297 cf = sALIAS | CMDASN;
298 } else if (t->u.evalflags)
299 cf = CMDWORD | CMDASN;
304 while ((iop = synio(cf)) != NULL) {
315 * the iopn == 0 and XPsize(vars) == 0 are
316 * dubious but AT&T ksh acts this way
318 if (iopn == 0 && XPsize(vars) == 0 &&
320 if (assign_command(ident, false))
321 t->u.evalflags = DOVACHECK;
322 else if (strcmp(ident, Tcommand) != 0)
323 check_assign_cmd = false;
325 if ((XPsize(args) == 0 || Flag(FKEYWORD)) &&
326 is_wdvarassign(yylval.cp))
327 XPput(vars, yylval.cp);
329 XPput(args, yylval.cp);
333 if (XPsize(args) == 0 && XPsize(vars) == 1 &&
334 is_wdvarassign(yylval.cp)) {
337 /* wdarrassign: foo=(bar) */
340 /* manipulate the vars string */
341 tcp = XPptrv(vars)[(vars.len = 0)];
342 /* 'varname=' -> 'varname' */
343 tcp[wdscan(tcp, EOS) - tcp - 3] = EOS;
345 /* construct new args strings */
346 XPput(args, wdcopy(setA_cmd0, ATEMP));
347 XPput(args, wdcopy(setA_cmd1, ATEMP));
349 XPput(args, wdcopy(setA_cmd2, ATEMP));
351 /* slurp in words till closing paren */
352 while (token(CONTIN) == LWORD)
353 XPput(args, yylval.cp);
354 if (symbol != /*(*/ ')')
358 * Check for "> foo (echo hi)"
359 * which AT&T ksh allows (not
360 * POSIX, but not disallowed)
363 if (XPsize(args) == 0 &&
369 /* must be a function */
370 if (iopn != 0 || XPsize(args) != 1 ||
374 musthave(/*(*/')', 0);
375 t = function_body(XPptrv(args)[0], false);
387 int subshell_nesting_type_saved;
389 subshell_nesting_type_saved = subshell_nesting_type;
390 subshell_nesting_type = ')';
391 t = nested(TPAREN, '(', ')');
392 subshell_nesting_type = subshell_nesting_type_saved;
397 t = nested(TBRACE, '{', '}');
401 /* leave KEYWORD in syniocf (allow if (( 1 )) then ...) */
404 switch (token(LETEXPR)) {
415 XPput(args, wdcopy(let_cmd, ATEMP));
416 XPput(args, yylval.cp);
419 case DBRACKET: /* [[ .. ]] */
420 /* leave KEYWORD in syniocf (allow if [[ -n 1 ]] then ...) */
421 t = newtp(TDBRACKET);
426 te.flags = TEF_DBRACKET;
428 te.isa = dbtestp_isa;
429 te.getopnd = dbtestp_getopnd;
430 te.eval = dbtestp_eval;
431 te.error = dbtestp_error;
439 t = newtp((c == FOR) ? TFOR : TSELECT);
440 musthave(LWORD, CMDASN);
441 if (!is_wdvarname(yylval.cp, true))
442 yyerror("%s: bad identifier\n",
443 c == FOR ? "for" : Tselect);
444 strdupx(t->str, ident, ATEMP);
445 nesting_push(&old_nesting, c);
446 t->vars = wordlist();
448 nesting_pop(&old_nesting);
453 nesting_push(&old_nesting, c);
454 t = newtp((c == WHILE) ? TWHILE : TUNTIL);
455 t->left = c_list(true);
456 t->right = dogroup();
457 nesting_pop(&old_nesting);
464 nesting_push(&old_nesting, c);
465 t->left = caselist();
466 nesting_pop(&old_nesting);
470 nesting_push(&old_nesting, c);
472 t->left = c_list(true);
473 t->right = thenpart();
474 musthave(FI, KEYWORD|sALIAS);
475 nesting_pop(&old_nesting);
479 syniocf &= ~(KEYWORD|sALIAS);
483 t = block(TBANG, NULL, t);
487 syniocf &= ~(KEYWORD|sALIAS);
489 if (t && t->type == TCOM) {
490 t->str = alloc(2, ATEMP);
495 t = block(TTIME, t, NULL);
500 t = function_body(yylval.cp, true);
504 while ((iop = synio(syniocf)) != NULL) {
506 yyerror(Tf_toomany, Tredirection);
515 iops = aresize2(iops, iopn, sizeof(struct ioword *), ATEMP);
519 if (t->type == TCOM || t->type == TDBRACKET) {
521 t->args = (const char **)XPclose(args);
523 t->vars = (char **)XPclose(vars);
530 t = block(TBRACE, t, NULL);
531 t->ioact = t->left->ioact;
532 t->left->ioact = NULL;
544 c = token(CONTIN|KEYWORD|sALIAS);
546 * A {...} can be used instead of do...done for for/select loops
547 * but not for while/until loops - we don't need to check if it
548 * is a while loop because it would have been parsed as part of
549 * the conditional command list...
558 musthave(c, KEYWORD|sALIAS);
567 musthave(THEN, KEYWORD|sALIAS);
569 t->left = c_list(true);
572 t->right = elsepart();
581 switch (token(KEYWORD|sALIAS|CMDASN)) {
583 if ((t = c_list(true)) == NULL)
589 t->left = c_list(true);
590 t->right = thenpart();
605 c = token(CONTIN|KEYWORD|sALIAS);
606 /* A {...} can be used instead of in...esac for case statements */
615 while ((tpeek(CONTIN|KEYWORD|ESACONLY)) != c) {
616 struct op *tc = casepart(c);
618 t = tl = tc, tl->right = NULL;
620 tl->right = tc, tl = tc;
622 musthave(c, KEYWORD|sALIAS);
635 if (token(CONTIN | KEYWORD) != '(')
643 if (symbol != endtok) {
645 symbol == '}' ? Tcbrace : Tesac, ATEMP);
652 XPput(ptns, yylval.cp);
653 } while (token(0) == '|');
656 t->vars = (char **)XPclose(ptns);
659 t->left = c_list(true);
661 /* initialise to default for ;; or omitted */
663 /* SUSv4 requires the ;; except in the last casepart */
664 if ((tpeek(CONTIN|KEYWORD|sALIAS)) != endtok)
676 /* initialised above, but we need to eat the token */
683 function_body(char *name,
684 /* function foo { ... } vs foo() { .. } */
690 sname = wdstrip(name, 0);
692 * Check for valid characters in name. POSIX and AT&T ksh93 say
693 * only allow [a-zA-Z_0-9] but this allows more as old pdkshs
694 * have allowed more; the following were never allowed:
695 * NUL TAB NL SP " $ & ' ( ) ; < = > \ ` |
696 * C_QUOTE covers all but adds # * ? [ ]
698 for (p = sname; *p; p++)
699 if (ctype(*p, C_QUOTE))
700 yyerror("%s: invalid function name\n", sname);
703 * Note that POSIX allows only compound statements after foo(),
704 * sh and AT&T ksh allow any command, go with the later since it
705 * shouldn't break anything. However, for function foo, AT&T ksh
706 * only accepts an open-brace.
709 if (tpeek(CONTIN|KEYWORD|sALIAS) == '(' /*)*/) {
710 /* function foo () { //}*/
713 /* degrade to POSIX function */
716 musthave('{' /*}*/, CONTIN|KEYWORD|sALIAS);
722 t->u.ksh_func = tobool(ksh_func);
723 t->lineno = source->line;
725 if ((t->left = get_command(CONTIN)) == NULL) {
728 * Probably something like foo() followed by EOF or ';'.
729 * This is accepted by sh and ksh88.
730 * To make "typeset -f foo" work reliably (so its output can
731 * be used as input), we pretend there is a colon here.
733 t->left = newtp(TCOM);
734 /* (2 * sizeof(char *)) is small enough */
735 t->left->args = alloc(2 * sizeof(char *), ATEMP);
736 t->left->args[0] = tv = alloc(3, ATEMP);
740 t->left->args[1] = NULL;
741 t->left->vars = alloc(sizeof(char *), ATEMP);
742 t->left->vars[0] = NULL;
756 /* POSIX does not do alias expansion here... */
757 if ((c = token(CONTIN|KEYWORD|sALIAS)) != IN) {
759 /* non-POSIX, but AT&T ksh accepts a ; here */
763 while ((c = token(0)) == LWORD)
764 XPput(args, yylval.cp);
765 if (c != '\n' && c != ';')
768 return ((char **)XPclose(args));
772 * supporting functions
776 block(int type, struct op *t1, struct op *t2)
786 static const struct tokeninfo {
793 { "then", THEN, true },
794 { "else", ELSE, true },
795 { "elif", ELIF, true },
797 { "case", CASE, true },
798 { Tesac, ESAC, true },
799 { "for", FOR, true },
800 { Tselect, SELECT, true },
801 { "while", WHILE, true },
802 { "until", UNTIL, true },
804 { "done", DONE, true },
806 { Tfunction, FUNCTION, true },
807 { Ttime, TIME, true },
809 { Tcbrace, '}', true },
811 { "[[", DBRACKET, true },
812 /* Lexical tokens (0[EOF], LWORD and REDIR handled specially) */
813 { "&&", LOGAND, false },
814 { "||", LOGOR, false },
815 { ";;", BREAK, false },
816 { ";|", BRKEV, false },
817 { ";&", BRKFT, false },
818 { "((", MDPAREN, false },
819 { "|&", COPROC, false },
820 /* and some special cases... */
821 { "newline", '\n', false },
828 struct tokeninfo const *tt;
831 ktinit(APERM, &keywords,
832 /* currently 28 keywords: 75% of 64 = 2^6 */
834 for (tt = tokentab; tt->name; tt++) {
836 p = ktenter(&keywords, tt->name, hash(tt->name));
837 p->flag |= DEFINED|ISSET;
845 syntaxerr(const char *what)
847 /* 23<<- is the longest redirection, I think */
850 struct tokeninfo const *tt;
860 if (nesting.start_token) {
861 c = nesting.start_token;
862 source->errline = nesting.start_line;
866 /* don't quote the EOF */
867 yyerror("%s: unexpected EOF\n", Tsynerr);
871 s = snptreef(NULL, 32, Tf_S, yylval.cp);
875 s = snptreef(redir, sizeof(redir), Tft_R, yylval.iop);
879 for (tt = tokentab; tt->name; tt++)
885 if (c > 0 && c < 256) {
889 shf_snprintf(redir, sizeof(redir),
894 yyerror("%s: '%s' %s\n", Tsynerr, s, what);
898 nesting_push(struct nesting_state *save, int tok)
901 nesting.start_token = tok;
902 nesting.start_line = source->line;
906 nesting_pop(struct nesting_state *saved)
916 t = alloc(sizeof(struct op), ATEMP);
922 t->left = t->right = NULL;
928 compile(Source *s, bool skiputf8bom)
930 nesting.start_token = 0;
931 nesting.start_line = 0;
941 * This kludge exists to take care of sh/AT&T ksh oddity in which
942 * the arguments of alias/export/readonly/typeset have no field
943 * splitting, file globbing, or (normal) tilde expansion done.
944 * AT&T ksh seems to do something similar to this since
945 * $ touch a=a; typeset a=[ab]; echo "$a"
947 * $ x=typeset; $x a=[ab]; echo "$a"
952 assign_command(const char *s, bool docommand)
956 return ((strcmp(s, Talias) == 0) ||
957 (strcmp(s, Texport) == 0) ||
958 (strcmp(s, Treadonly) == 0) ||
959 (docommand && (strcmp(s, Tcommand) == 0)) ||
960 (strcmp(s, Ttypeset) == 0));
963 /* Check if we are in the middle of reading an alias */
965 inalias(struct source *s)
967 while (s && s->type == SALIAS) {
968 if (!(s->flags & SF_ALIASEND))
977 * Order important - indexed by Test_meta values
978 * Note that ||, &&, ( and ) can't appear in as unquoted strings
979 * in normal shell input, so these can be interpreted unambiguously
980 * in the evaluation pass.
982 static const char dbtest_or[] = { CHAR, '|', CHAR, '|', EOS };
983 static const char dbtest_and[] = { CHAR, '&', CHAR, '&', EOS };
984 static const char dbtest_not[] = { CHAR, '!', EOS };
985 static const char dbtest_oparen[] = { CHAR, '(', EOS };
986 static const char dbtest_cparen[] = { CHAR, ')', EOS };
987 const char * const dbtest_tokens[] = {
988 dbtest_or, dbtest_and, dbtest_not,
989 dbtest_oparen, dbtest_cparen
991 static const char db_close[] = { CHAR, ']', CHAR, ']', EOS };
992 static const char db_lthan[] = { CHAR, '<', EOS };
993 static const char db_gthan[] = { CHAR, '>', EOS };
996 * Test if the current token is a whatever. Accepts the current token if
997 * it is. Returns 0 if it is not, non-zero if it is (in the case of
998 * TM_UNOP and TM_BINOP, the returned value is a Test_op).
1001 dbtestp_isa(Test_env *te, Test_meta meta)
1003 int c = tpeek(CMDASN | (meta == TM_BINOP ? 0 : CONTIN));
1006 Test_op ret = TO_NONOP;
1008 /* unquoted word? */
1009 uqword = c == LWORD && *ident;
1012 ret = c == LOGOR ? TO_NONNULL : TO_NONOP;
1013 else if (meta == TM_AND)
1014 ret = c == LOGAND ? TO_NONNULL : TO_NONOP;
1015 else if (meta == TM_NOT)
1016 ret = (uqword && !strcmp(yylval.cp,
1017 dbtest_tokens[(int)TM_NOT])) ? TO_NONNULL : TO_NONOP;
1018 else if (meta == TM_OPAREN)
1019 ret = c == '(' /*)*/ ? TO_NONNULL : TO_NONOP;
1020 else if (meta == TM_CPAREN)
1021 ret = c == /*(*/ ')' ? TO_NONNULL : TO_NONOP;
1022 else if (meta == TM_UNOP || meta == TM_BINOP) {
1023 if (meta == TM_BINOP && c == REDIR &&
1024 (yylval.iop->ioflag == IOREAD ||
1025 yylval.iop->ioflag == IOWRITE)) {
1027 save = wdcopy(yylval.iop->ioflag == IOREAD ?
1028 db_lthan : db_gthan, ATEMP);
1029 } else if (uqword && (ret = test_isop(meta, ident)))
1032 /* meta == TM_END */
1033 ret = (uqword && !strcmp(yylval.cp,
1034 db_close)) ? TO_NONNULL : TO_NONOP;
1035 if (ret != TO_NONOP) {
1037 if ((unsigned int)meta < NELEM(dbtest_tokens))
1038 save = wdcopy(dbtest_tokens[(int)meta], ATEMP);
1040 XPput(*te->pos.av, save);
1046 dbtestp_getopnd(Test_env *te, Test_op op MKSH_A_UNUSED,
1047 bool do_eval MKSH_A_UNUSED)
1049 int c = tpeek(CMDASN);
1055 XPput(*te->pos.av, yylval.cp);
1061 dbtestp_eval(Test_env *te MKSH_A_UNUSED, Test_op op MKSH_A_UNUSED,
1062 const char *opnd1 MKSH_A_UNUSED, const char *opnd2 MKSH_A_UNUSED,
1063 bool do_eval MKSH_A_UNUSED)
1069 dbtestp_error(Test_env *te, int offset, const char *msg)
1071 te->flags |= TEF_ERROR;
1075 /* Kludgy to say the least... */
1077 yylval.cp = *(XPptrv(*te->pos.av) + XPsize(*te->pos.av) +
1087 #define EOVERFLOW ERANGE
1089 #define EOVERFLOW EINVAL
1094 parse_usec(const char *s, struct timeval *tv)
1100 /* parse integral part */
1101 while (ksh_isdigit(*s)) {
1102 tt.tv_sec = tv->tv_sec * 10 + ksh_numdig(*s++);
1103 /*XXX this overflow check maybe UB */
1104 if (tt.tv_sec / 10 != tv->tv_sec) {
1108 tv->tv_sec = tt.tv_sec;
1113 /* no decimal fraction */
1115 else if (*s++ != '.') {
1116 /* junk after integral part */
1121 /* parse decimal fraction */
1123 while (ksh_isdigit(*s)) {
1124 tv->tv_usec += i * ksh_numdig(*s++);
1129 /* check for junk after fractional part */
1130 while (ksh_isdigit(*s))
1137 /* end of input string reached, no errors */
1143 * Helper function called from within lex.c:yylex() to parse
1144 * a COMSUB recursively using the main shell parser and lexer
1147 yyrecursive(int subtype MKSH_A_UNUSED)
1151 struct yyrecursive_state *ys;
1154 if (subtype != COMSUB) {
1162 ys = alloc(sizeof(struct yyrecursive_state), ATEMP);
1164 /* tell the lexer to accept a closing parenthesis as EOD */
1165 ys->old_nesting_type = subshell_nesting_type;
1166 subshell_nesting_type = etok;
1168 /* push reject state, parse recursively, pop reject state */
1169 ys->old_reject = reject;
1170 ys->old_symbol = symbol;
1172 memcpy(ys->old_heres, heres, sizeof(heres));
1173 ys->old_herep = herep;
1175 ys->old_salias = sALIAS;
1177 ys->next = e->yyrecursive_statep;
1178 e->yyrecursive_statep = ys;
1179 /* we use TPAREN as a helper container here */
1180 t = nested(TPAREN, stok, etok);
1181 yyrecursive_pop(false);
1183 /* t->left because nested(TPAREN, ...) hides our goodies there */
1184 cp = snptreef(NULL, 0, Tf_T, t->left);
1191 yyrecursive_pop(bool popall)
1193 struct yyrecursive_state *ys;
1196 if (!(ys = e->yyrecursive_statep))
1198 e->yyrecursive_statep = ys->next;
1200 sALIAS = ys->old_salias;
1201 memcpy(heres, ys->old_heres, sizeof(heres));
1202 herep = ys->old_herep;
1203 reject = ys->old_reject;
1204 symbol = ys->old_symbol;
1206 subshell_nesting_type = ys->old_nesting_type;