Comment.
[cql-java-moved-to-github.git] / src / org / z3950 / zing / cql / CQLLexer.java
index ce38eb6..90f2167 100644 (file)
@@ -1,4 +1,4 @@
-// $Id: CQLLexer.java,v 1.3 2002-11-01 23:45:28 mike Exp $
+// $Id: CQLLexer.java,v 1.8 2006-05-19 17:45:36 mike Exp $
 
 package org.z3950.zing.cql;
 import java.io.StreamTokenizer;
@@ -35,6 +35,8 @@ class CQLLexer extends StreamTokenizer {
     static int TT_RELEVANT  = 1016;    // The "relevant" relation modifier
     static int TT_FUZZY     = 1017;    // The "fuzzy" relation modifier
     static int TT_STEM      = 1018;    // The "stem" relation modifier
+    static int TT_SCR       = 1019;    // The server choice relation
+    static int TT_PHONETIC  = 1020;    // The "phonetic" relation modifier
 
     // Support for keywords.  It would be nice to compile this linear
     // list into a Hashtable, but it's hard to store ints as hash
@@ -67,6 +69,8 @@ class CQLLexer extends StreamTokenizer {
        new Keyword(TT_RELEVANT, "relevant"),
        new Keyword(TT_FUZZY, "fuzzy"),
        new Keyword(TT_STEM, "stem"),
+       new Keyword(TT_SCR, "scr"),
+       new Keyword(TT_PHONETIC, "phonetic"),
     };
 
     // For halfDecentPushBack() and the code at the top of nextToken()
@@ -80,6 +84,10 @@ class CQLLexer extends StreamTokenizer {
 
     CQLLexer(String cql, boolean lexdebug) {
        super(new StringReader(cql));
+       ordinaryChars ('0', '9');
+       wordChars('!', '?');    // ASCII-dependency!
+       wordChars('[', '`');    // ASCII-dependency!
+       quoteChar('"');
        ordinaryChar('=');
        ordinaryChar('<');
        ordinaryChar('>');
@@ -87,7 +95,6 @@ class CQLLexer extends StreamTokenizer {
        ordinaryChar('(');
        ordinaryChar(')');
        wordChars('\'', '\''); // prevent this from introducing strings
-       parseNumbers();
        DEBUG = lexdebug;
     }
 
@@ -181,7 +188,7 @@ class CQLLexer extends StreamTokenizer {
        if (token == TT_EOF) {
            return "EOF";
        } else if (token == TT_NUMBER) {
-           return new Integer((int) nval).toString();
+           return new Double((double) nval).toString();
        } else if (token == TT_WORD) {
            return "word: " + sval;
        } else if (token == '"') {