Search in sources :

Example 1 with MathExpr

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

the class SqlParser method parseMathExpr.

private MathExpr parseMathExpr(List<IToken> list, ParseContext ctx) {
    // _simpleExpr (BinaryOp _simpleExpr)*
    ParseStep lock = ctx.checkAndAdd("MathExpr", list);
    if (lock == null) {
        return null;
    }
    try {
        IToken se = parseSimpleExpr(list, ctx);
        if (se == null) {
            return null;
        }
        MathExpr me = new MathExpr();
        me.addChild(se);
        MathOp mo;
        while ((mo = removeToken(list, MathOp.class)) != null && (se = parseSimpleExpr(list, ctx)) != null) {
            me.addChild(mo);
            me.addChild(se);
        }
        // restore incomplete
        if (mo != null) {
            list.add(0, mo);
        }
        return me;
    } finally {
        ctx.remove(lock);
    }
}
Also used : IToken(org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.IToken) MathOp(org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.MathOp) MathExpr(org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.MathExpr)

Aggregations

IToken (org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.IToken)1 MathExpr (org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.MathExpr)1 MathOp (org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.MathOp)1