Search in sources :

Example 1 with UnaryPrefix

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

the class SqlParser method parseUnaryPrefixExpr.

private UnaryPrefixExpr parseUnaryPrefixExpr(List<IToken> list, ParseContext ctx) {
    // UnaryPrefix Atom
    ParseStep lock = ctx.checkAndAdd("UnaryPrefixExpr", list);
    if (lock == null) {
        return null;
    }
    try {
        UnaryPrefix up = null;
        IToken a = null;
        if ((up = removeToken(list, UnaryPrefix.class)) != null && (a = parseAtom(list, ctx)) != null) {
        // ok
        } else {
            // restore incomplete
            if (up != null) {
                list.add(0, up);
            }
            return null;
        }
        UnaryPrefixExpr e = new UnaryPrefixExpr();
        e.addChild(up);
        e.addChild(a);
        return e;
    } finally {
        ctx.remove(lock);
    }
}
Also used : IToken(org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.IToken) UnaryPrefix(org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.UnaryPrefix) UnaryPrefixExpr(org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.UnaryPrefixExpr)

Example 2 with UnaryPrefix

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

the class SqlFormatter method formatUnaryPrefixExpr.

private void formatUnaryPrefixExpr(UnaryPrefixExpr stm, FormatContext ctx) {
    for (IToken t : stm.getChildren()) {
        if (t instanceof UnaryPrefix) {
            formatDefault(t, ctx);
            ctx.print(" ");
        } else if (t instanceof Atom) {
            formatAtom((Atom) t, ctx);
        } else {
            formatDefault(t, ctx);
        }
    }
}
Also used : IToken(org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.IToken) UnaryPrefix(org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.UnaryPrefix) Atom(org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.Atom)

Aggregations

IToken (org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.IToken)2 UnaryPrefix (org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.UnaryPrefix)2 Atom (org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.Atom)1 UnaryPrefixExpr (org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.UnaryPrefixExpr)1