From 6bcdff4c474737f8e983873fdde87fbc01631405 Mon Sep 17 00:00:00 2001 From: mike Date: Wed, 6 Nov 2002 22:03:58 +0000 Subject: [PATCH 1/1] *** empty log message *** --- src/org/z3950/zing/cql/CQLParser.java | 10 ++++++---- test/regression/Makefile | 6 +++--- test/regression/queries.raw | 16 ++++++++-------- test/regression/runtests | 9 ++++++--- test/regression/showtest | 10 +++++----- 5 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/org/z3950/zing/cql/CQLParser.java b/src/org/z3950/zing/cql/CQLParser.java index a365030..5aa861f 100644 --- a/src/org/z3950/zing/cql/CQLParser.java +++ b/src/org/z3950/zing/cql/CQLParser.java @@ -1,4 +1,4 @@ -// $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; @@ -12,7 +12,7 @@ import java.io.FileNotFoundException; /** * 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 http://zing.z3950.org/cql/index.html */ @@ -46,7 +46,8 @@ public class CQLParser { 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()); @@ -360,7 +361,8 @@ public class CQLParser { 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()); diff --git a/test/regression/Makefile b/test/regression/Makefile index 5831c9e..acfd85c 100644 --- a/test/regression/Makefile +++ b/test/regression/Makefile @@ -1,4 +1,4 @@ -# $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 @@ -10,10 +10,10 @@ sections: mktests queries.raw ./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 diff --git a/test/regression/queries.raw b/test/regression/queries.raw index fd42750..5366fb9 100644 --- a/test/regression/queries.raw +++ b/test/regression/queries.raw @@ -6,7 +6,7 @@ comp.os.linux xml:element "" "=" -"prox/word/>=/5" +"prox/>=/5/word" ("cat") ((dog)) @@ -31,7 +31,7 @@ cat and fish 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 @@ -42,11 +42,11 @@ bath.author any fish and dc.title all "cat dog" # 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 @@ -65,7 +65,7 @@ cat?dog # 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"))))))))) diff --git a/test/regression/runtests b/test/regression/runtests index 9827034..78e4117 100755 --- a/test/regression/runtests +++ b/test/regression/runtests @@ -1,6 +1,6 @@ #!/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; @@ -27,8 +27,11 @@ while () { 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"; + } } } diff --git a/test/regression/showtest b/test/regression/showtest index eafd7ac..496e207 100755 --- a/test/regression/showtest +++ b/test/regression/showtest @@ -1,6 +1,6 @@ #!/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 " >&2 @@ -9,8 +9,8 @@ if [ $# != 1 ]; then 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 -- 1.7.10.4