Mercurial > hg > Applications > Grep
comparison regexParser/threadedSearch.cc @ 299:bdfe0a32c48f
grepWalk
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 03 Feb 2016 13:11:10 +0900 |
parents | 63213964502a |
children | 1188debbef10 |
comparison
equal
deleted
inserted
replaced
298:63213964502a | 299:bdfe0a32c48f |
---|---|
10 return tsv; | 10 return tsv; |
11 } | 11 } |
12 | 12 |
13 static | 13 static |
14 TSValue stateSkip(TSValue tsv) { | 14 TSValue stateSkip(TSValue tsv) { |
15 tsv.current = tsv.tg->stateStart->tState; | |
16 if (tsv.matchEnd) { | 15 if (tsv.matchEnd) { |
17 fwrite(tsv.matchBegin,tsv.matchEnd-tsv.matchBegin,1,stdout); | 16 fwrite(tsv.matchBegin,tsv.matchEnd-tsv.matchBegin,1,stdout); |
18 puts(""); | 17 puts(""); |
19 tsv.matchEnd = NULL; | 18 tsv.matchEnd = NULL; |
20 } | 19 } |
98 unsigned char c = *tsv.buff.buffptr++; | 97 unsigned char c = *tsv.buff.buffptr++; |
99 // printState(tsv.current->state); | 98 // printState(tsv.current->state); |
100 for (int i = 0; i < tsv.current->ccvSize; i++) { | 99 for (int i = 0; i < tsv.current->ccvSize; i++) { |
101 CCVPtr ccv = &tsv.current->ccv[i]; | 100 CCVPtr ccv = &tsv.current->ccv[i]; |
102 if (c<ccv->begin) { | 101 if (c<ccv->begin) { |
102 tsv.current = tsv.tg->stateStart->tState; | |
103 tsv = tsv.current->stateSkip(tsv); | 103 tsv = tsv.current->stateSkip(tsv); |
104 goto next; | 104 goto next; |
105 } else if (c<=ccv->end) { | 105 } else if (c<=ccv->end) { |
106 // range matched. | 106 // range matched. |
107 if (ccv->w.word) { | 107 if (ccv->w.word) { |
115 ccv->tState = tsv.current; | 115 ccv->tState = tsv.current; |
116 } | 116 } |
117 goto next; | 117 goto next; |
118 } | 118 } |
119 } | 119 } |
120 tsv.current = tsv.tg->stateStart->tState; | |
120 tsv = tsv.current->stateSkip(tsv); | 121 tsv = tsv.current->stateSkip(tsv); |
121 } | 122 } |
122 #if DEBUG | 123 #if DEBUG |
123 *tsvp = tsv; | 124 *tsvp = tsv; |
124 return *tsvp; | 125 return *tsvp; |