mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-07 05:14:29 +08:00
Some more renames
This commit is contained in:
@@ -108,8 +108,8 @@ class Grammar(object):
|
||||
states = []
|
||||
for state in dfas:
|
||||
arcs = []
|
||||
for label, next_ in state.arcs.items():
|
||||
arcs.append((self._make_label(label), dfas.index(next_)))
|
||||
for terminal_or_nonterminal, next_ in state.arcs.items():
|
||||
arcs.append((self._make_label(terminal_or_nonterminal), dfas.index(next_)))
|
||||
if state.isfinal:
|
||||
arcs.append((0, dfas.index(state)))
|
||||
states.append(arcs)
|
||||
@@ -119,9 +119,9 @@ class Grammar(object):
|
||||
def _make_first(self, nonterminal):
|
||||
rawfirst = self._first_terminals[nonterminal]
|
||||
first = set()
|
||||
for label in rawfirst:
|
||||
ilabel = self._make_label(label)
|
||||
##assert ilabel not in first, "%s failed on <> ... !=" % label
|
||||
for terminal_or_nonterminal in rawfirst:
|
||||
ilabel = self._make_label(terminal_or_nonterminal)
|
||||
##assert ilabel not in first, "%s failed on <> ... !=" % terminal_or_nonterminal
|
||||
first.add(ilabel)
|
||||
return first
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class DFAState(object):
|
||||
self.from_rule = from_rule
|
||||
self.nfa_set = nfa_set
|
||||
self.isfinal = final in nfa_set
|
||||
self.arcs = {} # map from nonterminals or strings to DFAState
|
||||
self.arcs = {} # map from terminals/nonterminals to DFAState
|
||||
|
||||
def add_arc(self, next_, label):
|
||||
assert isinstance(label, str)
|
||||
|
||||
Reference in New Issue
Block a user