comparison regexParser/subsetConstraction.cc @ 198:35608dc85e83

add test
author Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
date Sat, 26 Dec 2015 17:23:25 +0900
parents 4fefd80c05f2
children b8bc24abaf8a
comparison
equal deleted inserted replaced
196:9f96223f54aa 198:35608dc85e83
227 * があったら、次の状態はその時の先頭の状態になる 227 * があったら、次の状態はその時の先頭の状態になる
228 */ 228 */
229 TGValue stateAllocate(NodePtr n,TGValue tgv) { 229 TGValue stateAllocate(NodePtr n,TGValue tgv) {
230 if (n->tokenType == '+') { 230 if (n->tokenType == '+') {
231 TGValue tgvLeft = stateAllocate(n->left,tgv); 231 TGValue tgvLeft = stateAllocate(n->left,tgv);
232 n->left->state = createState(tgvLeft,n->left);
232 if (tgvLeft.asterisk) { 233 if (tgvLeft.asterisk) {
233 TGValue tgvRight = tgvLeft; 234 TGValue tgvRight = tgvLeft;
234 tgvRight.asterisk = false; 235 tgvRight.asterisk = false;
235 tgvRight = stateAllocate(n->right,tgvRight); 236 tgvRight = stateAllocate(n->right,tgvRight);
236 tgvRight.asterisk = true; 237 tgvRight.asterisk = true;
337 338
338 void printState(StatePtr state) { 339 void printState(StatePtr state) {
339 printf("state : %lx\n",state->bitState.bitContainer); 340 printf("state : %lx\n",state->bitState.bitContainer);
340 long nodeNumber = 0; 341 long nodeNumber = 0;
341 if (state->node) { 342 if (state->node) {
342 printf("node : %c %lx -> %d\n",state->node->tokenType,state->bitState.bitContainer,state->node->nextStateNum); 343 if (state->node->nextState) {
344 printf("node : %c %lx -> %lx\n",state->node->tokenType,
345 state->bitState.bitContainer,state->node->nextState->bitState.bitContainer);
343 if (state->node->state) 346 if (state->node->state)
344 nodeNumber = state->node->state->bitState.bitContainer; 347 nodeNumber = state->node->state->bitState.bitContainer;
348 }
345 } 349 }
346 if (state->cc) { 350 if (state->cc) {
347 printCharacterClass(state->cc,nodeNumber,4); 351 printCharacterClass(state->cc,nodeNumber,4);
348 } 352 }
349 } 353 }