'Consume the characters constituting an operator.
Returns the number of charactes consumed. (Does not update
self.offset)'

def parse_operator(self):

    if (self.formula[self.offset:(self.offset + 2)] in ('>=', '<=', '<>')):
        self.items.append(Token(self.formula[self.offset:(self.offset + 2)], Token.OP_IN))
        return 2
    curr_char = self.formula[self.offset]
    assert (curr_char in '%*/^&=><+-')
    if (curr_char == '%'):
        token = Token('%', Token.OP_POST)
    elif (curr_char in '*/^&=><'):
        token = Token(curr_char, Token.OP_IN)
    elif (not self.items):
        token = Token(curr_char, Token.OP_PRE)
    else:
        prev = self.items[(-1)]
        is_infix = ((prev.subtype == Token.CLOSE) or (prev.type == Token.OP_POST) or (prev.type == Token.OPERAND))
        if is_infix:
            token = Token(curr_char, Token.OP_IN)
        else:
            token = Token(curr_char, Token.OP_PRE)
    self.items.append(token)
    return 1
