def pretty_print(node_): text = "" children = get_children(node_) if children: text = text + util.pretty_print(children[0]) for child in children[1:]: text = text + '\n' + util.pretty_print(child) return text
def once_unfold_all(self, node_): unfolded = self.traverse(node_) print "z: ", util.pretty_print(node_) print "a: ", util.pretty_print(unfolded) #print "a: ", util.pretty_print(globalprotocoldecl_get_child(unfolded)) return unfolded
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