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