Mercurial > hg > Applications > Grep
annotate regexParser/regexParser.h @ 175:3be0fbcd4b52 pairPro
implement createTransitionGenerator
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Dec 2015 20:27:26 +0900 (2015-12-22) |
parents | 3bf2c6d6d53e |
children | 5e8c6857934c |
rev | line source |
---|---|
118 | 1 #include "error.h" |
126 | 2 |
3 #define NEW(type) (type*)malloc(sizeof(type)) | |
175
3be0fbcd4b52
implement createTransitionGenerator
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
167
diff
changeset
|
4 #define SYNTAX_NODENUMBER 100 |
126 | 5 |
144
d8a4922eceae
remove some errors (not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
142
diff
changeset
|
6 typedef struct bitVector { |
d8a4922eceae
remove some errors (not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
142
diff
changeset
|
7 unsigned long bitContainer; |
d8a4922eceae
remove some errors (not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
142
diff
changeset
|
8 }BitVector,*BitVectorPtr; |
d8a4922eceae
remove some errors (not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
142
diff
changeset
|
9 |
129
b930be74a16e
remove word.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
126
diff
changeset
|
10 typedef struct word { |
b930be74a16e
remove word.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
126
diff
changeset
|
11 unsigned char *word; |
b930be74a16e
remove word.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
126
diff
changeset
|
12 int length; |
b930be74a16e
remove word.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
126
diff
changeset
|
13 } Word, *WordPtr; |
b930be74a16e
remove word.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
126
diff
changeset
|
14 |
126 | 15 typedef struct utf8Range { |
142 | 16 unsigned long begin; |
17 unsigned long end; | |
18 struct utf8Range *next; // only used in the parser. | |
126 | 19 } RangeList , *RangeListPtr; |
20 | |
116
66c633575b53
remove error and warning
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
115
diff
changeset
|
21 typedef union condition { |
142 | 22 RangeList range; |
23 Word w; | |
116
66c633575b53
remove error and warning
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
115
diff
changeset
|
24 } Condition, *ConditionList; |
66c633575b53
remove error and warning
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
115
diff
changeset
|
25 |
77
7f53a587bf97
add regexParser.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26 typedef struct charClass { |
111 | 27 unsigned char type; |
115
ca30f8334741
rename createRegexParser.cc to regexParser.cc
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
111
diff
changeset
|
28 struct charClass *left; |
ca30f8334741
rename createRegexParser.cc to regexParser.cc
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
111
diff
changeset
|
29 struct charClass *right; |
142 | 30 Condition cond; |
31 BitVector nextState; | |
77
7f53a587bf97
add regexParser.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
32 } CharClass, *CharClassPtr; |
7f53a587bf97
add regexParser.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
33 |
7f53a587bf97
add regexParser.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
34 typedef struct node { |
89
50a146c05192
add NodeNumber in Regex Parser tree
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
85
diff
changeset
|
35 unsigned char tokenType; |
111 | 36 unsigned long nodeNumber; |
37 CharClassPtr cc; | |
77
7f53a587bf97
add regexParser.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
38 struct node *left; |
7f53a587bf97
add regexParser.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
39 struct node *right; |
7f53a587bf97
add regexParser.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
40 } Node, *NodePtr; |
116
66c633575b53
remove error and warning
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
115
diff
changeset
|
41 |
66c633575b53
remove error and warning
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
115
diff
changeset
|
42 typedef struct regexInfo { |
66c633575b53
remove error and warning
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
115
diff
changeset
|
43 unsigned char *ptr; |
66c633575b53
remove error and warning
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
115
diff
changeset
|
44 unsigned char tokenType; |
118 | 45 unsigned char *tokenValue; |
116
66c633575b53
remove error and warning
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
115
diff
changeset
|
46 int nodeNumber; |
66c633575b53
remove error and warning
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
115
diff
changeset
|
47 } RegexInfo, *RegexInfoPtr; |
155 | 48 |
49 CharClassPtr createCharClassRange(unsigned long begin, unsigned long end, CharClassPtr left, CharClassPtr right); |