diff regexParser/regexParser.h @ 248:2b1fbfb92d54

implement tSearch
author Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
date Fri, 22 Jan 2016 20:09:42 +0900
parents f5931151d70c
children 9493800265a8
line wrap: on
line diff
--- a/regexParser/regexParser.h	Fri Jan 22 18:37:04 2016 +0900
+++ b/regexParser/regexParser.h	Fri Jan 22 20:09:42 2016 +0900
@@ -11,6 +11,9 @@
 typedef struct word {
     unsigned char *word;
     int length;
+    // look up table for BM search.
+    // BitVector nextState;
+    // struct word *next;
 } Word, *WordPtr;
 
 typedef struct utf8Range {
@@ -40,10 +43,34 @@
     BitVector bitState;
     CharClassPtr cc;
     bool accept;
+    struct tState *tState;
     struct node *node;
     struct state *next;
 } State, *StatePtr;
 
+struct tsValue;
+
+typedef struct ccv {
+    unsigned long begin;
+    unsigned long end;
+    Word w;
+    BitVector state;
+    struct tState *tState;
+} CCV,*CCVPtr;
+
+typedef struct tState {
+    State *state;
+    void stateSkip(tsValue);
+    int ccvSize;
+    CCV ccv;
+} TState, *TStatePtr;
+
+typedef struct result {
+    unsigned char begin;
+    unsigned char end;
+    struct result *next;
+} Result, *ResultPtr;
+
 typedef struct node {
     unsigned char tokenType;
     CharClassPtr cc;
@@ -63,17 +90,20 @@
 typedef struct transitionGenerator {
     long totalStateCount;
     StateStackPtr stack;
+    StatePtr stateTop;
+    StatePtr stateEnd;
     StatePtr *stateArray;
     StatePtr stateList;
 } TransitionGenerator, *TransitionGeneratorPtr;
 
-// Value Container is passed directly in functions
-// Don't use it's pointer
-typedef struct scValue {
-    StatePtr stateTop;
-    StatePtr stateEnd;
+typedef struct tsValue {
+    Buffer buff;
+    ResultPtr result;
     TransitionGeneratorPtr tg;
-} SCValue, *SCValuePtr;
+    TState *current;
+    TState *blockBegin;
+    TState *blockEnd;
+} TSValue, *TSValuePtr;
 
 typedef struct tgValue {
     StatePtr asterisk;   // last * state of the expression