<commit_before>#include "generator.h"
#include "opcodes.h"
#include "sections.h"

#include "parser/parser.h"

#include <algorithm>

namespace Verve {

  std::stringstream &Generator::generate() {
    m_ast->generateBytecode(this);

    auto text = m_output.str();
    m_output = std::stringstream();

    if (m_functions.size()) {
      for (unsigned i = 0; i < m_functions.size(); i++) {
        write(Section::FunctionHeader);
        generateFunctionSource(m_functions[i]);
      }
    }

    auto functions = m_output.str();
    m_output = std::stringstream();

    if (m_strings.size()) {
      write(Section::Header);
      write(Section::Strings);

      for (auto string : m_strings) {
        write(string);
      }
    }

    unsigned index = m_output.tellp();
    while (index++ % WORD_SIZE) {
      m_output.put(1);
    }

    if (functions.length()) {
      write(Section::Header);
      write(Section::Functions);
      m_output << functions;
    }

    write(Section::Header);
    write(Section::Text);
    write(lookupID);
    m_output << text;

    emitOpcode(Opcode::exit);
    m_output.seekg(0);

    return m_output;<commit_msg>Fix compiler errors with clang-3.4<commit_after>#include "generator.h"
#include "opcodes.h"
#include "sections.h"

#include "parser/parser.h"

#include <algorithm>

namespace Verve {

  std::stringstream &Generator::generate() {
    m_ast->generateBytecode(this);

    auto text = m_output.str();
    m_output.str(std::string());
    m_output.clear();

    if (m_functions.size()) {
      for (unsigned i = 0; i < m_functions.size(); i++) {
        write(Section::FunctionHeader);
        generateFunctionSource(m_functions[i]);
      }
    }

    auto functions = m_output.str();
    m_output.str(std::string());
    m_output.clear();

    if (m_strings.size()) {
      write(Section::Header);
      write(Section::Strings);

      for (auto string : m_strings) {
        write(string);
      }
    }

    unsigned index = m_output.tellp();
    while (index++ % WORD_SIZE) {
      m_output.put(1);
    }

    if (functions.length()) {
      write(Section::Header);
      write(Section::Functions);
      m_output << functions;
    }

    write(Section::Header);
    write(Section::Text);
    write(lookupID);
    m_output << text;

    emitOpcode(Opcode::exit);
    m_output.seekg(0);

    return m_output;
{'fraction_non_alphanumeric': 0.1554140127388535, 'fraction_numerical': 0.003397027600849257, 'mean_word_length': 2.946398659966499, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 7, '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': '75488', 'n_tokens_mistral': 784, 'n_tokens_neox': 760, 'n_words': 137}