Mercurial > hg > Members > masakoha > testcode
changeset 263:292753bb31e4
fix Makefile
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 27 Jan 2016 16:37:42 +0900 |
parents | 157f6886ba55 |
children | ef95a7f1bc03 |
files | regexParser/Makefile regexParser/threadedSearch.cc |
diffstat | 2 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/regexParser/Makefile Tue Jan 26 19:32:18 2016 +0900 +++ b/regexParser/Makefile Wed Jan 27 16:37:42 2016 +0900 @@ -42,6 +42,9 @@ .SUFFIXES: .cc .o +tSearch: regexParser + ./regexParser -seq -subset -regex '[A-Z][A-Za-z0-9_]*' -file main.cc -ts + test1: regexParser ./regexParser -regex 'a' ./regexParser -regex 'ab'
--- a/regexParser/threadedSearch.cc Tue Jan 26 19:32:18 2016 +0900 +++ b/regexParser/threadedSearch.cc Wed Jan 27 16:37:42 2016 +0900 @@ -9,13 +9,11 @@ void stateSkip(TSValue tsv) { tsv.buff.matchBegin = tsv.buff.buffptr; - tSearch(tsv); } void stateMatch(TSValue tsv) { - fwrite(tsv.buff.matchBegin,tsv.buff.buffptr-tsv.buff.matchBegin,1,stdout); + fwrite(tsv.buff.matchBegin,tsv.buff.buffptr-tsv.buff.matchBegin-1,1,stdout); puts("\n"); - stateSkip(tsv); } TStatePtr generateTState(StatePtr state) { @@ -23,8 +21,10 @@ int ccvSize = 0; CharClassWalkerPtr ccw = createCharClassWalker(state->cc); while (hasNext(ccw)) { + getNext(ccw); ccvSize++; } + tState->ccvSize = ccvSize; if (ccvSize == 0) return tState; else tState->ccv = (ccv*)malloc(sizeof(ccv)*ccvSize); ccw = createCharClassWalker(state->cc); @@ -41,6 +41,13 @@ ccv->w = cc->cond.w; } free(ccw); + if (state->accept) { + tState->stateSkip = stateMatch; + tState->stateMatch = stateSkip; + } else { + tState->stateSkip = stateSkip; + tState->stateMatch = stateMatch; + } return tState; } @@ -91,5 +98,5 @@ tsv.buff = buff; tsv.tg = tg; tsv.current = generateTState(tg->stateList); - stateSkip(tsv); + tSearch(tsv); }