<commit_before>'use strict';

var EventEmitter = require('eventemitter3');
var Scheduler = require('../runtime/scheduler').Scheduler;
var Graph = require('../graph');
var Program = require('../program');

var parser = require('../parser');
var SemanticPass = require('./semantic');
var GraphBuilder = require('./graph-builder').GraphBuilder;
var GraphCompiler = require('./graph-compiler');
var Build = require('./build');

var _ = require('underscore');
var JuttleMoment = require('../runtime/types/juttle-moment');
var juttle = require('../runtime').runtime;

var Juttle = require('../runtime').Juttle;

var stages = {
    semantic: function(ast, options) {
        var s = new SemanticPass(options);
        return s.analyze(JSON.parse(JSON.stringify(ast)));
    },

    build: function(ast) {
        var builder = new Build();
        return builder.gen(ast);
    },

    flowgraph: function(code, options) {
        var fn = eval(code);
        var gb = new GraphBuilder(options);
        fn(gb, juttle);
        var graph = gb.graph();
        var program = new Graph();
        program.built_graph = graph;
        _.each(options.fg_processors, function(processor) {
            processor(program, Juttle);
        });
        return program;
    },

    compile: function(graph, options) {<commit_msg>Do not pass the Juttle object to flowgraph processors<commit_after>'use strict';

var EventEmitter = require('eventemitter3');
var Scheduler = require('../runtime/scheduler').Scheduler;
var Graph = require('../graph');
var Program = require('../program');

var parser = require('../parser');
var SemanticPass = require('./semantic');
var GraphBuilder = require('./graph-builder').GraphBuilder;
var GraphCompiler = require('./graph-compiler');
var Build = require('./build');

var _ = require('underscore');
var JuttleMoment = require('../runtime/types/juttle-moment');
var juttle = require('../runtime').runtime;

var stages = {
    semantic: function(ast, options) {
        var s = new SemanticPass(options);
        return s.analyze(JSON.parse(JSON.stringify(ast)));
    },

    build: function(ast) {
        var builder = new Build();
        return builder.gen(ast);
    },

    flowgraph: function(code, options) {
        var fn = eval(code);
        var gb = new GraphBuilder(options);
        fn(gb, juttle);
        var graph = gb.graph();
        var program = new Graph();
        program.built_graph = graph;
        _.each(options.fg_processors, function(processor) {
            processor(program);
        });
        return program;
    },

    compile: function(graph, options) {
{'fraction_non_alphanumeric': 0.1575920245398773, 'fraction_numerical': 0.0007668711656441718, 'mean_word_length': 3.095761381475667, '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': '7209650', 'n_tokens_mistral': 745, 'n_tokens_neox': 723, 'n_words': 182}