diff options
author | Jari Aalto <jari.aalto@cante.net> | 2004-07-27 13:29:18 +0000 |
---|---|---|
committer | Jari Aalto <jari.aalto@cante.net> | 2009-09-12 16:46:56 +0000 |
commit | b80f6443b6b7b620c7272664c66ecb0b120a0998 (patch) | |
tree | 9f71c98d8fe8fa0f41d95e1eb4227f32a09d43ca /y.tab.c | |
parent | 7117c2d221b2aed4ede8600f6a36b7c1454b4f55 (diff) | |
download | bash-b80f6443b6b7b620c7272664c66ecb0b120a0998.tar.gz |
Imported from ../bash-3.0.tar.gz.
Diffstat (limited to 'y.tab.c')
-rw-r--r-- | y.tab.c | 3168 |
1 files changed, 1632 insertions, 1536 deletions
@@ -1,50 +1,51 @@ -/* A Bison parser, made from /usr/homes/chet/src/bash/src/parse.y - by GNU bison 1.34. */ + +/* A Bison parser, made from /Users/chet/src/bash/src/parse.y + by GNU Bison version 1.28 */ #define YYBISON 1 /* Identify Bison output. */ -# define IF 257 -# define THEN 258 -# define ELSE 259 -# define ELIF 260 -# define FI 261 -# define CASE 262 -# define ESAC 263 -# define FOR 264 -# define SELECT 265 -# define WHILE 266 -# define UNTIL 267 -# define DO 268 -# define DONE 269 -# define FUNCTION 270 -# define COND_START 271 -# define COND_END 272 -# define COND_ERROR 273 -# define IN 274 -# define BANG 275 -# define TIME 276 -# define TIMEOPT 277 -# define WORD 278 -# define ASSIGNMENT_WORD 279 -# define NUMBER 280 -# define ARITH_CMD 281 -# define ARITH_FOR_EXPRS 282 -# define COND_CMD 283 -# define AND_AND 284 -# define OR_OR 285 -# define GREATER_GREATER 286 -# define LESS_LESS 287 -# define LESS_AND 288 -# define LESS_LESS_LESS 289 -# define GREATER_AND 290 -# define SEMI_SEMI 291 -# define LESS_LESS_MINUS 292 -# define AND_GREATER 293 -# define LESS_GREATER 294 -# define GREATER_BAR 295 -# define yacc_EOF 296 - -#line 21 "/usr/homes/chet/src/bash/src/parse.y" +#define IF 257 +#define THEN 258 +#define ELSE 259 +#define ELIF 260 +#define FI 261 +#define CASE 262 +#define ESAC 263 +#define FOR 264 +#define SELECT 265 +#define WHILE 266 +#define UNTIL 267 +#define DO 268 +#define DONE 269 +#define FUNCTION 270 +#define COND_START 271 +#define COND_END 272 +#define COND_ERROR 273 +#define IN 274 +#define BANG 275 +#define TIME 276 +#define TIMEOPT 277 +#define WORD 278 +#define ASSIGNMENT_WORD 279 +#define NUMBER 280 +#define ARITH_CMD 281 +#define ARITH_FOR_EXPRS 282 +#define COND_CMD 283 +#define AND_AND 284 +#define OR_OR 285 +#define GREATER_GREATER 286 +#define LESS_LESS 287 +#define LESS_AND 288 +#define LESS_LESS_LESS 289 +#define GREATER_AND 290 +#define SEMI_SEMI 291 +#define LESS_LESS_MINUS 292 +#define AND_GREATER 293 +#define LESS_GREATER 294 +#define GREATER_BAR 295 +#define yacc_EOF 296 + +#line 21 "/Users/chet/src/bash/src/parse.y" #include "config.h" @@ -67,6 +68,8 @@ #include "memalloc.h" +#include "bashintl.h" + #define NEED_STRFTIME_DECL /* used in externs.h */ #include "shell.h" @@ -96,6 +99,8 @@ #if defined (ALIAS) # include "alias.h" +#else +typedef void *alias_t; #endif /* ALIAS */ #if defined (PROMPT_STRING_DECODE) @@ -198,7 +203,7 @@ static char *parse_compound_assignment __P((int *)); #endif #if defined (DPAREN_ARITHMETIC) || defined (ARITH_FOR_COMMAND) static int parse_dparen __P((int)); -static int parse_arith_cmd __P((char **)); +static int parse_arith_cmd __P((char **, int)); #endif #if defined (COND_COMMAND) static void cond_error __P((void)); @@ -266,6 +271,11 @@ int expand_aliases = 0; decode_prompt_string. */ int promptvars = 1; +/* If non-zero, $'...' and $"..." are expanded when they appear within + a ${...} expansion, even when the expansion appears within double + quotes. */ +int extended_quote = 1; + /* The decoded prompt string. Used if READLINE is not defined or if editing is turned off. Analogous to current_readline_prompt. */ static char *current_decoded_prompt; @@ -297,10 +307,23 @@ static int function_bstart; /* The line number in a script at which an arithmetic for command starts. */ static int arith_for_lineno; +/* The line number in a script where the word in a `case WORD', `select WORD' + or `for WORD' begins. This is a nested command maximum, since the array + index is decremented after a case, select, or for command is parsed. */ +#define MAX_CASE_NEST 128 +static int word_lineno[MAX_CASE_NEST]; +static int word_top = -1; + +/* If non-zero, it is the token that we want read_token to return + regardless of what text is (or isn't) present to be read. This + is reset by read_token. If token_to_read == WORD or + ASSIGNMENT_WORD, yylval.word should be set to word_desc_to_read. */ +static int token_to_read; +static WORD_DESC *word_desc_to_read; + static REDIRECTEE redir; -#line 276 "/usr/homes/chet/src/bash/src/parse.y" -#ifndef YYSTYPE +#line 299 "/Users/chet/src/bash/src/parse.y" typedef union { WORD_DESC *word; /* the word that we read. */ int number; /* the number that we read. */ @@ -309,454 +332,428 @@ typedef union { REDIRECT *redirect; ELEMENT element; PATTERN_LIST *pattern; -} yystype; -# define YYSTYPE yystype +} YYSTYPE; +#include <stdio.h> + +#ifndef __cplusplus +#ifndef __STDC__ +#define const #endif -#ifndef YYDEBUG -# define YYDEBUG 0 #endif -#define YYFINAL 301 +#define YYFINAL 302 #define YYFLAG -32768 #define YYNTBASE 54 -/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ #define YYTRANSLATE(x) ((unsigned)(x) <= 296 ? yytranslate[x] : 90) -/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ -static const char yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 44, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 42, 2, - 52, 53, 2, 2, 2, 49, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 43, - 48, 2, 47, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 50, 46, 51, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 45 +static const char yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 44, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 42, 2, 52, + 53, 2, 2, 2, 49, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 43, 48, + 2, 47, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 50, 46, 51, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 45 }; -#if YYDEBUG -static const short yyprhs[] = -{ - 0, 0, 3, 5, 8, 10, 12, 15, 18, 21, - 25, 29, 32, 36, 39, 43, 46, 50, 53, 57, - 60, 64, 67, 71, 74, 78, 81, 85, 88, 92, - 95, 99, 102, 106, 109, 112, 116, 118, 120, 122, - 124, 127, 129, 132, 134, 136, 139, 141, 143, 145, - 151, 157, 159, 161, 163, 165, 167, 169, 171, 178, - 185, 193, 201, 212, 223, 233, 243, 251, 259, 265, - 271, 278, 285, 293, 301, 312, 323, 330, 338, 345, - 351, 358, 363, 365, 368, 372, 378, 386, 393, 397, - 399, 403, 408, 415, 421, 423, 426, 431, 436, 442, - 448, 451, 455, 457, 461, 464, 466, 469, 473, 477, - 481, 486, 491, 496, 501, 506, 508, 510, 512, 514, - 516, 518, 519, 522, 524, 527, 530, 535, 540, 544, - 548, 550, 552, 555, 558, 562, 566, 571, 573, 575 +#if YYDEBUG != 0 +static const short yyprhs[] = { 0, + 0, 3, 5, 8, 10, 12, 15, 18, 21, 25, + 29, 32, 36, 39, 43, 46, 50, 53, 57, 60, + 64, 67, 71, 74, 78, 81, 85, 88, 92, 95, + 99, 102, 106, 109, 112, 116, 118, 120, 122, 124, + 127, 129, 132, 134, 136, 139, 141, 143, 145, 151, + 157, 159, 161, 163, 165, 167, 169, 171, 178, 185, + 193, 201, 212, 223, 233, 243, 251, 259, 265, 271, + 278, 285, 293, 301, 312, 323, 330, 338, 345, 351, + 358, 363, 365, 368, 372, 378, 386, 393, 397, 399, + 403, 408, 415, 421, 423, 426, 431, 436, 442, 448, + 451, 455, 457, 461, 464, 466, 469, 473, 477, 481, + 486, 491, 496, 501, 506, 508, 510, 512, 514, 516, + 518, 519, 522, 524, 527, 530, 535, 540, 544, 548, + 550, 552, 555, 558, 562, 566, 569, 574, 576, 578 }; -static const short yyrhs[] = -{ - 85, 82, 0, 44, 0, 1, 44, 0, 45, 0, - 24, 0, 55, 24, 0, 47, 24, 0, 48, 24, - 0, 26, 47, 24, 0, 26, 48, 24, 0, 32, - 24, 0, 26, 32, 24, 0, 33, 24, 0, 26, - 33, 24, 0, 35, 24, 0, 26, 35, 24, 0, - 34, 26, 0, 26, 34, 26, 0, 36, 26, 0, - 26, 36, 26, 0, 34, 24, 0, 26, 34, 24, - 0, 36, 24, 0, 26, 36, 24, 0, 38, 24, - 0, 26, 38, 24, 0, 36, 49, 0, 26, 36, - 49, 0, 34, 49, 0, 26, 34, 49, 0, 39, - 24, 0, 26, 40, 24, 0, 40, 24, 0, 41, - 24, 0, 26, 41, 24, 0, 24, 0, 25, 0, - 56, 0, 56, 0, 58, 56, 0, 57, 0, 59, - 57, 0, 59, 0, 61, 0, 61, 58, 0, 66, - 0, 62, 0, 65, 0, 12, 79, 14, 79, 15, - 0, 13, 79, 14, 79, 15, 0, 64, 0, 69, - 0, 68, 0, 70, 0, 71, 0, 72, 0, 63, - 0, 10, 24, 84, 14, 79, 15, 0, 10, 24, - 84, 50, 79, 51, 0, 10, 24, 43, 84, 14, - 79, 15, 0, 10, 24, 43, 84, 50, 79, 51, - 0, 10, 24, 84, 20, 55, 83, 84, 14, 79, - 15, 0, 10, 24, 84, 20, 55, 83, 84, 50, - 79, 51, 0, 10, 24, 84, 20, 83, 84, 14, - 79, 15, 0, 10, 24, 84, 20, 83, 84, 50, - 79, 51, 0, 10, 28, 83, 84, 14, 79, 15, - 0, 10, 28, 83, 84, 50, 79, 51, 0, 10, - 28, 14, 79, 15, 0, 10, 28, 50, 79, 51, - 0, 11, 24, 84, 14, 78, 15, 0, 11, 24, - 84, 50, 78, 51, 0, 11, 24, 43, 84, 14, - 78, 15, 0, 11, 24, 43, 84, 50, 78, 51, - 0, 11, 24, 84, 20, 55, 83, 84, 14, 78, - 15, 0, 11, 24, 84, 20, 55, 83, 84, 50, - 78, 51, 0, 8, 24, 84, 20, 84, 9, 0, - 8, 24, 84, 20, 76, 84, 9, 0, 8, 24, - 84, 20, 74, 9, 0, 24, 52, 53, 84, 67, - 0, 16, 24, 52, 53, 84, 67, 0, 16, 24, - 84, 67, 0, 61, 0, 61, 58, 0, 52, 79, - 53, 0, 3, 79, 4, 79, 7, 0, 3, 79, - 4, 79, 5, 79, 7, 0, 3, 79, 4, 79, - 73, 7, 0, 50, 79, 51, 0, 27, 0, 17, - 29, 18, 0, 6, 79, 4, 79, 0, 6, 79, - 4, 79, 5, 79, 0, 6, 79, 4, 79, 73, - 0, 75, 0, 76, 75, 0, 84, 77, 53, 79, - 0, 84, 77, 53, 84, 0, 84, 52, 77, 53, - 79, 0, 84, 52, 77, 53, 84, 0, 75, 37, - 0, 76, 75, 37, 0, 24, 0, 77, 46, 24, - 0, 84, 80, 0, 78, 0, 84, 81, 0, 81, - 44, 84, 0, 81, 42, 84, 0, 81, 43, 84, - 0, 81, 30, 84, 81, 0, 81, 31, 84, 81, - 0, 81, 42, 84, 81, 0, 81, 43, 84, 81, - 0, 81, 44, 84, 81, 0, 87, 0, 44, 0, - 45, 0, 44, 0, 43, 0, 45, 0, 0, 84, - 44, 0, 86, 0, 86, 42, 0, 86, 43, 0, - 86, 30, 84, 86, 0, 86, 31, 84, 86, 0, - 86, 42, 86, 0, 86, 43, 86, 0, 87, 0, - 88, 0, 21, 88, 0, 89, 88, 0, 89, 21, - 88, 0, 21, 89, 88, 0, 88, 46, 84, 88, - 0, 60, 0, 22, 0, 22, 23, 0 + +static const short yyrhs[] = { 85, + 82, 0, 44, 0, 1, 44, 0, 45, 0, 24, + 0, 55, 24, 0, 47, 24, 0, 48, 24, 0, + 26, 47, 24, 0, 26, 48, 24, 0, 32, 24, + 0, 26, 32, 24, 0, 33, 24, 0, 26, 33, + 24, 0, 35, 24, 0, 26, 35, 24, 0, 34, + 26, 0, 26, 34, 26, 0, 36, 26, 0, 26, + 36, 26, 0, 34, 24, 0, 26, 34, 24, 0, + 36, 24, 0, 26, 36, 24, 0, 38, 24, 0, + 26, 38, 24, 0, 36, 49, 0, 26, 36, 49, + 0, 34, 49, 0, 26, 34, 49, 0, 39, 24, + 0, 26, 40, 24, 0, 40, 24, 0, 41, 24, + 0, 26, 41, 24, 0, 24, 0, 25, 0, 56, + 0, 56, 0, 58, 56, 0, 57, 0, 59, 57, + 0, 59, 0, 61, 0, 61, 58, 0, 66, 0, + 62, 0, 65, 0, 12, 79, 14, 79, 15, 0, + 13, 79, 14, 79, 15, 0, 64, 0, 69, 0, + 68, 0, 70, 0, 71, 0, 72, 0, 63, 0, + 10, 24, 84, 14, 79, 15, 0, 10, 24, 84, + 50, 79, 51, 0, 10, 24, 43, 84, 14, 79, + 15, 0, 10, 24, 43, 84, 50, 79, 51, 0, + 10, 24, 84, 20, 55, 83, 84, 14, 79, 15, + 0, 10, 24, 84, 20, 55, 83, 84, 50, 79, + 51, 0, 10, 24, 84, 20, 83, 84, 14, 79, + 15, 0, 10, 24, 84, 20, 83, 84, 50, 79, + 51, 0, 10, 28, 83, 84, 14, 79, 15, 0, + 10, 28, 83, 84, 50, 79, 51, 0, 10, 28, + 14, 79, 15, 0, 10, 28, 50, 79, 51, 0, + 11, 24, 84, 14, 78, 15, 0, 11, 24, 84, + 50, 78, 51, 0, 11, 24, 43, 84, 14, 78, + 15, 0, 11, 24, 43, 84, 50, 78, 51, 0, + 11, 24, 84, 20, 55, 83, 84, 14, 78, 15, + 0, 11, 24, 84, 20, 55, 83, 84, 50, 78, + 51, 0, 8, 24, 84, 20, 84, 9, 0, 8, + 24, 84, 20, 76, 84, 9, 0, 8, 24, 84, + 20, 74, 9, 0, 24, 52, 53, 84, 67, 0, + 16, 24, 52, 53, 84, 67, 0, 16, 24, 84, + 67, 0, 61, 0, 61, 58, 0, 52, 79, 53, + 0, 3, 79, 4, 79, 7, 0, 3, 79, 4, + 79, 5, 79, 7, 0, 3, 79, 4, 79, 73, + 7, 0, 50, 79, 51, 0, 27, 0, 17, 29, + 18, 0, 6, 79, 4, 79, 0, 6, 79, 4, + 79, 5, 79, 0, 6, 79, 4, 79, 73, 0, + 75, 0, 76, 75, 0, 84, 77, 53, 79, 0, + 84, 77, 53, 84, 0, 84, 52, 77, 53, 79, + 0, 84, 52, 77, 53, 84, 0, 75, 37, 0, + 76, 75, 37, 0, 24, 0, 77, 46, 24, 0, + 84, 80, 0, 78, 0, 84, 81, 0, 81, 44, + 84, 0, 81, 42, 84, 0, 81, 43, 84, 0, + 81, 30, 84, 81, 0, 81, 31, 84, 81, 0, + 81, 42, 84, 81, 0, 81, 43, 84, 81, 0, + 81, 44, 84, 81, 0, 87, 0, 44, 0, 45, + 0, 44, 0, 43, 0, 45, 0, 0, 84, 44, + 0, 86, 0, 86, 42, 0, 86, 43, 0, 86, + 30, 84, 86, 0, 86, 31, 84, 86, 0, 86, + 42, 86, 0, 86, 43, 86, 0, 87, 0, 88, + 0, 21, 88, 0, 89, 88, 0, 89, 21, 88, + 0, 21, 89, 88, 0, 89, 83, 0, 88, 46, + 84, 88, 0, 60, 0, 22, 0, 22, 23, 0 }; #endif -#if YYDEBUG -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const short yyrline[] = -{ - 0, 326, 335, 342, 357, 367, 369, 373, 378, 383, - 388, 393, 398, 403, 409, 415, 420, 425, 430, 435, - 440, 445, 450, 455, 460, 465, 472, 479, 484, 489, - 494, 499, 504, 509, 514, 519, 526, 528, 530, 534, - 538, 549, 551, 555, 557, 559, 575, 579, 581, 583, - 585, 587, 589, 591, 593, 595, 597, 599, 603, 605, - 607, 609, 611, 613, 615, 617, 621, 623, 625, 627, - 631, 635, 639, 643, 647, 651, 657, 659, 661, 665, - 668, 671, 676, 678, 709, 716, 718, 720, 725, 729, - 733, 737, 739, 741, 745, 746, 750, 752, 754, 756, - 760, 761, 765, 767, 776, 784, 785, 791, 792, 799, - 803, 805, 807, 814, 816, 818, 822, 823, 826, 827, - 828, 831, 832, 841, 847, 856, 864, 866, 868, 875, - 878, 882, 884, 889, 894, 899, 906, 909, 913, 915 +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 350, 359, 366, 381, 391, 393, 397, 402, 407, 412, + 417, 422, 427, 433, 439, 444, 449, 454, 459, 464, + 469, 474, 479, 484, 489, 496, 503, 508, 513, 518, + 523, 528, 533, 538, 543, 550, 552, 554, 558, 562, + 573, 575, 579, 581, 583, 599, 603, 605, 607, 609, + 611, 613, 615, 617, 619, 621, 623, 627, 632, 637, + 642, 647, 652, 657, 662, 669, 674, 679, 684, 691, + 696, 701, 706, 711, 716, 723, 728, 733, 740, 743, + 746, 751, 753, 784, 791, 793, 795, 800, 804, 808, + 812, 814, 816, 820, 821, 825, 827, 829, 831, 835, + 836, 840, 842, 851, 859, 860, 866, 867, 874, 878, + 880, 882, 889, 891, 893, 897, 898, 901, 903, 905, + 909, 910, 919, 925, 934, 942, 944, 946, 953, 956, + 960, 962, 967, 972, 977, 982, 1002, 1005, 1009, 1011 }; #endif -#if (YYDEBUG) || defined YYERROR_VERBOSE - -/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ -static const char *const yytname[] = -{ - "$", "error", "$undefined.", "IF", "THEN", "ELSE", "ELIF", "FI", "CASE", - "ESAC", "FOR", "SELECT", "WHILE", "UNTIL", "DO", "DONE", "FUNCTION", - "COND_START", "COND_END", "COND_ERROR", "IN", "BANG", "TIME", "TIMEOPT", - "WORD", "ASSIGNMENT_WORD", "NUMBER", "ARITH_CMD", "ARITH_FOR_EXPRS", - "COND_CMD", "AND_AND", "OR_OR", "GREATER_GREATER", "LESS_LESS", - "LESS_AND", "LESS_LESS_LESS", "GREATER_AND", "SEMI_SEMI", - "LESS_LESS_MINUS", "AND_GREATER", "LESS_GREATER", "GREATER_BAR", "'&'", - "';'", "'\\n'", "yacc_EOF", "'|'", "'>'", "'<'", "'-'", "'{'", "'}'", - "'('", "')'", "inputunit", "word_list", "redirection", - "simple_command_element", "redirection_list", "simple_command", - "command", "shell_command", "for_command", "arith_for_command", - "select_command", "case_command", "function_def", "function_body", - "subshell", "if_command", "group_command", "arith_command", - "cond_command", "elif_clause", "case_clause", "pattern_list", - "case_clause_sequence", "pattern", "list", "compound_list", "list0", - "list1", "simple_list_terminator", "list_terminator", "newline_list", - "simple_list", "simple_list1", "pipeline_command", "pipeline", - "timespec", 0 +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) + +static const char * const yytname[] = { "$","error","$undefined.","IF","THEN", +"ELSE","ELIF","FI","CASE","ESAC","FOR","SELECT","WHILE","UNTIL","DO","DONE", +"FUNCTION","COND_START","COND_END","COND_ERROR","IN","BANG","TIME","TIMEOPT", +"WORD","ASSIGNMENT_WORD","NUMBER","ARITH_CMD","ARITH_FOR_EXPRS","COND_CMD","AND_AND", +"OR_OR","GREATER_GREATER","LESS_LESS","LESS_AND","LESS_LESS_LESS","GREATER_AND", +"SEMI_SEMI","LESS_LESS_MINUS","AND_GREATER","LESS_GREATER","GREATER_BAR","'&'", +"';'","'\\n'","yacc_EOF","'|'","'>'","'<'","'-'","'{'","'}'","'('","')'","inputunit", +"word_list","redirection","simple_command_element","redirection_list","simple_command", +"command","shell_command","for_command","arith_for_command","select_command", +"case_command","function_def","function_body","subshell","if_command","group_command", +"arith_command","cond_command","elif_clause","case_clause","pattern_list","case_clause_sequence", +"pattern","list","compound_list","list0","list1","simple_list_terminator","list_terminator", +"newline_list","simple_list","simple_list1","pipeline_command","pipeline","timespec", NULL }; #endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const short yyr1[] = -{ - 0, 54, 54, 54, 54, 55, 55, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, - 56, 56, 56, 56, 56, 56, 57, 57, 57, 58, - 58, 59, 59, 60, 60, 60, 60, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 62, 62, - 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, - 64, 64, 64, 64, 64, 64, 65, 65, 65, 66, - 66, 66, 67, 67, 68, 69, 69, 69, 70, 71, - 72, 73, 73, 73, 74, 74, 75, 75, 75, 75, - 76, 76, 77, 77, 78, 79, 79, 80, 80, 80, - 81, 81, 81, 81, 81, 81, 82, 82, 83, 83, - 83, 84, 84, 85, 85, 85, 86, 86, 86, 86, - 86, 87, 87, 87, 87, 87, 88, 88, 89, 89 +static const short yyr1[] = { 0, + 54, 54, 54, 54, 55, 55, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 57, 57, 57, 58, 58, + 59, 59, 60, 60, 60, 60, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 62, 62, 62, + 62, 62, 62, 62, 62, 63, 63, 63, 63, 64, + 64, 64, 64, 64, 64, 65, 65, 65, 66, 66, + 66, 67, 67, 68, 69, 69, 69, 70, 71, 72, + 73, 73, 73, 74, 74, 75, 75, 75, 75, 76, + 76, 77, 77, 78, 79, 79, 80, 80, 80, 81, + 81, 81, 81, 81, 81, 82, 82, 83, 83, 83, + 84, 84, 85, 85, 85, 86, 86, 86, 86, 86, + 87, 87, 87, 87, 87, 87, 88, 88, 89, 89 }; -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const short yyr2[] = -{ - 0, 2, 1, 2, 1, 1, 2, 2, 2, 3, - 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, - 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, - 3, 2, 3, 2, 2, 3, 1, 1, 1, 1, - 2, 1, 2, 1, 1, 2, 1, 1, 1, 5, - 5, 1, 1, 1, 1, 1, 1, 1, 6, 6, - 7, 7, 10, 10, 9, 9, 7, 7, 5, 5, - 6, 6, 7, 7, 10, 10, 6, 7, 6, 5, - 6, 4, 1, 2, 3, 5, 7, 6, 3, 1, - 3, 4, 6, 5, 1, 2, 4, 4, 5, 5, - 2, 3, 1, 3, 2, 1, 2, 3, 3, 3, - 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, - 1, 0, 2, 1, 2, 2, 4, 4, 3, 3, - 1, 1, 2, 2, 3, 3, 4, 1, 1, 2 +static const short yyr2[] = { 0, + 2, 1, 2, 1, 1, 2, 2, 2, 3, 3, + 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, + 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, + 2, 3, 2, 2, 3, 1, 1, 1, 1, 2, + 1, 2, 1, 1, 2, 1, 1, 1, 5, 5, + 1, 1, 1, 1, 1, 1, 1, 6, 6, 7, + 7, 10, 10, 9, 9, 7, 7, 5, 5, 6, + 6, 7, 7, 10, 10, 6, 7, 6, 5, 6, + 4, 1, 2, 3, 5, 7, 6, 3, 1, 3, + 4, 6, 5, 1, 2, 4, 4, 5, 5, 2, + 3, 1, 3, 2, 1, 2, 3, 3, 3, 4, + 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, + 0, 2, 1, 2, 2, 4, 4, 3, 3, 1, + 1, 2, 2, 3, 3, 2, 4, 1, 1, 2 }; -/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE - doesn't specify something else to do. Zero means the default is an - error. */ -static const short yydefact[] = -{ - 0, 0, 121, 0, 0, 0, 121, 121, 0, 0, - 0, 138, 36, 37, 0, 89, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 2, 4, 0, 0, 121, - 121, 38, 41, 43, 137, 44, 47, 57, 51, 48, - 46, 53, 52, 54, 55, 56, 0, 123, 130, 131, - 0, 3, 105, 0, 0, 121, 121, 0, 121, 0, - 0, 121, 0, 132, 0, 139, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 11, 13, 21, - 17, 29, 15, 23, 19, 27, 25, 31, 33, 34, - 7, 8, 0, 0, 36, 42, 39, 45, 116, 117, - 1, 121, 121, 124, 125, 121, 0, 133, 121, 122, - 104, 106, 115, 0, 121, 0, 121, 119, 118, 120, - 121, 121, 121, 0, 121, 121, 0, 0, 90, 135, - 121, 12, 14, 22, 18, 30, 16, 24, 20, 28, - 26, 32, 35, 9, 10, 88, 84, 40, 0, 0, - 128, 129, 0, 134, 0, 121, 121, 121, 121, 121, - 121, 0, 121, 0, 121, 0, 0, 0, 0, 121, - 0, 121, 0, 0, 121, 82, 81, 0, 126, 127, - 0, 0, 136, 121, 121, 85, 0, 0, 0, 108, - 109, 107, 0, 94, 121, 0, 121, 121, 0, 5, - 0, 121, 0, 68, 69, 121, 121, 121, 121, 0, - 0, 0, 0, 49, 50, 0, 83, 79, 0, 0, - 87, 110, 111, 112, 113, 114, 78, 100, 95, 0, - 76, 102, 0, 0, 0, 0, 58, 6, 121, 0, - 59, 0, 0, 0, 0, 70, 0, 121, 71, 80, - 86, 121, 121, 121, 121, 101, 77, 0, 0, 121, - 60, 61, 0, 121, 121, 66, 67, 72, 73, 0, - 91, 0, 0, 0, 121, 103, 96, 97, 121, 121, - 0, 0, 121, 121, 121, 93, 98, 99, 0, 0, - 64, 65, 0, 0, 92, 62, 63, 74, 75, 0, - 0, 0 +static const short yydefact[] = { 0, + 0, 121, 0, 0, 0, 121, 121, 0, 0, 0, + 139, 36, 37, 0, 89, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 4, 0, 0, 121, 121, + 38, 41, 43, 138, 44, 47, 57, 51, 48, 46, + 53, 52, 54, 55, 56, 0, 123, 130, 131, 0, + 3, 105, 0, 0, 121, 121, 0, 121, 0, 0, + 121, 0, 132, 0, 140, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 11, 13, 21, 17, + 29, 15, 23, 19, 27, 25, 31, 33, 34, 7, + 8, 0, 0, 36, 42, 39, 45, 116, 117, 1, + 121, 121, 124, 125, 121, 0, 119, 118, 120, 136, + 133, 121, 122, 104, 106, 115, 0, 121, 0, 121, + 121, 121, 121, 0, 121, 121, 0, 0, 90, 135, + 121, 12, 14, 22, 18, 30, 16, 24, 20, 28, + 26, 32, 35, 9, 10, 88, 84, 40, 0, 0, + 128, 129, 0, 134, 0, 121, 121, 121, 121, 121, + 121, 0, 121, 0, 121, 0, 0, 0, 0, 121, + 0, 121, 0, 0, 121, 82, 81, 0, 126, 127, + 0, 0, 137, 121, 121, 85, 0, 0, 0, 108, + 109, 107, 0, 94, 121, 0, 121, 121, 0, 5, + 0, 121, 0, 68, 69, 121, 121, 121, 121, 0, + 0, 0, 0, 49, 50, 0, 83, 79, 0, 0, + 87, 110, 111, 112, 113, 114, 78, 100, 95, 0, + 76, 102, 0, 0, 0, 0, 58, 6, 121, 0, + 59, 0, 0, 0, 0, 70, 0, 121, 71, 80, + 86, 121, 121, 121, 121, 101, 77, 0, 0, 121, + 60, 61, 0, 121, 121, 66, 67, 72, 73, 0, + 91, 0, 0, 0, 121, 103, 96, 97, 121, 121, + 0, 0, 121, 121, 121, 93, 98, 99, 0, 0, + 64, 65, 0, 0, 92, 62, 63, 74, 75, 0, + 0, 0 }; -static const short yydefgoto[] = -{ - 299, 200, 31, 32, 97, 33, 34, 35, 36, 37, - 38, 39, 40, 176, 41, 42, 43, 44, 45, 186, - 192, 193, 194, 233, 52, 53, 110, 111, 100, 121, - 54, 46, 150, 112, 49, 50 +static const short yydefgoto[] = { 300, + 201, 31, 32, 97, 33, 34, 35, 36, 37, 38, + 39, 40, 177, 41, 42, 43, 44, 45, 187, 193, + 194, 195, 234, 52, 53, 114, 115, 100, 110, 54, + 46, 151, 116, 49, 50 }; -static const short yypact[] = -{ - 273, -24,-32768, -2, 11, 6,-32768,-32768, 12, 9, - 402, 41, 10,-32768, 552,-32768, 46, 52, -5, 58, - 64, 68, 102, 117, 135,-32768,-32768, 146, 149,-32768, - -32768,-32768,-32768, 169,-32768, 202,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768, -33, 42,-32768, 91, - 445,-32768,-32768, 142, 316,-32768, 133, 72, 136, 172, - 174, 97, 171, 91, 531,-32768, 139, 173, 182, 99, - 188, 138, 189, 190, 191, 194, 195,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768, 145, 168,-32768,-32768,-32768, 202,-32768,-32768, - -32768,-32768,-32768, 359, 359,-32768, 531, 91,-32768,-32768, - -32768, 249,-32768, -12,-32768, 13,-32768,-32768,-32768,-32768, - -32768,-32768,-32768, 57,-32768,-32768, 170, 39,-32768, 91, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 316, 316, - 28, 28, 488, 91, 74,-32768,-32768,-32768,-32768,-32768, - -32768, 90,-32768, 220,-32768, 183, 178, 110, 113,-32768, - 198,-32768, 209, 215,-32768, 202,-32768, 39,-32768,-32768, - 359, 359, 91,-32768,-32768,-32768, 224, 316, 316, 316, - 316, 316, 230, 196,-32768, 16,-32768,-32768, 231,-32768, - 258,-32768, 197,-32768,-32768,-32768,-32768,-32768,-32768, 236, - 316, 258, 201,-32768,-32768, 39, 202,-32768, 247, 255, - -32768,-32768,-32768, 66, 66, 66,-32768,-32768, 223, 17, - -32768,-32768, 237, 92, 251, 211,-32768,-32768,-32768, 121, - -32768, 252, 218, 256, 219,-32768, 249,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768,-32768, 115, 253,-32768, - -32768,-32768, 122,-32768,-32768,-32768,-32768,-32768,-32768, 125, - 106, 316, 316, 316,-32768,-32768,-32768, 316,-32768,-32768, - 260, 245,-32768,-32768,-32768,-32768,-32768, 316, 272, 259, - -32768,-32768, 289, 264,-32768,-32768,-32768,-32768,-32768, 288, - 322,-32768 +static const short yypact[] = { 274, + -23,-32768, 5, 55, 10,-32768,-32768, 21, 31, 446, + 32, 19,-32768, 553,-32768, 56, 72, -12, 89, -11, + 92, 102, 111, 113,-32768,-32768, 117, 124,-32768,-32768, +-32768,-32768, 183,-32768, 202,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768, -13, 134,-32768, 52, 317, +-32768,-32768, 148, 360,-32768, 115, 22, 120, 154, 173, + 114, 155, 52, 532,-32768, 140, 180, 181, 101, 182, + 112, 186, 188, 189, 190, 205,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768, 193, 195,-32768,-32768,-32768, 202,-32768,-32768,-32768, +-32768,-32768, 403, 403,-32768, 532,-32768,-32768,-32768,-32768, + 52,-32768,-32768,-32768, 221,-32768, -9,-32768, 42,-32768, +-32768,-32768,-32768, 61,-32768,-32768, 200, 41,-32768, 52, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 360, 360, + 152, 152, 489, 52, 192,-32768,-32768,-32768,-32768,-32768, +-32768, 26,-32768, 127,-32768, 218, 194, 34, 73,-32768, + 215,-32768, 242, 245,-32768, 202,-32768, 41,-32768,-32768, + 403, 403, 52,-32768,-32768,-32768, 254, 360, 360, 360, + 360, 360, 253, 229,-32768, -2,-32768,-32768, 252,-32768, + 151,-32768, 217,-32768,-32768,-32768,-32768,-32768,-32768, 255, + 360, 151, 220,-32768,-32768, 41, 202,-32768, 265, 272, +-32768,-32768,-32768, 159, 159, 159,-32768,-32768, 241, 17, +-32768,-32768, 256, 36, 266, 232,-32768,-32768,-32768, 74, +-32768, 273, 238, 277, 243,-32768, 221,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768, 116, 269,-32768, +-32768,-32768, 90,-32768,-32768,-32768,-32768,-32768,-32768, 95, + 197, 360, 360, 360,-32768,-32768,-32768, 360,-32768,-32768, + 282, 251,-32768,-32768,-32768,-32768,-32768, 360, 288, 260, +-32768,-32768, 289, 280,-32768,-32768,-32768,-32768,-32768, 305, + 316,-32768 }; -static const short yypgoto[] = -{ - -32768, 160, -32, 283, 156,-32768,-32768, -122,-32768,-32768, - -32768,-32768,-32768, -167,-32768,-32768,-32768,-32768,-32768, 65, - -32768, 140,-32768, 104, -162, -6,-32768, -173,-32768, -157, - -27,-32768, 4, 2, 3, 329 +static const short yypgoto[] = {-32768, + 146, -33, 290, 156,-32768,-32768, -119,-32768,-32768,-32768, +-32768,-32768, -153,-32768,-32768,-32768,-32768,-32768, 64,-32768, + 141,-32768, 104, -162, -6,-32768, -172,-32768, -52, -28, +-32768, 6, 4, -7, 329 }; -#define YYLAST 600 - - -static const short yytable[] = -{ - 59, 60, 48, 96, 47, 175, 201, 209, 160, 212, - 217, 98, 99, 63, 221, 222, 223, 224, 225, 79, - 51, 80, 55, 92, 93, 230, 256, 162, 113, 115, - 58, 123, 109, 163, 127, 56, 61, 246, 62, 57, - 231, 231, 2, 238, 81, 243, 244, 3, 249, 4, - 5, 6, 7, 107, 247, 175, 9, 109, 101, 102, - 109, 109, 66, 164, 65, 147, 15, 129, 232, 232, - 77, 169, 101, 102, 148, 149, 78, 170, 152, 183, - 184, 185, 82, 109, 103, 104, 116, 161, 83, 29, - 84, 30, 86, 175, 167, 168, 155, 156, 223, 224, - 225, 109, 154, 177, 196, 48, 48, 171, 151, 153, - 165, 284, 184, 85, 166, 117, 118, 119, 172, 173, - 292, 293, 120, 133, 205, 134, 87, 207, 187, 188, - 189, 190, 191, 195, 109, 263, 278, 105, 258, 282, - 197, 88, 210, 96, 210, 259, 108, 215, 135, 126, - 48, 48, 178, 179, 109, 182, 198, 109, 202, 89, - 206, 258, 137, 208, 138, 109, 109, 229, 274, 109, - 90, 264, 279, 91, 239, 283, 114, 218, 219, 122, - 210, 210, 48, 48, 147, 151, 124, 139, 125, 128, - 234, 235, 130, 94, 13, 14, 145, 131, 203, 241, - 242, 16, 17, 18, 19, 20, 132, 21, 22, 23, - 24, 262, 136, 140, 141, 142, 27, 28, 143, 144, - 269, 146, 199, 174, 213, 271, 272, 273, 14, 204, - 214, 220, 277, 227, 16, 17, 18, 19, 20, 226, - 21, 22, 23, 24, 199, 270, 236, 287, 240, 27, - 28, 245, 248, 276, 250, 210, 210, 280, 281, 251, - 255, 231, 261, 117, 118, 119, 260, 265, 286, 266, - 268, 267, 288, 289, 1, 290, 2, 275, 294, 155, - 156, 3, 237, 4, 5, 6, 7, 295, 300, 8, - 9, 157, 158, 159, 10, 11, 291, 12, 13, 14, - 15, 117, 118, 119, 297, 16, 17, 18, 19, 20, - 296, 21, 22, 23, 24, 298, 95, 25, 26, 2, - 27, 28, 301, 29, 3, 30, 4, 5, 6, 7, - 211, 216, 8, 9, 228, 285, 257, 10, 11, 64, - 12, 13, 14, 15, 0, 0, 0, 0, 16, 17, - 18, 19, 20, 0, 21, 22, 23, 24, 0, 0, - 109, 0, 2, 27, 28, 0, 29, 3, 30, 4, - 5, 6, 7, 0, 0, 8, 9, 0, 0, 0, - 10, 11, 0, 12, 13, 14, 15, 0, 0, 0, - 0, 16, 17, 18, 19, 20, 0, 21, 22, 23, - 24, 0, 0, 0, 0, 2, 27, 28, 0, 29, - 3, 30, 4, 5, 6, 7, 0, 0, 8, 9, - 0, 0, 0, 0, 11, 0, 12, 13, 14, 15, - 0, 0, 0, 0, 16, 17, 18, 19, 20, 0, - 21, 22, 23, 24, 0, 0, 0, 0, 2, 27, - 28, 0, 29, 3, 30, 4, 5, 6, 7, 0, - 0, 8, 9, 0, 0, 0, 106, 0, 0, 12, - 13, 14, 15, 0, 0, 0, 0, 16, 17, 18, - 19, 20, 0, 21, 22, 23, 24, 0, 0, 0, - 0, 2, 27, 28, 0, 29, 3, 30, 4, 5, - 6, 7, 0, 0, 8, 9, 0, 0, 0, 0, - 0, 0, 12, 13, 14, 15, 0, 0, 0, 0, - 16, 17, 18, 19, 20, 0, 21, 22, 23, 24, - 0, 0, 109, 0, 2, 27, 28, 0, 29, 3, - 30, 4, 5, 6, 7, 0, 0, 8, 9, 0, - 0, 0, 0, 0, 0, 12, 13, 14, 15, 0, - 0, 0, 0, 16, 17, 18, 19, 20, 0, 21, - 22, 23, 24, 0, 0, 0, 0, 0, 27, 28, - 0, 29, 0, 30, 67, 68, 69, 70, 71, 0, - 72, 0, 73, 74, 0, 0, 0, 0, 0, 75, - 76 +#define YYLAST 601 + + +static const short yytable[] = { 59, + 60, 96, 63, 48, 122, 47, 231, 210, 176, 213, + 161, 79, 83, 80, 84, 222, 223, 224, 225, 226, + 51, 232, 92, 93, 218, 257, 117, 119, 55, 124, + 98, 99, 128, 58, 113, 120, 81, 85, 247, 197, + 232, 113, 111, 2, 61, 244, 245, 206, 3, 233, + 4, 5, 6, 7, 65, 163, 130, 9, 176, 62, + 113, 164, 250, 148, 107, 108, 109, 15, 233, 113, + 66, 121, 149, 150, 170, 198, 153, 113, 56, 77, + 171, 259, 57, 207, 113, 113, 208, 264, 260, 162, + 29, 165, 30, 168, 169, 78, 176, 105, 154, 224, + 225, 226, 178, 279, 113, 155, 48, 48, 283, 152, + 172, 202, 82, 166, 167, 86, 113, 113, 173, 174, + 293, 294, 209, 265, 134, 87, 135, 188, 189, 190, + 191, 192, 196, 113, 88, 138, 89, 139, 113, 280, + 90, 211, 96, 211, 284, 183, 216, 91, 239, 136, + 200, 112, 48, 48, 179, 180, 199, 118, 203, 248, + 140, 259, 123, 101, 102, 127, 230, 125, 275, 107, + 108, 109, 129, 240, 238, 103, 104, 219, 220, 211, + 211, 101, 102, 148, 48, 48, 126, 152, 156, 157, + 235, 236, 131, 107, 108, 109, 184, 185, 186, 242, + 243, 285, 185, 132, 133, 137, 94, 13, 14, 141, + 263, 142, 143, 144, 16, 17, 18, 19, 20, 270, + 21, 22, 23, 24, 272, 273, 274, 14, 145, 27, + 28, 278, 204, 16, 17, 18, 19, 20, 200, 21, + 22, 23, 24, 146, 205, 271, 288, 147, 27, 28, + 156, 157, 175, 277, 211, 211, 214, 281, 282, 215, + 221, 227, 158, 159, 160, 228, 237, 241, 287, 246, + 249, 251, 289, 290, 1, 252, 2, 256, 295, 232, + 261, 3, 262, 4, 5, 6, 7, 266, 267, 8, + 9, 268, 276, 269, 10, 11, 291, 12, 13, 14, + 15, 292, 296, 298, 301, 16, 17, 18, 19, 20, + 297, 21, 22, 23, 24, 302, 212, 25, 26, 2, + 27, 28, 95, 29, 3, 30, 4, 5, 6, 7, + 299, 217, 8, 9, 286, 229, 258, 106, 64, 0, + 12, 13, 14, 15, 0, 0, 0, 0, 16, 17, + 18, 19, 20, 0, 21, 22, 23, 24, 0, 107, + 108, 109, 2, 27, 28, 0, 29, 3, 30, 4, + 5, 6, 7, 0, 0, 8, 9, 0, 0, 0, + 10, 11, 0, 12, 13, 14, 15, 0, 0, 0, + 0, 16, 17, 18, 19, 20, 0, 21, 22, 23, + 24, 0, 0, 113, 0, 2, 27, 28, 0, 29, + 3, 30, 4, 5, 6, 7, 0, 0, 8, 9, + 0, 0, 0, 10, 11, 0, 12, 13, 14, 15, + 0, 0, 0, 0, 16, 17, 18, 19, 20, 0, + 21, 22, 23, 24, 0, 0, 0, 0, 2, 27, + 28, 0, 29, 3, 30, 4, 5, 6, 7, 0, + 0, 8, 9, 0, 0, 0, 0, 11, 0, 12, + 13, 14, 15, 0, 0, 0, 0, 16, 17, 18, + 19, 20, 0, 21, 22, 23, 24, 0, 0, 0, + 0, 2, 27, 28, 0, 29, 3, 30, 4, 5, + 6, 7, 0, 0, 8, 9, 0, 0, 0, 0, + 0, 0, 12, 13, 14, 15, 0, 0, 0, 0, + 16, 17, 18, 19, 20, 0, 21, 22, 23, 24, + 0, 0, 113, 0, 2, 27, 28, 0, 29, 3, + 30, 4, 5, 6, 7, 0, 0, 8, 9, 0, + 0, 0, 0, 0, 0, 12, 13, 14, 15, 0, + 0, 0, 0, 16, 17, 18, 19, 20, 0, 21, + 22, 23, 24, 0, 0, 0, 0, 0, 27, 28, + 0, 29, 0, 30, 67, 68, 69, 70, 71, 0, + 72, 0, 73, 74, 0, 0, 0, 0, 0, 75, + 76 }; -static const short yycheck[] = -{ - 6, 7, 0, 35, 0, 127, 163, 169, 20, 171, - 177, 44, 45, 10, 187, 188, 189, 190, 191, 24, - 44, 26, 24, 29, 30, 9, 9, 14, 55, 56, - 24, 58, 44, 20, 61, 24, 24, 210, 29, 28, - 24, 24, 3, 200, 49, 207, 208, 8, 215, 10, - 11, 12, 13, 50, 211, 177, 17, 44, 30, 31, - 44, 44, 52, 50, 23, 97, 27, 64, 52, 52, - 24, 14, 30, 31, 101, 102, 24, 20, 105, 5, - 6, 7, 24, 44, 42, 43, 14, 114, 24, 50, - 26, 52, 24, 215, 121, 122, 30, 31, 271, 272, - 273, 44, 108, 130, 14, 103, 104, 50, 104, 106, - 116, 5, 6, 49, 120, 43, 44, 45, 124, 125, - 282, 283, 50, 24, 14, 26, 24, 14, 155, 156, - 157, 158, 159, 160, 44, 14, 14, 46, 46, 14, - 50, 24, 169, 175, 171, 53, 4, 174, 49, 52, - 148, 149, 148, 149, 44, 152, 162, 44, 164, 24, - 50, 46, 24, 50, 26, 44, 44, 194, 53, 44, - 24, 50, 50, 24, 201, 50, 43, 183, 184, 43, - 207, 208, 180, 181, 216, 181, 14, 49, 14, 18, - 196, 197, 53, 24, 25, 26, 51, 24, 15, 205, - 206, 32, 33, 34, 35, 36, 24, 38, 39, 40, - 41, 238, 24, 24, 24, 24, 47, 48, 24, 24, - 247, 53, 24, 53, 15, 252, 253, 254, 26, 51, - 15, 7, 259, 37, 32, 33, 34, 35, 36, 9, - 38, 39, 40, 41, 24, 251, 15, 274, 51, 47, - 48, 15, 51, 259, 7, 282, 283, 263, 264, 4, - 37, 24, 51, 43, 44, 45, 15, 15, 274, 51, - 51, 15, 278, 279, 1, 15, 3, 24, 284, 30, - 31, 8, 24, 10, 11, 12, 13, 15, 0, 16, - 17, 42, 43, 44, 21, 22, 51, 24, 25, 26, - 27, 43, 44, 45, 15, 32, 33, 34, 35, 36, - 51, 38, 39, 40, 41, 51, 33, 44, 45, 3, - 47, 48, 0, 50, 8, 52, 10, 11, 12, 13, - 170, 175, 16, 17, 194, 270, 232, 21, 22, 10, - 24, 25, 26, 27, -1, -1, -1, -1, 32, 33, - 34, 35, 36, -1, 38, 39, 40, 41, -1, -1, - 44, -1, 3, 47, 48, -1, 50, 8, 52, 10, - 11, 12, 13, -1, -1, 16, 17, -1, -1, -1, - 21, 22, -1, 24, 25, 26, 27, -1, -1, -1, - -1, 32, 33, 34, 35, 36, -1, 38, 39, 40, - 41, -1, -1, -1, -1, 3, 47, 48, -1, 50, - 8, 52, 10, 11, 12, 13, -1, -1, 16, 17, - -1, -1, -1, -1, 22, -1, 24, 25, 26, 27, - -1, -1, -1, -1, 32, 33, 34, 35, 36, -1, - 38, 39, 40, 41, -1, -1, -1, -1, 3, 47, - 48, -1, 50, 8, 52, 10, 11, 12, 13, -1, - -1, 16, 17, -1, -1, -1, 21, -1, -1, 24, - 25, 26, 27, -1, -1, -1, -1, 32, 33, 34, - 35, 36, -1, 38, 39, 40, 41, -1, -1, -1, - -1, 3, 47, 48, -1, 50, 8, 52, 10, 11, - 12, 13, -1, -1, 16, 17, -1, -1, -1, -1, - -1, -1, 24, 25, 26, 27, -1, -1, -1, -1, - 32, 33, 34, 35, 36, -1, 38, 39, 40, 41, - -1, -1, 44, -1, 3, 47, 48, -1, 50, 8, - 52, 10, 11, 12, 13, -1, -1, 16, 17, -1, - -1, -1, -1, -1, -1, 24, 25, 26, 27, -1, - -1, -1, -1, 32, 33, 34, 35, 36, -1, 38, - 39, 40, 41, -1, -1, -1, -1, -1, 47, 48, - -1, 50, -1, 52, 32, 33, 34, 35, 36, -1, - 38, -1, 40, 41, -1, -1, -1, -1, -1, 47, - 48 +static const short yycheck[] = { 6, + 7, 35, 10, 0, 57, 0, 9, 170, 128, 172, + 20, 24, 24, 26, 26, 188, 189, 190, 191, 192, + 44, 24, 29, 30, 178, 9, 55, 56, 24, 58, + 44, 45, 61, 24, 44, 14, 49, 49, 211, 14, + 24, 44, 50, 3, 24, 208, 209, 14, 8, 52, + 10, 11, 12, 13, 23, 14, 64, 17, 178, 29, + 44, 20, 216, 97, 43, 44, 45, 27, 52, 44, + 52, 50, 101, 102, 14, 50, 105, 44, 24, 24, + 20, 46, 28, 50, 44, 44, 14, 14, 53, 118, + 50, 50, 52, 122, 123, 24, 216, 46, 106, 272, + 273, 274, 131, 14, 44, 112, 103, 104, 14, 104, + 50, 164, 24, 120, 121, 24, 44, 44, 125, 126, + 283, 284, 50, 50, 24, 24, 26, 156, 157, 158, + 159, 160, 161, 44, 24, 24, 24, 26, 44, 50, + 24, 170, 176, 172, 50, 153, 175, 24, 201, 49, + 24, 4, 149, 150, 149, 150, 163, 43, 165, 212, + 49, 46, 43, 30, 31, 52, 195, 14, 53, 43, + 44, 45, 18, 202, 24, 42, 43, 184, 185, 208, + 209, 30, 31, 217, 181, 182, 14, 182, 30, 31, + 197, 198, 53, 43, 44, 45, 5, 6, 7, 206, + 207, 5, 6, 24, 24, 24, 24, 25, 26, 24, + 239, 24, 24, 24, 32, 33, 34, 35, 36, 248, + 38, 39, 40, 41, 253, 254, 255, 26, 24, 47, + 48, 260, 15, 32, 33, 34, 35, 36, 24, 38, + 39, 40, 41, 51, 51, 252, 275, 53, 47, 48, + 30, 31, 53, 260, 283, 284, 15, 264, 265, 15, + 7, 9, 42, 43, 44, 37, 15, 51, 275, 15, + 51, 7, 279, 280, 1, 4, 3, 37, 285, 24, + 15, 8, 51, 10, 11, 12, 13, 15, 51, 16, + 17, 15, 24, 51, 21, 22, 15, 24, 25, 26, + 27, 51, 15, 15, 0, 32, 33, 34, 35, 36, + 51, 38, 39, 40, 41, 0, 171, 44, 45, 3, + 47, 48, 33, 50, 8, 52, 10, 11, 12, 13, + 51, 176, 16, 17, 271, 195, 233, 21, 10, -1, + 24, 25, 26, 27, -1, -1, -1, -1, 32, 33, + 34, 35, 36, -1, 38, 39, 40, 41, -1, 43, + 44, 45, 3, 47, 48, -1, 50, 8, 52, 10, + 11, 12, 13, -1, -1, 16, 17, -1, -1, -1, + 21, 22, -1, 24, 25, 26, 27, -1, -1, -1, + -1, 32, 33, 34, 35, 36, -1, 38, 39, 40, + 41, -1, -1, 44, -1, 3, 47, 48, -1, 50, + 8, 52, 10, 11, 12, 13, -1, -1, 16, 17, + -1, -1, -1, 21, 22, -1, 24, 25, 26, 27, + -1, -1, -1, -1, 32, 33, 34, 35, 36, -1, + 38, 39, 40, 41, -1, -1, -1, -1, 3, 47, + 48, -1, 50, 8, 52, 10, 11, 12, 13, -1, + -1, 16, 17, -1, -1, -1, -1, 22, -1, 24, + 25, 26, 27, -1, -1, -1, -1, 32, 33, 34, + 35, 36, -1, 38, 39, 40, 41, -1, -1, -1, + -1, 3, 47, 48, -1, 50, 8, 52, 10, 11, + 12, 13, -1, -1, 16, 17, -1, -1, -1, -1, + -1, -1, 24, 25, 26, 27, -1, -1, -1, -1, + 32, 33, 34, 35, 36, -1, 38, 39, 40, 41, + -1, -1, 44, -1, 3, 47, 48, -1, 50, 8, + 52, 10, 11, 12, 13, -1, -1, 16, 17, -1, + -1, -1, -1, -1, -1, 24, 25, 26, 27, -1, + -1, -1, -1, 32, 33, 34, 35, 36, -1, 38, + 39, 40, 41, -1, -1, -1, -1, -1, 47, 48, + -1, 50, -1, 52, 32, 33, 34, 35, 36, -1, + 38, -1, 40, 41, -1, -1, -1, -1, -1, 47, + 48 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/local/share/bison/bison.simple" +#line 3 "/usr/share/bison.simple" +/* This file comes from bison-1.28. */ /* Skeleton output parser for bison, - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software - Foundation, Inc. + Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -778,109 +775,63 @@ static const short yycheck[] = This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ -/* This is the parser code that is written into each bison parser when - the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# if YYSTACK_USE_ALLOCA -# define YYSTACK_ALLOC alloca -# else -# ifndef YYSTACK_USE_ALLOCA -# if defined (alloca) || defined (_ALLOCA_H) -# define YYSTACK_ALLOC alloca -# else -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# else -# if defined (__STDC__) || defined (__cplusplus) -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif -# define YYSTACK_ALLOC malloc -# define YYSTACK_FREE free -# endif - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - short yyss; - YYSTYPE yyvs; -# if YYLSP_NEEDED - YYLTYPE yyls; -# endif -}; +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# if YYLSP_NEEDED -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ - + 2 * YYSTACK_GAP_MAX) -# else -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAX) -# endif - -/* Relocate the TYPE STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Type, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - yymemcpy ((char *) yyptr, (char *) (Stack), \ - yysize * (YYSIZE_T) sizeof (Type)); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (0) - -#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ - - -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ -#endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t +#ifndef YYSTACK_USE_ALLOCA +#ifdef alloca +#define YYSTACK_USE_ALLOCA +#else /* alloca not defined */ +#ifdef __GNUC__ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#else /* not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) +#define YYSTACK_USE_ALLOCA +#include <alloca.h> +#else /* not sparc */ +/* We think this test detects Watcom and Microsoft C. */ +/* This used to test MSDOS, but that is a bad idea + since that symbol is in the user namespace. */ +#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) +#if 0 /* No need for malloc.h, which pollutes the namespace; + instead, just don't use alloca. */ +#include <malloc.h> #endif -#if ! defined (YYSIZE_T) -# if defined (__STDC__) || defined (__cplusplus) -# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# endif +#else /* not MSDOS, or __TURBOC__ */ +#if defined(_AIX) +/* I don't know what this was needed for, but it pollutes the namespace. + So I turned it off. rms, 2 May 1997. */ +/* #include <malloc.h> */ + #pragma alloca +#define YYSTACK_USE_ALLOCA +#else /* not MSDOS, or __TURBOC__, or _AIX */ +#if 0 +#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, + and on HPUX 10. Eventually we can turn this on. */ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#endif /* __hpux */ #endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int +#endif /* not _AIX */ +#endif /* not MSDOS, or __TURBOC__ */ +#endif /* not sparc */ +#endif /* not GNU C */ +#endif /* alloca not defined */ +#endif /* YYSTACK_USE_ALLOCA not defined */ + +#ifdef YYSTACK_USE_ALLOCA +#define YYSTACK_ALLOC alloca +#else +#define YYSTACK_ALLOC malloc #endif +/* Note: there must be only one dollar sign in this file. + It is replaced by the list of actions, each action + as one case of the switch. */ + #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY -2 @@ -888,188 +839,131 @@ union yyalloc #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrlab1 -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(Token, Value) \ +#define YYBACKUP(token, value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ + { yychar = (token), yylval = (value); \ yychar1 = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ - { \ - yyerror ("syntax error: cannot back up"); \ - YYERROR; \ - } \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ while (0) #define YYTERROR 1 #define YYERRCODE 256 +#ifndef YYPURE +#define YYLEX yylex() +#endif -/* YYLLOC_DEFAULT -- Compute the default location (before the actions - are run). +#ifdef YYPURE +#ifdef YYLSP_NEEDED +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval, &yylloc) +#endif +#else /* not YYLSP_NEEDED */ +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval) +#endif +#endif /* not YYLSP_NEEDED */ +#endif + +/* If nonreentrant, generate the variables here */ - When YYLLOC_DEFAULT is run, CURRENT is set the location of the - first token. By default, to implement support for ranges, extend - its range to the last symbol. */ +#ifndef YYPURE -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - Current.last_line = Rhs[N].last_line; \ - Current.last_column = Rhs[N].last_column; +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ + +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ #endif +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ -/* YYLEX -- calling `yylex' with the right arguments. */ +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ +#endif + +/* YYINITDEPTH indicates the initial size of the parser's stacks */ -#if YYPURE -# if YYLSP_NEEDED -# ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) -# else -# define YYLEX yylex (&yylval, &yylloc) -# endif -# else /* !YYLSP_NEEDED */ -# ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, YYLEX_PARAM) -# else -# define YYLEX yylex (&yylval) -# endif -# endif /* !YYLSP_NEEDED */ -#else /* !YYPURE */ -# define YYLEX yylex () -#endif /* !YYPURE */ - - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -#endif /* !YYDEBUG */ - -/* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH -# define YYINITDEPTH 200 +#define YYINITDEPTH 200 #endif -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ #if YYMAXDEPTH == 0 -# undef YYMAXDEPTH +#undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 +#define YYMAXDEPTH 10000 #endif -#if ! defined (yyoverflow) && ! defined (yymemcpy) -# if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -# define yymemcpy __builtin_memcpy -# else /* not GNU C or C++ */ +/* Define __yy_memcpy. Note that the size argument + should be passed with type unsigned int, because that is what the non-GCC + definitions require. With GCC, __builtin_memcpy takes an arg + of type size_t, but it can handle unsigned int. */ + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ +#ifndef __cplusplus /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void -# if defined (__STDC__) || defined (__cplusplus) -yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount) -# else -yymemcpy (yyto, yyfrom, yycount) - char *yyto; - const char *yyfrom; - YYSIZE_T yycount; -# endif +__yy_memcpy (to, from, count) + char *to; + char *from; + unsigned int count; { - register const char *yyf = yyfrom; - register char *yyt = yyto; - register YYSIZE_T yyi = yycount; + register char *f = from; + register char *t = to; + register int i = count; - while (yyi-- != 0) - *yyt++ = *yyf++; + while (i-- > 0) + *t++ = *f++; } -# endif -#endif -#ifdef YYERROR_VERBOSE +#else /* __cplusplus */ -# ifndef yystrlen -# if defined (__GLIBC__) && defined (_STRING_H) -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -static YYSIZE_T -# if defined (__STDC__) || defined (__cplusplus) -yystrlen (const char *yystr) -# else -yystrlen (yystr) - const char *yystr; -# endif -{ - register const char *yys = yystr; - - while (*yys++ != '\0') - continue; - - return yys - yystr - 1; -} -# endif -# endif - -# ifndef yystpcpy -# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -# if defined (__STDC__) || defined (__cplusplus) -yystpcpy (char *yydest, const char *yysrc) -# else -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -# endif +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (char *to, char *from, unsigned int count) { - register char *yyd = yydest; - register const char *yys = yysrc; + register char *t = to; + register char *f = from; + register int i = count; - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; + while (i-- > 0) + *t++ = *f++; } -# endif -# endif + +#endif #endif -#line 319 "/usr/local/share/bison/bison.simple" - +#line 217 "/usr/share/bison.simple" /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. @@ -1078,121 +972,76 @@ yystpcpy (yydest, yysrc) to the proper pointer type. */ #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM -# define YYPARSE_PARAM_DECL -# else -# define YYPARSE_PARAM_ARG YYPARSE_PARAM -# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -# endif -#else /* !YYPARSE_PARAM */ -# define YYPARSE_PARAM_ARG -# define YYPARSE_PARAM_DECL -#endif /* !YYPARSE_PARAM */ +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ -# ifdef YYPARSE_PARAM +#ifdef YYPARSE_PARAM int yyparse (void *); -# else +#else int yyparse (void); -# endif #endif - -/* YY_DECL_VARIABLES -- depending whether we use a pure parser, - variables are global, or local to YYPARSE. */ - -#define YY_DECL_NON_LSP_VARIABLES \ -/* The lookahead symbol. */ \ -int yychar; \ - \ -/* The semantic value of the lookahead symbol. */ \ -YYSTYPE yylval; \ - \ -/* Number of parse errors so far. */ \ -int yynerrs; - -#if YYLSP_NEEDED -# define YY_DECL_VARIABLES \ -YY_DECL_NON_LSP_VARIABLES \ - \ -/* Location data for the lookahead symbol. */ \ -YYLTYPE yylloc; -#else -# define YY_DECL_VARIABLES \ -YY_DECL_NON_LSP_VARIABLES #endif - -/* If nonreentrant, generate the variables here. */ - -#if !YYPURE -YY_DECL_VARIABLES -#endif /* !YYPURE */ - int -yyparse (YYPARSE_PARAM_ARG) +yyparse(YYPARSE_PARAM_ARG) YYPARSE_PARAM_DECL { - /* If reentrant, generate the variables here. */ -#if YYPURE - YY_DECL_VARIABLES -#endif /* !YYPURE */ - register int yystate; register int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Lookahead token as an internal (translated) token number. */ - int yychar1 = 0; - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - short yyssa[YYINITDEPTH]; - short *yyss = yyssa; register short *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ -#if YYLSP_NEEDED - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ YYLTYPE *yyls = yylsa; YYLTYPE *yylsp; -#endif -#if YYLSP_NEEDED -# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else -# define YYPOPSTACK (yyvsp--, yyssp--) +#define YYPOPSTACK (yyvsp--, yyssp--) #endif - YYSIZE_T yystacksize = YYINITDEPTH; + int yystacksize = YYINITDEPTH; + int yyfree_stacks = 0; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; -#if YYLSP_NEEDED - YYLTYPE yyloc; +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; +#endif #endif - /* When reducing, the number of symbols on the RHS of the reduced - rule. */ + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + int yylen; - YYDPRINTF ((stderr, "Starting parse\n")); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif yystate = 0; yyerrstatus = 0; @@ -1204,106 +1053,110 @@ yyparse (YYPARSE_PARAM_ARG) so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; + yyssp = yyss - 1; yyvsp = yyvs; -#if YYLSP_NEEDED +#ifdef YYLSP_NEEDED yylsp = yyls; #endif - goto yysetstate; -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. - */ - yyssp++; +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: - yysetstate: - *yyssp = yystate; + *++yyssp = yystate; if (yyssp >= yyss + yystacksize - 1) { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + int size = yyssp - yyss + 1; #ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. */ -# if YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; - /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ - yyoverflow ("parser stack overflow", - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yyls1, yysize * sizeof (*yylsp), - &yystacksize); - yyls = yyls1; -# else - yyoverflow ("parser stack overflow", - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); -# endif - yyss = yyss1; - yyvs = yyvs1; - } + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); +#else + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif + + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif #else /* no yyoverflow */ /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) - goto yyoverflowlab; + { + yyerror("parser stack overflow"); + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 2; + } yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; - - { - short *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyoverflowlab; - YYSTACK_RELOCATE (short, yyss); - YYSTACK_RELOCATE (YYSTYPE, yyvs); -# if YYLSP_NEEDED - YYSTACK_RELOCATE (YYLTYPE, yyls); -# endif -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } +#ifndef YYSTACK_USE_ALLOCA + yyfree_stacks = 1; +#endif + yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, + size * (unsigned int) sizeof (*yyssp)); + yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, + size * (unsigned int) sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, + size * (unsigned int) sizeof (*yylsp)); +#endif #endif /* no yyoverflow */ - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; -#if YYLSP_NEEDED - yylsp = yyls + yysize - 1; + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; #endif - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif if (yyssp >= yyss + yystacksize - 1) YYABORT; } - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); +#endif goto yybackup; - - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: + yybackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ @@ -1322,7 +1175,10 @@ yybackup: if (yychar == YYEMPTY) { - YYDPRINTF ((stderr, "Reading a token: ")); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); +#endif yychar = YYLEX; } @@ -1333,25 +1189,25 @@ yybackup: yychar1 = 0; yychar = YYEOF; /* Don't call YYLEX any more */ - YYDPRINTF ((stderr, "Now at end of input.\n")); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Now at end of input.\n"); +#endif } else { - yychar1 = YYTRANSLATE (yychar); + yychar1 = YYTRANSLATE(yychar); -#if YYDEBUG - /* We have to keep this `#if YYDEBUG', since we use variables - which are defined only if `YYDEBUG' is set. */ +#if YYDEBUG != 0 if (yydebug) { - YYFPRINTF (stderr, "Next token is %d (%s", - yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise - meaning of a token, for further debugging info. */ -# ifdef YYPRINT + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ +#ifdef YYPRINT YYPRINT (stderr, yychar, yylval); -# endif - YYFPRINTF (stderr, ")\n"); +#endif + fprintf (stderr, ")\n"); } #endif } @@ -1383,82 +1239,60 @@ yybackup: YYACCEPT; /* Shift the lookahead token. */ - YYDPRINTF ((stderr, "Shifting token %d (%s), ", - yychar, yytname[yychar1])); + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +#endif /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; -#if YYLSP_NEEDED +#ifdef YYLSP_NEEDED *++yylsp = yylloc; #endif - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate; - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ +/* Do the default action for the current state. */ yydefault: + yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; - goto yyreduce; - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ +/* Do a reduction. yyn is the number of a rule to reduce with. */ yyreduce: - /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. - - Otherwise, the following line sets YYVAL to the semantic value of - the lookahead token. This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - -#if YYLSP_NEEDED - /* Similarly for the default location. Let the user run additional - commands if for instance locations are ranges. */ - yyloc = yylsp[1-yylen]; - YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); -#endif - -#if YYDEBUG - /* We have to keep this `#if YYDEBUG', since we use variables which - are defined only if `YYDEBUG' is set. */ +#if YYDEBUG != 0 if (yydebug) { - int yyi; + int i; - YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); + fprintf (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ - for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) - YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); - YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); + for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) + fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); } #endif + switch (yyn) { case 1: -#line 327 "/usr/homes/chet/src/bash/src/parse.y" +#line 351 "/Users/chet/src/bash/src/parse.y" { /* Case of regular command. Discard the error safety net,and return the command just parsed. */ @@ -1466,19 +1300,19 @@ case 1: eof_encountered = 0; /* discard_parser_constructs (0); */ YYACCEPT; - } - break; + ; + break;} case 2: -#line 336 "/usr/homes/chet/src/bash/src/parse.y" +#line 360 "/Users/chet/src/bash/src/parse.y" { /* Case of regular command, but not a very interesting one. Return a NULL command. */ global_command = (COMMAND *)NULL; YYACCEPT; - } - break; + ; + break;} case 3: -#line 343 "/usr/homes/chet/src/bash/src/parse.y" +#line 367 "/Users/chet/src/bash/src/parse.y" { /* Error during parsing. Return NULL command. */ global_command = (COMMAND *)NULL; @@ -1492,255 +1326,255 @@ case 3: { YYABORT; } - } - break; + ; + break;} case 4: -#line 358 "/usr/homes/chet/src/bash/src/parse.y" +#line 382 "/Users/chet/src/bash/src/parse.y" { /* Case of EOF seen by itself. Do ignoreeof or not. */ global_command = (COMMAND *)NULL; handle_eof_input_unit (); YYACCEPT; - } - break; + ; + break;} case 5: -#line 368 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.word_list = make_word_list (yyvsp[0].word, (WORD_LIST *)NULL); } - break; +#line 392 "/Users/chet/src/bash/src/parse.y" +{ yyval.word_list = make_word_list (yyvsp[0].word, (WORD_LIST *)NULL); ; + break;} case 6: -#line 370 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.word_list = make_word_list (yyvsp[0].word, yyvsp[-1].word_list); } - break; +#line 394 "/Users/chet/src/bash/src/parse.y" +{ yyval.word_list = make_word_list (yyvsp[0].word, yyvsp[-1].word_list); ; + break;} case 7: -#line 374 "/usr/homes/chet/src/bash/src/parse.y" +#line 398 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (1, r_output_direction, redir); - } - break; + ; + break;} case 8: -#line 379 "/usr/homes/chet/src/bash/src/parse.y" +#line 403 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (0, r_input_direction, redir); - } - break; + ; + break;} case 9: -#line 384 "/usr/homes/chet/src/bash/src/parse.y" +#line 408 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (yyvsp[-2].number, r_output_direction, redir); - } - break; + ; + break;} case 10: -#line 389 "/usr/homes/chet/src/bash/src/parse.y" +#line 413 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (yyvsp[-2].number, r_input_direction, redir); - } - break; + ; + break;} case 11: -#line 394 "/usr/homes/chet/src/bash/src/parse.y" +#line 418 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (1, r_appending_to, redir); - } - break; + ; + break;} case 12: -#line 399 "/usr/homes/chet/src/bash/src/parse.y" +#line 423 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (yyvsp[-2].number, r_appending_to, redir); - } - break; + ; + break;} case 13: -#line 404 "/usr/homes/chet/src/bash/src/parse.y" +#line 428 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (0, r_reading_until, redir); redir_stack[need_here_doc++] = yyval.redirect; - } - break; + ; + break;} case 14: -#line 410 "/usr/homes/chet/src/bash/src/parse.y" +#line 434 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (yyvsp[-2].number, r_reading_until, redir); redir_stack[need_here_doc++] = yyval.redirect; - } - break; + ; + break;} case 15: -#line 416 "/usr/homes/chet/src/bash/src/parse.y" +#line 440 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (0, r_reading_string, redir); - } - break; + ; + break;} case 16: -#line 421 "/usr/homes/chet/src/bash/src/parse.y" +#line 445 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (yyvsp[-2].number, r_reading_string, redir); - } - break; + ; + break;} case 17: -#line 426 "/usr/homes/chet/src/bash/src/parse.y" +#line 450 "/Users/chet/src/bash/src/parse.y" { redir.dest = yyvsp[0].number; yyval.redirect = make_redirection (0, r_duplicating_input, redir); - } - break; + ; + break;} case 18: -#line 431 "/usr/homes/chet/src/bash/src/parse.y" +#line 455 "/Users/chet/src/bash/src/parse.y" { redir.dest = yyvsp[0].number; yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_input, redir); - } - break; + ; + break;} case 19: -#line 436 "/usr/homes/chet/src/bash/src/parse.y" +#line 460 "/Users/chet/src/bash/src/parse.y" { redir.dest = yyvsp[0].number; yyval.redirect = make_redirection (1, r_duplicating_output, redir); - } - break; + ; + break;} case 20: -#line 441 "/usr/homes/chet/src/bash/src/parse.y" +#line 465 "/Users/chet/src/bash/src/parse.y" { redir.dest = yyvsp[0].number; yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_output, redir); - } - break; + ; + break;} case 21: -#line 446 "/usr/homes/chet/src/bash/src/parse.y" +#line 470 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (0, r_duplicating_input_word, redir); - } - break; + ; + break;} case 22: -#line 451 "/usr/homes/chet/src/bash/src/parse.y" +#line 475 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_input_word, redir); - } - break; + ; + break;} case 23: -#line 456 "/usr/homes/chet/src/bash/src/parse.y" +#line 480 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (1, r_duplicating_output_word, redir); - } - break; + ; + break;} case 24: -#line 461 "/usr/homes/chet/src/bash/src/parse.y" +#line 485 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_output_word, redir); - } - break; + ; + break;} case 25: -#line 466 "/usr/homes/chet/src/bash/src/parse.y" +#line 490 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (0, r_deblank_reading_until, redir); redir_stack[need_here_doc++] = yyval.redirect; - } - break; + ; + break;} case 26: -#line 473 "/usr/homes/chet/src/bash/src/parse.y" +#line 497 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (yyvsp[-2].number, r_deblank_reading_until, redir); redir_stack[need_here_doc++] = yyval.redirect; - } - break; + ; + break;} case 27: -#line 480 "/usr/homes/chet/src/bash/src/parse.y" +#line 504 "/Users/chet/src/bash/src/parse.y" { redir.dest = 0; yyval.redirect = make_redirection (1, r_close_this, redir); - } - break; + ; + break;} case 28: -#line 485 "/usr/homes/chet/src/bash/src/parse.y" +#line 509 "/Users/chet/src/bash/src/parse.y" { redir.dest = 0; yyval.redirect = make_redirection (yyvsp[-2].number, r_close_this, redir); - } - break; + ; + break;} case 29: -#line 490 "/usr/homes/chet/src/bash/src/parse.y" +#line 514 "/Users/chet/src/bash/src/parse.y" { redir.dest = 0; yyval.redirect = make_redirection (0, r_close_this, redir); - } - break; + ; + break;} case 30: -#line 495 "/usr/homes/chet/src/bash/src/parse.y" +#line 519 "/Users/chet/src/bash/src/parse.y" { redir.dest = 0; yyval.redirect = make_redirection (yyvsp[-2].number, r_close_this, redir); - } - break; + ; + break;} case 31: -#line 500 "/usr/homes/chet/src/bash/src/parse.y" +#line 524 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (1, r_err_and_out, redir); - } - break; + ; + break;} case 32: -#line 505 "/usr/homes/chet/src/bash/src/parse.y" +#line 529 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (yyvsp[-2].number, r_input_output, redir); - } - break; + ; + break;} case 33: -#line 510 "/usr/homes/chet/src/bash/src/parse.y" +#line 534 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (0, r_input_output, redir); - } - break; + ; + break;} case 34: -#line 515 "/usr/homes/chet/src/bash/src/parse.y" +#line 539 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (1, r_output_force, redir); - } - break; + ; + break;} case 35: -#line 520 "/usr/homes/chet/src/bash/src/parse.y" +#line 544 "/Users/chet/src/bash/src/parse.y" { redir.filename = yyvsp[0].word; yyval.redirect = make_redirection (yyvsp[-2].number, r_output_force, redir); - } - break; + ; + break;} case 36: -#line 527 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.element.word = yyvsp[0].word; yyval.element.redirect = 0; } - break; +#line 551 "/Users/chet/src/bash/src/parse.y" +{ yyval.element.word = yyvsp[0].word; yyval.element.redirect = 0; ; + break;} case 37: -#line 529 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.element.word = yyvsp[0].word; yyval.element.redirect = 0; } - break; +#line 553 "/Users/chet/src/bash/src/parse.y" +{ yyval.element.word = yyvsp[0].word; yyval.element.redirect = 0; ; + break;} case 38: -#line 531 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.element.redirect = yyvsp[0].redirect; yyval.element.word = 0; } - break; +#line 555 "/Users/chet/src/bash/src/parse.y" +{ yyval.element.redirect = yyvsp[0].redirect; yyval.element.word = 0; ; + break;} case 39: -#line 535 "/usr/homes/chet/src/bash/src/parse.y" +#line 559 "/Users/chet/src/bash/src/parse.y" { yyval.redirect = yyvsp[0].redirect; - } - break; + ; + break;} case 40: -#line 539 "/usr/homes/chet/src/bash/src/parse.y" +#line 563 "/Users/chet/src/bash/src/parse.y" { register REDIRECT *t; @@ -1748,26 +1582,26 @@ case 40: ; t->next = yyvsp[0].redirect; yyval.redirect = yyvsp[-1].redirect; - } - break; + ; + break;} case 41: -#line 550 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_simple_command (yyvsp[0].element, (COMMAND *)NULL); } - break; +#line 574 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = make_simple_command (yyvsp[0].element, (COMMAND *)NULL); ; + break;} case 42: -#line 552 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_simple_command (yyvsp[0].element, yyvsp[-1].command); } - break; +#line 576 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = make_simple_command (yyvsp[0].element, yyvsp[-1].command); ; + break;} case 43: -#line 556 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = clean_simple_command (yyvsp[0].command); } - break; +#line 580 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = clean_simple_command (yyvsp[0].command); ; + break;} case 44: -#line 558 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = yyvsp[0].command; } - break; +#line 582 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = yyvsp[0].command; ; + break;} case 45: -#line 560 "/usr/homes/chet/src/bash/src/parse.y" +#line 584 "/Users/chet/src/bash/src/parse.y" { COMMAND *tc; @@ -1782,170 +1616,221 @@ case 45: else tc->redirects = yyvsp[0].redirect; yyval.command = yyvsp[-1].command; - } - break; + ; + break;} case 46: -#line 576 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = yyvsp[0].command; } - break; +#line 600 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = yyvsp[0].command; ; + break;} case 47: -#line 580 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = yyvsp[0].command; } - break; +#line 604 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = yyvsp[0].command; ; + break;} case 48: -#line 582 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = yyvsp[0].command; } - break; +#line 606 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = yyvsp[0].command; ; + break;} case 49: -#line 584 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_while_command (yyvsp[-3].command, yyvsp[-1].command); } - break; +#line 608 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = make_while_command (yyvsp[-3].command, yyvsp[-1].command); ; + break;} case 50: -#line 586 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_until_command (yyvsp[-3].command, yyvsp[-1].command); } - break; +#line 610 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = make_until_command (yyvsp[-3].command, yyvsp[-1].command); ; + break;} case 51: -#line 588 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = yyvsp[0].command; } - break; +#line 612 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = yyvsp[0].command; ; + break;} case 52: -#line 590 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = yyvsp[0].command; } - break; +#line 614 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = yyvsp[0].command; ; + break;} case 53: -#line 592 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = yyvsp[0].command; } - break; +#line 616 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = yyvsp[0].command; ; + break;} case 54: -#line 594 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = yyvsp[0].command; } - break; +#line 618 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = yyvsp[0].command; ; + break;} case 55: -#line 596 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = yyvsp[0].command; } - break; +#line 620 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = yyvsp[0].command; ; + break;} case 56: -#line 598 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = yyvsp[0].command; } - break; +#line 622 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = yyvsp[0].command; ; + break;} case 57: -#line 600 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = yyvsp[0].command; } - break; +#line 624 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = yyvsp[0].command; ; + break;} case 58: -#line 604 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_for_command (yyvsp[-4].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); } - break; +#line 628 "/Users/chet/src/bash/src/parse.y" +{ + yyval.command = make_for_command (yyvsp[-4].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + ; + break;} case 59: -#line 606 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_for_command (yyvsp[-4].word, add_string_to_list ("$@", (WORD_LIST *)NULL), yyvsp[-1].command); } - break; +#line 633 "/Users/chet/src/bash/src/parse.y" +{ + yyval.command = make_for_command (yyvsp[-4].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + ; + break;} case 60: -#line 608 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_for_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); } - break; +#line 638 "/Users/chet/src/bash/src/parse.y" +{ + yyval.command = make_for_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + ; + break;} case 61: -#line 610 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_for_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); } - break; +#line 643 "/Users/chet/src/bash/src/parse.y" +{ + yyval.command = make_for_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + ; + break;} case 62: -#line 612 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_for_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command); } - break; +#line 648 "/Users/chet/src/bash/src/parse.y" +{ + yyval.command = make_for_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + ; + break;} case 63: -#line 614 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_for_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command); } - break; +#line 653 "/Users/chet/src/bash/src/parse.y" +{ + yyval.command = make_for_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + ; + break;} case 64: -#line 616 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_for_command (yyvsp[-7].word, (WORD_LIST *)NULL, yyvsp[-1].command); } - break; +#line 658 "/Users/chet/src/bash/src/parse.y" +{ + yyval.command = make_for_command (yyvsp[-7].word, (WORD_LIST *)NULL, yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + ; + break;} case 65: -#line 618 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_for_command (yyvsp[-7].word, (WORD_LIST *)NULL, yyvsp[-1].command); } - break; +#line 663 "/Users/chet/src/bash/src/parse.y" +{ + yyval.command = make_for_command (yyvsp[-7].word, (WORD_LIST *)NULL, yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + ; + break;} case 66: -#line 622 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_arith_for_command (yyvsp[-5].word_list, yyvsp[-1].command, arith_for_lineno); } - break; +#line 670 "/Users/chet/src/bash/src/parse.y" +{ + yyval.command = make_arith_for_command (yyvsp[-5].word_list, yyvsp[-1].command, arith_for_lineno); + if (word_top > 0) word_top--; + ; + break;} case 67: -#line 624 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_arith_for_command (yyvsp[-5].word_list, yyvsp[-1].command, arith_for_lineno); } - break; +#line 675 "/Users/chet/src/bash/src/parse.y" +{ + yyval.command = make_arith_for_command (yyvsp[-5].word_list, yyvsp[-1].command, arith_for_lineno); + if (word_top > 0) word_top--; + ; + break;} case 68: -#line 626 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_arith_for_command (yyvsp[-3].word_list, yyvsp[-1].command, arith_for_lineno); } - break; +#line 680 "/Users/chet/src/bash/src/parse.y" +{ + yyval.command = make_arith_for_command (yyvsp[-3].word_list, yyvsp[-1].command, arith_for_lineno); + if (word_top > 0) word_top--; + ; + break;} case 69: -#line 628 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_arith_for_command (yyvsp[-3].word_list, yyvsp[-1].command, arith_for_lineno); } - break; +#line 685 "/Users/chet/src/bash/src/parse.y" +{ + yyval.command = make_arith_for_command (yyvsp[-3].word_list, yyvsp[-1].command, arith_for_lineno); + if (word_top > 0) word_top--; + ; + break;} case 70: -#line 632 "/usr/homes/chet/src/bash/src/parse.y" +#line 692 "/Users/chet/src/bash/src/parse.y" { - yyval.command = make_select_command (yyvsp[-4].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); - } - break; + yyval.command = make_select_command (yyvsp[-4].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + ; + break;} case 71: -#line 636 "/usr/homes/chet/src/bash/src/parse.y" +#line 697 "/Users/chet/src/bash/src/parse.y" { - yyval.command = make_select_command (yyvsp[-4].word, add_string_to_list ("$@", (WORD_LIST *)NULL), yyvsp[-1].command); - } - break; + yyval.command = make_select_command (yyvsp[-4].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + ; + break;} case 72: -#line 640 "/usr/homes/chet/src/bash/src/parse.y" +#line 702 "/Users/chet/src/bash/src/parse.y" { - yyval.command = make_select_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); - } - break; + yyval.command = make_select_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + ; + break;} case 73: -#line 644 "/usr/homes/chet/src/bash/src/parse.y" +#line 707 "/Users/chet/src/bash/src/parse.y" { - yyval.command = make_select_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command); - } - break; + yyval.command = make_select_command (yyvsp[-5].word, add_string_to_list ("\"$@\"", (WORD_LIST *)NULL), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + ; + break;} case 74: -#line 648 "/usr/homes/chet/src/bash/src/parse.y" +#line 712 "/Users/chet/src/bash/src/parse.y" { - yyval.command = make_select_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command); - } - break; + yyval.command = make_select_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + ; + break;} case 75: -#line 652 "/usr/homes/chet/src/bash/src/parse.y" +#line 717 "/Users/chet/src/bash/src/parse.y" { - yyval.command = make_select_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command); - } - break; + yyval.command = make_select_command (yyvsp[-8].word, REVERSE_LIST (yyvsp[-5].word_list, WORD_LIST *), yyvsp[-1].command, word_lineno[word_top]); + if (word_top > 0) word_top--; + ; + break;} case 76: -#line 658 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_case_command (yyvsp[-4].word, (PATTERN_LIST *)NULL); } - break; +#line 724 "/Users/chet/src/bash/src/parse.y" +{ + yyval.command = make_case_command (yyvsp[-4].word, (PATTERN_LIST *)NULL, word_lineno[word_top]); + if (word_top > 0) word_top--; + ; + break;} case 77: -#line 660 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_case_command (yyvsp[-5].word, yyvsp[-2].pattern); } - break; +#line 729 "/Users/chet/src/bash/src/parse.y" +{ + yyval.command = make_case_command (yyvsp[-5].word, yyvsp[-2].pattern, word_lineno[word_top]); + if (word_top > 0) word_top--; + ; + break;} case 78: -#line 662 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_case_command (yyvsp[-4].word, yyvsp[-1].pattern); } - break; +#line 734 "/Users/chet/src/bash/src/parse.y" +{ + yyval.command = make_case_command (yyvsp[-4].word, yyvsp[-1].pattern, word_lineno[word_top]); + if (word_top > 0) word_top--; + ; + break;} case 79: -#line 666 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_function_def (yyvsp[-4].word, yyvsp[0].command, function_dstart, function_bstart); } - break; +#line 741 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = make_function_def (yyvsp[-4].word, yyvsp[0].command, function_dstart, function_bstart); ; + break;} case 80: -#line 669 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_function_def (yyvsp[-4].word, yyvsp[0].command, function_dstart, function_bstart); } - break; +#line 744 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = make_function_def (yyvsp[-4].word, yyvsp[0].command, function_dstart, function_bstart); ; + break;} case 81: -#line 672 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_function_def (yyvsp[-2].word, yyvsp[0].command, function_dstart, function_bstart); } - break; +#line 747 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = make_function_def (yyvsp[-2].word, yyvsp[0].command, function_dstart, function_bstart); ; + break;} case 82: -#line 677 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = yyvsp[0].command; } - break; +#line 752 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = yyvsp[0].command; ; + break;} case 83: -#line 679 "/usr/homes/chet/src/bash/src/parse.y" +#line 754 "/Users/chet/src/bash/src/parse.y" { COMMAND *tc; @@ -1973,145 +1858,157 @@ case 83: else tc->redirects = yyvsp[0].redirect; yyval.command = yyvsp[-1].command; - } - break; + ; + break;} case 84: -#line 710 "/usr/homes/chet/src/bash/src/parse.y" +#line 785 "/Users/chet/src/bash/src/parse.y" { yyval.command = make_subshell_command (yyvsp[-1].command); yyval.command->flags |= CMD_WANT_SUBSHELL; - } - break; + ; + break;} case 85: -#line 717 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_if_command (yyvsp[-3].command, yyvsp[-1].command, (COMMAND *)NULL); } - break; +#line 792 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = make_if_command (yyvsp[-3].command, yyvsp[-1].command, (COMMAND *)NULL); ; + break;} case 86: -#line 719 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_if_command (yyvsp[-5].command, yyvsp[-3].command, yyvsp[-1].command); } - break; +#line 794 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = make_if_command (yyvsp[-5].command, yyvsp[-3].command, yyvsp[-1].command); ; + break;} case 87: -#line 721 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_if_command (yyvsp[-4].command, yyvsp[-2].command, yyvsp[-1].command); } - break; +#line 796 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = make_if_command (yyvsp[-4].command, yyvsp[-2].command, yyvsp[-1].command); ; + break;} case 88: -#line 726 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_group_command (yyvsp[-1].command); } - break; +#line 801 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = make_group_command (yyvsp[-1].command); ; + break;} case 89: -#line 730 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_arith_command (yyvsp[0].word_list); } - break; +#line 805 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = make_arith_command (yyvsp[0].word_list); ; + break;} case 90: -#line 734 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = yyvsp[-1].command; } - break; +#line 809 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = yyvsp[-1].command; ; + break;} case 91: -#line 738 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_if_command (yyvsp[-2].command, yyvsp[0].command, (COMMAND *)NULL); } - break; +#line 813 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = make_if_command (yyvsp[-2].command, yyvsp[0].command, (COMMAND *)NULL); ; + break;} case 92: -#line 740 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_if_command (yyvsp[-4].command, yyvsp[-2].command, yyvsp[0].command); } - break; +#line 815 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = make_if_command (yyvsp[-4].command, yyvsp[-2].command, yyvsp[0].command); ; + break;} case 93: -#line 742 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = make_if_command (yyvsp[-3].command, yyvsp[-1].command, yyvsp[0].command); } - break; +#line 817 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = make_if_command (yyvsp[-3].command, yyvsp[-1].command, yyvsp[0].command); ; + break;} case 95: -#line 747 "/usr/homes/chet/src/bash/src/parse.y" -{ yyvsp[0].pattern->next = yyvsp[-1].pattern; yyval.pattern = yyvsp[0].pattern; } - break; +#line 822 "/Users/chet/src/bash/src/parse.y" +{ yyvsp[0].pattern->next = yyvsp[-1].pattern; yyval.pattern = yyvsp[0].pattern; ; + break;} case 96: -#line 751 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.pattern = make_pattern_list (yyvsp[-2].word_list, yyvsp[0].command); } - break; +#line 826 "/Users/chet/src/bash/src/parse.y" +{ yyval.pattern = make_pattern_list (yyvsp[-2].word_list, yyvsp[0].command); ; + break;} case 97: -#line 753 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.pattern = make_pattern_list (yyvsp[-2].word_list, (COMMAND *)NULL); } - break; +#line 828 "/Users/chet/src/bash/src/parse.y" +{ yyval.pattern = make_pattern_list (yyvsp[-2].word_list, (COMMAND *)NULL); ; + break;} case 98: -#line 755 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.pattern = make_pattern_list (yyvsp[-2].word_list, yyvsp[0].command); } - break; +#line 830 "/Users/chet/src/bash/src/parse.y" +{ yyval.pattern = make_pattern_list (yyvsp[-2].word_list, yyvsp[0].command); ; + break;} case 99: -#line 757 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.pattern = make_pattern_list (yyvsp[-2].word_list, (COMMAND *)NULL); } - break; +#line 832 "/Users/chet/src/bash/src/parse.y" +{ yyval.pattern = make_pattern_list (yyvsp[-2].word_list, (COMMAND *)NULL); ; + break;} case 101: -#line 762 "/usr/homes/chet/src/bash/src/parse.y" -{ yyvsp[-1].pattern->next = yyvsp[-2].pattern; yyval.pattern = yyvsp[-1].pattern; } - break; +#line 837 "/Users/chet/src/bash/src/parse.y" +{ yyvsp[-1].pattern->next = yyvsp[-2].pattern; yyval.pattern = yyvsp[-1].pattern; ; + break;} case 102: -#line 766 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.word_list = make_word_list (yyvsp[0].word, (WORD_LIST *)NULL); } - break; +#line 841 "/Users/chet/src/bash/src/parse.y" +{ yyval.word_list = make_word_list (yyvsp[0].word, (WORD_LIST *)NULL); ; + break;} case 103: -#line 768 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.word_list = make_word_list (yyvsp[0].word, yyvsp[-2].word_list); } - break; +#line 843 "/Users/chet/src/bash/src/parse.y" +{ yyval.word_list = make_word_list (yyvsp[0].word, yyvsp[-2].word_list); ; + break;} case 104: -#line 777 "/usr/homes/chet/src/bash/src/parse.y" +#line 852 "/Users/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; if (need_here_doc) gather_here_documents (); - } - break; + ; + break;} case 106: -#line 786 "/usr/homes/chet/src/bash/src/parse.y" +#line 861 "/Users/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; - } - break; + ; + break;} case 108: -#line 793 "/usr/homes/chet/src/bash/src/parse.y" +#line 868 "/Users/chet/src/bash/src/parse.y" { if (yyvsp[-2].command->type == cm_connection) yyval.command = connect_async_list (yyvsp[-2].command, (COMMAND *)NULL, '&'); else yyval.command = command_connect (yyvsp[-2].command, (COMMAND *)NULL, '&'); - } - break; + ; + break;} case 110: -#line 804 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, AND_AND); } - break; +#line 879 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, AND_AND); ; + break;} case 111: -#line 806 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, OR_OR); } - break; +#line 881 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, OR_OR); ; + break;} case 112: -#line 808 "/usr/homes/chet/src/bash/src/parse.y" +#line 883 "/Users/chet/src/bash/src/parse.y" { if (yyvsp[-3].command->type == cm_connection) yyval.command = connect_async_list (yyvsp[-3].command, yyvsp[0].command, '&'); else yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, '&'); - } - break; + ; + break;} case 113: -#line 815 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, ';'); } - break; +#line 890 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, ';'); ; + break;} case 114: -#line 817 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, ';'); } - break; +#line 892 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, ';'); ; + break;} case 115: -#line 819 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = yyvsp[0].command; } - break; +#line 894 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = yyvsp[0].command; ; + break;} +case 118: +#line 902 "/Users/chet/src/bash/src/parse.y" +{ yyval.number = '\n'; ; + break;} +case 119: +#line 904 "/Users/chet/src/bash/src/parse.y" +{ yyval.number = ';'; ; + break;} +case 120: +#line 906 "/Users/chet/src/bash/src/parse.y" +{ yyval.number = yacc_EOF; ; + break;} case 123: -#line 842 "/usr/homes/chet/src/bash/src/parse.y" +#line 920 "/Users/chet/src/bash/src/parse.y" { yyval.command = yyvsp[0].command; if (need_here_doc) gather_here_documents (); - } - break; + ; + break;} case 124: -#line 848 "/usr/homes/chet/src/bash/src/parse.y" +#line 926 "/Users/chet/src/bash/src/parse.y" { if (yyvsp[-1].command->type == cm_connection) yyval.command = connect_async_list (yyvsp[-1].command, (COMMAND *)NULL, '&'); @@ -2119,119 +2016,152 @@ case 124: yyval.command = command_connect (yyvsp[-1].command, (COMMAND *)NULL, '&'); if (need_here_doc) gather_here_documents (); - } - break; + ; + break;} case 125: -#line 857 "/usr/homes/chet/src/bash/src/parse.y" +#line 935 "/Users/chet/src/bash/src/parse.y" { yyval.command = yyvsp[-1].command; if (need_here_doc) gather_here_documents (); - } - break; + ; + break;} case 126: -#line 865 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, AND_AND); } - break; +#line 943 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, AND_AND); ; + break;} case 127: -#line 867 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, OR_OR); } - break; +#line 945 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, OR_OR); ; + break;} case 128: -#line 869 "/usr/homes/chet/src/bash/src/parse.y" +#line 947 "/Users/chet/src/bash/src/parse.y" { if (yyvsp[-2].command->type == cm_connection) yyval.command = connect_async_list (yyvsp[-2].command, yyvsp[0].command, '&'); else yyval.command = command_connect (yyvsp[-2].command, yyvsp[0].command, '&'); - } - break; + ; + break;} case 129: -#line 876 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = command_connect (yyvsp[-2].command, yyvsp[0].command, ';'); } - break; +#line 954 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = command_connect (yyvsp[-2].command, yyvsp[0].command, ';'); ; + break;} case 130: -#line 879 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = yyvsp[0].command; } - break; +#line 957 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = yyvsp[0].command; ; + break;} case 131: -#line 883 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = yyvsp[0].command; } - break; +#line 961 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = yyvsp[0].command; ; + break;} case 132: -#line 885 "/usr/homes/chet/src/bash/src/parse.y" +#line 963 "/Users/chet/src/bash/src/parse.y" { yyvsp[0].command->flags |= CMD_INVERT_RETURN; yyval.command = yyvsp[0].command; - } - break; + ; + break;} case 133: -#line 890 "/usr/homes/chet/src/bash/src/parse.y" +#line 968 "/Users/chet/src/bash/src/parse.y" { yyvsp[0].command->flags |= yyvsp[-1].number; yyval.command = yyvsp[0].command; - } - break; + ; + break;} case 134: -#line 895 "/usr/homes/chet/src/bash/src/parse.y" +#line 973 "/Users/chet/src/bash/src/parse.y" { yyvsp[0].command->flags |= yyvsp[-2].number|CMD_INVERT_RETURN; yyval.command = yyvsp[0].command; - } - break; + ; + break;} case 135: -#line 900 "/usr/homes/chet/src/bash/src/parse.y" +#line 978 "/Users/chet/src/bash/src/parse.y" { yyvsp[0].command->flags |= yyvsp[-1].number|CMD_INVERT_RETURN; yyval.command = yyvsp[0].command; - } - break; + ; + break;} case 136: -#line 908 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, '|'); } - break; +#line 983 "/Users/chet/src/bash/src/parse.y" +{ + ELEMENT x; + + /* Boy, this is unclean. `time' by itself can + time a null command. We cheat and push a + newline back if the list_terminator was a newline + to avoid the double-newline problem (one to + terminate this, one to terminate the command) */ + x.word = 0; + x.redirect = 0; + yyval.command = make_simple_command (x, (COMMAND *)NULL); + yyval.command->flags |= yyvsp[-1].number; + /* XXX - let's cheat and push a newline back */ + if (yyvsp[0].number == '\n') + token_to_read = '\n'; + ; + break;} case 137: -#line 910 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.command = yyvsp[0].command; } - break; +#line 1004 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, '|'); ; + break;} case 138: -#line 914 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.number = CMD_TIME_PIPELINE; } - break; +#line 1006 "/Users/chet/src/bash/src/parse.y" +{ yyval.command = yyvsp[0].command; ; + break;} case 139: -#line 916 "/usr/homes/chet/src/bash/src/parse.y" -{ yyval.number = CMD_TIME_PIPELINE|CMD_TIME_POSIX; } - break; +#line 1010 "/Users/chet/src/bash/src/parse.y" +{ yyval.number = CMD_TIME_PIPELINE; ; + break;} +case 140: +#line 1012 "/Users/chet/src/bash/src/parse.y" +{ yyval.number = CMD_TIME_PIPELINE|CMD_TIME_POSIX; ; + break;} } - -#line 705 "/usr/local/share/bison/bison.simple" - + /* the action file gets copied in in place of this dollarsign */ +#line 543 "/usr/share/bison.simple" yyvsp -= yylen; yyssp -= yylen; -#if YYLSP_NEEDED +#ifdef YYLSP_NEEDED yylsp -= yylen; #endif -#if YYDEBUG +#if YYDEBUG != 0 if (yydebug) { - short *yyssp1 = yyss - 1; - YYFPRINTF (stderr, "state stack now"); - while (yyssp1 != yyssp) - YYFPRINTF (stderr, " %d", *++yyssp1); - YYFPRINTF (stderr, "\n"); + short *ssp1 = yyss - 1; + fprintf (stderr, "state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); } #endif *++yyvsp = yyval; -#if YYLSP_NEEDED - *++yylsp = yyloc; + +#ifdef YYLSP_NEEDED + yylsp++; + if (yylen == 0) + { + yylsp->first_line = yylloc.first_line; + yylsp->first_column = yylloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } #endif - /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ yyn = yyr1[yyn]; @@ -2243,13 +2173,10 @@ case 139: goto yynewstate; +yyerrlab: /* here on detecting error */ -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ -yyerrlab: - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ { ++yynerrs; @@ -2258,121 +2185,102 @@ yyerrlab: if (yyn > YYFLAG && yyn < YYLAST) { - YYSIZE_T yysize = 0; - char *yymsg; - int yyx, yycount; - - yycount = 0; - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - for (yyx = yyn < 0 ? -yyn : 0; - yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) - if (yycheck[yyx + yyn] == yyx) - yysize += yystrlen (yytname[yyx]) + 15, yycount++; - yysize += yystrlen ("parse error, unexpected ") + 1; - yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg != 0) + int size = 0; + char *msg; + int x, count; + + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) malloc(size + 15); + if (msg != 0) { - char *yyp = yystpcpy (yymsg, "parse error, unexpected "); - yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); + strcpy(msg, "parse error"); - if (yycount < 5) + if (count < 5) { - yycount = 0; - for (yyx = yyn < 0 ? -yyn : 0; - yyx < (int) (sizeof (yytname) / sizeof (char *)); - yyx++) - if (yycheck[yyx + yyn] == yyx) + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) { - const char *yyq = ! yycount ? ", expecting " : " or "; - yyp = yystpcpy (yyp, yyq); - yyp = yystpcpy (yyp, yytname[yyx]); - yycount++; + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; } } - yyerror (yymsg); - YYSTACK_FREE (yymsg); + yyerror(msg); + free(msg); } else - yyerror ("parse error; also virtual memory exhausted"); + yyerror ("parse error; also virtual memory exceeded"); } else -#endif /* defined (YYERROR_VERBOSE) */ - yyerror ("parse error"); +#endif /* YYERROR_VERBOSE */ + yyerror("parse error"); } - goto yyerrlab1; + goto yyerrlab1; +yyerrlab1: /* here on error raised explicitly by an action */ -/*--------------------------------------------------. -| yyerrlab1 -- error raised explicitly by an action | -`--------------------------------------------------*/ -yyerrlab1: if (yyerrstatus == 3) { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + /* if just tried and failed to reuse lookahead token after an error, discard it. */ /* return failure if at end of input */ if (yychar == YYEOF) YYABORT; - YYDPRINTF ((stderr, "Discarding token %d (%s).\n", - yychar, yytname[yychar1])); + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +#endif + yychar = YYEMPTY; } - /* Else will try to reuse lookahead token after shifting the error - token. */ + /* Else will try to reuse lookahead token + after shifting the error token. */ yyerrstatus = 3; /* Each real token shifted decrements this */ goto yyerrhandle; +yyerrdefault: /* current state does not do anything special for the error token. */ -/*-------------------------------------------------------------------. -| yyerrdefault -- current state does not do anything special for the | -| error token. | -`-------------------------------------------------------------------*/ -yyerrdefault: #if 0 /* This is wrong; only states that explicitly want error tokens should shift them. */ - - /* If its default is to accept any token, ok. Otherwise pop it. */ - yyn = yydefact[yystate]; - if (yyn) - goto yydefault; + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; #endif +yyerrpop: /* pop the current state because it cannot handle the error token */ -/*---------------------------------------------------------------. -| yyerrpop -- pop the current state because it cannot handle the | -| error token | -`---------------------------------------------------------------*/ -yyerrpop: - if (yyssp == yyss) - YYABORT; + if (yyssp == yyss) YYABORT; yyvsp--; yystate = *--yyssp; -#if YYLSP_NEEDED +#ifdef YYLSP_NEEDED yylsp--; #endif -#if YYDEBUG +#if YYDEBUG != 0 if (yydebug) { - short *yyssp1 = yyss - 1; - YYFPRINTF (stderr, "Error: state stack now"); - while (yyssp1 != yyssp) - YYFPRINTF (stderr, " %d", *++yyssp1); - YYFPRINTF (stderr, "\n"); + short *ssp1 = yyss - 1; + fprintf (stderr, "Error: state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); } #endif -/*--------------. -| yyerrhandle. | -`--------------*/ yyerrhandle: + yyn = yypact[yystate]; if (yyn == YYFLAG) goto yyerrdefault; @@ -2395,67 +2303,77 @@ yyerrhandle: if (yyn == YYFINAL) YYACCEPT; - YYDPRINTF ((stderr, "Shifting error token, ")); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting error token, "); +#endif *++yyvsp = yylval; -#if YYLSP_NEEDED +#ifdef YYLSP_NEEDED *++yylsp = yylloc; #endif yystate = yyn; goto yynewstate; + yyacceptlab: + /* YYACCEPT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 0; -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -/*---------------------------------------------. -| yyoverflowab -- parser overflow comes here. | -`---------------------------------------------*/ -yyoverflowlab: - yyerror ("parser stack overflow"); - yyresult = 2; - /* Fall through. */ - -yyreturn: -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); + yyabortlab: + /* YYABORT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); #endif - return yyresult; + } + return 1; } -#line 918 "/usr/homes/chet/src/bash/src/parse.y" +#line 1014 "/Users/chet/src/bash/src/parse.y" /* Possible states for the parser that require it to do special things. */ -#define PST_CASEPAT 0x001 /* in a case pattern list */ -#define PST_ALEXPNEXT 0x002 /* expand next word for aliases */ -#define PST_ALLOWOPNBRC 0x004 /* allow open brace for function def */ -#define PST_NEEDCLOSBRC 0x008 /* need close brace */ -#define PST_DBLPAREN 0x010 /* double-paren parsing */ -#define PST_SUBSHELL 0x020 /* ( ... ) subshell */ -#define PST_CMDSUBST 0x040 /* $( ... ) command substitution */ -#define PST_CASESTMT 0x080 /* parsing a case statement */ -#define PST_CONDCMD 0x100 /* parsing a [[...]] command */ -#define PST_CONDEXPR 0x200 /* parsing the guts of [[...]] */ -#define PST_ARITHFOR 0x400 /* parsing an arithmetic for command */ +#define PST_CASEPAT 0x0001 /* in a case pattern list */ +#define PST_ALEXPNEXT 0x0002 /* expand next word for aliases */ +#define PST_ALLOWOPNBRC 0x0004 /* allow open brace for function def */ +#define PST_NEEDCLOSBRC 0x0008 /* need close brace */ +#define PST_DBLPAREN 0x0010 /* double-paren parsing */ +#define PST_SUBSHELL 0x0020 /* ( ... ) subshell */ +#define PST_CMDSUBST 0x0040 /* $( ... ) command substitution */ +#define PST_CASESTMT 0x0080 /* parsing a case statement */ +#define PST_CONDCMD 0x0100 /* parsing a [[...]] command */ +#define PST_CONDEXPR 0x0200 /* parsing the guts of [[...]] */ +#define PST_ARITHFOR 0x0400 /* parsing an arithmetic for command */ +#define PST_ALEXPAND 0x0800 /* OK to expand aliases - unused */ +#define PST_CMDTOKEN 0x1000 /* command token OK - unused */ +#define PST_COMPASSIGN 0x2000 /* parsing x=(...) compound assignment */ /* Initial size to allocate for tokens, and the amount to grow them by. */ #define TOKEN_DEFAULT_INITIAL_SIZE 496 #define TOKEN_DEFAULT_GROW_SIZE 512 +/* Should we call prompt_again? */ +#define SHOULD_PROMPT() \ + (interactive && (bash_input.type == st_stdin || bash_input.type == st_stream)) + +#if defined (ALIAS) +# define expanding_alias() (pushed_string_list && pushed_string_list->expander) +#else +# define expanding_alias() 0 +#endif + /* The token currently being read. */ static int current_token; @@ -2469,13 +2387,6 @@ static int token_before_that; /* The token read prior to token_before_that. */ static int two_tokens_ago; -/* If non-zero, it is the token that we want read_token to return - regardless of what text is (or isn't) present to be read. This - is reset by read_token. If token_to_read == WORD or - ASSIGNMENT_WORD, yylval.word should be set to word_desc_to_read. */ -static int token_to_read; -static WORD_DESC *word_desc_to_read; - /* The current parser state. */ static int parser_state; @@ -2920,10 +2831,6 @@ restore_token_state (ts) #if defined (ALIAS) || defined (DPAREN_ARITHMETIC) -#if !defined (ALIAS) -typedef void *alias_t; -#endif - #define END_OF_ALIAS 0 /* @@ -2983,7 +2890,9 @@ push_string (s, expand, ap) shell_input_line_size = strlen (s); shell_input_line_index = 0; shell_input_line_terminator = '\0'; - parser_state &= ~PST_ALEXPNEXT; +#if 0 + parser_state &= ~PST_ALEXPNEXT; /* XXX */ +#endif set_line_mbstate (); } @@ -3044,6 +2953,14 @@ free_string_list () #endif /* ALIAS || DPAREN_ARITHMETIC */ +void +free_pushed_string_input () +{ +#if defined (ALIAS) || defined (DPAREN_ARITHMETIC) + free_string_list (); +#endif +} + /* Return a line of text, taken from wherever yylex () reads input. If there is no more input, then we return NULL. If REMOVE_QUOTED_NEWLINE is non-zero, we remove unquoted \<newline> pairs. This is used by @@ -3057,9 +2974,9 @@ read_a_line (remove_quoted_newline) int indx = 0, c, peekc, pass_next; #if defined (READLINE) - if (interactive && bash_input.type != st_string && no_line_editing) + if (no_line_editing && SHOULD_PROMPT ()) #else - if (interactive && bash_input.type != st_string) + if (SHOULD_PROMPT ()) #endif print_prompt (); @@ -3108,7 +3025,10 @@ read_a_line (remove_quoted_newline) { peekc = yy_getc (); if (peekc == '\n') - continue; /* Make the unquoted \<newline> pair disappear. */ + { + line_number++; + continue; /* Make the unquoted \<newline> pair disappear. */ + } else { yy_ungetc (peekc); @@ -3137,7 +3057,8 @@ read_secondary_line (remove_quoted_newline) int remove_quoted_newline; { prompt_string_pointer = &ps2_prompt; - prompt_again (); + if (SHOULD_PROMPT()) + prompt_again (); return (read_a_line (remove_quoted_newline)); } @@ -3299,20 +3220,27 @@ shell_getc (remove_quoted_newline) i = 0; shell_input_line_terminator = 0; + /* If the shell is interatctive, but not currently printing a prompt + (interactive_shell && interactive == 0), we don't want to print + notifies or cleanup the jobs -- we want to defer it until we do + print the next prompt. */ + if (interactive_shell == 0 || SHOULD_PROMPT()) + { #if defined (JOB_CONTROL) /* This can cause a problem when reading a command as the result of a trap, when the trap is called from flush_child. This call had better not cause jobs to disappear from the job table in that case, or we will have big trouble. */ - notify_and_cleanup (); + notify_and_cleanup (); #else /* !JOB_CONTROL */ - cleanup_dead_jobs (); + cleanup_dead_jobs (); #endif /* !JOB_CONTROL */ + } #if defined (READLINE) - if (interactive && bash_input.type != st_string && no_line_editing) + if (no_line_editing && SHOULD_PROMPT()) #else - if (interactive && bash_input.type != st_string) + if (SHOULD_PROMPT()) #endif print_prompt (); @@ -3432,7 +3360,8 @@ shell_getc (remove_quoted_newline) { shell_input_line_size = 0; prompt_string_pointer = ¤t_prompt_string; - prompt_again (); + if (SHOULD_PROMPT ()) + prompt_again (); goto restart_read; } @@ -3458,7 +3387,8 @@ shell_getc (remove_quoted_newline) if MBTEST(uc == '\\' && remove_quoted_newline && shell_input_line[shell_input_line_index] == '\n') { - prompt_again (); + if (SHOULD_PROMPT ()) + prompt_again (); line_number++; goto restart_read; } @@ -3471,19 +3401,10 @@ shell_getc (remove_quoted_newline) to. */ if (!uc && (pushed_string_list != (STRING_SAVER *)NULL)) { - if (mustpop) - { - pop_string (); - uc = shell_input_line[shell_input_line_index]; - if (uc) - shell_input_line_index++; - mustpop--; - } - else - { - mustpop++; - uc = ' '; - } + pop_string (); + uc = shell_input_line[shell_input_line_index]; + if (uc) + shell_input_line_index++; } #endif /* ALIAS || DPAREN_ARITHMETIC */ @@ -3537,25 +3458,17 @@ void execute_prompt_command (command) char *command; { - sh_builtin_func_t *temp_last, *temp_this; char *last_lastarg; - int temp_exit_value, temp_eof_encountered; + sh_parser_state_t ps; - temp_last = last_shell_builtin; - temp_this = this_shell_builtin; - temp_exit_value = last_command_exit_value; - temp_eof_encountered = eof_encountered; + save_parser_state (&ps); last_lastarg = get_string_value ("_"); if (last_lastarg) last_lastarg = savestring (last_lastarg); parse_and_execute (savestring (command), "PROMPT_COMMAND", SEVAL_NONINT|SEVAL_NOHIST); - last_shell_builtin = temp_last; - this_shell_builtin = temp_this; - last_command_exit_value = temp_exit_value; - eof_encountered = temp_eof_encountered; - + restore_parser_state (&ps); bind_variable ("_", last_lastarg); FREE (last_lastarg); @@ -3595,7 +3508,7 @@ yylex () /* Avoid printing a prompt if we're not going to read anything, e.g. after resetting the parser with read_token (RESET). */ - if (token_to_read == 0 && interactive) + if (token_to_read == 0 && SHOULD_PROMPT ()) prompt_again (); } @@ -3629,8 +3542,8 @@ static int open_brace_count; (((token) == ASSIGNMENT_WORD) || \ ((token) != SEMI_SEMI && reserved_word_acceptable(token))) -#define assignment_acceptable(token) command_token_position(token) && \ - ((parser_state & PST_CASEPAT) == 0) +#define assignment_acceptable(token) \ + (command_token_position(token) && ((parser_state & PST_CASEPAT) == 0)) /* Check to see if TOKEN is a reserved word and return the token value if it is. */ @@ -3645,7 +3558,7 @@ static int open_brace_count; { \ if ((parser_state & PST_CASEPAT) && (word_token_alist[i].token != ESAC)) \ break; \ - if (word_token_alist[i].token == TIME) \ + if (word_token_alist[i].token == TIME && time_command_acceptable () == 0) \ break; \ if (word_token_alist[i].token == ESAC) \ parser_state &= ~(PST_CASEPAT|PST_CASESTMT); \ @@ -3678,6 +3591,23 @@ static int open_brace_count; Special cases that disqualify: In a pattern list in a case statement (parser_state & PST_CASEPAT). */ + +static char * +mk_alexpansion (s) + char *s; +{ + int l; + char *r; + + l = strlen (s); + r = xmalloc (l + 2); + strcpy (r, s); + if (r[l -1] != ' ') + r[l++] = ' '; + r[l] = '\0'; + return r; +} + static int alias_expand_token (tokstr) char *tokstr; @@ -3694,7 +3624,12 @@ alias_expand_token (tokstr) if (ap && (ap->flags & AL_BEINGEXPANDED)) return (NO_EXPANSION); - expanded = ap ? savestring (ap->value) : (char *)NULL; + /* mk_alexpansion puts an extra space on the end of the alias expansion, + so the lookahead by the parser works right. If this gets changed, + make sure the code in shell_getc that deals with reaching the end of + an expanded alias is changed with it. */ + expanded = ap ? mk_alexpansion (ap->value) : (char *)NULL; + if (expanded) { push_string (expanded, ap->flags & AL_EXPANDNEXT, ap); @@ -3838,10 +3773,12 @@ special_case_tokens (tokstr) return (TIMEOPT); #endif +#if 0 #if defined (COMMAND_TIMING) if (STREQ (token, "time") && ((parser_state & PST_CASEPAT) == 0) && time_command_acceptable ()) return (TIME); #endif /* COMMAND_TIMING */ +#endif #if defined (COND_COMMAND) /* [[ */ if ((parser_state & PST_CONDEXPR) && tokstr[0] == ']' && tokstr[1] == ']' && tokstr[2] == '\0') @@ -4086,6 +4023,7 @@ read_token (command) */ #define P_FIRSTCLOSE 0x01 #define P_ALLOWESC 0x02 +#define P_DQUOTE 0x04 static char matched_pair_error; static char * @@ -4097,11 +4035,14 @@ parse_matched_pair (qc, open, close, lenp, flags) int count, ch, was_dollar; int pass_next_character, nestlen, ttranslen, start_lineno; char *ret, *nestret, *ttrans; - int retind, retsize; + int retind, retsize, rflags; count = 1; pass_next_character = was_dollar = 0; + /* RFLAGS is the set of flags we want to pass to recursive calls. */ + rflags = (qc == '"') ? P_DQUOTE : (flags & P_DQUOTE); + ret = (char *)xmalloc (retsize = 64); retind = 0; @@ -4112,14 +4053,13 @@ parse_matched_pair (qc, open, close, lenp, flags) if (ch == EOF) { free (ret); - parser_error (start_lineno, "unexpected EOF while looking for matching `%c'", close); + parser_error (start_lineno, _("unexpected EOF while looking for matching `%c'"), close); EOF_Reached = 1; /* XXX */ return (&matched_pair_error); } /* Possible reprompting. */ - if (ch == '\n' && interactive && - (bash_input.type == st_stdin || bash_input.type == st_stream)) + if (ch == '\n' && SHOULD_PROMPT ()) prompt_again (); if (pass_next_character) /* last char was backslash */ @@ -4175,16 +4115,16 @@ parse_matched_pair (qc, open, close, lenp, flags) /* '', ``, or "" inside $(...) or other grouping construct. */ push_delimiter (dstack, ch); if MBTEST(was_dollar && ch == '\'') /* $'...' inside group */ - nestret = parse_matched_pair (ch, ch, ch, &nestlen, P_ALLOWESC); + nestret = parse_matched_pair (ch, ch, ch, &nestlen, P_ALLOWESC|rflags); else - nestret = parse_matched_pair (ch, ch, ch, &nestlen, 0); + nestret = parse_matched_pair (ch, ch, ch, &nestlen, rflags); pop_delimiter (dstack); if (nestret == &matched_pair_error) { free (ret); return &matched_pair_error; } - if MBTEST(was_dollar && ch == '\'') + if MBTEST(was_dollar && ch == '\'' && (extended_quote || (rflags & P_DQUOTE) == 0)) { /* Translate $'...' here. */ ttrans = ansiexpand (nestret, 0, nestlen - 1, &ttranslen); @@ -4194,7 +4134,7 @@ parse_matched_pair (qc, open, close, lenp, flags) nestlen = strlen (nestret); retind -= 2; /* back up before the $' */ } - else if MBTEST(was_dollar && ch == '"') + else if MBTEST(was_dollar && ch == '"' && (extended_quote || (rflags & P_DQUOTE) == 0)) { /* Locale expand $"..." here. */ ttrans = localeexpand (nestret, 0, nestlen - 1, start_lineno, &ttranslen); @@ -4223,7 +4163,7 @@ parse_matched_pair (qc, open, close, lenp, flags) /* XXX - sh and ksh93 don't do this - XXX */ else if MBTEST(open == '"' && ch == '`') { - nestret = parse_matched_pair (0, '`', '`', &nestlen, 0); + nestret = parse_matched_pair (0, '`', '`', &nestlen, rflags); if (nestret == &matched_pair_error) { free (ret); @@ -4243,11 +4183,11 @@ parse_matched_pair (qc, open, close, lenp, flags) if (open == ch) /* undo previous increment */ count--; if (ch == '(') /* ) */ - nestret = parse_matched_pair (0, '(', ')', &nestlen, 0); + nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags); else if (ch == '{') /* } */ - nestret = parse_matched_pair (0, '{', '}', &nestlen, P_FIRSTCLOSE); + nestret = parse_matched_pair (0, '{', '}', &nestlen, P_FIRSTCLOSE|rflags); else if (ch == '[') /* ] */ - nestret = parse_matched_pair (0, '[', ']', &nestlen, 0); + nestret = parse_matched_pair (0, '[', ']', &nestlen, rflags); if (nestret == &matched_pair_error) { free (ret); @@ -4287,19 +4227,12 @@ parse_dparen (c) if (last_read_token == FOR) { arith_for_lineno = line_number; - cmdtyp = parse_arith_cmd (&wval); + cmdtyp = parse_arith_cmd (&wval, 0); if (cmdtyp == 1) { - /* parse_arith_cmd adds quotes at the beginning and end - of the string it returns; we need to take those out. */ - len = strlen (wval); - wv2 = (char *)xmalloc (len); - strncpy (wv2, wval + 1, len - 2); - wv2[len - 2] = '\0'; - wd = make_word (wv2); + wd = make_word (wval); yylval.word_list = make_word_list (wd, (WORD_LIST *)NULL); free (wval); - free (wv2); return (ARITH_FOR_EXPRS); } else @@ -4311,11 +4244,19 @@ parse_dparen (c) if (reserved_word_acceptable (last_read_token)) { sline = line_number; - cmdtyp = parse_arith_cmd (&wval); +#if 0 + cmdtyp = parse_arith_cmd (&wval, 1); +#else + cmdtyp = parse_arith_cmd (&wval, 0); +#endif if (cmdtyp == 1) /* arithmetic command */ { wd = make_word (wval); +#if 0 wd->flags = W_QUOTED; +#else + wd->flags = W_QUOTED|W_NOSPLIT|W_NOGLOB; +#endif yylval.word_list = make_word_list (wd, (WORD_LIST *)NULL); free (wval); /* make_word copies it */ return (ARITH_CMD); @@ -4341,8 +4282,9 @@ parse_dparen (c) allocated buffer and make *ep point to that buffer. Return -1 on an error, for example EOF. */ static int -parse_arith_cmd (ep) +parse_arith_cmd (ep, adddq) char **ep; + int adddq; { int exp_lineno, rval, c; char *ttok, *tokstr; @@ -4361,20 +4303,28 @@ parse_arith_cmd (ep) tokstr = (char *)xmalloc (ttoklen + 4); - /* (( ... )) -> "..." */ - tokstr[0] = (rval == 1) ? '"' : '('; - strncpy (tokstr + 1, ttok, ttoklen - 1); /* don't copy the final `)' */ - if (rval == 1) + /* if ADDDQ != 0 then (( ... )) -> "..." */ + if (rval == 1 && adddq) /* arith cmd, add double quotes */ { + tokstr[0] = '"'; + strncpy (tokstr + 1, ttok, ttoklen - 1); tokstr[ttoklen] = '"'; tokstr[ttoklen+1] = '\0'; } - else + else if (rval == 1) /* arith cmd, don't add double quotes */ + { + strncpy (tokstr, ttok, ttoklen - 1); + tokstr[ttoklen-1] = '\0'; + } + else /* nested subshell */ { + tokstr[0] = '('; + strncpy (tokstr + 1, ttok, ttoklen - 1); tokstr[ttoklen] = ')'; tokstr[ttoklen+1] = c; tokstr[ttoklen+2] = '\0'; } + *ep = tokstr; FREE (ttok); return rval; @@ -4388,16 +4338,16 @@ cond_error () char *etext; if (EOF_Reached && cond_token != COND_ERROR) /* [[ */ - parser_error (cond_lineno, "unexpected EOF while looking for `]]'"); + parser_error (cond_lineno, _("unexpected EOF while looking for `]]'")); else if (cond_token != COND_ERROR) { if (etext = error_token_from_token (cond_token)) { - parser_error (cond_lineno, "syntax error in conditional expression: unexpected token `%s'", etext); + parser_error (cond_lineno, _("syntax error in conditional expression: unexpected token `%s'"), etext); free (etext); } else - parser_error (cond_lineno, "syntax error in conditional expression"); + parser_error (cond_lineno, _("syntax error in conditional expression")); } } @@ -4440,7 +4390,7 @@ cond_skip_newlines () { while ((cond_token = read_token (READ)) == '\n') { - if (interactive && (bash_input.type == st_stdin || bash_input.type == st_stream)) + if (SHOULD_PROMPT ()) prompt_again (); } return (cond_token); @@ -4475,11 +4425,11 @@ cond_term () dispose_cond_node (term); /* ( */ if (etext = error_token_from_token (cond_token)) { - parser_error (lineno, "unexpected token `%s', expected `)'", etext); + parser_error (lineno, _("unexpected token `%s', expected `)'"), etext); free (etext); } else - parser_error (lineno, "expected `)'"); + parser_error (lineno, _("expected `)'")); COND_RETURN_ERROR (); } term = make_cond_node (COND_EXPR, (WORD_DESC *)NULL, term, (COND_COM *)NULL); @@ -4507,11 +4457,11 @@ cond_term () dispose_word (op); if (etext = error_token_from_token (tok)) { - parser_error (line_number, "unexpected argument `%s' to conditional unary operator", etext); + parser_error (line_number, _("unexpected argument `%s' to conditional unary operator"), etext); free (etext); } else - parser_error (line_number, "unexpected argument to conditional unary operator"); + parser_error (line_number, _("unexpected argument to conditional unary operator")); COND_RETURN_ERROR (); } @@ -4526,6 +4476,10 @@ cond_term () tok = read_token (READ); if (tok == WORD && test_binop (yylval.word->word)) op = yylval.word; +#if defined (COND_REGEXP) + else if (tok == WORD && STREQ (yylval.word->word,"=~")) + op = yylval.word; +#endif else if (tok == '<' || tok == '>') op = make_word_from_token (tok); /* ( */ /* There should be a check before blindly accepting the `)' that we have @@ -4544,11 +4498,11 @@ cond_term () { if (etext = error_token_from_token (tok)) { - parser_error (line_number, "unexpected token `%s', conditional binary operator expected", etext); + parser_error (line_number, _("unexpected token `%s', conditional binary operator expected"), etext); free (etext); } else - parser_error (line_number, "conditional binary operator expected"); + parser_error (line_number, _("conditional binary operator expected")); dispose_cond_node (tleft); COND_RETURN_ERROR (); } @@ -4564,11 +4518,11 @@ cond_term () { if (etext = error_token_from_token (tok)) { - parser_error (line_number, "unexpected argument `%s' to conditional binary operator", etext); + parser_error (line_number, _("unexpected argument `%s' to conditional binary operator"), etext); free (etext); } else - parser_error (line_number, "unexpected argument to conditional binary operator"); + parser_error (line_number, _("unexpected argument to conditional binary operator")); dispose_cond_node (tleft); dispose_word (op); COND_RETURN_ERROR (); @@ -4579,14 +4533,14 @@ cond_term () else { if (tok < 256) - parser_error (line_number, "unexpected token `%c' in conditional command", tok); + parser_error (line_number, _("unexpected token `%c' in conditional command"), tok); else if (etext = error_token_from_token (tok)) { - parser_error (line_number, "unexpected token `%s' in conditional command", etext); + parser_error (line_number, _("unexpected token `%s' in conditional command"), etext); free (etext); } else - parser_error (line_number, "unexpected token %d in conditional command", tok); + parser_error (line_number, _("unexpected token %d in conditional command"), tok); COND_RETURN_ERROR (); } return (term); @@ -4617,7 +4571,7 @@ token_is_assignment (t, i) c = t[i]; c1 = t[i+1]; t[i] = '='; t[i+1] = '\0'; - r = assignment (t); + r = assignment (t, (parser_state & PST_COMPASSIGN) != 0); t[i] = c; t[i+1] = c1; return r; } @@ -4941,8 +4895,7 @@ read_token_word (character) TOKEN_DEFAULT_GROW_SIZE); next_character: - if (character == '\n' && interactive && - (bash_input.type == st_stdin || bash_input.type == st_stream)) + if (character == '\n' && SHOULD_PROMPT ()) prompt_again (); /* We want to remove quoted newlines (that is, a \<newline> pair) @@ -5011,11 +4964,11 @@ got_token: /* A word is an assignment if it appears at the beginning of a simple command, or after another assignment word. This is context-dependent, so it cannot be handled in the grammar. */ - if (assignment (token)) + if (assignment (token, (parser_state & PST_COMPASSIGN) != 0)) { the_word->flags |= W_ASSIGNMENT; /* Don't perform word splitting on assignment statements. */ - if (assignment_acceptable (last_read_token)) + if (assignment_acceptable (last_read_token) || (parser_state & PST_COMPASSIGN) != 0) the_word->flags |= W_NOSPLIT; } @@ -5024,10 +4977,19 @@ got_token: result = ((the_word->flags & (W_ASSIGNMENT|W_NOSPLIT)) == (W_ASSIGNMENT|W_NOSPLIT)) ? ASSIGNMENT_WORD : WORD; - if (last_read_token == FUNCTION) + switch (last_read_token) { + case FUNCTION: parser_state |= PST_ALLOWOPNBRC; function_dstart = line_number; + break; + case CASE: + case SELECT: + case FOR: + if (word_top < MAX_CASE_NEST) + word_top++; + word_lineno[word_top] = line_number; + break; } return (result); @@ -5185,7 +5147,7 @@ prompt_again () { char *temp_prompt; - if (!interactive) /* XXX */ + if (interactive == 0 || expanding_alias()) /* XXX */ return; ps1_prompt = get_string_value ("PS1"); @@ -5378,7 +5340,11 @@ decode_prompt_string (string) else if (c == 'A') n = strftime (timebuf, sizeof (timebuf), "%H:%M", tm); - timebuf[sizeof(timebuf) - 1] = '\0'; + if (n == 0) + timebuf[0] = '\0'; + else + timebuf[sizeof(timebuf) - 1] = '\0'; + temp = savestring (timebuf); goto add_string; @@ -5403,7 +5369,11 @@ decode_prompt_string (string) n = strftime (timebuf, sizeof (timebuf), timefmt, tm); free (timefmt); - timebuf[sizeof(timebuf) - 1] = '\0'; + if (n == 0) + timebuf[0] = '\0'; + else + timebuf[sizeof(timebuf) - 1] = '\0'; + if (promptvars || posixly_correct) /* Make sure that expand_prompt_string is called with a second argument of Q_DOUBLE_QUOTES if we use this @@ -5438,7 +5408,7 @@ decode_prompt_string (string) case 'W': { /* Use the value of PWD because it is much more efficient. */ - char t_string[PATH_MAX]; + char t_string[PATH_MAX], *t; int tlen; temp = get_string_value ("PWD"); @@ -5462,7 +5432,8 @@ decode_prompt_string (string) #define ROOT_PATH(x) ((x)[0] == '/' && (x)[1] == 0) #define DOUBLE_SLASH_ROOT(x) ((x)[0] == '/' && (x)[1] == '/' && (x)[2] == 0) - if (c == 'W') + /* Abbreviate \W as ~ if $PWD == $HOME */ + if (c == 'W' && (((t = get_string_value ("HOME")) == 0) || STREQ (t, temp) == 0)) { if (ROOT_PATH (t_string) == 0 && DOUBLE_SLASH_ROOT (t_string) == 0) { @@ -5541,6 +5512,11 @@ decode_prompt_string (string) #if defined (READLINE) case '[': case ']': + if (no_line_editing) + { + string++; + break; + } temp = (char *)xmalloc (3); temp[0] = '\001'; temp[1] = (c == '[') ? RL_PROMPT_START_IGNORE : RL_PROMPT_END_IGNORE; @@ -5760,7 +5736,7 @@ report_syntax_error (message) parser's complaining about by looking at current_token. */ if (current_token != 0 && EOF_Reached == 0 && (msg = error_token_from_token (current_token))) { - parser_error (line_number, "syntax error near unexpected token `%s'", msg); + parser_error (line_number, _("syntax error near unexpected token `%s'"), msg); free (msg); if (interactive == 0) @@ -5778,7 +5754,7 @@ report_syntax_error (message) msg = error_token_from_text (); if (msg) { - parser_error (line_number, "syntax error near `%s'", msg); + parser_error (line_number, _("syntax error near `%s'"), msg); free (msg); } @@ -5788,7 +5764,7 @@ report_syntax_error (message) } else { - msg = EOF_Reached ? "syntax error: unexpected end of file" : "syntax error"; + msg = EOF_Reached ? _("syntax error: unexpected end of file") : _("syntax error"); parser_error (line_number, "%s", msg); /* When the shell is interactive, this file uses EOF_Reached only for error reporting. Other mechanisms are used to @@ -5850,7 +5826,7 @@ handle_eof_input_unit () { if (eof_encountered < eof_encountered_limit) { - fprintf (stderr, "Use \"%s\" to leave the shell.\n", + fprintf (stderr, _("Use \"%s\" to leave the shell.\n"), login_shell ? "logout" : "exit"); eof_encountered++; /* Reset the parsing state. */ @@ -5887,8 +5863,9 @@ static WORD_LIST parse_string_error; /* Take a string and run it through the shell parser, returning the resultant word list. Used by compound array assignment. */ WORD_LIST * -parse_string_to_word_list (s, whom) +parse_string_to_word_list (s, flags, whom) char *s; + int flags; const char *whom; { WORD_LIST *wl; @@ -5920,6 +5897,10 @@ parse_string_to_word_list (s, whom) with_input_from_string (s, whom); wl = (WORD_LIST *)NULL; + + if (flags & 1) + parser_state |= PST_COMPASSIGN; + while ((tok = read_token (READ)) != yacc_EOF) { if (tok == '\n' && *bash_input.location.string == '\0') @@ -5957,6 +5938,9 @@ parse_string_to_word_list (s, whom) current_command_line_count = orig_line_count; shell_input_line_terminator = orig_input_terminator; + if (flags & 1) + parser_state &= ~PST_COMPASSIGN; + if (wl == &parse_string_error) { last_command_exit_value = EXECUTION_FAILURE; @@ -5987,15 +5971,21 @@ parse_compound_assignment (retlenp) token_buffer_size = 0; wl = (WORD_LIST *)NULL; /* ( */ + parser_state |= PST_COMPASSIGN; + while ((tok = read_token (READ)) != ')') { if (tok == '\n') /* Allow newlines in compound assignments */ - continue; + { + if (SHOULD_PROMPT ()) + prompt_again (); + continue; + } if (tok != WORD && tok != ASSIGNMENT_WORD) { current_token = tok; /* for error reporting */ if (tok == yacc_EOF) /* ( */ - parser_error (orig_line_number, "unexpected EOF while looking for matching `)'"); + parser_error (orig_line_number, _("unexpected EOF while looking for matching `)'")); else yyerror ((char *)NULL); /* does the right thing */ if (wl) @@ -6010,6 +6000,8 @@ parse_compound_assignment (retlenp) token = saved_token; token_buffer_size = orig_token_size; + parser_state &= ~PST_COMPASSIGN; + if (wl == &parse_string_error) { last_command_exit_value = EXECUTION_FAILURE; @@ -6037,6 +6029,105 @@ parse_compound_assignment (retlenp) /************************************************ * * + * SAVING AND RESTORING PARTIAL PARSE STATE * + * * + ************************************************/ + +sh_parser_state_t * +save_parser_state (ps) + sh_parser_state_t *ps; +{ +#if defined (ARRAY_VARS) + SHELL_VAR *v; +#endif + + if (ps == 0) + ps = xmalloc (sizeof (sh_parser_state_t)); + if (ps == 0) + return ((sh_parser_state_t *)NULL); + + ps->parser_state = parser_state; + ps->token_state = save_token_state (); + + ps->input_line_terminator = shell_input_line_terminator; + ps->eof_encountered = eof_encountered; + + ps->current_command_line_count = current_command_line_count; + +#if defined (HISTORY) + ps->remember_on_history = remember_on_history; +# if defined (BANG_HISTORY) + ps->history_expansion_inhibited = history_expansion_inhibited; +# endif +#endif + + ps->last_command_exit_value = last_command_exit_value; +#if defined (ARRAY_VARS) + v = find_variable ("PIPESTATUS"); + if (v && array_p (v) && array_cell (v)) + ps->pipestatus = array_copy (array_cell (v)); + else + ps->pipestatus = (ARRAY *)NULL; +#endif + + ps->last_shell_builtin = last_shell_builtin; + ps->this_shell_builtin = this_shell_builtin; + + ps->expand_aliases = expand_aliases; + ps->echo_input_at_read = echo_input_at_read; + + return (ps); +} + +void +restore_parser_state (ps) + sh_parser_state_t *ps; +{ +#if defined (ARRAY_VARS) + SHELL_VAR *v; +#endif + + if (ps == 0) + return; + + parser_state = ps->parser_state; + if (ps->token_state) + { + restore_token_state (ps->token_state); + free (ps->token_state); + } + + shell_input_line_terminator = ps->input_line_terminator; + eof_encountered = ps->eof_encountered; + + current_command_line_count = ps->current_command_line_count; + +#if defined (HISTORY) + remember_on_history = ps->remember_on_history; +# if defined (BANG_HISTORY) + history_expansion_inhibited = ps->history_expansion_inhibited; +# endif +#endif + + last_command_exit_value = ps->last_command_exit_value; +#if defined (ARRAY_VARS) + v = find_variable ("PIPESTATUS"); + if (v && array_p (v) && array_cell (v)) + { + array_dispose (array_cell (v)); + var_setarray (v, ps->pipestatus); + } +#endif + + last_shell_builtin = ps->last_shell_builtin; + this_shell_builtin = ps->this_shell_builtin; + + expand_aliases = ps->expand_aliases; + echo_input_at_read = ps->echo_input_at_read; +} + +/************************************************ + * * * MULTIBYTE CHARACTER HANDLING * * * ************************************************/ @@ -6045,7 +6136,7 @@ parse_compound_assignment (retlenp) static void set_line_mbstate () { - int i, previ, len; + int i, previ, len, c; mbstate_t mbs, prevs; size_t mbclen; @@ -6060,7 +6151,8 @@ set_line_mbstate () { mbs = prevs; - if (shell_input_line[i] == EOF) + c = shell_input_line[i]; + if (c == EOF) { int j; for (j = i; j < len; j++) @@ -6084,7 +6176,11 @@ set_line_mbstate () } else { - /* mbrlen doesn't return any other values */ + /* XXX - what to do if mbrlen returns 0? (null wide character) */ + int j; + for (j = i; j < len; j++) + shell_input_line_property[j] = 1; + break; } shell_input_line_property[i] = mbclen; |