package org.z3950.zing.cql;
import java.io.IOException;
-import java.util.Vector;
import java.util.Properties;
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.List;
/**
public class CQLParser {
private CQLLexer lexer;
private int compat; // When false, implement CQL 1.2
- public static int V1POINT1 = 12368;
- public static int V1POINT2 = 12369;
- public static int V1POINT1SORT = 12370;
+ public static final int V1POINT1 = 12368;
+ public static final int V1POINT2 = 12369;
+ public static final int V1POINT1SORT = 12370;
static private boolean DEBUG = false;
static private boolean LEXDEBUG = false;
debug("non-parenthesised term");
word = matchSymbol("index or term");
- if (!isSymbolicRelation() && lexer.ttype != lexer.TT_WORD)
+ while (lexer.ttype == lexer.TT_WORD && !isRelation()) {
+ word = word + " " + lexer.sval;
+ match(lexer.TT_WORD);
+ }
+
+ if (!isRelation())
break;
index = word;
relation = new CQLRelation(relstr);
match(lexer.ttype);
ModifierSet ms = gatherModifiers(relstr);
- relation.setModifiers(ms);
+ relation.ms = ms;
debug("index='" + index + ", " +
"relation='" + relation.toCQL() + "'");
}
debug("isRelation: checking ttype=" + lexer.ttype +
" (" + lexer.render() + ")");
if (lexer.ttype == lexer.TT_WORD &&
- (lexer.sval == "exact" ||
- lexer.sval == "any" ||
- lexer.sval == "all" ||
- (lexer.sval == "scr" && compat == V1POINT2)))
+ (lexer.sval.indexOf('.') >= 0 ||
+ lexer.sval.equals("any") ||
+ lexer.sval.equals("all") ||
+ lexer.sval.equals("within") ||
+ lexer.sval.equals("encloses") ||
+ lexer.sval.equals("exact") ||
+ (lexer.sval.equals("scr") && compat != V1POINT2) ||
+ (lexer.sval.equals("adj") && compat == V1POINT2)))
return true;
return isSymbolicRelation();
char mode = 'x'; // x=XCQL, c=CQL, p=PQF
String pfile = null;
- Vector<String> argv = new Vector<String>();
+ List<String> argv = new ArrayList<String>();
for (int i = 0; i < args.length; i++) {
argv.add(args[i]);
}