def validate_contents(self, view):
        """ Validates the file contents using ANGLE """
        ANGLEPath = self.ANGLEPath[self.platform]
        errors = []
        fileLines = view.lines(
            sublime.Region(0, view.size())
        )

        specCmd = ''

        # NOTE: view.find is documented to return None if not found in ST2 and
        # ST3, but actually returns (-1, -1) in ST3

        # Go with WebGL spec
        inline_spec = view.find("spec: webgl", sublime.IGNORECASE)
        if view.settings().get('glsv_spec') == 0 or (inline_spec is not None and not inline_spec.empty()):
            specCmd = '-s=w'

        # Check if the user has changed which spec they
        # want to use. If they have, drop the switch
        inline_spec = view.find("spec: es2", sublime.IGNORECASE)
        if view.settings().get('glsv_spec') == 1 or (inline_spec is not None and not inline_spec.empty()):
            specCmd = ''

        inline_spec = view.find("spec: css", sublime.IGNORECASE)
        if view.settings().get('glsv_spec') == 2 or (inline_spec is not None and not inline_spec.empty()):
            specCmd = '-s=c'

        # We need an extra flag for windows
        if self.platform == "windows":
            specCmd = specCmd + " -b=h"

        # Create a shell process for essl_to_glsl and pick
        # up its output directly
        ANGLEProcess = subprocess.Popen(
            ANGLEPath + ' ' + specCmd + ' "' + view.file_name() + '"',
            cwd=sublime.packages_path() + os.sep + self.packagePath + os.sep,
            stdout=subprocess.PIPE,
            stderr=subprocess.STDOUT,
            shell=True)

        if ANGLEProcess.stdout is not None:
            errlines = ANGLEProcess.stdout.readlines()

            # Go through each error, ignoring any comments
            for e in errlines:

                e = e.decode("utf-8")

                # Check if there was a permission denied
                # error running the essl_to_glsl cmd

                if re.search("permission denied", str(e), flags=re.IGNORECASE):
                    sublime.error_message("GLShaderValidator: permission denied to use essl_to_glsl command")
                    return []

                # ignore ANGLE's comments
                if not re.search("^####", e):

                    # Break down the error using the regexp
                    errorDetails = self.errorPattern.match(e)

                    # For each match construct an error
                    # object to pass back
                    if errorDetails is not None:
                        errorLine = int(errorDetails.group(1)) - 1
                        errorToken = errorDetails.group(2)
                        errorDescription = errorDetails.group(3)
                        errorLocation = fileLines[errorLine]

                        # If there is a token try and locate it
                        if len(errorToken) > 0:
                            betterLocation = view.find(
                                errorToken,
                                errorLocation.begin(),
                                sublime.LITERAL)

                            # Ensure we have a match before we
                            # replace the error region
                            if betterLocation is not None and not betterLocation.empty():
                                errorLocation = betterLocation

                        errors.append(GLShaderError(
                            errorLocation,
                            errorDescription
                        ))

        return errors
dataset/ETHPy150Open WebGLTools/GL-Shader-Validator/GLShaderValidator.py/ANGLECommandLine.validate_contents/original