aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog46
-rw-r--r--awk.h23
-rw-r--r--awkgram.c1850
-rw-r--r--awkgram.y506
-rw-r--r--debug.c55
-rw-r--r--doc/gawk.info848
-rw-r--r--eval.c186
-rw-r--r--profile.c202
8 files changed, 1807 insertions, 1909 deletions
diff --git a/ChangeLog b/ChangeLog
index c8442631..a1a7c119 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,49 @@
+Tue Feb 1 23:01:40 2011 John Haque <j.eh@mchsi.com>
+
+ Fix switch debugging.
+
+ * awkgram.y (LEX_SWITCH, case_statements, case_statement,
+ case_value): Linearize instructions to facilitate debugging.
+ (switch_body): Removed.
+ (yylex): Add LEX_CASE in special token processing.
+ (free_bc_internal): Remove case Op_K_switch.
+ * awk.h (OPCODE): Remove opcode Op_case_list.
+ * eval.c (r_interpret): Remove Op_K_switch. Add case
+ Op_K_case to handle switch.
+ Add cases Op_K_do, Op_K_while, Op_K_for, Op_K_arrayfor, Op_K_switch
+ and Op_K_default as no-ops, needed for pgawk.
+ * debug.c (print_instruction): Remove case Op_K_switch,
+ add case Op_K_case instead.
+
+ Unrelated:
+ * awkgram.y (case_statements): As case values, "abc" and /abc/
+ no longer considered as duplicates.
+
+ Cleanup grammar and run-time code for switch and loops.
+ Jump targets for break and continue are now fixed, and known
+ at parse time. See ChangeLog entry dated Oct 21, 2010.
+
+ * awk.h (OPCODE): Remove Op_push_loop and Op_pop_loop.
+ (loop_count): Remove definition.
+ * awkgram.y (fix_break_continue): Change calling parameters to
+ instruction list, break and continue targets. Adjust code.
+ (LEX_DO, LEX_WHILE, LEX_SWITCH, LEX_FOR): Simplify grammar. Use
+ Op_no_op as target for break. Adjust call to fix_break_continue.
+ (mk_for_loop): Ditto.
+ * eval.c (r_interpret): Nuke cases Op_push_loop and Op_pop_lop.
+ Simplify Op_K_break and Op_K_continue. Remove declaration of in_loop
+ and all loop detection code thereof.
+ * debug.c (pre_execute, post_execute): Adjust declarations and code.
+ (print_instruction): Nuke cases Op_push_loop and Op_pop_loop.
+ * eval.c (r_interpret): Adjust calls to pre_execute and post_execute.
+ * profile.c (pprint): Adjust cases Op_K_for, Op_K_do, Op_K_while,
+ Op_K_switch and Op_K_arrayfor. Add cases Op_K_case and Op_K_default.
+ Remove Op_push_loop and Op_pop_loop.
+
+ Unrelated cleanup:
+ * awkgram.y (mk_condition): Don't include Op_K_if, Op_K_else and
+ Op_cond_exp if not profiling.
+
Tue Feb 1 10:20:02 2011 Arnold D. Robbins <arnold@skeeve.com>
* eval.c (r_interpret): Change magic string for array sorting.
diff --git a/awk.h b/awk.h
index 0bd7f8d9..f132f3c8 100644
--- a/awk.h
+++ b/awk.h
@@ -403,7 +403,6 @@ typedef struct exp_node {
#define numbr sub.val.fltnum
/* Node_frame: */
-#define loop_count sub.nodep.l.ll
#define stack sub.nodep.r.av
#define func_node sub.nodep.x.extra
#define reti sub.nodep.reflags
@@ -538,8 +537,6 @@ typedef enum opcodeval {
Op_jmp,
Op_jmp_true,
Op_jmp_false,
- Op_push_loop, /* break (continue) target for loop */
- Op_pop_loop,
Op_get_record,
Op_newfile,
Op_arrayfor_init,
@@ -565,7 +562,7 @@ typedef enum opcodeval {
Op_token,
Op_symbol,
Op_list,
- Op_case_list,
+
/* program structures -- for use in the profiler/pretty printer */
Op_K_do,
Op_K_for,
@@ -638,14 +635,18 @@ typedef struct exp_instruction {
#define in_rule x.xl
#define source_file d.name
-/* Op_K_case, Op_K_default */
-#define target_stmt x.xi
-
-/* Op_case_list, Op_K_switch */
-#define case_val d.di
+ /* Op_K_case, Op_K_default */
#define case_stmt x.xi
-#define switch_dflt x.xi
-#define switch_body d.di /* pretty printing and profiling */
+#define case_exp d.di
+#define stmt_start case_exp
+#define stmt_end case_stmt
+#define match_exp x.xl
+
+#define target_stmt x.xi
+
+/* Op_K_switch */
+#define switch_end x.xi
+#define switch_start d.di
/* Op_K_getline, Op_K_getline_redir */
#define into_var x.xl
diff --git a/awkgram.c b/awkgram.c
index c97684f3..aff24d06 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -110,11 +110,11 @@ static INSTRUCTION *mk_condition(INSTRUCTION *cond, INSTRUCTION *ifp, INSTRUCTIO
static INSTRUCTION *mk_expression_list(INSTRUCTION *list, INSTRUCTION *s1);
static INSTRUCTION *mk_for_loop(INSTRUCTION *forp, INSTRUCTION *init, INSTRUCTION *cond,
INSTRUCTION *incr, INSTRUCTION *body);
-static void fix_break_continue(INSTRUCTION *start, INSTRUCTION *end, int check_continue);
+static void fix_break_continue(INSTRUCTION *list, INSTRUCTION *b_target, INSTRUCTION *c_target);
static INSTRUCTION *mk_binary(INSTRUCTION *s1, INSTRUCTION *s2, INSTRUCTION *op);
static INSTRUCTION *mk_boolean(INSTRUCTION *left, INSTRUCTION *right, INSTRUCTION *op);
static INSTRUCTION *mk_assignment(INSTRUCTION *lhs, INSTRUCTION *rhs, INSTRUCTION *op);
-static INSTRUCTION *mk_getline(INSTRUCTION *op, INSTRUCTION *opt_var, INSTRUCTION *redir, OPCODE redirtype);
+static INSTRUCTION *mk_getline(INSTRUCTION *op, INSTRUCTION *opt_var, INSTRUCTION *redir, int redirtype);
static NODE *make_regnode(int type, NODE *exp);
static int count_expressions(INSTRUCTION **list, int isarg);
static INSTRUCTION *optimize_assignment(INSTRUCTION *exp);
@@ -577,16 +577,16 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 1142
+#define YYLAST 1144
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 74
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 66
+#define YYNNTS 65
/* YYNRULES -- Number of rules. */
-#define YYNRULES 186
+#define YYNRULES 185
/* YYNRULES -- Number of states. */
-#define YYNSTATES 330
+#define YYNSTATES 329
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -642,82 +642,82 @@ static const yytype_uint16 yyprhs[] =
80, 81, 85, 87, 89, 90, 93, 96, 98, 101,
104, 108, 110, 120, 127, 136, 145, 158, 170, 172,
175, 178, 181, 184, 188, 189, 194, 197, 198, 203,
- 204, 209, 214, 216, 217, 219, 221, 222, 225, 228,
- 234, 239, 241, 244, 247, 249, 251, 253, 255, 257,
- 261, 262, 263, 267, 274, 284, 286, 289, 290, 292,
- 293, 296, 297, 299, 301, 305, 307, 310, 314, 315,
- 317, 318, 320, 322, 326, 328, 331, 335, 339, 343,
- 347, 351, 355, 359, 363, 369, 371, 373, 375, 378,
- 380, 382, 384, 386, 388, 390, 393, 395, 399, 403,
- 407, 411, 415, 419, 423, 426, 429, 435, 440, 444,
- 448, 452, 456, 460, 464, 466, 469, 473, 478, 483,
- 485, 487, 489, 492, 495, 497, 499, 502, 505, 507,
- 510, 515, 516, 518, 519, 522, 524, 527, 529, 533,
- 535, 538, 541, 543, 546, 548, 552, 554, 556, 557,
- 560, 563, 565, 566, 568, 570, 572
+ 204, 209, 214, 216, 217, 219, 220, 223, 226, 232,
+ 237, 239, 242, 245, 247, 249, 251, 253, 255, 259,
+ 260, 261, 265, 272, 282, 284, 287, 288, 290, 291,
+ 294, 295, 297, 299, 303, 305, 308, 312, 313, 315,
+ 316, 318, 320, 324, 326, 329, 333, 337, 341, 345,
+ 349, 353, 357, 361, 367, 369, 371, 373, 376, 378,
+ 380, 382, 384, 386, 388, 391, 393, 397, 401, 405,
+ 409, 413, 417, 421, 424, 427, 433, 438, 442, 446,
+ 450, 454, 458, 462, 464, 467, 471, 476, 481, 483,
+ 485, 487, 490, 493, 495, 497, 500, 503, 505, 508,
+ 513, 514, 516, 517, 520, 522, 525, 527, 531, 533,
+ 536, 539, 541, 544, 546, 550, 552, 554, 555, 558,
+ 561, 563, 564, 566, 568, 570
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int16 yyrhs[] =
{
- 75, 0, -1, -1, 75, 76, -1, 75, 105, -1,
+ 75, 0, -1, -1, 75, 76, -1, 75, 104, -1,
75, 47, -1, 75, 1, -1, 78, 79, -1, 78,
88, -1, 82, 79, -1, 68, 48, 77, 88, -1,
- 6, -1, 6, 1, -1, 1, -1, -1, 113, -1,
- 113, 54, 113, -1, 17, -1, 18, -1, 36, -1,
- 37, -1, 133, 87, 134, 136, 106, -1, 4, -1,
+ 6, -1, 6, 1, -1, 1, -1, -1, 112, -1,
+ 112, 54, 112, -1, 17, -1, 18, -1, 36, -1,
+ 37, -1, 132, 87, 133, 135, 105, -1, 4, -1,
3, -1, 81, -1, 68, 49, -1, 45, -1, 46,
- -1, -1, 35, 83, 80, 66, 108, 135, 106, -1,
+ -1, -1, 35, 83, 80, 66, 107, 134, 105, -1,
-1, 86, 85, 5, -1, 60, -1, 51, -1, -1,
- 87, 89, -1, 87, 1, -1, 105, -1, 137, 106,
- -1, 137, 106, -1, 133, 87, 134, -1, 104, -1,
- 23, 66, 113, 135, 106, 133, 96, 106, 134, -1,
- 26, 66, 113, 135, 106, 89, -1, 27, 106, 89,
- 26, 66, 113, 135, 106, -1, 28, 66, 4, 40,
- 130, 135, 106, 89, -1, 28, 66, 95, 137, 106,
- 113, 137, 106, 95, 135, 106, 89, -1, 28, 66,
- 95, 137, 106, 137, 106, 95, 135, 106, 89, -1,
+ 87, 89, -1, 87, 1, -1, 104, -1, 136, 105,
+ -1, 136, 105, -1, 132, 87, 133, -1, 103, -1,
+ 23, 66, 112, 134, 105, 132, 96, 105, 133, -1,
+ 26, 66, 112, 134, 105, 89, -1, 27, 105, 89,
+ 26, 66, 112, 134, 105, -1, 28, 66, 4, 40,
+ 129, 134, 105, 89, -1, 28, 66, 95, 136, 105,
+ 112, 136, 105, 95, 134, 105, 89, -1, 28, 66,
+ 95, 136, 105, 136, 105, 95, 134, 105, 89, -1,
90, -1, 29, 88, -1, 30, 88, -1, 33, 88,
- -1, 39, 88, -1, 34, 110, 88, -1, -1, 21,
- 91, 110, 88, -1, 92, 88, -1, -1, 100, 93,
- 101, 102, -1, -1, 22, 4, 94, 124, -1, 22,
- 66, 4, 67, -1, 113, -1, -1, 92, -1, 97,
- -1, -1, 97, 98, -1, 97, 1, -1, 24, 99,
- 138, 106, 87, -1, 25, 138, 106, 87, -1, 7,
- -1, 58, 7, -1, 57, 7, -1, 8, -1, 84,
- -1, 31, -1, 32, -1, 111, -1, 66, 112, 135,
- -1, -1, -1, 10, 103, 117, -1, 19, 66, 113,
- 135, 106, 89, -1, 19, 66, 113, 135, 106, 89,
- 20, 106, 89, -1, 50, -1, 105, 50, -1, -1,
- 105, -1, -1, 55, 118, -1, -1, 109, -1, 4,
- -1, 109, 139, 4, -1, 1, -1, 109, 1, -1,
- 109, 139, 1, -1, -1, 113, -1, -1, 112, -1,
- 113, -1, 112, 139, 113, -1, 1, -1, 112, 1,
- -1, 112, 1, 113, -1, 112, 139, 1, -1, 131,
- 114, 113, -1, 113, 41, 113, -1, 113, 42, 113,
- -1, 113, 14, 113, -1, 113, 40, 130, -1, 113,
- 116, 113, -1, 113, 52, 113, 53, 113, -1, 117,
- -1, 13, -1, 12, -1, 51, 13, -1, 9, -1,
- 55, -1, 115, -1, 56, -1, 118, -1, 119, -1,
- 117, 118, -1, 120, -1, 118, 64, 118, -1, 118,
- 59, 118, -1, 118, 60, 118, -1, 118, 61, 118,
- -1, 118, 57, 118, -1, 118, 58, 118, -1, 38,
- 123, 107, -1, 131, 43, -1, 131, 44, -1, 66,
- 112, 135, 40, 130, -1, 117, 11, 38, 123, -1,
- 119, 64, 118, -1, 119, 59, 118, -1, 119, 60,
- 118, -1, 119, 61, 118, -1, 119, 57, 118, -1,
- 119, 58, 118, -1, 84, -1, 62, 118, -1, 66,
- 113, 135, -1, 45, 66, 111, 135, -1, 46, 66,
- 111, 135, -1, 46, -1, 121, -1, 131, -1, 43,
- 131, -1, 44, 131, -1, 7, -1, 8, -1, 58,
- 118, -1, 57, 118, -1, 122, -1, 68, 122, -1,
- 3, 66, 111, 135, -1, -1, 131, -1, -1, 125,
- 16, -1, 126, -1, 125, 126, -1, 127, -1, 69,
- 112, 70, -1, 127, -1, 128, 127, -1, 128, 16,
- -1, 4, -1, 4, 129, -1, 130, -1, 65, 120,
- 132, -1, 43, -1, 44, -1, -1, 71, 106, -1,
- 72, 106, -1, 67, -1, -1, 137, -1, 73, -1,
- 53, -1, 54, 106, -1
+ -1, 39, 88, -1, 34, 109, 88, -1, -1, 21,
+ 91, 109, 88, -1, 92, 88, -1, -1, 99, 93,
+ 100, 101, -1, -1, 22, 4, 94, 123, -1, 22,
+ 66, 4, 67, -1, 112, -1, -1, 92, -1, -1,
+ 96, 97, -1, 96, 1, -1, 24, 98, 137, 105,
+ 87, -1, 25, 137, 105, 87, -1, 7, -1, 58,
+ 7, -1, 57, 7, -1, 8, -1, 84, -1, 31,
+ -1, 32, -1, 110, -1, 66, 111, 134, -1, -1,
+ -1, 10, 102, 116, -1, 19, 66, 112, 134, 105,
+ 89, -1, 19, 66, 112, 134, 105, 89, 20, 105,
+ 89, -1, 50, -1, 104, 50, -1, -1, 104, -1,
+ -1, 55, 117, -1, -1, 108, -1, 4, -1, 108,
+ 138, 4, -1, 1, -1, 108, 1, -1, 108, 138,
+ 1, -1, -1, 112, -1, -1, 111, -1, 112, -1,
+ 111, 138, 112, -1, 1, -1, 111, 1, -1, 111,
+ 1, 112, -1, 111, 138, 1, -1, 130, 113, 112,
+ -1, 112, 41, 112, -1, 112, 42, 112, -1, 112,
+ 14, 112, -1, 112, 40, 129, -1, 112, 115, 112,
+ -1, 112, 52, 112, 53, 112, -1, 116, -1, 13,
+ -1, 12, -1, 51, 13, -1, 9, -1, 55, -1,
+ 114, -1, 56, -1, 117, -1, 118, -1, 116, 117,
+ -1, 119, -1, 117, 64, 117, -1, 117, 59, 117,
+ -1, 117, 60, 117, -1, 117, 61, 117, -1, 117,
+ 57, 117, -1, 117, 58, 117, -1, 38, 122, 106,
+ -1, 130, 43, -1, 130, 44, -1, 66, 111, 134,
+ 40, 129, -1, 116, 11, 38, 122, -1, 118, 64,
+ 117, -1, 118, 59, 117, -1, 118, 60, 117, -1,
+ 118, 61, 117, -1, 118, 57, 117, -1, 118, 58,
+ 117, -1, 84, -1, 62, 117, -1, 66, 112, 134,
+ -1, 45, 66, 110, 134, -1, 46, 66, 110, 134,
+ -1, 46, -1, 120, -1, 130, -1, 43, 130, -1,
+ 44, 130, -1, 7, -1, 8, -1, 58, 117, -1,
+ 57, 117, -1, 121, -1, 68, 121, -1, 3, 66,
+ 110, 134, -1, -1, 130, -1, -1, 124, 16, -1,
+ 125, -1, 124, 125, -1, 126, -1, 69, 111, 70,
+ -1, 126, -1, 127, 126, -1, 127, 16, -1, 4,
+ -1, 4, 128, -1, 129, -1, 65, 119, 131, -1,
+ 43, -1, 44, -1, -1, 71, 105, -1, 72, 105,
+ -1, 67, -1, -1, 136, -1, 73, -1, 53, -1,
+ 54, 105, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -727,21 +727,21 @@ static const yytype_uint16 yyrline[] =
262, 270, 279, 281, 287, 288, 290, 316, 326, 336,
342, 351, 361, 363, 365, 376, 381, 382, 387, 386,
416, 415, 446, 448, 453, 454, 467, 472, 473, 477,
- 479, 481, 488, 509, 555, 598, 708, 715, 722, 732,
- 741, 750, 757, 782, 797, 796, 808, 820, 820, 916,
- 916, 944, 970, 976, 977, 982, 1035, 1036, 1048, 1053,
- 1072, 1090, 1095, 1102, 1108, 1113, 1121, 1123, 1132, 1133,
- 1141, 1146, 1146, 1157, 1161, 1169, 1170, 1173, 1175, 1180,
- 1181, 1188, 1190, 1194, 1200, 1207, 1209, 1211, 1218, 1219,
- 1225, 1226, 1231, 1233, 1238, 1240, 1242, 1244, 1250, 1256,
- 1258, 1260, 1275, 1284, 1290, 1292, 1297, 1299, 1301, 1309,
- 1311, 1316, 1318, 1323, 1325, 1327, 1380, 1382, 1384, 1386,
- 1388, 1390, 1392, 1394, 1415, 1420, 1425, 1448, 1454, 1456,
- 1458, 1460, 1462, 1464, 1469, 1473, 1504, 1506, 1512, 1518,
- 1530, 1531, 1532, 1537, 1542, 1546, 1550, 1562, 1575, 1580,
- 1616, 1634, 1635, 1641, 1642, 1647, 1649, 1656, 1673, 1690,
- 1692, 1699, 1704, 1712, 1726, 1738, 1747, 1751, 1755, 1759,
- 1763, 1767, 1770, 1772, 1776, 1780, 1784
+ 479, 481, 488, 581, 623, 665, 778, 785, 792, 802,
+ 811, 820, 827, 852, 867, 866, 878, 890, 890, 986,
+ 986, 1014, 1040, 1046, 1047, 1053, 1054, 1061, 1066, 1078,
+ 1092, 1094, 1100, 1105, 1107, 1115, 1117, 1126, 1127, 1135,
+ 1140, 1140, 1151, 1155, 1163, 1164, 1167, 1169, 1174, 1175,
+ 1182, 1184, 1188, 1194, 1201, 1203, 1205, 1212, 1213, 1219,
+ 1220, 1225, 1227, 1232, 1234, 1236, 1238, 1244, 1250, 1252,
+ 1254, 1269, 1278, 1284, 1286, 1291, 1293, 1295, 1303, 1305,
+ 1310, 1312, 1317, 1319, 1321, 1374, 1376, 1378, 1380, 1382,
+ 1384, 1386, 1388, 1409, 1414, 1419, 1442, 1448, 1450, 1452,
+ 1454, 1456, 1458, 1463, 1467, 1498, 1500, 1506, 1512, 1524,
+ 1525, 1526, 1531, 1536, 1540, 1544, 1556, 1569, 1574, 1610,
+ 1628, 1629, 1635, 1636, 1641, 1643, 1650, 1667, 1684, 1686,
+ 1693, 1698, 1706, 1720, 1732, 1741, 1745, 1749, 1753, 1757,
+ 1761, 1764, 1766, 1770, 1774, 1778
};
#endif
@@ -765,16 +765,16 @@ static const char *const yytname[] =
"rule", "source", "pattern", "action", "func_name", "lex_builtin",
"function_prologue", "$@1", "regexp", "$@2", "a_slash", "statements",
"statement_term", "statement", "non_compound_stmt", "$@3", "simple_stmt",
- "$@4", "$@5", "opt_simple_stmt", "switch_body", "case_statements",
- "case_statement", "case_value", "print", "print_expression_list",
- "output_redir", "$@6", "if_statement", "nls", "opt_nls", "input_redir",
- "opt_param_list", "param_list", "opt_exp", "opt_expression_list",
- "expression_list", "exp", "assign_operator", "relop_or_less", "a_relop",
- "common_exp", "simp_exp", "simp_exp_nc", "non_post_simp_exp",
- "func_call", "direct_func_call", "opt_variable", "delete_subscript_list",
- "delete_subscript", "delete_exp_list", "bracketed_exp_list", "subscript",
- "subscript_list", "simple_variable", "variable", "opt_incdec", "l_brace",
- "r_brace", "r_paren", "opt_semi", "semi", "colon", "comma", 0
+ "$@4", "$@5", "opt_simple_stmt", "case_statements", "case_statement",
+ "case_value", "print", "print_expression_list", "output_redir", "$@6",
+ "if_statement", "nls", "opt_nls", "input_redir", "opt_param_list",
+ "param_list", "opt_exp", "opt_expression_list", "expression_list", "exp",
+ "assign_operator", "relop_or_less", "a_relop", "common_exp", "simp_exp",
+ "simp_exp_nc", "non_post_simp_exp", "func_call", "direct_func_call",
+ "opt_variable", "delete_subscript_list", "delete_subscript",
+ "delete_exp_list", "bracketed_exp_list", "subscript", "subscript_list",
+ "simple_variable", "variable", "opt_incdec", "l_brace", "r_brace",
+ "r_paren", "opt_semi", "semi", "colon", "comma", 0
};
#endif
@@ -803,19 +803,19 @@ static const yytype_uint8 yyr1[] =
85, 84, 86, 86, 87, 87, 87, 88, 88, 89,
89, 89, 89, 89, 89, 89, 89, 89, 89, 90,
90, 90, 90, 90, 91, 90, 90, 93, 92, 94,
- 92, 92, 92, 95, 95, 96, 97, 97, 97, 98,
- 98, 99, 99, 99, 99, 99, 100, 100, 101, 101,
- 102, 103, 102, 104, 104, 105, 105, 106, 106, 107,
- 107, 108, 108, 109, 109, 109, 109, 109, 110, 110,
- 111, 111, 112, 112, 112, 112, 112, 112, 113, 113,
- 113, 113, 113, 113, 113, 113, 114, 114, 114, 115,
- 115, 116, 116, 117, 117, 117, 118, 118, 118, 118,
- 118, 118, 118, 118, 118, 118, 118, 119, 119, 119,
- 119, 119, 119, 119, 120, 120, 120, 120, 120, 120,
- 120, 120, 120, 120, 120, 120, 120, 120, 121, 121,
- 122, 123, 123, 124, 124, 125, 125, 126, 127, 128,
- 128, 129, 130, 130, 131, 131, 132, 132, 132, 133,
- 134, 135, 136, 136, 137, 138, 139
+ 92, 92, 92, 95, 95, 96, 96, 96, 97, 97,
+ 98, 98, 98, 98, 98, 99, 99, 100, 100, 101,
+ 102, 101, 103, 103, 104, 104, 105, 105, 106, 106,
+ 107, 107, 108, 108, 108, 108, 108, 109, 109, 110,
+ 110, 111, 111, 111, 111, 111, 111, 112, 112, 112,
+ 112, 112, 112, 112, 112, 113, 113, 113, 114, 114,
+ 115, 115, 116, 116, 116, 117, 117, 117, 117, 117,
+ 117, 117, 117, 117, 117, 117, 118, 118, 118, 118,
+ 118, 118, 118, 119, 119, 119, 119, 119, 119, 119,
+ 119, 119, 119, 119, 119, 119, 119, 120, 120, 121,
+ 122, 122, 123, 123, 124, 124, 125, 126, 127, 127,
+ 128, 129, 129, 130, 130, 131, 131, 131, 132, 133,
+ 134, 135, 135, 136, 137, 138
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -827,19 +827,19 @@ static const yytype_uint8 yyr2[] =
0, 3, 1, 1, 0, 2, 2, 1, 2, 2,
3, 1, 9, 6, 8, 8, 12, 11, 1, 2,
2, 2, 2, 3, 0, 4, 2, 0, 4, 0,
- 4, 4, 1, 0, 1, 1, 0, 2, 2, 5,
- 4, 1, 2, 2, 1, 1, 1, 1, 1, 3,
- 0, 0, 3, 6, 9, 1, 2, 0, 1, 0,
- 2, 0, 1, 1, 3, 1, 2, 3, 0, 1,
- 0, 1, 1, 3, 1, 2, 3, 3, 3, 3,
- 3, 3, 3, 3, 5, 1, 1, 1, 2, 1,
- 1, 1, 1, 1, 1, 2, 1, 3, 3, 3,
- 3, 3, 3, 3, 2, 2, 5, 4, 3, 3,
- 3, 3, 3, 3, 1, 2, 3, 4, 4, 1,
- 1, 1, 2, 2, 1, 1, 2, 2, 1, 2,
- 4, 0, 1, 0, 2, 1, 2, 1, 3, 1,
- 2, 2, 1, 2, 1, 3, 1, 1, 0, 2,
- 2, 1, 0, 1, 1, 1, 2
+ 4, 4, 1, 0, 1, 0, 2, 2, 5, 4,
+ 1, 2, 2, 1, 1, 1, 1, 1, 3, 0,
+ 0, 3, 6, 9, 1, 2, 0, 1, 0, 2,
+ 0, 1, 1, 3, 1, 2, 3, 0, 1, 0,
+ 1, 1, 3, 1, 2, 3, 3, 3, 3, 3,
+ 3, 3, 3, 5, 1, 1, 1, 2, 1, 1,
+ 1, 1, 1, 1, 2, 1, 3, 3, 3, 3,
+ 3, 3, 3, 2, 2, 5, 4, 3, 3, 3,
+ 3, 3, 3, 1, 2, 3, 4, 4, 1, 1,
+ 1, 2, 2, 1, 1, 2, 2, 1, 2, 4,
+ 0, 1, 0, 2, 1, 2, 1, 3, 1, 2,
+ 2, 1, 2, 1, 3, 1, 1, 0, 2, 2,
+ 1, 0, 1, 1, 1, 2
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -847,39 +847,39 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 2, 0, 1, 6, 0, 172, 154, 155, 17, 18,
- 28, 19, 20, 161, 0, 0, 0, 149, 5, 85,
+ 2, 0, 1, 6, 0, 171, 153, 154, 17, 18,
+ 28, 19, 20, 160, 0, 0, 0, 148, 5, 84,
33, 0, 0, 32, 0, 0, 0, 0, 3, 0,
- 0, 144, 30, 4, 15, 115, 123, 124, 126, 150,
- 158, 174, 151, 0, 0, 169, 0, 173, 0, 89,
- 162, 152, 153, 0, 0, 0, 157, 151, 156, 145,
- 0, 178, 151, 104, 0, 102, 0, 159, 87, 184,
- 7, 8, 37, 34, 87, 9, 0, 86, 119, 0,
- 0, 0, 0, 0, 0, 120, 122, 121, 0, 0,
- 125, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 117, 116, 134, 135, 0, 0, 0,
- 0, 102, 0, 171, 170, 23, 22, 26, 27, 0,
- 0, 24, 0, 133, 0, 0, 0, 176, 177, 175,
- 105, 87, 181, 0, 0, 146, 13, 0, 0, 88,
- 179, 0, 38, 31, 111, 112, 109, 110, 0, 16,
- 113, 161, 131, 132, 128, 129, 130, 127, 142, 143,
- 139, 140, 141, 138, 118, 108, 160, 168, 25, 0,
- 90, 147, 148, 106, 186, 0, 107, 103, 12, 10,
- 36, 0, 54, 0, 0, 0, 87, 0, 0, 0,
- 76, 77, 0, 98, 0, 87, 35, 48, 0, 57,
- 41, 62, 34, 182, 87, 0, 137, 95, 93, 0,
- 0, 136, 0, 98, 59, 0, 0, 0, 0, 63,
- 49, 50, 51, 0, 99, 52, 180, 56, 0, 0,
- 87, 183, 39, 114, 87, 96, 0, 0, 0, 163,
- 0, 0, 0, 0, 172, 64, 0, 53, 0, 80,
- 78, 40, 21, 29, 97, 94, 87, 55, 60, 0,
- 165, 167, 61, 87, 87, 0, 0, 87, 0, 81,
- 58, 0, 164, 166, 0, 0, 0, 0, 0, 79,
- 0, 83, 66, 43, 0, 87, 0, 87, 82, 87,
- 87, 0, 87, 0, 87, 63, 0, 0, 68, 0,
- 0, 67, 44, 45, 63, 0, 84, 42, 71, 74,
- 0, 0, 75, 0, 185, 87, 0, 87, 73, 72,
- 87, 34, 87, 0, 34, 0, 0, 47, 0, 46
+ 0, 143, 30, 4, 15, 114, 122, 123, 125, 149,
+ 157, 173, 150, 0, 0, 168, 0, 172, 0, 88,
+ 161, 151, 152, 0, 0, 0, 156, 150, 155, 144,
+ 0, 177, 150, 103, 0, 101, 0, 158, 86, 183,
+ 7, 8, 37, 34, 86, 9, 0, 85, 118, 0,
+ 0, 0, 0, 0, 0, 119, 121, 120, 0, 0,
+ 124, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 116, 115, 133, 134, 0, 0, 0,
+ 0, 101, 0, 170, 169, 23, 22, 26, 27, 0,
+ 0, 24, 0, 132, 0, 0, 0, 175, 176, 174,
+ 104, 86, 180, 0, 0, 145, 13, 0, 0, 87,
+ 178, 0, 38, 31, 110, 111, 108, 109, 0, 16,
+ 112, 160, 130, 131, 127, 128, 129, 126, 141, 142,
+ 138, 139, 140, 137, 117, 107, 159, 167, 25, 0,
+ 89, 146, 147, 105, 185, 0, 106, 102, 12, 10,
+ 36, 0, 54, 0, 0, 0, 86, 0, 0, 0,
+ 75, 76, 0, 97, 0, 86, 35, 48, 0, 57,
+ 41, 62, 34, 181, 86, 0, 136, 94, 92, 0,
+ 0, 135, 0, 97, 59, 0, 0, 0, 0, 63,
+ 49, 50, 51, 0, 98, 52, 179, 56, 0, 0,
+ 86, 182, 39, 113, 86, 95, 0, 0, 0, 162,
+ 0, 0, 0, 0, 171, 64, 0, 53, 0, 79,
+ 77, 40, 21, 29, 96, 93, 86, 55, 60, 0,
+ 164, 166, 61, 86, 86, 0, 0, 86, 0, 80,
+ 58, 0, 163, 165, 0, 0, 0, 0, 0, 78,
+ 0, 82, 65, 43, 0, 86, 0, 86, 81, 86,
+ 0, 86, 0, 86, 63, 0, 67, 0, 0, 66,
+ 0, 44, 45, 63, 0, 83, 70, 73, 0, 0,
+ 74, 0, 184, 86, 42, 0, 86, 72, 71, 86,
+ 34, 86, 0, 34, 0, 0, 47, 0, 46
};
/* YYDEFGOTO[NTERM-NUM]. */
@@ -887,306 +887,306 @@ static const yytype_int16 yydefgoto[] =
{
-1, 1, 28, 138, 29, 70, 120, 121, 30, 48,
31, 76, 32, 141, 71, 196, 197, 213, 198, 228,
- 239, 246, 290, 291, 301, 313, 199, 249, 270, 280,
- 200, 139, 140, 123, 209, 210, 223, 109, 110, 201,
- 108, 87, 88, 35, 36, 37, 38, 39, 40, 49,
- 258, 259, 260, 45, 46, 47, 41, 42, 129, 202,
- 203, 135, 230, 204, 315, 134
+ 239, 246, 290, 299, 311, 199, 249, 270, 280, 200,
+ 139, 140, 123, 209, 210, 223, 109, 110, 201, 108,
+ 87, 88, 35, 36, 37, 38, 39, 40, 49, 258,
+ 259, 260, 45, 46, 47, 41, 42, 129, 202, 203,
+ 135, 230, 204, 313, 134
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -267
+#define YYPACT_NINF -268
static const yytype_int16 yypact[] =
{
- -267, 330, -267, -267, -36, -37, -267, -267, -267, -267,
- -267, -267, -267, 20, 20, 20, -30, -20, -267, -267,
- -267, 973, 973, -267, 973, 1018, 799, 6, -267, -15,
- -21, -267, -267, 10, 1057, 947, 300, 325, -267, -267,
- -267, -267, 299, 731, 799, -267, 53, -267, 112, 66,
- -267, -267, -267, 731, 731, 122, 70, -3, 70, 70,
- 973, 88, -267, -267, 50, 1051, 25, -267, 97, -267,
- -267, -267, 10, -267, 97, -267, 143, -267, -267, 973,
- 146, 973, 973, 973, 973, -267, -267, -267, 973, 113,
- 300, 973, 973, 973, 973, 973, 973, 973, 973, 973,
- 973, 973, 973, -267, -267, -267, -267, 139, 973, 87,
- 118, 1086, 7, -267, -267, -267, -267, -267, -267, 121,
- 96, -267, 973, -267, 87, 87, 1051, -267, -267, -267,
- 973, 97, -267, 137, 825, -267, -267, 36, -16, 10,
- -267, 547, -267, -267, 19, -267, 260, 251, 1080, 1086,
- 105, 20, 115, 115, 70, 70, 70, 70, 115, 115,
- 70, 70, 70, 70, -267, 1086, -267, -267, -267, 63,
- 300, -267, -267, 1086, -267, 146, -267, 1086, -267, -267,
- -267, 116, -267, 45, 120, 124, 97, 129, -16, -16,
- -267, -267, -16, 973, -16, 97, -267, -267, -16, -267,
- -267, 1086, -267, 123, 97, 973, -267, -267, -267, 87,
- 117, -267, 973, 973, -267, 193, 973, 973, 660, 870,
- -267, -267, -267, -16, 1086, -267, -267, -267, 593, 547,
- 97, -267, -267, 1086, 97, -267, 72, 1051, -16, -37,
- 133, 1051, 1051, 175, -22, -267, 123, -267, 799, 192,
- -267, -267, -267, -267, -267, -267, 97, -267, -267, 90,
- -267, -267, -267, 97, 97, 141, 146, 97, 50, -267,
- -267, 660, -267, -267, -21, 660, 973, 87, 705, 137,
- 973, 183, -267, -267, 1051, 97, 262, 97, 947, 97,
- 97, 38, 97, 660, 97, 902, 660, 136, -267, 198,
- 156, -267, -267, -267, 902, 87, -267, -267, -267, -267,
- 203, 210, -267, 156, -267, 97, 87, 97, -267, -267,
- 97, -267, 97, 660, -267, 401, 660, -267, 474, -267
+ -268, 322, -268, -268, -36, -35, -268, -268, -268, -268,
+ -268, -268, -268, 20, 20, 20, -26, -21, -268, -268,
+ -268, 965, 965, -268, 965, 1010, 791, 12, -268, -32,
+ -33, -268, -268, 23, 1049, 939, 317, 345, -268, -268,
+ -268, -268, 291, 723, 791, -268, 15, -268, 203, 1,
+ -268, -268, -268, 723, 723, 72, 42, 26, 42, 42,
+ 965, 104, -268, -268, 108, 296, 31, -268, 64, -268,
+ -268, -268, 23, -268, 64, -268, 111, -268, -268, 965,
+ 120, 965, 965, 965, 965, -268, -268, -268, 965, 83,
+ 317, 965, 965, 965, 965, 965, 965, 965, 965, 965,
+ 965, 965, 965, -268, -268, -268, -268, 114, 965, 84,
+ 61, 1088, 116, -268, -268, -268, -268, -268, -268, 105,
+ 87, -268, 965, -268, 84, 84, 296, -268, -268, -268,
+ 965, 64, -268, 118, 817, -268, -268, 13, -15, 23,
+ -268, 539, -268, -268, 121, -268, 217, 241, 1068, 1088,
+ 141, 20, -10, -10, 42, 42, 42, 42, -10, -10,
+ 42, 42, 42, 42, -268, 1088, -268, -268, -268, 43,
+ 317, -268, -268, 1088, -268, 120, -268, 1088, -268, -268,
+ -268, 90, -268, 6, 94, 99, 64, 102, -15, -15,
+ -268, -268, -15, 965, -15, 64, -268, -268, -15, -268,
+ -268, 1088, -268, 101, 64, 965, -268, -268, -268, 84,
+ 117, -268, 965, 965, -268, 176, 965, 965, 652, 862,
+ -268, -268, -268, -15, 1088, -268, -268, -268, 585, 539,
+ 64, -268, -268, 1088, 64, -268, 63, 296, -15, -35,
+ 123, 296, 296, 155, -14, -268, 101, -268, 791, 175,
+ -268, -268, -268, -268, -268, -268, 64, -268, -268, 103,
+ -268, -268, -268, 64, 64, 122, 120, 64, 108, -268,
+ -268, 652, -268, -268, -33, 652, 965, 84, 697, 118,
+ 965, 167, -268, -268, 296, 64, 1043, 64, 939, 64,
+ 107, 64, 652, 64, 894, 652, -268, 194, 138, -268,
+ 128, -268, -268, 894, 84, -268, -268, -268, 196, 198,
+ -268, 138, -268, 64, -268, 84, 64, -268, -268, 64,
+ -268, 64, 652, -268, 393, 652, -268, 466, -268
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -267, -267, -267, -267, -267, 188, -267, -267, -267, -267,
- -77, -267, -267, -197, 56, -170, -267, -267, -192, -267,
- -267, -266, -267, -267, -267, -267, -267, -267, -267, -267,
- -267, 43, 34, -267, -267, -267, 11, -39, -23, -1,
- -267, -267, -267, -52, 44, -267, 201, -267, -10, 82,
- -267, -267, -19, -40, -267, -267, -73, -2, -267, -28,
- -213, -54, -267, -25, -79, 26
+ -268, -268, -268, -268, -268, 178, -268, -268, -268, -268,
+ -87, -268, -268, -197, 71, -170, -268, -268, -191, -268,
+ -268, -267, -268, -268, -268, -268, -268, -268, -268, -268,
+ 45, 28, -268, -268, -268, 4, -46, -23, -1, -268,
+ -268, -268, -62, 44, -268, 197, -268, 2, 73, -268,
+ -268, -31, -40, -268, -268, -71, -2, -268, -28, -212,
+ -48, -268, -25, -81, 25
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
number is the opposite. If zero, do what YYDEFACT says.
If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -102
+#define YYTABLE_NINF -101
static const yytype_int16 yytable[] =
{
- 34, 73, 73, 64, 74, 229, 114, 145, 130, 4,
- 133, 50, 51, 52, 124, 125, 251, 67, 266, 57,
- 57, 112, 57, 62, 5, 65, 136, 245, 78, 305,
- 43, 137, 44, 57, 19, 19, 53, 178, 316, 298,
- 105, 106, 111, 111, 33, 67, 54, 44, 243, 214,
- 68, 130, 111, 111, 66, 166, 68, 69, 69, 126,
- 77, 131, 299, 300, 207, 56, 58, 208, 59, 113,
- 171, 172, 72, 254, 85, 86, 255, 167, 144, 90,
- 146, 147, 148, 149, 307, 25, -11, 150, -65, 57,
+ 34, 73, 73, 64, 74, 229, 114, 124, 125, 145,
+ 214, 50, 51, 52, 178, 4, 133, 251, 19, 57,
+ 57, 112, 57, 62, 5, 65, 266, 304, 245, 67,
+ 43, 113, 136, 57, 44, 19, 315, 137, 68, 68,
+ 53, 69, 111, 111, 207, 54, 33, 208, 243, 93,
+ 94, 95, 111, 111, 96, 44, 122, 67, 69, 126,
+ 66, 166, 130, -11, 254, 56, 58, 255, 59, 105,
+ 106, -100, 215, 77, 72, 4, 171, 172, 144, 90,
+ 146, 147, 148, 149, 44, 25, -11, 150, 314, 57,
57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
- 57, 281, 211, 245, 131, 283, 272, 165, 142, -11,
- -65, 215, 245, 74, -102, 115, 116, 132, 235, 130,
- 57, 122, 44, 303, 325, 4, 306, 328, -101, 173,
- -91, 127, 128, 177, 96, 152, 153, 154, 155, 156,
- 157, 158, 159, 160, 161, 162, 163, 19, 143, 50,
- 5, 151, 164, 327, 132, 234, 329, 117, 118, 44,
- -102, -102, 169, 74, 74, 174, 170, 74, -101, 74,
- 168, 131, 131, 74, 93, 94, 95, 175, 231, 96,
- 119, 72, 212, 256, -92, -101, 216, 263, 264, 250,
- 217, -101, 224, 277, 179, 219, 69, 240, 74, 261,
- 262, 265, 269, 289, 233, 308, 309, 276, 195, 314,
- 318, 237, 224, 74, 279, 241, 242, 319, 75, 261,
- 218, 267, 312, 285, 238, 268, 61, 111, 288, 226,
- 292, 72, 72, 206, 320, 72, 236, 72, 232, 0,
- 273, 72, 0, 0, 220, 221, 282, 65, 222, 20,
- 225, 317, 0, 287, 227, 310, 311, 0, 23, 0,
- 78, 294, 322, 0, 252, 79, 72, 0, 253, 78,
- 0, 78, 0, 0, 79, 284, 79, 286, 57, 247,
- 0, 72, 0, 0, 0, 0, 57, 0, 0, 0,
- 271, 80, 81, 0, 257, 0, 0, 274, 275, 0,
- 80, 278, 80, 81, 82, 0, 85, 86, 0, 0,
- 0, 103, 104, 0, 83, 85, 86, 85, 86, 293,
- 0, 295, 0, 296, 297, 0, 302, 0, 304, 0,
- 2, 3, 90, 4, 5, 69, 0, 6, 7, 0,
- 0, 0, 105, 106, 0, 0, 0, 8, 9, 321,
- 107, 323, 0, 0, 324, 0, 326, 91, 92, 93,
- 94, 95, 0, 0, 96, 10, 11, 12, 13, 0,
- 0, 0, 0, 14, 15, 16, 17, 18, 0, 0,
- 19, 20, 97, 98, 99, 100, 101, 21, 22, 102,
- 23, 0, 24, 0, 0, 25, 26, 0, 27, 0,
- 0, -14, 180, -14, 4, 5, 0, 0, 6, 7,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 181, 0, 182, 183, 184, -70, -70, 185, 186, 187,
- 188, 189, 190, 191, 192, 193, 0, 0, 0, 13,
- 194, 0, 0, 0, 14, 15, 16, 17, 0, 0,
- 0, -70, 20, 0, 0, 0, 0, 0, 21, 22,
- 0, 23, 0, 24, 0, 0, 25, 26, 0, 55,
- 0, 0, 68, -70, 69, 180, 0, 4, 5, 0,
- 0, 6, 7, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 181, 0, 182, 183, 184, -69, -69,
- 185, 186, 187, 188, 189, 190, 191, 192, 193, 0,
- 0, 0, 13, 194, 0, 0, 0, 14, 15, 16,
- 17, 0, 0, 0, -69, 20, 0, 0, 0, 0,
- 0, 21, 22, 0, 23, 0, 24, 0, 0, 25,
- 26, 0, 55, 0, 0, 68, -69, 69, 180, 0,
- 4, 5, 0, 0, 6, 7, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 181, 0, 182, 183,
- 184, 0, 0, 185, 186, 187, 188, 189, 190, 191,
- 192, 193, 0, 0, 0, 13, 194, 0, 0, 0,
- 14, 15, 16, 17, 63, 0, 4, 5, 20, 0,
- 6, 7, 0, -100, 21, 22, 0, 23, 0, 24,
- 0, 0, 25, 26, 0, 55, 0, 0, 68, 195,
- 69, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 13, 0, 0, 0, 0, 14, 15, 16, 17,
- 0, 0, 0, -100, 20, 0, 0, 0, 0, 0,
- 21, 22, 0, 23, 0, 24, 0, 0, 25, 248,
- -100, 55, 0, 4, 5, 0, -100, 6, 7, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 181,
- 0, 182, 183, 184, 0, 0, 185, 186, 187, 188,
- 189, 190, 191, 192, 193, 0, 0, 0, 13, 194,
- 0, 0, 0, 14, 15, 16, 17, 0, 4, 5,
- 0, 20, 6, 7, 0, 0, 0, 21, 22, 0,
- 23, 0, 24, 0, 0, 25, 26, 0, 55, 0,
- 0, 68, 63, 69, 4, 5, 0, 0, 6, 7,
+ 57, 281, 142, 245, 211, 283, 96, 165, 296, 130,
+ -90, -100, 245, 74, 19, 131, 143, 130, 235, 272,
+ 57, 151, 302, 324, 5, 305, 327, 164, -100, 173,
+ 78, 297, 298, 177, -100, 152, 153, 154, 155, 156,
+ 157, 158, 159, 160, 161, 162, 163, 127, 128, 50,
+ -101, 132, 326, 169, 168, 328, 212, 19, 175, 174,
+ 216, 234, 131, 74, 74, 217, 170, 74, 219, 74,
+ 131, 131, 44, 74, 69, 132, 85, 86, 231, -86,
+ 240, 265, 250, 72, -91, 269, 167, 289, 276, 256,
+ 262, 312, 224, 263, 264, 277, -101, -101, 74, 261,
+ 195, 306, 307, 317, 233, 318, 115, 116, 75, 179,
+ 310, 237, 224, 74, 218, 241, 242, 238, 288, 261,
+ 279, 267, 61, 226, 206, 268, 78, 111, 273, 285,
+ 319, 79, 232, 72, 72, 236, 291, 72, 0, 72,
+ 0, 0, 0, 72, 0, 20, 282, 65, 117, 118,
+ 78, 308, 309, 287, 23, 79, 316, 80, 252, 220,
+ 221, 293, 253, 222, 0, 225, 0, 321, 72, 227,
+ 0, 119, 85, 86, 0, 284, 0, 286, 57, 0,
+ 0, 80, 81, 72, 271, 0, 57, 0, 0, 0,
+ 0, 274, 275, 0, 247, 278, 85, 86, 0, 0,
+ 0, 0, 0, 103, 104, 78, 0, 0, 0, 257,
+ 79, 0, 0, 292, 0, 294, 0, 295, 300, 301,
+ 0, 303, 2, 3, 0, 4, 5, 0, 0, 6,
+ 7, 0, 90, 0, 105, 106, 80, 81, 82, 8,
+ 9, 320, 107, 0, 322, 0, 0, 323, 83, 325,
+ 0, 85, 86, 0, 0, 0, 0, 10, 11, 12,
+ 13, 0, 0, 132, 0, 14, 15, 16, 17, 18,
+ 0, 0, 19, 20, 91, 92, 93, 94, 95, 21,
+ 22, 96, 23, 0, 24, 0, 0, 25, 26, 0,
+ 27, 0, 0, -14, 180, -14, 4, 5, 0, 0,
+ 6, 7, 97, 98, 99, 100, 101, 0, 0, 102,
+ 0, 0, 181, 0, 182, 183, 184, -69, -69, 185,
+ 186, 187, 188, 189, 190, 191, 192, 193, 0, 0,
+ 0, 13, 194, 0, 0, 0, 14, 15, 16, 17,
+ 0, 0, 0, -69, 20, 0, 0, 0, 0, 0,
+ 21, 22, 0, 23, 0, 24, 0, 0, 25, 26,
+ 0, 55, 0, 0, 68, -69, 69, 180, 0, 4,
+ 5, 0, 0, 6, 7, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 181, 0, 182, 183, 184,
+ -68, -68, 185, 186, 187, 188, 189, 190, 191, 192,
+ 193, 0, 0, 0, 13, 194, 0, 0, 0, 14,
+ 15, 16, 17, 0, 0, 0, -68, 20, 0, 0,
+ 0, 0, 0, 21, 22, 0, 23, 0, 24, 0,
+ 0, 25, 26, 0, 55, 0, 0, 68, -68, 69,
+ 180, 0, 4, 5, 0, 0, 6, 7, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 181, 0,
+ 182, 183, 184, 0, 0, 185, 186, 187, 188, 189,
+ 190, 191, 192, 193, 0, 0, 0, 13, 194, 0,
+ 0, 0, 14, 15, 16, 17, 63, 0, 4, 5,
+ 20, 0, 6, 7, 0, -99, 21, 22, 0, 23,
+ 0, 24, 0, 0, 25, 26, 0, 55, 0, 0,
+ 68, 195, 69, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 13, 0, 0, 0, 0, 14, 15,
- 16, 17, 0, 0, 0, 0, 20, 0, 0, 0,
- 0, 0, 21, 22, 0, 23, 0, 24, 0, 13,
- 25, 26, 0, 55, 14, 15, 16, 17, 69, 0,
- 0, 0, 20, 0, 0, 0, 0, 0, 21, 22,
- 0, 23, 0, 24, 0, 0, 25, 26, -100, 55,
- 63, 0, 4, 5, 0, 0, 6, 7, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 176, 0, 4, 5,
- 0, 0, 6, 7, 0, 0, 0, 13, 0, 0,
- 0, 0, 14, 15, 16, 17, 0, 0, 0, 0,
- 20, 0, 0, 0, 0, 0, 21, 22, 0, 23,
- 0, 24, 0, 13, 25, 26, 0, 55, 14, 15,
- 16, 17, 0, 4, 244, 0, 20, 6, 7, 0,
+ 16, 17, 0, 0, 0, -99, 20, 0, 0, 0,
0, 0, 21, 22, 0, 23, 0, 24, 0, 0,
- 25, 26, 183, 55, 0, 0, 0, 0, 0, 0,
- 0, 190, 191, 0, 0, 4, 5, 0, 13, 6,
- 7, 0, 0, 14, 15, 16, 17, 0, 0, 0,
- 0, 20, 0, 0, 183, 0, 0, 21, 22, 0,
- 23, 0, 24, 190, 191, 25, 26, 0, 55, 0,
- 13, 0, 0, 0, 0, 14, 15, 16, 17, 0,
- 4, 5, 0, 20, 6, 7, 0, 0, 89, 21,
+ 25, 248, -99, 55, 0, 4, 5, 0, -99, 6,
+ 7, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 181, 0, 182, 183, 184, 0, 0, 185, 186,
+ 187, 188, 189, 190, 191, 192, 193, 0, 0, 0,
+ 13, 194, 0, 0, 0, 14, 15, 16, 17, 0,
+ 4, 5, 0, 20, 6, 7, 0, 0, 0, 21,
22, 0, 23, 0, 24, 0, 0, 25, 26, 0,
- 55, 0, 0, 0, 0, 0, 4, 5, 0, 0,
+ 55, 0, 0, 68, 63, 69, 4, 5, 0, 0,
6, 7, 0, 0, 0, 13, 0, 0, 0, 0,
14, 15, 16, 17, 0, 0, 0, 0, 20, 0,
0, 0, 0, 0, 21, 22, 0, 23, 0, 24,
0, 13, 25, 26, 0, 55, 14, 15, 16, 17,
- 0, 4, 5, 0, 20, 6, 7, 0, 0, 0,
+ 69, 0, 0, 0, 20, 0, 0, 0, 0, 0,
21, 22, 0, 23, 0, 24, 0, 0, 25, 26,
- 0, 55, 0, 0, 0, 0, 0, 0, 0, 0,
+ -99, 55, 63, 0, 4, 5, 0, 0, 6, 7,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 176, 0,
+ 4, 5, 0, 0, 6, 7, 0, 0, 0, 13,
+ 0, 0, 0, 0, 14, 15, 16, 17, 0, 0,
+ 0, 0, 20, 0, 0, 0, 0, 0, 21, 22,
+ 0, 23, 0, 24, 0, 13, 25, 26, 0, 55,
+ 14, 15, 16, 17, 0, 4, 244, 0, 20, 6,
+ 7, 0, 0, 0, 21, 22, 0, 23, 0, 24,
+ 0, 0, 25, 26, 183, 55, 0, 0, 0, 0,
+ 0, 0, 0, 190, 191, 0, 0, 4, 5, 0,
+ 13, 6, 7, 0, 0, 14, 15, 16, 17, 0,
+ 0, 0, 0, 20, 0, 0, 183, 0, 0, 21,
+ 22, 0, 23, 0, 24, 190, 191, 25, 26, 0,
+ 55, 0, 13, 0, 0, 0, 0, 14, 15, 16,
+ 17, 0, 4, 5, 0, 20, 6, 7, 0, 0,
+ 89, 21, 22, 0, 23, 0, 24, 0, 0, 25,
+ 26, 0, 55, 0, 0, 0, 0, 0, 4, 5,
+ 0, 0, 6, 7, 0, 0, 0, 13, 0, 0,
+ 0, 0, 14, 15, 16, 17, 0, 0, 0, 0,
+ 20, 0, 0, 0, 0, 0, 21, 22, 0, 23,
+ 0, 24, 0, 13, 25, 26, 0, 55, 14, 15,
+ 16, 17, 0, 4, 5, 0, 20, 6, 7, 0,
+ 0, 0, 21, 22, 0, 23, 0, 24, 0, 0,
+ 25, 26, 0, 55, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 78, 14, 15, 16, 17, 79, 78, 0, 0, 20,
- 0, 79, 0, 0, 0, 21, 22, 0, 23, 0,
- 24, 0, 0, 25, 60, 0, 55, 0, 0, 78,
- 0, 80, 81, 82, 79, 78, 0, 80, 81, 82,
- 79, 0, 0, 83, 0, 0, 85, 86, 0, 83,
- 0, 84, 85, 86, 0, 0, 0, 0, 132, 0,
- 80, 81, 82, 0, 0, 0, 80, 81, 82, 0,
- 0, 0, 83, 205, 0, 85, 86, 0, 83, 0,
- 0, 85, 86
+ 0, 0, 78, 14, 15, 16, 17, 79, 78, 0,
+ 0, 20, 0, 79, 0, 0, 0, 21, 22, 0,
+ 23, 0, 24, 0, 0, 25, 60, 78, 55, 0,
+ 0, 0, 79, 80, 81, 82, 0, 0, 0, 80,
+ 81, 82, 0, 0, 0, 83, 0, 78, 85, 86,
+ 0, 83, 79, 84, 85, 86, 0, 0, 80, 81,
+ 82, 0, 0, 0, 0, 0, 69, 0, 0, 0,
+ 83, 205, 0, 85, 86, 0, 0, 0, 80, 81,
+ 82, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 83, 0, 0, 85, 86
};
static const yytype_int16 yycheck[] =
{
- 1, 29, 30, 26, 29, 202, 46, 80, 1, 3,
- 64, 13, 14, 15, 53, 54, 229, 27, 40, 21,
- 22, 44, 24, 25, 4, 26, 1, 219, 9, 295,
- 66, 6, 69, 35, 50, 50, 66, 1, 304, 1,
- 43, 44, 43, 44, 1, 55, 66, 69, 218, 4,
- 71, 1, 53, 54, 48, 109, 71, 73, 73, 60,
- 50, 54, 24, 25, 1, 21, 22, 4, 24, 16,
- 124, 125, 29, 1, 55, 56, 4, 70, 79, 35,
- 81, 82, 83, 84, 297, 65, 50, 88, 50, 91,
+ 1, 29, 30, 26, 29, 202, 46, 53, 54, 80,
+ 4, 13, 14, 15, 1, 3, 64, 229, 50, 21,
+ 22, 44, 24, 25, 4, 26, 40, 294, 219, 27,
+ 66, 16, 1, 35, 69, 50, 303, 6, 71, 71,
+ 66, 73, 43, 44, 1, 66, 1, 4, 218, 59,
+ 60, 61, 53, 54, 64, 69, 55, 55, 73, 60,
+ 48, 109, 1, 50, 1, 21, 22, 4, 24, 43,
+ 44, 10, 66, 50, 29, 3, 124, 125, 79, 35,
+ 81, 82, 83, 84, 69, 65, 73, 88, 300, 91,
92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
- 102, 271, 175, 295, 54, 275, 16, 108, 74, 73,
- 72, 66, 304, 138, 9, 3, 4, 67, 1, 1,
- 122, 55, 69, 293, 321, 3, 296, 324, 10, 130,
- 67, 43, 44, 134, 64, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 50, 5, 151,
- 4, 38, 13, 323, 67, 209, 326, 45, 46, 69,
- 55, 56, 66, 188, 189, 131, 122, 192, 50, 194,
- 49, 54, 54, 198, 59, 60, 61, 40, 203, 64,
- 68, 138, 66, 237, 67, 67, 66, 241, 242, 228,
- 66, 73, 193, 266, 138, 66, 73, 4, 223, 239,
- 67, 26, 10, 20, 205, 7, 8, 66, 72, 53,
- 7, 212, 213, 238, 268, 216, 217, 7, 30, 259,
- 186, 246, 299, 277, 213, 248, 25, 228, 280, 195,
- 284, 188, 189, 151, 313, 192, 210, 194, 204, -1,
- 259, 198, -1, -1, 188, 189, 274, 248, 192, 51,
- 194, 305, -1, 278, 198, 57, 58, -1, 60, -1,
- 9, 286, 316, -1, 230, 14, 223, -1, 234, 9,
- -1, 9, -1, -1, 14, 276, 14, 278, 280, 223,
- -1, 238, -1, -1, -1, -1, 288, -1, -1, -1,
- 256, 40, 41, -1, 238, -1, -1, 263, 264, -1,
- 40, 267, 40, 41, 42, -1, 55, 56, -1, -1,
- -1, 12, 13, -1, 52, 55, 56, 55, 56, 285,
- -1, 287, -1, 289, 290, -1, 292, -1, 294, -1,
- 0, 1, 288, 3, 4, 73, -1, 7, 8, -1,
- -1, -1, 43, 44, -1, -1, -1, 17, 18, 315,
- 51, 317, -1, -1, 320, -1, 322, 57, 58, 59,
- 60, 61, -1, -1, 64, 35, 36, 37, 38, -1,
- -1, -1, -1, 43, 44, 45, 46, 47, -1, -1,
- 50, 51, 57, 58, 59, 60, 61, 57, 58, 64,
- 60, -1, 62, -1, -1, 65, 66, -1, 68, -1,
- -1, 71, 1, 73, 3, 4, -1, -1, 7, 8,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 19, -1, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 31, 32, 33, 34, -1, -1, -1, 38,
- 39, -1, -1, -1, 43, 44, 45, 46, -1, -1,
- -1, 50, 51, -1, -1, -1, -1, -1, 57, 58,
- -1, 60, -1, 62, -1, -1, 65, 66, -1, 68,
- -1, -1, 71, 72, 73, 1, -1, 3, 4, -1,
- -1, 7, 8, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 19, -1, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, 33, 34, -1,
- -1, -1, 38, 39, -1, -1, -1, 43, 44, 45,
- 46, -1, -1, -1, 50, 51, -1, -1, -1, -1,
- -1, 57, 58, -1, 60, -1, 62, -1, -1, 65,
- 66, -1, 68, -1, -1, 71, 72, 73, 1, -1,
- 3, 4, -1, -1, 7, 8, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 19, -1, 21, 22,
- 23, -1, -1, 26, 27, 28, 29, 30, 31, 32,
- 33, 34, -1, -1, -1, 38, 39, -1, -1, -1,
- 43, 44, 45, 46, 1, -1, 3, 4, 51, -1,
- 7, 8, -1, 10, 57, 58, -1, 60, -1, 62,
- -1, -1, 65, 66, -1, 68, -1, -1, 71, 72,
- 73, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 38, -1, -1, -1, -1, 43, 44, 45, 46,
+ 102, 271, 74, 294, 175, 275, 64, 108, 1, 1,
+ 67, 50, 303, 138, 50, 54, 5, 1, 1, 16,
+ 122, 38, 292, 320, 4, 295, 323, 13, 67, 130,
+ 9, 24, 25, 134, 73, 91, 92, 93, 94, 95,
+ 96, 97, 98, 99, 100, 101, 102, 43, 44, 151,
+ 9, 67, 322, 66, 49, 325, 66, 50, 40, 131,
+ 66, 209, 54, 188, 189, 66, 122, 192, 66, 194,
+ 54, 54, 69, 198, 73, 67, 55, 56, 203, 72,
+ 4, 26, 228, 138, 67, 10, 70, 20, 66, 237,
+ 67, 53, 193, 241, 242, 266, 55, 56, 223, 239,
+ 72, 7, 8, 7, 205, 7, 3, 4, 30, 138,
+ 297, 212, 213, 238, 186, 216, 217, 213, 280, 259,
+ 268, 246, 25, 195, 151, 248, 9, 228, 259, 277,
+ 311, 14, 204, 188, 189, 210, 284, 192, -1, 194,
+ -1, -1, -1, 198, -1, 51, 274, 248, 45, 46,
+ 9, 57, 58, 278, 60, 14, 304, 40, 230, 188,
+ 189, 286, 234, 192, -1, 194, -1, 315, 223, 198,
+ -1, 68, 55, 56, -1, 276, -1, 278, 280, -1,
+ -1, 40, 41, 238, 256, -1, 288, -1, -1, -1,
+ -1, 263, 264, -1, 223, 267, 55, 56, -1, -1,
+ -1, -1, -1, 12, 13, 9, -1, -1, -1, 238,
+ 14, -1, -1, 285, -1, 287, -1, 289, 290, 291,
+ -1, 293, 0, 1, -1, 3, 4, -1, -1, 7,
+ 8, -1, 288, -1, 43, 44, 40, 41, 42, 17,
+ 18, 313, 51, -1, 316, -1, -1, 319, 52, 321,
+ -1, 55, 56, -1, -1, -1, -1, 35, 36, 37,
+ 38, -1, -1, 67, -1, 43, 44, 45, 46, 47,
+ -1, -1, 50, 51, 57, 58, 59, 60, 61, 57,
+ 58, 64, 60, -1, 62, -1, -1, 65, 66, -1,
+ 68, -1, -1, 71, 1, 73, 3, 4, -1, -1,
+ 7, 8, 57, 58, 59, 60, 61, -1, -1, 64,
+ -1, -1, 19, -1, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34, -1, -1,
+ -1, 38, 39, -1, -1, -1, 43, 44, 45, 46,
-1, -1, -1, 50, 51, -1, -1, -1, -1, -1,
57, 58, -1, 60, -1, 62, -1, -1, 65, 66,
- 67, 68, -1, 3, 4, -1, 73, 7, 8, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 19,
- -1, 21, 22, 23, -1, -1, 26, 27, 28, 29,
- 30, 31, 32, 33, 34, -1, -1, -1, 38, 39,
- -1, -1, -1, 43, 44, 45, 46, -1, 3, 4,
- -1, 51, 7, 8, -1, -1, -1, 57, 58, -1,
- 60, -1, 62, -1, -1, 65, 66, -1, 68, -1,
- -1, 71, 1, 73, 3, 4, -1, -1, 7, 8,
- -1, -1, -1, 38, -1, -1, -1, -1, 43, 44,
- 45, 46, -1, -1, -1, -1, 51, -1, -1, -1,
- -1, -1, 57, 58, -1, 60, -1, 62, -1, 38,
- 65, 66, -1, 68, 43, 44, 45, 46, 73, -1,
- -1, -1, 51, -1, -1, -1, -1, -1, 57, 58,
- -1, 60, -1, 62, -1, -1, 65, 66, 67, 68,
+ -1, 68, -1, -1, 71, 72, 73, 1, -1, 3,
+ 4, -1, -1, 7, 8, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 19, -1, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
+ 34, -1, -1, -1, 38, 39, -1, -1, -1, 43,
+ 44, 45, 46, -1, -1, -1, 50, 51, -1, -1,
+ -1, -1, -1, 57, 58, -1, 60, -1, 62, -1,
+ -1, 65, 66, -1, 68, -1, -1, 71, 72, 73,
1, -1, 3, 4, -1, -1, 7, 8, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 1, -1, 3, 4,
- -1, -1, 7, 8, -1, -1, -1, 38, -1, -1,
- -1, -1, 43, 44, 45, 46, -1, -1, -1, -1,
- 51, -1, -1, -1, -1, -1, 57, 58, -1, 60,
- -1, 62, -1, 38, 65, 66, -1, 68, 43, 44,
- 45, 46, -1, 3, 4, -1, 51, 7, 8, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 19, -1,
+ 21, 22, 23, -1, -1, 26, 27, 28, 29, 30,
+ 31, 32, 33, 34, -1, -1, -1, 38, 39, -1,
+ -1, -1, 43, 44, 45, 46, 1, -1, 3, 4,
+ 51, -1, 7, 8, -1, 10, 57, 58, -1, 60,
+ -1, 62, -1, -1, 65, 66, -1, 68, -1, -1,
+ 71, 72, 73, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 38, -1, -1, -1, -1, 43, 44,
+ 45, 46, -1, -1, -1, 50, 51, -1, -1, -1,
-1, -1, 57, 58, -1, 60, -1, 62, -1, -1,
- 65, 66, 22, 68, -1, -1, -1, -1, -1, -1,
- -1, 31, 32, -1, -1, 3, 4, -1, 38, 7,
- 8, -1, -1, 43, 44, 45, 46, -1, -1, -1,
- -1, 51, -1, -1, 22, -1, -1, 57, 58, -1,
- 60, -1, 62, 31, 32, 65, 66, -1, 68, -1,
- 38, -1, -1, -1, -1, 43, 44, 45, 46, -1,
- 3, 4, -1, 51, 7, 8, -1, -1, 11, 57,
+ 65, 66, 67, 68, -1, 3, 4, -1, 73, 7,
+ 8, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 19, -1, 21, 22, 23, -1, -1, 26, 27,
+ 28, 29, 30, 31, 32, 33, 34, -1, -1, -1,
+ 38, 39, -1, -1, -1, 43, 44, 45, 46, -1,
+ 3, 4, -1, 51, 7, 8, -1, -1, -1, 57,
58, -1, 60, -1, 62, -1, -1, 65, 66, -1,
- 68, -1, -1, -1, -1, -1, 3, 4, -1, -1,
+ 68, -1, -1, 71, 1, 73, 3, 4, -1, -1,
7, 8, -1, -1, -1, 38, -1, -1, -1, -1,
43, 44, 45, 46, -1, -1, -1, -1, 51, -1,
-1, -1, -1, -1, 57, 58, -1, 60, -1, 62,
-1, 38, 65, 66, -1, 68, 43, 44, 45, 46,
- -1, 3, 4, -1, 51, 7, 8, -1, -1, -1,
+ 73, -1, -1, -1, 51, -1, -1, -1, -1, -1,
57, 58, -1, 60, -1, 62, -1, -1, 65, 66,
- -1, 68, -1, -1, -1, -1, -1, -1, -1, -1,
+ 67, 68, 1, -1, 3, 4, -1, -1, 7, 8,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 1, -1,
+ 3, 4, -1, -1, 7, 8, -1, -1, -1, 38,
+ -1, -1, -1, -1, 43, 44, 45, 46, -1, -1,
+ -1, -1, 51, -1, -1, -1, -1, -1, 57, 58,
+ -1, 60, -1, 62, -1, 38, 65, 66, -1, 68,
+ 43, 44, 45, 46, -1, 3, 4, -1, 51, 7,
+ 8, -1, -1, -1, 57, 58, -1, 60, -1, 62,
+ -1, -1, 65, 66, 22, 68, -1, -1, -1, -1,
+ -1, -1, -1, 31, 32, -1, -1, 3, 4, -1,
+ 38, 7, 8, -1, -1, 43, 44, 45, 46, -1,
+ -1, -1, -1, 51, -1, -1, 22, -1, -1, 57,
+ 58, -1, 60, -1, 62, 31, 32, 65, 66, -1,
+ 68, -1, 38, -1, -1, -1, -1, 43, 44, 45,
+ 46, -1, 3, 4, -1, 51, 7, 8, -1, -1,
+ 11, 57, 58, -1, 60, -1, 62, -1, -1, 65,
+ 66, -1, 68, -1, -1, -1, -1, -1, 3, 4,
+ -1, -1, 7, 8, -1, -1, -1, 38, -1, -1,
+ -1, -1, 43, 44, 45, 46, -1, -1, -1, -1,
+ 51, -1, -1, -1, -1, -1, 57, 58, -1, 60,
+ -1, 62, -1, 38, 65, 66, -1, 68, 43, 44,
+ 45, 46, -1, 3, 4, -1, 51, 7, 8, -1,
+ -1, -1, 57, 58, -1, 60, -1, 62, -1, -1,
+ 65, 66, -1, 68, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 9, 43, 44, 45, 46, 14, 9, -1, -1, 51,
- -1, 14, -1, -1, -1, 57, 58, -1, 60, -1,
- 62, -1, -1, 65, 66, -1, 68, -1, -1, 9,
- -1, 40, 41, 42, 14, 9, -1, 40, 41, 42,
- 14, -1, -1, 52, -1, -1, 55, 56, -1, 52,
- -1, 54, 55, 56, -1, -1, -1, -1, 67, -1,
- 40, 41, 42, -1, -1, -1, 40, 41, 42, -1,
- -1, -1, 52, 53, -1, 55, 56, -1, 52, -1,
- -1, 55, 56
+ -1, -1, 9, 43, 44, 45, 46, 14, 9, -1,
+ -1, 51, -1, 14, -1, -1, -1, 57, 58, -1,
+ 60, -1, 62, -1, -1, 65, 66, 9, 68, -1,
+ -1, -1, 14, 40, 41, 42, -1, -1, -1, 40,
+ 41, 42, -1, -1, -1, 52, -1, 9, 55, 56,
+ -1, 52, 14, 54, 55, 56, -1, -1, 40, 41,
+ 42, -1, -1, -1, -1, -1, 73, -1, -1, -1,
+ 52, 53, -1, 55, 56, -1, -1, -1, 40, 41,
+ 42, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 52, -1, -1, 55, 56
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -1196,36 +1196,36 @@ static const yytype_uint8 yystos[] =
0, 75, 0, 1, 3, 4, 7, 8, 17, 18,
35, 36, 37, 38, 43, 44, 45, 46, 47, 50,
51, 57, 58, 60, 62, 65, 66, 68, 76, 78,
- 82, 84, 86, 105, 113, 117, 118, 119, 120, 121,
- 122, 130, 131, 66, 69, 127, 128, 129, 83, 123,
- 131, 131, 131, 66, 66, 68, 118, 131, 118, 118,
- 66, 120, 131, 1, 112, 113, 48, 122, 71, 73,
- 79, 88, 105, 133, 137, 79, 85, 50, 9, 14,
- 40, 41, 42, 52, 54, 55, 56, 115, 116, 11,
- 118, 57, 58, 59, 60, 61, 64, 57, 58, 59,
- 60, 61, 64, 12, 13, 43, 44, 51, 114, 111,
- 112, 113, 112, 16, 127, 3, 4, 45, 46, 68,
- 80, 81, 55, 107, 111, 111, 113, 43, 44, 132,
- 1, 54, 67, 135, 139, 135, 1, 6, 77, 105,
- 106, 87, 106, 5, 113, 130, 113, 113, 113, 113,
- 113, 38, 118, 118, 118, 118, 118, 118, 118, 118,
- 118, 118, 118, 118, 13, 113, 135, 70, 49, 66,
- 118, 135, 135, 113, 106, 40, 1, 113, 1, 88,
+ 82, 84, 86, 104, 112, 116, 117, 118, 119, 120,
+ 121, 129, 130, 66, 69, 126, 127, 128, 83, 122,
+ 130, 130, 130, 66, 66, 68, 117, 130, 117, 117,
+ 66, 119, 130, 1, 111, 112, 48, 121, 71, 73,
+ 79, 88, 104, 132, 136, 79, 85, 50, 9, 14,
+ 40, 41, 42, 52, 54, 55, 56, 114, 115, 11,
+ 117, 57, 58, 59, 60, 61, 64, 57, 58, 59,
+ 60, 61, 64, 12, 13, 43, 44, 51, 113, 110,
+ 111, 112, 111, 16, 126, 3, 4, 45, 46, 68,
+ 80, 81, 55, 106, 110, 110, 112, 43, 44, 131,
+ 1, 54, 67, 134, 138, 134, 1, 6, 77, 104,
+ 105, 87, 105, 5, 112, 129, 112, 112, 112, 112,
+ 112, 38, 117, 117, 117, 117, 117, 117, 117, 117,
+ 117, 117, 117, 117, 13, 112, 134, 70, 49, 66,
+ 117, 134, 134, 112, 105, 40, 1, 112, 1, 88,
1, 19, 21, 22, 23, 26, 27, 28, 29, 30,
- 31, 32, 33, 34, 39, 72, 89, 90, 92, 100,
- 104, 113, 133, 134, 137, 53, 123, 1, 4, 108,
- 109, 130, 66, 91, 4, 66, 66, 66, 106, 66,
- 88, 88, 88, 110, 113, 88, 106, 88, 93, 87,
- 136, 137, 106, 113, 135, 1, 139, 113, 110, 94,
- 4, 113, 113, 89, 4, 92, 95, 88, 66, 101,
- 111, 134, 106, 106, 1, 4, 135, 88, 124, 125,
- 126, 127, 67, 135, 135, 26, 40, 137, 112, 10,
- 102, 106, 16, 126, 106, 106, 66, 130, 106, 135,
- 103, 89, 133, 89, 113, 135, 113, 137, 117, 20,
- 96, 97, 135, 106, 137, 106, 106, 106, 1, 24,
- 25, 98, 106, 89, 106, 95, 89, 134, 7, 8,
- 57, 58, 84, 99, 53, 138, 95, 135, 7, 7,
- 138, 106, 135, 106, 106, 87, 106, 89, 87, 89
+ 31, 32, 33, 34, 39, 72, 89, 90, 92, 99,
+ 103, 112, 132, 133, 136, 53, 122, 1, 4, 107,
+ 108, 129, 66, 91, 4, 66, 66, 66, 105, 66,
+ 88, 88, 88, 109, 112, 88, 105, 88, 93, 87,
+ 135, 136, 105, 112, 134, 1, 138, 112, 109, 94,
+ 4, 112, 112, 89, 4, 92, 95, 88, 66, 100,
+ 110, 133, 105, 105, 1, 4, 134, 88, 123, 124,
+ 125, 126, 67, 134, 134, 26, 40, 136, 111, 10,
+ 101, 105, 16, 125, 105, 105, 66, 129, 105, 134,
+ 102, 89, 132, 89, 112, 134, 112, 136, 116, 20,
+ 96, 134, 105, 136, 105, 105, 1, 24, 25, 97,
+ 105, 105, 89, 105, 95, 89, 7, 8, 57, 58,
+ 84, 98, 53, 137, 133, 95, 134, 7, 7, 137,
+ 105, 134, 105, 105, 87, 105, 89, 87, 89
};
#define yyerrok (yyerrstatus = 0)
@@ -2431,130 +2431,197 @@ yyreduce:
/* Line 1464 of yacc.c */
#line 489 "awkgram.y"
{
- INSTRUCTION *ip;
+ INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt;
+ INSTRUCTION *ip, *nextc, *tbreak;
+ const char **case_values = NULL;
+ int maxcount = 128;
+ int case_count = 0;
+ int i;
+
+ tbreak = instruction(Op_no_op);
+ cstmt = list_create(tbreak);
+ cexp = list_create(instruction(Op_pop));
+ dflt = instruction(Op_jmp);
+ dflt->target_jmp = tbreak; /* if no case match and no explicit default */
+
+ if ((yyvsp[(7) - (9)]) != NULL) {
+ curr = (yyvsp[(7) - (9)])->nexti;
+ bcfree((yyvsp[(7) - (9)])); /* Op_list */
+ } /* else
+ curr = NULL; */
+
+ for(; curr != NULL; curr = nextc) {
+ INSTRUCTION *caseexp = curr->case_exp;
+ INSTRUCTION *casestmt = curr->case_stmt;
+
+ nextc = curr->nexti;
+ if (curr->opcode == Op_K_case) {
+ if (caseexp->opcode == Op_push_i) {
+ /* a constant scalar */
+ char *caseval;
+ caseval = force_string(caseexp->memory)->stptr;
+ for (i = 0; i < case_count; i++) {
+ if (strcmp(caseval, case_values[i]) == 0) {
+ /* can't use yyerror, since may have overshot the source line */
+ errcount++;
+ error(_("duplicate case values in switch body: %s"), caseval);
+ }
+ }
+
+ if (case_values == NULL)
+ emalloc(case_values, const char **, sizeof(char *) * maxcount, "statement");
+ else if (case_count >= maxcount) {
+ maxcount += 128;
+ erealloc(case_values, const char **, sizeof(char*) * maxcount, "statement");
+ }
+ case_values[case_count++] = caseval;
+ } else {
+ /* match a constant regex against switch expression. */
+ (curr + 1)->match_exp = TRUE;
+ }
+ curr->stmt_start = casestmt->nexti;
+ curr->stmt_end = casestmt->lasti;
+ (void) list_prepend(cexp, curr);
+ (void) list_prepend(cexp, caseexp);
+ } else {
+ if (dflt->target_jmp != tbreak) {
+ /* can't use yyerror, since may have overshot the source line */
+ errcount++;
+ error(_("duplicate `default' detected in switch body"));
+ } else
+ dflt->target_jmp = casestmt->nexti;
+
+ if (do_profiling) {
+ curr->stmt_start = casestmt->nexti;
+ curr->stmt_end = casestmt->lasti;
+ (void) list_prepend(cexp, curr);
+ } else
+ bcfree(curr);
+ }
+
+ cstmt = list_merge(casestmt, cstmt);
+ }
+
+ if (case_values != NULL)
+ efree(case_values);
- (yyvsp[(1) - (9)])->opcode = Op_push_loop;
- (yyvsp[(1) - (9)])->target_continue = NULL;
- ip = list_prepend((yyvsp[(3) - (9)]), (yyvsp[(1) - (9)]));
- if ((yyvsp[(7) - (9)])->nexti->switch_dflt == NULL)
- (yyvsp[(7) - (9)])->nexti->switch_dflt = (yyvsp[(1) - (9)]); /* implicit break */
+ ip = (yyvsp[(3) - (9)]);
if (do_profiling) {
+ (void) list_prepend(ip, (yyvsp[(1) - (9)]));
(void) list_prepend(ip, instruction(Op_exec_count));
- ((yyvsp[(1) - (9)]) + 1)->opcode = Op_K_switch;
- ((yyvsp[(1) - (9)]) + 1)->switch_body = (yyvsp[(7) - (9)])->nexti;
- }
- (void) list_merge(ip, (yyvsp[(7) - (9)]));
- (yyval) = list_append(ip, instruction(Op_pop_loop));
- (yyvsp[(1) - (9)])->target_break = (yyval)->lasti;
+ (yyvsp[(1) - (9)])->target_break = tbreak;
+ ((yyvsp[(1) - (9)]) + 1)->switch_start = cexp->nexti;
+ ((yyvsp[(1) - (9)]) + 1)->switch_end = cexp->lasti;
+ }/* else
+ $1 is NULL */
+
+ (void) list_append(cexp, dflt);
+ (void) list_merge(ip, cexp);
+ (yyval) = list_merge(ip, cstmt);
break_allowed--;
- fix_break_continue((yyvsp[(1) - (9)]), (yyval)->lasti, FALSE);
+ fix_break_continue(ip, tbreak, NULL);
}
break;
case 43:
/* Line 1464 of yacc.c */
-#line 510 "awkgram.y"
+#line 582 "awkgram.y"
{
- /*
- * [Op_push_loop| z| y]
- * -----------------
- * z:
- * cond
- * -----------------
- * [Op_jmp_false y ]
- * -----------------
- * body
- * -----------------
- * [Op_jmp z ]
- * y: [Op_pop_loop ]
- */
-
- INSTRUCTION *ip, *tp;
+ /*
+ * -----------------
+ * tc:
+ * cond
+ * -----------------
+ * [Op_jmp_false tb ]
+ * -----------------
+ * body
+ * -----------------
+ * [Op_jmp tc ]
+ * tb:[Op_no_op ]
+ */
- tp = instruction(Op_pop_loop);
+ INSTRUCTION *ip, *tbreak, *tcont;
+ tbreak = instruction(Op_no_op);
add_lint((yyvsp[(3) - (6)]), LINT_assign_in_cond);
- (yyvsp[(1) - (6)])->opcode = Op_push_loop;
- (yyvsp[(1) - (6)])->target_continue = (yyvsp[(3) - (6)])->nexti;
- (yyvsp[(1) - (6)])->target_break = tp;
- ip = list_create((yyvsp[(1) - (6)]));
-
- (void) list_merge(ip, (yyvsp[(3) - (6)]));
- (void) list_append(ip, instruction(Op_jmp_false));
- ip->lasti->target_jmp = tp;
+ tcont = (yyvsp[(3) - (6)])->nexti;
+ ip = list_append((yyvsp[(3) - (6)]), instruction(Op_jmp_false));
+ ip->lasti->target_jmp = tbreak;
if (do_profiling) {
(void) list_append(ip, instruction(Op_exec_count));
- ((yyvsp[(1) - (6)]) + 1)->opcode = Op_K_while;
+ (yyvsp[(1) - (6)])->target_break = tbreak;
+ (yyvsp[(1) - (6)])->target_continue = tcont;
((yyvsp[(1) - (6)]) + 1)->while_body = ip->lasti;
- }
+ (void) list_prepend(ip, (yyvsp[(1) - (6)]));
+ }/* else
+ $1 is NULL */
if ((yyvsp[(6) - (6)]) != NULL)
(void) list_merge(ip, (yyvsp[(6) - (6)]));
(void) list_append(ip, instruction(Op_jmp));
- ip->lasti->target_jmp = (yyvsp[(1) - (6)])->target_continue;
- (yyval) = list_append(ip, tp);
+ ip->lasti->target_jmp = tcont;
+ (yyval) = list_append(ip, tbreak);
break_allowed--;
continue_allowed--;
- fix_break_continue((yyvsp[(1) - (6)]), tp, TRUE);
+ fix_break_continue(ip, tbreak, tcont);
}
break;
case 44:
/* Line 1464 of yacc.c */
-#line 556 "awkgram.y"
+#line 624 "awkgram.y"
{
- /*
- * [Op_push_loop | x | y]
- * -----------------
- * z:
- * body
- * -----------------
- * x:
- * cond
- * -----------------
- * [Op_jmp_true | z ]
- * y: [Op_pop_loop ]
- */
-
- INSTRUCTION *ip;
+ /*
+ * -----------------
+ * z:
+ * body
+ * -----------------
+ * tc:
+ * cond
+ * -----------------
+ * [Op_jmp_true | z ]
+ * tb:[Op_no_op ]
+ */
- (yyvsp[(4) - (8)])->opcode = Op_pop_loop;
- (yyvsp[(1) - (8)])->opcode = Op_push_loop;
- (yyvsp[(1) - (8)])->target_continue = (yyvsp[(6) - (8)])->nexti;
- (yyvsp[(1) - (8)])->target_break = (yyvsp[(4) - (8)]);
+ INSTRUCTION *ip, *tbreak, *tcont;
+ tbreak = instruction(Op_no_op);
+ tcont = (yyvsp[(6) - (8)])->nexti;
add_lint((yyvsp[(6) - (8)]), LINT_assign_in_cond);
if ((yyvsp[(3) - (8)]) != NULL)
ip = list_merge((yyvsp[(3) - (8)]), (yyvsp[(6) - (8)]));
else
ip = list_prepend((yyvsp[(6) - (8)]), instruction(Op_no_op));
-
- if (do_profiling) {
+ if (do_profiling)
(void) list_prepend(ip, instruction(Op_exec_count));
- ((yyvsp[(1) - (8)]) + 1)->opcode = Op_K_do;
- ((yyvsp[(1) - (8)]) + 1)->doloop_cond = (yyvsp[(1) - (8)])->target_continue;
- }
-
(void) list_append(ip, instruction(Op_jmp_true));
ip->lasti->target_jmp = ip->nexti;
- (yyval) = list_prepend(ip, (yyvsp[(1) - (8)]));
- (void) list_append(ip, (yyvsp[(4) - (8)]));
+ (yyval) = list_append(ip, tbreak);
break_allowed--;
continue_allowed--;
- fix_break_continue((yyvsp[(1) - (8)]), (yyvsp[(4) - (8)]), TRUE);
+ fix_break_continue(ip, tbreak, tcont);
+
+ if (do_profiling) {
+ (yyvsp[(1) - (8)])->target_break = tbreak;
+ (yyvsp[(1) - (8)])->target_continue = tcont;
+ ((yyvsp[(1) - (8)]) + 1)->doloop_cond = tcont;
+ (yyval) = list_prepend(ip, (yyvsp[(1) - (8)]));
+ bcfree((yyvsp[(4) - (8)]));
+ } /* else
+ $1 and $4 are NULLs */
}
break;
case 45:
/* Line 1464 of yacc.c */
-#line 599 "awkgram.y"
+#line 666 "awkgram.y"
{
INSTRUCTION *ip;
char *var_name = (yyvsp[(3) - (8)])->lextok;
@@ -2593,7 +2660,8 @@ yyreduce:
(void) make_assignable((yyvsp[(8) - (8)])->nexti);
(yyvsp[(8) - (8)])->lasti->opcode = Op_K_delete_loop;
(yyvsp[(8) - (8)])->lasti->expr_count = 0;
- bcfree((yyvsp[(1) - (8)]));
+ if ((yyvsp[(1) - (8)]) != NULL)
+ bcfree((yyvsp[(1) - (8)]));
efree(var_name);
bcfree((yyvsp[(3) - (8)]));
bcfree((yyvsp[(4) - (8)]));
@@ -2602,31 +2670,38 @@ yyreduce:
} else
goto regular_loop;
} else {
+ INSTRUCTION *tbreak, *tcont;
- /* [ Op_push_array a ]
- * [ Op_arrayfor_init| w ]
- * [ Op_push_loop | z | y ]
- * z: [ Op_arrayfor_incr | y ]
- * [ Op_var_assign if any ]
+ /* [ Op_push_array a ]
+ * [ Op_arrayfor_init | ib ]
+ * ic:[ Op_arrayfor_incr | ib ]
+ * [ Op_var_assign if any ]
*
* body
*
- * [Op_jmp | z ]
- * y: [Op_pop_loop ]
- * w: [Op_arrayfor_final ]
+ * [Op_jmp | ic ]
+ * ib:[Op_arrayfor_final ]
*/
regular_loop:
ip = (yyvsp[(5) - (8)]);
ip->nexti->opcode = Op_push_array;
- (yyvsp[(3) - (8)])->opcode = Op_arrayfor_init;
- (void) list_append(ip, (yyvsp[(3) - (8)]));
+ tbreak = instruction(Op_arrayfor_final);
(yyvsp[(4) - (8)])->opcode = Op_arrayfor_incr;
(yyvsp[(4) - (8)])->array_var = variable(var_name, Node_var);
- (yyvsp[(1) - (8)])->opcode = Op_push_loop;
- (yyvsp[(1) - (8)])->target_continue = (yyvsp[(4) - (8)]);
+ (yyvsp[(4) - (8)])->target_jmp = tbreak;
+ tcont = (yyvsp[(4) - (8)]);
+ (yyvsp[(3) - (8)])->opcode = Op_arrayfor_init;
+ (yyvsp[(3) - (8)])->target_jmp = tbreak;
+ (void) list_append(ip, (yyvsp[(3) - (8)]));
- (void) list_append(ip, (yyvsp[(1) - (8)]));
+ if (do_profiling) {
+ (yyvsp[(1) - (8)])->opcode = Op_K_arrayfor;
+ (yyvsp[(1) - (8)])->target_continue = tcont;
+ (yyvsp[(1) - (8)])->target_break = tbreak;
+ (void) list_append(ip, (yyvsp[(1) - (8)]));
+ } /* else
+ $1 is NULL */
/* add update_FOO instruction if necessary */
if ((yyvsp[(4) - (8)])->array_var->type == Node_var && (yyvsp[(4) - (8)])->array_var->var_update) {
@@ -2643,7 +2718,6 @@ regular_loop:
if (do_profiling) {
(void) list_append(ip, instruction(Op_exec_count));
- ((yyvsp[(1) - (8)]) + 1)->opcode = Op_K_arrayfor;
((yyvsp[(1) - (8)]) + 1)->forloop_cond = (yyvsp[(4) - (8)]);
((yyvsp[(1) - (8)]) + 1)->forloop_body = ip->lasti;
}
@@ -2653,12 +2727,8 @@ regular_loop:
(void) list_append(ip, instruction(Op_jmp));
ip->lasti->target_jmp = (yyvsp[(4) - (8)]);
- (void) list_append(ip, instruction(Op_pop_loop));
- (yyvsp[(4) - (8)])->target_jmp = (yyvsp[(1) - (8)])->target_break = ip->lasti;
- (yyval) = list_append(ip, instruction(Op_arrayfor_final));
- (yyvsp[(3) - (8)])->target_jmp = (yyval)->lasti;
-
- fix_break_continue((yyvsp[(1) - (8)]), (yyvsp[(4) - (8)])->target_jmp, TRUE);
+ (yyval) = list_append(ip, tbreak);
+ fix_break_continue(ip, tbreak, tcont);
}
break_allowed--;
@@ -2669,7 +2739,7 @@ regular_loop:
case 46:
/* Line 1464 of yacc.c */
-#line 709 "awkgram.y"
+#line 779 "awkgram.y"
{
(yyval) = mk_for_loop((yyvsp[(1) - (12)]), (yyvsp[(3) - (12)]), (yyvsp[(6) - (12)]), (yyvsp[(9) - (12)]), (yyvsp[(12) - (12)]));
@@ -2681,7 +2751,7 @@ regular_loop:
case 47:
/* Line 1464 of yacc.c */
-#line 716 "awkgram.y"
+#line 786 "awkgram.y"
{
(yyval) = mk_for_loop((yyvsp[(1) - (11)]), (yyvsp[(3) - (11)]), (INSTRUCTION *) NULL, (yyvsp[(8) - (11)]), (yyvsp[(11) - (11)]));
@@ -2693,7 +2763,7 @@ regular_loop:
case 48:
/* Line 1464 of yacc.c */
-#line 723 "awkgram.y"
+#line 793 "awkgram.y"
{
if (do_profiling)
(yyval) = list_prepend((yyvsp[(1) - (1)]), instruction(Op_exec_count));
@@ -2705,7 +2775,7 @@ regular_loop:
case 49:
/* Line 1464 of yacc.c */
-#line 733 "awkgram.y"
+#line 803 "awkgram.y"
{
if (! break_allowed)
yyerror(_("`break' is not allowed outside a loop or switch"));
@@ -2719,7 +2789,7 @@ regular_loop:
case 50:
/* Line 1464 of yacc.c */
-#line 742 "awkgram.y"
+#line 812 "awkgram.y"
{
if (! continue_allowed)
yyerror(_("`continue' is not allowed outside a loop"));
@@ -2733,7 +2803,7 @@ regular_loop:
case 51:
/* Line 1464 of yacc.c */
-#line 751 "awkgram.y"
+#line 821 "awkgram.y"
{
if (rule != Rule)
yyerror(_("`next' used in %s action"), ruletab[rule]);
@@ -2745,7 +2815,7 @@ regular_loop:
case 52:
/* Line 1464 of yacc.c */
-#line 758 "awkgram.y"
+#line 828 "awkgram.y"
{
static short warned = FALSE;
@@ -2775,7 +2845,7 @@ regular_loop:
case 53:
/* Line 1464 of yacc.c */
-#line 783 "awkgram.y"
+#line 853 "awkgram.y"
{
if (rule == END)
(yyvsp[(1) - (3)])->target_jmp = ip_atexit;
@@ -2794,7 +2864,7 @@ regular_loop:
case 54:
/* Line 1464 of yacc.c */
-#line 797 "awkgram.y"
+#line 867 "awkgram.y"
{
if (! can_return)
yyerror(_("`return' used outside function context"));
@@ -2804,7 +2874,7 @@ regular_loop:
case 55:
/* Line 1464 of yacc.c */
-#line 800 "awkgram.y"
+#line 870 "awkgram.y"
{
if ((yyvsp[(3) - (4)]) == NULL) {
(yyval) = list_create((yyvsp[(1) - (4)]));
@@ -2818,14 +2888,14 @@ regular_loop:
case 57:
/* Line 1464 of yacc.c */
-#line 820 "awkgram.y"
+#line 890 "awkgram.y"
{ in_print = TRUE; in_parens = 0; }
break;
case 58:
/* Line 1464 of yacc.c */
-#line 821 "awkgram.y"
+#line 891 "awkgram.y"
{
/*
* Optimization: plain `print' has no expression list, so $3 is null.
@@ -2925,14 +2995,14 @@ regular_loop:
case 59:
/* Line 1464 of yacc.c */
-#line 916 "awkgram.y"
+#line 986 "awkgram.y"
{ sub_counter = 0; }
break;
case 60:
/* Line 1464 of yacc.c */
-#line 917 "awkgram.y"
+#line 987 "awkgram.y"
{
char *arr = (yyvsp[(2) - (4)])->lextok;
@@ -2965,7 +3035,7 @@ regular_loop:
case 61:
/* Line 1464 of yacc.c */
-#line 949 "awkgram.y"
+#line 1019 "awkgram.y"
{
static short warned = FALSE;
char *arr = (yyvsp[(3) - (4)])->lextok;
@@ -2992,233 +3062,155 @@ regular_loop:
case 62:
/* Line 1464 of yacc.c */
-#line 971 "awkgram.y"
+#line 1041 "awkgram.y"
{ (yyval) = optimize_assignment((yyvsp[(1) - (1)])); }
break;
case 63:
/* Line 1464 of yacc.c */
-#line 976 "awkgram.y"
+#line 1046 "awkgram.y"
{ (yyval) = NULL; }
break;
case 64:
/* Line 1464 of yacc.c */
-#line 978 "awkgram.y"
+#line 1048 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 65:
/* Line 1464 of yacc.c */
-#line 983 "awkgram.y"
- {
- INSTRUCTION *dflt = NULL;
-
- if ((yyvsp[(1) - (1)]) != NULL) {
- INSTRUCTION *curr;
- const char **case_values = NULL;
- int maxcount = 128;
- int case_count = 0;
- int i;
-
- emalloc(case_values, const char **, sizeof(char *) * maxcount, "statement");
-
- for (curr = (yyvsp[(1) - (1)])->case_val->nexti; curr != NULL; curr = curr->nexti) {
- if (curr->opcode == Op_K_case) {
- char *caseval;
- if (curr->memory->type == Node_regex)
- caseval = curr->memory->re_exp->stptr;
- else
- caseval = force_string(curr->memory)->stptr;
- for (i = 0; i < case_count; i++)
- if (strcmp(caseval, case_values[i]) == 0)
- yyerror(_("duplicate case values in switch body: %s"), caseval);
-
- if (case_count >= maxcount) {
- maxcount += 128;
- erealloc(case_values, const char **, sizeof(char*) * maxcount, "statement");
- }
- case_values[case_count++] = caseval;
- } else {
- /* Otherwise save a pointer to the default node. */
- if (dflt != NULL)
- yyerror(_("duplicate `default' detected in switch body"));
- dflt = curr;
- }
- }
-
- efree(case_values);
- (yyval) = list_prepend((yyvsp[(1) - (1)])->case_stmt, instruction(Op_K_switch));
- (yyval)->nexti->case_val = (yyvsp[(1) - (1)])->case_val->nexti;
- (yyval)->nexti->switch_dflt = dflt;
- bcfree((yyvsp[(1) - (1)])->case_val); /* Op_list */
- bcfree((yyvsp[(1) - (1)])); /* Op_case_list */
- } else {
- (yyval) = list_create(instruction(Op_K_switch));
- (yyval)->nexti->case_val = NULL;
- (yyval)->nexti->switch_dflt = NULL;
- }
- }
- break;
-
- case 66:
-
-/* Line 1464 of yacc.c */
-#line 1035 "awkgram.y"
+#line 1053 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 67:
+ case 66:
/* Line 1464 of yacc.c */
-#line 1037 "awkgram.y"
+#line 1055 "awkgram.y"
{
- if ((yyvsp[(1) - (2)]) == NULL) {
- (yyvsp[(2) - (2)])->case_val = list_create((yyvsp[(2) - (2)])->case_val);
- (yyval) = (yyvsp[(2) - (2)]);
- } else {
- (void) list_append((yyvsp[(1) - (2)])->case_val, (yyvsp[(2) - (2)])->case_val);
- (void) list_merge((yyvsp[(1) - (2)])->case_stmt, (yyvsp[(2) - (2)])->case_stmt);
- bcfree((yyvsp[(2) - (2)])); /* Op_case_list */
- (yyval) = (yyvsp[(1) - (2)]);
- }
+ if ((yyvsp[(1) - (2)]) == NULL)
+ (yyval) = list_create((yyvsp[(2) - (2)]));
+ else
+ (yyval) = list_prepend((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)]));
}
break;
- case 68:
+ case 67:
/* Line 1464 of yacc.c */
-#line 1049 "awkgram.y"
+#line 1062 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 69:
+ case 68:
/* Line 1464 of yacc.c */
-#line 1054 "awkgram.y"
+#line 1067 "awkgram.y"
{
INSTRUCTION *casestmt = (yyvsp[(5) - (5)]);
-
- (yyvsp[(1) - (5)])->memory = (yyvsp[(2) - (5)])->memory;
- bcfree((yyvsp[(2) - (5)]));
if ((yyvsp[(5) - (5)]) == NULL)
casestmt = list_create(instruction(Op_no_op));
if (do_profiling)
(void) list_prepend(casestmt, instruction(Op_exec_count));
-
- (yyvsp[(1) - (5)])->target_stmt = casestmt->nexti;
-
- /* recycle $3 as Op_case_list */
- (yyvsp[(3) - (5)])->opcode = Op_case_list;
- (yyvsp[(3) - (5)])->case_val = (yyvsp[(1) - (5)]); /* Op_K_case */
- (yyvsp[(3) - (5)])->case_stmt = casestmt; /* Op_list */
- (yyval) = (yyvsp[(3) - (5)]);
+ (yyvsp[(1) - (5)])->case_exp = (yyvsp[(2) - (5)]);
+ (yyvsp[(1) - (5)])->case_stmt = casestmt;
+ bcfree((yyvsp[(3) - (5)]));
+ (yyval) = (yyvsp[(1) - (5)]);
}
break;
- case 70:
+ case 69:
/* Line 1464 of yacc.c */
-#line 1073 "awkgram.y"
+#line 1079 "awkgram.y"
{
INSTRUCTION *casestmt = (yyvsp[(4) - (4)]);
-
if ((yyvsp[(4) - (4)]) == NULL)
casestmt = list_create(instruction(Op_no_op));
if (do_profiling)
(void) list_prepend(casestmt, instruction(Op_exec_count));
-
- (yyvsp[(1) - (4)])->target_stmt = casestmt->nexti;
- (yyvsp[(2) - (4)])->opcode = Op_case_list;
- (yyvsp[(2) - (4)])->case_val = (yyvsp[(1) - (4)]); /* Op_K_default */
- (yyvsp[(2) - (4)])->case_stmt = casestmt; /* Op_list */
- (yyval) = (yyvsp[(2) - (4)]);
+ bcfree((yyvsp[(2) - (4)]));
+ (yyvsp[(1) - (4)])->case_stmt = casestmt;
+ (yyval) = (yyvsp[(1) - (4)]);
}
break;
- case 71:
+ case 70:
/* Line 1464 of yacc.c */
-#line 1091 "awkgram.y"
- {
- (yyvsp[(1) - (1)])->opcode = Op_K_case;
- (yyval) = (yyvsp[(1) - (1)]);
- }
+#line 1093 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 72:
+ case 71:
/* Line 1464 of yacc.c */
-#line 1096 "awkgram.y"
+#line 1095 "awkgram.y"
{
(yyvsp[(2) - (2)])->memory->numbr = -(force_number((yyvsp[(2) - (2)])->memory));
bcfree((yyvsp[(1) - (2)]));
- (yyvsp[(2) - (2)])->opcode = Op_K_case;
(yyval) = (yyvsp[(2) - (2)]);
}
break;
- case 73:
+ case 72:
/* Line 1464 of yacc.c */
-#line 1103 "awkgram.y"
+#line 1101 "awkgram.y"
{
bcfree((yyvsp[(1) - (2)]));
- (yyvsp[(2) - (2)])->opcode = Op_K_case;
(yyval) = (yyvsp[(2) - (2)]);
}
break;
- case 74:
+ case 73:
/* Line 1464 of yacc.c */
-#line 1109 "awkgram.y"
- {
- (yyvsp[(1) - (1)])->opcode = Op_K_case;
- (yyval) = (yyvsp[(1) - (1)]);
- }
+#line 1106 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 75:
+ case 74:
/* Line 1464 of yacc.c */
-#line 1114 "awkgram.y"
+#line 1108 "awkgram.y"
{
- (yyvsp[(1) - (1)])->opcode = Op_K_case;
+ (yyvsp[(1) - (1)])->opcode = Op_push_re;
(yyval) = (yyvsp[(1) - (1)]);
}
break;
- case 76:
+ case 75:
/* Line 1464 of yacc.c */
-#line 1122 "awkgram.y"
+#line 1116 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 77:
+ case 76:
/* Line 1464 of yacc.c */
-#line 1124 "awkgram.y"
+#line 1118 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 79:
+ case 78:
/* Line 1464 of yacc.c */
-#line 1134 "awkgram.y"
+#line 1128 "awkgram.y"
{
(yyval) = (yyvsp[(2) - (3)]);
}
break;
- case 80:
+ case 79:
/* Line 1464 of yacc.c */
-#line 1141 "awkgram.y"
+#line 1135 "awkgram.y"
{
in_print = FALSE;
in_parens = 0;
@@ -3226,17 +3218,17 @@ regular_loop:
}
break;
- case 81:
+ case 80:
/* Line 1464 of yacc.c */
-#line 1146 "awkgram.y"
+#line 1140 "awkgram.y"
{ in_print = FALSE; in_parens = 0; }
break;
- case 82:
+ case 81:
/* Line 1464 of yacc.c */
-#line 1147 "awkgram.y"
+#line 1141 "awkgram.y"
{
if ((yyvsp[(1) - (3)])->redir_type == redirect_twoway
&& (yyvsp[(3) - (3)])->lasti->opcode == Op_K_getline_redir
@@ -3246,45 +3238,45 @@ regular_loop:
}
break;
- case 83:
+ case 82:
/* Line 1464 of yacc.c */
-#line 1158 "awkgram.y"
+#line 1152 "awkgram.y"
{
(yyval) = mk_condition((yyvsp[(3) - (6)]), (yyvsp[(1) - (6)]), (yyvsp[(6) - (6)]), NULL, NULL);
}
break;
- case 84:
+ case 83:
/* Line 1464 of yacc.c */
-#line 1163 "awkgram.y"
+#line 1157 "awkgram.y"
{
(yyval) = mk_condition((yyvsp[(3) - (9)]), (yyvsp[(1) - (9)]), (yyvsp[(6) - (9)]), (yyvsp[(7) - (9)]), (yyvsp[(9) - (9)]));
}
break;
- case 89:
+ case 88:
/* Line 1464 of yacc.c */
-#line 1180 "awkgram.y"
+#line 1174 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 90:
+ case 89:
/* Line 1464 of yacc.c */
-#line 1182 "awkgram.y"
+#line 1176 "awkgram.y"
{
bcfree((yyvsp[(1) - (2)]));
(yyval) = (yyvsp[(2) - (2)]);
}
break;
- case 93:
+ case 92:
/* Line 1464 of yacc.c */
-#line 1195 "awkgram.y"
+#line 1189 "awkgram.y"
{
append_param((yyvsp[(1) - (1)])->lextok);
(yyvsp[(1) - (1)])->lextok = NULL;
@@ -3292,10 +3284,10 @@ regular_loop:
}
break;
- case 94:
+ case 93:
/* Line 1464 of yacc.c */
-#line 1201 "awkgram.y"
+#line 1195 "awkgram.y"
{
append_param((yyvsp[(3) - (3)])->lextok);
(yyvsp[(3) - (3)])->lextok = NULL;
@@ -3304,104 +3296,104 @@ regular_loop:
}
break;
- case 95:
+ case 94:
/* Line 1464 of yacc.c */
-#line 1208 "awkgram.y"
+#line 1202 "awkgram.y"
{ /* func_params = NULL; */ }
break;
- case 96:
+ case 95:
/* Line 1464 of yacc.c */
-#line 1210 "awkgram.y"
+#line 1204 "awkgram.y"
{ /* func_params = NULL; */ }
break;
- case 97:
+ case 96:
/* Line 1464 of yacc.c */
-#line 1212 "awkgram.y"
+#line 1206 "awkgram.y"
{ /* func_params = NULL; */ }
break;
- case 98:
+ case 97:
/* Line 1464 of yacc.c */
-#line 1218 "awkgram.y"
+#line 1212 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 99:
+ case 98:
/* Line 1464 of yacc.c */
-#line 1220 "awkgram.y"
+#line 1214 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 100:
+ case 99:
/* Line 1464 of yacc.c */
-#line 1225 "awkgram.y"
+#line 1219 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 101:
+ case 100:
/* Line 1464 of yacc.c */
-#line 1227 "awkgram.y"
+#line 1221 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 102:
+ case 101:
/* Line 1464 of yacc.c */
-#line 1232 "awkgram.y"
+#line 1226 "awkgram.y"
{ (yyval) = mk_expression_list(NULL, (yyvsp[(1) - (1)])); }
break;
- case 103:
+ case 102:
/* Line 1464 of yacc.c */
-#line 1234 "awkgram.y"
+#line 1228 "awkgram.y"
{
(yyval) = mk_expression_list((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]));
yyerrok;
}
break;
- case 104:
+ case 103:
/* Line 1464 of yacc.c */
-#line 1239 "awkgram.y"
+#line 1233 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 105:
+ case 104:
/* Line 1464 of yacc.c */
-#line 1241 "awkgram.y"
+#line 1235 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 106:
+ case 105:
/* Line 1464 of yacc.c */
-#line 1243 "awkgram.y"
+#line 1237 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 107:
+ case 106:
/* Line 1464 of yacc.c */
-#line 1245 "awkgram.y"
+#line 1239 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 108:
+ case 107:
/* Line 1464 of yacc.c */
-#line 1251 "awkgram.y"
+#line 1245 "awkgram.y"
{
if (do_lint && (yyvsp[(3) - (3)])->lasti->opcode == Op_match_rec)
lintwarn(_("regular expression on right of assignment"));
@@ -3409,24 +3401,24 @@ regular_loop:
}
break;
- case 109:
+ case 108:
/* Line 1464 of yacc.c */
-#line 1257 "awkgram.y"
+#line 1251 "awkgram.y"
{ (yyval) = mk_boolean((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
- case 110:
+ case 109:
/* Line 1464 of yacc.c */
-#line 1259 "awkgram.y"
+#line 1253 "awkgram.y"
{ (yyval) = mk_boolean((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
- case 111:
+ case 110:
/* Line 1464 of yacc.c */
-#line 1261 "awkgram.y"
+#line 1255 "awkgram.y"
{
if ((yyvsp[(1) - (3)])->lasti->opcode == Op_match_rec)
warning(_("regular expression on left of `~' or `!~' operator"));
@@ -3443,10 +3435,10 @@ regular_loop:
}
break;
- case 112:
+ case 111:
/* Line 1464 of yacc.c */
-#line 1276 "awkgram.y"
+#line 1270 "awkgram.y"
{
if (do_lint_old)
warning(_("old awk does not support the keyword `in' except after `for'"));
@@ -3457,10 +3449,10 @@ regular_loop:
}
break;
- case 113:
+ case 112:
/* Line 1464 of yacc.c */
-#line 1285 "awkgram.y"
+#line 1279 "awkgram.y"
{
if (do_lint && (yyvsp[(3) - (3)])->lasti->opcode == Op_match_rec)
lintwarn(_("regular expression on right of comparison"));
@@ -3468,90 +3460,90 @@ regular_loop:
}
break;
- case 114:
+ case 113:
/* Line 1464 of yacc.c */
-#line 1291 "awkgram.y"
+#line 1285 "awkgram.y"
{ (yyval) = mk_condition((yyvsp[(1) - (5)]), (yyvsp[(2) - (5)]), (yyvsp[(3) - (5)]), (yyvsp[(4) - (5)]), (yyvsp[(5) - (5)])); }
break;
- case 115:
+ case 114:
/* Line 1464 of yacc.c */
-#line 1293 "awkgram.y"
+#line 1287 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 116:
+ case 115:
/* Line 1464 of yacc.c */
-#line 1298 "awkgram.y"
+#line 1292 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 117:
+ case 116:
/* Line 1464 of yacc.c */
-#line 1300 "awkgram.y"
+#line 1294 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 118:
+ case 117:
/* Line 1464 of yacc.c */
-#line 1302 "awkgram.y"
+#line 1296 "awkgram.y"
{
(yyvsp[(2) - (2)])->opcode = Op_assign_quotient;
(yyval) = (yyvsp[(2) - (2)]);
}
break;
+ case 118:
+
+/* Line 1464 of yacc.c */
+#line 1304 "awkgram.y"
+ { (yyval) = (yyvsp[(1) - (1)]); }
+ break;
+
case 119:
/* Line 1464 of yacc.c */
-#line 1310 "awkgram.y"
+#line 1306 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 120:
/* Line 1464 of yacc.c */
-#line 1312 "awkgram.y"
+#line 1311 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 121:
/* Line 1464 of yacc.c */
-#line 1317 "awkgram.y"
+#line 1313 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 122:
/* Line 1464 of yacc.c */
-#line 1319 "awkgram.y"
+#line 1318 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 123:
/* Line 1464 of yacc.c */
-#line 1324 "awkgram.y"
+#line 1320 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 124:
/* Line 1464 of yacc.c */
-#line 1326 "awkgram.y"
- { (yyval) = (yyvsp[(1) - (1)]); }
- break;
-
- case 125:
-
-/* Line 1464 of yacc.c */
-#line 1328 "awkgram.y"
+#line 1322 "awkgram.y"
{
int count = 2;
int is_simple_var = FALSE;
@@ -3603,52 +3595,52 @@ regular_loop:
}
break;
+ case 126:
+
+/* Line 1464 of yacc.c */
+#line 1377 "awkgram.y"
+ { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
+ break;
+
case 127:
/* Line 1464 of yacc.c */
-#line 1383 "awkgram.y"
+#line 1379 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 128:
/* Line 1464 of yacc.c */
-#line 1385 "awkgram.y"
+#line 1381 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 129:
/* Line 1464 of yacc.c */
-#line 1387 "awkgram.y"
+#line 1383 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 130:
/* Line 1464 of yacc.c */
-#line 1389 "awkgram.y"
+#line 1385 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 131:
/* Line 1464 of yacc.c */
-#line 1391 "awkgram.y"
+#line 1387 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 132:
/* Line 1464 of yacc.c */
-#line 1393 "awkgram.y"
- { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
- break;
-
- case 133:
-
-/* Line 1464 of yacc.c */
-#line 1395 "awkgram.y"
+#line 1389 "awkgram.y"
{
/*
* In BEGINFILE/ENDFILE, allow `getline var < file'
@@ -3671,30 +3663,30 @@ regular_loop:
}
break;
- case 134:
+ case 133:
/* Line 1464 of yacc.c */
-#line 1416 "awkgram.y"
+#line 1410 "awkgram.y"
{
(yyvsp[(2) - (2)])->opcode = Op_postincrement;
(yyval) = mk_assignment((yyvsp[(1) - (2)]), NULL, (yyvsp[(2) - (2)]));
}
break;
- case 135:
+ case 134:
/* Line 1464 of yacc.c */
-#line 1421 "awkgram.y"
+#line 1415 "awkgram.y"
{
(yyvsp[(2) - (2)])->opcode = Op_postdecrement;
(yyval) = mk_assignment((yyvsp[(1) - (2)]), NULL, (yyvsp[(2) - (2)]));
}
break;
- case 136:
+ case 135:
/* Line 1464 of yacc.c */
-#line 1426 "awkgram.y"
+#line 1420 "awkgram.y"
{
if (do_lint_old) {
warning(_("old awk does not support the keyword `in' except after `for'"));
@@ -3714,71 +3706,71 @@ regular_loop:
}
break;
- case 137:
+ case 136:
/* Line 1464 of yacc.c */
-#line 1449 "awkgram.y"
+#line 1443 "awkgram.y"
{
(yyval) = mk_getline((yyvsp[(3) - (4)]), (yyvsp[(4) - (4)]), (yyvsp[(1) - (4)]), (yyvsp[(2) - (4)])->redir_type);
bcfree((yyvsp[(2) - (4)]));
}
break;
+ case 137:
+
+/* Line 1464 of yacc.c */
+#line 1449 "awkgram.y"
+ { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
+ break;
+
case 138:
/* Line 1464 of yacc.c */
-#line 1455 "awkgram.y"
+#line 1451 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 139:
/* Line 1464 of yacc.c */
-#line 1457 "awkgram.y"
+#line 1453 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 140:
/* Line 1464 of yacc.c */
-#line 1459 "awkgram.y"
+#line 1455 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 141:
/* Line 1464 of yacc.c */
-#line 1461 "awkgram.y"
+#line 1457 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 142:
/* Line 1464 of yacc.c */
-#line 1463 "awkgram.y"
+#line 1459 "awkgram.y"
{ (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
break;
case 143:
/* Line 1464 of yacc.c */
-#line 1465 "awkgram.y"
- { (yyval) = mk_binary((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) - (3)])); }
- break;
-
- case 144:
-
-/* Line 1464 of yacc.c */
-#line 1470 "awkgram.y"
+#line 1464 "awkgram.y"
{
(yyval) = list_create((yyvsp[(1) - (1)]));
}
break;
- case 145:
+ case 144:
/* Line 1464 of yacc.c */
-#line 1474 "awkgram.y"
+#line 1468 "awkgram.y"
{
if ((yyvsp[(2) - (2)])->opcode == Op_match_rec) {
(yyvsp[(2) - (2)])->opcode = Op_nomatch;
@@ -3811,17 +3803,17 @@ regular_loop:
}
break;
- case 146:
+ case 145:
/* Line 1464 of yacc.c */
-#line 1505 "awkgram.y"
+#line 1499 "awkgram.y"
{ (yyval) = (yyvsp[(2) - (3)]); }
break;
- case 147:
+ case 146:
/* Line 1464 of yacc.c */
-#line 1507 "awkgram.y"
+#line 1501 "awkgram.y"
{
(yyval) = snode((yyvsp[(3) - (4)]), (yyvsp[(1) - (4)]));
if ((yyval) == NULL)
@@ -3829,10 +3821,10 @@ regular_loop:
}
break;
- case 148:
+ case 147:
/* Line 1464 of yacc.c */
-#line 1513 "awkgram.y"
+#line 1507 "awkgram.y"
{
(yyval) = snode((yyvsp[(3) - (4)]), (yyvsp[(1) - (4)]));
if ((yyval) == NULL)
@@ -3840,10 +3832,10 @@ regular_loop:
}
break;
- case 149:
+ case 148:
/* Line 1464 of yacc.c */
-#line 1519 "awkgram.y"
+#line 1513 "awkgram.y"
{
static short warned1 = FALSE;
@@ -3857,48 +3849,48 @@ regular_loop:
}
break;
- case 152:
+ case 151:
/* Line 1464 of yacc.c */
-#line 1533 "awkgram.y"
+#line 1527 "awkgram.y"
{
(yyvsp[(1) - (2)])->opcode = Op_preincrement;
(yyval) = mk_assignment((yyvsp[(2) - (2)]), NULL, (yyvsp[(1) - (2)]));
}
break;
- case 153:
+ case 152:
/* Line 1464 of yacc.c */
-#line 1538 "awkgram.y"
+#line 1532 "awkgram.y"
{
(yyvsp[(1) - (2)])->opcode = Op_predecrement;
(yyval) = mk_assignment((yyvsp[(2) - (2)]), NULL, (yyvsp[(1) - (2)]));
}
break;
- case 154:
+ case 153:
/* Line 1464 of yacc.c */
-#line 1543 "awkgram.y"
+#line 1537 "awkgram.y"
{
(yyval) = list_create((yyvsp[(1) - (1)]));
}
break;
- case 155:
+ case 154:
/* Line 1464 of yacc.c */
-#line 1547 "awkgram.y"
+#line 1541 "awkgram.y"
{
(yyval) = list_create((yyvsp[(1) - (1)]));
}
break;
- case 156:
+ case 155:
/* Line 1464 of yacc.c */
-#line 1551 "awkgram.y"
+#line 1545 "awkgram.y"
{
if ((yyvsp[(2) - (2)])->lasti->opcode == Op_push_i
&& ((yyvsp[(2) - (2)])->lasti->memory->flags & (STRCUR|STRING)) == 0) {
@@ -3912,10 +3904,10 @@ regular_loop:
}
break;
- case 157:
+ case 156:
/* Line 1464 of yacc.c */
-#line 1563 "awkgram.y"
+#line 1557 "awkgram.y"
{
/*
* was: $$ = $2
@@ -3927,20 +3919,20 @@ regular_loop:
}
break;
- case 158:
+ case 157:
/* Line 1464 of yacc.c */
-#line 1576 "awkgram.y"
+#line 1570 "awkgram.y"
{
func_use((yyvsp[(1) - (1)])->lasti->func_name, FUNC_USE);
(yyval) = (yyvsp[(1) - (1)]);
}
break;
- case 159:
+ case 158:
/* Line 1464 of yacc.c */
-#line 1581 "awkgram.y"
+#line 1575 "awkgram.y"
{
/* indirect function call */
INSTRUCTION *f, *t;
@@ -3975,10 +3967,10 @@ regular_loop:
}
break;
- case 160:
+ case 159:
/* Line 1464 of yacc.c */
-#line 1617 "awkgram.y"
+#line 1611 "awkgram.y"
{
param_sanity((yyvsp[(3) - (4)]));
(yyvsp[(1) - (4)])->opcode = Op_func_call;
@@ -3994,54 +3986,54 @@ regular_loop:
}
break;
- case 161:
+ case 160:
/* Line 1464 of yacc.c */
-#line 1634 "awkgram.y"
+#line 1628 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 162:
+ case 161:
/* Line 1464 of yacc.c */
-#line 1636 "awkgram.y"
+#line 1630 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 163:
+ case 162:
/* Line 1464 of yacc.c */
-#line 1641 "awkgram.y"
+#line 1635 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 164:
+ case 163:
/* Line 1464 of yacc.c */
-#line 1643 "awkgram.y"
+#line 1637 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (2)]); }
break;
- case 165:
+ case 164:
/* Line 1464 of yacc.c */
-#line 1648 "awkgram.y"
+#line 1642 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 166:
+ case 165:
/* Line 1464 of yacc.c */
-#line 1650 "awkgram.y"
+#line 1644 "awkgram.y"
{
(yyval) = list_merge((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)]));
}
break;
- case 167:
+ case 166:
/* Line 1464 of yacc.c */
-#line 1657 "awkgram.y"
+#line 1651 "awkgram.y"
{
INSTRUCTION *ip = (yyvsp[(1) - (1)])->lasti;
int count = ip->sub_count; /* # of SUBSEP-seperated expressions */
@@ -4057,10 +4049,10 @@ regular_loop:
}
break;
- case 168:
+ case 167:
/* Line 1464 of yacc.c */
-#line 1674 "awkgram.y"
+#line 1668 "awkgram.y"
{
INSTRUCTION *t = (yyvsp[(2) - (3)]);
if ((yyvsp[(2) - (3)]) == NULL) {
@@ -4076,33 +4068,33 @@ regular_loop:
}
break;
- case 169:
+ case 168:
/* Line 1464 of yacc.c */
-#line 1691 "awkgram.y"
+#line 1685 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
- case 170:
+ case 169:
/* Line 1464 of yacc.c */
-#line 1693 "awkgram.y"
+#line 1687 "awkgram.y"
{
(yyval) = list_merge((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)]));
}
break;
- case 171:
+ case 170:
/* Line 1464 of yacc.c */
-#line 1700 "awkgram.y"
+#line 1694 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (2)]); }
break;
- case 172:
+ case 171:
/* Line 1464 of yacc.c */
-#line 1705 "awkgram.y"
+#line 1699 "awkgram.y"
{
char *var_name = (yyvsp[(1) - (1)])->lextok;
@@ -4112,10 +4104,10 @@ regular_loop:
}
break;
- case 173:
+ case 172:
/* Line 1464 of yacc.c */
-#line 1713 "awkgram.y"
+#line 1707 "awkgram.y"
{
NODE *n;
@@ -4128,10 +4120,10 @@ regular_loop:
}
break;
- case 174:
+ case 173:
/* Line 1464 of yacc.c */
-#line 1727 "awkgram.y"
+#line 1721 "awkgram.y"
{
INSTRUCTION *ip = (yyvsp[(1) - (1)])->nexti;
if (ip->opcode == Op_push
@@ -4145,10 +4137,10 @@ regular_loop:
}
break;
- case 175:
+ case 174:
/* Line 1464 of yacc.c */
-#line 1739 "awkgram.y"
+#line 1733 "awkgram.y"
{
(yyval) = list_append((yyvsp[(2) - (3)]), (yyvsp[(1) - (3)]));
if ((yyvsp[(3) - (3)]) != NULL)
@@ -4156,70 +4148,70 @@ regular_loop:
}
break;
- case 176:
+ case 175:
/* Line 1464 of yacc.c */
-#line 1748 "awkgram.y"
+#line 1742 "awkgram.y"
{
(yyvsp[(1) - (1)])->opcode = Op_postincrement;
}
break;
- case 177:
+ case 176:
/* Line 1464 of yacc.c */
-#line 1752 "awkgram.y"
+#line 1746 "awkgram.y"
{
(yyvsp[(1) - (1)])->opcode = Op_postdecrement;
}
break;
- case 178:
+ case 177:
/* Line 1464 of yacc.c */
-#line 1755 "awkgram.y"
+#line 1749 "awkgram.y"
{ (yyval) = NULL; }
break;
- case 180:
+ case 179:
/* Line 1464 of yacc.c */
-#line 1763 "awkgram.y"
+#line 1757 "awkgram.y"
{ yyerrok; }
break;
- case 181:
+ case 180:
/* Line 1464 of yacc.c */
-#line 1767 "awkgram.y"
+#line 1761 "awkgram.y"
{ yyerrok; }
break;
- case 184:
+ case 183:
/* Line 1464 of yacc.c */
-#line 1776 "awkgram.y"
+#line 1770 "awkgram.y"
{ yyerrok; }
break;
- case 185:
+ case 184:
/* Line 1464 of yacc.c */
-#line 1780 "awkgram.y"
+#line 1774 "awkgram.y"
{ (yyval) = (yyvsp[(1) - (1)]); yyerrok; }
break;
- case 186:
+ case 185:
/* Line 1464 of yacc.c */
-#line 1784 "awkgram.y"
+#line 1778 "awkgram.y"
{ yyerrok; }
break;
/* Line 1464 of yacc.c */
-#line 4235 "awkgram.c"
+#line 4227 "awkgram.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -4431,7 +4423,7 @@ yyreturn:
/* Line 1684 of yacc.c */
-#line 1786 "awkgram.y"
+#line 1780 "awkgram.y"
struct token {
@@ -4495,14 +4487,14 @@ static const struct token tokentab[] = {
{"dcngettext", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2)|A(3)|A(4)|A(5), do_dcngettext},
{"default", Op_K_default, LEX_DEFAULT, GAWKX, 0},
{"delete", Op_K_delete, LEX_DELETE, NOT_OLD, 0},
-{"do", Op_symbol, LEX_DO, NOT_OLD|BREAK|CONTINUE, 0},
+{"do", Op_K_do, LEX_DO, NOT_OLD|BREAK|CONTINUE, 0},
{"else", Op_K_else, LEX_ELSE, 0, 0},
{"eval", Op_symbol, LEX_EVAL, 0, 0},
{"exit", Op_K_exit, LEX_EXIT, 0, 0},
{"exp", Op_builtin, LEX_BUILTIN, A(1), do_exp},
{"extension", Op_builtin, LEX_BUILTIN, GAWKX|A(2), do_ext},
{"fflush", Op_builtin, LEX_BUILTIN, RESX|A(0)|A(1), do_fflush},
-{"for", Op_symbol, LEX_FOR, BREAK|CONTINUE, 0},
+{"for", Op_K_for, LEX_FOR, BREAK|CONTINUE, 0},
{"func", Op_func, LEX_FUNCTION, NOT_POSIX|NOT_OLD, 0},
{"function",Op_func, LEX_FUNCTION, NOT_OLD, 0},
{"gensub", Op_builtin, LEX_BUILTIN, GAWKX|A(3)|A(4), do_gensub},
@@ -4540,12 +4532,12 @@ static const struct token tokentab[] = {
{"strtonum", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_strtonum},
{"sub", Op_builtin, LEX_BUILTIN, NOT_OLD|A(2)|A(3), do_sub},
{"substr", Op_builtin, LEX_BUILTIN, A(2)|A(3), do_substr},
-{"switch", Op_symbol, LEX_SWITCH, GAWKX|BREAK, 0},
+{"switch", Op_K_switch, LEX_SWITCH, GAWKX|BREAK, 0},
{"system", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_system},
{"systime", Op_builtin, LEX_BUILTIN, GAWKX|A(0), do_systime},
{"tolower", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_tolower},
{"toupper", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_toupper},
-{"while", Op_symbol, LEX_WHILE, BREAK|CONTINUE, 0},
+{"while", Op_K_while, LEX_WHILE, BREAK|CONTINUE, 0},
{"xor", Op_builtin, LEX_BUILTIN, GAWKX|A(2), do_xor},
};
@@ -6080,12 +6072,15 @@ retry:
yylval = bcalloc(tokentab[mid].value, 3, sourceline);
break;
+ case LEX_FOR:
case LEX_WHILE:
case LEX_DO:
- case LEX_FOR:
case LEX_SWITCH:
- yylval = bcalloc(tokentab[mid].value,
- !!do_profiling + 1, sourceline);
+ if (! do_profiling)
+ return lasttok = class;
+ /* fall through */
+ case LEX_CASE:
+ yylval = bcalloc(tokentab[mid].value, 2, sourceline);
break;
default:
@@ -7152,13 +7147,6 @@ mk_rexp(INSTRUCTION *list)
/* isnoeffect --- when used as a statement, has no side effects */
-/*
- * To be completely general, we should recursively walk the parse
- * tree, to make sure that all the subexpressions also have no effect.
- * Instead, we just weaken the actual warning that's printed, up above
- * in the grammar.
- */
-
static int
isnoeffect(OPCODE type)
{
@@ -7489,23 +7477,26 @@ mk_condition(INSTRUCTION *cond, INSTRUCTION *ifp, INSTRUCTION *true_branch,
INSTRUCTION *ip;
- /* FIXME else { } -- add elsep */
-
if (false_branch == NULL) {
- if (elsep != NULL) /* else { } */
- false_branch = list_append(list_create(elsep), instruction(Op_no_op));
- else
- false_branch = list_create(instruction(Op_no_op));
+ false_branch = list_create(instruction(Op_no_op));
+ if (elsep != NULL) { /* else { } */
+ if (do_profiling)
+ (void) list_prepend(false_branch, elsep);
+ else
+ bcfree(elsep);
+ }
} else {
/* assert(elsep != NULL); */
/* avoid a series of no_op's: if .. else if .. else if .. */
if (false_branch->lasti->opcode != Op_no_op)
(void) list_append(false_branch, instruction(Op_no_op));
- (void) list_prepend(false_branch, elsep);
- false_branch->nexti->branch_end = false_branch->lasti;
- if (do_profiling)
+ if (do_profiling) {
+ (void) list_prepend(false_branch, elsep);
+ false_branch->nexti->branch_end = false_branch->lasti;
(void) list_prepend(false_branch, instruction(Op_exec_count));
+ } else
+ bcfree(elsep);
}
(void) list_prepend(false_branch, instruction(Op_jmp));
@@ -7515,12 +7506,13 @@ mk_condition(INSTRUCTION *cond, INSTRUCTION *ifp, INSTRUCTION *true_branch,
ip = list_append(cond, instruction(Op_jmp_false));
ip->lasti->target_jmp = false_branch->nexti->nexti;
- (void) list_prepend(ip, ifp);
if (do_profiling) {
+ (void) list_prepend(ip, ifp);
(void) list_append(ip, instruction(Op_exec_count));
ip->nexti->branch_if = ip->lasti;
ip->nexti->branch_else = false_branch->nexti;
- }
+ } else
+ bcfree(ifp);
if (true_branch != NULL)
list_merge(ip, true_branch);
@@ -7704,7 +7696,7 @@ optimize_assignment(INSTRUCTION *exp)
* 1) Array element assignment array[subs] = x:
* Replaces Op_push_array + Op_subscript_lhs + Op_assign + Op_pop
* with single instruction Op_store_sub.
- * Limitation (FIXME): 1 dimension and sub is simple var/value.
+ * Limitation: 1 dimension and sub is simple var/value.
*
* 2) Simple variable assignment var = x:
* Replaces Op_push_lhs + Op_assign + Op_pop with Op_store_var.
@@ -7749,7 +7741,7 @@ optimize_assignment(INSTRUCTION *exp)
/* avoid stuff like x = x (x = y) or x = x gsub(/./, "b", x);
* check for l-value reference to this variable in the r.h.s.
- * Also avoid function calls in general, to guard against
+ * Also, avoid function calls in general to guard against
* global variable assignment.
*/
@@ -7840,7 +7832,7 @@ optimize_assignment(INSTRUCTION *exp)
/* mk_getline --- make instructions for getline */
static INSTRUCTION *
-mk_getline(INSTRUCTION *op, INSTRUCTION *var, INSTRUCTION *redir, OPCODE redirtype)
+mk_getline(INSTRUCTION *op, INSTRUCTION *var, INSTRUCTION *redir, int redirtype)
{
INSTRUCTION *ip;
INSTRUCTION *tp;
@@ -7903,73 +7895,72 @@ mk_for_loop(INSTRUCTION *forp, INSTRUCTION *init, INSTRUCTION *cond,
INSTRUCTION *incr, INSTRUCTION *body)
{
/*
- * [ Op_push_loop | z| y] <-- continue | break
* ------------------------
* init (may be NULL)
* ------------------------
* x:
* cond (Op_no_op if NULL)
* ------------------------
- * [ Op_jmp_false y ]
+ * [ Op_jmp_false tb ]
* ------------------------
* body (may be NULL)
* ------------------------
- * z:
- * incr (may be NULL)
- * [ Op_jmp x ]
+ * tc:
+ * incr (may be NULL)
+ * [ Op_jmp x ]
* ------------------------
- * y:[ Op_pop_loop ]
+ * tb:[ Op_no_op ]
*/
- INSTRUCTION *ip;
- INSTRUCTION *cp;
+ INSTRUCTION *ip, *tbreak, *tcont;
INSTRUCTION *jmp;
INSTRUCTION *pp_cond;
INSTRUCTION *ret;
- cp = instruction(Op_pop_loop);
-
- forp->opcode = Op_push_loop;
- forp->target_break = cp;
- ip = list_create(forp);
-
- if (init != NULL)
- (void) list_merge(ip, init);
+ tbreak = instruction(Op_no_op);
if (cond != NULL) {
add_lint(cond, LINT_assign_in_cond);
pp_cond = cond->nexti;
- (void) list_merge(ip, cond);
+ ip = cond;
(void) list_append(ip, instruction(Op_jmp_false));
- ip->lasti->target_jmp = cp;
+ ip->lasti->target_jmp = tbreak;
} else {
pp_cond = instruction(Op_no_op);
- (void) list_append(ip, pp_cond);
+ ip = list_create(pp_cond);
}
+ if (init != NULL)
+ ip = list_merge(init, ip);
+
if (do_profiling) {
(void) list_append(ip, instruction(Op_exec_count));
- (forp + 1)->opcode = Op_K_for;
(forp + 1)->forloop_cond = pp_cond;
(forp + 1)->forloop_body = ip->lasti;
}
if (body != NULL)
(void) list_merge(ip, body);
-
- if (incr != NULL) {
- forp->target_continue = incr->nexti;
- (void) list_merge(ip, incr);
- }
+
jmp = instruction(Op_jmp);
jmp->target_jmp = pp_cond;
if (incr == NULL)
- forp->target_continue = jmp;
- (void) list_append(ip, jmp);
+ tcont = jmp;
+ else {
+ tcont = incr->nexti;
+ (void) list_merge(ip, incr);
+ }
- ret = list_append(ip, cp);
+ (void) list_append(ip, jmp);
+ ret = list_append(ip, tbreak);
+ fix_break_continue(ret, tbreak, tcont);
- fix_break_continue(forp, cp, TRUE);
+ if (do_profiling) {
+ forp->target_break = tbreak;
+ forp->target_continue = tcont;
+ ret = list_prepend(ret, forp);
+ } /* else
+ forp is NULL */
return ret;
}
@@ -8095,20 +8086,16 @@ count_expressions(INSTRUCTION **list, int isarg)
return count;
}
-/* fix_break_continue --- fix up break & continue nodes in loop bodies */
+/* fix_break_continue --- fix up break & continue codes in loop bodies */
static void
-fix_break_continue(INSTRUCTION *start, INSTRUCTION *end, int check_continue)
+fix_break_continue(INSTRUCTION *list, INSTRUCTION *b_target, INSTRUCTION *c_target)
{
- INSTRUCTION *ip, *b_target, *c_target;
-
- assert(start->opcode == Op_push_loop);
- assert(end->opcode == Op_pop_loop);
+ INSTRUCTION *ip;
- b_target = start->target_break;
- c_target = start->target_continue;
+ list->lasti->nexti = NULL; /* just to make sure */
- for (ip = start; ip != end; ip = ip->nexti) {
+ for (ip = list->nexti; ip != NULL; ip = ip->nexti) {
switch (ip->opcode) {
case Op_K_break:
if (ip->target_jmp == NULL)
@@ -8116,7 +8103,7 @@ fix_break_continue(INSTRUCTION *start, INSTRUCTION *end, int check_continue)
break;
case Op_K_continue:
- if (check_continue && ip->target_jmp == NULL)
+ if (ip->target_jmp == NULL)
ip->target_jmp = c_target;
break;
@@ -8173,7 +8160,6 @@ release_symbols(NODE *symlist, int keep_globals)
* and free all associated memory.
*/
-
void
destroy_symbol(char *name)
{
@@ -8336,22 +8322,6 @@ free_bc_internal(INSTRUCTION *cp)
)
efree(cp->func_name);
break;
- case Op_K_switch:
- for (curr = cp->case_val; curr != NULL; curr = curr->nexti) {
- if (curr->opcode == Op_K_case &&
- curr->memory->type != Node_val
- ) {
- m = curr->memory;
- if (m->re_text != NULL)
- unref(m->re_text);
- if (m->re_reg != NULL)
- refree(m->re_reg);
- if (m->re_exp != NULL)
- unref(m->re_exp);
- freenode(m);
- }
- }
- break;
case Op_push_re:
case Op_match_rec:
case Op_match:
diff --git a/awkgram.y b/awkgram.y
index aae04a70..4fe2fb76 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -65,11 +65,11 @@ static INSTRUCTION *mk_condition(INSTRUCTION *cond, INSTRUCTION *ifp, INSTRUCTIO
static INSTRUCTION *mk_expression_list(INSTRUCTION *list, INSTRUCTION *s1);
static INSTRUCTION *mk_for_loop(INSTRUCTION *forp, INSTRUCTION *init, INSTRUCTION *cond,
INSTRUCTION *incr, INSTRUCTION *body);
-static void fix_break_continue(INSTRUCTION *start, INSTRUCTION *end, int check_continue);
+static void fix_break_continue(INSTRUCTION *list, INSTRUCTION *b_target, INSTRUCTION *c_target);
static INSTRUCTION *mk_binary(INSTRUCTION *s1, INSTRUCTION *s2, INSTRUCTION *op);
static INSTRUCTION *mk_boolean(INSTRUCTION *left, INSTRUCTION *right, INSTRUCTION *op);
static INSTRUCTION *mk_assignment(INSTRUCTION *lhs, INSTRUCTION *rhs, INSTRUCTION *op);
-static INSTRUCTION *mk_getline(INSTRUCTION *op, INSTRUCTION *opt_var, INSTRUCTION *redir, OPCODE redirtype);
+static INSTRUCTION *mk_getline(INSTRUCTION *op, INSTRUCTION *opt_var, INSTRUCTION *redir, int redirtype);
static NODE *make_regnode(int type, NODE *exp);
static int count_expressions(INSTRUCTION **list, int isarg);
static INSTRUCTION *optimize_assignment(INSTRUCTION *exp);
@@ -485,115 +485,182 @@ statement
else
$$ = $1;
}
- | LEX_SWITCH '(' exp r_paren opt_nls l_brace switch_body opt_nls r_brace
+ | LEX_SWITCH '(' exp r_paren opt_nls l_brace case_statements opt_nls r_brace
{
- INSTRUCTION *ip;
+ INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt;
+ INSTRUCTION *ip, *nextc, *tbreak;
+ const char **case_values = NULL;
+ int maxcount = 128;
+ int case_count = 0;
+ int i;
+
+ tbreak = instruction(Op_no_op);
+ cstmt = list_create(tbreak);
+ cexp = list_create(instruction(Op_pop));
+ dflt = instruction(Op_jmp);
+ dflt->target_jmp = tbreak; /* if no case match and no explicit default */
+
+ if ($7 != NULL) {
+ curr = $7->nexti;
+ bcfree($7); /* Op_list */
+ } /* else
+ curr = NULL; */
+
+ for(; curr != NULL; curr = nextc) {
+ INSTRUCTION *caseexp = curr->case_exp;
+ INSTRUCTION *casestmt = curr->case_stmt;
+
+ nextc = curr->nexti;
+ if (curr->opcode == Op_K_case) {
+ if (caseexp->opcode == Op_push_i) {
+ /* a constant scalar */
+ char *caseval;
+ caseval = force_string(caseexp->memory)->stptr;
+ for (i = 0; i < case_count; i++) {
+ if (strcmp(caseval, case_values[i]) == 0) {
+ /* can't use yyerror, since may have overshot the source line */
+ errcount++;
+ error(_("duplicate case values in switch body: %s"), caseval);
+ }
+ }
+
+ if (case_values == NULL)
+ emalloc(case_values, const char **, sizeof(char *) * maxcount, "statement");
+ else if (case_count >= maxcount) {
+ maxcount += 128;
+ erealloc(case_values, const char **, sizeof(char*) * maxcount, "statement");
+ }
+ case_values[case_count++] = caseval;
+ } else {
+ /* match a constant regex against switch expression. */
+ (curr + 1)->match_exp = TRUE;
+ }
+ curr->stmt_start = casestmt->nexti;
+ curr->stmt_end = casestmt->lasti;
+ (void) list_prepend(cexp, curr);
+ (void) list_prepend(cexp, caseexp);
+ } else {
+ if (dflt->target_jmp != tbreak) {
+ /* can't use yyerror, since may have overshot the source line */
+ errcount++;
+ error(_("duplicate `default' detected in switch body"));
+ } else
+ dflt->target_jmp = casestmt->nexti;
+
+ if (do_profiling) {
+ curr->stmt_start = casestmt->nexti;
+ curr->stmt_end = casestmt->lasti;
+ (void) list_prepend(cexp, curr);
+ } else
+ bcfree(curr);
+ }
+
+ cstmt = list_merge(casestmt, cstmt);
+ }
+
+ if (case_values != NULL)
+ efree(case_values);
- $1->opcode = Op_push_loop;
- $1->target_continue = NULL;
- ip = list_prepend($3, $1);
- if ($7->nexti->switch_dflt == NULL)
- $7->nexti->switch_dflt = $1; /* implicit break */
+ ip = $3;
if (do_profiling) {
+ (void) list_prepend(ip, $1);
(void) list_prepend(ip, instruction(Op_exec_count));
- ($1 + 1)->opcode = Op_K_switch;
- ($1 + 1)->switch_body = $7->nexti;
- }
- (void) list_merge(ip, $7);
- $$ = list_append(ip, instruction(Op_pop_loop));
- $1->target_break = $$->lasti;
+ $1->target_break = tbreak;
+ ($1 + 1)->switch_start = cexp->nexti;
+ ($1 + 1)->switch_end = cexp->lasti;
+ }/* else
+ $1 is NULL */
+
+ (void) list_append(cexp, dflt);
+ (void) list_merge(ip, cexp);
+ $$ = list_merge(ip, cstmt);
break_allowed--;
- fix_break_continue($1, $$->lasti, FALSE);
+ fix_break_continue(ip, tbreak, NULL);
}
| LEX_WHILE '(' exp r_paren opt_nls statement
{
- /*
- * [Op_push_loop| z| y]
- * -----------------
- * z:
- * cond
- * -----------------
- * [Op_jmp_false y ]
- * -----------------
- * body
- * -----------------
- * [Op_jmp z ]
- * y: [Op_pop_loop ]
- */
-
- INSTRUCTION *ip, *tp;
+ /*
+ * -----------------
+ * tc:
+ * cond
+ * -----------------
+ * [Op_jmp_false tb ]
+ * -----------------
+ * body
+ * -----------------
+ * [Op_jmp tc ]
+ * tb:[Op_no_op ]
+ */
- tp = instruction(Op_pop_loop);
+ INSTRUCTION *ip, *tbreak, *tcont;
+ tbreak = instruction(Op_no_op);
add_lint($3, LINT_assign_in_cond);
- $1->opcode = Op_push_loop;
- $1->target_continue = $3->nexti;
- $1->target_break = tp;
- ip = list_create($1);
-
- (void) list_merge(ip, $3);
- (void) list_append(ip, instruction(Op_jmp_false));
- ip->lasti->target_jmp = tp;
+ tcont = $3->nexti;
+ ip = list_append($3, instruction(Op_jmp_false));
+ ip->lasti->target_jmp = tbreak;
if (do_profiling) {
(void) list_append(ip, instruction(Op_exec_count));
- ($1 + 1)->opcode = Op_K_while;
+ $1->target_break = tbreak;
+ $1->target_continue = tcont;
($1 + 1)->while_body = ip->lasti;
- }
+ (void) list_prepend(ip, $1);
+ }/* else
+ $1 is NULL */
if ($6 != NULL)
(void) list_merge(ip, $6);
(void) list_append(ip, instruction(Op_jmp));
- ip->lasti->target_jmp = $1->target_continue;
- $$ = list_append(ip, tp);
+ ip->lasti->target_jmp = tcont;
+ $$ = list_append(ip, tbreak);
break_allowed--;
continue_allowed--;
- fix_break_continue($1, tp, TRUE);
+ fix_break_continue(ip, tbreak, tcont);
}
| LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren opt_nls
{
- /*
- * [Op_push_loop | x | y]
- * -----------------
- * z:
- * body
- * -----------------
- * x:
- * cond
- * -----------------
- * [Op_jmp_true | z ]
- * y: [Op_pop_loop ]
- */
-
- INSTRUCTION *ip;
+ /*
+ * -----------------
+ * z:
+ * body
+ * -----------------
+ * tc:
+ * cond
+ * -----------------
+ * [Op_jmp_true | z ]
+ * tb:[Op_no_op ]
+ */
- $4->opcode = Op_pop_loop;
- $1->opcode = Op_push_loop;
- $1->target_continue = $6->nexti;
- $1->target_break = $4;
+ INSTRUCTION *ip, *tbreak, *tcont;
+ tbreak = instruction(Op_no_op);
+ tcont = $6->nexti;
add_lint($6, LINT_assign_in_cond);
if ($3 != NULL)
ip = list_merge($3, $6);
else
ip = list_prepend($6, instruction(Op_no_op));
-
- if (do_profiling) {
+ if (do_profiling)
(void) list_prepend(ip, instruction(Op_exec_count));
- ($1 + 1)->opcode = Op_K_do;
- ($1 + 1)->doloop_cond = $1->target_continue;
- }
-
(void) list_append(ip, instruction(Op_jmp_true));
ip->lasti->target_jmp = ip->nexti;
- $$ = list_prepend(ip, $1);
- (void) list_append(ip, $4);
+ $$ = list_append(ip, tbreak);
break_allowed--;
continue_allowed--;
- fix_break_continue($1, $4, TRUE);
+ fix_break_continue(ip, tbreak, tcont);
+
+ if (do_profiling) {
+ $1->target_break = tbreak;
+ $1->target_continue = tcont;
+ ($1 + 1)->doloop_cond = tcont;
+ $$ = list_prepend(ip, $1);
+ bcfree($4);
+ } /* else
+ $1 and $4 are NULLs */
}
| LEX_FOR '(' NAME LEX_IN simple_variable r_paren opt_nls statement
{
@@ -634,7 +701,8 @@ statement
(void) make_assignable($8->nexti);
$8->lasti->opcode = Op_K_delete_loop;
$8->lasti->expr_count = 0;
- bcfree($1);
+ if ($1 != NULL)
+ bcfree($1);
efree(var_name);
bcfree($3);
bcfree($4);
@@ -643,31 +711,38 @@ statement
} else
goto regular_loop;
} else {
+ INSTRUCTION *tbreak, *tcont;
- /* [ Op_push_array a ]
- * [ Op_arrayfor_init| w ]
- * [ Op_push_loop | z | y ]
- * z: [ Op_arrayfor_incr | y ]
- * [ Op_var_assign if any ]
+ /* [ Op_push_array a ]
+ * [ Op_arrayfor_init | ib ]
+ * ic:[ Op_arrayfor_incr | ib ]
+ * [ Op_var_assign if any ]
*
* body
*
- * [Op_jmp | z ]
- * y: [Op_pop_loop ]
- * w: [Op_arrayfor_final ]
+ * [Op_jmp | ic ]
+ * ib:[Op_arrayfor_final ]
*/
regular_loop:
ip = $5;
ip->nexti->opcode = Op_push_array;
- $3->opcode = Op_arrayfor_init;
- (void) list_append(ip, $3);
+ tbreak = instruction(Op_arrayfor_final);
$4->opcode = Op_arrayfor_incr;
$4->array_var = variable(var_name, Node_var);
- $1->opcode = Op_push_loop;
- $1->target_continue = $4;
+ $4->target_jmp = tbreak;
+ tcont = $4;
+ $3->opcode = Op_arrayfor_init;
+ $3->target_jmp = tbreak;
+ (void) list_append(ip, $3);
- (void) list_append(ip, $1);
+ if (do_profiling) {
+ $1->opcode = Op_K_arrayfor;
+ $1->target_continue = tcont;
+ $1->target_break = tbreak;
+ (void) list_append(ip, $1);
+ } /* else
+ $1 is NULL */
/* add update_FOO instruction if necessary */
if ($4->array_var->type == Node_var && $4->array_var->var_update) {
@@ -684,7 +759,6 @@ regular_loop:
if (do_profiling) {
(void) list_append(ip, instruction(Op_exec_count));
- ($1 + 1)->opcode = Op_K_arrayfor;
($1 + 1)->forloop_cond = $4;
($1 + 1)->forloop_body = ip->lasti;
}
@@ -694,12 +768,8 @@ regular_loop:
(void) list_append(ip, instruction(Op_jmp));
ip->lasti->target_jmp = $4;
- (void) list_append(ip, instruction(Op_pop_loop));
- $4->target_jmp = $1->target_break = ip->lasti;
- $$ = list_append(ip, instruction(Op_arrayfor_final));
- $3->target_jmp = $$->lasti;
-
- fix_break_continue($1, $4->target_jmp, TRUE);
+ $$ = list_append(ip, tbreak);
+ fix_break_continue(ip, tbreak, tcont);
}
break_allowed--;
@@ -978,72 +1048,15 @@ opt_simple_stmt
{ $$ = $1; }
;
-switch_body
- : case_statements
- {
- INSTRUCTION *dflt = NULL;
-
- if ($1 != NULL) {
- INSTRUCTION *curr;
- const char **case_values = NULL;
- int maxcount = 128;
- int case_count = 0;
- int i;
-
- emalloc(case_values, const char **, sizeof(char *) * maxcount, "statement");
-
- for (curr = $1->case_val->nexti; curr != NULL; curr = curr->nexti) {
- if (curr->opcode == Op_K_case) {
- char *caseval;
- if (curr->memory->type == Node_regex)
- caseval = curr->memory->re_exp->stptr;
- else
- caseval = force_string(curr->memory)->stptr;
- for (i = 0; i < case_count; i++)
- if (strcmp(caseval, case_values[i]) == 0)
- yyerror(_("duplicate case values in switch body: %s"), caseval);
-
- if (case_count >= maxcount) {
- maxcount += 128;
- erealloc(case_values, const char **, sizeof(char*) * maxcount, "statement");
- }
- case_values[case_count++] = caseval;
- } else {
- /* Otherwise save a pointer to the default node. */
- if (dflt != NULL)
- yyerror(_("duplicate `default' detected in switch body"));
- dflt = curr;
- }
- }
-
- efree(case_values);
- $$ = list_prepend($1->case_stmt, instruction(Op_K_switch));
- $$->nexti->case_val = $1->case_val->nexti;
- $$->nexti->switch_dflt = dflt;
- bcfree($1->case_val); /* Op_list */
- bcfree($1); /* Op_case_list */
- } else {
- $$ = list_create(instruction(Op_K_switch));
- $$->nexti->case_val = NULL;
- $$->nexti->switch_dflt = NULL;
- }
- }
- ;
-
case_statements
: /* empty */
{ $$ = NULL; }
| case_statements case_statement
{
- if ($1 == NULL) {
- $2->case_val = list_create($2->case_val);
- $$ = $2;
- } else {
- (void) list_append($1->case_val, $2->case_val);
- (void) list_merge($1->case_stmt, $2->case_stmt);
- bcfree($2); /* Op_case_list */
- $$ = $1;
- }
+ if ($1 == NULL)
+ $$ = list_create($2);
+ else
+ $$ = list_prepend($1, $2);
}
| case_statements error
{ $$ = NULL; }
@@ -1053,66 +1066,47 @@ case_statement
: LEX_CASE case_value colon opt_nls statements
{
INSTRUCTION *casestmt = $5;
-
- $1->memory = $2->memory;
- bcfree($2);
if ($5 == NULL)
casestmt = list_create(instruction(Op_no_op));
if (do_profiling)
(void) list_prepend(casestmt, instruction(Op_exec_count));
-
- $1->target_stmt = casestmt->nexti;
-
- /* recycle $3 as Op_case_list */
- $3->opcode = Op_case_list;
- $3->case_val = $1; /* Op_K_case */
- $3->case_stmt = casestmt; /* Op_list */
- $$ = $3;
+ $1->case_exp = $2;
+ $1->case_stmt = casestmt;
+ bcfree($3);
+ $$ = $1;
}
| LEX_DEFAULT colon opt_nls statements
{
INSTRUCTION *casestmt = $4;
-
if ($4 == NULL)
casestmt = list_create(instruction(Op_no_op));
if (do_profiling)
(void) list_prepend(casestmt, instruction(Op_exec_count));
-
- $1->target_stmt = casestmt->nexti;
- $2->opcode = Op_case_list;
- $2->case_val = $1; /* Op_K_default */
- $2->case_stmt = casestmt; /* Op_list */
- $$ = $2;
+ bcfree($2);
+ $1->case_stmt = casestmt;
+ $$ = $1;
}
;
case_value
: YNUMBER
- {
- $1->opcode = Op_K_case;
- $$ = $1;
- }
+ { $$ = $1; }
| '-' YNUMBER %prec UNARY
{
$2->memory->numbr = -(force_number($2->memory));
bcfree($1);
- $2->opcode = Op_K_case;
$$ = $2;
}
| '+' YNUMBER %prec UNARY
{
bcfree($1);
- $2->opcode = Op_K_case;
$$ = $2;
}
| YSTRING
- {
- $1->opcode = Op_K_case;
- $$ = $1;
- }
+ { $$ = $1; }
| regexp
{
- $1->opcode = Op_K_case;
+ $1->opcode = Op_push_re;
$$ = $1;
}
;
@@ -1846,14 +1840,14 @@ static const struct token tokentab[] = {
{"dcngettext", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2)|A(3)|A(4)|A(5), do_dcngettext},
{"default", Op_K_default, LEX_DEFAULT, GAWKX, 0},
{"delete", Op_K_delete, LEX_DELETE, NOT_OLD, 0},
-{"do", Op_symbol, LEX_DO, NOT_OLD|BREAK|CONTINUE, 0},
+{"do", Op_K_do, LEX_DO, NOT_OLD|BREAK|CONTINUE, 0},
{"else", Op_K_else, LEX_ELSE, 0, 0},
{"eval", Op_symbol, LEX_EVAL, 0, 0},
{"exit", Op_K_exit, LEX_EXIT, 0, 0},
{"exp", Op_builtin, LEX_BUILTIN, A(1), do_exp},
{"extension", Op_builtin, LEX_BUILTIN, GAWKX|A(2), do_ext},
{"fflush", Op_builtin, LEX_BUILTIN, RESX|A(0)|A(1), do_fflush},
-{"for", Op_symbol, LEX_FOR, BREAK|CONTINUE, 0},
+{"for", Op_K_for, LEX_FOR, BREAK|CONTINUE, 0},
{"func", Op_func, LEX_FUNCTION, NOT_POSIX|NOT_OLD, 0},
{"function",Op_func, LEX_FUNCTION, NOT_OLD, 0},
{"gensub", Op_builtin, LEX_BUILTIN, GAWKX|A(3)|A(4), do_gensub},
@@ -1891,12 +1885,12 @@ static const struct token tokentab[] = {
{"strtonum", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_strtonum},
{"sub", Op_builtin, LEX_BUILTIN, NOT_OLD|A(2)|A(3), do_sub},
{"substr", Op_builtin, LEX_BUILTIN, A(2)|A(3), do_substr},
-{"switch", Op_symbol, LEX_SWITCH, GAWKX|BREAK, 0},
+{"switch", Op_K_switch, LEX_SWITCH, GAWKX|BREAK, 0},
{"system", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_system},
{"systime", Op_builtin, LEX_BUILTIN, GAWKX|A(0), do_systime},
{"tolower", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_tolower},
{"toupper", Op_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_toupper},
-{"while", Op_symbol, LEX_WHILE, BREAK|CONTINUE, 0},
+{"while", Op_K_while, LEX_WHILE, BREAK|CONTINUE, 0},
{"xor", Op_builtin, LEX_BUILTIN, GAWKX|A(2), do_xor},
};
@@ -3431,12 +3425,15 @@ retry:
yylval = bcalloc(tokentab[mid].value, 3, sourceline);
break;
+ case LEX_FOR:
case LEX_WHILE:
case LEX_DO:
- case LEX_FOR:
case LEX_SWITCH:
- yylval = bcalloc(tokentab[mid].value,
- !!do_profiling + 1, sourceline);
+ if (! do_profiling)
+ return lasttok = class;
+ /* fall through */
+ case LEX_CASE:
+ yylval = bcalloc(tokentab[mid].value, 2, sourceline);
break;
default:
@@ -4503,13 +4500,6 @@ mk_rexp(INSTRUCTION *list)
/* isnoeffect --- when used as a statement, has no side effects */
-/*
- * To be completely general, we should recursively walk the parse
- * tree, to make sure that all the subexpressions also have no effect.
- * Instead, we just weaken the actual warning that's printed, up above
- * in the grammar.
- */
-
static int
isnoeffect(OPCODE type)
{
@@ -4840,23 +4830,26 @@ mk_condition(INSTRUCTION *cond, INSTRUCTION *ifp, INSTRUCTION *true_branch,
INSTRUCTION *ip;
- /* FIXME else { } -- add elsep */
-
if (false_branch == NULL) {
- if (elsep != NULL) /* else { } */
- false_branch = list_append(list_create(elsep), instruction(Op_no_op));
- else
- false_branch = list_create(instruction(Op_no_op));
+ false_branch = list_create(instruction(Op_no_op));
+ if (elsep != NULL) { /* else { } */
+ if (do_profiling)
+ (void) list_prepend(false_branch, elsep);
+ else
+ bcfree(elsep);
+ }
} else {
/* assert(elsep != NULL); */
/* avoid a series of no_op's: if .. else if .. else if .. */
if (false_branch->lasti->opcode != Op_no_op)
(void) list_append(false_branch, instruction(Op_no_op));
- (void) list_prepend(false_branch, elsep);
- false_branch->nexti->branch_end = false_branch->lasti;
- if (do_profiling)
+ if (do_profiling) {
+ (void) list_prepend(false_branch, elsep);
+ false_branch->nexti->branch_end = false_branch->lasti;
(void) list_prepend(false_branch, instruction(Op_exec_count));
+ } else
+ bcfree(elsep);
}
(void) list_prepend(false_branch, instruction(Op_jmp));
@@ -4866,12 +4859,13 @@ mk_condition(INSTRUCTION *cond, INSTRUCTION *ifp, INSTRUCTION *true_branch,
ip = list_append(cond, instruction(Op_jmp_false));
ip->lasti->target_jmp = false_branch->nexti->nexti;
- (void) list_prepend(ip, ifp);
if (do_profiling) {
+ (void) list_prepend(ip, ifp);
(void) list_append(ip, instruction(Op_exec_count));
ip->nexti->branch_if = ip->lasti;
ip->nexti->branch_else = false_branch->nexti;
- }
+ } else
+ bcfree(ifp);
if (true_branch != NULL)
list_merge(ip, true_branch);
@@ -5055,7 +5049,7 @@ optimize_assignment(INSTRUCTION *exp)
* 1) Array element assignment array[subs] = x:
* Replaces Op_push_array + Op_subscript_lhs + Op_assign + Op_pop
* with single instruction Op_store_sub.
- * Limitation (FIXME): 1 dimension and sub is simple var/value.
+ * Limitation: 1 dimension and sub is simple var/value.
*
* 2) Simple variable assignment var = x:
* Replaces Op_push_lhs + Op_assign + Op_pop with Op_store_var.
@@ -5100,7 +5094,7 @@ optimize_assignment(INSTRUCTION *exp)
/* avoid stuff like x = x (x = y) or x = x gsub(/./, "b", x);
* check for l-value reference to this variable in the r.h.s.
- * Also avoid function calls in general, to guard against
+ * Also, avoid function calls in general to guard against
* global variable assignment.
*/
@@ -5191,7 +5185,7 @@ optimize_assignment(INSTRUCTION *exp)
/* mk_getline --- make instructions for getline */
static INSTRUCTION *
-mk_getline(INSTRUCTION *op, INSTRUCTION *var, INSTRUCTION *redir, OPCODE redirtype)
+mk_getline(INSTRUCTION *op, INSTRUCTION *var, INSTRUCTION *redir, int redirtype)
{
INSTRUCTION *ip;
INSTRUCTION *tp;
@@ -5254,73 +5248,72 @@ mk_for_loop(INSTRUCTION *forp, INSTRUCTION *init, INSTRUCTION *cond,
INSTRUCTION *incr, INSTRUCTION *body)
{
/*
- * [ Op_push_loop | z| y] <-- continue | break
* ------------------------
* init (may be NULL)
* ------------------------
* x:
* cond (Op_no_op if NULL)
* ------------------------
- * [ Op_jmp_false y ]
+ * [ Op_jmp_false tb ]
* ------------------------
* body (may be NULL)
* ------------------------
- * z:
- * incr (may be NULL)
- * [ Op_jmp x ]
+ * tc:
+ * incr (may be NULL)
+ * [ Op_jmp x ]
* ------------------------
- * y:[ Op_pop_loop ]
+ * tb:[ Op_no_op ]
*/
- INSTRUCTION *ip;
- INSTRUCTION *cp;
+ INSTRUCTION *ip, *tbreak, *tcont;
INSTRUCTION *jmp;
INSTRUCTION *pp_cond;
INSTRUCTION *ret;
- cp = instruction(Op_pop_loop);
-
- forp->opcode = Op_push_loop;
- forp->target_break = cp;
- ip = list_create(forp);
-
- if (init != NULL)
- (void) list_merge(ip, init);
+ tbreak = instruction(Op_no_op);
if (cond != NULL) {
add_lint(cond, LINT_assign_in_cond);
pp_cond = cond->nexti;
- (void) list_merge(ip, cond);
+ ip = cond;
(void) list_append(ip, instruction(Op_jmp_false));
- ip->lasti->target_jmp = cp;
+ ip->lasti->target_jmp = tbreak;
} else {
pp_cond = instruction(Op_no_op);
- (void) list_append(ip, pp_cond);
+ ip = list_create(pp_cond);
}
+ if (init != NULL)
+ ip = list_merge(init, ip);
+
if (do_profiling) {
(void) list_append(ip, instruction(Op_exec_count));
- (forp + 1)->opcode = Op_K_for;
(forp + 1)->forloop_cond = pp_cond;
(forp + 1)->forloop_body = ip->lasti;
}
if (body != NULL)
(void) list_merge(ip, body);
-
- if (incr != NULL) {
- forp->target_continue = incr->nexti;
- (void) list_merge(ip, incr);
- }
+
jmp = instruction(Op_jmp);
jmp->target_jmp = pp_cond;
if (incr == NULL)
- forp->target_continue = jmp;
- (void) list_append(ip, jmp);
+ tcont = jmp;
+ else {
+ tcont = incr->nexti;
+ (void) list_merge(ip, incr);
+ }
- ret = list_append(ip, cp);
+ (void) list_append(ip, jmp);
+ ret = list_append(ip, tbreak);
+ fix_break_continue(ret, tbreak, tcont);
- fix_break_continue(forp, cp, TRUE);
+ if (do_profiling) {
+ forp->target_break = tbreak;
+ forp->target_continue = tcont;
+ ret = list_prepend(ret, forp);
+ } /* else
+ forp is NULL */
return ret;
}
@@ -5446,20 +5439,16 @@ count_expressions(INSTRUCTION **list, int isarg)
return count;
}
-/* fix_break_continue --- fix up break & continue nodes in loop bodies */
+/* fix_break_continue --- fix up break & continue codes in loop bodies */
static void
-fix_break_continue(INSTRUCTION *start, INSTRUCTION *end, int check_continue)
+fix_break_continue(INSTRUCTION *list, INSTRUCTION *b_target, INSTRUCTION *c_target)
{
- INSTRUCTION *ip, *b_target, *c_target;
-
- assert(start->opcode == Op_push_loop);
- assert(end->opcode == Op_pop_loop);
+ INSTRUCTION *ip;
- b_target = start->target_break;
- c_target = start->target_continue;
+ list->lasti->nexti = NULL; /* just to make sure */
- for (ip = start; ip != end; ip = ip->nexti) {
+ for (ip = list->nexti; ip != NULL; ip = ip->nexti) {
switch (ip->opcode) {
case Op_K_break:
if (ip->target_jmp == NULL)
@@ -5467,7 +5456,7 @@ fix_break_continue(INSTRUCTION *start, INSTRUCTION *end, int check_continue)
break;
case Op_K_continue:
- if (check_continue && ip->target_jmp == NULL)
+ if (ip->target_jmp == NULL)
ip->target_jmp = c_target;
break;
@@ -5524,7 +5513,6 @@ release_symbols(NODE *symlist, int keep_globals)
* and free all associated memory.
*/
-
void
destroy_symbol(char *name)
{
@@ -5687,22 +5675,6 @@ free_bc_internal(INSTRUCTION *cp)
)
efree(cp->func_name);
break;
- case Op_K_switch:
- for (curr = cp->case_val; curr != NULL; curr = curr->nexti) {
- if (curr->opcode == Op_K_case &&
- curr->memory->type != Node_val
- ) {
- m = curr->memory;
- if (m->re_text != NULL)
- unref(m->re_text);
- if (m->re_reg != NULL)
- refree(m->re_reg);
- if (m->re_exp != NULL)
- unref(m->re_exp);
- freenode(m);
- }
- }
- break;
case Op_push_re:
case Op_match_rec:
case Op_match:
diff --git a/debug.c b/debug.c
index 854278c5..c54af488 100644
--- a/debug.c
+++ b/debug.c
@@ -292,7 +292,7 @@ static INSTRUCTION *mk_breakpoint(char *src, int srcline);
static int execute_commands(struct commands_item *commands);
static void delete_commands_item(struct commands_item *c);
static NODE *execute_code(volatile INSTRUCTION *code);
-static int pre_execute_code(INSTRUCTION **pi, int inloop);
+static int pre_execute_code(INSTRUCTION **pi);
static int parse_condition(int type, int num, char *expr);
static BREAKPOINT *add_breakpoint(INSTRUCTION *, INSTRUCTION *, char *, int);
static BREAKPOINT *set_breakpoint_next(INSTRUCTION *rp, INSTRUCTION *ip);
@@ -3502,18 +3502,12 @@ no_output:
/* post_execute --- post_hook in the interpreter */
void
-post_execute(INSTRUCTION *pc, int inloop)
+post_execute(INSTRUCTION *pc)
{
if (! in_main_context())
return;
switch (pc->opcode) {
- case Op_K_break:
- case Op_K_continue:
- if (inloop)
- break;
- /* else
- fall through */
case Op_K_next:
case Op_K_nextfile:
case Op_K_exit:
@@ -3564,13 +3558,13 @@ post_execute(INSTRUCTION *pc, int inloop)
*/
int
-pre_execute(INSTRUCTION **pi, int inloop)
+pre_execute(INSTRUCTION **pi)
{
static int cant_stop = FALSE;
NODE *m;
if (! in_main_context())
- return pre_execute_code(pi, inloop);
+ return pre_execute_code(pi);
cur_pc = *pi;
stop.break_point = 0;
@@ -3610,7 +3604,6 @@ pre_execute(INSTRUCTION **pi, int inloop)
cant_stop = TRUE;
break;
- case Op_pop_loop: /* need to unset cant_stop for Op_arrayfor_incr */
case Op_var_assign:
cant_stop = FALSE;
return TRUE; /* may stop at next instruction */
@@ -3810,14 +3803,6 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump)
pc->func_name, (pc + 1)->expr_count);
break;
- case Op_push_loop:
- if (pc->target_continue != NULL)
- print_func(fp, "[target_continue = %p] [target_break = %p]\n",
- pc->target_continue, pc->target_break);
- else
- print_func(fp, "[target_break = %p]\n", pc->target_break);
- break;
-
case Op_K_nextfile:
case Op_newfile:
print_func(fp, "[target_jmp = %p] [target_endfile = %p]\n",
@@ -3837,6 +3822,11 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump)
print_func(fp, "[target_jmp = %p]\n", pc->target_jmp);
break;
+ case Op_K_case:
+ print_func(fp, "[target_jmp = %p] [match_exp = %s]\n",
+ pc->target_jmp, (pc + 1)->match_exp ? "TRUE" : "FALSE");
+ break;
+
case Op_arrayfor_incr:
print_func(fp, "[array_var = %s] [target_jmp = %p]\n",
pc->array_var->type == Node_param_list ?
@@ -3884,6 +3874,7 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump)
case Op_in_array:
print_func(fp, "[expr_count = %ld]\n", pc->expr_count);
break;
+
case Op_concat:
/* NB: concat_flag CSVAR only used in grammar, don't display it */
print_func(fp, "[expr_count = %ld] [concat_flag = %s]\n",
@@ -3912,24 +3903,6 @@ print_instruction(INSTRUCTION *pc, Func_print print_func, FILE *fp, int in_dump)
print_func(fp, "[exec_count = %ld]\n", pc->exec_count);
break;
- case Op_K_switch:
- {
- INSTRUCTION *curr;
- print_func(fp, "[case_val = %p ] [switch_dflt = %p]\n",
- pc->case_val, pc->switch_dflt);
-
- for (curr = pc->case_val; curr != NULL; curr = curr->nexti) {
- print_func(fp, "[%6d:%p] %-20.20s: ",
- curr->source_line, curr, opcode2str(curr->opcode));
- if (curr->opcode == Op_K_case) {
- print_func(fp, "case: ");
- print_memory(curr->memory, fparms, print_func, fp);
- }
- print_func(fp, " [target_stmt = %p]\n", curr->target_stmt);
- }
- }
- break;
-
case Op_store_var:
case Op_push_lhs:
print_memory(pc->memory, fparms, print_func, fp);
@@ -5344,17 +5317,11 @@ remove_params(NODE *func)
/* pre_execute_code --- pre_hook for execute_code, called by pre_execute */
static int
-pre_execute_code(INSTRUCTION **pi, int inloop)
+pre_execute_code(INSTRUCTION **pi)
{
INSTRUCTION *ei = *pi;
switch (ei->opcode) {
- case Op_K_break:
- case Op_K_continue:
- if (inloop)
- break;
- /* else
- fall through */
case Op_K_exit:
case Op_K_next:
case Op_K_nextfile:
diff --git a/doc/gawk.info b/doc/gawk.info
index 9f62906d..07b24920 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -330,6 +330,7 @@ texts being (a) (see below), and with the Back-Cover Texts being (b)
* I/O Functions:: Functions for files and shell commands.
* Time Functions:: Functions for dealing with timestamps.
* Bitwise Functions:: Functions for bitwise operations.
+* Type Functions:: Functions for type information.
* I18N Functions:: Functions for string translation.
* User-defined:: Describes User-defined functions in detail.
* Definition Syntax:: How to write definitions and what they
@@ -9370,6 +9371,11 @@ with a pound sign (`#').
`PROCINFO["uid"]'
The value of the `getuid()' system call.
+ `PROCINFO["sorted_in"]'
+ If this element exists in `PROCINFO', _no matter what its
+ value_, then `gawk' will cause `for(i in arr) ...' loops to
+ traverse the array indices in sorted order.
+
`PROCINFO["strftime"]'
The default time format string for `strftime()'. Assigning a
new value to this element changes the default. *Note Time
@@ -10412,6 +10418,7 @@ for your convenience.
* I/O Functions:: Functions for files and shell commands.
* Time Functions:: Functions for dealing with timestamps.
* Bitwise Functions:: Functions for bitwise operations.
+* Type Functions:: Functions for type information.
* I18N Functions:: Functions for string translation.

@@ -11699,7 +11706,7 @@ Internationalization::.
does not appear in the returned string or appears literally.

-File: gawk.info, Node: Bitwise Functions, Next: I18N Functions, Prev: Time Functions, Up: Built-in
+File: gawk.info, Node: Bitwise Functions, Next: Type Functions, Prev: Time Functions, Up: Built-in
9.1.6 Bit-Manipulation Functions
--------------------------------
@@ -11829,9 +11836,22 @@ Nondecimal-numbers::), and then demonstrates the results of the
have the left side fill with 1's. Caveat emptor.

-File: gawk.info, Node: I18N Functions, Prev: Bitwise Functions, Up: Built-in
+File: gawk.info, Node: Type Functions, Next: I18N Functions, Prev: Bitwise Functions, Up: Built-in
+
+9.1.7 Getting Type Information
+------------------------------
+
+`gawk' provides a single function that lets you distinguish an array
+from a scalar variable. This is necessary for writing code that
+traverses every element of a multidimensional array.
+
+`isarray(X)'
+ Return a true value if X is an array. Otherwise return false.
+
+
+File: gawk.info, Node: I18N Functions, Prev: Type Functions, Up: Built-in
-9.1.7 String-Translation Functions
+9.1.8 String-Translation Functions
----------------------------------
`gawk' provides facilities for internationalizing `awk' programs.
@@ -24375,7 +24395,7 @@ Index
(line 67)
* advanced features, data files as single record: Records. (line 175)
* advanced features, fixed-width data: Constant Size. (line 9)
-* advanced features, FNR/NR variables: Auto-set. (line 200)
+* advanced features, FNR/NR variables: Auto-set. (line 205)
* advanced features, gawk: Advanced Features. (line 6)
* advanced features, gawk, network programming: TCP/IP Networking.
(line 6)
@@ -24869,7 +24889,7 @@ Index
(line 47)
* dark corner, FILENAME variable <1>: Auto-set. (line 92)
* dark corner, FILENAME variable: Getline Notes. (line 19)
-* dark corner, FNR/NR variables: Auto-set. (line 200)
+* dark corner, FNR/NR variables: Auto-set. (line 205)
* dark corner, format-control characters: Control Letters. (line 18)
* dark corner, FS as null string: Single Character Fields.
(line 20)
@@ -25068,7 +25088,7 @@ Index
* differences in awk and gawk, regular expressions: Case-sensitivity.
(line 26)
* differences in awk and gawk, RS/RT variables: Records. (line 167)
-* differences in awk and gawk, RT variable: Auto-set. (line 189)
+* differences in awk and gawk, RT variable: Auto-set. (line 194)
* differences in awk and gawk, single-character fields: Single Character Fields.
(line 6)
* differences in awk and gawk, split() function: String Functions.
@@ -25349,7 +25369,7 @@ Index
* floating-point, numbers, AWKNUM internal type: Internals. (line 19)
* FNR variable <1>: Auto-set. (line 102)
* FNR variable: Records. (line 6)
-* FNR variable, changing: Auto-set. (line 200)
+* FNR variable, changing: Auto-set. (line 205)
* for statement: For Statement. (line 6)
* for statement, in arrays: Scanning an Array. (line 20)
* force_number() internal function: Internals. (line 27)
@@ -25523,7 +25543,7 @@ Index
* gawk, regular expressions, operators: GNU Regexp Operators.
(line 6)
* gawk, regular expressions, precedence: Regexp Operators. (line 156)
-* gawk, RT variable in <1>: Auto-set. (line 189)
+* gawk, RT variable in <1>: Auto-set. (line 194)
* gawk, RT variable in <2>: Getline/Variable/File.
(line 10)
* gawk, RT variable in <3>: Multiple Line. (line 129)
@@ -25756,6 +25776,7 @@ Index
* inventory-shipped file: Sample Data Files. (line 32)
* IOBUF internal structure: Internals. (line 161)
* iop_alloc() internal function: Internals. (line 161)
+* isarray() function (gawk): Type Functions. (line 10)
* ISO: Glossary. (line 367)
* ISO 8859-1: Glossary. (line 137)
* ISO Latin-1: Glossary. (line 137)
@@ -25969,7 +25990,7 @@ Index
* not Boolean-logic operator: Boolean Ops. (line 6)
* NR variable <1>: Auto-set. (line 118)
* NR variable: Records. (line 6)
-* NR variable, changing: Auto-set. (line 200)
+* NR variable, changing: Auto-set. (line 205)
* null strings <1>: Basic Data Typing. (line 50)
* null strings <2>: Truth Values. (line 6)
* null strings <3>: Regexp Field Splitting.
@@ -26401,7 +26422,7 @@ Index
* right angle bracket (>), >> operator (I/O): Redirection. (line 50)
* right shift, bitwise: Bitwise Functions. (line 32)
* Ritchie, Dennis: Basic Data Typing. (line 74)
-* RLENGTH variable: Auto-set. (line 176)
+* RLENGTH variable: Auto-set. (line 181)
* RLENGTH variable, match() function and: String Functions. (line 194)
* Robbins, Arnold <1>: Future Extensions. (line 6)
* Robbins, Arnold <2>: Bugs. (line 32)
@@ -26426,9 +26447,9 @@ Index
* RS variable: Records. (line 20)
* RS variable, multiline records and: Multiple Line. (line 17)
* rshift() function (gawk): Bitwise Functions. (line 51)
-* RSTART variable: Auto-set. (line 182)
+* RSTART variable: Auto-set. (line 187)
* RSTART variable, match() function and: String Functions. (line 194)
-* RT variable <1>: Auto-set. (line 189)
+* RT variable <1>: Auto-set. (line 194)
* RT variable <2>: Getline/Variable/File.
(line 10)
* RT variable <3>: Multiple Line. (line 129)
@@ -26872,406 +26893,407 @@ Index

Tag Table:
Node: Top1340
-Node: Foreword30033
-Node: Preface34361
-Ref: Preface-Footnote-137313
-Ref: Preface-Footnote-237419
-Node: History37651
-Node: Names39885
-Ref: Names-Footnote-141362
-Node: This Manual41434
-Ref: This Manual-Footnote-146332
-Node: Conventions46432
-Node: Manual History48548
-Ref: Manual History-Footnote-151726
-Ref: Manual History-Footnote-251767
-Node: How To Contribute51841
-Node: Acknowledgments52985
-Node: Getting Started57233
-Node: Running gawk59612
-Node: One-shot60798
-Node: Read Terminal62023
-Ref: Read Terminal-Footnote-163673
-Ref: Read Terminal-Footnote-263947
-Node: Long64118
-Node: Executable Scripts65494
-Ref: Executable Scripts-Footnote-167355
-Ref: Executable Scripts-Footnote-267457
-Node: Comments67908
-Node: Quoting70375
-Node: DOS Quoting74992
-Node: Sample Data Files75667
-Node: Very Simple78699
-Node: Two Rules83296
-Node: More Complex85443
-Ref: More Complex-Footnote-188373
-Node: Statements/Lines88453
-Ref: Statements/Lines-Footnote-192915
-Node: Other Features93180
-Node: When94049
-Node: Invoking Gawk96192
-Node: Command Line97577
-Node: Options98360
-Ref: Options-Footnote-1111414
-Node: Other Arguments111439
-Node: Naming Standard Input114102
-Node: Environment Variables115066
-Node: AWKPATH Variable115510
-Ref: AWKPATH Variable-Footnote-1118247
-Node: Other Environment Variables118507
-Node: Exit Status120855
-Node: Include Files121530
-Node: Obsolete124921
-Node: Undocumented125607
-Node: Regexp125848
-Node: Regexp Usage127300
-Node: Escape Sequences129326
-Node: Regexp Operators135069
-Ref: Regexp Operators-Footnote-1142241
-Ref: Regexp Operators-Footnote-2142388
-Node: Character Lists142486
-Ref: table-char-classes144261
-Node: GNU Regexp Operators146901
-Node: Case-sensitivity150620
-Ref: Case-sensitivity-Footnote-1153575
-Ref: Case-sensitivity-Footnote-2153810
-Node: Leftmost Longest153918
-Node: Computed Regexps155119
-Node: Locales158536
-Node: Reading Files162078
-Node: Records164019
-Ref: Records-Footnote-1172698
-Node: Fields172735
-Ref: Fields-Footnote-1175767
-Node: Nonconstant Fields175853
-Node: Changing Fields178055
-Node: Field Separators183345
-Node: Default Field Splitting185974
-Node: Regexp Field Splitting187091
-Node: Single Character Fields190449
-Node: Command Line Field Separator191508
-Node: Field Splitting Summary194947
-Ref: Field Splitting Summary-Footnote-1198133
-Node: Constant Size198234
-Node: Splitting By Content202796
-Ref: Splitting By Content-Footnote-1206522
-Node: Multiple Line206562
-Ref: Multiple Line-Footnote-1212409
-Node: Getline212588
-Node: Plain Getline214816
-Node: Getline/Variable216905
-Node: Getline/File218046
-Node: Getline/Variable/File219368
-Ref: Getline/Variable/File-Footnote-1220967
-Node: Getline/Pipe221054
-Node: Getline/Variable/Pipe223602
-Node: Getline/Coprocess224709
-Node: Getline/Variable/Coprocess225952
-Node: Getline Notes226666
-Node: Getline Summary228608
-Ref: table-getline-variants228892
-Node: Command line directories229797
-Node: Printing230422
-Node: Print232053
-Node: Print Examples233390
-Node: Output Separators236174
-Node: OFMT237933
-Node: Printf239291
-Node: Basic Printf240197
-Node: Control Letters241734
-Node: Format Modifiers245546
-Node: Printf Examples251557
-Node: Redirection254272
-Node: Special Files261250
-Node: Special FD261783
-Ref: Special FD-Footnote-1265394
-Node: Special Network265468
-Node: Special Caveats266323
-Node: Close Files And Pipes267117
-Ref: Close Files And Pipes-Footnote-1274061
-Ref: Close Files And Pipes-Footnote-2274209
-Node: Expressions274359
-Node: Values275428
-Node: Constants276104
-Node: Scalar Constants276784
-Ref: Scalar Constants-Footnote-1277643
-Node: Nondecimal-numbers277825
-Node: Regexp Constants280884
-Node: Using Constant Regexps281359
-Node: Variables284364
-Node: Using Variables285019
-Node: Assignment Options286746
-Node: Conversion288627
-Ref: table-locale-affects294001
-Ref: Conversion-Footnote-1294625
-Node: All Operators294734
-Node: Arithmetic Ops295364
-Node: Concatenation297870
-Ref: Concatenation-Footnote-1300663
-Node: Assignment Ops300782
-Ref: table-assign-ops305770
-Node: Increment Ops307178
-Node: Truth Values and Conditions310656
-Node: Truth Values311739
-Node: Typing and Comparison312787
-Node: Variable Typing313576
-Ref: Variable Typing-Footnote-1317473
-Node: Comparison Operators317595
-Ref: table-relational-ops318005
-Node: POSIX String Comparison321554
-Ref: POSIX String Comparison-Footnote-1322511
-Node: Boolean Ops322649
-Ref: Boolean Ops-Footnote-1326727
-Node: Conditional Exp326818
-Node: Function Calls328550
-Node: Precedence332140
-Node: Patterns and Actions335793
-Node: Pattern Overview336847
-Node: Regexp Patterns338513
-Node: Expression Patterns339056
-Node: Ranges342630
-Node: BEGIN/END345596
-Node: Using BEGIN/END346346
-Ref: Using BEGIN/END-Footnote-1349077
-Node: I/O And BEGIN/END349191
-Node: Empty351460
-Node: BEGINFILE/ENDFILE351794
-Node: Using Shell Variables354619
-Node: Action Overview356898
-Node: Statements359255
-Node: If Statement361114
-Node: While Statement362613
-Node: Do Statement364657
-Node: For Statement365813
-Node: Switch Statement368965
-Node: Break Statement371062
-Node: Continue Statement373038
-Node: Next Statement374739
-Node: Nextfile Statement377121
-Node: Exit Statement379646
-Node: Built-in Variables381977
-Node: User-modified383072
-Ref: User-modified-Footnote-1391073
-Node: Auto-set391135
-Ref: Auto-set-Footnote-1400118
-Node: ARGC and ARGV400323
-Node: Arrays404082
-Node: Array Basics405653
-Node: Array Intro406364
-Node: Reference to Elements410682
-Node: Assigning Elements412952
-Node: Array Example413443
-Node: Scanning an Array415175
-Node: Delete417452
-Ref: Delete-Footnote-1419883
-Node: Numeric Array Subscripts419940
-Node: Uninitialized Subscripts422123
-Node: Multi-dimensional423751
-Node: Multi-scanning426842
-Node: Array Sorting428426
-Ref: Array Sorting-Footnote-1431624
-Node: Arrays of Arrays431818
-Node: Functions435980
-Node: Built-in436802
-Node: Calling Built-in437816
-Node: Numeric Functions439792
-Ref: Numeric Functions-Footnote-1443549
-Ref: Numeric Functions-Footnote-2443885
-Ref: Numeric Functions-Footnote-3443933
-Node: String Functions444202
-Ref: String Functions-Footnote-1466008
-Ref: String Functions-Footnote-2466137
-Ref: String Functions-Footnote-3466385
-Node: Gory Details466472
-Ref: table-sub-escapes468129
-Ref: table-posix-sub469443
-Ref: table-gensub-escapes470343
-Node: I/O Functions471514
-Ref: I/O Functions-Footnote-1478209
-Node: Time Functions478356
-Ref: Time Functions-Footnote-1489223
-Ref: Time Functions-Footnote-2489291
-Ref: Time Functions-Footnote-3489449
-Ref: Time Functions-Footnote-4489560
-Ref: Time Functions-Footnote-5489672
-Ref: Time Functions-Footnote-6489899
-Node: Bitwise Functions490165
-Ref: table-bitwise-ops490723
-Ref: Bitwise Functions-Footnote-1494883
-Node: I18N Functions495067
-Node: User-defined496697
-Node: Definition Syntax497501
-Ref: Definition Syntax-Footnote-1502138
-Node: Function Example502207
-Node: Function Caveats504801
-Node: Calling A Function505222
-Node: Variable Scope506337
-Node: Pass By Value/Reference508265
-Node: Return Statement511705
-Node: Dynamic Typing514647
-Node: Indirect Calls515384
-Node: Internationalization525069
-Node: I18N and L10N526497
-Node: Explaining gettext527183
-Ref: Explaining gettext-Footnote-1532245
-Ref: Explaining gettext-Footnote-2532428
-Node: Programmer i18n532593
-Node: Translator i18n536884
-Node: String Extraction537677
-Ref: String Extraction-Footnote-1538638
-Node: Printf Ordering538724
-Ref: Printf Ordering-Footnote-1541508
-Node: I18N Portability541572
-Ref: I18N Portability-Footnote-1544021
-Node: I18N Example544084
-Ref: I18N Example-Footnote-1546719
-Node: Gawk I18N546791
-Node: Advanced Features547408
-Node: Nondecimal Data548727
-Node: Two-way I/O550308
-Ref: Two-way I/O-Footnote-1555722
-Node: TCP/IP Networking555799
-Node: Profiling558642
-Node: Library Functions566042
-Ref: Library Functions-Footnote-1569012
-Node: Library Names569183
-Ref: Library Names-Footnote-1572654
-Ref: Library Names-Footnote-2572874
-Node: General Functions572960
-Node: Nextfile Function574023
-Node: Strtonum Function578404
-Node: Assert Function581355
-Node: Round Function584681
-Node: Cliff Random Function586222
-Node: Ordinal Functions587238
-Ref: Ordinal Functions-Footnote-1590308
-Ref: Ordinal Functions-Footnote-2590560
-Node: Join Function590776
-Ref: Join Function-Footnote-1592547
-Node: Gettimeofday Function592747
-Node: Data File Management596462
-Node: Filetrans Function597094
-Node: Rewind Function601331
-Node: File Checking602784
-Node: Empty Files603878
-Node: Ignoring Assigns606108
-Node: Getopt Function607661
-Ref: Getopt Function-Footnote-1618986
-Node: Passwd Functions619189
-Ref: Passwd Functions-Footnote-1628177
-Node: Group Functions628265
-Node: Sample Programs636345
-Node: Running Examples637010
-Node: Clones637738
-Node: Cut Program638861
-Node: Egrep Program648702
-Ref: Egrep Program-Footnote-1656473
-Node: Id Program656583
-Node: Split Program660199
-Ref: Split Program-Footnote-1663718
-Node: Tee Program663846
-Node: Uniq Program666649
-Node: Wc Program674072
-Ref: Wc Program-Footnote-1678336
-Node: Miscellaneous Programs678536
-Node: Dupword Program679656
-Node: Alarm Program681687
-Node: Translate Program686409
-Ref: Translate Program-Footnote-1690788
-Ref: Translate Program-Footnote-2691016
-Node: Labels Program691150
-Ref: Labels Program-Footnote-1694521
-Node: Word Sorting694605
-Node: History Sorting698950
-Node: Extract Program700788
-Ref: Extract Program-Footnote-1708269
-Node: Simple Sed708397
-Node: Igawk Program711459
-Ref: Igawk Program-Footnote-1726493
-Ref: Igawk Program-Footnote-2726694
-Node: Signature Program726832
-Node: Debugger727912
-Node: Debugging728823
-Node: Debugging Concepts729137
-Node: Debugging Terms730993
-Node: Awk Debugging733538
-Node: Sample dgawk session734430
-Node: dgawk invocation734922
-Node: Finding The Bug736104
-Node: List of Debugger Commands742588
-Node: Breakpoint Control743899
-Node: Dgawk Execution Control747375
-Node: Viewing And Changing Data750726
-Node: Dgawk Stack754035
-Node: Dgawk Info755495
-Node: Miscellaneous Dgawk Commands759443
-Node: Readline Support764871
-Node: Dgawk Limitations765698
-Node: Language History767837
-Node: V7/SVR3.1769269
-Node: SVR4771564
-Node: POSIX773006
-Node: BTL774004
-Node: POSIX/GNU774738
-Node: Common Extensions779924
-Node: Contributors781057
-Node: Installation785092
-Node: Gawk Distribution785986
-Node: Getting786470
-Node: Extracting787296
-Node: Distribution contents788974
-Node: Unix Installation793992
-Node: Quick Installation794609
-Node: Additional Configuration Options796571
-Node: Configuration Philosophy798048
-Node: Non-Unix Installation800390
-Node: PC Installation800848
-Node: PC Binary Installation802147
-Node: PC Compiling803995
-Node: PC Testing807141
-Node: PC Using808317
-Node: Cygwin812502
-Node: MSYS813499
-Node: VMS Installation814013
-Node: VMS Compilation814617
-Node: VMS Installation Details816194
-Node: VMS Running817824
-Node: VMS POSIX819421
-Node: VMS Old Gawk820719
-Node: Bugs821191
-Node: Other Versions825056
-Node: Notes830335
-Node: Compatibility Mode831027
-Node: Additions831810
-Node: Accessing The Source832622
-Node: Adding Code834045
-Node: New Ports839593
-Node: Dynamic Extensions843706
-Node: Internals845082
-Node: Plugin License854198
-Node: Sample Library854832
-Node: Internal File Description855518
-Node: Internal File Ops859225
-Ref: Internal File Ops-Footnote-1863993
-Node: Using Internal File Ops864141
-Node: Future Extensions866518
-Node: Basic Concepts869022
-Node: Basic High Level869779
-Ref: Basic High Level-Footnote-1873814
-Node: Basic Data Typing873999
-Node: Floating Point Issues878524
-Node: String Conversion Precision879607
-Ref: String Conversion Precision-Footnote-1881301
-Node: Unexpected Results881410
-Node: POSIX Floating Point Problems883236
-Ref: POSIX Floating Point Problems-Footnote-1886932
-Node: Glossary886970
-Node: Copying911069
-Node: GNU Free Documentation License948626
-Node: next-edition973770
-Node: unresolved974122
-Node: revision974622
-Node: consistency975045
-Node: Index978544
+Node: Foreword30100
+Node: Preface34428
+Ref: Preface-Footnote-137380
+Ref: Preface-Footnote-237486
+Node: History37718
+Node: Names39952
+Ref: Names-Footnote-141429
+Node: This Manual41501
+Ref: This Manual-Footnote-146399
+Node: Conventions46499
+Node: Manual History48615
+Ref: Manual History-Footnote-151793
+Ref: Manual History-Footnote-251834
+Node: How To Contribute51908
+Node: Acknowledgments53052
+Node: Getting Started57300
+Node: Running gawk59679
+Node: One-shot60865
+Node: Read Terminal62090
+Ref: Read Terminal-Footnote-163740
+Ref: Read Terminal-Footnote-264014
+Node: Long64185
+Node: Executable Scripts65561
+Ref: Executable Scripts-Footnote-167422
+Ref: Executable Scripts-Footnote-267524
+Node: Comments67975
+Node: Quoting70442
+Node: DOS Quoting75059
+Node: Sample Data Files75734
+Node: Very Simple78766
+Node: Two Rules83363
+Node: More Complex85510
+Ref: More Complex-Footnote-188440
+Node: Statements/Lines88520
+Ref: Statements/Lines-Footnote-192982
+Node: Other Features93247
+Node: When94116
+Node: Invoking Gawk96259
+Node: Command Line97644
+Node: Options98427
+Ref: Options-Footnote-1111481
+Node: Other Arguments111506
+Node: Naming Standard Input114169
+Node: Environment Variables115133
+Node: AWKPATH Variable115577
+Ref: AWKPATH Variable-Footnote-1118314
+Node: Other Environment Variables118574
+Node: Exit Status120922
+Node: Include Files121597
+Node: Obsolete124988
+Node: Undocumented125674
+Node: Regexp125915
+Node: Regexp Usage127367
+Node: Escape Sequences129393
+Node: Regexp Operators135136
+Ref: Regexp Operators-Footnote-1142308
+Ref: Regexp Operators-Footnote-2142455
+Node: Character Lists142553
+Ref: table-char-classes144328
+Node: GNU Regexp Operators146968
+Node: Case-sensitivity150687
+Ref: Case-sensitivity-Footnote-1153642
+Ref: Case-sensitivity-Footnote-2153877
+Node: Leftmost Longest153985
+Node: Computed Regexps155186
+Node: Locales158603
+Node: Reading Files162145
+Node: Records164086
+Ref: Records-Footnote-1172765
+Node: Fields172802
+Ref: Fields-Footnote-1175834
+Node: Nonconstant Fields175920
+Node: Changing Fields178122
+Node: Field Separators183412
+Node: Default Field Splitting186041
+Node: Regexp Field Splitting187158
+Node: Single Character Fields190516
+Node: Command Line Field Separator191575
+Node: Field Splitting Summary195014
+Ref: Field Splitting Summary-Footnote-1198200
+Node: Constant Size198301
+Node: Splitting By Content202863
+Ref: Splitting By Content-Footnote-1206589
+Node: Multiple Line206629
+Ref: Multiple Line-Footnote-1212476
+Node: Getline212655
+Node: Plain Getline214883
+Node: Getline/Variable216972
+Node: Getline/File218113
+Node: Getline/Variable/File219435
+Ref: Getline/Variable/File-Footnote-1221034
+Node: Getline/Pipe221121
+Node: Getline/Variable/Pipe223669
+Node: Getline/Coprocess224776
+Node: Getline/Variable/Coprocess226019
+Node: Getline Notes226733
+Node: Getline Summary228675
+Ref: table-getline-variants228959
+Node: Command line directories229864
+Node: Printing230489
+Node: Print232120
+Node: Print Examples233457
+Node: Output Separators236241
+Node: OFMT238000
+Node: Printf239358
+Node: Basic Printf240264
+Node: Control Letters241801
+Node: Format Modifiers245613
+Node: Printf Examples251624
+Node: Redirection254339
+Node: Special Files261317
+Node: Special FD261850
+Ref: Special FD-Footnote-1265461
+Node: Special Network265535
+Node: Special Caveats266390
+Node: Close Files And Pipes267184
+Ref: Close Files And Pipes-Footnote-1274128
+Ref: Close Files And Pipes-Footnote-2274276
+Node: Expressions274426
+Node: Values275495
+Node: Constants276171
+Node: Scalar Constants276851
+Ref: Scalar Constants-Footnote-1277710
+Node: Nondecimal-numbers277892
+Node: Regexp Constants280951
+Node: Using Constant Regexps281426
+Node: Variables284431
+Node: Using Variables285086
+Node: Assignment Options286813
+Node: Conversion288694
+Ref: table-locale-affects294068
+Ref: Conversion-Footnote-1294692
+Node: All Operators294801
+Node: Arithmetic Ops295431
+Node: Concatenation297937
+Ref: Concatenation-Footnote-1300730
+Node: Assignment Ops300849
+Ref: table-assign-ops305837
+Node: Increment Ops307245
+Node: Truth Values and Conditions310723
+Node: Truth Values311806
+Node: Typing and Comparison312854
+Node: Variable Typing313643
+Ref: Variable Typing-Footnote-1317540
+Node: Comparison Operators317662
+Ref: table-relational-ops318072
+Node: POSIX String Comparison321621
+Ref: POSIX String Comparison-Footnote-1322578
+Node: Boolean Ops322716
+Ref: Boolean Ops-Footnote-1326794
+Node: Conditional Exp326885
+Node: Function Calls328617
+Node: Precedence332207
+Node: Patterns and Actions335860
+Node: Pattern Overview336914
+Node: Regexp Patterns338580
+Node: Expression Patterns339123
+Node: Ranges342697
+Node: BEGIN/END345663
+Node: Using BEGIN/END346413
+Ref: Using BEGIN/END-Footnote-1349144
+Node: I/O And BEGIN/END349258
+Node: Empty351527
+Node: BEGINFILE/ENDFILE351861
+Node: Using Shell Variables354686
+Node: Action Overview356965
+Node: Statements359322
+Node: If Statement361181
+Node: While Statement362680
+Node: Do Statement364724
+Node: For Statement365880
+Node: Switch Statement369032
+Node: Break Statement371129
+Node: Continue Statement373105
+Node: Next Statement374806
+Node: Nextfile Statement377188
+Node: Exit Statement379713
+Node: Built-in Variables382044
+Node: User-modified383139
+Ref: User-modified-Footnote-1391140
+Node: Auto-set391202
+Ref: Auto-set-Footnote-1400406
+Node: ARGC and ARGV400611
+Node: Arrays404370
+Node: Array Basics405941
+Node: Array Intro406652
+Node: Reference to Elements410970
+Node: Assigning Elements413240
+Node: Array Example413731
+Node: Scanning an Array415463
+Node: Delete417740
+Ref: Delete-Footnote-1420171
+Node: Numeric Array Subscripts420228
+Node: Uninitialized Subscripts422411
+Node: Multi-dimensional424039
+Node: Multi-scanning427130
+Node: Array Sorting428714
+Ref: Array Sorting-Footnote-1431912
+Node: Arrays of Arrays432106
+Node: Functions436268
+Node: Built-in437090
+Node: Calling Built-in438168
+Node: Numeric Functions440144
+Ref: Numeric Functions-Footnote-1443901
+Ref: Numeric Functions-Footnote-2444237
+Ref: Numeric Functions-Footnote-3444285
+Node: String Functions444554
+Ref: String Functions-Footnote-1466360
+Ref: String Functions-Footnote-2466489
+Ref: String Functions-Footnote-3466737
+Node: Gory Details466824
+Ref: table-sub-escapes468481
+Ref: table-posix-sub469795
+Ref: table-gensub-escapes470695
+Node: I/O Functions471866
+Ref: I/O Functions-Footnote-1478561
+Node: Time Functions478708
+Ref: Time Functions-Footnote-1489575
+Ref: Time Functions-Footnote-2489643
+Ref: Time Functions-Footnote-3489801
+Ref: Time Functions-Footnote-4489912
+Ref: Time Functions-Footnote-5490024
+Ref: Time Functions-Footnote-6490251
+Node: Bitwise Functions490517
+Ref: table-bitwise-ops491075
+Ref: Bitwise Functions-Footnote-1495235
+Node: Type Functions495419
+Node: I18N Functions495857
+Node: User-defined497484
+Node: Definition Syntax498288
+Ref: Definition Syntax-Footnote-1502925
+Node: Function Example502994
+Node: Function Caveats505588
+Node: Calling A Function506009
+Node: Variable Scope507124
+Node: Pass By Value/Reference509052
+Node: Return Statement512492
+Node: Dynamic Typing515434
+Node: Indirect Calls516171
+Node: Internationalization525856
+Node: I18N and L10N527284
+Node: Explaining gettext527970
+Ref: Explaining gettext-Footnote-1533032
+Ref: Explaining gettext-Footnote-2533215
+Node: Programmer i18n533380
+Node: Translator i18n537671
+Node: String Extraction538464
+Ref: String Extraction-Footnote-1539425
+Node: Printf Ordering539511
+Ref: Printf Ordering-Footnote-1542295
+Node: I18N Portability542359
+Ref: I18N Portability-Footnote-1544808
+Node: I18N Example544871
+Ref: I18N Example-Footnote-1547506
+Node: Gawk I18N547578
+Node: Advanced Features548195
+Node: Nondecimal Data549514
+Node: Two-way I/O551095
+Ref: Two-way I/O-Footnote-1556509
+Node: TCP/IP Networking556586
+Node: Profiling559429
+Node: Library Functions566829
+Ref: Library Functions-Footnote-1569799
+Node: Library Names569970
+Ref: Library Names-Footnote-1573441
+Ref: Library Names-Footnote-2573661
+Node: General Functions573747
+Node: Nextfile Function574810
+Node: Strtonum Function579191
+Node: Assert Function582142
+Node: Round Function585468
+Node: Cliff Random Function587009
+Node: Ordinal Functions588025
+Ref: Ordinal Functions-Footnote-1591095
+Ref: Ordinal Functions-Footnote-2591347
+Node: Join Function591563
+Ref: Join Function-Footnote-1593334
+Node: Gettimeofday Function593534
+Node: Data File Management597249
+Node: Filetrans Function597881
+Node: Rewind Function602118
+Node: File Checking603571
+Node: Empty Files604665
+Node: Ignoring Assigns606895
+Node: Getopt Function608448
+Ref: Getopt Function-Footnote-1619773
+Node: Passwd Functions619976
+Ref: Passwd Functions-Footnote-1628964
+Node: Group Functions629052
+Node: Sample Programs637132
+Node: Running Examples637797
+Node: Clones638525
+Node: Cut Program639648
+Node: Egrep Program649489
+Ref: Egrep Program-Footnote-1657260
+Node: Id Program657370
+Node: Split Program660986
+Ref: Split Program-Footnote-1664505
+Node: Tee Program664633
+Node: Uniq Program667436
+Node: Wc Program674859
+Ref: Wc Program-Footnote-1679123
+Node: Miscellaneous Programs679323
+Node: Dupword Program680443
+Node: Alarm Program682474
+Node: Translate Program687196
+Ref: Translate Program-Footnote-1691575
+Ref: Translate Program-Footnote-2691803
+Node: Labels Program691937
+Ref: Labels Program-Footnote-1695308
+Node: Word Sorting695392
+Node: History Sorting699737
+Node: Extract Program701575
+Ref: Extract Program-Footnote-1709056
+Node: Simple Sed709184
+Node: Igawk Program712246
+Ref: Igawk Program-Footnote-1727280
+Ref: Igawk Program-Footnote-2727481
+Node: Signature Program727619
+Node: Debugger728699
+Node: Debugging729610
+Node: Debugging Concepts729924
+Node: Debugging Terms731780
+Node: Awk Debugging734325
+Node: Sample dgawk session735217
+Node: dgawk invocation735709
+Node: Finding The Bug736891
+Node: List of Debugger Commands743375
+Node: Breakpoint Control744686
+Node: Dgawk Execution Control748162
+Node: Viewing And Changing Data751513
+Node: Dgawk Stack754822
+Node: Dgawk Info756282
+Node: Miscellaneous Dgawk Commands760230
+Node: Readline Support765658
+Node: Dgawk Limitations766485
+Node: Language History768624
+Node: V7/SVR3.1770056
+Node: SVR4772351
+Node: POSIX773793
+Node: BTL774791
+Node: POSIX/GNU775525
+Node: Common Extensions780711
+Node: Contributors781844
+Node: Installation785879
+Node: Gawk Distribution786773
+Node: Getting787257
+Node: Extracting788083
+Node: Distribution contents789761
+Node: Unix Installation794779
+Node: Quick Installation795396
+Node: Additional Configuration Options797358
+Node: Configuration Philosophy798835
+Node: Non-Unix Installation801177
+Node: PC Installation801635
+Node: PC Binary Installation802934
+Node: PC Compiling804782
+Node: PC Testing807928
+Node: PC Using809104
+Node: Cygwin813289
+Node: MSYS814286
+Node: VMS Installation814800
+Node: VMS Compilation815404
+Node: VMS Installation Details816981
+Node: VMS Running818611
+Node: VMS POSIX820208
+Node: VMS Old Gawk821506
+Node: Bugs821978
+Node: Other Versions825843
+Node: Notes831122
+Node: Compatibility Mode831814
+Node: Additions832597
+Node: Accessing The Source833409
+Node: Adding Code834832
+Node: New Ports840380
+Node: Dynamic Extensions844493
+Node: Internals845869
+Node: Plugin License854985
+Node: Sample Library855619
+Node: Internal File Description856305
+Node: Internal File Ops860012
+Ref: Internal File Ops-Footnote-1864780
+Node: Using Internal File Ops864928
+Node: Future Extensions867305
+Node: Basic Concepts869809
+Node: Basic High Level870566
+Ref: Basic High Level-Footnote-1874601
+Node: Basic Data Typing874786
+Node: Floating Point Issues879311
+Node: String Conversion Precision880394
+Ref: String Conversion Precision-Footnote-1882088
+Node: Unexpected Results882197
+Node: POSIX Floating Point Problems884023
+Ref: POSIX Floating Point Problems-Footnote-1887719
+Node: Glossary887757
+Node: Copying911856
+Node: GNU Free Documentation License949413
+Node: next-edition974557
+Node: unresolved974909
+Node: revision975409
+Node: consistency975832
+Node: Index979331

End Tag Table
diff --git a/eval.c b/eval.c
index ba2a4229..0245553c 100644
--- a/eval.c
+++ b/eval.c
@@ -35,8 +35,8 @@ IOBUF *curfile = NULL; /* current data file */
int exiting = FALSE;
#ifdef DEBUGGING
-extern int pre_execute(INSTRUCTION **, int inloop);
-extern void post_execute(INSTRUCTION *, int inloop);
+extern int pre_execute(INSTRUCTION **);
+extern void post_execute(INSTRUCTION *);
#else
#define r_interpret interpret
#endif
@@ -364,8 +364,6 @@ static struct optypetab {
{ "Op_jmp", NULL },
{ "Op_jmp_true", NULL },
{ "Op_jmp_false", NULL },
- { "Op_push_loop", NULL },
- { "Op_pop_loop", NULL },
{ "Op_get_record", NULL },
{ "Op_newfile", NULL },
{ "Op_arrayfor_init", NULL },
@@ -386,7 +384,6 @@ static struct optypetab {
{ "Op_token", NULL },
{ "Op_symbol", NULL },
{ "Op_list", NULL },
- { "Op_case_list", NULL },
{ "Op_K_do", "do" },
{ "Op_K_for", "for" },
{ "Op_K_arrayfor", "for" },
@@ -1133,7 +1130,6 @@ grow_stack()
frame_ptr->stack = NULL;
frame_ptr->func_node = NULL; /* in main */
frame_ptr->vname = NULL;
- frame_ptr->loop_count = 0;
return stack_ptr;
}
@@ -1361,7 +1357,6 @@ setup_frame(INSTRUCTION *pc)
frame_ptr->type = Node_frame;
frame_ptr->stack = sp;
frame_ptr->func_node = f;
- frame_ptr->loop_count = 0;
frame_ptr->vname = NULL;
frame_ptr->reti = (unsigned long) pc; /* on return execute pc->nexti */
@@ -1621,7 +1616,6 @@ r_interpret(INSTRUCTION *code)
#if defined(GAWKDEBUG) || defined(ARRAYDEBUG)
int last_was_stopme = FALSE; /* builtin stopme() called ? */
#endif
- long in_loop = 0;
int stdio_problem = FALSE;
if (args_array == NULL)
@@ -1633,7 +1627,7 @@ r_interpret(INSTRUCTION *code)
#define mk_sub(n) (n == 1 ? POP_STRING() : concat_exp(n, TRUE))
#ifdef DEBUGGING
-#define JUMPTO(x) do { post_execute(pc, in_loop); pc = (x); goto top; } while(FALSE)
+#define JUMPTO(x) do { post_execute(pc); pc = (x); goto top; } while(FALSE)
#else
#define JUMPTO(x) do { pc = (x); goto top; } while(FALSE)
#endif
@@ -1654,7 +1648,7 @@ top:
sourceline = pc->source_line;
#ifdef DEBUGGING
- if (! pre_execute(&pc, in_loop))
+ if (! pre_execute(&pc))
goto top;
#endif
@@ -1856,16 +1850,8 @@ top:
}
break;
- case Op_push_loop: /* for break/continue in loop, switch */
- PUSH_CODE(pc);
- in_loop++;
- break;
-
- case Op_pop_loop:
- (void) POP_CODE();
- in_loop--;
- break;
-
+ case Op_K_break:
+ case Op_K_continue:
case Op_jmp:
JUMPTO(pc->target_jmp);
@@ -2167,62 +2153,25 @@ post:
PUSH(r);
break;
- case Op_K_switch:
- {
- INSTRUCTION *curr;
- int match_found = FALSE;
- t1 = TOP_SCALAR(); /* switch expression */
- for (curr = pc->case_val; curr != NULL; curr = curr->nexti) {
- if (curr->opcode == Op_K_case) {
- m = curr->memory;
- if (m->type == Node_regex) {
- (void) force_string(t1);
- rp = re_update(m);
- match_found = (research(rp, t1->stptr, 0, t1->stlen,
- avoid_dfa(m, t1->stptr, t1->stlen)) >= 0);
- } else
- match_found = (cmp_nodes(t1, m) == 0);
- if (match_found)
- break;
- }
- }
-
- if (! match_found)
- curr = pc->switch_dflt;
- decr_sp();
- DEREF(t1);
- JUMPTO(curr->target_stmt);
- }
-
- case Op_K_continue:
- assert(in_loop >= 0);
- while (in_loop) {
- r = TOP();
- ni = r->code_ptr;
- /* assert(ip->opcode == Op_push_loop); */
- if (ni->target_continue != NULL)
- break;
-
- /*
- * This one is for continue in case statement;
- * keep searching for one that corresponds
- * to a loop.
- */
- (void) POP_CODE();
- in_loop--;
+ case Op_K_case:
+ if ((pc + 1)->match_exp) {
+ /* match a constant regex against switch expression instead of $0. */
+ m = POP(); /* regex */
+ t2 = TOP_SCALAR(); /* switch expression */
+ (void) force_string(t2);
+ rp = re_update(m);
+ di = (research(rp, t2->stptr, 0, t2->stlen,
+ avoid_dfa(m, t2->stptr, t2->stlen)) >= 0);
+ } else {
+ t1 = POP_SCALAR(); /* case value */
+ t2 = TOP_SCALAR(); /* switch expression */
+ di = (cmp_nodes(t2, t1) == 0);
+ DEREF(t1);
}
- if (in_loop)
- JUMPTO(pc->target_jmp);
- else
- fatal(_("`continue' outside a loop is not allowed"));
- break;
-
- case Op_K_break:
- assert(in_loop >= 0);
- if (! in_loop)
- fatal(_("`break' outside a loop is not allowed"));
- else {
+ if (di) { /* match found */
+ decr_sp();
+ DEREF(t2);
JUMPTO(pc->target_jmp);
}
break;
@@ -2298,20 +2247,17 @@ arrayfor:
if (num_elems == 0)
JUMPTO(pc->target_jmp); /* Op_arrayfor_final */
}
- break; /* next instruction is Op_push_loop */
+ break;
case Op_arrayfor_incr:
- r = PEEK(1); /* (break/continue) bytecode from Op_push_loop has
- * an offset of 0.
- */
- /* assert(r->type == Node_arrayfor); */
+ r = TOP(); /* Node_arrayfor */
if (++r->array_size == r->table_size) {
NODE *array;
array = r->var_array[r->table_size]; /* actual array */
if (do_lint && array->table_size != r->table_size)
lintwarn(_("for loop: array `%s' changed size from %ld to %ld during loop execution"),
array_vname(array), (long) r->table_size, (long) array->table_size);
- JUMPTO(pc->target_jmp); /* Op_pop_loop */
+ JUMPTO(pc->target_jmp); /* Op_arrayfor_final */
}
t1 = r->var_array[r->array_size];
@@ -2366,7 +2312,7 @@ match_re:
/*
* Any place where research() is called with a last parameter of
* zero, we need to use the avoid_dfa test. This appears here and
- * in the code for Op_K_switch.
+ * in the code for Op_K_case.
*
* A new or improved dfa that distinguishes beginning/end of
* string from beginning/end of line will allow us to get rid of
@@ -2435,16 +2381,11 @@ match_re:
pc->func_body = f; /* save for next call */
}
- /* save current frame along with source and loop count.
- * NB: 'function fun() { break; } BEGIN { while (1) fun(); }'
- * should be fatal.
- */
+ /* save current frame along with source */
func_call:
frame_ptr->vname = source; /* save current source */
- frame_ptr->loop_count = in_loop; /* save loop count */
setup_frame(pc);
- in_loop = 0;
ni = f->code_ptr; /* function code */
if (ni->opcode == Op_ext_func) {
@@ -2481,7 +2422,6 @@ func_call:
ni = restore_frame(r);
source = frame_ptr->vname;
- in_loop = frame_ptr->loop_count;
/* put the return value back on stack */
PUSH(m);
@@ -2509,11 +2449,8 @@ func_call:
PUSH_CODE(pc);
if (curfile == NULL)
JUMPTO((pc + 1)->target_endfile);
- else {
- TOP()->loop_count = in_loop;
- in_loop = 0;
+ else
JUMPTO((pc + 1)->target_beginfile);
- }
}
} while (r == NULL); /* EOF */
PUSH(r);
@@ -2526,7 +2463,6 @@ func_call:
case Op_after_beginfile:
after_beginfile(&curfile);
- in_loop = TOP()->loop_count;
ni = POP_CODE();
if (ni->opcode == Op_K_getline
|| curfile == NULL /* skipping directory argument */
@@ -2545,8 +2481,6 @@ func_call:
PUSH_CODE(pc);
if (curfile == NULL)
JUMPTO(pc->target_endfile);
- TOP()->loop_count = in_loop;
- in_loop = 0;
break; /* beginfile block */
} else
PUSH_CODE(pc);
@@ -2565,42 +2499,34 @@ func_call:
case Op_K_nextfile:
if (currule != Rule && currule != BEGINFILE)
- fatal(_("`nextfile' cannot be called from a `%s' rule"),
- ruletab[currule]);
+ fatal(_("`nextfile' cannot be called from a `%s' rule"), ruletab[currule]);
(void) nextfile(&curfile, TRUE);
- if (currule == BEGINFILE) {
- while (TRUE) {
- r = POP();
- switch (r->type) {
- case Node_instruction:
- ni = r->code_ptr;
- if (ni->opcode == Op_newfile
- || ni->opcode == Op_K_getline
- ) {
- in_loop = r->loop_count;
- freenode(r);
- JUMPTO(ni);
- }
- freenode(r);
- break;
- case Node_frame:
- (void) restore_frame(r);
- source = frame_ptr->vname;
- break;
- case Node_arrayfor:
- free_arrayfor(r);
- break;
- case Node_val:
- DEREF(r);
- break;
- default:
- break;
- }
+ while (currule == BEGINFILE) {
+ r = POP();
+ switch (r->type) {
+ case Node_instruction:
+ ni = r->code_ptr;
+ freenode(r);
+ if (ni->opcode == Op_newfile || ni->opcode == Op_K_getline)
+ JUMPTO(ni);
+ break;
+ case Node_frame:
+ (void) restore_frame(r);
+ source = frame_ptr->vname;
+ break;
+ case Node_arrayfor:
+ free_arrayfor(r);
+ break;
+ case Node_val:
+ DEREF(r);
+ break;
+ default:
+ break;
}
}
+ assert(currule != BEGINFILE);
unwind_stack(stack_bottom + 1); /* don't pop Op_newfile */
- in_loop = 0;
JUMPTO(pc->target_endfile); /* endfile block */
case Op_K_exit:
@@ -2619,7 +2545,6 @@ func_call:
* or to Op_atexit
*/
unwind_stack(stack_bottom);
- in_loop = 0;
JUMPTO(pc->target_jmp);
case Op_K_next:
@@ -2628,7 +2553,6 @@ func_call:
/* jump to Op_get_record */
unwind_stack(stack_bottom + 1); /* don't pop Op_newfile */
- in_loop = 0;
JUMPTO(pc->target_jmp);
case Op_pop:
@@ -2680,6 +2604,12 @@ func_call:
break;
case Op_no_op:
+ case Op_K_do:
+ case Op_K_while:
+ case Op_K_for:
+ case Op_K_arrayfor:
+ case Op_K_switch:
+ case Op_K_default:
case Op_K_if:
case Op_K_else:
case Op_cond_exp:
diff --git a/profile.c b/profile.c
index 201d7360..2498e4c6 100644
--- a/profile.c
+++ b/profile.c
@@ -496,7 +496,6 @@ cleanup:
case Op_newfile:
case Op_get_record:
case Op_lint:
- case Op_pop_loop:
case Op_jmp:
case Op_jmp_false:
case Op_jmp_true:
@@ -681,125 +680,116 @@ cleanup:
pc = ip->condpair_right;
break;
- case Op_push_loop:
+ case Op_K_while:
ip = pc + 1;
- switch (ip->opcode) {
- case Op_K_while:
- indent(ip->while_body->exec_count);
- fprintf(prof_fp, "%s (", op2str(ip->opcode));
- pprint(pc->nexti, ip->while_body, FALSE);
- t1 = pp_pop();
- fprintf(prof_fp, "%s) {\n", t1->pp_str);
- pp_free(t1);
- indent_in();
- pprint(ip->while_body->nexti, pc->target_break, FALSE);
- indent_out();
- indent(SPACEOVER);
- fprintf(prof_fp, "}\n");
- break;
-
- case Op_K_do:
- indent(pc->nexti->exec_count);
- fprintf(prof_fp, "%s {\n", op2str(ip->opcode));
- indent_in();
- pprint(pc->nexti->nexti, ip->doloop_cond, FALSE);
- indent_out();
- pprint(ip->doloop_cond, pc->target_break, FALSE);
- indent(SPACEOVER);
- t1 = pp_pop();
- fprintf(prof_fp, "} %s (%s)\n", op2str(Op_K_while), t1->pp_str);
- pp_free(t1);
- break;
-
- case Op_K_for:
- indent(ip->forloop_body->exec_count);
- fprintf(prof_fp, "%s (", op2str(ip->opcode));
- pprint(pc->nexti, ip->forloop_cond, TRUE);
- fprintf(prof_fp, "; ");
+ indent(ip->while_body->exec_count);
+ fprintf(prof_fp, "%s (", op2str(pc->opcode));
+ pprint(pc->nexti, ip->while_body, FALSE);
+ t1 = pp_pop();
+ fprintf(prof_fp, "%s) {\n", t1->pp_str);
+ pp_free(t1);
+ indent_in();
+ pprint(ip->while_body->nexti, pc->target_break, FALSE);
+ indent_out();
+ indent(SPACEOVER);
+ fprintf(prof_fp, "}\n");
+ pc = pc->target_break;
+ break;
- if (ip->forloop_cond->opcode == Op_no_op &&
- ip->forloop_cond->nexti == ip->forloop_body)
- fprintf(prof_fp, "; ");
- else {
- pprint(ip->forloop_cond, ip->forloop_body, TRUE);
- t1 = pp_pop();
- fprintf(prof_fp, "%s; ", t1->pp_str);
- pp_free(t1);
- }
+ case Op_K_do:
+ ip = pc + 1;
+ indent(pc->nexti->exec_count);
+ fprintf(prof_fp, "%s {\n", op2str(pc->opcode));
+ indent_in();
+ pprint(pc->nexti->nexti, ip->doloop_cond, FALSE);
+ indent_out();
+ pprint(ip->doloop_cond, pc->target_break, FALSE);
+ indent(SPACEOVER);
+ t1 = pp_pop();
+ fprintf(prof_fp, "} %s (%s)\n", op2str(Op_K_while), t1->pp_str);
+ pp_free(t1);
+ pc = pc->target_break;
+ break;
- pprint(pc->target_continue, pc->target_break, TRUE);
- fprintf(prof_fp, ") {\n");
- indent_in();
- pprint(ip->forloop_body->nexti, pc->target_continue, FALSE);
- indent_out();
- indent(SPACEOVER);
- fprintf(prof_fp, "}\n");
- break;
+ case Op_K_for:
+ ip = pc + 1;
+ indent(ip->forloop_body->exec_count);
+ fprintf(prof_fp, "%s (", op2str(pc->opcode));
+ pprint(pc->nexti, ip->forloop_cond, TRUE);
+ fprintf(prof_fp, "; ");
- case Op_K_arrayfor:
- {
- char *array, *item;
+ if (ip->forloop_cond->opcode == Op_no_op &&
+ ip->forloop_cond->nexti == ip->forloop_body)
+ fprintf(prof_fp, "; ");
+ else {
+ pprint(ip->forloop_cond, ip->forloop_body, TRUE);
t1 = pp_pop();
- array = t1->pp_str;
- m = ip->forloop_cond->array_var;
- if (m->type == Node_param_list)
- item = fparms[m->param_cnt];
- else
- item = m->vname;
- indent(ip->forloop_body->exec_count);
- fprintf(prof_fp, "%s (%s%s%s) {\n", op2str(Op_K_arrayfor),
- item, op2str(Op_in_array), array);
- indent_in();
+ fprintf(prof_fp, "%s; ", t1->pp_str);
pp_free(t1);
- pprint(ip->forloop_body->nexti, pc->target_break, FALSE);
- indent_out();
- indent(SPACEOVER);
- fprintf(prof_fp, "}\n");
}
- break;
-
- case Op_K_switch:
- {
- INSTRUCTION *curr;
- fprintf(prof_fp, "%s (", op2str(ip->opcode));
- pprint(pc->nexti, ip->switch_body, FALSE);
- t1 = pp_pop();
- fprintf(prof_fp, "%s) {\n", t1->pp_str);
- pp_free(t1);
+ pprint(pc->target_continue, pc->target_break, TRUE);
+ fprintf(prof_fp, ") {\n");
+ indent_in();
+ pprint(ip->forloop_body->nexti, pc->target_continue, FALSE);
+ indent_out();
+ indent(SPACEOVER);
+ fprintf(prof_fp, "}\n");
+ pc = pc->target_break;
+ break;
- for (curr = ip->switch_body->case_val; curr != NULL; curr = curr->nexti) {
- indent(curr->target_stmt->exec_count);
- if (curr->opcode == Op_K_case) {
- m = curr->memory;
- if (m->type == Node_regex) {
- m = m->re_exp;
- tmp = pp_string(m->stptr, m->stlen, '/');
- } else if ((m->flags & NUMBER) != 0)
- tmp = pp_number(m->numbr);
- else
- tmp = pp_string(m->stptr, m->stlen, '"');
- fprintf(prof_fp, "%s %s:\n", op2str(Op_K_case), tmp);
- efree(tmp);
- } else
- fprintf(prof_fp, "%s:\n", op2str(Op_K_default));
- indent_in();
- pprint(curr->target_stmt->nexti, curr->nexti ?
- curr->nexti->target_stmt : pc->target_break, FALSE);
- indent_out();
- }
- indent(SPACEOVER);
- fprintf(prof_fp, "}\n");
- }
- break;
+ case Op_K_arrayfor:
+ {
+ char *array, *item;
- default:
- cant_happen();
- }
+ ip = pc + 1;
+ t1 = pp_pop();
+ array = t1->pp_str;
+ m = ip->forloop_cond->array_var;
+ if (m->type == Node_param_list)
+ item = fparms[m->param_cnt];
+ else
+ item = m->vname;
+ indent(ip->forloop_body->exec_count);
+ fprintf(prof_fp, "%s (%s%s%s) {\n", op2str(Op_K_arrayfor),
+ item, op2str(Op_in_array), array);
+ indent_in();
+ pp_free(t1);
+ pprint(ip->forloop_body->nexti, pc->target_break, FALSE);
+ indent_out();
+ indent(SPACEOVER);
+ fprintf(prof_fp, "}\n");
+ pc = pc->target_break;
+ }
+ break;
+ case Op_K_switch:
+ ip = pc + 1;
+ fprintf(prof_fp, "%s (", op2str(pc->opcode));
+ pprint(pc->nexti, ip->switch_start, FALSE);
+ t1 = pp_pop();
+ fprintf(prof_fp, "%s) {\n", t1->pp_str);
+ pp_free(t1);
+ pprint(ip->switch_start, ip->switch_end, FALSE);
+ indent(SPACEOVER);
+ fprintf(prof_fp, "}\n");
pc = pc->target_break;
break;
+ case Op_K_case:
+ case Op_K_default:
+ indent(pc->stmt_start->exec_count);
+ if (pc->opcode == Op_K_case) {
+ t1 = pp_pop();
+ fprintf(prof_fp, "%s %s:\n", op2str(pc->opcode), t1->pp_str);
+ pp_free(t1);
+ } else
+ fprintf(prof_fp, "%s:\n", op2str(pc->opcode));
+ indent_in();
+ pprint(pc->stmt_start->nexti, pc->stmt_end->nexti, FALSE);
+ indent_out();
+ break;
+
case Op_K_if:
fprintf(prof_fp, "%s (", op2str(pc->opcode));
pprint(pc->nexti, pc->branch_if, FALSE);