mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-24 05:01:44 +08:00
More dict to set
This commit is contained in:
@@ -115,7 +115,7 @@ class ParserGenerator(object):
|
|||||||
dfas = self._nonterminal_to_dfas[name]
|
dfas = self._nonterminal_to_dfas[name]
|
||||||
self._first[name] = None # dummy to detect left recursion
|
self._first[name] = None # dummy to detect left recursion
|
||||||
state = dfas[0]
|
state = dfas[0]
|
||||||
totalset = {}
|
totalset = set()
|
||||||
overlapcheck = {}
|
overlapcheck = {}
|
||||||
for nonterminal_or_string, next in state.arcs.items():
|
for nonterminal_or_string, next in state.arcs.items():
|
||||||
if nonterminal_or_string in self._nonterminal_to_dfas:
|
if nonterminal_or_string in self._nonterminal_to_dfas:
|
||||||
@@ -133,8 +133,8 @@ class ParserGenerator(object):
|
|||||||
overlapcheck[nonterminal_or_string] = fset
|
overlapcheck[nonterminal_or_string] = fset
|
||||||
else:
|
else:
|
||||||
# It's a string. We have finally found a possible first token.
|
# It's a string. We have finally found a possible first token.
|
||||||
totalset[nonterminal_or_string] = 1
|
totalset.add(nonterminal_or_string)
|
||||||
overlapcheck[nonterminal_or_string] = {nonterminal_or_string: 1}
|
overlapcheck[nonterminal_or_string] = set([nonterminal_or_string])
|
||||||
inverse = {}
|
inverse = {}
|
||||||
for nonterminal_or_string, itsfirst in overlapcheck.items():
|
for nonterminal_or_string, itsfirst in overlapcheck.items():
|
||||||
for symbol in itsfirst:
|
for symbol in itsfirst:
|
||||||
|
|||||||
Reference in New Issue
Block a user