Mercurial > hg > Members > masakoha > testcode
comparison regexParser/subsetConstruction.cc @ 277:7b4bcc7b5ae6
nextTState implemented
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 30 Jan 2016 20:44:37 +0900 |
parents | 6640b0d5bf13 |
children | 2f3e7bba038e |
comparison
equal
deleted
inserted
replaced
276:0faa561ac9ff | 277:7b4bcc7b5ae6 |
---|---|
233 tg->stateEnd->next = s; | 233 tg->stateEnd->next = s; |
234 tg->stateEnd = s; | 234 tg->stateEnd = s; |
235 s->bitState = bi; | 235 s->bitState = bi; |
236 s->cc = NULL; | 236 s->cc = NULL; |
237 s->node = NULL; | 237 s->node = NULL; |
238 s->tState = NULL; | |
238 return s; | 239 return s; |
239 } | 240 } |
240 | 241 |
241 StatePtr createState(TGValue tgv,NodePtr n) { | 242 StatePtr createState(TGValue tgv,NodePtr n) { |
242 BitVector bi = createBitVector(tgv.tg->totalStateCount); | 243 BitVector bi = createBitVector(tgv.tg->totalStateCount); |
362 return tgv; | 363 return tgv; |
363 } | 364 } |
364 | 365 |
365 void createAnyState(TransitionGeneratorPtr tg) { | 366 void createAnyState(TransitionGeneratorPtr tg) { |
366 BitVector anyBi = createBitVector(tg->totalBasicState); | 367 BitVector anyBi = createBitVector(tg->totalBasicState); |
367 anyBi.bitContainer = anyBi.bitContainer * 2 - 1; // all bit 1 state | 368 anyBi.bitContainer = anyBi.bitContainer - 1; // all bit 1 state |
369 anyBi.bitContainer ^= 2; // exclude Accept State | |
368 tg->anyState = createState(tg,anyBi); | 370 tg->anyState = createState(tg,anyBi); |
371 determinize(tg->anyState,tg); | |
369 tg->stateArray[tg->anyState->bitState.bitContainer] = tg->anyState; | 372 tg->stateArray[tg->anyState->bitState.bitContainer] = tg->anyState; |
370 } | 373 } |
371 | 374 |
372 void printState(StatePtr state) { | 375 void printState(StatePtr state) { |
373 printf("state : %lx\n",state->bitState.bitContainer); | 376 printf("state : %lx\n",state->bitState.bitContainer); |
410 s->accept = true; | 413 s->accept = true; |
411 continue; // EOF case | 414 continue; // EOF case |
412 } | 415 } |
413 StatePtr base = tg->stateArray[baseNum]; | 416 StatePtr base = tg->stateArray[baseNum]; |
414 if (base == NULL) { | 417 if (base == NULL) { |
418 fprintf(stderr,"baseNum=%lx ",baseNum); | |
415 errorMassege("No base state",__LINE__,__FILE__); break; | 419 errorMassege("No base state",__LINE__,__FILE__); break; |
416 } | 420 } |
417 CharClassPtr merge = mergeTransition(s,base->cc); | 421 CharClassPtr merge = mergeTransition(s,base->cc); |
418 s->cc = merge; | 422 s->cc = merge; |
419 } | 423 } |