This means that terms like "3d" will, as before, be incorrectly lexed
as the number "3" followed by the word "d", but that's how every
release until now has been, so we can obviously live with that.
The regression test was also broken by the previous change supporting
floating-point numbers, but I fixed that by having render() return
only the integer part when that's numerically equal to the full
banana. A similar lexical hack might be the way forward with the
other reverted change, but right now just making everything work the
way it ought to top priority.
-// $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;
package org.z3950.zing.cql;
import java.io.StreamTokenizer;
CQLLexer(String cql, boolean lexdebug) {
super(new StringReader(cql));
CQLLexer(String cql, boolean lexdebug) {
super(new StringReader(cql));
- ordinaryChars ('0', '9');
wordChars('!', '?'); // ASCII-dependency!
wordChars('[', '`'); // ASCII-dependency!
quoteChar('"');
wordChars('!', '?'); // ASCII-dependency!
wordChars('[', '`'); // ASCII-dependency!
quoteChar('"');
ordinaryChar('(');
ordinaryChar(')');
wordChars('\'', '\''); // prevent this from introducing strings
ordinaryChar('(');
ordinaryChar(')');
wordChars('\'', '\''); // prevent this from introducing strings
if (token == TT_EOF) {
return "EOF";
} else if (token == TT_NUMBER) {
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 == '"') {
} else if (token == TT_WORD) {
return "word: " + sval;
} else if (token == '"') {