Mercurial > hg > Members > masakoha > testcode
diff regexParser/threadedSearch.cc @ 257:ebb429c2b6a7
fix allocate state in generateTransition
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 Jan 2016 19:20:32 +0900 |
parents | 21b9ba76f91b |
children | 29e467a491ba |
line wrap: on
line diff
--- a/regexParser/threadedSearch.cc Mon Jan 25 18:28:57 2016 +0900 +++ b/regexParser/threadedSearch.cc Mon Jan 25 19:20:32 2016 +0900 @@ -9,6 +9,11 @@ tsv.current->stateSkip(tsv); } +void stateMatch(TSValue tsv) { + tsv.buff.matchBegin = tsv.buff.buffptr; + tsv.current->stateSkip(tsv); +} + TStatePtr generateTState(StatePtr state) { TStatePtr tState = NEW(TState); int ccvSize = 0; @@ -40,8 +45,10 @@ unsigned char c = *tsv.buff.buffptr++; for (int i = 0; i < tsv.current->ccvSize; i++) { CCVPtr ccv = &tsv.current->ccv[i]; - if (c<ccv->begin) tsv.current->stateSkip(tsv); - else if (c<=ccv->end) { + if (c<ccv->begin) { + tsv.stateSkip(tsv); + goto next; + } else if (c<=ccv->end) { // range matched. if (ccv->w.word) { // match the word. @@ -65,6 +72,9 @@ } } tsv.current = ccv->tState; + if (tsv.current->state->bitState.bitContainer & 2) { + tsv.stateMatch(); + } goto next; } }