diff --git a/gertty/search/__init__.py b/gertty/search/__init__.py index 1a7f125..0aa58bb 100644 --- a/gertty/search/__init__.py +++ b/gertty/search/__init__.py @@ -62,7 +62,7 @@ class SearchCompiler(object): if __name__ == '__main__': class Dummy(object): pass - query = 'reviewer:10068' + query = 'status:open limit:50' lexer = tokenizer.SearchTokenizer() lexer.input(query) while True: diff --git a/gertty/search/parser.py b/gertty/search/parser.py index f931458..beb6ea6 100644 --- a/gertty/search/parser.py +++ b/gertty/search/parser.py @@ -76,6 +76,7 @@ def SearchParser(): | has_term | is_term | status_term + | limit_term | op_term''' p[0] = p[1] @@ -302,6 +303,16 @@ def SearchParser(): else: p[0] = gertty.db.change_table.c.status == p[2].upper() + def p_limit_term(p): + '''limit_term : OP_LIMIT NUMBER''' + # TODO: Implement this. The sqlalchemy limit call needs to be + # applied to the query operation and so can not be returned as + # part of the production here. The information would need to + # be returned out-of-band. In the mean time, since limits are + # not as important in gertty, make this a no-op for now so + # that it does not produce a syntax error. + p[0] = (True == True) + def p_op_term(p): 'op_term : OP' raise SyntaxError() diff --git a/gertty/search/tokenizer.py b/gertty/search/tokenizer.py index 2c9b48c..3ae95c6 100644 --- a/gertty/search/tokenizer.py +++ b/gertty/search/tokenizer.py @@ -36,6 +36,7 @@ operators = { 'has': 'OP_HAS', 'is': 'OP_IS', 'status': 'OP_STATUS', + 'limit': 'OP_LIMIT', } reserved = {