annotate regexParser/regexParser.h @ 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 3e8e5780ad4a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
118
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
1 #include "error.h"
126
639b0b437ebf remove error (do not work)
masa
parents: 125
diff changeset
2 #define NEW(type) (type*)malloc(sizeof(type))
175
3be0fbcd4b52 implement createTransitionGenerator
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 167
diff changeset
3 #define SYNTAX_NODENUMBER 100
126
639b0b437ebf remove error (do not work)
masa
parents: 125
diff changeset
4
188
109d22faf7b5 remove errors and warnings
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 187
diff changeset
5 #ifndef INCLUDED_STRUCT
109d22faf7b5 remove errors and warnings
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 187
diff changeset
6 #define INCLUDED_STRUCT
144
d8a4922eceae remove some errors (not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 142
diff changeset
7 typedef struct bitVector {
d8a4922eceae remove some errors (not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 142
diff changeset
8 unsigned long bitContainer;
d8a4922eceae remove some errors (not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 142
diff changeset
9 }BitVector,*BitVectorPtr;
d8a4922eceae remove some errors (not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 142
diff changeset
10
129
b930be74a16e remove word.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 126
diff changeset
11 typedef struct word {
b930be74a16e remove word.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 126
diff changeset
12 unsigned char *word;
b930be74a16e remove word.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 126
diff changeset
13 int length;
b930be74a16e remove word.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 126
diff changeset
14 } Word, *WordPtr;
b930be74a16e remove word.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 126
diff changeset
15
126
639b0b437ebf remove error (do not work)
masa
parents: 125
diff changeset
16 typedef struct utf8Range {
142
de0f332d560c insert charClassMerge function
masa
parents: 133
diff changeset
17 unsigned long begin;
de0f332d560c insert charClassMerge function
masa
parents: 133
diff changeset
18 unsigned long end;
de0f332d560c insert charClassMerge function
masa
parents: 133
diff changeset
19 struct utf8Range *next; // only used in the parser.
126
639b0b437ebf remove error (do not work)
masa
parents: 125
diff changeset
20 } RangeList , *RangeListPtr;
639b0b437ebf remove error (do not work)
masa
parents: 125
diff changeset
21
178
5e8c6857934c implement charClassMerge
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
22 typedef struct condition {
142
de0f332d560c insert charClassMerge function
masa
parents: 133
diff changeset
23 RangeList range;
de0f332d560c insert charClassMerge function
masa
parents: 133
diff changeset
24 Word w;
116
66c633575b53 remove error and warning
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
25 } Condition, *ConditionList;
66c633575b53 remove error and warning
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
26
77
7f53a587bf97 add regexParser.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 typedef struct charClass {
111
1d30f70702df add determinize.cc and transition.cc
masa
parents: 110
diff changeset
28 unsigned char type;
115
ca30f8334741 rename createRegexParser.cc to regexParser.cc
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
29 struct charClass *left;
ca30f8334741 rename createRegexParser.cc to regexParser.cc
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 111
diff changeset
30 struct charClass *right;
142
de0f332d560c insert charClassMerge function
masa
parents: 133
diff changeset
31 Condition cond;
de0f332d560c insert charClassMerge function
masa
parents: 133
diff changeset
32 BitVector nextState;
77
7f53a587bf97 add regexParser.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 } CharClass, *CharClassPtr;
7f53a587bf97 add regexParser.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34
7f53a587bf97 add regexParser.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 typedef struct node {
89
50a146c05192 add NodeNumber in Regex Parser tree
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 85
diff changeset
36 unsigned char tokenType;
111
1d30f70702df add determinize.cc and transition.cc
masa
parents: 110
diff changeset
37 CharClassPtr cc;
183
7ae0a3070647 implement generateTransitionList
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
38 int stateNum;
7ae0a3070647 implement generateTransitionList
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
39 int nextStateNum;
187
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
40 typedef struct state {
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
41 BitVector bitState;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
42 CharClassPtr cc;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
43 struct node *node;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
44 struct state *next;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
45 } State, *StatePtr;
183
7ae0a3070647 implement generateTransitionList
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 180
diff changeset
46 StatePtr state;
77
7f53a587bf97 add regexParser.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 struct node *left;
7f53a587bf97 add regexParser.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 struct node *right;
7f53a587bf97 add regexParser.h
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 } Node, *NodePtr;
116
66c633575b53 remove error and warning
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
50
187
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
51 typedef struct stateStack {
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
52 BitVector state;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
53 struct stateStack *next;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
54 } StateStack, *StateStackPtr;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
55
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
56 typedef struct transitionGenerator {
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
57 long stateMax;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
58 StateStackPtr stack;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
59 node::StatePtr state;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
60 node::StatePtr stateArray;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
61 node::StatePtr currentState;
188
109d22faf7b5 remove errors and warnings
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 187
diff changeset
62 node::StatePtr startState;
109d22faf7b5 remove errors and warnings
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 187
diff changeset
63 node::StatePtr endState;
187
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
64 } TransitionGenerator, *TransitionGeneratorPtr;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
65
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
66 typedef struct tgValue {
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
67 bool asterisk;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
68 int stateNum;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
69 int stateBegin;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
70 int stateEnd;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
71 node::StatePtr tgState;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
72 TransitionGeneratorPtr tg;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
73 } TGValue, *TGValuePtr;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
74
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
75 enum charClassStackState {
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
76 LEFT,
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
77 SELF,
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
78 RIGHT
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
79 };
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
80
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
81 typedef struct charClassStack {
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
82 charClassStackState turn;
184
1da1b2eacb84 gather struct
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 183
diff changeset
83 CharClassPtr cc;
187
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
84 struct charClassStack *next;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
85 } CharClassStack, *CharClassStackPtr;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
86
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
87 typedef struct charClassWalker {
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
88 CharClassStackPtr stack;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
89 CharClassPtr next;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
90 } CharClassWalker, *CharClassWalkerPtr;
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
91
184
1da1b2eacb84 gather struct
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 183
diff changeset
92
116
66c633575b53 remove error and warning
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
93 typedef struct regexInfo {
66c633575b53 remove error and warning
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
94 unsigned char *ptr;
66c633575b53 remove error and warning
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
95 unsigned char tokenType;
118
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 116
diff changeset
96 unsigned char *tokenValue;
178
5e8c6857934c implement charClassMerge
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
97 int stateNumber;
116
66c633575b53 remove error and warning
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 115
diff changeset
98 } RegexInfo, *RegexInfoPtr;
188
109d22faf7b5 remove errors and warnings
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 187
diff changeset
99 #endif
187
ef798db705e9 remove some warnings and errors(not working)
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 186
diff changeset
100 NodePtr createNode(RegexInfoPtr ri,unsigned char type,CharClassPtr cc, NodePtr left, NodePtr right);
188
109d22faf7b5 remove errors and warnings
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents: 187
diff changeset
101 extern CharClassPtr createCharClassRange(unsigned long begin, unsigned long end,unsigned long state, CharClassPtr left, CharClassPtr right);