- private void gatherProxParameters(CQLProxNode node)
- throws CQLParseException, IOException {
- for (int i = 0; i < 4; i++) {
- if (lexer.ttype != '/')
- return; // end of proximity parameters
-
- match('/');
- if (lexer.ttype != '/') {
- // not an omitted default
- switch (i) {
- // Order should be: relation/distance/unit/ordering
- // For now, use MA's: unit/relation/distance/ordering
- case 0: gatherProxRelation(node); break;
- case 1: gatherProxDistance(node); break;
- case 2: gatherProxUnit(node); break;
- case 3: gatherProxOrdering(node); break;
- }
- }
- }
- }
-
- private void gatherProxRelation(CQLProxNode node)
- throws CQLParseException, IOException {
- if (!isRelation())
- throw new CQLParseException("expected proximity relation, got " +
- lexer.render());
- node.addModifier("relation", null, lexer.render(lexer.ttype, false));
- match(lexer.ttype);
- debug("gPR matched " + lexer.render(lexer.ttype, false));
- }
-
- private void gatherProxDistance(CQLProxNode node)
- throws CQLParseException, IOException {
- if (lexer.ttype != lexer.TT_NUMBER)
- throw new CQLParseException("expected proximity distance, got " +
- lexer.render());
- node.addModifier("distance", null, lexer.render(lexer.ttype, false));
- match(lexer.ttype);
- debug("gPD matched " + lexer.render(lexer.ttype, false));
- }
-
- private void gatherProxUnit(CQLProxNode node)
- throws CQLParseException, IOException {
- if (lexer.ttype != lexer.TT_pWORD &&
- lexer.ttype != lexer.TT_SENTENCE &&
- lexer.ttype != lexer.TT_PARAGRAPH &&
- lexer.ttype != lexer.TT_ELEMENT)
- throw new CQLParseException("expected proximity unit, got " +
- lexer.render());
- node.addModifier("unit", null, lexer.render());
- match(lexer.ttype);
- }
-
- private void gatherProxOrdering(CQLProxNode node)
- throws CQLParseException, IOException {
- if (lexer.ttype != lexer.TT_ORDERED &&
- lexer.ttype != lexer.TT_UNORDERED)
- throw new CQLParseException("expected proximity ordering, got " +
- lexer.render());
- node.addModifier("ordering", null, lexer.render());
- match(lexer.ttype);
- }
-
- // Checks for a relation that may be used inside a prox operator