Mercurial > hg > Applications > Grep
comparison regexParser/transition.cc @ 180:d97bcab546e8 pairPro
implement getNext
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 24 Dec 2015 17:56:28 +0900 |
parents | 8de9a33f6ae5 |
children | ef798db705e9 |
comparison
equal
deleted
inserted
replaced
179:6cf8252f3912 | 180:d97bcab546e8 |
---|---|
36 x1->next = createState(x->bitState); | 36 x1->next = createState(x->bitState); |
37 x1 = x1->next; | 37 x1 = x1->next; |
38 } | 38 } |
39 return x0; | 39 return x0; |
40 } | 40 } |
41 | |
42 TransitionPtr createTransition(CharClassPtr cc, BitVectorPtr state) { | |
43 TransitionPtr transition = NEW(Transition); | |
44 transition->condition = cc; | |
45 transition->condition->nextState = *state; | |
46 return transition; | |
47 } | |
48 | |
49 TransitionPtr appendTransition0(TransitionPtr x, TransitionPtr y) { | |
50 TransitionPtr x0 = x; | |
51 for(;;) { | |
52 if (x->next == NULL) { | |
53 x->next = y; | |
54 return x0; | |
55 } | |
56 } | |
57 return x; | |
58 } | |
59 | |
60 TransitionPtr appendTransition(TransitionPtr x, TransitionPtr y) { | |
61 TransitionPtr x0 = createTransition(x->condition, &x->condition->nextState); | |
62 TransitionPtr x1 = x0; | |
63 for(;;) { | |
64 if (x->next == NULL) { | |
65 x1->next = y; | |
66 return x0; | |
67 } | |
68 x = x->next; | |
69 x1->next = createTransition(x->condition, &x->condition->nextState); | |
70 x1 = x1->next; | |
71 } | |
72 return x0; | |
73 } |