Search in sources :

Example 1 with TransExpVar

use of catdata.aql.exp.TransExp.TransExpVar in project fql by CategoricalData.

the class CombinatorParser method transExp.

// TODO aql revisit parser type safety
@SuppressWarnings({ "rawtypes", "unchecked" })
private static void transExp() {
    Parser<TransExp<?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?>> var = ident.map(TransExpVar::new), id = Parsers.tuple(token("identity"), inst_ref.lazy()).map(x -> new TransExpId<>(x.b)), sigma = Parsers.tuple(token("sigma"), map_ref.lazy(), trans_ref.lazy(), options.between(token("{"), token("}")).optional(), options.between(token("{"), token("}")).optional()).map(x -> new TransExpSigma(x.b, x.c, x.d == null ? new HashMap<>() : Util.toMapSafely(x.d), x.e == null ? new HashMap<>() : Util.toMapSafely(x.e))), delta = Parsers.tuple(token("delta"), map_ref.lazy(), trans_ref.lazy()).map(x -> new TransExpDelta(x.b, x.c)), unit = Parsers.tuple(token("unit"), map_ref.lazy(), inst_ref.lazy(), options.between(token("{"), token("}")).optional(), options.between(token("{"), token("}")).optional()).map(x -> new TransExpSigmaDeltaUnit(x.b, x.c, x.d == null ? new HashMap<>() : Util.toMapSafely(x.d))), counit = Parsers.tuple(token("counit"), map_ref.lazy(), inst_ref.lazy(), options.between(token("{"), token("}")).optional(), options.between(token("{"), token("}")).optional()).map(x -> new TransExpSigmaDeltaCounit(x.b, x.c, x.d == null ? new HashMap<>() : Util.toMapSafely(x.d))), distinct = Parsers.tuple(token("distinct"), trans_ref.lazy()).map(x -> new TransExpDistinct(x.b)), eval = Parsers.tuple(token("eval"), query_ref.lazy(), trans_ref.lazy()).map(x -> new TransExpEval(x.b, x.c)), coeval = Parsers.tuple(token("coeval"), query_ref.lazy(), trans_ref.lazy(), options.between(token("{"), token("}")).optional(), options.between(token("{"), token("}")).optional()).map(x -> new TransExpCoEval(x.b, x.c, x.d == null ? new LinkedList<>() : x.d, x.e == null ? new LinkedList<>() : x.e)), unitq = Parsers.tuple(token("unit_query"), query_ref.lazy(), inst_ref.lazy(), // token("}")).optional(),
    options.between(token("{"), token("}")).optional()).map(x -> new TransExpCoEvalEvalUnit(x.b, x.c, x.d == null ? new HashMap<>() : Util.toMapSafely(x.d))), counitq = Parsers.tuple(token("counit_query"), query_ref.lazy(), inst_ref.lazy(), // token("}")).optional(),
    options.between(token("{"), token("}")).optional()).map(x -> new TransExpCoEvalEvalCoUnit(x.b, x.c, x.d == null ? new HashMap<>() : Util.toMapSafely(x.d))), comp = Parsers.tuple(token("["), trans_ref.lazy(), token(";"), trans_ref.lazy(), token("]")).map(x -> new TransExpCompose(x.b, x.d));
    Parser ret = Parsers.or(id, transExpRaw(), var, sigma, delta, unit, counit, distinct, eval, coeval, transExpCsv(), unitq, counitq, transExpJdbc(), comp, parens(trans_ref));
    trans_ref.set(ret);
}
Also used : TransExpCoEval(catdata.aql.exp.TransExp.TransExpCoEval) TransExpSigmaDeltaUnit(catdata.aql.exp.TransExp.TransExpSigmaDeltaUnit) TransExpSigmaDeltaCounit(catdata.aql.exp.TransExp.TransExpSigmaDeltaCounit) Parser(org.jparsec.Parser) TransExpEval(catdata.aql.exp.TransExp.TransExpEval) TransExpCoEvalEvalCoUnit(catdata.aql.exp.TransExp.TransExpCoEvalEvalCoUnit) TransExpDelta(catdata.aql.exp.TransExp.TransExpDelta) TransExpDistinct(catdata.aql.exp.TransExp.TransExpDistinct) TransExpVar(catdata.aql.exp.TransExp.TransExpVar) TransExpSigma(catdata.aql.exp.TransExp.TransExpSigma) TransExpCoEvalEvalUnit(catdata.aql.exp.TransExp.TransExpCoEvalEvalUnit)

Aggregations

TransExpCoEval (catdata.aql.exp.TransExp.TransExpCoEval)1 TransExpCoEvalEvalCoUnit (catdata.aql.exp.TransExp.TransExpCoEvalEvalCoUnit)1 TransExpCoEvalEvalUnit (catdata.aql.exp.TransExp.TransExpCoEvalEvalUnit)1 TransExpDelta (catdata.aql.exp.TransExp.TransExpDelta)1 TransExpDistinct (catdata.aql.exp.TransExp.TransExpDistinct)1 TransExpEval (catdata.aql.exp.TransExp.TransExpEval)1 TransExpSigma (catdata.aql.exp.TransExp.TransExpSigma)1 TransExpSigmaDeltaCounit (catdata.aql.exp.TransExp.TransExpSigmaDeltaCounit)1 TransExpSigmaDeltaUnit (catdata.aql.exp.TransExp.TransExpSigmaDeltaUnit)1 TransExpVar (catdata.aql.exp.TransExp.TransExpVar)1 Parser (org.jparsec.Parser)1