Rule UnicodeEscape() { return Sequence(OneOrMore('u'), HexDigit(), HexDigit(), HexDigit(), HexDigit()); }
Rule field() { return OneOrMore(FirstOf(CharRange('0', '9'), CharRange('a', 'z'), CharRange('A', 'Z'), AnyOf("_.*"))); }
/** * Une chaine simple sans espace, parenthese, retour chariot, tabulation, * accolade, crochet, ", '. * @return */ Rule SimpleString() { return OneOrMore(FirstOf( Escape(), Sequence(TestNot(AnyOf(" #\t\r\n\\" +COMMA +LITERAL_OPEN_SIMPLE+LITERAL_OPEN_DOUBLE +BRACKET_OPEN+BRACKET_CLOSE +CURLY_BRACKET_OPEN+CURLY_BRACKET_CLOSE +SQUARE_BRACKET_OPEN+SQUARE_BRACKET_CLOSE)), ANY) )).suppressSubnodes(); }
Rule offset() { return Optional(space(), icOFFSET, FirstOf(EQUALS, space()), OneOrMore(AnyOf("1234567890")), push(((WikittyQuery)pop()).setOffset(toInt(match()))) ); }
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 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()))); }