//檢查語法加亮規(guī)則定義,并做相應調(diào)整,返回是否成功 //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, " "); } } } //-------------------------------------------------------------- |
出處:藍色理想
責任編輯:藍色
上一頁 fictiony 介紹過程及開發(fā)計劃 下一頁
|