'Returns either a variable by itself or a non-boolean operation (such as
``x == 0`` or ``x < 0``).
This is needed to keep correct precedence for boolean operations (i.e.
``x or x == 0`` should be ``x or (x == 0)``, not ``(x or x) == 0``).'

def get_bool_var(self):

    var = self.get_var()
    if (not self.at_end()):
        op_token = self.get_token(lookahead=True)[0]
        if (isinstance(op_token, basestring) and (op_token not in BOOL_OPERATORS)):
            (op, negate) = self.get_operator()
            return op(var, self.get_var(), negate=negate)
    return var
