use of org.beetl.core.statement.TryCatchStatement in project beetl2.0 by javamonkey.
the class AntlrProgramBuilder method parseTryCatch.
protected TryCatchStatement parseTryCatch(TryStContext tryStCtx) {
BlockContext tryBlockCtx = tryStCtx.block(0);
BlockStatement tryPart = (BlockStatement) this.parseBlock(tryBlockCtx.statement(), tryBlockCtx);
BlockStatement catchPart = null;
VarDefineNode errorNode = null;
if (tryStCtx.Catch() != null) {
this.pbCtx.enterBlock();
if (tryStCtx.Identifier() != null) {
Token errorToken = tryStCtx.Identifier().getSymbol();
errorNode = new VarDefineNode(this.getBTToken(errorToken));
this.pbCtx.addVarAndPostion(errorNode);
}
BlockContext catchBlockCtx = tryStCtx.block(1);
catchPart = (BlockStatement) this.parseBlock(catchBlockCtx.statement(), catchBlockCtx);
this.pbCtx.exitBlock();
}
TryCatchStatement statement = new TryCatchStatement(tryPart, catchPart, errorNode, this.getBTToken(tryStCtx.Try().getSymbol()));
return statement;
}
Aggregations