def p_consumes_statement(t): '''consumes_statement : consumes ID ID SEMI | maybe consumes ID ID SEMI''' if len(t) == 5: t[0] = Consumes(Reference(t[2], Event), t[3]) else: assert len(t) == 6 t[0] = Consumes(Reference(t[3], Event), t[4], optional=True) t[0].filename = t.lexer.filename t[0].lineno = t.lexer.lineno
def _lift_consumes(location, *args): if len(args) == 3: optional = True _, type, name = args else: optional = False type, name = args return Consumes(type, name, optional, location)