!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}((function(t){"use strict";t.defineMode("dtd",(function(t){var e,n=t.indentUnit;function r(t,n){return e=n,t}function a(t,e){var n,u=t.next();if("<"!=u||!t.eat("!")){if("<"==u&&t.eat("?"))return e.tokenize=("meta","?>",function(t,e){for(;!t.eol();){if(t.match("?>")){e.tokenize=a;break}t.next()}return"meta"}),r("meta",u);if("#"==u&&t.eatWhile(/[\w]/))return r("atom","tag");if("|"==u)return r("keyword","separator");if(u.match(/[\(\)\[\]\-\.,\+\?>]/))return r(null,u);if(u.match(/[\[\]]/))return r("rule",u);if('"'==u||"'"==u)return e.tokenize=(n=u,function(t,e){for(var i,u=!1;null!=(i=t.next());){if(i==n&&!u){e.tokenize=a;break}u=!u&&"\\"==i}return r("string","tag")}),e.tokenize(t,e);if(t.eatWhile(/[a-zA-Z\?\+\d]/)){var o=t.current();return null!==o.substr(o.length-1,o.length).match(/\?|\+/)&&t.backUp(1),r("tag","tag")}return"%"==u||"*"==u?r("number","number"):(t.eatWhile(/[\w\\\-_%.{,]/),r(null,null))}return t.eatWhile(/[\-]/)?(e.tokenize=i,i(t,e)):t.eatWhile(/[\w]/)?r("keyword","doindent"):void 0}function i(t,e){for(var n,i=0;null!=(n=t.next());){if(i>=2&&">"==n){e.tokenize=a;break}i="-"==n?i+1:0}return r("comment","comment")}return{startState:function(t){return{tokenize:a,baseIndent:t||0,stack:[]}},token:function(t,n){if(t.eatSpace())return null;var r=n.tokenize(t,n),a=n.stack[n.stack.length-1];return"["==t.current()||"doindent"===e||"["==e?n.stack.push("rule"):"endtag"===e?n.stack[n.stack.length-1]="endtag":"]"==t.current()||"]"==e||">"==e&&"rule"==a?n.stack.pop():"["==e&&n.stack.push("["),r},indent:function(t,r){var a=t.stack.length;return"]"===r.charAt(0)?a--:">"===r.substr(r.length-1,r.length)&&("<"===r.substr(0,1)||"doindent"==e&&r.length>1||("doindent"==e?a--:">"==e&&r.length>1||"tag"==e&&">"!==r||("tag"==e&&"rule"==t.stack[t.stack.length-1]?a--:"tag"==e?a++:">"===r&&"rule"==t.stack[t.stack.length-1]&&">"===e?a--:">"===r&&"rule"==t.stack[t.stack.length-1]||("<"!==r.substr(0,1)&&">"===r.substr(0,1)?a-=1:">"===r||(a-=1)))),null!=e&&"]"!=e||a--),t.baseIndent+a*n},electricChars:"]>"}})),t.defineMIME("application/xml-dtd","dtd")}));