private static boolean isAfterForParameter(PsiElement position) {
    ElementPattern<PsiElement> forParameter = PsiJavaPatterns.psiElement().withParents(
      GrVariable.class, GrVariableDeclaration.class, GrTraditionalForClause.class, GrForStatement.class
    );
    return PsiJavaPatterns.psiElement().withParent(GrReferenceExpression.class).afterLeaf(forParameter).accepts(position) ||
           forParameter.accepts(position) && PsiJavaPatterns.psiElement().afterLeaf(PsiJavaPatterns.psiElement(GroovyTokenTypes.mIDENT)).accepts(position);
  }
private static boolean isAfterForParameter(PsiElement position)