#!/usr/bin/python

"""
Sample query parser. Not really useful for anything except for maybe 
debugging your queries.

If no args are passed on the command line it will try and read stdin,
if you give it an argument it will try and parse it as a filename.
"""

import demo
from xesam.query import *
import sys

if len (sys.argv) == 1:
	input = sys.stdin
else:
	input = file(sys.argv[1])

p = QueryParser ()
q = p.parse(input)
print >> sys.stderr, "PARSED QUERY:"
print q.xml()
