use of org.jparsec.Parser in project fql by CategoricalData.
the class OplParser method query.
private static Parser<?> query() {
Parser eee = Parsers.or(term("="), Parsers.tuple(term(":"), term("=")));
Parser p = Parsers.tuple(ident(), eee, block(), term(":"), ident());
Parser p2 = p.sepBy(term(",")).between(term("{"), term("}")).between(term("query"), term(":"));
return Parsers.tuple(p2, ident(), term("->"), ident());
}
use of org.jparsec.Parser in project fql by CategoricalData.
the class OplParser method sql.
private static Parser<?> sql() {
Parser p = Parsers.tuple(term("insert"), term("into"), ident(), block2());
Parser p2 = p.sepBy(term(";"));
return Parsers.tuple(term("sql"), p2.between(term("{"), term("}")).followedBy(term(":")), ident(), term("->"), ident());
}
use of org.jparsec.Parser in project fql by CategoricalData.
the class OplParser method flower.
private static Parser<?> flower() {
Parser<?> from0 = Parsers.tuple(ident(), term("as"), ident()).sepBy(term(","));
Parser<?> from = Parsers.tuple(term("from"), from0, term(";"));
Parser<?> where0 = Parsers.tuple(oplTerm(), term("="), oplTerm()).sepBy(term(","));
Parser<?> where = Parsers.tuple(term("where"), where0, term(";"));
Parser<?> select0 = Parsers.tuple(oplTerm(), term("as"), ident()).sepBy(term(","));
Parser<?> select = Parsers.tuple(term("select"), select0, term(";"));
Parser p = Parsers.tuple(select, from, where);
Parser ret = Parsers.tuple(term("flower"), p.between(term("{"), term("}")), ident());
return ret;
}
use of org.jparsec.Parser in project fql by CategoricalData.
the class OplParser method block.
private static Parser<?> block() {
Parser eee = Parsers.or(term("="), Parsers.tuple(term(":"), term("=")));
Parser p1 = Parsers.tuple(ident(), term(":"), ident()).sepBy(term(",")).between(term("for"), term(";"));
Parser p2 = Parsers.tuple(oplTerm(), term("="), oplTerm()).sepBy(term(",")).between(term("where"), term(";"));
Parser p3 = Parsers.tuple(ident(), eee, Parsers.or(agg(), oplTerm())).sepBy(term(",")).between(term("return"), term(";"));
Parser q = Parsers.tuple(ident(), eee, oplTerm()).sepBy(term(",")).between(term("{"), term("}"));
Parser a = Parsers.tuple(ident(), eee, q, term(":"), ident());
Parser p4 = a.sepBy(term(",")).between(term("keys"), term(";"));
Parser p = Parsers.tuple(p1, p2, p3, p4);
return p.between(term("{"), term("}"));
}
use of org.jparsec.Parser in project fql by CategoricalData.
the class NraViewer method ty.
private static Parser<?> ty() {
Reference ref = Parser.newReference();
Parser p = Parsers.tuple(term("set"), term("("), Parsers.tuple(ident(), term(":"), ref.lazy().or(term("string"))).sepBy(term(",")), term(")"));
ref.set(p);
return p;
}
Aggregations