Search in sources :

Example 1 with PragmaExpProc

use of catdata.aql.exp.PragmaExp.PragmaExpProc in project fql by CategoricalData.

the class CombinatorParser method pragmaExp.

@SuppressWarnings({ "rawtypes", "unchecked" })
private static void pragmaExp() {
    Parser<Pair<List<String>, List<catdata.Pair<String, String>>>> p = Parsers.tuple(ident.many(), options).between(token("{"), token("}"));
    Parser<PragmaExp> var = ident.map(PragmaExpVar::new), csvInst = Parsers.tuple(token("export_csv_instance"), inst_ref.lazy(), ident, options.between(token("{"), token("}")).optional()).map(x -> new PragmaExpToCsvInst(x.b, x.c, x.d == null ? new LinkedList<>() : x.d)), csvTrans = Parsers.tuple(token("export_csv_transform"), trans_ref.lazy(), ident, options.between(token("{"), token("}")).optional(), options.between(token("{"), token("}")).optional()).map(x -> new PragmaExpToCsvTrans(x.b, x.c, x.d == null ? new LinkedList<>() : x.d, x.e == null ? new LinkedList<>() : x.e)), sql = Parsers.tuple(token("exec_jdbc"), ident, ident, p).map(x -> new PragmaExpSql(x.b, x.c, x.d.a, x.d.b)), js = Parsers.tuple(token("exec_js"), p).map(x -> new PragmaExpJs(x.b.a, x.b.b)), proc = Parsers.tuple(token("exec_cmdline"), p).map(x -> new PragmaExpProc(x.b.a, x.b.b)), jdbcInst = Parsers.tuple(Parsers.tuple(token("export_jdbc_instance"), inst_ref.lazy()), ident, ident, ident, options.between(token("{"), token("}")).optional()).map(x -> new PragmaExpToJdbcInst(x.a.b, x.b, x.c, x.d, x.e == null ? new LinkedList<>() : x.e)), jdbcQuery = Parsers.tuple(Parsers.tuple(token("export_jdbc_query"), query_ref.lazy()), Parsers.tuple(ident, ident, ident, ident), options.between(token("{"), token("}")).optional()).map(x -> new PragmaExpToJdbcQuery(x.a.b, x.b.a, x.b.b, x.b.c, x.b.d, x.c == null ? new LinkedList<>() : x.c)), jdbcTrans = Parsers.tuple(Parsers.tuple(token("export_jdbc_transform"), trans_ref.lazy()), ident, ident, ident, Parsers.tuple(options.between(token("{"), token("}")).optional(), options.between(token("{"), token("}")).optional())).map(x -> new PragmaExpToJdbcTrans(x.a.b, x.b, x.c, x.d, x.e.a == null ? new LinkedList<>() : x.e.a, x.e.b == null ? new LinkedList<>() : x.e.b)), match = Parsers.tuple(token("match"), ident.followedBy(token(":")), graph_ref.lazy().followedBy(token("->")), graph_ref.lazy(), options.between(token("{"), token("}")).optional()).map(x -> new PragmaExpMatch(x.b, x.c, x.d, x.e == null ? new LinkedList<>() : x.e)), load = Parsers.tuple(token("add_to_classpath"), token("{"), ident.many(), token("}")).map(x -> new PragmaExpLoadJars(x.c)), check = Parsers.tuple(token("check"), edsExp(), inst_ref.lazy()).map(x -> new PragmaExpCheck(x.c, x.b)), cons = Parsers.tuple(token("assert_consistent"), inst_ref.lazy()).map(x -> new PragmaExpConsistent(x.b)), ret = Parsers.or(jdbcQuery, check, csvInst, cons, csvTrans, var, sql, js, proc, jdbcInst, jdbcTrans, match, load, parens(pragma_ref));
    pragma_ref.set(ret);
}
Also used : PragmaExpLoadJars(catdata.aql.exp.PragmaExp.PragmaExpLoadJars) PragmaExpToJdbcInst(catdata.aql.exp.PragmaExp.PragmaExpToJdbcInst) PragmaExpVar(catdata.aql.exp.PragmaExp.PragmaExpVar) PragmaExpToJdbcQuery(catdata.aql.exp.PragmaExp.PragmaExpToJdbcQuery) PragmaExpSql(catdata.aql.exp.PragmaExp.PragmaExpSql) PragmaExpProc(catdata.aql.exp.PragmaExp.PragmaExpProc) PragmaExpCheck(catdata.aql.exp.PragmaExp.PragmaExpCheck) PragmaExpJs(catdata.aql.exp.PragmaExp.PragmaExpJs) PragmaExpToCsvTrans(catdata.aql.exp.PragmaExp.PragmaExpToCsvTrans) PragmaExpMatch(catdata.aql.exp.PragmaExp.PragmaExpMatch) PragmaExpToJdbcTrans(catdata.aql.exp.PragmaExp.PragmaExpToJdbcTrans) PragmaExpConsistent(catdata.aql.exp.PragmaExp.PragmaExpConsistent) PragmaExpToCsvInst(catdata.aql.exp.PragmaExp.PragmaExpToCsvInst) Pair(org.jparsec.functors.Pair)

Aggregations

PragmaExpCheck (catdata.aql.exp.PragmaExp.PragmaExpCheck)1 PragmaExpConsistent (catdata.aql.exp.PragmaExp.PragmaExpConsistent)1 PragmaExpJs (catdata.aql.exp.PragmaExp.PragmaExpJs)1 PragmaExpLoadJars (catdata.aql.exp.PragmaExp.PragmaExpLoadJars)1 PragmaExpMatch (catdata.aql.exp.PragmaExp.PragmaExpMatch)1 PragmaExpProc (catdata.aql.exp.PragmaExp.PragmaExpProc)1 PragmaExpSql (catdata.aql.exp.PragmaExp.PragmaExpSql)1 PragmaExpToCsvInst (catdata.aql.exp.PragmaExp.PragmaExpToCsvInst)1 PragmaExpToCsvTrans (catdata.aql.exp.PragmaExp.PragmaExpToCsvTrans)1 PragmaExpToJdbcInst (catdata.aql.exp.PragmaExp.PragmaExpToJdbcInst)1 PragmaExpToJdbcQuery (catdata.aql.exp.PragmaExp.PragmaExpToJdbcQuery)1 PragmaExpToJdbcTrans (catdata.aql.exp.PragmaExp.PragmaExpToJdbcTrans)1 PragmaExpVar (catdata.aql.exp.PragmaExp.PragmaExpVar)1 Pair (org.jparsec.functors.Pair)1