Mercurial > hg > Members > masakoha > testcode
changeset 315:66012db6a717
add wordMode in grepWalk
author | mir3636 |
---|---|
date | Sat, 07 May 2016 19:18:43 +0900 |
parents | a4484c02cba5 |
children | c4d33b7c3ccd |
files | regexParser/CharClass.cc regexParser/grepWalk.cc |
diffstat | 2 files changed, 12 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/regexParser/CharClass.cc Sat May 07 18:38:54 2016 +0900 +++ b/regexParser/CharClass.cc Sat May 07 19:18:43 2016 +0900 @@ -47,17 +47,10 @@ return ncc; } if (m->cond.w.word) { - WordPtr w = &m->cond.w; - WordPtr *next = &ncc->cond.w.next; - while(w->next) { // insert sort? - WordPtr n = NEW(Word); - n->word = w->word; - n->length = w->length; - *next = n; - next = &n->next; - w = w->next; - } - *next = &m->cond.w; + WordPtr n = &ncc->cond.w; + n->word = m->cond.w.word; + n->length = m->cond.w.length; + n->next = &cc->cond.w; } ncc->nextState.bitContainer = m->nextState.bitContainer | cc->nextState.bitContainer; return ncc;
--- a/regexParser/grepWalk.cc Sat May 07 18:38:54 2016 +0900 +++ b/regexParser/grepWalk.cc Sat May 07 19:18:43 2016 +0900 @@ -49,8 +49,14 @@ } else if (c<=cc->cond.range.end) { // range matched. if (cc->cond.w.word) { - // match the word. - // if (not match) continue; + WordPtr w; + for (w = &cc->cond.w.word;w;w = w->next) { + // match the word. + // if (not match) continue; + if (strncmp(w.word,tsv.buff.buffptr-1,w.length)) break; + } + if (!w) continue; + tsv.buff.buffptr += w.length - 1; } state = nextState(cc->nextState,tg); goto next;