forked from VimPlug/jedi
Make some stuff private in the pgen parser API.
This commit is contained in:
@@ -137,9 +137,9 @@ class PgenParser(object):
|
|||||||
# Loop until the token is shifted; may raise exceptions
|
# Loop until the token is shifted; may raise exceptions
|
||||||
_gram = self.grammar
|
_gram = self.grammar
|
||||||
_labels = _gram.labels
|
_labels = _gram.labels
|
||||||
_push = self.push
|
_push = self._push
|
||||||
_pop = self.pop
|
_pop = self._pop
|
||||||
_shift = self.shift
|
_shift = self._shift
|
||||||
while True:
|
while True:
|
||||||
dfa, state, node = self.stack[-1]
|
dfa, state, node = self.stack[-1]
|
||||||
states, first = dfa
|
states, first = dfa
|
||||||
@@ -183,21 +183,21 @@ class PgenParser(object):
|
|||||||
value, start_pos, prefix, self.addtoken)
|
value, start_pos, prefix, self.addtoken)
|
||||||
break
|
break
|
||||||
|
|
||||||
def shift(self, type_, value, newstate, prefix, start_pos):
|
def _shift(self, type_, value, newstate, prefix, start_pos):
|
||||||
"""Shift a token. (Internal)"""
|
"""Shift a token. (Internal)"""
|
||||||
dfa, state, node = self.stack[-1]
|
dfa, state, node = self.stack[-1]
|
||||||
newnode = self.convert_leaf(self.grammar, type_, value, prefix, start_pos)
|
newnode = self.convert_leaf(self.grammar, type_, value, prefix, start_pos)
|
||||||
node[-1].append(newnode)
|
node[-1].append(newnode)
|
||||||
self.stack[-1] = (dfa, newstate, node)
|
self.stack[-1] = (dfa, newstate, node)
|
||||||
|
|
||||||
def push(self, type_, newdfa, newstate):
|
def _push(self, type_, newdfa, newstate):
|
||||||
"""Push a nonterminal. (Internal)"""
|
"""Push a nonterminal. (Internal)"""
|
||||||
dfa, state, node = self.stack[-1]
|
dfa, state, node = self.stack[-1]
|
||||||
newnode = (type_, [])
|
newnode = (type_, [])
|
||||||
self.stack[-1] = (dfa, newstate, node)
|
self.stack[-1] = (dfa, newstate, node)
|
||||||
self.stack.append((newdfa, 0, newnode))
|
self.stack.append((newdfa, 0, newnode))
|
||||||
|
|
||||||
def pop(self):
|
def _pop(self):
|
||||||
"""Pop a nonterminal. (Internal)"""
|
"""Pop a nonterminal. (Internal)"""
|
||||||
popdfa, popstate, (type_, children) = self.stack.pop()
|
popdfa, popstate, (type_, children) = self.stack.pop()
|
||||||
# If there's exactly one child, return that child instead of creating a
|
# If there's exactly one child, return that child instead of creating a
|
||||||
|
|||||||
Reference in New Issue
Block a user