openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

julia.min.js (6293B)


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