X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fz3950%2Fzing%2Fcql%2FCQLParser.java;h=b435aa3821862f28f0bafd1b66ecdedaca344f8a;hb=b76b718c1994b348b66a994dcf15c819c4e94617;hp=a4f2fc8ed287094c19e572c84d10ab122a42d22a;hpb=59200080b45184be8779f545d21ce87c4020ccf4;p=cql-java-moved-to-github.git diff --git a/src/main/java/org/z3950/zing/cql/CQLParser.java b/src/main/java/org/z3950/zing/cql/CQLParser.java index a4f2fc8..b435aa3 100644 --- a/src/main/java/org/z3950/zing/cql/CQLParser.java +++ b/src/main/java/org/z3950/zing/cql/CQLParser.java @@ -235,13 +235,13 @@ public class CQLParser { debug("non-parenthesised term"); word = matchSymbol("index or term"); - while (lexer.what() == CQLTokenizer.TT_WORD && !isRelation()) { + while (isWordOrString() && !isRelation()) { word = word + " " + lexer.value(); - match(CQLTokenizer.TT_WORD); + match(lexer.what()); } if (!isRelation()) - break; + break; index = word; String relstr = (lexer.what() == CQLTokenizer.TT_WORD ? @@ -278,6 +278,11 @@ public class CQLParser { return new CQLPrefixNode(name, identifier, node); } + + private boolean isWordOrString() { + return CQLTokenizer.TT_WORD == lexer.what() + || CQLTokenizer.TT_STRING == lexer.what(); + } private boolean isRelation() { debug("isRelation: checking what()=" + lexer.what() + @@ -326,12 +331,10 @@ public class CQLParser { debug("in matchSymbol()"); if (lexer.what() == CQLTokenizer.TT_WORD || - lexer.what() == '"' || + lexer.what() == CQLTokenizer.TT_STRING || // The following is a complete list of keywords. Because // they're listed here, they can be used unquoted as // indexes, terms, prefix names and prefix identifiers. - // ### Instead, we should ask the lexer whether what we - // have is a keyword, and let the knowledge reside there. (allowKeywordTerms && lexer.what() == CQLTokenizer.TT_AND || lexer.what() == CQLTokenizer.TT_OR ||