<commit_before>package com.redhat.ceylon.eclipse.imp.foldingUpdater;

import java.util.HashMap;
import java.util.List;

import org.eclipse.imp.services.base.FolderBase;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.source.Annotation;

import com.redhat.ceylon.compiler.typechecker.tree.Tree;
import com.redhat.ceylon.compiler.typechecker.tree.Visitor;

/**
 * This file provides a skeletal implementation of the language-dependent aspects
 * of a source-text folder.  This implementation is generated from a template that
 * is parameterized with respect to the name of the language, the package containing
 * the language-specific types for AST nodes and AbstractVisitors, and the name of
 * the folder package and class.
 */
public class CeylonFoldingUpdater extends FolderBase {

	@Override
	public void sendVisitorToAST(HashMap<Annotation,Position> newAnnotations, 
	        List<Annotation> annotations, Object ast) {
		new Visitor() {
			@Override 
			public void visit(Tree.Body body) {
				makeAnnotation(body);
			}
		}.visit((Tree.CompilationUnit) ast);
	}
	
}<commit_msg>folding can be nested<commit_after>package com.redhat.ceylon.eclipse.imp.foldingUpdater;

import java.util.HashMap;
import java.util.List;

import org.eclipse.imp.services.base.FolderBase;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.source.Annotation;

import com.redhat.ceylon.compiler.typechecker.tree.Tree;
import com.redhat.ceylon.compiler.typechecker.tree.Visitor;

/**
 * This file provides a skeletal implementation of the language-dependent aspects
 * of a source-text folder.  This implementation is generated from a template that
 * is parameterized with respect to the name of the language, the package containing
 * the language-specific types for AST nodes and AbstractVisitors, and the name of
 * the folder package and class.
 */
public class CeylonFoldingUpdater extends FolderBase {

    @Override
	public void sendVisitorToAST(HashMap<Annotation,Position> newAnnotations, 
	        List<Annotation> annotations, Object ast) {
		new Visitor() {
			@Override 
			public void visit(Tree.Body body) {
                super.visit(body);
				makeAnnotation(body);
			}
            //TODO: we should also allow multiline comments 
			//      to be folded, but currently there is no
			//      treenode for them!
		}.visit((Tree.CompilationUnit) ast);
	}
	
    /*public void makeRangeAnnotation(Object n) {
        ISourcePositionLocator nodeLocator = parseController.getSourcePositionLocator();
        DefaultRangeIndicator annotation= new DefaultRangeIndicator();
        newAnnotations.put(annotation, 
                new Position(nodeLocator.getStartOffset(n), nodeLocator.getEndOffset(n)));
        annotations.add(annotation);
    }*/
}
{'fraction_non_alphanumeric': 0.08686288585786073, 'fraction_numerical': 0.0, 'mean_word_length': 4.039783001808318, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5533665', 'n_tokens_mistral': 814, 'n_tokens_neox': 771, 'n_words': 222}