Search in sources :

Example 1 with ColimSchExpRaw

use of catdata.aql.exp.ColimSchExp.ColimSchExpRaw in project fql by CategoricalData.

the class CombinatorParser method colimSchExp.

@SuppressWarnings({ "rawtypes", "unchecked" })
private static void colimSchExp() {
    Parser<List<catdata.Pair<LocStr, SchExp<?, ?, ?, ?, ?>>>> nodes = Parsers.tuple(token("nodes"), env(sch_ref.lazy(), "->")).map(x -> x.b);
    Parser<List<catdata.Pair<LocStr, MapExp<?, ?, ?, ?, ?, ?, ?, ?>>>> edges = Parsers.tuple(token("edges"), env(map_ref.lazy(), "->")).map(x -> x.b);
    Parser<Tuple4<Object, List<catdata.Pair<LocStr, SchExp<?, ?, ?, ?, ?>>>, List<catdata.Pair<LocStr, MapExp<?, ?, ?, ?, ?, ?, ?, ?>>>, List<catdata.Pair<String, String>>>> pa = Parsers.tuple(Parsers.always(), nodes.optional(), edges.optional(), options);
    Parser<Tuple5<Token, GraphExp<?, ?>, Token, TyExp<?, ?>, Token>> l = Parsers.tuple(token("literal"), graph_ref.lazy(), token(":"), ty_ref.lazy(), token("{"));
    Parser<ColimSchExp<?>> ret = Parsers.tuple(l, pa, token("}")).map(x -> {
        // schema graph nodes edges options imports
        return new ColimSchExpRaw(x.a.b, x.a.d, Util.newIfNull(x.b.b), Util.newIfNull(x.b.c), x.b.d);
    });
    Parser<ColimSchExp<?>> ret2 = ident.map(x -> new ColimSchExpVar(x)), ret3 = Parsers.tuple(token("wrap"), colim_ref.lazy(), map_ref.lazy(), map_ref.lazy()).map(x -> new ColimSchExpWrap(x.b, x.c, x.d));
    Parser<ColimSchExp<?>> retX = Parsers.or(ret, ret2, ret3, colimExpModify(), colimSchExpQuotient(), parens(colim_ref));
    colim_ref.set(retX);
}
Also used : ColimSchExpRaw(catdata.aql.exp.ColimSchExp.ColimSchExpRaw) ColimSchExpVar(catdata.aql.exp.ColimSchExp.ColimSchExpVar) Tuple4(org.jparsec.functors.Tuple4) Tuple5(org.jparsec.functors.Tuple5) ColimSchExpWrap(catdata.aql.exp.ColimSchExp.ColimSchExpWrap) List(java.util.List) LinkedList(java.util.LinkedList) Pair(org.jparsec.functors.Pair)

Aggregations

ColimSchExpRaw (catdata.aql.exp.ColimSchExp.ColimSchExpRaw)1 ColimSchExpVar (catdata.aql.exp.ColimSchExp.ColimSchExpVar)1 ColimSchExpWrap (catdata.aql.exp.ColimSchExp.ColimSchExpWrap)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Pair (org.jparsec.functors.Pair)1 Tuple4 (org.jparsec.functors.Tuple4)1 Tuple5 (org.jparsec.functors.Tuple5)1