Mercurial > hg > Members > masakoha > testcode
annotate c/regexParser/main.cc @ 139:6c258910cacb pairPro
remove some warning and error
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 07 Dec 2015 02:20:13 +0900 |
parents | ccc673449351 |
children | 84a2a5209d3a |
rev | line source |
---|---|
45 | 1 #include <stdio.h> |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2 #include <stdlib.h> |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
3 #include <string.h> |
139
6c258910cacb
remove some warning and error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
133
diff
changeset
|
4 #include "subsetConstraction.h" |
76 | 5 |
82
1d9bbf922bb6
add createRegexTree.cc
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
81
diff
changeset
|
6 extern NodePtr regex(RegexInfoPtr); |
79
52da06c3f050
add printTree.cc & fix Makefile
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
77
diff
changeset
|
7 extern void printTree(NodePtr); |
95
1cdad0468484
rename createRegexTree to createRegexParser
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
91
diff
changeset
|
8 BitVectorListPtr createBitVectorList(NodePtr); |
64
e0ad6c145f89
remove some errors
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
9 |
66
f8fb3b463f70
fix when '|' come procces
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents:
65
diff
changeset
|
10 |
62
a49b4a8b8c14
implement isLiteral
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
61
diff
changeset
|
11 int main(int argc, char **argv) |
55 | 12 { |
80
0a452d69f0e2
remove global variable in main.cc
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
79
diff
changeset
|
13 RegexInfoPtr ri = (RegexInfoPtr)malloc(sizeof(RegexInfo)); |
139
6c258910cacb
remove some warning and error
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
133
diff
changeset
|
14 TransitionGeneratorPtr tg = (TransitionGeneratorPtr)malloc(sizeof(TransitionGenerator)); |
91
912d7bd51f38
remove static variable in createRegexTree.cc
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
82
diff
changeset
|
15 ri->nodeNumber = 1; |
133
ccc673449351
Look ahead '*'
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
132
diff
changeset
|
16 ri->orNum = 0; |
ccc673449351
Look ahead '*'
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
132
diff
changeset
|
17 ri->asterFlag = false; |
80
0a452d69f0e2
remove global variable in main.cc
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
79
diff
changeset
|
18 |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
19 for (int i = 1; i < argc; i++) { |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
20 if (strcmp(argv[i],"-regex") == 0) { |
80
0a452d69f0e2
remove global variable in main.cc
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
79
diff
changeset
|
21 ri->ptr = (unsigned char*)argv[i+1]; i++; |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
22 } |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
23 } |
55 | 24 |
80
0a452d69f0e2
remove global variable in main.cc
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
79
diff
changeset
|
25 printf("regex : %s\n",ri->ptr); |
0a452d69f0e2
remove global variable in main.cc
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
79
diff
changeset
|
26 NodePtr n = regex(ri); |
66
f8fb3b463f70
fix when '|' come procces
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents:
65
diff
changeset
|
27 printTree(n); |
45 | 28 return 0; |
29 } |