Change the generated output, to make it readable by element.deserialize(), etc
authorNick Downing <downing.nick@gmail.com>
Sun, 24 Jun 2018 09:14:02 +0000 (19:14 +1000)
committerNick Downing <downing.nick@gmail.com>
Sun, 24 Jun 2018 09:16:27 +0000 (19:16 +1000)
src/main.c
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 d31392a..b060a03 100644 (file)
@@ -168,9 +168,8 @@ int flex_main (int argc, char *argv[])
        flexinit (argc, argv);
 
 #if 1
- extern char *piece[];
- extern int piece1;
- piece[piece1++] = strdup("<root><Sect1>");
+ void piece_append(const char *str);
+ piece_append("<RefList><PLexSpecification ref=\"0\"><Section1>");
 #endif
        readin ();
 
@@ -191,8 +190,11 @@ int flex_main (int argc, char *argv[])
        /* Generate the C state transition tables from the DFA. */
        make_tables ();
 #if 1
- /* at this point flexscan() has been called to copy sect 3 to the output */
- piece[piece1++] = strdup("</root>");
+ /* at this point flexscan() has been called to copy section 3 to the output */
+ piece_append("</PLexSpecification></RefList>");
+
+ extern char *piece[];
+ extern int piece1;
  for (i = 0; i < piece1; ++i)
   fputs(piece[i], stderr);
 #endif
index eff98e4..ecba7fe 100644 (file)
@@ -598,10 +598,10 @@ static const yytype_uint16 yyrline[] =
      358,   363,   366,   372,   392,   405,   407,   409,   413,   439,
      497,   500,   549,   569,   577,   582,   611,   621,   624,   655,
      672,   697,   706,   714,   722,   753,   770,   792,   834,   852,
-     862,   865,   871,   886,   892,   896,   901,   903,   912,   977,
-    1000,  1010,  1019,  1023,  1027,  1031,  1035,  1039,  1043,  1057,
-    1061,  1065,  1069,  1073,  1088,  1092,  1096,  1100,  1104,  1108,
-    1112,  1116,  1120,  1124,  1128,  1136,  1146,  1164
+     862,   865,   873,   891,   897,   901,   906,   908,   917,   982,
+    1005,  1015,  1024,  1028,  1032,  1036,  1040,  1044,  1048,  1062,
+    1066,  1070,  1074,  1078,  1093,  1097,  1101,  1105,  1109,  1113,
+    1117,  1121,  1125,  1129,  1133,  1141,  1151,  1169
 };
 #endif
 
@@ -1954,7 +1954,7 @@ yyreduce:
                                trailcnt = rulelen;
 
                        (yyval) = link_machines( (yyvsp[-1]), (yyvsp[0]) );
- insert_after(2, "</RegexSequence>");
+ insert_after(1, "</RegexSequence>");
  insert_before(0, "<RegexSequence>");
                        }
 #line 1931 "parse.c" /* yacc.c:1646  */
@@ -2154,7 +2154,7 @@ yyreduce:
                        else
                                (yyval) = mkrep( (yyvsp[-4]), (yyvsp[-2]), INFINITE_REPEAT );
  insert_after(4, "</RegexRepeat>");
- sprintf(piece_temp, "<RegexRepeat count0=\"%d\" count1=\"-1\">", (yyvsp[-2]));
+ sprintf(piece_temp, "<RegexRepeat count0=\"%d\">", (yyvsp[-2]));
  insert_before(0, piece_temp);
                        }
 #line 2131 "parse.c" /* yacc.c:1646  */
@@ -2193,7 +2193,7 @@ yyreduce:
 
                        (yyval) = mkclos( (yyvsp[-1]) );
  insert_after(1, "</RegexRepeat>");
- insert_before(0, "<RegexRepeat count0=\"0\" count1=\"-1\">");
+ insert_before(0, "<RegexRepeat count0=\"0\">");
                        }
 #line 2169 "parse.c" /* yacc.c:1646  */
     break;
@@ -2204,7 +2204,7 @@ yyreduce:
                        varlength = true;
                        (yyval) = mkposcl( (yyvsp[-1]) );
  insert_after(1, "</RegexRepeat>");
- insert_before(0, "<RegexRepeat count0=\"1\" count1=\"-1\">");
+ insert_before(0, "<RegexRepeat count0=\"1\">");
                        }
 #line 2180 "parse.c" /* yacc.c:1646  */
     break;
@@ -2268,7 +2268,7 @@ yyreduce:
                        else
                                (yyval) = mkrep( (yyvsp[-4]), (yyvsp[-2]), INFINITE_REPEAT );
  insert_after(4, "</RegexRepeat>");
- sprintf(piece_temp, "<RegexRepeat count0=\"%d\" count1=\"-1\">", (yyvsp[-2]));
+ sprintf(piece_temp, "<RegexRepeat count0=\"%d\">", (yyvsp[-2]));
  insert_before(0, piece_temp);
                        }
 #line 2245 "parse.c" /* yacc.c:1646  */
@@ -2387,14 +2387,16 @@ yyreduce:
   case 61:
 #line 866 "parse.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[-1]); /*}*/
+#if 0 /* for now do things in the traditional lex way without subexpressions */
  insert_after(2, "</RegexGroup>");
  insert_before(0, "<RegexGroup>");
+#endif
  }
-#line 2364 "parse.c" /* yacc.c:1646  */
+#line 2366 "parse.c" /* yacc.c:1646  */
     break;
 
   case 62:
-#line 872 "parse.y" /* yacc.c:1646  */
+#line 874 "parse.y" /* yacc.c:1646  */
     {
                        ++rulelen;
 
@@ -2406,49 +2408,52 @@ yyreduce:
                 (yyval) = mkor (mkstate((yyvsp[0])), mkstate(reverse_case((yyvsp[0]))));
             else
                 (yyval) = mkstate( (yyvsp[0]) );
+ insert_after(0, "</RegexCharacter>");
+ sprintf(piece_temp, "<RegexCharacter char_set=\"%d %d\">", (yyvsp[0]), (yyvsp[0]) + 1);
+ insert_before(0, piece_temp);
                        }
-#line 2381 "parse.c" /* yacc.c:1646  */
+#line 2386 "parse.c" /* yacc.c:1646  */
     break;
 
   case 63:
-#line 886 "parse.y" /* yacc.c:1646  */
+#line 891 "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 2392 "parse.c" /* yacc.c:1646  */
+#line 2397 "parse.c" /* yacc.c:1646  */
     break;
 
   case 64:
-#line 892 "parse.y" /* yacc.c:1646  */
+#line 897 "parse.y" /* yacc.c:1646  */
     { (yyval) = ccl_set_union ((yyvsp[-2]), (yyvsp[0])); /*}*/
  insert_after(2, "</RegexCharacterOr>");
  insert_before(0, "<RegexCharacterOr>");
  }
-#line 2401 "parse.c" /* yacc.c:1646  */
+#line 2406 "parse.c" /* yacc.c:1646  */
     break;
 
   case 66:
-#line 901 "parse.y" /* yacc.c:1646  */
+#line 906 "parse.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[-1]); }
-#line 2407 "parse.c" /* yacc.c:1646  */
+#line 2412 "parse.c" /* yacc.c:1646  */
     break;
 
   case 67:
-#line 904 "parse.y" /* yacc.c:1646  */
+#line 909 "parse.y" /* yacc.c:1646  */
     {
                        cclnegate( (yyvsp[-1]) );
                        (yyval) = (yyvsp[-1]);
  insert_after(2, "</RegexCharacterNot>");
  insert_before(1, "<RegexCharacterNot>");
                        }
-#line 2418 "parse.c" /* yacc.c:1646  */
+#line 2423 "parse.c" /* yacc.c:1646  */
     break;
 
   case 68:
-#line 913 "parse.y" /* yacc.c:1646  */
+#line 918 "parse.y" /* yacc.c:1646  */
     {
 
                        if (sf_case_ins())
@@ -2512,11 +2517,11 @@ yyreduce:
  insert_before(1, piece_temp);
  insert_before(0, "<RegexCharacterOr>");
                        }
-#line 2486 "parse.c" /* yacc.c:1646  */
+#line 2491 "parse.c" /* yacc.c:1646  */
     break;
 
   case 69:
-#line 978 "parse.y" /* yacc.c:1646  */
+#line 983 "parse.y" /* yacc.c:1646  */
     {
                        ccladd( (yyvsp[-1]), (yyvsp[0]) );
                        cclsorted = cclsorted && ((yyvsp[0]) > lastchar);
@@ -2538,11 +2543,11 @@ yyreduce:
  insert_before(1, piece_temp);
  insert_before(0, "<RegexCharacterOr>");
                        }
-#line 2512 "parse.c" /* yacc.c:1646  */
+#line 2517 "parse.c" /* yacc.c:1646  */
     break;
 
   case 70:
-#line 1001 "parse.y" /* yacc.c:1646  */
+#line 1006 "parse.y" /* yacc.c:1646  */
     {
                        /* Too hard to properly maintain cclsorted. */
                        cclsorted = false;
@@ -2550,76 +2555,76 @@ yyreduce:
  insert_after(1, "</RegexCharacterOr>");
  insert_before(0, "<RegexCharacterOr>");
                        }
-#line 2524 "parse.c" /* yacc.c:1646  */
+#line 2529 "parse.c" /* yacc.c:1646  */
     break;
 
   case 71:
-#line 1010 "parse.y" /* yacc.c:1646  */
+#line 1015 "parse.y" /* yacc.c:1646  */
     {
                        cclsorted = true;
                        lastchar = 0;
                        currccl = (yyval) = cclinit();
  insert_before(0, "<RegexCharacter char_set=\"\" />");
                        }
-#line 2535 "parse.c" /* yacc.c:1646  */
+#line 2540 "parse.c" /* yacc.c:1646  */
     break;
 
   case 72:
-#line 1019 "parse.y" /* yacc.c:1646  */
+#line 1024 "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 2544 "parse.c" /* yacc.c:1646  */
+#line 2549 "parse.c" /* yacc.c:1646  */
     break;
 
   case 73:
-#line 1023 "parse.y" /* yacc.c:1646  */
+#line 1028 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(isalpha); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"65 91 97 123\">");
  }
-#line 2553 "parse.c" /* yacc.c:1646  */
+#line 2558 "parse.c" /* yacc.c:1646  */
     break;
 
   case 74:
-#line 1027 "parse.y" /* yacc.c:1646  */
+#line 1032 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(IS_BLANK); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"9 14 32 33\">");
  }
-#line 2562 "parse.c" /* yacc.c:1646  */
+#line 2567 "parse.c" /* yacc.c:1646  */
     break;
 
   case 75:
-#line 1031 "parse.y" /* yacc.c:1646  */
+#line 1036 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(iscntrl); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 32\">");
  }
-#line 2571 "parse.c" /* yacc.c:1646  */
+#line 2576 "parse.c" /* yacc.c:1646  */
     break;
 
   case 76:
-#line 1035 "parse.y" /* yacc.c:1646  */
+#line 1040 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(isdigit); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"48 58\">");
  }
-#line 2580 "parse.c" /* yacc.c:1646  */
+#line 2585 "parse.c" /* yacc.c:1646  */
     break;
 
   case 77:
-#line 1039 "parse.y" /* yacc.c:1646  */
+#line 1044 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(isgraph); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"33 127\">");
  }
-#line 2589 "parse.c" /* yacc.c:1646  */
+#line 2594 "parse.c" /* yacc.c:1646  */
     break;
 
   case 78:
-#line 1043 "parse.y" /* yacc.c:1646  */
+#line 1048 "parse.y" /* yacc.c:1646  */
     { 
                           CCL_EXPR(islower);
                           if (sf_case_ins())
@@ -2634,47 +2639,47 @@ yyreduce:
  insert_before(0, "<RegexCharacter char_set=\"97 123\">");
  }
                         }
-#line 2608 "parse.c" /* yacc.c:1646  */
+#line 2613 "parse.c" /* yacc.c:1646  */
     break;
 
   case 79:
-#line 1057 "parse.y" /* yacc.c:1646  */
+#line 1062 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(isprint); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"32 127\">");
  }
-#line 2617 "parse.c" /* yacc.c:1646  */
+#line 2622 "parse.c" /* yacc.c:1646  */
     break;
 
   case 80:
-#line 1061 "parse.y" /* yacc.c:1646  */
+#line 1066 "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 2626 "parse.c" /* yacc.c:1646  */
+#line 2631 "parse.c" /* yacc.c:1646  */
     break;
 
   case 81:
-#line 1065 "parse.y" /* yacc.c:1646  */
+#line 1070 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(isspace); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"32 33\">");
  }
-#line 2635 "parse.c" /* yacc.c:1646  */
+#line 2640 "parse.c" /* yacc.c:1646  */
     break;
 
   case 82:
-#line 1069 "parse.y" /* yacc.c:1646  */
+#line 1074 "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 2644 "parse.c" /* yacc.c:1646  */
+#line 2649 "parse.c" /* yacc.c:1646  */
     break;
 
   case 83:
-#line 1073 "parse.y" /* yacc.c:1646  */
+#line 1078 "parse.y" /* yacc.c:1646  */
     {
                     CCL_EXPR(isupper);
                     if (sf_case_ins())
@@ -2689,101 +2694,101 @@ yyreduce:
  insert_before(0, "<RegexCharacter char_set=\"65 91\">");
  }
                                }
-#line 2663 "parse.c" /* yacc.c:1646  */
+#line 2668 "parse.c" /* yacc.c:1646  */
     break;
 
   case 84:
-#line 1088 "parse.y" /* yacc.c:1646  */
+#line 1093 "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 2672 "parse.c" /* yacc.c:1646  */
+#line 2677 "parse.c" /* yacc.c:1646  */
     break;
 
   case 85:
-#line 1092 "parse.y" /* yacc.c:1646  */
+#line 1097 "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 2681 "parse.c" /* yacc.c:1646  */
+#line 2686 "parse.c" /* yacc.c:1646  */
     break;
 
   case 86:
-#line 1096 "parse.y" /* yacc.c:1646  */
+#line 1101 "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 2690 "parse.c" /* yacc.c:1646  */
+#line 2695 "parse.c" /* yacc.c:1646  */
     break;
 
   case 87:
-#line 1100 "parse.y" /* yacc.c:1646  */
+#line 1105 "parse.y" /* yacc.c:1646  */
     { CCL_NEG_EXPR(iscntrl); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"32 256\">");
  }
-#line 2699 "parse.c" /* yacc.c:1646  */
+#line 2704 "parse.c" /* yacc.c:1646  */
     break;
 
   case 88:
-#line 1104 "parse.y" /* yacc.c:1646  */
+#line 1109 "parse.y" /* yacc.c:1646  */
     { CCL_NEG_EXPR(isdigit); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 48 58 256\">");
  }
-#line 2708 "parse.c" /* yacc.c:1646  */
+#line 2713 "parse.c" /* yacc.c:1646  */
     break;
 
   case 89:
-#line 1108 "parse.y" /* yacc.c:1646  */
+#line 1113 "parse.y" /* yacc.c:1646  */
     { CCL_NEG_EXPR(isgraph); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 33 127 256\">");
  }
-#line 2717 "parse.c" /* yacc.c:1646  */
+#line 2722 "parse.c" /* yacc.c:1646  */
     break;
 
   case 90:
-#line 1112 "parse.y" /* yacc.c:1646  */
+#line 1117 "parse.y" /* yacc.c:1646  */
     { CCL_NEG_EXPR(isprint); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 32 127 256\">");
  }
-#line 2726 "parse.c" /* yacc.c:1646  */
+#line 2731 "parse.c" /* yacc.c:1646  */
     break;
 
   case 91:
-#line 1116 "parse.y" /* yacc.c:1646  */
+#line 1121 "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 2735 "parse.c" /* yacc.c:1646  */
+#line 2740 "parse.c" /* yacc.c:1646  */
     break;
 
   case 92:
-#line 1120 "parse.y" /* yacc.c:1646  */
+#line 1125 "parse.y" /* yacc.c:1646  */
     { CCL_NEG_EXPR(isspace); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 32 33 256\">");
  }
-#line 2744 "parse.c" /* yacc.c:1646  */
+#line 2749 "parse.c" /* yacc.c:1646  */
     break;
 
   case 93:
-#line 1124 "parse.y" /* yacc.c:1646  */
+#line 1129 "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 2753 "parse.c" /* yacc.c:1646  */
+#line 2758 "parse.c" /* yacc.c:1646  */
     break;
 
   case 94:
-#line 1128 "parse.y" /* yacc.c:1646  */
+#line 1133 "parse.y" /* yacc.c:1646  */
     { 
                                if ( sf_case_ins() )
                                        lwarn(_("[:^lower:] is ambiguous in case insensitive scanner"));
@@ -2792,11 +2797,11 @@ yyreduce:
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 97 123 256\">");
                                }
-#line 2766 "parse.c" /* yacc.c:1646  */
+#line 2771 "parse.c" /* yacc.c:1646  */
     break;
 
   case 95:
-#line 1136 "parse.y" /* yacc.c:1646  */
+#line 1141 "parse.y" /* yacc.c:1646  */
     {
                                if ( sf_case_ins() )
                                        lwarn(_("[:^upper:] ambiguous in case insensitive scanner"));
@@ -2805,11 +2810,11 @@ yyreduce:
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 65 91 256\">");
                                }
-#line 2779 "parse.c" /* yacc.c:1646  */
+#line 2784 "parse.c" /* yacc.c:1646  */
     break;
 
   case 96:
-#line 1147 "parse.y" /* yacc.c:1646  */
+#line 1152 "parse.y" /* yacc.c:1646  */
     {
                        if ( (yyvsp[0]) == nlch )
                                rule_has_nl[num_rules] = true;
@@ -2825,19 +2830,19 @@ yyreduce:
  insert_after(1, "</RegexSequence>");
  insert_before(0, "<RegexSequence>");
                        }
-#line 2799 "parse.c" /* yacc.c:1646  */
+#line 2804 "parse.c" /* yacc.c:1646  */
     break;
 
   case 97:
-#line 1164 "parse.y" /* yacc.c:1646  */
+#line 1169 "parse.y" /* yacc.c:1646  */
     { (yyval) = mkstate( SYM_EPSILON ); /*}*/
  insert_before(0, "<RegexEmpty />");
  }
-#line 2807 "parse.c" /* yacc.c:1646  */
+#line 2812 "parse.c" /* yacc.c:1646  */
     break;
 
 
-#line 2811 "parse.c" /* yacc.c:1646  */
+#line 2816 "parse.c" /* yacc.c:1646  */
       default: break;
     }
  int i;
@@ -3082,7 +3087,7 @@ yyreturn:
 #endif
   return yyresult;
 }
-#line 1170 "parse.y" /* yacc.c:1906  */
+#line 1175 "parse.y" /* yacc.c:1906  */
 
 
 
index 8789873..26072fa 100644 (file)
@@ -1,5 +1,5 @@
---- parse.c.orig       2018-06-23 12:59:36.016449806 +1000
-+++ parse.c    2018-06-23 13:03:32.212439810 +1000
+--- parse.c.orig       2018-06-24 10:38:12.236834056 +1000
++++ parse.c    2018-06-24 10:38:12.360834050 +1000
 @@ -1245,6 +1245,25 @@
  | yyparse.  |
  `----------*/
@@ -44,8 +44,8 @@
  
    /* If YYLEN is nonzero, implement the default value of the action:
       '$$ = $1'.
-@@ -2803,6 +2833,23 @@
- #line 2804 "parse.c" /* yacc.c:1646  */
+@@ -2813,6 +2843,23 @@
+ #line 2814 "parse.c" /* yacc.c:1646  */
        default: break;
      }
 + int i;
index df8e25c..24c13c8 100644 (file)
@@ -490,7 +490,7 @@ rule                :  re2 re
                                trailcnt = rulelen;
 
                        $$ = link_machines( $1, $2 );
- insert_after(2, "</RegexSequence>");
+ insert_after(1, "</RegexSequence>");
  insert_before(0, "<RegexSequence>");
                        }
 
@@ -665,7 +665,7 @@ series              :  series singleton
                        else
                                $$ = mkrep( $1, $3, INFINITE_REPEAT );
  insert_after(4, "</RegexRepeat>");
- sprintf(piece_temp, "<RegexRepeat count0=\"%d\" count1=\"-1\">", $3);
+ sprintf(piece_temp, "<RegexRepeat count0=\"%d\">", $3);
  insert_before(0, piece_temp);
                        }
 
@@ -700,7 +700,7 @@ singleton   :  singleton '*'
 
                        $$ = mkclos( $1 );
  insert_after(1, "</RegexRepeat>");
- insert_before(0, "<RegexRepeat count0=\"0\" count1=\"-1\">");
+ insert_before(0, "<RegexRepeat count0=\"0\">");
                        }
 
                |  singleton '+'
@@ -708,7 +708,7 @@ singleton   :  singleton '*'
                        varlength = true;
                        $$ = mkposcl( $1 );
  insert_after(1, "</RegexRepeat>");
- insert_before(0, "<RegexRepeat count0=\"1\" count1=\"-1\">");
+ insert_before(0, "<RegexRepeat count0=\"1\">");
                        }
 
                |  singleton '?'
@@ -763,7 +763,7 @@ singleton   :  singleton '*'
                        else
                                $$ = mkrep( $1, $3, INFINITE_REPEAT );
  insert_after(4, "</RegexRepeat>");
- sprintf(piece_temp, "<RegexRepeat count0=\"%d\" count1=\"-1\">", $3);
+ sprintf(piece_temp, "<RegexRepeat count0=\"%d\">", $3);
  insert_before(0, piece_temp);
                        }
 
@@ -864,8 +864,10 @@ singleton  :  singleton '*'
 
                |  '(' re ')'
                        { $$ = $2; /*}*/
+#if 0 /* for now do things in the traditional lex way without subexpressions */
  insert_after(2, "</RegexGroup>");
  insert_before(0, "<RegexGroup>");
+#endif
  }
 
                |  CHAR
@@ -880,6 +882,9 @@ singleton   :  singleton '*'
                 $$ = mkor (mkstate($1), mkstate(reverse_case($1)));
             else
                 $$ = mkstate( $1 );
+ insert_after(0, "</RegexCharacter>");
+ sprintf(piece_temp, "<RegexCharacter char_set=\"%d %d\">", $1, $1 + 1);
+ insert_before(0, piece_temp);
                        }
                ;
 fullccl:
index dbaa8d6..51aec37 100644 (file)
@@ -2501,7 +2501,7 @@ YY_RULE_SETUP
                        line_directive_out(NULL, 1);
                        BEGIN(SECT2PROLOG);
 #if 1
- piece_append("</Sect1>");
+ piece_append("</Section1>");
  piece_pack();
 #if 1
  piece_esc(yytext, strlen(yytext));
@@ -2511,7 +2511,7 @@ YY_RULE_SETUP
  piece_esc(yytext, strlen(yytext));
  piece_append("</token>");
 #endif
- piece_append("<Sect2>");
+ piece_append("<Section2>");
  piece_pack();
  return ~SECTEND;
 #else
@@ -3318,7 +3318,7 @@ case YY_STATE_EOF(SECT2PROLOG):
                        sectnum = 0;
 #if 1
  piece_pack();
- piece_append("</Sect2>");
+ piece_append("</Section2>");
 #if 0
  piece_append("<token value=\"0\" />");
 #endif
@@ -3456,19 +3456,17 @@ YY_RULE_SETUP
                     bracelevel = 0;
                     continued_action = false;
                     BEGIN(ACTION);
- /*flush();
- piece_append("<Action>");*/
                 }
                        }
        YY_BREAK
 case 147:
 YY_RULE_SETUP
-#line 636 "scan.l"
+#line 634 "scan.l"
 /* allow indented rules */ ;
        YY_BREAK
 case 148:
 YY_RULE_SETUP
-#line 638 "scan.l"
+#line 636 "scan.l"
 {
             if (sf_skip_ws()){
                 /* We're in the middle of a (?x: ) pattern. */
@@ -3508,7 +3506,7 @@ YY_RULE_SETUP
 case 149:
 /* rule 149 can match eol */
 YY_RULE_SETUP
-#line 674 "scan.l"
+#line 672 "scan.l"
 {
             if (sf_skip_ws()){
                 /* We're in the middle of a (?x: ) pattern. */
@@ -3548,22 +3546,22 @@ YY_RULE_SETUP
                        }
        YY_BREAK
 case 150:
-#line 713 "scan.l"
+#line 711 "scan.l"
 case 151:
 YY_RULE_SETUP
-#line 713 "scan.l"
+#line 711 "scan.l"
 return EOF_OP;
        YY_BREAK
 case 152:
 YY_RULE_SETUP
-#line 715 "scan.l"
+#line 713 "scan.l"
 {
                        sectnum = 3;
                        BEGIN(no_section3_escape ? SECT3_NOESCAPE : SECT3);
                        outn("/* Begin user sect3 */");
 #if 1
  piece_pack();
- piece_append("</Sect2>");
+ piece_append("</Section2>");
 #if 1
  piece_esc(yytext, strlen(yytext));
 #else
@@ -3572,7 +3570,7 @@ YY_RULE_SETUP
  piece_append("</token>");
 #endif
  piece_pack();
- piece_append("<Sect3>");
+ piece_append("<Section3>");
  return ~YY_NULL;
 #else
                        yyterminate(); /* to stop the parser */
@@ -3582,7 +3580,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 153:
 YY_RULE_SETUP
-#line 738 "scan.l"
+#line 736 "scan.l"
 {
                        int cclval;
 
@@ -3632,12 +3630,12 @@ YY_RULE_SETUP
        YY_BREAK
 case 154:
 YY_RULE_SETUP
-#line 784 "scan.l"
+#line 782 "scan.l"
 return CCL_OP_DIFF;
        YY_BREAK
 case 155:
 YY_RULE_SETUP
-#line 785 "scan.l"
+#line 783 "scan.l"
 return CCL_OP_UNION;
        YY_BREAK
 /* Check for :space: at the end of the rule so we don't
@@ -3647,7 +3645,7 @@ return CCL_OP_UNION;
 case 156:
 /* rule 156 can match eol */
 YY_RULE_SETUP
-#line 792 "scan.l"
+#line 790 "scan.l"
 {
                        char *nmdefptr;
             int end_is_ws, end_ch;
@@ -3702,7 +3700,7 @@ nmstr[yyleng - 2 - end_is_ws] = '\0';  /* chop trailing brace */
        YY_BREAK
 case 157:
 YY_RULE_SETUP
-#line 844 "scan.l"
+#line 842 "scan.l"
 {
                     if (sf_skip_ws())
                         yy_push_state(COMMENT_DISCARD);
@@ -3715,7 +3713,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 158:
 YY_RULE_SETUP
-#line 854 "scan.l"
+#line 852 "scan.l"
 {
                     if (lex_compat || posix_compat){
                         /* Push back the "?#" and treat it like a normal parens. */
@@ -3729,7 +3727,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 159:
 YY_RULE_SETUP
-#line 864 "scan.l"
+#line 862 "scan.l"
 {
                     sf_push();
                     if (lex_compat || posix_compat)
@@ -3742,12 +3740,12 @@ YY_RULE_SETUP
        YY_BREAK
 case 160:
 YY_RULE_SETUP
-#line 873 "scan.l"
+#line 871 "scan.l"
 sf_push(); return '(';
        YY_BREAK
 case 161:
 YY_RULE_SETUP
-#line 874 "scan.l"
+#line 872 "scan.l"
 {
                     if (_sf_top_ix > 0) {
                         sf_pop();
@@ -3758,22 +3756,22 @@ YY_RULE_SETUP
        YY_BREAK
 case 162:
 YY_RULE_SETUP
-#line 882 "scan.l"
+#line 880 "scan.l"
 return (unsigned char) yytext[0];
        YY_BREAK
 case 163:
 YY_RULE_SETUP
-#line 883 "scan.l"
+#line 881 "scan.l"
 RETURNCHAR;
        YY_BREAK
 /* Nick added this rule for consistency with rest of scanner */
 case YY_STATE_EOF(SECT2):
-#line 886 "scan.l"
+#line 884 "scan.l"
 {
                        sectnum = 0;
 #if 1
  piece_pack();
- piece_append("</Sect2>");
+ piece_append("</Section2>");
 #if 0
  piece_append("<token value=\"0\" />");
 #endif
@@ -3789,17 +3787,17 @@ case YY_STATE_EOF(SECT2):
 case 164:
 /* rule 164 can match eol */
 YY_RULE_SETUP
-#line 904 "scan.l"
+#line 902 "scan.l"
 ++linenum;     /* Allow blank lines & continuations */
        YY_BREAK
 case 165:
 YY_RULE_SETUP
-#line 905 "scan.l"
+#line 903 "scan.l"
 return (unsigned char) yytext[0];
        YY_BREAK
 case 166:
 YY_RULE_SETUP
-#line 906 "scan.l"
+#line 904 "scan.l"
 BEGIN(SECT2); return '>';
        YY_BREAK
 case 167:
@@ -3807,17 +3805,17 @@ case 167:
 (yy_c_buf_p) = yy_cp = yy_bp + 1;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 907 "scan.l"
+#line 905 "scan.l"
 BEGIN(CARETISBOL); return '>';
        YY_BREAK
 case 168:
 YY_RULE_SETUP
-#line 908 "scan.l"
+#line 906 "scan.l"
 RETURNNAME;
        YY_BREAK
 case 169:
 YY_RULE_SETUP
-#line 909 "scan.l"
+#line 907 "scan.l"
 {
                        format_synerr( _( "bad <start condition>: %s" ),
                                yytext );
@@ -3826,24 +3824,24 @@ YY_RULE_SETUP
 
 case 170:
 YY_RULE_SETUP
-#line 915 "scan.l"
+#line 913 "scan.l"
 BEGIN(SECT2); return '^';
        YY_BREAK
 
 case 171:
 YY_RULE_SETUP
-#line 919 "scan.l"
+#line 917 "scan.l"
 RETURNCHAR;
        YY_BREAK
 case 172:
 YY_RULE_SETUP
-#line 920 "scan.l"
+#line 918 "scan.l"
 BEGIN(SECT2); return '"';
        YY_BREAK
 case 173:
 /* rule 173 can match eol */
 YY_RULE_SETUP
-#line 922 "scan.l"
+#line 920 "scan.l"
 {
                        synerr( _( "missing quote" ) );
                        BEGIN(SECT2);
@@ -3855,49 +3853,49 @@ YY_RULE_SETUP
 
 case 174:
 YY_RULE_SETUP
-#line 931 "scan.l"
+#line 929 "scan.l"
 BEGIN(SECT2);
        YY_BREAK
 case 175:
 YY_RULE_SETUP
-#line 932 "scan.l"
+#line 930 "scan.l"
 BEGIN(GROUP_MINUS_PARAMS);
        YY_BREAK
 case 176:
 YY_RULE_SETUP
-#line 933 "scan.l"
+#line 931 "scan.l"
 sf_set_case_ins(1);
        YY_BREAK
 case 177:
 YY_RULE_SETUP
-#line 934 "scan.l"
+#line 932 "scan.l"
 sf_set_dot_all(1);
        YY_BREAK
 case 178:
 YY_RULE_SETUP
-#line 935 "scan.l"
+#line 933 "scan.l"
 sf_set_skip_ws(1);
        YY_BREAK
 
 
 case 179:
 YY_RULE_SETUP
-#line 938 "scan.l"
+#line 936 "scan.l"
 BEGIN(SECT2);
        YY_BREAK
 case 180:
 YY_RULE_SETUP
-#line 939 "scan.l"
+#line 937 "scan.l"
 sf_set_case_ins(0);
        YY_BREAK
 case 181:
 YY_RULE_SETUP
-#line 940 "scan.l"
+#line 938 "scan.l"
 sf_set_dot_all(0);
        YY_BREAK
 case 182:
 YY_RULE_SETUP
-#line 941 "scan.l"
+#line 939 "scan.l"
 sf_set_skip_ws(0);
        YY_BREAK
 
@@ -3907,7 +3905,7 @@ case 183:
 (yy_c_buf_p) = yy_cp = yy_bp + 1;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 945 "scan.l"
+#line 943 "scan.l"
 BEGIN(CCL); return '^';
        YY_BREAK
 case 184:
@@ -3915,12 +3913,12 @@ case 184:
 (yy_c_buf_p) = yy_cp = yy_bp + 1;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 946 "scan.l"
+#line 944 "scan.l"
 return '^';
        YY_BREAK
 case 185:
 YY_RULE_SETUP
-#line 947 "scan.l"
+#line 945 "scan.l"
 BEGIN(CCL); RETURNCHAR;
        YY_BREAK
 
@@ -3930,23 +3928,23 @@ case 186:
 (yy_c_buf_p) = yy_cp = yy_bp + 1;
 YY_DO_BEFORE_ACTION; /* set up yytext again */
 YY_RULE_SETUP
-#line 951 "scan.l"
+#line 949 "scan.l"
 return '-';
        YY_BREAK
 case 187:
 YY_RULE_SETUP
-#line 952 "scan.l"
+#line 950 "scan.l"
 RETURNCHAR;
        YY_BREAK
 case 188:
 YY_RULE_SETUP
-#line 953 "scan.l"
+#line 951 "scan.l"
 BEGIN(SECT2); return ']';
        YY_BREAK
 case 189:
 /* rule 189 can match eol */
 YY_RULE_SETUP
-#line 954 "scan.l"
+#line 952 "scan.l"
 {
                        synerr( _( "bad character class" ) );
                        BEGIN(SECT2);
@@ -3957,127 +3955,127 @@ YY_RULE_SETUP
 
 case 190:
 YY_RULE_SETUP
-#line 962 "scan.l"
+#line 960 "scan.l"
 BEGIN(CCL); return CCE_ALNUM;
        YY_BREAK
 case 191:
 YY_RULE_SETUP
-#line 963 "scan.l"
+#line 961 "scan.l"
 BEGIN(CCL); return CCE_ALPHA;
        YY_BREAK
 case 192:
 YY_RULE_SETUP
-#line 964 "scan.l"
+#line 962 "scan.l"
 BEGIN(CCL); return CCE_BLANK;
        YY_BREAK
 case 193:
 YY_RULE_SETUP
-#line 965 "scan.l"
+#line 963 "scan.l"
 BEGIN(CCL); return CCE_CNTRL;
        YY_BREAK
 case 194:
 YY_RULE_SETUP
-#line 966 "scan.l"
+#line 964 "scan.l"
 BEGIN(CCL); return CCE_DIGIT;
        YY_BREAK
 case 195:
 YY_RULE_SETUP
-#line 967 "scan.l"
+#line 965 "scan.l"
 BEGIN(CCL); return CCE_GRAPH;
        YY_BREAK
 case 196:
 YY_RULE_SETUP
-#line 968 "scan.l"
+#line 966 "scan.l"
 BEGIN(CCL); return CCE_LOWER;
        YY_BREAK
 case 197:
 YY_RULE_SETUP
-#line 969 "scan.l"
+#line 967 "scan.l"
 BEGIN(CCL); return CCE_PRINT;
        YY_BREAK
 case 198:
 YY_RULE_SETUP
-#line 970 "scan.l"
+#line 968 "scan.l"
 BEGIN(CCL); return CCE_PUNCT;
        YY_BREAK
 case 199:
 YY_RULE_SETUP
-#line 971 "scan.l"
+#line 969 "scan.l"
 BEGIN(CCL); return CCE_SPACE;
        YY_BREAK
 case 200:
 YY_RULE_SETUP
-#line 972 "scan.l"
+#line 970 "scan.l"
 BEGIN(CCL); return CCE_UPPER;
        YY_BREAK
 case 201:
 YY_RULE_SETUP
-#line 973 "scan.l"
+#line 971 "scan.l"
 BEGIN(CCL); return CCE_XDIGIT;
        YY_BREAK
 case 202:
 YY_RULE_SETUP
-#line 975 "scan.l"
+#line 973 "scan.l"
 BEGIN(CCL); return CCE_NEG_ALNUM;
        YY_BREAK
 case 203:
 YY_RULE_SETUP
-#line 976 "scan.l"
+#line 974 "scan.l"
 BEGIN(CCL); return CCE_NEG_ALPHA;
        YY_BREAK
 case 204:
 YY_RULE_SETUP
-#line 977 "scan.l"
+#line 975 "scan.l"
 BEGIN(CCL); return CCE_NEG_BLANK;
        YY_BREAK
 case 205:
 YY_RULE_SETUP
-#line 978 "scan.l"
+#line 976 "scan.l"
 BEGIN(CCL); return CCE_NEG_CNTRL;
        YY_BREAK
 case 206:
 YY_RULE_SETUP
-#line 979 "scan.l"
+#line 977 "scan.l"
 BEGIN(CCL); return CCE_NEG_DIGIT;
        YY_BREAK
 case 207:
 YY_RULE_SETUP
-#line 980 "scan.l"
+#line 978 "scan.l"
 BEGIN(CCL); return CCE_NEG_GRAPH;
        YY_BREAK
 case 208:
 YY_RULE_SETUP
-#line 981 "scan.l"
+#line 979 "scan.l"
 BEGIN(CCL); return CCE_NEG_LOWER;
        YY_BREAK
 case 209:
 YY_RULE_SETUP
-#line 982 "scan.l"
+#line 980 "scan.l"
 BEGIN(CCL); return CCE_NEG_PRINT;
        YY_BREAK
 case 210:
 YY_RULE_SETUP
-#line 983 "scan.l"
+#line 981 "scan.l"
 BEGIN(CCL); return CCE_NEG_PUNCT;
        YY_BREAK
 case 211:
 YY_RULE_SETUP
-#line 984 "scan.l"
+#line 982 "scan.l"
 BEGIN(CCL); return CCE_NEG_SPACE;
        YY_BREAK
 case 212:
 YY_RULE_SETUP
-#line 985 "scan.l"
+#line 983 "scan.l"
 BEGIN(CCL); return CCE_NEG_UPPER;
        YY_BREAK
 case 213:
 YY_RULE_SETUP
-#line 986 "scan.l"
+#line 984 "scan.l"
 BEGIN(CCL); return CCE_NEG_XDIGIT;
        YY_BREAK
 case 214:
 YY_RULE_SETUP
-#line 987 "scan.l"
+#line 985 "scan.l"
 {
                        format_synerr(
                                _( "bad character class expression: %s" ),
@@ -4089,7 +4087,7 @@ YY_RULE_SETUP
 
 case 215:
 YY_RULE_SETUP
-#line 996 "scan.l"
+#line 994 "scan.l"
 {
                        yylval = myctoi( yytext );
                        return NUMBER;
@@ -4097,12 +4095,12 @@ YY_RULE_SETUP
        YY_BREAK
 case 216:
 YY_RULE_SETUP
-#line 1001 "scan.l"
+#line 999 "scan.l"
 return ',';
        YY_BREAK
 case 217:
 YY_RULE_SETUP
-#line 1002 "scan.l"
+#line 1000 "scan.l"
 {
                        BEGIN(SECT2);
                        if ( lex_compat || posix_compat )
@@ -4113,7 +4111,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 218:
 YY_RULE_SETUP
-#line 1010 "scan.l"
+#line 1008 "scan.l"
 {
                        synerr( _( "bad character inside {}'s" ) );
                        BEGIN(SECT2);
@@ -4123,7 +4121,7 @@ YY_RULE_SETUP
 case 219:
 /* rule 219 can match eol */
 YY_RULE_SETUP
-#line 1016 "scan.l"
+#line 1014 "scan.l"
 {
                        synerr( _( "missing }" ) );
                        BEGIN(SECT2);
@@ -4135,18 +4133,18 @@ YY_RULE_SETUP
 
 case 220:
 YY_RULE_SETUP
-#line 1026 "scan.l"
+#line 1024 "scan.l"
 bracelevel = 0;
        YY_BREAK
 case 221:
 YY_RULE_SETUP
-#line 1028 "scan.l"
+#line 1026 "scan.l"
 ACTION_ECHO; yy_push_state( CODE_COMMENT );
        YY_BREAK
 
 case 222:
 YY_RULE_SETUP
-#line 1031 "scan.l"
+#line 1029 "scan.l"
 {
             ACTION_ECHO;
             CHECK_REJECT(yytext);
@@ -4154,7 +4152,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 223:
 YY_RULE_SETUP
-#line 1035 "scan.l"
+#line 1033 "scan.l"
 {
             ACTION_ECHO;
             CHECK_YYMORE(yytext);
@@ -4163,13 +4161,13 @@ YY_RULE_SETUP
 
 case 224:
 YY_RULE_SETUP
-#line 1041 "scan.l"
+#line 1039 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 case 225:
 /* rule 225 can match eol */
 YY_RULE_SETUP
-#line 1042 "scan.l"
+#line 1040 "scan.l"
 {
                ++linenum;
                ACTION_ECHO;
@@ -4188,43 +4186,43 @@ YY_RULE_SETUP
 
 case 226:
 YY_RULE_SETUP
-#line 1059 "scan.l"
+#line 1057 "scan.l"
 ACTION_ECHO; ++bracelevel;
        YY_BREAK
 case 227:
 YY_RULE_SETUP
-#line 1060 "scan.l"
+#line 1058 "scan.l"
 ACTION_ECHO; --bracelevel;
        YY_BREAK
 case 228:
 YY_RULE_SETUP
-#line 1061 "scan.l"
+#line 1059 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 case 229:
 YY_RULE_SETUP
-#line 1062 "scan.l"
+#line 1060 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 case 230:
 YY_RULE_SETUP
-#line 1063 "scan.l"
+#line 1061 "scan.l"
 ACTION_ECHO; /* character constant */
        YY_BREAK
 case 231:
 YY_RULE_SETUP
-#line 1064 "scan.l"
+#line 1062 "scan.l"
 ACTION_ECHO; BEGIN(CHARACTER_CONSTANT);
        YY_BREAK
 case 232:
 YY_RULE_SETUP
-#line 1065 "scan.l"
+#line 1063 "scan.l"
 ACTION_ECHO; BEGIN(ACTION_STRING);
        YY_BREAK
 case 233:
 /* rule 233 can match eol */
 YY_RULE_SETUP
-#line 1066 "scan.l"
+#line 1064 "scan.l"
 {
                 ++linenum;
                 ACTION_ECHO;
@@ -4243,31 +4241,31 @@ YY_RULE_SETUP
        YY_BREAK
 case 234:
 YY_RULE_SETUP
-#line 1081 "scan.l"
+#line 1079 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 
 
 case 235:
 YY_RULE_SETUP
-#line 1085 "scan.l"
+#line 1083 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 case 236:
 YY_RULE_SETUP
-#line 1086 "scan.l"
+#line 1084 "scan.l"
 ACTION_ECHO; BEGIN(ACTION);
        YY_BREAK
 
 
 case 237:
 YY_RULE_SETUP
-#line 1089 "scan.l"
+#line 1087 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 case 238:
 YY_RULE_SETUP
-#line 1090 "scan.l"
+#line 1088 "scan.l"
 ACTION_ECHO; BEGIN(ACTION);
        YY_BREAK
 
@@ -4275,24 +4273,24 @@ ACTION_ECHO; BEGIN(ACTION);
 case 239:
 /* rule 239 can match eol */
 YY_RULE_SETUP
-#line 1093 "scan.l"
+#line 1091 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 case 240:
 /* rule 240 can match eol */
 YY_RULE_SETUP
-#line 1094 "scan.l"
+#line 1092 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 case 241:
 /* rule 241 can match eol */
 YY_RULE_SETUP
-#line 1095 "scan.l"
+#line 1093 "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 1096 "scan.l"
+#line 1094 "scan.l"
 ACTION_ECHO;
        YY_BREAK
 
@@ -4302,7 +4300,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 1099 "scan.l"
+#line 1097 "scan.l"
 {
                        synerr( _( "EOF encountered inside an action" ) );
                        yyterminate();
@@ -4311,7 +4309,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 1104 "scan.l"
+#line 1102 "scan.l"
 {
                        synerr( _( "EOF encountered inside pattern" ) );
                        yyterminate();
@@ -4319,7 +4317,7 @@ case YY_STATE_EOF(GROUP_MINUS_PARAMS):
        YY_BREAK
 case 243:
 YY_RULE_SETUP
-#line 1109 "scan.l"
+#line 1107 "scan.l"
 {
                        yylval = myesc( (unsigned char *) yytext );
 
@@ -4332,32 +4330,32 @@ YY_RULE_SETUP
 
 case 244:
 YY_RULE_SETUP
-#line 1119 "scan.l"
+#line 1117 "scan.l"
 fputs(escaped_qstart, yyout);
        YY_BREAK
 case 245:
 YY_RULE_SETUP
-#line 1120 "scan.l"
+#line 1118 "scan.l"
 fputs(escaped_qend, yyout);
        YY_BREAK
 case 246:
 /* rule 246 can match eol */
 YY_RULE_SETUP
-#line 1121 "scan.l"
+#line 1119 "scan.l"
 ECHO;
        YY_BREAK
 case 247:
 YY_RULE_SETUP
-#line 1122 "scan.l"
+#line 1120 "scan.l"
 ECHO;
        YY_BREAK
 case YY_STATE_EOF(SECT3):
-#line 1123 "scan.l"
+#line 1121 "scan.l"
 {
         sectnum = 0;
 #if 1
  piece_pack();
- piece_append("</Sect3>");
+ piece_append("</Section3>");
 #if 0
  piece_append("<token value=\"0\" />");
 #endif
@@ -4372,32 +4370,32 @@ case YY_STATE_EOF(SECT3):
 
 case 248:
 YY_RULE_SETUP
-#line 1139 "scan.l"
+#line 1137 "scan.l"
 fprintf(yyout, "[""[%s]""]", escaped_qstart);
        YY_BREAK
 case 249:
 YY_RULE_SETUP
-#line 1140 "scan.l"
+#line 1138 "scan.l"
 fprintf(yyout, "[""[%s]""]", escaped_qend);
        YY_BREAK
 case 250:
 /* rule 250 can match eol */
 YY_RULE_SETUP
-#line 1141 "scan.l"
+#line 1139 "scan.l"
 ECHO;
        YY_BREAK
 case 251:
 YY_RULE_SETUP
-#line 1142 "scan.l"
+#line 1140 "scan.l"
 ECHO;
        YY_BREAK
 case YY_STATE_EOF(SECT3_NOESCAPE):
-#line 1143 "scan.l"
+#line 1141 "scan.l"
 {
        sectnum = 0;
 #if 1
  piece_pack();
- piece_append("</Sect3>");
+ piece_append("</Section3>");
 #if 0
  piece_append("<token value=\"0\" />");
 #endif
@@ -4412,15 +4410,15 @@ case YY_STATE_EOF(SECT3_NOESCAPE):
 case 252:
 /* rule 252 can match eol */
 YY_RULE_SETUP
-#line 1158 "scan.l"
+#line 1156 "scan.l"
 format_synerr( _( "bad character: %s" ), yytext );
        YY_BREAK
 case 253:
 YY_RULE_SETUP
-#line 1160 "scan.l"
+#line 1158 "scan.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
        YY_BREAK
-#line 4312 "scan.c"
+#line 4310 "scan.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(CODEBLOCK):
 case YY_STATE_EOF(PICKUPDEF):
@@ -5473,7 +5471,7 @@ void yyfree (void * ptr )
 
 #define YYTABLES_NAME "yytables"
 
-#line 1160 "scan.l"
+#line 1158 "scan.l"
 
 
 
@@ -5515,20 +5513,25 @@ void set_input_file( char *file )
 
 /* Nick */
 static void markup_action(void) {
- piece_append("</Action></Rule>");
  /* append to last token text so it appears inside <Rule>..</Rule> */
+ /* a problem here is that Rule has already been reduced (marked up), */
+ /* because we returned a '\n' token when we detected start of action, */
+ /* hence we need to move the closing </Rule> tag over to our right */
  int i = strlen(piece[--piece0]);
  if (i < 7 || strcmp(piece[piece0] + i - 7, "</Rule>") != 0)
   abort();
  piece[piece0][i - 7] = 0;
+ piece_append("</Action></Rule>");
  piece_pack();
 }
 
 static void markup_option(const char *name, int sense) {
+ /* a problem here is that we couldn't apply markup when scanning the "no" */
+ /* prefix because we didn't know what option it was, back up to include it */
  int i = piece1;
  while (--i >= piece0 && strcmp(piece[i], "no") == 0)
   ;
- sprintf(piece_temp, "<Options_%s value=\"%s\">", name, sense ? "true" : "false");
+ sprintf(piece_temp, "<Options_%s%s>", name, sense ? " value=\"true\"" : "");
  piece_insert(i + 1, piece_temp);
  flush();
  sprintf(piece_temp, "</Options_%s>", name);
index c7985f3..f4dd43c 100644 (file)
@@ -1,5 +1,5 @@
---- scan.c.orig        2018-06-23 13:08:34.800427005 +1000
-+++ scan.c     2018-06-23 13:06:16.936432839 +1000
+--- scan.c.orig        2018-06-24 10:38:13.780833990 +1000
++++ scan.c     2018-06-24 10:38:13.796833990 +1000
 @@ -23,6 +23,19 @@
  
  /* end standard C headers. */
@@ -42,7 +42,7 @@
  
  #ifndef YY_TYPEDEF_YY_SIZE_T
  #define YY_TYPEDEF_YY_SIZE_T
-@@ -2218,8 +2245,88 @@
+@@ -2219,8 +2246,88 @@
  
  /** The main scanner function which does all the work.
   */
        register yy_state_type yy_current_state;
        register char *yy_cp, *yy_bp;
        register int yy_act;
-@@ -2263,7 +2370,12 @@
+@@ -2264,7 +2371,12 @@
                yy_load_buffer_state( );
                }
  
index 8ac94c8..e506193 100644 (file)
@@ -201,7 +201,7 @@ M4QEND      "]""]"
                        line_directive_out(NULL, 1);
                        BEGIN(SECT2PROLOG);
 #if 1
- piece_append("</Sect1>");
+ piece_append("</Section1>");
  piece_pack();
 #if 1
  piece_esc(yytext, strlen(yytext));
@@ -211,7 +211,7 @@ M4QEND      "]""]"
  piece_esc(yytext, strlen(yytext));
  piece_append("</token>");
 #endif
- piece_append("<Sect2>");
+ piece_append("<Section2>");
  piece_pack();
  return ~SECTEND;
 #else
@@ -534,7 +534,7 @@ M4QEND      "]""]"
                        sectnum = 0;
 #if 1
  piece_pack();
- piece_append("</Sect2>");
+ piece_append("</Section2>");
 #if 0
  piece_append("<token value=\"0\" />");
 #endif
@@ -716,7 +716,7 @@ M4QEND      "]""]"
                        outn("/* Begin user sect3 */");
 #if 1
  piece_pack();
- piece_append("</Sect2>");
+ piece_append("</Section2>");
 #if 1
  piece_esc(yytext, strlen(yytext));
 #else
@@ -725,7 +725,7 @@ M4QEND      "]""]"
  piece_append("</token>");
 #endif
  piece_pack();
- piece_append("<Sect3>");
+ piece_append("<Section3>");
  return ~YY_NULL;
 #else
                        yyterminate(); /* to stop the parser */
@@ -885,7 +885,7 @@ nmstr[yyleng - 2 - end_is_ws] = '\0';  /* chop trailing brace */
                        sectnum = 0;
 #if 1
  piece_pack();
- piece_append("</Sect2>");
+ piece_append("</Section2>");
 #if 0
  piece_append("<token value=\"0\" />");
 #endif
@@ -1122,7 +1122,7 @@ nmstr[yyleng - 2 - end_is_ws] = '\0';  /* chop trailing brace */
         sectnum = 0;
 #if 1
  piece_pack();
- piece_append("</Sect3>");
+ piece_append("</Section3>");
 #if 0
  piece_append("<token value=\"0\" />");
 #endif
@@ -1142,7 +1142,7 @@ nmstr[yyleng - 2 - end_is_ws] = '\0';  /* chop trailing brace */
        sectnum = 0;
 #if 1
  piece_pack();
- piece_append("</Sect3>");
+ piece_append("</Section3>");
 #if 0
  piece_append("<token value=\"0\" />");
 #endif
@@ -1195,20 +1195,25 @@ void set_input_file( char *file )
 
 /* Nick */
 static void markup_action(void) {
- piece_append("</Action></Rule>");
  /* append to last token text so it appears inside <Rule>..</Rule> */
+ /* a problem here is that Rule has already been reduced (marked up), */
+ /* because we returned a '\n' token when we detected start of action, */
+ /* hence we need to move the closing </Rule> tag over to our right */
  int i = strlen(piece[--piece0]);
  if (i < 7 || strcmp(piece[piece0] + i - 7, "</Rule>") != 0)
   abort();
  piece[piece0][i - 7] = 0;
+ piece_append("</Action></Rule>");
  piece_pack();
 }
 
 static void markup_option(const char *name, int sense) {
+ /* a problem here is that we couldn't apply markup when scanning the "no" */
+ /* prefix because we didn't know what option it was, back up to include it */
  int i = piece1;
  while (--i >= piece0 && strcmp(piece[i], "no") == 0)
   ;
- sprintf(piece_temp, "<Options_%s value=\"%s\">", name, sense ? "true" : "false");
+ sprintf(piece_temp, "<Options_%s%s>", name, sense ? " value=\"true\"" : "");
  piece_insert(i + 1, piece_temp);
  flush();
  sprintf(piece_temp, "</Options_%s>", name);
index e86270b..53752db 100644 (file)
@@ -1,5 +1,5 @@
---- stage1scan.c.orig  2018-06-23 13:12:37.256416744 +1000
-+++ stage1scan.c       2018-06-23 13:16:25.000407106 +1000
+--- stage1scan.c.orig  2018-06-24 10:38:18.196833803 +1000
++++ stage1scan.c       2018-06-24 10:38:18.216833803 +1000
 @@ -24,6 +24,19 @@
  
  /* end standard C headers. */
@@ -42,7 +42,7 @@
  
  #ifndef YY_STRUCT_YY_BUFFER_STATE
  #define YY_STRUCT_YY_BUFFER_STATE
-@@ -2195,8 +2222,88 @@
+@@ -2196,8 +2223,88 @@
  
  /** The main scanner function which does all the work.
   */
        yy_state_type yy_current_state;
        char *yy_cp, *yy_bp;
        int yy_act;
-@@ -2242,7 +2349,12 @@
+@@ -2243,7 +2350,12 @@
  
- #line 2243 "stage1scan.c"
+ #line 2244 "stage1scan.c"
  
 +#if 1
 + /* we do this so that "continue;" in an action works correctly */