Mercurial > hg > Members > masakoha > testcode
changeset 320:da02a7258d54
fix
author | mir3636 |
---|---|
date | Sun, 08 May 2016 23:31:14 +0900 |
parents | 7b8234c090f7 |
children | a1b65d39b947 |
files | regexParser/bmSearch.cc regexParser/bmSearch.h regexParser/threadedSearch.cc |
diffstat | 3 files changed, 24 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/regexParser/bmSearch.cc Sun May 08 22:53:20 2016 +0900 +++ b/regexParser/bmSearch.cc Sun May 08 23:31:14 2016 +0900 @@ -1,4 +1,6 @@ -#include "regexPaser.h" +#include <stdlib.h> + +#include "regexParser.h" #include "CharClass.h" /** @@ -19,13 +21,13 @@ } } -void checkBMSearch(CharaClassPtr cc) { +void checkBMSearch(CharClassPtr cc) { // first check there is no Chareclass range - CharClassWalkerPtr cw = createCharClassWalker(st->cc); + CharClassWalkerPtr cw = createCharClassWalker(cc); while (hasNext(cw)) { - CharClassPtr cc = getNext(cw); - if (cc->cond.w.word == NULL) { + CharClassPtr cc1 = getNext(cw); + if (cc1->cond.w.word == NULL) { free(cw); return; } @@ -33,15 +35,15 @@ free(cw); // make skip table for each word - cw = createCharClassWalker(st->cc); + cw = createCharClassWalker(cc); while (hasNext(cw)) { - CharClassPtr cc = getNext(cw); - if (cc->cond.w.word) { - WordPtr w = &cc->cond.w; + CharClassPtr cc1 = getNext(cw); + if (cc1->cond.w.word) { + WordPtr w = &cc1->cond.w; while (w) { BMPtr bm = NEW(BM); - cc->cond.w.bm = bm; - create_BMskiptable(bm,cc->cond.w.word,cc->cond.length); + cc1->cond.w.bm = bm; + create_BMskiptable(bm,cc1->cond.w.word,cc1->cond.w.length); w = w->next; } }
--- a/regexParser/bmSearch.h Sun May 08 22:53:20 2016 +0900 +++ b/regexParser/bmSearch.h Sun May 08 23:31:14 2016 +0900 @@ -1,1 +1,1 @@ -extern void checkBMSearch(CharaClassPtr cc); +extern void checkBMSearch(CharClassPtr cc);
--- a/regexParser/threadedSearch.cc Sun May 08 22:53:20 2016 +0900 +++ b/regexParser/threadedSearch.cc Sun May 08 23:31:14 2016 +0900 @@ -7,6 +7,11 @@ #include "threadedSearch.h" #include "subsetConstruction.h" +#define max(a,b)((a)>(b)?a:b) +#define min(a,b)((a)<(b)?a:b) + +TStatePtr nextTState(BitVector bi,TransitionGeneratorPtr tg); + static TSValue stateNothing(TSValue tsv) { return tsv; @@ -25,9 +30,9 @@ long skip = tsv.tg->maxWordLen; for (int k = 0; k < tsv.current->ccvSize; k++) { CCVPtr ccv = &tsv.current->ccv[k]; - if (ccv.w.word) { - int i = ccv.w.length - 1; - while (tsv.buff.buffptr[i] == ccv.w.word[i]) { + if (ccv->w.word) { + int i = ccv->w.length - 1; + while (tsv.buff.buffptr[i] == ccv->w.word[i]) { if (i == 0) { if (ccv->tState) { tsv.current = ccv->tState; @@ -35,12 +40,12 @@ tsv.current = nextTState(ccv->state,tsv.tg); ccv->tState = tsv.current; } - tsv.buff.buffptr += ccv.w.length - 1; + tsv.buff.buffptr += ccv->w.length - 1; return tsv; } --i; } - skip = min(skip,max(ccv.w.bm->skip[tsv.buff.buffptr[i]],ccv.w.length - i)); + skip = min(skip,max(ccv->w.bm->skip_table[tsv.buff.buffptr[i]],ccv->w.length - i)); } } tsv.buff.buffptr += skip;