use of org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.Atom in project scout.rt by eclipse.
the class SqlParser method parseAtom.
private Atom parseAtom(List<IToken> list, ParseContext ctx) {
// (BracketExpr Outer | Statement | OrExpr | FunExpr | Name | Text | BinaryOp['*']) (OuterJoinToken)? (Name["AS"])? (Name[alias])?
ParseStep lock = ctx.checkAndAdd("Atom", list);
if (lock == null) {
return null;
}
try {
IToken t = null;
if ((t = parseBracketExpr(list, ctx)) != null) {
// ok
} else if ((t = parseStatement(list, ctx)) != null) {
// ok
} else if ((t = parseOrExpr(list, ctx)) != null) {
// ok
} else if ((t = parseFunExpr(list, ctx)) != null) {
// ok
} else if ((t = removeToken(list, Name.class)) != null) {
// ok
} else if ((t = removeToken(list, Text.class)) != null) {
// ok
} else if ((t = removeToken(list, MathOp.class, "*")) != null) {
// ok
} else {
return null;
}
// found a match
Atom a = new Atom();
a.addChild(t);
if ((t = removeToken(list, OuterJoinToken.class)) != null) {
a.addChild(t);
}
if ((t = removeToken(list, Name.class)) != null) {
a.addChild(t);
}
return a;
} finally {
ctx.remove(lock);
}
}
use of org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.Atom 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);
}
}
}
Aggregations