Common lisp 在Atom中使用特殊条件运行脚本
我曾经在Sublime文本中使用构建系统,在那里我可以添加自己的定制构建系统。例如,对于CLisp,我创建了一个构建系统:Common lisp 在Atom中使用特殊条件运行脚本,common-lisp,atom-editor,Common Lisp,Atom Editor,我曾经在Sublime文本中使用构建系统,在那里我可以添加自己的定制构建系统。例如,对于CLisp,我创建了一个构建系统: { "cmd": ["clisp", "-q", "-modern", "-L", "french", "$file"], "selector": "source.lisp" } 同样,我也为C定制了一个: { "cmd" : ["gcc $file_name -Wall -o ${file_base_name} && ./${fil
{
"cmd": ["clisp", "-q", "-modern", "-L", "french", "$file"],
"selector": "source.lisp"
}
同样,我也为C定制了一个:
{
"cmd" : ["gcc $file_name -Wall -o ${file_base_name} && ./${file_base_name}"],
"selector" : "source.c",
"shell": true,
"working_dir" : "$file_path"
}
如何在Atom中执行此操作?对于任务Atom有一个名为Atom Build package的漂亮包,您可以在此处找到它: 它正在使用javascript,以下是一个示例:
module.exports = {
cmd: 'make',
name: 'Makefile',
sh: true,
functionMatch: function (output) {
const enterDir = /^make\[\d+\]: Entering directory '([^']+)'$/;
const error = /^([^:]+):(\d+):(\d+): error: (.+)$/;
// this is the list of error matches that atom-build will process
const array = [];
// stores the current directory
var dir = null;
// iterate over the output by lines
output.split(/\r?\n/).forEach(line => {
// update the current directory on lines with `Entering directory`
const dir_match = enterDir.exec(line);
if (dir_match) {
dir = dir_match[1];
} else {
// process possible error messages
const error_match = error.exec(line);
if (error_match) {
// map the regex match to the error object that atom-build expects
array.push({
file: dir ? dir + '/' + error_match[1] : error_match[1],
line: error_match[2],
col: error_match[3],
message: error_match[4]
});
}
}
});
return array;
}
};
完成后,请告诉我们您的经验:)