From afb01dc07b1c7e64a6c0d11ab755fb58cf522f80 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Mon, 12 Jan 2015 12:04:34 +1300 Subject: [PATCH] Search: adjust association of negation Make negation left-associative, so that it groups from the left. This seems to match what Gerrit does. This means that: not owner:self project:foo is: (not owner:self) and (project:foo) rather than the previous, erroneous behavior: not (owner:self and project:foo) Change-Id: I9a922fb16d0b0e0c3d17871dc0e74f2211e36399 --- gertty/search/parser.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gertty/search/parser.py b/gertty/search/parser.py index 5f680fa..1dc44b7 100644 --- a/gertty/search/parser.py +++ b/gertty/search/parser.py @@ -24,6 +24,10 @@ import gertty.search from tokenizer import tokens def SearchParser(): + precedence = ( + ('left', 'NOT', 'NEG'), + ) + def p_terms(p): '''expression : list_expr | paren_expr