<commit_before>var ometajs = require('../../lib/ometajs'),
    fs = require('fs');

ometajs.root = __dirname + '/../../lib/ometajs';

exports.ometajs = ometajs;

exports.loadFile = function loadFile(name) {
  return fs.readFileSync(
    __dirname + '/../files/' + name + '.ometajs'
  ).toString()
};

exports.translate = function translate(name, options) {
  var code = exports.loadFile(name);
  return ometajs.translateCode(code, options);
};

exports.compile = function compile(code, options) {
  var ast = ometajs.parser.create(code).execute();
  return ometajs.compiler.create(ast, options).execute();
};

exports.require = function compile(name) {
  return require(__dirname + '/../files/' + name);
};

exports.lexems = function(code) {
  var lexer = ometajs.lexer.create(code),
      lexems = [],
      lexem;

  while (lexem = lexer.token()) lexems.push(lexem);

  return lexems;
};

exports.parse = function(code) {
  var parser = ometajs.parser.create(code);

  return parser.execute();<commit_msg>[test] uglify compiler results for syntax check<commit_after>var ometajs = require('../../lib/ometajs'),
    fs = require('fs'),
    assert = require('assert'),
    uglify = require('uglify-js');

ometajs.root = __dirname + '/../../lib/ometajs';

exports.ometajs = ometajs;

exports.loadFile = function loadFile(name) {
  return fs.readFileSync(
    __dirname + '/../files/' + name + '.ometajs'
  ).toString()
};

exports.translate = function translate(name, options) {
  var code = exports.loadFile(name);
  return ometajs.translateCode(code, options);
};

exports.compile = function compile(code, options) {
  var ast = ometajs.parser.create(code).execute(),
      code = ometajs.compiler.create(ast, options).execute();

  // Just to check that it has correct syntax
  assert.doesNotThrow(function() {
    uglify(code);
  });

  return code;
};

exports.require = function compile(name) {
  return require(__dirname + '/../files/' + name);
};

exports.lexems = function(code) {
  var lexer = ometajs.lexer.create(code),
      lexems = [],
      lexem;

  while (lexem = lexer.token()) lexems.push(lexem);

  return lexems;
};

exports.parse = function(code) {
  var parser = ometajs.parser.create(code);

  return parser.execute();
{'fraction_non_alphanumeric': 0.16688978134761268, 'fraction_numerical': 0.0, 'mean_word_length': 3.760084925690021, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4591083', 'n_tokens_mistral': 764, 'n_tokens_neox': 742, 'n_words': 155}