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, 2017
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.120 2017/04/06 01:59:57 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;
42 static void yyparse(bool);
43 static struct op *pipeline(int, int);
44 static struct op *andor(int);
45 static struct op *c_list(int, bool);
46 static struct ioword *synio(int);
47 static struct op *nested(int, int, int, int);
48 static struct op *get_command(int, int);
49 static struct op *dogroup(int);
50 static struct op *thenpart(int);
51 static struct op *elsepart(int);
52 static struct op *caselist(int);
53 static struct op *casepart(int, int);
54 static struct op *function_body(char *, int, bool);
55 static char **wordlist(int);
56 static struct op *block(int, struct op *, struct op *);
57 static struct op *newtp(int);
58 static void syntaxerr(const char *) MKSH_A_NORETURN;
59 static void nesting_push(struct nesting_state *, int);
60 static void nesting_pop(struct nesting_state *);
61 static int inalias(struct source *) MKSH_A_PURE;
62 static Test_op dbtestp_isa(Test_env *, Test_meta);
63 static const char *dbtestp_getopnd(Test_env *, Test_op, bool);
64 static int dbtestp_eval(Test_env *, Test_op, const char *,
66 static void dbtestp_error(Test_env *, int, const char *) MKSH_A_NORETURN;
68 static struct op *outtree; /* yyparse output */
69 static struct nesting_state nesting; /* \n changed to ; */
71 static bool reject; /* token(cf) gets symbol again */
72 static int symbol; /* yylex value */
74 #define REJECT (reject = true)
75 #define ACCEPT (reject = false)
76 #define token(cf) ((reject) ? (ACCEPT, symbol) : (symbol = yylex(cf)))
77 #define tpeek(cf) ((reject) ? (symbol) : (REJECT, symbol = yylex(cf)))
78 #define musthave(c,cf) do { if (token(cf) != (c)) syntaxerr(NULL); } while (/* CONSTCOND */ 0)
80 static const char Tcbrace[] = "}";
81 static const char Tesac[] = "esac";
90 outtree = c_list(doalias ? ALIAS : 0, source->type == SSTRING);
92 if (c == 0 && !outtree)
93 outtree = newtp(TEOF);
94 else if (c != '\n' && c != 0)
99 pipeline(int cf, int sALIAS)
101 struct op *t, *p, *tl = NULL;
103 t = get_command(cf, sALIAS);
105 while (token(0) == '|') {
106 if ((p = get_command(CONTIN, sALIAS)) == NULL)
109 t = tl = block(TPIPE, t, p);
111 tl = tl->right = block(TPIPE, tl->right, p);
124 t = pipeline(0, sALIAS);
126 while ((c = token(0)) == LOGAND || c == LOGOR) {
127 if ((p = pipeline(CONTIN, sALIAS)) == NULL)
129 t = block(c == LOGAND? TAND: TOR, t, p);
137 c_list(int sALIAS, bool multi)
139 struct op *t = NULL, *p, *tl = NULL;
143 while (/* CONSTCOND */ 1) {
146 * Token has always been read/rejected at this point, so
147 * we don't worry about what flags to pass token()
151 if (c == '\n' && (multi || inalias(source))) {
153 /* ignore blank lines */
157 else if (c == '&' || c == COPROC)
158 p = block(c == '&' ? TASYNC : TCOPROC, p, NULL);
164 t = tl = block(TLIST, t, p);
166 tl = tl->right = block(TLIST, tl->right, p);
174 static const char IONDELIM_delim[] = { CHAR, '<', CHAR, '<', EOS };
176 static struct ioword *
180 static struct ioword *nextiop;
183 if (nextiop != NULL) {
189 if (tpeek(cf) != REDIR)
193 ishere = (iop->ioflag & IOTYPE) == IOHERE;
194 if (iop->ioflag & IOHERESTR) {
196 } else if (ishere && tpeek(HEREDELIM) == '\n') {
198 yylval.cp = wdcopy(IONDELIM_delim, ATEMP);
199 iop->ioflag |= IOEVAL | IONDELIM;
201 musthave(LWORD, ishere ? HEREDELIM : 0);
203 iop->delim = yylval.cp;
204 if (*ident != 0 && !(iop->ioflag & IOHERESTR)) {
206 iop->ioflag |= IOEVAL;
208 if (herep > &heres[HERES - 1])
209 yyerror(Tf_toomany, "<<");
212 iop->ioname = yylval.cp;
214 if (iop->ioflag & IOBASH) {
217 nextiop = alloc(sizeof(*iop), ATEMP);
218 nextiop->ioname = cp = alloc(3, ATEMP);
220 *cp++ = digits_lc[iop->unit % 10];
223 iop->ioflag &= ~IOBASH;
225 nextiop->ioflag = IODUP;
226 nextiop->delim = NULL;
227 nextiop->heredoc = NULL;
233 nested(int type, int smark, int emark, int sALIAS)
236 struct nesting_state old_nesting;
238 nesting_push(&old_nesting, smark);
239 t = c_list(sALIAS, true);
240 musthave(emark, KEYWORD|sALIAS);
241 nesting_pop(&old_nesting);
242 return (block(type, t, NULL));
245 static const char builtin_cmd[] = {
246 QCHAR, '\\', CHAR, 'b', CHAR, 'u', CHAR, 'i',
247 CHAR, 'l', CHAR, 't', CHAR, 'i', CHAR, 'n', EOS
249 static const char let_cmd[] = {
250 CHAR, 'l', CHAR, 'e', CHAR, 't', EOS
252 static const char setA_cmd0[] = {
253 CHAR, 's', CHAR, 'e', CHAR, 't', EOS
255 static const char setA_cmd1[] = {
256 CHAR, '-', CHAR, 'A', EOS
258 static const char setA_cmd2[] = {
259 CHAR, '-', CHAR, '-', EOS
263 get_command(int cf, int sALIAS)
266 int c, iopn = 0, syniocf, lno;
267 struct ioword *iop, **iops;
269 struct nesting_state old_nesting;
271 /* NUFILE is small enough to leave this addition unchecked */
272 iops = alloc2((NUFILE + 1), sizeof(struct ioword *), ATEMP);
276 syniocf = KEYWORD|sALIAS;
277 switch (c = token(cf|KEYWORD|sALIAS|CMDASN)) {
289 syniocf &= ~(KEYWORD|sALIAS);
291 t->lineno = source->line;
292 goto get_command_start;
293 while (/* CONSTCOND */ 1) {
294 bool check_decl_utility;
296 if (XPsize(args) == 0) {
298 check_decl_utility = true;
299 cf = sALIAS | CMDASN;
300 } else if (t->u.evalflags)
301 cf = CMDWORD | CMDASN;
306 while ((iop = synio(cf)) != NULL) {
316 if (check_decl_utility) {
317 struct tbl *tt = get_builtin(ident);
320 flag = tt ? tt->flag : 0;
321 if (flag & DECL_UTIL)
322 t->u.evalflags = DOVACHECK;
323 if (!(flag & DECL_FWDR))
324 check_decl_utility = false;
326 if ((XPsize(args) == 0 || Flag(FKEYWORD)) &&
327 is_wdvarassign(yylval.cp))
328 XPput(vars, yylval.cp);
330 XPput(args, yylval.cp);
334 if (XPsize(args) == 0 && XPsize(vars) == 1 &&
335 is_wdvarassign(yylval.cp)) {
338 /* wdarrassign: foo=(bar) */
341 /* manipulate the vars string */
342 tcp = XPptrv(vars)[(vars.len = 0)];
343 /* 'varname=' -> 'varname' */
344 tcp[wdscan(tcp, EOS) - tcp - 3] = EOS;
346 /* construct new args strings */
347 XPput(args, wdcopy(builtin_cmd, ATEMP));
348 XPput(args, wdcopy(setA_cmd0, ATEMP));
349 XPput(args, wdcopy(setA_cmd1, ATEMP));
351 XPput(args, wdcopy(setA_cmd2, ATEMP));
353 /* slurp in words till closing paren */
354 while (token(CONTIN) == LWORD)
355 XPput(args, yylval.cp);
356 if (symbol != /*(*/ ')')
360 * Check for "> foo (echo hi)"
361 * which AT&T ksh allows (not
362 * POSIX, but not disallowed)
365 if (XPsize(args) == 0 &&
371 /* must be a function */
372 if (iopn != 0 || XPsize(args) != 1 ||
376 musthave(/*(*/')', 0);
377 t = function_body(XPptrv(args)[0],
390 int subshell_nesting_type_saved;
392 subshell_nesting_type_saved = subshell_nesting_type;
393 subshell_nesting_type = ')';
394 t = nested(TPAREN, '(', ')', sALIAS);
395 subshell_nesting_type = subshell_nesting_type_saved;
400 t = nested(TBRACE, '{', '}', sALIAS);
404 /* leave KEYWORD in syniocf (allow if (( 1 )) then ...) */
407 switch (token(LETEXPR)) {
418 XPput(args, wdcopy(builtin_cmd, ATEMP));
419 XPput(args, wdcopy(let_cmd, ATEMP));
420 XPput(args, yylval.cp);
423 case DBRACKET: /* [[ .. ]] */
424 /* leave KEYWORD in syniocf (allow if [[ -n 1 ]] then ...) */
425 t = newtp(TDBRACKET);
430 te.flags = TEF_DBRACKET;
432 te.isa = dbtestp_isa;
433 te.getopnd = dbtestp_getopnd;
434 te.eval = dbtestp_eval;
435 te.error = dbtestp_error;
443 t = newtp((c == FOR) ? TFOR : TSELECT);
444 musthave(LWORD, CMDASN);
445 if (!is_wdvarname(yylval.cp, true))
446 yyerror("%s: bad identifier",
447 c == FOR ? "for" : Tselect);
448 strdupx(t->str, ident, ATEMP);
449 nesting_push(&old_nesting, c);
450 t->vars = wordlist(sALIAS);
451 t->left = dogroup(sALIAS);
452 nesting_pop(&old_nesting);
457 nesting_push(&old_nesting, c);
458 t = newtp((c == WHILE) ? TWHILE : TUNTIL);
459 t->left = c_list(sALIAS, true);
460 t->right = dogroup(sALIAS);
461 nesting_pop(&old_nesting);
468 nesting_push(&old_nesting, c);
469 t->left = caselist(sALIAS);
470 nesting_pop(&old_nesting);
474 nesting_push(&old_nesting, c);
476 t->left = c_list(sALIAS, true);
477 t->right = thenpart(sALIAS);
478 musthave(FI, KEYWORD|sALIAS);
479 nesting_pop(&old_nesting);
483 syniocf &= ~(KEYWORD|sALIAS);
484 t = pipeline(0, sALIAS);
487 t = block(TBANG, NULL, t);
491 syniocf &= ~(KEYWORD|sALIAS);
492 t = pipeline(0, sALIAS);
493 if (t && t->type == TCOM) {
494 t->str = alloc(2, ATEMP);
499 t = block(TTIME, t, NULL);
504 t = function_body(yylval.cp, sALIAS, true);
508 while ((iop = synio(syniocf)) != NULL) {
510 yyerror(Tf_toomany, Tredirection);
519 iops = aresize2(iops, iopn, sizeof(struct ioword *), ATEMP);
523 if (t->type == TCOM || t->type == TDBRACKET) {
525 t->args = (const char **)XPclose(args);
527 t->vars = (char **)XPclose(vars);
534 t = block(TBRACE, t, NULL);
535 t->ioact = t->left->ioact;
536 t->left->ioact = NULL;
548 c = token(CONTIN|KEYWORD|sALIAS);
550 * A {...} can be used instead of do...done for for/select loops
551 * but not for while/until loops - we don't need to check if it
552 * is a while loop because it would have been parsed as part of
553 * the conditional command list...
561 list = c_list(sALIAS, true);
562 musthave(c, KEYWORD|sALIAS);
571 musthave(THEN, KEYWORD|sALIAS);
573 t->left = c_list(sALIAS, true);
576 t->right = elsepart(sALIAS);
585 switch (token(KEYWORD|sALIAS|CMDASN)) {
587 if ((t = c_list(sALIAS, true)) == NULL)
593 t->left = c_list(sALIAS, true);
594 t->right = thenpart(sALIAS);
609 c = token(CONTIN|KEYWORD|sALIAS);
610 /* A {...} can be used instead of in...esac for case statements */
619 while ((tpeek(CONTIN|KEYWORD|ESACONLY)) != c) {
620 struct op *tc = casepart(c, sALIAS);
622 t = tl = tc, tl->right = NULL;
624 tl->right = tc, tl = tc;
626 musthave(c, KEYWORD|sALIAS);
631 casepart(int endtok, int sALIAS)
639 if (token(CONTIN | KEYWORD) != '(')
647 if (symbol != endtok) {
649 symbol == '}' ? Tcbrace : Tesac, ATEMP);
656 XPput(ptns, yylval.cp);
657 } while (token(0) == '|');
660 t->vars = (char **)XPclose(ptns);
663 t->left = c_list(sALIAS, true);
665 /* initialise to default for ;; or omitted */
667 /* SUSv4 requires the ;; except in the last casepart */
668 if ((tpeek(CONTIN|KEYWORD|sALIAS)) != endtok)
680 /* initialised above, but we need to eat the token */
687 function_body(char *name, int sALIAS,
688 /* function foo { ... } vs foo() { .. } */
694 sname = wdstrip(name, 0);
696 * Check for valid characters in name. POSIX and AT&T ksh93 say
697 * only allow [a-zA-Z_0-9] but this allows more as old pdkshs
698 * have allowed more; the following were never allowed:
699 * NUL TAB NL SP " $ & ' ( ) ; < = > \ ` |
700 * C_QUOTE covers all but adds # * ? [ ]
702 for (p = sname; *p; p++)
703 if (ctype(*p, C_QUOTE))
704 yyerror(Tinvname, sname, Tfunction);
707 * Note that POSIX allows only compound statements after foo(),
708 * sh and AT&T ksh allow any command, go with the later since it
709 * shouldn't break anything. However, for function foo, AT&T ksh
710 * only accepts an open-brace.
713 if (tpeek(CONTIN|KEYWORD|sALIAS) == '(' /*)*/) {
714 /* function foo () { //}*/
717 /* degrade to POSIX function */
720 musthave('{' /*}*/, CONTIN|KEYWORD|sALIAS);
726 t->u.ksh_func = tobool(ksh_func);
727 t->lineno = source->line;
729 if ((t->left = get_command(CONTIN, sALIAS)) == NULL) {
732 * Probably something like foo() followed by EOF or ';'.
733 * This is accepted by sh and ksh88.
734 * To make "typeset -f foo" work reliably (so its output can
735 * be used as input), we pretend there is a colon here.
737 t->left = newtp(TCOM);
738 /* (2 * sizeof(char *)) is small enough */
739 t->left->args = alloc(2 * sizeof(char *), ATEMP);
740 t->left->args[0] = tv = alloc(3, ATEMP);
744 t->left->args[1] = NULL;
745 t->left->vars = alloc(sizeof(char *), ATEMP);
746 t->left->vars[0] = NULL;
760 /* POSIX does not do alias expansion here... */
761 if ((c = token(CONTIN|KEYWORD|sALIAS)) != IN) {
763 /* non-POSIX, but AT&T ksh accepts a ; here */
767 while ((c = token(0)) == LWORD)
768 XPput(args, yylval.cp);
769 if (c != '\n' && c != ';')
772 return ((char **)XPclose(args));
776 * supporting functions
780 block(int type, struct op *t1, struct op *t2)
790 static const struct tokeninfo {
797 { "then", THEN, true },
798 { "else", ELSE, true },
799 { "elif", ELIF, true },
801 { "case", CASE, true },
802 { Tesac, ESAC, true },
803 { "for", FOR, true },
804 { Tselect, SELECT, true },
805 { "while", WHILE, true },
806 { "until", UNTIL, true },
808 { "done", DONE, true },
810 { Tfunction, FUNCTION, true },
811 { Ttime, TIME, true },
813 { Tcbrace, '}', true },
815 { "[[", DBRACKET, true },
816 /* Lexical tokens (0[EOF], LWORD and REDIR handled specially) */
817 { "&&", LOGAND, false },
818 { "||", LOGOR, false },
819 { ";;", BREAK, false },
820 { ";|", BRKEV, false },
821 { ";&", BRKFT, false },
822 { "((", MDPAREN, false },
823 { "|&", COPROC, false },
824 /* and some special cases... */
825 { "newline", '\n', false },
832 struct tokeninfo const *tt;
835 ktinit(APERM, &keywords,
836 /* currently 28 keywords: 75% of 64 = 2^6 */
838 for (tt = tokentab; tt->name; tt++) {
840 p = ktenter(&keywords, tt->name, hash(tt->name));
841 p->flag |= DEFINED|ISSET;
849 syntaxerr(const char *what)
851 /* 23<<- is the longest redirection, I think */
854 struct tokeninfo const *tt;
864 if (nesting.start_token) {
865 c = nesting.start_token;
866 source->errline = nesting.start_line;
870 /* don't quote the EOF */
871 yyerror("%s: unexpected EOF", Tsynerr);
875 s = snptreef(NULL, 32, Tf_S, yylval.cp);
879 s = snptreef(redir, sizeof(redir), Tft_R, yylval.iop);
883 for (tt = tokentab; tt->name; tt++)
889 if (c > 0 && c < 256) {
893 shf_snprintf(redir, sizeof(redir),
898 yyerror(Tf_sD_s_qs, Tsynerr, what, s);
902 nesting_push(struct nesting_state *save, int tok)
905 nesting.start_token = tok;
906 nesting.start_line = source->line;
910 nesting_pop(struct nesting_state *saved)
920 t = alloc(sizeof(struct op), ATEMP);
926 t->left = t->right = NULL;
932 compile(Source *s, bool skiputf8bom, bool doalias)
934 nesting.start_token = 0;
935 nesting.start_line = 0;
944 /* Check if we are in the middle of reading an alias */
946 inalias(struct source *s)
948 while (s && s->type == SALIAS) {
949 if (!(s->flags & SF_ALIASEND))
958 * Order important - indexed by Test_meta values
959 * Note that ||, &&, ( and ) can't appear in as unquoted strings
960 * in normal shell input, so these can be interpreted unambiguously
961 * in the evaluation pass.
963 static const char dbtest_or[] = { CHAR, '|', CHAR, '|', EOS };
964 static const char dbtest_and[] = { CHAR, '&', CHAR, '&', EOS };
965 static const char dbtest_not[] = { CHAR, '!', EOS };
966 static const char dbtest_oparen[] = { CHAR, '(', EOS };
967 static const char dbtest_cparen[] = { CHAR, ')', EOS };
968 const char * const dbtest_tokens[] = {
969 dbtest_or, dbtest_and, dbtest_not,
970 dbtest_oparen, dbtest_cparen
972 static const char db_close[] = { CHAR, ']', CHAR, ']', EOS };
973 static const char db_lthan[] = { CHAR, '<', EOS };
974 static const char db_gthan[] = { CHAR, '>', EOS };
977 * Test if the current token is a whatever. Accepts the current token if
978 * it is. Returns 0 if it is not, non-zero if it is (in the case of
979 * TM_UNOP and TM_BINOP, the returned value is a Test_op).
982 dbtestp_isa(Test_env *te, Test_meta meta)
984 int c = tpeek(CMDASN | (meta == TM_BINOP ? 0 : CONTIN));
987 Test_op ret = TO_NONOP;
990 uqword = c == LWORD && *ident;
993 ret = c == LOGOR ? TO_NONNULL : TO_NONOP;
994 else if (meta == TM_AND)
995 ret = c == LOGAND ? TO_NONNULL : TO_NONOP;
996 else if (meta == TM_NOT)
997 ret = (uqword && !strcmp(yylval.cp,
998 dbtest_tokens[(int)TM_NOT])) ? TO_NONNULL : TO_NONOP;
999 else if (meta == TM_OPAREN)
1000 ret = c == '(' /*)*/ ? TO_NONNULL : TO_NONOP;
1001 else if (meta == TM_CPAREN)
1002 ret = c == /*(*/ ')' ? TO_NONNULL : TO_NONOP;
1003 else if (meta == TM_UNOP || meta == TM_BINOP) {
1004 if (meta == TM_BINOP && c == REDIR &&
1005 (yylval.iop->ioflag == IOREAD ||
1006 yylval.iop->ioflag == IOWRITE)) {
1008 save = wdcopy(yylval.iop->ioflag == IOREAD ?
1009 db_lthan : db_gthan, ATEMP);
1010 } else if (uqword && (ret = test_isop(meta, ident)))
1013 /* meta == TM_END */
1014 ret = (uqword && !strcmp(yylval.cp,
1015 db_close)) ? TO_NONNULL : TO_NONOP;
1016 if (ret != TO_NONOP) {
1018 if ((unsigned int)meta < NELEM(dbtest_tokens))
1019 save = wdcopy(dbtest_tokens[(int)meta], ATEMP);
1021 XPput(*te->pos.av, save);
1027 dbtestp_getopnd(Test_env *te, Test_op op MKSH_A_UNUSED,
1028 bool do_eval MKSH_A_UNUSED)
1030 int c = tpeek(CMDASN);
1036 XPput(*te->pos.av, yylval.cp);
1042 dbtestp_eval(Test_env *te MKSH_A_UNUSED, Test_op op MKSH_A_UNUSED,
1043 const char *opnd1 MKSH_A_UNUSED, const char *opnd2 MKSH_A_UNUSED,
1044 bool do_eval MKSH_A_UNUSED)
1050 dbtestp_error(Test_env *te, int offset, const char *msg)
1052 te->flags |= TEF_ERROR;
1056 /* Kludgy to say the least... */
1058 yylval.cp = *(XPptrv(*te->pos.av) + XPsize(*te->pos.av) +
1068 #define EOVERFLOW ERANGE
1070 #define EOVERFLOW EINVAL
1075 parse_usec(const char *s, struct timeval *tv)
1081 /* parse integral part */
1082 while (ksh_isdigit(*s)) {
1083 tt.tv_sec = tv->tv_sec * 10 + ksh_numdig(*s++);
1084 /*XXX this overflow check maybe UB */
1085 if (tt.tv_sec / 10 != tv->tv_sec) {
1089 tv->tv_sec = tt.tv_sec;
1094 /* no decimal fraction */
1096 else if (*s++ != '.') {
1097 /* junk after integral part */
1102 /* parse decimal fraction */
1104 while (ksh_isdigit(*s)) {
1105 tv->tv_usec += i * ksh_numdig(*s++);
1110 /* check for junk after fractional part */
1111 while (ksh_isdigit(*s))
1118 /* end of input string reached, no errors */
1124 * Helper function called from within lex.c:yylex() to parse
1125 * a COMSUB recursively using the main shell parser and lexer
1128 yyrecursive(int subtype)
1132 struct yyrecursive_state *ys;
1135 if (subtype != COMSUB) {
1143 ys = alloc(sizeof(struct yyrecursive_state), ATEMP);
1145 /* tell the lexer to accept a closing parenthesis as EOD */
1146 ys->old_nesting_type = subshell_nesting_type;
1147 subshell_nesting_type = etok;
1149 /* push reject state, parse recursively, pop reject state */
1150 ys->old_reject = reject;
1151 ys->old_symbol = symbol;
1153 memcpy(ys->old_heres, heres, sizeof(heres));
1154 ys->old_herep = herep;
1156 ys->next = e->yyrecursive_statep;
1157 e->yyrecursive_statep = ys;
1158 /* we use TPAREN as a helper container here */
1159 t = nested(TPAREN, stok, etok, ALIAS);
1160 yyrecursive_pop(false);
1162 /* t->left because nested(TPAREN, ...) hides our goodies there */
1163 cp = snptreef(NULL, 0, Tf_T, t->left);
1170 yyrecursive_pop(bool popall)
1172 struct yyrecursive_state *ys;
1175 if (!(ys = e->yyrecursive_statep))
1177 e->yyrecursive_statep = ys->next;
1179 memcpy(heres, ys->old_heres, sizeof(heres));
1180 herep = ys->old_herep;
1181 reject = ys->old_reject;
1182 symbol = ys->old_symbol;
1184 subshell_nesting_type = ys->old_nesting_type;