parser: fix and-not precedence

For now, don't treat "and not" specially; this gets us back into a
somewhat working state. At some point, we probably _do_ want to
special-case and_not though (since Xapian supports it).
This commit is contained in:
djcb
2017-10-31 07:18:14 +02:00
parent ea2ffe23ae
commit 65863e46cd

View File

@ -237,23 +237,12 @@ factor_2 (Mux::Tokens& tokens, Node::Type& op, ProcPtr proc,
switch (token.type) { switch (token.type) {
case Token::Type::And: { case Token::Type::And: {
tokens.pop_front(); tokens.pop_front();
const auto token2 = look_ahead(tokens); op = Node::Type::OpAnd;
if (token2.type == Token::Type::Not) { // AND NOT is a unit
tokens.pop_front();
op = Node::Type::OpAndNot;
} else
op = Node::Type::OpAnd;
} break; } break;
case Token::Type::Open: case Token::Type::Open:
case Token::Type::Data: case Token::Type::Data:
op = Node::Type::OpAnd; // implicit AND op = Node::Type::OpAnd; // implicit AND
break; break;
case Token::Type::Not:
tokens.pop_front();
op = Node::Type::OpAndNot; // implicit AND NOT
break;
default: default:
return empty(); return empty();
} }