diff regexParser/subsetConstraction.cc @ 208:2ec95755238e

fix mergetest
author Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
date Sun, 27 Dec 2015 18:46:08 +0900
parents e6e862e92fdc
children 959f8c00da17
line wrap: on
line diff
--- a/regexParser/subsetConstraction.cc	Sun Dec 27 16:51:14 2015 +0900
+++ b/regexParser/subsetConstraction.cc	Sun Dec 27 18:46:08 2015 +0900
@@ -188,7 +188,8 @@
     CharClassWalkerPtr walk = createCharClassWalker(x->cc);
     CharClassPtr ccy = y;
     BitVector bi;
-    for (CharClassPtr cc = getNext(walk); hasNext(walk); cc=getNext(walk)) {
+    while (hasNext(walk)) {
+        CharClassPtr cc = getNext(walk);
         unsigned long begin = cc->cond.range.begin;
         unsigned long end = cc->cond.range.end;
         bi = cc->nextState;
@@ -211,7 +212,7 @@
     s->node = n;
     BitVector bi = createBitVector(n->stateNum);
     s->bitState = bi;
-    s->cc = NULL;
+    s->cc = n->cc;
     return s;
 }
 
@@ -308,25 +309,29 @@
     return tg;
 }
 
-TransitionGeneratorPtr generateTransitionList(NodePtr n) {
+TGValue createTGValue() {
     TransitionGeneratorPtr tg = createTransitionGenerator();
     TGValue tgv;
-    // initiarize tgv
     tgv.asterisk = false;
     tgv.tg = tg;
+    return tgv;
+}
+
+TransitionGeneratorPtr generateTransitionList(NodePtr n) {
+    TGValue tgv = createTGValue();
     StatePtr startState = tgv.startState = createState(tgv,n);
     NodePtr eof = createNode(NULL,'e',NULL,NULL,NULL);
     StatePtr endState = tgv.endState = createState(tgv,eof);
     tgv = stateAllocate(n,tgv);
-    if (tg->totalStateCount > BITBLOCK) {
+    if (tgv.tg->totalStateCount > BITBLOCK) {
         errorMassege("StateMax > BITBLOCK",__LINE__,__FILE__);
     }
-    BitVector bi = createBitVector(tg->totalStateCount);
+    BitVector bi = createBitVector(tgv.tg->totalStateCount);
     tgv.tg->stateArray = (StatePtr*)calloc(bi.bitContainer*2,sizeof(StatePtr*));
     tgv.tg->stateArray[startState->bitState.bitContainer] = startState;
     tgv.tg->stateArray[endState->bitState.bitContainer] = endState;
     generateTransition(n,tgv);
-    return tg;
+    return tgv.tg;
 }
 
 void printState(StatePtr state) {