diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-04-12 07:15:51 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-04-12 07:15:51 -0700 |
commit | c0af51d412931f8b7a23eb0d782177f8244d9534 (patch) | |
tree | 2a556a7a8c52544991b01d7bd3d804fc97653c79 | |
parent | 3905cde43431cc4edcf901931f7b46511c21e6d8 (diff) | |
download | egawk-c0af51d412931f8b7a23eb0d782177f8244d9534.tar.gz egawk-c0af51d412931f8b7a23eb0d782177f8244d9534.tar.bz2 egawk-c0af51d412931f8b7a23eb0d782177f8244d9534.zip |
Update generated parsers.
* awkgram.c, command.c: Files regenerated using matching Bison 3.8.
-rw-r--r-- | awkgram.c | 2529 | ||||
-rw-r--r-- | command.c | 2 |
2 files changed, 1427 insertions, 1104 deletions
@@ -89,7 +89,11 @@ static int yylex(void); int yyparse(void); static INSTRUCTION *snode(INSTRUCTION *subn, INSTRUCTION *op); static char **check_params(char *fname, int pcount, INSTRUCTION *list); +static void check_param(const char *fname, const char *name, INSTRUCTION *parm); +static void check_local(const char *fname, const char *name, INSTRUCTION *local); +static char *gensym(const char *prefix); static int install_function(char *fname, INSTRUCTION *fi, INSTRUCTION *plist); +static bool add_let(INSTRUCTION *fi, INSTRUCTION *parm); static NODE *mk_rexp(INSTRUCTION *exp); static void param_sanity(INSTRUCTION *arglist); static int parms_shadow(INSTRUCTION *pc, bool *shadow); @@ -165,7 +169,11 @@ static enum { FUNC_BODY, DONT_CHECK } want_param_names = DONT_CHECK; /* ditto */ -static bool in_function; /* parsing kludge */ +static INSTRUCTION *in_function; /* parsing kludge */ +static int in_loop; /* parsing kludge */ +static NODE *let_free; /* free list of function lexical vars */ +static NODE *let_gfree; /* free list of external lexical vars */ +static NODE *let_stack; /* stack of allocated lexicals */ static int rule = 0; const char *const ruletab[] = { @@ -235,7 +243,7 @@ extern double fmod(double x, double y); #define YYSTYPE INSTRUCTION * -#line 239 "awkgram.c" +#line 247 "awkgram.c" # ifndef YY_CAST # ifdef __cplusplus @@ -326,9 +334,10 @@ extern int yydebug; LEX_EVAL = 305, /* LEX_EVAL */ LEX_LOAD = 306, /* LEX_LOAD */ LEX_NAMESPACE = 307, /* LEX_NAMESPACE */ - NEWLINE = 308, /* NEWLINE */ - SLASH_BEFORE_EQUAL = 309, /* SLASH_BEFORE_EQUAL */ - UNARY = 310 /* UNARY */ + LEX_LET = 308, /* LEX_LET */ + NEWLINE = 309, /* NEWLINE */ + SLASH_BEFORE_EQUAL = 310, /* SLASH_BEFORE_EQUAL */ + UNARY = 311 /* UNARY */ }; typedef enum yytokentype yytoken_kind_t; #endif @@ -387,9 +396,10 @@ extern int yydebug; #define LEX_EVAL 305 #define LEX_LOAD 306 #define LEX_NAMESPACE 307 -#define NEWLINE 308 -#define SLASH_BEFORE_EQUAL 309 -#define UNARY 310 +#define LEX_LET 308 +#define NEWLINE 309 +#define SLASH_BEFORE_EQUAL 310 +#define UNARY 311 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED @@ -469,102 +479,106 @@ enum yysymbol_kind_t YYSYMBOL_LEX_EVAL = 50, /* LEX_EVAL */ YYSYMBOL_LEX_LOAD = 51, /* LEX_LOAD */ YYSYMBOL_LEX_NAMESPACE = 52, /* LEX_NAMESPACE */ - YYSYMBOL_NEWLINE = 53, /* NEWLINE */ - YYSYMBOL_SLASH_BEFORE_EQUAL = 54, /* SLASH_BEFORE_EQUAL */ - YYSYMBOL_55_ = 55, /* '?' */ - YYSYMBOL_56_ = 56, /* ':' */ - YYSYMBOL_57_ = 57, /* ',' */ - YYSYMBOL_58_ = 58, /* '<' */ - YYSYMBOL_59_ = 59, /* '>' */ - YYSYMBOL_60_ = 60, /* '+' */ - YYSYMBOL_61_ = 61, /* '-' */ - YYSYMBOL_62_ = 62, /* '*' */ - YYSYMBOL_63_ = 63, /* '/' */ - YYSYMBOL_64_ = 64, /* '%' */ - YYSYMBOL_65_ = 65, /* '!' */ - YYSYMBOL_UNARY = 66, /* UNARY */ - YYSYMBOL_67_ = 67, /* '^' */ - YYSYMBOL_68_ = 68, /* '$' */ - YYSYMBOL_69_ = 69, /* '(' */ - YYSYMBOL_70_ = 70, /* ')' */ - YYSYMBOL_71_ = 71, /* '@' */ - YYSYMBOL_72_ = 72, /* '[' */ - YYSYMBOL_73_ = 73, /* ']' */ - YYSYMBOL_74_ = 74, /* '{' */ - YYSYMBOL_75_ = 75, /* '}' */ - YYSYMBOL_76_ = 76, /* ';' */ - YYSYMBOL_YYACCEPT = 77, /* $accept */ - YYSYMBOL_program = 78, /* program */ - YYSYMBOL_rule = 79, /* rule */ - YYSYMBOL_source = 80, /* source */ - YYSYMBOL_library = 81, /* library */ - YYSYMBOL_namespace = 82, /* namespace */ - YYSYMBOL_pattern = 83, /* pattern */ - YYSYMBOL_action = 84, /* action */ - YYSYMBOL_func_name = 85, /* func_name */ - YYSYMBOL_lex_builtin = 86, /* lex_builtin */ - YYSYMBOL_function_prologue = 87, /* function_prologue */ - YYSYMBOL_88_1 = 88, /* $@1 */ - YYSYMBOL_regexp = 89, /* regexp */ - YYSYMBOL_90_2 = 90, /* $@2 */ - YYSYMBOL_typed_regexp = 91, /* typed_regexp */ - YYSYMBOL_a_slash = 92, /* a_slash */ - YYSYMBOL_statements = 93, /* statements */ - YYSYMBOL_statement_term = 94, /* statement_term */ - YYSYMBOL_statement = 95, /* statement */ - YYSYMBOL_non_compound_stmt = 96, /* non_compound_stmt */ + YYSYMBOL_LEX_LET = 53, /* LEX_LET */ + YYSYMBOL_NEWLINE = 54, /* NEWLINE */ + YYSYMBOL_SLASH_BEFORE_EQUAL = 55, /* SLASH_BEFORE_EQUAL */ + YYSYMBOL_56_ = 56, /* '?' */ + YYSYMBOL_57_ = 57, /* ':' */ + YYSYMBOL_58_ = 58, /* ',' */ + YYSYMBOL_59_ = 59, /* '<' */ + YYSYMBOL_60_ = 60, /* '>' */ + YYSYMBOL_61_ = 61, /* '+' */ + YYSYMBOL_62_ = 62, /* '-' */ + YYSYMBOL_63_ = 63, /* '*' */ + YYSYMBOL_64_ = 64, /* '/' */ + YYSYMBOL_65_ = 65, /* '%' */ + YYSYMBOL_66_ = 66, /* '!' */ + YYSYMBOL_UNARY = 67, /* UNARY */ + YYSYMBOL_68_ = 68, /* '^' */ + YYSYMBOL_69_ = 69, /* '$' */ + YYSYMBOL_70_ = 70, /* '(' */ + YYSYMBOL_71_ = 71, /* ')' */ + YYSYMBOL_72_ = 72, /* '@' */ + YYSYMBOL_73_ = 73, /* '[' */ + YYSYMBOL_74_ = 74, /* ']' */ + YYSYMBOL_75_ = 75, /* '{' */ + YYSYMBOL_76_ = 76, /* '}' */ + YYSYMBOL_77_ = 77, /* ';' */ + YYSYMBOL_YYACCEPT = 78, /* $accept */ + YYSYMBOL_program = 79, /* program */ + YYSYMBOL_rule = 80, /* rule */ + YYSYMBOL_source = 81, /* source */ + YYSYMBOL_library = 82, /* library */ + YYSYMBOL_namespace = 83, /* namespace */ + YYSYMBOL_pattern = 84, /* pattern */ + YYSYMBOL_action = 85, /* action */ + YYSYMBOL_func_name = 86, /* func_name */ + YYSYMBOL_lex_builtin = 87, /* lex_builtin */ + YYSYMBOL_function_prologue = 88, /* function_prologue */ + YYSYMBOL_89_1 = 89, /* $@1 */ + YYSYMBOL_regexp = 90, /* regexp */ + YYSYMBOL_91_2 = 91, /* $@2 */ + YYSYMBOL_typed_regexp = 92, /* typed_regexp */ + YYSYMBOL_a_slash = 93, /* a_slash */ + YYSYMBOL_statements = 94, /* statements */ + YYSYMBOL_statement_term = 95, /* statement_term */ + YYSYMBOL_statement = 96, /* statement */ YYSYMBOL_97_3 = 97, /* $@3 */ - YYSYMBOL_simple_stmt = 98, /* simple_stmt */ + YYSYMBOL_non_compound_stmt = 98, /* non_compound_stmt */ YYSYMBOL_99_4 = 99, /* $@4 */ - YYSYMBOL_100_5 = 100, /* $@5 */ - YYSYMBOL_opt_simple_stmt = 101, /* opt_simple_stmt */ - YYSYMBOL_case_statements = 102, /* case_statements */ - YYSYMBOL_case_statement = 103, /* case_statement */ - YYSYMBOL_case_value = 104, /* case_value */ - YYSYMBOL_print = 105, /* print */ - YYSYMBOL_print_expression_list = 106, /* print_expression_list */ - YYSYMBOL_output_redir = 107, /* output_redir */ - YYSYMBOL_108_6 = 108, /* $@6 */ - YYSYMBOL_if_statement = 109, /* if_statement */ - YYSYMBOL_nls = 110, /* nls */ - YYSYMBOL_opt_nls = 111, /* opt_nls */ - YYSYMBOL_input_redir = 112, /* input_redir */ - YYSYMBOL_opt_param_list = 113, /* opt_param_list */ - YYSYMBOL_param_list = 114, /* param_list */ - YYSYMBOL_opt_exp = 115, /* opt_exp */ - YYSYMBOL_opt_expression_list = 116, /* opt_expression_list */ - YYSYMBOL_expression_list = 117, /* expression_list */ - YYSYMBOL_opt_fcall_expression_list = 118, /* opt_fcall_expression_list */ - YYSYMBOL_fcall_expression_list = 119, /* fcall_expression_list */ - YYSYMBOL_fcall_exp = 120, /* fcall_exp */ - YYSYMBOL_opt_fcall_exp = 121, /* opt_fcall_exp */ - YYSYMBOL_exp = 122, /* exp */ - YYSYMBOL_assign_operator = 123, /* assign_operator */ - YYSYMBOL_relop_or_less = 124, /* relop_or_less */ - YYSYMBOL_a_relop = 125, /* a_relop */ - YYSYMBOL_common_exp = 126, /* common_exp */ - YYSYMBOL_simp_exp = 127, /* simp_exp */ - YYSYMBOL_simp_exp_nc = 128, /* simp_exp_nc */ - YYSYMBOL_non_post_simp_exp = 129, /* non_post_simp_exp */ - YYSYMBOL_func_call = 130, /* func_call */ - YYSYMBOL_direct_func_call = 131, /* direct_func_call */ - YYSYMBOL_opt_variable = 132, /* opt_variable */ - YYSYMBOL_delete_subscript_list = 133, /* delete_subscript_list */ - YYSYMBOL_delete_subscript = 134, /* delete_subscript */ - YYSYMBOL_delete_exp_list = 135, /* delete_exp_list */ - YYSYMBOL_bracketed_exp_list = 136, /* bracketed_exp_list */ - YYSYMBOL_subscript = 137, /* subscript */ - YYSYMBOL_subscript_list = 138, /* subscript_list */ - YYSYMBOL_simple_variable = 139, /* simple_variable */ - YYSYMBOL_variable = 140, /* variable */ - YYSYMBOL_opt_incdec = 141, /* opt_incdec */ - YYSYMBOL_l_brace = 142, /* l_brace */ - YYSYMBOL_r_brace = 143, /* r_brace */ - YYSYMBOL_r_paren = 144, /* r_paren */ - YYSYMBOL_opt_semi = 145, /* opt_semi */ - YYSYMBOL_semi = 146, /* semi */ - YYSYMBOL_colon = 147, /* colon */ - YYSYMBOL_comma = 148 /* comma */ + YYSYMBOL_simple_stmt = 100, /* simple_stmt */ + YYSYMBOL_101_5 = 101, /* $@5 */ + YYSYMBOL_102_6 = 102, /* $@6 */ + YYSYMBOL_opt_simple_stmt = 103, /* opt_simple_stmt */ + YYSYMBOL_case_statements = 104, /* case_statements */ + YYSYMBOL_case_statement = 105, /* case_statement */ + YYSYMBOL_case_value = 106, /* case_value */ + YYSYMBOL_print = 107, /* print */ + YYSYMBOL_print_expression_list = 108, /* print_expression_list */ + YYSYMBOL_output_redir = 109, /* output_redir */ + YYSYMBOL_110_7 = 110, /* $@7 */ + YYSYMBOL_if_statement = 111, /* if_statement */ + YYSYMBOL_nls = 112, /* nls */ + YYSYMBOL_opt_nls = 113, /* opt_nls */ + YYSYMBOL_input_redir = 114, /* input_redir */ + YYSYMBOL_opt_param_list = 115, /* opt_param_list */ + YYSYMBOL_param_list = 116, /* param_list */ + YYSYMBOL_let_var_list_opt = 117, /* let_var_list_opt */ + YYSYMBOL_let_var_list = 118, /* let_var_list */ + YYSYMBOL_opt_exp = 119, /* opt_exp */ + YYSYMBOL_opt_expression_list = 120, /* opt_expression_list */ + YYSYMBOL_expression_list = 121, /* expression_list */ + YYSYMBOL_opt_fcall_expression_list = 122, /* opt_fcall_expression_list */ + YYSYMBOL_fcall_expression_list = 123, /* fcall_expression_list */ + YYSYMBOL_fcall_exp = 124, /* fcall_exp */ + YYSYMBOL_opt_fcall_exp = 125, /* opt_fcall_exp */ + YYSYMBOL_exp = 126, /* exp */ + YYSYMBOL_assign_operator = 127, /* assign_operator */ + YYSYMBOL_relop_or_less = 128, /* relop_or_less */ + YYSYMBOL_a_relop = 129, /* a_relop */ + YYSYMBOL_common_exp = 130, /* common_exp */ + YYSYMBOL_simp_exp = 131, /* simp_exp */ + YYSYMBOL_simp_exp_nc = 132, /* simp_exp_nc */ + YYSYMBOL_non_post_simp_exp = 133, /* non_post_simp_exp */ + YYSYMBOL_func_call = 134, /* func_call */ + YYSYMBOL_direct_func_call = 135, /* direct_func_call */ + YYSYMBOL_opt_variable = 136, /* opt_variable */ + YYSYMBOL_delete_subscript_list = 137, /* delete_subscript_list */ + YYSYMBOL_delete_subscript = 138, /* delete_subscript */ + YYSYMBOL_delete_exp_list = 139, /* delete_exp_list */ + YYSYMBOL_bracketed_exp_list = 140, /* bracketed_exp_list */ + YYSYMBOL_subscript = 141, /* subscript */ + YYSYMBOL_subscript_list = 142, /* subscript_list */ + YYSYMBOL_simple_variable = 143, /* simple_variable */ + YYSYMBOL_variable = 144, /* variable */ + YYSYMBOL_opt_incdec = 145, /* opt_incdec */ + YYSYMBOL_l_brace = 146, /* l_brace */ + YYSYMBOL_r_brace = 147, /* r_brace */ + YYSYMBOL_r_paren = 148, /* r_paren */ + YYSYMBOL_opt_semi = 149, /* opt_semi */ + YYSYMBOL_semi = 150, /* semi */ + YYSYMBOL_colon = 151, /* colon */ + YYSYMBOL_comma = 152 /* comma */ }; typedef enum yysymbol_kind_t yysymbol_kind_t; @@ -892,19 +906,19 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 1200 +#define YYLAST 1255 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 77 +#define YYNTOKENS 78 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 72 +#define YYNNTS 75 /* YYNRULES -- Number of rules. */ -#define YYNRULES 209 +#define YYNRULES 220 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 356 +#define YYNSTATES 375 /* YYMAXUTOK -- Last valid token kind. */ -#define YYMAXUTOK 310 +#define YYMAXUTOK 311 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM @@ -921,16 +935,16 @@ static const yytype_int8 yytranslate[] = 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 65, 2, 2, 68, 64, 2, 2, - 69, 70, 62, 60, 57, 61, 2, 63, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 56, 76, - 58, 2, 59, 55, 71, 2, 2, 2, 2, 2, + 2, 2, 2, 66, 2, 2, 69, 65, 2, 2, + 70, 71, 63, 61, 58, 62, 2, 64, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 57, 77, + 59, 2, 60, 56, 72, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 72, 2, 73, 67, 2, 2, 2, 2, 2, + 2, 73, 2, 74, 68, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 74, 2, 75, 2, 2, 2, 2, + 2, 2, 2, 75, 2, 76, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -949,34 +963,36 @@ static const yytype_int8 yytranslate[] = 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 66 + 55, 67 }; #if YYDEBUG /* 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, 2173, 2185, 2194, - 2198, 2203, 2207, 2211, 2215, 2220, 2221, 2225, 2229, 2233 + 0, 243, 243, 244, 249, 259, 263, 275, 283, 297, + 308, 318, 328, 354, 364, 366, 371, 381, 383, 388, + 390, 392, 398, 402, 407, 437, 449, 461, 467, 476, + 494, 495, 506, 512, 520, 521, 525, 525, 561, 560, + 594, 609, 611, 616, 617, 637, 642, 643, 647, 658, + 663, 670, 778, 831, 883, 1011, 1035, 1059, 1058, 1101, + 1111, 1121, 1131, 1142, 1155, 1173, 1172, 1189, 1207, 1207, + 1309, 1309, 1342, 1372, 1380, 1381, 1387, 1388, 1395, 1400, + 1413, 1428, 1430, 1438, 1445, 1447, 1455, 1464, 1466, 1475, + 1476, 1484, 1489, 1489, 1502, 1509, 1522, 1526, 1548, 1549, + 1555, 1556, 1565, 1566, 1571, 1576, 1593, 1595, 1597, 1603, + 1604, 1609, 1625, 1645, 1663, 1686, 1688, 1690, 1697, 1698, + 1704, 1705, 1710, 1712, 1719, 1721, 1729, 1734, 1745, 1746, + 1751, 1753, 1760, 1762, 1770, 1775, 1785, 1786, 1791, 1792, + 1797, 1804, 1808, 1810, 1812, 1825, 1842, 1852, 1859, 1861, + 1866, 1868, 1870, 1878, 1880, 1885, 1887, 1892, 1894, 1896, + 1953, 1955, 1957, 1959, 1961, 1963, 1965, 1967, 1981, 1986, + 1991, 2017, 2023, 2025, 2027, 2029, 2031, 2033, 2038, 2042, + 2074, 2082, 2088, 2094, 2107, 2108, 2109, 2114, 2119, 2123, + 2127, 2142, 2163, 2168, 2205, 2242, 2243, 2249, 2250, 2255, + 2257, 2264, 2281, 2298, 2300, 2307, 2312, 2318, 2329, 2341, + 2350, 2354, 2359, 2363, 2367, 2371, 2376, 2377, 2381, 2385, + 2389 }; #endif @@ -1002,20 +1018,20 @@ static const char *const yytname[] = "LEX_ENDFILE", "LEX_GETLINE", "LEX_NEXTFILE", "LEX_IN", "LEX_AND", "LEX_OR", "INCREMENT", "DECREMENT", "LEX_BUILTIN", "LEX_LENGTH", "LEX_EOF", "LEX_INCLUDE", "LEX_EVAL", "LEX_LOAD", "LEX_NAMESPACE", - "NEWLINE", "SLASH_BEFORE_EQUAL", "'?'", "':'", "','", "'<'", "'>'", - "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", "UNARY", "'^'", "'$'", "'('", - "')'", "'@'", "'['", "']'", "'{'", "'}'", "';'", "$accept", "program", - "rule", "source", "library", "namespace", "pattern", "action", + "LEX_LET", "NEWLINE", "SLASH_BEFORE_EQUAL", "'?'", "':'", "','", "'<'", + "'>'", "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", "UNARY", "'^'", "'$'", + "'('", "')'", "'@'", "'['", "']'", "'{'", "'}'", "';'", "$accept", + "program", "rule", "source", "library", "namespace", "pattern", "action", "func_name", "lex_builtin", "function_prologue", "$@1", "regexp", "$@2", "typed_regexp", "a_slash", "statements", "statement_term", "statement", - "non_compound_stmt", "$@3", "simple_stmt", "$@4", "$@5", + "$@3", "non_compound_stmt", "$@4", "simple_stmt", "$@5", "$@6", "opt_simple_stmt", "case_statements", "case_statement", "case_value", - "print", "print_expression_list", "output_redir", "$@6", "if_statement", + "print", "print_expression_list", "output_redir", "$@7", "if_statement", "nls", "opt_nls", "input_redir", "opt_param_list", "param_list", - "opt_exp", "opt_expression_list", "expression_list", - "opt_fcall_expression_list", "fcall_expression_list", "fcall_exp", - "opt_fcall_exp", "exp", "assign_operator", "relop_or_less", "a_relop", - "common_exp", "simp_exp", "simp_exp_nc", "non_post_simp_exp", + "let_var_list_opt", "let_var_list", "opt_exp", "opt_expression_list", + "expression_list", "opt_fcall_expression_list", "fcall_expression_list", + "fcall_exp", "opt_fcall_exp", "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", @@ -1029,12 +1045,12 @@ yysymbol_name (yysymbol_kind_t yysymbol) } #endif -#define YYPACT_NINF (-276) +#define YYPACT_NINF (-305) #define yypact_value_is_default(Yyn) \ ((Yyn) == YYPACT_NINF) -#define YYTABLE_NINF (-119) +#define YYTABLE_NINF (-130) #define yytable_value_is_error(Yyn) \ ((Yyn) == YYTABLE_NINF) @@ -1043,42 +1059,44 @@ yysymbol_name (yysymbol_kind_t yysymbol) STATE-NUM. */ static const yytype_int16 yypact[] = { - -276, 315, -276, -276, -45, -41, -276, -276, -276, -276, - 133, -276, -276, 13, 13, 13, -13, -7, -276, -276, - -276, 1046, 1046, -276, 1046, 1074, 817, 172, -276, -23, - -10, -276, -276, 29, 1112, 973, 276, 310, -276, -276, - -276, -276, 137, 741, 817, -276, 1, -276, -276, -276, - -276, -276, 64, 84, -276, 98, -276, -276, -276, 741, - 741, 173, 111, 117, 111, 111, 1046, 125, -276, -276, - 15, 1016, 31, 65, 151, -276, 141, -276, -276, -276, - 29, -276, 141, -276, 198, -276, -276, 1001, 203, 1046, - 1046, 1046, 141, -276, -276, -276, 1046, 1046, 175, 276, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, -276, 209, -276, -276, 208, 1046, -276, -276, - -276, 142, 74, -276, 1141, 73, 1141, -276, -276, -276, - -276, 1046, -276, 142, 142, 1016, -276, -276, -276, 1046, - -276, 186, 845, -276, -276, 8, 90, -276, 34, 90, - -276, 59, 90, 29, -276, 541, -276, -276, -276, 11, - -276, 287, 130, 1131, -276, 139, 1141, 13, 123, 123, - 111, 111, 111, 111, 123, 123, 111, 111, 111, 111, - -276, -276, 1141, -276, 1001, 769, -276, 45, 276, -276, - -276, 1141, 203, -276, 1141, -276, -276, -276, -276, -276, - -276, -276, 174, -276, 10, 179, 183, 141, 185, 90, - 90, -276, -276, 90, 1046, 90, 141, -276, -276, 90, - -276, -276, 1141, -276, 182, 141, 1046, -276, -276, -276, - -276, -276, -276, 142, 77, -276, 1046, 1001, -276, 251, - 1046, 1046, 659, 894, -276, -276, -276, 90, 1141, -276, - -276, -276, 589, 541, 141, -276, -276, 1141, 141, -276, - 46, 1016, -276, 90, -41, 189, 1016, 1016, 243, -15, - -276, 182, -276, 817, 263, -276, 162, -276, -276, -276, - -276, -276, 141, -276, -276, 60, -276, -276, -276, 141, - 141, 211, 203, 141, 15, -276, -276, 659, -276, -276, - -10, 659, 1046, 142, 693, 186, 1046, 256, -276, -276, - 1016, 141, 1089, 141, 973, 141, 260, 141, 659, 141, - 928, 659, -276, 340, 222, -276, 212, -276, -276, 928, - 142, -276, -276, -276, 281, 282, -276, -276, 222, -276, - 141, -276, 142, 141, -276, -276, 141, -276, 141, 659, - -276, 389, 659, -276, 465, -276 + -305, 380, -305, -305, -20, -26, -305, -305, -305, -305, + 162, -305, -305, 11, 11, 11, -17, 5, -305, -305, + -305, 1128, 1128, -305, 1128, 1157, 890, 21, -305, 100, + -18, -305, -305, 71, 934, 1054, 251, 290, -305, -305, + -305, -305, 238, 812, 890, -305, 3, -305, -305, -305, + -305, -305, 77, 69, -305, 98, -305, -305, -305, 812, + 812, 158, 127, 123, 127, 127, 1128, 136, -305, -305, + 16, 351, 32, 190, 237, -305, 116, -305, -305, -305, + 71, -305, 116, -305, 200, -305, -305, 1083, 208, 1128, + 1128, 1128, 116, -305, -305, -305, 1128, 1128, 183, 251, + 1128, 1128, 1128, 1128, 1128, 1128, 1128, 1128, 1128, 1128, + 1128, 1128, -305, 222, -305, -305, 218, 1128, -305, -305, + -305, 164, 114, -305, 1098, 59, 1098, -305, -305, -305, + -305, 1128, -305, 164, 164, 351, -305, -305, -305, 1128, + -305, 203, 919, -305, -305, 8, 102, -305, 15, 102, + -305, 55, 102, 71, -305, 609, -305, -305, -305, 19, + -305, 239, 159, 1195, -305, 161, 1098, 11, -19, -19, + 127, 127, 127, 127, -19, -19, 127, 127, 127, 127, + -305, -305, 1098, -305, 1083, 841, -305, 50, 251, -305, + -305, 1098, 208, -305, 1098, -305, -305, -305, -305, -305, + -305, -305, 177, -305, 64, 186, 189, 116, 191, 102, + 102, -305, -305, 102, 1128, 102, 31, 116, -305, -305, + 102, -305, -305, 1098, -305, 185, 116, 1128, -305, -305, + -305, -305, -305, -305, 164, 118, -305, 1128, 1083, -305, + 256, 1128, 1128, 729, 964, -305, -305, -305, 102, 1098, + -305, 194, -305, -305, 658, 609, 116, -305, -305, 1098, + 116, -305, 35, 351, -305, 102, -26, 197, 351, 351, + 243, -6, -305, 185, -305, -305, 890, 261, -305, 60, + -305, -305, -305, -305, -305, 116, -305, -305, 10, -305, + -305, -305, 116, 116, 207, 208, 116, 51, 16, -305, + -305, 729, -305, -305, -18, 729, 1128, 164, 763, -305, + 259, 164, 135, 203, 1128, 258, -305, -305, 351, 116, + 1172, 116, 1128, 116, -305, 36, 1054, 116, 134, 116, + 729, 116, 1009, 1098, 729, -305, 270, 729, -305, 341, + 229, -305, 211, -305, -305, 1009, 164, -305, 1128, -305, + -305, -305, 281, 282, -305, -305, 229, -305, 116, -305, + 164, 116, 1098, -305, -305, 116, -305, 116, 729, -305, + 455, 729, -305, 532, -305 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -1086,68 +1104,70 @@ static const yytype_int16 yypact[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 2, 0, 1, 6, 0, 195, 177, 178, 25, 26, - 0, 27, 28, 184, 0, 0, 0, 172, 5, 94, + 2, 0, 1, 6, 0, 206, 188, 189, 25, 26, + 0, 27, 28, 195, 0, 0, 0, 183, 5, 96, 42, 0, 0, 41, 0, 0, 0, 0, 3, 0, - 0, 167, 38, 4, 23, 138, 146, 147, 149, 173, - 181, 197, 174, 0, 0, 192, 0, 196, 31, 30, - 34, 35, 0, 0, 32, 98, 185, 175, 176, 0, - 0, 0, 180, 174, 179, 168, 0, 201, 174, 113, - 0, 111, 0, 0, 0, 182, 96, 207, 7, 8, - 46, 43, 96, 9, 0, 95, 142, 0, 0, 0, - 0, 0, 96, 143, 145, 144, 0, 0, 0, 148, + 0, 178, 38, 4, 23, 149, 157, 158, 160, 184, + 192, 208, 185, 0, 0, 203, 0, 207, 31, 30, + 34, 35, 0, 0, 32, 100, 196, 186, 187, 0, + 0, 0, 191, 185, 190, 179, 0, 212, 185, 124, + 0, 122, 0, 0, 0, 193, 98, 218, 7, 8, + 46, 43, 98, 9, 0, 97, 153, 0, 0, 0, + 0, 0, 98, 154, 156, 155, 0, 0, 0, 159, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 140, 139, 157, 158, 0, 0, 121, 40, - 126, 0, 0, 119, 125, 0, 111, 194, 193, 33, - 36, 0, 156, 0, 0, 0, 199, 200, 198, 114, - 204, 0, 0, 169, 15, 0, 0, 18, 0, 0, - 21, 0, 0, 97, 202, 0, 47, 39, 133, 134, - 135, 131, 132, 0, 209, 136, 24, 184, 154, 155, - 151, 152, 153, 150, 165, 166, 162, 163, 164, 161, - 130, 141, 129, 183, 122, 0, 191, 0, 99, 170, - 171, 115, 0, 116, 112, 14, 10, 17, 11, 20, - 12, 45, 0, 63, 0, 0, 0, 96, 0, 0, - 0, 85, 86, 0, 107, 0, 96, 44, 57, 0, - 66, 50, 71, 43, 205, 96, 0, 160, 123, 124, - 120, 104, 102, 0, 0, 159, 0, 127, 68, 0, - 0, 0, 0, 72, 58, 59, 60, 0, 108, 61, - 203, 65, 0, 0, 96, 206, 48, 137, 96, 105, - 0, 0, 128, 0, 186, 0, 0, 0, 0, 195, - 73, 0, 62, 0, 89, 87, 0, 49, 29, 37, - 106, 103, 96, 64, 69, 0, 188, 190, 70, 96, - 96, 0, 0, 96, 0, 90, 67, 0, 187, 189, - 0, 0, 0, 0, 0, 88, 0, 92, 74, 52, - 0, 96, 0, 96, 91, 96, 0, 96, 0, 96, - 72, 0, 76, 0, 0, 75, 0, 53, 54, 72, - 0, 93, 79, 82, 0, 0, 83, 84, 0, 208, - 96, 51, 0, 96, 81, 80, 96, 43, 96, 0, - 43, 0, 0, 56, 0, 55 + 0, 0, 151, 150, 168, 169, 0, 0, 132, 40, + 137, 0, 0, 130, 136, 0, 122, 205, 204, 33, + 36, 0, 167, 0, 0, 0, 210, 211, 209, 125, + 215, 0, 0, 180, 15, 0, 0, 18, 0, 0, + 21, 0, 0, 99, 213, 0, 47, 39, 144, 145, + 146, 142, 143, 0, 220, 147, 24, 195, 165, 166, + 162, 163, 164, 161, 176, 177, 173, 174, 175, 172, + 141, 152, 140, 194, 133, 0, 202, 0, 101, 181, + 182, 126, 0, 127, 123, 14, 10, 17, 11, 20, + 12, 45, 0, 65, 0, 0, 0, 98, 0, 0, + 0, 87, 88, 0, 118, 0, 0, 98, 44, 59, + 0, 68, 50, 73, 43, 216, 98, 0, 171, 134, + 135, 131, 106, 104, 0, 0, 170, 0, 138, 70, + 0, 0, 0, 0, 74, 60, 61, 62, 0, 119, + 63, 0, 214, 67, 0, 0, 98, 217, 48, 148, + 98, 107, 0, 0, 139, 0, 197, 0, 0, 0, + 0, 206, 75, 0, 64, 57, 0, 91, 89, 0, + 49, 29, 37, 108, 105, 98, 66, 71, 0, 199, + 201, 72, 98, 98, 0, 0, 98, 0, 0, 92, + 69, 0, 198, 200, 0, 0, 0, 0, 0, 115, + 111, 0, 0, 90, 0, 94, 76, 52, 0, 98, + 0, 98, 0, 98, 116, 0, 93, 98, 0, 98, + 0, 98, 74, 113, 0, 117, 112, 0, 78, 0, + 0, 77, 0, 53, 54, 74, 0, 58, 0, 95, + 81, 84, 0, 0, 85, 86, 0, 219, 98, 51, + 0, 98, 114, 83, 82, 98, 43, 98, 0, 43, + 0, 0, 56, 0, 55 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -276, -276, -276, -276, -276, -276, -276, 253, -276, -276, - -276, -276, -32, -276, -77, -276, -208, -55, -68, -276, - -276, -237, -276, -276, -275, -276, -276, -276, -276, -276, - -276, -276, -276, 47, -48, -276, -276, -276, -276, -276, - -43, 157, -276, -157, -276, -1, -276, -276, -276, 0, - 17, -276, 268, -276, 2, 138, -276, -276, 22, -38, - -276, -276, -81, -2, -276, -27, -213, -66, -276, -22, - -30, -29 + -305, -305, -305, -305, -305, -305, -305, 262, -305, -305, + -305, -305, -44, -305, -82, -305, -211, 117, -123, -305, + -305, -305, -221, -305, -305, -304, -305, -305, -305, -305, + -305, -305, -305, -305, 81, 48, -305, -305, -305, -305, + -305, -305, -305, -37, 139, -305, -22, -305, -1, -305, + -305, -305, -14, 42, -305, 277, -305, -13, 142, -305, + -305, 22, -42, -305, -305, -80, -3, -305, -28, -229, + -40, -305, -23, -53, -31 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { 0, 1, 28, 146, 149, 152, 29, 78, 53, 54, - 30, 187, 31, 84, 120, 32, 155, 79, 217, 218, - 237, 219, 252, 264, 271, 316, 325, 338, 220, 274, - 296, 306, 221, 153, 154, 132, 233, 234, 247, 275, - 70, 121, 122, 123, 263, 222, 117, 95, 96, 35, - 36, 37, 38, 39, 40, 55, 284, 285, 286, 45, - 46, 47, 41, 42, 138, 223, 224, 143, 254, 82, - 340, 142 + 30, 187, 31, 84, 120, 32, 155, 79, 218, 297, + 219, 238, 220, 254, 266, 273, 328, 341, 356, 221, + 277, 300, 314, 222, 153, 154, 132, 234, 235, 311, + 312, 248, 278, 70, 121, 122, 123, 265, 223, 117, + 95, 96, 35, 36, 37, 38, 39, 40, 55, 287, + 288, 289, 45, 46, 47, 41, 42, 138, 224, 225, + 143, 256, 226, 358, 142 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -1155,320 +1175,334 @@ static const yytype_int16 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 34, 125, 81, 81, 141, 97, 270, 160, 128, 195, - 158, 56, 57, 58, 238, 253, 139, 5, 127, 63, - 63, 86, 63, 68, 43, 71, 292, 228, 230, 75, - 19, 44, 144, 63, 156, 197, 180, 145, 62, 64, - 277, 65, 124, 126, 164, 330, 231, 280, 33, 232, - 281, 76, 99, 77, 342, 183, 59, 44, 124, 124, - 199, -13, 60, 75, 76, 135, 147, 189, 190, 93, - 94, 148, 92, 44, 139, 184, 80, 298, 259, 239, - 262, 25, 85, 270, -13, 140, 159, -16, 161, 162, - 163, 196, 270, 185, 198, 165, 166, 200, 63, 63, - 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, - -16, 235, -19, 341, 129, -100, 182, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, 179, 63, - 92, 92, 44, 225, 92, -19, 48, 49, 191, 351, - 86, 194, 354, 19, -118, 87, 186, -101, 188, -119, - 112, 113, 150, 130, 244, 245, 131, 151, 246, 242, - 249, 114, 115, 139, 251, 56, 77, 258, 250, 136, - 137, 88, 89, -110, 268, 4, 4, 256, 105, 50, - 51, 114, 115, 124, 124, 102, 103, 104, 93, 94, - 105, 116, 272, 80, 19, 282, 80, -119, -119, 80, - 289, 290, 255, 157, 52, 260, 278, 5, 283, 276, - 279, 303, 140, 248, 167, -110, 133, 134, 119, 92, - 225, 72, 181, 73, 74, 257, 287, 192, 305, 307, - 294, 225, -110, 309, 297, 261, 124, 311, -110, 266, - 267, 300, 301, 236, 317, 304, 337, 287, 240, 293, - 328, 126, 241, 331, 243, 265, 80, 80, 77, 288, - 80, 322, 80, 318, 343, 320, 80, 321, 326, 327, - 291, 329, 71, 308, 295, 225, 348, 315, 339, 225, - 302, 353, 313, 83, 355, 323, 324, 216, 344, 345, - 319, 336, 347, 67, 80, 349, 225, 86, 350, 225, - 352, 310, 87, 312, 63, 227, 314, 299, 346, 0, - 80, 0, 63, 19, 0, 2, 3, 0, 4, 5, - 0, 0, 6, 7, 0, 0, 0, 225, 88, 225, - 225, 99, 225, 8, 9, -96, 100, 101, 102, 103, - 104, 0, 0, 105, 0, 93, 94, 332, 333, 119, - 0, 10, 11, 12, 13, 0, 0, 0, 0, 14, - 15, 16, 17, 18, 0, 0, 0, 0, 19, 20, - 106, 107, 108, 109, 110, 21, 22, 111, 23, 0, - 24, 0, 0, 25, 26, 0, 27, 0, 0, -22, - 201, -22, 4, 5, 20, 0, 6, 7, 0, 0, - 334, 335, 0, 23, 0, 0, 0, 0, 0, 202, - 0, 203, 204, 205, -78, -78, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 0, 0, 0, 13, 215, - 0, 0, 0, 14, 15, 16, 17, 0, 0, 0, - 0, 0, -78, 20, 0, 0, 0, 0, 0, 21, - 22, 0, 23, 0, 24, 0, 0, 25, 26, 0, - 61, 0, 0, 76, -78, 77, 201, 0, 4, 5, + 34, 81, 81, 97, 128, 158, 82, 125, 160, 195, + 56, 57, 58, 255, 75, 5, 197, 139, 63, 63, + 127, 63, 68, 272, 4, 71, 280, 302, 346, 86, + 141, 180, 63, 144, 4, 295, 283, 335, 145, 284, + 336, 360, 124, 126, 102, 103, 104, 44, 75, 105, + 43, 232, 309, 59, 233, 310, 199, 76, 124, 124, + 139, 139, -13, 62, 64, 135, 65, 44, 239, -16, + 72, -121, 73, 74, 92, 60, 44, 99, 93, 94, + 25, 183, 33, 44, 251, -13, 159, 140, 161, 162, + 163, 185, -16, 189, 190, 165, 166, 63, 63, 63, + 63, 63, 63, 63, 63, 63, 63, 63, 63, -19, + 80, 272, 236, 359, -121, 184, 182, 92, 92, 261, + 270, -102, -109, 82, 272, 85, 82, 129, 63, 82, + 156, -121, -19, 186, 240, 338, 324, -121, 191, 130, + 164, 194, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 19, 370, 19, 131, 373, 339, + 340, 4, 229, 231, 56, 48, 49, 114, 115, 86, + 19, -130, 92, 188, 87, 76, 92, 77, 315, 77, + 136, 137, 317, 124, 124, -129, 82, 82, 19, -103, + 82, 147, 82, 92, 260, 105, 148, 82, 133, 134, + 88, 89, 257, 75, 262, 157, -110, 344, 50, 51, + -98, 347, 5, 249, 349, 307, 264, 279, 93, 94, + -130, -130, 167, 285, 290, 82, 259, 80, 292, 293, + 80, 119, 181, 80, 52, 140, 263, 124, 150, 298, + 268, 269, 82, 151, 192, 372, 290, 237, 374, 86, + 296, 112, 113, 126, 87, 243, 241, 355, 313, 242, + 267, 244, 77, 196, 275, 252, 198, 319, 291, 200, + 294, 323, 299, 322, 258, 71, 316, 306, 329, 327, + 88, 325, 114, 115, 348, 321, 357, 217, 363, 364, + 80, 80, 83, 116, 80, 354, 80, 331, 93, 94, + 326, 80, 67, 365, 281, 318, 361, 320, 282, 228, + 303, 63, 100, 101, 102, 103, 104, 0, 0, 105, + 367, 333, 0, 63, 0, 0, 245, 246, 0, 80, + 247, 0, 250, 301, 0, 0, 0, 253, 0, 0, + 304, 305, 0, 0, 308, 0, 80, 362, 350, 351, + 119, 106, 107, 108, 109, 110, 0, 0, 111, 0, + 0, 86, 0, 0, 0, 274, 87, 330, 99, 332, + 0, 334, 0, 0, 0, 337, 342, 343, 0, 345, + 2, 3, 286, 4, 5, 0, 0, 6, 7, 0, + 0, 0, 88, 89, 90, 0, 20, 0, 8, 9, + 0, 0, 352, 353, 0, 23, 366, 91, 0, 368, + 93, 94, 0, 369, 0, 371, 10, 11, 12, 13, + 0, 0, 140, 0, 14, 15, 16, 17, 18, 0, + 0, 0, 0, 0, 19, 20, 0, 0, 0, 0, + 0, 21, 22, 0, 23, 0, 24, 0, 0, 25, + 26, 0, 27, 0, 0, -22, 201, -22, 4, 5, 0, 0, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 202, 0, 203, 204, 205, - -77, -77, 206, 207, 208, 209, 210, 211, 212, 213, + -80, -80, 206, 207, 208, 209, 210, 211, 212, 213, 214, 0, 0, 0, 13, 215, 0, 0, 0, 14, - 15, 16, 17, 0, 0, 0, 0, 0, -77, 20, - 0, 0, 0, 0, 0, 21, 22, 0, 23, 0, - 24, 0, 0, 25, 26, 0, 61, 0, 0, 76, - -77, 77, 201, 0, 4, 5, 0, 0, 6, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 202, 0, 203, 204, 205, 0, 0, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 0, 0, 0, - 13, 215, 0, 0, 0, 14, 15, 16, 17, 0, - 69, 0, 4, 5, 0, 20, 6, 7, 0, 0, - -109, 21, 22, 0, 23, 0, 24, 0, 0, 25, - 26, 0, 61, 0, 0, 76, 216, 77, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, - 0, 0, 0, 14, 15, 16, 17, 0, 0, 0, - 0, 0, -109, 20, 0, 0, 0, 0, 0, 21, - 22, 0, 23, 0, 24, 0, 0, 25, 273, -109, - 61, 0, 4, 5, 0, -109, 6, 7, 0, 0, + 15, 16, 17, 0, 0, 0, 0, 0, 0, -80, + 20, 0, 0, 0, 0, 0, 21, 22, 0, 23, + 0, 24, 0, 0, 25, 26, 0, 216, 0, 0, + 76, -80, 77, 201, 0, 4, 5, 0, 0, 6, + 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 202, 0, 203, 204, 205, -79, -79, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 0, 0, + 0, 13, 215, 0, 0, 0, 14, 15, 16, 17, + 0, 0, 0, 0, 0, 0, -79, 20, 0, 0, + 0, 0, 0, 21, 22, 0, 23, 0, 24, 0, + 0, 25, 26, 0, 216, 0, 0, 76, -79, 77, + 201, 0, 4, 5, 0, 0, 6, 7, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 202, + 0, 203, 204, 205, 0, 0, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 0, 0, 0, 13, 215, + 0, 0, 0, 14, 15, 16, 17, 0, 0, 69, + 0, 4, 5, 0, 20, 6, 7, 0, 0, -120, + 21, 22, 0, 23, 0, 24, 0, 0, 25, 26, + 0, 216, 0, 0, 76, 217, 77, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, + 0, 0, 14, 15, 16, 17, 0, 0, 0, 0, + 0, 0, -120, 20, 0, 0, 0, 0, 0, 21, + 22, 0, 23, 0, 24, 0, 0, 25, 276, -120, + 61, 0, 4, 5, 0, -120, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 202, 0, 203, 204, 205, 0, 0, 206, 207, 208, 209, 210, 211, 212, 213, 214, 0, 4, 5, 13, 215, 6, 7, 0, 14, 15, 16, 17, 0, 0, 0, - 0, 0, 0, 20, 0, 0, 0, 0, 0, 21, - 22, 0, 23, 0, 24, 0, 0, 25, 26, 0, - 61, 0, 13, 76, 0, 77, 0, 14, 15, 16, - 17, 0, 118, 0, 4, 5, 0, 20, 6, 7, - 119, 0, 0, 21, 22, 0, 23, 0, 24, 0, - 0, 25, 26, 0, 61, 0, 0, 0, 0, 77, - 229, 0, 4, 5, 0, 0, 6, 7, 119, 0, - 13, 0, 0, 0, 0, 14, 15, 16, 17, 0, - 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, + 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, + 21, 22, 0, 23, 0, 24, 0, 0, 25, 26, + 0, 216, 13, 0, 76, 0, 77, 14, 15, 16, + 17, 0, 0, 118, 0, 4, 5, 0, 20, 6, + 7, 119, 0, 0, 21, 22, 0, 23, 0, 24, + 0, 0, 25, 26, 0, 61, 0, 0, 0, 0, + 77, 0, 230, 0, 4, 5, 0, 0, 6, 7, + 119, 13, 0, 0, 0, 0, 14, 15, 16, 17, + 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, + 0, 0, 0, 21, 22, 0, 23, 0, 24, 0, + 13, 25, 26, -128, 61, 14, 15, 16, 17, 0, + 0, 69, 0, 4, 5, 0, 20, 6, 7, 0, + 0, 0, 21, 22, 0, 23, 0, 24, 0, 0, + 25, 26, 0, 61, 0, 0, 0, 0, 0, 0, + 193, 0, 4, 5, 0, 0, 6, 7, 0, 13, + 0, 0, 0, 0, 14, 15, 16, 17, 0, 0, + 0, 0, 0, 0, 86, 20, 0, 0, 0, 87, 0, 21, 22, 0, 23, 0, 24, 0, 13, 25, - 26, -117, 61, 14, 15, 16, 17, 0, 69, 0, - 4, 5, 0, 20, 6, 7, 0, 0, 0, 21, + 26, 0, 61, 14, 15, 16, 17, 4, 271, 0, + 0, 6, 7, 0, 20, 88, 89, 90, 0, 0, + 21, 22, 0, 23, 0, 24, 0, 204, 25, 26, + 91, 61, 92, 93, 94, 0, 211, 212, 0, 0, + 0, 0, 0, 13, 0, 0, 0, 0, 14, 15, + 16, 17, 4, 5, 0, 0, 6, 7, 0, 20, + 0, 0, 0, 0, 0, 21, 22, 0, 23, 0, + 24, 0, 204, 25, 26, 0, 61, 0, 0, 0, + 0, 211, 212, 0, 0, 0, 0, 0, 13, 0, + 0, 0, 0, 14, 15, 16, 17, 4, 5, 0, + 0, 6, 7, 0, 20, 0, 98, 0, 0, 0, + 21, 22, 0, 23, 0, 24, 0, 0, 25, 26, + 0, 61, 0, 0, 0, 0, 4, 5, 0, 0, + 6, 7, 119, 13, 0, 0, 0, 0, 14, 15, + 16, 17, 0, 0, 0, 0, 0, 0, 86, 20, + 0, 0, 0, 87, 0, 21, 22, 0, 23, 0, + 24, 0, 13, 25, 26, 0, 61, 14, 15, 16, + 17, 4, 5, 0, 0, 6, 7, 0, 20, 88, + 89, 90, 0, 0, 21, 22, 0, 23, 0, 24, + 0, 0, 25, 26, 91, 61, 0, 93, 94, 0, + 4, 5, 0, 0, 6, 7, 0, 13, 0, 0, + 0, 0, 14, 15, 16, 17, 0, 0, 0, 0, + 0, 0, 86, 20, 0, 0, 0, 87, 0, 21, 22, 0, 23, 0, 24, 0, 0, 25, 26, 0, - 61, 0, 0, 0, 0, 0, 193, 0, 4, 5, - 0, 0, 6, 7, 0, 0, 13, 0, 0, 0, - 0, 14, 15, 16, 17, 0, 0, 0, 0, 0, - 0, 20, 0, 0, 0, 0, 0, 21, 22, 0, - 23, 0, 24, 0, 13, 25, 26, 0, 61, 14, - 15, 16, 17, 0, 0, 0, 0, 4, 269, 20, - 0, 6, 7, 0, 0, 21, 22, 0, 23, 0, - 24, 0, 0, 25, 26, 0, 61, 204, 0, 0, - 0, 0, 0, 0, 0, 0, 211, 212, 0, 0, - 0, 4, 5, 13, 0, 6, 7, 0, 14, 15, - 16, 17, 0, 0, 0, 0, 0, 0, 20, 0, - 0, 204, 0, 0, 21, 22, 0, 23, 0, 24, - 211, 212, 25, 26, 0, 61, 0, 13, 0, 0, - 0, 0, 14, 15, 16, 17, 4, 5, 0, 0, - 6, 7, 20, 0, 0, 98, 0, 0, 21, 22, - 0, 23, 0, 24, 0, 0, 25, 26, 0, 61, - 0, 0, 0, 0, 4, 5, 0, 0, 6, 7, - 119, 0, 13, 0, 0, 0, 0, 14, 15, 16, - 17, 0, 0, 0, 0, 0, 86, 20, 0, 0, - 0, 87, 0, 21, 22, 0, 23, 0, 24, 0, - 13, 25, 26, 0, 61, 14, 15, 16, 17, 4, - 5, 0, 0, 6, 7, 20, 0, 88, 89, 90, - 0, 21, 22, 0, 23, 0, 24, 0, 0, 25, - 26, 91, 61, 0, 93, 94, 0, 4, 5, 0, - 0, 6, 7, 0, 0, 13, 140, 0, 0, 0, - 14, 15, 16, 17, 0, 0, 0, 0, 0, 86, - 20, 0, 0, 0, 87, 0, 21, 22, 0, 23, - 0, 24, 0, 0, 25, 26, 0, 61, 14, 15, - 16, 17, 86, 0, 0, 0, 0, 87, 20, 0, - 88, 89, 90, 0, 21, 22, 0, 23, 0, 24, - 0, 86, 25, 66, 91, 61, 87, 93, 94, 0, - 0, 86, 0, 88, 89, 90, 87, 0, 0, 0, - 0, 0, 0, 0, 0, 77, 0, 91, 0, 92, - 93, 94, 88, 89, 90, 0, 0, 0, 0, 0, - 0, 0, 88, 89, 90, 0, 91, 226, 0, 93, - 94, 0, 0, 0, 0, 0, 91, 0, 0, 93, - 94 + 61, 14, 15, 16, 17, 86, 0, 0, 0, 0, + 87, 0, 20, 88, 89, 90, 0, 0, 21, 22, + 0, 23, 0, 24, 0, 0, 25, 66, 91, 61, + 0, 93, 94, 0, 0, 0, 88, 89, 90, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, + 0, 91, 227, 0, 93, 94 }; static const yytype_int16 yycheck[] = { - 1, 44, 29, 30, 70, 34, 243, 88, 46, 1, - 87, 13, 14, 15, 4, 223, 1, 4, 17, 21, - 22, 10, 24, 25, 69, 26, 41, 184, 185, 27, - 53, 72, 1, 35, 82, 1, 113, 6, 21, 22, - 253, 24, 43, 44, 92, 320, 1, 1, 1, 4, - 4, 74, 35, 76, 329, 121, 69, 72, 59, 60, - 1, 53, 69, 61, 74, 66, 1, 133, 134, 58, - 59, 6, 57, 72, 1, 1, 29, 17, 1, 69, - 237, 68, 53, 320, 76, 70, 87, 53, 89, 90, - 91, 146, 329, 122, 149, 96, 97, 152, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 76, 192, 53, 326, 50, 70, 117, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 131, - 57, 57, 72, 155, 57, 76, 3, 4, 139, 347, - 10, 142, 350, 53, 70, 15, 73, 70, 131, 10, - 13, 14, 1, 69, 209, 210, 58, 6, 213, 207, - 215, 44, 45, 1, 219, 167, 76, 233, 216, 44, - 45, 41, 42, 11, 242, 3, 3, 225, 67, 46, - 47, 44, 45, 184, 185, 62, 63, 64, 58, 59, - 67, 54, 247, 146, 53, 261, 149, 58, 59, 152, - 266, 267, 224, 5, 71, 234, 254, 4, 263, 252, - 258, 292, 70, 214, 39, 53, 59, 60, 9, 57, - 242, 49, 14, 51, 52, 226, 264, 41, 294, 297, - 273, 253, 70, 301, 282, 236, 237, 303, 76, 240, - 241, 289, 290, 69, 310, 293, 323, 285, 69, 271, - 318, 252, 69, 321, 69, 4, 209, 210, 76, 70, - 213, 1, 215, 311, 330, 313, 219, 315, 316, 317, - 27, 319, 273, 300, 11, 297, 342, 21, 56, 301, - 69, 349, 304, 30, 352, 25, 26, 75, 7, 7, - 312, 323, 340, 25, 247, 343, 318, 10, 346, 321, - 348, 302, 15, 304, 306, 167, 306, 285, 338, -1, - 263, -1, 314, 53, -1, 0, 1, -1, 3, 4, - -1, -1, 7, 8, -1, -1, -1, 349, 41, 351, - 352, 314, 354, 18, 19, 75, 60, 61, 62, 63, - 64, -1, -1, 67, -1, 58, 59, 7, 8, 9, - -1, 36, 37, 38, 39, -1, -1, -1, -1, 44, - 45, 46, 47, 48, -1, -1, -1, -1, 53, 54, - 60, 61, 62, 63, 64, 60, 61, 67, 63, -1, - 65, -1, -1, 68, 69, -1, 71, -1, -1, 74, - 1, 76, 3, 4, 54, -1, 7, 8, -1, -1, - 60, 61, -1, 63, -1, -1, -1, -1, -1, 20, - -1, 22, 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, -1, -1, -1, 39, 40, - -1, -1, -1, 44, 45, 46, 47, -1, -1, -1, - -1, -1, 53, 54, -1, -1, -1, -1, -1, 60, - 61, -1, 63, -1, 65, -1, -1, 68, 69, -1, - 71, -1, -1, 74, 75, 76, 1, -1, 3, 4, + 1, 29, 30, 34, 46, 87, 29, 44, 88, 1, + 13, 14, 15, 224, 27, 4, 1, 1, 21, 22, + 17, 24, 25, 244, 3, 26, 255, 17, 332, 10, + 70, 113, 35, 1, 3, 41, 1, 1, 6, 4, + 4, 345, 43, 44, 63, 64, 65, 73, 61, 68, + 70, 1, 1, 70, 4, 4, 1, 75, 59, 60, + 1, 1, 54, 21, 22, 66, 24, 73, 4, 54, + 49, 11, 51, 52, 58, 70, 73, 35, 59, 60, + 69, 121, 1, 73, 53, 77, 87, 71, 89, 90, + 91, 122, 77, 133, 134, 96, 97, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 110, 111, 54, + 29, 332, 192, 342, 54, 1, 117, 58, 58, 1, + 243, 71, 71, 146, 345, 54, 149, 50, 131, 152, + 82, 71, 77, 74, 70, 1, 1, 77, 139, 70, + 92, 142, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 54, 366, 54, 59, 369, 25, + 26, 3, 184, 185, 167, 3, 4, 44, 45, 10, + 54, 10, 58, 131, 15, 75, 58, 77, 301, 77, + 44, 45, 305, 184, 185, 71, 209, 210, 54, 71, + 213, 1, 215, 58, 234, 68, 6, 220, 59, 60, + 41, 42, 225, 216, 235, 5, 71, 330, 46, 47, + 76, 334, 4, 214, 337, 295, 238, 254, 59, 60, + 59, 60, 39, 263, 266, 248, 227, 146, 268, 269, + 149, 9, 14, 152, 72, 71, 237, 238, 1, 276, + 241, 242, 265, 6, 41, 368, 288, 70, 371, 10, + 273, 13, 14, 254, 15, 207, 70, 339, 298, 70, + 4, 70, 77, 146, 70, 217, 149, 307, 71, 152, + 27, 311, 11, 14, 226, 276, 304, 70, 318, 21, + 41, 312, 44, 45, 14, 308, 57, 76, 7, 7, + 209, 210, 30, 55, 213, 339, 215, 320, 59, 60, + 314, 220, 25, 356, 256, 306, 346, 308, 260, 167, + 288, 314, 61, 62, 63, 64, 65, -1, -1, 68, + 360, 322, -1, 326, -1, -1, 209, 210, -1, 248, + 213, -1, 215, 285, -1, -1, -1, 220, -1, -1, + 292, 293, -1, -1, 296, -1, 265, 348, 7, 8, + 9, 61, 62, 63, 64, 65, -1, -1, 68, -1, + -1, 10, -1, -1, -1, 248, 15, 319, 326, 321, + -1, 323, -1, -1, -1, 327, 328, 329, -1, 331, + 0, 1, 265, 3, 4, -1, -1, 7, 8, -1, + -1, -1, 41, 42, 43, -1, 55, -1, 18, 19, + -1, -1, 61, 62, -1, 64, 358, 56, -1, 361, + 59, 60, -1, 365, -1, 367, 36, 37, 38, 39, + -1, -1, 71, -1, 44, 45, 46, 47, 48, -1, + -1, -1, -1, -1, 54, 55, -1, -1, -1, -1, + -1, 61, 62, -1, 64, -1, 66, -1, -1, 69, + 70, -1, 72, -1, -1, 75, 1, 77, 3, 4, -1, -1, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, -1, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, 39, 40, -1, -1, -1, 44, - 45, 46, 47, -1, -1, -1, -1, -1, 53, 54, - -1, -1, -1, -1, -1, 60, 61, -1, 63, -1, - 65, -1, -1, 68, 69, -1, 71, -1, -1, 74, - 75, 76, 1, -1, 3, 4, -1, -1, 7, 8, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 20, -1, 22, 23, 24, -1, -1, 27, 28, - 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, - 39, 40, -1, -1, -1, 44, 45, 46, 47, -1, - 1, -1, 3, 4, -1, 54, 7, 8, -1, -1, - 11, 60, 61, -1, 63, -1, 65, -1, -1, 68, - 69, -1, 71, -1, -1, 74, 75, 76, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, - -1, -1, -1, 44, 45, 46, 47, -1, -1, -1, - -1, -1, 53, 54, -1, -1, -1, -1, -1, 60, - 61, -1, 63, -1, 65, -1, -1, 68, 69, 70, - 71, -1, 3, 4, -1, 76, 7, 8, -1, -1, + 45, 46, 47, -1, -1, -1, -1, -1, -1, 54, + 55, -1, -1, -1, -1, -1, 61, 62, -1, 64, + -1, 66, -1, -1, 69, 70, -1, 72, -1, -1, + 75, 76, 77, 1, -1, 3, 4, -1, -1, 7, + 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 20, -1, 22, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, + -1, 39, 40, -1, -1, -1, 44, 45, 46, 47, + -1, -1, -1, -1, -1, -1, 54, 55, -1, -1, + -1, -1, -1, 61, 62, -1, 64, -1, 66, -1, + -1, 69, 70, -1, 72, -1, -1, 75, 76, 77, + 1, -1, 3, 4, -1, -1, 7, 8, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, + -1, 22, 23, 24, -1, -1, 27, 28, 29, 30, + 31, 32, 33, 34, 35, -1, -1, -1, 39, 40, + -1, -1, -1, 44, 45, 46, 47, -1, -1, 1, + -1, 3, 4, -1, 55, 7, 8, -1, -1, 11, + 61, 62, -1, 64, -1, 66, -1, -1, 69, 70, + -1, 72, -1, -1, 75, 76, 77, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 39, -1, -1, + -1, -1, 44, 45, 46, 47, -1, -1, -1, -1, + -1, -1, 54, 55, -1, -1, -1, -1, -1, 61, + 62, -1, 64, -1, 66, -1, -1, 69, 70, 71, + 72, -1, 3, 4, -1, 77, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, -1, 22, 23, 24, -1, -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, 3, 4, 39, 40, 7, 8, -1, 44, 45, 46, 47, -1, -1, -1, - -1, -1, -1, 54, -1, -1, -1, -1, -1, 60, - 61, -1, 63, -1, 65, -1, -1, 68, 69, -1, - 71, -1, 39, 74, -1, 76, -1, 44, 45, 46, - 47, -1, 1, -1, 3, 4, -1, 54, 7, 8, - 9, -1, -1, 60, 61, -1, 63, -1, 65, -1, - -1, 68, 69, -1, 71, -1, -1, -1, -1, 76, - 1, -1, 3, 4, -1, -1, 7, 8, 9, -1, - 39, -1, -1, -1, -1, 44, 45, 46, 47, -1, - -1, -1, -1, -1, -1, 54, -1, -1, -1, -1, - -1, 60, 61, -1, 63, -1, 65, -1, 39, 68, - 69, 70, 71, 44, 45, 46, 47, -1, 1, -1, - 3, 4, -1, 54, 7, 8, -1, -1, -1, 60, - 61, -1, 63, -1, 65, -1, -1, 68, 69, -1, - 71, -1, -1, -1, -1, -1, 1, -1, 3, 4, - -1, -1, 7, 8, -1, -1, 39, -1, -1, -1, - -1, 44, 45, 46, 47, -1, -1, -1, -1, -1, - -1, 54, -1, -1, -1, -1, -1, 60, 61, -1, - 63, -1, 65, -1, 39, 68, 69, -1, 71, 44, - 45, 46, 47, -1, -1, -1, -1, 3, 4, 54, - -1, 7, 8, -1, -1, 60, 61, -1, 63, -1, - 65, -1, -1, 68, 69, -1, 71, 23, -1, -1, - -1, -1, -1, -1, -1, -1, 32, 33, -1, -1, - -1, 3, 4, 39, -1, 7, 8, -1, 44, 45, - 46, 47, -1, -1, -1, -1, -1, -1, 54, -1, - -1, 23, -1, -1, 60, 61, -1, 63, -1, 65, - 32, 33, 68, 69, -1, 71, -1, 39, -1, -1, - -1, -1, 44, 45, 46, 47, 3, 4, -1, -1, - 7, 8, 54, -1, -1, 12, -1, -1, 60, 61, - -1, 63, -1, 65, -1, -1, 68, 69, -1, 71, - -1, -1, -1, -1, 3, 4, -1, -1, 7, 8, - 9, -1, 39, -1, -1, -1, -1, 44, 45, 46, - 47, -1, -1, -1, -1, -1, 10, 54, -1, -1, - -1, 15, -1, 60, 61, -1, 63, -1, 65, -1, - 39, 68, 69, -1, 71, 44, 45, 46, 47, 3, - 4, -1, -1, 7, 8, 54, -1, 41, 42, 43, - -1, 60, 61, -1, 63, -1, 65, -1, -1, 68, - 69, 55, 71, -1, 58, 59, -1, 3, 4, -1, - -1, 7, 8, -1, -1, 39, 70, -1, -1, -1, - 44, 45, 46, 47, -1, -1, -1, -1, -1, 10, - 54, -1, -1, -1, 15, -1, 60, 61, -1, 63, - -1, 65, -1, -1, 68, 69, -1, 71, 44, 45, - 46, 47, 10, -1, -1, -1, -1, 15, 54, -1, - 41, 42, 43, -1, 60, 61, -1, 63, -1, 65, - -1, 10, 68, 69, 55, 71, 15, 58, 59, -1, - -1, 10, -1, 41, 42, 43, 15, -1, -1, -1, - -1, -1, -1, -1, -1, 76, -1, 55, -1, 57, - 58, 59, 41, 42, 43, -1, -1, -1, -1, -1, - -1, -1, 41, 42, 43, -1, 55, 56, -1, 58, - 59, -1, -1, -1, -1, -1, 55, -1, -1, 58, - 59 + -1, -1, -1, -1, 55, -1, -1, -1, -1, -1, + 61, 62, -1, 64, -1, 66, -1, -1, 69, 70, + -1, 72, 39, -1, 75, -1, 77, 44, 45, 46, + 47, -1, -1, 1, -1, 3, 4, -1, 55, 7, + 8, 9, -1, -1, 61, 62, -1, 64, -1, 66, + -1, -1, 69, 70, -1, 72, -1, -1, -1, -1, + 77, -1, 1, -1, 3, 4, -1, -1, 7, 8, + 9, 39, -1, -1, -1, -1, 44, 45, 46, 47, + -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, + -1, -1, -1, 61, 62, -1, 64, -1, 66, -1, + 39, 69, 70, 71, 72, 44, 45, 46, 47, -1, + -1, 1, -1, 3, 4, -1, 55, 7, 8, -1, + -1, -1, 61, 62, -1, 64, -1, 66, -1, -1, + 69, 70, -1, 72, -1, -1, -1, -1, -1, -1, + 1, -1, 3, 4, -1, -1, 7, 8, -1, 39, + -1, -1, -1, -1, 44, 45, 46, 47, -1, -1, + -1, -1, -1, -1, 10, 55, -1, -1, -1, 15, + -1, 61, 62, -1, 64, -1, 66, -1, 39, 69, + 70, -1, 72, 44, 45, 46, 47, 3, 4, -1, + -1, 7, 8, -1, 55, 41, 42, 43, -1, -1, + 61, 62, -1, 64, -1, 66, -1, 23, 69, 70, + 56, 72, 58, 59, 60, -1, 32, 33, -1, -1, + -1, -1, -1, 39, -1, -1, -1, -1, 44, 45, + 46, 47, 3, 4, -1, -1, 7, 8, -1, 55, + -1, -1, -1, -1, -1, 61, 62, -1, 64, -1, + 66, -1, 23, 69, 70, -1, 72, -1, -1, -1, + -1, 32, 33, -1, -1, -1, -1, -1, 39, -1, + -1, -1, -1, 44, 45, 46, 47, 3, 4, -1, + -1, 7, 8, -1, 55, -1, 12, -1, -1, -1, + 61, 62, -1, 64, -1, 66, -1, -1, 69, 70, + -1, 72, -1, -1, -1, -1, 3, 4, -1, -1, + 7, 8, 9, 39, -1, -1, -1, -1, 44, 45, + 46, 47, -1, -1, -1, -1, -1, -1, 10, 55, + -1, -1, -1, 15, -1, 61, 62, -1, 64, -1, + 66, -1, 39, 69, 70, -1, 72, 44, 45, 46, + 47, 3, 4, -1, -1, 7, 8, -1, 55, 41, + 42, 43, -1, -1, 61, 62, -1, 64, -1, 66, + -1, -1, 69, 70, 56, 72, -1, 59, 60, -1, + 3, 4, -1, -1, 7, 8, -1, 39, -1, -1, + -1, -1, 44, 45, 46, 47, -1, -1, -1, -1, + -1, -1, 10, 55, -1, -1, -1, 15, -1, 61, + 62, -1, 64, -1, 66, -1, -1, 69, 70, -1, + 72, 44, 45, 46, 47, 10, -1, -1, -1, -1, + 15, -1, 55, 41, 42, 43, -1, -1, 61, 62, + -1, 64, -1, 66, -1, -1, 69, 70, 56, 72, + -1, 59, 60, -1, -1, -1, 41, 42, 43, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 77, + -1, 56, 57, -1, 59, 60 }; /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 78, 0, 1, 3, 4, 7, 8, 18, 19, - 36, 37, 38, 39, 44, 45, 46, 47, 48, 53, - 54, 60, 61, 63, 65, 68, 69, 71, 79, 83, - 87, 89, 92, 110, 122, 126, 127, 128, 129, 130, - 131, 139, 140, 69, 72, 136, 137, 138, 3, 4, - 46, 47, 71, 85, 86, 132, 140, 140, 140, 69, - 69, 71, 127, 140, 127, 127, 69, 129, 140, 1, - 117, 122, 49, 51, 52, 131, 74, 76, 84, 94, - 110, 142, 146, 84, 90, 53, 10, 15, 41, 42, - 43, 55, 57, 58, 59, 124, 125, 148, 12, 127, - 60, 61, 62, 63, 64, 67, 60, 61, 62, 63, - 64, 67, 13, 14, 44, 45, 54, 123, 1, 9, - 91, 118, 119, 120, 122, 117, 122, 17, 136, 50, - 69, 58, 112, 118, 118, 122, 44, 45, 141, 1, - 70, 144, 148, 144, 1, 6, 80, 1, 6, 81, - 1, 6, 82, 110, 111, 93, 111, 5, 91, 122, - 139, 122, 122, 122, 111, 122, 122, 39, 127, 127, - 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, - 91, 14, 122, 144, 1, 148, 73, 88, 127, 144, - 144, 122, 41, 1, 122, 1, 94, 1, 94, 1, - 94, 1, 20, 22, 23, 24, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 40, 75, 95, 96, 98, - 105, 109, 122, 142, 143, 146, 56, 132, 120, 1, - 120, 1, 4, 113, 114, 139, 69, 97, 4, 69, - 69, 69, 111, 69, 94, 94, 94, 115, 122, 94, - 111, 94, 99, 93, 145, 146, 111, 122, 144, 1, - 148, 122, 120, 121, 100, 4, 122, 122, 95, 4, - 98, 101, 94, 69, 106, 116, 117, 143, 111, 111, - 1, 4, 144, 94, 133, 134, 135, 136, 70, 144, - 144, 27, 41, 146, 117, 11, 107, 111, 17, 135, - 111, 111, 69, 139, 111, 144, 108, 95, 142, 95, - 122, 144, 122, 146, 126, 21, 102, 144, 111, 146, - 111, 111, 1, 25, 26, 103, 111, 111, 95, 111, - 101, 95, 7, 8, 60, 61, 89, 91, 104, 56, - 147, 143, 101, 144, 7, 7, 147, 111, 144, 111, - 111, 93, 111, 95, 93, 95 + 0, 79, 0, 1, 3, 4, 7, 8, 18, 19, + 36, 37, 38, 39, 44, 45, 46, 47, 48, 54, + 55, 61, 62, 64, 66, 69, 70, 72, 80, 84, + 88, 90, 93, 112, 126, 130, 131, 132, 133, 134, + 135, 143, 144, 70, 73, 140, 141, 142, 3, 4, + 46, 47, 72, 86, 87, 136, 144, 144, 144, 70, + 70, 72, 131, 144, 131, 131, 70, 133, 144, 1, + 121, 126, 49, 51, 52, 135, 75, 77, 85, 95, + 112, 146, 150, 85, 91, 54, 10, 15, 41, 42, + 43, 56, 58, 59, 60, 128, 129, 152, 12, 131, + 61, 62, 63, 64, 65, 68, 61, 62, 63, 64, + 65, 68, 13, 14, 44, 45, 55, 127, 1, 9, + 92, 122, 123, 124, 126, 121, 126, 17, 140, 50, + 70, 59, 114, 122, 122, 126, 44, 45, 145, 1, + 71, 148, 152, 148, 1, 6, 81, 1, 6, 82, + 1, 6, 83, 112, 113, 94, 113, 5, 92, 126, + 143, 126, 126, 126, 113, 126, 126, 39, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 92, 14, 126, 148, 1, 152, 74, 89, 131, 148, + 148, 126, 41, 1, 126, 1, 95, 1, 95, 1, + 95, 1, 20, 22, 23, 24, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 40, 72, 76, 96, 98, + 100, 107, 111, 126, 146, 147, 150, 57, 136, 124, + 1, 124, 1, 4, 115, 116, 143, 70, 99, 4, + 70, 70, 70, 113, 70, 95, 95, 95, 119, 126, + 95, 53, 113, 95, 101, 94, 149, 150, 113, 126, + 148, 1, 152, 126, 124, 125, 102, 4, 126, 126, + 96, 4, 100, 103, 95, 70, 70, 108, 120, 121, + 147, 113, 113, 1, 4, 148, 95, 137, 138, 139, + 140, 71, 148, 148, 27, 41, 150, 97, 121, 11, + 109, 113, 17, 139, 113, 113, 70, 143, 113, 1, + 4, 117, 118, 148, 110, 96, 146, 96, 126, 148, + 126, 150, 14, 148, 1, 152, 130, 21, 104, 148, + 113, 150, 113, 126, 113, 1, 4, 113, 1, 25, + 26, 105, 113, 113, 96, 113, 103, 96, 14, 96, + 7, 8, 61, 62, 90, 92, 106, 57, 151, 147, + 103, 148, 126, 7, 7, 151, 113, 148, 113, 113, + 94, 113, 96, 94, 96 }; /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ static const yytype_uint8 yyr1[] = { - 0, 77, 78, 78, 78, 78, 78, 79, 79, 79, - 79, 79, 79, 80, 80, 80, 81, 81, 81, 82, - 82, 82, 83, 83, 83, 83, 83, 83, 83, 84, - 85, 85, 85, 85, 86, 86, 88, 87, 90, 89, - 91, 92, 92, 93, 93, 93, 94, 94, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 96, 96, - 96, 96, 96, 97, 96, 96, 99, 98, 100, 98, - 98, 98, 101, 101, 102, 102, 102, 103, 103, 104, - 104, 104, 104, 104, 104, 105, 105, 106, 106, 107, - 108, 107, 109, 109, 110, 110, 111, 111, 112, 112, - 113, 113, 114, 114, 114, 114, 114, 115, 115, 116, - 116, 117, 117, 117, 117, 117, 117, 118, 118, 119, - 119, 119, 119, 119, 119, 120, 120, 121, 121, 122, - 122, 122, 122, 122, 122, 122, 122, 122, 122, 123, - 123, 123, 124, 124, 125, 125, 126, 126, 126, 127, - 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, - 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, - 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, - 129, 130, 130, 131, 132, 132, 133, 133, 134, 134, - 135, 136, 137, 137, 138, 139, 139, 140, 140, 141, - 141, 141, 142, 143, 144, 145, 145, 146, 147, 148 + 0, 78, 79, 79, 79, 79, 79, 80, 80, 80, + 80, 80, 80, 81, 81, 81, 82, 82, 82, 83, + 83, 83, 84, 84, 84, 84, 84, 84, 84, 85, + 86, 86, 86, 86, 87, 87, 89, 88, 91, 90, + 92, 93, 93, 94, 94, 94, 95, 95, 96, 96, + 96, 96, 96, 96, 96, 96, 96, 97, 96, 96, + 98, 98, 98, 98, 98, 99, 98, 98, 101, 100, + 102, 100, 100, 100, 103, 103, 104, 104, 104, 105, + 105, 106, 106, 106, 106, 106, 106, 107, 107, 108, + 108, 109, 110, 109, 111, 111, 112, 112, 113, 113, + 114, 114, 115, 115, 116, 116, 116, 116, 116, 117, + 117, 118, 118, 118, 118, 118, 118, 118, 119, 119, + 120, 120, 121, 121, 121, 121, 121, 121, 122, 122, + 123, 123, 123, 123, 123, 123, 124, 124, 125, 125, + 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, + 127, 127, 127, 128, 128, 129, 129, 130, 130, 130, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 132, 132, 132, 132, 132, 132, 132, 133, 133, + 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, + 133, 133, 134, 134, 135, 136, 136, 137, 137, 138, + 138, 139, 140, 141, 141, 142, 143, 143, 144, 144, + 145, 145, 145, 146, 147, 148, 149, 149, 150, 151, + 152 }; /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ @@ -1479,22 +1513,24 @@ static const yytype_int8 yyr2[] = 2, 1, 0, 1, 3, 1, 1, 1, 1, 5, 1, 1, 1, 2, 1, 1, 0, 7, 0, 3, 1, 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, 0, 2, 2, 5, 4, 1, - 2, 2, 1, 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, 0, 1, 1, - 3, 1, 2, 3, 3, 1, 1, 0, 1, 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 + 1, 9, 6, 8, 8, 12, 11, 0, 8, 1, + 2, 2, 2, 2, 3, 0, 4, 2, 0, 4, + 0, 4, 4, 1, 0, 1, 0, 2, 2, 5, + 4, 1, 2, 2, 1, 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, 1, 3, 3, 5, 1, 2, 3, 0, 1, + 0, 1, 1, 3, 1, 2, 3, 3, 0, 1, + 1, 3, 1, 2, 3, 3, 1, 1, 0, 1, + 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 }; @@ -1958,22 +1994,22 @@ yyreduce: switch (yyn) { case 2: /* program: %empty */ -#line 235 "awkgram.y" +#line 243 "awkgram.y" { yyval = NULL; } -#line 1964 "awkgram.c" +#line 2000 "awkgram.c" break; case 3: /* program: program rule */ -#line 237 "awkgram.y" +#line 245 "awkgram.y" { rule = 0; yyerrok; } -#line 1973 "awkgram.c" +#line 2009 "awkgram.c" break; case 4: /* program: program nls */ -#line 242 "awkgram.y" +#line 250 "awkgram.y" { if (yyvsp[0] != NULL) { if (yyvsp[-1] == NULL) @@ -1983,19 +2019,19 @@ yyreduce: } yyval = yyvsp[-1]; } -#line 1987 "awkgram.c" +#line 2023 "awkgram.c" break; case 5: /* program: program LEX_EOF */ -#line 252 "awkgram.y" +#line 260 "awkgram.y" { next_sourcefile(); } -#line 1995 "awkgram.c" +#line 2031 "awkgram.c" break; case 6: /* program: program error */ -#line 256 "awkgram.y" +#line 264 "awkgram.y" { rule = 0; /* @@ -2004,11 +2040,11 @@ yyreduce: */ /* yyerrok; */ } -#line 2008 "awkgram.c" +#line 2044 "awkgram.c" break; case 7: /* rule: pattern action */ -#line 268 "awkgram.y" +#line 276 "awkgram.y" { (void) append_rule(yyvsp[-1], yyvsp[0]); if (pending_comment != NULL) { @@ -2016,11 +2052,11 @@ yyreduce: pending_comment = NULL; } } -#line 2020 "awkgram.c" +#line 2056 "awkgram.c" break; case 8: /* rule: pattern statement_term */ -#line 276 "awkgram.y" +#line 284 "awkgram.y" { if (rule != Rule) { msg(_("%s blocks must have an action part"), ruletab[rule]); @@ -2034,11 +2070,11 @@ yyreduce: (void) append_rule(yyvsp[-1], NULL); } } -#line 2038 "awkgram.c" +#line 2074 "awkgram.c" break; case 9: /* rule: function_prologue action */ -#line 290 "awkgram.y" +#line 298 "awkgram.y" { in_function = false; (void) mk_function(yyvsp[-1], yyvsp[0]); @@ -2049,11 +2085,11 @@ yyreduce: } yyerrok; } -#line 2053 "awkgram.c" +#line 2089 "awkgram.c" break; case 10: /* rule: '@' LEX_INCLUDE source statement_term */ -#line 301 "awkgram.y" +#line 309 "awkgram.y" { want_source = false; at_seen--; @@ -2063,11 +2099,11 @@ yyreduce: } yyerrok; } -#line 2067 "awkgram.c" +#line 2103 "awkgram.c" break; case 11: /* rule: '@' LEX_LOAD library statement_term */ -#line 311 "awkgram.y" +#line 319 "awkgram.y" { want_source = false; at_seen--; @@ -2077,11 +2113,11 @@ yyreduce: } yyerrok; } -#line 2081 "awkgram.c" +#line 2117 "awkgram.c" break; case 12: /* rule: '@' LEX_NAMESPACE namespace statement_term */ -#line 321 "awkgram.y" +#line 329 "awkgram.y" { /* * 1/2022: @@ -2104,11 +2140,11 @@ yyreduce: yyerrok; } -#line 2108 "awkgram.c" +#line 2144 "awkgram.c" break; case 13: /* source: FILENAME */ -#line 347 "awkgram.y" +#line 355 "awkgram.y" { void *srcfile = NULL; @@ -2118,23 +2154,23 @@ yyreduce: bcfree(yyvsp[0]); yyval = (INSTRUCTION *) srcfile; } -#line 2122 "awkgram.c" +#line 2158 "awkgram.c" break; case 14: /* source: FILENAME error */ -#line 357 "awkgram.y" +#line 365 "awkgram.y" { yyval = NULL; } -#line 2128 "awkgram.c" +#line 2164 "awkgram.c" break; case 15: /* source: error */ -#line 359 "awkgram.y" +#line 367 "awkgram.y" { yyval = NULL; } -#line 2134 "awkgram.c" +#line 2170 "awkgram.c" break; case 16: /* library: FILENAME */ -#line 364 "awkgram.y" +#line 372 "awkgram.y" { void *srcfile; @@ -2144,58 +2180,58 @@ yyreduce: bcfree(yyvsp[0]); yyval = (INSTRUCTION *) srcfile; } -#line 2148 "awkgram.c" +#line 2184 "awkgram.c" break; case 17: /* library: FILENAME error */ -#line 374 "awkgram.y" +#line 382 "awkgram.y" { yyval = NULL; } -#line 2154 "awkgram.c" +#line 2190 "awkgram.c" break; case 18: /* library: error */ -#line 376 "awkgram.y" +#line 384 "awkgram.y" { yyval = NULL; } -#line 2160 "awkgram.c" +#line 2196 "awkgram.c" break; case 19: /* namespace: FILENAME */ -#line 381 "awkgram.y" +#line 389 "awkgram.y" { yyval = yyvsp[0]; } -#line 2166 "awkgram.c" +#line 2202 "awkgram.c" break; case 20: /* namespace: FILENAME error */ -#line 383 "awkgram.y" +#line 391 "awkgram.y" { yyval = NULL; } -#line 2172 "awkgram.c" +#line 2208 "awkgram.c" break; case 21: /* namespace: error */ -#line 385 "awkgram.y" +#line 393 "awkgram.y" { yyval = NULL; } -#line 2178 "awkgram.c" +#line 2214 "awkgram.c" break; case 22: /* pattern: %empty */ -#line 390 "awkgram.y" +#line 398 "awkgram.y" { rule = Rule; yyval = NULL; } -#line 2187 "awkgram.c" +#line 2223 "awkgram.c" break; case 23: /* pattern: exp */ -#line 395 "awkgram.y" +#line 403 "awkgram.y" { rule = Rule; } -#line 2195 "awkgram.c" +#line 2231 "awkgram.c" break; case 24: /* pattern: exp comma exp */ -#line 400 "awkgram.y" +#line 408 "awkgram.y" { INSTRUCTION *tp; @@ -2225,11 +2261,11 @@ yyreduce: yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), tp); rule = Rule; } -#line 2229 "awkgram.c" +#line 2265 "awkgram.c" break; case 25: /* pattern: LEX_BEGIN */ -#line 430 "awkgram.y" +#line 438 "awkgram.y" { static int begin_seen = 0; @@ -2241,11 +2277,11 @@ yyreduce: yyvsp[0]->source_file = source; yyval = yyvsp[0]; } -#line 2245 "awkgram.c" +#line 2281 "awkgram.c" break; case 26: /* pattern: LEX_END */ -#line 442 "awkgram.y" +#line 450 "awkgram.y" { static int end_seen = 0; @@ -2257,31 +2293,31 @@ yyreduce: yyvsp[0]->source_file = source; yyval = yyvsp[0]; } -#line 2261 "awkgram.c" +#line 2297 "awkgram.c" break; case 27: /* pattern: LEX_BEGINFILE */ -#line 454 "awkgram.y" +#line 462 "awkgram.y" { yyvsp[0]->in_rule = rule = BEGINFILE; yyvsp[0]->source_file = source; yyval = yyvsp[0]; } -#line 2271 "awkgram.c" +#line 2307 "awkgram.c" break; case 28: /* pattern: LEX_ENDFILE */ -#line 460 "awkgram.y" +#line 468 "awkgram.y" { yyvsp[0]->in_rule = rule = ENDFILE; yyvsp[0]->source_file = source; yyval = yyvsp[0]; } -#line 2281 "awkgram.c" +#line 2317 "awkgram.c" break; case 29: /* action: l_brace statements r_brace opt_semi opt_nls */ -#line 469 "awkgram.y" +#line 477 "awkgram.y" { INSTRUCTION *ip = make_braced_statements(yyvsp[-4], yyvsp[-3], yyvsp[-2]); @@ -2296,11 +2332,11 @@ yyreduce: yyval = ip; } -#line 2300 "awkgram.c" +#line 2336 "awkgram.c" break; case 31: /* func_name: FUNC_CALL */ -#line 488 "awkgram.y" +#line 496 "awkgram.y" { const char *name = yyvsp[0]->lextok; char *qname = qualify_name(name, strlen(name)); @@ -2311,36 +2347,36 @@ yyreduce: } yyval = yyvsp[0]; } -#line 2315 "awkgram.c" +#line 2351 "awkgram.c" break; case 32: /* func_name: lex_builtin */ -#line 499 "awkgram.y" +#line 507 "awkgram.y" { yyerror(_("`%s' is a built-in function, it cannot be redefined"), tokstart); YYABORT; } -#line 2325 "awkgram.c" +#line 2361 "awkgram.c" break; case 33: /* func_name: '@' LEX_EVAL */ -#line 505 "awkgram.y" +#line 513 "awkgram.y" { yyval = yyvsp[0]; at_seen--; } -#line 2334 "awkgram.c" +#line 2370 "awkgram.c" break; case 36: /* $@1: %empty */ -#line 517 "awkgram.y" +#line 525 "awkgram.y" { want_param_names = FUNC_HEADER; } -#line 2340 "awkgram.c" +#line 2376 "awkgram.c" break; case 37: /* function_prologue: LEX_FUNCTION func_name '(' $@1 opt_param_list r_paren opt_nls */ -#line 518 "awkgram.y" +#line 526 "awkgram.y" { INSTRUCTION *func_comment = NULL; // Merge any comments found in the parameter list with those @@ -2357,26 +2393,28 @@ yyreduce: yyvsp[-6]->source_file = source; yyvsp[-6]->comment = func_comment; + /* Clear out lexical allocator, just in case */ + let_stack = let_free = NULL; if (install_function(yyvsp[-5]->lextok, yyvsp[-6], yyvsp[-2]) < 0) YYABORT; - in_function = true; + in_function = yyvsp[-6]; yyvsp[-5]->lextok = NULL; bcfree(yyvsp[-5]); /* $5 already free'd in install_function */ yyval = yyvsp[-6]; want_param_names = FUNC_BODY; } -#line 2370 "awkgram.c" +#line 2408 "awkgram.c" break; case 38: /* $@2: %empty */ -#line 551 "awkgram.y" +#line 561 "awkgram.y" { want_regexp = true; } -#line 2376 "awkgram.c" +#line 2414 "awkgram.c" break; case 39: /* regexp: a_slash $@2 REGEXP */ -#line 553 "awkgram.y" +#line 563 "awkgram.y" { NODE *n, *exp; char *re; @@ -2405,11 +2443,11 @@ yyreduce: yyval->opcode = Op_match_rec; yyval->memory = n; } -#line 2409 "awkgram.c" +#line 2447 "awkgram.c" break; case 40: /* typed_regexp: TYPED_REGEXP */ -#line 585 "awkgram.y" +#line 595 "awkgram.y" { char *re; size_t len; @@ -2422,23 +2460,23 @@ yyreduce: yyval->opcode = Op_push_re; yyval->memory = make_typed_regex(re, len); } -#line 2426 "awkgram.c" +#line 2464 "awkgram.c" break; case 41: /* a_slash: '/' */ -#line 600 "awkgram.y" +#line 610 "awkgram.y" { bcfree(yyvsp[0]); } -#line 2432 "awkgram.c" +#line 2470 "awkgram.c" break; case 43: /* statements: %empty */ -#line 606 "awkgram.y" +#line 616 "awkgram.y" { yyval = NULL; } -#line 2438 "awkgram.c" +#line 2476 "awkgram.c" break; case 44: /* statements: statements statement */ -#line 608 "awkgram.y" +#line 618 "awkgram.y" { if (yyvsp[0] == NULL) { yyval = yyvsp[-1]; @@ -2458,29 +2496,29 @@ yyreduce: yyerrok; } -#line 2462 "awkgram.c" +#line 2500 "awkgram.c" break; case 45: /* statements: statements error */ -#line 628 "awkgram.y" +#line 638 "awkgram.y" { yyval = NULL; } -#line 2468 "awkgram.c" +#line 2506 "awkgram.c" break; case 46: /* statement_term: nls */ -#line 632 "awkgram.y" +#line 642 "awkgram.y" { yyval = yyvsp[0]; } -#line 2474 "awkgram.c" +#line 2512 "awkgram.c" break; case 47: /* statement_term: semi opt_nls */ -#line 633 "awkgram.y" +#line 643 "awkgram.y" { yyval = yyvsp[0]; } -#line 2480 "awkgram.c" +#line 2518 "awkgram.c" break; case 48: /* statement: semi opt_nls */ -#line 638 "awkgram.y" +#line 648 "awkgram.y" { if (yyvsp[0] != NULL) { INSTRUCTION *ip; @@ -2491,31 +2529,31 @@ yyreduce: } else yyval = NULL; } -#line 2495 "awkgram.c" +#line 2533 "awkgram.c" break; case 49: /* statement: l_brace statements r_brace */ -#line 649 "awkgram.y" +#line 659 "awkgram.y" { trailing_comment = yyvsp[0]; // NULL or comment yyval = make_braced_statements(yyvsp[-2], yyvsp[-1], yyvsp[0]); } -#line 2504 "awkgram.c" +#line 2542 "awkgram.c" break; case 50: /* statement: if_statement */ -#line 654 "awkgram.y" +#line 664 "awkgram.y" { if (do_pretty_print) yyval = list_prepend(yyvsp[0], instruction(Op_exec_count)); else yyval = yyvsp[0]; } -#line 2515 "awkgram.c" +#line 2553 "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" +#line 671 "awkgram.y" { INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt; INSTRUCTION *ip, *nextc, *tbreak; @@ -2623,11 +2661,11 @@ yyreduce: break_allowed--; fix_break_continue(ip, tbreak, NULL); } -#line 2627 "awkgram.c" +#line 2665 "awkgram.c" break; case 52: /* statement: LEX_WHILE '(' exp r_paren opt_nls statement */ -#line 769 "awkgram.y" +#line 779 "awkgram.y" { /* * ----------------- @@ -2644,6 +2682,8 @@ yyreduce: INSTRUCTION *ip, *tbreak, *tcont; + in_loop--; + tbreak = instruction(Op_no_op); add_lint(yyvsp[-3], LINT_assign_in_cond); tcont = yyvsp[-3]->nexti; @@ -2678,11 +2718,11 @@ yyreduce: continue_allowed--; fix_break_continue(ip, tbreak, tcont); } -#line 2682 "awkgram.c" +#line 2722 "awkgram.c" break; case 53: /* statement: LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren opt_nls */ -#line 820 "awkgram.y" +#line 832 "awkgram.y" { /* * ----------------- @@ -2698,6 +2738,8 @@ yyreduce: INSTRUCTION *ip, *tbreak, *tcont; + in_loop--; + tbreak = instruction(Op_no_op); tcont = yyvsp[-2]->nexti; add_lint(yyvsp[-2], LINT_assign_in_cond); @@ -2732,15 +2774,17 @@ yyreduce: /* else $1 and $4 are NULLs */ } -#line 2736 "awkgram.c" +#line 2778 "awkgram.c" break; case 54: /* statement: LEX_FOR '(' NAME LEX_IN simple_variable r_paren opt_nls statement */ -#line 870 "awkgram.y" +#line 884 "awkgram.y" { INSTRUCTION *ip; char *var_name = yyvsp[-5]->lextok; + in_loop--; + if (yyvsp[0] != NULL && yyvsp[0]->lasti->opcode == Op_K_delete && yyvsp[0]->lasti->expr_count == 1 @@ -2862,12 +2906,14 @@ regular_loop: break_allowed--; continue_allowed--; } -#line 2866 "awkgram.c" +#line 2910 "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" +#line 1012 "awkgram.y" { + in_loop--; + if (yyvsp[-7] != NULL) { merge_comments(yyvsp[-7], NULL); yyvsp[-11]->comment = yyvsp[-7]; @@ -2888,12 +2934,14 @@ regular_loop: break_allowed--; continue_allowed--; } -#line 2892 "awkgram.c" +#line 2938 "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" +#line 1036 "awkgram.y" { + in_loop--; + if (yyvsp[-6] != NULL) { merge_comments(yyvsp[-6], NULL); yyvsp[-10]->comment = yyvsp[-6]; @@ -2913,22 +2961,73 @@ regular_loop: break_allowed--; continue_allowed--; } -#line 2917 "awkgram.c" +#line 2965 "awkgram.c" break; - case 57: /* statement: non_compound_stmt */ -#line 1039 "awkgram.y" + case 57: /* $@3: %empty */ +#line 1059 "awkgram.y" + { + /* Trick: remember current let stack top in LEX_LET token, + * which is an INSTRUCTION of Op_type_sym. All the lets get + * pushed onto this stack. If we know the old top, we can then + * tear them down. + */ + yyvsp[-1]->memory = let_stack; + } +#line 2978 "awkgram.c" + break; + + case 58: /* statement: '@' LEX_LET '(' $@3 let_var_list_opt r_paren opt_nls statement */ +#line 1068 "awkgram.y" + { + NODE *old_let_stack = yyvsp[-6]->memory; + NODE **pfreelist = in_function ? &let_free : &let_gfree; + NODE *freelist = *pfreelist; + + if (yyvsp[-1] != NULL) { + merge_comments(yyvsp[-1], NULL); + yyvsp[-6]->comment = yyvsp[-1]; + } + + if (yyvsp[-3] == NULL) + yyval = yyvsp[0]; + else if (yyvsp[0] == NULL) + yyval = yyvsp[-3]; + else + yyval = list_merge(yyvsp[-3], yyvsp[0]); + + /* Let block is processed; remove the variables */ + while (let_stack != old_let_stack) { + NODE *let = let_stack; + /* pop from let stack */ + let_stack = let->nxparam; + /* push onto free list */ + let->nxparam = freelist; + freelist = let; + /* scrub from symbol table */ + remove_let(let); + } + + *pfreelist = freelist; + + yyerrok; + } +#line 3016 "awkgram.c" + break; + + case 59: /* statement: non_compound_stmt */ +#line 1102 "awkgram.y" { if (do_pretty_print) yyval = list_prepend(yyvsp[0], instruction(Op_exec_count)); else yyval = yyvsp[0]; } -#line 2928 "awkgram.c" +#line 3027 "awkgram.c" break; - case 58: /* non_compound_stmt: LEX_BREAK statement_term */ -#line 1049 "awkgram.y" + case 60: /* non_compound_stmt: LEX_BREAK statement_term */ +#line 1112 "awkgram.y" { if (! break_allowed) error_ln(yyvsp[-1]->source_line, @@ -2938,11 +3037,11 @@ regular_loop: if (yyvsp[0] != NULL) yyval = list_append(yyval, yyvsp[0]); } -#line 2942 "awkgram.c" +#line 3041 "awkgram.c" break; - case 59: /* non_compound_stmt: LEX_CONTINUE statement_term */ -#line 1059 "awkgram.y" + case 61: /* non_compound_stmt: LEX_CONTINUE statement_term */ +#line 1122 "awkgram.y" { if (! continue_allowed) error_ln(yyvsp[-1]->source_line, @@ -2952,11 +3051,11 @@ regular_loop: if (yyvsp[0] != NULL) yyval = list_append(yyval, yyvsp[0]); } -#line 2956 "awkgram.c" +#line 3055 "awkgram.c" break; - case 60: /* non_compound_stmt: LEX_NEXT statement_term */ -#line 1069 "awkgram.y" + case 62: /* non_compound_stmt: LEX_NEXT statement_term */ +#line 1132 "awkgram.y" { /* if inside function (rule = 0), resolve context at run-time */ if (rule && rule != Rule) @@ -2967,11 +3066,11 @@ regular_loop: if (yyvsp[0] != NULL) yyval = list_append(yyval, yyvsp[0]); } -#line 2971 "awkgram.c" +#line 3070 "awkgram.c" break; - case 61: /* non_compound_stmt: LEX_NEXTFILE statement_term */ -#line 1080 "awkgram.y" + case 63: /* non_compound_stmt: LEX_NEXTFILE statement_term */ +#line 1143 "awkgram.y" { /* if inside function (rule = 0), resolve context at run-time */ if (rule == BEGIN || rule == END || rule == ENDFILE) @@ -2984,11 +3083,11 @@ regular_loop: if (yyvsp[0] != NULL) yyval = list_append(yyval, yyvsp[0]); } -#line 2988 "awkgram.c" +#line 3087 "awkgram.c" break; - case 62: /* non_compound_stmt: LEX_EXIT opt_exp statement_term */ -#line 1093 "awkgram.y" + case 64: /* non_compound_stmt: LEX_EXIT opt_exp statement_term */ +#line 1156 "awkgram.y" { /* Initialize the two possible jump targets, the actual target * is resolved at run-time. @@ -3005,20 +3104,20 @@ regular_loop: if (yyvsp[0] != NULL) yyval = list_append(yyval, yyvsp[0]); } -#line 3009 "awkgram.c" +#line 3108 "awkgram.c" break; - case 63: /* $@3: %empty */ -#line 1110 "awkgram.y" + case 65: /* $@4: %empty */ +#line 1173 "awkgram.y" { if (! in_function) yyerror(_("`return' used outside function context")); } -#line 3018 "awkgram.c" +#line 3117 "awkgram.c" break; - case 64: /* non_compound_stmt: LEX_RETURN $@3 opt_fcall_exp statement_term */ -#line 1113 "awkgram.y" + case 66: /* non_compound_stmt: LEX_RETURN $@4 opt_fcall_exp statement_term */ +#line 1176 "awkgram.y" { if (called_from_eval) yyvsp[-3]->opcode = Op_K_return_from_eval; @@ -3032,28 +3131,28 @@ regular_loop: if (yyvsp[0] != NULL) yyval = list_append(yyval, yyvsp[0]); } -#line 3036 "awkgram.c" +#line 3135 "awkgram.c" break; - case 65: /* non_compound_stmt: simple_stmt statement_term */ -#line 1127 "awkgram.y" + case 67: /* non_compound_stmt: simple_stmt statement_term */ +#line 1190 "awkgram.y" { if (yyvsp[0] != NULL) yyval = list_append(yyvsp[-1], yyvsp[0]); else yyval = yyvsp[-1]; } -#line 3047 "awkgram.c" +#line 3146 "awkgram.c" break; - case 66: /* $@4: %empty */ -#line 1144 "awkgram.y" + case 68: /* $@5: %empty */ +#line 1207 "awkgram.y" { in_print = true; in_parens = 0; } -#line 3053 "awkgram.c" +#line 3152 "awkgram.c" break; - case 67: /* simple_stmt: print $@4 print_expression_list output_redir */ -#line 1145 "awkgram.y" + case 69: /* simple_stmt: print $@5 print_expression_list output_redir */ +#line 1208 "awkgram.y" { /* * Optimization: plain `print' has no expression list, so $3 is null. @@ -3154,17 +3253,17 @@ regular_print: } } } -#line 3158 "awkgram.c" +#line 3257 "awkgram.c" break; - case 68: /* $@5: %empty */ -#line 1246 "awkgram.y" + case 70: /* $@6: %empty */ +#line 1309 "awkgram.y" { sub_counter = 0; } -#line 3164 "awkgram.c" +#line 3263 "awkgram.c" break; - case 69: /* simple_stmt: LEX_DELETE NAME $@5 delete_subscript_list */ -#line 1247 "awkgram.y" + case 71: /* simple_stmt: LEX_DELETE NAME $@6 delete_subscript_list */ +#line 1310 "awkgram.y" { char *arr = yyvsp[-2]->lextok; @@ -3197,11 +3296,11 @@ regular_print: yyval = list_append(list_append(yyvsp[0], yyvsp[-2]), yyvsp[-3]); } } -#line 3201 "awkgram.c" +#line 3300 "awkgram.c" break; - case 70: /* simple_stmt: LEX_DELETE '(' NAME ')' */ -#line 1284 "awkgram.y" + case 72: /* simple_stmt: LEX_DELETE '(' NAME ')' */ +#line 1347 "awkgram.y" { static bool warned = false; char *arr = yyvsp[-1]->lextok; @@ -3227,54 +3326,54 @@ regular_print: fatal(_("`delete' is not allowed with FUNCTAB")); } } -#line 3231 "awkgram.c" +#line 3330 "awkgram.c" break; - case 71: /* simple_stmt: exp */ -#line 1310 "awkgram.y" + case 73: /* simple_stmt: exp */ +#line 1373 "awkgram.y" { yyval = optimize_assignment(yyvsp[0]); } -#line 3239 "awkgram.c" +#line 3338 "awkgram.c" break; - case 72: /* opt_simple_stmt: %empty */ -#line 1317 "awkgram.y" + case 74: /* opt_simple_stmt: %empty */ +#line 1380 "awkgram.y" { yyval = NULL; } -#line 3245 "awkgram.c" +#line 3344 "awkgram.c" break; - case 73: /* opt_simple_stmt: simple_stmt */ -#line 1319 "awkgram.y" + case 75: /* opt_simple_stmt: simple_stmt */ +#line 1382 "awkgram.y" { yyval = yyvsp[0]; } -#line 3251 "awkgram.c" +#line 3350 "awkgram.c" break; - case 74: /* case_statements: %empty */ -#line 1324 "awkgram.y" + case 76: /* case_statements: %empty */ +#line 1387 "awkgram.y" { yyval = NULL; } -#line 3257 "awkgram.c" +#line 3356 "awkgram.c" break; - case 75: /* case_statements: case_statements case_statement */ -#line 1326 "awkgram.y" + case 77: /* case_statements: case_statements case_statement */ +#line 1389 "awkgram.y" { if (yyvsp[-1] == NULL) yyval = list_create(yyvsp[0]); else yyval = list_prepend(yyvsp[-1], yyvsp[0]); } -#line 3268 "awkgram.c" +#line 3367 "awkgram.c" break; - case 76: /* case_statements: case_statements error */ -#line 1333 "awkgram.y" + case 78: /* case_statements: case_statements error */ +#line 1396 "awkgram.y" { yyval = NULL; } -#line 3274 "awkgram.c" +#line 3373 "awkgram.c" break; - case 77: /* case_statement: LEX_CASE case_value colon opt_nls statements */ -#line 1338 "awkgram.y" + case 79: /* case_statement: LEX_CASE case_value colon opt_nls statements */ +#line 1401 "awkgram.y" { INSTRUCTION *casestmt = yyvsp[0]; if (yyvsp[0] == NULL) @@ -3287,11 +3386,11 @@ regular_print: bcfree(yyvsp[-2]); yyval = yyvsp[-4]; } -#line 3291 "awkgram.c" +#line 3390 "awkgram.c" break; - case 78: /* case_statement: LEX_DEFAULT colon opt_nls statements */ -#line 1351 "awkgram.y" + case 80: /* case_statement: LEX_DEFAULT colon opt_nls statements */ +#line 1414 "awkgram.y" { INSTRUCTION *casestmt = yyvsp[0]; if (yyvsp[0] == NULL) @@ -3303,17 +3402,17 @@ regular_print: yyvsp[-3]->comment = yyvsp[-1]; yyval = yyvsp[-3]; } -#line 3307 "awkgram.c" +#line 3406 "awkgram.c" break; - case 79: /* case_value: YNUMBER */ -#line 1366 "awkgram.y" + case 81: /* case_value: YNUMBER */ +#line 1429 "awkgram.y" { yyval = yyvsp[0]; } -#line 3313 "awkgram.c" +#line 3412 "awkgram.c" break; - case 80: /* case_value: '-' YNUMBER */ -#line 1368 "awkgram.y" + case 82: /* case_value: '-' YNUMBER */ +#line 1431 "awkgram.y" { NODE *n = yyvsp[0]->memory; (void) force_number(n); @@ -3321,28 +3420,28 @@ regular_print: bcfree(yyvsp[-1]); yyval = yyvsp[0]; } -#line 3325 "awkgram.c" +#line 3424 "awkgram.c" break; - case 81: /* case_value: '+' YNUMBER */ -#line 1376 "awkgram.y" + case 83: /* case_value: '+' YNUMBER */ +#line 1439 "awkgram.y" { NODE *n = yyvsp[0]->lasti->memory; bcfree(yyvsp[-1]); add_sign_to_num(n, '+'); yyval = yyvsp[0]; } -#line 3336 "awkgram.c" +#line 3435 "awkgram.c" break; - case 82: /* case_value: YSTRING */ -#line 1383 "awkgram.y" + case 84: /* case_value: YSTRING */ +#line 1446 "awkgram.y" { yyval = yyvsp[0]; } -#line 3342 "awkgram.c" +#line 3441 "awkgram.c" break; - case 83: /* case_value: regexp */ -#line 1385 "awkgram.y" + case 85: /* case_value: regexp */ +#line 1448 "awkgram.y" { if (yyvsp[0]->memory->type == Node_regex) yyvsp[0]->opcode = Op_push_re; @@ -3350,57 +3449,57 @@ regular_print: yyvsp[0]->opcode = Op_push; yyval = yyvsp[0]; } -#line 3354 "awkgram.c" +#line 3453 "awkgram.c" break; - case 84: /* case_value: typed_regexp */ -#line 1393 "awkgram.y" + case 86: /* case_value: typed_regexp */ +#line 1456 "awkgram.y" { assert((yyvsp[0]->memory->flags & REGEX) == REGEX); yyvsp[0]->opcode = Op_push_re; yyval = yyvsp[0]; } -#line 3364 "awkgram.c" +#line 3463 "awkgram.c" break; - case 85: /* print: LEX_PRINT */ -#line 1402 "awkgram.y" + case 87: /* print: LEX_PRINT */ +#line 1465 "awkgram.y" { yyval = yyvsp[0]; } -#line 3370 "awkgram.c" +#line 3469 "awkgram.c" break; - case 86: /* print: LEX_PRINTF */ -#line 1404 "awkgram.y" + case 88: /* print: LEX_PRINTF */ +#line 1467 "awkgram.y" { yyval = yyvsp[0]; } -#line 3376 "awkgram.c" +#line 3475 "awkgram.c" break; - case 88: /* print_expression_list: '(' expression_list r_paren */ -#line 1414 "awkgram.y" + case 90: /* print_expression_list: '(' expression_list r_paren */ +#line 1477 "awkgram.y" { yyval = yyvsp[-1]; } -#line 3384 "awkgram.c" +#line 3483 "awkgram.c" break; - case 89: /* output_redir: %empty */ -#line 1421 "awkgram.y" + case 91: /* output_redir: %empty */ +#line 1484 "awkgram.y" { in_print = false; in_parens = 0; yyval = NULL; } -#line 3394 "awkgram.c" +#line 3493 "awkgram.c" break; - case 90: /* $@6: %empty */ -#line 1426 "awkgram.y" + case 92: /* $@7: %empty */ +#line 1489 "awkgram.y" { in_print = false; in_parens = 0; } -#line 3400 "awkgram.c" +#line 3499 "awkgram.c" break; - case 91: /* output_redir: IO_OUT $@6 common_exp */ -#line 1427 "awkgram.y" + case 93: /* output_redir: IO_OUT $@7 common_exp */ +#line 1490 "awkgram.y" { if (yyvsp[-2]->redir_type == redirect_twoway && yyvsp[0]->lasti->opcode == Op_K_getline_redir @@ -3410,22 +3509,22 @@ regular_print: lintwarn(_("concatenation as I/O `>' redirection target is ambiguous")); yyval = list_prepend(yyvsp[0], yyvsp[-2]); } -#line 3414 "awkgram.c" +#line 3513 "awkgram.c" break; - case 92: /* if_statement: LEX_IF '(' exp r_paren opt_nls statement */ -#line 1440 "awkgram.y" + case 94: /* if_statement: LEX_IF '(' exp r_paren opt_nls statement */ +#line 1503 "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 3425 "awkgram.c" +#line 3524 "awkgram.c" break; - case 93: /* if_statement: LEX_IF '(' exp r_paren opt_nls statement LEX_ELSE opt_nls statement */ -#line 1448 "awkgram.y" + case 95: /* if_statement: LEX_IF '(' exp r_paren opt_nls statement LEX_ELSE opt_nls statement */ +#line 1511 "awkgram.y" { if (yyvsp[-4] != NULL) yyvsp[-8]->comment = yyvsp[-4]; @@ -3434,19 +3533,19 @@ regular_print: add_lint(yyvsp[-6], LINT_assign_in_cond); yyval = mk_condition(yyvsp[-6], yyvsp[-8], yyvsp[-3], yyvsp[-2], yyvsp[0]); } -#line 3438 "awkgram.c" +#line 3537 "awkgram.c" break; - case 94: /* nls: NEWLINE */ -#line 1460 "awkgram.y" + case 96: /* nls: NEWLINE */ +#line 1523 "awkgram.y" { yyval = yyvsp[0]; } -#line 3446 "awkgram.c" +#line 3545 "awkgram.c" break; - case 95: /* nls: nls NEWLINE */ -#line 1464 "awkgram.y" + case 97: /* nls: nls NEWLINE */ +#line 1527 "awkgram.y" { if (yyvsp[-1] != NULL && yyvsp[0] != NULL) { if (yyvsp[-1]->memory->comment_type == EOL_COMMENT) { @@ -3464,59 +3563,59 @@ regular_print: } else yyval = NULL; } -#line 3468 "awkgram.c" +#line 3567 "awkgram.c" break; - case 96: /* opt_nls: %empty */ -#line 1485 "awkgram.y" + case 98: /* opt_nls: %empty */ +#line 1548 "awkgram.y" { yyval = NULL; } -#line 3474 "awkgram.c" +#line 3573 "awkgram.c" break; - case 97: /* opt_nls: nls */ -#line 1487 "awkgram.y" + case 99: /* opt_nls: nls */ +#line 1550 "awkgram.y" { yyval = yyvsp[0]; } -#line 3480 "awkgram.c" +#line 3579 "awkgram.c" break; - case 98: /* input_redir: %empty */ -#line 1492 "awkgram.y" + case 100: /* input_redir: %empty */ +#line 1555 "awkgram.y" { yyval = NULL; } -#line 3486 "awkgram.c" +#line 3585 "awkgram.c" break; - case 99: /* input_redir: '<' simp_exp */ -#line 1494 "awkgram.y" + case 101: /* input_redir: '<' simp_exp */ +#line 1557 "awkgram.y" { bcfree(yyvsp[-1]); yyval = yyvsp[0]; } -#line 3495 "awkgram.c" +#line 3594 "awkgram.c" break; - case 100: /* opt_param_list: %empty */ -#line 1502 "awkgram.y" + case 102: /* opt_param_list: %empty */ +#line 1565 "awkgram.y" { yyval = NULL; } -#line 3501 "awkgram.c" +#line 3600 "awkgram.c" break; - case 101: /* opt_param_list: param_list */ -#line 1504 "awkgram.y" + case 103: /* opt_param_list: param_list */ +#line 1567 "awkgram.y" { yyval = yyvsp[0]; } -#line 3507 "awkgram.c" +#line 3606 "awkgram.c" break; - case 102: /* param_list: NAME */ -#line 1509 "awkgram.y" + case 104: /* param_list: NAME */ +#line 1572 "awkgram.y" { yyvsp[0]->param_count = 0; yyval = list_create(yyvsp[0]); } -#line 3516 "awkgram.c" +#line 3615 "awkgram.c" break; - case 103: /* param_list: param_list comma NAME */ -#line 1514 "awkgram.y" + case 105: /* param_list: param_list comma NAME */ +#line 1577 "awkgram.y" { if (yyvsp[-2] != NULL && yyvsp[0] != NULL) { yyvsp[0]->param_count = yyvsp[-2]->lasti->param_count + 1; @@ -3533,76 +3632,199 @@ regular_print: } else yyval = NULL; } -#line 3537 "awkgram.c" +#line 3636 "awkgram.c" break; - case 104: /* param_list: error */ -#line 1531 "awkgram.y" + case 106: /* param_list: error */ +#line 1594 "awkgram.y" { yyval = NULL; } -#line 3543 "awkgram.c" +#line 3642 "awkgram.c" break; - case 105: /* param_list: param_list error */ -#line 1533 "awkgram.y" + case 107: /* param_list: param_list error */ +#line 1596 "awkgram.y" { yyval = yyvsp[-1]; } -#line 3549 "awkgram.c" +#line 3648 "awkgram.c" break; - case 106: /* param_list: param_list comma error */ -#line 1535 "awkgram.y" + case 108: /* param_list: param_list comma error */ +#line 1598 "awkgram.y" { yyval = yyvsp[-2]; } -#line 3555 "awkgram.c" +#line 3654 "awkgram.c" break; - case 107: /* opt_exp: %empty */ -#line 1541 "awkgram.y" + case 109: /* let_var_list_opt: %empty */ +#line 1603 "awkgram.y" { yyval = NULL; } -#line 3561 "awkgram.c" +#line 3660 "awkgram.c" break; - case 108: /* opt_exp: exp */ -#line 1543 "awkgram.y" + case 110: /* let_var_list_opt: let_var_list */ +#line 1605 "awkgram.y" { yyval = yyvsp[0]; } -#line 3567 "awkgram.c" +#line 3666 "awkgram.c" break; - case 109: /* opt_expression_list: %empty */ -#line 1548 "awkgram.y" + case 111: /* let_var_list: NAME */ +#line 1610 "awkgram.y" + { + bool is_reused_location = add_let(in_function, yyvsp[0]); + + /* If we are not in a loop, and the variable is using + a fresh location, then we can count on that being + clear. Otherwise we have to generate code to clear it */ + if (!in_loop && !is_reused_location) { + yyval = NULL; + } else { + yyvsp[0]->opcode = Op_clear_var; + yyvsp[0]->memory = variable(yyvsp[0]->source_line, yyvsp[0]->lextok, + Node_var_new); + yyval = list_create(yyvsp[0]); + } + } +#line 3686 "awkgram.c" + break; + + case 112: /* let_var_list: let_var_list comma NAME */ +#line 1626 "awkgram.y" + { + bool is_reused_location = add_let(in_function, yyvsp[0]); + + /* If we are not in a loop, and the variable is using + a fresh location, then we can count on that being + clear. Otherwise we have to generate code to clear it */ + if (!in_loop && !is_reused_location) { + yyval = yyvsp[-2]; + } else { + yyvsp[0]->opcode = Op_clear_var; + yyvsp[0]->memory = variable(yyvsp[0]->source_line, yyvsp[0]->lextok, + Node_var_new); + + if (yyvsp[-2] == NULL) + yyval = list_create(yyvsp[0]); + else + yyval = list_append(yyvsp[-2], yyvsp[0]); + } + } +#line 3710 "awkgram.c" + break; + + case 113: /* let_var_list: NAME ASSIGN exp */ +#line 1646 "awkgram.y" + { + bool is_reused_location = add_let(in_function, yyvsp[-2]); + yyvsp[-2]->opcode = Op_push; + yyvsp[-2]->memory = variable(yyvsp[-2]->source_line, yyvsp[-2]->lextok, Node_var_new); + yyval = list_append(mk_assignment(list_create(yyvsp[-2]), yyvsp[0], yyvsp[-1]), + instruction(Op_pop)); + /* Even for initialized variables, we must emit the Op_clear_var + instruction. This is because the variable may previously have + been an array and is now being assigned as a scalar value. + the Op_clear_var will reset the type to allow that. */ + if (in_loop || is_reused_location) { + INSTRUCTION *clr = instruction(Op_clear_var); + UPREF(yyvsp[-2]->memory); + clr->memory = yyvsp[-2]->memory; + yyval = list_prepend(yyval, clr); + } + } +#line 3732 "awkgram.c" + break; + + case 114: /* let_var_list: let_var_list comma NAME ASSIGN exp */ +#line 1664 "awkgram.y" + { + INSTRUCTION *assn; + bool is_reused_location = add_let(in_function, yyvsp[-2]); + yyvsp[-2]->opcode = Op_push; + yyvsp[-2]->memory = variable(yyvsp[-2]->source_line, yyvsp[-2]->lextok, Node_var_new); + assn = list_append(mk_assignment(list_create(yyvsp[-2]), yyvsp[0], yyvsp[-1]), + instruction(Op_pop)); + if (yyvsp[-4] == NULL) + yyval = assn; + else + yyval = list_merge(yyvsp[-4], assn); + /* Even for initialized variables, we must emit the Op_clear_var + instruction. This is because the variable may previously have + been an array and is now being assigned as a scalar value. + the Op_clear_var will reset the type to allow that. */ + if (in_loop || is_reused_location) { + INSTRUCTION *clr = instruction(Op_clear_var); + UPREF(yyvsp[-2]->memory); + clr->memory = yyvsp[-2]->memory; + yyval = list_prepend(yyval, clr); + } + } +#line 3759 "awkgram.c" + break; + + case 115: /* let_var_list: error */ +#line 1687 "awkgram.y" { yyval = NULL; } -#line 3573 "awkgram.c" +#line 3765 "awkgram.c" break; - case 110: /* opt_expression_list: expression_list */ -#line 1550 "awkgram.y" + case 116: /* let_var_list: let_var_list error */ +#line 1689 "awkgram.y" + { yyval = yyvsp[-1]; } +#line 3771 "awkgram.c" + break; + + case 117: /* let_var_list: let_var_list comma error */ +#line 1691 "awkgram.y" + { yyval = yyvsp[-2]; } +#line 3777 "awkgram.c" + break; + + case 118: /* opt_exp: %empty */ +#line 1697 "awkgram.y" + { yyval = NULL; } +#line 3783 "awkgram.c" + break; + + case 119: /* opt_exp: exp */ +#line 1699 "awkgram.y" { yyval = yyvsp[0]; } -#line 3579 "awkgram.c" +#line 3789 "awkgram.c" break; - case 111: /* expression_list: exp */ -#line 1555 "awkgram.y" + case 120: /* opt_expression_list: %empty */ +#line 1704 "awkgram.y" + { yyval = NULL; } +#line 3795 "awkgram.c" + break; + + case 121: /* opt_expression_list: expression_list */ +#line 1706 "awkgram.y" + { yyval = yyvsp[0]; } +#line 3801 "awkgram.c" + break; + + case 122: /* expression_list: exp */ +#line 1711 "awkgram.y" { yyval = mk_expression_list(NULL, yyvsp[0]); } -#line 3585 "awkgram.c" +#line 3807 "awkgram.c" break; - case 112: /* expression_list: expression_list comma exp */ -#line 1557 "awkgram.y" + case 123: /* expression_list: expression_list comma exp */ +#line 1713 "awkgram.y" { if (yyvsp[-1] != NULL) yyvsp[-2]->lasti->comment = yyvsp[-1]; yyval = mk_expression_list(yyvsp[-2], yyvsp[0]); yyerrok; } -#line 3596 "awkgram.c" +#line 3818 "awkgram.c" break; - case 113: /* expression_list: error */ -#line 1564 "awkgram.y" + case 124: /* expression_list: error */ +#line 1720 "awkgram.y" { yyval = NULL; } -#line 3602 "awkgram.c" +#line 3824 "awkgram.c" break; - case 114: /* expression_list: expression_list error */ -#line 1566 "awkgram.y" + case 125: /* expression_list: expression_list error */ +#line 1722 "awkgram.y" { /* * Returning the expression list instead of NULL lets @@ -3610,66 +3832,66 @@ regular_print: */ yyval = yyvsp[-1]; } -#line 3614 "awkgram.c" +#line 3836 "awkgram.c" break; - case 115: /* expression_list: expression_list error exp */ -#line 1574 "awkgram.y" + case 126: /* expression_list: expression_list error exp */ +#line 1730 "awkgram.y" { /* Ditto */ yyval = mk_expression_list(yyvsp[-2], yyvsp[0]); } -#line 3623 "awkgram.c" +#line 3845 "awkgram.c" break; - case 116: /* expression_list: expression_list comma error */ -#line 1579 "awkgram.y" + case 127: /* expression_list: expression_list comma error */ +#line 1735 "awkgram.y" { /* Ditto */ if (yyvsp[-1] != NULL) yyvsp[-2]->lasti->comment = yyvsp[-1]; yyval = yyvsp[-2]; } -#line 3634 "awkgram.c" +#line 3856 "awkgram.c" break; - case 117: /* opt_fcall_expression_list: %empty */ -#line 1589 "awkgram.y" + case 128: /* opt_fcall_expression_list: %empty */ +#line 1745 "awkgram.y" { yyval = NULL; } -#line 3640 "awkgram.c" +#line 3862 "awkgram.c" break; - case 118: /* opt_fcall_expression_list: fcall_expression_list */ -#line 1591 "awkgram.y" + case 129: /* opt_fcall_expression_list: fcall_expression_list */ +#line 1747 "awkgram.y" { yyval = yyvsp[0]; } -#line 3646 "awkgram.c" +#line 3868 "awkgram.c" break; - case 119: /* fcall_expression_list: fcall_exp */ -#line 1596 "awkgram.y" + case 130: /* fcall_expression_list: fcall_exp */ +#line 1752 "awkgram.y" { yyval = mk_expression_list(NULL, yyvsp[0]); } -#line 3652 "awkgram.c" +#line 3874 "awkgram.c" break; - case 120: /* fcall_expression_list: fcall_expression_list comma fcall_exp */ -#line 1598 "awkgram.y" + case 131: /* fcall_expression_list: fcall_expression_list comma fcall_exp */ +#line 1754 "awkgram.y" { if (yyvsp[-1] != NULL) yyvsp[-2]->lasti->comment = yyvsp[-1]; yyval = mk_expression_list(yyvsp[-2], yyvsp[0]); yyerrok; } -#line 3663 "awkgram.c" +#line 3885 "awkgram.c" break; - case 121: /* fcall_expression_list: error */ -#line 1605 "awkgram.y" + case 132: /* fcall_expression_list: error */ +#line 1761 "awkgram.y" { yyval = NULL; } -#line 3669 "awkgram.c" +#line 3891 "awkgram.c" break; - case 122: /* fcall_expression_list: fcall_expression_list error */ -#line 1607 "awkgram.y" + case 133: /* fcall_expression_list: fcall_expression_list error */ +#line 1763 "awkgram.y" { /* * Returning the expression list instead of NULL lets @@ -3677,86 +3899,86 @@ regular_print: */ yyval = yyvsp[-1]; } -#line 3681 "awkgram.c" +#line 3903 "awkgram.c" break; - case 123: /* fcall_expression_list: fcall_expression_list error fcall_exp */ -#line 1615 "awkgram.y" + case 134: /* fcall_expression_list: fcall_expression_list error fcall_exp */ +#line 1771 "awkgram.y" { /* Ditto */ yyval = mk_expression_list(yyvsp[-2], yyvsp[0]); } -#line 3690 "awkgram.c" +#line 3912 "awkgram.c" break; - case 124: /* fcall_expression_list: fcall_expression_list comma error */ -#line 1620 "awkgram.y" + case 135: /* fcall_expression_list: fcall_expression_list comma error */ +#line 1776 "awkgram.y" { /* Ditto */ if (yyvsp[-1] != NULL) yyvsp[-2]->comment = yyvsp[-1]; yyval = yyvsp[-2]; } -#line 3701 "awkgram.c" +#line 3923 "awkgram.c" break; - case 125: /* fcall_exp: exp */ -#line 1629 "awkgram.y" + case 136: /* fcall_exp: exp */ +#line 1785 "awkgram.y" { yyval = yyvsp[0]; } -#line 3707 "awkgram.c" +#line 3929 "awkgram.c" break; - case 126: /* fcall_exp: typed_regexp */ -#line 1630 "awkgram.y" + case 137: /* fcall_exp: typed_regexp */ +#line 1786 "awkgram.y" { yyval = list_create(yyvsp[0]); } -#line 3713 "awkgram.c" +#line 3935 "awkgram.c" break; - case 127: /* opt_fcall_exp: %empty */ -#line 1635 "awkgram.y" + case 138: /* opt_fcall_exp: %empty */ +#line 1791 "awkgram.y" { yyval = NULL; } -#line 3719 "awkgram.c" +#line 3941 "awkgram.c" break; - case 128: /* opt_fcall_exp: fcall_exp */ -#line 1636 "awkgram.y" + case 139: /* opt_fcall_exp: fcall_exp */ +#line 1792 "awkgram.y" { yyval = yyvsp[0]; } -#line 3725 "awkgram.c" +#line 3947 "awkgram.c" break; - case 129: /* exp: variable assign_operator exp */ -#line 1642 "awkgram.y" + case 140: /* exp: variable assign_operator exp */ +#line 1798 "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 3736 "awkgram.c" +#line 3958 "awkgram.c" break; - case 130: /* exp: variable ASSIGN typed_regexp */ -#line 1649 "awkgram.y" + case 141: /* exp: variable ASSIGN typed_regexp */ +#line 1805 "awkgram.y" { yyval = mk_assignment(yyvsp[-2], list_create(yyvsp[0]), yyvsp[-1]); } -#line 3744 "awkgram.c" +#line 3966 "awkgram.c" break; - case 131: /* exp: exp LEX_AND exp */ -#line 1653 "awkgram.y" + case 142: /* exp: exp LEX_AND exp */ +#line 1809 "awkgram.y" { yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3750 "awkgram.c" +#line 3972 "awkgram.c" break; - case 132: /* exp: exp LEX_OR exp */ -#line 1655 "awkgram.y" + case 143: /* exp: exp LEX_OR exp */ +#line 1811 "awkgram.y" { yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3756 "awkgram.c" +#line 3978 "awkgram.c" break; - case 133: /* exp: exp MATCHOP typed_regexp */ -#line 1657 "awkgram.y" + case 144: /* exp: exp MATCHOP typed_regexp */ +#line 1813 "awkgram.y" { if (yyvsp[-2]->lasti->opcode == Op_match_rec) warning_ln(yyvsp[-1]->source_line, @@ -3769,11 +3991,11 @@ regular_print: bcfree(yyvsp[0]); yyval = list_append(yyvsp[-2], yyvsp[-1]); } -#line 3773 "awkgram.c" +#line 3995 "awkgram.c" break; - case 134: /* exp: exp MATCHOP exp */ -#line 1670 "awkgram.y" + case 145: /* exp: exp MATCHOP exp */ +#line 1826 "awkgram.y" { if (yyvsp[-2]->lasti->opcode == Op_match_rec) warning_ln(yyvsp[-1]->source_line, @@ -3790,11 +4012,11 @@ regular_print: yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]); } } -#line 3794 "awkgram.c" +#line 4016 "awkgram.c" break; - case 135: /* exp: exp LEX_IN simple_variable */ -#line 1687 "awkgram.y" + case 146: /* exp: exp LEX_IN simple_variable */ +#line 1843 "awkgram.y" { if (do_lint_old) lintwarn_ln(yyvsp[-1]->source_line, @@ -3804,91 +4026,91 @@ regular_print: yyvsp[-1]->expr_count = 1; yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]); } -#line 3808 "awkgram.c" +#line 4030 "awkgram.c" break; - case 136: /* exp: exp a_relop exp */ -#line 1697 "awkgram.y" + case 147: /* exp: exp a_relop exp */ +#line 1853 "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 3819 "awkgram.c" +#line 4041 "awkgram.c" break; - case 137: /* exp: exp '?' exp ':' exp */ -#line 1704 "awkgram.y" + case 148: /* exp: exp '?' exp ':' exp */ +#line 1860 "awkgram.y" { yyval = mk_condition(yyvsp[-4], yyvsp[-3], yyvsp[-2], yyvsp[-1], yyvsp[0]); } -#line 3825 "awkgram.c" +#line 4047 "awkgram.c" break; - case 138: /* exp: common_exp */ -#line 1706 "awkgram.y" + case 149: /* exp: common_exp */ +#line 1862 "awkgram.y" { yyval = yyvsp[0]; } -#line 3831 "awkgram.c" +#line 4053 "awkgram.c" break; - case 139: /* assign_operator: ASSIGN */ -#line 1711 "awkgram.y" + case 150: /* assign_operator: ASSIGN */ +#line 1867 "awkgram.y" { yyval = yyvsp[0]; } -#line 3837 "awkgram.c" +#line 4059 "awkgram.c" break; - case 140: /* assign_operator: ASSIGNOP */ -#line 1713 "awkgram.y" + case 151: /* assign_operator: ASSIGNOP */ +#line 1869 "awkgram.y" { yyval = yyvsp[0]; } -#line 3843 "awkgram.c" +#line 4065 "awkgram.c" break; - case 141: /* assign_operator: SLASH_BEFORE_EQUAL ASSIGN */ -#line 1715 "awkgram.y" + case 152: /* assign_operator: SLASH_BEFORE_EQUAL ASSIGN */ +#line 1871 "awkgram.y" { yyvsp[0]->opcode = Op_assign_quotient; yyval = yyvsp[0]; } -#line 3852 "awkgram.c" +#line 4074 "awkgram.c" break; - case 142: /* relop_or_less: RELOP */ -#line 1723 "awkgram.y" + case 153: /* relop_or_less: RELOP */ +#line 1879 "awkgram.y" { yyval = yyvsp[0]; } -#line 3858 "awkgram.c" +#line 4080 "awkgram.c" break; - case 143: /* relop_or_less: '<' */ -#line 1725 "awkgram.y" + case 154: /* relop_or_less: '<' */ +#line 1881 "awkgram.y" { yyval = yyvsp[0]; } -#line 3864 "awkgram.c" +#line 4086 "awkgram.c" break; - case 144: /* a_relop: relop_or_less */ -#line 1730 "awkgram.y" + case 155: /* a_relop: relop_or_less */ +#line 1886 "awkgram.y" { yyval = yyvsp[0]; } -#line 3870 "awkgram.c" +#line 4092 "awkgram.c" break; - case 145: /* a_relop: '>' */ -#line 1732 "awkgram.y" + case 156: /* a_relop: '>' */ +#line 1888 "awkgram.y" { yyval = yyvsp[0]; } -#line 3876 "awkgram.c" +#line 4098 "awkgram.c" break; - case 146: /* common_exp: simp_exp */ -#line 1737 "awkgram.y" + case 157: /* common_exp: simp_exp */ +#line 1893 "awkgram.y" { yyval = yyvsp[0]; } -#line 3882 "awkgram.c" +#line 4104 "awkgram.c" break; - case 147: /* common_exp: simp_exp_nc */ -#line 1739 "awkgram.y" + case 158: /* common_exp: simp_exp_nc */ +#line 1895 "awkgram.y" { yyval = yyvsp[0]; } -#line 3888 "awkgram.c" +#line 4110 "awkgram.c" break; - case 148: /* common_exp: common_exp simp_exp */ -#line 1741 "awkgram.y" + case 159: /* common_exp: common_exp simp_exp */ +#line 1897 "awkgram.y" { int count = 2; bool is_simple_var = false; @@ -3942,47 +4164,47 @@ regular_print: max_args = count; } } -#line 3946 "awkgram.c" +#line 4168 "awkgram.c" break; - case 150: /* simp_exp: simp_exp '^' simp_exp */ -#line 1800 "awkgram.y" + case 161: /* simp_exp: simp_exp '^' simp_exp */ +#line 1956 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3952 "awkgram.c" +#line 4174 "awkgram.c" break; - case 151: /* simp_exp: simp_exp '*' simp_exp */ -#line 1802 "awkgram.y" + case 162: /* simp_exp: simp_exp '*' simp_exp */ +#line 1958 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3958 "awkgram.c" +#line 4180 "awkgram.c" break; - case 152: /* simp_exp: simp_exp '/' simp_exp */ -#line 1804 "awkgram.y" + case 163: /* simp_exp: simp_exp '/' simp_exp */ +#line 1960 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3964 "awkgram.c" +#line 4186 "awkgram.c" break; - case 153: /* simp_exp: simp_exp '%' simp_exp */ -#line 1806 "awkgram.y" + case 164: /* simp_exp: simp_exp '%' simp_exp */ +#line 1962 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3970 "awkgram.c" +#line 4192 "awkgram.c" break; - case 154: /* simp_exp: simp_exp '+' simp_exp */ -#line 1808 "awkgram.y" + case 165: /* simp_exp: simp_exp '+' simp_exp */ +#line 1964 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3976 "awkgram.c" +#line 4198 "awkgram.c" break; - case 155: /* simp_exp: simp_exp '-' simp_exp */ -#line 1810 "awkgram.y" + case 166: /* simp_exp: simp_exp '-' simp_exp */ +#line 1966 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 3982 "awkgram.c" +#line 4204 "awkgram.c" break; - case 156: /* simp_exp: LEX_GETLINE opt_variable input_redir */ -#line 1812 "awkgram.y" + case 167: /* simp_exp: LEX_GETLINE opt_variable input_redir */ +#line 1968 "awkgram.y" { /* * In BEGINFILE/ENDFILE, allow `getline [var] < file' @@ -3996,29 +4218,29 @@ regular_print: _("non-redirected `getline' undefined inside END action")); yyval = mk_getline(yyvsp[-2], yyvsp[-1], yyvsp[0], redirect_input); } -#line 4000 "awkgram.c" +#line 4222 "awkgram.c" break; - case 157: /* simp_exp: variable INCREMENT */ -#line 1826 "awkgram.y" + case 168: /* simp_exp: variable INCREMENT */ +#line 1982 "awkgram.y" { yyvsp[0]->opcode = Op_postincrement; yyval = mk_assignment(yyvsp[-1], NULL, yyvsp[0]); } -#line 4009 "awkgram.c" +#line 4231 "awkgram.c" break; - case 158: /* simp_exp: variable DECREMENT */ -#line 1831 "awkgram.y" + case 169: /* simp_exp: variable DECREMENT */ +#line 1987 "awkgram.y" { yyvsp[0]->opcode = Op_postdecrement; yyval = mk_assignment(yyvsp[-1], NULL, yyvsp[0]); } -#line 4018 "awkgram.c" +#line 4240 "awkgram.c" break; - case 159: /* simp_exp: '(' expression_list r_paren LEX_IN simple_variable */ -#line 1836 "awkgram.y" + case 170: /* simp_exp: '(' expression_list r_paren LEX_IN simple_variable */ +#line 1992 "awkgram.y" { if (do_lint_old) { /* first one is warning so that second one comes out if warnings are fatal */ @@ -4039,64 +4261,64 @@ regular_print: yyval = list_append(list_merge(t, yyvsp[0]), yyvsp[-1]); } } -#line 4043 "awkgram.c" +#line 4265 "awkgram.c" break; - case 160: /* simp_exp_nc: common_exp IO_IN LEX_GETLINE opt_variable */ -#line 1862 "awkgram.y" + case 171: /* simp_exp_nc: common_exp IO_IN LEX_GETLINE opt_variable */ +#line 2018 "awkgram.y" { yyval = mk_getline(yyvsp[-1], yyvsp[0], yyvsp[-3], yyvsp[-2]->redir_type); bcfree(yyvsp[-2]); } -#line 4052 "awkgram.c" +#line 4274 "awkgram.c" break; - case 161: /* simp_exp_nc: simp_exp_nc '^' simp_exp */ -#line 1868 "awkgram.y" + case 172: /* simp_exp_nc: simp_exp_nc '^' simp_exp */ +#line 2024 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 4058 "awkgram.c" +#line 4280 "awkgram.c" break; - case 162: /* simp_exp_nc: simp_exp_nc '*' simp_exp */ -#line 1870 "awkgram.y" + case 173: /* simp_exp_nc: simp_exp_nc '*' simp_exp */ +#line 2026 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 4064 "awkgram.c" +#line 4286 "awkgram.c" break; - case 163: /* simp_exp_nc: simp_exp_nc '/' simp_exp */ -#line 1872 "awkgram.y" + case 174: /* simp_exp_nc: simp_exp_nc '/' simp_exp */ +#line 2028 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 4070 "awkgram.c" +#line 4292 "awkgram.c" break; - case 164: /* simp_exp_nc: simp_exp_nc '%' simp_exp */ -#line 1874 "awkgram.y" + case 175: /* simp_exp_nc: simp_exp_nc '%' simp_exp */ +#line 2030 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 4076 "awkgram.c" +#line 4298 "awkgram.c" break; - case 165: /* simp_exp_nc: simp_exp_nc '+' simp_exp */ -#line 1876 "awkgram.y" + case 176: /* simp_exp_nc: simp_exp_nc '+' simp_exp */ +#line 2032 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 4082 "awkgram.c" +#line 4304 "awkgram.c" break; - case 166: /* simp_exp_nc: simp_exp_nc '-' simp_exp */ -#line 1878 "awkgram.y" + case 177: /* simp_exp_nc: simp_exp_nc '-' simp_exp */ +#line 2034 "awkgram.y" { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); } -#line 4088 "awkgram.c" +#line 4310 "awkgram.c" break; - case 167: /* non_post_simp_exp: regexp */ -#line 1883 "awkgram.y" + case 178: /* non_post_simp_exp: regexp */ +#line 2039 "awkgram.y" { yyval = list_create(yyvsp[0]); } -#line 4096 "awkgram.c" +#line 4318 "awkgram.c" break; - case 168: /* non_post_simp_exp: '!' simp_exp */ -#line 1887 "awkgram.y" + case 179: /* non_post_simp_exp: '!' simp_exp */ +#line 2043 "awkgram.y" { if (yyvsp[0]->opcode == Op_match_rec) { yyvsp[0]->opcode = Op_nomatch; @@ -4128,11 +4350,11 @@ regular_print: } } } -#line 4132 "awkgram.c" +#line 4354 "awkgram.c" break; - case 169: /* non_post_simp_exp: '(' exp r_paren */ -#line 1919 "awkgram.y" + case 180: /* non_post_simp_exp: '(' exp r_paren */ +#line 2075 "awkgram.y" { // Always include. Allows us to lint warn on // print "foo" > "bar" 1 @@ -4140,31 +4362,31 @@ regular_print: // print "foo" > ("bar" 1) yyval = list_append(yyvsp[-1], bcalloc(Op_parens, 1, sourceline)); } -#line 4144 "awkgram.c" +#line 4366 "awkgram.c" break; - case 170: /* non_post_simp_exp: LEX_BUILTIN '(' opt_fcall_expression_list r_paren */ -#line 1927 "awkgram.y" + case 181: /* non_post_simp_exp: LEX_BUILTIN '(' opt_fcall_expression_list r_paren */ +#line 2083 "awkgram.y" { yyval = snode(yyvsp[-1], yyvsp[-3]); if (yyval == NULL) YYABORT; } -#line 4154 "awkgram.c" +#line 4376 "awkgram.c" break; - case 171: /* non_post_simp_exp: LEX_LENGTH '(' opt_fcall_expression_list r_paren */ -#line 1933 "awkgram.y" + case 182: /* non_post_simp_exp: LEX_LENGTH '(' opt_fcall_expression_list r_paren */ +#line 2089 "awkgram.y" { yyval = snode(yyvsp[-1], yyvsp[-3]); if (yyval == NULL) YYABORT; } -#line 4164 "awkgram.c" +#line 4386 "awkgram.c" break; - case 172: /* non_post_simp_exp: LEX_LENGTH */ -#line 1939 "awkgram.y" + case 183: /* non_post_simp_exp: LEX_LENGTH */ +#line 2095 "awkgram.y" { static bool warned = false; @@ -4177,45 +4399,45 @@ regular_print: if (yyval == NULL) YYABORT; } -#line 4181 "awkgram.c" +#line 4403 "awkgram.c" break; - case 175: /* non_post_simp_exp: INCREMENT variable */ -#line 1954 "awkgram.y" + case 186: /* non_post_simp_exp: INCREMENT variable */ +#line 2110 "awkgram.y" { yyvsp[-1]->opcode = Op_preincrement; yyval = mk_assignment(yyvsp[0], NULL, yyvsp[-1]); } -#line 4190 "awkgram.c" +#line 4412 "awkgram.c" break; - case 176: /* non_post_simp_exp: DECREMENT variable */ -#line 1959 "awkgram.y" + case 187: /* non_post_simp_exp: DECREMENT variable */ +#line 2115 "awkgram.y" { yyvsp[-1]->opcode = Op_predecrement; yyval = mk_assignment(yyvsp[0], NULL, yyvsp[-1]); } -#line 4199 "awkgram.c" +#line 4421 "awkgram.c" break; - case 177: /* non_post_simp_exp: YNUMBER */ -#line 1964 "awkgram.y" + case 188: /* non_post_simp_exp: YNUMBER */ +#line 2120 "awkgram.y" { yyval = list_create(yyvsp[0]); } -#line 4207 "awkgram.c" +#line 4429 "awkgram.c" break; - case 178: /* non_post_simp_exp: YSTRING */ -#line 1968 "awkgram.y" + case 189: /* non_post_simp_exp: YSTRING */ +#line 2124 "awkgram.y" { yyval = list_create(yyvsp[0]); } -#line 4215 "awkgram.c" +#line 4437 "awkgram.c" break; - case 179: /* non_post_simp_exp: '-' simp_exp */ -#line 1972 "awkgram.y" + case 190: /* non_post_simp_exp: '-' simp_exp */ +#line 2128 "awkgram.y" { if (yyvsp[0]->lasti->opcode == Op_push_i && (yyvsp[0]->lasti->memory->flags & STRING) == 0 @@ -4230,11 +4452,11 @@ regular_print: yyval = list_append(yyvsp[0], yyvsp[-1]); } } -#line 4234 "awkgram.c" +#line 4456 "awkgram.c" break; - case 180: /* non_post_simp_exp: '+' simp_exp */ -#line 1987 "awkgram.y" + case 191: /* non_post_simp_exp: '+' simp_exp */ +#line 2143 "awkgram.y" { if (yyvsp[0]->lasti->opcode == Op_push_i && (yyvsp[0]->lasti->memory->flags & STRING) == 0 @@ -4252,20 +4474,20 @@ regular_print: yyval = list_append(yyvsp[0], yyvsp[-1]); } } -#line 4256 "awkgram.c" +#line 4478 "awkgram.c" break; - case 181: /* func_call: direct_func_call */ -#line 2008 "awkgram.y" + case 192: /* func_call: direct_func_call */ +#line 2164 "awkgram.y" { func_use(yyvsp[0]->lasti->func_name, FUNC_USE); yyval = yyvsp[0]; } -#line 4265 "awkgram.c" +#line 4487 "awkgram.c" break; - case 182: /* func_call: '@' direct_func_call */ -#line 2013 "awkgram.y" + case 193: /* func_call: '@' direct_func_call */ +#line 2169 "awkgram.y" { /* indirect function call */ INSTRUCTION *f, *t; @@ -4299,11 +4521,11 @@ regular_print: yyval = list_prepend(yyvsp[0], t); at_seen--; } -#line 4303 "awkgram.c" +#line 4525 "awkgram.c" break; - case 183: /* direct_func_call: FUNC_CALL '(' opt_fcall_expression_list r_paren */ -#line 2050 "awkgram.y" + case 194: /* direct_func_call: FUNC_CALL '(' opt_fcall_expression_list r_paren */ +#line 2206 "awkgram.y" { NODE *n; char *name = yyvsp[-3]->func_name; @@ -4336,49 +4558,49 @@ regular_print: yyval = list_append(t, yyvsp[-3]); } } -#line 4340 "awkgram.c" +#line 4562 "awkgram.c" break; - case 184: /* opt_variable: %empty */ -#line 2086 "awkgram.y" + case 195: /* opt_variable: %empty */ +#line 2242 "awkgram.y" { yyval = NULL; } -#line 4346 "awkgram.c" +#line 4568 "awkgram.c" break; - case 185: /* opt_variable: variable */ -#line 2088 "awkgram.y" + case 196: /* opt_variable: variable */ +#line 2244 "awkgram.y" { yyval = yyvsp[0]; } -#line 4352 "awkgram.c" +#line 4574 "awkgram.c" break; - case 186: /* delete_subscript_list: %empty */ -#line 2093 "awkgram.y" + case 197: /* delete_subscript_list: %empty */ +#line 2249 "awkgram.y" { yyval = NULL; } -#line 4358 "awkgram.c" +#line 4580 "awkgram.c" break; - case 187: /* delete_subscript_list: delete_subscript SUBSCRIPT */ -#line 2095 "awkgram.y" + case 198: /* delete_subscript_list: delete_subscript SUBSCRIPT */ +#line 2251 "awkgram.y" { yyval = yyvsp[-1]; } -#line 4364 "awkgram.c" +#line 4586 "awkgram.c" break; - case 188: /* delete_subscript: delete_exp_list */ -#line 2100 "awkgram.y" + case 199: /* delete_subscript: delete_exp_list */ +#line 2256 "awkgram.y" { yyval = yyvsp[0]; } -#line 4370 "awkgram.c" +#line 4592 "awkgram.c" break; - case 189: /* delete_subscript: delete_subscript delete_exp_list */ -#line 2102 "awkgram.y" + case 200: /* delete_subscript: delete_subscript delete_exp_list */ +#line 2258 "awkgram.y" { yyval = list_merge(yyvsp[-1], yyvsp[0]); } -#line 4378 "awkgram.c" +#line 4600 "awkgram.c" break; - case 190: /* delete_exp_list: bracketed_exp_list */ -#line 2109 "awkgram.y" + case 201: /* delete_exp_list: bracketed_exp_list */ +#line 2265 "awkgram.y" { INSTRUCTION *ip = yyvsp[0]->lasti; int count = ip->sub_count; /* # of SUBSEP-seperated expressions */ @@ -4392,11 +4614,11 @@ regular_print: sub_counter++; /* count # of dimensions */ yyval = yyvsp[0]; } -#line 4396 "awkgram.c" +#line 4618 "awkgram.c" break; - case 191: /* bracketed_exp_list: '[' expression_list ']' */ -#line 2126 "awkgram.y" + case 202: /* bracketed_exp_list: '[' expression_list ']' */ +#line 2282 "awkgram.y" { INSTRUCTION *t = yyvsp[-1]; if (yyvsp[-1] == NULL) { @@ -4410,41 +4632,41 @@ regular_print: yyvsp[0]->sub_count = count_expressions(&t, false); yyval = list_append(t, yyvsp[0]); } -#line 4414 "awkgram.c" +#line 4636 "awkgram.c" break; - case 192: /* subscript: bracketed_exp_list */ -#line 2143 "awkgram.y" + case 203: /* subscript: bracketed_exp_list */ +#line 2299 "awkgram.y" { yyval = yyvsp[0]; } -#line 4420 "awkgram.c" +#line 4642 "awkgram.c" break; - case 193: /* subscript: subscript bracketed_exp_list */ -#line 2145 "awkgram.y" + case 204: /* subscript: subscript bracketed_exp_list */ +#line 2301 "awkgram.y" { yyval = list_merge(yyvsp[-1], yyvsp[0]); } -#line 4428 "awkgram.c" +#line 4650 "awkgram.c" break; - case 194: /* subscript_list: subscript SUBSCRIPT */ -#line 2152 "awkgram.y" + case 205: /* subscript_list: subscript SUBSCRIPT */ +#line 2308 "awkgram.y" { yyval = yyvsp[-1]; } -#line 4434 "awkgram.c" +#line 4656 "awkgram.c" break; - case 195: /* simple_variable: NAME */ -#line 2157 "awkgram.y" + case 206: /* simple_variable: NAME */ +#line 2313 "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 4444 "awkgram.c" +#line 4666 "awkgram.c" break; - case 196: /* simple_variable: NAME subscript_list */ -#line 2163 "awkgram.y" + case 207: /* simple_variable: NAME subscript_list */ +#line 2319 "awkgram.y" { char *arr = yyvsp[-1]->lextok; @@ -4452,11 +4674,11 @@ regular_print: yyvsp[-1]->opcode = Op_push_array; yyval = list_prepend(yyvsp[0], yyvsp[-1]); } -#line 4456 "awkgram.c" +#line 4678 "awkgram.c" break; - case 197: /* variable: simple_variable */ -#line 2174 "awkgram.y" + case 208: /* variable: simple_variable */ +#line 2330 "awkgram.y" { INSTRUCTION *ip = yyvsp[0]->nexti; if (ip->opcode == Op_push @@ -4468,85 +4690,85 @@ regular_print: } else yyval = yyvsp[0]; } -#line 4472 "awkgram.c" +#line 4694 "awkgram.c" break; - case 198: /* variable: '$' non_post_simp_exp opt_incdec */ -#line 2186 "awkgram.y" + case 209: /* variable: '$' non_post_simp_exp opt_incdec */ +#line 2342 "awkgram.y" { yyval = list_append(yyvsp[-1], yyvsp[-2]); if (yyvsp[0] != NULL) mk_assignment(yyvsp[-1], NULL, yyvsp[0]); } -#line 4482 "awkgram.c" +#line 4704 "awkgram.c" break; - case 199: /* opt_incdec: INCREMENT */ -#line 2195 "awkgram.y" + case 210: /* opt_incdec: INCREMENT */ +#line 2351 "awkgram.y" { yyvsp[0]->opcode = Op_postincrement; } -#line 4490 "awkgram.c" +#line 4712 "awkgram.c" break; - case 200: /* opt_incdec: DECREMENT */ -#line 2199 "awkgram.y" + case 211: /* opt_incdec: DECREMENT */ +#line 2355 "awkgram.y" { yyvsp[0]->opcode = Op_postdecrement; } -#line 4498 "awkgram.c" +#line 4720 "awkgram.c" break; - case 201: /* opt_incdec: %empty */ -#line 2203 "awkgram.y" + case 212: /* opt_incdec: %empty */ +#line 2359 "awkgram.y" { yyval = NULL; } -#line 4504 "awkgram.c" +#line 4726 "awkgram.c" break; - case 202: /* l_brace: '{' opt_nls */ -#line 2207 "awkgram.y" + case 213: /* l_brace: '{' opt_nls */ +#line 2363 "awkgram.y" { yyval = yyvsp[0]; } -#line 4510 "awkgram.c" +#line 4732 "awkgram.c" break; - case 203: /* r_brace: '}' opt_nls */ -#line 2211 "awkgram.y" + case 214: /* r_brace: '}' opt_nls */ +#line 2367 "awkgram.y" { yyval = yyvsp[0]; yyerrok; } -#line 4516 "awkgram.c" +#line 4738 "awkgram.c" break; - case 204: /* r_paren: ')' */ -#line 2215 "awkgram.y" + case 215: /* r_paren: ')' */ +#line 2371 "awkgram.y" { yyerrok; } -#line 4522 "awkgram.c" +#line 4744 "awkgram.c" break; - case 205: /* opt_semi: %empty */ -#line 2220 "awkgram.y" + case 216: /* opt_semi: %empty */ +#line 2376 "awkgram.y" { yyval = NULL; } -#line 4528 "awkgram.c" +#line 4750 "awkgram.c" break; - case 207: /* semi: ';' */ -#line 2225 "awkgram.y" + case 218: /* semi: ';' */ +#line 2381 "awkgram.y" { yyerrok; } -#line 4534 "awkgram.c" +#line 4756 "awkgram.c" break; - case 208: /* colon: ':' */ -#line 2229 "awkgram.y" + case 219: /* colon: ':' */ +#line 2385 "awkgram.y" { yyval = yyvsp[0]; yyerrok; } -#line 4540 "awkgram.c" +#line 4762 "awkgram.c" break; - case 209: /* comma: ',' opt_nls */ -#line 2233 "awkgram.y" + case 220: /* comma: ',' opt_nls */ +#line 2389 "awkgram.y" { yyval = yyvsp[0]; yyerrok; } -#line 4546 "awkgram.c" +#line 4768 "awkgram.c" break; -#line 4550 "awkgram.c" +#line 4772 "awkgram.c" default: break; } @@ -4739,7 +4961,7 @@ yyreturnlab: return yyresult; } -#line 2235 "awkgram.y" +#line 2391 "awkgram.y" struct token { @@ -4833,6 +5055,7 @@ static const struct token tokentab[] = { #endif {"isarray", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_isarray, 0}, {"length", Op_builtin, LEX_LENGTH, A(0)|A(1), do_length, 0}, +{"let", Op_symbol, LEX_LET, GAWKX, 0, 0}, {"load", Op_symbol, LEX_LOAD, GAWKX, 0, 0}, {"log", Op_builtin, LEX_BUILTIN, A(1), do_log, MPF(log)}, {"lshift", Op_builtin, LEX_BUILTIN, GAWKX|A(2), do_lshift, MPF(lshift)}, @@ -6883,6 +7106,7 @@ retry: switch (class) { case LEX_EVAL: case LEX_INCLUDE: + case LEX_LET: case LEX_LOAD: case LEX_NAMESPACE: if (lasttok != '@') @@ -6972,6 +7196,8 @@ retry: case LEX_FOR: case LEX_WHILE: case LEX_DO: + in_loop++; + /* falltrhough */ case LEX_SWITCH: if (! do_pretty_print) return lasttok = class; @@ -7377,9 +7603,9 @@ snode(INSTRUCTION *subn, INSTRUCTION *r) static int parms_shadow(INSTRUCTION *pc, bool *shadow) { - int pcount, i; + int pcount, lcount, i; bool ret = false; - NODE *func, *fp; + NODE *func, **fp; char *fname; func = pc->func_body; @@ -7392,8 +7618,9 @@ parms_shadow(INSTRUCTION *pc, bool *shadow) #endif pcount = func->param_cnt; + lcount = func->frame_cnt; - if (pcount == 0) /* no args, no problem */ + if (lcount == 0) /* no locals, no problem */ return 0; source = pc->source_file; @@ -7402,11 +7629,12 @@ parms_shadow(INSTRUCTION *pc, bool *shadow) * Use warning() and not lintwarn() so that can warn * about all shadowed parameters. */ - for (i = 0; i < pcount; i++) { - if (lookup(fp[i].param) != NULL) { - warning( - _("function `%s': parameter `%s' shadows global variable"), - fname, fp[i].param); + for (i = 0; i < lcount; i++) { + if (lookup(fp[i]->param) != NULL) { + warning((i < pcount) + ? _("function `%s': parameter `%s' shadows global variable") + : _("function `%s': local `%s' shadows global variable"), + fname, fp[i]->param); ret = true; } } @@ -7554,8 +7782,8 @@ mk_function(INSTRUCTION *fi, INSTRUCTION *def) /* update lint table info */ func_use(thisfunc->vname, FUNC_DEFINE); - /* remove params from symbol table */ - remove_params(thisfunc); + /* remove params/locals from symbol table */ + remove_locals(thisfunc); return fi; } @@ -7586,7 +7814,12 @@ install_function(char *fname, INSTRUCTION *fi, INSTRUCTION *plist) } fi->func_body = f; - f->param_cnt = pcount; + /* + * param_cnt and frame_cnt stay the same if there are no @local + * variables. add_let increments frame_cnt, and frame_cnt + * is what is allocated when a function is invoked. + */ + f->frame_cnt = f->param_cnt = pcount; f->code_ptr = fi; f->fparms = NULL; if (pcount > 0) { @@ -7599,6 +7832,60 @@ install_function(char *fname, INSTRUCTION *fi, INSTRUCTION *plist) return 0; } +static bool +add_let(INSTRUCTION *fi, INSTRUCTION *local) +{ + NODE *f = fi != NULL ? fi->func_body : NULL; + const char *fname = f != NULL ? f->vname : NULL; + const char *name = estrdup(local->lextok, strlen(local->lextok)); + NODE **pfreelist = in_function ? &let_free : &let_gfree; + + /* Basic checks:*/ + check_local(fname, name, local); + + /* No duplicate check for lexicals */ + + /* + * Try to get lexical from the free list. + */ + if (*pfreelist) { + /* pop let from stack */ + NODE *let = *pfreelist; + *pfreelist = let->nxparam; + /* register in param or alias table under the given name */ + install_let(let, name); + /* push onto let stack */ + let->nxparam = let_stack; + let_stack = let; + return true; /* Reused frame slot */ + } else if (f != NULL) { /* allocate new local in function */ + NODE **parms = f->fparms; + int lcount = f->frame_cnt, i; + NODE *let; + + /* Reallocate the function's param vector to accommodate + * the new one, or allocate if null. + */ + lcount++; + f->fparms = extend_locals(parms, name, lcount); + f->frame_cnt = lcount; + + let = f->fparms[lcount - 1]; + let->nxparam = let_stack; + let_stack = let; + + return false; /* Fresh, not re-used frame slot */ + } else { /* allocate new let outside of function as alias for anon global */ + char *var = gensym("let"); + NODE *anon_global = variable(local->source_line, var, Node_var_new); + NODE *let = install_global_let(name, anon_global); + + let->nxparam = let_stack; + let_stack = let; + + return false; + } +} /* check_params --- build a list of function parameter names after * making sure that the names are valid and there are no duplicates. @@ -7621,18 +7908,7 @@ check_params(char *fname, int pcount, INSTRUCTION *list) name = p->lextok; p->lextok = NULL; - if (strcmp(name, fname) == 0) { - /* check for function foo(foo) { ... }. bleah. */ - error_ln(p->source_line, - _("function `%s': cannot use function name as parameter name"), fname); - } else if (is_std_var(name)) { - error_ln(p->source_line, - _("function `%s': cannot use special variable `%s' as a function parameter"), - fname, name); - } else if (strchr(name, ':') != NULL) - error_ln(p->source_line, - _("function `%s': parameter `%s' cannot contain a namespace"), - fname, name); + check_param(fname, name, p); /* check for duplicate parameters */ for (j = 0; j < i; j++) { @@ -7651,6 +7927,53 @@ check_params(char *fname, int pcount, INSTRUCTION *list) return pnames; } +/* check_param --- perform basic checks on one parameter. + */ +static void +check_param(const char *fname, const char *name, INSTRUCTION *parm) +{ + if (strcmp(name, fname) == 0) { + /* check for function foo(foo) { ... }. bleah. */ + error_ln(parm->source_line, + _("function `%s': cannot use function name as parameter name"), fname); + } else if (is_std_var(name)) { + error_ln(parm->source_line, + _("function `%s': cannot use special variable `%s' as a function parameter"), + fname, name); + } else if (strchr(name, ':') != NULL) { + error_ln(parm->source_line, + _("function `%s': parameter `%s' cannot contain a namespace"), + fname, name); + } +} + +/* check_local == like check_param but with wording about locals + */ +static void +check_local(const char *fname, const char *name, INSTRUCTION *local) +{ + if (fname && strcmp(name, fname) == 0) { + /* check for function foo(foo) { ... }. bleah. */ + error_ln(local->source_line, + _("function `%s': cannot use function name as local variable name"), fname); + } else if (is_std_var(name)) { + error_ln(local->source_line, + _("cannot use special variable `%s' as a local variable"), name); + } else if (strchr(name, ':') != NULL) { + error_ln(local->source_line, + _("local variable `%s' cannot contain a namespace"), name); + } +} + +static char * +gensym(const char *prefix) +{ + char buf[64]; + static unsigned int gensym_counter; + + size_t len = snprintf(buf, sizeof buf, "$%s%04d", prefix, ++gensym_counter); + return estrdup(buf, len); +} #ifdef HASHSIZE undef HASHSIZE @@ -3426,7 +3426,7 @@ variable_generator(const char *text, int state) idx = 0; break; } - name = func->fparms[idx++].param; + name = func->fparms[idx++]->param; if (strncmp(name, text, textlen) == 0) return estrdup(name, strlen(name)); } |