def pretty_print(node_): text = constants.GLOBAL_KW + ' ' + constants.PROTOCOL_KW + ' ' text = text + get_name(node_) pds = get_parameterdecllist_child(node_) if util.get_node_type(pds) != parameterdecllist_EMPTY_PARAMETER_DECL_LIST: text = text + parameterdecllist_pretty_print(pds) text = text + roledecllist_pretty_print(get_roledecllist_child(node_)) body = get_child(node_) if util.get_node_type(body) == constants.GLOBAL_PROTOCOL_DEF_NODE_TYPE: text = text + '\n' + util.pretty_print(body) else: raise RuntimeError("TODO: ") return text
def _pretty_print_aux(p, r, paramdecllist_, roledecllist_, body): text = "" text = text + constants.LOCAL_KW + ' ' + constants.PROTOCOL_KW + ' ' text = text + p + ' ' text = text + constants.AT_KW + ' ' + role_get_role_name(r) if util.get_node_type(paramdecllist_) != \ parameterdecllist_EMPTY_PARAMETER_DECL_LIST: text = text + parameterdecllist_pretty_print(paramdecllist_) text = text + roledecllist_pretty_print(roledecllist_) child = body if util.get_node_type(child) == constants.LOCAL_PROTOCOL_DEF_NODE_TYPE: text = text + localprotocoldef_pretty_print(child) else: raise RuntimeError("TODO:", util.get_node_type(child)) return text