Skip to content

Commit b56e2d0

Browse files
committed
fix: items follow set calculation
1 parent d0aca9e commit b56e2d0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

parglare/closure.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def closure(state, itemset_type, first_sets=None):
3030
for prod in [p for p in state.grammar.productions
3131
if p.symbol == symbol]:
3232
new_item = LRItem(prod, 0,
33-
follow if itemset_type is LR_1 else None)
33+
set(follow) if itemset_type is LR_1 else None)
3434
if new_item not in state.items:
3535
# If the item doesn't exists yet add it and reprocess it.
3636
state.items.append(new_item)

parglare/tables/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,10 @@ def create_table(grammar, itemset_type=LR_1, start_production=1,
238238
update = False
239239

240240
for state in states:
241-
242-
# First refresh current state's follows
241+
# First refresh state's follows
243242
closure(state, LR_1, first_sets)
244243

244+
for state in states:
245245
# Propagate follows to next states. GOTOs/ACTIONs keep
246246
# information about states created from this state
247247
inc_items = [i.get_pos_inc() for i in state.items]

0 commit comments

Comments
 (0)