Mercurial > hg > Applications > Grep
comparison c/regexParser/transition.h @ 110:a3adc5c24e19 pairPro
start branch
author | masa |
---|---|
date | Fri, 20 Nov 2015 21:02:00 +0900 |
parents | |
children | ec485345daf9 |
comparison
equal
deleted
inserted
replaced
109:6401c708f5dd | 110:a3adc5c24e19 |
---|---|
1 typedef struct transition { | |
2 CharClassPtr condition; | |
3 BitVectorPtr nextState; | |
4 struct transition *next; | |
5 } Transition, TransitionPtr; | |
6 | |
7 | |
8 typedef struct state { | |
9 TransitionPtr transition; | |
10 struct state *next; | |
11 } State; StatePtr; | |
12 /* | |
13 正規表現木を辿って transition のList をつくる | |
14 HcarClass のかさなりを判定して重なりのない新しいCharClassをつくる | |
15 重なっている状態はbitvectorのorをとる | |
16 重なっている状態はそれぞれの状態について木をたどる | |
17 | |
18 nextState == 0 は正規表現の末端を表す | |
19 nextState == 1 は受理状態を表す | |
20 正規表現のノードの番号 n に対応する 2^n のbitをセットした状態 | |
21 | |
22 | |
23 | の場合は両方のListを結合する | |
24 + の場合は左のノードに * がある場合は右のリストも結合する | |
25 左のノードにあすたがない場合は、右のほうだけみる | |
26 * は直下のリストを使って、次の状態を自分自身にする | |
27 */ |