mirror of
https://github.com/davidhalter/parso.git
synced 2026-09-21 02:33:16 +08:00
Remove a while loop that is not necessary
This commit is contained in:
@@ -167,14 +167,12 @@ class PgenParser(object):
|
||||
ilabel = token_to_ilabel(self.grammar, type_, value)
|
||||
stack = self.stack
|
||||
|
||||
while True:
|
||||
ilabel
|
||||
try:
|
||||
plan = stack[-1].current_dfa.ilabel_to_plan[ilabel]
|
||||
except KeyError:
|
||||
self.error_recovery(self.grammar, stack, type_,
|
||||
value, start_pos, prefix, self.add_token)
|
||||
break
|
||||
return False
|
||||
|
||||
stack[-1].current_dfa = plan.next_dfa
|
||||
for push in plan.pushes:
|
||||
@@ -199,6 +197,8 @@ class PgenParser(object):
|
||||
except IndexError:
|
||||
# Stack is empty, set the rootnode.
|
||||
self.rootnode = new_node
|
||||
return True
|
||||
return False
|
||||
|
||||
def add_token(self, type_, value, start_pos, prefix):
|
||||
"""Add a token; return True if this is the end of the program."""
|
||||
|
||||
Reference in New Issue
Block a user