def p_x_boolx(self,t):
    """expression : unop expression
                  | expression binop expression
    """
    # todo: ply exposes precedence with %prec, use it.
    if len(t)==4: t[0] = bin_priority(t[2],t[1],t[3])
    elif len(t)==3: t[0] = un_priority(t[1],t[2])
    else: raise NotImplementedError('unk_len',len(t)) # pragma: no cover
def p_x_boolx ( self , t ) : if len ( t ) == 4 : t [ 0 ] = bin_priority ( t [ 2 ] , t [ 1 ] , t [ 3 ] ) elif len ( t ) == 3 : t [ 0 ] = un_priority ( t [ 1 ] , t [ 2 ] ) else : raise NotImplementedError ( 'unk_len' , len ( t ) )
expression : unop expression
                  | expression binop expression