def p_uses_statement(t): '''uses_statement : uses ID ID SEMI | maybe uses ID ID SEMI''' if len(t) == 5: t[0] = Uses(Reference(t[2], Procedure), t[3]) else: assert len(t) == 6 t[0] = Uses(Reference(t[3], Procedure), t[4], optional=True) t[0].filename = t.lexer.filename t[0].lineno = t.lexer.lineno
def _lift_uses(location, *args): if len(args) == 3: optional = True _, type, name = args else: optional = False type, name = args return Uses(Reference(type.name, Procedure, type.location), name, optional, location)