CodeMirror.defineMode("bbcode",function(h){var k,l,m;k="b i u s img quote code list table  tr td size color url";l="* :-) hr cut";h.hasOwnProperty("bbCodeTags")&&(k=h.bbCodeTags);h.hasOwnProperty("bbCodeUnaryTags")&&(l=h.bbCodeUnaryTags);var c={cont:function(a,b){m=b;return a},escapeRegEx:function(a){return a.replace(/([\:\-\)\(\*\+\?\[\]])/g,"\\$1")}},n=/[a-zA-Z0-9_]/,p=/['"]/,q=new RegExp("(?:"+c.escapeRegEx(k).split(" ").join("|")+")"),r=new RegExp("(?:"+c.escapeRegEx(l).split(" ").join("|")+")"),
f={tokenizer:function(a,b){if(a.eatSpace())return null;if(a.match("[",!0))return b.tokenize=f.bbcode,c.cont("tag","startTag");a.next();return null},inAttribute:function(a){return function(b,c){for(var d=null,g=null;!b.eol();){g=b.peek();if(b.next()==a&&"\\"!==d){c.tokenize=f.bbcode;break}d=g}return"string"}},bbcode:function(a,b){if(a.match("]",!0))return b.tokenize=f.tokenizer,c.cont("tag",null);if(a.match("[",!0))return c.cont("tag","startTag");var e=a.next();if(p.test(e))return b.tokenize=f.inAttribute(e),
c.cont("string","string");if(/\d/.test(e))return a.eatWhile(/\d/),c.cont("number","number");if("whitespace"==b.last)return a.eatWhile(n),c.cont("attribute","modifier");if("property"==b.last)return a.eatWhile(n),c.cont("property",null);if(/\s/.test(e))return m="whitespace",null;var d="";"/"!=e&&(d+=e);for(var g=null;g=a.eat(n);)d+=g;return r.test(d)?c.cont("atom","atom"):q.test(d)?c.cont("keyword","keyword"):/\s/.test(e)?null:c.cont("tag","tag")}};return{startState:function(){return{tokenize:f.tokenizer,
mode:"bbcode",last:null}},token:function(a,b){var c=b.tokenize(a,b);b.last=m;return c},electricChars:""}});CodeMirror.defineMIME("text/x-bbcode","bbcode");