<commit_before>define([
        '../Core/DeveloperError',
    ], function(
        DeveloperError) {
    'use strict';

    /**
     * A function to port GLSL shaders from GLSL ES 1.00 to GLSL ES 2.00
     *
     * This function is nowhere near comprehensive or complete. It just
     * handles some common cases.
     *
     * @private
     */
    function glslModernizeShaderSource(shaderSource, isFragmentShader) {
        for (var i = 0; i < shaderSource.sources.length; i++) {
            shaderSource.sources[i] = glslModernizeShaderText(shaderSource.sources[i], isFragmentShader, i === 0);
        }
    }

    // Note that this function requires the presence of the
    // "#define OUTPUT_DECLARATION" line that is appended
    // by ShaderSource
    function glslModernizeShaderText(source, isFragmentShader, first) {
        var mainFunctionRegex = /void\s+main\s*\((void)?\)/;
        var outputDeclarationRegex = /#define OUTPUT_DECLARATION/;
        var splitSource = source.split('\n');

        if (source.search(/#version 300 es/g) !== -1) {
            return source;
        }
        
        var outputDeclarationLine = -1;
        var number;
        for (number = 0; number < splitSource.length; ++number) {
            var line = splitSource[number];
            if (outputDeclarationRegex.exec(line)) {
                outputDeclarationLine = number;
                break;
            }
        };
        
        if (outputDeclarationLine == -1) {
            for (number = 0; number < splitSource.length; ++number) {
                var line = splitSource[number];
                if (mainFunctionRegex.exec(line)) {
                    outputDeclarationLine = number;
                }
            };
        }

        if (outputDeclarationLine == -1) {
            throw new DeveloperError('Could not find a #define OUTPUT_DECLARATION nor a main function!');
        }
        
        function safeNameFalseNegative(regex, region) {
            var regExpStr = regex.toString();
            regExpStr = regExpStr.match(/\/([^\/]+)(\/.)?/)[1];
            var somethingBadInString =
                new RegExp("[a-zA-Z0-9_]+" + regExpStr, 'g');
            var searchResult = region.search(somethingBadInString);
            if (searchResult === -1) {
                return true;
            } else {
                return false;
            }
        }

        function safeNameFind(regex, str) {
            var originalMatch = regex.exec(str);
            if (originalMatch == null) {
                return -1;
            }
            var endPos = originalMatch.index + originalMatch[0].length;
            var region = str.substring(0, endPos);

            var possiblyFalseNegative = safeNameFalseNegative(regex, region);
            if (possiblyFalseNegative) {
                return endPos;
            } else {
                var childResult = safeNameFind(regex, str.substring(endPos));
                if (childResult == -1) {
                    return -1;
                } else {
                    return endPos + childResult;
                }
            }
        }

        function safeNameReplace(regex, str, replacement) {
            var originalMatch = regex.exec(str);
            if (originalMatch == null) {
                return str;
            }
            var endPos = originalMatch.index + originalMatch[0].length;
            var region = str.substring(0, endPos);

            var possiblyFalseNegative = safeNameFalseNegative(regex, region);
            if (possiblyFalseNegative) {
                return region.replace(regex, replacement) + safeNameReplace(regex, str.substr(endPos), replacement);
            } else {
                return region + safeNameReplace(regex, str.substr(endPos), replacement);
            }
        }

        function replaceInSource(regex, replacement) {
            for (var number = 0; number < splitSource.length; ++number) {
                splitSource[number] = safeNameReplace(regex, splitSource[number], replacement);
            }
        }
        
        function findInSource(regex) {
            for (var number = 0; number < splitSource.length; ++number) {
                var line = splitSource[number];
                if (safeNameFind(regex, line) !== -1) {<commit_msg>Changes the last few == operators to === operators<commit_after>define([
        '../Core/DeveloperError',
    ], function(
        DeveloperError) {
    'use strict';

    /**
     * A function to port GLSL shaders from GLSL ES 1.00 to GLSL ES 2.00
     *
     * This function is nowhere near comprehensive or complete. It just
     * handles some common cases.
     *
     * @private
     */
    function glslModernizeShaderSource(shaderSource, isFragmentShader) {
        for (var i = 0; i < shaderSource.sources.length; i++) {
            shaderSource.sources[i] = glslModernizeShaderText(shaderSource.sources[i], isFragmentShader, i === 0);
        }
    }

    // Note that this function requires the presence of the
    // "#define OUTPUT_DECLARATION" line that is appended
    // by ShaderSource
    function glslModernizeShaderText(source, isFragmentShader, first) {
        var mainFunctionRegex = /void\s+main\s*\((void)?\)/;
        var outputDeclarationRegex = /#define OUTPUT_DECLARATION/;
        var splitSource = source.split('\n');

        if (source.search(/#version 300 es/g) !== -1) {
            return source;
        }
        
        var outputDeclarationLine = -1;
        var number;
        for (number = 0; number < splitSource.length; ++number) {
            var line = splitSource[number];
            if (outputDeclarationRegex.exec(line)) {
                outputDeclarationLine = number;
                break;
            }
        };
        
        if (outputDeclarationLine === -1) {
            for (number = 0; number < splitSource.length; ++number) {
                var line = splitSource[number];
                if (mainFunctionRegex.exec(line)) {
                    outputDeclarationLine = number;
                }
            };
        }

        if (outputDeclarationLine === -1) {
            throw new DeveloperError('Could not find a #define OUTPUT_DECLARATION nor a main function!');
        }
        
        function safeNameFalseNegative(regex, region) {
            var regExpStr = regex.toString();
            regExpStr = regExpStr.match(/\/([^\/]+)(\/.)?/)[1];
            var somethingBadInString =
                new RegExp("[a-zA-Z0-9_]+" + regExpStr, 'g');
            var searchResult = region.search(somethingBadInString);
            if (searchResult === -1) {
                return true;
            } else {
                return false;
            }
        }

        function safeNameFind(regex, str) {
            var originalMatch = regex.exec(str);
            if (originalMatch === null) {
                return -1;
            }
            var endPos = originalMatch.index + originalMatch[0].length;
            var region = str.substring(0, endPos);

            var possiblyFalseNegative = safeNameFalseNegative(regex, region);
            if (possiblyFalseNegative) {
                return endPos;
            } else {
                var childResult = safeNameFind(regex, str.substring(endPos));
                if (childResult === -1) {
                    return -1;
                } else {
                    return endPos + childResult;
                }
            }
        }

        function safeNameReplace(regex, str, replacement) {
            var originalMatch = regex.exec(str);
            if (originalMatch === null) {
                return str;
            }
            var endPos = originalMatch.index + originalMatch[0].length;
            var region = str.substring(0, endPos);

            var possiblyFalseNegative = safeNameFalseNegative(regex, region);
            if (possiblyFalseNegative) {
                return region.replace(regex, replacement) + safeNameReplace(regex, str.substr(endPos), replacement);
            } else {
                return region + safeNameReplace(regex, str.substr(endPos), replacement);
            }
        }

        function replaceInSource(regex, replacement) {
            for (var number = 0; number < splitSource.length; ++number) {
                splitSource[number] = safeNameReplace(regex, splitSource[number], replacement);
            }
        }
        
        function findInSource(regex) {
            for (var number = 0; number < splitSource.length; ++number) {
                var line = splitSource[number];
                if (safeNameFind(regex, line) !== -1) {
{'fraction_non_alphanumeric': 0.1053484602917342, 'fraction_numerical': 0.00717758740449178, 'mean_word_length': 1.6988441112152453, 'pattern_counts': {'":': 0, '<': 13, '<?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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '225420', 'n_tokens_mistral': 2299, 'n_tokens_neox': 2180, 'n_words': 550}