diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2014-05-22 06:11:32 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2014-05-22 06:11:32 +0300 |
commit | cb3db09270b4caaddb0d606ec892841c149698eb (patch) | |
tree | 7d9ec7403ae2f90730258199ccbf5fd7c3c2dc91 | |
parent | 931074569ea4a92ac2eddb19745a518f1f697193 (diff) | |
download | egawk-cb3db09270b4caaddb0d606ec892841c149698eb.tar.gz egawk-cb3db09270b4caaddb0d606ec892841c149698eb.tar.bz2 egawk-cb3db09270b4caaddb0d606ec892841c149698eb.zip |
Allow any redirected getline inside BEGINFILE/ENDFILE.
-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 23044677..a93ab771 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 55cc9829..4852a58f 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 @@ -33382,363 +33382,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-1430681 -Ref: Auto-set-Footnote-2430886 -Node: ARGC and ARGV430942 -Node: Arrays434796 -Node: Array Basics436294 -Node: Array Intro437120 -Ref: figure-array-elements439093 -Node: Reference to Elements441500 -Node: Assigning Elements443773 -Node: Array Example444264 -Node: Scanning an Array445996 -Node: Controlling Scanning449011 -Ref: Controlling Scanning-Footnote-1454184 -Node: Delete454500 -Ref: Delete-Footnote-1457265 -Node: Numeric Array Subscripts457322 -Node: Uninitialized Subscripts459505 -Node: Multidimensional461130 -Node: Multiscanning464223 -Node: Arrays of Arrays465812 -Node: Functions470452 -Node: Built-in471271 -Node: Calling Built-in472349 -Node: Numeric Functions474337 -Ref: Numeric Functions-Footnote-1478171 -Ref: Numeric Functions-Footnote-2478528 -Ref: Numeric Functions-Footnote-3478576 -Node: String Functions478845 -Ref: String Functions-Footnote-1501856 -Ref: String Functions-Footnote-2501985 -Ref: String Functions-Footnote-3502233 -Node: Gory Details502320 -Ref: table-sub-escapes503989 -Ref: table-sub-posix-92505343 -Ref: table-sub-proposed506694 -Ref: table-posix-sub508048 -Ref: table-gensub-escapes509593 -Ref: Gory Details-Footnote-1510769 -Ref: Gory Details-Footnote-2510820 -Node: I/O Functions510971 -Ref: I/O Functions-Footnote-1518094 -Node: Time Functions518241 -Ref: Time Functions-Footnote-1528705 -Ref: Time Functions-Footnote-2528773 -Ref: Time Functions-Footnote-3528931 -Ref: Time Functions-Footnote-4529042 -Ref: Time Functions-Footnote-5529154 -Ref: Time Functions-Footnote-6529381 -Node: Bitwise Functions529647 -Ref: table-bitwise-ops530209 -Ref: Bitwise Functions-Footnote-1534454 -Node: Type Functions534638 -Node: I18N Functions535780 -Node: User-defined537425 -Node: Definition Syntax538229 -Ref: Definition Syntax-Footnote-1543154 -Node: Function Example543223 -Ref: Function Example-Footnote-1545867 -Node: Function Caveats545889 -Node: Calling A Function546407 -Node: Variable Scope547362 -Node: Pass By Value/Reference550350 -Node: Return Statement553858 -Node: Dynamic Typing556842 -Node: Indirect Calls557771 -Node: Library Functions567458 -Ref: Library Functions-Footnote-1570971 -Ref: Library Functions-Footnote-2571114 -Node: Library Names571285 -Ref: Library Names-Footnote-1574758 -Ref: Library Names-Footnote-2574978 -Node: General Functions575064 -Node: Strtonum Function576092 -Node: Assert Function579022 -Node: Round Function582348 -Node: Cliff Random Function583889 -Node: Ordinal Functions584905 -Ref: Ordinal Functions-Footnote-1587982 -Ref: Ordinal Functions-Footnote-2588234 -Node: Join Function588445 -Ref: Join Function-Footnote-1590216 -Node: Getlocaltime Function590416 -Node: Readfile Function594152 -Node: Data File Management595991 -Node: Filetrans Function596623 -Node: Rewind Function600692 -Node: File Checking602079 -Ref: File Checking-Footnote-1603211 -Node: Empty Files603412 -Node: Ignoring Assigns605642 -Node: Getopt Function607196 -Ref: Getopt Function-Footnote-1618499 -Node: Passwd Functions618702 -Ref: Passwd Functions-Footnote-1627681 -Node: Group Functions627769 -Ref: Group Functions-Footnote-1635711 -Node: Walking Arrays635924 -Node: Sample Programs638060 -Node: Running Examples638734 -Node: Clones639462 -Node: Cut Program640686 -Node: Egrep Program650539 -Ref: Egrep Program-Footnote-1658510 -Node: Id Program658620 -Node: Split Program662284 -Ref: Split Program-Footnote-1665822 -Node: Tee Program665950 -Node: Uniq Program668757 -Node: Wc Program676187 -Ref: Wc Program-Footnote-1680455 -Ref: Wc Program-Footnote-2680655 -Node: Miscellaneous Programs680747 -Node: Dupword Program681935 -Node: Alarm Program683966 -Node: Translate Program688773 -Ref: Translate Program-Footnote-1693164 -Ref: Translate Program-Footnote-2693434 -Node: Labels Program693568 -Ref: Labels Program-Footnote-1696939 -Node: Word Sorting697023 -Node: History Sorting701066 -Node: Extract Program702902 -Ref: Extract Program-Footnote-1710432 -Node: Simple Sed710561 -Node: Igawk Program713623 -Ref: Igawk Program-Footnote-1728798 -Ref: Igawk Program-Footnote-2728999 -Node: Anagram Program729137 -Node: Signature Program732205 -Node: Advanced Features733452 -Node: Nondecimal Data735338 -Node: Array Sorting736915 -Node: Controlling Array Traversal737612 -Node: Array Sorting Functions745892 -Ref: Array Sorting Functions-Footnote-1749799 -Node: Two-way I/O749993 -Ref: Two-way I/O-Footnote-1755509 -Node: TCP/IP Networking755591 -Node: Profiling758435 -Node: Internationalization765943 -Node: I18N and L10N767368 -Node: Explaining gettext768054 -Ref: Explaining gettext-Footnote-1773194 -Ref: Explaining gettext-Footnote-2773378 -Node: Programmer i18n773543 -Node: Translator i18n777768 -Node: String Extraction778562 -Ref: String Extraction-Footnote-1779523 -Node: Printf Ordering779609 -Ref: Printf Ordering-Footnote-1782391 -Node: I18N Portability782455 -Ref: I18N Portability-Footnote-1784904 -Node: I18N Example784967 -Ref: I18N Example-Footnote-1787689 -Node: Gawk I18N787761 -Node: Debugger788382 -Node: Debugging789353 -Node: Debugging Concepts789794 -Node: Debugging Terms791650 -Node: Awk Debugging794247 -Node: Sample Debugging Session795139 -Node: Debugger Invocation795659 -Node: Finding The Bug796992 -Node: List of Debugger Commands803474 -Node: Breakpoint Control804806 -Node: Debugger Execution Control808470 -Node: Viewing And Changing Data811830 -Node: Execution Stack815188 -Node: Debugger Info816701 -Node: Miscellaneous Debugger Commands820695 -Node: Readline Support825879 -Node: Limitations826771 -Node: Arbitrary Precision Arithmetic829019 -Ref: Arbitrary Precision Arithmetic-Footnote-1830668 -Node: General Arithmetic830816 -Node: Floating Point Issues832536 -Node: String Conversion Precision833417 -Ref: String Conversion Precision-Footnote-1835122 -Node: Unexpected Results835231 -Node: POSIX Floating Point Problems837384 -Ref: POSIX Floating Point Problems-Footnote-1841205 -Node: Integer Programming841243 -Node: Floating-point Programming843054 -Ref: Floating-point Programming-Footnote-1849382 -Ref: Floating-point Programming-Footnote-2849652 -Node: Floating-point Representation849916 -Node: Floating-point Context851081 -Ref: table-ieee-formats851920 -Node: Rounding Mode853304 -Ref: table-rounding-modes853783 -Ref: Rounding Mode-Footnote-1856798 -Node: Gawk and MPFR856977 -Node: Arbitrary Precision Floats858386 -Ref: Arbitrary Precision Floats-Footnote-1860829 -Node: Setting Precision861150 -Ref: table-predefined-precision-strings861834 -Node: Setting Rounding Mode863979 -Ref: table-gawk-rounding-modes864383 -Node: Floating-point Constants865570 -Node: Changing Precision867022 -Ref: Changing Precision-Footnote-1868414 -Node: Exact Arithmetic868588 -Node: Arbitrary Precision Integers871722 -Ref: Arbitrary Precision Integers-Footnote-1874737 -Node: Dynamic Extensions874884 -Node: Extension Intro876342 -Node: Plugin License877607 -Node: Extension Mechanism Outline878292 -Ref: figure-load-extension878716 -Ref: figure-load-new-function880201 -Ref: figure-call-new-function881203 -Node: Extension API Description883187 -Node: Extension API Functions Introduction884637 -Node: General Data Types889503 -Ref: General Data Types-Footnote-1895196 -Node: Requesting Values895495 -Ref: table-value-types-returned896232 -Node: Memory Allocation Functions897190 -Ref: Memory Allocation Functions-Footnote-1899936 -Node: Constructor Functions900032 -Node: Registration Functions901790 -Node: Extension Functions902475 -Node: Exit Callback Functions904777 -Node: Extension Version String906026 -Node: Input Parsers906676 -Node: Output Wrappers916479 -Node: Two-way processors920995 -Node: Printing Messages923198 -Ref: Printing Messages-Footnote-1924275 -Node: Updating `ERRNO'924427 -Node: Accessing Parameters925166 -Node: Symbol Table Access926396 -Node: Symbol table by name926910 -Node: Symbol table by cookie928886 -Ref: Symbol table by cookie-Footnote-1933019 -Node: Cached values933082 -Ref: Cached values-Footnote-1936587 -Node: Array Manipulation936678 -Ref: Array Manipulation-Footnote-1937776 -Node: Array Data Types937815 -Ref: Array Data Types-Footnote-1940518 -Node: Array Functions940610 -Node: Flattening Arrays944484 -Node: Creating Arrays951336 -Node: Extension API Variables956067 -Node: Extension Versioning956703 -Node: Extension API Informational Variables958604 -Node: Extension API Boilerplate959690 -Node: Finding Extensions963494 -Node: Extension Example964054 -Node: Internal File Description964784 -Node: Internal File Ops968875 -Ref: Internal File Ops-Footnote-1980421 -Node: Using Internal File Ops980561 -Ref: Using Internal File Ops-Footnote-1982908 -Node: Extension Samples983174 -Node: Extension Sample File Functions984698 -Node: Extension Sample Fnmatch992265 -Node: Extension Sample Fork993744 -Node: Extension Sample Inplace994957 -Node: Extension Sample Ord996735 -Node: Extension Sample Readdir997571 -Ref: table-readdir-file-types998426 -Node: Extension Sample Revout999225 -Node: Extension Sample Rev2way999816 -Node: Extension Sample Read write array1000557 -Node: Extension Sample Readfile1002436 -Node: Extension Sample API Tests1003536 -Node: Extension Sample Time1004061 -Node: gawkextlib1005376 -Node: Language History1008157 -Node: V7/SVR3.11009750 -Node: SVR41012070 -Node: POSIX1013512 -Node: BTL1014898 -Node: POSIX/GNU1015632 -Node: Feature History1021231 -Node: Common Extensions1034207 -Node: Ranges and Locales1035519 -Ref: Ranges and Locales-Footnote-11040136 -Ref: Ranges and Locales-Footnote-21040163 -Ref: Ranges and Locales-Footnote-31040397 -Node: Contributors1040618 -Node: Installation1045999 -Node: Gawk Distribution1046893 -Node: Getting1047377 -Node: Extracting1048203 -Node: Distribution contents1049895 -Node: Unix Installation1055616 -Node: Quick Installation1056233 -Node: Additional Configuration Options1058679 -Node: Configuration Philosophy1060415 -Node: Non-Unix Installation1062769 -Node: PC Installation1063227 -Node: PC Binary Installation1064538 -Node: PC Compiling1066386 -Node: PC Testing1069346 -Node: PC Using1070522 -Node: Cygwin1074690 -Node: MSYS1075499 -Node: VMS Installation1076013 -Node: VMS Compilation1076809 -Ref: VMS Compilation-Footnote-11078061 -Node: VMS Dynamic Extensions1078119 -Node: VMS Installation Details1079492 -Node: VMS Running1081743 -Node: VMS GNV1084577 -Node: VMS Old Gawk1085300 -Node: Bugs1085770 -Node: Other Versions1089688 -Node: Notes1095772 -Node: Compatibility Mode1096572 -Node: Additions1097355 -Node: Accessing The Source1098282 -Node: Adding Code1099722 -Node: New Ports1105767 -Node: Derived Files1109902 -Ref: Derived Files-Footnote-11115223 -Ref: Derived Files-Footnote-21115257 -Ref: Derived Files-Footnote-31115857 -Node: Future Extensions1115955 -Node: Implementation Limitations1116538 -Node: Extension Design1117786 -Node: Old Extension Problems1118940 -Ref: Old Extension Problems-Footnote-11120448 -Node: Extension New Mechanism Goals1120505 -Ref: Extension New Mechanism Goals-Footnote-11123870 -Node: Extension Other Design Decisions1124056 -Node: Extension Future Growth1126162 -Node: Old Extension Mechanism1126998 -Node: Basic Concepts1128738 -Node: Basic High Level1129419 -Ref: figure-general-flow1129691 -Ref: figure-process-flow1130290 -Ref: Basic High Level-Footnote-11133519 -Node: Basic Data Typing1133704 -Node: Glossary1137059 -Node: Copying1162290 -Node: GNU Free Documentation License1199846 -Node: Index1224982 +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-1430676 +Ref: Auto-set-Footnote-2430881 +Node: ARGC and ARGV430937 +Node: Arrays434791 +Node: Array Basics436289 +Node: Array Intro437115 +Ref: figure-array-elements439088 +Node: Reference to Elements441495 +Node: Assigning Elements443768 +Node: Array Example444259 +Node: Scanning an Array445991 +Node: Controlling Scanning449006 +Ref: Controlling Scanning-Footnote-1454179 +Node: Delete454495 +Ref: Delete-Footnote-1457260 +Node: Numeric Array Subscripts457317 +Node: Uninitialized Subscripts459500 +Node: Multidimensional461125 +Node: Multiscanning464218 +Node: Arrays of Arrays465807 +Node: Functions470447 +Node: Built-in471266 +Node: Calling Built-in472344 +Node: Numeric Functions474332 +Ref: Numeric Functions-Footnote-1478166 +Ref: Numeric Functions-Footnote-2478523 +Ref: Numeric Functions-Footnote-3478571 +Node: String Functions478840 +Ref: String Functions-Footnote-1501851 +Ref: String Functions-Footnote-2501980 +Ref: String Functions-Footnote-3502228 +Node: Gory Details502315 +Ref: table-sub-escapes503984 +Ref: table-sub-posix-92505338 +Ref: table-sub-proposed506689 +Ref: table-posix-sub508043 +Ref: table-gensub-escapes509588 +Ref: Gory Details-Footnote-1510764 +Ref: Gory Details-Footnote-2510815 +Node: I/O Functions510966 +Ref: I/O Functions-Footnote-1518089 +Node: Time Functions518236 +Ref: Time Functions-Footnote-1528700 +Ref: Time Functions-Footnote-2528768 +Ref: Time Functions-Footnote-3528926 +Ref: Time Functions-Footnote-4529037 +Ref: Time Functions-Footnote-5529149 +Ref: Time Functions-Footnote-6529376 +Node: Bitwise Functions529642 +Ref: table-bitwise-ops530204 +Ref: Bitwise Functions-Footnote-1534449 +Node: Type Functions534633 +Node: I18N Functions535775 +Node: User-defined537420 +Node: Definition Syntax538224 +Ref: Definition Syntax-Footnote-1543149 +Node: Function Example543218 +Ref: Function Example-Footnote-1545862 +Node: Function Caveats545884 +Node: Calling A Function546402 +Node: Variable Scope547357 +Node: Pass By Value/Reference550345 +Node: Return Statement553853 +Node: Dynamic Typing556837 +Node: Indirect Calls557766 +Node: Library Functions567453 +Ref: Library Functions-Footnote-1570966 +Ref: Library Functions-Footnote-2571109 +Node: Library Names571280 +Ref: Library Names-Footnote-1574753 +Ref: Library Names-Footnote-2574973 +Node: General Functions575059 +Node: Strtonum Function576087 +Node: Assert Function579017 +Node: Round Function582343 +Node: Cliff Random Function583884 +Node: Ordinal Functions584900 +Ref: Ordinal Functions-Footnote-1587977 +Ref: Ordinal Functions-Footnote-2588229 +Node: Join Function588440 +Ref: Join Function-Footnote-1590211 +Node: Getlocaltime Function590411 +Node: Readfile Function594147 +Node: Data File Management595986 +Node: Filetrans Function596618 +Node: Rewind Function600687 +Node: File Checking602074 +Ref: File Checking-Footnote-1603206 +Node: Empty Files603407 +Node: Ignoring Assigns605637 +Node: Getopt Function607191 +Ref: Getopt Function-Footnote-1618494 +Node: Passwd Functions618697 +Ref: Passwd Functions-Footnote-1627676 +Node: Group Functions627764 +Ref: Group Functions-Footnote-1635706 +Node: Walking Arrays635919 +Node: Sample Programs638055 +Node: Running Examples638729 +Node: Clones639457 +Node: Cut Program640681 +Node: Egrep Program650534 +Ref: Egrep Program-Footnote-1658505 +Node: Id Program658615 +Node: Split Program662279 +Ref: Split Program-Footnote-1665817 +Node: Tee Program665945 +Node: Uniq Program668752 +Node: Wc Program676182 +Ref: Wc Program-Footnote-1680450 +Ref: Wc Program-Footnote-2680650 +Node: Miscellaneous Programs680742 +Node: Dupword Program681930 +Node: Alarm Program683961 +Node: Translate Program688768 +Ref: Translate Program-Footnote-1693159 +Ref: Translate Program-Footnote-2693429 +Node: Labels Program693563 +Ref: Labels Program-Footnote-1696934 +Node: Word Sorting697018 +Node: History Sorting701061 +Node: Extract Program702897 +Ref: Extract Program-Footnote-1710427 +Node: Simple Sed710556 +Node: Igawk Program713618 +Ref: Igawk Program-Footnote-1728793 +Ref: Igawk Program-Footnote-2728994 +Node: Anagram Program729132 +Node: Signature Program732200 +Node: Advanced Features733447 +Node: Nondecimal Data735333 +Node: Array Sorting736910 +Node: Controlling Array Traversal737607 +Node: Array Sorting Functions745887 +Ref: Array Sorting Functions-Footnote-1749794 +Node: Two-way I/O749988 +Ref: Two-way I/O-Footnote-1755504 +Node: TCP/IP Networking755586 +Node: Profiling758430 +Node: Internationalization765938 +Node: I18N and L10N767363 +Node: Explaining gettext768049 +Ref: Explaining gettext-Footnote-1773189 +Ref: Explaining gettext-Footnote-2773373 +Node: Programmer i18n773538 +Node: Translator i18n777763 +Node: String Extraction778557 +Ref: String Extraction-Footnote-1779518 +Node: Printf Ordering779604 +Ref: Printf Ordering-Footnote-1782386 +Node: I18N Portability782450 +Ref: I18N Portability-Footnote-1784899 +Node: I18N Example784962 +Ref: I18N Example-Footnote-1787684 +Node: Gawk I18N787756 +Node: Debugger788377 +Node: Debugging789348 +Node: Debugging Concepts789789 +Node: Debugging Terms791645 +Node: Awk Debugging794242 +Node: Sample Debugging Session795134 +Node: Debugger Invocation795654 +Node: Finding The Bug796987 +Node: List of Debugger Commands803469 +Node: Breakpoint Control804801 +Node: Debugger Execution Control808465 +Node: Viewing And Changing Data811825 +Node: Execution Stack815183 +Node: Debugger Info816696 +Node: Miscellaneous Debugger Commands820690 +Node: Readline Support825874 +Node: Limitations826766 +Node: Arbitrary Precision Arithmetic829014 +Ref: Arbitrary Precision Arithmetic-Footnote-1830663 +Node: General Arithmetic830811 +Node: Floating Point Issues832531 +Node: String Conversion Precision833412 +Ref: String Conversion Precision-Footnote-1835117 +Node: Unexpected Results835226 +Node: POSIX Floating Point Problems837379 +Ref: POSIX Floating Point Problems-Footnote-1841200 +Node: Integer Programming841238 +Node: Floating-point Programming843049 +Ref: Floating-point Programming-Footnote-1849377 +Ref: Floating-point Programming-Footnote-2849647 +Node: Floating-point Representation849911 +Node: Floating-point Context851076 +Ref: table-ieee-formats851915 +Node: Rounding Mode853299 +Ref: table-rounding-modes853778 +Ref: Rounding Mode-Footnote-1856793 +Node: Gawk and MPFR856972 +Node: Arbitrary Precision Floats858381 +Ref: Arbitrary Precision Floats-Footnote-1860824 +Node: Setting Precision861145 +Ref: table-predefined-precision-strings861829 +Node: Setting Rounding Mode863974 +Ref: table-gawk-rounding-modes864378 +Node: Floating-point Constants865565 +Node: Changing Precision867017 +Ref: Changing Precision-Footnote-1868409 +Node: Exact Arithmetic868583 +Node: Arbitrary Precision Integers871717 +Ref: Arbitrary Precision Integers-Footnote-1874732 +Node: Dynamic Extensions874879 +Node: Extension Intro876337 +Node: Plugin License877602 +Node: Extension Mechanism Outline878287 +Ref: figure-load-extension878711 +Ref: figure-load-new-function880196 +Ref: figure-call-new-function881198 +Node: Extension API Description883182 +Node: Extension API Functions Introduction884632 +Node: General Data Types889498 +Ref: General Data Types-Footnote-1895191 +Node: Requesting Values895490 +Ref: table-value-types-returned896227 +Node: Memory Allocation Functions897185 +Ref: Memory Allocation Functions-Footnote-1899931 +Node: Constructor Functions900027 +Node: Registration Functions901785 +Node: Extension Functions902470 +Node: Exit Callback Functions904772 +Node: Extension Version String906021 +Node: Input Parsers906671 +Node: Output Wrappers916474 +Node: Two-way processors920990 +Node: Printing Messages923193 +Ref: Printing Messages-Footnote-1924270 +Node: Updating `ERRNO'924422 +Node: Accessing Parameters925161 +Node: Symbol Table Access926391 +Node: Symbol table by name926905 +Node: Symbol table by cookie928881 +Ref: Symbol table by cookie-Footnote-1933014 +Node: Cached values933077 +Ref: Cached values-Footnote-1936582 +Node: Array Manipulation936673 +Ref: Array Manipulation-Footnote-1937771 +Node: Array Data Types937810 +Ref: Array Data Types-Footnote-1940513 +Node: Array Functions940605 +Node: Flattening Arrays944479 +Node: Creating Arrays951331 +Node: Extension API Variables956062 +Node: Extension Versioning956698 +Node: Extension API Informational Variables958599 +Node: Extension API Boilerplate959685 +Node: Finding Extensions963489 +Node: Extension Example964049 +Node: Internal File Description964779 +Node: Internal File Ops968870 +Ref: Internal File Ops-Footnote-1980416 +Node: Using Internal File Ops980556 +Ref: Using Internal File Ops-Footnote-1982903 +Node: Extension Samples983169 +Node: Extension Sample File Functions984693 +Node: Extension Sample Fnmatch992260 +Node: Extension Sample Fork993739 +Node: Extension Sample Inplace994952 +Node: Extension Sample Ord996730 +Node: Extension Sample Readdir997566 +Ref: table-readdir-file-types998421 +Node: Extension Sample Revout999220 +Node: Extension Sample Rev2way999811 +Node: Extension Sample Read write array1000552 +Node: Extension Sample Readfile1002431 +Node: Extension Sample API Tests1003531 +Node: Extension Sample Time1004056 +Node: gawkextlib1005371 +Node: Language History1008152 +Node: V7/SVR3.11009745 +Node: SVR41012065 +Node: POSIX1013507 +Node: BTL1014893 +Node: POSIX/GNU1015627 +Node: Feature History1021226 +Node: Common Extensions1034202 +Node: Ranges and Locales1035514 +Ref: Ranges and Locales-Footnote-11040131 +Ref: Ranges and Locales-Footnote-21040158 +Ref: Ranges and Locales-Footnote-31040392 +Node: Contributors1040613 +Node: Installation1045994 +Node: Gawk Distribution1046888 +Node: Getting1047372 +Node: Extracting1048198 +Node: Distribution contents1049890 +Node: Unix Installation1055611 +Node: Quick Installation1056228 +Node: Additional Configuration Options1058674 +Node: Configuration Philosophy1060410 +Node: Non-Unix Installation1062764 +Node: PC Installation1063222 +Node: PC Binary Installation1064533 +Node: PC Compiling1066381 +Node: PC Testing1069341 +Node: PC Using1070517 +Node: Cygwin1074685 +Node: MSYS1075494 +Node: VMS Installation1076008 +Node: VMS Compilation1076804 +Ref: VMS Compilation-Footnote-11078056 +Node: VMS Dynamic Extensions1078114 +Node: VMS Installation Details1079487 +Node: VMS Running1081738 +Node: VMS GNV1084572 +Node: VMS Old Gawk1085295 +Node: Bugs1085765 +Node: Other Versions1089683 +Node: Notes1095767 +Node: Compatibility Mode1096567 +Node: Additions1097350 +Node: Accessing The Source1098277 +Node: Adding Code1099717 +Node: New Ports1105762 +Node: Derived Files1109897 +Ref: Derived Files-Footnote-11115218 +Ref: Derived Files-Footnote-21115252 +Ref: Derived Files-Footnote-31115852 +Node: Future Extensions1115950 +Node: Implementation Limitations1116533 +Node: Extension Design1117781 +Node: Old Extension Problems1118935 +Ref: Old Extension Problems-Footnote-11120443 +Node: Extension New Mechanism Goals1120500 +Ref: Extension New Mechanism Goals-Footnote-11123865 +Node: Extension Other Design Decisions1124051 +Node: Extension Future Growth1126157 +Node: Old Extension Mechanism1126993 +Node: Basic Concepts1128733 +Node: Basic High Level1129414 +Ref: figure-general-flow1129686 +Ref: figure-process-flow1130285 +Ref: Basic High Level-Footnote-11133514 +Node: Basic Data Typing1133699 +Node: Glossary1137054 +Node: Copying1162285 +Node: GNU Free Documentation License1199841 +Node: Index1224977 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index a9c50684..fc12bff0 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 a380288a..63a9851e 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 9bd0540b..4af051f0 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 |