-// This is a trivial subclass for java.io.StreamTokenizer which knows
-// about the multi-character tokens "<=", ">=" and "<>", and included
-// a render() method. Used only by CQLParser.
-//
-class CQLLexer extends StreamTokenizer {
- private static boolean lexdebug;
-
- CQLLexer(String cql, boolean lexdebug) {
- super(new StringReader(cql));
- this.ordinaryChar('=');
- this.ordinaryChar('<');
- this.ordinaryChar('>');
- this.ordinaryChar('/');
- this.ordinaryChar('(');
- this.ordinaryChar(')');
- this.wordChars('\'', '\''); // prevent this from introducing strings
- this.lexdebug = lexdebug;
- }
-
- public int nextToken() throws java.io.IOException {
- int token = super.nextToken();
- if (lexdebug)
- System.out.println("LEXDEBUG: " +
- "token=" + token + ", " +
- "nval=" + this.nval + ", " +
- "sval=" + this.sval);
-
- return token;
- }
-
- String render() {
- return this.render(this.ttype, null, true);
- }
-
- String render(boolean quoteChars) {
- return this.render(this.ttype, null, quoteChars);
- }
-
- String render(int token, String str, boolean quoteChars) {
- String ret;
-
- if (token == this.TT_EOF) {
- return "EOF";
- } else if (token == this.TT_EOL) {
- return "EOL";
- } else if (token == this.TT_NUMBER) {
- return "number: " + this.nval;
- } else if (token == this.TT_WORD) {
- return "word: \"" + this.sval + "\"";
- } else if (token == '"') {
- return "string: \"" + this.sval + "\"";
+ Properties config = new Properties();
+ config.load(f);
+ f.close();
+ System.out.println(root.toPQF(config));
+ } else {
+ System.out.print(root.toXCQL(0));
+ }
+ } catch (IOException ex) {
+ System.err.println("Can't render query: " + ex.getMessage());
+ System.exit(5);
+ } catch (UnknownIndexException ex) {
+ System.err.println("Unknown index: " + ex.getMessage());
+ System.exit(6);
+ } catch (UnknownRelationException ex) {
+ System.err.println("Unknown relation: " + ex.getMessage());
+ System.exit(7);
+ } catch (UnknownRelationModifierException ex) {
+ System.err.println("Unknown relation modifier: " +
+ ex.getMessage());
+ System.exit(8);
+ } catch (UnknownPositionException ex) {
+ System.err.println("Unknown position: " + ex.getMessage());
+ System.exit(9);
+ } catch (PQFTranslationException ex) {
+ // We catch all of this class's subclasses, so --
+ throw new Error("can't get a PQFTranslationException");