-// $Id: CQLLexer.java,v 1.12 2007-06-29 12:54:05 mike Exp $
+// $Id: CQLLexer.java,v 1.13 2007-06-29 15:38:56 mike Exp $
package org.z3950.zing.cql;
import java.io.StreamTokenizer;
static int TT_LE = 1000; // The "<=" relation
static int TT_GE = 1001; // The ">=" relation
static int TT_NE = 1002; // The "<>" relation
- static int TT_AND = 1003; // The "and" boolean
- static int TT_OR = 1004; // The "or" boolean
- static int TT_NOT = 1005; // The "not" boolean
- static int TT_PROX = 1006; // The "prox" boolean
+ static int TT_EQEQ = 1003; // The "==" relation
+ static int TT_AND = 1004; // The "and" boolean
+ static int TT_OR = 1005; // The "or" boolean
+ static int TT_NOT = 1006; // The "not" boolean
+ static int TT_PROX = 1007; // The "prox" boolean
// Support for keywords. It would be nice to compile this linear
// list into a Hashtable, but it's hard to store ints as hash
ttype = '>';
debug("AFTER: ttype is now " + ttype + " - " + render());
}
+ } else if (ttype == '=') {
+ debug("token starts with '=' ...");
+ underlyingNextToken();
+ if (ttype == '=') {
+ debug("token continues with '=' - it's '=='");
+ ttype = TT_EQEQ;
+ } else {
+ debug("next token is " + render() + " (pushed back)");
+ halfDecentPushBack();
+ ttype = '=';
+ debug("AFTER: ttype is now " + ttype + " - " + render());
+ }
}
debug("done nextToken(): ttype=" + ttype + ", " +
return ">=";
} else if (token == TT_NE) {
return "<>";
+ } else if (token == TT_EQEQ) {
+ return "==";
}
// Check whether its associated with one of the keywords
-// $Id: CQLParser.java,v 1.35 2007-06-29 15:24:26 mike Exp $
+// $Id: CQLParser.java,v 1.36 2007-06-29 15:39:09 mike Exp $
package org.z3950.zing.cql;
import java.io.IOException;
/**
* Compiles CQL strings into parse trees of CQLNode subtypes.
*
- * @version $Id: CQLParser.java,v 1.35 2007-06-29 15:24:26 mike Exp $
+ * @version $Id: CQLParser.java,v 1.36 2007-06-29 15:39:09 mike Exp $
* @see <A href="http://zing.z3950.org/cql/index.html"
* >http://zing.z3950.org/cql/index.html</A>
*/
lexer.ttype == '=' ||
lexer.ttype == lexer.TT_LE ||
lexer.ttype == lexer.TT_GE ||
- lexer.ttype == lexer.TT_NE);
+ lexer.ttype == lexer.TT_NE ||
+ lexer.ttype == lexer.TT_EQEQ);
}
private void match(int token)