int (PsiElement elementInHost, PsiFile regexp) { final PsiExpressionList list = PsiTreeUtil.getParentOfType(elementInHost, PsiExpressionList.class); if (list != null) { PsiExpression[] expressions = list.getExpressions(); if (expressions.length == 2 && PsiTypes.intType().equals(expressions[1].getType())) { final Object result = JavaConstantExpressionEvaluator.computeConstantExpression(expressions[1], false); if (result instanceof Integer) { //noinspection MagicConstant return ((Integer)result).intValue(); } } } return 0; }