Skip to content

Commit

Permalink
query-parser: 'not' should take units
Browse files Browse the repository at this point in the history
NOT should bind more tightly.
  • Loading branch information
djcb committed Sep 19, 2023
1 parent 5bda8c3 commit b5b90a0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/mu-query-parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ unit(Sexp& tokens, ParseContext& ctx)
{
if (tokens.head_symbolp(not_sym)) { /* NOT */
tokens.pop_front();
Sexp sub{query(tokens, ctx)};
Sexp sub{unit(tokens, ctx)};

/* special case: interpret "not" as a matcher instead; */
if (sub.empty())
Expand Down Expand Up @@ -360,6 +360,8 @@ test_parser_basic()
TestCase{R"(not)", R"((_ "not"))"},
// a and (b or c)
TestCase{R"(a and (b or c))", R"((and (_ "a") (or (_ "b") (_ "c"))))"},
// not a and not b
TestCase{R"(not a and b)", R"((and (not (_ "a")) (_ "b")))"},
// TODO: add more...
};

Expand Down

0 comments on commit b5b90a0

Please sign in to comment.