%PDF- %PDF-
Direktori : /proc/self/root/usr/share/webmin/authentic-theme/unauthenticated/js/codemirror/mode/julia/ |
Current File : //proc/self/root/usr/share/webmin/authentic-theme/unauthenticated/js/codemirror/mode/julia/julia.js |
!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){"use strict";e.defineMode("julia",function(t,n){function r(e,t){return void 0===t&&(t="\\b"),new RegExp("^(("+e.join(")|(")+"))"+t)}function i(e){return a(e,"[")}function a(e,t,n){void 0===t&&(t="("),void 0===n&&(n=0);var r=o(e,n);return!!(0==n&&"if"===r&&a(e,t,n+1)||"for"===r&&a(e,t,n+1)||r===t)}function o(e,t){return void 0===t&&(t=0),e.scopes.length<=t?null:e.scopes[e.scopes.length-(t+1)]}function c(e,t){if(e.match(/^#=/,!1))return t.tokenize=f,t.tokenize(e,t);var n=t.leavingExpr;if(e.sol()&&(n=!1),t.leavingExpr=!1,n&&e.match(/^'+/))return"operator";if(e.match(/\.{4,}/))return"error";if(e.match(/\.{1,3}/))return"operator";if(e.eatSpace())return null;var r=e.peek();if("#"===r)return e.skipToEnd(),"comment";if("["===r&&t.scopes.push("["),"("===r&&t.scopes.push("("),i(t)&&"]"===r){for("if"===o(t)&&t.scopes.pop();"for"===o(t);)t.scopes.pop();t.scopes.pop(),t.leavingExpr=!0}if(a(t)&&")"===r){for("if"===o(t)&&t.scopes.pop();"for"===o(t);)t.scopes.pop();t.scopes.pop(),t.leavingExpr=!0}if(i(t)){if("end"==t.lastToken&&e.match(/^:/))return"operator";if(e.match(/^end/))return"number"}var c;if(c=e.match(x))return t.scopes.push(c[0]),"keyword";if(e.match(z))return t.scopes.pop(),"keyword";if(e.match(/^::(?![:\$])/))return t.tokenize=u,t.tokenize(e,t);if(!n&&e.match(P)||e.match(/:([<>]:|<<=?|>>>?=?|->|\/\/|\.{2,3}|[\.\\%*+\-<>!\/^|&]=?|[~\?\$])/))return"builtin";if(e.match(m))return"operator";if(e.match(/^\.?\d/,!1)){var v=RegExp(/^im\b/),k=!1;if(e.match(/^\d*\.(?!\.)\d*([Eef][\+\-]?\d+)?/i)&&(k=!0),e.match(/^\d+\.(?!\.)\d*/)&&(k=!0),e.match(/^\.\d+/)&&(k=!0),e.match(/^0x\.[0-9a-f]+p[\+\-]?\d+/i)&&(k=!0),e.match(/^0x[0-9a-f]+/i)&&(k=!0),e.match(/^0b[01]+/i)&&(k=!0),e.match(/^0o[0-7]+/i)&&(k=!0),e.match(/^[1-9]\d*(e[\+\-]?\d+)?/)&&(k=!0),e.match(/^0(?![\dx])/i)&&(k=!0),k)return e.match(v),t.leavingExpr=!0,"number"}if(e.match(/^'/))return t.tokenize=l,t.tokenize(e,t);if(e.match(w))return t.tokenize=p(e.current()),t.tokenize(e,t);if(e.match(E))return"meta";if(e.match(h))return null;if(e.match(A))return"keyword";if(e.match(y))return"builtin";var b=t.isDefinition||"function"==t.lastToken||"macro"==t.lastToken||"type"==t.lastToken||"struct"==t.lastToken||"immutable"==t.lastToken;return e.match(d)?b?"."===e.peek()?(t.isDefinition=!0,"variable"):(t.isDefinition=!1,"def"):e.match(/^({[^}]*})*\(/,!1)?(t.tokenize=s,t.tokenize(e,t)):(t.leavingExpr=!0,"variable"):(e.next(),"error")}function s(e,t){var n=e.match(/^(\(\s*)/);if(n&&(t.firstParenPos<0&&(t.firstParenPos=t.scopes.length),t.scopes.push("("),t.charsAdvanced+=n[1].length),"("==o(t)&&e.match(/^\)/)&&(t.scopes.pop(),t.charsAdvanced+=1,t.scopes.length<=t.firstParenPos)){var r=e.match(/^(\s*where\s+[^\s=]+)*\s*?=(?!=)/,!1);return e.backUp(t.charsAdvanced),t.firstParenPos=-1,t.charsAdvanced=0,t.tokenize=c,r?"def":"builtin"}if(e.match(/^$/g,!1)){for(e.backUp(t.charsAdvanced);t.scopes.length>t.firstParenPos;)t.scopes.pop();return t.firstParenPos=-1,t.charsAdvanced=0,t.tokenize=c,"builtin"}return t.charsAdvanced+=e.match(/^([^()]*)/)[1].length,t.tokenize(e,t)}function u(e,t){return e.match(/.*?(?=,|;|{|}|\(|\)|=|$|\s)/),e.match(/^{/)?t.nestedLevels++:e.match(/^}/)&&t.nestedLevels--,t.nestedLevels>0?e.match(/.*?(?={|})/)||e.next():0==t.nestedLevels&&(t.tokenize=c),"builtin"}function f(e,t){return e.match(/^#=/)&&t.nestedLevels++,e.match(/.*?(?=(#=|=#))/)||e.skipToEnd(),e.match(/^=#/)&&0==--t.nestedLevels&&(t.tokenize=c),"comment"}function l(e,t){var n,r=!1;if(e.match(v))r=!0;else if(n=e.match(/\\u([a-f0-9]{1,4})(?=')/i)){var i=parseInt(n[1],16);(i<=55295||i>=57344)&&(r=!0,e.next())}else if(n=e.match(/\\U([A-Fa-f0-9]{5,8})(?=')/)){var i=parseInt(n[1],16);i<=1114111&&(r=!0,e.next())}return r?(t.leavingExpr=!0,t.tokenize=c,"string"):(e.match(/^[^']+(?=')/)||e.skipToEnd(),e.match(/^'/)&&(t.tokenize=c),"error")}function p(e){function t(t,n){if(t.eat("\\"))t.next();else{if(t.match(e))return n.tokenize=c,n.leavingExpr=!0,"string";t.eat(/[`"]/)}return t.eatWhile(/[^\\`"]/),"string"}return'"""'===e.substr(-3)?e='"""':'"'===e.substr(-1)&&(e='"'),t}var m=n.operators||r(["[<>]:","[<>=]=","<<=?",">>>?=?","=>","->","\\/\\/","[\\\\%*+\\-<>!=\\/^|&\\u00F7\\u22BB]=?","\\?","\\$","~",":","\\u00D7","\\u2208","\\u2209","\\u220B","\\u220C","\\u2218","\\u221A","\\u221B","\\u2229","\\u222A","\\u2260","\\u2264","\\u2265","\\u2286","\\u2288","\\u228A","\\u22C5","\\b(in|isa)\\b(?!.?\\()"],""),h=n.delimiters||/^[;,()[\]{}]/,d=n.identifiers||/^[_A-Za-z\u00A1-\u2217\u2219-\uFFFF][\w\u00A1-\u2217\u2219-\uFFFF]*!*/,v=r(["\\\\[0-7]{1,3}","\\\\x[A-Fa-f0-9]{1,2}","\\\\[abefnrtv0%?'\"\\\\]","([^\\u0027\\u005C\\uD800-\\uDFFF]|[\\uD800-\\uDFFF][\\uDC00-\\uDFFF])"],"'"),k=["begin","function","type","struct","immutable","let","macro","for","while","quote","if","else","elseif","try","finally","catch","do"],b=["end","else","elseif","catch","finally"],F=["if","else","elseif","while","for","begin","let","end","do","try","catch","finally","return","break","continue","global","local","const","export","import","importall","using","function","where","macro","module","baremodule","struct","type","mutable","immutable","quote","typealias","abstract","primitive","bitstype"],g=["true","false","nothing","NaN","Inf"];e.registerHelper("hintWords","julia",F.concat(g));var x=r(k),z=r(b),A=r(F),y=r(g),E=/^@[_A-Za-z][\w]*/,P=/^:[_A-Za-z\u00A1-\uFFFF][\w\u00A1-\uFFFF]*!*/,w=/^(`|([_A-Za-z\u00A1-\uFFFF]*"("")?))/;return{startState:function(){return{tokenize:c,scopes:[],lastToken:null,leavingExpr:!1,isDefinition:!1,nestedLevels:0,charsAdvanced:0,firstParenPos:-1}},token:function(e,t){var n=t.tokenize(e,t),r=e.current();return r&&n&&(t.lastToken=r),n},indent:function(e,n){var r=0;return"]"!==n&&")"!==n&&"end"!==n&&"else"!==n&&"catch"!==n&&"elseif"!==n&&"finally"!==n||(r=-1),(e.scopes.length+r)*t.indentUnit},electricInput:/\b(end|else|catch|finally)\b/,blockCommentStart:"#=",blockCommentEnd:"=#",lineComment:"#",fold:"indent"}}),e.defineMIME("text/x-julia","julia")});