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