Implement proper options markup, tidy up <Rule>...<Action>...</Action</Rule>
authorNick Downing <downing.nick@gmail.com>
Sat, 23 Jun 2018 03:56:38 +0000 (13:56 +1000)
committerNick Downing <downing.nick@gmail.com>
Sat, 23 Jun 2018 03:56:54 +0000 (13:56 +1000)
src/parse.c
src/parse.c.patch
src/parse.y
src/scan.c
src/scan.c.patch
src/scan.l
src/stage1scan.c.patch

index 7afcc91..2813e2c 100644 (file)
@@ -593,15 +593,15 @@ static const yytype_uint8 yytranslate[] =
 static const yytype_uint16 yyrline[] =
 {
        0,   118,   118,   148,   155,   161,   166,   167,   171,   179,
-     182,   186,   189,   192,   196,   199,   200,   203,   208,   210,
-     214,   216,   218,   222,   228,   233,   237,   249,   287,   311,
-     336,   341,   344,   350,   370,   375,   377,   379,   383,   409,
-     467,   470,   519,   539,   547,   552,   581,   591,   594,   625,
-     642,   667,   676,   684,   692,   723,   740,   762,   804,   822,
-     832,   835,   841,   856,   862,   866,   871,   873,   882,   947,
-     970,   980,   989,   993,   997,  1001,  1005,  1009,  1013,  1027,
-    1031,  1035,  1039,  1043,  1058,  1062,  1066,  1070,  1074,  1078,
-    1082,  1086,  1090,  1094,  1098,  1106,  1116,  1134
+     182,   186,   189,   192,   196,   199,   200,   203,   211,   217,
+     225,   231,   237,   245,   250,   255,   259,   271,   309,   333,
+     358,   363,   366,   372,   392,   397,   399,   401,   405,   431,
+     489,   492,   541,   561,   569,   574,   603,   613,   616,   647,
+     664,   689,   698,   706,   714,   745,   762,   784,   826,   844,
+     854,   857,   863,   878,   884,   888,   893,   895,   904,   969,
+     992,  1002,  1011,  1015,  1019,  1023,  1027,  1031,  1035,  1049,
+    1053,  1057,  1061,  1065,  1080,  1084,  1088,  1092,  1096,  1100,
+    1104,  1108,  1112,  1116,  1120,  1128,  1138,  1156
 };
 #endif
 
@@ -1248,7 +1248,7 @@ int yynerrs;
 extern char piece_temp[];
 extern char *piece[];
 extern int piece0, piece1;
-void insert_piece(int n, const void *str);
+void piece_insert(int n, const void *str);
 int piece2, piece3;
 static void peek(void) {
  if (yychar == YYEMPTY)
@@ -1261,9 +1261,9 @@ static void peek(void) {
  piece1 += 2;
 }
 #define insert_before(n, str) \
- do { insert_piece(piece2 + (n) * 2, (str)); ++piece3; } while (0)
+ do { piece_insert(piece2 + (n) * 2, (str)); ++piece0; ++piece3; } while (0)
 #define insert_after(n, str) \
- do { insert_piece(piece2 + (n) * 2 + 1, (str)); ++piece3; } while (0)
+ do { piece_insert(piece2 + (n) * 2 + 1, (str)); ++piece0; ++piece3; } while (0)
 int
 yyparse (void)
 {
@@ -1554,8 +1554,8 @@ yyreduce:
   case 4:
 #line 156 "parse.y" /* yacc.c:1646  */
     {
- insert_after(2, "</Sect1_StartCond>");
- sprintf(piece_temp, "<Sect1_StartCond exclusive=\"%s\">", xcluflg ? "true" : "false");
+ insert_after(2, "</StartCondDecl>");
+ sprintf(piece_temp, "<StartCondDecl exclusive=\"%s\">", xcluflg ? "true" : "false");
  insert_before(1, piece_temp);
  }
 #line 1532 "parse.c" /* yacc.c:1646  */
@@ -1564,8 +1564,8 @@ yyreduce:
   case 5:
 #line 162 "parse.y" /* yacc.c:1646  */
     {
- insert_after(1, "</Sect1_Options>");
- insert_before(1, "<Sect1_Options>");
+ insert_after(1, "</Options>");
+ insert_before(1, "<Options>");
  }
 #line 1541 "parse.c" /* yacc.c:1646  */
     break;
@@ -1621,63 +1621,85 @@ yyreduce:
     {
                        outfilename = xstrdup(nmstr);
                        did_outfilename = 1;
+ insert_after(2, "</Option_OutFile>");
+ sprintf(piece_temp, "<Option_OutFile value=\"%s\">", nmstr);
+ insert_before(0, piece_temp);
                        }
-#line 1596 "parse.c" /* yacc.c:1646  */
+#line 1599 "parse.c" /* yacc.c:1646  */
     break;
 
   case 18:
-#line 209 "parse.y" /* yacc.c:1646  */
-    { extra_type = xstrdup(nmstr); }
-#line 1602 "parse.c" /* yacc.c:1646  */
+#line 212 "parse.y" /* yacc.c:1646  */
+    { extra_type = xstrdup(nmstr); /*}*/
+ insert_after(2, "</Option_ExtraType>");
+ sprintf(piece_temp, "<Option_ExtraType value=\"%s\">", nmstr);
+ insert_before(0, piece_temp);
+ }
+#line 1609 "parse.c" /* yacc.c:1646  */
     break;
 
   case 19:
-#line 211 "parse.y" /* yacc.c:1646  */
+#line 218 "parse.y" /* yacc.c:1646  */
     { prefix = xstrdup(nmstr);
                           if (strchr(prefix, '[') || strchr(prefix, ']'))
-                              flexerror(_("Prefix must not contain [ or ]")); }
-#line 1610 "parse.c" /* yacc.c:1646  */
+                              flexerror(_("Prefix must not contain [ or ]")); /*}*/
+ insert_after(2, "</Option_Prefix>");
+ sprintf(piece_temp, "<Option_Prefix value=\"%s\">", nmstr);
+ insert_before(0, piece_temp);
+ }
+#line 1621 "parse.c" /* yacc.c:1646  */
     break;
 
   case 20:
-#line 215 "parse.y" /* yacc.c:1646  */
-    { yyclass = xstrdup(nmstr); }
-#line 1616 "parse.c" /* yacc.c:1646  */
+#line 226 "parse.y" /* yacc.c:1646  */
+    { yyclass = xstrdup(nmstr); /*}*/
+ insert_after(2, "</Option_YYClass>");
+ sprintf(piece_temp, "<Option_YYClass value=\"%s\">", nmstr);
+ insert_before(0, piece_temp);
+ }
+#line 1631 "parse.c" /* yacc.c:1646  */
     break;
 
   case 21:
-#line 217 "parse.y" /* yacc.c:1646  */
-    { headerfilename = xstrdup(nmstr); }
-#line 1622 "parse.c" /* yacc.c:1646  */
+#line 232 "parse.y" /* yacc.c:1646  */
+    { headerfilename = xstrdup(nmstr); /*}*/
+ insert_after(2, "</Option_HeaderFile>");
+ sprintf(piece_temp, "<Option_HeaderFile value=\"%s\">", nmstr);
+ insert_before(0, piece_temp);
+ }
+#line 1641 "parse.c" /* yacc.c:1646  */
     break;
 
   case 22:
-#line 219 "parse.y" /* yacc.c:1646  */
-    { tablesext = true; tablesfilename = xstrdup(nmstr); }
-#line 1628 "parse.c" /* yacc.c:1646  */
+#line 238 "parse.y" /* yacc.c:1646  */
+    { tablesext = true; tablesfilename = xstrdup(nmstr); /*}*/
+ insert_after(2, "</Option_TableFile>");
+ sprintf(piece_temp, "<Option_TableFile value=\"%s\">", nmstr);
+ insert_before(0, piece_temp);
+ }
+#line 1651 "parse.c" /* yacc.c:1646  */
     break;
 
   case 23:
-#line 223 "parse.y" /* yacc.c:1646  */
+#line 246 "parse.y" /* yacc.c:1646  */
     { scon_stk_ptr = (yyvsp[-3]); /*}*/
- peek();
- insert_before(5, "</Sect2_Rule>");
- insert_before(1, "<Sect2_Rule>");
+ insert_after(4, "</Rule>");
+ insert_before(1, "<Rule>");
  }
-#line 1638 "parse.c" /* yacc.c:1646  */
+#line 1660 "parse.c" /* yacc.c:1646  */
     break;
 
   case 24:
-#line 229 "parse.y" /* yacc.c:1646  */
+#line 251 "parse.y" /* yacc.c:1646  */
     { scon_stk_ptr = (yyvsp[-3]); /*}*/
- insert_after(4, "</Sect2_CompoundRule>");
- insert_before(1, "<Sect2_CompoundRule>");
+ insert_after(4, "</CompoundRule>");
+ insert_before(1, "<CompoundRule>");
  }
-#line 1647 "parse.c" /* yacc.c:1646  */
+#line 1669 "parse.c" /* yacc.c:1646  */
     break;
 
   case 26:
-#line 237 "parse.y" /* yacc.c:1646  */
+#line 259 "parse.y" /* yacc.c:1646  */
     {
                        /* Initialize for a parse of one rule. */
                        trlcontxt = variable_trail_rule = varlength = false;
@@ -1688,11 +1710,11 @@ yyreduce:
 
                        new_rule();
                        }
-#line 1662 "parse.c" /* yacc.c:1646  */
+#line 1684 "parse.c" /* yacc.c:1646  */
     break;
 
   case 27:
-#line 250 "parse.y" /* yacc.c:1646  */
+#line 272 "parse.y" /* yacc.c:1646  */
     {
                        pat = (yyvsp[0]);
                        finish_rule( pat, variable_trail_rule,
@@ -1726,14 +1748,14 @@ yyreduce:
                                        pinpoint_message(
                        "'^' operator results in sub-optimal performance" );
                                }
- insert_after(2, "</Sect2_BOLRule>");
- insert_before(1, "<Sect2_BOLRule>");
+ insert_after(1, "</BOLRule>");
+ insert_before(0, "<BOLRule>");
                        }
-#line 1703 "parse.c" /* yacc.c:1646  */
+#line 1725 "parse.c" /* yacc.c:1646  */
     break;
 
   case 28:
-#line 288 "parse.y" /* yacc.c:1646  */
+#line 310 "parse.y" /* yacc.c:1646  */
     {
                        pat = (yyvsp[0]);
                        finish_rule( pat, variable_trail_rule,
@@ -1756,11 +1778,11 @@ yyreduce:
                                                                pat );
                                }
                        }
-#line 1730 "parse.c" /* yacc.c:1646  */
+#line 1752 "parse.c" /* yacc.c:1646  */
     break;
 
   case 29:
-#line 312 "parse.y" /* yacc.c:1646  */
+#line 334 "parse.y" /* yacc.c:1646  */
     {
                        if ( scon_stk_ptr > 0 )
                                build_eof_action();
@@ -1781,35 +1803,35 @@ yyreduce:
                                else
                                        build_eof_action();
                                }
- insert_after(0, "</Sect2_EOFRule>");
- insert_before(0, "<Sect2_EOFRule>");
+ insert_after(0, "</EOFRule>");
+ insert_before(0, "<EOFRule>");
                        }
-#line 1758 "parse.c" /* yacc.c:1646  */
+#line 1780 "parse.c" /* yacc.c:1646  */
     break;
 
   case 30:
-#line 337 "parse.y" /* yacc.c:1646  */
+#line 359 "parse.y" /* yacc.c:1646  */
     { synerr( _("unrecognized rule") ); }
-#line 1764 "parse.c" /* yacc.c:1646  */
+#line 1786 "parse.c" /* yacc.c:1646  */
     break;
 
   case 31:
-#line 341 "parse.y" /* yacc.c:1646  */
+#line 363 "parse.y" /* yacc.c:1646  */
     { (yyval) = scon_stk_ptr; }
-#line 1770 "parse.c" /* yacc.c:1646  */
+#line 1792 "parse.c" /* yacc.c:1646  */
     break;
 
   case 32:
-#line 345 "parse.y" /* yacc.c:1646  */
+#line 367 "parse.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[-2]); /*}*/
  insert_after(3, "</StartCond>");
  insert_before(0, "<StartCond>");
  }
-#line 1779 "parse.c" /* yacc.c:1646  */
+#line 1801 "parse.c" /* yacc.c:1646  */
     break;
 
   case 33:
-#line 351 "parse.y" /* yacc.c:1646  */
+#line 373 "parse.y" /* yacc.c:1646  */
     {
                        (yyval) = scon_stk_ptr;
 
@@ -1827,25 +1849,25 @@ yyreduce:
  insert_after(2, "</StartCondWild>");
  insert_before(0, "<StartCondWild>");
                        }
-#line 1801 "parse.c" /* yacc.c:1646  */
+#line 1823 "parse.c" /* yacc.c:1646  */
     break;
 
   case 34:
-#line 370 "parse.y" /* yacc.c:1646  */
+#line 392 "parse.y" /* yacc.c:1646  */
     { (yyval) = scon_stk_ptr; /*}*/
  insert_before(0, "<StartCondNone />");
  }
-#line 1809 "parse.c" /* yacc.c:1646  */
+#line 1831 "parse.c" /* yacc.c:1646  */
     break;
 
   case 37:
-#line 380 "parse.y" /* yacc.c:1646  */
+#line 402 "parse.y" /* yacc.c:1646  */
     { synerr( _("bad start condition list") ); }
-#line 1815 "parse.c" /* yacc.c:1646  */
+#line 1837 "parse.c" /* yacc.c:1646  */
     break;
 
   case 38:
-#line 384 "parse.y" /* yacc.c:1646  */
+#line 406 "parse.y" /* yacc.c:1646  */
     {
                        if ( (scnum = sclookup( nmstr )) == 0 )
                                format_pinpoint_message(
@@ -1866,11 +1888,11 @@ yyreduce:
                                        scon_stk[++scon_stk_ptr] = scnum;
                                }
                        }
-#line 1840 "parse.c" /* yacc.c:1646  */
+#line 1862 "parse.c" /* yacc.c:1646  */
     break;
 
   case 39:
-#line 410 "parse.y" /* yacc.c:1646  */
+#line 432 "parse.y" /* yacc.c:1646  */
     {
                        if ( transchar[lastst[(yyvsp[0])]] != SYM_EPSILON )
                                /* Provide final transition \now/ so it
@@ -1927,17 +1949,17 @@ yyreduce:
  insert_after(2, "</RegexSequence>");
  insert_before(0, "<RegexSequence>");
                        }
-#line 1901 "parse.c" /* yacc.c:1646  */
+#line 1923 "parse.c" /* yacc.c:1646  */
     break;
 
   case 40:
-#line 468 "parse.y" /* yacc.c:1646  */
+#line 490 "parse.y" /* yacc.c:1646  */
     { synerr( _("trailing context used twice") ); }
-#line 1907 "parse.c" /* yacc.c:1646  */
+#line 1929 "parse.c" /* yacc.c:1646  */
     break;
 
   case 41:
-#line 471 "parse.y" /* yacc.c:1646  */
+#line 493 "parse.y" /* yacc.c:1646  */
     {
                        headcnt = 0;
                        trailcnt = 1;
@@ -1985,11 +2007,11 @@ yyreduce:
  insert_before(0, "<RegexGroup>");
  insert_before(0, "<RegexSequence>");
                        }
-#line 1959 "parse.c" /* yacc.c:1646  */
+#line 1981 "parse.c" /* yacc.c:1646  */
     break;
 
   case 42:
-#line 520 "parse.y" /* yacc.c:1646  */
+#line 542 "parse.y" /* yacc.c:1646  */
     {
                        (yyval) = (yyvsp[0]);
 
@@ -2006,28 +2028,28 @@ yyreduce:
  insert_after(0, "</RegexGroup>");
  insert_before(0, "<RegexGroup>");
                        }
-#line 1980 "parse.c" /* yacc.c:1646  */
+#line 2002 "parse.c" /* yacc.c:1646  */
     break;
 
   case 43:
-#line 540 "parse.y" /* yacc.c:1646  */
+#line 562 "parse.y" /* yacc.c:1646  */
     {
                        varlength = true;
                        (yyval) = mkor( (yyvsp[-2]), (yyvsp[0]) );
  insert_after(2, "</RegexOr>");
  insert_before(0, "<RegexOr>");
                        }
-#line 1991 "parse.c" /* yacc.c:1646  */
+#line 2013 "parse.c" /* yacc.c:1646  */
     break;
 
   case 44:
-#line 548 "parse.y" /* yacc.c:1646  */
+#line 570 "parse.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 1997 "parse.c" /* yacc.c:1646  */
+#line 2019 "parse.c" /* yacc.c:1646  */
     break;
 
   case 45:
-#line 553 "parse.y" /* yacc.c:1646  */
+#line 575 "parse.y" /* yacc.c:1646  */
     {
                        /* This rule is written separately so the
                         * reduction will occur before the trailing
@@ -2054,11 +2076,11 @@ yyreduce:
  insert_after(0, "</RegexGroup>");
  insert_before(0, "<RegexGroup>");
                        }
-#line 2028 "parse.c" /* yacc.c:1646  */
+#line 2050 "parse.c" /* yacc.c:1646  */
     break;
 
   case 46:
-#line 582 "parse.y" /* yacc.c:1646  */
+#line 604 "parse.y" /* yacc.c:1646  */
     {
                        /* This is where concatenation of adjacent patterns
                         * gets done.
@@ -2067,17 +2089,17 @@ yyreduce:
  insert_after(1, "</RegexSequence>");
  insert_before(0, "<RegexSequence>");
                        }
-#line 2041 "parse.c" /* yacc.c:1646  */
+#line 2063 "parse.c" /* yacc.c:1646  */
     break;
 
   case 47:
-#line 592 "parse.y" /* yacc.c:1646  */
+#line 614 "parse.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 2047 "parse.c" /* yacc.c:1646  */
+#line 2069 "parse.c" /* yacc.c:1646  */
     break;
 
   case 48:
-#line 595 "parse.y" /* yacc.c:1646  */
+#line 617 "parse.y" /* yacc.c:1646  */
     {
                        varlength = true;
 
@@ -2107,11 +2129,11 @@ yyreduce:
  sprintf(piece_temp, "<RegexRepeat count0=\"%d\" count1=\"%d\">", (yyvsp[-3]), (yyvsp[-1]));
  insert_before(0, piece_temp);
                        }
-#line 2081 "parse.c" /* yacc.c:1646  */
+#line 2103 "parse.c" /* yacc.c:1646  */
     break;
 
   case 49:
-#line 626 "parse.y" /* yacc.c:1646  */
+#line 648 "parse.y" /* yacc.c:1646  */
     {
                        varlength = true;
 
@@ -2127,11 +2149,11 @@ yyreduce:
  sprintf(piece_temp, "<RegexRepeat count0=\"%d\" count1=\"-1\">", (yyvsp[-2]));
  insert_before(0, piece_temp);
                        }
-#line 2101 "parse.c" /* yacc.c:1646  */
+#line 2123 "parse.c" /* yacc.c:1646  */
     break;
 
   case 50:
-#line 643 "parse.y" /* yacc.c:1646  */
+#line 665 "parse.y" /* yacc.c:1646  */
     {
                        /* The series could be something like "(foo)",
                         * in which case we have no idea what its length
@@ -2153,11 +2175,11 @@ yyreduce:
  sprintf(piece_temp, "<RegexRepeat count0=\"%d\" count1=\"%d\">", (yyvsp[-1]), (yyvsp[-1]));
  insert_before(0, piece_temp);
                        }
-#line 2127 "parse.c" /* yacc.c:1646  */
+#line 2149 "parse.c" /* yacc.c:1646  */
     break;
 
   case 51:
-#line 668 "parse.y" /* yacc.c:1646  */
+#line 690 "parse.y" /* yacc.c:1646  */
     {
                        varlength = true;
 
@@ -2165,33 +2187,33 @@ yyreduce:
  insert_after(1, "</RegexRepeat>");
  insert_before(0, "<RegexRepeat count0=\"0\" count1=\"-1\">");
                        }
-#line 2139 "parse.c" /* yacc.c:1646  */
+#line 2161 "parse.c" /* yacc.c:1646  */
     break;
 
   case 52:
-#line 677 "parse.y" /* yacc.c:1646  */
+#line 699 "parse.y" /* yacc.c:1646  */
     {
                        varlength = true;
                        (yyval) = mkposcl( (yyvsp[-1]) );
  insert_after(1, "</RegexRepeat>");
  insert_before(0, "<RegexRepeat count0=\"1\" count1=\"-1\">");
                        }
-#line 2150 "parse.c" /* yacc.c:1646  */
+#line 2172 "parse.c" /* yacc.c:1646  */
     break;
 
   case 53:
-#line 685 "parse.y" /* yacc.c:1646  */
+#line 707 "parse.y" /* yacc.c:1646  */
     {
                        varlength = true;
                        (yyval) = mkopt( (yyvsp[-1]) );
  insert_after(1, "</RegexRepeat>");
  insert_before(0, "<RegexRepeat count0=\"0\" count1=\"1\">");
                        }
-#line 2161 "parse.c" /* yacc.c:1646  */
+#line 2183 "parse.c" /* yacc.c:1646  */
     break;
 
   case 54:
-#line 693 "parse.y" /* yacc.c:1646  */
+#line 715 "parse.y" /* yacc.c:1646  */
     {
                        varlength = true;
 
@@ -2221,11 +2243,11 @@ yyreduce:
  sprintf(piece_temp, "<RegexRepeat count0=\"%d\" count1=\"%d\">", (yyvsp[-3]), (yyvsp[-1]));
  insert_before(0, piece_temp);
                        }
-#line 2195 "parse.c" /* yacc.c:1646  */
+#line 2217 "parse.c" /* yacc.c:1646  */
     break;
 
   case 55:
-#line 724 "parse.y" /* yacc.c:1646  */
+#line 746 "parse.y" /* yacc.c:1646  */
     {
                        varlength = true;
 
@@ -2241,11 +2263,11 @@ yyreduce:
  sprintf(piece_temp, "<RegexRepeat count0=\"%d\" count1=\"-1\">", (yyvsp[-2]));
  insert_before(0, piece_temp);
                        }
-#line 2215 "parse.c" /* yacc.c:1646  */
+#line 2237 "parse.c" /* yacc.c:1646  */
     break;
 
   case 56:
-#line 741 "parse.y" /* yacc.c:1646  */
+#line 763 "parse.y" /* yacc.c:1646  */
     {
                        /* The singleton could be something like "(foo)",
                         * in which case we have no idea what its length
@@ -2266,11 +2288,11 @@ yyreduce:
  sprintf(piece_temp, "<RegexRepeat count0=\"%d\" count1=\"%d\">", (yyvsp[-1]), (yyvsp[-1]));
  insert_before(0, piece_temp);
                        }
-#line 2240 "parse.c" /* yacc.c:1646  */
+#line 2262 "parse.c" /* yacc.c:1646  */
     break;
 
   case 57:
-#line 763 "parse.y" /* yacc.c:1646  */
+#line 785 "parse.y" /* yacc.c:1646  */
     {
                        if ( ! madeany )
                                {
@@ -2311,11 +2333,11 @@ yyreduce:
  insert_before(0, "<RegexCharacter char_set=\"0 10 11 256\">");
  }
                        }
-#line 2285 "parse.c" /* yacc.c:1646  */
+#line 2307 "parse.c" /* yacc.c:1646  */
     break;
 
   case 58:
-#line 805 "parse.y" /* yacc.c:1646  */
+#line 827 "parse.y" /* yacc.c:1646  */
     {
                                /* Sort characters for fast searching.
                                 */
@@ -2332,11 +2354,11 @@ yyreduce:
 
                        (yyval) = mkstate( -(yyvsp[0]) );
                        }
-#line 2306 "parse.c" /* yacc.c:1646  */
+#line 2328 "parse.c" /* yacc.c:1646  */
     break;
 
   case 59:
-#line 823 "parse.y" /* yacc.c:1646  */
+#line 845 "parse.y" /* yacc.c:1646  */
     {
                        ++rulelen;
 
@@ -2345,26 +2367,26 @@ yyreduce:
 
                        (yyval) = mkstate( -(yyvsp[0]) );
                        }
-#line 2319 "parse.c" /* yacc.c:1646  */
+#line 2341 "parse.c" /* yacc.c:1646  */
     break;
 
   case 60:
-#line 833 "parse.y" /* yacc.c:1646  */
+#line 855 "parse.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[-1]); }
-#line 2325 "parse.c" /* yacc.c:1646  */
+#line 2347 "parse.c" /* yacc.c:1646  */
     break;
 
   case 61:
-#line 836 "parse.y" /* yacc.c:1646  */
+#line 858 "parse.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[-1]); /*}*/
  insert_after(2, "</RegexGroup>");
  insert_before(0, "<RegexGroup>");
  }
-#line 2334 "parse.c" /* yacc.c:1646  */
+#line 2356 "parse.c" /* yacc.c:1646  */
     break;
 
   case 62:
-#line 842 "parse.y" /* yacc.c:1646  */
+#line 864 "parse.y" /* yacc.c:1646  */
     {
                        ++rulelen;
 
@@ -2377,48 +2399,48 @@ yyreduce:
             else
                 (yyval) = mkstate( (yyvsp[0]) );
                        }
-#line 2351 "parse.c" /* yacc.c:1646  */
+#line 2373 "parse.c" /* yacc.c:1646  */
     break;
 
   case 63:
-#line 856 "parse.y" /* yacc.c:1646  */
+#line 878 "parse.y" /* yacc.c:1646  */
     { (yyval) = ccl_set_diff  ((yyvsp[-2]), (yyvsp[0])); /*}*/
  insert_after(2, "</RegexCharacterAnd>");
  insert_after(2, "</RegexCharacterNot>");
  insert_before(2, "<RegexCharacterNot>");
  insert_before(0, "<RegexCharacterAnd>");
  }
-#line 2362 "parse.c" /* yacc.c:1646  */
+#line 2384 "parse.c" /* yacc.c:1646  */
     break;
 
   case 64:
-#line 862 "parse.y" /* yacc.c:1646  */
+#line 884 "parse.y" /* yacc.c:1646  */
     { (yyval) = ccl_set_union ((yyvsp[-2]), (yyvsp[0])); /*}*/
  insert_after(2, "</RegexCharacterOr>");
  insert_before(0, "<RegexCharacterOr>");
  }
-#line 2371 "parse.c" /* yacc.c:1646  */
+#line 2393 "parse.c" /* yacc.c:1646  */
     break;
 
   case 66:
-#line 871 "parse.y" /* yacc.c:1646  */
+#line 893 "parse.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[-1]); }
-#line 2377 "parse.c" /* yacc.c:1646  */
+#line 2399 "parse.c" /* yacc.c:1646  */
     break;
 
   case 67:
-#line 874 "parse.y" /* yacc.c:1646  */
+#line 896 "parse.y" /* yacc.c:1646  */
     {
                        cclnegate( (yyvsp[-1]) );
                        (yyval) = (yyvsp[-1]);
  insert_after(2, "</RegexCharacterNot>");
  insert_before(1, "<RegexCharacterNot>");
                        }
-#line 2388 "parse.c" /* yacc.c:1646  */
+#line 2410 "parse.c" /* yacc.c:1646  */
     break;
 
   case 68:
-#line 883 "parse.y" /* yacc.c:1646  */
+#line 905 "parse.y" /* yacc.c:1646  */
     {
 
                        if (sf_case_ins())
@@ -2482,11 +2504,11 @@ yyreduce:
  insert_before(1, piece_temp);
  insert_before(0, "<RegexCharacterOr>");
                        }
-#line 2456 "parse.c" /* yacc.c:1646  */
+#line 2478 "parse.c" /* yacc.c:1646  */
     break;
 
   case 69:
-#line 948 "parse.y" /* yacc.c:1646  */
+#line 970 "parse.y" /* yacc.c:1646  */
     {
                        ccladd( (yyvsp[-1]), (yyvsp[0]) );
                        cclsorted = cclsorted && ((yyvsp[0]) > lastchar);
@@ -2508,11 +2530,11 @@ yyreduce:
  insert_before(1, piece_temp);
  insert_before(0, "<RegexCharacterOr>");
                        }
-#line 2482 "parse.c" /* yacc.c:1646  */
+#line 2504 "parse.c" /* yacc.c:1646  */
     break;
 
   case 70:
-#line 971 "parse.y" /* yacc.c:1646  */
+#line 993 "parse.y" /* yacc.c:1646  */
     {
                        /* Too hard to properly maintain cclsorted. */
                        cclsorted = false;
@@ -2520,76 +2542,76 @@ yyreduce:
  insert_after(1, "</RegexCharacterOr>");
  insert_before(0, "<RegexCharacterOr>");
                        }
-#line 2494 "parse.c" /* yacc.c:1646  */
+#line 2516 "parse.c" /* yacc.c:1646  */
     break;
 
   case 71:
-#line 980 "parse.y" /* yacc.c:1646  */
+#line 1002 "parse.y" /* yacc.c:1646  */
     {
                        cclsorted = true;
                        lastchar = 0;
                        currccl = (yyval) = cclinit();
  insert_before(0, "<RegexCharacter char_set=\"\" />");
                        }
-#line 2505 "parse.c" /* yacc.c:1646  */
+#line 2527 "parse.c" /* yacc.c:1646  */
     break;
 
   case 72:
-#line 989 "parse.y" /* yacc.c:1646  */
+#line 1011 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(isalnum); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"48 58 65 91 97 123\">");
  }
-#line 2514 "parse.c" /* yacc.c:1646  */
+#line 2536 "parse.c" /* yacc.c:1646  */
     break;
 
   case 73:
-#line 993 "parse.y" /* yacc.c:1646  */
+#line 1015 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(isalpha); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"65 91 97 123\">");
  }
-#line 2523 "parse.c" /* yacc.c:1646  */
+#line 2545 "parse.c" /* yacc.c:1646  */
     break;
 
   case 74:
-#line 997 "parse.y" /* yacc.c:1646  */
+#line 1019 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(IS_BLANK); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"9 14 32 33\">");
  }
-#line 2532 "parse.c" /* yacc.c:1646  */
+#line 2554 "parse.c" /* yacc.c:1646  */
     break;
 
   case 75:
-#line 1001 "parse.y" /* yacc.c:1646  */
+#line 1023 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(iscntrl); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 32\">");
  }
-#line 2541 "parse.c" /* yacc.c:1646  */
+#line 2563 "parse.c" /* yacc.c:1646  */
     break;
 
   case 76:
-#line 1005 "parse.y" /* yacc.c:1646  */
+#line 1027 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(isdigit); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"48 58\">");
  }
-#line 2550 "parse.c" /* yacc.c:1646  */
+#line 2572 "parse.c" /* yacc.c:1646  */
     break;
 
   case 77:
-#line 1009 "parse.y" /* yacc.c:1646  */
+#line 1031 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(isgraph); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"33 127\">");
  }
-#line 2559 "parse.c" /* yacc.c:1646  */
+#line 2581 "parse.c" /* yacc.c:1646  */
     break;
 
   case 78:
-#line 1013 "parse.y" /* yacc.c:1646  */
+#line 1035 "parse.y" /* yacc.c:1646  */
     { 
                           CCL_EXPR(islower);
                           if (sf_case_ins())
@@ -2604,47 +2626,47 @@ yyreduce:
  insert_before(0, "<RegexCharacter char_set=\"97 123\">");
  }
                         }
-#line 2578 "parse.c" /* yacc.c:1646  */
+#line 2600 "parse.c" /* yacc.c:1646  */
     break;
 
   case 79:
-#line 1027 "parse.y" /* yacc.c:1646  */
+#line 1049 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(isprint); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"32 127\">");
  }
-#line 2587 "parse.c" /* yacc.c:1646  */
+#line 2609 "parse.c" /* yacc.c:1646  */
     break;
 
   case 80:
-#line 1031 "parse.y" /* yacc.c:1646  */
+#line 1053 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(ispunct); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"33 48 58 65 91 97 123 127\">");
  }
-#line 2596 "parse.c" /* yacc.c:1646  */
+#line 2618 "parse.c" /* yacc.c:1646  */
     break;
 
   case 81:
-#line 1035 "parse.y" /* yacc.c:1646  */
+#line 1057 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(isspace); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"32 33\">");
  }
-#line 2605 "parse.c" /* yacc.c:1646  */
+#line 2627 "parse.c" /* yacc.c:1646  */
     break;
 
   case 82:
-#line 1039 "parse.y" /* yacc.c:1646  */
+#line 1061 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(isxdigit); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"48 58 65 71 97 103\">");
  }
-#line 2614 "parse.c" /* yacc.c:1646  */
+#line 2636 "parse.c" /* yacc.c:1646  */
     break;
 
   case 83:
-#line 1043 "parse.y" /* yacc.c:1646  */
+#line 1065 "parse.y" /* yacc.c:1646  */
     {
                     CCL_EXPR(isupper);
                     if (sf_case_ins())
@@ -2659,101 +2681,101 @@ yyreduce:
  insert_before(0, "<RegexCharacter char_set=\"65 91\">");
  }
                                }
-#line 2633 "parse.c" /* yacc.c:1646  */
+#line 2655 "parse.c" /* yacc.c:1646  */
     break;
 
   case 84:
-#line 1058 "parse.y" /* yacc.c:1646  */
+#line 1080 "parse.y" /* yacc.c:1646  */
     { CCL_NEG_EXPR(isalnum); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 48 58 65 91 97 123 256\">");
  }
-#line 2642 "parse.c" /* yacc.c:1646  */
+#line 2664 "parse.c" /* yacc.c:1646  */
     break;
 
   case 85:
-#line 1062 "parse.y" /* yacc.c:1646  */
+#line 1084 "parse.y" /* yacc.c:1646  */
     { CCL_NEG_EXPR(isalpha); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 65 91 97 123 256\">");
  }
-#line 2651 "parse.c" /* yacc.c:1646  */
+#line 2673 "parse.c" /* yacc.c:1646  */
     break;
 
   case 86:
-#line 1066 "parse.y" /* yacc.c:1646  */
+#line 1088 "parse.y" /* yacc.c:1646  */
     { CCL_NEG_EXPR(IS_BLANK); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 9 14 32 33 256\">");
  }
-#line 2660 "parse.c" /* yacc.c:1646  */
+#line 2682 "parse.c" /* yacc.c:1646  */
     break;
 
   case 87:
-#line 1070 "parse.y" /* yacc.c:1646  */
+#line 1092 "parse.y" /* yacc.c:1646  */
     { CCL_NEG_EXPR(iscntrl); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"32 256\">");
  }
-#line 2669 "parse.c" /* yacc.c:1646  */
+#line 2691 "parse.c" /* yacc.c:1646  */
     break;
 
   case 88:
-#line 1074 "parse.y" /* yacc.c:1646  */
+#line 1096 "parse.y" /* yacc.c:1646  */
     { CCL_NEG_EXPR(isdigit); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 48 58 256\">");
  }
-#line 2678 "parse.c" /* yacc.c:1646  */
+#line 2700 "parse.c" /* yacc.c:1646  */
     break;
 
   case 89:
-#line 1078 "parse.y" /* yacc.c:1646  */
+#line 1100 "parse.y" /* yacc.c:1646  */
     { CCL_NEG_EXPR(isgraph); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 33 127 256\">");
  }
-#line 2687 "parse.c" /* yacc.c:1646  */
+#line 2709 "parse.c" /* yacc.c:1646  */
     break;
 
   case 90:
-#line 1082 "parse.y" /* yacc.c:1646  */
+#line 1104 "parse.y" /* yacc.c:1646  */
     { CCL_NEG_EXPR(isprint); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 32 127 256\">");
  }
-#line 2696 "parse.c" /* yacc.c:1646  */
+#line 2718 "parse.c" /* yacc.c:1646  */
     break;
 
   case 91:
-#line 1086 "parse.y" /* yacc.c:1646  */
+#line 1108 "parse.y" /* yacc.c:1646  */
     { CCL_NEG_EXPR(ispunct); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 33 48 58 65 91 97 123 127 256\">");
  }
-#line 2705 "parse.c" /* yacc.c:1646  */
+#line 2727 "parse.c" /* yacc.c:1646  */
     break;
 
   case 92:
-#line 1090 "parse.y" /* yacc.c:1646  */
+#line 1112 "parse.y" /* yacc.c:1646  */
     { CCL_NEG_EXPR(isspace); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 32 33 256\">");
  }
-#line 2714 "parse.c" /* yacc.c:1646  */
+#line 2736 "parse.c" /* yacc.c:1646  */
     break;
 
   case 93:
-#line 1094 "parse.y" /* yacc.c:1646  */
+#line 1116 "parse.y" /* yacc.c:1646  */
     { CCL_NEG_EXPR(isxdigit); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 48 58 65 71 97 103 256\">");
  }
-#line 2723 "parse.c" /* yacc.c:1646  */
+#line 2745 "parse.c" /* yacc.c:1646  */
     break;
 
   case 94:
-#line 1098 "parse.y" /* yacc.c:1646  */
+#line 1120 "parse.y" /* yacc.c:1646  */
     { 
                                if ( sf_case_ins() )
                                        lwarn(_("[:^lower:] is ambiguous in case insensitive scanner"));
@@ -2762,11 +2784,11 @@ yyreduce:
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 97 123 256\">");
                                }
-#line 2736 "parse.c" /* yacc.c:1646  */
+#line 2758 "parse.c" /* yacc.c:1646  */
     break;
 
   case 95:
-#line 1106 "parse.y" /* yacc.c:1646  */
+#line 1128 "parse.y" /* yacc.c:1646  */
     {
                                if ( sf_case_ins() )
                                        lwarn(_("[:^upper:] ambiguous in case insensitive scanner"));
@@ -2775,11 +2797,11 @@ yyreduce:
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 65 91 256\">");
                                }
-#line 2749 "parse.c" /* yacc.c:1646  */
+#line 2771 "parse.c" /* yacc.c:1646  */
     break;
 
   case 96:
-#line 1117 "parse.y" /* yacc.c:1646  */
+#line 1139 "parse.y" /* yacc.c:1646  */
     {
                        if ( (yyvsp[0]) == nlch )
                                rule_has_nl[num_rules] = true;
@@ -2795,19 +2817,19 @@ yyreduce:
  insert_after(1, "</RegexSequence>");
  insert_before(0, "<RegexSequence>");
                        }
-#line 2769 "parse.c" /* yacc.c:1646  */
+#line 2791 "parse.c" /* yacc.c:1646  */
     break;
 
   case 97:
-#line 1134 "parse.y" /* yacc.c:1646  */
+#line 1156 "parse.y" /* yacc.c:1646  */
     { (yyval) = mkstate( SYM_EPSILON ); /*}*/
  insert_before(0, "<RegexEmpty />");
  }
-#line 2777 "parse.c" /* yacc.c:1646  */
+#line 2799 "parse.c" /* yacc.c:1646  */
     break;
 
 
-#line 2781 "parse.c" /* yacc.c:1646  */
+#line 2803 "parse.c" /* yacc.c:1646  */
       default: break;
     }
  int i;
@@ -3052,7 +3074,7 @@ yyreturn:
 #endif
   return yyresult;
 }
-#line 1140 "parse.y" /* yacc.c:1906  */
+#line 1162 "parse.y" /* yacc.c:1906  */
 
 
 
index 1d5329f..8789873 100644 (file)
@@ -1,5 +1,5 @@
---- parse.c.orig       2018-06-23 10:24:45.780660653 +1000
-+++ parse.c    2018-06-23 10:51:33.648592609 +1000
+--- parse.c.orig       2018-06-23 12:59:36.016449806 +1000
++++ parse.c    2018-06-23 13:03:32.212439810 +1000
 @@ -1245,6 +1245,25 @@
  | yyparse.  |
  `----------*/
@@ -7,7 +7,7 @@
 +extern char piece_temp[];
 +extern char *piece[];
 +extern int piece0, piece1;
-+void insert_piece(int n, const void *str);
++void piece_insert(int n, const void *str);
 +int piece2, piece3;
 +static void peek(void) {
 + if (yychar == YYEMPTY)
@@ -20,9 +20,9 @@
 + piece1 += 2;
 +}
 +#define insert_before(n, str) \
-+ do { insert_piece(piece2 + (n) * 2, (str)); ++piece3; } while (0)
++ do { piece_insert(piece2 + (n) * 2, (str)); ++piece0; ++piece3; } while (0)
 +#define insert_after(n, str) \
-+ do { insert_piece(piece2 + (n) * 2 + 1, (str)); ++piece3; } while (0)
++ do { piece_insert(piece2 + (n) * 2 + 1, (str)); ++piece0; ++piece3; } while (0)
  int
  yyparse (void)
  {
@@ -44,8 +44,8 @@
  
    /* If YYLEN is nonzero, implement the default value of the action:
       '$$ = $1'.
-@@ -2780,6 +2810,23 @@
- #line 2781 "parse.c" /* yacc.c:1646  */
+@@ -2803,6 +2833,23 @@
+ #line 2804 "parse.c" /* yacc.c:1646  */
        default: break;
      }
 + int i;
index d7813f1..e20f58b 100644 (file)
@@ -154,14 +154,14 @@ initlex           :
 
 sect1          :  sect1 startconddecl namelist1
  {
- insert_after(2, "</Sect1_StartCond>");
- sprintf(piece_temp, "<Sect1_StartCond exclusive=\"%s\">", xcluflg ? "true" : "false");
+ insert_after(2, "</StartCondDecl>");
+ sprintf(piece_temp, "<StartCondDecl exclusive=\"%s\">", xcluflg ? "true" : "false");
  insert_before(1, piece_temp);
  }
                |  sect1 options
  {
- insert_after(1, "</Sect1_Options>");
- insert_before(1, "<Sect1_Options>");
+ insert_after(1, "</Options>");
+ insert_before(1, "<Options>");
  }
                |
                |  error
@@ -204,31 +204,53 @@ option            :  TOK_OUTFILE '=' NAME
                        {
                        outfilename = xstrdup(nmstr);
                        did_outfilename = 1;
+ insert_after(2, "</Option_OutFile>");
+ sprintf(piece_temp, "<Option_OutFile value=\"%s\">", nmstr);
+ insert_before(0, piece_temp);
                        }
                |  TOK_EXTRA_TYPE '=' NAME
-                       { extra_type = xstrdup(nmstr); }
+                       { extra_type = xstrdup(nmstr); /*}*/
+ insert_after(2, "</Option_ExtraType>");
+ sprintf(piece_temp, "<Option_ExtraType value=\"%s\">", nmstr);
+ insert_before(0, piece_temp);
+ }
                |  TOK_PREFIX '=' NAME
                        { prefix = xstrdup(nmstr);
                           if (strchr(prefix, '[') || strchr(prefix, ']'))
-                              flexerror(_("Prefix must not contain [ or ]")); }
+                              flexerror(_("Prefix must not contain [ or ]")); /*}*/
+ insert_after(2, "</Option_Prefix>");
+ sprintf(piece_temp, "<Option_Prefix value=\"%s\">", nmstr);
+ insert_before(0, piece_temp);
+ }
                |  TOK_YYCLASS '=' NAME
-                       { yyclass = xstrdup(nmstr); }
+                       { yyclass = xstrdup(nmstr); /*}*/
+ insert_after(2, "</Option_YYClass>");
+ sprintf(piece_temp, "<Option_YYClass value=\"%s\">", nmstr);
+ insert_before(0, piece_temp);
+ }
                |  TOK_HEADER_FILE '=' NAME
-                       { headerfilename = xstrdup(nmstr); }
+                       { headerfilename = xstrdup(nmstr); /*}*/
+ insert_after(2, "</Option_HeaderFile>");
+ sprintf(piece_temp, "<Option_HeaderFile value=\"%s\">", nmstr);
+ insert_before(0, piece_temp);
+ }
            |  TOK_TABLES_FILE '=' NAME
-            { tablesext = true; tablesfilename = xstrdup(nmstr); }
+            { tablesext = true; tablesfilename = xstrdup(nmstr); /*}*/
+ insert_after(2, "</Option_TableFile>");
+ sprintf(piece_temp, "<Option_TableFile value=\"%s\">", nmstr);
+ insert_before(0, piece_temp);
+ }
                ;
 
 sect2          :  sect2 scon initforrule flexrule '\n'
                        { scon_stk_ptr = $2; /*}*/
- peek();
- insert_before(5, "</Sect2_Rule>");
- insert_before(1, "<Sect2_Rule>");
+ insert_after(4, "</Rule>");
+ insert_before(1, "<Rule>");
  }
                |  sect2 scon '{' sect2 '}'
                        { scon_stk_ptr = $2; /*}*/
- insert_after(4, "</Sect2_CompoundRule>");
- insert_before(1, "<Sect2_CompoundRule>");
+ insert_after(4, "</CompoundRule>");
+ insert_before(1, "<CompoundRule>");
  }
                |
                ;
@@ -280,8 +302,8 @@ flexrule    :  '^' rule
                                        pinpoint_message(
                        "'^' operator results in sub-optimal performance" );
                                }
- insert_after(2, "</Sect2_BOLRule>");
- insert_before(1, "<Sect2_BOLRule>");
+ insert_after(1, "</BOLRule>");
+ insert_before(0, "<BOLRule>");
                        }
 
                |  rule
@@ -329,8 +351,8 @@ flexrule    :  '^' rule
                                else
                                        build_eof_action();
                                }
- insert_after(0, "</Sect2_EOFRule>");
- insert_before(0, "<Sect2_EOFRule>");
+ insert_after(0, "</EOFRule>");
+ insert_before(0, "<EOFRule>");
                        }
 
                |  error
index 75f7f60..dbaa8d6 100644 (file)
@@ -27,10 +27,12 @@ char piece_temp[100];
 char *piece[10000];
 int piece0;
 int piece1;
-void insert_piece(int n, const char *str) {
+void piece_append(const char *str) {
+ piece[piece1++] = strdup(str);
+}
+void piece_insert(int n, const char *str) {
  memmove(piece + n + 1, piece + n, (piece1 - n) * sizeof(char *));
  piece[n] = strdup(str);
- ++piece0;
  ++piece1;
 }
 
@@ -1964,9 +1966,9 @@ extern const char *escaped_qstart, *escaped_qend;
        if(yyleng < MAXLINE) \
          { \
        strncpy( nmstr, yytext, sizeof(nmstr) ); \
- piece[piece1++] = strdup("<Name>"); \
+ piece_append("<Name>"); \
  flush(); \
- piece[piece1++] = strdup("</Name>"); \
+ piece_append("</Name>"); \
        return NAME; \
         } \
        else \
@@ -2003,16 +2005,20 @@ extern const char *escaped_qstart, *escaped_qend;
     yy_push_state(CODEBLOCK); \
     if ((indented_code = x)) ACTION_ECHO; \
  flush(); \
- piece[piece1++] = strdup("<CodeBlock>"); \
+ piece_append("<CodeBlock>"); \
 } while(0)
 
 #define END_CODEBLOCK do { \
     yy_pop_state();\
     add_action(M4QEND); \
     if (!indented_code) line_directive_out(NULL, 0);\
- piece[piece1++] = strdup("</CodeBlock>"); \
+ piece_append("</CodeBlock>"); \
 } while (0)
 
+/* Nick */
+static void markup_action(void);
+static void markup_option(const char *name, int sense);
+
 
 
 
@@ -2022,7 +2028,7 @@ extern const char *escaped_qstart, *escaped_qend;
 
 
 
-#line 2001 "scan.c"
+#line 2005 "scan.c"
 
 #define INITIAL 0
 #define SECT2 1
@@ -2308,13 +2314,13 @@ YY_DECL
  size_t n = strlen(yytext);
  if (n) {
   sprintf(piece_temp, "<token value=\"%d\">", result);
-  piece[piece1++] = strdup(piece_temp);
+  piece_append(piece_temp);
   piece_esc(yytext, n);
-  piece[piece1++] = strdup("</token>");
+  piece_append("</token>");
  }
  else {
   sprintf(piece_temp, "<token value=\"%d\" />", result);
-  piece[piece1++] = strdup(piece_temp);
+  piece_append(piece_temp);
  }
 #endif
  piece_pack();
@@ -2326,7 +2332,7 @@ static int real_yylex(void)
        register char *yy_cp, *yy_bp;
        register int yy_act;
     
-#line 164 "scan.l"
+#line 168 "scan.l"
 
        static int bracelevel, didadef, indented_code;
        static int doing_rule_action = false;
@@ -2337,7 +2343,7 @@ static int real_yylex(void)
        char nmdef[MAXLINE];
 
 
-#line 2236 "scan.c"
+#line 2240 "scan.c"
 
        if ( !(yy_init) )
                {
@@ -2434,39 +2440,39 @@ do_action:      /* This label is used only to access EOF actions. */
 
 case 1:
 YY_RULE_SETUP
-#line 175 "scan.l"
+#line 179 "scan.l"
 START_CODEBLOCK(true);
        YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 176 "scan.l"
+#line 180 "scan.l"
 add_action("/*[""["); yy_push_state( COMMENT );
        YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 177 "scan.l"
+#line 181 "scan.l"
 yy_push_state( LINEDIR );
        YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 178 "scan.l"
+#line 182 "scan.l"
 return SCDECL;
        YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 179 "scan.l"
+#line 183 "scan.l"
 return XSCDECL;
        YY_BREAK
 case 6:
 /* rule 6 can match eol */
 YY_RULE_SETUP
-#line 180 "scan.l"
+#line 184 "scan.l"
 START_CODEBLOCK(false);
        YY_BREAK
 case 7:
 /* rule 7 can match eol */
 YY_RULE_SETUP
-#line 181 "scan.l"
+#line 185 "scan.l"
 {
                 brace_start_line = linenum;
                 ++linenum;
@@ -2477,17 +2483,17 @@ YY_RULE_SETUP
        YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 189 "scan.l"
+#line 193 "scan.l"
 synerr( _("malformed '%top' directive") );
        YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 191 "scan.l"
+#line 195 "scan.l"
 /* discard */
        YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 193 "scan.l"
+#line 197 "scan.l"
 {
                        sectnum = 2;
                        bracelevel = 0;
@@ -2495,17 +2501,17 @@ YY_RULE_SETUP
                        line_directive_out(NULL, 1);
                        BEGIN(SECT2PROLOG);
 #if 1
- piece[piece1++] = strdup("</Sect1>");
+ piece_append("</Sect1>");
  piece_pack();
 #if 1
  piece_esc(yytext, strlen(yytext));
 #else
  sprintf(piece_temp, "<token value=\"%d\">", SECTEND);
- piece[piece1++] = strdup(piece_temp);
+ piece_append(piece_temp);
  piece_esc(yytext, strlen(yytext));
- piece[piece1++] = strdup("</token>");
+ piece_append("</token>");
 #endif
- piece[piece1++] = strdup("<Sect2>");
+ piece_append("<Sect2>");
  piece_pack();
  return ~SECTEND;
 #else
@@ -2516,42 +2522,42 @@ YY_RULE_SETUP
 case 11:
 /* rule 11 can match eol */
 YY_RULE_SETUP
-#line 218 "scan.l"
+#line 222 "scan.l"
 yytext_is_array = false; ++linenum;
        YY_BREAK
 case 12:
 /* rule 12 can match eol */
 YY_RULE_SETUP
-#line 219 "scan.l"
+#line 223 "scan.l"
 yytext_is_array = true; ++linenum;
        YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 221 "scan.l"
+#line 225 "scan.l"
 BEGIN(OPTION); return TOK_OPTION;
        YY_BREAK
 case 14:
 /* rule 14 can match eol */
 YY_RULE_SETUP
-#line 223 "scan.l"
+#line 227 "scan.l"
 ++linenum; /* ignore */
        YY_BREAK
 case 15:
 /* rule 15 can match eol */
 YY_RULE_SETUP
-#line 224 "scan.l"
+#line 228 "scan.l"
 ++linenum;     /* ignore */
        YY_BREAK
 /* xgettext: no-c-format */
 case 16:
 /* rule 16 can match eol */
 YY_RULE_SETUP
-#line 227 "scan.l"
+#line 231 "scan.l"
 synerr( _( "unrecognized '%' directive" ) );
        YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 229 "scan.l"
+#line 233 "scan.l"
 {
                        if(yyleng < MAXLINE)
                         {
@@ -2569,51 +2575,51 @@ YY_RULE_SETUP
        YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 244 "scan.l"
+#line 248 "scan.l"
 RETURNNAME;
        YY_BREAK
 case 19:
 /* rule 19 can match eol */
 YY_RULE_SETUP
-#line 245 "scan.l"
+#line 249 "scan.l"
 ++linenum; /* allows blank lines in section 1 */
        YY_BREAK
 case 20:
 /* rule 20 can match eol */
 YY_RULE_SETUP
-#line 246 "scan.l"
+#line 250 "scan.l"
 ACTION_ECHO; ++linenum; /* maybe end of comment line */
        YY_BREAK
 
 /* */
 case 21:
 YY_RULE_SETUP
-#line 251 "scan.l"
+#line 255 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 252 "scan.l"
+#line 256 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 case 23:
 /* rule 23 can match eol */
 YY_RULE_SETUP
-#line 254 "scan.l"
+#line 258 "scan.l"
 ++linenum; ACTION_ECHO;
        YY_BREAK
 
 
 case 24:
 YY_RULE_SETUP
-#line 257 "scan.l"
+#line 261 "scan.l"
 add_action("*/]""]"); yy_pop_state();
        YY_BREAK
 
 
 case 25:
 YY_RULE_SETUP
-#line 260 "scan.l"
+#line 264 "scan.l"
 ACTION_ECHO; yy_pop_state();
        YY_BREAK
 
@@ -2621,41 +2627,41 @@ ACTION_ECHO; yy_pop_state();
 /* This is the same as COMMENT, but is discarded rather than output. */
 case 26:
 YY_RULE_SETUP
-#line 265 "scan.l"
+#line 269 "scan.l"
 yy_pop_state();
        YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 266 "scan.l"
+#line 270 "scan.l"
 ;
        YY_BREAK
 case 28:
 YY_RULE_SETUP
-#line 267 "scan.l"
+#line 271 "scan.l"
 ;
        YY_BREAK
 case 29:
 /* rule 29 can match eol */
 YY_RULE_SETUP
-#line 268 "scan.l"
+#line 272 "scan.l"
 ++linenum;
        YY_BREAK
 
 
 case 30:
 YY_RULE_SETUP
-#line 272 "scan.l"
+#line 276 "scan.l"
 yy_pop_state();
        YY_BREAK
 case 31:
 YY_RULE_SETUP
-#line 273 "scan.l"
+#line 277 "scan.l"
 ;
        YY_BREAK
 case 32:
 /* rule 32 can match eol */
 YY_RULE_SETUP
-#line 274 "scan.l"
+#line 278 "scan.l"
 ++linenum;
        YY_BREAK
 
@@ -2663,17 +2669,17 @@ YY_RULE_SETUP
 case 33:
 /* rule 33 can match eol */
 YY_RULE_SETUP
-#line 278 "scan.l"
+#line 282 "scan.l"
 yy_pop_state();
        YY_BREAK
 case 34:
 YY_RULE_SETUP
-#line 279 "scan.l"
+#line 283 "scan.l"
 linenum = myctoi( yytext );
        YY_BREAK
 case 35:
 YY_RULE_SETUP
-#line 281 "scan.l"
+#line 285 "scan.l"
 {
                        free(infilename);
                        infilename = xstrdup(yytext + 1);
@@ -2682,19 +2688,19 @@ YY_RULE_SETUP
        YY_BREAK
 case 36:
 YY_RULE_SETUP
-#line 286 "scan.l"
+#line 290 "scan.l"
 /* ignore spurious characters */
        YY_BREAK
 
 
 case 37:
 YY_RULE_SETUP
-#line 289 "scan.l"
+#line 293 "scan.l"
 ACTION_ECHO_QSTART;
        YY_BREAK
 case 38:
 YY_RULE_SETUP
-#line 290 "scan.l"
+#line 294 "scan.l"
 ACTION_ECHO_QEND;
        YY_BREAK
 
@@ -2702,23 +2708,23 @@ ACTION_ECHO_QEND;
 case 39:
 /* rule 39 can match eol */
 YY_RULE_SETUP
-#line 294 "scan.l"
+#line 298 "scan.l"
 ++linenum; END_CODEBLOCK;
        YY_BREAK
 case 40:
 YY_RULE_SETUP
-#line 295 "scan.l"
+#line 299 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 case 41:
 YY_RULE_SETUP
-#line 296 "scan.l"
+#line 300 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 case 42:
 /* rule 42 can match eol */
 YY_RULE_SETUP
-#line 297 "scan.l"
+#line 301 "scan.l"
 {
                        ++linenum;
                        ACTION_ECHO;
@@ -2729,7 +2735,7 @@ YY_RULE_SETUP
 
 case 43:
 YY_RULE_SETUP
-#line 305 "scan.l"
+#line 309 "scan.l"
 {
                 if( --brace_depth == 0){
                     /* TODO: Matched. */
@@ -2740,7 +2746,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 44:
 YY_RULE_SETUP
-#line 313 "scan.l"
+#line 317 "scan.l"
 {
                 brace_depth++;
                 buf_strnappend(&top_buf, yytext, yyleng);
@@ -2749,7 +2755,7 @@ YY_RULE_SETUP
 case 45:
 /* rule 45 can match eol */
 YY_RULE_SETUP
-#line 318 "scan.l"
+#line 322 "scan.l"
 {
                 ++linenum;
                 buf_strnappend(&top_buf, yytext, yyleng);
@@ -2757,23 +2763,23 @@ YY_RULE_SETUP
        YY_BREAK
 case 46:
 YY_RULE_SETUP
-#line 323 "scan.l"
+#line 327 "scan.l"
 buf_strnappend(&top_buf, escaped_qstart, (int) strlen(escaped_qstart));
        YY_BREAK
 case 47:
 YY_RULE_SETUP
-#line 324 "scan.l"
+#line 328 "scan.l"
 buf_strnappend(&top_buf, escaped_qend, (int) strlen(escaped_qend));
        YY_BREAK
 case 48:
 YY_RULE_SETUP
-#line 325 "scan.l"
+#line 329 "scan.l"
 {
        buf_strnappend(&top_buf, yytext, yyleng);
     }
        YY_BREAK
 case YY_STATE_EOF(CODEBLOCK_MATCH_BRACE):
-#line 329 "scan.l"
+#line 333 "scan.l"
 {
                 linenum = brace_start_line;
                 synerr(_("Unmatched '{'"));
@@ -2784,12 +2790,12 @@ case YY_STATE_EOF(CODEBLOCK_MATCH_BRACE):
 
 case 49:
 YY_RULE_SETUP
-#line 338 "scan.l"
+#line 342 "scan.l"
 /* separates name and definition */
        YY_BREAK
 case 50:
 YY_RULE_SETUP
-#line 340 "scan.l"
+#line 344 "scan.l"
 {
                        if(yyleng < MAXLINE)
                         {
@@ -2815,7 +2821,7 @@ YY_RULE_SETUP
 case 51:
 /* rule 51 can match eol */
 YY_RULE_SETUP
-#line 362 "scan.l"
+#line 366 "scan.l"
 {
                        if ( ! didadef )
                                synerr( _( "incomplete name definition" ) );
@@ -2828,149 +2834,149 @@ YY_RULE_SETUP
 case 52:
 /* rule 52 can match eol */
 YY_RULE_SETUP
-#line 372 "scan.l"
+#line 376 "scan.l"
 ++linenum; BEGIN(INITIAL);
        YY_BREAK
 case 53:
 YY_RULE_SETUP
-#line 373 "scan.l"
+#line 377 "scan.l"
 option_sense = true;
        YY_BREAK
 case 54:
 YY_RULE_SETUP
-#line 375 "scan.l"
+#line 379 "scan.l"
 return '=';
        YY_BREAK
 case 55:
 YY_RULE_SETUP
-#line 377 "scan.l"
+#line 381 "scan.l"
 option_sense = ! option_sense;
        YY_BREAK
 case 56:
 YY_RULE_SETUP
-#line 379 "scan.l"
-csize = option_sense ? 128 : 256;
+#line 383 "scan.l"
+csize = option_sense ? 128 : 256; markup_option("7bit", option_sense);
        YY_BREAK
 case 57:
 YY_RULE_SETUP
-#line 380 "scan.l"
-csize = option_sense ? 256 : 128;
+#line 384 "scan.l"
+csize = option_sense ? 256 : 128; markup_option("8bit", option_sense);
        YY_BREAK
 case 58:
 YY_RULE_SETUP
-#line 382 "scan.l"
-long_align = option_sense;
+#line 386 "scan.l"
+long_align = option_sense; markup_option("Align", option_sense);
        YY_BREAK
 case 59:
 YY_RULE_SETUP
-#line 383 "scan.l"
-{
+#line 387 "scan.l"
+{ markup_option("AlwaysInteractive", option_sense);
                        ACTION_M4_IFDEF( "M4""_YY_ALWAYS_INTERACTIVE", option_sense );
             interactive = option_sense;
                        }
        YY_BREAK
 case 60:
 YY_RULE_SETUP
-#line 387 "scan.l"
-yytext_is_array = option_sense;
+#line 391 "scan.l"
+yytext_is_array = option_sense; markup_option("Array", option_sense);
        YY_BREAK
 case 61:
 YY_RULE_SETUP
-#line 388 "scan.l"
-backing_up_report = option_sense;
+#line 392 "scan.l"
+backing_up_report = option_sense; markup_option("Backup", option_sense);
        YY_BREAK
 case 62:
 YY_RULE_SETUP
-#line 389 "scan.l"
-interactive = ! option_sense;
+#line 393 "scan.l"
+interactive = ! option_sense; markup_option("Batch", option_sense);
        YY_BREAK
 case 63:
 YY_RULE_SETUP
-#line 390 "scan.l"
-bison_bridge_lval = option_sense;
+#line 394 "scan.l"
+bison_bridge_lval = option_sense; markup_option("BisonBridge", option_sense);
        YY_BREAK
 case 64:
 YY_RULE_SETUP
-#line 391 "scan.l"
-{ if((bison_bridge_lloc = option_sense))
+#line 395 "scan.l"
+{ if((bison_bridge_lloc = option_sense)) markup_option("BisonLocations", option_sense);
                             bison_bridge_lval = true;
                      }
        YY_BREAK
 case 65:
 YY_RULE_SETUP
-#line 394 "scan.l"
-C_plus_plus = option_sense;
+#line 398 "scan.l"
+C_plus_plus = option_sense; markup_option("CPlusPlus", option_sense);
        YY_BREAK
 case 66:
 YY_RULE_SETUP
-#line 395 "scan.l"
-sf_set_case_ins(!option_sense);
+#line 399 "scan.l"
+sf_set_case_ins(!option_sense); markup_option("CaseSensitive", option_sense);
        YY_BREAK
 case 67:
 YY_RULE_SETUP
-#line 396 "scan.l"
-sf_set_case_ins(option_sense);
+#line 400 "scan.l"
+sf_set_case_ins(option_sense); markup_option("CaseInsensitive", option_sense);
        YY_BREAK
 case 68:
 YY_RULE_SETUP
-#line 397 "scan.l"
-ddebug = option_sense;
+#line 401 "scan.l"
+ddebug = option_sense; markup_option("Debug", option_sense);
        YY_BREAK
 case 69:
 YY_RULE_SETUP
-#line 398 "scan.l"
-spprdflt = ! option_sense;
+#line 402 "scan.l"
+spprdflt = ! option_sense; markup_option("Default", option_sense);
        YY_BREAK
 case 70:
 YY_RULE_SETUP
-#line 399 "scan.l"
-useecs = option_sense;
+#line 403 "scan.l"
+useecs = option_sense; markup_option("ECS", option_sense);
        YY_BREAK
 case 71:
 YY_RULE_SETUP
-#line 400 "scan.l"
-{
+#line 404 "scan.l"
+{ markup_option("Fast", option_sense);
                        useecs = usemecs = false;
                        use_read = fullspd = true;
                        }
        YY_BREAK
 case 72:
 YY_RULE_SETUP
-#line 404 "scan.l"
-{
+#line 408 "scan.l"
+{ markup_option("Full", option_sense);
                        useecs = usemecs = false;
                        use_read = fulltbl = true;
                        }
        YY_BREAK
 case 73:
 YY_RULE_SETUP
-#line 408 "scan.l"
-ACTION_IFDEF("YY_NO_INPUT", ! option_sense);
+#line 412 "scan.l"
+ACTION_IFDEF("YY_NO_INPUT", ! option_sense); markup_option("Input", option_sense);
        YY_BREAK
 case 74:
 YY_RULE_SETUP
-#line 409 "scan.l"
-interactive = option_sense;
+#line 413 "scan.l"
+interactive = option_sense; markup_option("Interactive", option_sense);
        YY_BREAK
 case 75:
 YY_RULE_SETUP
-#line 410 "scan.l"
-lex_compat = option_sense;
+#line 414 "scan.l"
+lex_compat = option_sense; markup_option("LexCompat", option_sense);
        YY_BREAK
 case 76:
 YY_RULE_SETUP
-#line 411 "scan.l"
-posix_compat = option_sense;
+#line 415 "scan.l"
+posix_compat = option_sense; markup_option("PosixCompat", option_sense);
        YY_BREAK
 case 77:
 YY_RULE_SETUP
-#line 412 "scan.l"
-gen_line_dirs = option_sense;
+#line 416 "scan.l"
+gen_line_dirs = option_sense; markup_option("Line", option_sense);
        YY_BREAK
 case 78:
 YY_RULE_SETUP
-#line 413 "scan.l"
-{
+#line 417 "scan.l"
+{ markup_option("Main", option_sense);
                        ACTION_M4_IFDEF( "M4""_YY_MAIN", option_sense);
             /* Override yywrap */
             if( option_sense == true )
@@ -2979,251 +2985,251 @@ YY_RULE_SETUP
        YY_BREAK
 case 79:
 YY_RULE_SETUP
-#line 419 "scan.l"
-usemecs = option_sense;
+#line 423 "scan.l"
+usemecs = option_sense; markup_option("MetaECS", option_sense);
        YY_BREAK
 case 80:
 YY_RULE_SETUP
-#line 420 "scan.l"
-{
+#line 424 "scan.l"
+{ markup_option("NeverInteractive", option_sense);
                        ACTION_M4_IFDEF( "M4""_YY_NEVER_INTERACTIVE", option_sense );
             interactive = !option_sense;
                        }
        YY_BREAK
 case 81:
 YY_RULE_SETUP
-#line 424 "scan.l"
-performance_report += option_sense ? 1 : -1;
+#line 428 "scan.l"
+performance_report += option_sense ? 1 : -1; markup_option("PerfReport", option_sense);
        YY_BREAK
 case 82:
 YY_RULE_SETUP
-#line 425 "scan.l"
-yytext_is_array = ! option_sense;
+#line 429 "scan.l"
+yytext_is_array = ! option_sense; markup_option("Pointer", option_sense);
        YY_BREAK
 case 83:
 YY_RULE_SETUP
-#line 426 "scan.l"
-use_read = option_sense;
+#line 430 "scan.l"
+use_read = option_sense; markup_option("Read", option_sense);
        YY_BREAK
 case 84:
 YY_RULE_SETUP
-#line 427 "scan.l"
-reentrant = option_sense;
+#line 431 "scan.l"
+reentrant = option_sense; markup_option("Reentrant", option_sense);
        YY_BREAK
 case 85:
 YY_RULE_SETUP
-#line 428 "scan.l"
-reject_really_used = option_sense;
+#line 432 "scan.l"
+reject_really_used = option_sense; markup_option("Reject", option_sense);
        YY_BREAK
 case 86:
 YY_RULE_SETUP
-#line 429 "scan.l"
-ACTION_M4_IFDEF( "M4""_YY_STACK_USED", option_sense );
+#line 433 "scan.l"
+ACTION_M4_IFDEF( "M4""_YY_STACK_USED", option_sense ); markup_option("Stack", option_sense);
        YY_BREAK
 case 87:
 YY_RULE_SETUP
-#line 430 "scan.l"
-do_stdinit = option_sense;
+#line 434 "scan.l"
+do_stdinit = option_sense; markup_option("StdInit", option_sense);
        YY_BREAK
 case 88:
 YY_RULE_SETUP
-#line 431 "scan.l"
-use_stdout = option_sense;
+#line 435 "scan.l"
+use_stdout = option_sense; markup_option("StdOut", option_sense);
        YY_BREAK
 case 89:
 YY_RULE_SETUP
-#line 432 "scan.l"
-ACTION_IFDEF("YY_NO_UNISTD_H", ! option_sense);
+#line 436 "scan.l"
+ACTION_IFDEF("YY_NO_UNISTD_H", ! option_sense); markup_option("Unistd", option_sense);
        YY_BREAK
 case 90:
 YY_RULE_SETUP
-#line 433 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_UNPUT", ! option_sense);
+#line 437 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_UNPUT", ! option_sense); markup_option("Unput", option_sense);
        YY_BREAK
 case 91:
 YY_RULE_SETUP
-#line 434 "scan.l"
-printstats = option_sense;
+#line 438 "scan.l"
+printstats = option_sense; markup_option("Verbose", option_sense);
        YY_BREAK
 case 92:
 YY_RULE_SETUP
-#line 435 "scan.l"
-nowarn = ! option_sense;
+#line 439 "scan.l"
+nowarn = ! option_sense; markup_option("Warn", option_sense);
        YY_BREAK
 case 93:
 YY_RULE_SETUP
-#line 436 "scan.l"
-do_yylineno = option_sense; ACTION_M4_IFDEF("M4""_YY_USE_LINENO", option_sense);
+#line 440 "scan.l"
+do_yylineno = option_sense; ACTION_M4_IFDEF("M4""_YY_USE_LINENO", option_sense); markup_option("YYLineNo", option_sense);
        YY_BREAK
 case 94:
 YY_RULE_SETUP
-#line 437 "scan.l"
-yymore_really_used = option_sense;
+#line 441 "scan.l"
+yymore_really_used = option_sense; markup_option("YYMore", option_sense);
        YY_BREAK
 case 95:
 YY_RULE_SETUP
-#line 438 "scan.l"
-do_yywrap = option_sense;
+#line 442 "scan.l"
+do_yywrap = option_sense; markup_option("YYWrap", option_sense);
        YY_BREAK
 case 96:
 YY_RULE_SETUP
-#line 440 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_PUSH_STATE", ! option_sense);
+#line 444 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_PUSH_STATE", ! option_sense); markup_option("YYPushState", option_sense);
        YY_BREAK
 case 97:
 YY_RULE_SETUP
-#line 441 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_POP_STATE", ! option_sense);
+#line 445 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_POP_STATE", ! option_sense); markup_option("YYPopState", option_sense);
        YY_BREAK
 case 98:
 YY_RULE_SETUP
-#line 442 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_TOP_STATE", ! option_sense);
+#line 446 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_TOP_STATE", ! option_sense); markup_option("YYTopState", option_sense);
        YY_BREAK
 case 99:
 YY_RULE_SETUP
-#line 444 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_SCAN_BUFFER", ! option_sense);
+#line 448 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SCAN_BUFFER", ! option_sense); markup_option("YYScanBuffer", option_sense);
        YY_BREAK
 case 100:
 YY_RULE_SETUP
-#line 445 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_SCAN_BYTES", ! option_sense);
+#line 449 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SCAN_BYTES", ! option_sense); markup_option("YYScanBytes", option_sense);
        YY_BREAK
 case 101:
 YY_RULE_SETUP
-#line 446 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_SCAN_STRING", ! option_sense);
+#line 450 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SCAN_STRING", ! option_sense); markup_option("YYScanString", option_sense);
        YY_BREAK
 case 102:
 YY_RULE_SETUP
-#line 448 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_FLEX_ALLOC", ! option_sense);
+#line 452 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_FLEX_ALLOC", ! option_sense); markup_option("YYAlloc", option_sense);
        YY_BREAK
 case 103:
 YY_RULE_SETUP
-#line 449 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_FLEX_REALLOC", ! option_sense);
+#line 453 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_FLEX_REALLOC", ! option_sense); markup_option("YYRealloc", option_sense);
        YY_BREAK
 case 104:
 YY_RULE_SETUP
-#line 450 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_FLEX_FREE", ! option_sense);
+#line 454 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_FLEX_FREE", ! option_sense); markup_option("YYFree", option_sense);
        YY_BREAK
 case 105:
 YY_RULE_SETUP
-#line 452 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_GET_DEBUG", ! option_sense);
+#line 456 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_DEBUG", ! option_sense); markup_option("YYGetDebug", option_sense);
        YY_BREAK
 case 106:
 YY_RULE_SETUP
-#line 453 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_SET_DEBUG", ! option_sense);
+#line 457 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_DEBUG", ! option_sense); markup_option("YYSetDebug", option_sense);
        YY_BREAK
 case 107:
 YY_RULE_SETUP
-#line 454 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_GET_EXTRA", ! option_sense);
+#line 458 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_EXTRA", ! option_sense); markup_option("YYGetExtra", option_sense);
        YY_BREAK
 case 108:
 YY_RULE_SETUP
-#line 455 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_SET_EXTRA", ! option_sense);
+#line 459 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_EXTRA", ! option_sense); markup_option("YYSetExtra", option_sense);
        YY_BREAK
 case 109:
 YY_RULE_SETUP
-#line 456 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_GET_LENG", ! option_sense);
+#line 460 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_LENG", ! option_sense); markup_option("YYGetLeng", option_sense);
        YY_BREAK
 case 110:
 YY_RULE_SETUP
-#line 457 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_GET_TEXT", ! option_sense);
+#line 461 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_TEXT", ! option_sense); markup_option("YYGetText", option_sense);
        YY_BREAK
 case 111:
 YY_RULE_SETUP
-#line 458 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_GET_LINENO", ! option_sense);
+#line 462 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_LINENO", ! option_sense); markup_option("YYGetLineNo", option_sense);
        YY_BREAK
 case 112:
 YY_RULE_SETUP
-#line 459 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_SET_LINENO", ! option_sense);
+#line 463 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_LINENO", ! option_sense); markup_option("YYSetLineNo", option_sense);
        YY_BREAK
 case 113:
 YY_RULE_SETUP
-#line 460 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_GET_IN", ! option_sense);
+#line 464 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_IN", ! option_sense); markup_option("YYGetIn", option_sense);
        YY_BREAK
 case 114:
 YY_RULE_SETUP
-#line 461 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_SET_IN", ! option_sense);
+#line 465 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_IN", ! option_sense); markup_option("YYSetIn", option_sense);
        YY_BREAK
 case 115:
 YY_RULE_SETUP
-#line 462 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_GET_OUT", ! option_sense);
+#line 466 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_OUT", ! option_sense); markup_option("YYGetOut", option_sense);
        YY_BREAK
 case 116:
 YY_RULE_SETUP
-#line 463 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_SET_OUT", ! option_sense);
+#line 467 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_OUT", ! option_sense); markup_option("YYSetOut", option_sense);
        YY_BREAK
 case 117:
 YY_RULE_SETUP
-#line 464 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_GET_LVAL", ! option_sense);
+#line 468 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_LVAL", ! option_sense); markup_option("YYGetLVal", option_sense);
        YY_BREAK
 case 118:
 YY_RULE_SETUP
-#line 465 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_SET_LVAL", ! option_sense);
+#line 469 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_LVAL", ! option_sense); markup_option("YYSetLVal", option_sense);
        YY_BREAK
 case 119:
 YY_RULE_SETUP
-#line 466 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_GET_LLOC", ! option_sense);
+#line 470 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_GET_LLOC", ! option_sense); markup_option("YYGetLLoc", option_sense);
        YY_BREAK
 case 120:
 YY_RULE_SETUP
-#line 467 "scan.l"
-ACTION_M4_IFDEF("M4""_YY_NO_SET_LLOC", ! option_sense);
+#line 471 "scan.l"
+ACTION_M4_IFDEF("M4""_YY_NO_SET_LLOC", ! option_sense); markup_option("YYSetLLoc", option_sense);
        YY_BREAK
 case 121:
 YY_RULE_SETUP
-#line 469 "scan.l"
+#line 473 "scan.l"
 return TOK_EXTRA_TYPE;
        YY_BREAK
 case 122:
 YY_RULE_SETUP
-#line 470 "scan.l"
+#line 474 "scan.l"
 return TOK_OUTFILE;
        YY_BREAK
 case 123:
 YY_RULE_SETUP
-#line 471 "scan.l"
+#line 475 "scan.l"
 return TOK_PREFIX;
        YY_BREAK
 case 124:
 YY_RULE_SETUP
-#line 472 "scan.l"
+#line 476 "scan.l"
 return TOK_YYCLASS;
        YY_BREAK
 case 125:
 YY_RULE_SETUP
-#line 473 "scan.l"
+#line 477 "scan.l"
 return TOK_HEADER_FILE;
        YY_BREAK
 case 126:
 YY_RULE_SETUP
-#line 474 "scan.l"
+#line 478 "scan.l"
 return TOK_TABLES_FILE;
        YY_BREAK
 case 127:
 YY_RULE_SETUP
-#line 475 "scan.l"
-{
+#line 479 "scan.l"
+{ markup_option("TablesVerify", option_sense);
                     tablesverify = option_sense;
                     if(!tablesext && option_sense)
                         tablesext = true;
@@ -3231,7 +3237,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 128:
 YY_RULE_SETUP
-#line 482 "scan.l"
+#line 486 "scan.l"
 {
                        if(yyleng-1 < MAXLINE)
                         {
@@ -3248,7 +3254,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 129:
 YY_RULE_SETUP
-#line 496 "scan.l"
+#line 500 "scan.l"
 {
                        format_synerr( _( "unrecognized %%option: %s" ),
                                yytext );
@@ -3259,28 +3265,28 @@ YY_RULE_SETUP
 case 130:
 /* rule 130 can match eol */
 YY_RULE_SETUP
-#line 503 "scan.l"
+#line 507 "scan.l"
 ++linenum; BEGIN(INITIAL);
        YY_BREAK
 
 case 131:
 YY_RULE_SETUP
-#line 507 "scan.l"
+#line 511 "scan.l"
 ++bracelevel; yyless( 2 );     /* eat only %{ */
        YY_BREAK
 case 132:
 YY_RULE_SETUP
-#line 508 "scan.l"
+#line 512 "scan.l"
 --bracelevel; yyless( 2 );     /* eat only %} */
        YY_BREAK
 case 133:
 YY_RULE_SETUP
-#line 510 "scan.l"
+#line 514 "scan.l"
 START_CODEBLOCK(true); /* indented code in prolog */
        YY_BREAK
 case 134:
 YY_RULE_SETUP
-#line 512 "scan.l"
+#line 516 "scan.l"
 {
         /* non-indented code */
                if ( bracelevel <= 0 ) {
@@ -3296,25 +3302,25 @@ YY_RULE_SETUP
        YY_BREAK
 case 135:
 YY_RULE_SETUP
-#line 525 "scan.l"
+#line 529 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 case 136:
 /* rule 136 can match eol */
 YY_RULE_SETUP
-#line 526 "scan.l"
+#line 530 "scan.l"
 ++linenum; ACTION_ECHO;
        YY_BREAK
 case YY_STATE_EOF(SECT2PROLOG):
-#line 528 "scan.l"
+#line 532 "scan.l"
 {
                        mark_prolog();
                        sectnum = 0;
 #if 1
  piece_pack();
- piece[piece1++] = strdup("</Sect2>");
+ piece_append("</Sect2>");
 #if 0
- piece[piece1++] = strdup("<token value=\"0\" />");
+ piece_append("<token value=\"0\" />");
 #endif
  piece_pack();
  return ~YY_NULL;
@@ -3328,24 +3334,24 @@ case YY_STATE_EOF(SECT2PROLOG):
 case 137:
 /* rule 137 can match eol */
 YY_RULE_SETUP
-#line 546 "scan.l"
+#line 550 "scan.l"
 ++linenum; /* allow blank lines in section 2 */
        YY_BREAK
 case 138:
 YY_RULE_SETUP
-#line 548 "scan.l"
+#line 552 "scan.l"
 {
                        indented_code = false;
                        doing_codeblock = true;
                        bracelevel = 1;
                        BEGIN(PERCENT_BRACE_ACTION);
  flush();
- piece[piece1++] = strdup("<PercentBraceAction>");
+ piece_append("<PercentBraceAction>");
                        }
        YY_BREAK
 case 139:
 YY_RULE_SETUP
-#line 557 "scan.l"
+#line 561 "scan.l"
 {
                         /* Allow "<" to appear in (?x) patterns. */
                         if (!sf_skip_ws())
@@ -3355,12 +3361,12 @@ YY_RULE_SETUP
        YY_BREAK
 case 140:
 YY_RULE_SETUP
-#line 563 "scan.l"
+#line 567 "scan.l"
 return '^';
        YY_BREAK
 case 141:
 YY_RULE_SETUP
-#line 564 "scan.l"
+#line 568 "scan.l"
 BEGIN(QUOTE); return '"';
        YY_BREAK
 case 142:
@@ -3368,7 +3374,7 @@ case 142:
 (yy_c_buf_p) = yy_cp = yy_bp + 1;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 565 "scan.l"
+#line 569 "scan.l"
 {
                        BEGIN(NUM);
                        if ( lex_compat || posix_compat )
@@ -3383,12 +3389,12 @@ case 143:
 (yy_c_buf_p) = yy_cp = yy_bp + 1;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 572 "scan.l"
+#line 576 "scan.l"
 return '$';
        YY_BREAK
 case 144:
 YY_RULE_SETUP
-#line 574 "scan.l"
+#line 578 "scan.l"
 {
                        bracelevel = 1;
                        BEGIN(PERCENT_BRACE_ACTION);
@@ -3402,25 +3408,25 @@ YY_RULE_SETUP
 #if 1
  piece_esc(yytext, strlen(yytext));
 #else
- piece[piece1++] = strdup("<token value=\"10\">");
+ piece_append("<token value=\"10\">");
  piece_esc(yytext, strlen(yytext));
- piece[piece1++] = strdup("</token>");
+ piece_append("</token>");
 #endif
  piece_pack();
- piece[piece1++] = strdup("<PercentBraceAction>");
+ piece_append("<PercentBraceAction>");
  return ~'\n';
 #else
                                return '\n';
 #endif
                                }
  flush();
- piece[piece1++] = strdup("<PercentBraceAction>");
+ piece_append("<PercentBraceAction>");
                        }
        YY_BREAK
 case 145:
 /* rule 145 can match eol */
 YY_RULE_SETUP
-#line 601 "scan.l"
+#line 605 "scan.l"
 {
                         if (sf_skip_ws()){
                             /* We're in the middle of a (?x: ) pattern. */
@@ -3438,7 +3444,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 146:
 YY_RULE_SETUP
-#line 616 "scan.l"
+#line 620 "scan.l"
 {
 
                 if (sf_skip_ws()){
@@ -3450,19 +3456,19 @@ YY_RULE_SETUP
                     bracelevel = 0;
                     continued_action = false;
                     BEGIN(ACTION);
- flush();
- piece[piece1++] = strdup("<Action>");
/*flush();
+ piece_append("<Action>");*/
                 }
                        }
        YY_BREAK
 case 147:
 YY_RULE_SETUP
-#line 632 "scan.l"
+#line 636 "scan.l"
 /* allow indented rules */ ;
        YY_BREAK
 case 148:
 YY_RULE_SETUP
-#line 634 "scan.l"
+#line 638 "scan.l"
 {
             if (sf_skip_ws()){
                 /* We're in the middle of a (?x: ) pattern. */
@@ -3485,12 +3491,12 @@ YY_RULE_SETUP
 #if 1
  piece_esc(yytext, strlen(yytext));
 #else
- piece[piece1++] = strdup("<token value=\"10\">");
+ piece_append("<token value=\"10\">");
  piece_esc(yytext, strlen(yytext));
- piece[piece1++] = strdup("</token>");
+ piece_append("</token>");
 #endif
  piece_pack();
- piece[piece1++] = strdup("<Action>");
+ piece_append("<Action>");
  return ~'\n';
 #else
                     return '\n';
@@ -3502,7 +3508,7 @@ YY_RULE_SETUP
 case 149:
 /* rule 149 can match eol */
 YY_RULE_SETUP
-#line 670 "scan.l"
+#line 674 "scan.l"
 {
             if (sf_skip_ws()){
                 /* We're in the middle of a (?x: ) pattern. */
@@ -3527,12 +3533,12 @@ YY_RULE_SETUP
 #if 1
  piece_esc(yytext, strlen(yytext));
 #else
- piece[piece1++] = strdup("<token value=\"10\">");
+ piece_append("<token value=\"10\">");
  piece_esc(yytext, strlen(yytext));
- piece[piece1++] = strdup("</token>");
+ piece_append("</token>");
 #endif
  piece_pack();
- piece[piece1++] = strdup("<Action>");
+ piece_append("<Action>");
  return ~'\n';
 #else
                     return '\n';
@@ -3542,31 +3548,31 @@ YY_RULE_SETUP
                        }
        YY_BREAK
 case 150:
-#line 709 "scan.l"
+#line 713 "scan.l"
 case 151:
 YY_RULE_SETUP
-#line 709 "scan.l"
+#line 713 "scan.l"
 return EOF_OP;
        YY_BREAK
 case 152:
 YY_RULE_SETUP
-#line 711 "scan.l"
+#line 715 "scan.l"
 {
                        sectnum = 3;
                        BEGIN(no_section3_escape ? SECT3_NOESCAPE : SECT3);
                        outn("/* Begin user sect3 */");
 #if 1
  piece_pack();
- piece[piece1++] = strdup("</Sect2>");
+ piece_append("</Sect2>");
 #if 1
  piece_esc(yytext, strlen(yytext));
 #else
- piece[piece1++] = strdup("<token value=\"0\">");
+ piece_append("<token value=\"0\">");
  piece_esc(yytext, strlen(yytext));
- piece[piece1++] = strdup("</token>");
+ piece_append("</token>");
 #endif
  piece_pack();
- piece[piece1++] = strdup("<Sect3>");
+ piece_append("<Sect3>");
  return ~YY_NULL;
 #else
                        yyterminate(); /* to stop the parser */
@@ -3576,7 +3582,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 153:
 YY_RULE_SETUP
-#line 734 "scan.l"
+#line 738 "scan.l"
 {
                        int cclval;
 
@@ -3626,12 +3632,12 @@ YY_RULE_SETUP
        YY_BREAK
 case 154:
 YY_RULE_SETUP
-#line 780 "scan.l"
+#line 784 "scan.l"
 return CCL_OP_DIFF;
        YY_BREAK
 case 155:
 YY_RULE_SETUP
-#line 781 "scan.l"
+#line 785 "scan.l"
 return CCL_OP_UNION;
        YY_BREAK
 /* Check for :space: at the end of the rule so we don't
@@ -3641,7 +3647,7 @@ return CCL_OP_UNION;
 case 156:
 /* rule 156 can match eol */
 YY_RULE_SETUP
-#line 788 "scan.l"
+#line 792 "scan.l"
 {
                        char *nmdefptr;
             int end_is_ws, end_ch;
@@ -3696,7 +3702,7 @@ nmstr[yyleng - 2 - end_is_ws] = '\0';  /* chop trailing brace */
        YY_BREAK
 case 157:
 YY_RULE_SETUP
-#line 840 "scan.l"
+#line 844 "scan.l"
 {
                     if (sf_skip_ws())
                         yy_push_state(COMMENT_DISCARD);
@@ -3709,7 +3715,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 158:
 YY_RULE_SETUP
-#line 850 "scan.l"
+#line 854 "scan.l"
 {
                     if (lex_compat || posix_compat){
                         /* Push back the "?#" and treat it like a normal parens. */
@@ -3723,7 +3729,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 159:
 YY_RULE_SETUP
-#line 860 "scan.l"
+#line 864 "scan.l"
 {
                     sf_push();
                     if (lex_compat || posix_compat)
@@ -3736,12 +3742,12 @@ YY_RULE_SETUP
        YY_BREAK
 case 160:
 YY_RULE_SETUP
-#line 869 "scan.l"
+#line 873 "scan.l"
 sf_push(); return '(';
        YY_BREAK
 case 161:
 YY_RULE_SETUP
-#line 870 "scan.l"
+#line 874 "scan.l"
 {
                     if (_sf_top_ix > 0) {
                         sf_pop();
@@ -3752,24 +3758,24 @@ YY_RULE_SETUP
        YY_BREAK
 case 162:
 YY_RULE_SETUP
-#line 878 "scan.l"
+#line 882 "scan.l"
 return (unsigned char) yytext[0];
        YY_BREAK
 case 163:
 YY_RULE_SETUP
-#line 879 "scan.l"
+#line 883 "scan.l"
 RETURNCHAR;
        YY_BREAK
 /* Nick added this rule for consistency with rest of scanner */
 case YY_STATE_EOF(SECT2):
-#line 882 "scan.l"
+#line 886 "scan.l"
 {
                        sectnum = 0;
 #if 1
  piece_pack();
- piece[piece1++] = strdup("</Sect2>");
+ piece_append("</Sect2>");
 #if 0
- piece[piece1++] = strdup("<token value=\"0\" />");
+ piece_append("<token value=\"0\" />");
 #endif
  piece_pack();
  return ~YY_NULL;
@@ -3783,17 +3789,17 @@ case YY_STATE_EOF(SECT2):
 case 164:
 /* rule 164 can match eol */
 YY_RULE_SETUP
-#line 900 "scan.l"
+#line 904 "scan.l"
 ++linenum;     /* Allow blank lines & continuations */
        YY_BREAK
 case 165:
 YY_RULE_SETUP
-#line 901 "scan.l"
+#line 905 "scan.l"
 return (unsigned char) yytext[0];
        YY_BREAK
 case 166:
 YY_RULE_SETUP
-#line 902 "scan.l"
+#line 906 "scan.l"
 BEGIN(SECT2); return '>';
        YY_BREAK
 case 167:
@@ -3801,17 +3807,17 @@ case 167:
 (yy_c_buf_p) = yy_cp = yy_bp + 1;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 903 "scan.l"
+#line 907 "scan.l"
 BEGIN(CARETISBOL); return '>';
        YY_BREAK
 case 168:
 YY_RULE_SETUP
-#line 904 "scan.l"
+#line 908 "scan.l"
 RETURNNAME;
        YY_BREAK
 case 169:
 YY_RULE_SETUP
-#line 905 "scan.l"
+#line 909 "scan.l"
 {
                        format_synerr( _( "bad <start condition>: %s" ),
                                yytext );
@@ -3820,24 +3826,24 @@ YY_RULE_SETUP
 
 case 170:
 YY_RULE_SETUP
-#line 911 "scan.l"
+#line 915 "scan.l"
 BEGIN(SECT2); return '^';
        YY_BREAK
 
 case 171:
 YY_RULE_SETUP
-#line 915 "scan.l"
+#line 919 "scan.l"
 RETURNCHAR;
        YY_BREAK
 case 172:
 YY_RULE_SETUP
-#line 916 "scan.l"
+#line 920 "scan.l"
 BEGIN(SECT2); return '"';
        YY_BREAK
 case 173:
 /* rule 173 can match eol */
 YY_RULE_SETUP
-#line 918 "scan.l"
+#line 922 "scan.l"
 {
                        synerr( _( "missing quote" ) );
                        BEGIN(SECT2);
@@ -3849,49 +3855,49 @@ YY_RULE_SETUP
 
 case 174:
 YY_RULE_SETUP
-#line 927 "scan.l"
+#line 931 "scan.l"
 BEGIN(SECT2);
        YY_BREAK
 case 175:
 YY_RULE_SETUP
-#line 928 "scan.l"
+#line 932 "scan.l"
 BEGIN(GROUP_MINUS_PARAMS);
        YY_BREAK
 case 176:
 YY_RULE_SETUP
-#line 929 "scan.l"
+#line 933 "scan.l"
 sf_set_case_ins(1);
        YY_BREAK
 case 177:
 YY_RULE_SETUP
-#line 930 "scan.l"
+#line 934 "scan.l"
 sf_set_dot_all(1);
        YY_BREAK
 case 178:
 YY_RULE_SETUP
-#line 931 "scan.l"
+#line 935 "scan.l"
 sf_set_skip_ws(1);
        YY_BREAK
 
 
 case 179:
 YY_RULE_SETUP
-#line 934 "scan.l"
+#line 938 "scan.l"
 BEGIN(SECT2);
        YY_BREAK
 case 180:
 YY_RULE_SETUP
-#line 935 "scan.l"
+#line 939 "scan.l"
 sf_set_case_ins(0);
        YY_BREAK
 case 181:
 YY_RULE_SETUP
-#line 936 "scan.l"
+#line 940 "scan.l"
 sf_set_dot_all(0);
        YY_BREAK
 case 182:
 YY_RULE_SETUP
-#line 937 "scan.l"
+#line 941 "scan.l"
 sf_set_skip_ws(0);
        YY_BREAK
 
@@ -3901,7 +3907,7 @@ case 183:
 (yy_c_buf_p) = yy_cp = yy_bp + 1;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 941 "scan.l"
+#line 945 "scan.l"
 BEGIN(CCL); return '^';
        YY_BREAK
 case 184:
@@ -3909,12 +3915,12 @@ case 184:
 (yy_c_buf_p) = yy_cp = yy_bp + 1;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 942 "scan.l"
+#line 946 "scan.l"
 return '^';
        YY_BREAK
 case 185:
 YY_RULE_SETUP
-#line 943 "scan.l"
+#line 947 "scan.l"
 BEGIN(CCL); RETURNCHAR;
        YY_BREAK
 
@@ -3924,23 +3930,23 @@ case 186:
 (yy_c_buf_p) = yy_cp = yy_bp + 1;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 947 "scan.l"
+#line 951 "scan.l"
 return '-';
        YY_BREAK
 case 187:
 YY_RULE_SETUP
-#line 948 "scan.l"
+#line 952 "scan.l"
 RETURNCHAR;
        YY_BREAK
 case 188:
 YY_RULE_SETUP
-#line 949 "scan.l"
+#line 953 "scan.l"
 BEGIN(SECT2); return ']';
        YY_BREAK
 case 189:
 /* rule 189 can match eol */
 YY_RULE_SETUP
-#line 950 "scan.l"
+#line 954 "scan.l"
 {
                        synerr( _( "bad character class" ) );
                        BEGIN(SECT2);
@@ -3951,127 +3957,127 @@ YY_RULE_SETUP
 
 case 190:
 YY_RULE_SETUP
-#line 958 "scan.l"
+#line 962 "scan.l"
 BEGIN(CCL); return CCE_ALNUM;
        YY_BREAK
 case 191:
 YY_RULE_SETUP
-#line 959 "scan.l"
+#line 963 "scan.l"
 BEGIN(CCL); return CCE_ALPHA;
        YY_BREAK
 case 192:
 YY_RULE_SETUP
-#line 960 "scan.l"
+#line 964 "scan.l"
 BEGIN(CCL); return CCE_BLANK;
        YY_BREAK
 case 193:
 YY_RULE_SETUP
-#line 961 "scan.l"
+#line 965 "scan.l"
 BEGIN(CCL); return CCE_CNTRL;
        YY_BREAK
 case 194:
 YY_RULE_SETUP
-#line 962 "scan.l"
+#line 966 "scan.l"
 BEGIN(CCL); return CCE_DIGIT;
        YY_BREAK
 case 195:
 YY_RULE_SETUP
-#line 963 "scan.l"
+#line 967 "scan.l"
 BEGIN(CCL); return CCE_GRAPH;
        YY_BREAK
 case 196:
 YY_RULE_SETUP
-#line 964 "scan.l"
+#line 968 "scan.l"
 BEGIN(CCL); return CCE_LOWER;
        YY_BREAK
 case 197:
 YY_RULE_SETUP
-#line 965 "scan.l"
+#line 969 "scan.l"
 BEGIN(CCL); return CCE_PRINT;
        YY_BREAK
 case 198:
 YY_RULE_SETUP
-#line 966 "scan.l"
+#line 970 "scan.l"
 BEGIN(CCL); return CCE_PUNCT;
        YY_BREAK
 case 199:
 YY_RULE_SETUP
-#line 967 "scan.l"
+#line 971 "scan.l"
 BEGIN(CCL); return CCE_SPACE;
        YY_BREAK
 case 200:
 YY_RULE_SETUP
-#line 968 "scan.l"
+#line 972 "scan.l"
 BEGIN(CCL); return CCE_UPPER;
        YY_BREAK
 case 201:
 YY_RULE_SETUP
-#line 969 "scan.l"
+#line 973 "scan.l"
 BEGIN(CCL); return CCE_XDIGIT;
        YY_BREAK
 case 202:
 YY_RULE_SETUP
-#line 971 "scan.l"
+#line 975 "scan.l"
 BEGIN(CCL); return CCE_NEG_ALNUM;
        YY_BREAK
 case 203:
 YY_RULE_SETUP
-#line 972 "scan.l"
+#line 976 "scan.l"
 BEGIN(CCL); return CCE_NEG_ALPHA;
        YY_BREAK
 case 204:
 YY_RULE_SETUP
-#line 973 "scan.l"
+#line 977 "scan.l"
 BEGIN(CCL); return CCE_NEG_BLANK;
        YY_BREAK
 case 205:
 YY_RULE_SETUP
-#line 974 "scan.l"
+#line 978 "scan.l"
 BEGIN(CCL); return CCE_NEG_CNTRL;
        YY_BREAK
 case 206:
 YY_RULE_SETUP
-#line 975 "scan.l"
+#line 979 "scan.l"
 BEGIN(CCL); return CCE_NEG_DIGIT;
        YY_BREAK
 case 207:
 YY_RULE_SETUP
-#line 976 "scan.l"
+#line 980 "scan.l"
 BEGIN(CCL); return CCE_NEG_GRAPH;
        YY_BREAK
 case 208:
 YY_RULE_SETUP
-#line 977 "scan.l"
+#line 981 "scan.l"
 BEGIN(CCL); return CCE_NEG_LOWER;
        YY_BREAK
 case 209:
 YY_RULE_SETUP
-#line 978 "scan.l"
+#line 982 "scan.l"
 BEGIN(CCL); return CCE_NEG_PRINT;
        YY_BREAK
 case 210:
 YY_RULE_SETUP
-#line 979 "scan.l"
+#line 983 "scan.l"
 BEGIN(CCL); return CCE_NEG_PUNCT;
        YY_BREAK
 case 211:
 YY_RULE_SETUP
-#line 980 "scan.l"
+#line 984 "scan.l"
 BEGIN(CCL); return CCE_NEG_SPACE;
        YY_BREAK
 case 212:
 YY_RULE_SETUP
-#line 981 "scan.l"
+#line 985 "scan.l"
 BEGIN(CCL); return CCE_NEG_UPPER;
        YY_BREAK
 case 213:
 YY_RULE_SETUP
-#line 982 "scan.l"
+#line 986 "scan.l"
 BEGIN(CCL); return CCE_NEG_XDIGIT;
        YY_BREAK
 case 214:
 YY_RULE_SETUP
-#line 983 "scan.l"
+#line 987 "scan.l"
 {
                        format_synerr(
                                _( "bad character class expression: %s" ),
@@ -4083,7 +4089,7 @@ YY_RULE_SETUP
 
 case 215:
 YY_RULE_SETUP
-#line 992 "scan.l"
+#line 996 "scan.l"
 {
                        yylval = myctoi( yytext );
                        return NUMBER;
@@ -4091,12 +4097,12 @@ YY_RULE_SETUP
        YY_BREAK
 case 216:
 YY_RULE_SETUP
-#line 997 "scan.l"
+#line 1001 "scan.l"
 return ',';
        YY_BREAK
 case 217:
 YY_RULE_SETUP
-#line 998 "scan.l"
+#line 1002 "scan.l"
 {
                        BEGIN(SECT2);
                        if ( lex_compat || posix_compat )
@@ -4107,7 +4113,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 218:
 YY_RULE_SETUP
-#line 1006 "scan.l"
+#line 1010 "scan.l"
 {
                        synerr( _( "bad character inside {}'s" ) );
                        BEGIN(SECT2);
@@ -4117,7 +4123,7 @@ YY_RULE_SETUP
 case 219:
 /* rule 219 can match eol */
 YY_RULE_SETUP
-#line 1012 "scan.l"
+#line 1016 "scan.l"
 {
                        synerr( _( "missing }" ) );
                        BEGIN(SECT2);
@@ -4129,18 +4135,18 @@ YY_RULE_SETUP
 
 case 220:
 YY_RULE_SETUP
-#line 1022 "scan.l"
+#line 1026 "scan.l"
 bracelevel = 0;
        YY_BREAK
 case 221:
 YY_RULE_SETUP
-#line 1024 "scan.l"
+#line 1028 "scan.l"
 ACTION_ECHO; yy_push_state( CODE_COMMENT );
        YY_BREAK
 
 case 222:
 YY_RULE_SETUP
-#line 1027 "scan.l"
+#line 1031 "scan.l"
 {
             ACTION_ECHO;
             CHECK_REJECT(yytext);
@@ -4148,7 +4154,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 223:
 YY_RULE_SETUP
-#line 1031 "scan.l"
+#line 1035 "scan.l"
 {
             ACTION_ECHO;
             CHECK_YYMORE(yytext);
@@ -4157,13 +4163,13 @@ YY_RULE_SETUP
 
 case 224:
 YY_RULE_SETUP
-#line 1037 "scan.l"
+#line 1041 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 case 225:
 /* rule 225 can match eol */
 YY_RULE_SETUP
-#line 1038 "scan.l"
+#line 1042 "scan.l"
 {
                ++linenum;
                ACTION_ECHO;
@@ -4173,7 +4179,7 @@ YY_RULE_SETUP
 
             doing_rule_action = doing_codeblock = false;
             BEGIN(SECT2);
- piece[piece1++] = strdup("</PercentBraceAction>");
+ piece_append("</PercentBraceAction>");
         }
     }
        YY_BREAK
@@ -4182,43 +4188,43 @@ YY_RULE_SETUP
 
 case 226:
 YY_RULE_SETUP
-#line 1055 "scan.l"
+#line 1059 "scan.l"
 ACTION_ECHO; ++bracelevel;
        YY_BREAK
 case 227:
 YY_RULE_SETUP
-#line 1056 "scan.l"
+#line 1060 "scan.l"
 ACTION_ECHO; --bracelevel;
        YY_BREAK
 case 228:
 YY_RULE_SETUP
-#line 1057 "scan.l"
+#line 1061 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 case 229:
 YY_RULE_SETUP
-#line 1058 "scan.l"
+#line 1062 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 case 230:
 YY_RULE_SETUP
-#line 1059 "scan.l"
+#line 1063 "scan.l"
 ACTION_ECHO; /* character constant */
        YY_BREAK
 case 231:
 YY_RULE_SETUP
-#line 1060 "scan.l"
+#line 1064 "scan.l"
 ACTION_ECHO; BEGIN(CHARACTER_CONSTANT);
        YY_BREAK
 case 232:
 YY_RULE_SETUP
-#line 1061 "scan.l"
+#line 1065 "scan.l"
 ACTION_ECHO; BEGIN(ACTION_STRING);
        YY_BREAK
 case 233:
 /* rule 233 can match eol */
 YY_RULE_SETUP
-#line 1062 "scan.l"
+#line 1066 "scan.l"
 {
                 ++linenum;
                 ACTION_ECHO;
@@ -4227,7 +4233,7 @@ YY_RULE_SETUP
  {
                       add_action( "\tYY_BREAK]""]\n" );
   flush();
-  piece[piece1++] = strdup("</Action>");
+  markup_action();
  }
 
                    doing_rule_action = false;
@@ -4237,31 +4243,31 @@ YY_RULE_SETUP
        YY_BREAK
 case 234:
 YY_RULE_SETUP
-#line 1077 "scan.l"
+#line 1081 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 
 
 case 235:
 YY_RULE_SETUP
-#line 1081 "scan.l"
+#line 1085 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 case 236:
 YY_RULE_SETUP
-#line 1082 "scan.l"
+#line 1086 "scan.l"
 ACTION_ECHO; BEGIN(ACTION);
        YY_BREAK
 
 
 case 237:
 YY_RULE_SETUP
-#line 1085 "scan.l"
+#line 1089 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 case 238:
 YY_RULE_SETUP
-#line 1086 "scan.l"
+#line 1090 "scan.l"
 ACTION_ECHO; BEGIN(ACTION);
        YY_BREAK
 
@@ -4269,24 +4275,24 @@ ACTION_ECHO; BEGIN(ACTION);
 case 239:
 /* rule 239 can match eol */
 YY_RULE_SETUP
-#line 1089 "scan.l"
+#line 1093 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 case 240:
 /* rule 240 can match eol */
 YY_RULE_SETUP
-#line 1090 "scan.l"
+#line 1094 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 case 241:
 /* rule 241 can match eol */
 YY_RULE_SETUP
-#line 1091 "scan.l"
-++linenum; ACTION_ECHO; if (bracelevel <= 0) { BEGIN(SECT2); flush(); if (doing_rule_action) piece[piece1++] = strdup("</Action>"); } else { BEGIN(ACTION); }
+#line 1095 "scan.l"
+++linenum; ACTION_ECHO; if (bracelevel <= 0) { BEGIN(SECT2); flush(); if (doing_rule_action) markup_action(); } else { BEGIN(ACTION); }
        YY_BREAK
 case 242:
 YY_RULE_SETUP
-#line 1092 "scan.l"
+#line 1096 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 
@@ -4296,7 +4302,7 @@ case YY_STATE_EOF(COMMENT_DISCARD):
 case YY_STATE_EOF(ACTION):
 case YY_STATE_EOF(ACTION_STRING):
 case YY_STATE_EOF(CHARACTER_CONSTANT):
-#line 1095 "scan.l"
+#line 1099 "scan.l"
 {
                        synerr( _( "EOF encountered inside an action" ) );
                        yyterminate();
@@ -4305,7 +4311,7 @@ case YY_STATE_EOF(CHARACTER_CONSTANT):
 case YY_STATE_EOF(EXTENDED_COMMENT):
 case YY_STATE_EOF(GROUP_WITH_PARAMS):
 case YY_STATE_EOF(GROUP_MINUS_PARAMS):
-#line 1100 "scan.l"
+#line 1104 "scan.l"
 {
                        synerr( _( "EOF encountered inside pattern" ) );
                        yyterminate();
@@ -4313,7 +4319,7 @@ case YY_STATE_EOF(GROUP_MINUS_PARAMS):
        YY_BREAK
 case 243:
 YY_RULE_SETUP
-#line 1105 "scan.l"
+#line 1109 "scan.l"
 {
                        yylval = myesc( (unsigned char *) yytext );
 
@@ -4326,34 +4332,34 @@ YY_RULE_SETUP
 
 case 244:
 YY_RULE_SETUP
-#line 1115 "scan.l"
+#line 1119 "scan.l"
 fputs(escaped_qstart, yyout);
        YY_BREAK
 case 245:
 YY_RULE_SETUP
-#line 1116 "scan.l"
+#line 1120 "scan.l"
 fputs(escaped_qend, yyout);
        YY_BREAK
 case 246:
 /* rule 246 can match eol */
 YY_RULE_SETUP
-#line 1117 "scan.l"
+#line 1121 "scan.l"
 ECHO;
        YY_BREAK
 case 247:
 YY_RULE_SETUP
-#line 1118 "scan.l"
+#line 1122 "scan.l"
 ECHO;
        YY_BREAK
 case YY_STATE_EOF(SECT3):
-#line 1119 "scan.l"
+#line 1123 "scan.l"
 {
         sectnum = 0;
 #if 1
  piece_pack();
- piece[piece1++] = strdup("</Sect3>");
+ piece_append("</Sect3>");
 #if 0
- piece[piece1++] = strdup("<token value=\"0\" />");
+ piece_append("<token value=\"0\" />");
 #endif
  piece_pack();
  return ~YY_NULL;
@@ -4366,34 +4372,34 @@ case YY_STATE_EOF(SECT3):
 
 case 248:
 YY_RULE_SETUP
-#line 1135 "scan.l"
+#line 1139 "scan.l"
 fprintf(yyout, "[""[%s]""]", escaped_qstart);
        YY_BREAK
 case 249:
 YY_RULE_SETUP
-#line 1136 "scan.l"
+#line 1140 "scan.l"
 fprintf(yyout, "[""[%s]""]", escaped_qend);
        YY_BREAK
 case 250:
 /* rule 250 can match eol */
 YY_RULE_SETUP
-#line 1137 "scan.l"
+#line 1141 "scan.l"
 ECHO;
        YY_BREAK
 case 251:
 YY_RULE_SETUP
-#line 1138 "scan.l"
+#line 1142 "scan.l"
 ECHO;
        YY_BREAK
 case YY_STATE_EOF(SECT3_NOESCAPE):
-#line 1139 "scan.l"
+#line 1143 "scan.l"
 {
        sectnum = 0;
 #if 1
  piece_pack();
- piece[piece1++] = strdup("</Sect3>");
+ piece_append("</Sect3>");
 #if 0
- piece[piece1++] = strdup("<token value=\"0\" />");
+ piece_append("<token value=\"0\" />");
 #endif
  piece_pack();
  return ~YY_NULL;
@@ -4406,15 +4412,15 @@ case YY_STATE_EOF(SECT3_NOESCAPE):
 case 252:
 /* rule 252 can match eol */
 YY_RULE_SETUP
-#line 1154 "scan.l"
+#line 1158 "scan.l"
 format_synerr( _( "bad character: %s" ), yytext );
        YY_BREAK
 case 253:
 YY_RULE_SETUP
-#line 1156 "scan.l"
+#line 1160 "scan.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
        YY_BREAK
-#line 4308 "scan.c"
+#line 4312 "scan.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(CODEBLOCK):
 case YY_STATE_EOF(PICKUPDEF):
@@ -5467,7 +5473,7 @@ void yyfree (void * ptr )
 
 #define YYTABLES_NAME "yytables"
 
-#line 1156 "scan.l"
+#line 1160 "scan.l"
 
 
 
@@ -5507,3 +5513,28 @@ void set_input_file( char *file )
        linenum = 1;
        }
 
+/* Nick */
+static void markup_action(void) {
+ piece_append("</Action></Rule>");
+ /* append to last token text so it appears inside <Rule>..</Rule> */
+ int i = strlen(piece[--piece0]);
+ if (i < 7 || strcmp(piece[piece0] + i - 7, "</Rule>") != 0)
+  abort();
+ piece[piece0][i - 7] = 0;
+ piece_pack();
+}
+
+static void markup_option(const char *name, int sense) {
+ int i = piece1;
+ while (--i >= piece0 && strcmp(piece[i], "no") == 0)
+  ;
+ sprintf(piece_temp, "<Options_%s value=\"%s\">", name, sense ? "true" : "false");
+ piece_insert(i + 1, piece_temp);
+ flush();
+ sprintf(piece_temp, "</Options_%s>", name);
+ piece_append(piece_temp);
+ /* append to last token text so it appears inside <Options>..</Options> */
+ --piece0;
+ piece_pack();
+}
+
index 8770d1b..c7985f3 100644 (file)
@@ -1,6 +1,6 @@
---- scan.c.orig        2018-06-23 10:26:10.768657057 +1000
-+++ scan.c     2018-06-23 10:52:51.120589330 +1000
-@@ -23,6 +23,17 @@
+--- scan.c.orig        2018-06-23 13:08:34.800427005 +1000
++++ scan.c     2018-06-23 13:06:16.936432839 +1000
+@@ -23,6 +23,19 @@
  
  /* end standard C headers. */
  
@@ -8,17 +8,19 @@
 +char *piece[10000];
 +int piece0;
 +int piece1;
-+void insert_piece(int n, const char *str) {
++void piece_append(const char *str) {
++ piece[piece1++] = strdup(str);
++}
++void piece_insert(int n, const char *str) {
 + memmove(piece + n + 1, piece + n, (piece1 - n) * sizeof(char *));
 + piece[n] = strdup(str);
-+ ++piece0;
 + ++piece1;
 +}
 +
  /* flex integer type definitions */
  
  #ifndef FLEXINT_H
-@@ -185,7 +196,21 @@
+@@ -185,7 +198,21 @@
                } \
        while ( 0 )
  
@@ -40,7 +42,7 @@
  
  #ifndef YY_TYPEDEF_YY_SIZE_T
  #define YY_TYPEDEF_YY_SIZE_T
-@@ -2215,8 +2240,88 @@
+@@ -2218,8 +2245,88 @@
  
  /** The main scanner function which does all the work.
   */
 + size_t n = strlen(yytext);
 + if (n) {
 +  sprintf(piece_temp, "<token value=\"%d\">", result);
-+  piece[piece1++] = strdup(piece_temp);
++  piece_append(piece_temp);
 +  piece_esc(yytext, n);
-+  piece[piece1++] = strdup("</token>");
++  piece_append("</token>");
 + }
 + else {
 +  sprintf(piece_temp, "<token value=\"%d\" />", result);
-+  piece[piece1++] = strdup(piece_temp);
++  piece_append(piece_temp);
 + }
 +#endif
 + piece_pack();
        register yy_state_type yy_current_state;
        register char *yy_cp, *yy_bp;
        register int yy_act;
-@@ -2260,7 +2365,12 @@
+@@ -2263,7 +2370,12 @@
                yy_load_buffer_state( );
                }
  
index bb62473..8ac94c8 100644 (file)
@@ -75,9 +75,9 @@ extern const char *escaped_qstart, *escaped_qend;
        if(yyleng < MAXLINE) \
          { \
        strncpy( nmstr, yytext, sizeof(nmstr) ); \
- piece[piece1++] = strdup("<Name>"); \
+ piece_append("<Name>"); \
  flush(); \
- piece[piece1++] = strdup("</Name>"); \
+ piece_append("</Name>"); \
        return NAME; \
         } \
        else \
@@ -114,16 +114,20 @@ extern const char *escaped_qstart, *escaped_qend;
     yy_push_state(CODEBLOCK); \
     if ((indented_code = x)) ACTION_ECHO; \
  flush(); \
- piece[piece1++] = strdup("<CodeBlock>"); \
+ piece_append("<CodeBlock>"); \
 } while(0)
 
 #define END_CODEBLOCK do { \
     yy_pop_state();\
     add_action(M4QEND); \
     if (!indented_code) line_directive_out(NULL, 0);\
- piece[piece1++] = strdup("</CodeBlock>"); \
+ piece_append("</CodeBlock>"); \
 } while (0)
 
+/* Nick */
+static void markup_action(void);
+static void markup_option(const char *name, int sense);
+
 %}
 
 %option caseless nodefault noreject stack noyy_top_state
@@ -197,17 +201,17 @@ M4QEND      "]""]"
                        line_directive_out(NULL, 1);
                        BEGIN(SECT2PROLOG);
 #if 1
- piece[piece1++] = strdup("</Sect1>");
+ piece_append("</Sect1>");
  piece_pack();
 #if 1
  piece_esc(yytext, strlen(yytext));
 #else
  sprintf(piece_temp, "<token value=\"%d\">", SECTEND);
- piece[piece1++] = strdup(piece_temp);
+ piece_append(piece_temp);
  piece_esc(yytext, strlen(yytext));
- piece[piece1++] = strdup("</token>");
+ piece_append("</token>");
 #endif
- piece[piece1++] = strdup("<Sect2>");
+ piece_append("<Sect2>");
  piece_pack();
  return ~SECTEND;
 #else
@@ -376,95 +380,95 @@ M4QEND      "]""]"
 
        no              option_sense = ! option_sense;
 
-       7bit            csize = option_sense ? 128 : 256;
-       8bit            csize = option_sense ? 256 : 128;
+       7bit            csize = option_sense ? 128 : 256; markup_option("7bit", option_sense);
+       8bit            csize = option_sense ? 256 : 128; markup_option("8bit", option_sense);
 
-       align           long_align = option_sense;
-       always-interactive      {
+       align           long_align = option_sense; markup_option("Align", option_sense);
+       always-interactive      { markup_option("AlwaysInteractive", option_sense);
                        ACTION_M4_IFDEF( "M4""_YY_ALWAYS_INTERACTIVE", option_sense );
             interactive = option_sense;
                        }
-       array           yytext_is_array = option_sense;
-       backup          backing_up_report = option_sense;
-       batch           interactive = ! option_sense;
-    bison-bridge     bison_bridge_lval = option_sense;
-    bison-locations  { if((bison_bridge_lloc = option_sense))
+       array           yytext_is_array = option_sense; markup_option("Array", option_sense);
+       backup          backing_up_report = option_sense; markup_option("Backup", option_sense);
+       batch           interactive = ! option_sense; markup_option("Batch", option_sense);
+    bison-bridge     bison_bridge_lval = option_sense; markup_option("BisonBridge", option_sense);
+    bison-locations  { if((bison_bridge_lloc = option_sense)) markup_option("BisonLocations", option_sense);
                             bison_bridge_lval = true;
                      }
-       "c++"           C_plus_plus = option_sense;
-       caseful|case-sensitive          sf_set_case_ins(!option_sense);
-       caseless|case-insensitive       sf_set_case_ins(option_sense);
-       debug           ddebug = option_sense;
-       default         spprdflt = ! option_sense;
-       ecs             useecs = option_sense;
-       fast            {
+       "c++"           C_plus_plus = option_sense; markup_option("CPlusPlus", option_sense);
+       caseful|case-sensitive          sf_set_case_ins(!option_sense); markup_option("CaseSensitive", option_sense);
+       caseless|case-insensitive       sf_set_case_ins(option_sense); markup_option("CaseInsensitive", option_sense);
+       debug           ddebug = option_sense; markup_option("Debug", option_sense);
+       default         spprdflt = ! option_sense; markup_option("Default", option_sense);
+       ecs             useecs = option_sense; markup_option("ECS", option_sense);
+       fast            { markup_option("Fast", option_sense);
                        useecs = usemecs = false;
                        use_read = fullspd = true;
                        }
-       full            {
+       full            { markup_option("Full", option_sense);
                        useecs = usemecs = false;
                        use_read = fulltbl = true;
                        }
-       input           ACTION_IFDEF("YY_NO_INPUT", ! option_sense);
-       interactive     interactive = option_sense;
-       lex-compat      lex_compat = option_sense;
-       posix-compat    posix_compat = option_sense;
-       line            gen_line_dirs = option_sense;
-       main            {
+       input           ACTION_IFDEF("YY_NO_INPUT", ! option_sense); markup_option("Input", option_sense);
+       interactive     interactive = option_sense; markup_option("Interactive", option_sense);
+       lex-compat      lex_compat = option_sense; markup_option("LexCompat", option_sense);
+       posix-compat    posix_compat = option_sense; markup_option("PosixCompat", option_sense);
+       line            gen_line_dirs = option_sense; markup_option("Line", option_sense);
+       main            { markup_option("Main", option_sense);
                        ACTION_M4_IFDEF( "M4""_YY_MAIN", option_sense);
             /* Override yywrap */
             if( option_sense == true )
                 do_yywrap = false;
                        }
-       meta-ecs        usemecs = option_sense;
-       never-interactive       {
+       meta-ecs        usemecs = option_sense; markup_option("MetaECS", option_sense);
+       never-interactive       { markup_option("NeverInteractive", option_sense);
                        ACTION_M4_IFDEF( "M4""_YY_NEVER_INTERACTIVE", option_sense );
             interactive = !option_sense;
                        }
-       perf-report     performance_report += option_sense ? 1 : -1;
-       pointer         yytext_is_array = ! option_sense;
-       read            use_read = option_sense;
-    reentrant   reentrant = option_sense;
-       reject          reject_really_used = option_sense;
-       stack           ACTION_M4_IFDEF( "M4""_YY_STACK_USED", option_sense );
-       stdinit         do_stdinit = option_sense;
-       stdout          use_stdout = option_sense;
-    unistd      ACTION_IFDEF("YY_NO_UNISTD_H", ! option_sense);
-       unput           ACTION_M4_IFDEF("M4""_YY_NO_UNPUT", ! option_sense);
-       verbose         printstats = option_sense;
-       warn            nowarn = ! option_sense;
-       yylineno        do_yylineno = option_sense; ACTION_M4_IFDEF("M4""_YY_USE_LINENO", option_sense);
-       yymore          yymore_really_used = option_sense;
-       yywrap      do_yywrap = option_sense;
-
-       yy_push_state   ACTION_M4_IFDEF("M4""_YY_NO_PUSH_STATE", ! option_sense);
-       yy_pop_state    ACTION_M4_IFDEF("M4""_YY_NO_POP_STATE", ! option_sense);
-       yy_top_state    ACTION_M4_IFDEF("M4""_YY_NO_TOP_STATE", ! option_sense);
-
-       yy_scan_buffer  ACTION_M4_IFDEF("M4""_YY_NO_SCAN_BUFFER", ! option_sense);
-       yy_scan_bytes   ACTION_M4_IFDEF("M4""_YY_NO_SCAN_BYTES", ! option_sense);
-       yy_scan_string  ACTION_M4_IFDEF("M4""_YY_NO_SCAN_STRING", ! option_sense);
-
-    yyalloc         ACTION_M4_IFDEF("M4""_YY_NO_FLEX_ALLOC", ! option_sense);
-    yyrealloc       ACTION_M4_IFDEF("M4""_YY_NO_FLEX_REALLOC", ! option_sense);
-    yyfree          ACTION_M4_IFDEF("M4""_YY_NO_FLEX_FREE", ! option_sense);
-
-    yyget_debug     ACTION_M4_IFDEF("M4""_YY_NO_GET_DEBUG", ! option_sense);
-    yyset_debug     ACTION_M4_IFDEF("M4""_YY_NO_SET_DEBUG", ! option_sense);
-    yyget_extra     ACTION_M4_IFDEF("M4""_YY_NO_GET_EXTRA", ! option_sense);
-    yyset_extra     ACTION_M4_IFDEF("M4""_YY_NO_SET_EXTRA", ! option_sense);
-    yyget_leng      ACTION_M4_IFDEF("M4""_YY_NO_GET_LENG", ! option_sense);
-    yyget_text      ACTION_M4_IFDEF("M4""_YY_NO_GET_TEXT", ! option_sense);
-    yyget_lineno    ACTION_M4_IFDEF("M4""_YY_NO_GET_LINENO", ! option_sense);
-    yyset_lineno    ACTION_M4_IFDEF("M4""_YY_NO_SET_LINENO", ! option_sense);
-    yyget_in        ACTION_M4_IFDEF("M4""_YY_NO_GET_IN", ! option_sense);
-    yyset_in        ACTION_M4_IFDEF("M4""_YY_NO_SET_IN", ! option_sense);
-    yyget_out       ACTION_M4_IFDEF("M4""_YY_NO_GET_OUT", ! option_sense);
-    yyset_out       ACTION_M4_IFDEF("M4""_YY_NO_SET_OUT", ! option_sense);
-    yyget_lval      ACTION_M4_IFDEF("M4""_YY_NO_GET_LVAL", ! option_sense);
-    yyset_lval      ACTION_M4_IFDEF("M4""_YY_NO_SET_LVAL", ! option_sense);
-    yyget_lloc      ACTION_M4_IFDEF("M4""_YY_NO_GET_LLOC", ! option_sense);
-    yyset_lloc      ACTION_M4_IFDEF("M4""_YY_NO_SET_LLOC", ! option_sense);
+       perf-report     performance_report += option_sense ? 1 : -1; markup_option("PerfReport", option_sense);
+       pointer         yytext_is_array = ! option_sense; markup_option("Pointer", option_sense);
+       read            use_read = option_sense; markup_option("Read", option_sense);
+    reentrant   reentrant = option_sense; markup_option("Reentrant", option_sense);
+       reject          reject_really_used = option_sense; markup_option("Reject", option_sense);
+       stack           ACTION_M4_IFDEF( "M4""_YY_STACK_USED", option_sense ); markup_option("Stack", option_sense);
+       stdinit         do_stdinit = option_sense; markup_option("StdInit", option_sense);
+       stdout          use_stdout = option_sense; markup_option("StdOut", option_sense);
+    unistd      ACTION_IFDEF("YY_NO_UNISTD_H", ! option_sense); markup_option("Unistd", option_sense);
+       unput           ACTION_M4_IFDEF("M4""_YY_NO_UNPUT", ! option_sense); markup_option("Unput", option_sense);
+       verbose         printstats = option_sense; markup_option("Verbose", option_sense);
+       warn            nowarn = ! option_sense; markup_option("Warn", option_sense);
+       yylineno        do_yylineno = option_sense; ACTION_M4_IFDEF("M4""_YY_USE_LINENO", option_sense); markup_option("YYLineNo", option_sense);
+       yymore          yymore_really_used = option_sense; markup_option("YYMore", option_sense);
+       yywrap      do_yywrap = option_sense; markup_option("YYWrap", option_sense);
+
+       yy_push_state   ACTION_M4_IFDEF("M4""_YY_NO_PUSH_STATE", ! option_sense); markup_option("YYPushState", option_sense);
+       yy_pop_state    ACTION_M4_IFDEF("M4""_YY_NO_POP_STATE", ! option_sense); markup_option("YYPopState", option_sense);
+       yy_top_state    ACTION_M4_IFDEF("M4""_YY_NO_TOP_STATE", ! option_sense); markup_option("YYTopState", option_sense);
+
+       yy_scan_buffer  ACTION_M4_IFDEF("M4""_YY_NO_SCAN_BUFFER", ! option_sense); markup_option("YYScanBuffer", option_sense);
+       yy_scan_bytes   ACTION_M4_IFDEF("M4""_YY_NO_SCAN_BYTES", ! option_sense); markup_option("YYScanBytes", option_sense);
+       yy_scan_string  ACTION_M4_IFDEF("M4""_YY_NO_SCAN_STRING", ! option_sense); markup_option("YYScanString", option_sense);
+
+    yyalloc         ACTION_M4_IFDEF("M4""_YY_NO_FLEX_ALLOC", ! option_sense); markup_option("YYAlloc", option_sense);
+    yyrealloc       ACTION_M4_IFDEF("M4""_YY_NO_FLEX_REALLOC", ! option_sense); markup_option("YYRealloc", option_sense);
+    yyfree          ACTION_M4_IFDEF("M4""_YY_NO_FLEX_FREE", ! option_sense); markup_option("YYFree", option_sense);
+
+    yyget_debug     ACTION_M4_IFDEF("M4""_YY_NO_GET_DEBUG", ! option_sense); markup_option("YYGetDebug", option_sense);
+    yyset_debug     ACTION_M4_IFDEF("M4""_YY_NO_SET_DEBUG", ! option_sense); markup_option("YYSetDebug", option_sense);
+    yyget_extra     ACTION_M4_IFDEF("M4""_YY_NO_GET_EXTRA", ! option_sense); markup_option("YYGetExtra", option_sense);
+    yyset_extra     ACTION_M4_IFDEF("M4""_YY_NO_SET_EXTRA", ! option_sense); markup_option("YYSetExtra", option_sense);
+    yyget_leng      ACTION_M4_IFDEF("M4""_YY_NO_GET_LENG", ! option_sense); markup_option("YYGetLeng", option_sense);
+    yyget_text      ACTION_M4_IFDEF("M4""_YY_NO_GET_TEXT", ! option_sense); markup_option("YYGetText", option_sense);
+    yyget_lineno    ACTION_M4_IFDEF("M4""_YY_NO_GET_LINENO", ! option_sense); markup_option("YYGetLineNo", option_sense);
+    yyset_lineno    ACTION_M4_IFDEF("M4""_YY_NO_SET_LINENO", ! option_sense); markup_option("YYSetLineNo", option_sense);
+    yyget_in        ACTION_M4_IFDEF("M4""_YY_NO_GET_IN", ! option_sense); markup_option("YYGetIn", option_sense);
+    yyset_in        ACTION_M4_IFDEF("M4""_YY_NO_SET_IN", ! option_sense); markup_option("YYSetIn", option_sense);
+    yyget_out       ACTION_M4_IFDEF("M4""_YY_NO_GET_OUT", ! option_sense); markup_option("YYGetOut", option_sense);
+    yyset_out       ACTION_M4_IFDEF("M4""_YY_NO_SET_OUT", ! option_sense); markup_option("YYSetOut", option_sense);
+    yyget_lval      ACTION_M4_IFDEF("M4""_YY_NO_GET_LVAL", ! option_sense); markup_option("YYGetLVal", option_sense);
+    yyset_lval      ACTION_M4_IFDEF("M4""_YY_NO_SET_LVAL", ! option_sense); markup_option("YYSetLVal", option_sense);
+    yyget_lloc      ACTION_M4_IFDEF("M4""_YY_NO_GET_LLOC", ! option_sense); markup_option("YYGetLLoc", option_sense);
+    yyset_lloc      ACTION_M4_IFDEF("M4""_YY_NO_SET_LLOC", ! option_sense); markup_option("YYSetLLoc", option_sense);
 
        extra-type      return TOK_EXTRA_TYPE;
        outfile         return TOK_OUTFILE;
@@ -472,7 +476,7 @@ M4QEND      "]""]"
        yyclass         return TOK_YYCLASS;
        header(-file)?      return TOK_HEADER_FILE;
        tables-file         return TOK_TABLES_FILE;
-       tables-verify   {
+       tables-verify   { markup_option("TablesVerify", option_sense);
                     tablesverify = option_sense;
                     if(!tablesext && option_sense)
                         tablesext = true;
@@ -530,9 +534,9 @@ M4QEND      "]""]"
                        sectnum = 0;
 #if 1
  piece_pack();
- piece[piece1++] = strdup("</Sect2>");
+ piece_append("</Sect2>");
 #if 0
- piece[piece1++] = strdup("<token value=\"0\" />");
+ piece_append("<token value=\"0\" />");
 #endif
  piece_pack();
  return ~YY_NULL;
@@ -551,7 +555,7 @@ M4QEND      "]""]"
                        bracelevel = 1;
                        BEGIN(PERCENT_BRACE_ACTION);
  flush();
- piece[piece1++] = strdup("<PercentBraceAction>");
+ piece_append("<PercentBraceAction>");
                        }
 
        ^{OPTWS}"<"         {
@@ -584,19 +588,19 @@ M4QEND      "]""]"
 #if 1
  piece_esc(yytext, strlen(yytext));
 #else
- piece[piece1++] = strdup("<token value=\"10\">");
+ piece_append("<token value=\"10\">");
  piece_esc(yytext, strlen(yytext));
- piece[piece1++] = strdup("</token>");
+ piece_append("</token>");
 #endif
  piece_pack();
- piece[piece1++] = strdup("<PercentBraceAction>");
+ piece_append("<PercentBraceAction>");
  return ~'\n';
 #else
                                return '\n';
 #endif
                                }
  flush();
- piece[piece1++] = strdup("<PercentBraceAction>");
+ piece_append("<PercentBraceAction>");
                        }
        {WS}"|".*{NL}   {
                         if (sf_skip_ws()){
@@ -624,8 +628,6 @@ M4QEND      "]""]"
                     bracelevel = 0;
                     continued_action = false;
                     BEGIN(ACTION);
- flush();
- piece[piece1++] = strdup("<Action>");
                 }
                        }
 
@@ -653,12 +655,12 @@ M4QEND      "]""]"
 #if 1
  piece_esc(yytext, strlen(yytext));
 #else
- piece[piece1++] = strdup("<token value=\"10\">");
+ piece_append("<token value=\"10\">");
  piece_esc(yytext, strlen(yytext));
- piece[piece1++] = strdup("</token>");
+ piece_append("</token>");
 #endif
  piece_pack();
- piece[piece1++] = strdup("<Action>");
+ piece_append("<Action>");
  return ~'\n';
 #else
                     return '\n';
@@ -691,12 +693,12 @@ M4QEND      "]""]"
 #if 1
  piece_esc(yytext, strlen(yytext));
 #else
- piece[piece1++] = strdup("<token value=\"10\">");
+ piece_append("<token value=\"10\">");
  piece_esc(yytext, strlen(yytext));
- piece[piece1++] = strdup("</token>");
+ piece_append("</token>");
 #endif
  piece_pack();
- piece[piece1++] = strdup("<Action>");
+ piece_append("<Action>");
  return ~'\n';
 #else
                     return '\n';
@@ -714,16 +716,16 @@ M4QEND      "]""]"
                        outn("/* Begin user sect3 */");
 #if 1
  piece_pack();
- piece[piece1++] = strdup("</Sect2>");
+ piece_append("</Sect2>");
 #if 1
  piece_esc(yytext, strlen(yytext));
 #else
- piece[piece1++] = strdup("<token value=\"0\">");
+ piece_append("<token value=\"0\">");
  piece_esc(yytext, strlen(yytext));
- piece[piece1++] = strdup("</token>");
+ piece_append("</token>");
 #endif
  piece_pack();
- piece[piece1++] = strdup("<Sect3>");
+ piece_append("<Sect3>");
  return ~YY_NULL;
 #else
                        yyterminate(); /* to stop the parser */
@@ -883,9 +885,9 @@ nmstr[yyleng - 2 - end_is_ws] = '\0';  /* chop trailing brace */
                        sectnum = 0;
 #if 1
  piece_pack();
- piece[piece1++] = strdup("</Sect2>");
+ piece_append("</Sect2>");
 #if 0
- piece[piece1++] = strdup("<token value=\"0\" />");
+ piece_append("<token value=\"0\" />");
 #endif
  piece_pack();
  return ~YY_NULL;
@@ -1044,7 +1046,7 @@ nmstr[yyleng - 2 - end_is_ws] = '\0';  /* chop trailing brace */
 
             doing_rule_action = doing_codeblock = false;
             BEGIN(SECT2);
- piece[piece1++] = strdup("</PercentBraceAction>");
+ piece_append("</PercentBraceAction>");
         }
     }
 }
@@ -1067,7 +1069,7 @@ nmstr[yyleng - 2 - end_is_ws] = '\0';  /* chop trailing brace */
  {
                       add_action( "\tYY_BREAK]""]\n" );
   flush();
-  piece[piece1++] = strdup("</Action>");
+  markup_action();
  }
 
                    doing_rule_action = false;
@@ -1088,7 +1090,7 @@ nmstr[yyleng - 2 - end_is_ws] = '\0';  /* chop trailing brace */
 <ACTION_STRING,CHARACTER_CONSTANT>{
         (\\\n)*         ACTION_ECHO;
        \\(\\\n)*.      ACTION_ECHO;
-       {NL}    ++linenum; ACTION_ECHO; if (bracelevel <= 0) { BEGIN(SECT2); flush(); if (doing_rule_action) piece[piece1++] = strdup("</Action>"); } else { BEGIN(ACTION); }
+       {NL}    ++linenum; ACTION_ECHO; if (bracelevel <= 0) { BEGIN(SECT2); flush(); if (doing_rule_action) markup_action(); } else { BEGIN(ACTION); }
         .      ACTION_ECHO;
 }
 
@@ -1120,9 +1122,9 @@ nmstr[yyleng - 2 - end_is_ws] = '\0';  /* chop trailing brace */
         sectnum = 0;
 #if 1
  piece_pack();
- piece[piece1++] = strdup("</Sect3>");
+ piece_append("</Sect3>");
 #if 0
- piece[piece1++] = strdup("<token value=\"0\" />");
+ piece_append("<token value=\"0\" />");
 #endif
  piece_pack();
  return ~YY_NULL;
@@ -1140,9 +1142,9 @@ nmstr[yyleng - 2 - end_is_ws] = '\0';  /* chop trailing brace */
        sectnum = 0;
 #if 1
  piece_pack();
- piece[piece1++] = strdup("</Sect3>");
+ piece_append("</Sect3>");
 #if 0
- piece[piece1++] = strdup("<token value=\"0\" />");
+ piece_append("<token value=\"0\" />");
 #endif
  piece_pack();
  return ~YY_NULL;
@@ -1190,3 +1192,28 @@ void set_input_file( char *file )
 
        linenum = 1;
        }
+
+/* Nick */
+static void markup_action(void) {
+ piece_append("</Action></Rule>");
+ /* append to last token text so it appears inside <Rule>..</Rule> */
+ int i = strlen(piece[--piece0]);
+ if (i < 7 || strcmp(piece[piece0] + i - 7, "</Rule>") != 0)
+  abort();
+ piece[piece0][i - 7] = 0;
+ piece_pack();
+}
+
+static void markup_option(const char *name, int sense) {
+ int i = piece1;
+ while (--i >= piece0 && strcmp(piece[i], "no") == 0)
+  ;
+ sprintf(piece_temp, "<Options_%s value=\"%s\">", name, sense ? "true" : "false");
+ piece_insert(i + 1, piece_temp);
+ flush();
+ sprintf(piece_temp, "</Options_%s>", name);
+ piece_append(piece_temp);
+ /* append to last token text so it appears inside <Options>..</Options> */
+ --piece0;
+ piece_pack();
+}
index fb8c28e..e86270b 100644 (file)
@@ -1,6 +1,6 @@
---- stage1scan.c.orig  2018-06-23 10:54:03.460586269 +1000
-+++ stage1scan.c       2018-06-23 10:56:11.792580838 +1000
-@@ -24,6 +24,17 @@
+--- stage1scan.c.orig  2018-06-23 13:12:37.256416744 +1000
++++ stage1scan.c       2018-06-23 13:16:25.000407106 +1000
+@@ -24,6 +24,19 @@
  
  /* end standard C headers. */
  
@@ -8,17 +8,19 @@
 +char *piece[10000];
 +int piece0;
 +int piece1;
-+void insert_piece(int n, const char *str) {
++void piece_append(const char *str) {
++ piece[piece1++] = strdup(str);
++}
++void piece_insert(int n, const char *str) {
 + memmove(piece + n + 1, piece + n, (piece1 - n) * sizeof(char *));
 + piece[n] = strdup(str);
-+ ++piece0;
 + ++piece1;
 +}
 +
  /* flex integer type definitions */
  
  #ifndef FLEXINT_H
-@@ -179,7 +190,21 @@
+@@ -179,7 +192,21 @@
                YY_DO_BEFORE_ACTION; /* set up yytext again */ \
                } \
        while ( 0 )
@@ -40,7 +42,7 @@
  
  #ifndef YY_STRUCT_YY_BUFFER_STATE
  #define YY_STRUCT_YY_BUFFER_STATE
-@@ -2192,8 +2217,88 @@
+@@ -2195,8 +2222,88 @@
  
  /** The main scanner function which does all the work.
   */
 + size_t n = strlen(yytext);
 + if (n) {
 +  sprintf(piece_temp, "<token value=\"%d\">", result);
-+  piece[piece1++] = strdup(piece_temp);
++  piece_append(piece_temp);
 +  piece_esc(yytext, n);
-+  piece[piece1++] = strdup("</token>");
++  piece_append("</token>");
 + }
 + else {
 +  sprintf(piece_temp, "<token value=\"%d\" />", result);
-+  piece[piece1++] = strdup(piece_temp);
++  piece_append(piece_temp);
 + }
 +#endif
 + piece_pack();
        yy_state_type yy_current_state;
        char *yy_cp, *yy_bp;
        int yy_act;
-@@ -2239,7 +2344,12 @@
+@@ -2242,7 +2349,12 @@
  
- #line 2240 "stage1scan.c"
+ #line 2243 "stage1scan.c"
  
 +#if 1
 + /* we do this so that "continue;" in an action works correctly */