-// $Id: CQLParser.java,v 1.16 2002-11-06 20:13:45 mike Exp $
+// $Id: CQLParser.java,v 1.17 2002-11-06 22:03:58 mike Exp $
package org.z3950.zing.cql;
import java.io.IOException;
/**
* Compiles CQL strings into parse trees of CQLNode subtypes.
*
- * @version $Id: CQLParser.java,v 1.16 2002-11-06 20:13:45 mike Exp $
+ * @version $Id: CQLParser.java,v 1.17 2002-11-06 22:03:58 mike Exp $
* @see <A href="http://zing.z3950.org/cql/index.html"
* >http://zing.z3950.org/cql/index.html</A>
*/
lexer.nextToken();
debug("about to parse_query()");
- CQLNode root = parse_query("srw.serverChoice", new CQLRelation("="));
+ CQLNode root = parse_query("srw.serverChoice", new CQLRelation("scr"));
+ // ### "scr" above should arguably be "="
if (lexer.ttype != lexer.TT_EOF)
throw new CQLParseException("junk after end: " + lexer.render());
f.close();
System.out.println(root.toPQF(config));
} else {
- System.out.print(root.toXCQL(0));
+ System.out.println(root.toXCQL(0));
+ // ### should be print (no ~ln)
}
} catch (IOException ex) {
System.err.println("Can't render query: " + ex.getMessage());
-# $Id: Makefile,v 1.1 2002-11-03 16:53:04 mike Exp $
+# $Id: Makefile,v 1.2 2002-11-06 22:03:58 mike Exp $
sections/01/01.xcql: sections
./mkanswers CQLParser
./mktests queries.raw
adam-tests: sections/01/01.xcql
- ./runtests ../../srw/cql/cqlparse3
+ ./runtests ../../../srw/cql/cqlparse3 cat
rob-tests: sections/01/01.xcql
- ./runtests ../../rob/CQLParser.py
+ ./runtests ../../../rob/CQLParser.py cat
clean:
find sections -name '*.xcql' -print | xargs rm -f
xml:element
"<xml:element>"
"="
-"prox/word/>=/5"
+"prox/>=/5/word"
("cat")
((dog))
cat not frog
(cat not frog)
"cat" not "fish food"
-xml and "prox/word/"
+xml and "prox///word/"
a or b and c not d
# I/R/T plus Boolean
# Prox
cat prox hat
-cat prox/word/=/3/ordered hat
-cat prox///3 hat
-"fish food" prox/sentence "and"
-title all "chips frog" prox/word//5 "any"
-(dc.author exact "jones" prox///5 title >= "smith")
+cat prox/=/3/word/ordered hat
+cat prox//3 hat
+"fish food" prox///sentence "and"
+title all "chips frog" prox//5/word "any"
+(dc.author exact "jones" prox//5 title >= "smith")
((cat prox hat))
# Special characters
# Lame searches
-"any" or "all:stem" and "all" exact "any" prox/word "prox"="fuzzy"
+"any" or "all:stem" and "all" exact "any" prox///word "prox"="fuzzy"
((((((((("any")))))))))
#!/usr/bin/perl -w
-# $Id: runtests,v 1.2 2002-11-03 17:02:48 mike Exp $
+# $Id: runtests,v 1.3 2002-11-06 22:03:58 mike Exp $
use IO::File;
use strict;
my $correct = read_file("$norman < $afile |");
my $tested = read_file("$compiler < $qfile | $norman |")
or die "can't run test compiler '$compiler | $norman': $!";
- print " *** different XCQL output\n"
- if $tested ne $correct;
+ if ($tested ne $correct) {
+ print " *** different XCQL output\n";
+ print "=== correct ===\n$correct";
+ print "=== tested ===\n$tested";
+ }
}
}
#!/bin/sh
-# $Id: showtest,v 1.2 2002-11-03 17:02:48 mike Exp $
+# $Id: showtest,v 1.3 2002-11-06 22:03:58 mike Exp $
if [ $# != 1 ]; then
echo "Usage: $0 <test-name>" >&2
fi
### Warning: nasty hard-coded choices
-( echo "=== Adam ==="
- ../../srw/cql/cqlparse3 < sections/$1.cql ) > /tmp/adam
+( echo "=== Rob ==="
+ ../../../rob/CQLParser.py < sections/$1.cql ) > /tmp/rob
( echo "=== Mike ==="
- ../bin/CQLParser < sections/$1.cql ) > /tmp/mike
-sdiff -w 80 /tmp/adam /tmp/mike
+ ../../bin/CQLParser < sections/$1.cql ) > /tmp/mike
+sdiff -w 80 /tmp/rob /tmp/mike