use of catdata.aql.exp.QueryExp.QueryExpCompose in project fql by CategoricalData.
the class CombinatorParser method queryExp.
/*
* private static Parser<Quad<LocStr, Block, List<catdata.Pair<LocStr,
* RawTerm>>, List<catdata.Pair<LocStr, Trans>>>> block( boolean isSimple) {
* Parser<List<catdata.Pair<LocStr, String>>> generators =
* Parsers.tuple(token("from"), env(ident, ":")) .map(x -> x.b);
*
* Parser<catdata.Pair<Integer, catdata.Pair<RawTerm, RawTerm>>> eq = Parsers
* .tuple(Parsers.INDEX, Parsers.tuple(term(), token("="), term()).map(x -> new
* catdata.Pair<>(x.a, x.c))) .map(x -> new catdata.Pair<>(x.a, x.b));
*
* Parser<List<catdata.Pair<Integer, catdata.Pair<RawTerm, RawTerm>>>> eqs =
* Parsers .tuple(token("where"), eq.many()).map(x -> x.b);
*
* Parser<List<catdata.Pair<LocStr, RawTerm>>> atts = Parsers
* .tuple(token("attributes"), Parsers.tuple(locstr, token("->"), term()).map(x
* -> new catdata.Pair<>(x.a, x.c)).many()) .map(x -> x.b);
*
* Parser<List<catdata.Pair<LocStr, Trans>>> fks = Parsers
* .tuple(token("foreign_keys"), Parsers.tuple(locstr, token("->"),
* trans()).map(x -> new catdata.Pair<>(x.a, x.c)).many()) .map(x -> x.b);
*
* Parser<Tuple5<List<catdata.Pair<LocStr, String>>, List<catdata.Pair<Integer,
* catdata.Pair<RawTerm, RawTerm>>>, List<catdata.Pair<LocStr, RawTerm>>,
* List<catdata.Pair<LocStr, Trans>>, List<catdata.Pair<String, String>>>> pa =
* Parsers .tuple(generators.optional(), eqs.optional(), atts.optional(),
* fks.optional(), options);
*
* Parser<LocStr> lp = locstr.followedBy(token("->")); if (isSimple) { lp =
* Parsers.tuple(Parsers.INDEX, Parsers.constant("Q")).map(x -> new LocStr(x.a,
* x.b)); } Parser<Quad<LocStr, Block, List<catdata.Pair<LocStr, RawTerm>>,
* List<catdata.Pair<LocStr, Trans>>>> ret = Parsers .tuple(lp, token("{"), pa,
* token("}")).map(x -> new Quad<>(x.a, new Block(x.c.a, Util.newIfNull(x.c.b),
* x.c.e, Util.newIfNull(x.c.c), x.a.str),
*
* Util.newIfNull(x.c.c), Util.newIfNull(x.c.d)));
*
* return ret;
*
* }
*/
private static void queryExp() {
Parser<QueryExp<?, ?, ?, ?, ?, ?, ?, ?>> var = ident.map(QueryExpVar::new), deltaQueryEval = Parsers.tuple(token("toQuery"), map_ref.lazy(), options.between(token("{"), token("}")).optional()).map(x -> new QueryExpDeltaEval<>(x.b, Util.newIfNull(x.c))), deltaQueryCoEval = Parsers.tuple(token("toCoQuery"), map_ref.lazy(), options.between(token("{"), token("}")).optional()).map(x -> new QueryExpDeltaCoEval<>(x.b, Util.newIfNull(x.c))), comp = Parsers.tuple(token("["), query_ref.lazy(), token(";"), query_ref.lazy().followedBy(token("]")), options.between(token("{"), token("}")).optional()).map(x -> new QueryExpCompose(x.b, x.d, Util.newIfNull(x.e))), id = Parsers.tuple(token("identity"), sch_ref.lazy()).map(x -> new QueryExpId<>(x.b)), ret = Parsers.or(id, queryExpRaw(), queryExpRawSimple(), var, deltaQueryEval, deltaQueryCoEval, comp, parens(query_ref));
query_ref.set(ret);
}
Aggregations