Browse Source

提交版本

李云瑞 1 year ago
parent
commit
dc270fa082

+ 1 - 0
jeecg-module-demo/src/main/resources/static/bigscreen/template2/js/pop_base.js

@@ -0,0 +1 @@
+

+ 1 - 0
jeecg-module-demo/target/classes/static/bigscreen/template2/js/pop_base.js

@@ -0,0 +1 @@
+

File diff suppressed because it is too large
+ 88 - 0
jeecg-server-cloud/jeecg-visual/jeecg-cloud-xxljob/src/main/resources/static/plugins/codemirror/mode/php/php.js


+ 398 - 0
jeecg-server-cloud/jeecg-visual/jeecg-cloud-xxljob/src/main/resources/static/plugins/codemirror/mode/powershell/powershell.js

@@ -0,0 +1,398 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/LICENSE
+
+(function(mod) {
+  'use strict';
+  if (typeof exports == 'object' && typeof module == 'object') // CommonJS
+    mod(require('../../lib/codemirror'));
+  else if (typeof define == 'function' && define.amd) // AMD
+    define(['../../lib/codemirror'], mod);
+  else // Plain browser env
+    mod(window.CodeMirror);
+})(function(CodeMirror) {
+'use strict';
+
+CodeMirror.defineMode('powershell', function() {
+  function buildRegexp(patterns, options) {
+    options = options || {};
+    var prefix = options.prefix !== undefined ? options.prefix : '^';
+    var suffix = options.suffix !== undefined ? options.suffix : '\\b';
+
+    for (var i = 0; i < patterns.length; i++) {
+      if (patterns[i] instanceof RegExp) {
+        patterns[i] = patterns[i].source;
+      }
+      else {
+        patterns[i] = patterns[i].replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
+      }
+    }
+
+    return new RegExp(prefix + '(' + patterns.join('|') + ')' + suffix, 'i');
+  }
+
+  var notCharacterOrDash = '(?=[^A-Za-z\\d\\-_]|$)';
+  var varNames = /[\w\-:]/
+  var keywords = buildRegexp([
+    /begin|break|catch|continue|data|default|do|dynamicparam/,
+    /else|elseif|end|exit|filter|finally|for|foreach|from|function|if|in/,
+    /param|process|return|switch|throw|trap|try|until|where|while/
+  ], { suffix: notCharacterOrDash });
+
+  var punctuation = /[\[\]{},;`\.]|@[({]/;
+  var wordOperators = buildRegexp([
+    'f',
+    /b?not/,
+    /[ic]?split/, 'join',
+    /is(not)?/, 'as',
+    /[ic]?(eq|ne|[gl][te])/,
+    /[ic]?(not)?(like|match|contains)/,
+    /[ic]?replace/,
+    /b?(and|or|xor)/
+  ], { prefix: '-' });
+  var symbolOperators = /[+\-*\/%]=|\+\+|--|\.\.|[+\-*&^%:=!|\/]|<(?!#)|(?!#)>/;
+  var operators = buildRegexp([wordOperators, symbolOperators], { suffix: '' });
+
+  var numbers = /^((0x[\da-f]+)|((\d+\.\d+|\d\.|\.\d+|\d+)(e[\+\-]?\d+)?))[ld]?([kmgtp]b)?/i;
+
+  var identifiers = /^[A-Za-z\_][A-Za-z\-\_\d]*\b/;
+
+  var symbolBuiltins = /[A-Z]:|%|\?/i;
+  var namedBuiltins = buildRegexp([
+    /Add-(Computer|Content|History|Member|PSSnapin|Type)/,
+    /Checkpoint-Computer/,
+    /Clear-(Content|EventLog|History|Host|Item(Property)?|Variable)/,
+    /Compare-Object/,
+    /Complete-Transaction/,
+    /Connect-PSSession/,
+    /ConvertFrom-(Csv|Json|SecureString|StringData)/,
+    /Convert-Path/,
+    /ConvertTo-(Csv|Html|Json|SecureString|Xml)/,
+    /Copy-Item(Property)?/,
+    /Debug-Process/,
+    /Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)/,
+    /Disconnect-PSSession/,
+    /Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)/,
+    /(Enter|Exit)-PSSession/,
+    /Export-(Alias|Clixml|Console|Counter|Csv|FormatData|ModuleMember|PSSession)/,
+    /ForEach-Object/,
+    /Format-(Custom|List|Table|Wide)/,
+    new RegExp('Get-(Acl|Alias|AuthenticodeSignature|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Counter|Credential'
+      + '|Culture|Date|Event|EventLog|EventSubscriber|ExecutionPolicy|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job'
+      + '|Location|Member|Module|PfxCertificate|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration'
+      + '|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|Verb|WinEvent|WmiObject)'),
+    /Group-Object/,
+    /Import-(Alias|Clixml|Counter|Csv|LocalizedData|Module|PSSession)/,
+    /ImportSystemModules/,
+    /Invoke-(Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)/,
+    /Join-Path/,
+    /Limit-EventLog/,
+    /Measure-(Command|Object)/,
+    /Move-Item(Property)?/,
+    new RegExp('New-(Alias|Event|EventLog|Item(Property)?|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile'
+      + '|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy|WinEvent)'),
+    /Out-(Default|File|GridView|Host|Null|Printer|String)/,
+    /Pause/,
+    /(Pop|Push)-Location/,
+    /Read-Host/,
+    /Receive-(Job|PSSession)/,
+    /Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)/,
+    /Remove-(Computer|Event|EventLog|Item(Property)?|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)/,
+    /Rename-(Computer|Item(Property)?)/,
+    /Reset-ComputerMachinePassword/,
+    /Resolve-Path/,
+    /Restart-(Computer|Service)/,
+    /Restore-Computer/,
+    /Resume-(Job|Service)/,
+    /Save-Help/,
+    /Select-(Object|String|Xml)/,
+    /Send-MailMessage/,
+    new RegExp('Set-(Acl|Alias|AuthenticodeSignature|Content|Date|ExecutionPolicy|Item(Property)?|Location|PSBreakpoint|PSDebug' +
+               '|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)'),
+    /Show-(Command|ControlPanelItem|EventLog)/,
+    /Sort-Object/,
+    /Split-Path/,
+    /Start-(Job|Process|Service|Sleep|Transaction|Transcript)/,
+    /Stop-(Computer|Job|Process|Service|Transcript)/,
+    /Suspend-(Job|Service)/,
+    /TabExpansion2/,
+    /Tee-Object/,
+    /Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)/,
+    /Trace-Command/,
+    /Unblock-File/,
+    /Undo-Transaction/,
+    /Unregister-(Event|PSSessionConfiguration)/,
+    /Update-(FormatData|Help|List|TypeData)/,
+    /Use-Transaction/,
+    /Wait-(Event|Job|Process)/,
+    /Where-Object/,
+    /Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning)/,
+    /cd|help|mkdir|more|oss|prompt/,
+    /ac|asnp|cat|cd|chdir|clc|clear|clhy|cli|clp|cls|clv|cnsn|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|dnsn|ebp/,
+    /echo|epal|epcsv|epsn|erase|etsn|exsn|fc|fl|foreach|ft|fw|gal|gbp|gc|gci|gcm|gcs|gdr|ghy|gi|gjb|gl|gm|gmo|gp|gps/,
+    /group|gsn|gsnp|gsv|gu|gv|gwmi|h|history|icm|iex|ihy|ii|ipal|ipcsv|ipmo|ipsn|irm|ise|iwmi|iwr|kill|lp|ls|man|md/,
+    /measure|mi|mount|move|mp|mv|nal|ndr|ni|nmo|npssc|nsn|nv|ogv|oh|popd|ps|pushd|pwd|r|rbp|rcjb|rcsn|rd|rdr|ren|ri/,
+    /rjb|rm|rmdir|rmo|rni|rnp|rp|rsn|rsnp|rujb|rv|rvpa|rwmi|sajb|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls/,
+    /sort|sp|spjb|spps|spsv|start|sujb|sv|swmi|tee|trcm|type|where|wjb|write/
+  ], { prefix: '', suffix: '' });
+  var variableBuiltins = buildRegexp([
+    /[$?^_]|Args|ConfirmPreference|ConsoleFileName|DebugPreference|Error|ErrorActionPreference|ErrorView|ExecutionContext/,
+    /FormatEnumerationLimit|Home|Host|Input|MaximumAliasCount|MaximumDriveCount|MaximumErrorCount|MaximumFunctionCount/,
+    /MaximumHistoryCount|MaximumVariableCount|MyInvocation|NestedPromptLevel|OutputEncoding|Pid|Profile|ProgressPreference/,
+    /PSBoundParameters|PSCommandPath|PSCulture|PSDefaultParameterValues|PSEmailServer|PSHome|PSScriptRoot|PSSessionApplicationName/,
+    /PSSessionConfigurationName|PSSessionOption|PSUICulture|PSVersionTable|Pwd|ShellId|StackTrace|VerbosePreference/,
+    /WarningPreference|WhatIfPreference/,
+
+    /Event|EventArgs|EventSubscriber|Sender/,
+    /Matches|Ofs|ForEach|LastExitCode|PSCmdlet|PSItem|PSSenderInfo|This/,
+    /true|false|null/
+  ], { prefix: '\\$', suffix: '' });
+
+  var builtins = buildRegexp([symbolBuiltins, namedBuiltins, variableBuiltins], { suffix: notCharacterOrDash });
+
+  var grammar = {
+    keyword: keywords,
+    number: numbers,
+    operator: operators,
+    builtin: builtins,
+    punctuation: punctuation,
+    identifier: identifiers
+  };
+
+  // tokenizers
+  function tokenBase(stream, state) {
+    // Handle Comments
+    //var ch = stream.peek();
+
+    var parent = state.returnStack[state.returnStack.length - 1];
+    if (parent && parent.shouldReturnFrom(state)) {
+      state.tokenize = parent.tokenize;
+      state.returnStack.pop();
+      return state.tokenize(stream, state);
+    }
+
+    if (stream.eatSpace()) {
+      return null;
+    }
+
+    if (stream.eat('(')) {
+      state.bracketNesting += 1;
+      return 'punctuation';
+    }
+
+    if (stream.eat(')')) {
+      state.bracketNesting -= 1;
+      return 'punctuation';
+    }
+
+    for (var key in grammar) {
+      if (stream.match(grammar[key])) {
+        return key;
+      }
+    }
+
+    var ch = stream.next();
+
+    // single-quote string
+    if (ch === "'") {
+      return tokenSingleQuoteString(stream, state);
+    }
+
+    if (ch === '$') {
+      return tokenVariable(stream, state);
+    }
+
+    // double-quote string
+    if (ch === '"') {
+      return tokenDoubleQuoteString(stream, state);
+    }
+
+    if (ch === '<' && stream.eat('#')) {
+      state.tokenize = tokenComment;
+      return tokenComment(stream, state);
+    }
+
+    if (ch === '#') {
+      stream.skipToEnd();
+      return 'comment';
+    }
+
+    if (ch === '@') {
+      var quoteMatch = stream.eat(/["']/);
+      if (quoteMatch && stream.eol()) {
+        state.tokenize = tokenMultiString;
+        state.startQuote = quoteMatch[0];
+        return tokenMultiString(stream, state);
+      } else if (stream.eol()) {
+        return 'error';
+      } else if (stream.peek().match(/[({]/)) {
+        return 'punctuation';
+      } else if (stream.peek().match(varNames)) {
+        // splatted variable
+        return tokenVariable(stream, state);
+      }
+    }
+    return 'error';
+  }
+
+  function tokenSingleQuoteString(stream, state) {
+    var ch;
+    while ((ch = stream.peek()) != null) {
+      stream.next();
+
+      if (ch === "'" && !stream.eat("'")) {
+        state.tokenize = tokenBase;
+        return 'string';
+      }
+    }
+
+    return 'error';
+  }
+
+  function tokenDoubleQuoteString(stream, state) {
+    var ch;
+    while ((ch = stream.peek()) != null) {
+      if (ch === '$') {
+        state.tokenize = tokenStringInterpolation;
+        return 'string';
+      }
+
+      stream.next();
+      if (ch === '`') {
+        stream.next();
+        continue;
+      }
+
+      if (ch === '"' && !stream.eat('"')) {
+        state.tokenize = tokenBase;
+        return 'string';
+      }
+    }
+
+    return 'error';
+  }
+
+  function tokenStringInterpolation(stream, state) {
+    return tokenInterpolation(stream, state, tokenDoubleQuoteString);
+  }
+
+  function tokenMultiStringReturn(stream, state) {
+    state.tokenize = tokenMultiString;
+    state.startQuote = '"'
+    return tokenMultiString(stream, state);
+  }
+
+  function tokenHereStringInterpolation(stream, state) {
+    return tokenInterpolation(stream, state, tokenMultiStringReturn);
+  }
+
+  function tokenInterpolation(stream, state, parentTokenize) {
+    if (stream.match('$(')) {
+      var savedBracketNesting = state.bracketNesting;
+      state.returnStack.push({
+        /*jshint loopfunc:true */
+        shouldReturnFrom: function(state) {
+          return state.bracketNesting === savedBracketNesting;
+        },
+        tokenize: parentTokenize
+      });
+      state.tokenize = tokenBase;
+      state.bracketNesting += 1;
+      return 'punctuation';
+    } else {
+      stream.next();
+      state.returnStack.push({
+        shouldReturnFrom: function() { return true; },
+        tokenize: parentTokenize
+      });
+      state.tokenize = tokenVariable;
+      return state.tokenize(stream, state);
+    }
+  }
+
+  function tokenComment(stream, state) {
+    var maybeEnd = false, ch;
+    while ((ch = stream.next()) != null) {
+      if (maybeEnd && ch == '>') {
+          state.tokenize = tokenBase;
+          break;
+      }
+      maybeEnd = (ch === '#');
+    }
+    return 'comment';
+  }
+
+  function tokenVariable(stream, state) {
+    var ch = stream.peek();
+    if (stream.eat('{')) {
+      state.tokenize = tokenVariableWithBraces;
+      return tokenVariableWithBraces(stream, state);
+    } else if (ch != undefined && ch.match(varNames)) {
+      stream.eatWhile(varNames);
+      state.tokenize = tokenBase;
+      return 'variable-2';
+    } else {
+      state.tokenize = tokenBase;
+      return 'error';
+    }
+  }
+
+  function tokenVariableWithBraces(stream, state) {
+    var ch;
+    while ((ch = stream.next()) != null) {
+      if (ch === '}') {
+        state.tokenize = tokenBase;
+        break;
+      }
+    }
+    return 'variable-2';
+  }
+
+  function tokenMultiString(stream, state) {
+    var quote = state.startQuote;
+    if (stream.sol() && stream.match(new RegExp(quote + '@'))) {
+      state.tokenize = tokenBase;
+    }
+    else if (quote === '"') {
+      while (!stream.eol()) {
+        var ch = stream.peek();
+        if (ch === '$') {
+          state.tokenize = tokenHereStringInterpolation;
+          return 'string';
+        }
+
+        stream.next();
+        if (ch === '`') {
+          stream.next();
+        }
+      }
+    }
+    else {
+      stream.skipToEnd();
+    }
+
+    return 'string';
+  }
+
+  var external = {
+    startState: function() {
+      return {
+        returnStack: [],
+        bracketNesting: 0,
+        tokenize: tokenBase
+      };
+    },
+
+    token: function(stream, state) {
+      return state.tokenize(stream, state);
+    },
+
+    blockCommentStart: '<#',
+    blockCommentEnd: '#>',
+    lineComment: '#',
+    fold: 'brace'
+  };
+  return external;
+});
+
+CodeMirror.defineMIME('application/x-powershell', 'powershell');
+});

+ 409 - 0
jeecg-server-cloud/jeecg-visual/jeecg-cloud-xxljob/src/main/resources/static/plugins/codemirror/mode/python/python.js

@@ -0,0 +1,409 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  function wordRegexp(words) {
+    return new RegExp("^((" + words.join(")|(") + "))\\b");
+  }
+
+  var wordOperators = wordRegexp(["and", "or", "not", "is"]);
+  var commonKeywords = ["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"];
+  var commonBuiltins = ["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__"];
+  CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins));
+
+  function top(state) {
+    return state.scopes[state.scopes.length - 1];
+  }
+
+  CodeMirror.defineMode("python", function(conf, parserConf) {
+    var ERRORCLASS = "error";
+
+    var delimiters = parserConf.delimiters || parserConf.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.\\]/;
+    //               (Backwards-compatiblity with old, cumbersome config system)
+    var operators = [parserConf.singleOperators, parserConf.doubleOperators, parserConf.doubleDelimiters, parserConf.tripleDelimiters,
+                     parserConf.operators || /^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@])/]
+    for (var i = 0; i < operators.length; i++) if (!operators[i]) operators.splice(i--, 1)
+
+    var hangingIndent = parserConf.hangingIndent || conf.indentUnit;
+
+    var myKeywords = commonKeywords, myBuiltins = commonBuiltins;
+    if (parserConf.extra_keywords != undefined)
+      myKeywords = myKeywords.concat(parserConf.extra_keywords);
+
+    if (parserConf.extra_builtins != undefined)
+      myBuiltins = myBuiltins.concat(parserConf.extra_builtins);
+
+    var py3 = !(parserConf.version && Number(parserConf.version) < 3)
+    if (py3) {
+      // since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator
+      var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;
+      myKeywords = myKeywords.concat(["nonlocal", "False", "True", "None", "async", "await"]);
+      myBuiltins = myBuiltins.concat(["ascii", "bytes", "exec", "print"]);
+      var stringPrefixes = new RegExp("^(([rbuf]|(br)|(fr))?('{3}|\"{3}|['\"]))", "i");
+    } else {
+      var identifiers = parserConf.identifiers|| /^[_A-Za-z][_A-Za-z0-9]*/;
+      myKeywords = myKeywords.concat(["exec", "print"]);
+      myBuiltins = myBuiltins.concat(["apply", "basestring", "buffer", "cmp", "coerce", "execfile",
+                                      "file", "intern", "long", "raw_input", "reduce", "reload",
+                                      "unichr", "unicode", "xrange", "False", "True", "None"]);
+      var stringPrefixes = new RegExp("^(([rubf]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
+    }
+    var keywords = wordRegexp(myKeywords);
+    var builtins = wordRegexp(myBuiltins);
+
+    // tokenizers
+    function tokenBase(stream, state) {
+      var sol = stream.sol() && state.lastToken != "\\"
+      if (sol) state.indent = stream.indentation()
+      // Handle scope changes
+      if (sol && top(state).type == "py") {
+        var scopeOffset = top(state).offset;
+        if (stream.eatSpace()) {
+          var lineOffset = stream.indentation();
+          if (lineOffset > scopeOffset)
+            pushPyScope(state);
+          else if (lineOffset < scopeOffset && dedent(stream, state) && stream.peek() != "#")
+            state.errorToken = true;
+          return null;
+        } else {
+          var style = tokenBaseInner(stream, state);
+          if (scopeOffset > 0 && dedent(stream, state))
+            style += " " + ERRORCLASS;
+          return style;
+        }
+      }
+      return tokenBaseInner(stream, state);
+    }
+
+    function tokenBaseInner(stream, state) {
+      if (stream.eatSpace()) return null;
+
+      // Handle Comments
+      if (stream.match(/^#.*/)) return "comment";
+
+      // Handle Number Literals
+      if (stream.match(/^[0-9\.]/, false)) {
+        var floatLiteral = false;
+        // Floats
+        if (stream.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
+        if (stream.match(/^[\d_]+\.\d*/)) { floatLiteral = true; }
+        if (stream.match(/^\.\d+/)) { floatLiteral = true; }
+        if (floatLiteral) {
+          // Float literals may be "imaginary"
+          stream.eat(/J/i);
+          return "number";
+        }
+        // Integers
+        var intLiteral = false;
+        // Hex
+        if (stream.match(/^0x[0-9a-f_]+/i)) intLiteral = true;
+        // Binary
+        if (stream.match(/^0b[01_]+/i)) intLiteral = true;
+        // Octal
+        if (stream.match(/^0o[0-7_]+/i)) intLiteral = true;
+        // Decimal
+        if (stream.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)) {
+          // Decimal literals may be "imaginary"
+          stream.eat(/J/i);
+          // TODO - Can you have imaginary longs?
+          intLiteral = true;
+        }
+        // Zero by itself with no other piece of number.
+        if (stream.match(/^0(?![\dx])/i)) intLiteral = true;
+        if (intLiteral) {
+          // Integer literals may be "long"
+          stream.eat(/L/i);
+          return "number";
+        }
+      }
+
+      // Handle Strings
+      if (stream.match(stringPrefixes)) {
+        var isFmtString = stream.current().toLowerCase().indexOf('f') !== -1;
+        if (!isFmtString) {
+          state.tokenize = tokenStringFactory(stream.current());
+          return state.tokenize(stream, state);
+        } else {
+          state.tokenize = formatStringFactory(stream.current(), state.tokenize);
+          return state.tokenize(stream, state);
+        }
+      }
+
+      for (var i = 0; i < operators.length; i++)
+        if (stream.match(operators[i])) return "operator"
+
+      if (stream.match(delimiters)) return "punctuation";
+
+      if (state.lastToken == "." && stream.match(identifiers))
+        return "property";
+
+      if (stream.match(keywords) || stream.match(wordOperators))
+        return "keyword";
+
+      if (stream.match(builtins))
+        return "builtin";
+
+      if (stream.match(/^(self|cls)\b/))
+        return "variable-2";
+
+      if (stream.match(identifiers)) {
+        if (state.lastToken == "def" || state.lastToken == "class")
+          return "def";
+        return "variable";
+      }
+
+      // Handle non-detected items
+      stream.next();
+      return ERRORCLASS;
+    }
+
+    function formatStringFactory(delimiter, tokenOuter) {
+      while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
+        delimiter = delimiter.substr(1);
+
+      var singleline = delimiter.length == 1;
+      var OUTCLASS = "string";
+
+      function tokenFString(stream, state) {
+        // inside f-str Expression
+        if (stream.match(delimiter)) {
+          // expression ends pre-maturally, but very common in editing
+          // Could show error to remind users to close brace here
+          state.tokenize = tokenString
+          return OUTCLASS;
+        } else if (stream.match('{')) {
+          // starting brace, if not eaten below
+          return "punctuation";
+        } else if (stream.match('}')) {
+          // return to regular inside string state
+          state.tokenize = tokenString
+          return "punctuation";
+        } else {
+          // use tokenBaseInner to parse the expression
+          return tokenBaseInner(stream, state);
+        }
+      }
+
+      function tokenString(stream, state) {
+        while (!stream.eol()) {
+          stream.eatWhile(/[^'"\{\}\\]/);
+          if (stream.eat("\\")) {
+            stream.next();
+            if (singleline && stream.eol())
+              return OUTCLASS;
+          } else if (stream.match(delimiter)) {
+            state.tokenize = tokenOuter;
+            return OUTCLASS;
+          } else if (stream.match('{{')) {
+            // ignore {{ in f-str
+            return OUTCLASS;
+          } else if (stream.match('{', false)) {
+            // switch to nested mode
+            state.tokenize = tokenFString
+            if (stream.current()) {
+              return OUTCLASS;
+            } else {
+              // need to return something, so eat the starting {
+              stream.next();
+              return "punctuation";
+            }
+          } else if (stream.match('}}')) {
+            return OUTCLASS;
+          } else if (stream.match('}')) {
+            // single } in f-string is an error
+            return ERRORCLASS;
+          } else {
+            stream.eat(/['"]/);
+          }
+        }
+        if (singleline) {
+          if (parserConf.singleLineStringErrors)
+            return ERRORCLASS;
+          else
+            state.tokenize = tokenOuter;
+        }
+        return OUTCLASS;
+      }
+      tokenString.isString = true;
+      return tokenString;
+    }
+
+    function tokenStringFactory(delimiter) {
+      while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
+        delimiter = delimiter.substr(1);
+
+      var singleline = delimiter.length == 1;
+      var OUTCLASS = "string";
+
+      function tokenString(stream, state) {
+        while (!stream.eol()) {
+          stream.eatWhile(/[^'"\\]/);
+          if (stream.eat("\\")) {
+            stream.next();
+            if (singleline && stream.eol())
+              return OUTCLASS;
+          } else if (stream.match(delimiter)) {
+            state.tokenize = tokenBase;
+            return OUTCLASS;
+          } else {
+            stream.eat(/['"]/);
+          }
+        }
+        if (singleline) {
+          if (parserConf.singleLineStringErrors)
+            return ERRORCLASS;
+          else
+            state.tokenize = tokenBase;
+        }
+        return OUTCLASS;
+      }
+      tokenString.isString = true;
+      return tokenString;
+    }
+
+    function pushPyScope(state) {
+      while (top(state).type != "py") state.scopes.pop()
+      state.scopes.push({offset: top(state).offset + conf.indentUnit,
+                         type: "py",
+                         align: null})
+    }
+
+    function pushBracketScope(stream, state, type) {
+      var align = stream.match(/^([\s\[\{\(]|#.*)*$/, false) ? null : stream.column() + 1
+      state.scopes.push({offset: state.indent + hangingIndent,
+                         type: type,
+                         align: align})
+    }
+
+    function dedent(stream, state) {
+      var indented = stream.indentation();
+      while (state.scopes.length > 1 && top(state).offset > indented) {
+        if (top(state).type != "py") return true;
+        state.scopes.pop();
+      }
+      return top(state).offset != indented;
+    }
+
+    function tokenLexer(stream, state) {
+      if (stream.sol()) state.beginningOfLine = true;
+
+      var style = state.tokenize(stream, state);
+      var current = stream.current();
+
+      // Handle decorators
+      if (state.beginningOfLine && current == "@")
+        return stream.match(identifiers, false) ? "meta" : py3 ? "operator" : ERRORCLASS;
+
+      if (/\S/.test(current)) state.beginningOfLine = false;
+
+      if ((style == "variable" || style == "builtin")
+          && state.lastToken == "meta")
+        style = "meta";
+
+      // Handle scope changes.
+      if (current == "pass" || current == "return")
+        state.dedent += 1;
+
+      if (current == "lambda") state.lambda = true;
+      if (current == ":" && !state.lambda && top(state).type == "py")
+        pushPyScope(state);
+
+      if (current.length == 1 && !/string|comment/.test(style)) {
+        var delimiter_index = "[({".indexOf(current);
+        if (delimiter_index != -1)
+          pushBracketScope(stream, state, "])}".slice(delimiter_index, delimiter_index+1));
+
+        delimiter_index = "])}".indexOf(current);
+        if (delimiter_index != -1) {
+          if (top(state).type == current) state.indent = state.scopes.pop().offset - hangingIndent
+          else return ERRORCLASS;
+        }
+      }
+      if (state.dedent > 0 && stream.eol() && top(state).type == "py") {
+        if (state.scopes.length > 1) state.scopes.pop();
+        state.dedent -= 1;
+      }
+
+      return style;
+    }
+
+    var external = {
+      startState: function(basecolumn) {
+        return {
+          tokenize: tokenBase,
+          scopes: [{offset: basecolumn || 0, type: "py", align: null}],
+          indent: basecolumn || 0,
+          lastToken: null,
+          lambda: false,
+          dedent: 0
+        };
+      },
+
+      token: function(stream, state) {
+        var addErr = state.errorToken;
+        if (addErr) state.errorToken = false;
+        var style = tokenLexer(stream, state);
+
+        if (style && style != "comment")
+          state.lastToken = (style == "keyword" || style == "punctuation") ? stream.current() : style;
+        if (style == "punctuation") style = null;
+
+        if (stream.eol() && state.lambda)
+          state.lambda = false;
+        return addErr ? style + " " + ERRORCLASS : style;
+      },
+
+      indent: function(state, textAfter) {
+        if (state.tokenize != tokenBase)
+          return state.tokenize.isString ? CodeMirror.Pass : 0;
+
+        var scope = top(state), closing = scope.type == textAfter.charAt(0)
+        if (scope.align != null)
+          return scope.align - (closing ? 1 : 0)
+        else
+          return scope.offset - (closing ? hangingIndent : 0)
+      },
+
+      electricInput: /^\s*[\}\]\)]$/,
+      closeBrackets: {triples: "'\""},
+      lineComment: "#",
+      fold: "indent"
+    };
+    return external;
+  });
+
+  CodeMirror.defineMIME("text/x-python", "python");
+
+  var words = function(str) { return str.split(" "); };
+
+  CodeMirror.defineMIME("text/x-cython", {
+    name: "python",
+    extra_keywords: words("by cdef cimport cpdef ctypedef enum except "+
+                          "extern gil include nogil property public "+
+                          "readonly struct union DEF IF ELIF ELSE")
+  });
+
+});

Some files were not shown because too many files changed in this diff