Fix argument insertion
This commit is contained in:
@@ -41,13 +41,20 @@ class MaMa:
|
||||
|
||||
# Decodes string MaMa instructions to function callables
|
||||
@staticmethod
|
||||
def decode(micro: str) -> Tuple[str, Optional[List[int]]]:
|
||||
def decode(micro: str) -> Tuple[str, Optional[List[Any]]]:
|
||||
if "(" in micro:
|
||||
name, rest = micro.split("(", 1)
|
||||
args_str = rest[:-1]
|
||||
if args_str.strip() == "":
|
||||
args_str = rest[:-1].strip()
|
||||
if args_str == "":
|
||||
return name, []
|
||||
args = [int(a.strip()) for a in args_str.split(",")]
|
||||
args = []
|
||||
for a in args_str.split(","):
|
||||
a = a.strip()
|
||||
try:
|
||||
a = int(a)
|
||||
except ValueError:
|
||||
pass # keep symbolic argument (e.g., 'n')
|
||||
args.append(a)
|
||||
return name, args
|
||||
return micro, None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user