<commit_before>/**
 * main.js
 * <NAME> - 2015
 */

module.exports = function() {
  var jsparser = require('./JSParser/jsparser.js');

  var source = null;
  var ast = null;

  return {
    /**
     * Initializes the system.
     * source: The ScriptSharp/JavaScript source to parse.
     */
    initialize: function(src) {
      source = src;
    },

    /**
     * Retrieves the AST.
     */
    retrieveAst: function() {
      if (!source) {
        throw 'Error: Initialization required! SS-JS source needed.';
      }

      // Calling the parser and getting JSON AST
      var jsonAst = null;
      try {
        jsonAst = jsparser().parse(source);
      } catch(e) {
        throw 'Error: Parsing was not successful!';
      }

      try {
        ast = JSON.parse(jsonAst);
      } catch(e) {
        throw 'Error: JSON AST parsing was not successful!';<commit_msg>Update main.js<commit_after>/**
 * main.js
 * <NAME> - 2015
 */

module.exports = function() {
  var jsparser = require('./JSParser/jsparser.js');
  var fileManager = require('./FileManager/fileManager.js');

  var source = null;
  var ast = null;

  return {
    /**
     * Initializes the system.
     * filepath: The file path containing the Javascript source to parse.
     */
    initialize: function(filePath) {
      var fm = fileManager(filepath);
      fm.createShadowFile();
      source = '';
    },

    /**
     * Retrieves the AST.
     */
    retrieveAst: function() {
      if (!source) {
        throw 'Error: Initialization required! SS-JS source needed.';
      }

      // Calling the parser and getting JSON AST
      var jsonAst = null;
      try {
        jsonAst = jsparser().parse(source);
      } catch(e) {
        throw 'Error: Parsing was not successful!';
      }

      try {
        ast = JSON.parse(jsonAst);
      } catch(e) {
        throw 'Error: JSON AST parsing was not successful!';
{'fraction_non_alphanumeric': 0.12988384371700107, 'fraction_numerical': 0.004223864836325237, 'mean_word_length': 2.056451612903226, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6131452', 'n_tokens_mistral': 611, 'n_tokens_neox': 564, 'n_words': 160}