gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, comment, updated. gawk-4.1.0-995-g53892e


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, comment, updated. gawk-4.1.0-995-g53892e3
Date: Thu, 04 Dec 2014 19:57:14 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, comment has been updated
       via  53892e324939cf3526c9242a5ea81555dc16e408 (commit)
       via  d07f0f9df7ea216ca579eed7a9b46d3e168619de (commit)
       via  0d9a32b95e932fb47ddfb100056aa6fe527da595 (commit)
       via  a5a031ed51c3236e0d72d766f2ac1d53022ae957 (commit)
       via  5dd46ec03bb3dc945d2f084726aaba79a83e6340 (commit)
       via  2451ae9bb7e5aca7fdbaa139f4692ae9f4b21244 (commit)
       via  7efd4d794abbbd1b6abc2110cd43fd7896e0cb47 (commit)
       via  723446ecab4a6c88ff129d61e360f70bf17a718b (commit)
       via  0b07960513cbb8aa76b6f301b23cf73b5b2019c7 (commit)
       via  2513062a4c89b0b60c3717d506fce841d44d871e (commit)
       via  b15c7145da2b28bdb0f6521428d5f057a7dc8cfb (commit)
       via  838f65088cda84edc2df609d3e388acb3c8eb13d (commit)
       via  a3454a6b0e25a6d1be66b698c52bae9674309c21 (commit)
       via  1fc15398cbd381b83e20bca3913c12ee7aa34bd4 (commit)
       via  a398513aadb70b98e6e0ad04e5821ea0b6eca00c (commit)
       via  cbaeeb232619098a4bdd9ad5d322dd9e3f4f1930 (commit)
       via  d00161ea2a57bcc45a34a35fed0d46c0e3b2de99 (commit)
       via  f49b0b03937c6edfdfba5cfc229557dcfe56b2c7 (commit)
       via  081af8809fd1dc3e05bac3d313fc0a480b0dd5c0 (commit)
       via  f3eec73c3b99d1b688421ca2c3e0cd3117ca452d (commit)
       via  e9f1827fcd3a45cbf5a6df93d9e177e3151e1f56 (commit)
       via  d8035c3f7d40d741d7be27e323dcad5757a32759 (commit)
       via  2ef8920a5dfb2d1975deecb83e8239d90a58600c (commit)
       via  6316df7a19613a47f94366d24f3302daf5d582da (commit)
       via  fa17ad763ec4c001a5d1858832e473a3b0ead0fd (commit)
       via  e13c76601a232b24c99a452d8f3403f87f069c22 (commit)
       via  90001d0580cdba35ed3813396a095bd9f5a9345e (commit)
       via  deb2fe660265860073c5180a5e31c0375cd0d1f1 (commit)
       via  80561e40fab798717fe2d0c217ccaf96e1025def (commit)
       via  f862e8fe648ed66662417bc37b20980fe7780eec (commit)
       via  fed291bee8b64bddbb27537b1ab104cf93b8de01 (commit)
       via  84feadf5595d1bde46d9e93357fe6b094697ac22 (commit)
       via  ac7bcb4c8cdc07f974205709616fda91a447c0f1 (commit)
       via  624caa19ebb5b5a19046f0b0deb96b2e6c093685 (commit)
       via  41da6a35e2cca4ec3c6b7c61e204e51484ecd7eb (commit)
       via  e65bf179b2c804d2af89f938fa7434cb03d3b52b (commit)
       via  46fb38d70fe250f318fb95a6083beaceaaf5155d (commit)
       via  add7cf1fd2229b7245d8a611f98ac7310e157f76 (commit)
       via  73c561d03b0e9a4f2d0bc10d943ec73e002ea48b (commit)
       via  66de65c83fc98ff2745b664f06e6b90a19b90b3b (commit)
       via  f35c7514dda9bf9cf06580ab5870af13e0e58103 (commit)
       via  52edf49564243b1d6392477e7c447eeb0d8558c0 (commit)
       via  c55f68090438121e3bb7c4baa66d5bba6681f277 (commit)
       via  bfb15f15556411332a2c33c2ddf51ca44c7df82f (commit)
       via  6cc74b6a9954bcfcf48aeb6178b3426b5940f928 (commit)
       via  d4397f45eb710a3c24b7b24aa895e8b9323aff4f (commit)
       via  b027c0d5d49cddfb46565d2d572ecf3828b80b1a (commit)
       via  67557ccd7bfedd6656394c42b367493f6eba0bdb (commit)
       via  0ef2d77362b1ac3caae96512c0dbdcda5b87adc5 (commit)
       via  0a0442fb4744b4a6f419b5e341dfb553081cf04e (commit)
       via  ab90088866a262f32c79e4fabc4a63409c9fd4f5 (commit)
       via  6e6d960b0964b43f3c94e19872537f7fd4603f59 (commit)
       via  757eacd6cf522e56df34372ca7e6968817947cbb (commit)
       via  0c9e840515309d37257da568d6b01dad72aa7ebc (commit)
       via  afabab5ec7a8d8500576a3bf39321cb5ca566661 (commit)
       via  2bf2c2b86482c77a8ca3b88df8e2def62e65f903 (commit)
       via  31c6051694d3152e50eb037e20c4734c7321eac6 (commit)
       via  905daf3abd3dc2d0dde5b2009ae00be3da3bf105 (commit)
       via  82e7082d1653a2143fc29d405fe40329188828b5 (commit)
       via  d03f6f66493d8a8a80810f51fb363dfb7bcd02a5 (commit)
       via  ee77f64d563188b6a5d761fd9342df00431e99d8 (commit)
       via  d312241e2ed853effb2d018d50e1362bf21848a0 (commit)
       via  8b863f8852067b0638e09dc7c82355b96381dc12 (commit)
       via  af9cde0a7cf69800ac3ec581a7c2422e955b9a3c (commit)
       via  05de499531bc8fece2625b27a728bd24412ab41a (commit)
       via  20b2458ba07a9190cfd5bc942da604482036a5b0 (commit)
       via  d268465c69afb15db91f9dd0cb07131ef7ba9c45 (commit)
       via  0a050fa206e5d899f553b6ac492d389cb39591a2 (commit)
       via  f23d62da85fad992feeddd630ce07f0214df7029 (commit)
       via  b4cf3cc470eb1200ec90fcc7ad5b2d069059cf7e (commit)
       via  5cd73ffdcdbd5de2d03b9db781ca26c5a5af516d (commit)
       via  350265fafb2a0153d4207c67d626f135b308ad34 (commit)
       via  b549d4314c75c5136bfc5ede78df5ecdfbd85690 (commit)
       via  2375b235875e65e2238b7723d29b9bcb527192e1 (commit)
       via  a9d4cec96e6e37f470ef5bf8ca7b5a6af6a722bc (commit)
       via  f9098699afea06c80045a6e7ab0ff819a29da84f (commit)
       via  0ea9121e4bf07514d75024837fe4dd1c615c8ec0 (commit)
       via  42d78c1d49a0b5257eb3fbde733a99732892f47d (commit)
       via  50925902635e9b66288318fd768157dbeb529f08 (commit)
       via  9d32cd025e715630e4665499a93c45b2e5d13bdb (commit)
       via  46a457244070dac0ff575293348748f1d8db4352 (commit)
       via  204bec7af64c61489e37007d45de936482007977 (commit)
       via  c9936ef0d4d7a7f263831bead31c5ffcf8b0a8d3 (commit)
       via  af1cce266d1b6c875cf01db6c47ada89cbf64411 (commit)
       via  c5227d1685aa158e63d4b6a6289063ae985673c1 (commit)
       via  bae708045f36e3a000acd9de74084e48471bf389 (commit)
       via  99d0b82fbf3ff42019fadef5fbb396551aa20070 (commit)
       via  f7904deae23ca465c4035fc913b7dbe1abca19a9 (commit)
       via  2f19ce406c3c350dcf6de6454d5c7e1bd7755c24 (commit)
       via  e8f34d6db9d1c4343ecfacd94cd5d0441ffacee4 (commit)
       via  c2cda8d3736b59738f579fce748e94ca109ccc58 (commit)
       via  e982e87ced45d48d23ffc86fa0b6cf6fabfbef8d (commit)
       via  b75a0f281598a38f64a5b2bc3da40ff2cdac20ca (commit)
       via  ac0717b3ca30f7b250db4d526e98ed3eb8de9953 (commit)
       via  22e694149f4ffb9118de16127169ca80b26137d3 (commit)
       via  af2d598d477dbabdfdb6f730850191017dec625e (commit)
       via  3b13df110f42b26417de73151eb4a03657e85de4 (commit)
       via  b7f2322bfa862bb7b4391392aa914f40f13e9ab3 (commit)
       via  d8018f6f8957cb67920904f08377608a7cc78307 (commit)
       via  0182312b0fc945a20a3d7aeac1488540b5518e3a (commit)
       via  0d487f23486bae6721650e37b746fdb1d1a67977 (commit)
       via  393460d20fcc982c3d71749ca3ef4192cb01defb (commit)
       via  cdafa10657ce3d8be73baa3a18f09045bfdc2ae7 (commit)
       via  ab0f848957a4b9d891e7e793cd232cc4a8e61fac (commit)
       via  8554673ddcb41cad3634eeced649d3ad53b99ee8 (commit)
       via  ae9f4eebdcf5b0e5340480bf71d221e16091266e (commit)
       via  50f8512202d7a52effe43422323e2f0c7184afe0 (commit)
       via  cbecf843696d2574accb198b84d9386eef15341c (commit)
       via  81475535ddd41d5c91b2ea65c22aff3c687dad03 (commit)
       via  2c84999804e28517cf467a6ed6788aea06e146c0 (commit)
       via  a786967e7e5775d6da6fd94e5113c6cb3c7704f2 (commit)
       via  49a291d1713912ffb6801ced6f0c517e430a9a71 (commit)
       via  92b1be4a48425e584f29e223a56b261dddb4cdd5 (commit)
       via  98ba9765f8e6b0cd22e94e226a21a46b1b6eaf9b (commit)
       via  6f373546792c2befaa2d9d0fffb12fda80320042 (commit)
       via  74ee0dcab17240a1626b77ed998b07f0f6560a48 (commit)
       via  d7a6deaeca178a15c600fbc13262aca29fb39753 (commit)
       via  cb9faa8c276efc4e2b24378bdb941d007523fc22 (commit)
       via  2a8c128ca91b42261720368e5d25431ee4362c70 (commit)
       via  8529cd991d329ca9f17da5d75320248a86400f3d (commit)
       via  13bfd4900cb896756442778d82b3be3bac074b32 (commit)
       via  5e73f350819b4cd9efb0d50b8a57e50ab271dcda (commit)
       via  964e19b54a9ee3e03658e2a733c1b50ee8624397 (commit)
       via  de578ef8fa4fecfda01ead45ea24ef3b64b7d1b0 (commit)
       via  2711b6286b4929e20289a318fceac67025db92d6 (commit)
       via  78d374fdffd6d83b559393a00a6f69804d6e5c4d (commit)
       via  3c4daf4e10892a471111a95f62d99d660ab24552 (commit)
       via  e86f9bcc463370f27f005439c2d8bb73a0caafbd (commit)
       via  0e8a103b9aa1f2411fba665d1656f28fa297e874 (commit)
       via  62988ea2ac1f845e30c3986bfc9bf4620693682a (commit)
       via  c86aa5e85c7ced14a81389c0bf96b6c75fe420c9 (commit)
       via  6b818c7f463e1bd6b9470f4bfb694f240ac3e5c2 (commit)
      from  2f7402ec4b65a2546373403fa701a29d7482cf3f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=53892e324939cf3526c9242a5ea81555dc16e408

commit 53892e324939cf3526c9242a5ea81555dc16e408
Author: Arnold D. Robbins <address@hidden>
Date:   Tue Dec 2 20:59:19 2014 +0200

    Redo commenting mechanism.

diff --git a/ChangeLog b/ChangeLog
index 5119ac5..41eac66 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2014-12-02         Stephen Davies        <address@hidden>
+
+       Improve comment handling in pretty printing.
+       Create a linked-list of comments and merge them in during
+       pretty-printing instead of into the instruction list at
+       parse time.
+
+       * awk.h (comment_type, comment_text): New defines for NODE,
+       INSTRUCTION.
+       * awkgram.y (append_comment): New function.
+       (program_comment, function_comment): Removed.
+       (first_comment, last_comment): New variables.
+       (get_comment): Take a flag for newline; rework storage. Adjust calls.
+       (split_comment): Store comments in list.
+       (first_comment, last_comment, current_comment_type): New variables.
+       (dump_funcs): Set current_comment_type.
+       * main.c (main): Call print_extra_comments.
+       * profile.c (end_line): New function.
+       (print_extra_comments): New function.
+       (lind): New variable.
+       (pprint): Change how comments are handled.
+
 2014-11-26         Arnold D. Robbins     <address@hidden>
 
        * builtin.c (do_sub): Improve wording of gensub warnings.
diff --git a/awk.h b/awk.h
index a932b54..425760a 100644
--- a/awk.h
+++ b/awk.h
@@ -530,6 +530,9 @@ typedef struct exp_node {
 #define adepth     sub.nodep.l.ll
 #define alevel     sub.nodep.x.xl
 
+/* Op_comment  */
+#define comment_type   sub.val.idx
+
 /* --------------------------------lint warning 
types----------------------------*/
 typedef enum lintvals {
        LINT_illegal,
@@ -794,6 +797,9 @@ typedef struct exp_instruction {
 /* Op_arrayfor_incr    */
 #define array_var       x.xn
 
+/* Op_comment  */
+#define comment_text    x.xn
+
 /* Op_line_range */
 #define triggered       x.xl
 
diff --git a/awkgram.c b/awkgram.c
index ddd41d5..e037258 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -98,6 +98,8 @@ static int load_library(INSTRUCTION *file);
 static void next_sourcefile(void);
 static char *tokexpand(void);
 static bool is_deferred_variable(const char *name);
+static void split_comment(void);
+static void append_comment(INSTRUCTION *ip);
 
 #define instruction(t) bcalloc(t, 1, 0)
 
@@ -127,7 +129,6 @@ static void check_funcs(void);
 
 static ssize_t read_one_line(int fd, void *buffer, size_t count);
 static int one_line_close(int fd);
-static void split_comment(void);
 
 static bool want_source = false;
 static bool want_regexp = false;       /* lexical scanning kludge */
@@ -188,8 +189,6 @@ static INSTRUCTION *ip_endfile;
 static INSTRUCTION *ip_beginfile;
 
 static INSTRUCTION *comment = NULL;
-static INSTRUCTION *program_comment = NULL;
-static INSTRUCTION *function_comment = NULL;
 
 static bool func_first = true;
 
@@ -200,9 +199,15 @@ static inline INSTRUCTION *list_merge(INSTRUCTION *l1, 
INSTRUCTION *l2);
 
 extern double fmod(double x, double y);
 
+/* first and last pointers to comment list  */
+INSTRUCTION *first_comment = NULL;
+INSTRUCTION *last_comment = NULL;
+/* comment type (program=0, function=1)  */
+int current_comment_type = 0;
+
 #define YYSTYPE INSTRUCTION *
 
-#line 206 "awkgram.c" /* yacc.c:339  */
+#line 211 "awkgram.c" /* yacc.c:339  */
 
 # ifndef YY_NULLPTR
 #  if defined __cplusplus && 201103L <= __cplusplus
@@ -356,7 +361,7 @@ int yyparse (void);
 
 /* Copy the second part of user declarations.  */
 
-#line 360 "awkgram.c" /* yacc.c:358  */
+#line 365 "awkgram.c" /* yacc.c:358  */
 
 #ifdef short
 # undef short
@@ -658,25 +663,25 @@ static const yytype_uint8 yytranslate[] =
   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   205,   205,   207,   212,   213,   219,   231,   235,   246,
-     252,   257,   265,   273,   275,   280,   288,   290,   296,   304,
-     314,   340,   353,   366,   373,   383,   395,   397,   399,   405,
-     410,   411,   415,   450,   449,   483,   485,   490,   496,   524,
-     529,   530,   534,   536,   538,   545,   635,   677,   719,   832,
-     839,   846,   856,   865,   874,   883,   894,   910,   909,   933,
-     945,   945,  1043,  1043,  1076,  1106,  1112,  1113,  1119,  1120,
-    1127,  1132,  1144,  1158,  1160,  1168,  1173,  1175,  1183,  1185,
-    1194,  1195,  1203,  1208,  1208,  1219,  1223,  1231,  1232,  1235,
-    1237,  1242,  1243,  1252,  1253,  1258,  1263,  1269,  1271,  1273,
-    1280,  1281,  1287,  1288,  1293,  1295,  1300,  1302,  1310,  1315,
-    1324,  1331,  1333,  1335,  1351,  1361,  1368,  1370,  1375,  1377,
-    1379,  1387,  1389,  1394,  1396,  1401,  1403,  1405,  1455,  1457,
-    1459,  1461,  1463,  1465,  1467,  1469,  1483,  1488,  1493,  1518,
-    1524,  1526,  1528,  1530,  1532,  1534,  1539,  1543,  1575,  1577,
-    1583,  1589,  1602,  1603,  1604,  1609,  1614,  1618,  1622,  1637,
-    1650,  1655,  1691,  1709,  1710,  1716,  1717,  1722,  1724,  1731,
-    1748,  1765,  1767,  1774,  1779,  1787,  1797,  1809,  1818,  1822,
-    1826,  1830,  1834,  1838,  1841,  1843,  1847,  1851,  1855
+       0,   210,   210,   212,   217,   218,   224,   236,   240,   251,
+     257,   262,   270,   278,   280,   285,   293,   295,   301,   305,
+     311,   337,   350,   363,   370,   380,   398,   400,   402,   408,
+     413,   414,   418,   449,   448,   482,   484,   489,   492,   506,
+     511,   512,   516,   518,   520,   527,   617,   659,   701,   814,
+     821,   828,   838,   847,   856,   865,   876,   892,   891,   915,
+     927,   927,  1025,  1025,  1058,  1088,  1094,  1095,  1101,  1102,
+    1109,  1114,  1126,  1140,  1142,  1150,  1155,  1157,  1165,  1167,
+    1176,  1177,  1185,  1190,  1190,  1201,  1205,  1213,  1214,  1217,
+    1219,  1224,  1225,  1234,  1235,  1240,  1245,  1251,  1253,  1255,
+    1262,  1263,  1269,  1270,  1275,  1277,  1282,  1284,  1292,  1297,
+    1306,  1313,  1315,  1317,  1333,  1343,  1350,  1352,  1357,  1359,
+    1361,  1369,  1371,  1376,  1378,  1383,  1385,  1387,  1437,  1439,
+    1441,  1443,  1445,  1447,  1449,  1451,  1465,  1470,  1475,  1500,
+    1506,  1508,  1510,  1512,  1514,  1516,  1521,  1525,  1557,  1559,
+    1565,  1571,  1584,  1585,  1586,  1591,  1596,  1600,  1604,  1619,
+    1632,  1637,  1673,  1691,  1692,  1698,  1699,  1704,  1706,  1713,
+    1730,  1747,  1749,  1756,  1761,  1769,  1779,  1791,  1800,  1804,
+    1808,  1812,  1816,  1820,  1823,  1825,  1829,  1833,  1837
 };
 #endif
 
@@ -1849,26 +1854,26 @@ yyreduce:
   switch (yyn)
     {
         case 3:
-#line 208 "awkgram.y" /* yacc.c:1646  */
+#line 213 "awkgram.y" /* yacc.c:1646  */
     {
                rule = 0;
                yyerrok;
          }
-#line 1858 "awkgram.c" /* yacc.c:1646  */
+#line 1863 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 5:
-#line 214 "awkgram.y" /* yacc.c:1646  */
+#line 219 "awkgram.y" /* yacc.c:1646  */
     {
                next_sourcefile();
                if (sourcefile == srcfiles)
                        process_deferred();
          }
-#line 1868 "awkgram.c" /* yacc.c:1646  */
+#line 1873 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 6:
-#line 220 "awkgram.y" /* yacc.c:1646  */
+#line 225 "awkgram.y" /* yacc.c:1646  */
     {
                rule = 0;
                /*
@@ -1877,19 +1882,19 @@ yyreduce:
                 */
                /* yyerrok; */
          }
-#line 1881 "awkgram.c" /* yacc.c:1646  */
+#line 1886 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 7:
-#line 232 "awkgram.y" /* yacc.c:1646  */
+#line 237 "awkgram.y" /* yacc.c:1646  */
     {
                (void) append_rule((yyvsp[-1]), (yyvsp[0]));
          }
-#line 1889 "awkgram.c" /* yacc.c:1646  */
+#line 1894 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 8:
-#line 236 "awkgram.y" /* yacc.c:1646  */
+#line 241 "awkgram.y" /* yacc.c:1646  */
     {
                if (rule != Rule) {
                        msg(_("%s blocks must have an action part"), 
ruletab[rule]);
@@ -1900,39 +1905,39 @@ yyreduce:
                } else          /* pattern rule with non-empty pattern */
                        (void) append_rule((yyvsp[-1]), NULL);
          }
-#line 1904 "awkgram.c" /* yacc.c:1646  */
+#line 1909 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 9:
-#line 247 "awkgram.y" /* yacc.c:1646  */
+#line 252 "awkgram.y" /* yacc.c:1646  */
     {
                in_function = NULL;
                (void) mk_function((yyvsp[-1]), (yyvsp[0]));
                yyerrok;
          }
-#line 1914 "awkgram.c" /* yacc.c:1646  */
+#line 1919 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 10:
-#line 253 "awkgram.y" /* yacc.c:1646  */
+#line 258 "awkgram.y" /* yacc.c:1646  */
     {
                want_source = false;
                yyerrok;
          }
-#line 1923 "awkgram.c" /* yacc.c:1646  */
+#line 1928 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 11:
-#line 258 "awkgram.y" /* yacc.c:1646  */
+#line 263 "awkgram.y" /* yacc.c:1646  */
     {
                want_source = false;
                yyerrok;
          }
-#line 1932 "awkgram.c" /* yacc.c:1646  */
+#line 1937 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 12:
-#line 266 "awkgram.y" /* yacc.c:1646  */
+#line 271 "awkgram.y" /* yacc.c:1646  */
     {
                if (include_source((yyvsp[0])) < 0)
                        YYABORT;
@@ -1940,23 +1945,23 @@ yyreduce:
                bcfree((yyvsp[0]));
                (yyval) = NULL;
          }
-#line 1944 "awkgram.c" /* yacc.c:1646  */
+#line 1949 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 13:
-#line 274 "awkgram.y" /* yacc.c:1646  */
+#line 279 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = NULL; }
-#line 1950 "awkgram.c" /* yacc.c:1646  */
+#line 1955 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 14:
-#line 276 "awkgram.y" /* yacc.c:1646  */
+#line 281 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = NULL; }
-#line 1956 "awkgram.c" /* yacc.c:1646  */
+#line 1961 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 15:
-#line 281 "awkgram.y" /* yacc.c:1646  */
+#line 286 "awkgram.y" /* yacc.c:1646  */
     {
                if (load_library((yyvsp[0])) < 0)
                        YYABORT;
@@ -1964,49 +1969,41 @@ yyreduce:
                bcfree((yyvsp[0]));
                (yyval) = NULL;
          }
-#line 1968 "awkgram.c" /* yacc.c:1646  */
+#line 1973 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 16:
-#line 289 "awkgram.y" /* yacc.c:1646  */
+#line 294 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = NULL; }
-#line 1974 "awkgram.c" /* yacc.c:1646  */
+#line 1979 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 17:
-#line 291 "awkgram.y" /* yacc.c:1646  */
+#line 296 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = NULL; }
-#line 1980 "awkgram.c" /* yacc.c:1646  */
+#line 1985 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 18:
-#line 296 "awkgram.y" /* yacc.c:1646  */
+#line 301 "awkgram.y" /* yacc.c:1646  */
     {
                rule = Rule;
-               if (comment != NULL) {
-                       (yyval) = list_create(comment);
-                       comment = NULL;
-               } else
-                       (yyval) = NULL;
+               (yyval) = NULL;
          }
-#line 1993 "awkgram.c" /* yacc.c:1646  */
+#line 1994 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 19:
-#line 305 "awkgram.y" /* yacc.c:1646  */
+#line 306 "awkgram.y" /* yacc.c:1646  */
     {
                rule = Rule;
-               if (comment != NULL) {
-                       (yyval) = list_prepend((yyvsp[0]), comment);
-                       comment = NULL;
-               } else
-                       (yyval) = (yyvsp[0]);
+               (yyval) = (yyvsp[0]);
          }
-#line 2006 "awkgram.c" /* yacc.c:1646  */
+#line 2003 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 20:
-#line 315 "awkgram.y" /* yacc.c:1646  */
+#line 312 "awkgram.y" /* yacc.c:1646  */
     {
                INSTRUCTION *tp;
 
@@ -2032,11 +2029,11 @@ yyreduce:
                (yyval) = list_append(list_merge((yyvsp[-3]), (yyvsp[0])), tp);
                rule = Rule;
          }
-#line 2036 "awkgram.c" /* yacc.c:1646  */
+#line 2033 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 21:
-#line 341 "awkgram.y" /* yacc.c:1646  */
+#line 338 "awkgram.y" /* yacc.c:1646  */
     {
                static int begin_seen = 0;
 
@@ -2049,11 +2046,11 @@ yyreduce:
                (yyvsp[0])->source_file = source;
                (yyval) = (yyvsp[0]);
          }
-#line 2053 "awkgram.c" /* yacc.c:1646  */
+#line 2050 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 22:
-#line 354 "awkgram.y" /* yacc.c:1646  */
+#line 351 "awkgram.y" /* yacc.c:1646  */
     {
                static int end_seen = 0;
 
@@ -2066,74 +2063,80 @@ yyreduce:
                (yyvsp[0])->source_file = source;
                (yyval) = (yyvsp[0]);
          }
-#line 2070 "awkgram.c" /* yacc.c:1646  */
+#line 2067 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 23:
-#line 367 "awkgram.y" /* yacc.c:1646  */
+#line 364 "awkgram.y" /* yacc.c:1646  */
     {
                func_first = false;
                (yyvsp[0])->in_rule = rule = BEGINFILE;
                (yyvsp[0])->source_file = source;
                (yyval) = (yyvsp[0]);
          }
-#line 2081 "awkgram.c" /* yacc.c:1646  */
+#line 2078 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 24:
-#line 374 "awkgram.y" /* yacc.c:1646  */
+#line 371 "awkgram.y" /* yacc.c:1646  */
     {
                func_first = false;
                (yyvsp[0])->in_rule = rule = ENDFILE;
                (yyvsp[0])->source_file = source;
                (yyval) = (yyvsp[0]);
          }
-#line 2092 "awkgram.c" /* yacc.c:1646  */
+#line 2089 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 25:
-#line 384 "awkgram.y" /* yacc.c:1646  */
+#line 381 "awkgram.y" /* yacc.c:1646  */
     {
                INSTRUCTION *ip;
+               INSTRUCTION *tp;
                if ((yyvsp[-3]) == NULL)
                        ip = list_create(instruction(Op_no_op));
-               else
-                       ip = (yyvsp[-3]);
+               else {
+                       if (do_pretty_print) {
+                               tp = bcalloc(Op_no_op, 1, lastline);
+                               ip = list_append((yyvsp[-3]), tp);
+                       } else
+                               ip = (yyvsp[-3]);
+               }
                (yyval) = ip;
          }
-#line 2105 "awkgram.c" /* yacc.c:1646  */
+#line 2108 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 26:
-#line 396 "awkgram.y" /* yacc.c:1646  */
+#line 399 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 2111 "awkgram.c" /* yacc.c:1646  */
+#line 2114 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 27:
-#line 398 "awkgram.y" /* yacc.c:1646  */
+#line 401 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 2117 "awkgram.c" /* yacc.c:1646  */
+#line 2120 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 28:
-#line 400 "awkgram.y" /* yacc.c:1646  */
+#line 403 "awkgram.y" /* yacc.c:1646  */
     {
                yyerror(_("`%s' is a built-in function, it cannot be 
redefined"),
                                        tokstart);
                YYABORT;
          }
-#line 2127 "awkgram.c" /* yacc.c:1646  */
+#line 2130 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 29:
-#line 406 "awkgram.y" /* yacc.c:1646  */
+#line 409 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 2133 "awkgram.c" /* yacc.c:1646  */
+#line 2136 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 32:
-#line 416 "awkgram.y" /* yacc.c:1646  */
+#line 419 "awkgram.y" /* yacc.c:1646  */
     {
                /*
                 *  treat any comments between BOF and the first function
@@ -2142,14 +2145,10 @@ yyreduce:
                 *  than one such comments, treat the last as a function
                 *  comment.
                 */
-               if (comment != NULL && func_first
-                   && strstr(comment->memory->stptr, "\n\n") != NULL)
+               current_comment_type = 1;
+               if (last_comment != NULL && func_first
+                   && strstr(last_comment->comment_text->stptr, "\n\n") != 
NULL)
                        split_comment();
-               /* save any other pre-function comment as function comment  */
-               if (comment != NULL) {
-                       function_comment = comment;
-                       comment = NULL;
-               }
                func_first = false;
                (yyvsp[-5])->source_file = source;
                if (install_function((yyvsp[-4])->lextok, (yyvsp[-5]), 
(yyvsp[-2])) < 0)
@@ -2160,17 +2159,17 @@ yyreduce:
                /* $4 already free'd in install_function */
                (yyval) = (yyvsp[-5]);
          }
-#line 2164 "awkgram.c" /* yacc.c:1646  */
+#line 2163 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 33:
-#line 450 "awkgram.y" /* yacc.c:1646  */
+#line 449 "awkgram.y" /* yacc.c:1646  */
     { want_regexp = true; }
-#line 2170 "awkgram.c" /* yacc.c:1646  */
+#line 2169 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 34:
-#line 452 "awkgram.y" /* yacc.c:1646  */
+#line 451 "awkgram.y" /* yacc.c:1646  */
     {
                  NODE *n, *exp;
                  char *re;
@@ -2199,89 +2198,72 @@ yyreduce:
                  (yyval)->opcode = Op_match_rec;
                  (yyval)->memory = n;
                }
-#line 2203 "awkgram.c" /* yacc.c:1646  */
+#line 2202 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 35:
-#line 484 "awkgram.y" /* yacc.c:1646  */
+#line 483 "awkgram.y" /* yacc.c:1646  */
     { bcfree((yyvsp[0])); }
-#line 2209 "awkgram.c" /* yacc.c:1646  */
+#line 2208 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 37:
-#line 490 "awkgram.y" /* yacc.c:1646  */
+#line 489 "awkgram.y" /* yacc.c:1646  */
     {
-               if (comment != NULL) {
-                       (yyval) = list_create(comment);
-                       comment = NULL;
-               } else (yyval) = NULL;
+               (yyval) = NULL;
          }
-#line 2220 "awkgram.c" /* yacc.c:1646  */
+#line 2216 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 38:
-#line 497 "awkgram.y" /* yacc.c:1646  */
+#line 493 "awkgram.y" /* yacc.c:1646  */
     {
                if ((yyvsp[0]) == NULL) {
-                       if (comment == NULL)
-                               (yyval) = (yyvsp[-1]);
-                       else {
-                               (yyval) = list_append((yyvsp[-1]), comment);
-                               comment = NULL;
-                       }
+                       (yyval) = (yyvsp[-1]);
                } else {
                        add_lint((yyvsp[0]), LINT_no_effect);
                        if ((yyvsp[-1]) == NULL) {
-                               if (comment == NULL)
-                                       (yyval) = (yyvsp[0]);
-                               else {
-                                       (yyval) = list_append((yyvsp[0]), 
comment);
-                                       comment = NULL;
-                               }
+                               (yyval) = (yyvsp[0]);
                        } else {
-                               if (comment != NULL) {
-                                       list_append((yyvsp[0]), comment);
-                                       comment = NULL;
-                               }
                                (yyval) = list_merge((yyvsp[-1]), (yyvsp[0]));
                        }
                }
                yyerrok;
          }
-#line 2252 "awkgram.c" /* yacc.c:1646  */
+#line 2234 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 39:
-#line 525 "awkgram.y" /* yacc.c:1646  */
+#line 507 "awkgram.y" /* yacc.c:1646  */
     {  (yyval) = NULL; }
-#line 2258 "awkgram.c" /* yacc.c:1646  */
+#line 2240 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 42:
-#line 535 "awkgram.y" /* yacc.c:1646  */
+#line 517 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = NULL; }
-#line 2264 "awkgram.c" /* yacc.c:1646  */
+#line 2246 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 43:
-#line 537 "awkgram.y" /* yacc.c:1646  */
+#line 519 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[-1]); }
-#line 2270 "awkgram.c" /* yacc.c:1646  */
+#line 2252 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 44:
-#line 539 "awkgram.y" /* yacc.c:1646  */
+#line 521 "awkgram.y" /* yacc.c:1646  */
     {
                if (do_pretty_print)
                        (yyval) = list_prepend((yyvsp[0]), 
instruction(Op_exec_count));
                else
                        (yyval) = (yyvsp[0]);
          }
-#line 2281 "awkgram.c" /* yacc.c:1646  */
+#line 2263 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 45:
-#line 546 "awkgram.y" /* yacc.c:1646  */
+#line 528 "awkgram.y" /* yacc.c:1646  */
     {
                INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt;
                INSTRUCTION *ip, *nextc, *tbreak;
@@ -2371,11 +2353,11 @@ yyreduce:
                break_allowed--;                        
                fix_break_continue(ip, tbreak, NULL);
          }
-#line 2375 "awkgram.c" /* yacc.c:1646  */
+#line 2357 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 46:
-#line 636 "awkgram.y" /* yacc.c:1646  */
+#line 618 "awkgram.y" /* yacc.c:1646  */
     { 
                /*
                 *    -----------------
@@ -2417,11 +2399,11 @@ yyreduce:
                continue_allowed--;
                fix_break_continue(ip, tbreak, tcont);
          }
-#line 2421 "awkgram.c" /* yacc.c:1646  */
+#line 2403 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 47:
-#line 678 "awkgram.y" /* yacc.c:1646  */
+#line 660 "awkgram.y" /* yacc.c:1646  */
     {
                /*
                 *    -----------------
@@ -2463,11 +2445,11 @@ yyreduce:
                } /* else
                        $1 and $4 are NULLs */
          }
-#line 2467 "awkgram.c" /* yacc.c:1646  */
+#line 2449 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 48:
-#line 720 "awkgram.y" /* yacc.c:1646  */
+#line 702 "awkgram.y" /* yacc.c:1646  */
     {
                INSTRUCTION *ip;
                char *var_name = (yyvsp[-5])->lextok;
@@ -2580,44 +2562,44 @@ regular_loop:
                break_allowed--;
                continue_allowed--;
          }
-#line 2584 "awkgram.c" /* yacc.c:1646  */
+#line 2566 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 49:
-#line 833 "awkgram.y" /* yacc.c:1646  */
+#line 815 "awkgram.y" /* yacc.c:1646  */
     {
                (yyval) = mk_for_loop((yyvsp[-11]), (yyvsp[-9]), (yyvsp[-6]), 
(yyvsp[-3]), (yyvsp[0]));
 
                break_allowed--;
                continue_allowed--;
          }
-#line 2595 "awkgram.c" /* yacc.c:1646  */
+#line 2577 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 50:
-#line 840 "awkgram.y" /* yacc.c:1646  */
+#line 822 "awkgram.y" /* yacc.c:1646  */
     {
                (yyval) = mk_for_loop((yyvsp[-10]), (yyvsp[-8]), (INSTRUCTION 
*) NULL, (yyvsp[-3]), (yyvsp[0]));
 
                break_allowed--;
                continue_allowed--;
          }
-#line 2606 "awkgram.c" /* yacc.c:1646  */
+#line 2588 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 51:
-#line 847 "awkgram.y" /* yacc.c:1646  */
+#line 829 "awkgram.y" /* yacc.c:1646  */
     {
                if (do_pretty_print)
                        (yyval) = list_prepend((yyvsp[0]), 
instruction(Op_exec_count));
                else
                        (yyval) = (yyvsp[0]);
          }
-#line 2617 "awkgram.c" /* yacc.c:1646  */
+#line 2599 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 52:
-#line 857 "awkgram.y" /* yacc.c:1646  */
+#line 839 "awkgram.y" /* yacc.c:1646  */
     { 
                if (! break_allowed)
                        error_ln((yyvsp[-1])->source_line,
@@ -2626,11 +2608,11 @@ regular_loop:
                (yyval) = list_create((yyvsp[-1]));
 
          }
-#line 2630 "awkgram.c" /* yacc.c:1646  */
+#line 2612 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 53:
-#line 866 "awkgram.y" /* yacc.c:1646  */
+#line 848 "awkgram.y" /* yacc.c:1646  */
     {
                if (! continue_allowed)
                        error_ln((yyvsp[-1])->source_line,
@@ -2639,11 +2621,11 @@ regular_loop:
                (yyval) = list_create((yyvsp[-1]));
 
          }
-#line 2643 "awkgram.c" /* yacc.c:1646  */
+#line 2625 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 54:
-#line 875 "awkgram.y" /* yacc.c:1646  */
+#line 857 "awkgram.y" /* yacc.c:1646  */
     {
                /* if inside function (rule = 0), resolve context at run-time */
                if (rule && rule != Rule)
@@ -2652,11 +2634,11 @@ regular_loop:
                (yyvsp[-1])->target_jmp = ip_rec;
                (yyval) = list_create((yyvsp[-1]));
          }
-#line 2656 "awkgram.c" /* yacc.c:1646  */
+#line 2638 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 55:
-#line 884 "awkgram.y" /* yacc.c:1646  */
+#line 866 "awkgram.y" /* yacc.c:1646  */
     {
                /* if inside function (rule = 0), resolve context at run-time */
                if (rule == BEGIN || rule == END || rule == ENDFILE)
@@ -2667,11 +2649,11 @@ regular_loop:
                (yyvsp[-1])->target_endfile = ip_endfile;
                (yyval) = list_create((yyvsp[-1]));
          }
-#line 2671 "awkgram.c" /* yacc.c:1646  */
+#line 2653 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 56:
-#line 895 "awkgram.y" /* yacc.c:1646  */
+#line 877 "awkgram.y" /* yacc.c:1646  */
     {
                /* Initialize the two possible jump targets, the actual target
                 * is resolved at run-time. 
@@ -2686,20 +2668,20 @@ regular_loop:
                } else
                        (yyval) = list_append((yyvsp[-1]), (yyvsp[-2]));
          }
-#line 2690 "awkgram.c" /* yacc.c:1646  */
+#line 2672 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 57:
-#line 910 "awkgram.y" /* yacc.c:1646  */
+#line 892 "awkgram.y" /* yacc.c:1646  */
     {
                if (! in_function)
                        yyerror(_("`return' used outside function context"));
          }
-#line 2699 "awkgram.c" /* yacc.c:1646  */
+#line 2681 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 58:
-#line 913 "awkgram.y" /* yacc.c:1646  */
+#line 895 "awkgram.y" /* yacc.c:1646  */
     {
                if ((yyvsp[-1]) == NULL) {
                        (yyval) = list_create((yyvsp[-3]));
@@ -2720,17 +2702,17 @@ regular_loop:
                        (yyval) = list_append((yyvsp[-1]), (yyvsp[-3]));
                }
          }
-#line 2724 "awkgram.c" /* yacc.c:1646  */
+#line 2706 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 60:
-#line 945 "awkgram.y" /* yacc.c:1646  */
+#line 927 "awkgram.y" /* yacc.c:1646  */
     { in_print = true; in_parens = 0; }
-#line 2730 "awkgram.c" /* yacc.c:1646  */
+#line 2712 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 61:
-#line 946 "awkgram.y" /* yacc.c:1646  */
+#line 928 "awkgram.y" /* yacc.c:1646  */
     {
                /*
                 * Optimization: plain `print' has no expression list, so $3 is 
null.
@@ -2827,17 +2809,17 @@ regular_print:
                        }
                }
          }
-#line 2831 "awkgram.c" /* yacc.c:1646  */
+#line 2813 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 62:
-#line 1043 "awkgram.y" /* yacc.c:1646  */
+#line 1025 "awkgram.y" /* yacc.c:1646  */
     { sub_counter = 0; }
-#line 2837 "awkgram.c" /* yacc.c:1646  */
+#line 2819 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 63:
-#line 1044 "awkgram.y" /* yacc.c:1646  */
+#line 1026 "awkgram.y" /* yacc.c:1646  */
     {
                char *arr = (yyvsp[-2])->lextok;
 
@@ -2870,11 +2852,11 @@ regular_print:
                        (yyval) = list_append(list_append((yyvsp[0]), 
(yyvsp[-2])), (yyvsp[-3]));
                }
          }
-#line 2874 "awkgram.c" /* yacc.c:1646  */
+#line 2856 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 64:
-#line 1081 "awkgram.y" /* yacc.c:1646  */
+#line 1063 "awkgram.y" /* yacc.c:1646  */
     {
                static bool warned = false;
                char *arr = (yyvsp[-1])->lextok;
@@ -2900,52 +2882,52 @@ regular_print:
                                fatal(_("`delete' is not allowed with 
FUNCTAB"));
                }
          }
-#line 2904 "awkgram.c" /* yacc.c:1646  */
+#line 2886 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 65:
-#line 1107 "awkgram.y" /* yacc.c:1646  */
+#line 1089 "awkgram.y" /* yacc.c:1646  */
     {  (yyval) = optimize_assignment((yyvsp[0])); }
-#line 2910 "awkgram.c" /* yacc.c:1646  */
+#line 2892 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 66:
-#line 1112 "awkgram.y" /* yacc.c:1646  */
+#line 1094 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = NULL; }
-#line 2916 "awkgram.c" /* yacc.c:1646  */
+#line 2898 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 67:
-#line 1114 "awkgram.y" /* yacc.c:1646  */
+#line 1096 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 2922 "awkgram.c" /* yacc.c:1646  */
+#line 2904 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 68:
-#line 1119 "awkgram.y" /* yacc.c:1646  */
+#line 1101 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = NULL; }
-#line 2928 "awkgram.c" /* yacc.c:1646  */
+#line 2910 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 69:
-#line 1121 "awkgram.y" /* yacc.c:1646  */
+#line 1103 "awkgram.y" /* yacc.c:1646  */
     {
                if ((yyvsp[-1]) == NULL)
                        (yyval) = list_create((yyvsp[0]));
                else
                        (yyval) = list_prepend((yyvsp[-1]), (yyvsp[0]));
          }
-#line 2939 "awkgram.c" /* yacc.c:1646  */
+#line 2921 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 70:
-#line 1128 "awkgram.y" /* yacc.c:1646  */
+#line 1110 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = NULL; }
-#line 2945 "awkgram.c" /* yacc.c:1646  */
+#line 2927 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 71:
-#line 1133 "awkgram.y" /* yacc.c:1646  */
+#line 1115 "awkgram.y" /* yacc.c:1646  */
     {
                INSTRUCTION *casestmt = (yyvsp[0]);
                if ((yyvsp[0]) == NULL)
@@ -2957,11 +2939,11 @@ regular_print:
                bcfree((yyvsp[-2]));
                (yyval) = (yyvsp[-4]);
          }
-#line 2961 "awkgram.c" /* yacc.c:1646  */
+#line 2943 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 72:
-#line 1145 "awkgram.y" /* yacc.c:1646  */
+#line 1127 "awkgram.y" /* yacc.c:1646  */
     {
                INSTRUCTION *casestmt = (yyvsp[0]);
                if ((yyvsp[0]) == NULL)
@@ -2972,17 +2954,17 @@ regular_print:
                (yyvsp[-3])->case_stmt = casestmt;
                (yyval) = (yyvsp[-3]);
          }
-#line 2976 "awkgram.c" /* yacc.c:1646  */
+#line 2958 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 73:
-#line 1159 "awkgram.y" /* yacc.c:1646  */
+#line 1141 "awkgram.y" /* yacc.c:1646  */
     {  (yyval) = (yyvsp[0]); }
-#line 2982 "awkgram.c" /* yacc.c:1646  */
+#line 2964 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 74:
-#line 1161 "awkgram.y" /* yacc.c:1646  */
+#line 1143 "awkgram.y" /* yacc.c:1646  */
     { 
                NODE *n = (yyvsp[0])->memory;
                (void) force_number(n);
@@ -2990,71 +2972,71 @@ regular_print:
                bcfree((yyvsp[-1]));
                (yyval) = (yyvsp[0]);
          }
-#line 2994 "awkgram.c" /* yacc.c:1646  */
+#line 2976 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 75:
-#line 1169 "awkgram.y" /* yacc.c:1646  */
+#line 1151 "awkgram.y" /* yacc.c:1646  */
     {
                bcfree((yyvsp[-1]));
                (yyval) = (yyvsp[0]);
          }
-#line 3003 "awkgram.c" /* yacc.c:1646  */
+#line 2985 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 76:
-#line 1174 "awkgram.y" /* yacc.c:1646  */
+#line 1156 "awkgram.y" /* yacc.c:1646  */
     {  (yyval) = (yyvsp[0]); }
-#line 3009 "awkgram.c" /* yacc.c:1646  */
+#line 2991 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 77:
-#line 1176 "awkgram.y" /* yacc.c:1646  */
+#line 1158 "awkgram.y" /* yacc.c:1646  */
     {
                (yyvsp[0])->opcode = Op_push_re;
                (yyval) = (yyvsp[0]);
          }
-#line 3018 "awkgram.c" /* yacc.c:1646  */
+#line 3000 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 78:
-#line 1184 "awkgram.y" /* yacc.c:1646  */
+#line 1166 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 3024 "awkgram.c" /* yacc.c:1646  */
+#line 3006 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 79:
-#line 1186 "awkgram.y" /* yacc.c:1646  */
+#line 1168 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 3030 "awkgram.c" /* yacc.c:1646  */
+#line 3012 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 81:
-#line 1196 "awkgram.y" /* yacc.c:1646  */
+#line 1178 "awkgram.y" /* yacc.c:1646  */
     {
                (yyval) = (yyvsp[-1]);
          }
-#line 3038 "awkgram.c" /* yacc.c:1646  */
+#line 3020 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 82:
-#line 1203 "awkgram.y" /* yacc.c:1646  */
+#line 1185 "awkgram.y" /* yacc.c:1646  */
     {
                in_print = false;
                in_parens = 0;
                (yyval) = NULL;
          }
-#line 3048 "awkgram.c" /* yacc.c:1646  */
+#line 3030 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 83:
-#line 1208 "awkgram.y" /* yacc.c:1646  */
+#line 1190 "awkgram.y" /* yacc.c:1646  */
     { in_print = false; in_parens = 0; }
-#line 3054 "awkgram.c" /* yacc.c:1646  */
+#line 3036 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 84:
-#line 1209 "awkgram.y" /* yacc.c:1646  */
+#line 1191 "awkgram.y" /* yacc.c:1646  */
     {
                if ((yyvsp[-2])->redir_type == redirect_twoway
                        && (yyvsp[0])->lasti->opcode == Op_K_getline_redir
@@ -3062,136 +3044,136 @@ regular_print:
                        yyerror(_("multistage two-way pipelines don't work"));
                (yyval) = list_prepend((yyvsp[0]), (yyvsp[-2]));
          }
-#line 3066 "awkgram.c" /* yacc.c:1646  */
+#line 3048 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 85:
-#line 1220 "awkgram.y" /* yacc.c:1646  */
+#line 1202 "awkgram.y" /* yacc.c:1646  */
     {
                (yyval) = mk_condition((yyvsp[-3]), (yyvsp[-5]), (yyvsp[0]), 
NULL, NULL);
          }
-#line 3074 "awkgram.c" /* yacc.c:1646  */
+#line 3056 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 86:
-#line 1225 "awkgram.y" /* yacc.c:1646  */
+#line 1207 "awkgram.y" /* yacc.c:1646  */
     {
                (yyval) = mk_condition((yyvsp[-6]), (yyvsp[-8]), (yyvsp[-3]), 
(yyvsp[-2]), (yyvsp[0]));
          }
-#line 3082 "awkgram.c" /* yacc.c:1646  */
+#line 3064 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 91:
-#line 1242 "awkgram.y" /* yacc.c:1646  */
+#line 1224 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = NULL; }
-#line 3088 "awkgram.c" /* yacc.c:1646  */
+#line 3070 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 92:
-#line 1244 "awkgram.y" /* yacc.c:1646  */
+#line 1226 "awkgram.y" /* yacc.c:1646  */
     {
                bcfree((yyvsp[-1]));
                (yyval) = (yyvsp[0]);
          }
-#line 3097 "awkgram.c" /* yacc.c:1646  */
+#line 3079 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 93:
-#line 1252 "awkgram.y" /* yacc.c:1646  */
+#line 1234 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = NULL; }
-#line 3103 "awkgram.c" /* yacc.c:1646  */
+#line 3085 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 94:
-#line 1254 "awkgram.y" /* yacc.c:1646  */
+#line 1236 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 3109 "awkgram.c" /* yacc.c:1646  */
+#line 3091 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 95:
-#line 1259 "awkgram.y" /* yacc.c:1646  */
+#line 1241 "awkgram.y" /* yacc.c:1646  */
     {
                (yyvsp[0])->param_count = 0;
                (yyval) = list_create((yyvsp[0]));
          }
-#line 3118 "awkgram.c" /* yacc.c:1646  */
+#line 3100 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 96:
-#line 1264 "awkgram.y" /* yacc.c:1646  */
+#line 1246 "awkgram.y" /* yacc.c:1646  */
     {
                (yyvsp[0])->param_count =  (yyvsp[-2])->lasti->param_count + 1;
                (yyval) = list_append((yyvsp[-2]), (yyvsp[0]));
                yyerrok;
          }
-#line 3128 "awkgram.c" /* yacc.c:1646  */
+#line 3110 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 97:
-#line 1270 "awkgram.y" /* yacc.c:1646  */
+#line 1252 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = NULL; }
-#line 3134 "awkgram.c" /* yacc.c:1646  */
+#line 3116 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 98:
-#line 1272 "awkgram.y" /* yacc.c:1646  */
+#line 1254 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[-1]); }
-#line 3140 "awkgram.c" /* yacc.c:1646  */
+#line 3122 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 99:
-#line 1274 "awkgram.y" /* yacc.c:1646  */
+#line 1256 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[-2]); }
-#line 3146 "awkgram.c" /* yacc.c:1646  */
+#line 3128 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 100:
-#line 1280 "awkgram.y" /* yacc.c:1646  */
+#line 1262 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = NULL; }
-#line 3152 "awkgram.c" /* yacc.c:1646  */
+#line 3134 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 101:
-#line 1282 "awkgram.y" /* yacc.c:1646  */
+#line 1264 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 3158 "awkgram.c" /* yacc.c:1646  */
+#line 3140 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 102:
-#line 1287 "awkgram.y" /* yacc.c:1646  */
+#line 1269 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = NULL; }
-#line 3164 "awkgram.c" /* yacc.c:1646  */
+#line 3146 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 103:
-#line 1289 "awkgram.y" /* yacc.c:1646  */
+#line 1271 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 3170 "awkgram.c" /* yacc.c:1646  */
+#line 3152 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 104:
-#line 1294 "awkgram.y" /* yacc.c:1646  */
+#line 1276 "awkgram.y" /* yacc.c:1646  */
     {  (yyval) = mk_expression_list(NULL, (yyvsp[0])); }
-#line 3176 "awkgram.c" /* yacc.c:1646  */
+#line 3158 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 105:
-#line 1296 "awkgram.y" /* yacc.c:1646  */
+#line 1278 "awkgram.y" /* yacc.c:1646  */
     {
                (yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
                yyerrok;
          }
-#line 3185 "awkgram.c" /* yacc.c:1646  */
+#line 3167 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 106:
-#line 1301 "awkgram.y" /* yacc.c:1646  */
+#line 1283 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = NULL; }
-#line 3191 "awkgram.c" /* yacc.c:1646  */
+#line 3173 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 107:
-#line 1303 "awkgram.y" /* yacc.c:1646  */
+#line 1285 "awkgram.y" /* yacc.c:1646  */
     {
                /*
                 * Returning the expression list instead of NULL lets
@@ -3199,52 +3181,52 @@ regular_print:
                 */
                (yyval) = (yyvsp[-1]);
          }
-#line 3203 "awkgram.c" /* yacc.c:1646  */
+#line 3185 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 108:
-#line 1311 "awkgram.y" /* yacc.c:1646  */
+#line 1293 "awkgram.y" /* yacc.c:1646  */
     {
                /* Ditto */
                (yyval) = mk_expression_list((yyvsp[-2]), (yyvsp[0]));
          }
-#line 3212 "awkgram.c" /* yacc.c:1646  */
+#line 3194 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 109:
-#line 1316 "awkgram.y" /* yacc.c:1646  */
+#line 1298 "awkgram.y" /* yacc.c:1646  */
     {
                /* Ditto */
                (yyval) = (yyvsp[-2]);
          }
-#line 3221 "awkgram.c" /* yacc.c:1646  */
+#line 3203 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 110:
-#line 1325 "awkgram.y" /* yacc.c:1646  */
+#line 1307 "awkgram.y" /* yacc.c:1646  */
     {
                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 3232 "awkgram.c" /* yacc.c:1646  */
+#line 3214 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 111:
-#line 1332 "awkgram.y" /* yacc.c:1646  */
+#line 1314 "awkgram.y" /* yacc.c:1646  */
     {  (yyval) = mk_boolean((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3238 "awkgram.c" /* yacc.c:1646  */
+#line 3220 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 112:
-#line 1334 "awkgram.y" /* yacc.c:1646  */
+#line 1316 "awkgram.y" /* yacc.c:1646  */
     {  (yyval) = mk_boolean((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3244 "awkgram.c" /* yacc.c:1646  */
+#line 3226 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 113:
-#line 1336 "awkgram.y" /* yacc.c:1646  */
+#line 1318 "awkgram.y" /* yacc.c:1646  */
     {
                if ((yyvsp[-2])->lasti->opcode == Op_match_rec)
                        warning_ln((yyvsp[-1])->source_line,
@@ -3260,11 +3242,11 @@ regular_print:
                        (yyval) = list_append(list_merge((yyvsp[-2]), 
(yyvsp[0])), (yyvsp[-1]));
                }
          }
-#line 3264 "awkgram.c" /* yacc.c:1646  */
+#line 3246 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 114:
-#line 1352 "awkgram.y" /* yacc.c:1646  */
+#line 1334 "awkgram.y" /* yacc.c:1646  */
     {
                if (do_lint_old)
                        warning_ln((yyvsp[-1])->source_line,
@@ -3274,91 +3256,91 @@ regular_print:
                (yyvsp[-1])->expr_count = 1;
                (yyval) = list_append(list_merge((yyvsp[-2]), (yyvsp[0])), 
(yyvsp[-1]));
          }
-#line 3278 "awkgram.c" /* yacc.c:1646  */
+#line 3260 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 115:
-#line 1362 "awkgram.y" /* yacc.c:1646  */
+#line 1344 "awkgram.y" /* yacc.c:1646  */
     {
                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 3289 "awkgram.c" /* yacc.c:1646  */
+#line 3271 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 116:
-#line 1369 "awkgram.y" /* yacc.c:1646  */
+#line 1351 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = mk_condition((yyvsp[-4]), (yyvsp[-3]), (yyvsp[-2]), 
(yyvsp[-1]), (yyvsp[0])); }
-#line 3295 "awkgram.c" /* yacc.c:1646  */
+#line 3277 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 117:
-#line 1371 "awkgram.y" /* yacc.c:1646  */
+#line 1353 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 3301 "awkgram.c" /* yacc.c:1646  */
+#line 3283 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 118:
-#line 1376 "awkgram.y" /* yacc.c:1646  */
+#line 1358 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 3307 "awkgram.c" /* yacc.c:1646  */
+#line 3289 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 119:
-#line 1378 "awkgram.y" /* yacc.c:1646  */
+#line 1360 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 3313 "awkgram.c" /* yacc.c:1646  */
+#line 3295 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 120:
-#line 1380 "awkgram.y" /* yacc.c:1646  */
+#line 1362 "awkgram.y" /* yacc.c:1646  */
     {  
                (yyvsp[0])->opcode = Op_assign_quotient;
                (yyval) = (yyvsp[0]);
          }
-#line 3322 "awkgram.c" /* yacc.c:1646  */
+#line 3304 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 121:
-#line 1388 "awkgram.y" /* yacc.c:1646  */
+#line 1370 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 3328 "awkgram.c" /* yacc.c:1646  */
+#line 3310 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 122:
-#line 1390 "awkgram.y" /* yacc.c:1646  */
+#line 1372 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 3334 "awkgram.c" /* yacc.c:1646  */
+#line 3316 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 123:
-#line 1395 "awkgram.y" /* yacc.c:1646  */
+#line 1377 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 3340 "awkgram.c" /* yacc.c:1646  */
+#line 3322 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 124:
-#line 1397 "awkgram.y" /* yacc.c:1646  */
+#line 1379 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 3346 "awkgram.c" /* yacc.c:1646  */
+#line 3328 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 125:
-#line 1402 "awkgram.y" /* yacc.c:1646  */
+#line 1384 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 3352 "awkgram.c" /* yacc.c:1646  */
+#line 3334 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 126:
-#line 1404 "awkgram.y" /* yacc.c:1646  */
+#line 1386 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 3358 "awkgram.c" /* yacc.c:1646  */
+#line 3340 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 127:
-#line 1406 "awkgram.y" /* yacc.c:1646  */
+#line 1388 "awkgram.y" /* yacc.c:1646  */
     {
                int count = 2;
                bool is_simple_var = false;
@@ -3405,47 +3387,47 @@ regular_print:
                                max_args = count;
                }
          }
-#line 3409 "awkgram.c" /* yacc.c:1646  */
+#line 3391 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 129:
-#line 1458 "awkgram.y" /* yacc.c:1646  */
+#line 1440 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3415 "awkgram.c" /* yacc.c:1646  */
+#line 3397 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 130:
-#line 1460 "awkgram.y" /* yacc.c:1646  */
+#line 1442 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3421 "awkgram.c" /* yacc.c:1646  */
+#line 3403 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 131:
-#line 1462 "awkgram.y" /* yacc.c:1646  */
+#line 1444 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3427 "awkgram.c" /* yacc.c:1646  */
+#line 3409 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 132:
-#line 1464 "awkgram.y" /* yacc.c:1646  */
+#line 1446 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3433 "awkgram.c" /* yacc.c:1646  */
+#line 3415 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 133:
-#line 1466 "awkgram.y" /* yacc.c:1646  */
+#line 1448 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3439 "awkgram.c" /* yacc.c:1646  */
+#line 3421 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 134:
-#line 1468 "awkgram.y" /* yacc.c:1646  */
+#line 1450 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3445 "awkgram.c" /* yacc.c:1646  */
+#line 3427 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 135:
-#line 1470 "awkgram.y" /* yacc.c:1646  */
+#line 1452 "awkgram.y" /* yacc.c:1646  */
     {
                /*
                 * In BEGINFILE/ENDFILE, allow `getline [var] < file'
@@ -3459,29 +3441,29 @@ regular_print:
                                _("non-redirected `getline' undefined inside 
END action"));
                (yyval) = mk_getline((yyvsp[-2]), (yyvsp[-1]), (yyvsp[0]), 
redirect_input);
          }
-#line 3463 "awkgram.c" /* yacc.c:1646  */
+#line 3445 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 136:
-#line 1484 "awkgram.y" /* yacc.c:1646  */
+#line 1466 "awkgram.y" /* yacc.c:1646  */
     {
                (yyvsp[0])->opcode = Op_postincrement;
                (yyval) = mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
          }
-#line 3472 "awkgram.c" /* yacc.c:1646  */
+#line 3454 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 137:
-#line 1489 "awkgram.y" /* yacc.c:1646  */
+#line 1471 "awkgram.y" /* yacc.c:1646  */
     {
                (yyvsp[0])->opcode = Op_postdecrement;
                (yyval) = mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
          }
-#line 3481 "awkgram.c" /* yacc.c:1646  */
+#line 3463 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 138:
-#line 1494 "awkgram.y" /* yacc.c:1646  */
+#line 1476 "awkgram.y" /* yacc.c:1646  */
     {
                if (do_lint_old) {
                    warning_ln((yyvsp[-1])->source_line,
@@ -3501,64 +3483,64 @@ regular_print:
                        (yyval) = list_append(list_merge(t, (yyvsp[0])), 
(yyvsp[-1]));
                }
          }
-#line 3505 "awkgram.c" /* yacc.c:1646  */
+#line 3487 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 139:
-#line 1519 "awkgram.y" /* yacc.c:1646  */
+#line 1501 "awkgram.y" /* yacc.c:1646  */
     {
                  (yyval) = mk_getline((yyvsp[-1]), (yyvsp[0]), (yyvsp[-3]), 
(yyvsp[-2])->redir_type);
                  bcfree((yyvsp[-2]));
                }
-#line 3514 "awkgram.c" /* yacc.c:1646  */
+#line 3496 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 140:
-#line 1525 "awkgram.y" /* yacc.c:1646  */
+#line 1507 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3520 "awkgram.c" /* yacc.c:1646  */
+#line 3502 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 141:
-#line 1527 "awkgram.y" /* yacc.c:1646  */
+#line 1509 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3526 "awkgram.c" /* yacc.c:1646  */
+#line 3508 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 142:
-#line 1529 "awkgram.y" /* yacc.c:1646  */
+#line 1511 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3532 "awkgram.c" /* yacc.c:1646  */
+#line 3514 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 143:
-#line 1531 "awkgram.y" /* yacc.c:1646  */
+#line 1513 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3538 "awkgram.c" /* yacc.c:1646  */
+#line 3520 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 144:
-#line 1533 "awkgram.y" /* yacc.c:1646  */
+#line 1515 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3544 "awkgram.c" /* yacc.c:1646  */
+#line 3526 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 145:
-#line 1535 "awkgram.y" /* yacc.c:1646  */
+#line 1517 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = mk_binary((yyvsp[-2]), (yyvsp[0]), (yyvsp[-1])); }
-#line 3550 "awkgram.c" /* yacc.c:1646  */
+#line 3532 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 146:
-#line 1540 "awkgram.y" /* yacc.c:1646  */
+#line 1522 "awkgram.y" /* yacc.c:1646  */
     {
                (yyval) = list_create((yyvsp[0]));
          }
-#line 3558 "awkgram.c" /* yacc.c:1646  */
+#line 3540 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 147:
-#line 1544 "awkgram.y" /* yacc.c:1646  */
+#line 1526 "awkgram.y" /* yacc.c:1646  */
     {
                if ((yyvsp[0])->opcode == Op_match_rec) {
                        (yyvsp[0])->opcode = Op_nomatch;
@@ -3590,37 +3572,37 @@ regular_print:
                        }
                }
           }
-#line 3594 "awkgram.c" /* yacc.c:1646  */
+#line 3576 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 148:
-#line 1576 "awkgram.y" /* yacc.c:1646  */
+#line 1558 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[-1]); }
-#line 3600 "awkgram.c" /* yacc.c:1646  */
+#line 3582 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 149:
-#line 1578 "awkgram.y" /* yacc.c:1646  */
+#line 1560 "awkgram.y" /* yacc.c:1646  */
     {
                (yyval) = snode((yyvsp[-1]), (yyvsp[-3]));
                if ((yyval) == NULL)
                        YYABORT;
          }
-#line 3610 "awkgram.c" /* yacc.c:1646  */
+#line 3592 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 150:
-#line 1584 "awkgram.y" /* yacc.c:1646  */
+#line 1566 "awkgram.y" /* yacc.c:1646  */
     {
                (yyval) = snode((yyvsp[-1]), (yyvsp[-3]));
                if ((yyval) == NULL)
                        YYABORT;
          }
-#line 3620 "awkgram.c" /* yacc.c:1646  */
+#line 3602 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 151:
-#line 1590 "awkgram.y" /* yacc.c:1646  */
+#line 1572 "awkgram.y" /* yacc.c:1646  */
     {
                static bool warned = false;
 
@@ -3633,45 +3615,45 @@ regular_print:
                if ((yyval) == NULL)
                        YYABORT;
          }
-#line 3637 "awkgram.c" /* yacc.c:1646  */
+#line 3619 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 154:
-#line 1605 "awkgram.y" /* yacc.c:1646  */
+#line 1587 "awkgram.y" /* yacc.c:1646  */
     {
                (yyvsp[-1])->opcode = Op_preincrement;
                (yyval) = mk_assignment((yyvsp[0]), NULL, (yyvsp[-1]));
          }
-#line 3646 "awkgram.c" /* yacc.c:1646  */
+#line 3628 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 155:
-#line 1610 "awkgram.y" /* yacc.c:1646  */
+#line 1592 "awkgram.y" /* yacc.c:1646  */
     {
                (yyvsp[-1])->opcode = Op_predecrement;
                (yyval) = mk_assignment((yyvsp[0]), NULL, (yyvsp[-1]));
          }
-#line 3655 "awkgram.c" /* yacc.c:1646  */
+#line 3637 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 156:
-#line 1615 "awkgram.y" /* yacc.c:1646  */
+#line 1597 "awkgram.y" /* yacc.c:1646  */
     {
                (yyval) = list_create((yyvsp[0]));
          }
-#line 3663 "awkgram.c" /* yacc.c:1646  */
+#line 3645 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 157:
-#line 1619 "awkgram.y" /* yacc.c:1646  */
+#line 1601 "awkgram.y" /* yacc.c:1646  */
     {
                (yyval) = list_create((yyvsp[0]));
          }
-#line 3671 "awkgram.c" /* yacc.c:1646  */
+#line 3653 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 158:
-#line 1623 "awkgram.y" /* yacc.c:1646  */
+#line 1605 "awkgram.y" /* yacc.c:1646  */
     {
                if ((yyvsp[0])->lasti->opcode == Op_push_i
                        && ((yyvsp[0])->lasti->memory->flags & (STRCUR|STRING)) 
== 0
@@ -3686,11 +3668,11 @@ regular_print:
                        (yyval) = list_append((yyvsp[0]), (yyvsp[-1]));
                }
          }
-#line 3690 "awkgram.c" /* yacc.c:1646  */
+#line 3672 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 159:
-#line 1638 "awkgram.y" /* yacc.c:1646  */
+#line 1620 "awkgram.y" /* yacc.c:1646  */
     {
            /*
             * was: $$ = $2
@@ -3700,20 +3682,20 @@ regular_print:
                (yyvsp[-1])->memory = make_number(0.0);
                (yyval) = list_append((yyvsp[0]), (yyvsp[-1]));
          }
-#line 3704 "awkgram.c" /* yacc.c:1646  */
+#line 3686 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 160:
-#line 1651 "awkgram.y" /* yacc.c:1646  */
+#line 1633 "awkgram.y" /* yacc.c:1646  */
     {
                func_use((yyvsp[0])->lasti->func_name, FUNC_USE);
                (yyval) = (yyvsp[0]);
          }
-#line 3713 "awkgram.c" /* yacc.c:1646  */
+#line 3695 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 161:
-#line 1656 "awkgram.y" /* yacc.c:1646  */
+#line 1638 "awkgram.y" /* yacc.c:1646  */
     {
                /* indirect function call */
                INSTRUCTION *f, *t;
@@ -3746,11 +3728,11 @@ regular_print:
 
                (yyval) = list_prepend((yyvsp[0]), t);
          }
-#line 3750 "awkgram.c" /* yacc.c:1646  */
+#line 3732 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 162:
-#line 1692 "awkgram.y" /* yacc.c:1646  */
+#line 1674 "awkgram.y" /* yacc.c:1646  */
     {
                param_sanity((yyvsp[-1]));
                (yyvsp[-3])->opcode = Op_func_call;
@@ -3764,49 +3746,49 @@ regular_print:
                        (yyval) = list_append(t, (yyvsp[-3]));
                }
          }
-#line 3768 "awkgram.c" /* yacc.c:1646  */
+#line 3750 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 163:
-#line 1709 "awkgram.y" /* yacc.c:1646  */
+#line 1691 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = NULL; }
-#line 3774 "awkgram.c" /* yacc.c:1646  */
+#line 3756 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 164:
-#line 1711 "awkgram.y" /* yacc.c:1646  */
+#line 1693 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 3780 "awkgram.c" /* yacc.c:1646  */
+#line 3762 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 165:
-#line 1716 "awkgram.y" /* yacc.c:1646  */
+#line 1698 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = NULL; }
-#line 3786 "awkgram.c" /* yacc.c:1646  */
+#line 3768 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 166:
-#line 1718 "awkgram.y" /* yacc.c:1646  */
+#line 1700 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[-1]); }
-#line 3792 "awkgram.c" /* yacc.c:1646  */
+#line 3774 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 167:
-#line 1723 "awkgram.y" /* yacc.c:1646  */
+#line 1705 "awkgram.y" /* yacc.c:1646  */
     {  (yyval) = (yyvsp[0]); }
-#line 3798 "awkgram.c" /* yacc.c:1646  */
+#line 3780 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 168:
-#line 1725 "awkgram.y" /* yacc.c:1646  */
+#line 1707 "awkgram.y" /* yacc.c:1646  */
     {
                (yyval) = list_merge((yyvsp[-1]), (yyvsp[0]));
          }
-#line 3806 "awkgram.c" /* yacc.c:1646  */
+#line 3788 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 169:
-#line 1732 "awkgram.y" /* yacc.c:1646  */
+#line 1714 "awkgram.y" /* yacc.c:1646  */
     {
                INSTRUCTION *ip = (yyvsp[0])->lasti; 
                int count = ip->sub_count;      /* # of SUBSEP-seperated 
expressions */
@@ -3820,11 +3802,11 @@ regular_print:
                sub_counter++;  /* count # of dimensions */
                (yyval) = (yyvsp[0]);
          }
-#line 3824 "awkgram.c" /* yacc.c:1646  */
+#line 3806 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 170:
-#line 1749 "awkgram.y" /* yacc.c:1646  */
+#line 1731 "awkgram.y" /* yacc.c:1646  */
     {
                INSTRUCTION *t = (yyvsp[-1]);
                if ((yyvsp[-1]) == NULL) {
@@ -3838,31 +3820,31 @@ regular_print:
                        (yyvsp[0])->sub_count = count_expressions(&t, false);
                (yyval) = list_append(t, (yyvsp[0]));
          }
-#line 3842 "awkgram.c" /* yacc.c:1646  */
+#line 3824 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 171:
-#line 1766 "awkgram.y" /* yacc.c:1646  */
+#line 1748 "awkgram.y" /* yacc.c:1646  */
     {  (yyval) = (yyvsp[0]); }
-#line 3848 "awkgram.c" /* yacc.c:1646  */
+#line 3830 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 172:
-#line 1768 "awkgram.y" /* yacc.c:1646  */
+#line 1750 "awkgram.y" /* yacc.c:1646  */
     {
                (yyval) = list_merge((yyvsp[-1]), (yyvsp[0]));
          }
-#line 3856 "awkgram.c" /* yacc.c:1646  */
+#line 3838 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 173:
-#line 1775 "awkgram.y" /* yacc.c:1646  */
+#line 1757 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[-1]); }
-#line 3862 "awkgram.c" /* yacc.c:1646  */
+#line 3844 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 174:
-#line 1780 "awkgram.y" /* yacc.c:1646  */
+#line 1762 "awkgram.y" /* yacc.c:1646  */
     {
                char *var_name = (yyvsp[0])->lextok;
 
@@ -3870,22 +3852,22 @@ regular_print:
                (yyvsp[0])->memory = variable((yyvsp[0])->source_line, 
var_name, Node_var_new);
                (yyval) = list_create((yyvsp[0]));
          }
-#line 3874 "awkgram.c" /* yacc.c:1646  */
+#line 3856 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 175:
-#line 1788 "awkgram.y" /* yacc.c:1646  */
+#line 1770 "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 3885 "awkgram.c" /* yacc.c:1646  */
+#line 3867 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 176:
-#line 1798 "awkgram.y" /* yacc.c:1646  */
+#line 1780 "awkgram.y" /* yacc.c:1646  */
     {
                INSTRUCTION *ip = (yyvsp[0])->nexti;
                if (ip->opcode == Op_push
@@ -3897,73 +3879,73 @@ regular_print:
                } else
                        (yyval) = (yyvsp[0]);
          }
-#line 3901 "awkgram.c" /* yacc.c:1646  */
+#line 3883 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 177:
-#line 1810 "awkgram.y" /* yacc.c:1646  */
+#line 1792 "awkgram.y" /* yacc.c:1646  */
     {
                (yyval) = list_append((yyvsp[-1]), (yyvsp[-2]));
                if ((yyvsp[0]) != NULL)
                        mk_assignment((yyvsp[-1]), NULL, (yyvsp[0]));
          }
-#line 3911 "awkgram.c" /* yacc.c:1646  */
+#line 3893 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 178:
-#line 1819 "awkgram.y" /* yacc.c:1646  */
+#line 1801 "awkgram.y" /* yacc.c:1646  */
     {
                (yyvsp[0])->opcode = Op_postincrement;
          }
-#line 3919 "awkgram.c" /* yacc.c:1646  */
+#line 3901 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 179:
-#line 1823 "awkgram.y" /* yacc.c:1646  */
+#line 1805 "awkgram.y" /* yacc.c:1646  */
     {
                (yyvsp[0])->opcode = Op_postdecrement;
          }
-#line 3927 "awkgram.c" /* yacc.c:1646  */
+#line 3909 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 180:
-#line 1826 "awkgram.y" /* yacc.c:1646  */
+#line 1808 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = NULL; }
-#line 3933 "awkgram.c" /* yacc.c:1646  */
+#line 3915 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 182:
-#line 1834 "awkgram.y" /* yacc.c:1646  */
+#line 1816 "awkgram.y" /* yacc.c:1646  */
     { yyerrok; }
-#line 3939 "awkgram.c" /* yacc.c:1646  */
+#line 3921 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 183:
-#line 1838 "awkgram.y" /* yacc.c:1646  */
+#line 1820 "awkgram.y" /* yacc.c:1646  */
     { yyerrok; }
-#line 3945 "awkgram.c" /* yacc.c:1646  */
+#line 3927 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 186:
-#line 1847 "awkgram.y" /* yacc.c:1646  */
+#line 1829 "awkgram.y" /* yacc.c:1646  */
     { yyerrok; }
-#line 3951 "awkgram.c" /* yacc.c:1646  */
+#line 3933 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 187:
-#line 1851 "awkgram.y" /* yacc.c:1646  */
+#line 1833 "awkgram.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); yyerrok; }
-#line 3957 "awkgram.c" /* yacc.c:1646  */
+#line 3939 "awkgram.c" /* yacc.c:1646  */
     break;
 
   case 188:
-#line 1855 "awkgram.y" /* yacc.c:1646  */
+#line 1837 "awkgram.y" /* yacc.c:1646  */
     { yyerrok; }
-#line 3963 "awkgram.c" /* yacc.c:1646  */
+#line 3945 "awkgram.c" /* yacc.c:1646  */
     break;
 
 
-#line 3967 "awkgram.c" /* yacc.c:1646  */
+#line 3949 "awkgram.c" /* yacc.c:1646  */
       default: break;
     }
   /* User semantic actions sometimes alter yychar, and that requires
@@ -4191,7 +4173,7 @@ yyreturn:
 #endif
   return yyresult;
 }
-#line 1857 "awkgram.y" /* yacc.c:1906  */
+#line 1839 "awkgram.y" /* yacc.c:1906  */
 
 
 struct token {
@@ -4620,13 +4602,6 @@ mk_program()
                                cp = end_block;
                        else
                                cp = list_merge(begin_block, end_block);
-                       /*
-                        * We don't need to clear the comment variables
-                        * since they're not used anymore after this
-                        * function is called.
-                        */
-                       if (comment != NULL)
-                               (void) list_append(cp, comment);
                        (void) list_append(cp, ip_atexit);
                        (void) list_append(cp, instruction(Op_stop));
 
@@ -4659,12 +4634,6 @@ mk_program()
        if (begin_block != NULL)
                cp = list_merge(begin_block, cp);
 
-       if (program_comment != NULL) {
-               (void) list_prepend(cp, program_comment);
-       }  
-       if (comment != NULL) {
-               (void) list_append(cp, comment);
-       } 
        (void) list_append(cp, ip_atexit);
        (void) list_append(cp, instruction(Op_stop));
 
@@ -5314,11 +5283,10 @@ pushback(void)
        (! lexeof && lexptr && lexptr > lexptr_begin ? lexptr-- : lexptr);
 }
 
-
 /* get_comment --- collect comment text */
 
 int
-get_comment(void)
+get_comment(int flag)
 {
        int c;
        int sl;
@@ -5330,6 +5298,12 @@ get_comment(void)
                while ((c = nextc(false)) != '\n' && c != END_FILE) {
                        tokadd(c);
                }
+               if (flag == 1) {
+                       /* comment at end of line.  */
+                       if (c == '\n')
+                               tokadd(c);
+                       break;
+               }
                if (c == '\n') {
                        tokadd(c);
                        sourceline++;
@@ -5344,6 +5318,7 @@ get_comment(void)
                                break;
                        else if (c != '#') {
                                pushback();
+                               sourceline--;
                                break;
                        } else
                                tokadd(c);
@@ -5351,8 +5326,10 @@ get_comment(void)
                        break;
        }
        comment = bcalloc(Op_comment, 1, sl);
+       comment->comment_text = make_str_node(tokstart, tok - tokstart, 0);
        comment->source_file = source;
-       comment->memory = make_str_node(tokstart, tok - tokstart, 0);
+       comment->comment_text->comment_type = current_comment_type;
+       append_comment(comment);
 
        return c;
 }
@@ -5366,20 +5343,19 @@ split_comment(void)
        int l;
        NODE *n;
 
-       p = comment->memory->stptr;
-       l = comment->memory->stlen - 3;
+       p = last_comment->comment_text->stptr;
+       l = last_comment->comment_text->stlen - 3;
        /* have at least two comments so split at last blank line (\n\n)  */
        while (l >= 0) {
                if (p[l] == '\n' && p[l+1] == '\n') {
-                       function_comment = comment;
-                       n = function_comment->memory;
-                       function_comment->memory = make_str_node(p + l + 2, 
n->stlen - l - 2, 0);
-                       /* create program comment  */
-                       program_comment = bcalloc(Op_comment, 1, sourceline);
-                       program_comment->source_file = comment->source_file;
+                       n = last_comment->comment_text;
+                       /* create function comment  */
+                       comment = bcalloc(Op_comment, 1, sourceline);
+                       comment->source_file = source;
+                       comment->comment_text = make_str_node(p + l + 2, 
n->stlen - l - 2, 0);
                        p[l + 2] = 0;
-                       program_comment->memory = make_str_node(p, l + 2, 0);
-                       comment = NULL;
+                       last_comment->comment_text = make_str_node(p, l + 2, 0);
+                       append_comment(comment);
                        freenode(n);
                        break;
                }
@@ -5388,6 +5364,22 @@ split_comment(void)
        }
 }
 
+/* append_comment --- append latest comment to our list of comments */
+
+static void
+append_comment(INSTRUCTION *ip)
+{
+       if (first_comment == NULL) {
+               first_comment = ip;
+               last_comment = ip;
+       } else
+               last_comment->nexti = ip;
+
+       last_comment = ip;
+       last_comment->nexti = NULL;     
+       ip = NULL;
+}
+
 /* allow_newline --- allow newline after &&, ||, ? and : */
 
 static void
@@ -5404,7 +5396,7 @@ allow_newline(void)
                if (c == '#') {
                        if (do_pretty_print && ! do_profile) {
                        /* collect comment byte code iff doing pretty print but 
not profiling.  */
-                               c = get_comment();
+                               c = get_comment(1);
                        } else {
                                while ((c = nextc(false)) != '\n' && c != 
END_FILE)
                                        continue;
@@ -5616,7 +5608,10 @@ retry:
                         * Collect comment byte code iff doing pretty print
                         * but not profiling.
                         */
-                       c = get_comment();
+                       if (lasttok == NEWLINE)
+                               c = get_comment(2);
+                       else
+                               c = get_comment(1);
 
                        if (c == END_FILE)
                                return lasttok = NEWLINE_EOF;
@@ -5653,7 +5648,7 @@ retry:
                _("use of `\\ #...' line continuation is not portable"));
                                }
                                if (do_pretty_print && ! do_profile)
-                                       c = get_comment();
+                                       c = get_comment(2);
                                else {
                                        while ((c = nextc(false)) != '\n')
                                                if (c == END_FILE)
@@ -6671,6 +6666,7 @@ void
 dump_funcs()
 {
        NODE **funcs;
+       current_comment_type = 1;
        funcs = function_list(true);
        (void) foreach_func(funcs, (int (*)(INSTRUCTION *, void *)) pp_func, 
(void *) 0);
        efree(funcs);
@@ -6723,14 +6719,6 @@ mk_function(INSTRUCTION *fi, INSTRUCTION *def)
                        (t + 1)->tail_call = true;
        }
 
-       /* add any pre-function comment to start of action for profile.c  */
-
-       if (function_comment != NULL) {
-               function_comment->source_line = 0;
-               (void) list_prepend(def, function_comment);
-               function_comment = NULL;
-       }
-
        /* add an implicit return at end;
         * also used by 'return' command in debugger
         */
@@ -6757,6 +6745,7 @@ mk_function(INSTRUCTION *fi, INSTRUCTION *def)
 
        /* remove params from symbol table */
        remove_params(thisfunc);
+       current_comment_type = 0;
        return fi;
 }
 
diff --git a/awkgram.y b/awkgram.y
index 85825cb..5c6e2eb 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -58,6 +58,8 @@ static int load_library(INSTRUCTION *file);
 static void next_sourcefile(void);
 static char *tokexpand(void);
 static bool is_deferred_variable(const char *name);
+static void split_comment(void);
+static void append_comment(INSTRUCTION *ip);
 
 #define instruction(t) bcalloc(t, 1, 0)
 
@@ -87,7 +89,6 @@ static void check_funcs(void);
 
 static ssize_t read_one_line(int fd, void *buffer, size_t count);
 static int one_line_close(int fd);
-static void split_comment(void);
 
 static bool want_source = false;
 static bool want_regexp = false;       /* lexical scanning kludge */
@@ -148,8 +149,6 @@ static INSTRUCTION *ip_endfile;
 static INSTRUCTION *ip_beginfile;
 
 static INSTRUCTION *comment = NULL;
-static INSTRUCTION *program_comment = NULL;
-static INSTRUCTION *function_comment = NULL;
 
 static bool func_first = true;
 
@@ -160,6 +159,12 @@ static inline INSTRUCTION *list_merge(INSTRUCTION *l1, 
INSTRUCTION *l2);
 
 extern double fmod(double x, double y);
 
+/* first and last pointers to comment list  */
+INSTRUCTION *first_comment = NULL;
+INSTRUCTION *last_comment = NULL;
+/* comment type (program=0, function=1)  */
+int current_comment_type = 0;
+
 #define YYSTYPE INSTRUCTION *
 %}
 
@@ -295,20 +300,12 @@ pattern
        : /* empty */
          {
                rule = Rule;
-               if (comment != NULL) {
-                       $$ = list_create(comment);
-                       comment = NULL;
-               } else
-                       $$ = NULL;
+               $$ = NULL;
          }
        | exp
          {
                rule = Rule;
-               if (comment != NULL) {
-                       $$ = list_prepend($1, comment);
-                       comment = NULL;
-               } else
-                       $$ = $1;
+               $$ = $1;
          }
                
        | exp ',' opt_nls exp
@@ -383,10 +380,16 @@ action
        : l_brace statements r_brace opt_semi opt_nls
          {
                INSTRUCTION *ip;
+               INSTRUCTION *tp;
                if ($2 == NULL)
                        ip = list_create(instruction(Op_no_op));
-               else
-                       ip = $2;
+               else {
+                       if (do_pretty_print) {
+                               tp = bcalloc(Op_no_op, 1, lastline);
+                               ip = list_append($2, tp);
+                       } else
+                               ip = $2;
+               }
                $$ = ip;
          }
        ;
@@ -421,14 +424,10 @@ function_prologue
                 *  than one such comments, treat the last as a function
                 *  comment.
                 */
-               if (comment != NULL && func_first
-                   && strstr(comment->memory->stptr, "\n\n") != NULL)
+               current_comment_type = 1;
+               if (last_comment != NULL && func_first
+                   && strstr(last_comment->comment_text->stptr, "\n\n") != 
NULL)
                        split_comment();
-               /* save any other pre-function comment as function comment  */
-               if (comment != NULL) {
-                       function_comment = comment;
-                       comment = NULL;
-               }
                func_first = false;
                $1->source_file = source;
                if (install_function($2->lextok, $1, $4) < 0)
@@ -488,34 +487,17 @@ a_slash
 statements
        : /* empty */
          {
-               if (comment != NULL) {
-                       $$ = list_create(comment);
-                       comment = NULL;
-               } else $$ = NULL;
+               $$ = NULL;
          }
        | statements statement
          {
                if ($2 == NULL) {
-                       if (comment == NULL)
-                               $$ = $1;
-                       else {
-                               $$ = list_append($1, comment);
-                               comment = NULL;
-                       }
+                       $$ = $1;
                } else {
                        add_lint($2, LINT_no_effect);
                        if ($1 == NULL) {
-                               if (comment == NULL)
-                                       $$ = $2;
-                               else {
-                                       $$ = list_append($2, comment);
-                                       comment = NULL;
-                               }
+                               $$ = $2;
                        } else {
-                               if (comment != NULL) {
-                                       list_append($2, comment);
-                                       comment = NULL;
-                               }
                                $$ = list_merge($1, $2);
                        }
                }
@@ -2282,13 +2264,6 @@ mk_program()
                                cp = end_block;
                        else
                                cp = list_merge(begin_block, end_block);
-                       /*
-                        * We don't need to clear the comment variables
-                        * since they're not used anymore after this
-                        * function is called.
-                        */
-                       if (comment != NULL)
-                               (void) list_append(cp, comment);
                        (void) list_append(cp, ip_atexit);
                        (void) list_append(cp, instruction(Op_stop));
 
@@ -2321,12 +2296,6 @@ mk_program()
        if (begin_block != NULL)
                cp = list_merge(begin_block, cp);
 
-       if (program_comment != NULL) {
-               (void) list_prepend(cp, program_comment);
-       }  
-       if (comment != NULL) {
-               (void) list_append(cp, comment);
-       } 
        (void) list_append(cp, ip_atexit);
        (void) list_append(cp, instruction(Op_stop));
 
@@ -2976,11 +2945,10 @@ pushback(void)
        (! lexeof && lexptr && lexptr > lexptr_begin ? lexptr-- : lexptr);
 }
 
-
 /* get_comment --- collect comment text */
 
 int
-get_comment(void)
+get_comment(int flag)
 {
        int c;
        int sl;
@@ -2992,6 +2960,12 @@ get_comment(void)
                while ((c = nextc(false)) != '\n' && c != END_FILE) {
                        tokadd(c);
                }
+               if (flag == 1) {
+                       /* comment at end of line.  */
+                       if (c == '\n')
+                               tokadd(c);
+                       break;
+               }
                if (c == '\n') {
                        tokadd(c);
                        sourceline++;
@@ -3006,6 +2980,7 @@ get_comment(void)
                                break;
                        else if (c != '#') {
                                pushback();
+                               sourceline--;
                                break;
                        } else
                                tokadd(c);
@@ -3013,8 +2988,10 @@ get_comment(void)
                        break;
        }
        comment = bcalloc(Op_comment, 1, sl);
+       comment->comment_text = make_str_node(tokstart, tok - tokstart, 0);
        comment->source_file = source;
-       comment->memory = make_str_node(tokstart, tok - tokstart, 0);
+       comment->comment_text->comment_type = current_comment_type;
+       append_comment(comment);
 
        return c;
 }
@@ -3028,20 +3005,19 @@ split_comment(void)
        int l;
        NODE *n;
 
-       p = comment->memory->stptr;
-       l = comment->memory->stlen - 3;
+       p = last_comment->comment_text->stptr;
+       l = last_comment->comment_text->stlen - 3;
        /* have at least two comments so split at last blank line (\n\n)  */
        while (l >= 0) {
                if (p[l] == '\n' && p[l+1] == '\n') {
-                       function_comment = comment;
-                       n = function_comment->memory;
-                       function_comment->memory = make_str_node(p + l + 2, 
n->stlen - l - 2, 0);
-                       /* create program comment  */
-                       program_comment = bcalloc(Op_comment, 1, sourceline);
-                       program_comment->source_file = comment->source_file;
+                       n = last_comment->comment_text;
+                       /* create function comment  */
+                       comment = bcalloc(Op_comment, 1, sourceline);
+                       comment->source_file = source;
+                       comment->comment_text = make_str_node(p + l + 2, 
n->stlen - l - 2, 0);
                        p[l + 2] = 0;
-                       program_comment->memory = make_str_node(p, l + 2, 0);
-                       comment = NULL;
+                       last_comment->comment_text = make_str_node(p, l + 2, 0);
+                       append_comment(comment);
                        freenode(n);
                        break;
                }
@@ -3050,6 +3026,22 @@ split_comment(void)
        }
 }
 
+/* append_comment --- append latest comment to our list of comments */
+
+static void
+append_comment(INSTRUCTION *ip)
+{
+       if (first_comment == NULL) {
+               first_comment = ip;
+               last_comment = ip;
+       } else
+               last_comment->nexti = ip;
+
+       last_comment = ip;
+       last_comment->nexti = NULL;     
+       ip = NULL;
+}
+
 /* allow_newline --- allow newline after &&, ||, ? and : */
 
 static void
@@ -3066,7 +3058,7 @@ allow_newline(void)
                if (c == '#') {
                        if (do_pretty_print && ! do_profile) {
                        /* collect comment byte code iff doing pretty print but 
not profiling.  */
-                               c = get_comment();
+                               c = get_comment(1);
                        } else {
                                while ((c = nextc(false)) != '\n' && c != 
END_FILE)
                                        continue;
@@ -3278,7 +3270,10 @@ retry:
                         * Collect comment byte code iff doing pretty print
                         * but not profiling.
                         */
-                       c = get_comment();
+                       if (lasttok == NEWLINE)
+                               c = get_comment(2);
+                       else
+                               c = get_comment(1);
 
                        if (c == END_FILE)
                                return lasttok = NEWLINE_EOF;
@@ -3315,7 +3310,7 @@ retry:
                _("use of `\\ #...' line continuation is not portable"));
                                }
                                if (do_pretty_print && ! do_profile)
-                                       c = get_comment();
+                                       c = get_comment(2);
                                else {
                                        while ((c = nextc(false)) != '\n')
                                                if (c == END_FILE)
@@ -4333,6 +4328,7 @@ void
 dump_funcs()
 {
        NODE **funcs;
+       current_comment_type = 1;
        funcs = function_list(true);
        (void) foreach_func(funcs, (int (*)(INSTRUCTION *, void *)) pp_func, 
(void *) 0);
        efree(funcs);
@@ -4385,14 +4381,6 @@ mk_function(INSTRUCTION *fi, INSTRUCTION *def)
                        (t + 1)->tail_call = true;
        }
 
-       /* add any pre-function comment to start of action for profile.c  */
-
-       if (function_comment != NULL) {
-               function_comment->source_line = 0;
-               (void) list_prepend(def, function_comment);
-               function_comment = NULL;
-       }
-
        /* add an implicit return at end;
         * also used by 'return' command in debugger
         */
@@ -4419,6 +4407,7 @@ mk_function(INSTRUCTION *fi, INSTRUCTION *def)
 
        /* remove params from symbol table */
        remove_params(thisfunc);
+       current_comment_type = 0;
        return fi;
 }
 
diff --git a/main.c b/main.c
index 93f9499..5483588 100644
--- a/main.c
+++ b/main.c
@@ -71,6 +71,7 @@ static void save_argv(int, char **);
 
 extern int debug_prog(INSTRUCTION *pc); /* debug.c */
 extern int init_debug();       /* debug.c */
+extern void print_extra_comments(char *src, int ct);
 
 /* These nodes store all the special variables AWK uses */
 NODE *ARGC_node, *ARGIND_node, *ARGV_node, *BINMODE_node, *CONVFMT_node;
@@ -493,7 +494,9 @@ main(int argc, char **argv)
 
        if (do_pretty_print) {
                dump_prog(code_block);
+               print_extra_comments(source, 0);
                dump_funcs();
+               print_extra_comments(source, 1);
        }
 
        if (do_dump_vars)
diff --git a/profile.c b/profile.c
index 59542ab..01c0b10 100644
--- a/profile.c
+++ b/profile.c
@@ -26,6 +26,7 @@
 #include "awk.h"
 
 static void pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool in_for_header);
+static void end_line(INSTRUCTION *ip);
 static void pp_parenthesize(NODE *n);
 static void parenthesize(int type, NODE *left, NODE *right);
 static char *pp_list(int nargs, const char *paren, const char *delim);
@@ -36,8 +37,9 @@ static bool is_scalar(int type);
 static int prec_level(int type);
 static void pp_push(int type, char *s, int flag);
 static NODE *pp_pop(void);
-static void pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool in_for_header);
-static void print_comment(INSTRUCTION *pc, long in);
+static void print_comment(INSTRUCTION *ip);
+void print_extra_comments(char *src, int ct);
+
 const char *redir2str(int redirtype);
 
 #define pp_str vname
@@ -57,7 +59,11 @@ static NODE *func_params;    /* function parameters */
 static FILE *prof_fp;  /* where to send the profile */
 
 static long indent_level = 0;
+static int lind;
 
+extern INSTRUCTION *first_comment;
+extern INSTRUCTION *last_comment;
+extern int current_comment_type;
 
 #define SPACEOVER      0
 
@@ -180,48 +186,82 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool 
in_for_header)
        NODE *m;
        char *tmp;
        int rule;
-       long lind;
+       INSTRUCTION *this_comment;
+       INSTRUCTION *line_comment;
        static int rule_count[MAXRULE];
 
        for (pc = startp; pc != endp; pc = pc->nexti) {
+               if (pc->opcode == Op_rule) {
+                       if (pc->source_file != source) {
+                               print_extra_comments(source, 
current_comment_type);
+                       }
+                       source = pc->source_file;
+               }
                if (pc->source_line > 0)
                        sourceline = pc->source_line;
+               /*  check for last real instruction     */
+               if (   (pc->nexti != NULL
+                       && pc->nexti->opcode == Op_no_op
+                       && pc->nexti->source_line > 0)
+                   || (pc->opcode == Op_no_op && pc->source_line > 0))
+                       lind = 1;
+               else
+                       lind = 0;
+
+               /*
+                * Scan the comments list for entries relevant to the
+                * current instruction.
+                */
+               line_comment = NULL;
+               if (pc->source_line > 0) {
+                       for (this_comment = first_comment;
+                            this_comment != NULL && pc->source_line > 0;
+                            this_comment = this_comment->nexti) {
+                               if (this_comment->comment_text->comment_type == 
current_comment_type
+                                   && this_comment->source_file == source) {
+                                       if (this_comment->source_line <= 
sourceline) {
+                                               if (this_comment->source_line 
== sourceline) {
+                                                       line_comment = 
this_comment;
+                                                       break;
+                                               } else {
+                                                       
print_comment(this_comment);
+                                                       line_comment = NULL;
+                                                       if (lind == 0)
+                                                               indent(0);
+                                               }
+                                       }
+                               }
+                       }
+               }
 
                switch (pc->opcode) {
                case Op_rule:
+               /*
+                * Rules are three instructions long. See append_rule in 
awkgram.y. 
+                * The first has the Rule Op Code, nexti etc. 
+                * The second, (pc + 1) has firsti and lasti:
+                *      the first/last ACTION instructions for this rule. 
+                * The third (pc + 2) has first_line and last_line:
+                *      the first and last source line numbers.
+                */
                        source = pc->source_file;
                        rule = pc->in_rule;
 
                        if (rule != Rule) {
                                ip = (pc + 1)->firsti;
 
-                               /* print pre-begin/end comments */
-                               if (ip->opcode == Op_comment) {
-                                       print_comment(ip, 0);
-                                       ip = ip->nexti;
-                               }
-
                                if (do_profile) {
                                        if (! rule_count[rule]++)
                                                fprintf(prof_fp, _("\t# %s 
rule(s)\n\n"), ruletab[rule]);
                                        indent(0);
                                }
-                               fprintf(prof_fp, "%s {\n", ruletab[rule]);
+                               fprintf(prof_fp, "%s {", ruletab[rule]);
+                               end_line(line_comment);
                        } else {
                                if (do_profile && ! rule_count[rule]++)
                                        fprintf(prof_fp, _("\t# Rule(s)\n\n"));
                                ip = pc->nexti;
-                               lind = ip->exec_count;
-                               /* print pre-block comments */
-                               if (ip->opcode == Op_exec_count && 
ip->nexti->opcode == Op_comment)
-                                       ip = ip->nexti;
-                               if (ip->opcode == Op_comment) {
-                                       print_comment(ip, lind);
-                                       if (ip->nexti->nexti == (pc + 
1)->firsti)
-                                               ip = ip->nexti->nexti;
-                               }
                                if (ip != (pc + 1)->firsti) {           /* 
non-empty pattern */
-                                       indent(lind);
                                        pprint(ip->nexti, (pc + 1)->firsti, 
false);
                                        t1 = pp_pop();
                                        fprintf(prof_fp, "%s {", t1->pp_str);
@@ -231,9 +271,10 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool 
in_for_header)
                                        if (do_profile && ip->exec_count > 0)
                                                fprintf(prof_fp, " # %ld", 
ip->exec_count);
 
-                                       fprintf(prof_fp, "\n");
+                                       end_line(line_comment);
                                } else {
-                                       fprintf(prof_fp, "{\n");
+                                       fprintf(prof_fp, "{");
+                                       end_line(line_comment);
                                        ip = (pc + 1)->firsti;
                                }
                                ip = ip->nexti;
@@ -243,6 +284,15 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool 
in_for_header)
                        indent_out();
                        if (do_profile)
                                indent(0);
+                       /* print extra block comments  */
+                       for (this_comment = first_comment;
+                            this_comment != NULL;
+                            this_comment = this_comment->nexti) {
+                               if (this_comment->comment_text->comment_type == 
current_comment_type
+                                   && this_comment->source_file == source
+                                   && this_comment->source_line < sourceline)
+                                       print_comment(this_comment);
+                       }
                        fprintf(prof_fp, "}\n\n");
                        pc = (pc + 1)->lasti;
                        break;
@@ -328,7 +378,7 @@ cleanup:
                                pp_free(t2);
                                pp_free(t1);
                                if (! in_for_header)
-                                       fprintf(prof_fp, "\n");
+                                       end_line(line_comment);
                                break;
 
                        default:
@@ -454,7 +504,7 @@ cleanup:
                        pp_free(t2);
                        pp_free(t1);
                        if (! in_for_header)
-                               fprintf(prof_fp, "\n");
+                               end_line(line_comment);
                        break; 
 
                case Op_concat:
@@ -475,7 +525,7 @@ cleanup:
                        } else                          
                                fprintf(prof_fp, "%s %s", op2str(Op_K_delete), 
array);
                        if (! in_for_header)
-                               fprintf(prof_fp, "\n");
+                               end_line(line_comment);
                        pp_free(t1);
                }
                        break;
@@ -587,7 +637,7 @@ cleanup:
                                fprintf(prof_fp, "%s%s", op2str(pc->opcode), 
tmp);
                        efree(tmp);
                        if (! in_for_header)
-                               fprintf(prof_fp, "\n");
+                               end_line(line_comment);
                        break;
 
                case Op_push_re:
@@ -688,7 +738,8 @@ cleanup:
                case Op_K_break:
                case Op_K_nextfile:
                case Op_K_next:
-                       fprintf(prof_fp, "%s\n", op2str(pc->opcode));
+                       fprintf(prof_fp, "%s", op2str(pc->opcode));
+                       end_line(line_comment);
                        break;
 
                case Op_K_return:
@@ -696,8 +747,11 @@ cleanup:
                        t1 = pp_pop();
                        if (is_binary(t1->type))
                                pp_parenthesize(t1);
-                       if (pc->source_line > 0)        /* don't print implicit 
'return' at end of function */
-                               fprintf(prof_fp, "%s %s\n", op2str(pc->opcode), 
t1->pp_str);
+                       if (pc->source_line > 0) {
+                               /* don't print implicit 'return' at end of 
function */
+                               fprintf(prof_fp, "%s %s", op2str(pc->opcode), 
t1->pp_str);
+                               end_line(line_comment);
+                       }
                        pp_free(t1);
                        break;
 
@@ -705,7 +759,7 @@ cleanup:
                        t1 = pp_pop();
                        fprintf(prof_fp, "%s", t1->pp_str);
                        if (! in_for_header)
-                               fprintf(prof_fp, "\n");
+                               end_line(line_comment);
                        pp_free(t1);
                        break;
 
@@ -832,10 +886,12 @@ cleanup:
                        indent(pc->stmt_start->exec_count);
                        if (pc->opcode == Op_K_case) {
                                t1 = pp_pop();
-                               fprintf(prof_fp, "%s %s:\n", 
op2str(pc->opcode), t1->pp_str);
+                               fprintf(prof_fp, "%s %s:", op2str(pc->opcode), 
t1->pp_str);
+                               end_line(line_comment);
                                pp_free(t1);
                        } else
-                               fprintf(prof_fp, "%s:\n", op2str(pc->opcode));
+                               fprintf(prof_fp, "%s:", op2str(pc->opcode));
+                               end_line(line_comment);
                        indent_in();
                        pprint(pc->stmt_start->nexti, pc->stmt_end->nexti, 
false);
                        indent_out();
@@ -851,14 +907,15 @@ cleanup:
                        ip = pc->branch_if;
                        if (ip->exec_count > 0)
                                fprintf(prof_fp, " # %ld", ip->exec_count);
-                       fprintf(prof_fp, "\n");
+                       end_line(line_comment);
                        indent_in();
                        pprint(ip->nexti, pc->branch_else, false);
                        indent_out();
                        pc = pc->branch_else;
                        if (pc->nexti->opcode == Op_no_op) {
                                indent(SPACEOVER);
-                               fprintf(prof_fp, "}\n");
+                               fprintf(prof_fp, "}");
+                               end_line(line_comment);
                        }
                        break;
 
@@ -868,7 +925,8 @@ cleanup:
                        pprint(pc->nexti, pc->branch_end, false);
                        indent_out();
                        indent(SPACEOVER);
-                       fprintf(prof_fp, "}\n");
+                       fprintf(prof_fp, "}");
+                       end_line(line_comment);
                        pc = pc->branch_end;
                        break;
 
@@ -907,10 +965,6 @@ cleanup:
                                indent(pc->exec_count);
                        break;
 
-               case Op_comment:
-                       print_comment(pc, 0);
-                       break;
-
                case Op_list:
                        break;
 
@@ -923,6 +977,22 @@ cleanup:
        }
 }
 
+/* end pretty print line with new line or on-line comment  */
+
+void 
+end_line(INSTRUCTION *ip)
+{
+       if (ip == NULL || ip->comment_text->comment_type < 0)
+               fprintf(prof_fp, "\n");
+       else {
+               fprintf(prof_fp, "\t");
+               print_comment(ip);
+               ip = NULL;
+               if (lind == 0)
+                       indent(0);
+       }
+}
+
 /* pp_string_fp --- printy print a string to the fp */
 
 /*
@@ -996,28 +1066,38 @@ print_lib_list(FILE *prof_fp)
                fprintf(prof_fp, "\n");
 }
 
-/* print_comment --- print comment text with proper indentation */
+/* print_extra_comments  --- print any left over comments for the current 
source file and comment type  */
+
+void
+print_extra_comments(char *src, int ct)
+{
+       INSTRUCTION *ip;
+
+       for (ip = first_comment; ip != NULL; ip = ip->nexti) {
+               if (ip->comment_text->comment_type == current_comment_type
+                   && ip->source_file == src) {
+                       print_comment(ip);
+               }
+       }
+}
+
+/* print_comment --- print comment text */
 
 static void
-print_comment(INSTRUCTION* pc, long in)
+print_comment(INSTRUCTION *ip)
 {
        char *text;
        size_t count;
-       bool after_newline = false;
 
-       count = pc->memory->stlen;
-       text = pc->memory->stptr;
+       count = ip->comment_text->stlen;
+       text = ip->comment_text->stptr;
 
-       indent(in);   /* is this correct? Where should comments go?  */
        for (; count > 0; count--, text++) {
-               if (after_newline) {
-                       indent(in);
-                       after_newline = false;
-               }
                putc(*text, prof_fp);
-               if (*text == '\n')
-                       after_newline = true;
+               if (*text == '\n' && count > 1)
+                       indent(0);
        }
+       ip->comment_text->comment_type = -1;  /* turn off printed comment  */
 }
 
 /* dump_prog --- dump the program */
@@ -1037,6 +1117,7 @@ dump_prog(INSTRUCTION *code)
        if (do_profile)
                fprintf(prof_fp, _("\t# gawk profile, created %s\n"), ctime(& 
now));
        print_lib_list(prof_fp);
+       current_comment_type = 0;  /* program  */
        pprint(code, NULL, false);
 }
 
@@ -1582,14 +1663,9 @@ pp_func(INSTRUCTION *pc, void *data ATTRIBUTE_UNUSED)
 
        fp = pc->nexti->nexti;
        func = pc->func_body;
+       source = pc->source_file;
        fprintf(prof_fp, "\n");
 
-       /* print any function comment */
-       if (fp->opcode == Op_comment && fp->source_line == 0) {
-               print_comment(fp, 0);
-               fp = fp->nexti;
-       }
-
        indent(pc->nexti->exec_count);
        fprintf(prof_fp, "%s %s(", op2str(Op_K_function), func->vname);
        pcount = func->param_cnt;

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                          |  215 ++
 Makefile.am                        |    7 +-
 Makefile.in                        |   30 +-
 NEWS                               |   23 +-
 README                             |    3 -
 aclocal.m4                         |  122 +-
 array.c                            |    9 +-
 awk.h                              |  125 +-
 awkgram.c                          |  895 ++++----
 awkgram.y                          |  177 +-
 awklib/ChangeLog                   |   10 +
 awklib/Makefile.am                 |    4 +-
 awklib/Makefile.in                 |   11 +-
 awklib/eg/lib/ftrans.awk           |    2 +-
 awklib/eg/lib/strtonum.awk         |    2 +-
 awklib/eg/prog/indirectcall.awk    |    2 +-
 awklib/eg/prog/split.awk           |    2 +-
 builtin.c                          |   90 +-
 compile                            |  347 +++
 config.rpath                       |   16 +-
 configure                          |  461 +++-
 configure.ac                       |    7 +-
 dfa.c                              |  295 ++--
 doc/ChangeLog                      |   68 +
 doc/Makefile.in                    |   11 +-
 doc/gawk.1                         |    5 +-
 doc/gawk.info                      | 4479 +++++++++++++++++++-----------------
 doc/gawk.texi                      | 2943 +++++++++++++-----------
 doc/gawktexi.in                    | 2846 +++++++++++++-----------
 eval.c                             |   13 +-
 ext.c                              |    3 +
 extension/ChangeLog                |   21 +
 extension/Makefile.am              |    3 +
 extension/Makefile.in              |   30 +-
 extension/aclocal.m4               |  127 +-
 extension/build-aux/compile        |  347 +++
 extension/build-aux/ltmain.sh      |  354 ++-
 extension/configure                |  249 ++-
 extension/inplace.c                |   11 +-
 extension/m4/libtool.m4            |   96 +-
 extension/m4/ltoptions.m4          |    2 +-
 extension/m4/ltsugar.m4            |    7 +-
 extension/m4/ltversion.m4          |   12 +-
 extension/m4/lt~obsolete.m4        |    7 +-
 extras/ChangeLog                   |    3 +
 bisonfix.awk => extras/Makefile.am |   40 +-
 {awklib => extras}/Makefile.in     |  333 +--
 extras/gawk.csh                    |   11 +
 extras/gawk.sh                     |   31 +
 field.c                            |   63 +-
 gawkapi.c                          |    5 +-
 gawkmisc.c                         |    2 +
 getopt.h                           |   15 +
 interpret.h                        |   38 +-
 io.c                               |   58 +-
 m4/ChangeLog                       |   17 +
 m4/gettext.m4                      |   58 +-
 m4/iconv.m4                        |  110 +-
 m4/lib-ld.m4                       |   77 +-
 m4/lib-link.m4                     |   43 +-
 m4/lib-prefix.m4                   |    2 +-
 m4/nls.m4                          |    2 +-
 m4/po.m4                           |   36 +-
 m4/progtest.m4                     |   21 +-
 m4/readline.m4                     |   23 +-
 main.c                             |  783 ++++---
 mbsupport.h                        |   74 +-
 mpfr.c                             |    2 -
 node.c                             |   18 +-
 pc/ChangeLog                       |   14 +
 pc/Makefile.tst                    |   28 +-
 pc/gawkmisc.pc                     |    4 +-
 po/ChangeLog                       |    5 +
 po/Makefile.in.in                  |   53 +-
 po/Makevars                        |   39 +-
 po/Makevars.template               |   37 +
 po/Rules-quot                      |   15 +-
 po/de.po                           | 1653 ++++++--------
 po/ja.gmo                          |  Bin 47970 -> 52559 bytes
 po/ja.po                           |  290 +--
 po/sv.gmo                          |  Bin 80916 -> 80917 bytes
 po/sv.po                           |   31 +-
 profile.c                          |  262 ++-
 re.c                               |   16 +-
 regcomp.c                          |    2 +-
 regex_internal.h                   |    8 +-
 replace.c                          |    2 +-
 test/ChangeLog                     |   50 +
 test/Gentests                      |    2 +-
 test/Makefile.am                   |   29 +-
 test/Makefile.in                   |   37 +-
 test/Maketests                     |    5 +
 test/gensub2.ok                    |    1 +
 test/mbprintf4.awk                 |   51 +-
 test/mbprintf4.ok                  |  144 +-
 test/profile6.awk                  |    7 +
 test/profile6.ok                   |   10 +
 test/profile7.awk                  |   12 +
 test/profile7.ok                   |   15 +
 test/sortglos.awk                  |   51 +
 test/sortglos.in                   |   22 +
 test/sortglos.ok                   |   15 +
 vms/ChangeLog                      |   11 +
 vms/config_h.com                   |    2 +-
 vms/vmsbuild.com                   |    6 +-
 vms/vmstest.com                    |    3 +
 106 files changed, 10952 insertions(+), 8334 deletions(-)
 create mode 100755 compile
 create mode 100755 extension/build-aux/compile
 create mode 100644 extras/ChangeLog
 copy bisonfix.awk => extras/Makefile.am (58%)
 copy {awklib => extras}/Makefile.in (56%)
 create mode 100644 extras/gawk.csh
 create mode 100644 extras/gawk.sh
 create mode 100644 test/profile6.awk
 create mode 100644 test/profile6.ok
 create mode 100644 test/profile7.awk
 create mode 100644 test/profile7.ok
 create mode 100755 test/sortglos.awk
 create mode 100755 test/sortglos.in
 create mode 100644 test/sortglos.ok


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]