Mercurial > gnulib
changeset 39953:2f4c84e23e3c
dfa: remove unneeded code
By the addition of beg, a code for the initial state is unnecessary, so
remove it.
dfa.c (epsclosure): Remove a code for the initial state.
(dfaanalyze): Print follows for BEG in debug mode.
author | Norihiro Tanaka <noritnk@kcn.ne.jp> |
---|---|
date | Mon, 22 Oct 2018 23:22:40 +0900 |
parents | 72b39af7d945 |
children | b6666dd9d140 |
files | lib/dfa.c |
diffstat | 1 files changed, 5 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/dfa.c Fri Oct 26 09:46:25 2018 -0700 +++ b/lib/dfa.c Mon Oct 22 23:22:40 2018 +0900 @@ -2248,7 +2248,7 @@ constraint. Repeat exhaustively until no funny positions are left. S->elems must be large enough to hold the result. */ static void -epsclosure (position_set *initial, struct dfa const *d) +epsclosure (struct dfa const *d) { position_set tmp; alloc_position_set (&tmp, d->nleaves); @@ -2288,8 +2288,6 @@ for (size_t j = 0; j < d->tindex; j++) if (i != j && d->follows[j].nelem > 0) replace (&d->follows[j], i, &d->follows[i], constraint, &tmp); - - replace (initial, i, &d->follows[i], constraint, &tmp); } free (tmp.elems); } @@ -2680,9 +2678,9 @@ #ifdef DEBUG for (size_t i = 0; i < d->tindex; ++i) - if (d->tokens[i] < NOTCHAR || d->tokens[i] == BACKREF - || d->tokens[i] == ANYCHAR || d->tokens[i] == MBCSET - || d->tokens[i] >= CSET) + if (d->tokens[i] == BEG || d->tokens[i] < NOTCHAR + || d->tokens[i] == BACKREF || d->tokens[i] == ANYCHAR + || d->tokens[i] == MBCSET || d->tokens[i] >= CSET) { fprintf (stderr, "follows(%zu:", i); prtok (d->tokens[i]); @@ -2698,7 +2696,7 @@ /* For each follow set that is the follow set of a real position, replace it with its epsilon closure. */ - epsclosure (&d->follows[0], d); + epsclosure (d); /* Context wanted by some position. */ int separate_contexts = state_separate_contexts (&d->follows[0]);