summaryrefslogtreecommitdiff
path: root/src/grammar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/grammar.c')
-rw-r--r--src/grammar.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/grammar.c b/src/grammar.c
index c12ddec..3b5a959 100644
--- a/src/grammar.c
+++ b/src/grammar.c
@@ -676,7 +676,7 @@ nt_first(CC_MOD(Grammar *) g, CCR_MOD(BOOL *) nts,
BOOL
tnt_first(CC_MOD(ht *) terminal_hts, CC_MOD(ht *) predicate_hts,
- CCR_MOD(BOOL *) nts, NUM len, List *tnts,
+ CCR_MOD(BOOL *) nts, NUM len, CCR_MOD(List *) tnts,
ht * const restrict result_terminals,
ht * const restrict result_predicates)
{
@@ -787,8 +787,8 @@ nt_follow(CC_MOD(Grammar *) g, CCR_MOD(BOOL *) nts,
Rule_group *rg = grammar_rule(g, (NT) i);
NUM rg_length = rg_len(rg);
- for (NUM j = 0; j < rg_length;) {
- List *string = rg_nth(rg, j++);
+ for (NUM j = 0; j < rg_length; j++) {
+ List *string = rg_nth(rg, j);
NUM string_len = list_length(string);
TNT *top = NULL;
@@ -842,13 +842,12 @@ nt_follow(CC_MOD(Grammar *) g, CCR_MOD(BOOL *) nts,
if (k+1 == string_len ||
(rest_produce_epsilon >= 0 &&
- rest_produce_epsilon <= k))
+ rest_produce_epsilon <= k+1))
goto add_to_follow;
break;
add_to_follow:
-
ht_len = ht_size(result_terminals+i);
keys = (NUM **) ht_keys(result_terminals+i);