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