1
0
mirror of https://github.com/djcb/mu.git synced 2024-06-20 06:46:50 +02:00

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) {
case Token::Type::And: {
tokens.pop_front();
const auto token2 = look_ahead(tokens);
if (token2.type == Token::Type::Not) { // AND NOT is a unit
tokens.pop_front();
op = Node::Type::OpAndNot;
} else
op = Node::Type::OpAnd;
op = Node::Type::OpAnd;
} break;
case Token::Type::Open:
case Token::Type::Data:
op = Node::Type::OpAnd; // implicit AND
break;
case Token::Type::Not:
tokens.pop_front();
op = Node::Type::OpAndNot; // implicit AND NOT
break;
default:
return empty();
}