This commit is contained in:
Gouvernathor 2024-04-04 23:15:35 +02:00
parent 9befd927a8
commit c2d8c394a1

View File

@ -73,16 +73,23 @@ python early hide:
class chibi:
@staticmethod
def parse(l):
who = l.simple_expression()
action = l.simple_expression()
who = l.name()
action = l.name()
arguments = l.arguments() # may be None
l.expect_eol()
return (who, action)
return (who, action, arguments)
def execute(self):
print(self)
who, action = self
chibi = DollChibi.instance[who]
getattr(chibi, action)
who, action, arguments = self
chibi = DollChibi.instances[who]
method = getattr(chibi, action)
if arguments is None:
args, kwargs = (), {}
else:
args, kwargs = arguments.evaluate()
method(*args, **kwargs)
# print(f"Execution: {who} {action}")