use of org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.PartToken in project scout.rt by eclipse.
the class SqlFormatter method formatPart.
private void formatPart(Part stm, FormatContext ctx) {
boolean hasList = false;
for (IToken t : stm.getChildren()) {
if (t instanceof PartToken) {
formatDefault(t, ctx);
} else if (t instanceof Part) {
ctx.in();
formatPart((Part) t, ctx);
ctx.out();
} else if (t instanceof ListExpr) {
hasList = true;
ctx.in();
formatListExpr((ListExpr) t, true, ctx);
ctx.out();
} else {
formatDefault(t, ctx);
}
}
if (!hasList) {
ctx.in();
ctx.print(" ");
ctx.out();
}
}
use of org.eclipse.scout.rt.server.jdbc.parsers.sql.SqlParserToken.PartToken in project scout.rt by eclipse.
the class SqlParser method parsePart.
private Part parsePart(List<IToken> list, ParseContext ctx, boolean rootPart) {
// PartToken ListExpr
ParseStep lock = ctx.checkAndAdd("Part", list);
if (lock == null) {
return null;
}
try {
PartToken pt;
ListExpr le;
if ((pt = removeToken(list, PartToken.class)) != null && (!rootPart || isRootPartToken(pt))) {
// ok
le = parseListExpr(list, ctx);
} else {
// restore incomplete
if (pt != null) {
list.add(0, pt);
}
return null;
}
Part p = new Part();
p.addChild(pt);
if (le != null) {
p.addChild(le);
}
return p;
} finally {
ctx.remove(lock);
}
}
Aggregations