Skip to content

Commit bed65ed

Browse files
committed
reduce after specialize
1 parent ea17a43 commit bed65ed

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

grape/automaton/spec_manager.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,14 @@ def make_var(i: int):
6060
new_rules[(P, args)] = dst
6161

6262
if whatever or syntax is None:
63-
return DFTA(new_rules, set(list(grammar.finals)))
63+
dfta = DFTA(new_rules, set(list(grammar.finals)))
6464
else:
6565
state_to_type = syntax.get_state_types(grammar)
66-
return DFTA(
66+
dfta = DFTA(
6767
new_rules, set(s for s in grammar.finals if state_to_type[s] == rtype)
6868
)
69+
dfta.reduce()
70+
return dfta
6971

7072

7173
def is_specialized(grammar: DFTA[T, str] | DFTA[T, Program]) -> bool:

0 commit comments

Comments
 (0)