use of org.develnext.jphp.core.tokenizer.token.stmt.TryStmtToken in project jphp by jphp-compiler.
the class TryCatchGenerator method getToken.
@Override
public TryStmtToken getToken(Token current, ListIterator<Token> iterator) {
if (current instanceof TryStmtToken) {
TryStmtToken result = (TryStmtToken) current;
analyzer.addScope(false);
BodyStmtToken body = analyzer.generator(BodyGenerator.class).getToken(nextToken(iterator), iterator);
result.setBody(body);
Token next = nextToken(iterator);
result.setCatches(new ArrayList<CatchStmtToken>());
if (next instanceof CatchStmtToken) {
processCatches(result, next, iterator);
} else if (next instanceof FinallyStmtToken) {
analyzer.getScope().setLevelForGoto(true);
processFinally(result, next, iterator);
analyzer.getScope().setLevelForGoto(false);
} else
unexpectedToken(next, TokenType.T_CATCH);
result.setLocal(analyzer.removeScope().getVariables());
return result;
}
return null;
}
Aggregations