def p_real_inport_list(self, p): """real_inport_list : inport_list COMMA real_inport | real_inport""" if len(p) == 2: p[0] = ast.PortList() p[0].add_child(p[1]) else: p[1].add_child(p[3]) p[0] = p[1]
def p_inportlist(self, p): """inportlist : inportlist COMMA inport | inport COMMA inport""" if type(p[1]) is ast.PortList: p[1].add_child(p[3]) p[0] = p[1] else: p[0] = ast.PortList() p[0].add_child(p[1]) p[0].add_child(p[3])