Mercurial > hg > Applications > Grep
diff regexParser/main.cc @ 216:4852bfa85db4
spell fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 30 Dec 2015 15:05:06 +0900 |
parents | a94f57af1600 |
children | a9e3512120e2 |
line wrap: on
line diff
--- a/regexParser/main.cc Tue Dec 29 19:01:23 2015 +0900 +++ b/regexParser/main.cc Wed Dec 30 15:05:06 2015 +0900 @@ -2,23 +2,40 @@ #include <stdlib.h> #include <string.h> #include "regexParser.h" -#include "subsetConstraction.h" +#include "subsetConstruction.h" #include "node.h" int main(int argc, char **argv) { + bool generate = true; + bool subset = false; + RegexInfo ri; ri.stateNumber = 1; for (int i = 1; i < argc; i++) { if (strcmp(argv[i],"-regex") == 0) { ri.ptr = (unsigned char*)argv[i+1]; i++; + } else if (strcmp(argv[i],"-noGeneration") == 0) { + generate = false; + } else if (strcmp(argv[i],"-subset") == 0) { + subset = true; } } + if (!ri.ptr) return 0; + printf("regex : %s\n",ri.ptr); - NodePtr n = regex(&ri); + NodePtr n = regex(&ri); // parse only printTree(n); - TransitionGeneratorPtr tg = generateTransitionList(n); - printTree(n); - printState(tg); + + if (generate) { // NFA generation + TGValue tgv = generateTransitionList(n); + printState(tgv.tg); + } else if (subset) { + TGValue tgv = generateTransitionList(n); + SCValue scv = createSCValue(tgv); + subsetConstruction(scv); // Determinization + printState(tgv.tg); + } + return 0; }