[Pcre-svn] [1104] code/trunk: Make pcre2_match() return (*MA…

Page principale
Supprimer ce message
Auteur: Subversion repository
Date:  
À: pcre-svn
Sujet: [Pcre-svn] [1104] code/trunk: Make pcre2_match() return (*MARK) names from successful conditional assertions,
Revision: 1104
          http://www.exim.org/viewvc/pcre2?view=rev&revision=1104
Author:   ph10
Date:     2019-06-13 17:49:40 +0100 (Thu, 13 Jun 2019)
Log Message:
-----------
Make pcre2_match() return (*MARK) names from successful conditional assertions, 
as Perl and the JIT do.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/pcre2_match.c
    code/trunk/testdata/testinput1
    code/trunk/testdata/testoutput1


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2019-06-13 16:00:11 UTC (rev 1103)
+++ code/trunk/ChangeLog    2019-06-13 16:49:40 UTC (rev 1104)
@@ -35,6 +35,9 @@


    * When no minimum length is set by the normal scan, but a first and/or last 
      code unit is recorded, set the minimum to 1 or 2 as appropriate.
+     
+10. A (*MARK) value inside a successful condition was not being returned by the 
+interpretive matcher (it was returned by JIT). This bug has been mended.



Version 10.33 16-April-2019

Modified: code/trunk/src/pcre2_match.c
===================================================================
--- code/trunk/src/pcre2_match.c    2019-06-13 16:00:11 UTC (rev 1103)
+++ code/trunk/src/pcre2_match.c    2019-06-13 16:49:40 UTC (rev 1104)
@@ -5472,9 +5472,9 @@


       /* If we are at the end of an assertion that is a condition, return a
       match, discarding any intermediate backtracking points. Copy back the
-      captures into the frame before N so that they are set on return. Doing
-      this for all assertions, both positive and negative, seems to match what
-      Perl does. */
+      mark setting and the captures into the frame before N so that they are
+      set on return. Doing this for all assertions, both positive and negative,
+      seems to match what Perl does. */


       if (GF_IDMASK(N->group_frame_type) == GF_CONDASSERT)
         {
@@ -5481,6 +5481,7 @@
         memcpy((char *)P + offsetof(heapframe, ovector), Fovector,
           Foffset_top * sizeof(PCRE2_SIZE));
         P->offset_top = Foffset_top;
+        P->mark = Fmark;
         Fback_frame = (char *)F - (char *)P;
         RRETURN(MATCH_MATCH);
         }


Modified: code/trunk/testdata/testinput1
===================================================================
--- code/trunk/testdata/testinput1    2019-06-13 16:00:11 UTC (rev 1103)
+++ code/trunk/testdata/testinput1    2019-06-13 16:49:40 UTC (rev 1104)
@@ -6343,4 +6343,12 @@
 /(?&word)*  \. (?<word> \w+ )/xi
     pokus.hokus


+/a(?(?=(*:2)b).)/mark
+    abc
+    acb     
+
+/a(?(?!(*:2)b).)/mark
+    acb
+    abc     
+
 # End of testinput1 


Modified: code/trunk/testdata/testoutput1
===================================================================
--- code/trunk/testdata/testoutput1    2019-06-13 16:00:11 UTC (rev 1103)
+++ code/trunk/testdata/testoutput1    2019-06-13 16:49:40 UTC (rev 1104)
@@ -10049,4 +10049,18 @@
  0: pokus.hokus
  1: hokus


+/a(?(?=(*:2)b).)/mark
+    abc
+ 0: ab
+MK: 2
+    acb     
+ 0: a
+
+/a(?(?!(*:2)b).)/mark
+    acb
+ 0: ac
+    abc     
+ 0: a
+MK: 2
+
 # End of testinput1