//>>built
define("dojox/highlight/_base",["dojo/_base/lang","dojo/_base/array","dojo/dom","dojo/dom-class"],function(n,g,v,w){function h(a){return a.replace(/&/gm,"\x26amp;").replace(/</gm,"\x26lt;").replace(/>/gm,"\x26gt;")}function x(a){return g.every(a.childNodes,function(b){return 3==b.nodeType||"br"==String(b.nodeName).toLowerCase()})}function p(a){var b=[];g.forEach(a.childNodes,function(c){if(3==c.nodeType)b.push(c.nodeValue);else if("br"==String(c.nodeName).toLowerCase())b.push("\n");else throw"Complex markup";
});return b.join("")}function q(a){if(!a.keywordGroups)for(var b in a.keywords){a.keywordGroups=a.keywords[b]instanceof Object?a.keywords:{keyword:a.keywords};break}}function r(a,b,c){if("code"==String(a.tagName).toLowerCase()&&"pre"==String(a.parentNode.tagName).toLowerCase()){var d=document.createElement("div"),e=a.parentNode.parentNode;d.innerHTML='\x3cpre\x3e\x3ccode class\x3d"'+b+'"\x3e'+c+"\x3c/code\x3e\x3c/pre\x3e";e.replaceChild(d.firstChild,a.parentNode)}else a.className=b,a.innerHTML=c}
function t(a,b){var c=new m(a,b);return{result:c.result,langName:a,partialResult:c.partialResult}}function u(a){var b="",c="",d;for(d in f.languages)if(f.languages[d].defaultMode){var e=new m(d,a),k=e.keywordCount+e.relevance,l=0;if(!b||k>l)l=k,b=e.result,c=e.langName}return{result:b,langName:c}}function y(a){var b=u(p(a));b.result&&r(a,b.langName,b.result)}var f=n.getObject("dojox.highlight",!0);f.languages=f.languages||{};f.constants={IDENT_RE:"[a-zA-Z][a-zA-Z0-9_]*",UNDERSCORE_IDENT_RE:"[a-zA-Z_][a-zA-Z0-9_]*",
NUMBER_RE:"\\b\\d+(\\.\\d+)?",C_NUMBER_RE:"\\b(0x[A-Za-z0-9]+|\\d+(\\.\\d+)?)",APOS_STRING_MODE:{className:"string",begin:"'",end:"'",illegal:"\\n",contains:["escape"],relevance:0},QUOTE_STRING_MODE:{className:"string",begin:'"',end:'"',illegal:"\\n",contains:["escape"],relevance:0},BACKSLASH_ESCAPE:{className:"escape",begin:"\\\\.",end:"^",relevance:0},C_LINE_COMMENT_MODE:{className:"comment",begin:"//",end:"$",relevance:0},C_BLOCK_COMMENT_MODE:{className:"comment",begin:"/\\*",end:"\\*/"},HASH_COMMENT_MODE:{className:"comment",
begin:"#",end:"$"},C_NUMBER_MODE:{className:"number",begin:"\\b(0x[A-Za-z0-9]+|\\d+(\\.\\d+)?)",end:"^",relevance:0}};var m=function(a,b){this.langName=a;this.lang=f.languages[a];this.modes=[this.lang.defaultMode];this.keywordCount=this.relevance=0;this.result=[];if(!this.lang.defaultMode.illegalRe){this.buildRes();var c=this.lang;c.defaultMode&&c.modes&&(q(c.defaultMode),g.forEach(c.modes,q))}try{this.highlight(b),this.result=this.result.join("")}catch(d){if("Illegal"==d)this.keywordCount=this.relevance=
0,this.partialResult=this.result.join(""),this.result=h(b);else throw d;}};n.extend(m,{buildRes:function(){g.forEach(this.lang.modes,function(a){a.begin&&(a.beginRe=this.langRe("^"+a.begin));a.end&&(a.endRe=this.langRe("^"+a.end));a.illegal&&(a.illegalRe=this.langRe("^(?:"+a.illegal+")"))},this);this.lang.defaultMode.illegalRe=this.langRe("^(?:"+this.lang.defaultMode.illegal+")")},subMode:function(a){var b=this.modes[this.modes.length-1].contains;if(b)for(var c=this.lang.modes,d=0;d<b.length;++d)for(var e=
b[d],k=0;k<c.length;++k){var l=c[k];if(l.className==e&&l.beginRe.test(a))return l}return null},endOfMode:function(a){for(var b=this.modes.length-1;0<=b;--b){var c=this.modes[b];if(c.end&&c.endRe.test(a))return this.modes.length-b;if(!c.endsWithParent)break}return 0},isIllegal:function(a){var b=this.modes[this.modes.length-1].illegalRe;return b&&b.test(a)},langRe:function(a,b){return new RegExp(a,"m"+(this.lang.case_insensitive?"i":"")+(b?"g":""))},buildTerminators:function(){var a=this.modes[this.modes.length-
1],b={};a.contains&&g.forEach(this.lang.modes,function(e){0<=g.indexOf(a.contains,e.className)&&(b[e.begin]=1)});for(var c=this.modes.length-1;0<=c;--c){var d=this.modes[c];d.end&&(b[d.end]=1);if(!d.endsWithParent)break}a.illegal&&(b[a.illegal]=1);d=[];for(c in b)d.push(c);a.terminatorsRe=this.langRe("("+d.join("|")+")")},eatModeChunk:function(a,b){var c=this.modes[this.modes.length-1];c.terminatorsRe||this.buildTerminators();a=a.substr(b);return(c=c.terminatorsRe.exec(a))?{buffer:c.index?a.substr(0,
c.index):"",lexeme:c[0],end:!1}:{buffer:a,lexeme:"",end:!0}},keywordMatch:function(a,b){var c=b[0];this.lang.case_insensitive&&(c=c.toLowerCase());for(var d in a.keywordGroups)if(c in a.keywordGroups[d])return d;return""},buildLexemes:function(a){var b={};g.forEach(a.lexems,function(e){b[e]=1});var c=[],d;for(d in b)c.push(d);a.lexemsRe=this.langRe("("+c.join("|")+")",!0)},processKeywords:function(a){var b=this.modes[this.modes.length-1];if(!b.keywords||!b.lexems)return h(a);b.lexemsRe||this.buildLexemes(b);
b.lexemsRe.lastIndex=0;for(var c=[],d=0,e=b.lexemsRe.exec(a);e;)c.push(h(a.substr(d,e.index-d))),(d=this.keywordMatch(b,e))?(++this.keywordCount,c.push('\x3cspan class\x3d"'+d+'"\x3e'+h(e[0])+"\x3c/span\x3e")):c.push(h(e[0])),d=b.lexemsRe.lastIndex,e=b.lexemsRe.exec(a);c.push(h(a.substr(d,a.length-d)));return c.join("")},processModeInfo:function(a,b,c){var d=this.modes[this.modes.length-1];if(c)this.result.push(this.processKeywords(d.buffer+a));else{if(this.isIllegal(b))throw"Illegal";if(c=this.subMode(b))d.buffer+=
a,this.result.push(this.processKeywords(d.buffer)),c.excludeBegin?(this.result.push(b+'\x3cspan class\x3d"'+c.className+'"\x3e'),c.buffer=""):(this.result.push('\x3cspan class\x3d"'+c.className+'"\x3e'),c.buffer=b),this.modes.push(c),this.relevance+="number"==typeof c.relevance?c.relevance:1;else if(c=this.endOfMode(b)){d.buffer+=a;for(d.excludeEnd?this.result.push(this.processKeywords(d.buffer)+"\x3c/span\x3e"+b):this.result.push(this.processKeywords(d.buffer+b)+"\x3c/span\x3e");1<c;)this.result.push("\x3c/span\x3e"),
--c,this.modes.pop();this.modes.pop();this.modes[this.modes.length-1].buffer=""}}},highlight:function(a){var b=0;this.lang.defaultMode.buffer="";do{var c=this.eatModeChunk(a,b);this.processModeInfo(c.buffer,c.lexeme,c.end);b+=c.buffer.length+c.lexeme.length}while(!c.end);if(1<this.modes.length)throw"Illegal";}});dojox.highlight.processString=function(a,b){return b?t(b,a):u(a)};dojox.highlight.init=function(a){a=v.byId(a);if(!w.contains(a,"no-highlight")&&x(a)){var b=a.className.split(/\s+/);g.some(b,
function(c){if("_"!=c.charAt(0)&&f.languages[c]){var d=a;c=t(c,p(d));r(d,d.className,c.result);return!0}return!1})||y(a)}};f.Code=function(a,b){f.init(b)};return f});