-// $Id: CQLLexer.java,v 1.8 2006-05-19 17:45:36 mike Exp $
+// $Id: CQLLexer.java,v 1.9 2007-06-07 16:15:22 mike Exp $
package org.z3950.zing.cql;
import java.io.StreamTokenizer;
CQLLexer(String cql, boolean lexdebug) {
super(new StringReader(cql));
- ordinaryChars ('0', '9');
wordChars('!', '?'); // ASCII-dependency!
wordChars('[', '`'); // ASCII-dependency!
quoteChar('"');
ordinaryChar('(');
ordinaryChar(')');
wordChars('\'', '\''); // prevent this from introducing strings
+ parseNumbers();
DEBUG = lexdebug;
}
if (token == TT_EOF) {
return "EOF";
} else if (token == TT_NUMBER) {
- return new Double((double) nval).toString();
+ if ((double) nval == (int) nval) {
+ return new Integer((int) nval).toString();
+ } else {
+ return new Double((double) nval).toString();
+ }
} else if (token == TT_WORD) {
return "word: " + sval;
} else if (token == '"') {