summaryrefslogtreecommitdiff
path: root/y.tab.c
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>2000-03-17 21:46:59 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:53 +0000
commitbb70624e964126b7ac4ff085ba163a9c35ffa18f (patch)
treeba2dd4add13ada94b1899c6d4aca80195b80b74b /y.tab.c
parentb72432fdcc59300c6fe7c9d6c8a31ad3447933f5 (diff)
downloadbash-bb70624e964126b7ac4ff085ba163a9c35ffa18f.tar.gz
Imported from ../bash-2.04.tar.gz.
Diffstat (limited to 'y.tab.c')
-rw-r--r--y.tab.c1339
1 files changed, 822 insertions, 517 deletions
diff --git a/y.tab.c b/y.tab.c
index a19a1fce..dd66aa92 100644
--- a/y.tab.c
+++ b/y.tab.c
@@ -30,19 +30,20 @@
#define ASSIGNMENT_WORD 280
#define NUMBER 281
#define ARITH_CMD 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 GREATER_AND 289
-#define SEMI_SEMI 290
-#define LESS_LESS_MINUS 291
-#define AND_GREATER 292
-#define LESS_GREATER 293
-#define GREATER_BAR 294
-#define yacc_EOF 295
+#define ARITH_FOR_EXPRS 283
+#define COND_CMD 284
+#define AND_AND 285
+#define OR_OR 286
+#define GREATER_GREATER 287
+#define LESS_LESS 288
+#define LESS_AND 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"
@@ -127,6 +128,7 @@ extern Function *last_shell_builtin, *this_shell_builtin;
extern int bash_input_fd_changed;
#endif
+extern int errno;
/* **************************************************************** */
/* */
/* "Forward" declarations */
@@ -204,9 +206,12 @@ static int function_dstart;
/* The line number in a script on which a function body starts. */
static int function_bstart;
+/* The line number in a script at which an arithmetic for command starts. */
+static int arith_for_lineno;
+
static REDIRECTEE redir;
-#line 183 "/usr/homes/chet/src/bash/src/parse.y"
+#line 187 "/usr/homes/chet/src/bash/src/parse.y"
typedef union {
WORD_DESC *word; /* the word that we read. */
int number; /* the number that we read. */
@@ -226,26 +231,26 @@ typedef union {
-#define YYFINAL 269
+#define YYFINAL 279
#define YYFLAG -32768
-#define YYNTBASE 52
+#define YYNTBASE 53
-#define YYTRANSLATE(x) ((unsigned)(x) <= 295 ? yytranslate[x] : 85)
+#define YYTRANSLATE(x) ((unsigned)(x) <= 296 ? yytranslate[x] : 87)
static const char yytranslate[] = { 0,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 42,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 43,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 40, 2, 50,
- 51, 2, 2, 2, 47, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 41, 46,
- 2, 45, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 41, 2, 51,
+ 52, 2, 2, 2, 48, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 42, 47,
+ 2, 46, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 48, 44, 49, 2, 2, 2, 2, 2,
+ 2, 2, 49, 45, 50, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -262,7 +267,7 @@ static const char yytranslate[] = { 0,
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, 43
+ 36, 37, 38, 39, 40, 44
};
#if YYDEBUG != 0
@@ -272,88 +277,89 @@ static const short yyprhs[] = { 0,
64, 67, 71, 74, 78, 81, 85, 88, 92, 95,
99, 102, 105, 109, 111, 113, 115, 117, 120, 122,
125, 127, 129, 132, 134, 136, 142, 148, 150, 152,
- 154, 156, 158, 160, 162, 169, 176, 184, 192, 203,
- 214, 221, 228, 236, 244, 255, 266, 273, 281, 288,
- 294, 301, 306, 310, 316, 324, 331, 335, 337, 341,
- 346, 353, 359, 361, 364, 369, 374, 380, 386, 389,
- 393, 395, 399, 402, 404, 407, 411, 415, 419, 424,
- 429, 434, 439, 444, 446, 448, 450, 452, 453, 456,
- 458, 461, 464, 469, 474, 478, 482, 484, 486, 489,
- 492, 496, 500, 505, 507, 509
+ 154, 156, 158, 160, 162, 164, 171, 178, 186, 194,
+ 205, 216, 224, 232, 239, 246, 254, 262, 273, 284,
+ 291, 299, 306, 312, 319, 324, 328, 334, 342, 349,
+ 353, 355, 359, 364, 371, 377, 379, 382, 387, 392,
+ 398, 404, 407, 411, 413, 417, 420, 422, 425, 429,
+ 433, 437, 442, 447, 452, 457, 462, 464, 466, 468,
+ 470, 471, 474, 476, 479, 482, 487, 492, 496, 500,
+ 502, 504, 507, 510, 514, 518, 523, 525, 527
};
-static const short yyrhs[] = { 80,
- 42, 0, 42, 0, 1, 42, 0, 43, 0, 24,
- 0, 53, 24, 0, 45, 24, 0, 46, 24, 0,
- 26, 45, 24, 0, 26, 46, 24, 0, 31, 24,
- 0, 26, 31, 24, 0, 32, 24, 0, 26, 32,
- 24, 0, 33, 26, 0, 26, 33, 26, 0, 34,
- 26, 0, 26, 34, 26, 0, 33, 24, 0, 26,
- 33, 24, 0, 34, 24, 0, 26, 34, 24, 0,
- 36, 24, 0, 26, 36, 24, 0, 34, 47, 0,
- 26, 34, 47, 0, 33, 47, 0, 26, 33, 47,
- 0, 37, 24, 0, 26, 38, 24, 0, 38, 24,
- 0, 39, 24, 0, 26, 39, 24, 0, 24, 0,
- 25, 0, 54, 0, 54, 0, 56, 54, 0, 55,
- 0, 57, 55, 0, 57, 0, 59, 0, 59, 56,
- 0, 60, 0, 62, 0, 12, 75, 14, 75, 15,
- 0, 13, 75, 14, 75, 15, 0, 61, 0, 65,
- 0, 64, 0, 66, 0, 67, 0, 68, 0, 63,
- 0, 10, 24, 79, 14, 75, 15, 0, 10, 24,
- 79, 48, 75, 49, 0, 10, 24, 41, 79, 14,
- 75, 15, 0, 10, 24, 41, 79, 48, 75, 49,
- 0, 10, 24, 79, 20, 53, 78, 79, 14, 75,
- 15, 0, 10, 24, 79, 20, 53, 78, 79, 48,
- 75, 49, 0, 11, 24, 79, 14, 74, 15, 0,
- 11, 24, 79, 48, 74, 49, 0, 11, 24, 41,
- 79, 14, 74, 15, 0, 11, 24, 41, 79, 48,
- 74, 49, 0, 11, 24, 79, 20, 53, 78, 79,
- 14, 74, 15, 0, 11, 24, 79, 20, 53, 78,
- 79, 48, 74, 49, 0, 8, 24, 79, 20, 79,
- 9, 0, 8, 24, 79, 20, 72, 79, 9, 0,
- 8, 24, 79, 20, 70, 9, 0, 24, 50, 51,
- 79, 66, 0, 16, 24, 50, 51, 79, 66, 0,
- 16, 24, 79, 66, 0, 50, 75, 51, 0, 3,
- 75, 4, 75, 7, 0, 3, 75, 4, 75, 5,
- 75, 7, 0, 3, 75, 4, 75, 69, 7, 0,
- 48, 74, 49, 0, 27, 0, 17, 28, 18, 0,
- 6, 75, 4, 75, 0, 6, 75, 4, 75, 5,
- 75, 0, 6, 75, 4, 75, 69, 0, 71, 0,
- 72, 71, 0, 79, 73, 51, 75, 0, 79, 73,
- 51, 79, 0, 79, 50, 73, 51, 75, 0, 79,
- 50, 73, 51, 79, 0, 71, 35, 0, 72, 71,
- 35, 0, 24, 0, 73, 44, 24, 0, 79, 76,
- 0, 74, 0, 79, 77, 0, 77, 42, 79, 0,
- 77, 40, 79, 0, 77, 41, 79, 0, 77, 29,
- 79, 77, 0, 77, 30, 79, 77, 0, 77, 40,
- 79, 77, 0, 77, 41, 79, 77, 0, 77, 42,
- 79, 77, 0, 82, 0, 42, 0, 41, 0, 43,
- 0, 0, 79, 42, 0, 81, 0, 81, 40, 0,
- 81, 41, 0, 81, 29, 79, 81, 0, 81, 30,
- 79, 81, 0, 81, 40, 81, 0, 81, 41, 81,
- 0, 82, 0, 83, 0, 21, 83, 0, 84, 83,
- 0, 84, 21, 83, 0, 21, 84, 83, 0, 83,
- 44, 79, 83, 0, 58, 0, 22, 0, 22, 23,
- 0
+static const short yyrhs[] = { 82,
+ 43, 0, 43, 0, 1, 43, 0, 44, 0, 24,
+ 0, 54, 24, 0, 46, 24, 0, 47, 24, 0,
+ 26, 46, 24, 0, 26, 47, 24, 0, 32, 24,
+ 0, 26, 32, 24, 0, 33, 24, 0, 26, 33,
+ 24, 0, 34, 26, 0, 26, 34, 26, 0, 35,
+ 26, 0, 26, 35, 26, 0, 34, 24, 0, 26,
+ 34, 24, 0, 35, 24, 0, 26, 35, 24, 0,
+ 37, 24, 0, 26, 37, 24, 0, 35, 48, 0,
+ 26, 35, 48, 0, 34, 48, 0, 26, 34, 48,
+ 0, 38, 24, 0, 26, 39, 24, 0, 39, 24,
+ 0, 40, 24, 0, 26, 40, 24, 0, 24, 0,
+ 25, 0, 55, 0, 55, 0, 57, 55, 0, 56,
+ 0, 58, 56, 0, 58, 0, 60, 0, 60, 57,
+ 0, 61, 0, 64, 0, 12, 77, 14, 77, 15,
+ 0, 13, 77, 14, 77, 15, 0, 63, 0, 67,
+ 0, 66, 0, 68, 0, 69, 0, 70, 0, 62,
+ 0, 65, 0, 10, 24, 81, 14, 77, 15, 0,
+ 10, 24, 81, 49, 77, 50, 0, 10, 24, 42,
+ 81, 14, 77, 15, 0, 10, 24, 42, 81, 49,
+ 77, 50, 0, 10, 24, 81, 20, 54, 80, 81,
+ 14, 77, 15, 0, 10, 24, 81, 20, 54, 80,
+ 81, 49, 77, 50, 0, 10, 28, 80, 81, 14,
+ 77, 15, 0, 10, 28, 80, 81, 49, 77, 50,
+ 0, 11, 24, 81, 14, 76, 15, 0, 11, 24,
+ 81, 49, 76, 50, 0, 11, 24, 42, 81, 14,
+ 76, 15, 0, 11, 24, 42, 81, 49, 76, 50,
+ 0, 11, 24, 81, 20, 54, 80, 81, 14, 76,
+ 15, 0, 11, 24, 81, 20, 54, 80, 81, 49,
+ 76, 50, 0, 8, 24, 81, 20, 81, 9, 0,
+ 8, 24, 81, 20, 74, 81, 9, 0, 8, 24,
+ 81, 20, 72, 9, 0, 24, 51, 52, 81, 68,
+ 0, 16, 24, 51, 52, 81, 68, 0, 16, 24,
+ 81, 68, 0, 51, 77, 52, 0, 3, 77, 4,
+ 77, 7, 0, 3, 77, 4, 77, 5, 77, 7,
+ 0, 3, 77, 4, 77, 71, 7, 0, 49, 76,
+ 50, 0, 27, 0, 17, 29, 18, 0, 6, 77,
+ 4, 77, 0, 6, 77, 4, 77, 5, 77, 0,
+ 6, 77, 4, 77, 71, 0, 73, 0, 74, 73,
+ 0, 81, 75, 52, 77, 0, 81, 75, 52, 81,
+ 0, 81, 51, 75, 52, 77, 0, 81, 51, 75,
+ 52, 81, 0, 73, 36, 0, 74, 73, 36, 0,
+ 24, 0, 75, 45, 24, 0, 81, 78, 0, 76,
+ 0, 81, 79, 0, 79, 43, 81, 0, 79, 41,
+ 81, 0, 79, 42, 81, 0, 79, 30, 81, 79,
+ 0, 79, 31, 81, 79, 0, 79, 41, 81, 79,
+ 0, 79, 42, 81, 79, 0, 79, 43, 81, 79,
+ 0, 84, 0, 43, 0, 42, 0, 44, 0, 0,
+ 81, 43, 0, 83, 0, 83, 41, 0, 83, 42,
+ 0, 83, 30, 81, 83, 0, 83, 31, 81, 83,
+ 0, 83, 41, 83, 0, 83, 42, 83, 0, 84,
+ 0, 85, 0, 21, 85, 0, 86, 85, 0, 86,
+ 21, 85, 0, 21, 86, 85, 0, 85, 45, 81,
+ 85, 0, 59, 0, 22, 0, 22, 23, 0
};
#endif
#if YYDEBUG != 0
static const short yyrline[] = { 0,
- 232, 241, 248, 263, 273, 275, 279, 284, 289, 294,
- 299, 304, 309, 315, 321, 326, 331, 336, 341, 346,
- 351, 356, 361, 368, 375, 380, 385, 390, 395, 400,
- 405, 410, 415, 422, 424, 426, 430, 434, 445, 447,
- 451, 453, 455, 484, 486, 488, 490, 492, 494, 496,
- 498, 500, 502, 504, 508, 510, 512, 514, 516, 518,
- 522, 526, 530, 534, 538, 542, 548, 550, 552, 556,
- 560, 563, 567, 571, 573, 575, 580, 584, 588, 592,
- 594, 596, 600, 601, 605, 607, 609, 611, 615, 616,
- 620, 622, 631, 639, 640, 646, 647, 654, 658, 660,
- 662, 669, 671, 673, 677, 678, 679, 682, 683, 692,
- 698, 707, 715, 717, 719, 726, 729, 733, 735, 740,
- 745, 750, 757, 760, 764, 766
+ 237, 246, 253, 268, 278, 280, 284, 289, 294, 299,
+ 304, 309, 314, 320, 326, 331, 336, 341, 346, 351,
+ 356, 361, 366, 373, 380, 385, 390, 395, 400, 405,
+ 410, 415, 420, 427, 429, 431, 435, 439, 450, 452,
+ 456, 458, 460, 497, 499, 501, 503, 505, 507, 509,
+ 511, 513, 515, 517, 519, 523, 525, 527, 529, 531,
+ 533, 537, 539, 542, 546, 550, 554, 558, 562, 568,
+ 570, 572, 576, 580, 583, 587, 594, 596, 598, 603,
+ 607, 611, 615, 617, 619, 623, 624, 628, 630, 632,
+ 634, 638, 639, 643, 645, 654, 662, 663, 669, 670,
+ 677, 681, 683, 685, 692, 694, 696, 700, 701, 702,
+ 705, 706, 715, 721, 730, 738, 740, 742, 749, 752,
+ 756, 758, 763, 768, 773, 780, 783, 787, 789
};
#endif
@@ -363,32 +369,33 @@ static const short yyrline[] = { 0,
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","COND_CMD","AND_AND","OR_OR","GREATER_GREATER",
-"LESS_LESS","LESS_AND","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",
-"select_command","case_command","function_def","subshell","if_command","group_command",
-"arith_command","cond_command","elif_clause","case_clause","pattern_list","case_clause_sequence",
-"pattern","list","compound_list","list0","list1","list_terminator","newline_list",
-"simple_list","simple_list1","pipeline_command","pipeline","timespec", NULL
+"WORD","ASSIGNMENT_WORD","NUMBER","ARITH_CMD","ARITH_FOR_EXPRS","COND_CMD","AND_AND",
+"OR_OR","GREATER_GREATER","LESS_LESS","LESS_AND","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",
+"subshell","if_command","group_command","arith_command","cond_command","elif_clause",
+"case_clause","pattern_list","case_clause_sequence","pattern","list","compound_list",
+"list0","list1","list_terminator","newline_list","simple_list","simple_list1",
+"pipeline_command","pipeline","timespec", NULL
};
#endif
static const short yyr1[] = { 0,
- 52, 52, 52, 52, 53, 53, 54, 54, 54, 54,
- 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
- 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
- 54, 54, 54, 55, 55, 55, 56, 56, 57, 57,
- 58, 58, 58, 59, 59, 59, 59, 59, 59, 59,
- 59, 59, 59, 59, 60, 60, 60, 60, 60, 60,
- 61, 61, 61, 61, 61, 61, 62, 62, 62, 63,
- 63, 63, 64, 65, 65, 65, 66, 67, 68, 69,
- 69, 69, 70, 70, 71, 71, 71, 71, 72, 72,
- 73, 73, 74, 75, 75, 76, 76, 76, 77, 77,
- 77, 77, 77, 77, 78, 78, 78, 79, 79, 80,
- 80, 80, 81, 81, 81, 81, 81, 82, 82, 82,
- 82, 82, 83, 83, 84, 84
+ 53, 53, 53, 53, 54, 54, 55, 55, 55, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
+ 55, 55, 55, 56, 56, 56, 57, 57, 58, 58,
+ 59, 59, 59, 60, 60, 60, 60, 60, 60, 60,
+ 60, 60, 60, 60, 60, 61, 61, 61, 61, 61,
+ 61, 62, 62, 63, 63, 63, 63, 63, 63, 64,
+ 64, 64, 65, 65, 65, 66, 67, 67, 67, 68,
+ 69, 70, 71, 71, 71, 72, 72, 73, 73, 73,
+ 73, 74, 74, 75, 75, 76, 77, 77, 78, 78,
+ 78, 79, 79, 79, 79, 79, 79, 80, 80, 80,
+ 81, 81, 82, 82, 82, 83, 83, 83, 83, 83,
+ 84, 84, 84, 84, 84, 85, 85, 86, 86
};
static const short yyr2[] = { 0,
@@ -397,214 +404,216 @@ static const short yyr2[] = { 0,
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, 5, 5, 1, 1, 1,
- 1, 1, 1, 1, 6, 6, 7, 7, 10, 10,
- 6, 6, 7, 7, 10, 10, 6, 7, 6, 5,
- 6, 4, 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, 0, 2, 1,
- 2, 2, 4, 4, 3, 3, 1, 1, 2, 2,
- 3, 3, 4, 1, 1, 2
+ 1, 1, 1, 1, 1, 6, 6, 7, 7, 10,
+ 10, 7, 7, 6, 6, 7, 7, 10, 10, 6,
+ 7, 6, 5, 6, 4, 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,
+ 0, 2, 1, 2, 2, 4, 4, 3, 3, 1,
+ 1, 2, 2, 3, 3, 4, 1, 1, 2
};
static const short yydefact[] = { 0,
- 0, 108, 0, 0, 0, 108, 108, 0, 0, 0,
- 125, 34, 35, 0, 78, 0, 0, 0, 0, 0,
- 0, 0, 0, 2, 4, 0, 0, 108, 108, 36,
- 39, 41, 124, 42, 44, 48, 45, 54, 50, 49,
- 51, 52, 53, 0, 110, 117, 118, 0, 3, 94,
- 0, 0, 108, 108, 108, 0, 0, 108, 0, 119,
- 0, 126, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 11, 13, 19, 15, 27, 21, 17, 25,
- 23, 29, 31, 32, 7, 8, 0, 0, 0, 34,
- 40, 37, 43, 1, 108, 108, 111, 112, 108, 0,
- 120, 108, 109, 93, 95, 104, 0, 108, 0, 108,
- 0, 108, 108, 0, 0, 79, 122, 108, 12, 14,
- 20, 16, 28, 22, 18, 26, 24, 30, 33, 9,
- 10, 77, 0, 73, 38, 0, 0, 115, 116, 0,
- 121, 0, 108, 108, 108, 108, 108, 108, 0, 108,
- 0, 108, 0, 108, 0, 108, 0, 0, 108, 72,
- 0, 113, 114, 0, 0, 123, 108, 108, 74, 0,
- 0, 0, 97, 98, 96, 0, 83, 108, 0, 108,
- 108, 0, 5, 0, 0, 108, 108, 0, 0, 0,
- 46, 47, 0, 70, 0, 0, 76, 99, 100, 101,
- 102, 103, 69, 89, 84, 0, 67, 91, 0, 0,
- 0, 0, 55, 6, 106, 105, 107, 108, 56, 0,
- 0, 61, 108, 62, 71, 75, 108, 108, 108, 108,
- 90, 68, 0, 0, 108, 57, 58, 0, 63, 64,
- 0, 80, 0, 0, 0, 108, 92, 85, 86, 108,
- 108, 108, 108, 108, 82, 87, 88, 0, 0, 0,
- 0, 81, 59, 60, 65, 66, 0, 0, 0
+ 0, 111, 0, 0, 0, 111, 111, 0, 0, 0,
+ 128, 34, 35, 0, 81, 0, 0, 0, 0, 0,
+ 0, 0, 0, 2, 4, 0, 0, 111, 111, 36,
+ 39, 41, 127, 42, 44, 54, 48, 45, 55, 50,
+ 49, 51, 52, 53, 0, 113, 120, 121, 0, 3,
+ 97, 0, 0, 111, 111, 0, 111, 0, 0, 111,
+ 0, 122, 0, 129, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 11, 13, 19, 15, 27, 21,
+ 17, 25, 23, 29, 31, 32, 7, 8, 0, 0,
+ 0, 34, 40, 37, 43, 1, 111, 111, 114, 115,
+ 111, 0, 123, 111, 112, 96, 98, 107, 0, 111,
+ 0, 109, 108, 110, 111, 111, 0, 111, 111, 0,
+ 0, 82, 125, 111, 12, 14, 20, 16, 28, 22,
+ 18, 26, 24, 30, 33, 9, 10, 80, 0, 76,
+ 38, 0, 0, 118, 119, 0, 124, 0, 111, 111,
+ 111, 111, 111, 111, 0, 111, 0, 111, 0, 0,
+ 111, 0, 111, 0, 0, 111, 75, 0, 116, 117,
+ 0, 0, 126, 111, 111, 77, 0, 0, 0, 100,
+ 101, 99, 0, 86, 111, 0, 111, 111, 0, 5,
+ 0, 0, 111, 111, 111, 111, 0, 0, 0, 46,
+ 47, 0, 73, 0, 0, 79, 102, 103, 104, 105,
+ 106, 72, 92, 87, 0, 70, 94, 0, 0, 0,
+ 0, 56, 6, 111, 57, 0, 0, 0, 0, 64,
+ 111, 65, 74, 78, 111, 111, 111, 111, 93, 71,
+ 0, 0, 111, 58, 59, 0, 62, 63, 66, 67,
+ 0, 83, 0, 0, 0, 111, 95, 88, 89, 111,
+ 111, 111, 111, 111, 85, 90, 91, 0, 0, 0,
+ 0, 84, 60, 61, 68, 69, 0, 0, 0
};
-static const short yydefgoto[] = { 267,
- 184, 30, 31, 93, 32, 33, 34, 35, 36, 37,
- 38, 39, 40, 41, 42, 43, 170, 176, 177, 178,
- 210, 50, 51, 104, 105, 218, 52, 44, 138, 106,
- 47, 48
+static const short yydefgoto[] = { 277,
+ 191, 30, 31, 95, 32, 33, 34, 35, 36, 37,
+ 38, 39, 40, 41, 42, 43, 44, 177, 183, 184,
+ 185, 219, 51, 52, 106, 107, 115, 53, 45, 144,
+ 108, 48, 49
};
-static const short yypact[] = { 246,
- -34,-32768, 11, 20, 24,-32768,-32768, 33, -10, 369,
- 29, 19,-32768, 529,-32768, 42, 47, 30, 36, 64,
- 66, 78, 81,-32768,-32768, 84, 92,-32768,-32768,-32768,
--32768, 155,-32768, 513,-32768,-32768,-32768,-32768,-32768,-32768,
--32768,-32768,-32768, 89, -15,-32768, 77, 410,-32768,-32768,
- 130, 287,-32768, 95, 99, 127, 131, 97, 132, 77,
- 492,-32768, 100, 128, 129, 44, 56, 134, 135, 136,
- 139, 140,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
--32768,-32768,-32768,-32768,-32768,-32768, 105, 287, 104,-32768,
--32768,-32768, 513,-32768,-32768,-32768, 328, 328,-32768, 492,
- 77,-32768,-32768,-32768, 88,-32768, 1,-32768, -1,-32768,
- 16,-32768,-32768, 116, -32,-32768, 77,-32768,-32768,-32768,
+static const short yypact[] = { 256,
+ -9,-32768, 28, 54, 31,-32768,-32768, 38, -14, 382,
+ 49, 24,-32768, 188,-32768, 41, 56, 35, 42, 61,
+ 73, 75, 100,-32768,-32768, 111, 112,-32768,-32768,-32768,
+-32768, 171,-32768, 530,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768, 95, 124,-32768, 59, 424,-32768,
+-32768, 136, 298,-32768, 104, 64, 107, 137, 142, 106,
+ 140, 59, 508,-32768, 108, 135, 138, 45, 55, 139,
+ 143, 146, 154, 155,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 114, 298,
+ 131,-32768,-32768,-32768, 530,-32768,-32768,-32768, 340, 340,
+-32768, 508, 59,-32768,-32768,-32768, 80,-32768, -8,-32768,
+ -4,-32768,-32768,-32768,-32768,-32768, -1,-32768,-32768, 132,
+ -11,-32768, 59,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 80,-32768,
+-32768, 298, 298, 89, 89, 466, 59, 82,-32768,-32768,
+-32768,-32768,-32768,-32768, -3,-32768, 156,-32768, 4, 11,
+-32768, 156,-32768, 170, 177,-32768,-32768, -11,-32768,-32768,
+ 340, 340, 59,-32768,-32768,-32768, 179, 298, 298, 298,
+ 298, 298, 184, 158,-32768, -2,-32768,-32768, 183,-32768,
+ 52, 149,-32768,-32768,-32768,-32768, 186, 52, 152,-32768,
+-32768, -11,-32768, 208, 212,-32768,-32768,-32768, 101, 101,
+ 101,-32768,-32768, 190, 0,-32768,-32768, 200, -31, 215,
+ 181,-32768,-32768,-32768,-32768, 218, 191, 221, 194,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
--32768,-32768, 88,-32768,-32768, 287, 287, 69, 69, 451,
- 77, 79,-32768,-32768,-32768,-32768,-32768,-32768, 3,-32768,
- 144,-32768, 13,-32768, 144,-32768, 141, 157,-32768,-32768,
- -32,-32768,-32768, 328, 328, 77,-32768,-32768,-32768, 166,
- 287, 287, 287, 287, 287, 169, 147,-32768, -4,-32768,
--32768, 175,-32768, 52, 146,-32768,-32768, 181, 52, 149,
--32768,-32768, -32,-32768, 192, 199,-32768,-32768,-32768, 71,
- 71, 71,-32768,-32768, 170, 0,-32768,-32768, 180, -22,
- 191, 161,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 196,
- 163,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
--32768,-32768, 28, 189,-32768,-32768,-32768, 17,-32768,-32768,
- 25, 114, 287, 287, 287,-32768,-32768,-32768, 287,-32768,
--32768,-32768,-32768,-32768,-32768,-32768, 287, 200, 167, 202,
- 171,-32768,-32768,-32768,-32768,-32768, 218, 219,-32768
+ -25, 216,-32768,-32768,-32768, 14,-32768,-32768,-32768,-32768,
+ 15, 128, 298, 298, 298,-32768,-32768,-32768, 298,-32768,
+-32768,-32768,-32768,-32768,-32768,-32768, 298, 230, 196, 232,
+ 198,-32768,-32768,-32768,-32768,-32768, 249, 251,-32768
};
static const short yypgoto[] = {-32768,
- 67, -30, 194,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
--32768,-32768,-32768, -112,-32768,-32768, -19,-32768, 46,-32768,
- 18, -17, -6,-32768, -60, 39, -21,-32768, 6, 12,
- -8, 220
+ 90, -28, 224,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768, -118,-32768,-32768, 1,-32768, 76,
+-32768, 44, -20, -6,-32768, -64, -154, -24,-32768, 5,
+ 2, 7, 250
};
-#define YYLAST 575
-
-
-static const short yytable[] = { 56,
- 57, 60, 160, 92, 207, 45, 88, 49, 232, 103,
- 87, 46, 150, 95, 96, 28, 180, 59, 151, 208,
- 148, 234, 89, 208, 97, 98, 186, 133, 235, 154,
- 250, 107, 109, 111, 53, 155, 115, 103, 252, 101,
- 103, 103, 103, 54, 103, 209, 152, 55, 194, 209,
- 181, 62, 117, 75, 103, 76, 58, 103, 103, 78,
- 187, 79, 135, 156, 251, 73, 103, 121, 63, 122,
- 74, 234, 253, 136, 137, 214, 77, 140, 246, 124,
- 225, 125, 80, 167, 168, 169, 149, 81, 153, 82,
- 123, 141, 215, 216, 217, 142, 161, 95, 96, 143,
- 144, 83, 126, 139, 84, 157, 158, 85, 46, 46,
- 198, 199, 200, 201, 202, 86, 143, 144, 254, 168,
- 99, 171, 172, 173, 174, 175, 179, 145, 146, 147,
- 94, 166, 88, 102, 88, 108, 188, 193, 190, 110,
- 112, 162, 163, 182, 113, 185, 114, 46, 46, 116,
- 118, 119, 120, 132, 134, 191, 206, 127, 128, 129,
- 195, 196, 130, 131, 88, 88, 159, 183, 220, 221,
- 139, 192, 197, 211, 212, 46, 46, 203, 90, 13,
- 14, 204, 200, 201, 202, 16, 17, 18, 19, 213,
- 20, 21, 22, 23, 219, 222, 238, 224, 226, 26,
- 27, 241, 227, 208, 231, 236, 243, 244, 245, 237,
- 239, 240, 247, 249, 263, 264, 265, 268, 269, 266,
- 242, 189, 255, 205, 257, 91, 233, 223, 248, 61,
- 88, 88, 0, 0, 260, 261, 0, 0, 0, 256,
- 0, 0, 0, 258, 259, 0, 1, 262, 2, 0,
- 0, 0, 0, 3, 0, 4, 5, 6, 7, 0,
+#define YYLAST 577
+
+
+static const short yytable[] = { 58,
+ 59, 47, 167, 90, 46, 94, 216, 89, 240, 156,
+ 187, 154, 161, 242, 61, 157, 62, 193, 162, 242,
+ 243, 217, 91, 217, 195, 139, 256, 260, 262, 109,
+ 111, 105, 117, 50, 105, 121, 224, 28, 105, 105,
+ 105, 105, 105, 231, 158, 188, 105, 163, 218, 203,
+ 218, 54, 194, 105, 57, 103, 105, 105, 77, 196,
+ 78, 60, 261, 263, 75, 80, 141, 81, 127, 123,
+ 128, 64, 142, 143, 65, 223, 146, 55, 130, 76,
+ 131, 56, 79, 233, 83, 155, 174, 175, 176, 82,
+ 159, 160, 129, 112, 113, 114, 84, 148, 85, 168,
+ 47, 47, 132, 101, 145, 112, 113, 114, 147, 149,
+ 150, 164, 165, 207, 208, 209, 210, 211, 97, 98,
+ 151, 152, 153, 86, 178, 179, 180, 181, 182, 186,
+ 149, 150, 264, 175, 87, 88, 90, 96, 90, 104,
+ 197, 202, 199, 47, 47, 110, 169, 170, 116, 189,
+ 118, 192, 173, 97, 98, 119, 120, 122, 125, 124,
+ 215, 126, 133, 138, 99, 100, 134, 204, 205, 135,
+ 90, 90, 47, 47, 228, 229, 145, 136, 137, 190,
+ 220, 221, 140, 166, 200, 206, 226, 227, 209, 210,
+ 211, 201, 212, 213, 92, 13, 14, 222, 225, 246,
+ 230, 232, 16, 17, 18, 19, 251, 20, 21, 22,
+ 23, 253, 254, 255, 234, 235, 26, 27, 259, 66,
+ 67, 68, 69, 217, 70, 239, 71, 72, 252, 244,
+ 245, 267, 247, 73, 74, 249, 258, 90, 90, 257,
+ 248, 270, 271, 250, 273, 274, 275, 276, 278, 266,
+ 279, 198, 265, 268, 269, 93, 1, 272, 2, 63,
+ 214, 241, 0, 3, 0, 4, 5, 6, 7, 0,
0, 8, 9, 0, 0, 0, 10, 11, 0, 12,
- 13, 14, 15, 0, 0, 0, 16, 17, 18, 19,
- 0, 20, 21, 22, 23, 0, 0, 24, 25, 2,
- 26, 27, 0, 28, 3, 29, 4, 5, 6, 7,
- 0, 0, 8, 9, 0, 0, 0, 10, 11, 0,
- 12, 13, 14, 15, 0, 0, 0, 16, 17, 18,
- 19, 0, 20, 21, 22, 23, 0, 0, 103, 0,
+ 13, 14, 15, 0, 0, 0, 0, 16, 17, 18,
+ 19, 0, 20, 21, 22, 23, 0, 0, 24, 25,
2, 26, 27, 0, 28, 3, 29, 4, 5, 6,
7, 0, 0, 8, 9, 0, 0, 0, 10, 11,
- 0, 12, 13, 14, 15, 0, 0, 0, 16, 17,
- 18, 19, 0, 20, 21, 22, 23, 0, 0, 0,
- 0, 2, 26, 27, 0, 28, 3, 29, 4, 5,
- 6, 7, 0, 0, 8, 9, 0, 0, 0, 0,
- 11, 0, 12, 13, 14, 15, 0, 0, 0, 16,
+ 0, 12, 13, 14, 15, 0, 0, 0, 0, 16,
17, 18, 19, 0, 20, 21, 22, 23, 0, 0,
- 0, 0, 2, 26, 27, 0, 28, 3, 29, 4,
+ 105, 0, 2, 26, 27, 0, 28, 3, 29, 4,
5, 6, 7, 0, 0, 8, 9, 0, 0, 0,
- 100, 0, 0, 12, 13, 14, 15, 0, 0, 0,
- 16, 17, 18, 19, 0, 20, 21, 22, 23, 0,
- 0, 0, 0, 2, 26, 27, 0, 28, 3, 29,
- 4, 5, 6, 7, 0, 0, 8, 9, 0, 0,
- 0, 0, 0, 0, 12, 13, 14, 15, 0, 0,
+ 10, 11, 0, 12, 13, 14, 15, 0, 0, 0,
0, 16, 17, 18, 19, 0, 20, 21, 22, 23,
- 0, 0, 103, 0, 2, 26, 27, 0, 28, 3,
+ 0, 0, 0, 0, 2, 26, 27, 0, 28, 3,
29, 4, 5, 6, 7, 0, 0, 8, 9, 0,
- 0, 0, 0, 0, 0, 12, 13, 14, 15, 0,
- 0, 0, 16, 17, 18, 19, 0, 20, 21, 22,
- 23, 0, 0, 0, 0, 0, 26, 27, 14, 28,
- 0, 29, 0, 16, 17, 18, 19, 0, 20, 21,
- 22, 23, 0, 0, 0, 0, 0, 26, 27, 64,
- 65, 66, 67, 0, 68, 0, 69, 70, 0, 0,
- 0, 0, 0, 71, 72
+ 0, 0, 0, 11, 0, 12, 13, 14, 15, 0,
+ 0, 0, 0, 16, 17, 18, 19, 0, 20, 21,
+ 22, 23, 0, 0, 0, 0, 2, 26, 27, 0,
+ 28, 3, 29, 4, 5, 6, 7, 0, 0, 8,
+ 9, 0, 0, 0, 102, 0, 0, 12, 13, 14,
+ 15, 0, 0, 0, 0, 16, 17, 18, 19, 0,
+ 20, 21, 22, 23, 0, 0, 0, 0, 2, 26,
+ 27, 0, 28, 3, 29, 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, 0, 20, 21, 22, 23, 0, 0, 105, 0,
+ 2, 26, 27, 0, 28, 3, 29, 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, 0, 20, 21, 22, 23, 0, 0,
+ 0, 0, 0, 26, 27, 14, 28, 0, 29, 0,
+ 0, 16, 17, 18, 19, 0, 20, 21, 22, 23,
+ 0, 0, 0, 0, 0, 26, 27
};
static const short yycheck[] = { 6,
- 7, 10, 115, 34, 9, 0, 28, 42, 9, 42,
- 28, 0, 14, 29, 30, 48, 14, 28, 20, 24,
- 20, 44, 29, 24, 40, 41, 14, 88, 51, 14,
- 14, 53, 54, 55, 24, 20, 58, 42, 14, 48,
- 42, 42, 42, 24, 42, 50, 48, 24, 161, 50,
- 48, 23, 61, 24, 42, 26, 24, 42, 42, 24,
- 48, 26, 93, 48, 48, 24, 42, 24, 50, 26,
- 24, 44, 48, 95, 96, 24, 47, 99, 51, 24,
- 193, 26, 47, 5, 6, 7, 108, 24, 110, 24,
- 47, 100, 41, 42, 43, 102, 118, 29, 30, 29,
- 30, 24, 47, 98, 24, 112, 113, 24, 97, 98,
- 171, 172, 173, 174, 175, 24, 29, 30, 5, 6,
- 44, 143, 144, 145, 146, 147, 148, 40, 41, 42,
- 42, 140, 154, 4, 156, 41, 154, 159, 156, 41,
- 14, 136, 137, 150, 14, 152, 50, 136, 137, 18,
- 51, 24, 24, 49, 51, 15, 178, 24, 24, 24,
- 167, 168, 24, 24, 186, 187, 51, 24, 186, 187,
- 165, 15, 7, 180, 181, 164, 165, 9, 24, 25,
- 26, 35, 243, 244, 245, 31, 32, 33, 34, 15,
- 36, 37, 38, 39, 49, 15, 218, 49, 7, 45,
- 46, 223, 4, 24, 35, 15, 228, 229, 230, 49,
- 15, 49, 24, 235, 15, 49, 15, 0, 0, 49,
- 227, 155, 242, 178, 246, 32, 209, 189, 235, 10,
- 252, 253, -1, -1, 252, 253, -1, -1, -1, 246,
- -1, -1, -1, 250, 251, -1, 1, 254, 3, -1,
- -1, -1, -1, 8, -1, 10, 11, 12, 13, -1,
+ 7, 0, 121, 28, 0, 34, 9, 28, 9, 14,
+ 14, 20, 14, 45, 29, 20, 10, 14, 20, 45,
+ 52, 24, 29, 24, 14, 90, 52, 14, 14, 54,
+ 55, 43, 57, 43, 43, 60, 191, 49, 43, 43,
+ 43, 43, 43, 198, 49, 49, 43, 49, 51, 168,
+ 51, 24, 49, 43, 24, 49, 43, 43, 24, 49,
+ 26, 24, 49, 49, 24, 24, 95, 26, 24, 63,
+ 26, 23, 97, 98, 51, 24, 101, 24, 24, 24,
+ 26, 28, 48, 202, 24, 110, 5, 6, 7, 48,
+ 115, 116, 48, 42, 43, 44, 24, 104, 24, 124,
+ 99, 100, 48, 45, 100, 42, 43, 44, 102, 30,
+ 31, 118, 119, 178, 179, 180, 181, 182, 30, 31,
+ 41, 42, 43, 24, 149, 150, 151, 152, 153, 154,
+ 30, 31, 5, 6, 24, 24, 161, 43, 163, 4,
+ 161, 166, 163, 142, 143, 42, 142, 143, 42, 156,
+ 14, 158, 146, 30, 31, 14, 51, 18, 24, 52,
+ 185, 24, 24, 50, 41, 42, 24, 174, 175, 24,
+ 195, 196, 171, 172, 195, 196, 172, 24, 24, 24,
+ 187, 188, 52, 52, 15, 7, 193, 194, 253, 254,
+ 255, 15, 9, 36, 24, 25, 26, 15, 50, 224,
+ 15, 50, 32, 33, 34, 35, 231, 37, 38, 39,
+ 40, 236, 237, 238, 7, 4, 46, 47, 243, 32,
+ 33, 34, 35, 24, 37, 36, 39, 40, 235, 15,
+ 50, 256, 15, 46, 47, 15, 243, 262, 263, 24,
+ 50, 262, 263, 50, 15, 50, 15, 50, 0, 256,
+ 0, 162, 252, 260, 261, 32, 1, 264, 3, 10,
+ 185, 218, -1, 8, -1, 10, 11, 12, 13, -1,
-1, 16, 17, -1, -1, -1, 21, 22, -1, 24,
- 25, 26, 27, -1, -1, -1, 31, 32, 33, 34,
- -1, 36, 37, 38, 39, -1, -1, 42, 43, 3,
- 45, 46, -1, 48, 8, 50, 10, 11, 12, 13,
- -1, -1, 16, 17, -1, -1, -1, 21, 22, -1,
- 24, 25, 26, 27, -1, -1, -1, 31, 32, 33,
- 34, -1, 36, 37, 38, 39, -1, -1, 42, -1,
- 3, 45, 46, -1, 48, 8, 50, 10, 11, 12,
+ 25, 26, 27, -1, -1, -1, -1, 32, 33, 34,
+ 35, -1, 37, 38, 39, 40, -1, -1, 43, 44,
+ 3, 46, 47, -1, 49, 8, 51, 10, 11, 12,
13, -1, -1, 16, 17, -1, -1, -1, 21, 22,
- -1, 24, 25, 26, 27, -1, -1, -1, 31, 32,
- 33, 34, -1, 36, 37, 38, 39, -1, -1, -1,
- -1, 3, 45, 46, -1, 48, 8, 50, 10, 11,
- 12, 13, -1, -1, 16, 17, -1, -1, -1, -1,
- 22, -1, 24, 25, 26, 27, -1, -1, -1, 31,
- 32, 33, 34, -1, 36, 37, 38, 39, -1, -1,
- -1, -1, 3, 45, 46, -1, 48, 8, 50, 10,
+ -1, 24, 25, 26, 27, -1, -1, -1, -1, 32,
+ 33, 34, 35, -1, 37, 38, 39, 40, -1, -1,
+ 43, -1, 3, 46, 47, -1, 49, 8, 51, 10,
11, 12, 13, -1, -1, 16, 17, -1, -1, -1,
- 21, -1, -1, 24, 25, 26, 27, -1, -1, -1,
- 31, 32, 33, 34, -1, 36, 37, 38, 39, -1,
- -1, -1, -1, 3, 45, 46, -1, 48, 8, 50,
- 10, 11, 12, 13, -1, -1, 16, 17, -1, -1,
- -1, -1, -1, -1, 24, 25, 26, 27, -1, -1,
- -1, 31, 32, 33, 34, -1, 36, 37, 38, 39,
- -1, -1, 42, -1, 3, 45, 46, -1, 48, 8,
- 50, 10, 11, 12, 13, -1, -1, 16, 17, -1,
- -1, -1, -1, -1, -1, 24, 25, 26, 27, -1,
- -1, -1, 31, 32, 33, 34, -1, 36, 37, 38,
- 39, -1, -1, -1, -1, -1, 45, 46, 26, 48,
- -1, 50, -1, 31, 32, 33, 34, -1, 36, 37,
- 38, 39, -1, -1, -1, -1, -1, 45, 46, 31,
- 32, 33, 34, -1, 36, -1, 38, 39, -1, -1,
- -1, -1, -1, 45, 46
+ 21, 22, -1, 24, 25, 26, 27, -1, -1, -1,
+ -1, 32, 33, 34, 35, -1, 37, 38, 39, 40,
+ -1, -1, -1, -1, 3, 46, 47, -1, 49, 8,
+ 51, 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, -1, 37, 38,
+ 39, 40, -1, -1, -1, -1, 3, 46, 47, -1,
+ 49, 8, 51, 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, -1,
+ 37, 38, 39, 40, -1, -1, -1, -1, 3, 46,
+ 47, -1, 49, 8, 51, 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, -1, 37, 38, 39, 40, -1, -1, 43, -1,
+ 3, 46, 47, -1, 49, 8, 51, 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, -1, 37, 38, 39, 40, -1, -1,
+ -1, -1, -1, 46, 47, 26, 49, -1, 51, -1,
+ -1, 32, 33, 34, 35, -1, 37, 38, 39, 40,
+ -1, -1, -1, -1, -1, 46, 47
};
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "/usr/share/misc/bison.simple"
@@ -1105,7 +1114,7 @@ yyreduce:
switch (yyn) {
case 1:
-#line 233 "/usr/homes/chet/src/bash/src/parse.y"
+#line 238 "/usr/homes/chet/src/bash/src/parse.y"
{
/* Case of regular command. Discard the error
safety net,and return the command just parsed. */
@@ -1116,7 +1125,7 @@ case 1:
;
break;}
case 2:
-#line 242 "/usr/homes/chet/src/bash/src/parse.y"
+#line 247 "/usr/homes/chet/src/bash/src/parse.y"
{
/* Case of regular command, but not a very
interesting one. Return a NULL command. */
@@ -1125,7 +1134,7 @@ case 2:
;
break;}
case 3:
-#line 249 "/usr/homes/chet/src/bash/src/parse.y"
+#line 254 "/usr/homes/chet/src/bash/src/parse.y"
{
/* Error during parsing. Return NULL command. */
global_command = (COMMAND *)NULL;
@@ -1142,7 +1151,7 @@ case 3:
;
break;}
case 4:
-#line 264 "/usr/homes/chet/src/bash/src/parse.y"
+#line 269 "/usr/homes/chet/src/bash/src/parse.y"
{
/* Case of EOF seen by itself. Do ignoreeof or
not. */
@@ -1152,57 +1161,57 @@ case 4:
;
break;}
case 5:
-#line 274 "/usr/homes/chet/src/bash/src/parse.y"
+#line 279 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.word_list = make_word_list (yyvsp[0].word, (WORD_LIST *)NULL); ;
break;}
case 6:
-#line 276 "/usr/homes/chet/src/bash/src/parse.y"
+#line 281 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.word_list = make_word_list (yyvsp[0].word, yyvsp[-1].word_list); ;
break;}
case 7:
-#line 280 "/usr/homes/chet/src/bash/src/parse.y"
+#line 285 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (1, r_output_direction, redir);
;
break;}
case 8:
-#line 285 "/usr/homes/chet/src/bash/src/parse.y"
+#line 290 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (0, r_input_direction, redir);
;
break;}
case 9:
-#line 290 "/usr/homes/chet/src/bash/src/parse.y"
+#line 295 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_output_direction, redir);
;
break;}
case 10:
-#line 295 "/usr/homes/chet/src/bash/src/parse.y"
+#line 300 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_input_direction, redir);
;
break;}
case 11:
-#line 300 "/usr/homes/chet/src/bash/src/parse.y"
+#line 305 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (1, r_appending_to, redir);
;
break;}
case 12:
-#line 305 "/usr/homes/chet/src/bash/src/parse.y"
+#line 310 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_appending_to, redir);
;
break;}
case 13:
-#line 310 "/usr/homes/chet/src/bash/src/parse.y"
+#line 315 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (0, r_reading_until, redir);
@@ -1210,7 +1219,7 @@ case 13:
;
break;}
case 14:
-#line 316 "/usr/homes/chet/src/bash/src/parse.y"
+#line 321 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_reading_until, redir);
@@ -1218,63 +1227,63 @@ case 14:
;
break;}
case 15:
-#line 322 "/usr/homes/chet/src/bash/src/parse.y"
+#line 327 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.dest = yyvsp[0].number;
yyval.redirect = make_redirection (0, r_duplicating_input, redir);
;
break;}
case 16:
-#line 327 "/usr/homes/chet/src/bash/src/parse.y"
+#line 332 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.dest = yyvsp[0].number;
yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_input, redir);
;
break;}
case 17:
-#line 332 "/usr/homes/chet/src/bash/src/parse.y"
+#line 337 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.dest = yyvsp[0].number;
yyval.redirect = make_redirection (1, r_duplicating_output, redir);
;
break;}
case 18:
-#line 337 "/usr/homes/chet/src/bash/src/parse.y"
+#line 342 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.dest = yyvsp[0].number;
yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_output, redir);
;
break;}
case 19:
-#line 342 "/usr/homes/chet/src/bash/src/parse.y"
+#line 347 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (0, r_duplicating_input_word, redir);
;
break;}
case 20:
-#line 347 "/usr/homes/chet/src/bash/src/parse.y"
+#line 352 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_input_word, redir);
;
break;}
case 21:
-#line 352 "/usr/homes/chet/src/bash/src/parse.y"
+#line 357 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (1, r_duplicating_output_word, redir);
;
break;}
case 22:
-#line 357 "/usr/homes/chet/src/bash/src/parse.y"
+#line 362 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_duplicating_output_word, redir);
;
break;}
case 23:
-#line 362 "/usr/homes/chet/src/bash/src/parse.y"
+#line 367 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection
@@ -1283,7 +1292,7 @@ case 23:
;
break;}
case 24:
-#line 369 "/usr/homes/chet/src/bash/src/parse.y"
+#line 374 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection
@@ -1292,88 +1301,88 @@ case 24:
;
break;}
case 25:
-#line 376 "/usr/homes/chet/src/bash/src/parse.y"
+#line 381 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.dest = 0L;
yyval.redirect = make_redirection (1, r_close_this, redir);
;
break;}
case 26:
-#line 381 "/usr/homes/chet/src/bash/src/parse.y"
+#line 386 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.dest = 0L;
yyval.redirect = make_redirection (yyvsp[-2].number, r_close_this, redir);
;
break;}
case 27:
-#line 386 "/usr/homes/chet/src/bash/src/parse.y"
+#line 391 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.dest = 0L;
yyval.redirect = make_redirection (0, r_close_this, redir);
;
break;}
case 28:
-#line 391 "/usr/homes/chet/src/bash/src/parse.y"
+#line 396 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.dest = 0L;
yyval.redirect = make_redirection (yyvsp[-2].number, r_close_this, redir);
;
break;}
case 29:
-#line 396 "/usr/homes/chet/src/bash/src/parse.y"
+#line 401 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (1, r_err_and_out, redir);
;
break;}
case 30:
-#line 401 "/usr/homes/chet/src/bash/src/parse.y"
+#line 406 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_input_output, redir);
;
break;}
case 31:
-#line 406 "/usr/homes/chet/src/bash/src/parse.y"
+#line 411 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (0, r_input_output, redir);
;
break;}
case 32:
-#line 411 "/usr/homes/chet/src/bash/src/parse.y"
+#line 416 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (1, r_output_force, redir);
;
break;}
case 33:
-#line 416 "/usr/homes/chet/src/bash/src/parse.y"
+#line 421 "/usr/homes/chet/src/bash/src/parse.y"
{
redir.filename = yyvsp[0].word;
yyval.redirect = make_redirection (yyvsp[-2].number, r_output_force, redir);
;
break;}
case 34:
-#line 423 "/usr/homes/chet/src/bash/src/parse.y"
+#line 428 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.element.word = yyvsp[0].word; yyval.element.redirect = 0; ;
break;}
case 35:
-#line 425 "/usr/homes/chet/src/bash/src/parse.y"
+#line 430 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.element.word = yyvsp[0].word; yyval.element.redirect = 0; ;
break;}
case 36:
-#line 427 "/usr/homes/chet/src/bash/src/parse.y"
+#line 432 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.element.redirect = yyvsp[0].redirect; yyval.element.word = 0; ;
break;}
case 37:
-#line 431 "/usr/homes/chet/src/bash/src/parse.y"
+#line 436 "/usr/homes/chet/src/bash/src/parse.y"
{
yyval.redirect = yyvsp[0].redirect;
;
break;}
case 38:
-#line 435 "/usr/homes/chet/src/bash/src/parse.y"
+#line 440 "/usr/homes/chet/src/bash/src/parse.y"
{
register REDIRECT *t;
@@ -1384,23 +1393,23 @@ case 38:
;
break;}
case 39:
-#line 446 "/usr/homes/chet/src/bash/src/parse.y"
+#line 451 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = make_simple_command (yyvsp[0].element, (COMMAND *)NULL); ;
break;}
case 40:
-#line 448 "/usr/homes/chet/src/bash/src/parse.y"
+#line 453 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = make_simple_command (yyvsp[0].element, yyvsp[-1].command); ;
break;}
case 41:
-#line 452 "/usr/homes/chet/src/bash/src/parse.y"
+#line 457 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = clean_simple_command (yyvsp[0].command); ;
break;}
case 42:
-#line 454 "/usr/homes/chet/src/bash/src/parse.y"
+#line 459 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
case 43:
-#line 456 "/usr/homes/chet/src/bash/src/parse.y"
+#line 461 "/usr/homes/chet/src/bash/src/parse.y"
{
COMMAND *tc;
@@ -1410,6 +1419,14 @@ case 43:
be attached to the function and performed when
the function is executed, not as part of the
function definition command. */
+ /* XXX - I don't think it matters, but we might
+ want to change this in the future to avoid
+ problems differentiating between a function
+ definition with a redirection and a function
+ definition containing a single command with a
+ redirection. The two are semantically equivalent,
+ though -- the only difference is in how the
+ command printing code displays the redirections. */
if (tc->type == cm_function_def)
{
tc = tc->value.Function_def->command;
@@ -1429,221 +1446,236 @@ case 43:
;
break;}
case 44:
-#line 485 "/usr/homes/chet/src/bash/src/parse.y"
+#line 498 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
case 45:
-#line 487 "/usr/homes/chet/src/bash/src/parse.y"
+#line 500 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
case 46:
-#line 489 "/usr/homes/chet/src/bash/src/parse.y"
+#line 502 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = make_while_command (yyvsp[-3].command, yyvsp[-1].command); ;
break;}
case 47:
-#line 491 "/usr/homes/chet/src/bash/src/parse.y"
+#line 504 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = make_until_command (yyvsp[-3].command, yyvsp[-1].command); ;
break;}
case 48:
-#line 493 "/usr/homes/chet/src/bash/src/parse.y"
+#line 506 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
case 49:
-#line 495 "/usr/homes/chet/src/bash/src/parse.y"
+#line 508 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
case 50:
-#line 497 "/usr/homes/chet/src/bash/src/parse.y"
+#line 510 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
case 51:
-#line 499 "/usr/homes/chet/src/bash/src/parse.y"
+#line 512 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
case 52:
-#line 501 "/usr/homes/chet/src/bash/src/parse.y"
+#line 514 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
case 53:
-#line 503 "/usr/homes/chet/src/bash/src/parse.y"
+#line 516 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
case 54:
-#line 505 "/usr/homes/chet/src/bash/src/parse.y"
+#line 518 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
case 55:
-#line 509 "/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); ;
+#line 520 "/usr/homes/chet/src/bash/src/parse.y"
+{ yyval.command = yyvsp[0].command; ;
break;}
case 56:
-#line 511 "/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); ;
+#line 524 "/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;}
case 57:
-#line 513 "/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); ;
+#line 526 "/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;}
case 58:
-#line 515 "/usr/homes/chet/src/bash/src/parse.y"
+#line 528 "/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;}
case 59:
-#line 517 "/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); ;
+#line 530 "/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;}
case 60:
-#line 519 "/usr/homes/chet/src/bash/src/parse.y"
+#line 532 "/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;}
case 61:
-#line 523 "/usr/homes/chet/src/bash/src/parse.y"
+#line 534 "/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;}
+case 62:
+#line 538 "/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;}
+case 63:
+#line 540 "/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;}
+case 64:
+#line 543 "/usr/homes/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;}
-case 62:
-#line 527 "/usr/homes/chet/src/bash/src/parse.y"
+case 65:
+#line 547 "/usr/homes/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;}
-case 63:
-#line 531 "/usr/homes/chet/src/bash/src/parse.y"
+case 66:
+#line 551 "/usr/homes/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;}
-case 64:
-#line 535 "/usr/homes/chet/src/bash/src/parse.y"
+case 67:
+#line 555 "/usr/homes/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;}
-case 65:
-#line 539 "/usr/homes/chet/src/bash/src/parse.y"
+case 68:
+#line 559 "/usr/homes/chet/src/bash/src/parse.y"
{
yyval.command = make_select_command (yyvsp[-8].word, (WORD_LIST *)reverse_list (yyvsp[-5].word_list), yyvsp[-1].command);
;
break;}
-case 66:
-#line 543 "/usr/homes/chet/src/bash/src/parse.y"
+case 69:
+#line 563 "/usr/homes/chet/src/bash/src/parse.y"
{
yyval.command = make_select_command (yyvsp[-8].word, (WORD_LIST *)reverse_list (yyvsp[-5].word_list), yyvsp[-1].command);
;
break;}
-case 67:
-#line 549 "/usr/homes/chet/src/bash/src/parse.y"
+case 70:
+#line 569 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = make_case_command (yyvsp[-4].word, (PATTERN_LIST *)NULL); ;
break;}
-case 68:
-#line 551 "/usr/homes/chet/src/bash/src/parse.y"
+case 71:
+#line 571 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = make_case_command (yyvsp[-5].word, yyvsp[-2].pattern); ;
break;}
-case 69:
-#line 553 "/usr/homes/chet/src/bash/src/parse.y"
+case 72:
+#line 573 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = make_case_command (yyvsp[-4].word, yyvsp[-1].pattern); ;
break;}
-case 70:
-#line 557 "/usr/homes/chet/src/bash/src/parse.y"
+case 73:
+#line 577 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = make_function_def (yyvsp[-4].word, yyvsp[0].command, function_dstart, function_bstart); ;
break;}
-case 71:
-#line 561 "/usr/homes/chet/src/bash/src/parse.y"
+case 74:
+#line 581 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = make_function_def (yyvsp[-4].word, yyvsp[0].command, function_dstart, function_bstart); ;
break;}
-case 72:
-#line 564 "/usr/homes/chet/src/bash/src/parse.y"
+case 75:
+#line 584 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = make_function_def (yyvsp[-2].word, yyvsp[0].command, function_dstart, function_bstart); ;
break;}
-case 73:
-#line 568 "/usr/homes/chet/src/bash/src/parse.y"
-{ yyvsp[-1].command->flags |= CMD_WANT_SUBSHELL; yyval.command = yyvsp[-1].command; ;
+case 76:
+#line 588 "/usr/homes/chet/src/bash/src/parse.y"
+{
+ yyval.command = make_subshell_command (yyvsp[-1].command);
+ yyval.command->flags |= CMD_WANT_SUBSHELL;
+ ;
break;}
-case 74:
-#line 572 "/usr/homes/chet/src/bash/src/parse.y"
+case 77:
+#line 595 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = make_if_command (yyvsp[-3].command, yyvsp[-1].command, (COMMAND *)NULL); ;
break;}
-case 75:
-#line 574 "/usr/homes/chet/src/bash/src/parse.y"
+case 78:
+#line 597 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = make_if_command (yyvsp[-5].command, yyvsp[-3].command, yyvsp[-1].command); ;
break;}
-case 76:
-#line 576 "/usr/homes/chet/src/bash/src/parse.y"
+case 79:
+#line 599 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = make_if_command (yyvsp[-4].command, yyvsp[-2].command, yyvsp[-1].command); ;
break;}
-case 77:
-#line 581 "/usr/homes/chet/src/bash/src/parse.y"
+case 80:
+#line 604 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = make_group_command (yyvsp[-1].command); ;
break;}
-case 78:
-#line 585 "/usr/homes/chet/src/bash/src/parse.y"
+case 81:
+#line 608 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = make_arith_command (yyvsp[0].word_list); ;
break;}
-case 79:
-#line 589 "/usr/homes/chet/src/bash/src/parse.y"
+case 82:
+#line 612 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = yyvsp[-1].command; ;
break;}
-case 80:
-#line 593 "/usr/homes/chet/src/bash/src/parse.y"
+case 83:
+#line 616 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = make_if_command (yyvsp[-2].command, yyvsp[0].command, (COMMAND *)NULL); ;
break;}
-case 81:
-#line 595 "/usr/homes/chet/src/bash/src/parse.y"
+case 84:
+#line 618 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = make_if_command (yyvsp[-4].command, yyvsp[-2].command, yyvsp[0].command); ;
break;}
-case 82:
-#line 597 "/usr/homes/chet/src/bash/src/parse.y"
+case 85:
+#line 620 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = make_if_command (yyvsp[-3].command, yyvsp[-1].command, yyvsp[0].command); ;
break;}
-case 84:
-#line 602 "/usr/homes/chet/src/bash/src/parse.y"
+case 87:
+#line 625 "/usr/homes/chet/src/bash/src/parse.y"
{ yyvsp[0].pattern->next = yyvsp[-1].pattern; yyval.pattern = yyvsp[0].pattern; ;
break;}
-case 85:
-#line 606 "/usr/homes/chet/src/bash/src/parse.y"
+case 88:
+#line 629 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.pattern = make_pattern_list (yyvsp[-2].word_list, yyvsp[0].command); ;
break;}
-case 86:
-#line 608 "/usr/homes/chet/src/bash/src/parse.y"
+case 89:
+#line 631 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.pattern = make_pattern_list (yyvsp[-2].word_list, (COMMAND *)NULL); ;
break;}
-case 87:
-#line 610 "/usr/homes/chet/src/bash/src/parse.y"
+case 90:
+#line 633 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.pattern = make_pattern_list (yyvsp[-2].word_list, yyvsp[0].command); ;
break;}
-case 88:
-#line 612 "/usr/homes/chet/src/bash/src/parse.y"
+case 91:
+#line 635 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.pattern = make_pattern_list (yyvsp[-2].word_list, (COMMAND *)NULL); ;
break;}
-case 90:
-#line 617 "/usr/homes/chet/src/bash/src/parse.y"
+case 93:
+#line 640 "/usr/homes/chet/src/bash/src/parse.y"
{ yyvsp[-1].pattern->next = yyvsp[-2].pattern; yyval.pattern = yyvsp[-1].pattern; ;
break;}
-case 91:
-#line 621 "/usr/homes/chet/src/bash/src/parse.y"
+case 94:
+#line 644 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.word_list = make_word_list (yyvsp[0].word, (WORD_LIST *)NULL); ;
break;}
-case 92:
-#line 623 "/usr/homes/chet/src/bash/src/parse.y"
+case 95:
+#line 646 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.word_list = make_word_list (yyvsp[0].word, yyvsp[-2].word_list); ;
break;}
-case 93:
-#line 632 "/usr/homes/chet/src/bash/src/parse.y"
+case 96:
+#line 655 "/usr/homes/chet/src/bash/src/parse.y"
{
yyval.command = yyvsp[0].command;
if (need_here_doc)
gather_here_documents ();
;
break;}
-case 95:
-#line 641 "/usr/homes/chet/src/bash/src/parse.y"
+case 98:
+#line 664 "/usr/homes/chet/src/bash/src/parse.y"
{
yyval.command = yyvsp[0].command;
;
break;}
-case 97:
-#line 648 "/usr/homes/chet/src/bash/src/parse.y"
+case 100:
+#line 671 "/usr/homes/chet/src/bash/src/parse.y"
{
if (yyvsp[-2].command->type == cm_connection)
yyval.command = connect_async_list (yyvsp[-2].command, (COMMAND *)NULL, '&');
@@ -1651,16 +1683,16 @@ case 97:
yyval.command = command_connect (yyvsp[-2].command, (COMMAND *)NULL, '&');
;
break;}
-case 99:
-#line 659 "/usr/homes/chet/src/bash/src/parse.y"
+case 102:
+#line 682 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, AND_AND); ;
break;}
-case 100:
-#line 661 "/usr/homes/chet/src/bash/src/parse.y"
+case 103:
+#line 684 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, OR_OR); ;
break;}
-case 101:
-#line 663 "/usr/homes/chet/src/bash/src/parse.y"
+case 104:
+#line 686 "/usr/homes/chet/src/bash/src/parse.y"
{
if (yyvsp[-3].command->type == cm_connection)
yyval.command = connect_async_list (yyvsp[-3].command, yyvsp[0].command, '&');
@@ -1668,28 +1700,28 @@ case 101:
yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, '&');
;
break;}
-case 102:
-#line 670 "/usr/homes/chet/src/bash/src/parse.y"
+case 105:
+#line 693 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, ';'); ;
break;}
-case 103:
-#line 672 "/usr/homes/chet/src/bash/src/parse.y"
+case 106:
+#line 695 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, ';'); ;
break;}
-case 104:
-#line 674 "/usr/homes/chet/src/bash/src/parse.y"
+case 107:
+#line 697 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
-case 110:
-#line 693 "/usr/homes/chet/src/bash/src/parse.y"
+case 113:
+#line 716 "/usr/homes/chet/src/bash/src/parse.y"
{
yyval.command = yyvsp[0].command;
if (need_here_doc)
gather_here_documents ();
;
break;}
-case 111:
-#line 699 "/usr/homes/chet/src/bash/src/parse.y"
+case 114:
+#line 722 "/usr/homes/chet/src/bash/src/parse.y"
{
if (yyvsp[-1].command->type == cm_connection)
yyval.command = connect_async_list (yyvsp[-1].command, (COMMAND *)NULL, '&');
@@ -1699,24 +1731,24 @@ case 111:
gather_here_documents ();
;
break;}
-case 112:
-#line 708 "/usr/homes/chet/src/bash/src/parse.y"
+case 115:
+#line 731 "/usr/homes/chet/src/bash/src/parse.y"
{
yyval.command = yyvsp[-1].command;
if (need_here_doc)
gather_here_documents ();
;
break;}
-case 113:
-#line 716 "/usr/homes/chet/src/bash/src/parse.y"
+case 116:
+#line 739 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, AND_AND); ;
break;}
-case 114:
-#line 718 "/usr/homes/chet/src/bash/src/parse.y"
+case 117:
+#line 741 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, OR_OR); ;
break;}
-case 115:
-#line 720 "/usr/homes/chet/src/bash/src/parse.y"
+case 118:
+#line 743 "/usr/homes/chet/src/bash/src/parse.y"
{
if (yyvsp[-2].command->type == cm_connection)
yyval.command = connect_async_list (yyvsp[-2].command, yyvsp[0].command, '&');
@@ -1724,60 +1756,60 @@ case 115:
yyval.command = command_connect (yyvsp[-2].command, yyvsp[0].command, '&');
;
break;}
-case 116:
-#line 727 "/usr/homes/chet/src/bash/src/parse.y"
+case 119:
+#line 750 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = command_connect (yyvsp[-2].command, yyvsp[0].command, ';'); ;
break;}
-case 117:
-#line 730 "/usr/homes/chet/src/bash/src/parse.y"
+case 120:
+#line 753 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
-case 118:
-#line 734 "/usr/homes/chet/src/bash/src/parse.y"
+case 121:
+#line 757 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
-case 119:
-#line 736 "/usr/homes/chet/src/bash/src/parse.y"
+case 122:
+#line 759 "/usr/homes/chet/src/bash/src/parse.y"
{
yyvsp[0].command->flags |= CMD_INVERT_RETURN;
yyval.command = yyvsp[0].command;
;
break;}
-case 120:
-#line 741 "/usr/homes/chet/src/bash/src/parse.y"
+case 123:
+#line 764 "/usr/homes/chet/src/bash/src/parse.y"
{
yyvsp[0].command->flags |= yyvsp[-1].number;
yyval.command = yyvsp[0].command;
;
break;}
-case 121:
-#line 746 "/usr/homes/chet/src/bash/src/parse.y"
+case 124:
+#line 769 "/usr/homes/chet/src/bash/src/parse.y"
{
- yyvsp[0].command->flags |= yyvsp[-2].number;
+ yyvsp[0].command->flags |= yyvsp[-2].number|CMD_INVERT_RETURN;
yyval.command = yyvsp[0].command;
;
break;}
-case 122:
-#line 751 "/usr/homes/chet/src/bash/src/parse.y"
+case 125:
+#line 774 "/usr/homes/chet/src/bash/src/parse.y"
{
yyvsp[0].command->flags |= yyvsp[-1].number|CMD_INVERT_RETURN;
yyval.command = yyvsp[0].command;
;
break;}
-case 123:
-#line 759 "/usr/homes/chet/src/bash/src/parse.y"
+case 126:
+#line 782 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = command_connect (yyvsp[-3].command, yyvsp[0].command, '|'); ;
break;}
-case 124:
-#line 761 "/usr/homes/chet/src/bash/src/parse.y"
+case 127:
+#line 784 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.command = yyvsp[0].command; ;
break;}
-case 125:
-#line 765 "/usr/homes/chet/src/bash/src/parse.y"
+case 128:
+#line 788 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.number = CMD_TIME_PIPELINE; ;
break;}
-case 126:
-#line 767 "/usr/homes/chet/src/bash/src/parse.y"
+case 129:
+#line 790 "/usr/homes/chet/src/bash/src/parse.y"
{ yyval.number = CMD_TIME_PIPELINE|CMD_TIME_POSIX; ;
break;}
}
@@ -1978,7 +2010,7 @@ yyerrhandle:
yystate = yyn;
goto yynewstate;
}
-#line 769 "/usr/homes/chet/src/bash/src/parse.y"
+#line 792 "/usr/homes/chet/src/bash/src/parse.y"
/* Possible states for the parser that require it to do special things. */
@@ -1992,6 +2024,7 @@ yyerrhandle:
#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 */
/* Initial size to allocate for tokens, and the
amount to grow them by. */
@@ -2281,20 +2314,21 @@ with_input_from_string (string, name)
/* */
/* **************************************************************** */
+/* These two functions used to test the value of the HAVE_RESTARTABLE_SYSCALLS
+ define, and just use getc/ungetc if it was defined, but since bash
+ installs its signal handlers without the SA_RESTART flag, some signals
+ (like SIGCHLD, SIGWINCH, etc.) received during a read(2) will not cause
+ the read to be restarted. We need to restart it ourselves. */
+
static int
yy_stream_get ()
{
- int result = EOF;
+ int result;
+ result = EOF;
if (bash_input.location.file)
- {
-#if !defined (HAVE_RESTARTABLE_SYSCALLS)
- result = getc_with_restart (bash_input.location.file);
-#else /* HAVE_RESTARTABLE_SYSCALLS */
- result = getc (bash_input.location.file);
- result = (feof (bash_input.location.file)) ? EOF : (unsigned char)result;
-#endif /* HAVE_RESTARTABLE_SYSCALLS */
- }
+ result = getc_with_restart (bash_input.location.file);
+
return (result);
}
@@ -2302,11 +2336,7 @@ static int
yy_stream_unget (c)
int c;
{
-#if !defined (HAVE_RESTARTABLE_SYSCALLS)
return (ungetc_with_restart (c, bash_input.location.file));
-#else /* HAVE_RESTARTABLE_SYSCALLS */
- return (ungetc (c, bash_input.location.file));
-#endif /* HAVE_RESTARTABLE_SYSCALLS */
}
void
@@ -2422,6 +2452,30 @@ stream_on_stack (type)
return 0;
}
+/* Save the current token state and return it in a malloced array. */
+int *
+save_token_state ()
+{
+ int *ret;
+
+ ret = (int *)xmalloc (3 * sizeof (int));
+ ret[0] = last_read_token;
+ ret[1] = token_before_that;
+ ret[2] = two_tokens_ago;
+ return ret;
+}
+
+void
+restore_token_state (ts)
+ int *ts;
+{
+ if (ts == 0)
+ return;
+ last_read_token = ts[0];
+ token_before_that = ts[1];
+ two_tokens_ago = ts[2];
+}
+
/*
* This is used to inhibit alias expansion and reserved word recognition
* inside case statement pattern lists. A `case statement pattern list' is:
@@ -3417,8 +3471,36 @@ read_token (command)
case '|':
return (OR_OR);
-#if defined (DPAREN_ARITHMETIC)
+#if defined (DPAREN_ARITHMETIC) || defined (ARITH_FOR_COMMAND)
case '(': /* ) */
+# if defined (ARITH_FOR_COMMAND)
+ if (last_read_token == FOR)
+ {
+ int cmdtyp, len;
+ char *wval, *wv2;
+ WORD_DESC *wd;
+
+ arith_for_lineno = line_number;
+ cmdtyp = parse_arith_cmd (&wval);
+ 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 = xmalloc (len);
+ strncpy (wv2, wval + 1, len - 2);
+ wv2[len - 2] = '\0';
+ wd = make_word (wv2);
+ yylval.word_list = make_word_list (wd, (WORD_LIST *)NULL);
+ free (wval);
+ free (wv2);
+ return (ARITH_FOR_EXPRS);
+ }
+ else
+ return -1; /* ERROR */
+ }
+# endif
+# if defined (DPAREN_ARITHMETIC)
if (reserved_word_acceptable (last_read_token))
{
int cmdtyp, sline;
@@ -3446,6 +3528,7 @@ read_token (command)
return -1;
}
break;
+# endif
#endif
}
}
@@ -3515,6 +3598,7 @@ read_token (command)
correct error values if it reads EOF. */
#define P_FIRSTCLOSE 0x01
+#define P_ALLOWESC 0x02
static char matched_pair_error;
static char *
@@ -3537,7 +3621,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
start_lineno = line_number;
while (count)
{
- ch = shell_getc (qc != '\'' && pass_next_character == 0);
+ ch = shell_getc ((qc != '\'' || (flags & P_ALLOWESC)) && pass_next_character == 0);
if (ch == EOF)
{
free (ret);
@@ -3575,6 +3659,11 @@ parse_matched_pair (qc, open, close, lenp, flags)
}
else if (ch == close) /* ending delimiter */
count--;
+#if 1
+ /* handle nested ${...} specially. */
+ else if (open != close && was_dollar && open == '{' && ch == open) /* } */
+ count++;
+#endif
else if (((flags & P_FIRSTCLOSE) == 0) && ch == open) /* nested begin */
count++;
@@ -3583,7 +3672,11 @@ parse_matched_pair (qc, open, close, lenp, flags)
ret[retind++] = ch;
if (open == '\'') /* '' inside grouping construct */
- continue;
+ {
+ if ((flags & P_ALLOWESC) && ch == '\\')
+ pass_next_character++;
+ continue;
+ }
if (ch == '\\') /* backslashes */
pass_next_character++;
@@ -3662,7 +3755,7 @@ parse_matched_pair (qc, open, close, lenp, flags)
return ret;
}
-#if defined (DPAREN_ARITHMETIC)
+#if defined (DPAREN_ARITHMETIC) || defined (ARITH_FOR_COMMAND)
/* We've seen a `(('. Look for the matching `))'. If we get it, return 1.
If not, assume it's a nested subshell for backwards compatibility and
return 0. In any case, put the characters we've consumed into a locally-
@@ -3686,7 +3779,7 @@ parse_arith_cmd (ep)
if ((c = shell_getc (0)) != ')')
rval = 0;
- token = xmalloc(ttoklen + 4);
+ token = xmalloc (ttoklen + 4);
/* (( ... )) -> "..." */
token[0] = (rval == 1) ? '"' : '(';
@@ -3706,7 +3799,7 @@ parse_arith_cmd (ep)
FREE (ttok);
return rval;
}
-#endif /* DPAREN_ARITHMETIC */
+#endif /* DPAREN_ARITHMETIC || ARITH_FOR_COMMAND */
#if defined (COND_COMMAND)
static COND_COM *cond_term ();
@@ -3817,7 +3910,7 @@ cond_term ()
(void)cond_skip_newlines ();
}
- else /* left argument to binary operator */
+ else if (tok == WORD) /* left argument to binary operator */
{
/* lhs */
tleft = make_cond_node (COND_TERM, yylval.word, (COND_COM *)NULL, (COND_COM *)NULL);
@@ -3862,6 +3955,14 @@ cond_term ()
(void)cond_skip_newlines ();
}
+ else
+ {
+ if (tok < 256)
+ parser_error (line_number, "unexpected token `%c' in conditional command", tok);
+ else
+ parser_error (line_number, "unexpected token %d in conditional command", tok);
+ COND_RETURN_ERROR ();
+ }
return (term);
}
@@ -4022,7 +4123,7 @@ read_token_word (character)
the command-oriented-history code. This way newlines
appearing in the $(...) string get added to the
history literally rather than causing a possibly-
- incorrect `;' to be added. */
+ incorrect `;' to be added. ) */
push_delimiter (dstack, peek_char);
ttok = parse_matched_pair (cd, '(', ')', &ttoklen, 0);
pop_delimiter (dstack);
@@ -4049,21 +4150,46 @@ read_token_word (character)
int first_line;
first_line = line_number;
- ttok = parse_matched_pair (peek_char, peek_char, peek_char, &ttoklen, 0);
+ push_delimiter (dstack, peek_char);
+ ttok = parse_matched_pair (peek_char, peek_char, peek_char,
+ &ttoklen,
+ (peek_char == '\'') ? P_ALLOWESC : 0);
+ pop_delimiter (dstack);
if (ttok == &matched_pair_error)
return -1;
if (peek_char == '\'')
- ttrans = ansiexpand (ttok, 0, ttoklen - 1, &ttranslen);
+ {
+ ttrans = ansiexpand (ttok, 0, ttoklen - 1, &ttranslen);
+ free (ttok);
+ /* Insert the single quotes and correctly quote any
+ embedded single quotes (allowed because P_ALLOWESC was
+ passed to parse_matched_pair). */
+ ttok = single_quote (ttrans);
+ free (ttrans);
+ ttrans = ttok;
+ ttranslen = strlen (ttrans);
+ }
else
- ttrans = localeexpand (ttok, 0, ttoklen - 1, first_line, &ttranslen);
- free (ttok);
+ {
+ /* Try to locale-expand the converted string. */
+ ttrans = localeexpand (ttok, 0, ttoklen - 1, first_line, &ttranslen);
+ free (ttok);
+
+ /* Add the double quotes back */
+ ttok = xmalloc (ttranslen + 3);
+ ttok[0] = '"';
+ strcpy (ttok + 1, ttrans);
+ ttok[ttranslen + 1] = '"';
+ ttok[ttranslen += 2] = '\0';
+ free (ttrans);
+ ttrans = ttok;
+ }
+
RESIZE_MALLOCED_BUFFER (token, token_index, ttranslen + 2,
token_buffer_size,
TOKEN_DEFAULT_GROW_SIZE);
- token[token_index++] = peek_char;
strcpy (token + token_index, ttrans);
token_index += ttranslen;
- token[token_index++] = peek_char;
FREE (ttrans);
quoted = 1;
all_digits = 0;
@@ -4249,7 +4375,7 @@ ansiexpand (string, start, end, lenp)
if (*temp)
{
- t = ansicstr (temp, tlen, (int *)NULL, lenp);
+ t = ansicstr (temp, tlen, 0, (int *)NULL, lenp);
free (temp);
return (t);
}
@@ -4261,6 +4387,52 @@ ansiexpand (string, start, end, lenp)
}
}
+/* Change a bash string into a string suitable for inclusion in a `po' file.
+ This backslash-escapes `"' and `\' and changes newlines into \\\n"\n". */
+static char *
+mk_msgstr (string, foundnlp)
+ char *string;
+ int *foundnlp;
+{
+ register int c, len;
+ char *result, *r, *s;
+
+ for (len = 0, s = string; s && *s; s++)
+ {
+ len++;
+ if (*s == '"' || *s == '\\')
+ len++;
+ else if (*s == '\n')
+ len += 5;
+ }
+
+ r = result = xmalloc (len + 3);
+ *r++ = '"';
+
+ for (s = string; s && (c = *s); s++)
+ {
+ if (c == '\n') /* <NL> -> \n"<NL>" */
+ {
+ *r++ = '\\';
+ *r++ = 'n';
+ *r++ = '"';
+ *r++ = '\n';
+ *r++ = '"';
+ if (foundnlp)
+ *foundnlp = 1;
+ continue;
+ }
+ if (c == '"' || c == '\\')
+ *r++ = '\\';
+ *r++ = c;
+ }
+
+ *r++ = '"';
+ *r++ = '\0';
+
+ return result;
+}
+
/* $"..." -- Translate the portion of STRING between START and END
according to current locale using gettext (if available) and return
the result. The caller will take care of leaving the quotes intact.
@@ -4273,22 +4445,35 @@ localeexpand (string, start, end, lineno, lenp)
char *string;
int start, end, lineno, *lenp;
{
- int len, tlen;
- char *temp, *t;
+ int len, tlen, foundnl;
+ char *temp, *t, *t2;
temp = xmalloc (end - start + 1);
for (tlen = 0, len = start; len < end; )
temp[tlen++] = string[len++];
temp[tlen] = '\0';
- /* If we're just dumping translatable strings, don't do anything. */
+ /* If we're just dumping translatable strings, don't do anything with the
+ string itself, but if we're dumping in `po' file format, convert it into a form more palatable to gettext(3)
+ and friends by quoting `"' and `\' with backslashes and converting <NL>
+ into `\n"<NL>"'. If we find a newline in TEMP, we first output a
+ `msgid ""' line and then the translated string; otherwise we output the
+ `msgid' and translated string all on one line. */
if (dump_translatable_strings)
{
if (dump_po_strings)
- printf ("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n",
- (bash_input.name ? bash_input.name : "stdin"), lineno, temp);
+ {
+ foundnl = 0;
+ t = mk_msgstr (temp, &foundnl);
+ t2 = foundnl ? "\"\"\n" : "";
+
+ printf ("#: %s:%d\nmsgid %s%s\nmsgstr \"\"\n",
+ (bash_input.name ? bash_input.name : "stdin"), lineno, t2, t);
+ free (t);
+ }
else
printf ("\"%s\"\n", temp);
+
if (lenp)
*lenp = tlen;
return (temp);
@@ -4424,6 +4609,17 @@ history_delimiting_chars ()
else if (token_before_that == WORD && two_tokens_ago == FUNCTION)
return " "; /* function def using `function name' without `()' */
+ else if (token_before_that == WORD && two_tokens_ago == FOR)
+ {
+ /* Tricky. `for i\nin ...' should not have a semicolon, but
+ `for i\ndo ...' should. We do what we can. */
+ for (i = shell_input_line_index; whitespace(shell_input_line[i]); i++)
+ ;
+ if (shell_input_line[i] && shell_input_line[i] == 'i' && shell_input_line[i+1] == 'n')
+ return " ";
+ return ";";
+ }
+
for (i = 0; no_semi_successors[i]; i++)
{
if (token_before_that == no_semi_successors[i])
@@ -4477,6 +4673,20 @@ prompt_again ()
}
}
+int
+get_current_prompt_level ()
+{
+ return ((current_prompt_string && current_prompt_string == ps2_prompt) ? 2 : 1);
+}
+
+void
+set_current_prompt_level (x)
+ int x;
+{
+ prompt_string_pointer = (x == 2) ? &ps2_prompt : &ps1_prompt;
+ current_prompt_string = *prompt_string_pointer;
+}
+
static void
print_prompt ()
{
@@ -4492,6 +4702,8 @@ print_prompt ()
\d the date in Day Mon Date format
\h the hostname up to the first `.'
\H the hostname
+ \j the number of active jobs
+ \l the basename of the shell's tty device name
\n CRLF
\s the name of the shell
\t the time in 24-hour hh:mm:ss format
@@ -4692,7 +4904,14 @@ decode_prompt_string (string)
/* If we're going to be expanding the prompt string later,
quote the directory name. */
if (promptvars || posixly_correct)
+#if 0
temp = backslash_quote (t_string);
+#else
+ /* Make sure that expand_prompt_string is called with a
+ second argument of Q_DOUBLE_QUOTE if we use this
+ function here. */
+ temp = backslash_quote_for_double_quotes (t_string);
+#endif
else
temp = savestring (t_string);
@@ -4700,6 +4919,8 @@ decode_prompt_string (string)
}
case 'u':
+ if (current_user.user_name == 0)
+ get_current_user_info ();
temp = savestring (current_user.user_name);
goto add_string;
@@ -4730,6 +4951,20 @@ decode_prompt_string (string)
*t = '\0';
goto add_string;
+ case 'j':
+ temp = itos (count_all_jobs ());
+ goto add_string;
+
+ case 'l':
+#if defined (HAVE_TTYNAME)
+ temp = (char *)ttyname (fileno (stdin));
+ t = temp ? base_pathname (temp) : "tty";
+ temp = savestring (t);
+#else
+ temp = savestring ("tty");
+#endif /* !HAVE_TTYNAME */
+ goto add_string;
+
#if defined (READLINE)
case '[':
case ']':
@@ -4791,7 +5026,11 @@ decode_prompt_string (string)
the prompt string. */
if (promptvars || posixly_correct)
{
+#if 0
list = expand_string_unsplit (result, Q_DOUBLE_QUOTES);
+#else
+ list = expand_prompt_string (result, Q_DOUBLE_QUOTES);
+#endif
free (result);
result = string_list (list);
dispose_words (list);
@@ -4866,11 +5105,7 @@ report_syntax_error (message)
if (token_end || (i == 0 && token_end == 0))
{
if (token_end)
- {
- msg = xmalloc (1 + (token_end - i));
- strncpy (msg, t + i, token_end - i);
- msg[token_end - i] = '\0';
- }
+ msg = substring (t, i, token_end);
else /* one-character token */
{
msg2[0] = t[i];
@@ -4974,3 +5209,73 @@ handle_eof_input_unit ()
EOF_Reached = 1;
}
}
+
+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)
+ char *s, *whom;
+{
+ WORD_LIST *wl;
+ int tok, orig_line_number, orig_input_terminator;
+#if defined (HISTORY)
+ int old_remember_on_history, old_history_expansion_inhibited;
+#endif
+
+#if defined (HISTORY)
+ old_remember_on_history = remember_on_history;
+# if defined (BANG_HISTORY)
+ old_history_expansion_inhibited = history_expansion_inhibited;
+# endif
+ bash_history_disable ();
+#endif
+
+ orig_line_number = line_number;
+ orig_input_terminator = shell_input_line_terminator;
+
+ push_stream (1);
+ last_read_token = '\n';
+
+ with_input_from_string (s, whom);
+ wl = (WORD_LIST *)NULL;
+ while ((tok = read_token (READ)) != yacc_EOF)
+ {
+ if (tok == '\n' && *bash_input.location.string == '\0')
+ break;
+ if (tok != WORD && tok != ASSIGNMENT_WORD)
+ {
+ line_number = orig_line_number + line_number - 1;
+ yyerror (); /* does the right thing */
+ if (wl)
+ dispose_words (wl);
+ wl = &parse_string_error;
+ break;
+ }
+ wl = make_word_list (yylval.word, wl);
+ }
+
+ last_read_token = '\n';
+ pop_stream ();
+
+#if defined (HISTORY)
+ remember_on_history = old_remember_on_history;
+# if defined (BANG_HISTORY)
+ history_expansion_inhibited = old_history_expansion_inhibited;
+# endif /* BANG_HISTORY */
+#endif /* HISTORY */
+
+ shell_input_line_terminator = orig_input_terminator;
+
+ if (wl == &parse_string_error)
+ {
+ last_command_exit_value = EXECUTION_FAILURE;
+ if (interactive_shell == 0 && posixly_correct)
+ jump_to_top_level (FORCE_EOF);
+ else
+ jump_to_top_level (DISCARD);
+ }
+
+ return (REVERSE_LIST (wl, WORD_LIST *));
+}