Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
Ditch built-in lexer
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Dec 28, 2014
1 parent c633ce4 commit 610141d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 128 deletions.
1 change: 1 addition & 0 deletions setup.py
Expand Up @@ -41,6 +41,7 @@ def main():
"SQLAlchemy>=0.8",
"sqlalchemy-migrate>=0.7.2.24",
"parsedatetime>=0.8.6",
"pytools>=2014.3.5",
"ipaddr",
],

Expand Down
125 changes: 0 additions & 125 deletions synoptic/lex.py

This file was deleted.

7 changes: 4 additions & 3 deletions synoptic/query.py
Expand Up @@ -422,7 +422,7 @@ def visit_date_query(self, q):
_whitespace = intern("whitespace")


from synoptic.lex import RE
from pytools.lex import RE
_LEX_TABLE = [
(_and, RE(r"and\b")),
(_or, RE(r"or\b")),
Expand Down Expand Up @@ -526,10 +526,11 @@ def inner_parse(pstate, min_precedence=0):

return left_query

from synoptic.lex import LexIterator, lex
from pytools.lex import LexIterator, lex
pstate = LexIterator(
[(tag, s, idx, matchobj)
for (tag, s, idx, matchobj) in lex(_LEX_TABLE, expr_str)
for (tag, s, idx, matchobj) in lex(
_LEX_TABLE, expr_str, match_objects=True)
if tag is not _whitespace], expr_str)

if pstate.is_at_end():
Expand Down

0 comments on commit 610141d

Please sign in to comment.