X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Forg%2Fz3950%2Fzing%2Fcql%2FCQLLexer.java;h=01cc05dd1ae1d16c53216f9277b8cfa18b13724a;hb=8d4197c069c477cb1285b047b4e4ea5ca22ad79d;hp=11c99eaee484aeb725c0f8cda75efbe6d56945f9;hpb=a7592c6784c33f5afdb1eb4a67a521f5bf2cba1c;p=cql-java-moved-to-github.git diff --git a/src/org/z3950/zing/cql/CQLLexer.java b/src/org/z3950/zing/cql/CQLLexer.java index 11c99ea..01cc05d 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.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; @@ -19,10 +19,11 @@ class CQLLexer extends 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 @@ -126,6 +127,18 @@ class CQLLexer extends StreamTokenizer { 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 + ", " + @@ -175,6 +188,8 @@ class CQLLexer extends StreamTokenizer { return ">="; } else if (token == TT_NE) { return "<>"; + } else if (token == TT_EQEQ) { + return "=="; } // Check whether its associated with one of the keywords