?
Path : /home/admin/public_html/old/media/editors/codemirror/mode/oz/ |
Current File : /home/admin/public_html/old/media/editors/codemirror/mode/oz/oz.min.js |
!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";a.defineMode("oz",function(a){function b(a){return new RegExp("^(("+a.join(")|(")+"))\\b")}function c(a,b){if(a.eatSpace())return null;if(a.match(/[{}]/))return"bracket";if(a.match(/(\[])/))return"keyword";if(a.match(l)||a.match(k))return"operator";if(a.match(o))return"atom";var c=a.match(q);if(c)return b.doInCurrentLine?b.doInCurrentLine=!1:b.currentIndent++,"proc"==c[0]||"fun"==c[0]?b.tokenize=f:"class"==c[0]?b.tokenize=d:"meth"==c[0]&&(b.tokenize=e),"keyword";if(a.match(r)||a.match(p))return"keyword";if(a.match(s))return b.currentIndent--,"keyword";var i=a.next();if('"'==i||"'"==i)return b.tokenize=h(i),b.tokenize(a,b);if(/[~\d]/.test(i)){if("~"==i){if(!/^[0-9]/.test(a.peek()))return null;if("0"==a.next()&&a.match(/^[xX][0-9a-fA-F]+/)||a.match(/^[0-9]*(\.[0-9]+)?([eE][~+]?[0-9]+)?/))return"number"}return"0"==i&&a.match(/^[xX][0-9a-fA-F]+/)||a.match(/^[0-9]*(\.[0-9]+)?([eE][~+]?[0-9]+)?/)?"number":null}return"%"==i?(a.skipToEnd(),"comment"):"/"==i&&a.eat("*")?(b.tokenize=g,g(a,b)):j.test(i)?"operator":(a.eatWhile(/\w/),"variable")}function d(a,b){return a.eatSpace()?null:(a.match(/([A-Z][A-Za-z0-9_]*)|(`.+`)/),b.tokenize=c,"variable-3")}function e(a,b){return a.eatSpace()?null:(a.match(/([a-zA-Z][A-Za-z0-9_]*)|(`.+`)/),b.tokenize=c,"def")}function f(a,b){return a.eatSpace()?null:!b.hasPassedFirstStage&&a.eat("{")?(b.hasPassedFirstStage=!0,"bracket"):b.hasPassedFirstStage?(a.match(/([A-Z][A-Za-z0-9_]*)|(`.+`)|\$/),b.hasPassedFirstStage=!1,b.tokenize=c,"def"):(b.tokenize=c,null)}function g(a,b){for(var d,e=!1;d=a.next();){if("/"==d&&e){b.tokenize=c;break}e="*"==d}return"comment"}function h(a){return function(b,d){for(var e,f=!1,g=!1;null!=(e=b.next());){if(e==a&&!f){g=!0;break}f=!f&&"\\"==e}return(g||!f)&&(d.tokenize=c),"string"}}function i(){var a=m.concat(n);return new RegExp("[\\[\\]]|("+a.join("|")+")$")}var j=/[\^@!\|<>#~\.\*\-\+\\/,=]/,k=/(<-)|(:=)|(=<)|(>=)|(<=)|(<:)|(>:)|(=:)|(\\=)|(\\=:)|(!!)|(==)|(::)/,l=/(:::)|(\.\.\.)|(=<:)|(>=:)/,m=["in","then","else","of","elseof","elsecase","elseif","catch","finally","with","require","prepare","import","export","define","do"],n=["end"],o=b(["true","false","nil","unit"]),p=b(["andthen","at","attr","declare","feat","from","lex","mod","mode","orelse","parser","prod","prop","scanner","self","syn","token"]),q=b(["local","proc","fun","case","class","if","cond","or","dis","choice","not","thread","try","raise","lock","for","suchthat","meth","functor"]),r=b(m),s=b(n);return{startState:function(){return{tokenize:c,currentIndent:0,doInCurrentLine:!1,hasPassedFirstStage:!1}},token:function(a,b){return a.sol()&&(b.doInCurrentLine=0),b.tokenize(a,b)},indent:function(b,c){var d=c.replace(/^\s+|\s+$/g,"");return d.match(s)||d.match(r)||d.match(/(\[])/)?a.indentUnit*(b.currentIndent-1):b.currentIndent<0?0:b.currentIndent*a.indentUnit},fold:"indent",electricInput:i(),lineComment:"%",blockCommentStart:"/*",blockCommentEnd:"*/"}}),a.defineMIME("text/x-oz","oz")});