Search in sources :

Example 21 with Parser

use of org.jparsec.Parser in project fql by CategoricalData.

the class OplParser method query.

private static Parser<?> query() {
    Parser eee = Parsers.or(term("="), Parsers.tuple(term(":"), term("=")));
    Parser p = Parsers.tuple(ident(), eee, block(), term(":"), ident());
    Parser p2 = p.sepBy(term(",")).between(term("{"), term("}")).between(term("query"), term(":"));
    return Parsers.tuple(p2, ident(), term("->"), ident());
}
Also used : Parser(org.jparsec.Parser)

Example 22 with Parser

use of org.jparsec.Parser in project fql by CategoricalData.

the class OplParser method sql.

private static Parser<?> sql() {
    Parser p = Parsers.tuple(term("insert"), term("into"), ident(), block2());
    Parser p2 = p.sepBy(term(";"));
    return Parsers.tuple(term("sql"), p2.between(term("{"), term("}")).followedBy(term(":")), ident(), term("->"), ident());
}
Also used : Parser(org.jparsec.Parser)

Example 23 with Parser

use of org.jparsec.Parser in project fql by CategoricalData.

the class OplParser method flower.

private static Parser<?> flower() {
    Parser<?> from0 = Parsers.tuple(ident(), term("as"), ident()).sepBy(term(","));
    Parser<?> from = Parsers.tuple(term("from"), from0, term(";"));
    Parser<?> where0 = Parsers.tuple(oplTerm(), term("="), oplTerm()).sepBy(term(","));
    Parser<?> where = Parsers.tuple(term("where"), where0, term(";"));
    Parser<?> select0 = Parsers.tuple(oplTerm(), term("as"), ident()).sepBy(term(","));
    Parser<?> select = Parsers.tuple(term("select"), select0, term(";"));
    Parser p = Parsers.tuple(select, from, where);
    Parser ret = Parsers.tuple(term("flower"), p.between(term("{"), term("}")), ident());
    return ret;
}
Also used : Parser(org.jparsec.Parser)

Example 24 with Parser

use of org.jparsec.Parser in project fql by CategoricalData.

the class OplParser method block.

private static Parser<?> block() {
    Parser eee = Parsers.or(term("="), Parsers.tuple(term(":"), term("=")));
    Parser p1 = Parsers.tuple(ident(), term(":"), ident()).sepBy(term(",")).between(term("for"), term(";"));
    Parser p2 = Parsers.tuple(oplTerm(), term("="), oplTerm()).sepBy(term(",")).between(term("where"), term(";"));
    Parser p3 = Parsers.tuple(ident(), eee, Parsers.or(agg(), oplTerm())).sepBy(term(",")).between(term("return"), term(";"));
    Parser q = Parsers.tuple(ident(), eee, oplTerm()).sepBy(term(",")).between(term("{"), term("}"));
    Parser a = Parsers.tuple(ident(), eee, q, term(":"), ident());
    Parser p4 = a.sepBy(term(",")).between(term("keys"), term(";"));
    Parser p = Parsers.tuple(p1, p2, p3, p4);
    return p.between(term("{"), term("}"));
}
Also used : Parser(org.jparsec.Parser)

Example 25 with Parser

use of org.jparsec.Parser in project fql by CategoricalData.

the class NraViewer method ty.

private static Parser<?> ty() {
    Reference ref = Parser.newReference();
    Parser p = Parsers.tuple(term("set"), term("("), Parsers.tuple(ident(), term(":"), ref.lazy().or(term("string"))).sepBy(term(",")), term(")"));
    ref.set(p);
    return p;
}
Also used : Reference(org.jparsec.Parser.Reference) Parser(org.jparsec.Parser)

Aggregations

Parser (org.jparsec.Parser)38 Reference (org.jparsec.Parser.Reference)15 InstExpAnonymize (catdata.aql.exp.InstExp.InstExpAnonymize)4 InstExpChase (catdata.aql.exp.InstExp.InstExpChase)4 InstExpCoEval (catdata.aql.exp.InstExp.InstExpCoEval)4 InstExpCoProdFull (catdata.aql.exp.InstExp.InstExpCoProdFull)4 InstExpCod (catdata.aql.exp.InstExp.InstExpCod)4 InstExpDelta (catdata.aql.exp.InstExp.InstExpDelta)4 InstExpDistinct (catdata.aql.exp.InstExp.InstExpDistinct)4 InstExpDom (catdata.aql.exp.InstExp.InstExpDom)4 InstExpEval (catdata.aql.exp.InstExp.InstExpEval)4 InstExpFrozen (catdata.aql.exp.InstExp.InstExpFrozen)4 InstExpPi (catdata.aql.exp.InstExp.InstExpPi)4 InstExpSigma (catdata.aql.exp.InstExp.InstExpSigma)4 InstExpSigmaChase (catdata.aql.exp.InstExp.InstExpSigmaChase)4 InstExpVar (catdata.aql.exp.InstExp.InstExpVar)4 ParseException (catdata.ParseException)3 Program (catdata.Program)3 Quad (catdata.Quad)3 Triple (catdata.Triple)3