]> granicus.if.org Git - onig/commitdiff
add (*FAIL_COUNT)
authorK.Kosako <kosako@sofnec.co.jp>
Mon, 26 Feb 2018 02:04:07 +0000 (11:04 +0900)
committerK.Kosako <kosako@sofnec.co.jp>
Mon, 26 Feb 2018 02:04:07 +0000 (11:04 +0900)
sample/count.c
src/regexec.c

index c49972e1a92ff6e65bab6d75e8e759082f1efe28..e0ac8b18ae0f99f8fca20cd956e29106f7f3fbcf 100644 (file)
@@ -94,6 +94,7 @@ extern int main(int argc, char* argv[])
 
   test("abc(.(*COUNT[x]))*(*FAIL)", "abcdefg");
   test("abc(.(*COUNT[_any_]))*(.(*COUNT[x]))*d", "abcdefg");
+  test("abc(.(*FAIL_COUNT[x]))*f", "abcdefg");
 
   onig_end();
   return 0;
index ab8c6a7d2d564aadd37a2276dcc8f98d3b25ffd7..6366277e53a190823508f6de091d3a02217eb953 100644 (file)
@@ -5281,6 +5281,14 @@ onig_initialize_builtin_callouts(void)
   if (id < 0) return id;\
 } while(0)
 
+#define BS0_RETRACTION(name, func)  do {\
+    id = onig_set_callout_of_name(enc, ONIG_CALLOUT_TYPE_SINGLE,\
+                              (UChar* )#name, (UChar* )(#name + strlen(#name)), \
+                              ONIG_CALLOUT_IN_RETRACTION,\
+                              onig_builtin_ ## func, 0, 0, 0, 0, 0);\
+  if (id < 0) return id;\
+} while(0)
+
 #define BS1(name, func, ts)  do {\
     id = onig_set_callout_of_name(enc, ONIG_CALLOUT_TYPE_SINGLE,\
                               (UChar* )#name, (UChar* )(#name + strlen(#name)), \
@@ -5301,6 +5309,7 @@ onig_initialize_builtin_callouts(void)
   BS0(ABORT,   abort);
   BS1(ERROR, error, &t_int);
   BS0(COUNT,   count);
+  BS0_RETRACTION(FAIL_COUNT, count);
 
   return ONIG_NORMAL;
 #endif /* USE_CALLOUT */