Skip to content

Commit

Permalink
fix: items follow set calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
igordejanovic committed Feb 13, 2024
1 parent d0aca9e commit b56e2d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion parglare/closure.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def closure(state, itemset_type, first_sets=None):
for prod in [p for p in state.grammar.productions
if p.symbol == symbol]:
new_item = LRItem(prod, 0,
follow if itemset_type is LR_1 else None)
set(follow) if itemset_type is LR_1 else None)
if new_item not in state.items:
# If the item doesn't exists yet add it and reprocess it.
state.items.append(new_item)
Expand Down
4 changes: 2 additions & 2 deletions parglare/tables/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,10 @@ def create_table(grammar, itemset_type=LR_1, start_production=1,
update = False

for state in states:

# First refresh current state's follows
# First refresh state's follows
closure(state, LR_1, first_sets)

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

0 comments on commit b56e2d0

Please sign in to comment.