Mercurial > hg > Applications > Grep
comparison 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 |
comparison
equal
deleted
inserted
replaced
247:96c2507fd22d | 248:2b1fbfb92d54 |
---|---|
9 } BitVector,*BitVectorPtr; | 9 } BitVector,*BitVectorPtr; |
10 | 10 |
11 typedef struct word { | 11 typedef struct word { |
12 unsigned char *word; | 12 unsigned char *word; |
13 int length; | 13 int length; |
14 // look up table for BM search. | |
15 // BitVector nextState; | |
16 // struct word *next; | |
14 } Word, *WordPtr; | 17 } Word, *WordPtr; |
15 | 18 |
16 typedef struct utf8Range { | 19 typedef struct utf8Range { |
17 unsigned long begin; | 20 unsigned long begin; |
18 unsigned long end; | 21 unsigned long end; |
38 typedef struct state { | 41 typedef struct state { |
39 int stateNum; | 42 int stateNum; |
40 BitVector bitState; | 43 BitVector bitState; |
41 CharClassPtr cc; | 44 CharClassPtr cc; |
42 bool accept; | 45 bool accept; |
46 struct tState *tState; | |
43 struct node *node; | 47 struct node *node; |
44 struct state *next; | 48 struct state *next; |
45 } State, *StatePtr; | 49 } State, *StatePtr; |
50 | |
51 struct tsValue; | |
52 | |
53 typedef struct ccv { | |
54 unsigned long begin; | |
55 unsigned long end; | |
56 Word w; | |
57 BitVector state; | |
58 struct tState *tState; | |
59 } CCV,*CCVPtr; | |
60 | |
61 typedef struct tState { | |
62 State *state; | |
63 void stateSkip(tsValue); | |
64 int ccvSize; | |
65 CCV ccv; | |
66 } TState, *TStatePtr; | |
67 | |
68 typedef struct result { | |
69 unsigned char begin; | |
70 unsigned char end; | |
71 struct result *next; | |
72 } Result, *ResultPtr; | |
46 | 73 |
47 typedef struct node { | 74 typedef struct node { |
48 unsigned char tokenType; | 75 unsigned char tokenType; |
49 CharClassPtr cc; | 76 CharClassPtr cc; |
50 int stateNum; | 77 int stateNum; |
61 } StateStack, *StateStackPtr; | 88 } StateStack, *StateStackPtr; |
62 | 89 |
63 typedef struct transitionGenerator { | 90 typedef struct transitionGenerator { |
64 long totalStateCount; | 91 long totalStateCount; |
65 StateStackPtr stack; | 92 StateStackPtr stack; |
93 StatePtr stateTop; | |
94 StatePtr stateEnd; | |
66 StatePtr *stateArray; | 95 StatePtr *stateArray; |
67 StatePtr stateList; | 96 StatePtr stateList; |
68 } TransitionGenerator, *TransitionGeneratorPtr; | 97 } TransitionGenerator, *TransitionGeneratorPtr; |
69 | 98 |
70 // Value Container is passed directly in functions | 99 typedef struct tsValue { |
71 // Don't use it's pointer | 100 Buffer buff; |
72 typedef struct scValue { | 101 ResultPtr result; |
73 StatePtr stateTop; | |
74 StatePtr stateEnd; | |
75 TransitionGeneratorPtr tg; | 102 TransitionGeneratorPtr tg; |
76 } SCValue, *SCValuePtr; | 103 TState *current; |
104 TState *blockBegin; | |
105 TState *blockEnd; | |
106 } TSValue, *TSValuePtr; | |
77 | 107 |
78 typedef struct tgValue { | 108 typedef struct tgValue { |
79 StatePtr asterisk; // last * state of the expression | 109 StatePtr asterisk; // last * state of the expression |
80 StatePtr startState; | 110 StatePtr startState; |
81 StatePtr endState; | 111 StatePtr endState; |