]> granicus.if.org Git - onig/commitdiff
refactoring
authorK.Kosako <kosako@sofnec.co.jp>
Mon, 21 Aug 2017 02:20:05 +0000 (11:20 +0900)
committerK.Kosako <kosako@sofnec.co.jp>
Mon, 21 Aug 2017 02:20:05 +0000 (11:20 +0900)
src/regcomp.c
src/regexec.c
src/regint.h
src/regparse.c

index 77a4f2d6c1e25e863d5f0f4eb971fbdfa1aa67d1..c1696e81ab3134cd5a584742297b318de381f436 100644 (file)
@@ -1596,7 +1596,7 @@ compile_length_anchor_node(AnchorNode* node, regex_t* reg)
     break;
 
   case ANCHOR_WORD_BOUND:
-  case ANCHOR_NOT_WORD_BOUND:
+  case ANCHOR_NO_WORD_BOUND:
 #ifdef USE_WORD_BEGIN_END
   case ANCHOR_WORD_BEGIN:
   case ANCHOR_WORD_END:
@@ -1634,8 +1634,8 @@ compile_anchor_node(AnchorNode* node, regex_t* reg, ScanEnv* env)
     r = add_mode(reg, (ModeType )node->ascii_mode);
     break;
 
-  case ANCHOR_NOT_WORD_BOUND:
-    op = OP_NOT_WORD_BOUND; goto word;
+  case ANCHOR_NO_WORD_BOUND:
+    op = OP_NO_WORD_BOUND; goto word;
     break;
 #ifdef USE_WORD_BEGIN_END
   case ANCHOR_WORD_BEGIN:
@@ -1945,10 +1945,10 @@ compile_tree(Node* node, regex_t* reg, ScanEnv* env)
 
       case ONIGENC_CTYPE_WORD:
         if (CTYPE_(node)->ascii_mode == 0) {
-          op = CTYPE_(node)->not != 0 ? OP_NOT_WORD : OP_WORD;
+          op = CTYPE_(node)->not != 0 ? OP_NO_WORD : OP_WORD;
         }
         else {
-          op = CTYPE_(node)->not != 0 ? OP_NOT_WORD_ASCII : OP_WORD_ASCII;
+          op = CTYPE_(node)->not != 0 ? OP_NO_WORD_ASCII : OP_WORD_ASCII;
         }
         r = add_opcode(reg, op);
         break;
@@ -4617,13 +4617,13 @@ setup_anchor(Node* node, regex_t* reg, int state, ScanEnv* env)
 
 #define ALLOWED_ANCHOR_IN_LB \
   ( ANCHOR_LOOK_BEHIND | ANCHOR_BEGIN_LINE | ANCHOR_END_LINE | ANCHOR_BEGIN_BUF \
-  | ANCHOR_BEGIN_POSITION | ANCHOR_WORD_BOUND | ANCHOR_NOT_WORD_BOUND \
+  | ANCHOR_BEGIN_POSITION | ANCHOR_WORD_BOUND | ANCHOR_NO_WORD_BOUND \
   | ANCHOR_WORD_BEGIN | ANCHOR_WORD_END )
 
 #define ALLOWED_ANCHOR_IN_LB_NOT \
   ( ANCHOR_LOOK_BEHIND | ANCHOR_LOOK_BEHIND_NOT | ANCHOR_BEGIN_LINE \
   | ANCHOR_END_LINE | ANCHOR_BEGIN_BUF | ANCHOR_BEGIN_POSITION | ANCHOR_WORD_BOUND \
-  | ANCHOR_NOT_WORD_BOUND | ANCHOR_WORD_BEGIN | ANCHOR_WORD_END )
+  | ANCHOR_NO_WORD_BOUND | ANCHOR_WORD_BEGIN | ANCHOR_WORD_END )
 
   int r;
   AnchorNode* an = ANCHOR_(node);
@@ -6710,10 +6710,10 @@ OnigOpInfoType OnigOpInfo[] = {
   { OP_ANYCHAR_ML_STAR_PEEK_NEXT, "anychar-ml*-peek-next", ARG_SPECIAL },
   { OP_WORD,                "word",            ARG_NON },
   { OP_WORD_ASCII,          "word-ascii",      ARG_NON },
-  { OP_NOT_WORD,            "not-word",        ARG_NON },
-  { OP_NOT_WORD_ASCII,      "not-word-ascii",  ARG_NON },
+  { OP_NO_WORD,             "not-word",        ARG_NON },
+  { OP_NO_WORD_ASCII,       "not-word-ascii",  ARG_NON },
   { OP_WORD_BOUND,          "word-bound",      ARG_MODE },
-  { OP_NOT_WORD_BOUND,      "not-word-bound",  ARG_MODE },
+  { OP_NO_WORD_BOUND,       "not-word-bound",  ARG_MODE },
   { OP_WORD_BEGIN,          "word-begin",      ARG_MODE },
   { OP_WORD_END,            "word-end",        ARG_MODE },
   { OP_BEGIN_BUF,           "begin-buf",       ARG_NON },
@@ -7229,7 +7229,7 @@ print_indent_tree(FILE* f, Node* node, int indent)
     case ANCHOR_BEGIN_POSITION: fputs("begin position", f); break;
 
     case ANCHOR_WORD_BOUND:      fputs("word bound",     f); break;
-    case ANCHOR_NOT_WORD_BOUND:  fputs("not word bound", f); break;
+    case ANCHOR_NO_WORD_BOUND:   fputs("not word bound", f); break;
 #ifdef USE_WORD_BEGIN_END
     case ANCHOR_WORD_BEGIN:      fputs("word begin", f);     break;
     case ANCHOR_WORD_END:        fputs("word end", f);       break;
index b5cea40f25be3403aa78368658d33250335e4261..6178ceafe1378f0e71270269750ea2df29678462 100644 (file)
@@ -2166,7 +2166,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
       MOP_OUT;
       break;
 
-    case OP_NOT_WORD:  MOP_IN(OP_NOT_WORD);
+    case OP_NO_WORD:  MOP_IN(OP_NO_WORD);
       DATA_ENSURE(1);
       if (ONIGENC_IS_MBC_WORD(encode, s, end))
         goto fail;
@@ -2175,7 +2175,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
       MOP_OUT;
       break;
 
-    case OP_NOT_WORD_ASCII:  MOP_IN(OP_NOT_WORD_ASCII);
+    case OP_NO_WORD_ASCII:  MOP_IN(OP_NO_WORD_ASCII);
       DATA_ENSURE(1);
       if (ONIGENC_IS_MBC_WORD_ASCII(encode, s, end))
         goto fail;
@@ -2208,7 +2208,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
       continue;
       break;
 
-    case OP_NOT_WORD_BOUND:  MOP_IN(OP_NOT_WORD_BOUND);
+    case OP_NO_WORD_BOUND:  MOP_IN(OP_NO_WORD_BOUND);
       {
         ModeType mode;
         GET_MODE_INC(mode, p); // ascii_mode
index 9b9214a11a18f5e257bf080c3e01ebd9dbe6cf4e..0e6142cf4f5abef83de854b07e6a1b9dd21f18b9 100644 (file)
@@ -458,7 +458,7 @@ typedef struct _BBuf {
 #define ANCHOR_SEMI_END_BUF     (1<<8)
 #define ANCHOR_END_LINE         (1<<9)
 #define ANCHOR_WORD_BOUND       (1<<10)
-#define ANCHOR_NOT_WORD_BOUND   (1<<11)
+#define ANCHOR_NO_WORD_BOUND   (1<<11)
 #define ANCHOR_WORD_BEGIN       (1<<12)
 #define ANCHOR_WORD_END         (1<<13)
 #define ANCHOR_ANYCHAR_STAR     (1<<14)   /* ".*" optimize info */
@@ -467,7 +467,7 @@ typedef struct _BBuf {
 #define ANCHOR_HAS_BODY(a)      ((a)->type < ANCHOR_BEGIN_BUF)
 
 #define IS_WORD_ANCHOR_TYPE(type) \
-  ((type) == ANCHOR_WORD_BOUND || (type) == ANCHOR_NOT_WORD_BOUND || \
+  ((type) == ANCHOR_WORD_BOUND || (type) == ANCHOR_NO_WORD_BOUND || \
    (type) == ANCHOR_WORD_BEGIN || (type) == ANCHOR_WORD_END)
 
 /* operation code */
@@ -510,10 +510,10 @@ enum OpCode {
 
   OP_WORD,
   OP_WORD_ASCII,
-  OP_NOT_WORD,
-  OP_NOT_WORD_ASCII,
+  OP_NO_WORD,
+  OP_NO_WORD_ASCII,
   OP_WORD_BOUND,
-  OP_NOT_WORD_BOUND,
+  OP_NO_WORD_BOUND,
   OP_WORD_BEGIN,
   OP_WORD_END,
 
index 3c913a6fb2fa4b24549e2d791eb8650ae2039c27..21c6081796db38618800263acdc1e16d98ed4fe4 100644 (file)
@@ -3873,7 +3873,7 @@ fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env)
     case 'B':
       if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ESC_B_WORD_BOUND)) break;
       tok->type = TK_ANCHOR;
-      tok->u.anchor = ANCHOR_NOT_WORD_BOUND;
+      tok->u.anchor = ANCHOR_NO_WORD_BOUND;
       break;
 
 #ifdef USE_WORD_BEGIN_END