StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
StackGenVis/frontend/node_modules/gl-format-compiler-error/index.js

53 lines
1.6 KiB

var sprintf = require('sprintf-js').sprintf;
var glConstants = require('gl-constants/lookup');
var shaderName = require('glsl-shader-name');
var addLineNumbers = require('add-line-numbers');
module.exports = formatCompilerError;
function formatCompilerError(errLog, src, type) {
"use strict";
var name = shaderName(src) || 'of unknown name (see npm glsl-shader-name)';
var typeName = 'unknown type';
if (type !== undefined) {
typeName = type === glConstants.FRAGMENT_SHADER ? 'fragment' : 'vertex'
}
var longForm = sprintf('Error compiling %s shader %s:\n', typeName, name);
var shortForm = sprintf("%s%s", longForm, errLog);
var errorStrings = errLog.split('\n');
var errors = {};
for (var i = 0; i < errorStrings.length; i++) {
var errorString = errorStrings[i];
if (errorString === '' || errorString === "\0") continue;
var lineNo = parseInt(errorString.split(':')[2]);
if (isNaN(lineNo)) {
throw new Error(sprintf('Could not parse error: %s', errorString));
}
errors[lineNo] = errorString;
}
var lines = addLineNumbers(src).split('\n');
for (var i = 0; i < lines.length; i++) {
if (!errors[i+3] && !errors[i+2] && !errors[i+1]) continue;
var line = lines[i];
longForm += line + '\n';
if (errors[i+1]) {
var e = errors[i+1];
e = e.substr(e.split(':', 3).join(':').length + 1).trim();
longForm += sprintf('^^^ %s\n\n', e);
}
}
return {
long: longForm.trim(),
short: shortForm.trim()
};
}