mirror of
https://github.com/davidhalter/parso.git
synced 2026-11-05 02:02:49 +08:00
Use nonterminals instead of numbers if possible
This commit is contained in:
1 parent
87299335c4
commit
878b4b2d3b
3 files changed
+3
-8
No files matched your search
@@ -211,7 +211,3 @@ class Grammar(object):
|
||||
(nonterminal, terminal, nonterminal_or_string, inverse[terminal]))
|
||||
inverse[terminal] = nonterminal_or_string
|
||||
self._first_terminals[nonterminal] = totalset
|
||||
|
||||
@property
|
||||
def start(self):
|
||||
return self.nonterminal2number[self.start_nonterminal]
|
||||
@@ -114,7 +114,8 @@ class PgenParser(object):
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, grammar, convert_node, convert_leaf, error_recovery, start):
|
||||
def __init__(self, grammar, convert_node, convert_leaf, error_recovery,
|
||||
start_nonterminal):
|
||||
"""Constructor.
|
||||
|
||||
The grammar argument is a grammar.Grammar instance; see the
|
||||
@@ -144,7 +145,6 @@ class PgenParser(object):
|
||||
self.convert_node = convert_node
|
||||
self.convert_leaf = convert_leaf
|
||||
|
||||
start_nonterminal = grammar.number2nonterminal[start]
|
||||
self.stack = Stack([StackNode(grammar._nonterminal_to_dfas[start_nonterminal][0])])
|
||||
self.rootnode = None
|
||||
self.error_recovery = error_recovery
|
||||
|
||||
Reference in new issue
Block a user