private static void collectExecutableSnippets(PsiElement container, Collection<? super PsiElement> result) {
    for (PsiElement child = container.getFirstChild(); child != null; child = child.getNextSibling()) {
      if (child instanceof PsiJShellRootClass) {
        collectExecutableSnippets(child, result);
      }
      else {
        if (isExecutable(child)) {
          result.add(child);
        }
      }
    }
  }
private static void collectExecutableSnippets(PsiElement container, Collection<? super PsiElement> result)