Search in sources :

Example 26 with Parser

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

the class CfgToOpl method program.

@SuppressWarnings({ "unchecked", "rawtypes" })
private static Parser program() {
    Parser q = string().many().sepBy(term("|"));
    Parser p = Parsers.tuple(ident(), term("::="), q).sepBy(term(","));
    return p;
}
Also used : Parser(org.jparsec.Parser)

Example 27 with Parser

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

the class XParser method poly.

private static Parser<?> poly(Reference ref) {
    Parser p = Parsers.tuple(ident(), term("="), block(), term(":"), ident());
    Parser p2 = p.sepBy(term(",")).between(term("{"), term("}")).between(term("polynomial"), term(":"));
    return Parsers.tuple(p2, ref.lazy(), term("->"), ref.lazy());
}
Also used : Parser(org.jparsec.Parser)

Example 28 with Parser

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

the class XParser method block.

/*{ from a1:A, a2:A;
           where a1.att2=a2.f.att1;
           attributes att3 = a2.att2,
                      att4 = a2.att2;
           edges e1 = {b2=a1.f, b3=a1.f} : q2,
                 e2 = { ... } : q3; 
           } */
private static Parser<?> block() {
    Parser p1 = Parsers.tuple(ident(), term(":"), ident()).sepBy(term(",")).between(term("for"), term(";"));
    Parser p2 = Parsers.tuple(ident().sepBy1(term(".")), term("="), ident().sepBy1(term("."))).sepBy(term(",")).between(term("where"), term(";"));
    Parser p3 = Parsers.tuple(ident(), term("="), ident().sepBy1(term("."))).sepBy(term(",")).between(term("attributes"), term(";"));
    Parser q = Parsers.tuple(ident(), term("="), ident().sepBy1(term("."))).sepBy(term(",")).between(term("{"), term("}"));
    Parser a = Parsers.tuple(ident(), term("="), q, term(":"), ident());
    Parser p4 = a.sepBy(term(",")).between(term("edges"), term(";"));
    Parser p = Parsers.tuple(p1, p2, p3, p4);
    return p.between(term("{"), term("}"));
}
Also used : Parser(org.jparsec.Parser)

Example 29 with Parser

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

the class XParser method transform.

private static Parser<?> transform(Reference ref) {
    Parser p = Parsers.tuple(ident(), term(":"), ident());
    Parser<?> node = Parsers.tuple(p.or(ident()), term("->"), path());
    Parser<?> xxx = section("variables", node);
    Parser<?> constant = Parsers.tuple(Parsers.between(term("homomorphism").followedBy(term("{")), xxx, term("}")), term(":"), ref.lazy(), term("->"), ref.lazy());
    return constant;
}
Also used : Parser(org.jparsec.Parser)

Example 30 with Parser

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

the class XParser method FLOWER.

private static Parser<?> FLOWER(Reference self) {
    Parser<?> from0 = Parsers.tuple(ident(), term("as"), ident()).sepBy(term(","));
    Parser<?> from = Parsers.tuple(term("from"), from0, term(";"));
    Parser<?> where = Parsers.tuple(term("where"), where(), term(";"));
    Parser<?> select0 = Parsers.tuple(path(), 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("}")), self.lazy());
    return ret;
}
Also used : 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