//检查语法加亮规则定义,并做相应调整,返回是否成功
//lang: 可为0个或多个,分别表示各个需要检查的语言,如果不写则表示检查所有
function FCCheckSyntaxDef(/*lang, ...*/) {
if (arguments.length > 0) {
var langList = {};
for (var i = arguments.length - 1; i >= 0; i--) {
if (FCSyntaxDef[arguments[i]] != null) langList[arguments[i]] = true;
}
} else {
var langList = FCSyntaxDef;
}
for (var lang in langList) {
var syntax = FCSyntaxDef[lang];
var delim = syntax.delimiters;
if (delim == null) {
syntax.delimiters = "~!@%^&*()-+=|\/{}[]:;\"'<>,.? \t";
} else if (delim.indexOf(" \t") < 0) {
syntax.delimiters += " \t";
}
if (syntax.comments != null) {
if (typeof(syntax.comments) == "string") syntax.comments = syntax.comments.split(" ");
if (syntax.cmtcolor == null) syntax.cmtcolor = "#00ff00";
if (syntax.cmtstyle == null) syntax.cmtstyle = "";
else syntax.cmtsytle = syntax.cmtstyle.toLowerCase();
}
var blocks = syntax.blocks;
for (var classid in blocks) {
var block = blocks[classid];
if (block.color == null) block.color = "#00ffff";
if (block.style == null) block.style = "";
else block.style = block.style.toLowerCase();
}
var keywords = syntax.keywords;
for (var classid in keywords) {
var group = keywords[classid];
if (group.color == null) group.color = "#0000ff";
if (group.style == null) group.style = "";
else group.style = group.style.toLowerCase();
group.list = (" " + (group.list instanceof Array ? group.list.join(" ")
: group.list) + " ").replace(/ +/g, " ");
}
}
}
//--------------------------------------------------------------
//lang: 可为0个或多个,分别表示各个需要检查的语言,如果不写则表示检查所有
function FCCheckSyntaxDef(/*lang, ...*/) {
if (arguments.length > 0) {
var langList = {};
for (var i = arguments.length - 1; i >= 0; i--) {
if (FCSyntaxDef[arguments[i]] != null) langList[arguments[i]] = true;
}
} else {
var langList = FCSyntaxDef;
}
for (var lang in langList) {
var syntax = FCSyntaxDef[lang];
var delim = syntax.delimiters;
if (delim == null) {
syntax.delimiters = "~!@%^&*()-+=|\/{}[]:;\"'<>,.? \t";
} else if (delim.indexOf(" \t") < 0) {
syntax.delimiters += " \t";
}
if (syntax.comments != null) {
if (typeof(syntax.comments) == "string") syntax.comments = syntax.comments.split(" ");
if (syntax.cmtcolor == null) syntax.cmtcolor = "#00ff00";
if (syntax.cmtstyle == null) syntax.cmtstyle = "";
else syntax.cmtsytle = syntax.cmtstyle.toLowerCase();
}
var blocks = syntax.blocks;
for (var classid in blocks) {
var block = blocks[classid];
if (block.color == null) block.color = "#00ffff";
if (block.style == null) block.style = "";
else block.style = block.style.toLowerCase();
}
var keywords = syntax.keywords;
for (var classid in keywords) {
var group = keywords[classid];
if (group.color == null) group.color = "#0000ff";
if (group.style == null) group.style = "";
else group.style = group.style.toLowerCase();
group.list = (" " + (group.list instanceof Array ? group.list.join(" ")
: group.list) + " ").replace(/ +/g, " ");
}
}
}
//--------------------------------------------------------------