mirror of
https://github.com/davidhalter/parso.git
synced 2026-08-13 19:41:03 +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)
|
ilabel = token_to_ilabel(self.grammar, type_, value)
|
||||||
stack = self.stack
|
stack = self.stack
|
||||||
|
|
||||||
while True:
|
|
||||||
ilabel
|
|
||||||
try:
|
try:
|
||||||
plan = stack[-1].current_dfa.ilabel_to_plan[ilabel]
|
plan = stack[-1].current_dfa.ilabel_to_plan[ilabel]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self.error_recovery(self.grammar, stack, type_,
|
self.error_recovery(self.grammar, stack, type_,
|
||||||
value, start_pos, prefix, self.add_token)
|
value, start_pos, prefix, self.add_token)
|
||||||
break
|
return False
|
||||||
|
|
||||||
stack[-1].current_dfa = plan.next_dfa
|
stack[-1].current_dfa = plan.next_dfa
|
||||||
for push in plan.pushes:
|
for push in plan.pushes:
|
||||||
@@ -199,6 +197,8 @@ class PgenParser(object):
|
|||||||
except IndexError:
|
except IndexError:
|
||||||
# Stack is empty, set the rootnode.
|
# Stack is empty, set the rootnode.
|
||||||
self.rootnode = new_node
|
self.rootnode = new_node
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def add_token(self, type_, value, start_pos, prefix):
|
def add_token(self, type_, value, start_pos, prefix):
|
||||||
"""Add a token; return True if this is the end of the program."""
|
"""Add a token; return True if this is the end of the program."""
|
||||||
|
|||||||
Reference in New Issue
Block a user