Example #1
0
def p_expr_ternary_op(p):
    'expr : expr QUESTION expr COLON expr'
    p[0] = ast.TernaryOp(p[1], p[3], p[5], lineno=p.lineno(2))
Example #2
0
def p_expr_short_ternary_op(p):
    'expr : expr QUESTION COLON expr'
    p[0] = ast.TernaryOp(p[1], p[1], p[4], lineno=p.lineno(2))