<commit_before>/**
* @author bhouston / http://clara.io
*/

THREE.WebGLShaderPreProcessor = {};

THREE.WebGLShaderPreProcessor.compile = function() {

  var regexInclude = /[ ]*#include[ ]+["<]([\w\d.]*)[">]/;

  return function( code, includeResolver ) {

    includeResolver = includeResolver || THREE.WebGLShaderPreProcessor.defaultIncludeResolver;

    var lines = code.split( '\n' );
    var newLines = [];
    while( lines.length > 0 ) {
      var line = lines.shift();

      var matcheInclude = regexInclude.exec(line);
      if( matcheInclude ) {
        var includeFileName = matcheInclude[1];
        var includeChunk = includeResolver( includeFileName );
        if( ! includeChunk ) throw new Error( "can not find include file for line: " + line );
        var includeLines = includeChunk.split( '\n' ).reverse();
        while( includeLines.length > 0 ) {
          lines.unshift( includeLines.shift() );
        }
      }
      else {
        newLines.push( line );
      }
    }
    return newLines.join( '\n' );
  };

}();

THREE.WebGLShaderPreProcessor.defaultIncludeResolver = function( fileName ) {

  return THREE.ShaderChunk[ fileName ];

};
<commit_msg>simplify preprocessor, no need for reserve if I use pop.<commit_after>/**
* @author bhouston / http://clara.io
*/

THREE.WebGLShaderPreProcessor = {};

THREE.WebGLShaderPreProcessor.compile = function() {

  var regexInclude = /[ ]*#include[ ]+["<]([\w\d.]*)[">]/;

  return function( code, includeResolver ) {

    includeResolver = includeResolver || THREE.WebGLShaderPreProcessor.defaultIncludeResolver;

    var lines = code.split( '\n' );
    var newLines = [];
    while( lines.length > 0 ) {
      var line = lines.shift();

      var matcheInclude = regexInclude.exec(line);
      if( matcheInclude ) {
        var includeFileName = matcheInclude[1];
        var includeChunk = includeResolver( includeFileName );
        if( ! includeChunk ) throw new Error( "can not find include file for line: " + line );
        var includeLines = includeChunk.split( '\n' );
        while( includeLines.length > 0 ) {
          lines.unshift( includeLines.pop() );
        }
      }
      else {
        newLines.push( line );
      }
    }
    return newLines.join( '\n' );
  };

}();

THREE.WebGLShaderPreProcessor.defaultIncludeResolver = function( fileName ) {

  return THREE.ShaderChunk[ fileName ];

};

{'fraction_non_alphanumeric': 0.1405791019723038, 'fraction_numerical': 0.002517834662190516, 'mean_word_length': 2.832797427652733, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '6263261', 'n_tokens_mistral': 720, 'n_tokens_neox': 702, 'n_words': 162}