Seditio Source
Root |
./othercms/xenForo 2.2.8/js/vendor/codemirror/mode/python/python.min.js
(function(h){"object"==typeof exports&&"object"==typeof module?h(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],h):h(CodeMirror)})(function(h){function p(d){return new RegExp("^(("+d.join(")|(")+"))\\b")}function d(d){return d.scopes[d.scopes.length-1]}var C=p(["and","or","not","is"]),v="as assert break class continue def del elif else except finally for from global if import lambda pass raise return try while with yield in".split(" "),w="abs all any bin bool bytearray callable chr classmethod compile complex delattr dict dir divmod enumerate eval filter float format frozenset getattr globals hasattr hash help hex id input int isinstance issubclass iter len list locals map max memoryview min next object oct open ord pow property range repr reversed round set setattr slice sorted staticmethod str sum super tuple type vars zip __import__ NotImplemented Ellipsis __debug__".split(" ");
h.registerHelper("hintWords","python",v.concat(w));h.defineMode("python",function(u,e){function x(a,b){var g=a.sol()&&"\\"!=b.lastToken;g&&(b.indent=a.indentation());if(g&&"py"==d(b).type){g=d(b).offset;if(a.eatSpace()){var c=a.indentation();c>g?y(b):c<g&&z(a,b)&&"#"!=a.peek()&&(b.errorToken=!0);return null}c=q(a,b);0<g&&z(a,b)&&(c+=" error");return c}return q(a,b)}function q(a,b,g){if(a.eatSpace())return null;if(!g&&a.match(/^#.*/))return"comment";if(a.match(/^[0-9\.]/,!1)){var c=!1;a.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)&&
(c=!0);a.match(/^[\d_]+\.\d*/)&&(c=!0);a.match(/^\.\d+/)&&(c=!0);if(c)return a.eat(/J/i),"number";c=!1;a.match(/^0x[0-9a-f_]+/i)&&(c=!0);a.match(/^0b[01_]+/i)&&(c=!0);a.match(/^0o[0-7_]+/i)&&(c=!0);a.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)&&(a.eat(/J/i),c=!0);a.match(/^0(?![\dx])/i)&&(c=!0);if(c)return a.eat(/L/i),"number"}if(a.match(A))return-1===a.current().toLowerCase().indexOf("f")?b.tokenize=D(a.current(),b.tokenize):b.tokenize=E(a.current(),b.tokenize),b.tokenize(a,b);for(c=0;c<l.length;c++)if(a.match(l[c]))return"operator";
if(a.match(F))return"punctuation";if("."==b.lastToken&&a.match(n))return"property";if(a.match(G)||a.match(C))return"keyword";if(a.match(H))return"builtin";if(a.match(/^(self|cls)\b/))return"variable-2";if(a.match(n))return"def"==b.lastToken||"class"==b.lastToken?"def":"variable";a.next();return g?null:"error"}function E(a,b){function g(a){return function(b,r){var m=q(b,r,!0);"punctuation"==m&&("{"==b.current()?r.tokenize=g(a+1):"}"==b.current()&&(r.tokenize=1<a?g(a-1):c));return m}}function c(c,d){for(;!c.eol();)if(c.eatWhile(/[^'"\{\}\\]/),
c.eat("\\")){if(c.next(),m&&c.eol())return"string"}else{if(c.match(a))return d.tokenize=b,"string";if(c.match("{{"))return"string";if(c.match("{",!1))return d.tokenize=g(0),c.current()?"string":d.tokenize(c,d);if(c.match("}}"))return"string";if(c.match("}"))return"error";c.eat(/['"]/)}if(m){if(e.singleLineStringErrors)return"error";d.tokenize=b}return"string"}for(;0<="rubf".indexOf(a.charAt(0).toLowerCase());)a=a.substr(1);var m=1==a.length;c.isString=!0;return c}function D(a,b){function d(d,g){for(;!d.eol();)if(d.eatWhile(/[^'"\\]/),
d.eat("\\")){if(d.next(),c&&d.eol())return"string"}else{if(d.match(a))return g.tokenize=b,"string";d.eat(/['"]/)}if(c){if(e.singleLineStringErrors)return"error";g.tokenize=b}return"string"}for(;0<="rubf".indexOf(a.charAt(0).toLowerCase());)a=a.substr(1);var c=1==a.length;d.isString=!0;return d}function y(a){for(;"py"!=d(a).type;)a.scopes.pop();a.scopes.push({offset:d(a).offset+u.indentUnit,type:"py",align:null})}function z(a,b){for(a=a.indentation();1<b.scopes.length&&d(b).offset>a;){if("py"!=d(b).type)return!0;
b.scopes.pop()}return d(b).offset!=a}for(var F=e.delimiters||e.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.\\]/,l=[e.singleOperators,e.doubleOperators,e.doubleDelimiters,e.tripleDelimiters,e.operators||/^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/],f=0;f<l.length;f++)l[f]||l.splice(f--,1);var t=e.hangingIndent||u.indentUnit;f=v;var k=w;void 0!=e.extra_keywords&&(f=f.concat(e.extra_keywords));void 0!=e.extra_builtins&&(k=k.concat(e.extra_builtins));var B=!(e.version&&3>Number(e.version));if(B){var n=
e.identifiers||/^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;f=f.concat("nonlocal False True None async await".split(" "));k=k.concat(["ascii","bytes","exec","print"]);var A=/^(([rbuf]|(br)|(fr))?('{3}|"{3}|['"]))/i}else n=e.identifiers||/^[_A-Za-z][_A-Za-z0-9]*/,f=f.concat(["exec","print"]),k=k.concat("apply basestring buffer cmp coerce execfile file intern long raw_input reduce reload unichr unicode xrange False True None".split(" ")),A=/^(([rubf]|(ur)|(br))?('{3}|"{3}|['"]))/i;var G=p(f),
H=p(k);return{startState:function(a){return{tokenize:x,scopes:[{offset:a||0,type:"py",align:null}],indent:a||0,lastToken:null,lambda:!1,dedent:0}},token:function(a,b){var g=b.errorToken;g&&(b.errorToken=!1);a:{a.sol()&&(b.beginningOfLine=!0);var c=b.tokenize(a,b);var e=a.current();if(b.beginningOfLine&&"@"==e)c=a.match(n,!1)?"meta":B?"operator":"error";else{/\S/.test(e)&&(b.beginningOfLine=!1);"variable"!=c&&"builtin"!=c||"meta"!=b.lastToken||(c="meta");if("pass"==e||"return"==e)b.dedent+=1;"lambda"==
e&&(b.lambda=!0);":"!=e||b.lambda||"py"!=d(b).type||y(b);if(1==e.length&&!/string|comment/.test(c)){var f="[({".indexOf(e);if(-1!=f){f="])}".slice(f,f+1);var h=a.match(/^([\s\[\{\(]|#.*)*$/,!1)?null:a.column()+1;b.scopes.push({offset:b.indent+t,type:f,align:h})}f="])}".indexOf(e);if(-1!=f)if(d(b).type==e)b.indent=b.scopes.pop().offset-t;else{c="error";break a}}0<b.dedent&&a.eol()&&"py"==d(b).type&&(1<b.scopes.length&&b.scopes.pop(),--b.dedent)}}c&&"comment"!=c&&(b.lastToken="keyword"==c||"punctuation"==
c?a.current():c);"punctuation"==c&&(c=null);a.eol()&&b.lambda&&(b.lambda=!1);return g?c+" error":c},indent:function(a,b){if(a.tokenize!=x)return a.tokenize.isString?h.Pass:0;a=d(a);b=a.type==b.charAt(0);return null!=a.align?a.align-(b?1:0):a.offset-(b?t:0)},electricInput:/^\s*[\}\]\)]$/,closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"}});h.defineMIME("text/x-python","python");h.defineMIME("text/x-cython",{name:"python",extra_keywords:"by cdef cimport cpdef ctypedef enum except extern gil include nogil property public readonly struct union DEF IF ELIF ELSE".split(" ")})});