comparison regexParser/regexParser.h @ 319:7b8234c090f7

bmSearch
author mir3636
date Sun, 08 May 2016 22:53:20 +0900
parents a4484c02cba5
children
comparison
equal deleted inserted replaced
318:c9458ffecb87 319:7b8234c090f7
6 #define BITBLOCK 64 6 #define BITBLOCK 64
7 typedef struct bitVector { 7 typedef struct bitVector {
8 unsigned long bitContainer; 8 unsigned long bitContainer;
9 } BitVector,*BitVectorPtr; 9 } BitVector,*BitVectorPtr;
10 10
11 // skip table of Boyer-Moore Search
12 typedef struct bm {
13 int* skip_table;
14 unsigned char *search_word;
15 int search_word_len;
16 struct bm *next;
17 } BM, *BMPtr;
18
11 typedef struct word { 19 typedef struct word {
12 unsigned char *word; 20 unsigned char *word;
13 int length; 21 int length;
14 // look up table for BM search. 22 BMPtr bm;
15 // BitVector nextState;
16 struct word *next; 23 struct word *next;
17 } Word, *WordPtr; 24 } Word, *WordPtr;
18 25
19 typedef struct utf8Range { 26 typedef struct utf8Range {
20 unsigned long begin; 27 unsigned long begin;
88 } StateStack, *StateStackPtr; 95 } StateStack, *StateStackPtr;
89 96
90 typedef struct transitionGenerator { 97 typedef struct transitionGenerator {
91 long totalStateCount; 98 long totalStateCount;
92 long totalBasicState; 99 long totalBasicState;
100 long maxWordLen;
93 StateStackPtr stack; 101 StateStackPtr stack;
94 StatePtr stateEnd; 102 StatePtr stateEnd;
95 StatePtr stateStart; // start state without accept flag 103 StatePtr stateStart; // start state without accept flag
96 StatePtr *stateArray; 104 StatePtr *stateArray;
97 StatePtr stateList; 105 StatePtr stateList;
152 typedef struct regexInfo { 160 typedef struct regexInfo {
153 unsigned char *ptr; 161 unsigned char *ptr;
154 unsigned char tokenType; 162 unsigned char tokenType;
155 unsigned char *tokenValue; 163 unsigned char *tokenValue;
156 int stateNumber; 164 int stateNumber;
165 long maxWordLen;
157 bool wordMode; 166 bool wordMode;
158 } RegexInfo, *RegexInfoPtr; 167 } RegexInfo, *RegexInfoPtr;
159 168
160 typedef struct { 169 typedef struct {
161 unsigned char* file_mmap; 170 unsigned char* file_mmap;