Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}, function(err, result) {
try {
rimraf.rimrafSync(dir);
} catch (e) {}
var errCount = 0;
// Put the correct filenames in any error messages
if (result.errors) {
result.errors.forEach(function(error) {
var match = error.file.match(/(\d+)\.inc/);
if (match) {
var index = +match[1];
index = info.postFileIndexes[index];
error.file = info.prePreTree.allFiles[index].realFile;
}
try {
var dir = temp.mkdirSync('prawn');
// Remove #file and #endinput directives
info.ppScript = info.ppScript.replace(/^#(file|endinput).*?$/gm, '');
// Build a tree from the flat lst-file
info.fileTree = _buildFileTree(info.ppScript, 0, info.ppScript.indexOf('START_OF_@0();') + 14);
// Save that tree in a folder. postFileIndexes will help keeping track
// of the original filenames
info.postFileIndexes = _saveFileTree(info.fileTree, dir, info);
} catch (e) {
if (dir) {
try {
rimraf.rimrafSync(dir);
} catch (e) {}
}
return fn(e);
}
pawnc.invokeCompiler('0.inc', {
includeDirectory: info.includePath,
workingDirectory: dir,
debugLevel: 2,
requireSemicolons: true,
requireParentheses: true,
PRAWN: true
}, function(err, result) {
try {
}, function(err, result) {
try {
rimraf.rimrafSync(dir);
} catch (e) {}
var errCount = 0;
// Put the correct filenames in any error messages
if (result && result.errors) {
result.errors.forEach(function(error) {
var match = error.file.match(/\b(\d+)[\/\\][^\/\\]+\.inc$/);
if (match) {
var index = +match[1];
error.file = info.prePreTree.allFiles[index].realFile;
}
if (error.type !== 'warning') {
function _cleanup() {
if (_info.prePreDir) {
try {
rimraf.rimrafSync(_info.prePreDir);
} catch (e) {}
}
if (_info.outputFile) {
try {
fs.unlinkSync(_info.outputFile);
} catch (e) {}
}
}
exports.process = function(info, fn) {
var dir;
try {
dir = temp.mkdirSync('prawn');
_process(info, dir);
} catch (e) {
if (dir) {
try {
rimraf.rimrafSync(dir);
} catch (e) {}
}
fn(e);
return;
}
info.prePreDir = dir;
pawnc.invokeCompiler(path.resolve(info.entryFile), {
includeDirectory: info.includePath,
workingDirectory: dir,
debugLevel: 2,
outputLst: true,
requireSemicolons: true,