Search in sources :

Example 1 with AndExpr

use of org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.AndExpr in project scout.rt by eclipse.

the class SqlParser method parseAndExpr.

private AndExpr parseAndExpr(List<IToken> list, ParseContext ctx) {
    // MathExpr (BinaryOp['AND'] MathExpr)*
    ParseStep lock = ctx.checkAndAdd("AndExpr", list);
    if (lock == null) {
        return null;
    }
    try {
        IToken me = parseMathExpr(list, ctx);
        if (me == null) {
            return null;
        }
        AndExpr ae = new AndExpr();
        ae.addChild(me);
        AndOp ao;
        while ((ao = removeToken(list, AndOp.class)) != null && (me = parseMathExpr(list, ctx)) != null) {
            ae.addChild(ao);
            ae.addChild(me);
        }
        // remaining?
        if (ao != null) {
            ao.addComment(new Comment("/*syntax warning*/"));
            ae.addChild(ao);
        }
        return ae;
    } finally {
        ctx.remove(lock);
    }
}
Also used : AndExpr(org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.AndExpr) Comment(org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.Comment) IToken(org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.IToken) AndOp(org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.AndOp)

Example 2 with AndExpr

use of org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.AndExpr in project scout.rt by eclipse.

the class SqlParser method parseOrExpr.

private OrExpr parseOrExpr(List<IToken> list, ParseContext ctx) {
    // AndExpr (BinaryOp['OR'] AndExpr)*
    ParseStep lock = ctx.checkAndAdd("OrExpr", list);
    if (lock == null) {
        return null;
    }
    try {
        AndExpr ae = parseAndExpr(list, ctx);
        if (ae == null) {
            return null;
        }
        OrExpr oe = new OrExpr();
        oe.addChild(ae);
        OrOp oo;
        while ((oo = removeToken(list, OrOp.class)) != null && (ae = parseAndExpr(list, ctx)) != null) {
            oe.addChild(oo);
            oe.addChild(ae);
        }
        // remaining?
        if (oo != null) {
            oo.addComment(new Comment("/*syntax warning*/"));
            oe.addChild(oo);
        }
        return oe;
    } finally {
        ctx.remove(lock);
    }
}
Also used : AndExpr(org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.AndExpr) OrOp(org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.OrOp) Comment(org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.Comment) OrExpr(org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.OrExpr)

Aggregations

AndExpr (org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.AndExpr)2 Comment (org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.Comment)2 AndOp (org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.AndOp)1 IToken (org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.IToken)1 OrExpr (org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.OrExpr)1 OrOp (org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.OrOp)1