示例#1
0
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
示例#2
0
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)
示例#3
0
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