Debian Codegraph @

debian/external_deps/fetk/maloc/src/vsh/vyacc.c

raw
1 /* A Bison parser, made from ../../../src/vsh/vyacc.y, by GNU bison 1.75. */
2
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
25
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
28
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
35
36 /* Identify Bison output. */
37 #define YYBISON 1
38
39 /* Pure parsers. */
40 #define YYPURE 0
41
42 /* Using locations. */
43 #define YYLSP_NEEDED 0
44
45
46
47 /* Tokens. */
48 #ifndef YYTOKENTYPE
49 # define YYTOKENTYPE
50 /* Put the tokens into the symbol table, so that GDB and other debuggers
51 know about them. */
52 enum yytokentype {
53 IF = 258,
54 THEN = 259,
55 ELSE = 260,
56 ELIF = 261,
57 FI = 262,
58 CASE = 263,
59 IN = 264,
60 ESAC = 265,
61 FOR = 266,
62 WHILE = 267,
63 UNTIL = 268,
64 DO = 269,
65 DONE = 270,
66 SEMI_SEMI = 271,
67 AND_AND = 272,
68 OR_OR = 273,
69 LESS_LESS = 274,
70 GREATER_GREATER = 275,
71 LESS_AND = 276,
72 GREATER_AND = 277,
73 AND_GREATER = 278,
74 LESS_GREATER = 279,
75 GREATER_BAR = 280,
76 LESS_LESS_MINUS = 281,
77 WORD = 282,
78 ASSIGNMENT_WORD = 283,
79 SELECT = 284,
80 FUNCTION = 285,
81 BANG = 286,
82 vsh_EOF = 287
83 };
84 #endif
85 #define IF 258
86 #define THEN 259
87 #define ELSE 260
88 #define ELIF 261
89 #define FI 262
90 #define CASE 263
91 #define IN 264
92 #define ESAC 265
93 #define FOR 266
94 #define WHILE 267
95 #define UNTIL 268
96 #define DO 269
97 #define DONE 270
98 #define SEMI_SEMI 271
99 #define AND_AND 272
100 #define OR_OR 273
101 #define LESS_LESS 274
102 #define GREATER_GREATER 275
103 #define LESS_AND 276
104 #define GREATER_AND 277
105 #define AND_GREATER 278
106 #define LESS_GREATER 279
107 #define GREATER_BAR 280
108 #define LESS_LESS_MINUS 281
109 #define WORD 282
110 #define ASSIGNMENT_WORD 283
111 #define SELECT 284
112 #define FUNCTION 285
113 #define BANG 286
114 #define vsh_EOF 287
115
116
117
118
119 /* Copy the first part of user declarations. */
120
121
122 #include "vsh_p.h"
123
124 VEMBED(rcsid="$Id: vyacc.c,v 1.10 2003/07/05 20:44:12 mholst Exp $")
125
126 VPUBLIC void yyerror(const char *errmsg)
127 {
128 fprintf(stderr, "Vsh: %s at '%s'\n", errmsg, yytext);
129 if (!Vsh_isInteractive(Vsh_thee)) {
130 exit(1);
131 }
132 }
133
134 VPUBLIC void report_error(const char *format, ...)
135 {
136 fprintf(stderr,"report_error: ERROR:\n");
137 }
138
139 VPUBLIC void programming_error(const char *format, ...)
140 {
141 fprintf(stderr,"programming_error: ERROR:\n");
142 }
143
144 VPUBLIC int yywrap(void)
145 {
146 if (Vsh_thee->cinUnit == stdin) {
147 Vnm_print(1,"%s",Vsh_thee->PR_EXIT);
148 Vnm_print(1,"%s",VNEWLINE_STRING);
149 }
150 cmdKey = 2;
151 return 1;
152 }
153
154 /*
155 * Reverse the chain of structures in LIST. Output the new head
156 * of the chain. You should always assign the output value of this
157 * function to something, or you will lose the chain.
158 */
159 GENERIC_LIST *reverse_list (GENERIC_LIST *list)
160 {
161 register GENERIC_LIST *next, *prev = (GENERIC_LIST *)NULL;
162
163 while (list) {
164 next = list->next;
165 list->next = prev;
166 prev = list;
167 list = next;
168 }
169 return (prev);
170 }
171
172 WORD_LIST* make_word_list(WORD_DESC *word, WORD_LIST *link)
173 {
174 WORD_LIST *temp;
175
176 temp = (WORD_LIST *)malloc (sizeof (WORD_LIST));
177 temp->word = word;
178 temp->next = link;
179 return temp;
180 }
181
182 COMMAND *make_bare_simple_command(void)
183 {
184 COMMAND *command;
185 SIMPLE_COM *temp = (SIMPLE_COM *)malloc (sizeof (SIMPLE_COM));
186
187 temp->flags = 0;
188 /* temp->line = line_number; */
189 temp->line = 0;
190 temp->words = (WORD_LIST *)NULL;
191 temp->redirects = (REDIRECT *)NULL;
192 command = (COMMAND *)malloc (sizeof (COMMAND));
193 command->type = cm_simple;
194 command->redirects = (REDIRECT *)NULL;
195 command->flags = 0;
196 command->value.Simple = temp;
197 return command;
198 }
199
200 /*
201 * Generate a REDIRECT from SOURCE, DEST, and INSTRUCTION.
202 * INSTRUCTION is the instruction type, SOURCE is a file descriptor,
203 * and DEST is a file descriptor or a WORD_DESC*.
204 */
205 REDIRECT *make_redirection (int source,
206 enum r_instruction instruction, REDIRECTEE dest_and_filename)
207 {
208 REDIRECT *temp = (REDIRECT *)malloc (sizeof (REDIRECT));
209
210 /* First do the common cases. */
211 temp->redirector = source;
212 temp->redirectee = dest_and_filename;
213 temp->instruction = instruction;
214 temp->flags = 0;
215 temp->next = (REDIRECT *)NULL;
216
217 switch (instruction) {
218
219 case r_output_direction: /* >foo */
220 case r_output_force: /* >| foo */
221 temp->flags = O_TRUNC | O_WRONLY | O_CREAT;
222 break;
223
224 case r_input_direction: /* <foo */
225 case r_inputa_direction: /* foo & makes this. */
226 temp->flags = O_RDONLY;
227 break;
228
229 case r_appending_to: /* >>foo */
230 temp->flags = O_APPEND | O_WRONLY | O_CREAT;
231 break;
232
233 case r_deblank_reading_until: /* <<-foo */
234 case r_reading_until: /* << foo */
235 break;
236
237 case r_duplicating_input: /* 1<&2 */
238 case r_duplicating_output: /* 1>&2 */
239 case r_close_this: /* <&- */
240 case r_duplicating_input_word: /* 1<&$foo */
241 case r_duplicating_output_word: /* 1>&$foo */
242 break;
243
244 case r_err_and_out: /* command &>filename */
245 temp->flags = O_TRUNC | O_WRONLY | O_CREAT;
246 break;
247
248 case r_input_output:
249 temp->flags = O_RDWR | O_CREAT;
250 break;
251
252 default:
253 fprintf(stderr,"We seem to have a problem...\n");
254 abort ();
255 break;
256 }
257 return (temp);
258 }
259
260 /*
261 * Return a command which is the connection of the word or redirection
262 * in ELEMENT, and the command * or NULL in COMMAND.
263 */
264 COMMAND *make_simple_command (ELEMENT element, COMMAND *command) {
265 /* If we are starting from scratch, then make the initial command
266 structure. Also note that we have to fill in all the slots, since
267 malloc doesn't return zeroed space. */
268 if (!command) command = make_bare_simple_command ();
269
270 if (element.word) {
271 WORD_LIST *tw = (WORD_LIST *)malloc (sizeof (WORD_LIST));
272 tw->word = element.word;
273 tw->next = command->value.Simple->words;
274 command->value.Simple->words = tw;
275 } else {
276 REDIRECT *r = element.redirect;
277 /* Due to the way <> is implemented, there may be more than a single
278 redirection in element.redirect. We just follow the chain as far
279 as it goes, and hook onto the end. */
280 while (r->next) r = r->next;
281 r->next = command->value.Simple->redirects;
282 command->value.Simple->redirects = element.redirect;
283 }
284 return (command);
285 }
286
287 COMMAND* make_command (enum command_type type, SIMPLE_COM *pointer)
288 {
289 COMMAND *temp;
290
291 temp = (COMMAND *)malloc (sizeof (COMMAND));
292 temp->type = type;
293 temp->value.Simple = pointer;
294 temp->value.Simple->flags = 0;
295 temp->flags = 0;
296 temp->redirects = (REDIRECT *)NULL;
297 return temp;
298 }
299
300 void dispose_command (COMMAND *command);
301 void dispose_word (WORD_DESC *word);
302 void dispose_words (WORD_LIST *list);
303 void dispose_word_array (char **array);
304 void dispose_redirects (REDIRECT *list);
305
306 /* Dispose of the command structure passed. */
307 void dispose_command (COMMAND *command)
308 {
309 if (!command) return;
310
311 if (command->redirects)
312 dispose_redirects (command->redirects);
313
314 switch (command->type)
315 {
316 case cm_for:
317 {
318 register FOR_COM *c = command->value.For;
319 dispose_word (c->name);
320 dispose_words (c->map_list);
321 dispose_command (c->action);
322 free (c);
323 break;
324 }
325
326 case cm_group:
327 {
328 dispose_command (command->value.Group->command);
329 free (command->value.Group);
330 break;
331 }
332
333 case cm_case:
334 {
335 register CASE_COM *c = command->value.Case;
336 PATTERN_LIST *t, *p = c->clauses;
337
338 dispose_word (c->word);
339
340 while (p)
341 {
342 dispose_words (p->patterns);
343 dispose_command (p->action);
344 t = p;
345 p = p->next;
346 free (t);
347 }
348 free (c);
349 break;
350 }
351
352 case cm_until:
353 case cm_while:
354 {
355 register WHILE_COM *c = command->value.While;
356
357 dispose_command (c->test);
358 dispose_command (c->action);
359 free (c);
360 break;
361 }
362
363 case cm_if:
364 {
365 register IF_COM *c = command->value.If;
366 dispose_command (c->test);
367 dispose_command (c->true_case);
368 dispose_command (c->false_case);
369 free (c);
370 break;
371 }
372
373 case cm_simple:
374 {
375 register SIMPLE_COM *c = command->value.Simple;
376 dispose_words (c->words);
377 dispose_redirects (c->redirects);
378 free (c);
379 break;
380 }
381
382 case cm_connection:
383 {
384 register CONNECTION *c = command->value.Connection;
385 dispose_command (c->first);
386 dispose_command (c->second);
387 free (c);
388 break;
389 }
390
391 case cm_function_def:
392 {
393 register FUNCTION_DEF *c = command->value.Function_def;
394 dispose_word (c->name);
395 dispose_command (c->command);
396 free (c);
397 break;
398 }
399
400 default:
401 report_error ("Attempt free unknown command type `%d'.\n", command->type);
402 break;
403 }
404 free (command);
405 }
406
407 /* How to free a WORD_DESC. */
408 void dispose_word (WORD_DESC *word)
409 {
410 if (word->word)
411 free (word->word);
412 free (word);
413 }
414
415 /* How to get rid of a linked list of words. A WORD_LIST. */
416 void dispose_words (WORD_LIST *list)
417 {
418 WORD_LIST *t;
419 while (list)
420 {
421 t = list;
422 list = list->next;
423 dispose_word (t->word);
424 free (t);
425 }
426 }
427
428 /* How to dispose of an array of pointers to char. */
429 void dispose_word_array (char **array)
430 {
431 register int count;
432
433 for (count = 0; array[count]; count++)
434 free (array[count]);
435
436 free (array);
437 }
438
439 /* How to dispose of an list of redirections. A REDIRECT. */
440 void dispose_redirects (REDIRECT *list)
441 {
442 register REDIRECT *t;
443
444 while (list)
445 {
446 t = list;
447 list = list->next;
448 switch (t->instruction)
449 {
450 case r_reading_until:
451 case r_deblank_reading_until:
452 free (t->here_doc_eof);
453 /* ... */
454 case r_output_direction:
455 case r_input_direction:
456 case r_inputa_direction:
457 case r_appending_to:
458 case r_err_and_out:
459 case r_input_output:
460 case r_output_force:
461 case r_duplicating_input:
462 case r_duplicating_output:
463 case r_close_this:
464 case r_duplicating_input_word:
465 case r_duplicating_output_word:
466 dispose_word (t->redirectee.filename);
467 break;
468 }
469 free (t);
470 }
471 }
472
473 /* Reverse the word list and redirection list in the simple command
474 has just been parsed. It seems simpler to do this here the one
475 time then by any other method that I can think of. */
476 COMMAND *clean_simple_command (COMMAND *command)
477 {
478 if (command->type != cm_simple)
479 {
480 programming_error
481 ("clean_simple_command () got a command with type %d.", command->type);
482 }
483 else
484 {
485 command->value.Simple->words =
486 REVERSE_LIST (command->value.Simple->words, WORD_LIST *);
487 command->value.Simple->redirects =
488 REVERSE_LIST (command->value.Simple->redirects, REDIRECT *);
489 }
490
491 return (command);
492 }
493
494 static REDIRECTEE redir;
495
496 static WORD_LIST *wordTmp;
497 static WORD_DESC *wTmp;
498 static char buf[VMAX_BUFSIZE];
499
500
501
502 /* Enabling traces. */
503 #ifndef YYDEBUG
504 # define YYDEBUG 0
505 #endif
506
507 /* Enabling verbose error messages. */
508 #ifdef YYERROR_VERBOSE
509 # undef YYERROR_VERBOSE
510 # define YYERROR_VERBOSE 1
511 #else
512 # define YYERROR_VERBOSE 0
513 #endif
514
515 #ifndef YYSTYPE
516 #line 413 "../../../src/vsh/vyacc.y"
517 typedef union {
518 WORD_DESC *word; /* the word that we read. */
519 /* int number; */ /* number we saw */
520 WORD_LIST *word_list; /* a sequence of white-space separated words */
521 COMMAND *command; /* a complete command */
522 REDIRECT *redirect; /* redirect i/o info */
523 ELEMENT element; /* base element */
524 PATTERN_LIST *pattern; /* a case pattern */
525 } yystype;
526 /* Line 193 of /usr/share/bison/yacc.c. */
527 #line 525 "y.tab.c"
528 # define YYSTYPE yystype
529 # define YYSTYPE_IS_TRIVIAL 1
530 #endif
531
532 #ifndef YYLTYPE
533 typedef struct yyltype
534 {
535 int first_line;
536 int first_column;
537 int last_line;
538 int last_column;
539 } yyltype;
540 # define YYLTYPE yyltype
541 # define YYLTYPE_IS_TRIVIAL 1
542 #endif
543
544 /* Copy the second part of user declarations. */
545
546
547 /* Line 213 of /usr/share/bison/yacc.c. */
548 #line 546 "y.tab.c"
549
550 #if ! defined (yyoverflow) || YYERROR_VERBOSE
551
552 /* The parser invokes alloca or malloc; define the necessary symbols. */
553
554 # if YYSTACK_USE_ALLOCA
555 # define YYSTACK_ALLOC alloca
556 # else
557 # ifndef YYSTACK_USE_ALLOCA
558 # if defined (alloca) || defined (_ALLOCA_H)
559 # define YYSTACK_ALLOC alloca
560 # else
561 # ifdef __GNUC__
562 # define YYSTACK_ALLOC __builtin_alloca
563 # endif
564 # endif
565 # endif
566 # endif
567
568 # ifdef YYSTACK_ALLOC
569 /* Pacify GCC's `empty if-body' warning. */
570 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
571 # else
572 # if defined (__STDC__) || defined (__cplusplus)
573 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
574 # define YYSIZE_T size_t
575 # endif
576 # define YYSTACK_ALLOC malloc
577 # define YYSTACK_FREE free
578 # endif
579 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
580
581
582 #if (! defined (yyoverflow) \
583 && (! defined (__cplusplus) \
584 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
585
586 /* A type that is properly aligned for any stack member. */
587 union yyalloc
588 {
589 short yyss;
590 YYSTYPE yyvs;
591 };
592
593 /* The size of the maximum gap between one aligned stack and the next. */
594 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
595
596 /* The size of an array large to enough to hold all stacks, each with
597 N elements. */
598 # define YYSTACK_BYTES(N) \
599 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
600 + YYSTACK_GAP_MAX)
601
602 /* Copy COUNT objects from FROM to TO. The source and destination do
603 not overlap. */
604 # ifndef YYCOPY
605 # if 1 < __GNUC__
606 # define YYCOPY(To, From, Count) \
607 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
608 # else
609 # define YYCOPY(To, From, Count) \
610 do \
611 { \
612 register YYSIZE_T yyi; \
613 for (yyi = 0; yyi < (Count); yyi++) \
614 (To)[yyi] = (From)[yyi]; \
615 } \
616 while (0)
617 # endif
618 # endif
619
620 /* Relocate STACK from its old location to the new one. The
621 local variables YYSIZE and YYSTACKSIZE give the old and new number of
622 elements in the stack, and YYPTR gives the new location of the
623 stack. Advance YYPTR to a properly aligned location for the next
624 stack. */
625 # define YYSTACK_RELOCATE(Stack) \
626 do \
627 { \
628 YYSIZE_T yynewbytes; \
629 YYCOPY (&yyptr->Stack, Stack, yysize); \
630 Stack = &yyptr->Stack; \
631 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
632 yyptr += yynewbytes / sizeof (*yyptr); \
633 } \
634 while (0)
635
636 #endif
637
638 #if defined (__STDC__) || defined (__cplusplus)
639 typedef signed char yysigned_char;
640 #else
641 typedef short yysigned_char;
642 #endif
643
644 /* YYFINAL -- State number of the termination state. */
645 #define YYFINAL 47
646 #define YYLAST 423
647
648 /* YYNTOKENS -- Number of terminals. */
649 #define YYNTOKENS 43
650 /* YYNNTS -- Number of nonterminals. */
651 #define YYNNTS 32
652 /* YYNRULES -- Number of rules. */
653 #define YYNRULES 91
654 /* YYNRULES -- Number of states. */
655 #define YYNSTATES 181
656
657 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
658 #define YYUNDEFTOK 2
659 #define YYMAXUTOK 287
660
661 #define YYTRANSLATE(X) \
662 ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)
663
664 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
665 static const unsigned char yytranslate[] =
666 {
667 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
668 34, 2, 2, 2, 2, 2, 2, 2, 2, 2,
669 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
670 2, 2, 2, 37, 2, 2, 2, 2, 32, 2,
671 39, 40, 2, 2, 2, 2, 2, 2, 2, 2,
672 2, 2, 2, 2, 2, 2, 2, 2, 2, 33,
673 2, 2, 38, 2, 2, 2, 2, 2, 2, 2,
674 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
675 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
676 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
677 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
678 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
679 2, 2, 2, 41, 36, 42, 2, 2, 2, 2,
680 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
681 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
682 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
683 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
684 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
685 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
686 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
687 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
688 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
689 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
690 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
691 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
692 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
693 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
694 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
695 25, 26, 27, 28, 29, 30, 31, 35
696 };
697
698 #if YYDEBUG
699 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
700 YYRHS. */
701 static const unsigned short yyprhs[] =
702 {
703 0, 0, 3, 6, 8, 10, 13, 15, 18, 21,
704 26, 31, 35, 39, 41, 44, 49, 51, 54, 56,
705 60, 64, 68, 73, 78, 83, 88, 93, 95, 98,
706 101, 104, 106, 109, 111, 113, 115, 118, 120, 123,
707 125, 127, 129, 131, 133, 135, 137, 139, 141, 143,
708 145, 149, 153, 159, 166, 172, 180, 187, 192, 199,
709 205, 212, 220, 227, 229, 232, 237, 242, 248, 254,
710 256, 259, 265, 271, 278, 285, 287, 291, 298, 305,
711 313, 321, 332, 343, 349, 355, 356, 359, 361, 363,
712 365, 366
713 };
714
715 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
716 static const yysigned_char yyrhs[] =
717 {
718 44, 0, -1, 45, 34, -1, 34, -1, 35, -1,
719 1, 74, -1, 46, -1, 46, 32, -1, 46, 33,
720 -1, 46, 17, 74, 46, -1, 46, 18, 74, 46,
721 -1, 46, 32, 46, -1, 46, 33, 46, -1, 47,
722 -1, 37, 47, -1, 47, 36, 74, 47, -1, 53,
723 -1, 74, 49, -1, 50, -1, 50, 34, 74, -1,
724 50, 32, 74, -1, 50, 33, 74, -1, 50, 17,
725 74, 50, -1, 50, 18, 74, 50, -1, 50, 32,
726 74, 50, -1, 50, 33, 74, 50, -1, 50, 34,
727 74, 50, -1, 47, -1, 37, 47, -1, 38, 27,
728 -1, 20, 27, -1, 51, -1, 52, 51, -1, 54,
729 -1, 55, -1, 57, -1, 54, 57, -1, 56, -1,
730 56, 52, -1, 69, -1, 63, -1, 70, -1, 71,
731 -1, 61, -1, 58, -1, 59, -1, 60, -1, 27,
732 -1, 28, -1, 51, -1, 39, 48, 40, -1, 41,
733 48, 42, -1, 27, 39, 40, 74, 59, -1, 27,
734 39, 40, 74, 59, 52, -1, 3, 48, 4, 48,
735 7, -1, 3, 48, 4, 48, 5, 48, 7, -1,
736 3, 48, 4, 48, 62, 7, -1, 6, 48, 4,
737 48, -1, 6, 48, 4, 48, 5, 48, -1, 6,
738 48, 4, 48, 62, -1, 8, 27, 74, 9, 74,
739 10, -1, 8, 27, 74, 9, 66, 74, 10, -1,
740 8, 27, 74, 9, 64, 10, -1, 65, -1, 66,
741 65, -1, 74, 68, 40, 48, -1, 74, 68, 40,
742 74, -1, 74, 39, 68, 40, 48, -1, 74, 39,
743 68, 40, 74, -1, 67, -1, 66, 67, -1, 74,
744 68, 40, 48, 16, -1, 74, 68, 40, 74, 16,
745 -1, 74, 39, 68, 40, 48, 16, -1, 74, 39,
746 68, 40, 74, 16, -1, 27, -1, 68, 36, 27,
747 -1, 11, 27, 74, 14, 48, 15, -1, 11, 27,
748 74, 41, 48, 42, -1, 11, 27, 33, 74, 14,
749 48, 15, -1, 11, 27, 33, 74, 41, 48, 42,
750 -1, 11, 27, 74, 9, 72, 73, 74, 14, 48,
751 15, -1, 11, 27, 74, 9, 72, 73, 74, 41,
752 48, 42, -1, 12, 48, 14, 48, 15, -1, 13,
753 48, 14, 48, 15, -1, -1, 72, 27, -1, 34,
754 -1, 33, -1, 35, -1, -1, 74, 34, -1
755 };
756
757 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
758 static const unsigned short yyrline[] =
759 {
760 0, 471, 471, 496, 501, 507, 526, 530, 534, 540,
761 544, 548, 552, 556, 560, 566, 570, 582, 588, 592,
762 596, 600, 606, 610, 614, 618, 622, 626, 630, 642,
763 647, 687, 691, 703, 707, 713, 717, 723, 727, 733,
764 737, 741, 745, 749, 753, 757, 761, 767, 772, 777,
765 790, 796, 802, 806, 818, 822, 826, 832, 836, 840,
766 852, 856, 860, 866, 870, 876, 880, 884, 888, 894,
767 898, 904, 908, 912, 916, 922, 926, 938, 942, 946,
768 950, 954, 958, 970, 982, 994, 998, 1004, 1007, 1010,
769 1015, 1018
770 };
771 #endif
772
773 #if YYDEBUG || YYERROR_VERBOSE
774 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
775 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
776 static const char *const yytname[] =
777 {
778 "$end", "error", "$undefined", "IF", "THEN", "ELSE", "ELIF", "FI", "CASE",
779 "IN", "ESAC", "FOR", "WHILE", "UNTIL", "DO", "DONE", "SEMI_SEMI",
780 "AND_AND", "OR_OR", "LESS_LESS", "GREATER_GREATER", "LESS_AND",
781 "GREATER_AND", "AND_GREATER", "LESS_GREATER", "GREATER_BAR",
782 "LESS_LESS_MINUS", "WORD", "ASSIGNMENT_WORD", "SELECT", "FUNCTION",
783 "BANG", "'&'", "';'", "'\\n'", "vsh_EOF", "'|'", "'!'", "'>'", "'('",
784 "')'", "'{'", "'}'", "$accept", "inputunit", "simple_list",
785 "simple_list1", "pipeline", "list", "list0", "list1", "redirection",
786 "redirections", "command", "simple_command", "shell_command",
787 "shell_command_1", "simple_command_element", "subshell",
788 "group_command", "function_def", "if_command", "elif_clause",
789 "case_command", "case_clause_1", "pattern_list_1",
790 "case_clause_sequence", "pattern_list", "pattern", "for_command",
791 "while_command", "until_command", "words", "term", "newlines", 0
792 };
793 #endif
794
795 # ifdef YYPRINT
796 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
797 token YYLEX-NUM. */
798 static const unsigned short yytoknum[] =
799 {
800 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
801 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
802 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
803 285, 286, 38, 59, 10, 287, 124, 33, 62, 40,
804 41, 123, 125
805 };
806 # endif
807
808 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
809 static const unsigned char yyr1[] =
810 {
811 0, 43, 44, 44, 44, 44, 45, 45, 45, 46,
812 46, 46, 46, 46, 46, 47, 47, 48, 49, 49,
813 49, 49, 50, 50, 50, 50, 50, 50, 50, 51,
814 51, 52, 52, 53, 53, 54, 54, 55, 55, 56,
815 56, 56, 56, 56, 56, 56, 56, 57, 57, 57,
816 58, 59, 60, 60, 61, 61, 61, 62, 62, 62,
817 63, 63, 63, 64, 64, 65, 65, 65, 65, 66,
818 66, 67, 67, 67, 67, 68, 68, 69, 69, 69,
819 69, 69, 69, 70, 71, 72, 72, 73, 73, 73,
820 74, 74
821 };
822
823 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
824 static const unsigned char yyr2[] =
825 {
826 0, 2, 2, 1, 1, 2, 1, 2, 2, 4,
827 4, 3, 3, 1, 2, 4, 1, 2, 1, 3,
828 3, 3, 4, 4, 4, 4, 4, 1, 2, 2,
829 2, 1, 2, 1, 1, 1, 2, 1, 2, 1,
830 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
831 3, 3, 5, 6, 5, 7, 6, 4, 6, 5,
832 6, 7, 6, 1, 2, 4, 4, 5, 5, 1,
833 2, 5, 5, 6, 6, 1, 3, 6, 6, 7,
834 7, 10, 10, 5, 5, 0, 2, 1, 1, 1,
835 0, 2
836 };
837
838 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
839 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
840 means the default is an error. */
841 static const unsigned char yydefact[] =
842 {
843 0, 90, 90, 0, 0, 90, 90, 0, 47, 48,
844 3, 4, 0, 0, 90, 90, 0, 0, 6, 13,
845 49, 16, 33, 34, 37, 35, 44, 45, 46, 43,
846 40, 39, 41, 42, 5, 0, 0, 90, 90, 0,
847 0, 30, 0, 14, 29, 0, 0, 1, 2, 90,
848 90, 7, 8, 90, 47, 36, 31, 38, 91, 90,
849 0, 27, 17, 18, 0, 90, 0, 90, 90, 90,
850 50, 51, 0, 0, 11, 12, 0, 32, 0, 28,
851 90, 90, 90, 90, 90, 90, 0, 85, 90, 90,
852 0, 0, 0, 9, 10, 0, 0, 15, 90, 90,
853 54, 0, 0, 0, 20, 21, 19, 0, 63, 90,
854 69, 0, 90, 90, 0, 0, 0, 83, 84, 52,
855 0, 0, 56, 22, 23, 24, 25, 26, 62, 64,
856 70, 0, 60, 75, 0, 0, 0, 0, 86, 88,
857 87, 89, 90, 77, 78, 53, 55, 90, 90, 90,
858 90, 61, 0, 0, 90, 79, 80, 0, 57, 0,
859 0, 0, 90, 76, 65, 66, 90, 90, 90, 59,
860 67, 68, 71, 72, 0, 0, 58, 73, 74, 81,
861 82
862 };
863
864 /* YYDEFGOTO[NTERM-NUM]. */
865 static const short yydefgoto[] =
866 {
867 -1, 16, 17, 74, 61, 35, 62, 63, 20, 57,
868 21, 22, 23, 24, 25, 26, 27, 28, 29, 101,
869 30, 107, 108, 109, 110, 135, 31, 32, 33, 114,
870 142, 36
871 };
872
873 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
874 STATE-NUM. */
875 #define YYPACT_NINF -92
876 static const short yypact[] =
877 {
878 163, -92, -92, 1, 13, -92, -92, 18, 11, -92,
879 -92, -92, 382, 26, -92, -92, 17, 33, 78, 43,
880 -92, -92, 9, -92, 14, -92, -92, -92, -92, -92,
881 -92, -92, -92, -92, 42, 88, 264, -92, 52, 68,
882 91, -92, 76, 43, -92, 77, 82, -92, -92, -92,
883 -92, 328, 328, -92, -92, -92, -92, 14, -92, -92,
884 382, 43, -92, 40, -4, -92, 7, -92, -92, -92,
885 -92, -92, 296, 296, 60, 60, 350, -92, 59, 43,
886 -92, -92, -92, -92, -92, -92, -10, -92, -92, -92,
887 103, 104, -16, -92, -92, 328, 328, 43, -92, -92,
888 -92, 113, 264, 264, 264, 264, 264, 116, -92, -92,
889 -92, -7, -92, -92, 79, 112, 86, -92, -92, 14,
890 122, 126, -92, -92, -92, 81, 81, 81, -92, -92,
891 -92, 12, -92, -92, 105, -17, 118, 89, -92, -92,
892 -92, -92, -92, -92, -92, 14, -92, -92, -92, -92,
893 -92, -92, 2, 107, -92, -92, -92, -8, 97, 264,
894 264, 264, -92, -92, 119, 200, -92, -92, -92, -92,
895 120, 232, -92, -92, 123, 95, -92, -92, -92, -92,
896 -92
897 };
898
899 /* YYPGOTO[NTERM-NUM]. */
900 static const yysigned_char yypgoto[] =
901 {
902 -92, -92, -92, 8, 49, -5, -92, -91, -22, 20,
903 -92, -92, -92, -92, 121, -92, 48, -92, -92, -12,
904 -92, -92, 32, -92, 38, 16, -92, -92, -92, -92,
905 -92, 6
906 };
907
908 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
909 positive, shift that token. If negative, reduce the rule which
910 number is the opposite. If zero, do what YYDEFACT says.
911 If YYTABLE_NINF, parse error. */
912 #define YYTABLE_NINF -1
913 static const unsigned char yytable[] =
914 {
915 39, 40, 56, 132, 112, 85, 166, 34, 18, 45,
916 46, 123, 124, 125, 126, 127, 87, 47, 58, 153,
917 133, 88, 151, 154, 58, 15, 58, 58, 37, 7,
918 58, 113, 134, 167, 7, 77, 54, 9, 153, 133,
919 38, 58, 162, 64, 66, 41, 58, 13, 89, 19,
920 42, 134, 13, 44, 78, 72, 73, 80, 81, 76,
921 75, 43, 90, 91, 98, 99, 100, 48, 125, 126,
922 127, 86, 82, 83, 84, 92, 58, 49, 50, 53,
923 93, 94, 67, 115, 116, 65, 102, 103, 104, 105,
924 106, 111, 59, 120, 121, 49, 50, 56, 80, 81,
925 19, 19, 168, 99, 75, 68, 138, 136, 137, 79,
926 51, 52, 139, 140, 141, 131, 69, 70, 117, 118,
927 122, 19, 19, 77, 71, 97, 128, 143, 144, 146,
928 147, 156, 133, 155, 163, 172, 177, 180, 179, 145,
929 119, 129, 158, 55, 19, 19, 169, 130, 157, 164,
930 152, 0, 0, 0, 159, 160, 161, 170, 0, 0,
931 165, 174, 175, 176, 1, 0, 2, 0, 171, 0,
932 0, 3, 0, 0, 4, 5, 6, 0, 0, 0,
933 0, 0, 0, 7, 0, 0, 0, 0, 0, 0,
934 8, 9, 0, 0, 0, 0, 0, 10, 11, 0,
935 12, 13, 14, 2, 15, 0, 0, 0, 3, 0,
936 0, 4, 5, 6, 0, 0, 173, 0, 0, 0,
937 7, 0, 0, 0, 0, 0, 0, 8, 9, 0,
938 0, 0, 0, 0, 58, 2, 0, 60, 13, 14,
939 3, 15, 0, 4, 5, 6, 0, 0, 178, 0,
940 0, 0, 7, 0, 0, 0, 0, 0, 0, 8,
941 9, 0, 0, 0, 0, 0, 58, 2, 0, 60,
942 13, 14, 3, 15, 0, 4, 5, 6, 0, 0,
943 0, 0, 0, 0, 7, 0, 0, 0, 0, 0,
944 0, 8, 9, 0, 0, 0, 0, 0, 58, 2,
945 0, 60, 13, 14, 3, 15, 0, 4, 5, 6,
946 0, 0, 0, 0, 0, 0, 7, 0, 0, 0,
947 0, 0, 0, 8, 9, 0, 0, 0, 0, 0,
948 58, 2, 0, 12, 13, 14, 3, 15, 0, 4,
949 5, 6, 0, 0, 0, 0, 0, 0, 7, 0,
950 0, 0, 0, 2, 0, 8, 9, 0, 3, 0,
951 0, 4, 5, 6, 0, 12, 13, 14, 0, 15,
952 7, 0, 0, 0, 0, 0, 0, 8, 9, 0,
953 0, 0, 0, 0, 58, 2, 0, 0, 13, 14,
954 3, 15, 0, 4, 5, 6, 0, 0, 0, 0,
955 0, 0, 7, 0, 0, 0, 0, 0, 0, 8,
956 9, 0, 0, 0, 0, 0, 0, 0, 0, 0,
957 13, 14, 0, 15
958 };
959
960 static const short yycheck[] =
961 {
962 5, 6, 24, 10, 14, 9, 14, 1, 0, 14,
963 15, 102, 103, 104, 105, 106, 9, 0, 34, 36,
964 27, 14, 10, 40, 34, 41, 34, 34, 27, 20,
965 34, 41, 39, 41, 20, 57, 27, 28, 36, 27,
966 27, 34, 40, 37, 38, 27, 34, 38, 41, 0,
967 39, 39, 38, 27, 59, 49, 50, 17, 18, 53,
968 52, 12, 67, 68, 5, 6, 7, 34, 159, 160,
969 161, 65, 32, 33, 34, 69, 34, 17, 18, 36,
970 72, 73, 14, 88, 89, 33, 80, 81, 82, 83,
971 84, 85, 4, 98, 99, 17, 18, 119, 17, 18,
972 51, 52, 5, 6, 96, 14, 27, 112, 113, 60,
973 32, 33, 33, 34, 35, 109, 40, 40, 15, 15,
974 7, 72, 73, 145, 42, 76, 10, 15, 42, 7,
975 4, 42, 27, 15, 27, 16, 16, 42, 15, 119,
976 92, 109, 147, 22, 95, 96, 158, 109, 142, 154,
977 134, -1, -1, -1, 148, 149, 150, 162, -1, -1,
978 154, 166, 167, 168, 1, -1, 3, -1, 162, -1,
979 -1, 8, -1, -1, 11, 12, 13, -1, -1, -1,
980 -1, -1, -1, 20, -1, -1, -1, -1, -1, -1,
981 27, 28, -1, -1, -1, -1, -1, 34, 35, -1,
982 37, 38, 39, 3, 41, -1, -1, -1, 8, -1,
983 -1, 11, 12, 13, -1, -1, 16, -1, -1, -1,
984 20, -1, -1, -1, -1, -1, -1, 27, 28, -1,
985 -1, -1, -1, -1, 34, 3, -1, 37, 38, 39,
986 8, 41, -1, 11, 12, 13, -1, -1, 16, -1,
987 -1, -1, 20, -1, -1, -1, -1, -1, -1, 27,
988 28, -1, -1, -1, -1, -1, 34, 3, -1, 37,
989 38, 39, 8, 41, -1, 11, 12, 13, -1, -1,
990 -1, -1, -1, -1, 20, -1, -1, -1, -1, -1,
991 -1, 27, 28, -1, -1, -1, -1, -1, 34, 3,
992 -1, 37, 38, 39, 8, 41, -1, 11, 12, 13,
993 -1, -1, -1, -1, -1, -1, 20, -1, -1, -1,
994 -1, -1, -1, 27, 28, -1, -1, -1, -1, -1,
995 34, 3, -1, 37, 38, 39, 8, 41, -1, 11,
996 12, 13, -1, -1, -1, -1, -1, -1, 20, -1,
997 -1, -1, -1, 3, -1, 27, 28, -1, 8, -1,
998 -1, 11, 12, 13, -1, 37, 38, 39, -1, 41,
999 20, -1, -1, -1, -1, -1, -1, 27, 28, -1,
1000 -1, -1, -1, -1, 34, 3, -1, -1, 38, 39,
1001 8, 41, -1, 11, 12, 13, -1, -1, -1, -1,
1002 -1, -1, 20, -1, -1, -1, -1, -1, -1, 27,
1003 28, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1004 38, 39, -1, 41
1005 };
1006
1007 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1008 symbol of state STATE-NUM. */
1009 static const unsigned char yystos[] =
1010 {
1011 0, 1, 3, 8, 11, 12, 13, 20, 27, 28,
1012 34, 35, 37, 38, 39, 41, 44, 45, 46, 47,
1013 51, 53, 54, 55, 56, 57, 58, 59, 60, 61,
1014 63, 69, 70, 71, 74, 48, 74, 27, 27, 48,
1015 48, 27, 39, 47, 27, 48, 48, 0, 34, 17,
1016 18, 32, 33, 36, 27, 57, 51, 52, 34, 4,
1017 37, 47, 49, 50, 74, 33, 74, 14, 14, 40,
1018 40, 42, 74, 74, 46, 46, 74, 51, 48, 47,
1019 17, 18, 32, 33, 34, 9, 74, 9, 14, 41,
1020 48, 48, 74, 46, 46, 32, 33, 47, 5, 6,
1021 7, 62, 74, 74, 74, 74, 74, 64, 65, 66,
1022 67, 74, 14, 41, 72, 48, 48, 15, 15, 59,
1023 48, 48, 7, 50, 50, 50, 50, 50, 10, 65,
1024 67, 74, 10, 27, 39, 68, 48, 48, 27, 33,
1025 34, 35, 73, 15, 42, 52, 7, 4, 32, 33,
1026 34, 10, 68, 36, 40, 15, 42, 74, 48, 74,
1027 74, 74, 40, 27, 48, 74, 14, 41, 5, 62,
1028 48, 74, 16, 16, 48, 48, 48, 16, 16, 15,
1029 42
1030 };
1031
1032 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1033 # define YYSIZE_T __SIZE_TYPE__
1034 #endif
1035 #if ! defined (YYSIZE_T) && defined (size_t)
1036 # define YYSIZE_T size_t
1037 #endif
1038 #if ! defined (YYSIZE_T)
1039 # if defined (__STDC__) || defined (__cplusplus)
1040 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1041 # define YYSIZE_T size_t
1042 # endif
1043 #endif
1044 #if ! defined (YYSIZE_T)
1045 # define YYSIZE_T unsigned int
1046 #endif
1047
1048 #define yyerrok (yyerrstatus = 0)
1049 #define yyclearin (yychar = YYEMPTY)
1050 #define YYEMPTY -2
1051 #define YYEOF 0
1052
1053 #define YYACCEPT goto yyacceptlab
1054 #define YYABORT goto yyabortlab
1055 #define YYERROR goto yyerrlab1
1056
1057 /* Like YYERROR except do call yyerror. This remains here temporarily
1058 to ease the transition to the new meaning of YYERROR, for GCC.
1059 Once GCC version 2 has supplanted version 1, this can go. */
1060
1061 #define YYFAIL goto yyerrlab
1062
1063 #define YYRECOVERING() (!!yyerrstatus)
1064
1065 #define YYBACKUP(Token, Value) \
1066 do \
1067 if (yychar == YYEMPTY && yylen == 1) \
1068 { \
1069 yychar = (Token); \
1070 yylval = (Value); \
1071 yychar1 = YYTRANSLATE (yychar); \
1072 YYPOPSTACK; \
1073 goto yybackup; \
1074 } \
1075 else \
1076 { \
1077 yyerror ("syntax error: cannot back up"); \
1078 YYERROR; \
1079 } \
1080 while (0)
1081
1082 #define YYTERROR 1
1083 #define YYERRCODE 256
1084
1085 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
1086 are run). */
1087
1088 #ifndef YYLLOC_DEFAULT
1089 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1090 Current.first_line = Rhs[1].first_line; \
1091 Current.first_column = Rhs[1].first_column; \
1092 Current.last_line = Rhs[N].last_line; \
1093 Current.last_column = Rhs[N].last_column;
1094 #endif
1095
1096 /* YYLEX -- calling `yylex' with the right arguments. */
1097
1098 #define YYLEX yylex ()
1099
1100 /* Enable debugging if requested. */
1101 #if YYDEBUG
1102
1103 # ifndef YYFPRINTF
1104 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1105 # define YYFPRINTF fprintf
1106 # endif
1107
1108 # define YYDPRINTF(Args) \
1109 do { \
1110 if (yydebug) \
1111 YYFPRINTF Args; \
1112 } while (0)
1113 # define YYDSYMPRINT(Args) \
1114 do { \
1115 if (yydebug) \
1116 yysymprint Args; \
1117 } while (0)
1118 /* Nonzero means print parse trace. It is left uninitialized so that
1119 multiple parsers can coexist. */
1120 int yydebug;
1121 #else /* !YYDEBUG */
1122 # define YYDPRINTF(Args)
1123 # define YYDSYMPRINT(Args)
1124 #endif /* !YYDEBUG */
1125
1126 /* YYINITDEPTH -- initial size of the parser's stacks. */
1127 #ifndef YYINITDEPTH
1128 # define YYINITDEPTH 200
1129 #endif
1130
1131 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1132 if the built-in stack extension method is used).
1133
1134 Do not make this value too large; the results are undefined if
1135 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
1136 evaluated with infinite-precision integer arithmetic. */
1137
1138 #if YYMAXDEPTH == 0
1139 # undef YYMAXDEPTH
1140 #endif
1141
1142 #ifndef YYMAXDEPTH
1143 # define YYMAXDEPTH 10000
1144 #endif
1145
1146
1147
1148 #if YYERROR_VERBOSE
1149
1150 # ifndef yystrlen
1151 # if defined (__GLIBC__) && defined (_STRING_H)
1152 # define yystrlen strlen
1153 # else
1154 /* Return the length of YYSTR. */
1155 static YYSIZE_T
1156 # if defined (__STDC__) || defined (__cplusplus)
1157 yystrlen (const char *yystr)
1158 # else
1159 yystrlen (yystr)
1160 const char *yystr;
1161 # endif
1162 {
1163 register const char *yys = yystr;
1164
1165 while (*yys++ != '\0')
1166 continue;
1167
1168 return yys - yystr - 1;
1169 }
1170 # endif
1171 # endif
1172
1173 # ifndef yystpcpy
1174 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1175 # define yystpcpy stpcpy
1176 # else
1177 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1178 YYDEST. */
1179 static char *
1180 # if defined (__STDC__) || defined (__cplusplus)
1181 yystpcpy (char *yydest, const char *yysrc)
1182 # else
1183 yystpcpy (yydest, yysrc)
1184 char *yydest;
1185 const char *yysrc;
1186 # endif
1187 {
1188 register char *yyd = yydest;
1189 register const char *yys = yysrc;
1190
1191 while ((*yyd++ = *yys++) != '\0')
1192 continue;
1193
1194 return yyd - 1;
1195 }
1196 # endif
1197 # endif
1198
1199 #endif /* !YYERROR_VERBOSE */
1200
1201
1202
1203 #if YYDEBUG
1204 /*-----------------------------.
1205 | Print this symbol on YYOUT. |
1206 `-----------------------------*/
1207
1208 static void
1209 #if defined (__STDC__) || defined (__cplusplus)
1210 yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue)
1211 #else
1212 yysymprint (yyout, yytype, yyvalue)
1213 FILE* yyout;
1214 int yytype;
1215 YYSTYPE yyvalue;
1216 #endif
1217 {
1218 /* Pacify ``unused variable'' warnings. */
1219 (void) yyvalue;
1220
1221 if (yytype < YYNTOKENS)
1222 {
1223 YYFPRINTF (yyout, "token %s (", yytname[yytype]);
1224 # ifdef YYPRINT
1225 YYPRINT (yyout, yytoknum[yytype], yyvalue);
1226 # endif
1227 }
1228 else
1229 YYFPRINTF (yyout, "nterm %s (", yytname[yytype]);
1230
1231 switch (yytype)
1232 {
1233 default:
1234 break;
1235 }
1236 YYFPRINTF (yyout, ")");
1237 }
1238 #endif /* YYDEBUG. */
1239
1240
1241 /*-----------------------------------------------.
1242 | Release the memory associated to this symbol. |
1243 `-----------------------------------------------*/
1244
1245 static void
1246 #if defined (__STDC__) || defined (__cplusplus)
1247 yydestruct (int yytype, YYSTYPE yyvalue)
1248 #else
1249 yydestruct (yytype, yyvalue)
1250 int yytype;
1251 YYSTYPE yyvalue;
1252 #endif
1253 {
1254 /* Pacify ``unused variable'' warnings. */
1255 (void) yyvalue;
1256
1257 switch (yytype)
1258 {
1259 default:
1260 break;
1261 }
1262 }
1263
1264
1265
1266 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
1267 into yyparse. The argument should have type void *.
1268 It should actually point to an object.
1269 Grammar actions can access the variable by casting it
1270 to the proper pointer type. */
1271
1272 #ifdef YYPARSE_PARAM
1273 # if defined (__STDC__) || defined (__cplusplus)
1274 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
1275 # define YYPARSE_PARAM_DECL
1276 # else
1277 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
1278 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
1279 # endif
1280 #else /* !YYPARSE_PARAM */
1281 # define YYPARSE_PARAM_ARG
1282 # define YYPARSE_PARAM_DECL
1283 #endif /* !YYPARSE_PARAM */
1284
1285 /* Prevent warning if -Wstrict-prototypes. */
1286 #ifdef __GNUC__
1287 # ifdef YYPARSE_PARAM
1288 int yyparse (void *);
1289 # else
1290 int yyparse (void);
1291 # endif
1292 #endif
1293
1294
1295 /* The lookahead symbol. */
1296 int yychar;
1297
1298 /* The semantic value of the lookahead symbol. */
1299 YYSTYPE yylval;
1300
1301 /* Number of parse errors so far. */
1302 int yynerrs;
1303
1304
1305 int
1306 yyparse (YYPARSE_PARAM_ARG)
1307 YYPARSE_PARAM_DECL
1308 {
1309
1310 register int yystate;
1311 register int yyn;
1312 int yyresult;
1313 /* Number of tokens to shift before error messages enabled. */
1314 int yyerrstatus;
1315 /* Lookahead token as an internal (translated) token number. */
1316 int yychar1 = 0;
1317
1318 /* Three stacks and their tools:
1319 `yyss': related to states,
1320 `yyvs': related to semantic values,
1321 `yyls': related to locations.
1322
1323 Refer to the stacks thru separate pointers, to allow yyoverflow
1324 to reallocate them elsewhere. */
1325
1326 /* The state stack. */
1327 short yyssa[YYINITDEPTH];
1328 short *yyss = yyssa;
1329 register short *yyssp;
1330
1331 /* The semantic value stack. */
1332 YYSTYPE yyvsa[YYINITDEPTH];
1333 YYSTYPE *yyvs = yyvsa;
1334 register YYSTYPE *yyvsp;
1335
1336
1337
1338 #define YYPOPSTACK (yyvsp--, yyssp--)
1339
1340 YYSIZE_T yystacksize = YYINITDEPTH;
1341
1342 /* The variables used to return semantic value and location from the
1343 action routines. */
1344 YYSTYPE yyval;
1345
1346
1347 /* When reducing, the number of symbols on the RHS of the reduced
1348 rule. */
1349 int yylen;
1350
1351 YYDPRINTF ((stderr, "Starting parse\n"));
1352
1353 yystate = 0;
1354 yyerrstatus = 0;
1355 yynerrs = 0;
1356 yychar = YYEMPTY; /* Cause a token to be read. */
1357
1358 /* Initialize stack pointers.
1359 Waste one element of value and location stack
1360 so that they stay on the same level as the state stack.
1361 The wasted elements are never initialized. */
1362
1363 yyssp = yyss;
1364 yyvsp = yyvs;
1365
1366 goto yysetstate;
1367
1368 /*------------------------------------------------------------.
1369 | yynewstate -- Push a new state, which is found in yystate. |
1370 `------------------------------------------------------------*/
1371 yynewstate:
1372 /* In all cases, when you get here, the value and location stacks
1373 have just been pushed. so pushing a state here evens the stacks.
1374 */
1375 yyssp++;
1376
1377 yysetstate:
1378 *yyssp = yystate;
1379
1380 if (yyssp >= yyss + yystacksize - 1)
1381 {
1382 /* Get the current used size of the three stacks, in elements. */
1383 YYSIZE_T yysize = yyssp - yyss + 1;
1384
1385 #ifdef yyoverflow
1386 {
1387 /* Give user a chance to reallocate the stack. Use copies of
1388 these so that the &'s don't force the real ones into
1389 memory. */
1390 YYSTYPE *yyvs1 = yyvs;
1391 short *yyss1 = yyss;
1392
1393
1394 /* Each stack pointer address is followed by the size of the
1395 data in use in that stack, in bytes. This used to be a
1396 conditional around just the two extra args, but that might
1397 be undefined if yyoverflow is a macro. */
1398 yyoverflow ("parser stack overflow",
1399 &yyss1, yysize * sizeof (*yyssp),
1400 &yyvs1, yysize * sizeof (*yyvsp),
1401
1402 &yystacksize);
1403
1404 yyss = yyss1;
1405 yyvs = yyvs1;
1406 }
1407 #else /* no yyoverflow */
1408 # ifndef YYSTACK_RELOCATE
1409 goto yyoverflowlab;
1410 # else
1411 /* Extend the stack our own way. */
1412 if (yystacksize >= YYMAXDEPTH)
1413 goto yyoverflowlab;
1414 yystacksize *= 2;
1415 if (yystacksize > YYMAXDEPTH)
1416 yystacksize = YYMAXDEPTH;
1417
1418 {
1419 short *yyss1 = yyss;
1420 union yyalloc *yyptr =
1421 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1422 if (! yyptr)
1423 goto yyoverflowlab;
1424 YYSTACK_RELOCATE (yyss);
1425 YYSTACK_RELOCATE (yyvs);
1426
1427 # undef YYSTACK_RELOCATE
1428 if (yyss1 != yyssa)
1429 YYSTACK_FREE (yyss1);
1430 }
1431 # endif
1432 #endif /* no yyoverflow */
1433
1434 yyssp = yyss + yysize - 1;
1435 yyvsp = yyvs + yysize - 1;
1436
1437
1438 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1439 (unsigned long int) yystacksize));
1440
1441 if (yyssp >= yyss + yystacksize - 1)
1442 YYABORT;
1443 }
1444
1445 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1446
1447 goto yybackup;
1448
1449 /*-----------.
1450 | yybackup. |
1451 `-----------*/
1452 yybackup:
1453
1454 /* Do appropriate processing given the current state. */
1455 /* Read a lookahead token if we need one and don't already have one. */
1456 /* yyresume: */
1457
1458 /* First try to decide what to do without reference to lookahead token. */
1459
1460 yyn = yypact[yystate];
1461 if (yyn == YYPACT_NINF)
1462 goto yydefault;
1463
1464 /* Not known => get a lookahead token if don't already have one. */
1465
1466 /* yychar is either YYEMPTY or YYEOF
1467 or a valid token in external form. */
1468
1469 if (yychar == YYEMPTY)
1470 {
1471 YYDPRINTF ((stderr, "Reading a token: "));
1472 yychar = YYLEX;
1473 }
1474
1475 /* Convert token to internal form (in yychar1) for indexing tables with. */
1476
1477 if (yychar <= 0) /* This means end of input. */
1478 {
1479 yychar1 = 0;
1480 yychar = YYEOF; /* Don't call YYLEX any more. */
1481
1482 YYDPRINTF ((stderr, "Now at end of input.\n"));
1483 }
1484 else
1485 {
1486 yychar1 = YYTRANSLATE (yychar);
1487
1488 /* We have to keep this `#if YYDEBUG', since we use variables
1489 which are defined only if `YYDEBUG' is set. */
1490 YYDPRINTF ((stderr, "Next token is "));
1491 YYDSYMPRINT ((stderr, yychar1, yylval));
1492 YYDPRINTF ((stderr, "\n"));
1493 }
1494
1495 /* If the proper action on seeing token YYCHAR1 is to reduce or to
1496 detect an error, take that action. */
1497 yyn += yychar1;
1498 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1)
1499 goto yydefault;
1500 yyn = yytable[yyn];
1501 if (yyn <= 0)
1502 {
1503 if (yyn == 0 || yyn == YYTABLE_NINF)
1504 goto yyerrlab;
1505 yyn = -yyn;
1506 goto yyreduce;
1507 }
1508
1509 if (yyn == YYFINAL)
1510 YYACCEPT;
1511
1512 /* Shift the lookahead token. */
1513 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
1514 yychar, yytname[yychar1]));
1515
1516 /* Discard the token being shifted unless it is eof. */
1517 if (yychar != YYEOF)
1518 yychar = YYEMPTY;
1519
1520 *++yyvsp = yylval;
1521
1522
1523 /* Count tokens shifted since error; after three, turn off error
1524 status. */
1525 if (yyerrstatus)
1526 yyerrstatus--;
1527
1528 yystate = yyn;
1529 goto yynewstate;
1530
1531
1532 /*-----------------------------------------------------------.
1533 | yydefault -- do the default action for the current state. |
1534 `-----------------------------------------------------------*/
1535 yydefault:
1536 yyn = yydefact[yystate];
1537 if (yyn == 0)
1538 goto yyerrlab;
1539 goto yyreduce;
1540
1541
1542 /*-----------------------------.
1543 | yyreduce -- Do a reduction. |
1544 `-----------------------------*/
1545 yyreduce:
1546 /* yyn is the number of a rule to reduce with. */
1547 yylen = yyr2[yyn];
1548
1549 /* If YYLEN is nonzero, implement the default value of the action:
1550 `$$ = $1'.
1551
1552 Otherwise, the following line sets YYVAL to garbage.
1553 This behavior is undocumented and Bison
1554 users should not rely upon it. Assigning to YYVAL
1555 unconditionally makes the parser a bit smaller, and it avoids a
1556 GCC warning that YYVAL may be used uninitialized. */
1557 yyval = yyvsp[1-yylen];
1558
1559
1560
1561 #if YYDEBUG
1562 /* We have to keep this `#if YYDEBUG', since we use variables which
1563 are defined only if `YYDEBUG' is set. */
1564 if (yydebug)
1565 {
1566 int yyi;
1567
1568 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
1569 yyn - 1, yyrline[yyn]);
1570
1571 /* Print the symbols being reduced, and their result. */
1572 for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++)
1573 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
1574 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1575 }
1576 #endif
1577 switch (yyn)
1578 {
1579 case 2:
1580 {
1581 Vsh_trace("Yacc","inputunit::1");
1582 global_command = yyvsp[-1].command;
1583 if (global_command != VNULL) {
1584 if (global_command->type == cm_simple) {
1585 wordTmp = yyvsp[-1].command->value.Simple->words;
1586 memset(buf, VNULL_SYMBOL, sizeof(buf));
1587 while (wordTmp != VNULL) {
1588 wTmp = wordTmp->word;
1589 if (wTmp != VNULL) {
1590 strcat(buf,wTmp->word);
1591 wordTmp = wordTmp->next;
1592 } else {
1593 wordTmp = VNULL;
1594 }
1595 if (wordTmp != VNULL) strcat(buf," ");
1596 }
1597 Vnm_print(1,"Vsh: will execv: <%s>\n", buf);
1598 Vsh_parseHandoff(buf);
1599 Vsh_yyexecute(global_command);
1600 dispose_command (global_command);
1601 }
1602 }
1603 YYACCEPT;
1604 }
1605 break;
1606
1607 case 3:
1608 {
1609 Vsh_trace("Yacc","inputunit::2");
1610 global_command = (COMMAND*)VNULL;
1611 YYACCEPT;
1612 }
1613 break;
1614
1615 case 4:
1616 {
1617 Vsh_trace("Yacc","inputunit::3");
1618 global_command = (COMMAND*)VNULL;
1619 cmdKey = 2;
1620 YYACCEPT;
1621 }
1622 break;
1623
1624 case 5:
1625 {
1626 Vsh_trace("Yacc","inputunit::4");
1627 global_command = (COMMAND*)VNULL;
1628 YYABORT;
1629 }
1630 break;
1631
1632 case 6:
1633 {
1634 Vsh_trace("Yacc","simple_list::1");
1635 yyval.command = yyvsp[0].command;
1636 }
1637 break;
1638
1639 case 7:
1640 {
1641 Vsh_trace("Yacc","simple_list::2");
1642 yyval.command = yyvsp[-1].command;
1643 }
1644 break;
1645
1646 case 8:
1647 {
1648 Vsh_trace("Yacc","simple_list::3");
1649 yyval.command = yyvsp[-1].command;
1650 }
1651 break;
1652
1653 case 9:
1654 {
1655 Vsh_trace("Yacc","simple_list1::1");
1656 yyval.command = yyvsp[-3].command;
1657 }
1658 break;
1659
1660 case 10:
1661 {
1662 Vsh_trace("Yacc","simple_list1::2");
1663 yyval.command = yyvsp[-3].command;
1664 }
1665 break;
1666
1667 case 11:
1668 {
1669 Vsh_trace("Yacc","simple_list1::3");
1670 yyval.command = yyvsp[-2].command;
1671 }
1672 break;
1673
1674 case 12:
1675 {
1676 Vsh_trace("Yacc","simple_list1::4");
1677 yyval.command = yyvsp[-2].command;
1678 }
1679 break;
1680
1681 case 13:
1682 {
1683 Vsh_trace("Yacc","simple_list1::5");
1684 yyval.command = yyvsp[0].command;
1685 }
1686 break;
1687
1688 case 14:
1689 {
1690 Vsh_trace("Yacc","simple_list1::6");
1691 yyval.command = yyvsp[0].command;
1692 }
1693 break;
1694
1695 case 15:
1696 {
1697 Vsh_trace("Yacc","pipeline::1");
1698 yyval.command = yyvsp[-3].command;
1699 }
1700 break;
1701
1702 case 16:
1703 {
1704 Vsh_trace("Yacc","pipeline::2");
1705 yyval.command = yyvsp[0].command;
1706 }
1707 break;
1708
1709 case 17:
1710 {
1711 Vsh_trace("Yacc","list::1");
1712 yyval.command = yyvsp[0].command;
1713 }
1714 break;
1715
1716 case 18:
1717 {
1718 Vsh_trace("Yacc","list0::1");
1719 yyval.command = yyvsp[0].command;
1720 }
1721 break;
1722
1723 case 19:
1724 {
1725 Vsh_trace("Yacc","list0::2");
1726 yyval.command = yyvsp[-2].command;
1727 }
1728 break;
1729
1730 case 20:
1731 {
1732 Vsh_trace("Yacc","list0::3");
1733 yyval.command = yyvsp[-2].command;
1734 }
1735 break;
1736
1737 case 21:
1738 {
1739 Vsh_trace("Yacc","list0::4");
1740 yyval.command = yyvsp[-2].command;
1741 }
1742 break;
1743
1744 case 22:
1745 {
1746 Vsh_trace("Yacc","list1::1");
1747 yyval.command = yyvsp[-3].command;
1748 }
1749 break;
1750
1751 case 23:
1752 {
1753 Vsh_trace("Yacc","list1::2");
1754 yyval.command = yyvsp[-3].command;
1755 }
1756 break;
1757
1758 case 24:
1759 {
1760 Vsh_trace("Yacc","list1::3");
1761 yyval.command = yyvsp[-3].command;
1762 }
1763 break;
1764
1765 case 25:
1766 {
1767 Vsh_trace("Yacc","list1::4");
1768 yyval.command = yyvsp[-3].command;
1769 }
1770 break;
1771
1772 case 26:
1773 {
1774 Vsh_trace("Yacc","list1::5");
1775 yyval.command = yyvsp[-3].command;
1776 }
1777 break;
1778
1779 case 27:
1780 {
1781 Vsh_trace("Yacc","list1::6");
1782 yyval.command = yyvsp[0].command;
1783 }
1784 break;
1785
1786 case 28:
1787 {
1788 Vsh_trace("Yacc","list1::7");
1789 yyval.command = yyvsp[0].command;
1790 }
1791 break;
1792
1793 case 29:
1794 {
1795 Vsh_trace("Yacc","redirection::1");
1796 redir.filename = yyvsp[0].word;
1797 yyval.redirect = make_redirection(1, r_output_direction, redir);
1798 }
1799 break;
1800
1801 case 30:
1802 {
1803 Vsh_trace("Yacc","redirection::2");
1804 redir.filename = yyvsp[0].word;
1805 yyval.redirect = make_redirection(1, r_appending_to, redir);
1806 }
1807 break;
1808
1809 case 31:
1810 {
1811 Vsh_trace("Yacc","redirections::1");
1812 yyval.redirect = yyvsp[0].redirect;
1813 }
1814 break;
1815
1816 case 32:
1817 {
1818 Vsh_trace("Yacc","redirections::2");
1819 yyval.redirect = yyvsp[-1].redirect;
1820 }
1821 break;
1822
1823 case 33:
1824 {
1825 Vsh_trace("Yacc","command::1");
1826 yyval.command = clean_simple_command(yyvsp[0].command);
1827 }
1828 break;
1829
1830 case 34:
1831 {
1832 Vsh_trace("Yacc","command::2");
1833 yyval.command = yyvsp[0].command;
1834 }
1835 break;
1836
1837 case 35:
1838 {
1839 Vsh_trace("Yacc","simple_command::1");
1840 yyval.command = make_simple_command(yyvsp[0].element,(COMMAND*)VNULL);
1841 }
1842 break;
1843
1844 case 36:
1845 {
1846 Vsh_trace("Yacc","simple_command::2");
1847 yyval.command = make_simple_command(yyvsp[0].element,yyvsp[-1].command);
1848 }
1849 break;
1850
1851 case 37:
1852 {
1853 Vsh_trace("Yacc","shell_command::1");
1854 yyval.command = yyvsp[0].command;
1855 }
1856 break;
1857
1858 case 38:
1859 {
1860 Vsh_trace("Yacc","shell_command::2");
1861 yyval.command = yyvsp[-1].command;
1862 }
1863 break;
1864
1865 case 39:
1866 {
1867 Vsh_trace("Yacc","shell_command_1::1");
1868 yyval.command = VNULL;
1869 }
1870 break;
1871
1872 case 40:
1873 {
1874 Vsh_trace("Yacc","shell_command_1::2");
1875 yyval.command = VNULL;
1876 }
1877 break;
1878
1879 case 41:
1880 {
1881 Vsh_trace("Yacc","shell_command_1::3");
1882 yyval.command = VNULL;
1883 }
1884 break;
1885
1886 case 42:
1887 {
1888 Vsh_trace("Yacc","shell_command_1::4");
1889 yyval.command = VNULL;
1890 }
1891 break;
1892
1893 case 43:
1894 {
1895 Vsh_trace("Yacc","shell_command_1::5");
1896 yyval.command = VNULL;
1897 }
1898 break;
1899
1900 case 44:
1901 {
1902 Vsh_trace("Yacc","shell_command_1::6");
1903 yyval.command = VNULL;
1904 }
1905 break;
1906
1907 case 45:
1908 {
1909 Vsh_trace("Yacc","shell_command_1::7");
1910 yyval.command = VNULL;
1911 }
1912 break;
1913
1914 case 46:
1915 {
1916 Vsh_trace("Yacc","shell_command_1::8");
1917 yyval.command = VNULL;
1918 }
1919 break;
1920
1921 case 47:
1922 {
1923 Vsh_trace("Yacc","simple_command_element::1");
1924 yyval.element.word = yyvsp[0].word;
1925 yyval.element.redirect = 0;
1926 }
1927 break;
1928
1929 case 48:
1930 {
1931 Vsh_trace("Yacc","simple_command_element::2");
1932 yyval.element.word = yyvsp[0].word;
1933 yyval.element.redirect = 0;
1934 }
1935 break;
1936
1937 case 49:
1938 {
1939 Vsh_trace("Yacc","simple_command_element::3");
1940 yyval.element.word = 0;
1941 yyval.element.redirect = yyvsp[0].redirect;
1942 }
1943 break;
1944
1945 case 50:
1946 {
1947 Vsh_trace("Yacc","subshell::1");
1948 yyval.command = yyvsp[-1].command;
1949 }
1950 break;
1951
1952 case 51:
1953 {
1954 Vsh_trace("Yacc","group_command::1");
1955 yyval.command = yyvsp[-1].command;
1956 }
1957 break;
1958
1959 case 52:
1960 {
1961 Vsh_trace("Yacc","function_def::1");
1962 yyval.command = VNULL;
1963 }
1964 break;
1965
1966 case 53:
1967 {
1968 Vsh_trace("Yacc","function_def::2");
1969 yyval.command = VNULL;
1970 }
1971 break;
1972
1973 case 54:
1974 {
1975 Vsh_trace("Yacc","if_command::1");
1976 yyval.command = VNULL;
1977 }
1978 break;
1979
1980 case 55:
1981 {
1982 Vsh_trace("Yacc","if_command::2");
1983 yyval.command = VNULL;
1984 }
1985 break;
1986
1987 case 56:
1988 {
1989 Vsh_trace("Yacc","if_command::3");
1990 yyval.command = VNULL;
1991 }
1992 break;
1993
1994 case 57:
1995 {
1996 Vsh_trace("Yacc","elif_clause::1");
1997 yyval.command = VNULL;
1998 }
1999 break;
2000
2001 case 58:
2002 {
2003 Vsh_trace("Yacc","elif_clause::2");
2004 yyval.command = VNULL;
2005 }
2006 break;
2007
2008 case 59:
2009 {
2010 Vsh_trace("Yacc","elif_clause::3");
2011 yyval.command = VNULL;
2012 }
2013 break;
2014
2015 case 60:
2016 {
2017 Vsh_trace("Yacc","case_command::1");
2018 yyval.command = VNULL;
2019 }
2020 break;
2021
2022 case 61:
2023 {
2024 Vsh_trace("Yacc","case_command::2");
2025 yyval.command = VNULL;
2026 }
2027 break;
2028
2029 case 62:
2030 {
2031 Vsh_trace("Yacc","case_command::3");
2032 yyval.command = VNULL;
2033 }
2034 break;
2035
2036 case 63:
2037 {
2038 Vsh_trace("Yacc","case_clause_1::1");
2039 yyval.pattern = VNULL;
2040 }
2041 break;
2042
2043 case 64:
2044 {
2045 Vsh_trace("Yacc","case_clause_1::2");
2046 yyval.pattern = VNULL;
2047 }
2048 break;
2049
2050 case 65:
2051 {
2052 Vsh_trace("Yacc","pattern_list_1::1");
2053 yyval.pattern = VNULL;
2054 }
2055 break;
2056
2057 case 66:
2058 {
2059 Vsh_trace("Yacc","pattern_list_1::2");
2060 yyval.pattern = VNULL;
2061 }
2062 break;
2063
2064 case 67:
2065 {
2066 Vsh_trace("Yacc","pattern_list_1::3");
2067 yyval.pattern = VNULL;
2068 }
2069 break;
2070
2071 case 68:
2072 {
2073 Vsh_trace("Yacc","pattern_list_1::4");
2074 yyval.pattern = VNULL;
2075 }
2076 break;
2077
2078 case 69:
2079 {
2080 Vsh_trace("Yacc","case_clause_sequence::1");
2081 yyval.pattern = VNULL;
2082 }
2083 break;
2084
2085 case 70:
2086 {
2087 Vsh_trace("Yacc","case_clause_sequence::2");
2088 yyval.pattern = VNULL;
2089 }
2090 break;
2091
2092 case 71:
2093 {
2094 Vsh_trace("Yacc","pattern_list::1");
2095 yyval.pattern = VNULL;
2096 }
2097 break;
2098
2099 case 72:
2100 {
2101 Vsh_trace("Yacc","pattern_list::2");
2102 yyval.pattern = VNULL;
2103 }
2104 break;
2105
2106 case 73:
2107 {
2108 Vsh_trace("Yacc","pattern_list::3");
2109 yyval.pattern = VNULL;
2110 }
2111 break;
2112
2113 case 74:
2114 {
2115 Vsh_trace("Yacc","pattern_list::4");
2116 yyval.pattern = VNULL;
2117 }
2118 break;
2119
2120 case 75:
2121 {
2122 Vsh_trace("Yacc","pattern::1");
2123 yyval.word_list = VNULL;
2124 }
2125 break;
2126
2127 case 76:
2128 {
2129 Vsh_trace("Yacc","pattern::2");
2130 yyval.word_list = VNULL;
2131 }
2132 break;
2133
2134 case 77:
2135 {
2136 Vsh_trace("Yacc","for_command::1");
2137 yyval.command = VNULL;
2138 }
2139 break;
2140
2141 case 78:
2142 {
2143 Vsh_trace("Yacc","for_command::2");
2144 yyval.command = VNULL;
2145 }
2146 break;
2147
2148 case 79:
2149 {
2150 Vsh_trace("Yacc","for_command::3");
2151 yyval.command = VNULL;
2152 }
2153 break;
2154
2155 case 80:
2156 {
2157 Vsh_trace("Yacc","for_command::4");
2158 yyval.command = VNULL;
2159 }
2160 break;
2161
2162 case 81:
2163 {
2164 Vsh_trace("Yacc","for_command::5");
2165 yyval.command = VNULL;
2166 }
2167 break;
2168
2169 case 82:
2170 {
2171 Vsh_trace("Yacc","for_command::6");
2172 yyval.command = VNULL;
2173 }
2174 break;
2175
2176 case 83:
2177 {
2178 Vsh_trace("Yacc","while_command::1");
2179 yyval.command = VNULL;
2180 }
2181 break;
2182
2183 case 84:
2184 {
2185 Vsh_trace("Yacc","until_command::1");
2186 yyval.command = VNULL;
2187 }
2188 break;
2189
2190 case 85:
2191 {
2192 Vsh_trace("Yacc","words::1");
2193 yyval.word_list = (WORD_LIST*)VNULL;
2194 }
2195 break;
2196
2197 case 86:
2198 {
2199 Vsh_trace("Yacc","words::2");
2200 yyval.word_list = make_word_list(yyvsp[0].word,yyvsp[-1].word_list);
2201 }
2202 break;
2203
2204 case 87:
2205 {
2206 Vsh_trace("Yacc","term::1");
2207 }
2208 break;
2209
2210 case 88:
2211 {
2212 Vsh_trace("Yacc","term::2");
2213 }
2214 break;
2215
2216 case 89:
2217 {
2218 Vsh_trace("Yacc","term::3");
2219 }
2220 break;
2221
2222 case 90:
2223 {
2224 Vsh_trace("Yacc","newlines::1");
2225 }
2226 break;
2227
2228 case 91:
2229 {
2230 Vsh_trace("Yacc","newlines::2");
2231 }
2232 break;
2233
2234
2235 }
2236
2237 /* Line 1016 of /usr/share/bison/yacc.c. */
2238 #line 2236 "y.tab.c"
2239
2240 yyvsp -= yylen;
2241 yyssp -= yylen;
2242
2243
2244 #if YYDEBUG
2245 if (yydebug)
2246 {
2247 short *yyssp1 = yyss - 1;
2248 YYFPRINTF (stderr, "state stack now");
2249 while (yyssp1 != yyssp)
2250 YYFPRINTF (stderr, " %d", *++yyssp1);
2251 YYFPRINTF (stderr, "\n");
2252 }
2253 #endif
2254
2255 *++yyvsp = yyval;
2256
2257
2258 /* Now `shift' the result of the reduction. Determine what state
2259 that goes to, based on the state we popped back to and the rule
2260 number reduced by. */
2261
2262 yyn = yyr1[yyn];
2263
2264 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2265 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2266 yystate = yytable[yystate];
2267 else
2268 yystate = yydefgoto[yyn - YYNTOKENS];
2269
2270 goto yynewstate;
2271
2272
2273 /*------------------------------------.
2274 | yyerrlab -- here on detecting error |
2275 `------------------------------------*/
2276 yyerrlab:
2277 /* If not already recovering from an error, report this error. */
2278 if (!yyerrstatus)
2279 {
2280 ++yynerrs;
2281 #if YYERROR_VERBOSE
2282 yyn = yypact[yystate];
2283
2284 if (YYPACT_NINF < yyn && yyn < YYLAST)
2285 {
2286 YYSIZE_T yysize = 0;
2287 int yytype = YYTRANSLATE (yychar);
2288 char *yymsg;
2289 int yyx, yycount;
2290
2291 yycount = 0;
2292 /* Start YYX at -YYN if negative to avoid negative indexes in
2293 YYCHECK. */
2294 for (yyx = yyn < 0 ? -yyn : 0;
2295 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
2296 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2297 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
2298 yysize += yystrlen ("parse error, unexpected ") + 1;
2299 yysize += yystrlen (yytname[yytype]);
2300 yymsg = (char *) YYSTACK_ALLOC (yysize);
2301 if (yymsg != 0)
2302 {
2303 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
2304 yyp = yystpcpy (yyp, yytname[yytype]);
2305
2306 if (yycount < 5)
2307 {
2308 yycount = 0;
2309 for (yyx = yyn < 0 ? -yyn : 0;
2310 yyx < (int) (sizeof (yytname) / sizeof (char *));
2311 yyx++)
2312 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2313 {
2314 const char *yyq = ! yycount ? ", expecting " : " or ";
2315 yyp = yystpcpy (yyp, yyq);
2316 yyp = yystpcpy (yyp, yytname[yyx]);
2317 yycount++;
2318 }
2319 }
2320 yyerror (yymsg);
2321 YYSTACK_FREE (yymsg);
2322 }
2323 else
2324 yyerror ("parse error; also virtual memory exhausted");
2325 }
2326 else
2327 #endif /* YYERROR_VERBOSE */
2328 yyerror ("parse error");
2329 }
2330 goto yyerrlab1;
2331
2332
2333 /*----------------------------------------------------.
2334 | yyerrlab1 -- error raised explicitly by an action. |
2335 `----------------------------------------------------*/
2336 yyerrlab1:
2337 if (yyerrstatus == 3)
2338 {
2339 /* If just tried and failed to reuse lookahead token after an
2340 error, discard it. */
2341
2342 /* Return failure if at end of input. */
2343 if (yychar == YYEOF)
2344 {
2345 /* Pop the error token. */
2346 YYPOPSTACK;
2347 /* Pop the rest of the stack. */
2348 while (yyssp > yyss)
2349 {
2350 YYDPRINTF ((stderr, "Error: popping "));
2351 YYDSYMPRINT ((stderr,
2352 yystos[*yyssp],
2353 *yyvsp));
2354 YYDPRINTF ((stderr, "\n"));
2355 yydestruct (yystos[*yyssp], *yyvsp);
2356 YYPOPSTACK;
2357 }
2358 YYABORT;
2359 }
2360
2361 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
2362 yychar, yytname[yychar1]));
2363 yydestruct (yychar1, yylval);
2364 yychar = YYEMPTY;
2365 }
2366
2367 /* Else will try to reuse lookahead token after shifting the error
2368 token. */
2369
2370 yyerrstatus = 3; /* Each real token shifted decrements this. */
2371
2372 for (;;)
2373 {
2374 yyn = yypact[yystate];
2375 if (yyn != YYPACT_NINF)
2376 {
2377 yyn += YYTERROR;
2378 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2379 {
2380 yyn = yytable[yyn];
2381 if (0 < yyn)
2382 break;
2383 }
2384 }
2385
2386 /* Pop the current state because it cannot handle the error token. */
2387 if (yyssp == yyss)
2388 YYABORT;
2389
2390 YYDPRINTF ((stderr, "Error: popping "));
2391 YYDSYMPRINT ((stderr,
2392 yystos[*yyssp], *yyvsp));
2393 YYDPRINTF ((stderr, "\n"));
2394
2395 yydestruct (yystos[yystate], *yyvsp);
2396 yyvsp--;
2397 yystate = *--yyssp;
2398
2399
2400 #if YYDEBUG
2401 if (yydebug)
2402 {
2403 short *yyssp1 = yyss - 1;
2404 YYFPRINTF (stderr, "Error: state stack now");
2405 while (yyssp1 != yyssp)
2406 YYFPRINTF (stderr, " %d", *++yyssp1);
2407 YYFPRINTF (stderr, "\n");
2408 }
2409 #endif
2410 }
2411
2412 if (yyn == YYFINAL)
2413 YYACCEPT;
2414
2415 YYDPRINTF ((stderr, "Shifting error token, "));
2416
2417 *++yyvsp = yylval;
2418
2419
2420 yystate = yyn;
2421 goto yynewstate;
2422
2423
2424 /*-------------------------------------.
2425 | yyacceptlab -- YYACCEPT comes here. |
2426 `-------------------------------------*/
2427 yyacceptlab:
2428 yyresult = 0;
2429 goto yyreturn;
2430
2431 /*-----------------------------------.
2432 | yyabortlab -- YYABORT comes here. |
2433 `-----------------------------------*/
2434 yyabortlab:
2435 yyresult = 1;
2436 goto yyreturn;
2437
2438 #ifndef yyoverflow
2439 /*----------------------------------------------.
2440 | yyoverflowlab -- parser overflow comes here. |
2441 `----------------------------------------------*/
2442 yyoverflowlab:
2443 yyerror ("parser stack overflow");
2444 yyresult = 2;
2445 /* Fall through. */
2446 #endif
2447
2448 yyreturn:
2449 #ifndef yyoverflow
2450 if (yyss != yyssa)
2451 YYSTACK_FREE (yyss);
2452 #endif
2453 return yyresult;
2454 }
2455
2456
2457
2458
2459