Commit 2259081c authored by Christopher Happe's avatar Christopher Happe
Browse files

Bugfix: Falsche Zeilen in Fehlermeldungen bei WHITESPACE vor LINEBREAK

parent edc22717
......@@ -17,8 +17,8 @@ class ErrorHandler:
message]
raise SyntaxError("\n".join(msg)) from None
def increase_line(self):
self.line_number += 1
def increase_line(self, value):
self.line_number += value
def handle_break(self):
print("BREAK in Zeile " + str(self.line_number))
......@@ -42,8 +42,7 @@ class LOOPInterpreter:
(re.compile(r'END'), 'END'),
(re.compile(r';'), 'SEMICOLON'),
(re.compile(r'BREAK'), 'BREAK'),
(re.compile(r'\n', re.MULTILINE), 'LINEBREAK'),
(re.compile(r'\s+'), 'WHITESPACE'),
(re.compile(r'\s+', re.MULTILINE), 'WHITESPACE'),
(re.compile(r'[^\n]*'), 'UNKNOWN')]
self.values = {}
self.lex = None
......@@ -210,10 +209,9 @@ class LOOPInterpreter:
elif new_token.k == 'BREAK':
self.error_handler.handle_break()
return self.next_token()
elif new_token.k == 'LINEBREAK':
self.error_handler.increase_line()
return self.next_token()
elif new_token.k == 'WHITESPACE':
if new_token.v.count('\n') > 0:
self.error_handler.increase_line(new_token.v.count('\n'))
return self.next_token()
else:
return new_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