From: mike Date: Thu, 7 Jun 2007 16:15:22 +0000 (+0000) Subject: Revert the previous change, because it broke the regression test. X-Git-Tag: v1.5~134 X-Git-Url: http://lists.indexdata.com/cgi-bin?a=commitdiff_plain;h=06247838399c68f3aacacaba75714e25d22d9992;p=cql-java-moved-to-github.git Revert the previous change, because it broke the regression test. 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. --- diff --git a/src/org/z3950/zing/cql/CQLLexer.java b/src/org/z3950/zing/cql/CQLLexer.java index 90f2167..2cb8852 100644 --- a/src/org/z3950/zing/cql/CQLLexer.java +++ b/src/org/z3950/zing/cql/CQLLexer.java @@ -1,4 +1,4 @@ -// $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; @@ -84,7 +84,6 @@ class CQLLexer extends StreamTokenizer { CQLLexer(String cql, boolean lexdebug) { super(new StringReader(cql)); - ordinaryChars ('0', '9'); wordChars('!', '?'); // ASCII-dependency! wordChars('[', '`'); // ASCII-dependency! quoteChar('"'); @@ -95,6 +94,7 @@ class CQLLexer extends StreamTokenizer { ordinaryChar('('); ordinaryChar(')'); wordChars('\'', '\''); // prevent this from introducing strings + parseNumbers(); DEBUG = lexdebug; } @@ -188,7 +188,11 @@ class CQLLexer extends StreamTokenizer { 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 == '"') {