function e(e){return RegExp(`^((`+e.join(`)|(`)+`))\\b`)}var t=/[\^@!\|<>#~\.\*\-\+\\/,=]/,n=/(<-)|(:=)|(=<)|(>=)|(<=)|(<:)|(>:)|(=:)|(\\=)|(\\=:)|(!!)|(==)|(::)/,r=/(:::)|(\.\.\.)|(=<:)|(>=:)/,i=[`in`,`then`,`else`,`of`,`elseof`,`elsecase`,`elseif`,`catch`,`finally`,`with`,`require`,`prepare`,`import`,`export`,`define`,`do`],a=[`end`],o=e([`true`,`false`,`nil`,`unit`]),s=e([`andthen`,`at`,`attr`,`declare`,`feat`,`from`,`lex`,`mod`,`div`,`mode`,`orelse`,`parser`,`prod`,`prop`,`scanner`,`self`,`syn`,`token`]),c=e([`local`,`proc`,`fun`,`case`,`class`,`if`,`cond`,`or`,`dis`,`choice`,`not`,`thread`,`try`,`raise`,`lock`,`for`,`suchthat`,`meth`,`functor`]),l=e(i),u=e(a);function d(e,i){if(e.eatSpace())return null;if(e.match(/[{}]/))return`bracket`;if(e.match(`[]`))return`keyword`;if(e.match(r)||e.match(n))return`operator`;if(e.match(o))return`atom`;var a=e.match(c);if(a)return i.doInCurrentLine?i.doInCurrentLine=!1:i.currentIndent++,a[0]==`proc`||a[0]==`fun`?i.tokenize=m:a[0]==`class`?i.tokenize=f:a[0]==`meth`&&(i.tokenize=p),`keyword`;if(e.match(l)||e.match(s))return`keyword`;if(e.match(u))return i.currentIndent--,`keyword`;var d=e.next();if(d==`"`||d==`'`)return i.tokenize=g(d),i.tokenize(e,i);if(/[~\d]/.test(d)){if(d==`~`){if(!/^[0-9]/.test(e.peek()))return null;if(e.next()==`0`&&e.match(/^[xX][0-9a-fA-F]+/)||e.match(/^[0-9]*(\.[0-9]+)?([eE][~+]?[0-9]+)?/))return`number`}return d==`0`&&e.match(/^[xX][0-9a-fA-F]+/)||e.match(/^[0-9]*(\.[0-9]+)?([eE][~+]?[0-9]+)?/)?`number`:null}return d==`%`?(e.skipToEnd(),`comment`):d==`/`&&e.eat(`*`)?(i.tokenize=h,h(e,i)):t.test(d)?`operator`:(e.eatWhile(/\w/),`variable`)}function f(e,t){return e.eatSpace()?null:(e.match(/([A-Z][A-Za-z0-9_]*)|(`.+`)/),t.tokenize=d,`type`)}function p(e,t){return e.eatSpace()?null:(e.match(/([a-zA-Z][A-Za-z0-9_]*)|(`.+`)/),t.tokenize=d,`def`)}function m(e,t){return e.eatSpace()?null:!t.hasPassedFirstStage&&e.eat(`{`)?(t.hasPassedFirstStage=!0,`bracket`):t.hasPassedFirstStage?(e.match(/([A-Z][A-Za-z0-9_]*)|(`.+`)|\$/),t.hasPassedFirstStage=!1,t.tokenize=d,`def`):(t.tokenize=d,null)}function h(e,t){for(var n=!1,r;r=e.next();){if(r==`/`&&n){t.tokenize=d;break}n=r==`*`}return`comment`}function g(e){return function(t,n){for(var r=!1,i,a=!1;(i=t.next())!=null;){if(i==e&&!r){a=!0;break}r=!r&&i==`\\`}return(a||!r)&&(n.tokenize=d),`string`}}function _(){var e=i.concat(a);return RegExp(`[\\[\\]]|(`+e.join(`|`)+`)$`)}var v={name:`oz`,startState:function(){return{tokenize:d,currentIndent:0,doInCurrentLine:!1,hasPassedFirstStage:!1}},token:function(e,t){return e.sol()&&(t.doInCurrentLine=0),t.tokenize(e,t)},indent:function(e,t,n){var r=t.replace(/^\s+|\s+$/g,``);return r.match(u)||r.match(l)||r.match(/(\[])/)?n.unit*(e.currentIndent-1):e.currentIndent<0?0:e.currentIndent*n.unit},languageData:{indentOnInut:_(),commentTokens:{line:`%`,block:{open:`/*`,close:`*/`}}}};export{v as oz};