浏览代码

More work.

tags/v1.0^2
Ben Kurtovic 10 年前
父节点
当前提交
b5c22d3b4a
共有 2 个文件被更改,包括 33 次插入3 次删除
  1. +24
    -2
      bitshift/query/__init__.py
  2. +9
    -1
      bitshift/query/tree.py

+ 24
- 2
bitshift/query/__init__.py 查看文件

@@ -1,7 +1,12 @@
from .nodes import * ## TODO
from .tree import Tree

__all__ = ["parse_query"]
__all__ = ["QueryParseException", "parse_query"]

class QueryParseException(Exception):
"""Raised by parse_query when a query is invalid."""
pass


def parse_query(query):
"""
@@ -16,8 +21,25 @@ def parse_query(query):

:return: A tree storing the data in the query.
:rtype: :py:class:`~.query.tree.Tree`

:raises: :py:class:`.QueryParseException`
"""
pass
for term in query.split(" "):
pass

language:"Python"
lang:
l:

author:"Ben Kurtovic"

modified:before
modified:after
created:before
created:after:"Jaunary 4, 2014"

func:"foobar"
func:re|gex:"foo?b|car"

# "foo" -> Tree()
# "foo bar" -> "foo bar" OR ("foo" or "bar")


+ 9
- 1
bitshift/query/tree.py 查看文件

@@ -6,5 +6,13 @@ class Tree(object):
def __init__(self, root):
self._root = root

def __repr__(self):
return "Tree({0})".format(self._root)

def serialize(self):
pass
"""Create a string representation of the query for caching.

:return: Query string representation.
:rtype: str
"""
return repr(self)

正在加载...
取消
保存