def update_pids_stmt(self, env, marking_var, new_pid_dict_var): return pyast.Assign( targets=[self.place_expr(env, marking_var)], value=pyast.Call(func=pyast.E(stubs['pid_place_type_update_pids']), args=[ self.place_expr(self, marking_var), pyast.Name(new_pid_dict_var.name) ]))
def dump_expr(self, env, marking_var): place_expr = pyast.E(self.field.access_from(marking_var)) return pyast.IfExp(test=place_expr, body=pyast.BinOp(left=pyast.Str('['), op=pyast.Add(), right=pyast.BinOp( left=pyast.Call( func=pyast.Name('dump'), args=[place_expr]), op=pyast.Add(), right=pyast.Str(']'))), orelse=pyast.Str('[]'))
def dump_expr(self, env, marking_var, variable): place_expr = pyast.E(self.field.access_from(marking_var)) l = [] for place in self._places: l.append( pyast.stmt( pyast.Call( func=pyast.E('{}.append'.format(variable.name)), args=[ pyast.BinOp( left=pyast.Str(repr(place) + ' : '), op=pyast.Add(), right=pyast.IfExp(test=self.gen_check_flow( env, marking_var, place, place_expr), body=pyast.Str('[ dot ],'), orelse=pyast.Str('[],'))) ]))) return l
def add_items_stmt(self, env, multiset, marking_var): add_items_attr_expr = pyast.E('{}.add_items'.format( self.field.access_from(marking_var))) return pyast.stmt(pyast.Call(func=add_items_attr_expr, args=[multiset]))
def add_multiset_stmt(self, env, multiset, marking_var): update_attr_expr = pyast.E('{}.update'.format( self.field.access_from(marking_var))) return pyast.stmt(pyast.Call(func=update_attr_expr, args=[multiset]))
def add_token_stmt(self, env, compiled_token, marking_var, *args): add_expr = pyast.E("{}.add".format( self.field.access_from(marking_var))) return pyast.stmt(pyast.Call(func=add_expr, args=[compiled_token]))