Support '-' as negation operator in query

This nudges slightly toward harmony with the Gerrit web UI
search syntax.

Change-Id: Ibff2bef27d2e5d3f3d703c877d9332d5aa670c54
This commit is contained in:
Clint Adams 2015-07-29 18:10:53 -04:00
parent 0b02fafdc7
commit e042b4e679

View File

@ -64,7 +64,7 @@ tokens = [
def SearchTokenizer(): def SearchTokenizer():
t_LPAREN = r'\(' # NOQA t_LPAREN = r'\(' # NOQA
t_RPAREN = r'\)' # NOQA t_RPAREN = r'\)' # NOQA
t_NEG = r'!' # NOQA t_NEG = r'[-!]' # NOQA
t_ignore = ' \t' # NOQA (and intentionally not using r'' due to tab char) t_ignore = ' \t' # NOQA (and intentionally not using r'' due to tab char)
def t_OP(t): def t_OP(t):
@ -109,7 +109,7 @@ def SearchTokenizer():
return t return t
def t_USTRING(t): def t_USTRING(t):
r'([^\s\(\)!]+)' r'([^\s\(\)!-][^\s\(\)!]*)'
t.value=t.value.decode("string-escape") t.value=t.value.decode("string-escape")
return t return t