Skip to content
Snippets Groups Projects
Commit 8005a507 authored by Chris's avatar Chris
Browse files

Support für MINUS in Unicode.

parent 6bbba802
No related branches found
No related tags found
1 merge request!1Master
...@@ -14,7 +14,7 @@ class GOTOInterpreter: ...@@ -14,7 +14,7 @@ class GOTOInterpreter:
(re.compile(r'x\d+'), 'IDENTIFIER'), (re.compile(r'x\d+'), 'IDENTIFIER'),
(re.compile(r'M\d+'), 'MARKER'), (re.compile(r'M\d+'), 'MARKER'),
(re.compile(r'\+'), 'PLUS'), (re.compile(r'\+'), 'PLUS'),
(re.compile(r'-'), 'MINUS'), (re.compile(r'-|−'), 'MINUS'),
(re.compile(r':=|≔'), 'ALLOCATION'), (re.compile(r':=|≔'), 'ALLOCATION'),
(re.compile(r'='), 'EQUALS'), (re.compile(r'='), 'EQUALS'),
(re.compile(r'/=|≠|!='), 'NOTEQUALS'), (re.compile(r'/=|≠|!='), 'NOTEQUALS'),
......
...@@ -37,6 +37,7 @@ class GOTOInterpreterTest(TestCase): ...@@ -37,6 +37,7 @@ class GOTOInterpreterTest(TestCase):
self.assertEqual(interpret('M1:x0:=x0+1;M2:HALT;'), 1) self.assertEqual(interpret('M1:x0:=x0+1;M2:HALT;'), 1)
self.assertEqual(interpret('M1:x0:= 5; M2:x0:=x0-1; M3:HALT;'), 4) self.assertEqual(interpret('M1:x0:= 5; M2:x0:=x0-1; M3:HALT;'), 4)
self.assertEqual(interpret('M1:x0:=x1-1; M2:x0:=x0+1; M3:HALT;'), 1) self.assertEqual(interpret('M1:x0:=x1-1; M2:x0:=x0+1; M3:HALT;'), 1)
self.assertEqual(interpret('M1:x0:=4; M2:x0:= x0 − 1; M3:HALT;'), 3)
def test_assignment_wrong_syntax(self): def test_assignment_wrong_syntax(self):
with self.assertRaises(SyntaxError): with self.assertRaises(SyntaxError):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment