default base domain ObjectPascal. pattern before_advice_stmt() : statement_list = "TExHandleCollection(Collection).LockHandle;". external pattern around_advice_exec_try_finally(slist : statement_list, proceed_bef : statement_list, proceed_within_try : statement_list, proceed_within_finally : statement_list, proceed_aft : statement_list) : statement_list = 'around_advice_exec_try_finally' in domain ObjectPascal. rule function_handle( id1 : IDENTIFIER, fps : formal_parameters, frt : function_result_type, slist : statement_list) : implementation_declaration-> implementation_declaration = "function \id1 . Handle \fps :\frt ; begin \slist end;" -> "function \id1 . Handle \fps:\frt ; begin \around_advice_exec_try_finally\(\slist \, \before_advice_stmt\(\) \, \within_try_block\(\) \, \within_finally_block\(\) \, \after_advice_stmt\(\) \) end;" if slist == around_advice_exec_try_finally(slist, before_advice_stmt(), within_try_block(), within_finally_block(), after_advice_stmt()) . pattern after_advice_stmt() : statement_list = "". pattern within_try_block() : statement_list = "p1234567890;". pattern within_finally_block() : statement_list = "TExHandleCollection(Collection).UnLockHandle;". public ruleset synchronize = {function_handle}.