diff --git a/awkgram.c b/awkgram.c index 180d29c7..74d1371f 100644 --- a/awkgram.c +++ b/awkgram.c @@ -67,7 +67,6 @@ /* First part of user prologue. */ -#line 26 "awkgram.y" #ifdef GAWKDEBUG #define YYDEBUG 12 @@ -235,7 +234,6 @@ extern double fmod(double x, double y); #define YYSTYPE INSTRUCTION * -#line 239 "awkgram.c" # ifndef YY_CAST # ifdef __cplusplus @@ -950,27 +948,27 @@ static const yytype_int8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_int16 yyrline[] = { - 0, 235, 235, 236, 241, 251, 255, 267, 275, 289, - 300, 310, 320, 346, 356, 358, 363, 373, 375, 380, - 382, 384, 390, 394, 399, 429, 441, 453, 459, 468, - 486, 487, 498, 504, 512, 513, 517, 517, 551, 550, - 584, 599, 601, 606, 607, 627, 632, 633, 637, 648, - 653, 660, 768, 819, 869, 995, 1017, 1038, 1048, 1058, - 1068, 1079, 1092, 1110, 1109, 1126, 1144, 1144, 1246, 1246, - 1279, 1309, 1317, 1318, 1324, 1325, 1332, 1337, 1350, 1365, - 1367, 1375, 1382, 1384, 1392, 1401, 1403, 1412, 1413, 1421, - 1426, 1426, 1439, 1446, 1459, 1463, 1485, 1486, 1492, 1493, - 1502, 1503, 1508, 1513, 1530, 1532, 1534, 1541, 1542, 1548, - 1549, 1554, 1556, 1563, 1565, 1573, 1578, 1589, 1590, 1595, - 1597, 1604, 1606, 1614, 1619, 1629, 1630, 1635, 1636, 1641, - 1648, 1652, 1654, 1656, 1669, 1686, 1696, 1703, 1705, 1710, - 1712, 1714, 1722, 1724, 1729, 1731, 1736, 1738, 1740, 1797, - 1799, 1801, 1803, 1805, 1807, 1809, 1811, 1825, 1830, 1835, - 1861, 1867, 1869, 1871, 1873, 1875, 1877, 1882, 1886, 1918, - 1926, 1932, 1938, 1951, 1952, 1953, 1958, 1963, 1967, 1971, - 1986, 2007, 2012, 2049, 2086, 2087, 2093, 2094, 2099, 2101, - 2108, 2125, 2142, 2144, 2151, 2156, 2162, 2174, 2186, 2195, - 2199, 2204, 2208, 2212, 2216, 2221, 2222, 2226, 2230, 2234 + 0, 236, 236, 237, 242, 252, 256, 268, 276, 290, + 301, 311, 321, 347, 357, 359, 364, 374, 376, 381, + 383, 385, 391, 395, 400, 430, 442, 454, 460, 469, + 487, 488, 499, 505, 513, 514, 518, 518, 552, 551, + 585, 600, 602, 607, 608, 628, 633, 634, 638, 649, + 654, 661, 769, 820, 870, 996, 1018, 1039, 1049, 1059, + 1069, 1080, 1093, 1111, 1110, 1127, 1145, 1145, 1247, 1247, + 1280, 1310, 1318, 1319, 1325, 1326, 1333, 1338, 1351, 1366, + 1368, 1376, 1383, 1385, 1393, 1402, 1404, 1413, 1414, 1422, + 1427, 1427, 1440, 1447, 1460, 1464, 1486, 1487, 1493, 1494, + 1503, 1504, 1509, 1514, 1531, 1533, 1535, 1542, 1543, 1549, + 1550, 1555, 1557, 1564, 1566, 1574, 1579, 1590, 1591, 1596, + 1598, 1605, 1607, 1615, 1620, 1630, 1631, 1636, 1637, 1642, + 1649, 1653, 1655, 1657, 1670, 1687, 1697, 1704, 1706, 1711, + 1713, 1715, 1723, 1725, 1730, 1732, 1737, 1739, 1741, 1798, + 1800, 1802, 1804, 1806, 1808, 1810, 1812, 1826, 1831, 1836, + 1862, 1868, 1870, 1872, 1874, 1876, 1878, 1883, 1887, 1919, + 1927, 1933, 1939, 1952, 1953, 1954, 1959, 1964, 1968, 1972, + 1987, 2008, 2013, 2050, 2087, 2088, 2094, 2095, 2100, 2102, + 2109, 2126, 2143, 2145, 2152, 2157, 2163, 2175, 2187, 2196, + 2200, 2205, 2209, 2213, 2217, 2222, 2223, 2227, 2231, 2235 }; #endif @@ -1952,22 +1950,17 @@ yyreduce: switch (yyn) { case 2: /* program: %empty */ -#line 235 "awkgram.y" { yyval = NULL; } -#line 1958 "awkgram.c" break; case 3: /* program: program rule */ -#line 237 "awkgram.y" { rule = 0; yyerrok; } -#line 1967 "awkgram.c" break; case 4: /* program: program nls */ -#line 242 "awkgram.y" { if (yyvsp[0] != NULL) { if (yyvsp[-1] == NULL) @@ -1977,19 +1970,15 @@ yyreduce: } yyval = yyvsp[-1]; } -#line 1981 "awkgram.c" break; case 5: /* program: program LEX_EOF */ -#line 252 "awkgram.y" { next_sourcefile(); } -#line 1989 "awkgram.c" break; case 6: /* program: program error */ -#line 256 "awkgram.y" { rule = 0; /* @@ -1998,11 +1987,9 @@ yyreduce: */ /* yyerrok; */ } -#line 2002 "awkgram.c" break; case 7: /* rule: pattern action */ -#line 268 "awkgram.y" { (void) append_rule(yyvsp[-1], yyvsp[0]); if (pending_comment != NULL) { @@ -2010,11 +1997,9 @@ yyreduce: pending_comment = NULL; } } -#line 2014 "awkgram.c" break; case 8: /* rule: pattern statement_term */ -#line 276 "awkgram.y" { if (rule != Rule) { msg(_("%s blocks must have an action part"), ruletab[rule]); @@ -2028,11 +2013,9 @@ yyreduce: (void) append_rule(yyvsp[-1], NULL); } } -#line 2032 "awkgram.c" break; case 9: /* rule: function_prologue action */ -#line 290 "awkgram.y" { in_function = false; (void) mk_function(yyvsp[-1], yyvsp[0]); @@ -2043,11 +2026,9 @@ yyreduce: } yyerrok; } -#line 2047 "awkgram.c" break; case 10: /* rule: '@' LEX_INCLUDE source statement_term */ -#line 301 "awkgram.y" { want_source = false; at_seen--; @@ -2057,11 +2038,9 @@ yyreduce: } yyerrok; } -#line 2061 "awkgram.c" break; case 11: /* rule: '@' LEX_LOAD library statement_term */ -#line 311 "awkgram.y" { want_source = false; at_seen--; @@ -2071,11 +2050,9 @@ yyreduce: } yyerrok; } -#line 2075 "awkgram.c" break; case 12: /* rule: '@' LEX_NAMESPACE namespace statement_term */ -#line 321 "awkgram.y" { /* * 1/2022: @@ -2098,11 +2075,9 @@ yyreduce: yyerrok; } -#line 2102 "awkgram.c" break; case 13: /* source: FILENAME */ -#line 347 "awkgram.y" { void *srcfile = NULL; @@ -2112,23 +2087,17 @@ yyreduce: bcfree(yyvsp[0]); yyval = (INSTRUCTION *) srcfile; } -#line 2116 "awkgram.c" break; case 14: /* source: FILENAME error */ -#line 357 "awkgram.y" { yyval = NULL; } -#line 2122 "awkgram.c" break; case 15: /* source: error */ -#line 359 "awkgram.y" { yyval = NULL; } -#line 2128 "awkgram.c" break; case 16: /* library: FILENAME */ -#line 364 "awkgram.y" { void *srcfile; @@ -2138,58 +2107,42 @@ yyreduce: bcfree(yyvsp[0]); yyval = (INSTRUCTION *) srcfile; } -#line 2142 "awkgram.c" break; case 17: /* library: FILENAME error */ -#line 374 "awkgram.y" { yyval = NULL; } -#line 2148 "awkgram.c" break; case 18: /* library: error */ -#line 376 "awkgram.y" { yyval = NULL; } -#line 2154 "awkgram.c" break; case 19: /* namespace: FILENAME */ -#line 381 "awkgram.y" { yyval = yyvsp[0]; } -#line 2160 "awkgram.c" break; case 20: /* namespace: FILENAME error */ -#line 383 "awkgram.y" { yyval = NULL; } -#line 2166 "awkgram.c" break; case 21: /* namespace: error */ -#line 385 "awkgram.y" { yyval = NULL; } -#line 2172 "awkgram.c" break; case 22: /* pattern: %empty */ -#line 390 "awkgram.y" { rule = Rule; yyval = NULL; } -#line 2181 "awkgram.c" break; case 23: /* pattern: exp */ -#line 395 "awkgram.y" { rule = Rule; } -#line 2189 "awkgram.c" break; case 24: /* pattern: exp comma exp */ -#line 400 "awkgram.y" { INSTRUCTION *tp; @@ -2219,11 +2172,9 @@ yyreduce: yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), tp); rule = Rule; } -#line 2223 "awkgram.c" break; case 25: /* pattern: LEX_BEGIN */ -#line 430 "awkgram.y" { static int begin_seen = 0; @@ -2235,11 +2186,9 @@ yyreduce: yyvsp[0]->source_file = source; yyval = yyvsp[0]; } -#line 2239 "awkgram.c" break; case 26: /* pattern: LEX_END */ -#line 442 "awkgram.y" { static int end_seen = 0; @@ -2251,31 +2200,25 @@ yyreduce: yyvsp[0]->source_file = source; yyval = yyvsp[0]; } -#line 2255 "awkgram.c" break; case 27: /* pattern: LEX_BEGINFILE */ -#line 454 "awkgram.y" { yyvsp[0]->in_rule = rule = BEGINFILE; yyvsp[0]->source_file = source; yyval = yyvsp[0]; } -#line 2265 "awkgram.c" break; case 28: /* pattern: LEX_ENDFILE */ -#line 460 "awkgram.y" { yyvsp[0]->in_rule = rule = ENDFILE; yyvsp[0]->source_file = source; yyval = yyvsp[0]; } -#line 2275 "awkgram.c" break; case 29: /* action: l_brace statements r_brace opt_semi opt_nls */ -#line 469 "awkgram.y" { INSTRUCTION *ip = make_braced_statements(yyvsp[-4], yyvsp[-3], yyvsp[-2]); @@ -2290,11 +2233,9 @@ yyreduce: yyval = ip; } -#line 2294 "awkgram.c" break; case 31: /* func_name: FUNC_CALL */ -#line 488 "awkgram.y" { const char *name = yyvsp[0]->lextok; char *qname = qualify_name(name, strlen(name)); @@ -2305,36 +2246,28 @@ yyreduce: } yyval = yyvsp[0]; } -#line 2309 "awkgram.c" break; case 32: /* func_name: lex_builtin */ -#line 499 "awkgram.y" { yyerror(_("`%s' is a built-in function, it cannot be redefined"), tokstart); YYABORT; } -#line 2319 "awkgram.c" break; case 33: /* func_name: '@' LEX_EVAL */ -#line 505 "awkgram.y" { yyval = yyvsp[0]; at_seen--; } -#line 2328 "awkgram.c" break; case 36: /* $@1: %empty */ -#line 517 "awkgram.y" { want_param_names = FUNC_HEADER; } -#line 2334 "awkgram.c" break; case 37: /* function_prologue: LEX_FUNCTION func_name '(' $@1 opt_param_list r_paren opt_nls */ -#line 518 "awkgram.y" { INSTRUCTION *func_comment = NULL; // Merge any comments found in the parameter list with those @@ -2360,17 +2293,13 @@ yyreduce: yyval = yyvsp[-6]; want_param_names = FUNC_BODY; } -#line 2364 "awkgram.c" break; case 38: /* $@2: %empty */ -#line 551 "awkgram.y" { want_regexp = true; } -#line 2370 "awkgram.c" break; case 39: /* regexp: a_slash $@2 REGEXP */ -#line 553 "awkgram.y" { NODE *n, *exp; char *re; @@ -2399,11 +2328,9 @@ yyreduce: yyval->opcode = Op_match_rec; yyval->memory = n; } -#line 2403 "awkgram.c" break; case 40: /* typed_regexp: TYPED_REGEXP */ -#line 585 "awkgram.y" { char *re; size_t len; @@ -2416,23 +2343,17 @@ yyreduce: yyval->opcode = Op_push_re; yyval->memory = make_typed_regex(re, len); } -#line 2420 "awkgram.c" break; case 41: /* a_slash: '/' */ -#line 600 "awkgram.y" { bcfree(yyvsp[0]); } -#line 2426 "awkgram.c" break; case 43: /* statements: %empty */ -#line 606 "awkgram.y" { yyval = NULL; } -#line 2432 "awkgram.c" break; case 44: /* statements: statements statement */ -#line 608 "awkgram.y" { if (yyvsp[0] == NULL) { yyval = yyvsp[-1]; @@ -2452,29 +2373,21 @@ yyreduce: yyerrok; } -#line 2456 "awkgram.c" break; case 45: /* statements: statements error */ -#line 628 "awkgram.y" { yyval = NULL; } -#line 2462 "awkgram.c" break; case 46: /* statement_term: nls */ -#line 632 "awkgram.y" { yyval = yyvsp[0]; } -#line 2468 "awkgram.c" break; case 47: /* statement_term: semi opt_nls */ -#line 633 "awkgram.y" { yyval = yyvsp[0]; } -#line 2474 "awkgram.c" break; case 48: /* statement: semi opt_nls */ -#line 638 "awkgram.y" { if (yyvsp[0] != NULL) { INSTRUCTION *ip; @@ -2485,31 +2398,25 @@ yyreduce: } else yyval = NULL; } -#line 2489 "awkgram.c" break; case 49: /* statement: l_brace statements r_brace */ -#line 649 "awkgram.y" { trailing_comment = yyvsp[0]; // NULL or comment yyval = make_braced_statements(yyvsp[-2], yyvsp[-1], yyvsp[0]); } -#line 2498 "awkgram.c" break; case 50: /* statement: if_statement */ -#line 654 "awkgram.y" { if (do_pretty_print) yyval = list_prepend(yyvsp[0], instruction(Op_exec_count)); else yyval = yyvsp[0]; } -#line 2509 "awkgram.c" break; case 51: /* statement: LEX_SWITCH '(' exp r_paren opt_nls l_brace case_statements opt_nls r_brace */ -#line 661 "awkgram.y" { INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt; INSTRUCTION *ip, *nextc, *tbreak; @@ -2617,11 +2524,9 @@ yyreduce: break_allowed--; fix_break_continue(ip, tbreak, NULL); } -#line 2621 "awkgram.c" break; case 52: /* statement: LEX_WHILE '(' exp r_paren opt_nls statement */ -#line 769 "awkgram.y" { /* * ----------------- @@ -2672,11 +2577,9 @@ yyreduce: continue_allowed--; fix_break_continue(ip, tbreak, tcont); } -#line 2676 "awkgram.c" break; case 53: /* statement: LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren opt_nls */ -#line 820 "awkgram.y" { /* * ----------------- @@ -2726,11 +2629,9 @@ yyreduce: /* else $1 and $4 are NULLs */ } -#line 2730 "awkgram.c" break; case 54: /* statement: LEX_FOR '(' NAME LEX_IN simple_variable r_paren opt_nls statement */ -#line 870 "awkgram.y" { INSTRUCTION *ip; char *var_name = yyvsp[-5]->lextok; @@ -2856,11 +2757,9 @@ regular_loop: break_allowed--; continue_allowed--; } -#line 2860 "awkgram.c" break; case 55: /* statement: LEX_FOR '(' opt_simple_stmt semi opt_nls exp semi opt_nls opt_simple_stmt r_paren opt_nls statement */ -#line 996 "awkgram.y" { if (yyvsp[-7] != NULL) { merge_comments(yyvsp[-7], NULL); @@ -2882,11 +2781,9 @@ regular_loop: break_allowed--; continue_allowed--; } -#line 2886 "awkgram.c" break; case 56: /* statement: LEX_FOR '(' opt_simple_stmt semi opt_nls semi opt_nls opt_simple_stmt r_paren opt_nls statement */ -#line 1018 "awkgram.y" { if (yyvsp[-6] != NULL) { merge_comments(yyvsp[-6], NULL); @@ -2907,22 +2804,18 @@ regular_loop: break_allowed--; continue_allowed--; } -#line 2911 "awkgram.c" break; case 57: /* statement: non_compound_stmt */ -#line 1039 "awkgram.y" { if (do_pretty_print) yyval = list_prepend(yyvsp[0], instruction(Op_exec_count)); else yyval = yyvsp[0]; } -#line 2922 "awkgram.c" break; case 58: /* non_compound_stmt: LEX_BREAK statement_term */ -#line 1049 "awkgram.y" { if (! break_allowed) error_ln(yyvsp[-1]->source_line, @@ -2932,11 +2825,9 @@ regular_loop: if (yyvsp[0] != NULL) yyval = list_append(yyval, yyvsp[0]); } -#line 2936 "awkgram.c" break; case 59: /* non_compound_stmt: LEX_CONTINUE statement_term */ -#line 1059 "awkgram.y" { if (! continue_allowed) error_ln(yyvsp[-1]->source_line, @@ -2946,11 +2837,9 @@ regular_loop: if (yyvsp[0] != NULL) yyval = list_append(yyval, yyvsp[0]); } -#line 2950 "awkgram.c" break; case 60: /* non_compound_stmt: LEX_NEXT statement_term */ -#line 1069 "awkgram.y" { /* if inside function (rule = 0), resolve context at run-time */ if (rule && rule != Rule) @@ -2961,11 +2850,9 @@ regular_loop: if (yyvsp[0] != NULL) yyval = list_append(yyval, yyvsp[0]); } -#line 2965 "awkgram.c" break; case 61: /* non_compound_stmt: LEX_NEXTFILE statement_term */ -#line 1080 "awkgram.y" { /* if inside function (rule = 0), resolve context at run-time */ if (rule == BEGIN || rule == END || rule == ENDFILE) @@ -2978,11 +2865,9 @@ regular_loop: if (yyvsp[0] != NULL) yyval = list_append(yyval, yyvsp[0]); } -#line 2982 "awkgram.c" break; case 62: /* non_compound_stmt: LEX_EXIT opt_exp statement_term */ -#line 1093 "awkgram.y" { /* Initialize the two possible jump targets, the actual target * is resolved at run-time. @@ -2999,20 +2884,16 @@ regular_loop: if (yyvsp[0] != NULL) yyval = list_append(yyval, yyvsp[0]); } -#line 3003 "awkgram.c" break; case 63: /* $@3: %empty */ -#line 1110 "awkgram.y" { if (! in_function) yyerror(_("`return' used outside function context")); } -#line 3012 "awkgram.c" break; case 64: /* non_compound_stmt: LEX_RETURN $@3 opt_fcall_exp statement_term */ -#line 1113 "awkgram.y" { if (called_from_eval) yyvsp[-3]->opcode = Op_K_return_from_eval; @@ -3026,28 +2907,22 @@ regular_loop: if (yyvsp[0] != NULL) yyval = list_append(yyval, yyvsp[0]); } -#line 3030 "awkgram.c" break; case 65: /* non_compound_stmt: simple_stmt statement_term */ -#line 1127 "awkgram.y" { if (yyvsp[0] != NULL) yyval = list_append(yyvsp[-1], yyvsp[0]); else yyval = yyvsp[-1]; } -#line 3041 "awkgram.c" break; case 66: /* $@4: %empty */ -#line 1144 "awkgram.y" { in_print = true; in_parens = 0; } -#line 3047 "awkgram.c" break; case 67: /* simple_stmt: print $@4 print_expression_list output_redir */ -#line 1145 "awkgram.y" { /* * Optimization: plain `print' has no expression list, so $3 is null. @@ -3148,17 +3023,13 @@ regular_print: } } } -#line 3152 "awkgram.c" break; case 68: /* $@5: %empty */ -#line 1246 "awkgram.y" { sub_counter = 0; } -#line 3158 "awkgram.c" break; case 69: /* simple_stmt: LEX_DELETE NAME $@5 delete_subscript_list */ -#line 1247 "awkgram.y" { char *arr = yyvsp[-2]->lextok; @@ -3191,11 +3062,9 @@ regular_print: yyval = list_append(list_append(yyvsp[0], yyvsp[-2]), yyvsp[-3]); } } -#line 3195 "awkgram.c" break; case 70: /* simple_stmt: LEX_DELETE '(' NAME ')' */ -#line 1284 "awkgram.y" { static bool warned = false; char *arr = yyvsp[-1]->lextok; @@ -3221,54 +3090,40 @@ regular_print: fatal(_("`delete' is not allowed with FUNCTAB")); } } -#line 3225 "awkgram.c" break; case 71: /* simple_stmt: exp */ -#line 1310 "awkgram.y" { yyval = optimize_assignment(yyvsp[0]); } -#line 3233 "awkgram.c" break; case 72: /* opt_simple_stmt: %empty */ -#line 1317 "awkgram.y" { yyval = NULL; } -#line 3239 "awkgram.c" break; case 73: /* opt_simple_stmt: simple_stmt */ -#line 1319 "awkgram.y" { yyval = yyvsp[0]; } -#line 3245 "awkgram.c" break; case 74: /* case_statements: %empty */ -#line 1324 "awkgram.y" { yyval = NULL; } -#line 3251 "awkgram.c" break; case 75: /* case_statements: case_statements case_statement */ -#line 1326 "awkgram.y" { if (yyvsp[-1] == NULL) yyval = list_create(yyvsp[0]); else yyval = list_prepend(yyvsp[-1], yyvsp[0]); } -#line 3262 "awkgram.c" break; case 76: /* case_statements: case_statements error */ -#line 1333 "awkgram.y" { yyval = NULL; } -#line 3268 "awkgram.c" break; case 77: /* case_statement: LEX_CASE case_value colon opt_nls statements */ -#line 1338 "awkgram.y" { INSTRUCTION *casestmt = yyvsp[0]; if (yyvsp[0] == NULL) @@ -3281,11 +3136,9 @@ regular_print: bcfree(yyvsp[-2]); yyval = yyvsp[-4]; } -#line 3285 "awkgram.c" break; case 78: /* case_statement: LEX_DEFAULT colon opt_nls statements */ -#line 1351 "awkgram.y" { INSTRUCTION *casestmt = yyvsp[0]; if (yyvsp[0] == NULL) @@ -3297,17 +3150,13 @@ regular_print: yyvsp[-3]->comment = yyvsp[-1]; yyval = yyvsp[-3]; } -#line 3301 "awkgram.c" break; case 79: /* case_value: YNUMBER */ -#line 1366 "awkgram.y" { yyval = yyvsp[0]; } -#line 3307 "awkgram.c" break; case 80: /* case_value: '-' YNUMBER */ -#line 1368 "awkgram.y" { NODE *n = yyvsp[0]->memory; (void) force_number(n); @@ -3315,28 +3164,22 @@ regular_print: bcfree(yyvsp[-1]); yyval = yyvsp[0]; } -#line 3319 "awkgram.c" break; case 81: /* case_value: '+' YNUMBER */ -#line 1376 "awkgram.y" { NODE *n = yyvsp[0]->lasti->memory; bcfree(yyvsp[-1]); add_sign_to_num(n, '+'); yyval = yyvsp[0]; } -#line 3330 "awkgram.c" break; case 82: /* case_value: YSTRING */ -#line 1383 "awkgram.y" { yyval = yyvsp[0]; } -#line 3336 "awkgram.c" break; case 83: /* case_value: regexp */ -#line 1385 "awkgram.y" { if (yyvsp[0]->memory->type == Node_regex) yyvsp[0]->opcode = Op_push_re; @@ -3344,57 +3187,43 @@ regular_print: yyvsp[0]->opcode = Op_push; yyval = yyvsp[0]; } -#line 3348 "awkgram.c" break; case 84: /* case_value: typed_regexp */ -#line 1393 "awkgram.y" { assert((yyvsp[0]->memory->flags & REGEX) == REGEX); yyvsp[0]->opcode = Op_push_re; yyval = yyvsp[0]; } -#line 3358 "awkgram.c" break; case 85: /* print: LEX_PRINT */ -#line 1402 "awkgram.y" { yyval = yyvsp[0]; } -#line 3364 "awkgram.c" break; case 86: /* print: LEX_PRINTF */ -#line 1404 "awkgram.y" { yyval = yyvsp[0]; } -#line 3370 "awkgram.c" break; case 88: /* print_expression_list: '(' expression_list r_paren */ -#line 1414 "awkgram.y" { yyval = yyvsp[-1]; } -#line 3378 "awkgram.c" break; case 89: /* output_redir: %empty */ -#line 1421 "awkgram.y" { in_print = false; in_parens = 0; yyval = NULL; } -#line 3388 "awkgram.c" break; case 90: /* $@6: %empty */ -#line 1426 "awkgram.y" { in_print = false; in_parens = 0; } -#line 3394 "awkgram.c" break; case 91: /* output_redir: IO_OUT $@6 common_exp */ -#line 1427 "awkgram.y" { if (yyvsp[-2]->redir_type == redirect_twoway && yyvsp[0]->lasti->opcode == Op_K_getline_redir @@ -3404,22 +3233,18 @@ regular_print: lintwarn(_("concatenation as I/O `>' redirection target is ambiguous")); yyval = list_prepend(yyvsp[0], yyvsp[-2]); } -#line 3408 "awkgram.c" break; case 92: /* if_statement: LEX_IF '(' exp r_paren opt_nls statement */ -#line 1440 "awkgram.y" { if (yyvsp[-1] != NULL) yyvsp[-5]->comment = yyvsp[-1]; add_lint(yyvsp[-3], LINT_assign_in_cond); yyval = mk_condition(yyvsp[-3], yyvsp[-5], yyvsp[0], NULL, NULL); } -#line 3419 "awkgram.c" break; case 93: /* if_statement: LEX_IF '(' exp r_paren opt_nls statement LEX_ELSE opt_nls statement */ -#line 1448 "awkgram.y" { if (yyvsp[-4] != NULL) yyvsp[-8]->comment = yyvsp[-4]; @@ -3428,19 +3253,15 @@ regular_print: add_lint(yyvsp[-6], LINT_assign_in_cond); yyval = mk_condition(yyvsp[-6], yyvsp[-8], yyvsp[-3], yyvsp[-2], yyvsp[0]); } -#line 3432 "awkgram.c" break; case 94: /* nls: NEWLINE */ -#line 1460 "awkgram.y" { yyval = yyvsp[0]; } -#line 3440 "awkgram.c" break; case 95: /* nls: nls NEWLINE */ -#line 1464 "awkgram.y" { if (yyvsp[-1] != NULL && yyvsp[0] != NULL) { if (yyvsp[-1]->memory->comment_type == EOL_COMMENT) { @@ -3458,59 +3279,43 @@ regular_print: } else yyval = NULL; } -#line 3462 "awkgram.c" break; case 96: /* opt_nls: %empty */ -#line 1485 "awkgram.y" { yyval = NULL; } -#line 3468 "awkgram.c" break; case 97: /* opt_nls: nls */ -#line 1487 "awkgram.y" { yyval = yyvsp[0]; } -#line 3474 "awkgram.c" break; case 98: /* input_redir: %empty */ -#line 1492 "awkgram.y" { yyval = NULL; } -#line 3480 "awkgram.c" break; case 99: /* input_redir: '<' simp_exp */ -#line 1494 "awkgram.y" { bcfree(yyvsp[-1]); yyval = yyvsp[0]; } -#line 3489 "awkgram.c" break; case 100: /* opt_param_list: %empty */ -#line 1502 "awkgram.y" { yyval = NULL; } -#line 3495 "awkgram.c" break; case 101: /* opt_param_list: param_list */ -#line 1504 "awkgram.y" { yyval = yyvsp[0]; } -#line 3501 "awkgram.c" break; case 102: /* param_list: NAME */ -#line 1509 "awkgram.y" { yyvsp[0]->param_count = 0; yyval = list_create(yyvsp[0]); } -#line 3510 "awkgram.c" break; case 103: /* param_list: param_list comma NAME */ -#line 1514 "awkgram.y" { if (yyvsp[-2] != NULL && yyvsp[0] != NULL) { yyvsp[0]->param_count = yyvsp[-2]->lasti->param_count + 1; @@ -3527,76 +3332,54 @@ regular_print: } else yyval = NULL; } -#line 3531 "awkgram.c" break; case 104: /* param_list: error */ -#line 1531 "awkgram.y" { yyval = NULL; } -#line 3537 "awkgram.c" break; case 105: /* param_list: param_list error */ -#line 1533 "awkgram.y" { yyval = yyvsp[-1]; } -#line 3543 "awkgram.c" break; case 106: /* param_list: param_list comma error */ -#line 1535 "awkgram.y" { yyval = yyvsp[-2]; } -#line 3549 "awkgram.c" break; case 107: /* opt_exp: %empty */ -#line 1541 "awkgram.y" { yyval = NULL; } -#line 3555 "awkgram.c" break; case 108: /* opt_exp: exp */ -#line 1543 "awkgram.y" { yyval = yyvsp[0]; } -#line 3561 "awkgram.c" break; case 109: /* opt_expression_list: %empty */ -#line 1548 "awkgram.y" { yyval = NULL; } -#line 3567 "awkgram.c" break; case 110: /* opt_expression_list: expression_list */ -#line 1550 "awkgram.y" { yyval = yyvsp[0]; } -#line 3573 "awkgram.c" break; case 111: /* expression_list: exp */ -#line 1555 "awkgram.y" { yyval = mk_expression_list(NULL, yyvsp[0]); } -#line 3579 "awkgram.c" break; case 112: /* expression_list: expression_list comma exp */ -#line 1557 "awkgram.y" { if (yyvsp[-1] != NULL) yyvsp[-2]->lasti->comment = yyvsp[-1]; yyval = mk_expression_list(yyvsp[-2], yyvsp[0]); yyerrok; } -#line 3590 "awkgram.c" break; case 113: /* expression_list: error */ -#line 1564 "awkgram.y" { yyval = NULL; } -#line 3596 "awkgram.c" break; case 114: /* expression_list: expression_list error */ -#line 1566 "awkgram.y" { /* * Returning the expression list instead of NULL lets @@ -3604,66 +3387,50 @@ regular_print: */ yyval = yyvsp[-1]; } -#line 3608 "awkgram.c" break; case 115: /* expression_list: expression_list error exp */ -#line 1574 "awkgram.y" { /* Ditto */ yyval = mk_expression_list(yyvsp[-2], yyvsp[0]); } -#line 3617 "awkgram.c" break; case 116: /* expression_list: expression_list comma error */ -#line 1579 "awkgram.y" { /* Ditto */ if (yyvsp[-1] != NULL) yyvsp[-2]->lasti->comment = yyvsp[-1]; yyval = yyvsp[-2]; } -#line 3628 "awkgram.c" break; case 117: /* opt_fcall_expression_list: %empty */ -#line 1589 "awkgram.y" { yyval = NULL; } -#line 3634 "awkgram.c" break; case 118: /* opt_fcall_expression_list: fcall_expression_list */ -#line 1591 "awkgram.y" { yyval = yyvsp[0]; } -#line 3640 "awkgram.c" break; case 119: /* fcall_expression_list: fcall_exp */ -#line 1596 "awkgram.y" { yyval = mk_expression_list(NULL, yyvsp[0]); } -#line 3646 "awkgram.c" break; case 120: /* fcall_expression_list: fcall_expression_list comma fcall_exp */ -#line 1598 "awkgram.y" { if (yyvsp[-1] != NULL) yyvsp[-2]->lasti->comment = yyvsp[-1]; yyval = mk_expression_list(yyvsp[-2], yyvsp[0]); yyerrok; } -#line 3657 "awkgram.c" break; case 121: /* fcall_expression_list: error */ -#line 1605 "awkgram.y" { yyval = NULL; } -#line 3663 "awkgram.c" break; case 122: /* fcall_expression_list: fcall_expression_list error */ -#line 1607 "awkgram.y" { /* * Returning the expression list instead of NULL lets @@ -3671,86 +3438,64 @@ regular_print: */ yyval = yyvsp[-1]; } -#line 3675 "awkgram.c" break; case 123: /* fcall_expression_list: fcall_expression_list error fcall_exp */ -#line 1615 "awkgram.y" { /* Ditto */ yyval = mk_expression_list(yyvsp[-2], yyvsp[0]); } -#line 3684 "awkgram.c" break; case 124: /* fcall_expression_list: fcall_expression_list comma error */ -#line 1620 "awkgram.y" { /* Ditto */ if (yyvsp[-1] != NULL) yyvsp[-2]->comment = yyvsp[-1]; yyval = yyvsp[-2]; } -#line 3695 "awkgram.c" break; case 125: /* fcall_exp: exp */ -#line 1629 "awkgram.y" { yyval = yyvsp[0]; } -#line 3701 "awkgram.c" break; case 126: /* fcall_exp: typed_regexp */ -#line 1630 "awkgram.y" { yyval = list_create(yyvsp[0]); } -#line 3707 "awkgram.c" break; case 127: /* opt_fcall_exp: %empty */ -#line 1635 "awkgram.y" { yyval = NULL; } -#line 3713 "awkgram.c" break; case 128: /* opt_fcall_exp: fcall_exp */ -#line 1636 "awkgram.y" { yyval = yyvsp[0]; } -#line 3719 "awkgram.c" break; case 129: /* exp: variable assign_operator exp */ -#line 1642 "awkgram.y" { if (do_lint && yyvsp[0]->lasti->opcode == Op_match_rec) lintwarn_ln(yyvsp[-1]->source_line, _("regular expression on right of assignment")); yyval = mk_assignment(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3730 "awkgram.c" break; case 130: /* exp: variable ASSIGN typed_regexp */ -#line 1649 "awkgram.y" { yyval = mk_assignment(yyvsp[-2], list_create(yyvsp[0]), yyvsp[-1]); } -#line 3738 "awkgram.c" break; case 131: /* exp: exp LEX_AND exp */ -#line 1653 "awkgram.y" { yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3744 "awkgram.c" break; case 132: /* exp: exp LEX_OR exp */ -#line 1655 "awkgram.y" { yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3750 "awkgram.c" break; case 133: /* exp: exp MATCHOP typed_regexp */ -#line 1657 "awkgram.y" { if (yyvsp[-2]->lasti->opcode == Op_match_rec) warning_ln(yyvsp[-1]->source_line, @@ -3763,11 +3508,9 @@ regular_print: bcfree(yyvsp[0]); yyval = list_append(yyvsp[-2], yyvsp[-1]); } -#line 3767 "awkgram.c" break; case 134: /* exp: exp MATCHOP exp */ -#line 1670 "awkgram.y" { if (yyvsp[-2]->lasti->opcode == Op_match_rec) warning_ln(yyvsp[-1]->source_line, @@ -3784,11 +3527,9 @@ regular_print: yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]); } } -#line 3788 "awkgram.c" break; case 135: /* exp: exp LEX_IN simple_variable */ -#line 1687 "awkgram.y" { if (do_lint_old) lintwarn_ln(yyvsp[-1]->source_line, @@ -3798,91 +3539,65 @@ regular_print: yyvsp[-1]->expr_count = 1; yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]); } -#line 3802 "awkgram.c" break; case 136: /* exp: exp a_relop exp */ -#line 1697 "awkgram.y" { if (do_lint && yyvsp[0]->lasti->opcode == Op_match_rec) lintwarn_ln(yyvsp[-1]->source_line, _("regular expression on right of comparison")); yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]); } -#line 3813 "awkgram.c" break; case 137: /* exp: exp '?' exp ':' exp */ -#line 1704 "awkgram.y" { yyval = mk_condition(yyvsp[-4], yyvsp[-3], yyvsp[-2], yyvsp[-1], yyvsp[0]); } -#line 3819 "awkgram.c" break; case 138: /* exp: common_exp */ -#line 1706 "awkgram.y" { yyval = yyvsp[0]; } -#line 3825 "awkgram.c" break; case 139: /* assign_operator: ASSIGN */ -#line 1711 "awkgram.y" { yyval = yyvsp[0]; } -#line 3831 "awkgram.c" break; case 140: /* assign_operator: ASSIGNOP */ -#line 1713 "awkgram.y" { yyval = yyvsp[0]; } -#line 3837 "awkgram.c" break; case 141: /* assign_operator: SLASH_BEFORE_EQUAL ASSIGN */ -#line 1715 "awkgram.y" { yyvsp[0]->opcode = Op_assign_quotient; yyval = yyvsp[0]; } -#line 3846 "awkgram.c" break; case 142: /* relop_or_less: RELOP */ -#line 1723 "awkgram.y" { yyval = yyvsp[0]; } -#line 3852 "awkgram.c" break; case 143: /* relop_or_less: '<' */ -#line 1725 "awkgram.y" { yyval = yyvsp[0]; } -#line 3858 "awkgram.c" break; case 144: /* a_relop: relop_or_less */ -#line 1730 "awkgram.y" { yyval = yyvsp[0]; } -#line 3864 "awkgram.c" break; case 145: /* a_relop: '>' */ -#line 1732 "awkgram.y" { yyval = yyvsp[0]; } -#line 3870 "awkgram.c" break; case 146: /* common_exp: simp_exp */ -#line 1737 "awkgram.y" { yyval = yyvsp[0]; } -#line 3876 "awkgram.c" break; case 147: /* common_exp: simp_exp_nc */ -#line 1739 "awkgram.y" { yyval = yyvsp[0]; } -#line 3882 "awkgram.c" break; case 148: /* common_exp: common_exp simp_exp */ -#line 1741 "awkgram.y" { int count = 2; bool is_simple_var = false; @@ -3936,47 +3651,33 @@ regular_print: max_args = count; } } -#line 3940 "awkgram.c" break; case 150: /* simp_exp: simp_exp '^' simp_exp */ -#line 1800 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3946 "awkgram.c" break; case 151: /* simp_exp: simp_exp '*' simp_exp */ -#line 1802 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3952 "awkgram.c" break; case 152: /* simp_exp: simp_exp '/' simp_exp */ -#line 1804 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3958 "awkgram.c" break; case 153: /* simp_exp: simp_exp '%' simp_exp */ -#line 1806 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3964 "awkgram.c" break; case 154: /* simp_exp: simp_exp '+' simp_exp */ -#line 1808 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3970 "awkgram.c" break; case 155: /* simp_exp: simp_exp '-' simp_exp */ -#line 1810 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3976 "awkgram.c" break; case 156: /* simp_exp: LEX_GETLINE opt_variable input_redir */ -#line 1812 "awkgram.y" { /* * In BEGINFILE/ENDFILE, allow `getline [var] < file' @@ -3990,29 +3691,23 @@ regular_print: _("non-redirected `getline' undefined inside END action")); yyval = mk_getline(yyvsp[-2], yyvsp[-1], yyvsp[0], redirect_input); } -#line 3994 "awkgram.c" break; case 157: /* simp_exp: variable INCREMENT */ -#line 1826 "awkgram.y" { yyvsp[0]->opcode = Op_postincrement; yyval = mk_assignment(yyvsp[-1], NULL, yyvsp[0]); } -#line 4003 "awkgram.c" break; case 158: /* simp_exp: variable DECREMENT */ -#line 1831 "awkgram.y" { yyvsp[0]->opcode = Op_postdecrement; yyval = mk_assignment(yyvsp[-1], NULL, yyvsp[0]); } -#line 4012 "awkgram.c" break; case 159: /* simp_exp: '(' expression_list r_paren LEX_IN simple_variable */ -#line 1836 "awkgram.y" { if (do_lint_old) { /* first one is warning so that second one comes out if warnings are fatal */ @@ -4033,64 +3728,46 @@ regular_print: yyval = list_append(list_merge(t, yyvsp[0]), yyvsp[-1]); } } -#line 4037 "awkgram.c" break; case 160: /* simp_exp_nc: common_exp IO_IN LEX_GETLINE opt_variable */ -#line 1862 "awkgram.y" { yyval = mk_getline(yyvsp[-1], yyvsp[0], yyvsp[-3], yyvsp[-2]->redir_type); bcfree(yyvsp[-2]); } -#line 4046 "awkgram.c" break; case 161: /* simp_exp_nc: simp_exp_nc '^' simp_exp */ -#line 1868 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 4052 "awkgram.c" break; case 162: /* simp_exp_nc: simp_exp_nc '*' simp_exp */ -#line 1870 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 4058 "awkgram.c" break; case 163: /* simp_exp_nc: simp_exp_nc '/' simp_exp */ -#line 1872 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 4064 "awkgram.c" break; case 164: /* simp_exp_nc: simp_exp_nc '%' simp_exp */ -#line 1874 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 4070 "awkgram.c" break; case 165: /* simp_exp_nc: simp_exp_nc '+' simp_exp */ -#line 1876 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 4076 "awkgram.c" break; case 166: /* simp_exp_nc: simp_exp_nc '-' simp_exp */ -#line 1878 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 4082 "awkgram.c" break; case 167: /* non_post_simp_exp: regexp */ -#line 1883 "awkgram.y" { yyval = list_create(yyvsp[0]); } -#line 4090 "awkgram.c" break; case 168: /* non_post_simp_exp: '!' simp_exp */ -#line 1887 "awkgram.y" { if (yyvsp[0]->opcode == Op_match_rec) { yyvsp[0]->opcode = Op_nomatch; @@ -4122,11 +3799,9 @@ regular_print: } } } -#line 4126 "awkgram.c" break; case 169: /* non_post_simp_exp: '(' exp r_paren */ -#line 1919 "awkgram.y" { // Always include. Allows us to lint warn on // print "foo" > "bar" 1 @@ -4134,31 +3809,25 @@ regular_print: // print "foo" > ("bar" 1) yyval = list_append(yyvsp[-1], bcalloc(Op_parens, 1, sourceline)); } -#line 4138 "awkgram.c" break; case 170: /* non_post_simp_exp: LEX_BUILTIN '(' opt_fcall_expression_list r_paren */ -#line 1927 "awkgram.y" { yyval = snode(yyvsp[-1], yyvsp[-3]); if (yyval == NULL) YYABORT; } -#line 4148 "awkgram.c" break; case 171: /* non_post_simp_exp: LEX_LENGTH '(' opt_fcall_expression_list r_paren */ -#line 1933 "awkgram.y" { yyval = snode(yyvsp[-1], yyvsp[-3]); if (yyval == NULL) YYABORT; } -#line 4158 "awkgram.c" break; case 172: /* non_post_simp_exp: LEX_LENGTH */ -#line 1939 "awkgram.y" { static bool warned = false; @@ -4171,45 +3840,35 @@ regular_print: if (yyval == NULL) YYABORT; } -#line 4175 "awkgram.c" break; case 175: /* non_post_simp_exp: INCREMENT variable */ -#line 1954 "awkgram.y" { yyvsp[-1]->opcode = Op_preincrement; yyval = mk_assignment(yyvsp[0], NULL, yyvsp[-1]); } -#line 4184 "awkgram.c" break; case 176: /* non_post_simp_exp: DECREMENT variable */ -#line 1959 "awkgram.y" { yyvsp[-1]->opcode = Op_predecrement; yyval = mk_assignment(yyvsp[0], NULL, yyvsp[-1]); } -#line 4193 "awkgram.c" break; case 177: /* non_post_simp_exp: YNUMBER */ -#line 1964 "awkgram.y" { yyval = list_create(yyvsp[0]); } -#line 4201 "awkgram.c" break; case 178: /* non_post_simp_exp: YSTRING */ -#line 1968 "awkgram.y" { yyval = list_create(yyvsp[0]); } -#line 4209 "awkgram.c" break; case 179: /* non_post_simp_exp: '-' simp_exp */ -#line 1972 "awkgram.y" { if (yyvsp[0]->lasti->opcode == Op_push_i && (yyvsp[0]->lasti->memory->flags & STRING) == 0 @@ -4224,11 +3883,9 @@ regular_print: yyval = list_append(yyvsp[0], yyvsp[-1]); } } -#line 4228 "awkgram.c" break; case 180: /* non_post_simp_exp: '+' simp_exp */ -#line 1987 "awkgram.y" { if (yyvsp[0]->lasti->opcode == Op_push_i && (yyvsp[0]->lasti->memory->flags & STRING) == 0 @@ -4246,20 +3903,16 @@ regular_print: yyval = list_append(yyvsp[0], yyvsp[-1]); } } -#line 4250 "awkgram.c" break; case 181: /* func_call: direct_func_call */ -#line 2008 "awkgram.y" { func_use(yyvsp[0]->lasti->func_name, FUNC_USE); yyval = yyvsp[0]; } -#line 4259 "awkgram.c" break; case 182: /* func_call: '@' direct_func_call */ -#line 2013 "awkgram.y" { /* indirect function call */ INSTRUCTION *f, *t; @@ -4293,11 +3946,9 @@ regular_print: yyval = list_prepend(yyvsp[0], t); at_seen--; } -#line 4297 "awkgram.c" break; case 183: /* direct_func_call: FUNC_CALL '(' opt_fcall_expression_list r_paren */ -#line 2050 "awkgram.y" { NODE *n; char *name = yyvsp[-3]->func_name; @@ -4330,49 +3981,35 @@ regular_print: yyval = list_append(t, yyvsp[-3]); } } -#line 4334 "awkgram.c" break; case 184: /* opt_variable: %empty */ -#line 2086 "awkgram.y" { yyval = NULL; } -#line 4340 "awkgram.c" break; case 185: /* opt_variable: variable */ -#line 2088 "awkgram.y" { yyval = yyvsp[0]; } -#line 4346 "awkgram.c" break; case 186: /* delete_subscript_list: %empty */ -#line 2093 "awkgram.y" { yyval = NULL; } -#line 4352 "awkgram.c" break; case 187: /* delete_subscript_list: delete_subscript SUBSCRIPT */ -#line 2095 "awkgram.y" { yyval = yyvsp[-1]; } -#line 4358 "awkgram.c" break; case 188: /* delete_subscript: delete_exp_list */ -#line 2100 "awkgram.y" { yyval = yyvsp[0]; } -#line 4364 "awkgram.c" break; case 189: /* delete_subscript: delete_subscript delete_exp_list */ -#line 2102 "awkgram.y" { yyval = list_merge(yyvsp[-1], yyvsp[0]); } -#line 4372 "awkgram.c" break; case 190: /* delete_exp_list: bracketed_exp_list */ -#line 2109 "awkgram.y" { INSTRUCTION *ip = yyvsp[0]->lasti; int count = ip->sub_count; /* # of SUBSEP-seperated expressions */ @@ -4386,11 +4023,9 @@ regular_print: sub_counter++; /* count # of dimensions */ yyval = yyvsp[0]; } -#line 4390 "awkgram.c" break; case 191: /* bracketed_exp_list: '[' expression_list ']' */ -#line 2126 "awkgram.y" { INSTRUCTION *t = yyvsp[-1]; if (yyvsp[-1] == NULL) { @@ -4404,41 +4039,31 @@ regular_print: yyvsp[0]->sub_count = count_expressions(&t, false); yyval = list_append(t, yyvsp[0]); } -#line 4408 "awkgram.c" break; case 192: /* subscript: bracketed_exp_list */ -#line 2143 "awkgram.y" { yyval = yyvsp[0]; } -#line 4414 "awkgram.c" break; case 193: /* subscript: subscript bracketed_exp_list */ -#line 2145 "awkgram.y" { yyval = list_merge(yyvsp[-1], yyvsp[0]); } -#line 4422 "awkgram.c" break; case 194: /* subscript_list: subscript SUBSCRIPT */ -#line 2152 "awkgram.y" { yyval = yyvsp[-1]; } -#line 4428 "awkgram.c" break; case 195: /* simple_variable: NAME */ -#line 2157 "awkgram.y" { yyvsp[0]->opcode = Op_push; yyvsp[0]->memory = variable(yyvsp[0]->source_line, yyvsp[0]->lextok, Node_var_new); yyval = list_create(yyvsp[0]); } -#line 4438 "awkgram.c" break; case 196: /* simple_variable: NAME subscript_list */ -#line 2163 "awkgram.y" { char *arr = yyvsp[-1]->lextok; @@ -4447,11 +4072,9 @@ regular_print: yyvsp[-1]->opcode = Op_push_array; yyval = list_prepend(yyvsp[0], yyvsp[-1]); } -#line 4451 "awkgram.c" break; case 197: /* variable: simple_variable */ -#line 2175 "awkgram.y" { INSTRUCTION *ip = yyvsp[0]->nexti; if (ip->opcode == Op_push @@ -4463,85 +4086,61 @@ regular_print: } else yyval = yyvsp[0]; } -#line 4467 "awkgram.c" break; case 198: /* variable: '$' non_post_simp_exp opt_incdec */ -#line 2187 "awkgram.y" { yyval = list_append(yyvsp[-1], yyvsp[-2]); if (yyvsp[0] != NULL) mk_assignment(yyvsp[-1], NULL, yyvsp[0]); } -#line 4477 "awkgram.c" break; case 199: /* opt_incdec: INCREMENT */ -#line 2196 "awkgram.y" { yyvsp[0]->opcode = Op_postincrement; } -#line 4485 "awkgram.c" break; case 200: /* opt_incdec: DECREMENT */ -#line 2200 "awkgram.y" { yyvsp[0]->opcode = Op_postdecrement; } -#line 4493 "awkgram.c" break; case 201: /* opt_incdec: %empty */ -#line 2204 "awkgram.y" { yyval = NULL; } -#line 4499 "awkgram.c" break; case 202: /* l_brace: '{' opt_nls */ -#line 2208 "awkgram.y" { yyval = yyvsp[0]; } -#line 4505 "awkgram.c" break; case 203: /* r_brace: '}' opt_nls */ -#line 2212 "awkgram.y" { yyval = yyvsp[0]; yyerrok; } -#line 4511 "awkgram.c" break; case 204: /* r_paren: ')' */ -#line 2216 "awkgram.y" { yyerrok; } -#line 4517 "awkgram.c" break; case 205: /* opt_semi: %empty */ -#line 2221 "awkgram.y" { yyval = NULL; } -#line 4523 "awkgram.c" break; case 207: /* semi: ';' */ -#line 2226 "awkgram.y" { yyerrok; } -#line 4529 "awkgram.c" break; case 208: /* colon: ':' */ -#line 2230 "awkgram.y" { yyval = yyvsp[0]; yyerrok; } -#line 4535 "awkgram.c" break; case 209: /* comma: ',' opt_nls */ -#line 2234 "awkgram.y" { yyval = yyvsp[0]; yyerrok; } -#line 4541 "awkgram.c" break; -#line 4545 "awkgram.c" default: break; } @@ -4734,7 +4333,6 @@ yyreturnlab: return yyresult; } -#line 2236 "awkgram.y" struct token { diff --git a/awkgram.y b/awkgram.y index 74be2340..60d688c9 100644 --- a/awkgram.y +++ b/awkgram.y @@ -190,6 +190,7 @@ extern double fmod(double x, double y); #define YYSTYPE INSTRUCTION * %} +%no-lines %token FUNC_CALL NAME REGEXP FILENAME %token YNUMBER YSTRING TYPED_REGEXP diff --git a/builtin.c b/builtin.c index 2bc0aaa3..df273cac 100644 --- a/builtin.c +++ b/builtin.c @@ -2962,6 +2962,8 @@ do_match(int nargs) * * 7/2011: Reverted backslash handling to what it used to be. It was in * gawk for too long. Should have known better. + * + * 9/2023: Update for matches of null strings around multibyte characters. */ /* @@ -3264,8 +3266,19 @@ do_sub(int nargs, unsigned int flags) empty: /* catch the case of gsub(//, "blah", whatever), i.e. empty regexp */ if (matchstart == matchend && matchend < text + textlen) { - *bp++ = *matchend; - matchend++; + // copy in regular text + if (gawk_mb_cur_max == 1) { + *bp++ = *matchend; + matchend++; + } else { + mbstate_t mbs; + size_t i, j; + + memset(& mbs, 0, sizeof(mbs)); + j = mbrlen(matchend, (target->stptr + target->stlen) - matchend, & mbs); + for (i = 0; i < j; i++) + *bp++ = *matchend++; + } } textlen = text + textlen - matchend; text = matchend; diff --git a/command.c b/command.c index 8ef03834..7117872b 100644 --- a/command.c +++ b/command.c @@ -74,7 +74,6 @@ #define yychar zzchar /* First part of user prologue. */ -#line 28 "command.y" #include "awk.h" #include "cmd.h" @@ -142,7 +141,6 @@ static void append_cmdarg(CMDARG *arg); static int find_argument(CMDARG *arg); #define YYSTYPE CMDARG * -#line 146 "command.c" # ifndef YY_CAST # ifdef __cplusplus @@ -807,22 +805,22 @@ static const yytype_int8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_int16 yyrline[] = { - 0, 110, 110, 111, 129, 130, 180, 187, 188, 189, - 190, 191, 195, 196, 197, 198, 202, 203, 204, 205, - 209, 210, 215, 219, 239, 246, 246, 253, 269, 283, - 284, 285, 286, 287, 288, 294, 306, 307, 308, 308, - 309, 309, 310, 311, 312, 313, 314, 314, 315, 316, - 316, 317, 317, 318, 318, 319, 320, 321, 326, 331, - 357, 367, 372, 384, 384, 392, 406, 419, 420, 426, - 427, 431, 432, 433, 434, 440, 441, 442, 447, 458, - 459, 464, 472, 489, 490, 491, 492, 493, 498, 499, - 499, 500, 501, 501, 502, 507, 508, 513, 514, 519, - 520, 524, 525, 529, 530, 545, 546, 551, 559, 560, - 561, 562, 566, 567, 571, 572, 573, 578, 579, 581, - 588, 589, 590, 591, 592, 593, 597, 610, 611, 612, - 616, 617, 618, 619, 623, 625, 627, 631, 646, 650, - 652, 657, 658, 667, 677, 679, 686, 699, 700, 706, - 707, 712, 718, 727, 729, 731, 739 + 0, 111, 111, 112, 130, 131, 181, 188, 189, 190, + 191, 192, 196, 197, 198, 199, 203, 204, 205, 206, + 210, 211, 216, 220, 240, 247, 247, 254, 270, 284, + 285, 286, 287, 288, 289, 295, 307, 308, 309, 309, + 310, 310, 311, 312, 313, 314, 315, 315, 316, 317, + 317, 318, 318, 319, 319, 320, 321, 322, 327, 332, + 358, 368, 373, 385, 385, 393, 407, 420, 421, 427, + 428, 432, 433, 434, 435, 441, 442, 443, 448, 459, + 460, 465, 473, 490, 491, 492, 493, 494, 499, 500, + 500, 501, 502, 502, 503, 508, 509, 514, 515, 520, + 521, 525, 526, 530, 531, 546, 547, 552, 560, 561, + 562, 563, 567, 568, 572, 573, 574, 579, 580, 582, + 589, 590, 591, 592, 593, 594, 598, 611, 612, 613, + 617, 618, 619, 620, 624, 626, 628, 632, 647, 651, + 653, 658, 659, 668, 678, 680, 687, 700, 701, 707, + 708, 713, 719, 728, 730, 732, 740 }; #endif @@ -1537,7 +1535,6 @@ yyreduce: switch (yyn) { case 3: /* input: input line */ -#line 112 "command.y" { cmd_idx = -1; want_nodeval = false; @@ -1552,11 +1549,9 @@ yyreduce: arg_list = NULL; } } -#line 1556 "command.c" break; case 5: /* line: command nls */ -#line 131 "command.y" { if (dbg_errcount == 0 && cmd_idx >= 0) { Func_cmd cmdfunc; @@ -1606,25 +1601,19 @@ yyreduce: YYACCEPT; } } -#line 1610 "command.c" break; case 6: /* line: error nls */ -#line 181 "command.y" { yyerrok; } -#line 1618 "command.c" break; case 22: /* set_want_nodeval: %empty */ -#line 215 "command.y" { want_nodeval = true; } -#line 1624 "command.c" break; case 23: /* eval_prologue: D_EVAL set_want_nodeval opt_param_list nls */ -#line 220 "command.y" { if (dbg_errcount == 0) { /* don't free arg_list; passed on to statement_list @@ -1640,11 +1629,9 @@ yyreduce: in_eval = true; } } -#line 1644 "command.c" break; case 24: /* statement_list: %empty */ -#line 239 "command.y" { yyval = append_statement(arg_list, (char *) start_EVAL); if (read_a_line == read_commands_string) /* unserializing 'eval' in 'commands' */ @@ -1652,25 +1639,19 @@ yyreduce: free_cmdarg(arg_list); arg_list = NULL; } -#line 1656 "command.c" break; case 25: /* @1: %empty */ -#line 246 "command.y" { yyval = append_statement(yyvsp[-1], lexptr_begin); } -#line 1662 "command.c" break; case 26: /* statement_list: statement_list D_STATEMENT @1 nls */ -#line 247 "command.y" { yyval = yyvsp[-1]; } -#line 1670 "command.c" break; case 27: /* eval_cmd: eval_prologue statement_list D_END */ -#line 254 "command.y" { arg_list = append_statement(yyvsp[-1], (char *) end_EVAL); if (read_a_line == read_commands_string) { /* unserializing 'eval' in 'commands' */ @@ -1686,11 +1667,9 @@ yyreduce: cmd_idx = find_command("eval", 4); in_eval = false; } -#line 1690 "command.c" break; case 28: /* eval_cmd: D_EVAL set_want_nodeval string_node */ -#line 270 "command.y" { NODE *n; CMDARG *arg; @@ -1701,21 +1680,17 @@ yyreduce: free_cmdarg(arg_list); arg_list = arg; } -#line 1705 "command.c" break; case 34: /* command: frame_cmd opt_integer */ -#line 289 "command.y" { if (cmdtab[cmd_idx].lex_class == D_FRAME && yyvsp[0] != NULL && yyvsp[0]->a_int < 0) yyerror(_("invalid frame number: %d"), yyvsp[0]->a_int); } -#line 1715 "command.c" break; case 35: /* command: D_INFO D_STRING */ -#line 295 "command.y" { int idx = find_argument(yyvsp[0]); if (idx < 0) @@ -1727,65 +1702,47 @@ yyreduce: yyvsp[0]->a_argument = argtab[idx].value; } } -#line 1731 "command.c" break; case 38: /* $@2: %empty */ -#line 308 "command.y" { want_nodeval = true; } -#line 1737 "command.c" break; case 40: /* $@3: %empty */ -#line 309 "command.y" { want_nodeval = true; } -#line 1743 "command.c" break; case 46: /* $@4: %empty */ -#line 314 "command.y" { want_nodeval = true; } -#line 1749 "command.c" break; case 49: /* $@5: %empty */ -#line 316 "command.y" { want_nodeval = true; } -#line 1755 "command.c" break; case 51: /* $@6: %empty */ -#line 317 "command.y" { want_nodeval = true; } -#line 1761 "command.c" break; case 53: /* $@7: %empty */ -#line 318 "command.y" { want_nodeval = true; } -#line 1767 "command.c" break; case 57: /* command: D_SOURCE D_STRING */ -#line 322 "command.y" { if (in_cmd_src(yyvsp[0]->a_string)) yyerror(_("source: `%s': already sourced"), yyvsp[0]->a_string); } -#line 1776 "command.c" break; case 58: /* command: D_SAVE D_STRING */ -#line 327 "command.y" { if (! input_from_tty) yyerror(_("save: `%s': command not permitted"), yyvsp[0]->a_string); } -#line 1785 "command.c" break; case 59: /* command: D_COMMANDS commands_arg */ -#line 332 "command.y" { int type = 0; int num; @@ -1811,11 +1768,9 @@ yyreduce: } } } -#line 1815 "command.c" break; case 60: /* command: D_END */ -#line 358 "command.y" { if (! in_commands) yyerror(_("`end' valid only in command `commands' or `eval'")); @@ -1825,20 +1780,16 @@ yyreduce: in_commands = false; } } -#line 1829 "command.c" break; case 61: /* command: D_SILENT */ -#line 368 "command.y" { if (! in_commands) yyerror(_("`silent' valid only in command `commands'")); } -#line 1838 "command.c" break; case 62: /* command: D_TRACE D_STRING */ -#line 373 "command.y" { int idx = find_argument(yyvsp[0]); if (idx < 0) @@ -1850,17 +1801,13 @@ yyreduce: yyvsp[0]->a_argument = argtab[idx].value; } } -#line 1854 "command.c" break; case 63: /* $@8: %empty */ -#line 384 "command.y" { want_nodeval = true; } -#line 1860 "command.c" break; case 64: /* command: D_CONDITION plus_integer $@8 condition_exp */ -#line 385 "command.y" { int type; int num = yyvsp[-2]->a_int; @@ -1868,11 +1815,9 @@ yyreduce: if (! type) yyerror(_("condition: invalid breakpoint/watchpoint number")); } -#line 1872 "command.c" break; case 65: /* command: eval_cmd */ -#line 393 "command.y" { if (in_commands) { /* Prepend command 'eval' to argument list */ @@ -1883,11 +1828,9 @@ yyreduce: arg_list = arg; } } -#line 1887 "command.c" break; case 66: /* condition_exp: opt_string_node */ -#line 407 "command.y" { if (yyvsp[0] != NULL) { NODE *n = yyvsp[0]->a_node; @@ -1897,76 +1840,56 @@ yyreduce: } yyval = yyvsp[0]; } -#line 1901 "command.c" break; case 68: /* commands_arg: error */ -#line 421 "command.y" { yyval = NULL; } -#line 1907 "command.c" break; case 69: /* opt_param_list: %empty */ -#line 426 "command.y" { yyval = NULL; } -#line 1913 "command.c" break; case 74: /* param_list: error */ -#line 435 "command.y" { yyval = NULL; } -#line 1919 "command.c" break; case 75: /* opt_string_node: %empty */ -#line 440 "command.y" { yyval = NULL; } -#line 1925 "command.c" break; case 77: /* opt_string_node: error */ -#line 443 "command.y" { yyval = NULL; } -#line 1931 "command.c" break; case 78: /* string_node: D_NODE */ -#line 448 "command.y" { NODE *n; n = yyvsp[0]->a_node; if ((n->flags & STRING) == 0) yyerror(_("argument not a string")); } -#line 1942 "command.c" break; case 79: /* option_args: %empty */ -#line 458 "command.y" { yyval = NULL; } -#line 1948 "command.c" break; case 80: /* option_args: D_STRING */ -#line 460 "command.y" { if (find_option(yyvsp[0]->a_string) < 0) yyerror(_("option: invalid parameter - `%s'"), yyvsp[0]->a_string); } -#line 1957 "command.c" break; case 81: /* option_args: D_STRING '=' D_STRING */ -#line 465 "command.y" { if (find_option(yyvsp[-2]->a_string) < 0) yyerror(_("option: invalid parameter - `%s'"), yyvsp[-2]->a_string); } -#line 1966 "command.c" break; case 82: /* func_name: D_STRING */ -#line 473 "command.y" { NODE *n; n = lookup(yyvsp[0]->a_string); @@ -1979,53 +1902,37 @@ yyreduce: yyvsp[0]->a_node = n; } } -#line 1983 "command.c" break; case 83: /* location: %empty */ -#line 489 "command.y" { yyval = NULL; } -#line 1989 "command.c" break; case 88: /* break_args: %empty */ -#line 498 "command.y" { yyval = NULL; } -#line 1995 "command.c" break; case 89: /* $@9: %empty */ -#line 499 "command.y" { want_nodeval = true; } -#line 2001 "command.c" break; case 92: /* $@10: %empty */ -#line 501 "command.y" { want_nodeval = true; } -#line 2007 "command.c" break; case 95: /* opt_variable: %empty */ -#line 507 "command.y" { yyval = NULL; } -#line 2013 "command.c" break; case 97: /* opt_string: %empty */ -#line 513 "command.y" { yyval = NULL; } -#line 2019 "command.c" break; case 99: /* opt_node: %empty */ -#line 519 "command.y" { yyval = NULL; } -#line 2025 "command.c" break; case 104: /* enable_args: D_STRING opt_integer_list */ -#line 531 "command.y" { int idx = find_argument(yyvsp[-1]); if (idx < 0) @@ -2037,52 +1944,40 @@ yyreduce: yyvsp[-1]->a_argument = argtab[idx].value; } } -#line 2041 "command.c" break; case 106: /* print_exp: '@' D_VARIABLE */ -#line 547 "command.y" { yyvsp[0]->type = D_array; /* dump all items */ yyvsp[0]->a_count = 0; } -#line 2050 "command.c" break; case 107: /* print_exp: '@' D_VARIABLE subscript_list */ -#line 552 "command.y" { yyvsp[-1]->type = D_array; yyvsp[-1]->a_count = num_dim; } -#line 2059 "command.c" break; case 117: /* list_args: %empty */ -#line 578 "command.y" { yyval = NULL; } -#line 2065 "command.c" break; case 118: /* list_args: '+' */ -#line 580 "command.y" { yyval = NULL; } -#line 2071 "command.c" break; case 119: /* list_args: '-' */ -#line 582 "command.y" { CMDARG *a; a = mk_cmdarg(D_int); a->a_int = -1; append_cmdarg(a); } -#line 2082 "command.c" break; case 126: /* integer_range: plus_integer '-' plus_integer */ -#line 598 "command.y" { if (yyvsp[-2]->a_int > yyvsp[0]->a_int) yyerror(_("invalid range specification: %d - %d"), @@ -2091,29 +1986,21 @@ yyreduce: yyvsp[-2]->type = D_range; yyval = yyvsp[-2]; } -#line 2095 "command.c" break; case 127: /* opt_integer_list: %empty */ -#line 610 "command.y" { yyval = NULL; } -#line 2101 "command.c" break; case 134: /* exp_list: node */ -#line 624 "command.y" { yyval = yyvsp[0]; } -#line 2107 "command.c" break; case 135: /* exp_list: exp_list ',' node */ -#line 626 "command.y" { yyval = yyvsp[-2]; } -#line 2113 "command.c" break; case 137: /* subscript: '[' exp_list ']' */ -#line 632 "command.y" { CMDARG *a; NODE *subs; @@ -2128,23 +2015,17 @@ yyreduce: yyvsp[-1]->a_node = subs; yyval = yyvsp[-1]; } -#line 2132 "command.c" break; case 139: /* subscript_list: subscript */ -#line 651 "command.y" { yyval = yyvsp[0]; num_dim = 1; } -#line 2138 "command.c" break; case 140: /* subscript_list: subscript_list subscript */ -#line 653 "command.y" { yyval = yyvsp[-1]; num_dim++; } -#line 2144 "command.c" break; case 142: /* variable: '$' D_NODE */ -#line 659 "command.y" { NODE *n = yyvsp[0]->a_node; if ((n->flags & NUMBER) == 0) @@ -2153,39 +2034,31 @@ yyreduce: yyvsp[0]->type = D_field; yyval = yyvsp[0]; } -#line 2157 "command.c" break; case 143: /* variable: D_VARIABLE subscript_list */ -#line 668 "command.y" { /* a_string is array name, a_count is dimension count */ yyvsp[-1]->type = D_subscript; yyvsp[-1]->a_count = num_dim; yyval = yyvsp[-1]; } -#line 2168 "command.c" break; case 144: /* node: D_NODE */ -#line 678 "command.y" { yyval = yyvsp[0]; } -#line 2174 "command.c" break; case 145: /* node: '+' D_NODE */ -#line 680 "command.y" { NODE *n = yyvsp[0]->a_node; if ((n->flags & NUMBER) == 0) yyerror(_("non-numeric value found, numeric expected")); yyval = yyvsp[0]; } -#line 2185 "command.c" break; case 146: /* node: '-' D_NODE */ -#line 687 "command.y" { NODE *n = yyvsp[0]->a_node; if ((n->flags & NUMBER) == 0) @@ -2194,76 +2067,56 @@ yyreduce: negate_num(n); yyval = yyvsp[0]; } -#line 2198 "command.c" break; case 147: /* opt_plus_integer: %empty */ -#line 699 "command.y" { yyval = NULL; } -#line 2204 "command.c" break; case 148: /* opt_plus_integer: plus_integer */ -#line 701 "command.y" { yyval = yyvsp[0]; } -#line 2210 "command.c" break; case 149: /* opt_integer: %empty */ -#line 706 "command.y" { yyval = NULL; } -#line 2216 "command.c" break; case 150: /* opt_integer: integer */ -#line 708 "command.y" { yyval = yyvsp[0]; } -#line 2222 "command.c" break; case 151: /* plus_integer: D_INT */ -#line 713 "command.y" { if (yyvsp[0]->a_int == 0) yyerror(_("non-zero integer value")); yyval = yyvsp[0]; } -#line 2232 "command.c" break; case 152: /* plus_integer: '+' D_INT */ -#line 719 "command.y" { if (yyvsp[0]->a_int == 0) yyerror(_("non-zero integer value")); yyval = yyvsp[0]; } -#line 2242 "command.c" break; case 153: /* integer: D_INT */ -#line 728 "command.y" { yyval = yyvsp[0]; } -#line 2248 "command.c" break; case 154: /* integer: '+' D_INT */ -#line 730 "command.y" { yyval = yyvsp[0]; } -#line 2254 "command.c" break; case 155: /* integer: '-' D_INT */ -#line 732 "command.y" { yyvsp[0]->a_int = - yyvsp[0]->a_int; yyval = yyvsp[0]; } -#line 2263 "command.c" break; case 156: /* nls: '\n' */ -#line 740 "command.y" { if (lexptr_begin != NULL) { if (input_from_tty && lexptr_begin[0] != '\0') @@ -2272,11 +2125,9 @@ yyreduce: lexptr_begin = NULL; } } -#line 2276 "command.c" break; -#line 2280 "command.c" default: break; } @@ -2469,7 +2320,6 @@ yyreturnlab: return yyresult; } -#line 750 "command.y" diff --git a/command.y b/command.y index 342c5105..414e3256 100644 --- a/command.y +++ b/command.y @@ -92,6 +92,7 @@ static void append_cmdarg(CMDARG *arg); static int find_argument(CMDARG *arg); #define YYSTYPE CMDARG * %} +%no-lines %token D_BACKTRACE D_BREAK D_CLEAR D_CONTINUE D_DELETE D_DISABLE D_DOWN %token D_ENABLE D_FINISH D_FRAME D_HELP D_IGNORE D_INFO D_LIST