def p_dataport_statement(t): '''dataport_statement : dataport ID ID SEMI | maybe dataport ID ID SEMI''' if len(t) == 5: t[0] = Dataport(Reference(t[2], Port), t[3]) else: assert len(t) == 6 t[0] = Dataport(Reference(t[3], Port), t[4], optional=True) t[0].filename = t.lexer.filename t[0].lineno = t.lexer.lineno
def _lift_dataport(location, *args): if len(args) == 3: optional = True _, type, name = args else: optional = False type, name = args return Dataport(type, name, optional, location)