Mercurial > hg > Members > masakoha > testcode
annotate c/regexParser/main.cc @ 133:ccc673449351 pairPro
Look ahead '*'
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 03 Dec 2015 20:47:11 +0900 |
parents | fb4c8adf3a80 |
children | 6c258910cacb |
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> |
95
1cdad0468484
rename createRegexTree to createRegexParser
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
91
diff
changeset
|
4 #include "bitVector.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)); |
91
912d7bd51f38
remove static variable in createRegexTree.cc
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
82
diff
changeset
|
14 ri->nodeNumber = 1; |
133
ccc673449351
Look ahead '*'
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
132
diff
changeset
|
15 ri->orNum = 0; |
ccc673449351
Look ahead '*'
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
132
diff
changeset
|
16 ri->asterFlag = false; |
80
0a452d69f0e2
remove global variable in main.cc
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
79
diff
changeset
|
17 |
56
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
18 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
|
19 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
|
20 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
|
21 } |
8901bc071d33
implement string() and literal()
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
22 } |
55 | 23 |
80
0a452d69f0e2
remove global variable in main.cc
Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
parents:
79
diff
changeset
|
24 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
|
25 NodePtr n = regex(ri); |
66
f8fb3b463f70
fix when '|' come procces
Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
parents:
65
diff
changeset
|
26 printTree(n); |
45 | 27 return 0; |
28 } |