<commit_before># This is a temporary script to compile a new CodeDB cache from an existing
# bootstrap cache. It's pretty messy. Hopefully, it will be short-lived.

require "rubinius/code/toolset"

Rubinius::ToolSets.create :build do
  require "rubinius/code/melbourne"
  require "rubinius/code/processor"
  require "rubinius/code/compiler"
  require "rubinius/code/ast"
end

require File.expand_path("../config/config.rb", __dir__)

class CodeDBCompiler
  def self.compile(file, line=1, transforms=[:default, :kernel])
    compiler = Rubinius::ToolSets::Build::Compiler.new :file, :compiled_code

    parser = compiler.parser
    parser.root Rubinius::ToolSets::Build::AST::Script

    if transforms.kind_of? Array
      transforms.each { |t| parser.enable_category t }
    else
      parser.enable_category transforms
    end

    parser.input file, line

    generator = compiler.generator
    generator.processor Rubinius::ToolSets::Build::Generator
<commit_msg>Revert "Disable experimental compiler plugins."<commit_after># This is a temporary script to compile a new CodeDB cache from an existing
# bootstrap cache. It's pretty messy. Hopefully, it will be short-lived.

require "rubinius/code/toolset"

Rubinius::ToolSets.create :build do
  require "rubinius/code/melbourne"
  require "rubinius/code/processor"
  require "rubinius/code/compiler"
  require "rubinius/code/ast"
end

require File.expand_path("../config/config.rb", __dir__)

class CodeDBCompiler
  def self.compile(file, line=1, transforms=[:default, :kernel, :experimental])
    compiler = Rubinius::ToolSets::Build::Compiler.new :file, :compiled_code

    parser = compiler.parser
    parser.root Rubinius::ToolSets::Build::AST::Script

    if transforms.kind_of? Array
      transforms.each { |t| parser.enable_category t }
    else
      parser.enable_category transforms
    end

    parser.input file, line

    generator = compiler.generator
    generator.processor Rubinius::ToolSets::Build::Generator

{'fraction_non_alphanumeric': 0.10348308934881373, 'fraction_numerical': 0.0010095911155981827, 'mean_word_length': 4.4301369863013695, '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': '2474642', 'n_tokens_mistral': 611, 'n_tokens_neox': 581, 'n_words': 155}