Remove RegexGroup markup around the expression to be matched, so that we simply gener...
authorNick Downing <downing.nick@gmail.com>
Wed, 27 Jun 2018 14:14:09 +0000 (00:14 +1000)
committerNick Downing <downing.nick@gmail.com>
Wed, 27 Jun 2018 14:14:09 +0000 (00:14 +1000)
src/parse.c
src/parse.y

index ecba7fe..5bc1e75 100644 (file)
@@ -595,13 +595,13 @@ static const yytype_uint16 yyrline[] =
        0,   118,   118,   148,   155,   161,   166,   167,   171,   179,
      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,   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,   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
+     358,   363,   366,   372,   392,   405,   407,   409,   413,   440,
+     496,   499,   544,   563,   571,   576,   603,   613,   616,   647,
+     664,   689,   698,   706,   714,   745,   762,   784,   826,   844,
+     854,   857,   865,   883,   889,   893,   898,   900,   909,   974,
+     997,  1007,  1016,  1020,  1024,  1028,  1032,  1036,  1040,  1054,
+    1058,  1062,  1066,  1070,  1085,  1089,  1093,  1097,  1101,  1105,
+    1109,  1113,  1117,  1121,  1125,  1133,  1143,  1161
 };
 #endif
 
@@ -1900,7 +1900,7 @@ yyreduce:
     break;
 
   case 39:
-#line 440 "parse.y" /* yacc.c:1646  */
+#line 441 "parse.y" /* yacc.c:1646  */
     {
                        if ( transchar[lastst[(yyvsp[0])]] != SYM_EPSILON )
                                /* Provide final transition \now/ so it
@@ -1954,20 +1954,18 @@ yyreduce:
                                trailcnt = rulelen;
 
                        (yyval) = link_machines( (yyvsp[-1]), (yyvsp[0]) );
- insert_after(1, "</RegexSequence>");
- insert_before(0, "<RegexSequence>");
                        }
-#line 1931 "parse.c" /* yacc.c:1646  */
+#line 1929 "parse.c" /* yacc.c:1646  */
     break;
 
   case 40:
-#line 498 "parse.y" /* yacc.c:1646  */
+#line 497 "parse.y" /* yacc.c:1646  */
     { synerr( _("trailing context used twice") ); }
-#line 1937 "parse.c" /* yacc.c:1646  */
+#line 1935 "parse.c" /* yacc.c:1646  */
     break;
 
   case 41:
-#line 501 "parse.y" /* yacc.c:1646  */
+#line 500 "parse.y" /* yacc.c:1646  */
     {
                        headcnt = 0;
                        trailcnt = 1;
@@ -2008,18 +2006,14 @@ yyreduce:
                        eps = mkstate( SYM_EPSILON );
                        (yyval) = link_machines( (yyvsp[-1]),
                                link_machines( eps, mkstate( '\n' ) ) );
- insert_after(1, "</RegexSequence>");
  insert_after(1, "</RegexCharacter>");
  insert_before(1, "<RegexCharacter char_set=\"10 11\">");
- insert_after(0, "</RegexGroup>");
- insert_before(0, "<RegexGroup>");
- insert_before(0, "<RegexSequence>");
                        }
-#line 1989 "parse.c" /* yacc.c:1646  */
+#line 1983 "parse.c" /* yacc.c:1646  */
     break;
 
   case 42:
-#line 550 "parse.y" /* yacc.c:1646  */
+#line 545 "parse.y" /* yacc.c:1646  */
     {
                        (yyval) = (yyvsp[0]);
 
@@ -2033,31 +2027,30 @@ yyreduce:
                                else
                                        trailcnt = rulelen;
                                }
- insert_after(0, "</RegexGroup>");
- insert_before(0, "<RegexGroup>");
+ insert_after(1, "<RegexEmpty />");
                        }
-#line 2010 "parse.c" /* yacc.c:1646  */
+#line 2003 "parse.c" /* yacc.c:1646  */
     break;
 
   case 43:
-#line 570 "parse.y" /* yacc.c:1646  */
+#line 564 "parse.y" /* yacc.c:1646  */
     {
                        varlength = true;
                        (yyval) = mkor( (yyvsp[-2]), (yyvsp[0]) );
  insert_after(2, "</RegexOr>");
  insert_before(0, "<RegexOr>");
                        }
-#line 2021 "parse.c" /* yacc.c:1646  */
+#line 2014 "parse.c" /* yacc.c:1646  */
     break;
 
   case 44:
-#line 578 "parse.y" /* yacc.c:1646  */
+#line 572 "parse.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 2027 "parse.c" /* yacc.c:1646  */
+#line 2020 "parse.c" /* yacc.c:1646  */
     break;
 
   case 45:
-#line 583 "parse.y" /* yacc.c:1646  */
+#line 577 "parse.y" /* yacc.c:1646  */
     {
                        /* This rule is written separately so the
                         * reduction will occur before the trailing
@@ -2081,14 +2074,12 @@ yyreduce:
 
                        current_state_type = STATE_TRAILING_CONTEXT;
                        (yyval) = (yyvsp[-1]);
- insert_after(0, "</RegexGroup>");
- insert_before(0, "<RegexGroup>");
                        }
-#line 2058 "parse.c" /* yacc.c:1646  */
+#line 2049 "parse.c" /* yacc.c:1646  */
     break;
 
   case 46:
-#line 612 "parse.y" /* yacc.c:1646  */
+#line 604 "parse.y" /* yacc.c:1646  */
     {
                        /* This is where concatenation of adjacent patterns
                         * gets done.
@@ -2097,17 +2088,17 @@ yyreduce:
  insert_after(1, "</RegexSequence>");
  insert_before(0, "<RegexSequence>");
                        }
-#line 2071 "parse.c" /* yacc.c:1646  */
+#line 2062 "parse.c" /* yacc.c:1646  */
     break;
 
   case 47:
-#line 622 "parse.y" /* yacc.c:1646  */
+#line 614 "parse.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[0]); }
-#line 2077 "parse.c" /* yacc.c:1646  */
+#line 2068 "parse.c" /* yacc.c:1646  */
     break;
 
   case 48:
-#line 625 "parse.y" /* yacc.c:1646  */
+#line 617 "parse.y" /* yacc.c:1646  */
     {
                        varlength = true;
 
@@ -2137,11 +2128,11 @@ yyreduce:
  sprintf(piece_temp, "<RegexRepeat count0=\"%d\" count1=\"%d\">", (yyvsp[-3]), (yyvsp[-1]));
  insert_before(0, piece_temp);
                        }
-#line 2111 "parse.c" /* yacc.c:1646  */
+#line 2102 "parse.c" /* yacc.c:1646  */
     break;
 
   case 49:
-#line 656 "parse.y" /* yacc.c:1646  */
+#line 648 "parse.y" /* yacc.c:1646  */
     {
                        varlength = true;
 
@@ -2157,11 +2148,11 @@ yyreduce:
  sprintf(piece_temp, "<RegexRepeat count0=\"%d\">", (yyvsp[-2]));
  insert_before(0, piece_temp);
                        }
-#line 2131 "parse.c" /* yacc.c:1646  */
+#line 2122 "parse.c" /* yacc.c:1646  */
     break;
 
   case 50:
-#line 673 "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
@@ -2183,11 +2174,11 @@ yyreduce:
  sprintf(piece_temp, "<RegexRepeat count0=\"%d\" count1=\"%d\">", (yyvsp[-1]), (yyvsp[-1]));
  insert_before(0, piece_temp);
                        }
-#line 2157 "parse.c" /* yacc.c:1646  */
+#line 2148 "parse.c" /* yacc.c:1646  */
     break;
 
   case 51:
-#line 698 "parse.y" /* yacc.c:1646  */
+#line 690 "parse.y" /* yacc.c:1646  */
     {
                        varlength = true;
 
@@ -2195,33 +2186,33 @@ yyreduce:
  insert_after(1, "</RegexRepeat>");
  insert_before(0, "<RegexRepeat count0=\"0\">");
                        }
-#line 2169 "parse.c" /* yacc.c:1646  */
+#line 2160 "parse.c" /* yacc.c:1646  */
     break;
 
   case 52:
-#line 707 "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\">");
                        }
-#line 2180 "parse.c" /* yacc.c:1646  */
+#line 2171 "parse.c" /* yacc.c:1646  */
     break;
 
   case 53:
-#line 715 "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 2191 "parse.c" /* yacc.c:1646  */
+#line 2182 "parse.c" /* yacc.c:1646  */
     break;
 
   case 54:
-#line 723 "parse.y" /* yacc.c:1646  */
+#line 715 "parse.y" /* yacc.c:1646  */
     {
                        varlength = true;
 
@@ -2251,11 +2242,11 @@ yyreduce:
  sprintf(piece_temp, "<RegexRepeat count0=\"%d\" count1=\"%d\">", (yyvsp[-3]), (yyvsp[-1]));
  insert_before(0, piece_temp);
                        }
-#line 2225 "parse.c" /* yacc.c:1646  */
+#line 2216 "parse.c" /* yacc.c:1646  */
     break;
 
   case 55:
-#line 754 "parse.y" /* yacc.c:1646  */
+#line 746 "parse.y" /* yacc.c:1646  */
     {
                        varlength = true;
 
@@ -2271,11 +2262,11 @@ yyreduce:
  sprintf(piece_temp, "<RegexRepeat count0=\"%d\">", (yyvsp[-2]));
  insert_before(0, piece_temp);
                        }
-#line 2245 "parse.c" /* yacc.c:1646  */
+#line 2236 "parse.c" /* yacc.c:1646  */
     break;
 
   case 56:
-#line 771 "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
@@ -2296,11 +2287,11 @@ yyreduce:
  sprintf(piece_temp, "<RegexRepeat count0=\"%d\" count1=\"%d\">", (yyvsp[-1]), (yyvsp[-1]));
  insert_before(0, piece_temp);
                        }
-#line 2270 "parse.c" /* yacc.c:1646  */
+#line 2261 "parse.c" /* yacc.c:1646  */
     break;
 
   case 57:
-#line 793 "parse.y" /* yacc.c:1646  */
+#line 785 "parse.y" /* yacc.c:1646  */
     {
                        if ( ! madeany )
                                {
@@ -2341,11 +2332,11 @@ yyreduce:
  insert_before(0, "<RegexCharacter char_set=\"0 10 11 256\">");
  }
                        }
-#line 2315 "parse.c" /* yacc.c:1646  */
+#line 2306 "parse.c" /* yacc.c:1646  */
     break;
 
   case 58:
-#line 835 "parse.y" /* yacc.c:1646  */
+#line 827 "parse.y" /* yacc.c:1646  */
     {
                                /* Sort characters for fast searching.
                                 */
@@ -2362,11 +2353,11 @@ yyreduce:
 
                        (yyval) = mkstate( -(yyvsp[0]) );
                        }
-#line 2336 "parse.c" /* yacc.c:1646  */
+#line 2327 "parse.c" /* yacc.c:1646  */
     break;
 
   case 59:
-#line 853 "parse.y" /* yacc.c:1646  */
+#line 845 "parse.y" /* yacc.c:1646  */
     {
                        ++rulelen;
 
@@ -2375,28 +2366,28 @@ yyreduce:
 
                        (yyval) = mkstate( -(yyvsp[0]) );
                        }
-#line 2349 "parse.c" /* yacc.c:1646  */
+#line 2340 "parse.c" /* yacc.c:1646  */
     break;
 
   case 60:
-#line 863 "parse.y" /* yacc.c:1646  */
+#line 855 "parse.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[-1]); }
-#line 2355 "parse.c" /* yacc.c:1646  */
+#line 2346 "parse.c" /* yacc.c:1646  */
     break;
 
   case 61:
-#line 866 "parse.y" /* yacc.c:1646  */
+#line 858 "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 2366 "parse.c" /* yacc.c:1646  */
+#line 2357 "parse.c" /* yacc.c:1646  */
     break;
 
   case 62:
-#line 874 "parse.y" /* yacc.c:1646  */
+#line 866 "parse.y" /* yacc.c:1646  */
     {
                        ++rulelen;
 
@@ -2412,48 +2403,48 @@ yyreduce:
  sprintf(piece_temp, "<RegexCharacter char_set=\"%d %d\">", (yyvsp[0]), (yyvsp[0]) + 1);
  insert_before(0, piece_temp);
                        }
-#line 2386 "parse.c" /* yacc.c:1646  */
+#line 2377 "parse.c" /* yacc.c:1646  */
     break;
 
   case 63:
-#line 891 "parse.y" /* yacc.c:1646  */
+#line 883 "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 2397 "parse.c" /* yacc.c:1646  */
+#line 2388 "parse.c" /* yacc.c:1646  */
     break;
 
   case 64:
-#line 897 "parse.y" /* yacc.c:1646  */
+#line 889 "parse.y" /* yacc.c:1646  */
     { (yyval) = ccl_set_union ((yyvsp[-2]), (yyvsp[0])); /*}*/
  insert_after(2, "</RegexCharacterOr>");
  insert_before(0, "<RegexCharacterOr>");
  }
-#line 2406 "parse.c" /* yacc.c:1646  */
+#line 2397 "parse.c" /* yacc.c:1646  */
     break;
 
   case 66:
-#line 906 "parse.y" /* yacc.c:1646  */
+#line 898 "parse.y" /* yacc.c:1646  */
     { (yyval) = (yyvsp[-1]); }
-#line 2412 "parse.c" /* yacc.c:1646  */
+#line 2403 "parse.c" /* yacc.c:1646  */
     break;
 
   case 67:
-#line 909 "parse.y" /* yacc.c:1646  */
+#line 901 "parse.y" /* yacc.c:1646  */
     {
                        cclnegate( (yyvsp[-1]) );
                        (yyval) = (yyvsp[-1]);
  insert_after(2, "</RegexCharacterNot>");
  insert_before(1, "<RegexCharacterNot>");
                        }
-#line 2423 "parse.c" /* yacc.c:1646  */
+#line 2414 "parse.c" /* yacc.c:1646  */
     break;
 
   case 68:
-#line 918 "parse.y" /* yacc.c:1646  */
+#line 910 "parse.y" /* yacc.c:1646  */
     {
 
                        if (sf_case_ins())
@@ -2517,11 +2508,11 @@ yyreduce:
  insert_before(1, piece_temp);
  insert_before(0, "<RegexCharacterOr>");
                        }
-#line 2491 "parse.c" /* yacc.c:1646  */
+#line 2482 "parse.c" /* yacc.c:1646  */
     break;
 
   case 69:
-#line 983 "parse.y" /* yacc.c:1646  */
+#line 975 "parse.y" /* yacc.c:1646  */
     {
                        ccladd( (yyvsp[-1]), (yyvsp[0]) );
                        cclsorted = cclsorted && ((yyvsp[0]) > lastchar);
@@ -2543,11 +2534,11 @@ yyreduce:
  insert_before(1, piece_temp);
  insert_before(0, "<RegexCharacterOr>");
                        }
-#line 2517 "parse.c" /* yacc.c:1646  */
+#line 2508 "parse.c" /* yacc.c:1646  */
     break;
 
   case 70:
-#line 1006 "parse.y" /* yacc.c:1646  */
+#line 998 "parse.y" /* yacc.c:1646  */
     {
                        /* Too hard to properly maintain cclsorted. */
                        cclsorted = false;
@@ -2555,76 +2546,76 @@ yyreduce:
  insert_after(1, "</RegexCharacterOr>");
  insert_before(0, "<RegexCharacterOr>");
                        }
-#line 2529 "parse.c" /* yacc.c:1646  */
+#line 2520 "parse.c" /* yacc.c:1646  */
     break;
 
   case 71:
-#line 1015 "parse.y" /* yacc.c:1646  */
+#line 1007 "parse.y" /* yacc.c:1646  */
     {
                        cclsorted = true;
                        lastchar = 0;
                        currccl = (yyval) = cclinit();
  insert_before(0, "<RegexCharacter char_set=\"\" />");
                        }
-#line 2540 "parse.c" /* yacc.c:1646  */
+#line 2531 "parse.c" /* yacc.c:1646  */
     break;
 
   case 72:
-#line 1024 "parse.y" /* yacc.c:1646  */
+#line 1016 "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 2549 "parse.c" /* yacc.c:1646  */
+#line 2540 "parse.c" /* yacc.c:1646  */
     break;
 
   case 73:
-#line 1028 "parse.y" /* yacc.c:1646  */
+#line 1020 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(isalpha); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"65 91 97 123\">");
  }
-#line 2558 "parse.c" /* yacc.c:1646  */
+#line 2549 "parse.c" /* yacc.c:1646  */
     break;
 
   case 74:
-#line 1032 "parse.y" /* yacc.c:1646  */
+#line 1024 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(IS_BLANK); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"9 14 32 33\">");
  }
-#line 2567 "parse.c" /* yacc.c:1646  */
+#line 2558 "parse.c" /* yacc.c:1646  */
     break;
 
   case 75:
-#line 1036 "parse.y" /* yacc.c:1646  */
+#line 1028 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(iscntrl); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 32\">");
  }
-#line 2576 "parse.c" /* yacc.c:1646  */
+#line 2567 "parse.c" /* yacc.c:1646  */
     break;
 
   case 76:
-#line 1040 "parse.y" /* yacc.c:1646  */
+#line 1032 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(isdigit); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"48 58\">");
  }
-#line 2585 "parse.c" /* yacc.c:1646  */
+#line 2576 "parse.c" /* yacc.c:1646  */
     break;
 
   case 77:
-#line 1044 "parse.y" /* yacc.c:1646  */
+#line 1036 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(isgraph); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"33 127\">");
  }
-#line 2594 "parse.c" /* yacc.c:1646  */
+#line 2585 "parse.c" /* yacc.c:1646  */
     break;
 
   case 78:
-#line 1048 "parse.y" /* yacc.c:1646  */
+#line 1040 "parse.y" /* yacc.c:1646  */
     { 
                           CCL_EXPR(islower);
                           if (sf_case_ins())
@@ -2639,47 +2630,47 @@ yyreduce:
  insert_before(0, "<RegexCharacter char_set=\"97 123\">");
  }
                         }
-#line 2613 "parse.c" /* yacc.c:1646  */
+#line 2604 "parse.c" /* yacc.c:1646  */
     break;
 
   case 79:
-#line 1062 "parse.y" /* yacc.c:1646  */
+#line 1054 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(isprint); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"32 127\">");
  }
-#line 2622 "parse.c" /* yacc.c:1646  */
+#line 2613 "parse.c" /* yacc.c:1646  */
     break;
 
   case 80:
-#line 1066 "parse.y" /* yacc.c:1646  */
+#line 1058 "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 2631 "parse.c" /* yacc.c:1646  */
+#line 2622 "parse.c" /* yacc.c:1646  */
     break;
 
   case 81:
-#line 1070 "parse.y" /* yacc.c:1646  */
+#line 1062 "parse.y" /* yacc.c:1646  */
     { CCL_EXPR(isspace); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"32 33\">");
  }
-#line 2640 "parse.c" /* yacc.c:1646  */
+#line 2631 "parse.c" /* yacc.c:1646  */
     break;
 
   case 82:
-#line 1074 "parse.y" /* yacc.c:1646  */
+#line 1066 "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 2649 "parse.c" /* yacc.c:1646  */
+#line 2640 "parse.c" /* yacc.c:1646  */
     break;
 
   case 83:
-#line 1078 "parse.y" /* yacc.c:1646  */
+#line 1070 "parse.y" /* yacc.c:1646  */
     {
                     CCL_EXPR(isupper);
                     if (sf_case_ins())
@@ -2694,101 +2685,101 @@ yyreduce:
  insert_before(0, "<RegexCharacter char_set=\"65 91\">");
  }
                                }
-#line 2668 "parse.c" /* yacc.c:1646  */
+#line 2659 "parse.c" /* yacc.c:1646  */
     break;
 
   case 84:
-#line 1093 "parse.y" /* yacc.c:1646  */
+#line 1085 "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 2677 "parse.c" /* yacc.c:1646  */
+#line 2668 "parse.c" /* yacc.c:1646  */
     break;
 
   case 85:
-#line 1097 "parse.y" /* yacc.c:1646  */
+#line 1089 "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 2686 "parse.c" /* yacc.c:1646  */
+#line 2677 "parse.c" /* yacc.c:1646  */
     break;
 
   case 86:
-#line 1101 "parse.y" /* yacc.c:1646  */
+#line 1093 "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 2695 "parse.c" /* yacc.c:1646  */
+#line 2686 "parse.c" /* yacc.c:1646  */
     break;
 
   case 87:
-#line 1105 "parse.y" /* yacc.c:1646  */
+#line 1097 "parse.y" /* yacc.c:1646  */
     { CCL_NEG_EXPR(iscntrl); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"32 256\">");
  }
-#line 2704 "parse.c" /* yacc.c:1646  */
+#line 2695 "parse.c" /* yacc.c:1646  */
     break;
 
   case 88:
-#line 1109 "parse.y" /* yacc.c:1646  */
+#line 1101 "parse.y" /* yacc.c:1646  */
     { CCL_NEG_EXPR(isdigit); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 48 58 256\">");
  }
-#line 2713 "parse.c" /* yacc.c:1646  */
+#line 2704 "parse.c" /* yacc.c:1646  */
     break;
 
   case 89:
-#line 1113 "parse.y" /* yacc.c:1646  */
+#line 1105 "parse.y" /* yacc.c:1646  */
     { CCL_NEG_EXPR(isgraph); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 33 127 256\">");
  }
-#line 2722 "parse.c" /* yacc.c:1646  */
+#line 2713 "parse.c" /* yacc.c:1646  */
     break;
 
   case 90:
-#line 1117 "parse.y" /* yacc.c:1646  */
+#line 1109 "parse.y" /* yacc.c:1646  */
     { CCL_NEG_EXPR(isprint); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 32 127 256\">");
  }
-#line 2731 "parse.c" /* yacc.c:1646  */
+#line 2722 "parse.c" /* yacc.c:1646  */
     break;
 
   case 91:
-#line 1121 "parse.y" /* yacc.c:1646  */
+#line 1113 "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 2740 "parse.c" /* yacc.c:1646  */
+#line 2731 "parse.c" /* yacc.c:1646  */
     break;
 
   case 92:
-#line 1125 "parse.y" /* yacc.c:1646  */
+#line 1117 "parse.y" /* yacc.c:1646  */
     { CCL_NEG_EXPR(isspace); /*}*/
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 32 33 256\">");
  }
-#line 2749 "parse.c" /* yacc.c:1646  */
+#line 2740 "parse.c" /* yacc.c:1646  */
     break;
 
   case 93:
-#line 1129 "parse.y" /* yacc.c:1646  */
+#line 1121 "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 2758 "parse.c" /* yacc.c:1646  */
+#line 2749 "parse.c" /* yacc.c:1646  */
     break;
 
   case 94:
-#line 1133 "parse.y" /* yacc.c:1646  */
+#line 1125 "parse.y" /* yacc.c:1646  */
     { 
                                if ( sf_case_ins() )
                                        lwarn(_("[:^lower:] is ambiguous in case insensitive scanner"));
@@ -2797,11 +2788,11 @@ yyreduce:
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 97 123 256\">");
                                }
-#line 2771 "parse.c" /* yacc.c:1646  */
+#line 2762 "parse.c" /* yacc.c:1646  */
     break;
 
   case 95:
-#line 1141 "parse.y" /* yacc.c:1646  */
+#line 1133 "parse.y" /* yacc.c:1646  */
     {
                                if ( sf_case_ins() )
                                        lwarn(_("[:^upper:] ambiguous in case insensitive scanner"));
@@ -2810,11 +2801,11 @@ yyreduce:
  insert_after(0, "</RegexCharacter>");
  insert_before(0, "<RegexCharacter char_set=\"0 65 91 256\">");
                                }
-#line 2784 "parse.c" /* yacc.c:1646  */
+#line 2775 "parse.c" /* yacc.c:1646  */
     break;
 
   case 96:
-#line 1152 "parse.y" /* yacc.c:1646  */
+#line 1144 "parse.y" /* yacc.c:1646  */
     {
                        if ( (yyvsp[0]) == nlch )
                                rule_has_nl[num_rules] = true;
@@ -2830,19 +2821,19 @@ yyreduce:
  insert_after(1, "</RegexSequence>");
  insert_before(0, "<RegexSequence>");
                        }
-#line 2804 "parse.c" /* yacc.c:1646  */
+#line 2795 "parse.c" /* yacc.c:1646  */
     break;
 
   case 97:
-#line 1169 "parse.y" /* yacc.c:1646  */
+#line 1161 "parse.y" /* yacc.c:1646  */
     { (yyval) = mkstate( SYM_EPSILON ); /*}*/
  insert_before(0, "<RegexEmpty />");
  }
-#line 2812 "parse.c" /* yacc.c:1646  */
+#line 2803 "parse.c" /* yacc.c:1646  */
     break;
 
 
-#line 2816 "parse.c" /* yacc.c:1646  */
+#line 2807 "parse.c" /* yacc.c:1646  */
       default: break;
     }
  int i;
@@ -3087,7 +3078,7 @@ yyreturn:
 #endif
   return yyresult;
 }
-#line 1175 "parse.y" /* yacc.c:1906  */
+#line 1167 "parse.y" /* yacc.c:1906  */
 
 
 
index 24c13c8..38f213e 100644 (file)
@@ -433,8 +433,9 @@ sconname    :  NAME
                        }
                ;
 
-/* this rule handles trailing context, we will arrange things so that the thing
- * to be returned is always in a group, whereas any trailing context is outside
+/* this rule handles trailing context, it must produce two separate regexes,
+ * where the first is the expression to be matched, and the second is the
+ * trailing context, RegexEmpty (matches empty string) if no trailing context
  */
 rule           :  re2 re
                        {
@@ -490,8 +491,6 @@ rule                :  re2 re
                                trailcnt = rulelen;
 
                        $$ = link_machines( $1, $2 );
- insert_after(1, "</RegexSequence>");
- insert_before(0, "<RegexSequence>");
                        }
 
                |  re2 re '$'
@@ -538,12 +537,8 @@ rule               :  re2 re
                        eps = mkstate( SYM_EPSILON );
                        $$ = link_machines( $1,
                                link_machines( eps, mkstate( '\n' ) ) );
- insert_after(1, "</RegexSequence>");
  insert_after(1, "</RegexCharacter>");
  insert_before(1, "<RegexCharacter char_set=\"10 11\">");
- insert_after(0, "</RegexGroup>");
- insert_before(0, "<RegexGroup>");
- insert_before(0, "<RegexSequence>");
                        }
 
                |  re
@@ -560,8 +555,7 @@ rule                :  re2 re
                                else
                                        trailcnt = rulelen;
                                }
- insert_after(0, "</RegexGroup>");
- insert_before(0, "<RegexGroup>");
+ insert_after(1, "<RegexEmpty />");
                        }
                ;
 
@@ -603,8 +597,6 @@ re2         :  re '/'
 
                        current_state_type = STATE_TRAILING_CONTEXT;
                        $$ = $1;
- insert_after(0, "</RegexGroup>");
- insert_before(0, "<RegexGroup>");
                        }
                ;