Rule containsAll() { Var<List<ConditionValue>> elems = new Var<List<ConditionValue>>(new LinkedList<ConditionValue>()); return Sequence(field(), push(match()), space(), EQUALS, space(), SQUARE_BRACKET_OPEN, space(), value(), elems.get().add((ConditionValue)pop()), space(), ZeroOrMore(COMMA, space(), value(), elems.get().add((ConditionValue)pop()), space()), SQUARE_BRACKET_CLOSE, push(new ContainsAll(toElement(pop().toString()), elems.get()))); } Rule containsOne() {
Rule functionOrFieldList() { return Sequence(push(new LinkedList()), functionOrFieldOrString(), ZeroOrMore(COMMA, functionOrFieldOrString()), push(WikittyQueryFunction.createFusionIfNeeded((List)pop()))); } Rule functionOrFieldOrString() {
Rule function() { Var<String> alias = new Var<String>(); return Sequence(OneOrMore(FirstOf(field(), AnyOf("#"))), push(match()), BRACKET_OPEN, push(new LinkedList()), Optional(functionOrFieldOrString(), ZeroOrMore(COMMA, functionOrFieldOrString())), BRACKET_CLOSE, Optional(alias(alias)), push(WikittyQueryFunction.create(pop(1).toString(), alias.get(), (List)pop()))); }
/** * gere eq, isNull * @return */ Rule isNotNull() { return Sequence(field(), push(match()), space(), NOT_EQUALS, space(), icNULL, push(new NotNull(toElement(pop().toString())))); }
/** * gere eq, startsWith, endsWith, isNull * @return */ Rule isNull() { return Sequence(field(), push(match()), space(), EQUALS, space(), icNULL, push(new Null(toElement(pop().toString())))); }
Rule fieldFunction() { Var<String> alias = new Var<String>(); return Sequence(field(), push(toElement(match())), Optional(alias(alias)), push(new FunctionFieldValue(alias.get(), pop().toString()))); }
Rule stringFunction() { Var<String> alias = new Var<String>(); return Sequence(valueText(), Optional(alias(alias)), push(new FunctionValue(alias.get(), ((ConditionValueString)pop()).getValue() ))); }
Rule limit() { return Optional(space(), icLIMIT, FirstOf(EQUALS, space()), OneOrMore(AnyOf("1234567890")), push(((WikittyQuery)pop()).setLimit(toInt(match()))) ); }
Rule depth() { return Optional(space(), icDEPTH, FirstOf(EQUALS, space()), OneOrMore(AnyOf("1234567890")), push(((WikittyQuery)pop()).setWikittyFieldSearchDepth(toInt(match()))) ); }
Rule start() { return Sequence(FirstOf(or(), empty()), push(new WikittyQuery((Condition)pop())), offset(), limit(), depth(), space(), EOI); }