Пример #1
0
def p_assign4(p):
    '''assign : commalist_expr  EQ  commalist_expr
    '''
    p[0] = Node('Assign')
    p[0].target =Node('tuple')
    p[0].target.elems =p[1].elems
    p[0].value =Node('tuple')
    p[0].value.elems =p[3].elems
Пример #2
0
def p_foreach(p):
    '''foreach : FOR IDENTIFIER IN expr block
                   | FOR vdef IN expr block
    '''
    p[0] = Node('Foreach')
    p[0].iter = p[2]
    p[0].target = p[4]
    p[0].body = p[5].body
Пример #3
0
def p_assign5(p):
    '''assign : commalist_expr  EQ  expr
    '''
    p[0] = Node('Assign')
    p[0].target = p[1]
    p[0].value = p[3]
Пример #4
0
def p_assign3(p):
    '''assign : unary_expr    EQ  expr
    '''
    p[0] = Node('Assign')
    p[0].target = p[1]
    p[0].value = p[3]
Пример #5
0
def p_assign2(p):
    '''assign : vdef          EQ  expr
    '''
    p[0] = Node('Assign')
    p[0].target = p[1]
    p[0].value = p[3]