title: string parsing a complex logical operators in pyparsing
body: <p>i am trying parse logical operators, query string see below</p>
  
  <pre><code>code!=720 AND first_name=abc OR last_name=def AND status_code=OK
  </code></pre>
  
  <p>and get the parsed string as a binary tree. For the above expression the expected parsed expression should look like</p>
  
  <pre><code>[[['code', '!=', '720'], 'AND', ['first_name', '=', 'abc']], 'OR', [['last_name', '=', 'def'], 'AND', ['status_code', '=', 'OK']]]
  </code></pre>
  
  <p>i tried to do this code but i do not get the desired output</p>
  
  <pre><code>operator = pp.Regex("&gt;=|&lt;=|!=|&gt;|&lt;|=").setName("operator")
  number = pp.Regex(r'[+-]?\w+(:?\.\w*)?(:?[eE][+-]?\w+)?')
  word = pp.Word(pp.alphas, pp.alphanums + "_-*(1234567890 ,)")
  term = word | number
  condition = pp.Group(term + operator + term)
  
  
  expr = pp.operatorPrecedence(condition,
           [('NOT', 1, pp.opAssoc.RIGHT,),
            ('AND', 2, pp.opAssoc.LEFT,),
            ('OR', 2, pp.opAssoc.LEFT,)])
  </code></pre>
  
  <p>example </p>
  
  <pre><code>query_string = 'code!=720 AND first_name=abc OR last_name=def AND status_code=OK'
  print(expr.parseString(query_string)[0])
  </code></pre>
  
  <p>and output is wrong</p>
  
  <pre><code> [['code', '!=', '720'], 'AND', ['first_name', '=', 'abc OR last_name']]
  </code></pre>
  
  <p>can you help me write the correct condition?</p>