Skip to content

Commit

Permalink
modify regex printing routine
Browse files Browse the repository at this point in the history
  • Loading branch information
sinya8282 committed Dec 20, 2011
1 parent 25a26c4 commit 4df3f3f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/recon.cc
Expand Up @@ -43,8 +43,13 @@ int main(int argc, char *argv[]) {
}

regen::Regex r = regen::Regex(regex, Regen::Options::Extended);
r.Compile(Regen::Options::O0);
if (minimize) r.MinimizeDFA();
if (generate == REGEN && !minimize) {
r.PrintRegex();
return 0;
} else {
r.Compile(Regen::Options::O0);
if (minimize) r.MinimizeDFA();
}

switch (generate) {
case CGEN:
Expand All @@ -54,9 +59,7 @@ int main(int argc, char *argv[]) {
r.MinimizeDFA();
regen::Generator::DotGenerate(r);
break;
case REGEN:
r.PrintRegex();
break;
case REGEN: break; // Unreachable
}
return 0;
}
2 changes: 1 addition & 1 deletion src/regex.cc
Expand Up @@ -676,7 +676,7 @@ bool Regex::Compile(Regen::Options::CompileFlag olevel) {
if (!dfa_failure_ && !dfa_.Complete()) {
/* try create DFA. */
std::size_t limit = state_exprs_.size();
limit = 1000; // default limitation is 1000 (it's may finish within a second).
limit = 10000; // default limitation is 10000 (it's may finish within a second).
dfa_failure_ = !dfa_.Construct(expr_root_, limit);
}
if (dfa_failure_) {
Expand Down

0 comments on commit 4df3f3f

Please sign in to comment.