Commit 74706dc7 authored by Marien Fressinaud's avatar Marien Fressinaud

add: Accept "set" statement to assign variables

parent 2797f4ae
......@@ -91,7 +91,15 @@ class Template:
words = token[2:-2].strip().split()
statement = words[0]
args = words[1:]
if statement == "if":
if statement == "set":
if len(args) < 3 or args[1] != "=":
self._oopsy("set statement expects an assignation")
variable = args[0]
value = " ".join(args[2:])
code.write(f"{variable} = {value}")
elif statement == "if":
if len(args) < 1:
self._oopsy("a condition is expected in if statement")
ops_stack.append("if")
......
Markdown is supported
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