Skip to content

Commit

Permalink
Merge pull request #130 from yuan-xy/patch-1
Browse files Browse the repository at this point in the history
fix dump_nfa
  • Loading branch information
davidhalter committed May 30, 2020
2 parents 93b5e6d + 4403b5c commit 450e9d0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions parso/pgen2/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ def _dump_nfa(start, finish):
todo = [start]
for i, state in enumerate(todo):
print(" State", i, state is finish and "(final)" or "")
for label, next_ in state.arcs:
for arc in state.arcs:
label, next_ = arc.nonterminal_or_string, arc.next
if next_ in todo:
j = todo.index(next_)
else:
Expand Down Expand Up @@ -244,7 +245,7 @@ def generate_grammar(bnf_grammar, token_namespace):
rule_to_dfas = {}
start_nonterminal = None
for nfa_a, nfa_z in GrammarParser(bnf_grammar).parse():
#_dump_nfa(a, z)
#_dump_nfa(nfa_a, nfa_z)
dfas = _make_dfas(nfa_a, nfa_z)
#_dump_dfas(dfas)
# oldlen = len(dfas)
Expand Down

0 comments on commit 450e9d0

Please sign in to comment.