use of catdata.fqlpp.CatExp.Colim in project fql by CategoricalData.
the class PPParser method toCat.
private static CatExp toCat(Object o) {
if (o.toString().equals("Set")) {
return new Named("Set");
}
if (o.toString().equals("Cat")) {
return new Named("Cat");
}
if (o instanceof Tuple4) {
Tuple4 t = (Tuple4) o;
return new Kleisli(t.b.toString(), t.c.toString(), t.d.toString(), t.a.toString().equals("cokleisli"));
}
try {
Tuple3<?, ?, ?> t = (Tuple3<?, ?, ?>) o;
String y = t.b.toString();
if (y.equals("+")) {
return new Plus(toCat(t.a), toCat(t.c));
} else if (y.equals("*")) {
return new Times(toCat(t.a), toCat(t.c));
} else if (y.equals("^")) {
return new CatExp.Exp(toCat(t.a), toCat(t.c));
} else if (t.a.toString().equals("union")) {
return new Union(toCat(t.b), toCat(t.c));
} else {
return toCatConst(o);
}
} catch (RuntimeException cce) {
}
try {
org.jparsec.functors.Pair<?, ?> p = (org.jparsec.functors.Pair<?, ?>) o;
if (p.a.toString().equals("dom")) {
return new CatExp.Dom(toFtr(p.b));
} else if (p.a.toString().equals("cod")) {
return new Cod(toFtr(p.b));
} else if (p.a.toString().equals("colim")) {
return new Colim((String) p.b);
}
} catch (RuntimeException cce) {
}
try {
if (o.toString().equals("void")) {
return new CatExp.Zero();
} else if (o.toString().equals("unit")) {
return new CatExp.One();
}
} catch (RuntimeException cce) {
}
return new CatExp.Var(o.toString());
}
Aggregations