Mercurial > hg > Applications > Grep
comparison regexParser/subsetConstraction.cc @ 188:109d22faf7b5 pairPro
remove errors and warnings
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 25 Dec 2015 02:57:21 +0900 |
parents | ef798db705e9 |
children | fccf7941ecc2 |
comparison
equal
deleted
inserted
replaced
187:ef798db705e9 | 188:109d22faf7b5 |
---|---|
33 // 重なっているccの領域を分割する | 33 // 重なっているccの領域を分割する |
34 // 必要ならばnextStateを重ねあわせる | 34 // 必要ならばnextStateを重ねあわせる |
35 // 変更があった場合は新しくリストを作って返す | 35 // 変更があった場合は新しくリストを作って返す |
36 if (end < cc->cond.range.begin ) { // 1 | 36 if (end < cc->cond.range.begin ) { // 1 |
37 if (cc->left) { | 37 if (cc->left) { |
38 return createCharClassRange(cc->cond.range.begin,cc->cond.range.end,charClassMerge(cc->left,begin,end,nextState),cc->right); | 38 return createCharClassRange(cc->cond.range.begin,cc->cond.range.end,nextState.bitContainer,charClassMerge(cc->left,begin,end,nextState),cc->right); |
39 } else { | 39 } else { |
40 return createCharClassRange(begin,end,nextState.bitContainer,NULL,cc); | 40 return createCharClassRange(begin,end,nextState.bitContainer,NULL,cc); |
41 } | 41 } |
42 } else if (end == cc->cond.range.begin && begin != end ) { // 2 | 42 } else if (end == cc->cond.range.begin && begin != end ) { // 2 |
43 CharClassPtr cc1 = mergeCCTree(cc->left,begin,end-1,nextState); | 43 CharClassPtr cc1 = mergeCCTree(cc->left,begin,end-1,nextState); |
73 CharClassPtr cc2 = createCharClassRange(begin,cc->cond.range.end,cc->nextState.bitContainer | nextState.bitContainer,NULL,cc->right); | 73 CharClassPtr cc2 = createCharClassRange(begin,cc->cond.range.end,cc->nextState.bitContainer | nextState.bitContainer,NULL,cc->right); |
74 return createCharClassRange(cc->cond.range.begin,begin-1,cc->nextState.bitContainer,cc->left,cc2); | 74 return createCharClassRange(cc->cond.range.begin,begin-1,cc->nextState.bitContainer,cc->left,cc2); |
75 } | 75 } |
76 if (begin > cc->cond.range.end ) { // 13 | 76 if (begin > cc->cond.range.end ) { // 13 |
77 if (cc->right) { | 77 if (cc->right) { |
78 return createCharClassRange(cc->cond.range.begin,cc->cond.range.end,cc->left,charClassMerge(cc->right,begin,end,nextState)); | 78 return createCharClassRange(cc->cond.range.begin,cc->cond.range.end,nextState.bitContainer,cc->left,charClassMerge(cc->right,begin,end,nextState)); |
79 } else { | 79 } else { |
80 return createCharClassRange(begin,end,nextState.bitContainer,cc,NULL); | 80 return createCharClassRange(begin,end,nextState.bitContainer,cc,NULL); |
81 } | 81 } |
82 } | 82 } |
83 if (begin >= cc->cond.range.begin && begin <= cc->cond.range.end) { | 83 if (begin >= cc->cond.range.begin && begin <= cc->cond.range.end) { |
235 return tgRight; | 235 return tgRight; |
236 } | 236 } |
237 TGValue tgRight = tgLeft; | 237 TGValue tgRight = tgLeft; |
238 tgRight.stateBegin = ++tgRight.stateNum; | 238 tgRight.stateBegin = ++tgRight.stateNum; |
239 n->right->state = createState(tgRight,n->right); | 239 n->right->state = createState(tgRight,n->right); |
240 TGValue tgv1 = stateAllocate(n->right,tgLeft); | |
241 return tgLeft; | 240 return tgLeft; |
242 } else if (n->tokenType == '|') { | 241 } else if (n->tokenType == '|') { |
243 TGValue tgv = stateAllocate(n->left,tg); | 242 TGValue tgv = stateAllocate(n->left,tg); |
244 TGValue tgv1 = stateAllocate(n->right,tgv); | 243 TGValue tgv1 = stateAllocate(n->right,tgv); |
245 return tgv1; | 244 return tgv1; |
314 TransitionGeneratorPtr generateTransitionList(NodePtr n) { | 313 TransitionGeneratorPtr generateTransitionList(NodePtr n) { |
315 TransitionGeneratorPtr tg = createTransitionGenerator(); | 314 TransitionGeneratorPtr tg = createTransitionGenerator(); |
316 TGValue tgv; | 315 TGValue tgv; |
317 tgv.asterisk = false; | 316 tgv.asterisk = false; |
318 tgv.tg = tg; | 317 tgv.tg = tg; |
319 node::StatePtr start = createState(tgv,n); | 318 tgv.tg->startState = createState(tgv,n); |
320 NodePtr eof = createNode(NULL,'e',NULL,NULL,NULL); | 319 NodePtr eof = createNode(NULL,'e',NULL,NULL,NULL); |
321 node::StatePtr end = createState(tgv,eof); | 320 tgv.tg->endState = createState(tgv,eof); |
322 tgv.stateBegin = 0; | 321 tgv.stateBegin = 0; |
323 tgv.stateEnd = 1; | 322 tgv.stateEnd = 1; |
324 stateAllocate(n,tgv); | 323 stateAllocate(n,tgv); |
325 tgv.tg->stateMax = tg->stateMax; | 324 tgv.tg->stateMax = tg->stateMax; |
326 tgv.tg->stateArray = (node::StatePtr)calloc(tg->stateMax,sizeof(node::StatePtr)); | 325 tgv.tg->stateArray = (node::StatePtr)calloc(tg->stateMax,sizeof(node::StatePtr)); |