[前][次][番号順一覧][スレッド一覧]

ruby-changes:45531

From: naruse <ko1@a...>
Date: Sun, 12 Feb 2017 00:08:39 +0900 (JST)
Subject: [ruby-changes:45531] naruse:r57603 (trunk): Merge Onigmo 6.1.1

naruse	2017-02-12 00:08:33 +0900 (Sun, 12 Feb 2017)

  New Revision: 57603

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57603

  Log:
    Merge Onigmo 6.1.1
    
    * Support absent operator https://github.com/k-takata/Onigmo/issues/82
    * https://github.com/k-takata/Onigmo/blob/Onigmo-6.1.1/HISTORY

  Modified files:
    trunk/NEWS
    trunk/include/ruby/onigmo.h
    trunk/regcomp.c
    trunk/regenc.c
    trunk/regexec.c
    trunk/regint.h
    trunk/regparse.c
    trunk/regparse.h
Index: regenc.c
===================================================================
--- regenc.c	(revision 57602)
+++ regenc.c	(revision 57603)
@@ -54,11 +54,11 @@ onigenc_set_default_encoding(OnigEncodin https://github.com/ruby/ruby/blob/trunk/regenc.c#L54
 extern int
 onigenc_mbclen_approximate(const OnigUChar* p,const OnigUChar* e, OnigEncoding enc)
 {
-  int ret = ONIGENC_PRECISE_MBC_ENC_LEN(enc,p,e);
+  int ret = ONIGENC_PRECISE_MBC_ENC_LEN(enc, p, e);
   if (ONIGENC_MBCLEN_CHARFOUND_P(ret))
     return ONIGENC_MBCLEN_CHARFOUND_LEN(ret);
   else if (ONIGENC_MBCLEN_NEEDMORE_P(ret))
-    return (int)(e-p)+ONIGENC_MBCLEN_NEEDMORE_LEN(ret);
+    return (int )(e - p) + ONIGENC_MBCLEN_NEEDMORE_LEN(ret);
   return 1;
 }
 
Index: regexec.c
===================================================================
--- regexec.c	(revision 57602)
+++ regexec.c	(revision 57603)
@@ -403,6 +403,8 @@ onig_region_copy(OnigRegion* to, const O https://github.com/ruby/ruby/blob/trunk/regexec.c#L403
 #define STK_CALL_FRAME             0x0800
 #define STK_RETURN                 0x0900
 #define STK_VOID                   0x0a00  /* for fill a blank */
+#define STK_ABSENT_POS             0x0b00  /* for absent */
+#define STK_ABSENT                 0x0c00  /* absent inner loop marker */
 
 /* stack type check mask */
 #define STK_MASK_POP_USED          0x00ff
@@ -673,7 +675,8 @@ stack_double(OnigStackType** arg_stk_bas https://github.com/ruby/ruby/blob/trunk/regexec.c#L675
 #define STACK_PUSH_ALT(pat,s,sprev,keep)     STACK_PUSH(STK_ALT,pat,s,sprev,keep)
 #define STACK_PUSH_POS(s,sprev,keep)         STACK_PUSH(STK_POS,NULL_UCHARP,s,sprev,keep)
 #define STACK_PUSH_POS_NOT(pat,s,sprev,keep) STACK_PUSH(STK_POS_NOT,pat,s,sprev,keep)
-#define STACK_PUSH_STOP_BT              STACK_PUSH_TYPE(STK_STOP_BT)
+#define STACK_PUSH_ABSENT                    STACK_PUSH_TYPE(STK_ABSENT)
+#define STACK_PUSH_STOP_BT                   STACK_PUSH_TYPE(STK_STOP_BT)
 #define STACK_PUSH_LOOK_BEHIND_NOT(pat,s,sprev,keep) \
         STACK_PUSH(STK_LOOK_BEHIND_NOT,pat,s,sprev,keep)
 
@@ -785,6 +788,14 @@ stack_double(OnigStackType** arg_stk_bas https://github.com/ruby/ruby/blob/trunk/regexec.c#L788
   STACK_INC;\
 } while(0)
 
+#define STACK_PUSH_ABSENT_POS(start, end) do {\
+  STACK_ENSURE(1);\
+  stk->type = STK_ABSENT_POS;\
+  stk->u.absent_pos.abs_pstr = (start);\
+  stk->u.absent_pos.end_pstr = (end);\
+  STACK_INC;\
+} while(0)
+
 
 #ifdef ONIG_DEBUG
 # define STACK_BASE_CHECK(p, at) \
@@ -885,6 +896,33 @@ stack_double(OnigStackType** arg_stk_bas https://github.com/ruby/ruby/blob/trunk/regexec.c#L896
   }\
 } while(0)
 
+#define STACK_POP_TIL_ABSENT  do {\
+  while (1) {\
+    stk--;\
+    STACK_BASE_CHECK(stk, "STACK_POP_TIL_ABSENT"); \
+    if (stk->type == STK_ABSENT) break;\
+    else if (stk->type == STK_MEM_START) {\
+      mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\
+      mem_end_stk[stk->u.mem.num]   = stk->u.mem.end;\
+    }\
+    else if (stk->type == STK_REPEAT_INC) {\
+      STACK_AT(stk->u.repeat_inc.si)->u.repeat.count--;\
+    }\
+    else if (stk->type == STK_MEM_END) {\
+      mem_start_stk[stk->u.mem.num] = stk->u.mem.start;\
+      mem_end_stk[stk->u.mem.num]   = stk->u.mem.end;\
+    }\
+    ELSE_IF_STATE_CHECK_MARK(stk);\
+  }\
+} while(0)
+
+#define STACK_POP_ABSENT_POS(start, end) do {\
+  stk--;\
+  STACK_BASE_CHECK(stk, "STACK_POP_ABSENT_POS"); \
+  (start) = stk->u.absent_pos.abs_pstr;\
+  (end) = stk->u.absent_pos.end_pstr;\
+} while(0)
+
 #define STACK_POS_END(k) do {\
   k = stk;\
   while (1) {\
@@ -1136,10 +1174,12 @@ static int string_cmp_ic(OnigEncoding en https://github.com/ruby/ruby/blob/trunk/regexec.c#L1174
 # define DATA_ENSURE_CHECK1    (s < right_range)
 # define DATA_ENSURE_CHECK(n)  (s + (n) <= right_range)
 # define DATA_ENSURE(n)        if (s + (n) > right_range) goto fail
+# define ABSENT_END_POS        right_range
 #else
 # define DATA_ENSURE_CHECK1    (s < end)
 # define DATA_ENSURE_CHECK(n)  (s + (n) <= end)
 # define DATA_ENSURE(n)        if (s + (n) > end) goto fail
+# define ABSENT_END_POS        end
 #endif /* USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE */
 
 
@@ -1372,6 +1412,8 @@ stack_type_str(int stack_type) https://github.com/ruby/ruby/blob/trunk/regexec.c#L1412
     case STK_CALL_FRAME:	return "Call  ";
     case STK_RETURN:		return "Ret   ";
     case STK_VOID:		return "Void  ";
+    case STK_ABSENT_POS:	return "AbsPos";
+    case STK_ABSENT:		return "Absent";
     default:			return "      ";
   }
 }
@@ -1484,7 +1526,6 @@ match_at(regex_t* reg, const UChar* str, https://github.com/ruby/ruby/blob/trunk/regexec.c#L1526
     &&L_OP_END_LINE,
     &&L_OP_SEMI_END_BUF,
     &&L_OP_BEGIN_POSITION,
-    &&L_OP_BEGIN_POS_OR_LINE,    /* used for implicit anchor optimization */
 
     &&L_OP_BACKREF1,
     &&L_OP_BACKREF2,
@@ -1552,6 +1593,9 @@ match_at(regex_t* reg, const UChar* str, https://github.com/ruby/ruby/blob/trunk/regexec.c#L1593
     &&L_OP_LOOK_BEHIND,          /* (?<=...) start (no needs end opcode) */
     &&L_OP_PUSH_LOOK_BEHIND_NOT, /* (?<!...) start */
     &&L_OP_FAIL_LOOK_BEHIND_NOT, /* (?<!...) end   */
+    &&L_OP_PUSH_ABSENT_POS,      /* (?~...)  start */
+    &&L_OP_ABSENT,               /* (?~...)  start of inner loop */
+    &&L_OP_ABSENT_END,           /* (?~...)  end   */
 
 # ifdef USE_SUBEXP_CALL
     &&L_OP_CALL,                 /* \g<name> */
@@ -1636,8 +1680,8 @@ match_at(regex_t* reg, const UChar* str, https://github.com/ruby/ruby/blob/trunk/regexec.c#L1680
 #endif
 
 #ifdef ONIG_DEBUG_MATCH
-  fprintf(stderr, "match_at: str: %"PRIdPTR" (%p), end: %"PRIdPTR" (%p), start: %"PRIdPTR" (%p), sprev: %"PRIdPTR" (%p)\n",
-	  (intptr_t )str, str, (intptr_t )end, end, (intptr_t )sstart, sstart, (intptr_t )sprev, sprev);
+  fprintf(stderr, "match_at: str: %"PRIuPTR" (%p), end: %"PRIuPTR" (%p), start: %"PRIuPTR" (%p), sprev: %"PRIuPTR" (%p)\n",
+	  (uintptr_t )str, str, (uintptr_t )end, end, (uintptr_t )sstart, sstart, (uintptr_t )sprev, sprev);
   fprintf(stderr, "size: %d, start offset: %d\n",
 	  (int )(end - str), (int )(sstart - str));
   fprintf(stderr, "\n ofs> str                   stk:type   addr:opcode\n");
@@ -2378,7 +2422,6 @@ match_at(regex_t* reg, const UChar* str, https://github.com/ruby/ruby/blob/trunk/regexec.c#L2422
       JUMP;
 
     CASE(OP_BEGIN_LINE)  MOP_IN(OP_BEGIN_LINE);
-    op_begin_line:
       if (ON_STR_BEGIN(s)) {
 	if (IS_NOTBOL(msa->options)) goto fail;
 	MOP_OUT;
@@ -2454,13 +2497,6 @@ match_at(regex_t* reg, const UChar* str, https://github.com/ruby/ruby/blob/trunk/regexec.c#L2497
       MOP_OUT;
       JUMP;
 
-    CASE(OP_BEGIN_POS_OR_LINE)  MOP_IN(OP_BEGIN_POS_OR_LINE);
-      if (s != msa->gpos)
-	goto op_begin_line;
-
-      MOP_OUT;
-      JUMP;
-
     CASE(OP_MEMORY_START_PUSH)  MOP_IN(OP_MEMORY_START_PUSH);
       GET_MEMNUM_INC(mem, p);
       STACK_PUSH_MEM_START(mem, s);
@@ -2721,8 +2757,8 @@ match_at(regex_t* reg, const UChar* str, https://github.com/ruby/ruby/blob/trunk/regexec.c#L2757
 	STACK_NULL_CHECK(isnull, mem, s);
 	if (isnull) {
 #ifdef ONIG_DEBUG_MATCH
-	  fprintf(stderr, "NULL_CHECK_END: skip  id:%d, s:%"PRIdPTR" (%p)\n",
-		  (int )mem, (intptr_t )s, s);
+	  fprintf(stderr, "NULL_CHECK_END: skip  id:%d, s:%"PRIuPTR" (%p)\n",
+		  (int )mem, (uintptr_t )s, s);
 #endif
 	null_check_found:
 	  /* empty loop founded, skip next instruction */
@@ -2755,8 +2791,8 @@ match_at(regex_t* reg, const UChar* str, https://github.com/ruby/ruby/blob/trunk/regexec.c#L2791
 	STACK_NULL_CHECK_MEMST(isnull, mem, s, reg);
 	if (isnull) {
 # ifdef ONIG_DEBUG_MATCH
-	  fprintf(stderr, "NULL_CHECK_END_MEMST: skip  id:%d, s:%"PRIdPTR" (%p)\n",
-		  (int )mem, (intptr_t )s, s);
+	  fprintf(stderr, "NULL_CHECK_END_MEMST: skip  id:%d, s:%"PRIuPTR" (%p)\n",
+		  (int )mem, (uintptr_t )s, s);
 # endif
 	  if (isnull == -1) goto fail;
 	  goto null_check_found;
@@ -2780,8 +2816,8 @@ match_at(regex_t* reg, const UChar* str, https://github.com/ruby/ruby/blob/trunk/regexec.c#L2816
 # endif
 	if (isnull) {
 # ifdef ONIG_DEBUG_MATCH
-	  fprintf(stderr, "NULL_CHECK_END_MEMST_PUSH: skip  id:%d, s:%"PRIdPTR" (%p)\n",
-		  (int )mem, (intptr_t )s, s);
+	  fprintf(stderr, "NULL_CHECK_END_MEMST_PUSH: skip  id:%d, s:%"PRIuPTR" (%p)\n",
+		  (int )mem, (uintptr_t )s, s);
 # endif
 	  if (isnull == -1) goto fail;
 	  goto null_check_found;
@@ -3033,6 +3069,63 @@ match_at(regex_t* reg, const UChar* str, https://github.com/ruby/ruby/blob/trunk/regexec.c#L3069
       goto fail;
       NEXT;
 
+    CASE(OP_PUSH_ABSENT_POS)  MOP_IN(OP_PUSH_ABSENT_POS);
+      /* Save the absent-start-pos and the original end-pos. */
+      STACK_PUSH_ABSENT_POS(s, ABSENT_END_POS);
+      MOP_OUT;
+      JUMP;
+
+    CASE(OP_ABSENT)  MOP_IN(OP_ABSENT);
+      {
+	const UChar* aend = ABSENT_END_POS;
+	UChar* absent;
+	UChar* selfp = p - 1;
+
+	STACK_POP_ABSENT_POS(absent, ABSENT_END_POS);  /* Restore end-pos. */
+	GET_RELADDR_INC(addr, p);
+#ifdef ONIG_DEBUG_MATCH
+	fprintf(stderr, "ABSENT: s:%p, end:%p, absent:%p, aend:%p\n", s, end, absent, aend);
+#endif
+	if ((absent > aend) && (s > absent)) {
+	  /* An empty match occurred in (?~...) at the start point.
+	   * Never match. */
+	  STACK_POP;
+	  goto fail;
+	}
+	else if ((s >= aend) && (s > absent)) {
+	  if (s > aend) {
+	    /* Only one (or less) character matched in the last iteration.
+	     * This is not a possible point. */
+	    goto fail;
+	  }
+	  /* All possible points were found. Try matching after (?~...). */
+	  DATA_ENSURE(0);
+	  p += addr;
+	}
+	else {
+	  STACK_PUSH_ALT(p + addr, s, sprev, pkeep); /* Push possible point. */
+	  n = enclen(encode, s, end);
+	  STACK_PUSH_ABSENT_POS(absent, ABSENT_END_POS); /* Save the original pos. */
+	  STACK_PUSH_ALT(selfp, s + n, s, pkeep); /* Next iteration. */
+	  STACK_PUSH_ABSENT;
+	  ABSENT_END_POS = aend;
+	}
+      }
+      MOP_OUT;
+      JUMP;
+
+    CASE(OP_ABSENT_END)  MOP_IN(OP_ABSENT_END);
+      /* The pattern inside (?~...) was matched.
+       * Set the end-pos temporary and go to next iteration. */
+      if (sprev < ABSENT_END_POS)
+	ABSENT_END_POS = sprev;
+#ifdef ONIG_DEBUG_MATCH
+      fprintf(stderr, "ABSENT_END: end:%p\n", ABSENT_END_POS);
+#endif
+      STACK_POP_TIL_ABSENT;
+      goto fail;
+      NEXT;
+
 #ifdef USE_SUBEXP_CALL
     CASE(OP_CALL)  MOP_IN(OP_CALL);
       GET_ABSADDR_INC(addr, p);
@@ -3270,7 +3363,7 @@ bm_search_notrev(regex_t* reg, const UCh https://github.com/ruby/ruby/blob/trunk/regexec.c#L3363
 
 # ifdef ONIG_DEBUG_SEARCH
   fprintf(stderr, "bm_search_notrev: text: %"PRIuPTR" (%p), text_end: %"PRIuPTR" (%p), text_range: %"PRIuPTR" (%p)\n",
-	  text, text, text_end, text_end, text_range, text_range);
+	  (uintptr_t )text, text, (uintptr_t )text_end, text_end, (uintptr_t )text_range, text_range);
 # endif
 
   tail = target_end - 1;
@@ -3326,8 +3419,8 @@ bm_search(regex_t* reg, const UChar* tar https://github.com/ruby/ruby/blob/trunk/regexec.c#L3419
   const UChar *tail;
 
 # ifdef ONIG_DEBUG_SEARCH
-  fprintf(stderr, "bm_search: text: %"PRIuPTR", text_end: %"PRIuPTR", text_range: %"PRIuPTR"\n",
-	  text, text_end, text_range);
+  fprintf(stderr, "bm_search: text: %"PRIuPTR" (%p), text_end: %"PRIuPTR" (%p), text_range: %"PRIuPTR" (%p)\n",
+	  (uintptr_t )text, text, (uintptr_t )text_end, text_end, (uintptr_t )text_range, text_range);
 # endif
 
   end = text_range + (target_end - target) - 1;
@@ -3482,8 +3575,8 @@ bm_search_notrev(regex_t* reg, const UCh https://github.com/ruby/ruby/blob/trunk/regexec.c#L3575
   OnigEncoding enc = reg->enc;
 
 # ifdef ONIG_DEBUG_SEARCH
-  fprintf(stderr, "bm_search_notrev: text: %"PRIdPTR" (%p), text_end: %"PRIdPTR" (%p), text_range: %"PRIdPTR" (%p)\n",
-	  (intptr_t )text, text, (intptr_t )text_end, text_end, (intptr_t )text_range, text_range);
+  fprintf(stderr, "bm_search_notrev: text: %"PRIuPTR" (%p), text_end: %"PRIuPTR" (%p), text_range: %"PRIuPTR" (%p)\n",
+	  (uintptr_t )text, text, (uintptr_t )text_end, text_end, (uintptr_t )text_range, text_range);
 # endif
 
   tail = target_end - 1;
@@ -3542,8 +3635,8 @@ bm_search(regex_t* reg, const UChar* tar https://github.com/ruby/ruby/blob/trunk/regexec.c#L3635
   ptrdiff_t tlen1;
 
 # ifdef ONIG_DEBUG_SEARCH
-  fprintf(stderr, "bm_search: text: %"PRIuPTR", text_end: %"PRIuPTR", text_range: %"PRIuPTR"\n",
-	  text, text_end, text_range);
+  fprintf(stderr, "bm_search: text: %"PRIuPTR" (%p), text_end: %"PRIuPTR" (%p), text_range: %"PRIuPTR" (%p)\n",
+	  (uintptr_t )text, text, (uintptr_t )text_end, text_end, (uintptr_t )text_range, text_range);
 # endif
 
   tail = target_end - 1;
@@ -3595,8 +3688,8 @@ bm_search_notrev_ic(regex_t* reg, const https://github.com/ruby/ruby/blob/trunk/regexec.c#L3688
   int case_fold_flag = reg->case_fold_flag;
 
 # ifdef ONIG_DEBUG_SEARCH
-  fprintf(stderr, "bm_search_notrev_ic: text: %"PRIdPTR" (%p), text_end: %"PRIdPTR" (%p), text_range: %"PRIdPTR" (%p)\n",
-	  (intptr_t )text, text, (intptr_t )text_end, text_end, (intptr_t )text_range, text_range);
+  fprintf(stderr, "bm_search_notrev_ic: text: %"PRIuPTR" (%p), text_end: %"PRIuPTR" (%p), text_range: %"PRIuPTR" (%p)\n",
+	  (uintptr_t )text, text, (uintptr_t )text_end, text_end, (uintptr_t )text_range, text_range);
 # endif
 
   tail = target_end - 1;
@@ -3653,8 +3746,8 @@ bm_search_ic(regex_t* reg, const UChar* https://github.com/ruby/ruby/blob/trunk/regexec.c#L3746
   int case_fold_flag = reg->case_fold_flag;
 
 # ifdef ONIG_DEBUG_SEARCH
-  fprintf(stderr, "bm_search_ic: text: %"PRIdPTR" (%p), text_end: %"PRIdPTR" (%p), text_range: %"PRIdPTR" (%p)\n",
-	  (intptr_t )text, text, (intptr_t )text_end, text_end, (intptr_t )text_range, text_range);
+  fprintf(stderr, "bm_search_ic: text: %"PRIuPTR" (%p), text_end: %"PRIuPTR" (%p), text_range: %"PRIuPTR" (%p)\n",
+	  (uintptr_t )text, text, (uintptr_t )text_end, text_end, (uintptr_t )text_range, text_range);
 # endif
 
   tail = target_end - 1;
@@ -3814,7 +3907,7 @@ forward_search_range(regex_t* reg, const https://github.com/ruby/ruby/blob/trunk/regexec.c#L3907
 
 #ifdef ONIG_DEBUG_SEARCH
   fprintf(stderr, "forward_search_range: str: %"PRIuPTR" (%p), end: %"PRIuPTR" (%p), s: %"PRIuPTR" (%p), range: %"PRIuPTR" (%p)\n",
-	  (intptr_t )str, str, (intptr_t )end, end, (intptr_t )s, s, (intptr_t )range, range);
+	  (uintptr_t )str, str, (uintptr_t )end, end, (uintptr_t )s, s, (uintptr_t )range, range);
 #endif
 
   p = s;
@@ -4068,7 +4161,7 @@ onig_search_gpos(regex_t* reg, const UCh https://github.com/ruby/ruby/blob/trunk/regexec.c#L4161
 #ifdef ONIG_DEBUG_SEARCH
   fprintf(stderr,
      "onig_search (entry point): str: %"PRIuPTR" (%p), end: %"PRIuPTR", start: %"PRIuPTR", range: %"PRIuPTR"\n",
-     (intptr_t )str, str, end - str, start - str, range - str);
+     (uintptr_t )str, str, end - str, start - str, range - str);
 #endif
 
   if (region) {
@@ -4302,8 +4395,6 @@ onig_search_gpos(regex_t* reg, const UCh https://github.com/ruby/ruby/blob/trunk/regexec.c#L4395
 
 	if ((reg->anchor & ANCHOR_ANYCHAR_STAR) != 0) {
 	  do {
-	    if ((reg->anchor & ANCHOR_BEGIN_POSITION) == 0)
-	      msa.gpos = s;     /* move \G position */
 	    MATCH_AND_RETURN_CHECK(orig_range);
 	    prev = s;
 	    s += enclen(reg->enc, s, end);
Index: include/ruby/onigmo.h
===================================================================
--- include/ruby/onigmo.h	(revision 57602)
+++ include/ruby/onigmo.h	(revision 57603)
@@ -5,7 +5,7 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/onigmo.h#L5
 **********************************************************************/
 /*-
  * Copyright (c) 2002-2009  K.Kosako  <sndgk393 AT ybb DOT ne DOT jp>
- * Copyright (c) 2011-2016  K.Takata  <kentkt AT csc DOT jp>
+ * Copyright (c) 2011-2017  K.Takata  <kentkt AT csc DOT jp>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,8 +38,8 @@ extern "C" { https://github.com/ruby/ruby/blob/trunk/include/ruby/onigmo.h#L38
 #endif
 
 #define ONIGMO_VERSION_MAJOR   6
-#define ONIGMO_VERSION_MINOR   0
-#define ONIGMO_VERSION_TEENY   0
+#define ONIGMO_VERSION_MINOR   1
+#define ONIGMO_VERSION_TEENY   1
 
 #ifndef ONIG_EXTERN
 # ifdef RUBY_EXTERN
@@ -580,7 +580,8 @@ ONIG_EXTERN const OnigSyntaxType*   Onig https://github.com/ruby/ruby/blob/trunk/include/ruby/onigmo.h#L580
 #define ONIG_SYN_OP2_QMARK_VBAR_BRANCH_RESET    (1U<<28) /* (?|...) */         /* NOTIMPL */
 #define ONIG_SYN_OP2_QMARK_LPAREN_CONDITION     (1U<<29) /* (?(cond)yes...|no...) */
 #define ONIG_SYN_OP2_QMARK_CAPITAL_P_NAMED_GROUP (1U<<30) /* (?P<name>...), (?P=name), (?P>name) -- Python/PCRE */
-#define ONIG_SYN_OP2_OPTION_JAVA                (1U<<31) /* (?idmsux), (?-idmsux) */ /* NOTIMPL */
+#define ONIG_SYN_OP2_QMARK_TILDE_ABSENT         (1U<<31) /* (?~...) */
+/* #define ONIG_SYN_OP2_OPTION_JAVA                (1U<<xx) */ /* (?idmsux), (?-idmsux) */ /* NOTIMPL */
 
 /* syntax (behavior) */
 #define ONIG_SYN_CONTEXT_INDEP_ANCHORS           (1U<<31) /* not implemented */
@@ -824,7 +825,7 @@ int onig_new(OnigRegex*, const OnigUChar https://github.com/ruby/ruby/blob/trunk/include/ruby/onigmo.h#L825
 ONIG_EXTERN
 int onig_reg_init(OnigRegex reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, const OnigSyntaxType* syntax);
 ONIG_EXTERN
-int onig_new_without_alloc(OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo);
+int onig_new_without_alloc(OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, const OnigSyntaxType* syntax, OnigErrorInfo* einfo);
 ONIG_EXTERN
 int onig_new_deluxe(OnigRegex* reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo);
 ONIG_EXTERN
Index: regint.h
===================================================================
--- regint.h	(revision 57602)
+++ regint.h	(revision 57603)
@@ -202,7 +202,9 @@ https://github.com/ruby/ruby/blob/trunk/regint.h#L202
 #define xmemcpy     memcpy
 #define xmemmove    memmove
 
-#if defined(RUBY_MSVCRT_VERSION) && RUBY_MSVCRT_VERSION >= 90 && !defined(__GNUC__)
+#if ((defined(RUBY_MSVCRT_VERSION) && RUBY_MSVCRT_VERSION >= 90) \
+        || (!defined(RUBY_MSVCRT_VERSION) && defined(_WIN32))) \
+    && !defined(__GNUC__)
 # define xalloca     _alloca
 # define xvsnprintf(buf,size,fmt,args)  _vsnprintf_s(buf,size,_TRUNCATE,fmt,args)
 # define xsnprintf   sprintf_s
@@ -598,7 +600,6 @@ enum OpCode { https://github.com/ruby/ruby/blob/trunk/regint.h#L600
   OP_END_LINE,
   OP_SEMI_END_BUF,
   OP_BEGIN_POSITION,
-  OP_BEGIN_POS_OR_LINE,   /* used for implicit anchor optimization */
 
   OP_BACKREF1,
   OP_BACKREF2,
@@ -643,6 +644,9 @@ enum OpCode { https://github.com/ruby/ruby/blob/trunk/regint.h#L644
   OP_LOOK_BEHIND,          /* (?<=...) start (no needs end opcode) */
   OP_PUSH_LOOK_BEHIND_NOT, /* (?<!...) start */
   OP_FAIL_LOOK_BEHIND_NOT, /* (?<!...) end   */
+  OP_PUSH_ABSENT_POS,      /* (?~...)  start */
+  OP_ABSENT,               /* (?~...)  start of inner loop */
+  OP_ABSENT_END,           /* (?~...)  end   */
 
   OP_CALL,                 /* \g<name> */
   OP_RETURN,
@@ -730,6 +734,9 @@ typedef void* PointerType; https://github.com/ruby/ruby/blob/trunk/regint.h#L734
 #define SIZE_OP_CALL                   (SIZE_OPCODE + SIZE_ABSADDR)
 #define SIZE_OP_RETURN                  SIZE_OPCODE
 #define SIZE_OP_CONDITION              (SIZE_OPCODE + SIZE_MEMNUM + SIZE_RELADDR)
+#define SIZE_OP_PUSH_ABSENT_POS         SIZE_OPCODE
+#define SIZE_OP_ABSENT                 (SIZE_OPCODE + SIZE_RELADDR)
+#define SIZE_OP_ABSENT_END              SIZE_OPCODE
 
 #ifdef USE_COMBINATION_EXPLOSION_CHECK
 # define SIZE_OP_STATE_CHECK           (SIZE_OPCODE + SIZE_STATE_CHECK_NUM)
@@ -841,6 +848,10 @@ typedef struct _OnigStackType { https://github.com/ruby/ruby/blob/trunk/regint.h#L848
       UChar *pstr;       /* string position */
     } call_frame;
 #endif
+    struct {
+      UChar *a (... truncated)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]