]> granicus.if.org Git - onig/commitdiff
refactoring
authorK.Kosako <kosako@sofnec.co.jp>
Wed, 13 Sep 2017 08:12:06 +0000 (17:12 +0900)
committerK.Kosako <kosako@sofnec.co.jp>
Wed, 13 Sep 2017 08:12:06 +0000 (17:12 +0900)
src/regcomp.c
src/regexec.c
src/regint.h

index ab5701c7b5cdc1f81e9ad278e2a7aa890b9e25ae..e3753e02d51149a58804f0446f310215376e6f1c 100644 (file)
@@ -1357,7 +1357,7 @@ compile_length_enclosure_node(EnclosureNode* node, regex_t* reg)
         + SIZE_OP_PUSH + tlen + SIZE_OP_POP + SIZE_OP_JUMP;
     }
     else {
-      len = SIZE_OP_PUSH_STOP_BT + tlen + SIZE_OP_POP_STOP_BT;
+      len = SIZE_OP_ATOMIC_START + tlen + SIZE_OP_ATOMIC_END;
     }
     break;
 
@@ -1370,7 +1370,7 @@ compile_length_enclosure_node(EnclosureNode* node, regex_t* reg)
       len = compile_length_tree(cond, reg);
       if (len < 0) return len;
       len += SIZE_OP_PUSH;
-      len += SIZE_OP_PUSH_STOP_BT + SIZE_OP_POP_STOP_BT;
+      len += SIZE_OP_ATOMIC_START + SIZE_OP_ATOMIC_END;
 
       if (IS_NOT_NULL(Then)) {
         tlen = compile_length_tree(Then, reg);
@@ -1511,11 +1511,11 @@ compile_enclosure_node(EnclosureNode* node, regex_t* reg, ScanEnv* env)
              -((int )SIZE_OP_PUSH + len + (int )SIZE_OP_POP + (int )SIZE_OP_JUMP));
     }
     else {
-      r = add_opcode(reg, OP_PUSH_STOP_BT);
+      r = add_opcode(reg, OP_ATOMIC_START);
       if (r != 0) return r;
       r = compile_tree(NODE_ENCLOSURE_BODY(node), reg, env);
       if (r != 0) return r;
-      r = add_opcode(reg, OP_POP_STOP_BT);
+      r = add_opcode(reg, OP_ATOMIC_END);
     }
     break;
 
@@ -1526,7 +1526,7 @@ compile_enclosure_node(EnclosureNode* node, regex_t* reg, ScanEnv* env)
       Node* Then = node->te.Then;
       Node* Else = node->te.Else;
 
-      r = add_opcode(reg, OP_PUSH_STOP_BT);
+      r = add_opcode(reg, OP_ATOMIC_START);
       if (r != 0) return r;
 
       cond_len = compile_length_tree(cond, reg);
@@ -1538,14 +1538,14 @@ compile_enclosure_node(EnclosureNode* node, regex_t* reg, ScanEnv* env)
       else
         then_len = 0;
 
-      jump_len = cond_len + then_len + SIZE_OP_POP_STOP_BT;
+      jump_len = cond_len + then_len + SIZE_OP_ATOMIC_END;
       if (IS_NOT_NULL(Else)) jump_len += SIZE_OP_JUMP;
 
       r = add_opcode_rel_addr(reg, OP_PUSH, jump_len);
       if (r != 0) return r;
       r = compile_tree(cond, reg, env);
       if (r != 0) return r;
-      r = add_opcode(reg, OP_POP_STOP_BT);
+      r = add_opcode(reg, OP_ATOMIC_END);
       if (r != 0) return r;
 
       if (IS_NOT_NULL(Then)) {
@@ -6777,8 +6777,8 @@ OnigOpInfoType OnigOpInfo[] = {
   { OP_PREC_READ_END,        "pop-pos",              ARG_NON },
   { OP_PUSH_PREC_READ_NOT,   "push-prec-read-not",   ARG_RELADDR },
   { OP_FAIL_PREC_READ_NOT,   "fail-prec-read-not",   ARG_NON },
-  { OP_PUSH_STOP_BT,         "push-stop-bt",         ARG_NON },
-  { OP_POP_STOP_BT,          "pop-stop-bt",          ARG_NON },
+  { OP_ATOMIC_START,         "atomic-start",         ARG_NON },
+  { OP_ATOMIC_END,           "atomic-end",           ARG_NON },
   { OP_LOOK_BEHIND,          "look-behind",          ARG_SPECIAL },
   { OP_PUSH_LOOK_BEHIND_NOT, "push-look-behind-not", ARG_SPECIAL },
   { OP_FAIL_LOOK_BEHIND_NOT, "fail-look-behind-not", ARG_NON },
index 411261a85ed1d0513ec1dd3d96455693719c730c..ea6a7f850c9d2eb695fd3c7b4c0bf46fa4969ffe 100644 (file)
@@ -2963,13 +2963,13 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
       goto fail;
       break;
 
-    case OP_PUSH_STOP_BT:  MOP_IN(OP_PUSH_STOP_BT);
+    case OP_ATOMIC_START:  MOP_IN(OP_ATOMIC_START);
       STACK_PUSH_STOP_BACKTRACK;
       MOP_OUT;
       continue;
       break;
 
-    case OP_POP_STOP_BT:  MOP_IN(OP_POP_STOP_BT);
+    case OP_ATOMIC_END:  MOP_IN(OP_ATOMIC_END);
       STACK_STOP_BACKTRACK_END;
       MOP_OUT;
       continue;
index 9dc1723e2fbe098864838e03286f20b954306c4e..d478955f96771357e31002cc93f71f229ec6d7ab 100644 (file)
@@ -569,8 +569,8 @@ enum OpCode {
   OP_PREC_READ_END,              /* (?=...)  end   */
   OP_PUSH_PREC_READ_NOT,   /* (?!...)  start */
   OP_FAIL_PREC_READ_NOT,   /* (?!...)  end   */
-  OP_PUSH_STOP_BT,         /* (?>...)  start */
-  OP_POP_STOP_BT,          /* (?>...)  end   */
+  OP_ATOMIC_START,         /* (?>...)  start */
+  OP_ATOMIC_END,           /* (?>...)  end   */
   OP_LOOK_BEHIND,          /* (?<=...) start (no needs end opcode) */
   OP_PUSH_LOOK_BEHIND_NOT, /* (?<!...) start */
   OP_FAIL_LOOK_BEHIND_NOT, /* (?<!...) end   */
@@ -675,8 +675,8 @@ typedef int ModeType;
 #define SIZE_OP_MEMORY_END_PUSH_REC    (SIZE_OPCODE + SIZE_MEMNUM)
 #define SIZE_OP_MEMORY_END             (SIZE_OPCODE + SIZE_MEMNUM)
 #define SIZE_OP_MEMORY_END_REC         (SIZE_OPCODE + SIZE_MEMNUM)
-#define SIZE_OP_PUSH_STOP_BT            SIZE_OPCODE
-#define SIZE_OP_POP_STOP_BT             SIZE_OPCODE
+#define SIZE_OP_ATOMIC_START            SIZE_OPCODE
+#define SIZE_OP_ATOMIC_END              SIZE_OPCODE
 #define SIZE_OP_EMPTY_CHECK_START       (SIZE_OPCODE + SIZE_MEMNUM)
 #define SIZE_OP_EMPTY_CHECK_END         (SIZE_OPCODE + SIZE_MEMNUM)
 #define SIZE_OP_LOOK_BEHIND            (SIZE_OPCODE + SIZE_LENGTH)