Mercurial > hg > Applications > Grep
comparison regexParser/main.cc @ 231:d67649929e96
add grepWalk
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 19 Jan 2016 12:54:11 +0900 |
parents | 399380ad95b7 |
children | 1a34e702776a |
comparison
equal
deleted
inserted
replaced
230:2081b9d6a179 | 231:d67649929e96 |
---|---|
2 #include <stdlib.h> | 2 #include <stdlib.h> |
3 #include <string.h> | 3 #include <string.h> |
4 #include "regexParser.h" | 4 #include "regexParser.h" |
5 #include "subsetConstruction.h" | 5 #include "subsetConstruction.h" |
6 #include "node.h" | 6 #include "node.h" |
7 #include "grepWalk.h" | |
7 | 8 |
8 int main(int argc, char **argv) | 9 int main(int argc, char **argv) |
9 { | 10 { |
10 bool generate = true; | 11 bool generate = true; |
11 bool subset = false; | 12 bool subset = false; |
28 | 29 |
29 printf("regex : %s\n",ri.ptr); | 30 printf("regex : %s\n",ri.ptr); |
30 NodePtr n = regex(&ri); // parse only | 31 NodePtr n = regex(&ri); // parse only |
31 printTree(n); | 32 printTree(n); |
32 | 33 |
34 TGValue tgv; | |
33 if (generate && !subset) { // NFA generation | 35 if (generate && !subset) { // NFA generation |
34 TGValue tgv = generateTransitionList(n); | 36 tgv = generateTransitionList(n); |
35 printTree(n); | 37 printTree(n); |
36 printState(tgv.tg); | 38 printState(tgv.tg); |
37 if (generateSequentialSearch) { | 39 if (generateSequentialSearch) { |
38 exportState(tgv.tg); | 40 exportState(tgv.tg); |
39 } | 41 } |
40 } else if (subset) { | 42 } else if (subset) { |
41 TGValue tgv = generateTransitionList(n); | 43 tgv = generateTransitionList(n); |
42 SCValue scv = createSCValue(tgv); | 44 SCValue scv = createSCValue(tgv); |
43 subsetConstruction(scv); // Determinization | 45 subsetConstruction(scv); // Determinization |
44 printState(tgv.tg); | 46 printState(tgv.tg); |
45 if (generateSequentialSearch) { | 47 if (generateSequentialSearch) { |
46 exportState(tgv.tg); | 48 exportState(tgv.tg); |
47 } | 49 } |
48 } | 50 } |
51 | |
52 grepWalk(tgv.tg); | |
49 return 0; | 53 return 0; |
50 } | 54 } |