Skip to content
Snippets Groups Projects
Commit 1db3efae authored by Chris's avatar Chris
Browse files

Token EQUALS in ALLOCATION umbenannt um passende Benennung für GOTO-Interpreter zu ermöglichen

parent 5b7589c0
No related branches found
No related tags found
1 merge request!1Master
......@@ -36,7 +36,7 @@ class LOOPInterpreter:
(re.compile(r'x\d+'), 'IDENTIFIER'),
(re.compile(r'\+'), 'PLUS'),
(re.compile(r'-'), 'MINUS'),
(re.compile(r':=|≔'), 'EQUALS'),
(re.compile(r':=|≔'), 'ALLOCATION'),
(re.compile(r'LOOP'), 'LOOP'),
(re.compile(r'DO'), 'DO'),
(re.compile(r'END'), 'END'),
......@@ -53,7 +53,7 @@ class LOOPInterpreter:
if identifier_1 in forbidden_identifiers:
self.error_handler.handle_error("Identifier " + identifier_1 +
" ist bereits in Loop vorhanden und darf nicht verwendet werden.")
if not self.next_nonempty_token("Zuweisung", ":=").k == 'EQUALS':
if not self.next_nonempty_token("Zuweisung", ":=").k == 'ALLOCATION':
self.error_handler.handle_error(":= in Zuweisung erwartet.")
identifier_token_2 = self.next_nonempty_token("Zuweisung", "IDENTIFIER (x0, x1, ...) oder NUMBER")
if identifier_token_2.k == 'NUMBER':
......@@ -90,7 +90,7 @@ class LOOPInterpreter:
if identifier_1 in forbidden_identifiers:
self.error_handler.handle_error("Identifier " + identifier_1 +
" ist bereits in Loop vorhanden und darf nicht verwendet werden.")
if not self.next_nonempty_token("Zuweisung", ":=").k == 'EQUALS':
if not self.next_nonempty_token("Zuweisung", ":=").k == 'ALLOCATION':
self.error_handler.handle_error(":= in Zuweisung erwartet.")
identifier_token_2 = self.next_nonempty_token("Zuweisung", "IDENTIFIER (x0, x1, ...) oder NUMBER")
......
......@@ -35,7 +35,7 @@ class WHILEInterpreter(LOOPInterpreter):
(re.compile(r'x\d+'), 'IDENTIFIER'),
(re.compile(r'\+'), 'PLUS'),
(re.compile(r'-'), 'MINUS'),
(re.compile(r':=|≔'), 'EQUALS'),
(re.compile(r':=|≔'), 'ALLOCATION'),
(re.compile(r'/=|≠|!='), 'NOTEQUALS'),
(re.compile(r'LOOP'), 'LOOP'),
(re.compile(r'WHILE'), 'WHILE'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment