Commit e5c6a18a authored by Christopher Happe's avatar Christopher Happe
Browse files

Bugfix: Falsches Zurücksetzen der Zeilennummer und Position

parent c4c4bcd2
......@@ -115,13 +115,17 @@ class GOTOInterpreter:
if not self.next_nonempty_token('GOTO', 'SEMICOLON').k == 'SEMICOLON':
self.error_handler.handle_error('SEMICOLON zum Abschluss eines GOTO erwartet')
marker_number = int(marker_token.v[1:])
saved_position = marker_token.p
saved_line = self.error_handler.line_number
current_token = self.next_token()
while current_token is not None and max(self.marker_to_position.keys()) < int(marker_number):
current_token = self.verify_line(current_token)
self.lex.current_position = self.marker_to_position.get(marker_number)
self.error_handler.line_number = self.marker_to_line.get(marker_number)
if marker_number not in self.marker_to_position.keys():
self.lex.current_position = saved_position
self.error_handler.line_number = saved_line
self.error_handler.handle_error('GOTO zu nicht vorhandener Markierung')
self.lex.current_position = self.marker_to_position.get(marker_number)
self.error_handler.line_number = self.marker_to_line.get(marker_number)
return self.next_token()
def verify_goto(self, goto_token):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment