-// $Id: CQLBooleanNode.java,v 1.1 2002-10-25 16:04:44 mike Exp $
+// $Id: CQLBooleanNode.java,v 1.2 2002-10-25 16:11:05 mike Exp $
package org.z3950.zing.cql;
* Represents a boolean node in a CQL parse-tree ...
* ###
*
- * @version $Id: CQLBooleanNode.java,v 1.1 2002-10-25 16:04:44 mike Exp $
+ * @version $Id: CQLBooleanNode.java,v 1.2 2002-10-25 16:11:05 mike Exp $
*/
-public abstract class CQLBooleanNode {
+public abstract class CQLBooleanNode extends CQLNode {
protected CQLNode left;
protected CQLNode right;
}
-// $Id: CQLNode.java,v 1.3 2002-10-25 16:04:44 mike Exp $
+// $Id: CQLNode.java,v 1.4 2002-10-25 16:11:05 mike Exp $
package org.z3950.zing.cql;
* Represents a node in a CQL parse-tree ...
* ###
*
- * @version $Id: CQLNode.java,v 1.3 2002-10-25 16:04:44 mike Exp $
+ * @version $Id: CQLNode.java,v 1.4 2002-10-25 16:11:05 mike Exp $
*/
public abstract class CQLNode {
abstract String toXCQL(int level);
CQLNode n1 = new CQLTermNode("dc.author", "=", "kernighan");
CQLNode n2 = new CQLTermNode("dc.title", "all", "elements style");
CQLNode root = new CQLAndNode(n1, n2);
- System.out.println(root.toXCQL(3));
+ System.out.println(root.toXCQL(0));
}
}
-// $Id: CQLParser.java,v 1.5 2002-10-25 16:01:26 mike Exp $
+// $Id: CQLParser.java,v 1.6 2002-10-25 16:11:05 mike Exp $
package org.z3950.zing.cql;
import java.util.Properties;
* Compiles a CQL string into a parse tree ...
* ###
*
- * @version $Id: CQLParser.java,v 1.5 2002-10-25 16:01:26 mike Exp $
+ * @version $Id: CQLParser.java,v 1.6 2002-10-25 16:11:05 mike Exp $
* @see <A href="http://zing.z3950.org/cql/index.html"
* >http://zing.z3950.org/cql/index.html</A>
*/
System.err.println("Can't read query: " + ex);
System.exit(2);
}
- String cql = String(bytes);
+ String cql = new String(bytes);
CQLParser parser = new CQLParser();
- CQLNode root = parser.parse(cql);
- System.out.println(root.toXCQL());
+ CQLNode root;
+ try {
+ root = parser.parse(cql);
+ System.out.println(root.toXCQL(0));
+ } catch (java.io.IOException ex) {
+ System.err.println("Can't compile query: " + ex);
+ System.exit(3);
+ }
}
}