Mercurial > hg > Members > masakoha > testcode
changeset 171:684363c44d6f pairPro
remove some warning and error (not working)
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 21 Dec 2015 17:37:41 +0900 |
parents | de2438d4146a |
children | 540fc12871d9 |
files | regexParser/subsetConstraction.cc regexParser/subsetConstraction.h |
diffstat | 2 files changed, 21 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/regexParser/subsetConstraction.cc Sat Dec 19 20:14:42 2015 +0900 +++ b/regexParser/subsetConstraction.cc Mon Dec 21 17:37:41 2015 +0900 @@ -6,7 +6,7 @@ CharClassPtr createCharClassWord(unsigned char *w, CharClassPtr cc1, CharClassPtr cc2) { CharClassPtr cc = NEW(CharClass); return cc; -} +} CharClassPtr createCharClassRange(unsigned long begin, unsigned long end,unsigned long state, CharClassPtr left, CharClassPtr right) { CharClassPtr cc = NEW(CharClass); @@ -114,15 +114,15 @@ CharClassWalkerPtr findLeftMost(CharClassPtr next,CharClassWalker walk) { while (next->left) { - CharClassStackPtr ts = NEW(CharClassStack); - ts->next = walk->stack; - ts->left = false; - ts->cc = next; - walk->stack = ts; + CharClassStackPtr ccs = NEW(CharClassStack); + ccs->next = &walk.stack; + ccs->left = false; + ccs->cc = next; + walk.stack = *ccs; next = next->left; } - walk->next = next; - return walk; + walk.next = next; + return &walk; } CharClassWalkerPtr createCharClassWalker (CharClassPtr next) { @@ -133,7 +133,7 @@ walk->next = next; return walk; } - walk->next = findLeftMost(next,walk); + walk = findLeftMost(next,*walk); return walk; } @@ -143,9 +143,9 @@ CharClassPtr getNext(CharClassWalkerPtr walk) { CharClassPtr current = walk->next; - if (ts->left && current->right) { - ts->left = true; - CharClassPtr next = findLeftMost(current->right,walk); + if (walk->next->left && current->right) { + walk->stack.left = true; + CharClassPtr next = findLeftMost(current->right,*walk)->next; walk->next = next; } else { TransitionPtr tsOld = ts; @@ -160,13 +160,13 @@ } TransitionPtr mergeTransition(TransitionPtr x,TransitionPtr y) { - CharClassWalkerPtr walk = createCharClassWalker(x); + CharClassWalkerPtr walk = createCharClassWalker(x->condition); CharClassPtr ccy = y->condition; for (CharClassPtr cc = getNext(walk); hasNext(walk); cc=getNext(walk)) { - unsigned long begin = cc->range.cond.begin; - unsigned long end = cc->range.cond.end; - BitVectorPtr bi = cc->nextState; - ccy = charClassMerge(ccy,begin,end,*bi); + unsigned long begin = cc->cond.range.begin; + unsigned long end = cc->cond.range.end; + BitVector bi = cc->nextState; + ccy = charClassMerge(ccy,begin,end,bi); } TransitionPtr z = createTransition(ccy); free(walk); @@ -177,7 +177,7 @@ TGValue tgv2; if (n->tokenType == '+') { TGValue tgv = generateTransition(n->right,tg); - TGValue tgv1 = generateTransition(n->left,tgv.tg); + TGValue tgv1 = generateTransition(n->left,tg); if (tgv.asterisk) { tgv1.ts = mergeTransition(tgv.ts,tgv1.ts); return tgv1; @@ -185,7 +185,7 @@ return tgv; } else if (n->tokenType == '|') { TGValue tgv = generateTransition(n->left,tg); - TGValue tgv1 = generateTransition(n->right,tgv.tg); + TGValue tgv1 = generateTransition(n->right,tg); tgv.tg = tgv1.tg; tgv.ts = mergeTransition(tgv.ts,tgv1.ts); tgv.asterisk |= tgv1.asterisk; @@ -201,8 +201,7 @@ TGValue tgv; tgv.ts = (TransitionPtr)malloc(sizeof(Transition)); tgv.ts->condition = n->cc; - tgv.ts->nextState = (BitVectorPtr)malloc(sizeof(BitVector)); - bitSet(tgv.ts->nextState,n->nodeNumber); + bitSet(&tgv.ts->condition->nextState,n->nodeNumber); tg.ts = appendTransition(tg.ts,tgv.ts); return tgv; } else {
--- a/regexParser/subsetConstraction.h Sat Dec 19 20:14:42 2015 +0900 +++ b/regexParser/subsetConstraction.h Mon Dec 21 17:37:41 2015 +0900 @@ -21,7 +21,7 @@ typedef struct charClassStack { bool left; CharClassPtr cc; - CharClassStackPtr next; + struct charClassStack *next; } CharClassStack, *CharClassStackPtr; typedef struct charClassWalker {