+ private String matchSymbol(String expected)
+ throws CQLParseException, IOException {
+
+ debug("in matchSymbol()");
+ if (lexer.ttype == lexer.TT_WORD ||
+ lexer.ttype == lexer.TT_NUMBER ||
+ lexer.ttype == '"' ||
+ // The following is a complete list of keywords. Because
+ // they're listed here, they can be used unquoted as
+ // qualifiers, terms, prefix names and prefix identifiers.
+ // ### Instead, we should ask the lexer whether what we
+ // have is a keyword, and let the knowledge reside there.
+ lexer.ttype == lexer.TT_AND ||
+ lexer.ttype == lexer.TT_OR ||
+ lexer.ttype == lexer.TT_NOT ||
+ lexer.ttype == lexer.TT_PROX ||
+ lexer.ttype == lexer.TT_ANY ||
+ lexer.ttype == lexer.TT_ALL ||
+ lexer.ttype == lexer.TT_EXACT ||
+ lexer.ttype == lexer.TT_pWORD ||
+ lexer.ttype == lexer.TT_SENTENCE ||
+ lexer.ttype == lexer.TT_PARAGRAPH ||
+ lexer.ttype == lexer.TT_ELEMENT ||
+ lexer.ttype == lexer.TT_ORDERED ||
+ lexer.ttype == lexer.TT_UNORDERED ||
+ lexer.ttype == lexer.TT_RELEVANT ||
+ lexer.ttype == lexer.TT_FUZZY ||
+ lexer.ttype == lexer.TT_STEM ||
+ lexer.ttype == lexer.TT_SCR ||
+ lexer.ttype == lexer.TT_PHONETIC) {
+ String symbol = (lexer.ttype == lexer.TT_NUMBER) ?
+ lexer.render() : lexer.sval;
+ match(lexer.ttype);
+ return symbol;
+ }
+
+ throw new CQLParseException("expected " + expected + ", " +
+ "got " + lexer.render());
+ }
+