Browse Source

More work.

tags/v1.0^2
Ben Kurtovic 10 years ago
parent
commit
b5c22d3b4a
2 changed files with 33 additions and 3 deletions
  1. +24
    -2
      bitshift/query/__init__.py
  2. +9
    -1
      bitshift/query/tree.py

+ 24
- 2
bitshift/query/__init__.py View File

@@ -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 View File

@@ -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)

Loading…
Cancel
Save