示例#1
0
def p_fundef_static(p):
    '''fundef : STATIC funheader LBRACE RBRACE
              | STATIC funheader LBRACE statements RBRACE'''
    name, _type = p[2]
    body = ast.Block(p[4] if len(p) == 6 else [])
    p[0] = ast.FunDef(True, name, _type, body).at(loc(p, 2))
示例#2
0
def p_fundef(p):
    '''fundef : funheader LBRACE RBRACE
              | funheader LBRACE statements RBRACE'''
    name, _type = p[1]
    body = ast.Block(p[3] if len(p) == 5 else [])
    p[0] = ast.FunDef(False, name, _type, body).at(loc(p, 1))