]> granicus.if.org Git - onig/commitdiff
remove arg_type member from OptInfoType
authorK.Kosako <kosako@sofnec.co.jp>
Fri, 15 Feb 2019 05:11:47 +0000 (14:11 +0900)
committerK.Kosako <kosako@sofnec.co.jp>
Thu, 28 Feb 2019 05:28:18 +0000 (14:28 +0900)
src/regexec.c

index d8427852aabf48b20b2fd29ff8005d8e5ec8a96e..f9dac409a9f3b4710bd93701ba617c0142f51131 100644 (file)
@@ -147,108 +147,107 @@ typedef enum {
 typedef struct {
   short int opcode;
   char*     name;
-  OpArgType arg_type;
 } OpInfoType;
 
 static OpInfoType OpInfo[] = {
-  { OP_FINISH,            "finish",          ARG_NON },
-  { OP_END,               "end",             ARG_NON },
-  { OP_EXACT1,            "exact1",          ARG_SPECIAL },
-  { OP_EXACT2,            "exact2",          ARG_SPECIAL },
-  { OP_EXACT3,            "exact3",          ARG_SPECIAL },
-  { OP_EXACT4,            "exact4",          ARG_SPECIAL },
-  { OP_EXACT5,            "exact5",          ARG_SPECIAL },
-  { OP_EXACTN,            "exactn",          ARG_SPECIAL },
-  { OP_EXACTMB2N1,        "exactmb2-n1",     ARG_SPECIAL },
-  { OP_EXACTMB2N2,        "exactmb2-n2",     ARG_SPECIAL },
-  { OP_EXACTMB2N3,        "exactmb2-n3",     ARG_SPECIAL },
-  { OP_EXACTMB2N,         "exactmb2-n",      ARG_SPECIAL },
-  { OP_EXACTMB3N,         "exactmb3n"  ,     ARG_SPECIAL },
-  { OP_EXACTMBN,          "exactmbn",        ARG_SPECIAL },
-  { OP_EXACT1_IC,         "exact1-ic",       ARG_SPECIAL },
-  { OP_EXACTN_IC,         "exactn-ic",       ARG_SPECIAL },
-  { OP_CCLASS,            "cclass",          ARG_SPECIAL },
-  { OP_CCLASS_MB,         "cclass-mb",       ARG_SPECIAL },
-  { OP_CCLASS_MIX,        "cclass-mix",      ARG_SPECIAL },
-  { OP_CCLASS_NOT,        "cclass-not",      ARG_SPECIAL },
-  { OP_CCLASS_MB_NOT,     "cclass-mb-not",   ARG_SPECIAL },
-  { OP_CCLASS_MIX_NOT,    "cclass-mix-not",  ARG_SPECIAL },
+  { OP_FINISH,            "finish" },
+  { OP_END,               "end"    },
+  { OP_EXACT1,            "exact1" },
+  { OP_EXACT2,            "exact2" },
+  { OP_EXACT3,            "exact3" },
+  { OP_EXACT4,            "exact4" },
+  { OP_EXACT5,            "exact5" },
+  { OP_EXACTN,            "exactn" },
+  { OP_EXACTMB2N1,        "exactmb2-n1" },
+  { OP_EXACTMB2N2,        "exactmb2-n2" },
+  { OP_EXACTMB2N3,        "exactmb2-n3" },
+  { OP_EXACTMB2N,         "exactmb2-n"  },
+  { OP_EXACTMB3N,         "exactmb3n"   },
+  { OP_EXACTMBN,          "exactmbn"    },
+  { OP_EXACT1_IC,         "exact1-ic"   },
+  { OP_EXACTN_IC,         "exactn-ic"   },
+  { OP_CCLASS,            "cclass"      },
+  { OP_CCLASS_MB,         "cclass-mb"   },
+  { OP_CCLASS_MIX,        "cclass-mix"  },
+  { OP_CCLASS_NOT,        "cclass-not"  },
+  { OP_CCLASS_MB_NOT,     "cclass-mb-not"  },
+  { OP_CCLASS_MIX_NOT,    "cclass-mix-not" },
 #ifdef USE_OP_CCLASS_NODE
-  { OP_CCLASS_NODE,       "cclass-node",     ARG_SPECIAL },
+  { OP_CCLASS_NODE,       "cclass-node" },
 #endif
-  { OP_ANYCHAR,           "anychar",         ARG_NON },
-  { OP_ANYCHAR_ML,        "anychar-ml",      ARG_NON },
-  { OP_ANYCHAR_STAR,      "anychar*",        ARG_NON },
-  { OP_ANYCHAR_ML_STAR,   "anychar-ml*",     ARG_NON },
-  { OP_ANYCHAR_STAR_PEEK_NEXT, "anychar*-peek-next", ARG_SPECIAL },
-  { 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_NO_WORD,             "not-word",        ARG_NON },
-  { OP_NO_WORD_ASCII,       "not-word-ascii",  ARG_NON },
-  { OP_WORD_BOUNDARY,       "word-boundary",     ARG_MODE },
-  { OP_NO_WORD_BOUNDARY,    "not-word-boundary", ARG_MODE },
-  { OP_WORD_BEGIN,          "word-begin",      ARG_MODE },
-  { OP_WORD_END,            "word-end",        ARG_MODE },
-  { OP_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY, "extended-grapheme-cluster-boundary", ARG_NON },
-  { OP_NO_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY, "no-extended-grapheme-cluster-boundary", ARG_NON },
-  { OP_BEGIN_BUF,           "begin-buf",       ARG_NON },
-  { OP_END_BUF,             "end-buf",         ARG_NON },
-  { OP_BEGIN_LINE,          "begin-line",      ARG_NON },
-  { OP_END_LINE,            "end-line",        ARG_NON },
-  { OP_SEMI_END_BUF,        "semi-end-buf",    ARG_NON },
-  { OP_BEGIN_POSITION,      "begin-position",  ARG_NON },
-  { OP_BACKREF1,            "backref1",             ARG_NON },
-  { OP_BACKREF2,            "backref2",             ARG_NON },
-  { OP_BACKREF_N,            "backref-n",           ARG_MEMNUM  },
-  { OP_BACKREF_N_IC,         "backref-n-ic",        ARG_SPECIAL },
-  { OP_BACKREF_MULTI,       "backref_multi",        ARG_SPECIAL },
-  { OP_BACKREF_MULTI_IC,    "backref_multi-ic",     ARG_SPECIAL },
-  { OP_BACKREF_WITH_LEVEL,    "backref_with_level",   ARG_SPECIAL },
-  { OP_BACKREF_WITH_LEVEL_IC, "backref_with_level-c", ARG_SPECIAL },
-  { OP_BACKREF_CHECK,       "backref_check",        ARG_SPECIAL },
-  { OP_BACKREF_CHECK_WITH_LEVEL, "backref_check_with_level", ARG_SPECIAL },
-  { OP_MEMORY_START_PUSH,   "mem-start-push",       ARG_MEMNUM  },
-  { OP_MEMORY_START,        "mem-start",            ARG_MEMNUM  },
-  { OP_MEMORY_END_PUSH,     "mem-end-push",         ARG_MEMNUM  },
-  { OP_MEMORY_END_PUSH_REC, "mem-end-push-rec",     ARG_MEMNUM  },
-  { OP_MEMORY_END,          "mem-end",              ARG_MEMNUM  },
-  { OP_MEMORY_END_REC,      "mem-end-rec",          ARG_MEMNUM  },
-  { OP_FAIL,                "fail",                 ARG_NON },
-  { OP_JUMP,                "jump",                 ARG_RELADDR },
-  { OP_PUSH,                "push",                 ARG_RELADDR },
-  { OP_PUSH_SUPER,          "push-super",           ARG_RELADDR },
-  { OP_POP_OUT,             "pop-out",              ARG_NON },
-  { OP_PUSH_OR_JUMP_EXACT1, "push-or-jump-e1",      ARG_SPECIAL },
-  { OP_PUSH_IF_PEEK_NEXT,   "push-if-peek-next",    ARG_SPECIAL },
-  { OP_REPEAT,              "repeat",               ARG_SPECIAL },
-  { OP_REPEAT_NG,           "repeat-ng",            ARG_SPECIAL },
-  { OP_REPEAT_INC,          "repeat-inc",           ARG_MEMNUM  },
-  { OP_REPEAT_INC_NG,       "repeat-inc-ng",        ARG_MEMNUM  },
-  { OP_REPEAT_INC_SG,       "repeat-inc-sg",        ARG_MEMNUM  },
-  { OP_REPEAT_INC_NG_SG,    "repeat-inc-ng-sg",     ARG_MEMNUM  },
-  { OP_EMPTY_CHECK_START,   "empty-check-start",    ARG_MEMNUM  },
-  { OP_EMPTY_CHECK_END,     "empty-check-end",      ARG_MEMNUM  },
-  { OP_EMPTY_CHECK_END_MEMST,"empty-check-end-memst", ARG_MEMNUM  },
-  { OP_EMPTY_CHECK_END_MEMST_PUSH,"empty-check-end-memst-push", ARG_MEMNUM  },
-  { OP_PREC_READ_START,      "push-pos",             ARG_NON },
-  { OP_PREC_READ_END,        "pop-pos",              ARG_NON },
-  { OP_PREC_READ_NOT_START,  "prec-read-not-start",  ARG_RELADDR },
-  { OP_PREC_READ_NOT_END,    "prec-read-not-end",    ARG_NON },
-  { OP_ATOMIC_START,         "atomic-start",         ARG_NON },
-  { OP_ATOMIC_END,           "atomic-end",           ARG_NON },
-  { OP_LOOK_BEHIND,          "look-behind",          ARG_SPECIAL },
-  { OP_LOOK_BEHIND_NOT_START, "look-behind-not-start", ARG_SPECIAL },
-  { OP_LOOK_BEHIND_NOT_END,  "look-behind-not-end",  ARG_NON },
-  { OP_CALL,                 "call",                 ARG_ABSADDR },
-  { OP_RETURN,               "return",               ARG_NON },
-  { OP_PUSH_SAVE_VAL,        "push-save-val",        ARG_SPECIAL },
-  { OP_UPDATE_VAR,           "update-var",           ARG_SPECIAL },
+  { OP_ANYCHAR,               "anychar"     },
+  { OP_ANYCHAR_ML,            "anychar-ml"  },
+  { OP_ANYCHAR_STAR,          "anychar*"    },
+  { OP_ANYCHAR_ML_STAR,       "anychar-ml*" },
+  { OP_ANYCHAR_STAR_PEEK_NEXT,    "anychar*-peek-next" },
+  { OP_ANYCHAR_ML_STAR_PEEK_NEXT, "anychar-ml*-peek-next" },
+  { OP_WORD,                  "word"       },
+  { OP_WORD_ASCII,            "word-ascii" },
+  { OP_NO_WORD,               "not-word"   },
+  { OP_NO_WORD_ASCII,         "not-word-ascii" },
+  { OP_WORD_BOUNDARY,         "word-boundary"  },
+  { OP_NO_WORD_BOUNDARY,      "not-word-boundary" },
+  { OP_WORD_BEGIN,            "word-begin" },
+  { OP_WORD_END,              "word-end"   },
+  { OP_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY,    "extended-grapheme-cluster-boundary" },
+  { OP_NO_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY, "no-extended-grapheme-cluster-boundary" },
+  { OP_BEGIN_BUF,             "begin-buf"  },
+  { OP_END_BUF,               "end-buf"    },
+  { OP_BEGIN_LINE,            "begin-line" },
+  { OP_END_LINE,              "end-line"   },
+  { OP_SEMI_END_BUF,          "semi-end-buf"   },
+  { OP_BEGIN_POSITION,        "begin-position" },
+  { OP_BACKREF1,              "backref1"       },
+  { OP_BACKREF2,              "backref2"       },
+  { OP_BACKREF_N,             "backref-n"      },
+  { OP_BACKREF_N_IC,          "backref-n-ic"   },
+  { OP_BACKREF_MULTI,         "backref_multi"  },
+  { OP_BACKREF_MULTI_IC,      "backref_multi-ic"     },
+  { OP_BACKREF_WITH_LEVEL,    "backref_with_level"   },
+  { OP_BACKREF_WITH_LEVEL_IC, "backref_with_level-c" },
+  { OP_BACKREF_CHECK,         "backref_check"        },
+  { OP_BACKREF_CHECK_WITH_LEVEL, "backref_check_with_level" },
+  { OP_MEMORY_START_PUSH,     "mem-start-push"        },
+  { OP_MEMORY_START,          "mem-start"             },
+  { OP_MEMORY_END_PUSH,       "mem-end-push"          },
+  { OP_MEMORY_END_PUSH_REC,   "mem-end-push-rec"      },
+  { OP_MEMORY_END,            "mem-end"               },
+  { OP_MEMORY_END_REC,        "mem-end-rec"           },
+  { OP_FAIL,                  "fail"                  },
+  { OP_JUMP,                  "jump"                  },
+  { OP_PUSH,                  "push"                  },
+  { OP_PUSH_SUPER,            "push-super"            },
+  { OP_POP_OUT,               "pop-out"               },
+  { OP_PUSH_OR_JUMP_EXACT1,   "push-or-jump-e1"       },
+  { OP_PUSH_IF_PEEK_NEXT,     "push-if-peek-next"     },
+  { OP_REPEAT,                "repeat"                },
+  { OP_REPEAT_NG,             "repeat-ng"             },
+  { OP_REPEAT_INC,            "repeat-inc"            },
+  { OP_REPEAT_INC_NG,         "repeat-inc-ng"         },
+  { OP_REPEAT_INC_SG,         "repeat-inc-sg"         },
+  { OP_REPEAT_INC_NG_SG,      "repeat-inc-ng-sg"      },
+  { OP_EMPTY_CHECK_START,     "empty-check-start"     },
+  { OP_EMPTY_CHECK_END,       "empty-check-end"       },
+  { OP_EMPTY_CHECK_END_MEMST, "empty-check-end-memst" },
+  { OP_EMPTY_CHECK_END_MEMST_PUSH,"empty-check-end-memst-push" },
+  { OP_PREC_READ_START,       "push-pos"              },
+  { OP_PREC_READ_END,         "pop-pos"               },
+  { OP_PREC_READ_NOT_START,   "prec-read-not-start"   },
+  { OP_PREC_READ_NOT_END,     "prec-read-not-end"     },
+  { OP_ATOMIC_START,          "atomic-start"          },
+  { OP_ATOMIC_END,            "atomic-end"            },
+  { OP_LOOK_BEHIND,           "look-behind"           },
+  { OP_LOOK_BEHIND_NOT_START, "look-behind-not-start" },
+  { OP_LOOK_BEHIND_NOT_END,   "look-behind-not-end"   },
+  { OP_CALL,                  "call"                  },
+  { OP_RETURN,                "return"                },
+  { OP_PUSH_SAVE_VAL,         "push-save-val"         },
+  { OP_UPDATE_VAR,            "update-var"            },
 #ifdef USE_CALLOUT
-  { OP_CALLOUT_CONTENTS,     "callout-contents",     ARG_SPECIAL },
-  { OP_CALLOUT_NAME,         "callout-name",         ARG_SPECIAL },
+  { OP_CALLOUT_CONTENTS,      "callout-contents"      },
+  { OP_CALLOUT_NAME,          "callout-name"          },
 #endif
-  { -1, "", ARG_NON }
+  { -1, "" }
 };
 
 static char*
@@ -263,20 +262,6 @@ op2name(int opcode)
   return "";
 }
 
-#if 0
-static int
-op2arg_type(int opcode)
-{
-  int i;
-
-  for (i = 0; OpInfo[i].opcode >= 0; i++) {
-    if (opcode == OpInfo[i].opcode)
-      return OpInfo[i].arg_type;
-  }
-  return ARG_SPECIAL;
-}
-#endif
-
 static void
 p_string(FILE* f, int len, UChar* s)
 {