Set, add, remove bytes
This commit is contained in:
24
src/main.py
24
src/main.py
@@ -241,12 +241,34 @@ for i in file:
|
||||
else:
|
||||
raise TypeError("Could not find variable type")
|
||||
bfcode += "<<[[<<]<<]<<<<<<<<"
|
||||
elif "+=" in i:
|
||||
if a.split("[")[0] in variables:
|
||||
var = a.split("[")[0]
|
||||
idx = int(a.split("[")[1].split("]")[0])
|
||||
bfcode += ">>>>>>>>>>>>" + "[>>]>>" * variables.index(var) + ">>" * idx + ">"
|
||||
bfcode += "+" * int(removeChar(i.split("+=")[1], " "))
|
||||
bfcode += "<[[<<]<<]<<<<<<<<"
|
||||
else:
|
||||
raise NameError(f"Could not find variable {a.split("[")[0]}")
|
||||
elif "-=" in i:
|
||||
if a.split("[")[0] in variables:
|
||||
var = a.split("[")[0]
|
||||
idx = int(a.split("[")[1].split("]")[0])
|
||||
bfcode += ">>>>>>>>>>>>" + "[>>]>>" * variables.index(var) + ">>" * idx + ">"
|
||||
bfcode += "-" * int(removeChar(i.split("-=")[1], " "))
|
||||
bfcode += "<[[<<]<<]<<<<<<<<"
|
||||
else:
|
||||
raise NameError(f"Could not find variable {a.split("[")[0]}")
|
||||
elif "=" in i:
|
||||
if a.split("[")[0] in variables:
|
||||
var = a.split("[")[0]
|
||||
idx = int(a.split("[")[1].split("]")[0])
|
||||
bfcode += ">>>>>>>>>>>>" + "[>>]>>" * variables.index(var) + ">>" * idx + ">"
|
||||
bfcode += "[-]" + "+" * ord(i.split("=", 1)[1].split("\"")[1])
|
||||
if "\"" in i:
|
||||
replace = ord(i.split("=", 1)[1].split("\"")[1])
|
||||
else:
|
||||
replace = int(i.split("=", 1)[1].lstrip().rstrip())
|
||||
bfcode += "[-]" + "+" * replace
|
||||
bfcode += "<[[<<]<<]<<<<<<<<"
|
||||
else:
|
||||
raise NameError(f"Could not find variable {a.split("[")[0]}")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
create var *5 = "Hello"
|
||||
create var2 *5 = "World"
|
||||
set var[1] = "E"
|
||||
set var2[2] = "R"
|
||||
set var2[2] -= 1
|
||||
Reference in New Issue
Block a user