Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
general
stups
prob-teaching-notebooks
Commits
8005a507
Commit
8005a507
authored
Nov 24, 2020
by
Christopher Happe
Browse files
Support für MINUS in Unicode.
parent
6bbba802
Changes
2
Hide whitespace changes
Inline
Side-by-side
info4/kapitel-8/Interpreter/gotointerpreter.py
View file @
8005a507
...
...
@@ -14,7 +14,7 @@ class GOTOInterpreter:
(
re
.
compile
(
r
'x\d+'
),
'IDENTIFIER'
),
(
re
.
compile
(
r
'M\d+'
),
'MARKER'
),
(
re
.
compile
(
r
'\+'
),
'PLUS'
),
(
re
.
compile
(
r
'-'
),
'MINUS'
),
(
re
.
compile
(
r
'-
|−
'
),
'MINUS'
),
(
re
.
compile
(
r
':=|≔'
),
'ALLOCATION'
),
(
re
.
compile
(
r
'='
),
'EQUALS'
),
(
re
.
compile
(
r
'/=|≠|!='
),
'NOTEQUALS'
),
...
...
info4/kapitel-8/Interpreter/test_goto_interpreter.py
View file @
8005a507
...
...
@@ -37,6 +37,7 @@ class GOTOInterpreterTest(TestCase):
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:=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
):
with
self
.
assertRaises
(
SyntaxError
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment