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: class chibi:
@staticmethod @staticmethod
def parse(l): def parse(l):
who = l.simple_expression() who = l.name()
action = l.simple_expression() action = l.name()
arguments = l.arguments() # may be None
l.expect_eol()
return (who, action) return (who, action, arguments)
def execute(self): def execute(self):
print(self) print(self)
who, action = self who, action, arguments = self
chibi = DollChibi.instance[who] chibi = DollChibi.instances[who]
getattr(chibi, action) method = getattr(chibi, action)
if arguments is None:
args, kwargs = (), {}
else:
args, kwargs = arguments.evaluate()
method(*args, **kwargs)
# print(f"Execution: {who} {action}") # print(f"Execution: {who} {action}")