var e;function t(t,n){return e=n,t}function n(e,n){var o=e.next();if(o==`<`&&e.eat(`!`)){if(e.eatWhile(/[\-]/))return n.tokenize=r,r(e,n);if(e.eatWhile(/[\w]/))return t(`keyword`,`doindent`)}else if(o==`<`&&e.eat(`?`))return n.tokenize=a(`meta`,`?>`),t(`meta`,o);else if(o==`#`&&e.eatWhile(/[\w]/))return t(`atom`,`tag`);else if(o==`|`)return t(`keyword`,`separator`);else if(o.match(/[\(\)\[\]\-\.,\+\?>]/))return t(null,o);else if(o.match(/[\[\]]/))return t(`rule`,o);else if(o==`"`||o==`'`)return n.tokenize=i(o),n.tokenize(e,n);else if(e.eatWhile(/[a-zA-Z\?\+\d]/)){var s=e.current();return s.substr(s.length-1,s.length).match(/\?|\+/)!==null&&e.backUp(1),t(`tag`,`tag`)}else if(o==`%`||o==`*`)return t(`number`,`number`);else return e.eatWhile(/[\w\\\-_%.{,]/),t(null,null)}function r(e,r){for(var i=0,a;(a=e.next())!=null;){if(i>=2&&a==`>`){r.tokenize=n;break}i=a==`-`?i+1:0}return t(`comment`,`comment`)}function i(e){return function(r,i){for(var a=!1,o;(o=r.next())!=null;){if(o==e&&!a){i.tokenize=n;break}a=!a&&o==`\\`}return t(`string`,`tag`)}}function a(e,t){return function(r,i){for(;!r.eol();){if(r.match(t)){i.tokenize=n;break}r.next()}return e}}var o={name:`dtd`,startState:function(){return{tokenize:n,baseIndent:0,stack:[]}},token:function(t,n){if(t.eatSpace())return null;var r=n.tokenize(t,n),i=n.stack[n.stack.length-1];return t.current()==`[`||e===`doindent`||e==`[`?n.stack.push(`rule`):e===`endtag`?n.stack[n.stack.length-1]=`endtag`:t.current()==`]`||e==`]`||e==`>`&&i==`rule`?n.stack.pop():e==`[`&&n.stack.push(`[`),r},indent:function(t,n,r){var i=t.stack.length;return n.charAt(0)===`]`?i--:n.substr(n.length-1,n.length)===`>`&&(n.substr(0,1)===`<`||e==`doindent`&&n.length>1||(e==`doindent`?i--:e==`>`&&n.length>1||e==`tag`&&n!==`>`||(e==`tag`&&t.stack[t.stack.length-1]==`rule`?i--:e==`tag`?i++:n===`>`&&t.stack[t.stack.length-1]==`rule`&&e===`>`?i--:n===`>`&&t.stack[t.stack.length-1]==`rule`||(n.substr(0,1)!==`<`&&n.substr(0,1)===`>`?--i:n===`>`||--i))),(e==null||e==`]`)&&i--),t.baseIndent+i*r.unit},languageData:{indentOnInput:/^\s*[\]>]$/}};export{o as dtd};
//# sourceMappingURL=dtd.9McJAPjM.js.map