

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 = ''
    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'
    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'
    if (self.platform == 'windows'):
        specCmd = (specCmd + ' -b=h')
    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()
        for e in errlines:
            e = e.decode('utf-8')
            if re.search('permission denied', str(e), flags=re.IGNORECASE):
                sublime.error_message('GLShaderValidator: permission denied to use essl_to_glsl command')
                return []
            if (not re.search('^####', e)):
                errorDetails = self.errorPattern.match(e)
                if (errorDetails is not None):
                    errorLine = (int(errorDetails.group(1)) - 1)
                    errorToken = errorDetails.group(2)
                    errorDescription = errorDetails.group(3)
                    errorLocation = fileLines[errorLine]
                    if (len(errorToken) > 0):
                        betterLocation = view.find(errorToken, errorLocation.begin(), sublime.LITERAL)
                        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