// Path: src/main/java/codemining/languagetools/ParseType.java
// public enum ParseType {
// 	COMPILATION_UNIT, CLASS_BODY, METHOD, STATEMENTS, EXPRESSION
// }


import java.io.File;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Map;
import org.apache.commons.io.FileUtils;
import org.eclipse.wst.jsdt.core.JavaScriptCore;
import org.eclipse.wst.jsdt.core.dom.AST;
import org.eclipse.wst.jsdt.core.dom.ASTNode;
import org.eclipse.wst.jsdt.core.dom.ASTParser;
import org.eclipse.wst.jsdt.core.dom.ASTVisitor;
import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration;
import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit;
import codemining.languagetools.ParseType;
		parser.setCompilerOptions(options);
		parser.setSource(sourceFile.toCharArray()); // set source
		parser.setResolveBindings(useBindings);
		parser.setBindingsRecovery(useBindings);

		parser.setStatementsRecovery(true);

		parser.setUnitName(file.getAbsolutePath());

		// FIXME Need file's project loaded into Eclipse to get bindings
		// which is only possible automatically if this were an Eclipse plugin
		// cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=206391
		// final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
		// final IProject project = root.getProject(projectName);
		// parser.setProject(JavaScriptCore.create(project));

		final JavaScriptUnit compilationUnit = (JavaScriptUnit) parser
				.createAST(null);

		return compilationUnit;
	}

	/**
	 * Get a compilation unit of the given file content.
	 * 
	 * @param fileContent
	 * @param parseType
	 * @return the compilation unit
	 */
	public final ASTNode getAST(final String fileContent,
// Path: src/main/java/codemining/languagetools/ParseType.java
// public enum ParseType {
// 	COMPILATION_UNIT, CLASS_BODY, METHOD, STATEMENTS, EXPRESSION
// }


// Path: src/main/java/codemining/js/codeutils/JavascriptASTExtractor.java
import java.io.File;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Map;
import org.apache.commons.io.FileUtils;
import org.eclipse.wst.jsdt.core.JavaScriptCore;
import org.eclipse.wst.jsdt.core.dom.AST;
import org.eclipse.wst.jsdt.core.dom.ASTNode;
import org.eclipse.wst.jsdt.core.dom.ASTParser;
import org.eclipse.wst.jsdt.core.dom.ASTVisitor;
import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration;
import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit;
import codemining.languagetools.ParseType;

		parser.setCompilerOptions(options);
		parser.setSource(sourceFile.toCharArray()); // set source
		parser.setResolveBindings(useBindings);
		parser.setBindingsRecovery(useBindings);

		parser.setStatementsRecovery(true);

		parser.setUnitName(file.getAbsolutePath());

		// FIXME Need file's project loaded into Eclipse to get bindings
		// which is only possible automatically if this were an Eclipse plugin
		// cf. https://bugs.eclipse.org/bugs/show_bug.cgi?id=206391
		// final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
		// final IProject project = root.getProject(projectName);
		// parser.setProject(JavaScriptCore.create(project));

		final JavaScriptUnit compilationUnit = (JavaScriptUnit) parser
				.createAST(null);

		return compilationUnit;
	}

	/**
	 * Get a compilation unit of the given file content.
	 * 
	 * @param fileContent
	 * @param parseType
	 * @return the compilation unit
	 */
	public final ASTNode getAST(final String fileContent,
			final ParseType parseType) {