diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2014-05-22 06:12:59 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2014-05-22 06:12:59 +0300 |
commit | 3da3dbeb0116c0cfe2590e7fa0676b8a0f12fd68 (patch) | |
tree | 3736d20106437a06fc59af91be6f83c954c6252c | |
parent | 684968d926e000a4c82b47fbc2a5b24e564e8400 (diff) | |
parent | cb3db09270b4caaddb0d606ec892841c149698eb (diff) | |
download | egawk-3da3dbeb0116c0cfe2590e7fa0676b8a0f12fd68.tar.gz egawk-3da3dbeb0116c0cfe2590e7fa0676b8a0f12fd68.tar.bz2 egawk-3da3dbeb0116c0cfe2590e7fa0676b8a0f12fd68.zip |
Merge branch 'gawk-4.1-stable'
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | awkgram.c | 227 | ||||
-rw-r--r-- | awkgram.y | 17 | ||||
-rw-r--r-- | doc/ChangeLog | 5 | ||||
-rw-r--r-- | doc/gawk.info | 718 | ||||
-rw-r--r-- | doc/gawk.texi | 4 | ||||
-rw-r--r-- | doc/gawktexi.in | 4 | ||||
-rw-r--r-- | interpret.h | 4 | ||||
-rw-r--r-- | test/ChangeLog | 4 | ||||
-rw-r--r-- | test/lintwarn.ok | 4 |
10 files changed, 495 insertions, 500 deletions
@@ -1,3 +1,11 @@ +2014-05-22 Andrew J. Schorr <aschorr@telemetry-investments.com> + + Allow any redirected getline inside BEGINFILE/ENDFILE. + + * awkgram.y (LEX_GETLINE): Only require a redirection and not also + a variable if getline is in a BEGINFILE or ENDFILE rule. + * interpret.h (Op_K_getline_redir): Remove check and fatal error. + 2014-05-20 Arnold D. Robbins <arnold@skeeve.com> * dfa.c (dfaexec): Minor sync with GNU grep. @@ -666,12 +666,12 @@ static const yytype_uint16 yyrline[] = 1216, 1217, 1223, 1224, 1229, 1231, 1236, 1238, 1246, 1251, 1260, 1267, 1269, 1271, 1287, 1297, 1304, 1306, 1311, 1313, 1315, 1323, 1325, 1330, 1332, 1337, 1339, 1341, 1391, 1393, - 1395, 1397, 1399, 1401, 1403, 1405, 1428, 1433, 1438, 1463, - 1469, 1471, 1473, 1475, 1477, 1479, 1484, 1488, 1520, 1522, - 1528, 1534, 1547, 1548, 1549, 1554, 1559, 1563, 1567, 1582, - 1595, 1600, 1636, 1654, 1655, 1661, 1662, 1667, 1669, 1676, - 1693, 1710, 1712, 1719, 1724, 1732, 1742, 1754, 1763, 1767, - 1771, 1775, 1779, 1783, 1786, 1788, 1792, 1796, 1800 + 1395, 1397, 1399, 1401, 1403, 1405, 1419, 1424, 1429, 1454, + 1460, 1462, 1464, 1466, 1468, 1470, 1475, 1479, 1511, 1513, + 1519, 1525, 1538, 1539, 1540, 1545, 1550, 1554, 1558, 1573, + 1586, 1591, 1627, 1645, 1646, 1652, 1653, 1658, 1660, 1667, + 1684, 1701, 1703, 1710, 1715, 1723, 1733, 1745, 1754, 1758, + 1762, 1766, 1770, 1774, 1777, 1779, 1783, 1787, 1791 }; #endif @@ -3385,49 +3385,40 @@ regular_print: #line 1406 "awkgram.y" /* yacc.c:1646 */ { /* - * In BEGINFILE/ENDFILE, allow `getline var < file' + * In BEGINFILE/ENDFILE, allow `getline [var] < file' */ - if (rule == BEGINFILE || rule == ENDFILE) { - if ((yyvsp[-1]) != NULL && (yyvsp[0]) != NULL) - ; /* all ok */ - else { - if ((yyvsp[-1]) != NULL) - error_ln((yyvsp[-2])->source_line, - _("`getline var' invalid inside `%s' rule"), ruletab[rule]); - else - error_ln((yyvsp[-2])->source_line, - _("`getline' invalid inside `%s' rule"), ruletab[rule]); - } - } + if ((rule == BEGINFILE || rule == ENDFILE) && (yyvsp[0]) == NULL) + error_ln((yyvsp[-2])->source_line, + _("non-redirected `getline' invalid inside `%s' rule"), ruletab[rule]); if (do_lint && rule == END && (yyvsp[0]) == NULL) lintwarn_ln((yyvsp[-2])->source_line, _("non-redirected `getline' undefined inside END action")); (yyval) = mk_getline((yyvsp[-2]), (yyvsp[-1]), (yyvsp[0]), redirect_input); } -#line 3409 "awkgram.c" /* yacc.c:1646 */ +#line 3400 "awkgram.c" /* yacc.c:1646 */ break; case 136: -#line 1429 "awkgram.y" /* yacc.c:1646 */ +#line 1420 "awkgram.y" /* yacc.c:1646 */ { (yyvsp[0])->opcode = Op_postincrement; (yyval) = mk_assignment((yyvsp[-1]), NULL, (yyvsp[0])); } -#line 3418 "awkgram.c" /* yacc.c:1646 */ +#line 3409 "awkgram.c" /* yacc.c:1646 */ break; case 137: -#line 1434 "awkgram.y" /* yacc.c:1646 */ +#line 1425 "awkgram.y" /* yacc.c:1646 */ { (yyvsp[0])->opcode = Op_postdecrement; (yyval) = mk_assignment((yyvsp[-1]), NULL, (yyvsp[0])); } -#line 3427 "awkgram.c" /* yacc.c:1646 */ +#line 3418 "awkgram.c" /* yacc.c:1646 */ break; case 138: -#line 1439 "awkgram.y" /* yacc.c:1646 */ +#line 1430 "awkgram.y" /* yacc.c:1646 */ { if (do_lint_old) { warning_ln((yyvsp[-1])->source_line, @@ -3447,64 +3438,64 @@ regular_print: (yyval) = list_append(list_merge(t, (yyvsp[0])), (yyvsp[-1])); } } -#line 3451 "awkgram.c" /* yacc.c:1646 */ +#line 3442 "awkgram.c" /* yacc.c:1646 */ break; case 139: -#line 1464 "awkgram.y" /* yacc.c:1646 */ +#line 1455 "awkgram.y" /* yacc.c:1646 */ { (yyval) = mk_getline((yyvsp[-1]), (yyvsp[0]), (yyvsp[-3]), (yyvsp[-2])->redir_type); bcfree((yyvsp[-2])); } -#line 3460 "awkgram.c" /* yacc.c:1646 */ +#line 3451 "awkgram.c" /* yacc.c:1646 */ break; case 140: -#line 1470 "awkgram.y" /* yacc.c:1646 */ +#line 1461 "awkgram.y" /* yacc.c:1646 */ { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); } -#line 3466 "awkgram.c" /* yacc.c:1646 */ +#line 3457 "awkgram.c" /* yacc.c:1646 */ break; case 141: -#line 1472 "awkgram.y" /* yacc.c:1646 */ +#line 1463 "awkgram.y" /* yacc.c:1646 */ { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); } -#line 3472 "awkgram.c" /* yacc.c:1646 */ +#line 3463 "awkgram.c" /* yacc.c:1646 */ break; case 142: -#line 1474 "awkgram.y" /* yacc.c:1646 */ +#line 1465 "awkgram.y" /* yacc.c:1646 */ { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); } -#line 3478 "awkgram.c" /* yacc.c:1646 */ +#line 3469 "awkgram.c" /* yacc.c:1646 */ break; case 143: -#line 1476 "awkgram.y" /* yacc.c:1646 */ +#line 1467 "awkgram.y" /* yacc.c:1646 */ { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); } -#line 3484 "awkgram.c" /* yacc.c:1646 */ +#line 3475 "awkgram.c" /* yacc.c:1646 */ break; case 144: -#line 1478 "awkgram.y" /* yacc.c:1646 */ +#line 1469 "awkgram.y" /* yacc.c:1646 */ { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); } -#line 3490 "awkgram.c" /* yacc.c:1646 */ +#line 3481 "awkgram.c" /* yacc.c:1646 */ break; case 145: -#line 1480 "awkgram.y" /* yacc.c:1646 */ +#line 1471 "awkgram.y" /* yacc.c:1646 */ { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); } -#line 3496 "awkgram.c" /* yacc.c:1646 */ +#line 3487 "awkgram.c" /* yacc.c:1646 */ break; case 146: -#line 1485 "awkgram.y" /* yacc.c:1646 */ +#line 1476 "awkgram.y" /* yacc.c:1646 */ { (yyval) = list_create((yyvsp[0])); } -#line 3504 "awkgram.c" /* yacc.c:1646 */ +#line 3495 "awkgram.c" /* yacc.c:1646 */ break; case 147: -#line 1489 "awkgram.y" /* yacc.c:1646 */ +#line 1480 "awkgram.y" /* yacc.c:1646 */ { if ((yyvsp[0])->opcode == Op_match_rec) { (yyvsp[0])->opcode = Op_nomatch; @@ -3536,37 +3527,37 @@ regular_print: } } } -#line 3540 "awkgram.c" /* yacc.c:1646 */ +#line 3531 "awkgram.c" /* yacc.c:1646 */ break; case 148: -#line 1521 "awkgram.y" /* yacc.c:1646 */ +#line 1512 "awkgram.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[-1]); } -#line 3546 "awkgram.c" /* yacc.c:1646 */ +#line 3537 "awkgram.c" /* yacc.c:1646 */ break; case 149: -#line 1523 "awkgram.y" /* yacc.c:1646 */ +#line 1514 "awkgram.y" /* yacc.c:1646 */ { (yyval) = snode((yyvsp[-1]), (yyvsp[-3])); if ((yyval) == NULL) YYABORT; } -#line 3556 "awkgram.c" /* yacc.c:1646 */ +#line 3547 "awkgram.c" /* yacc.c:1646 */ break; case 150: -#line 1529 "awkgram.y" /* yacc.c:1646 */ +#line 1520 "awkgram.y" /* yacc.c:1646 */ { (yyval) = snode((yyvsp[-1]), (yyvsp[-3])); if ((yyval) == NULL) YYABORT; } -#line 3566 "awkgram.c" /* yacc.c:1646 */ +#line 3557 "awkgram.c" /* yacc.c:1646 */ break; case 151: -#line 1535 "awkgram.y" /* yacc.c:1646 */ +#line 1526 "awkgram.y" /* yacc.c:1646 */ { static bool warned = false; @@ -3579,45 +3570,45 @@ regular_print: if ((yyval) == NULL) YYABORT; } -#line 3583 "awkgram.c" /* yacc.c:1646 */ +#line 3574 "awkgram.c" /* yacc.c:1646 */ break; case 154: -#line 1550 "awkgram.y" /* yacc.c:1646 */ +#line 1541 "awkgram.y" /* yacc.c:1646 */ { (yyvsp[-1])->opcode = Op_preincrement; (yyval) = mk_assignment((yyvsp[0]), NULL, (yyvsp[-1])); } -#line 3592 "awkgram.c" /* yacc.c:1646 */ +#line 3583 "awkgram.c" /* yacc.c:1646 */ break; case 155: -#line 1555 "awkgram.y" /* yacc.c:1646 */ +#line 1546 "awkgram.y" /* yacc.c:1646 */ { (yyvsp[-1])->opcode = Op_predecrement; (yyval) = mk_assignment((yyvsp[0]), NULL, (yyvsp[-1])); } -#line 3601 "awkgram.c" /* yacc.c:1646 */ +#line 3592 "awkgram.c" /* yacc.c:1646 */ break; case 156: -#line 1560 "awkgram.y" /* yacc.c:1646 */ +#line 1551 "awkgram.y" /* yacc.c:1646 */ { (yyval) = list_create((yyvsp[0])); } -#line 3609 "awkgram.c" /* yacc.c:1646 */ +#line 3600 "awkgram.c" /* yacc.c:1646 */ break; case 157: -#line 1564 "awkgram.y" /* yacc.c:1646 */ +#line 1555 "awkgram.y" /* yacc.c:1646 */ { (yyval) = list_create((yyvsp[0])); } -#line 3617 "awkgram.c" /* yacc.c:1646 */ +#line 3608 "awkgram.c" /* yacc.c:1646 */ break; case 158: -#line 1568 "awkgram.y" /* yacc.c:1646 */ +#line 1559 "awkgram.y" /* yacc.c:1646 */ { if ((yyvsp[0])->lasti->opcode == Op_push_i && ((yyvsp[0])->lasti->memory->flags & (STRCUR|STRING)) == 0 @@ -3632,11 +3623,11 @@ regular_print: (yyval) = list_append((yyvsp[0]), (yyvsp[-1])); } } -#line 3636 "awkgram.c" /* yacc.c:1646 */ +#line 3627 "awkgram.c" /* yacc.c:1646 */ break; case 159: -#line 1583 "awkgram.y" /* yacc.c:1646 */ +#line 1574 "awkgram.y" /* yacc.c:1646 */ { /* * was: $$ = $2 @@ -3646,20 +3637,20 @@ regular_print: (yyvsp[-1])->memory = make_number(0.0); (yyval) = list_append((yyvsp[0]), (yyvsp[-1])); } -#line 3650 "awkgram.c" /* yacc.c:1646 */ +#line 3641 "awkgram.c" /* yacc.c:1646 */ break; case 160: -#line 1596 "awkgram.y" /* yacc.c:1646 */ +#line 1587 "awkgram.y" /* yacc.c:1646 */ { func_use((yyvsp[0])->lasti->func_name, FUNC_USE); (yyval) = (yyvsp[0]); } -#line 3659 "awkgram.c" /* yacc.c:1646 */ +#line 3650 "awkgram.c" /* yacc.c:1646 */ break; case 161: -#line 1601 "awkgram.y" /* yacc.c:1646 */ +#line 1592 "awkgram.y" /* yacc.c:1646 */ { /* indirect function call */ INSTRUCTION *f, *t; @@ -3692,11 +3683,11 @@ regular_print: (yyval) = list_prepend((yyvsp[0]), t); } -#line 3696 "awkgram.c" /* yacc.c:1646 */ +#line 3687 "awkgram.c" /* yacc.c:1646 */ break; case 162: -#line 1637 "awkgram.y" /* yacc.c:1646 */ +#line 1628 "awkgram.y" /* yacc.c:1646 */ { param_sanity((yyvsp[-1])); (yyvsp[-3])->opcode = Op_func_call; @@ -3710,49 +3701,49 @@ regular_print: (yyval) = list_append(t, (yyvsp[-3])); } } -#line 3714 "awkgram.c" /* yacc.c:1646 */ +#line 3705 "awkgram.c" /* yacc.c:1646 */ break; case 163: -#line 1654 "awkgram.y" /* yacc.c:1646 */ +#line 1645 "awkgram.y" /* yacc.c:1646 */ { (yyval) = NULL; } -#line 3720 "awkgram.c" /* yacc.c:1646 */ +#line 3711 "awkgram.c" /* yacc.c:1646 */ break; case 164: -#line 1656 "awkgram.y" /* yacc.c:1646 */ +#line 1647 "awkgram.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[0]); } -#line 3726 "awkgram.c" /* yacc.c:1646 */ +#line 3717 "awkgram.c" /* yacc.c:1646 */ break; case 165: -#line 1661 "awkgram.y" /* yacc.c:1646 */ +#line 1652 "awkgram.y" /* yacc.c:1646 */ { (yyval) = NULL; } -#line 3732 "awkgram.c" /* yacc.c:1646 */ +#line 3723 "awkgram.c" /* yacc.c:1646 */ break; case 166: -#line 1663 "awkgram.y" /* yacc.c:1646 */ +#line 1654 "awkgram.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[-1]); } -#line 3738 "awkgram.c" /* yacc.c:1646 */ +#line 3729 "awkgram.c" /* yacc.c:1646 */ break; case 167: -#line 1668 "awkgram.y" /* yacc.c:1646 */ +#line 1659 "awkgram.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[0]); } -#line 3744 "awkgram.c" /* yacc.c:1646 */ +#line 3735 "awkgram.c" /* yacc.c:1646 */ break; case 168: -#line 1670 "awkgram.y" /* yacc.c:1646 */ +#line 1661 "awkgram.y" /* yacc.c:1646 */ { (yyval) = list_merge((yyvsp[-1]), (yyvsp[0])); } -#line 3752 "awkgram.c" /* yacc.c:1646 */ +#line 3743 "awkgram.c" /* yacc.c:1646 */ break; case 169: -#line 1677 "awkgram.y" /* yacc.c:1646 */ +#line 1668 "awkgram.y" /* yacc.c:1646 */ { INSTRUCTION *ip = (yyvsp[0])->lasti; int count = ip->sub_count; /* # of SUBSEP-seperated expressions */ @@ -3766,11 +3757,11 @@ regular_print: sub_counter++; /* count # of dimensions */ (yyval) = (yyvsp[0]); } -#line 3770 "awkgram.c" /* yacc.c:1646 */ +#line 3761 "awkgram.c" /* yacc.c:1646 */ break; case 170: -#line 1694 "awkgram.y" /* yacc.c:1646 */ +#line 1685 "awkgram.y" /* yacc.c:1646 */ { INSTRUCTION *t = (yyvsp[-1]); if ((yyvsp[-1]) == NULL) { @@ -3784,31 +3775,31 @@ regular_print: (yyvsp[0])->sub_count = count_expressions(&t, false); (yyval) = list_append(t, (yyvsp[0])); } -#line 3788 "awkgram.c" /* yacc.c:1646 */ +#line 3779 "awkgram.c" /* yacc.c:1646 */ break; case 171: -#line 1711 "awkgram.y" /* yacc.c:1646 */ +#line 1702 "awkgram.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[0]); } -#line 3794 "awkgram.c" /* yacc.c:1646 */ +#line 3785 "awkgram.c" /* yacc.c:1646 */ break; case 172: -#line 1713 "awkgram.y" /* yacc.c:1646 */ +#line 1704 "awkgram.y" /* yacc.c:1646 */ { (yyval) = list_merge((yyvsp[-1]), (yyvsp[0])); } -#line 3802 "awkgram.c" /* yacc.c:1646 */ +#line 3793 "awkgram.c" /* yacc.c:1646 */ break; case 173: -#line 1720 "awkgram.y" /* yacc.c:1646 */ +#line 1711 "awkgram.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[-1]); } -#line 3808 "awkgram.c" /* yacc.c:1646 */ +#line 3799 "awkgram.c" /* yacc.c:1646 */ break; case 174: -#line 1725 "awkgram.y" /* yacc.c:1646 */ +#line 1716 "awkgram.y" /* yacc.c:1646 */ { char *var_name = (yyvsp[0])->lextok; @@ -3816,22 +3807,22 @@ regular_print: (yyvsp[0])->memory = variable((yyvsp[0])->source_line, var_name, Node_var_new); (yyval) = list_create((yyvsp[0])); } -#line 3820 "awkgram.c" /* yacc.c:1646 */ +#line 3811 "awkgram.c" /* yacc.c:1646 */ break; case 175: -#line 1733 "awkgram.y" /* yacc.c:1646 */ +#line 1724 "awkgram.y" /* yacc.c:1646 */ { char *arr = (yyvsp[-1])->lextok; (yyvsp[-1])->memory = variable((yyvsp[-1])->source_line, arr, Node_var_new); (yyvsp[-1])->opcode = Op_push_array; (yyval) = list_prepend((yyvsp[0]), (yyvsp[-1])); } -#line 3831 "awkgram.c" /* yacc.c:1646 */ +#line 3822 "awkgram.c" /* yacc.c:1646 */ break; case 176: -#line 1743 "awkgram.y" /* yacc.c:1646 */ +#line 1734 "awkgram.y" /* yacc.c:1646 */ { INSTRUCTION *ip = (yyvsp[0])->nexti; if (ip->opcode == Op_push @@ -3843,73 +3834,73 @@ regular_print: } else (yyval) = (yyvsp[0]); } -#line 3847 "awkgram.c" /* yacc.c:1646 */ +#line 3838 "awkgram.c" /* yacc.c:1646 */ break; case 177: -#line 1755 "awkgram.y" /* yacc.c:1646 */ +#line 1746 "awkgram.y" /* yacc.c:1646 */ { (yyval) = list_append((yyvsp[-1]), (yyvsp[-2])); if ((yyvsp[0]) != NULL) mk_assignment((yyvsp[-1]), NULL, (yyvsp[0])); } -#line 3857 "awkgram.c" /* yacc.c:1646 */ +#line 3848 "awkgram.c" /* yacc.c:1646 */ break; case 178: -#line 1764 "awkgram.y" /* yacc.c:1646 */ +#line 1755 "awkgram.y" /* yacc.c:1646 */ { (yyvsp[0])->opcode = Op_postincrement; } -#line 3865 "awkgram.c" /* yacc.c:1646 */ +#line 3856 "awkgram.c" /* yacc.c:1646 */ break; case 179: -#line 1768 "awkgram.y" /* yacc.c:1646 */ +#line 1759 "awkgram.y" /* yacc.c:1646 */ { (yyvsp[0])->opcode = Op_postdecrement; } -#line 3873 "awkgram.c" /* yacc.c:1646 */ +#line 3864 "awkgram.c" /* yacc.c:1646 */ break; case 180: -#line 1771 "awkgram.y" /* yacc.c:1646 */ +#line 1762 "awkgram.y" /* yacc.c:1646 */ { (yyval) = NULL; } -#line 3879 "awkgram.c" /* yacc.c:1646 */ +#line 3870 "awkgram.c" /* yacc.c:1646 */ break; case 182: -#line 1779 "awkgram.y" /* yacc.c:1646 */ +#line 1770 "awkgram.y" /* yacc.c:1646 */ { yyerrok; } -#line 3885 "awkgram.c" /* yacc.c:1646 */ +#line 3876 "awkgram.c" /* yacc.c:1646 */ break; case 183: -#line 1783 "awkgram.y" /* yacc.c:1646 */ +#line 1774 "awkgram.y" /* yacc.c:1646 */ { yyerrok; } -#line 3891 "awkgram.c" /* yacc.c:1646 */ +#line 3882 "awkgram.c" /* yacc.c:1646 */ break; case 186: -#line 1792 "awkgram.y" /* yacc.c:1646 */ +#line 1783 "awkgram.y" /* yacc.c:1646 */ { yyerrok; } -#line 3897 "awkgram.c" /* yacc.c:1646 */ +#line 3888 "awkgram.c" /* yacc.c:1646 */ break; case 187: -#line 1796 "awkgram.y" /* yacc.c:1646 */ +#line 1787 "awkgram.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[0]); yyerrok; } -#line 3903 "awkgram.c" /* yacc.c:1646 */ +#line 3894 "awkgram.c" /* yacc.c:1646 */ break; case 188: -#line 1800 "awkgram.y" /* yacc.c:1646 */ +#line 1791 "awkgram.y" /* yacc.c:1646 */ { yyerrok; } -#line 3909 "awkgram.c" /* yacc.c:1646 */ +#line 3900 "awkgram.c" /* yacc.c:1646 */ break; -#line 3913 "awkgram.c" /* yacc.c:1646 */ +#line 3904 "awkgram.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -4137,7 +4128,7 @@ yyreturn: #endif return yyresult; } -#line 1802 "awkgram.y" /* yacc.c:1906 */ +#line 1793 "awkgram.y" /* yacc.c:1906 */ struct token { @@ -1405,21 +1405,12 @@ simp_exp | LEX_GETLINE opt_variable input_redir { /* - * In BEGINFILE/ENDFILE, allow `getline var < file' + * In BEGINFILE/ENDFILE, allow `getline [var] < file' */ - if (rule == BEGINFILE || rule == ENDFILE) { - if ($2 != NULL && $3 != NULL) - ; /* all ok */ - else { - if ($2 != NULL) - error_ln($1->source_line, - _("`getline var' invalid inside `%s' rule"), ruletab[rule]); - else - error_ln($1->source_line, - _("`getline' invalid inside `%s' rule"), ruletab[rule]); - } - } + if ((rule == BEGINFILE || rule == ENDFILE) && $3 == NULL) + error_ln($1->source_line, + _("non-redirected `getline' invalid inside `%s' rule"), ruletab[rule]); if (do_lint && rule == END && $3 == NULL) lintwarn_ln($1->source_line, _("non-redirected `getline' undefined inside END action")); diff --git a/doc/ChangeLog b/doc/ChangeLog index d8cfb484..d1ea52eb 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2014-05-22 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawktexi.in (BEGINFILE/ENDFILE): Update doc for getline - any + redirected form is allowed inside BEGINFILE/ENDFILE. + 2014-05-21 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: Add comments for where we need full xrefs in diff --git a/doc/gawk.info b/doc/gawk.info index 8469667b..5dd1a6ca 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -8849,7 +8849,7 @@ either a `BEGINFILE' or and `ENDFILE' rule. The `nextfile' statement but not inside an `ENDFILE' rule. The `getline' statement (*note Getline::) is restricted inside both -`BEGINFILE' and `ENDFILE'. Only the `getline VARIABLE < FILE' form is +`BEGINFILE' and `ENDFILE': only redirected forms of `getline' are allowed. `BEGINFILE' and `ENDFILE' are `gawk' extensions. In most other @@ -33390,363 +33390,363 @@ Node: Using BEGIN/END373150 Ref: Using BEGIN/END-Footnote-1375886 Node: I/O And BEGIN/END375992 Node: BEGINFILE/ENDFILE378277 -Node: Empty381213 -Node: Using Shell Variables381530 -Node: Action Overview383813 -Node: Statements386164 -Node: If Statement388018 -Node: While Statement389521 -Node: Do Statement391565 -Node: For Statement392721 -Node: Switch Statement395873 -Node: Break Statement397976 -Node: Continue Statement400031 -Node: Next Statement401824 -Node: Nextfile Statement404214 -Node: Exit Statement406869 -Node: Built-in Variables409273 -Node: User-modified410369 -Ref: User-modified-Footnote-1418054 -Node: Auto-set418116 -Ref: Auto-set-Footnote-1431018 -Ref: Auto-set-Footnote-2431223 -Node: ARGC and ARGV431279 -Node: Arrays435133 -Node: Array Basics436631 -Node: Array Intro437457 -Ref: figure-array-elements439430 -Node: Reference to Elements441837 -Node: Assigning Elements444110 -Node: Array Example444601 -Node: Scanning an Array446333 -Node: Controlling Scanning449348 -Ref: Controlling Scanning-Footnote-1454521 -Node: Delete454837 -Ref: Delete-Footnote-1457602 -Node: Numeric Array Subscripts457659 -Node: Uninitialized Subscripts459842 -Node: Multidimensional461467 -Node: Multiscanning464560 -Node: Arrays of Arrays466149 -Node: Functions470789 -Node: Built-in471608 -Node: Calling Built-in472686 -Node: Numeric Functions474674 -Ref: Numeric Functions-Footnote-1478508 -Ref: Numeric Functions-Footnote-2478865 -Ref: Numeric Functions-Footnote-3478913 -Node: String Functions479182 -Ref: String Functions-Footnote-1502193 -Ref: String Functions-Footnote-2502322 -Ref: String Functions-Footnote-3502570 -Node: Gory Details502657 -Ref: table-sub-escapes504326 -Ref: table-sub-posix-92505680 -Ref: table-sub-proposed507031 -Ref: table-posix-sub508385 -Ref: table-gensub-escapes509930 -Ref: Gory Details-Footnote-1511106 -Ref: Gory Details-Footnote-2511157 -Node: I/O Functions511308 -Ref: I/O Functions-Footnote-1518431 -Node: Time Functions518578 -Ref: Time Functions-Footnote-1529042 -Ref: Time Functions-Footnote-2529110 -Ref: Time Functions-Footnote-3529268 -Ref: Time Functions-Footnote-4529379 -Ref: Time Functions-Footnote-5529491 -Ref: Time Functions-Footnote-6529718 -Node: Bitwise Functions529984 -Ref: table-bitwise-ops530546 -Ref: Bitwise Functions-Footnote-1534791 -Node: Type Functions534975 -Node: I18N Functions536117 -Node: User-defined537762 -Node: Definition Syntax538566 -Ref: Definition Syntax-Footnote-1543491 -Node: Function Example543560 -Ref: Function Example-Footnote-1546204 -Node: Function Caveats546226 -Node: Calling A Function546744 -Node: Variable Scope547699 -Node: Pass By Value/Reference550687 -Node: Return Statement554195 -Node: Dynamic Typing557179 -Node: Indirect Calls558108 -Node: Library Functions567795 -Ref: Library Functions-Footnote-1571308 -Ref: Library Functions-Footnote-2571451 -Node: Library Names571622 -Ref: Library Names-Footnote-1575095 -Ref: Library Names-Footnote-2575315 -Node: General Functions575401 -Node: Strtonum Function576429 -Node: Assert Function579359 -Node: Round Function582685 -Node: Cliff Random Function584226 -Node: Ordinal Functions585242 -Ref: Ordinal Functions-Footnote-1588319 -Ref: Ordinal Functions-Footnote-2588571 -Node: Join Function588782 -Ref: Join Function-Footnote-1590553 -Node: Getlocaltime Function590753 -Node: Readfile Function594489 -Node: Data File Management596328 -Node: Filetrans Function596960 -Node: Rewind Function601029 -Node: File Checking602416 -Ref: File Checking-Footnote-1603548 -Node: Empty Files603749 -Node: Ignoring Assigns605979 -Node: Getopt Function607533 -Ref: Getopt Function-Footnote-1618836 -Node: Passwd Functions619039 -Ref: Passwd Functions-Footnote-1628018 -Node: Group Functions628106 -Ref: Group Functions-Footnote-1636048 -Node: Walking Arrays636261 -Node: Sample Programs638397 -Node: Running Examples639071 -Node: Clones639799 -Node: Cut Program641023 -Node: Egrep Program650876 -Ref: Egrep Program-Footnote-1658847 -Node: Id Program658957 -Node: Split Program662621 -Ref: Split Program-Footnote-1666159 -Node: Tee Program666287 -Node: Uniq Program669094 -Node: Wc Program676524 -Ref: Wc Program-Footnote-1680792 -Ref: Wc Program-Footnote-2680992 -Node: Miscellaneous Programs681084 -Node: Dupword Program682272 -Node: Alarm Program684303 -Node: Translate Program689110 -Ref: Translate Program-Footnote-1693501 -Ref: Translate Program-Footnote-2693771 -Node: Labels Program693905 -Ref: Labels Program-Footnote-1697276 -Node: Word Sorting697360 -Node: History Sorting701403 -Node: Extract Program703239 -Ref: Extract Program-Footnote-1710769 -Node: Simple Sed710898 -Node: Igawk Program713960 -Ref: Igawk Program-Footnote-1729135 -Ref: Igawk Program-Footnote-2729336 -Node: Anagram Program729474 -Node: Signature Program732542 -Node: Advanced Features733789 -Node: Nondecimal Data735675 -Node: Array Sorting737252 -Node: Controlling Array Traversal737949 -Node: Array Sorting Functions746229 -Ref: Array Sorting Functions-Footnote-1750136 -Node: Two-way I/O750330 -Ref: Two-way I/O-Footnote-1755846 -Node: TCP/IP Networking755928 -Node: Profiling758772 -Node: Internationalization766280 -Node: I18N and L10N767705 -Node: Explaining gettext768391 -Ref: Explaining gettext-Footnote-1773531 -Ref: Explaining gettext-Footnote-2773715 -Node: Programmer i18n773880 -Node: Translator i18n778105 -Node: String Extraction778899 -Ref: String Extraction-Footnote-1779860 -Node: Printf Ordering779946 -Ref: Printf Ordering-Footnote-1782728 -Node: I18N Portability782792 -Ref: I18N Portability-Footnote-1785241 -Node: I18N Example785304 -Ref: I18N Example-Footnote-1788026 -Node: Gawk I18N788098 -Node: Debugger788719 -Node: Debugging789690 -Node: Debugging Concepts790131 -Node: Debugging Terms791987 -Node: Awk Debugging794584 -Node: Sample Debugging Session795476 -Node: Debugger Invocation795996 -Node: Finding The Bug797329 -Node: List of Debugger Commands803811 -Node: Breakpoint Control805143 -Node: Debugger Execution Control808807 -Node: Viewing And Changing Data812167 -Node: Execution Stack815525 -Node: Debugger Info817038 -Node: Miscellaneous Debugger Commands821032 -Node: Readline Support826216 -Node: Limitations827108 -Node: Arbitrary Precision Arithmetic829356 -Ref: Arbitrary Precision Arithmetic-Footnote-1831005 -Node: General Arithmetic831153 -Node: Floating Point Issues832873 -Node: String Conversion Precision833754 -Ref: String Conversion Precision-Footnote-1835459 -Node: Unexpected Results835568 -Node: POSIX Floating Point Problems837721 -Ref: POSIX Floating Point Problems-Footnote-1841542 -Node: Integer Programming841580 -Node: Floating-point Programming843391 -Ref: Floating-point Programming-Footnote-1849719 -Ref: Floating-point Programming-Footnote-2849989 -Node: Floating-point Representation850253 -Node: Floating-point Context851418 -Ref: table-ieee-formats852257 -Node: Rounding Mode853641 -Ref: table-rounding-modes854120 -Ref: Rounding Mode-Footnote-1857135 -Node: Gawk and MPFR857314 -Node: Arbitrary Precision Floats858723 -Ref: Arbitrary Precision Floats-Footnote-1861166 -Node: Setting Precision861487 -Ref: table-predefined-precision-strings862171 -Node: Setting Rounding Mode864316 -Ref: table-gawk-rounding-modes864720 -Node: Floating-point Constants865907 -Node: Changing Precision867359 -Ref: Changing Precision-Footnote-1868751 -Node: Exact Arithmetic868925 -Node: Arbitrary Precision Integers872059 -Ref: Arbitrary Precision Integers-Footnote-1875074 -Node: Dynamic Extensions875221 -Node: Extension Intro876679 -Node: Plugin License877944 -Node: Extension Mechanism Outline878629 -Ref: figure-load-extension879053 -Ref: figure-load-new-function880538 -Ref: figure-call-new-function881540 -Node: Extension API Description883524 -Node: Extension API Functions Introduction884974 -Node: General Data Types889840 -Ref: General Data Types-Footnote-1895533 -Node: Requesting Values895832 -Ref: table-value-types-returned896569 -Node: Memory Allocation Functions897527 -Ref: Memory Allocation Functions-Footnote-1900273 -Node: Constructor Functions900369 -Node: Registration Functions902127 -Node: Extension Functions902812 -Node: Exit Callback Functions905114 -Node: Extension Version String906363 -Node: Input Parsers907013 -Node: Output Wrappers916816 -Node: Two-way processors921332 -Node: Printing Messages923535 -Ref: Printing Messages-Footnote-1924612 -Node: Updating `ERRNO'924764 -Node: Accessing Parameters925503 -Node: Symbol Table Access926733 -Node: Symbol table by name927247 -Node: Symbol table by cookie929223 -Ref: Symbol table by cookie-Footnote-1933356 -Node: Cached values933419 -Ref: Cached values-Footnote-1936924 -Node: Array Manipulation937015 -Ref: Array Manipulation-Footnote-1938113 -Node: Array Data Types938152 -Ref: Array Data Types-Footnote-1940855 -Node: Array Functions940947 -Node: Flattening Arrays944821 -Node: Creating Arrays951673 -Node: Extension API Variables956404 -Node: Extension Versioning957040 -Node: Extension API Informational Variables958941 -Node: Extension API Boilerplate960027 -Node: Finding Extensions963831 -Node: Extension Example964391 -Node: Internal File Description965121 -Node: Internal File Ops969212 -Ref: Internal File Ops-Footnote-1980758 -Node: Using Internal File Ops980898 -Ref: Using Internal File Ops-Footnote-1983245 -Node: Extension Samples983511 -Node: Extension Sample File Functions985035 -Node: Extension Sample Fnmatch992602 -Node: Extension Sample Fork994081 -Node: Extension Sample Inplace995294 -Node: Extension Sample Ord997072 -Node: Extension Sample Readdir997908 -Ref: table-readdir-file-types998763 -Node: Extension Sample Revout999562 -Node: Extension Sample Rev2way1000153 -Node: Extension Sample Read write array1000894 -Node: Extension Sample Readfile1002773 -Node: Extension Sample API Tests1003873 -Node: Extension Sample Time1004398 -Node: gawkextlib1005713 -Node: Language History1008494 -Node: V7/SVR3.11010087 -Node: SVR41012407 -Node: POSIX1013849 -Node: BTL1015235 -Node: POSIX/GNU1015969 -Node: Feature History1021568 -Node: Common Extensions1034544 -Node: Ranges and Locales1035856 -Ref: Ranges and Locales-Footnote-11040473 -Ref: Ranges and Locales-Footnote-21040500 -Ref: Ranges and Locales-Footnote-31040734 -Node: Contributors1040955 -Node: Installation1046336 -Node: Gawk Distribution1047230 -Node: Getting1047714 -Node: Extracting1048540 -Node: Distribution contents1050232 -Node: Unix Installation1055953 -Node: Quick Installation1056570 -Node: Additional Configuration Options1059016 -Node: Configuration Philosophy1060752 -Node: Non-Unix Installation1063106 -Node: PC Installation1063564 -Node: PC Binary Installation1064875 -Node: PC Compiling1066723 -Node: PC Testing1069683 -Node: PC Using1070859 -Node: Cygwin1075027 -Node: MSYS1075836 -Node: VMS Installation1076350 -Node: VMS Compilation1077146 -Ref: VMS Compilation-Footnote-11078398 -Node: VMS Dynamic Extensions1078456 -Node: VMS Installation Details1079829 -Node: VMS Running1082080 -Node: VMS GNV1084914 -Node: VMS Old Gawk1085637 -Node: Bugs1086107 -Node: Other Versions1090025 -Node: Notes1096109 -Node: Compatibility Mode1096909 -Node: Additions1097692 -Node: Accessing The Source1098619 -Node: Adding Code1100059 -Node: New Ports1106104 -Node: Derived Files1110239 -Ref: Derived Files-Footnote-11115560 -Ref: Derived Files-Footnote-21115594 -Ref: Derived Files-Footnote-31116194 -Node: Future Extensions1116292 -Node: Implementation Limitations1116875 -Node: Extension Design1118123 -Node: Old Extension Problems1119277 -Ref: Old Extension Problems-Footnote-11120785 -Node: Extension New Mechanism Goals1120842 -Ref: Extension New Mechanism Goals-Footnote-11124207 -Node: Extension Other Design Decisions1124393 -Node: Extension Future Growth1126499 -Node: Old Extension Mechanism1127335 -Node: Basic Concepts1129075 -Node: Basic High Level1129756 -Ref: figure-general-flow1130028 -Ref: figure-process-flow1130627 -Ref: Basic High Level-Footnote-11133856 -Node: Basic Data Typing1134041 -Node: Glossary1137396 -Node: Copying1162627 -Node: GNU Free Documentation License1200183 -Node: Index1225319 +Node: Empty381208 +Node: Using Shell Variables381525 +Node: Action Overview383808 +Node: Statements386159 +Node: If Statement388013 +Node: While Statement389516 +Node: Do Statement391560 +Node: For Statement392716 +Node: Switch Statement395868 +Node: Break Statement397971 +Node: Continue Statement400026 +Node: Next Statement401819 +Node: Nextfile Statement404209 +Node: Exit Statement406864 +Node: Built-in Variables409268 +Node: User-modified410364 +Ref: User-modified-Footnote-1418049 +Node: Auto-set418111 +Ref: Auto-set-Footnote-1431013 +Ref: Auto-set-Footnote-2431218 +Node: ARGC and ARGV431274 +Node: Arrays435128 +Node: Array Basics436626 +Node: Array Intro437452 +Ref: figure-array-elements439425 +Node: Reference to Elements441832 +Node: Assigning Elements444105 +Node: Array Example444596 +Node: Scanning an Array446328 +Node: Controlling Scanning449343 +Ref: Controlling Scanning-Footnote-1454516 +Node: Delete454832 +Ref: Delete-Footnote-1457597 +Node: Numeric Array Subscripts457654 +Node: Uninitialized Subscripts459837 +Node: Multidimensional461462 +Node: Multiscanning464555 +Node: Arrays of Arrays466144 +Node: Functions470784 +Node: Built-in471603 +Node: Calling Built-in472681 +Node: Numeric Functions474669 +Ref: Numeric Functions-Footnote-1478503 +Ref: Numeric Functions-Footnote-2478860 +Ref: Numeric Functions-Footnote-3478908 +Node: String Functions479177 +Ref: String Functions-Footnote-1502188 +Ref: String Functions-Footnote-2502317 +Ref: String Functions-Footnote-3502565 +Node: Gory Details502652 +Ref: table-sub-escapes504321 +Ref: table-sub-posix-92505675 +Ref: table-sub-proposed507026 +Ref: table-posix-sub508380 +Ref: table-gensub-escapes509925 +Ref: Gory Details-Footnote-1511101 +Ref: Gory Details-Footnote-2511152 +Node: I/O Functions511303 +Ref: I/O Functions-Footnote-1518426 +Node: Time Functions518573 +Ref: Time Functions-Footnote-1529037 +Ref: Time Functions-Footnote-2529105 +Ref: Time Functions-Footnote-3529263 +Ref: Time Functions-Footnote-4529374 +Ref: Time Functions-Footnote-5529486 +Ref: Time Functions-Footnote-6529713 +Node: Bitwise Functions529979 +Ref: table-bitwise-ops530541 +Ref: Bitwise Functions-Footnote-1534786 +Node: Type Functions534970 +Node: I18N Functions536112 +Node: User-defined537757 +Node: Definition Syntax538561 +Ref: Definition Syntax-Footnote-1543486 +Node: Function Example543555 +Ref: Function Example-Footnote-1546199 +Node: Function Caveats546221 +Node: Calling A Function546739 +Node: Variable Scope547694 +Node: Pass By Value/Reference550682 +Node: Return Statement554190 +Node: Dynamic Typing557174 +Node: Indirect Calls558103 +Node: Library Functions567790 +Ref: Library Functions-Footnote-1571303 +Ref: Library Functions-Footnote-2571446 +Node: Library Names571617 +Ref: Library Names-Footnote-1575090 +Ref: Library Names-Footnote-2575310 +Node: General Functions575396 +Node: Strtonum Function576424 +Node: Assert Function579354 +Node: Round Function582680 +Node: Cliff Random Function584221 +Node: Ordinal Functions585237 +Ref: Ordinal Functions-Footnote-1588314 +Ref: Ordinal Functions-Footnote-2588566 +Node: Join Function588777 +Ref: Join Function-Footnote-1590548 +Node: Getlocaltime Function590748 +Node: Readfile Function594484 +Node: Data File Management596323 +Node: Filetrans Function596955 +Node: Rewind Function601024 +Node: File Checking602411 +Ref: File Checking-Footnote-1603543 +Node: Empty Files603744 +Node: Ignoring Assigns605974 +Node: Getopt Function607528 +Ref: Getopt Function-Footnote-1618831 +Node: Passwd Functions619034 +Ref: Passwd Functions-Footnote-1628013 +Node: Group Functions628101 +Ref: Group Functions-Footnote-1636043 +Node: Walking Arrays636256 +Node: Sample Programs638392 +Node: Running Examples639066 +Node: Clones639794 +Node: Cut Program641018 +Node: Egrep Program650871 +Ref: Egrep Program-Footnote-1658842 +Node: Id Program658952 +Node: Split Program662616 +Ref: Split Program-Footnote-1666154 +Node: Tee Program666282 +Node: Uniq Program669089 +Node: Wc Program676519 +Ref: Wc Program-Footnote-1680787 +Ref: Wc Program-Footnote-2680987 +Node: Miscellaneous Programs681079 +Node: Dupword Program682267 +Node: Alarm Program684298 +Node: Translate Program689105 +Ref: Translate Program-Footnote-1693496 +Ref: Translate Program-Footnote-2693766 +Node: Labels Program693900 +Ref: Labels Program-Footnote-1697271 +Node: Word Sorting697355 +Node: History Sorting701398 +Node: Extract Program703234 +Ref: Extract Program-Footnote-1710764 +Node: Simple Sed710893 +Node: Igawk Program713955 +Ref: Igawk Program-Footnote-1729130 +Ref: Igawk Program-Footnote-2729331 +Node: Anagram Program729469 +Node: Signature Program732537 +Node: Advanced Features733784 +Node: Nondecimal Data735670 +Node: Array Sorting737247 +Node: Controlling Array Traversal737944 +Node: Array Sorting Functions746224 +Ref: Array Sorting Functions-Footnote-1750131 +Node: Two-way I/O750325 +Ref: Two-way I/O-Footnote-1755841 +Node: TCP/IP Networking755923 +Node: Profiling758767 +Node: Internationalization766275 +Node: I18N and L10N767700 +Node: Explaining gettext768386 +Ref: Explaining gettext-Footnote-1773526 +Ref: Explaining gettext-Footnote-2773710 +Node: Programmer i18n773875 +Node: Translator i18n778100 +Node: String Extraction778894 +Ref: String Extraction-Footnote-1779855 +Node: Printf Ordering779941 +Ref: Printf Ordering-Footnote-1782723 +Node: I18N Portability782787 +Ref: I18N Portability-Footnote-1785236 +Node: I18N Example785299 +Ref: I18N Example-Footnote-1788021 +Node: Gawk I18N788093 +Node: Debugger788714 +Node: Debugging789685 +Node: Debugging Concepts790126 +Node: Debugging Terms791982 +Node: Awk Debugging794579 +Node: Sample Debugging Session795471 +Node: Debugger Invocation795991 +Node: Finding The Bug797324 +Node: List of Debugger Commands803806 +Node: Breakpoint Control805138 +Node: Debugger Execution Control808802 +Node: Viewing And Changing Data812162 +Node: Execution Stack815520 +Node: Debugger Info817033 +Node: Miscellaneous Debugger Commands821027 +Node: Readline Support826211 +Node: Limitations827103 +Node: Arbitrary Precision Arithmetic829351 +Ref: Arbitrary Precision Arithmetic-Footnote-1831000 +Node: General Arithmetic831148 +Node: Floating Point Issues832868 +Node: String Conversion Precision833749 +Ref: String Conversion Precision-Footnote-1835454 +Node: Unexpected Results835563 +Node: POSIX Floating Point Problems837716 +Ref: POSIX Floating Point Problems-Footnote-1841537 +Node: Integer Programming841575 +Node: Floating-point Programming843386 +Ref: Floating-point Programming-Footnote-1849714 +Ref: Floating-point Programming-Footnote-2849984 +Node: Floating-point Representation850248 +Node: Floating-point Context851413 +Ref: table-ieee-formats852252 +Node: Rounding Mode853636 +Ref: table-rounding-modes854115 +Ref: Rounding Mode-Footnote-1857130 +Node: Gawk and MPFR857309 +Node: Arbitrary Precision Floats858718 +Ref: Arbitrary Precision Floats-Footnote-1861161 +Node: Setting Precision861482 +Ref: table-predefined-precision-strings862166 +Node: Setting Rounding Mode864311 +Ref: table-gawk-rounding-modes864715 +Node: Floating-point Constants865902 +Node: Changing Precision867354 +Ref: Changing Precision-Footnote-1868746 +Node: Exact Arithmetic868920 +Node: Arbitrary Precision Integers872054 +Ref: Arbitrary Precision Integers-Footnote-1875069 +Node: Dynamic Extensions875216 +Node: Extension Intro876674 +Node: Plugin License877939 +Node: Extension Mechanism Outline878624 +Ref: figure-load-extension879048 +Ref: figure-load-new-function880533 +Ref: figure-call-new-function881535 +Node: Extension API Description883519 +Node: Extension API Functions Introduction884969 +Node: General Data Types889835 +Ref: General Data Types-Footnote-1895528 +Node: Requesting Values895827 +Ref: table-value-types-returned896564 +Node: Memory Allocation Functions897522 +Ref: Memory Allocation Functions-Footnote-1900268 +Node: Constructor Functions900364 +Node: Registration Functions902122 +Node: Extension Functions902807 +Node: Exit Callback Functions905109 +Node: Extension Version String906358 +Node: Input Parsers907008 +Node: Output Wrappers916811 +Node: Two-way processors921327 +Node: Printing Messages923530 +Ref: Printing Messages-Footnote-1924607 +Node: Updating `ERRNO'924759 +Node: Accessing Parameters925498 +Node: Symbol Table Access926728 +Node: Symbol table by name927242 +Node: Symbol table by cookie929218 +Ref: Symbol table by cookie-Footnote-1933351 +Node: Cached values933414 +Ref: Cached values-Footnote-1936919 +Node: Array Manipulation937010 +Ref: Array Manipulation-Footnote-1938108 +Node: Array Data Types938147 +Ref: Array Data Types-Footnote-1940850 +Node: Array Functions940942 +Node: Flattening Arrays944816 +Node: Creating Arrays951668 +Node: Extension API Variables956399 +Node: Extension Versioning957035 +Node: Extension API Informational Variables958936 +Node: Extension API Boilerplate960022 +Node: Finding Extensions963826 +Node: Extension Example964386 +Node: Internal File Description965116 +Node: Internal File Ops969207 +Ref: Internal File Ops-Footnote-1980753 +Node: Using Internal File Ops980893 +Ref: Using Internal File Ops-Footnote-1983240 +Node: Extension Samples983506 +Node: Extension Sample File Functions985030 +Node: Extension Sample Fnmatch992597 +Node: Extension Sample Fork994076 +Node: Extension Sample Inplace995289 +Node: Extension Sample Ord997067 +Node: Extension Sample Readdir997903 +Ref: table-readdir-file-types998758 +Node: Extension Sample Revout999557 +Node: Extension Sample Rev2way1000148 +Node: Extension Sample Read write array1000889 +Node: Extension Sample Readfile1002768 +Node: Extension Sample API Tests1003868 +Node: Extension Sample Time1004393 +Node: gawkextlib1005708 +Node: Language History1008489 +Node: V7/SVR3.11010082 +Node: SVR41012402 +Node: POSIX1013844 +Node: BTL1015230 +Node: POSIX/GNU1015964 +Node: Feature History1021563 +Node: Common Extensions1034539 +Node: Ranges and Locales1035851 +Ref: Ranges and Locales-Footnote-11040468 +Ref: Ranges and Locales-Footnote-21040495 +Ref: Ranges and Locales-Footnote-31040729 +Node: Contributors1040950 +Node: Installation1046331 +Node: Gawk Distribution1047225 +Node: Getting1047709 +Node: Extracting1048535 +Node: Distribution contents1050227 +Node: Unix Installation1055948 +Node: Quick Installation1056565 +Node: Additional Configuration Options1059011 +Node: Configuration Philosophy1060747 +Node: Non-Unix Installation1063101 +Node: PC Installation1063559 +Node: PC Binary Installation1064870 +Node: PC Compiling1066718 +Node: PC Testing1069678 +Node: PC Using1070854 +Node: Cygwin1075022 +Node: MSYS1075831 +Node: VMS Installation1076345 +Node: VMS Compilation1077141 +Ref: VMS Compilation-Footnote-11078393 +Node: VMS Dynamic Extensions1078451 +Node: VMS Installation Details1079824 +Node: VMS Running1082075 +Node: VMS GNV1084909 +Node: VMS Old Gawk1085632 +Node: Bugs1086102 +Node: Other Versions1090020 +Node: Notes1096104 +Node: Compatibility Mode1096904 +Node: Additions1097687 +Node: Accessing The Source1098614 +Node: Adding Code1100054 +Node: New Ports1106099 +Node: Derived Files1110234 +Ref: Derived Files-Footnote-11115555 +Ref: Derived Files-Footnote-21115589 +Ref: Derived Files-Footnote-31116189 +Node: Future Extensions1116287 +Node: Implementation Limitations1116870 +Node: Extension Design1118118 +Node: Old Extension Problems1119272 +Ref: Old Extension Problems-Footnote-11120780 +Node: Extension New Mechanism Goals1120837 +Ref: Extension New Mechanism Goals-Footnote-11124202 +Node: Extension Other Design Decisions1124388 +Node: Extension Future Growth1126494 +Node: Old Extension Mechanism1127330 +Node: Basic Concepts1129070 +Node: Basic High Level1129751 +Ref: figure-general-flow1130023 +Ref: figure-process-flow1130622 +Ref: Basic High Level-Footnote-11133851 +Node: Basic Data Typing1134036 +Node: Glossary1137391 +Node: Copying1162622 +Node: GNU Free Documentation License1200178 +Node: Index1225314 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index c7484cb4..531b85b1 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -12827,8 +12827,8 @@ statement (@pxref{Nextfile Statement}) is allowed only inside a @cindex @code{getline} statement, @code{BEGINFILE}/@code{ENDFILE} patterns and The @code{getline} statement (@pxref{Getline}) is restricted inside -both @code{BEGINFILE} and @code{ENDFILE}. Only the @samp{getline -@var{variable} < @var{file}} form is allowed. +both @code{BEGINFILE} and @code{ENDFILE}: only redirected +forms of @code{getline} are allowed. @code{BEGINFILE} and @code{ENDFILE} are @command{gawk} extensions. In most other @command{awk} implementations, or if @command{gawk} is in diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 2dd32e8e..16572bb2 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -12207,8 +12207,8 @@ statement (@pxref{Nextfile Statement}) is allowed only inside a @cindex @code{getline} statement, @code{BEGINFILE}/@code{ENDFILE} patterns and The @code{getline} statement (@pxref{Getline}) is restricted inside -both @code{BEGINFILE} and @code{ENDFILE}. Only the @samp{getline -@var{variable} < @var{file}} form is allowed. +both @code{BEGINFILE} and @code{ENDFILE}: only redirected +forms of @code{getline} are allowed. @code{BEGINFILE} and @code{ENDFILE} are @command{gawk} extensions. In most other @command{awk} implementations, or if @command{gawk} is in diff --git a/interpret.h b/interpret.h index 29feb821..27f194ae 100644 --- a/interpret.h +++ b/interpret.h @@ -1098,10 +1098,6 @@ match_re: JUMPTO(ni); case Op_K_getline_redir: - if ((currule == BEGINFILE || currule == ENDFILE) - && pc->into_var == false - && pc->redir_type == redirect_input) - fatal(_("`getline' invalid inside `%s' rule"), ruletab[currule]); r = do_getline_redir(pc->into_var, pc->redir_type); PUSH(r); break; diff --git a/test/ChangeLog b/test/ChangeLog index ee668beb..c1d24863 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2014-05-22 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * lintwarn.ok: Updated. + 2014-05-13 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am (EXTRA_DIST): Forgot dbugeval.ok. Ooops. diff --git a/test/lintwarn.ok b/test/lintwarn.ok index ec87612f..bc5226e6 100644 --- a/test/lintwarn.ok +++ b/test/lintwarn.ok @@ -1,6 +1,6 @@ gawk: lintwarn.awk:2: warning: `BEGINFILE' is a gawk extension -gawk: lintwarn.awk:3: error: `getline var' invalid inside `BEGINFILE' rule -gawk: lintwarn.awk:4: error: `getline' invalid inside `BEGINFILE' rule +gawk: lintwarn.awk:3: error: non-redirected `getline' invalid inside `BEGINFILE' rule +gawk: lintwarn.awk:4: error: non-redirected `getline' invalid inside `BEGINFILE' rule gawk: lintwarn.awk:8: warning: statement may have no effect gawk: lintwarn.awk:9: warning: plain `print' in BEGIN or END rule should probably be `print ""' gawk: lintwarn.awk:10: error: `nextfile' used in BEGIN action |