mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-27 15:40:00 +00:00
Update the CodeMirror library to 5.9 (v 3.4.0)
Change-Id: Ia36b0573809d632c0521477cea72268b5524efae
(cherry picked from commit 7854e7c06b
)
This commit is contained in:
parent
e7c2131b6e
commit
cf6cc5f5d7
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
.svn
|
||||
*~
|
||||
*.kate-swp
|
||||
.*.swp
|
||||
.directory
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "CodeMirror",
|
||||
"version": "3.3.0",
|
||||
"version": "3.4.0",
|
||||
"author": [
|
||||
"[https://www.mediawiki.org/wiki/User:Pastakhov Pavel Astakhov]",
|
||||
"[https://www.mediawiki.org/wiki/User:Florianschmidtwelzow Florian Schmidt]"
|
||||
|
|
|
@ -91,6 +91,7 @@ Brian Sletten
|
|||
Bruce Mitchener
|
||||
Caitlin Potter
|
||||
Calin Barbat
|
||||
Chad Jolly
|
||||
Chandra Sekhar Pydi
|
||||
Charles Skelton
|
||||
Cheah Chu Yeow
|
||||
|
@ -233,6 +234,7 @@ jeffkenton
|
|||
Jeff Pickhardt
|
||||
jem (graphite)
|
||||
Jeremy Parmenter
|
||||
JobJob
|
||||
Jochen Berger
|
||||
Johan Ask
|
||||
John Connor
|
||||
|
@ -247,6 +249,7 @@ Jon Malmaud
|
|||
Jon Sangster
|
||||
Joost-Wim Boekesteijn
|
||||
Joseph Pecoraro
|
||||
Josh Cohen
|
||||
Joshua Newman
|
||||
Josh Watzman
|
||||
jots
|
||||
|
@ -259,6 +262,7 @@ Justin Hileman
|
|||
jwallers@gmail.com
|
||||
kaniga
|
||||
karevn
|
||||
Kayur Patel
|
||||
Ken Newman
|
||||
Ken Rockot
|
||||
Kevin Earls
|
||||
|
@ -437,6 +441,7 @@ SCLINIC\jdecker
|
|||
Scott Aikin
|
||||
Scott Goodhew
|
||||
Sebastian Zaha
|
||||
Sergey Goder
|
||||
Se-Won Kim
|
||||
shaund
|
||||
shaun gilchrist
|
||||
|
@ -459,12 +464,14 @@ Steffen Beyer
|
|||
Stephen Lavelle
|
||||
Steve O'Hara
|
||||
stoskov
|
||||
Stu Kennedy
|
||||
Sungho Kim
|
||||
sverweij
|
||||
Taha Jahangir
|
||||
Tako Schotanus
|
||||
Takuji Shimokawa
|
||||
Tarmil
|
||||
TDaglis
|
||||
tel
|
||||
tfjgeorge
|
||||
Thaddee Tyl
|
||||
|
|
|
@ -16,7 +16,7 @@ new functionality.
|
|||
You can find more information (and the
|
||||
[manual](http://codemirror.net/doc/manual.html)) on the [project
|
||||
page](http://codemirror.net). For questions and discussion, use the
|
||||
[discussion forum](http://discuss.codemirror.net/).
|
||||
[discussion forum](https://discuss.codemirror.net/).
|
||||
|
||||
See
|
||||
[CONTRIBUTING.md](https://github.com/codemirror/CodeMirror/blob/master/CONTRIBUTING.md)
|
||||
|
|
|
@ -28,7 +28,9 @@ CodeMirror.registerGlobalHelper("fold", "comment", function(mode) {
|
|||
continue;
|
||||
}
|
||||
if (pass == 1 && found < start.ch) return;
|
||||
if (/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1)))) {
|
||||
if (/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1))) &&
|
||||
(lineText.slice(found - endToken.length, found) == endToken ||
|
||||
!/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found))))) {
|
||||
startCh = found + startToken.length;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -295,6 +295,13 @@
|
|||
setTimeout(function(){cm.focus();}, 20);
|
||||
});
|
||||
|
||||
if (completion.options.completeOnSingleClick)
|
||||
CodeMirror.on(hints, "mousemove", function(e) {
|
||||
var elt = getHintElement(hints, e.target || e.srcElement);
|
||||
if (elt && elt.hintId != null)
|
||||
widget.changeActive(elt.hintId);
|
||||
});
|
||||
|
||||
CodeMirror.signal(data, "select", completions[0], hints.firstChild);
|
||||
return true;
|
||||
}
|
||||
|
@ -430,7 +437,7 @@
|
|||
alignWithWord: true,
|
||||
closeCharacters: /[\s()\[\]{};:>,]/,
|
||||
closeOnUnfocus: true,
|
||||
completeOnSingleClick: false,
|
||||
completeOnSingleClick: true,
|
||||
container: null,
|
||||
customKeys: null,
|
||||
extraKeys: null
|
||||
|
|
|
@ -176,3 +176,4 @@ exports.runMode = function(string, modespec, callback, options) {
|
|||
};
|
||||
|
||||
require.cache[require.resolve("../../lib/codemirror")] = require.cache[require.resolve("./runmode.node")];
|
||||
require.cache[require.resolve("../../addon/runmode/runmode")] = require.cache[require.resolve("./runmode.node")];
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
Annotation.prototype.computeScale = function() {
|
||||
var cm = this.cm;
|
||||
var hScale = (cm.getWrapperElement().clientHeight - cm.display.barHeight - this.buttonHeight * 2) /
|
||||
cm.heightAtLine(cm.lastLine() + 1, "local");
|
||||
cm.getScrollerElement().scrollHeight
|
||||
if (hScale != this.hScale) {
|
||||
this.hScale = hScale;
|
||||
return true;
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
query.lastIndex = stream.pos;
|
||||
var match = query.exec(stream.string);
|
||||
if (match && match.index == stream.pos) {
|
||||
stream.pos += match[0].length;
|
||||
stream.pos += match[0].length || 1;
|
||||
return "searching";
|
||||
} else if (match) {
|
||||
stream.pos = match.index;
|
||||
|
|
1
resources/lib/codemirror/addon/tern/tern.js
vendored
1
resources/lib/codemirror/addon/tern/tern.js
vendored
|
@ -135,6 +135,7 @@
|
|||
},
|
||||
|
||||
destroy: function () {
|
||||
closeArgHints(this)
|
||||
if (this.worker) {
|
||||
this.worker.terminate();
|
||||
this.worker = null;
|
||||
|
|
2
resources/lib/codemirror/keymap/vim.js
vendored
2
resources/lib/codemirror/keymap/vim.js
vendored
|
@ -3208,7 +3208,7 @@
|
|||
return cur;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Returns the boundaries of the next word. If the cursor in the middle of
|
||||
* the word, then returns the boundaries of the current word, starting at
|
||||
* the cursor. If the cursor is at the start/end of a word, and we are going
|
||||
|
|
56
resources/lib/codemirror/lib/codemirror.js
vendored
56
resources/lib/codemirror/lib/codemirror.js
vendored
|
@ -410,7 +410,7 @@
|
|||
if (horiz.clientWidth) scroll(horiz.scrollLeft, "horizontal");
|
||||
});
|
||||
|
||||
this.checkedOverlay = false;
|
||||
this.checkedZeroWidth = false;
|
||||
// Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
|
||||
if (ie && ie_version < 8) this.horiz.style.minHeight = this.vert.style.minWidth = "18px";
|
||||
}
|
||||
|
@ -445,29 +445,43 @@
|
|||
this.horiz.firstChild.style.width = "0";
|
||||
}
|
||||
|
||||
if (!this.checkedOverlay && measure.clientHeight > 0) {
|
||||
if (sWidth == 0) this.overlayHack();
|
||||
this.checkedOverlay = true;
|
||||
if (!this.checkedZeroWidth && measure.clientHeight > 0) {
|
||||
if (sWidth == 0) this.zeroWidthHack();
|
||||
this.checkedZeroWidth = true;
|
||||
}
|
||||
|
||||
return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0};
|
||||
},
|
||||
setScrollLeft: function(pos) {
|
||||
if (this.horiz.scrollLeft != pos) this.horiz.scrollLeft = pos;
|
||||
if (this.disableHoriz) this.enableZeroWidthBar(this.horiz, this.disableHoriz);
|
||||
},
|
||||
setScrollTop: function(pos) {
|
||||
if (this.vert.scrollTop != pos) this.vert.scrollTop = pos;
|
||||
if (this.disableVert) this.enableZeroWidthBar(this.vert, this.disableVert);
|
||||
},
|
||||
overlayHack: function() {
|
||||
zeroWidthHack: function() {
|
||||
var w = mac && !mac_geMountainLion ? "12px" : "18px";
|
||||
this.horiz.style.minHeight = this.vert.style.minWidth = w;
|
||||
var self = this;
|
||||
var barMouseDown = function(e) {
|
||||
if (e_target(e) != self.vert && e_target(e) != self.horiz)
|
||||
operation(self.cm, onMouseDown)(e);
|
||||
};
|
||||
on(this.vert, "mousedown", barMouseDown);
|
||||
on(this.horiz, "mousedown", barMouseDown);
|
||||
this.horiz.style.height = this.vert.style.width = w;
|
||||
this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none";
|
||||
this.disableHoriz = new Delayed;
|
||||
this.disableVert = new Delayed;
|
||||
},
|
||||
enableZeroWidthBar: function(bar, delay) {
|
||||
bar.style.pointerEvents = "auto";
|
||||
function maybeDisable() {
|
||||
// To find out whether the scrollbar is still visible, we
|
||||
// check whether the element under the pixel in the bottom
|
||||
// left corner of the scrollbar box is the scrollbar box
|
||||
// itself (when the bar is still visible) or its filler child
|
||||
// (when the bar is hidden). If it is still visible, we keep
|
||||
// it enabled, if it's hidden, we disable pointer events.
|
||||
var box = bar.getBoundingClientRect();
|
||||
var elt = document.elementFromPoint(box.left + 1, box.bottom - 1);
|
||||
if (elt != bar) bar.style.pointerEvents = "none";
|
||||
else delay.set(1000, maybeDisable);
|
||||
}
|
||||
delay.set(1000, maybeDisable);
|
||||
},
|
||||
clear: function() {
|
||||
var parent = this.horiz.parentNode;
|
||||
|
@ -3093,7 +3107,8 @@
|
|||
|
||||
if (cm.state.focused && op.updateInput)
|
||||
cm.display.input.reset(op.typing);
|
||||
if (op.focus && op.focus == activeElt()) ensureFocus(op.cm);
|
||||
if (op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus()))
|
||||
ensureFocus(op.cm);
|
||||
}
|
||||
|
||||
function endOperation_finish(op) {
|
||||
|
@ -3778,7 +3793,7 @@
|
|||
|
||||
// Determines whether an event happened in the gutter, and fires the
|
||||
// handlers for the corresponding event.
|
||||
function gutterEvent(cm, e, type, prevent, signalfn) {
|
||||
function gutterEvent(cm, e, type, prevent) {
|
||||
try { var mX = e.clientX, mY = e.clientY; }
|
||||
catch(e) { return false; }
|
||||
if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;
|
||||
|
@ -3795,14 +3810,14 @@
|
|||
if (g && g.getBoundingClientRect().right >= mX) {
|
||||
var line = lineAtHeight(cm.doc, mY);
|
||||
var gutter = cm.options.gutters[i];
|
||||
signalfn(cm, type, cm, line, gutter, e);
|
||||
signal(cm, type, cm, line, gutter, e);
|
||||
return e_defaultPrevented(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function clickInGutter(cm, e) {
|
||||
return gutterEvent(cm, e, "gutterClick", true, signalLater);
|
||||
return gutterEvent(cm, e, "gutterClick", true);
|
||||
}
|
||||
|
||||
// Kludge to work around strange IE behavior where it'll sometimes
|
||||
|
@ -4241,7 +4256,7 @@
|
|||
|
||||
function contextMenuInGutter(cm, e) {
|
||||
if (!hasHandler(cm, "gutterContextMenu")) return false;
|
||||
return gutterEvent(cm, e, "gutterContextMenu", false, signal);
|
||||
return gutterEvent(cm, e, "gutterContextMenu", false);
|
||||
}
|
||||
|
||||
// UPDATING
|
||||
|
@ -7074,7 +7089,7 @@
|
|||
spanEndStyle = "";
|
||||
}
|
||||
if (m.className) spanStyle += " " + m.className;
|
||||
if (m.css) css = m.css;
|
||||
if (m.css) css = (css ? css + ";" : "") + m.css;
|
||||
if (m.startStyle && sp.from == pos) spanStartStyle += " " + m.startStyle;
|
||||
if (m.endStyle && sp.to == nextChange) spanEndStyle += " " + m.endStyle;
|
||||
if (m.title && !title) title = m.title;
|
||||
|
@ -7343,6 +7358,7 @@
|
|||
this.id = ++nextDocId;
|
||||
this.modeOption = mode;
|
||||
this.lineSep = lineSep;
|
||||
this.extend = false;
|
||||
|
||||
if (typeof text == "string") text = this.splitLines(text);
|
||||
updateDoc(this, {from: start, to: start, text: text});
|
||||
|
@ -8850,7 +8866,7 @@
|
|||
|
||||
// THE END
|
||||
|
||||
CodeMirror.version = "5.8.0";
|
||||
CodeMirror.version = "5.9.0";
|
||||
|
||||
return CodeMirror;
|
||||
});
|
||||
|
|
49
resources/lib/codemirror/mode/clike/clike.js
vendored
49
resources/lib/codemirror/mode/clike/clike.js
vendored
|
@ -27,7 +27,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
indentSwitch = parserConfig.indentSwitch !== false,
|
||||
namespaceSeparator = parserConfig.namespaceSeparator,
|
||||
isPunctuationChar = parserConfig.isPunctuationChar || /[\[\]{}\(\),;\:\.]/,
|
||||
isNumberChar = parserConfig.isNumberChar || /\d/,
|
||||
numberStart = parserConfig.numberStart || /[\d\.]/,
|
||||
number = parserConfig.number || /^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,
|
||||
isOperatorChar = parserConfig.isOperatorChar || /[+\-*&%=<>!?|\/]/,
|
||||
endStatement = parserConfig.endStatement || /^[;:,]$/;
|
||||
|
||||
|
@ -47,9 +48,10 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
curPunc = ch;
|
||||
return null;
|
||||
}
|
||||
if (isNumberChar.test(ch)) {
|
||||
stream.eatWhile(/[\w\.]/);
|
||||
return "number";
|
||||
if (numberStart.test(ch)) {
|
||||
stream.backUp(1)
|
||||
if (stream.match(number)) return "number"
|
||||
stream.next()
|
||||
}
|
||||
if (ch == "/") {
|
||||
if (stream.eat("*")) {
|
||||
|
@ -220,6 +222,10 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
}
|
||||
var closing = firstChar == ctx.type;
|
||||
var switchBlock = ctx.prev && ctx.prev.type == "switchstatement";
|
||||
if (parserConfig.allmanIndentation && /[{(]/.test(firstChar)) {
|
||||
while (ctx.type != "top" && ctx.type != "}") ctx = ctx.prev
|
||||
return ctx.indented
|
||||
}
|
||||
if (isStatement(ctx.type))
|
||||
return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
|
||||
if (ctx.align && (!dontAlignCalls || ctx.type != ")"))
|
||||
|
@ -252,8 +258,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
}
|
||||
}
|
||||
var cKeywords = "auto if break case register continue return default do sizeof " +
|
||||
"static else struct switch extern typedef float union for " +
|
||||
"goto while enum const volatile";
|
||||
"static else struct switch extern typedef union for goto while enum const volatile";
|
||||
var cTypes = "int long char short double float unsigned signed void size_t ptrdiff_t";
|
||||
|
||||
function cppHook(stream, state) {
|
||||
|
@ -530,19 +535,36 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
modeProps: {closeBrackets: {triples: '"'}}
|
||||
});
|
||||
|
||||
function tokenKotlinString(tripleString){
|
||||
return function (stream, state) {
|
||||
var escaped = false, next, end = false;
|
||||
while (!stream.eol()) {
|
||||
if (!tripleString && !escaped && stream.match('"') ) {end = true; break;}
|
||||
if (tripleString && stream.match('"""')) {end = true; break;}
|
||||
next = stream.next();
|
||||
if(!escaped && next == "$" && stream.match('{'))
|
||||
stream.skipTo("}");
|
||||
escaped = !escaped && next == "\\" && !tripleString;
|
||||
}
|
||||
if (end || !tripleString)
|
||||
state.tokenize = null;
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
||||
def("text/x-kotlin", {
|
||||
name: "clike",
|
||||
keywords: words(
|
||||
/*keywords*/
|
||||
"package as typealias class interface this super val " +
|
||||
"var fun for is in This throw return " +
|
||||
"break continue object if else while do try when !in !is as?" +
|
||||
"break continue object if else while do try when !in !is as? " +
|
||||
|
||||
/*soft keywords*/
|
||||
"file import where by get set abstract enum open inner override private public internal " +
|
||||
"protected catch finally out final vararg reified dynamic companion constructor init " +
|
||||
"sealed field property receiver param sparam lateinit data inline noinline tailrec " +
|
||||
"external annotation crossinline"
|
||||
"external annotation crossinline const operator infix"
|
||||
),
|
||||
types: words(
|
||||
/* package java.lang */
|
||||
|
@ -551,10 +573,18 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
"Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " +
|
||||
"StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"
|
||||
),
|
||||
intendSwitch: false,
|
||||
indentStatements: false,
|
||||
multiLineStrings: true,
|
||||
blockKeywords: words("catch class do else finally for if where try while enum"),
|
||||
defKeywords: words("class val var object package interface fun"),
|
||||
atoms: words("true false null this"),
|
||||
hooks: {
|
||||
'"': function(stream, state) {
|
||||
state.tokenize = tokenKotlinString(stream.match('""'));
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
},
|
||||
modeProps: {closeBrackets: {triples: '"'}}
|
||||
});
|
||||
|
||||
|
@ -703,7 +733,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
" native optional sealed see serializable shared suppressWarnings tagged throws variable"),
|
||||
isPunctuationChar: /[\[\]{}\(\),;\:\.`]/,
|
||||
isOperatorChar: /[+\-*&%=<>!?|^~:\/]/,
|
||||
isNumberChar: /[\d#$]/,
|
||||
numberStart: /[\d#$]/,
|
||||
number: /^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,
|
||||
multiLineStrings: true,
|
||||
typeFirstDefinitions: true,
|
||||
atoms: words("true false null larger smaller equal empty finished"),
|
||||
|
|
2
resources/lib/codemirror/mode/css/css.js
vendored
2
resources/lib/codemirror/mode/css/css.js
vendored
|
@ -228,7 +228,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
|
|||
if (type == "}" || type == "{") return popAndPass(type, stream, state);
|
||||
if (type == "(") return pushContext(state, stream, "parens");
|
||||
|
||||
if (type == "hash" && !/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(stream.current())) {
|
||||
if (type == "hash" && !/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(stream.current())) {
|
||||
override += " error";
|
||||
} else if (type == "word") {
|
||||
wordAsValue(stream);
|
||||
|
|
10
resources/lib/codemirror/mode/css/test.js
vendored
10
resources/lib/codemirror/mode/css/test.js
vendored
|
@ -55,11 +55,17 @@
|
|||
MT("tagColorHex3",
|
||||
"[tag foo] { [property background]: [atom #fff]; }");
|
||||
|
||||
MT("tagColorHex4",
|
||||
"[tag foo] { [property background]: [atom #ffff]; }");
|
||||
|
||||
MT("tagColorHex6",
|
||||
"[tag foo] { [property background]: [atom #ffffff]; }");
|
||||
|
||||
MT("tagColorHex4",
|
||||
"[tag foo] { [property background]: [atom&error #ffff]; }");
|
||||
MT("tagColorHex8",
|
||||
"[tag foo] { [property background]: [atom #ffffffff]; }");
|
||||
|
||||
MT("tagColorHex5Invalid",
|
||||
"[tag foo] { [property background]: [atom&error #fffff]; }");
|
||||
|
||||
MT("tagColorHexInvalid",
|
||||
"[tag foo] { [property background]: [atom&error #ffg]; }");
|
||||
|
|
6
resources/lib/codemirror/mode/dart/dart.js
vendored
6
resources/lib/codemirror/mode/dart/dart.js
vendored
|
@ -15,7 +15,7 @@
|
|||
"implements get native operator set typedef with enum throw rethrow " +
|
||||
"assert break case continue default in return new deferred async await " +
|
||||
"try catch finally do else for if switch while import library export " +
|
||||
"part of show hide is").split(" ");
|
||||
"part of show hide is as").split(" ");
|
||||
var blockKeywords = "try catch finally do else for if switch while".split(" ");
|
||||
var atoms = "true false null".split(" ");
|
||||
var builtins = "void bool num int double dynamic var String".split(" ");
|
||||
|
@ -46,7 +46,7 @@
|
|||
atoms: set(atoms),
|
||||
hooks: {
|
||||
"@": function(stream) {
|
||||
stream.eatWhile(/[\w\$_]/);
|
||||
stream.eatWhile(/[\w\$_\.]/);
|
||||
return "meta";
|
||||
},
|
||||
|
||||
|
@ -95,7 +95,7 @@
|
|||
state.tokenize = null;
|
||||
break;
|
||||
}
|
||||
escaped = !escaped && next == "\\";
|
||||
escaped = !raw && !escaped && next == "\\";
|
||||
}
|
||||
return "string";
|
||||
}
|
||||
|
|
16
resources/lib/codemirror/mode/django/django.js
vendored
16
resources/lib/codemirror/mode/django/django.js
vendored
|
@ -14,14 +14,14 @@
|
|||
"use strict";
|
||||
|
||||
CodeMirror.defineMode("django:inner", function() {
|
||||
var keywords = ["block", "endblock", "for", "endfor", "true", "false",
|
||||
"loop", "none", "self", "super", "if", "endif", "as",
|
||||
"else", "import", "with", "endwith", "without", "context", "ifequal", "endifequal",
|
||||
"ifnotequal", "endifnotequal", "extends", "include", "load", "comment",
|
||||
"endcomment", "empty", "url", "static", "trans", "blocktrans", "now", "regroup",
|
||||
"lorem", "ifchanged", "endifchanged", "firstof", "debug", "cycle", "csrf_token",
|
||||
"autoescape", "endautoescape", "spaceless", "ssi", "templatetag",
|
||||
"verbatim", "endverbatim", "widthratio"],
|
||||
var keywords = ["block", "endblock", "for", "endfor", "true", "false", "filter", "endfilter",
|
||||
"loop", "none", "self", "super", "if", "elif", "endif", "as", "else", "import",
|
||||
"with", "endwith", "without", "context", "ifequal", "endifequal", "ifnotequal",
|
||||
"endifnotequal", "extends", "include", "load", "comment", "endcomment",
|
||||
"empty", "url", "static", "trans", "blocktrans", "endblocktrans", "now",
|
||||
"regroup", "lorem", "ifchanged", "endifchanged", "firstof", "debug", "cycle",
|
||||
"csrf_token", "autoescape", "endautoescape", "spaceless", "endspaceless",
|
||||
"ssi", "templatetag", "verbatim", "endverbatim", "widthratio"],
|
||||
filters = ["add", "addslashes", "capfirst", "center", "cut", "date",
|
||||
"default", "default_if_none", "dictsort",
|
||||
"dictsortreversed", "divisibleby", "escape", "escapejs",
|
||||
|
|
6
resources/lib/codemirror/mode/haml/haml.js
vendored
6
resources/lib/codemirror/mode/haml/haml.js
vendored
|
@ -85,8 +85,10 @@
|
|||
state.tokenize = rubyInQuote(")");
|
||||
return state.tokenize(stream, state);
|
||||
} else if (ch == "{") {
|
||||
state.tokenize = rubyInQuote("}");
|
||||
return state.tokenize(stream, state);
|
||||
if (!stream.match(/^\{%.*/)) {
|
||||
state.tokenize = rubyInQuote("}");
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
{ regex: /\}\}/, pop: true, token: "tag" },
|
||||
|
||||
// Double and single quotes
|
||||
{ regex: /"(?:[^\\]|\\.)*?"/, token: "string" },
|
||||
{ regex: /'(?:[^\\]|\\.)*?'/, token: "string" },
|
||||
{ regex: /"(?:[^\\"]|\\.)*"?/, token: "string" },
|
||||
{ regex: /'(?:[^\\']|\\.)*'?/, token: "string" },
|
||||
|
||||
// Handlebars keywords
|
||||
{ regex: />|[#\/]([A-Za-z_]\w*)/, token: "keyword" },
|
||||
|
|
|
@ -32,12 +32,12 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
"if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
|
||||
"return": C, "break": C, "continue": C, "new": kw("new"), "delete": C, "throw": C, "debugger": C,
|
||||
"var": kw("var"), "const": kw("var"), "let": kw("var"),
|
||||
"async": kw("async"), "function": kw("function"), "catch": kw("catch"),
|
||||
"function": kw("function"), "catch": kw("catch"),
|
||||
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
|
||||
"in": operator, "typeof": operator, "instanceof": operator,
|
||||
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
|
||||
"this": kw("this"), "class": kw("class"), "super": kw("atom"),
|
||||
"await": C, "yield": C, "export": kw("export"), "import": kw("import"), "extends": C
|
||||
"yield": C, "export": kw("export"), "import": kw("import"), "extends": C
|
||||
};
|
||||
|
||||
// Extend the 'normal' keywords with the TypeScript language extensions
|
||||
|
@ -121,8 +121,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
} else if (stream.eat("/")) {
|
||||
stream.skipToEnd();
|
||||
return ret("comment", "comment");
|
||||
} else if (state.lastType == "operator" || state.lastType == "keyword c" ||
|
||||
state.lastType == "sof" || /^[\[{}\(,;:]$/.test(state.lastType)) {
|
||||
} else if (/^(?:operator|sof|keyword c|case|new|[\[{}\(,;:])$/.test(state.lastType)) {
|
||||
readRegexp(stream);
|
||||
stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);
|
||||
return ret("regexp", "string-2");
|
||||
|
@ -373,7 +372,6 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
|
||||
var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
|
||||
if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
|
||||
if (type == "async") return cont(expression);
|
||||
if (type == "function") return cont(functiondef, maybeop);
|
||||
if (type == "keyword c") return cont(noComma ? maybeexpressionNoComma : maybeexpression);
|
||||
if (type == "(") return cont(pushlex(")"), maybeexpression, comprehension, expect(")"), poplex, maybeop);
|
||||
|
@ -452,9 +450,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
if (type == "variable") {cx.marked = "property"; return cont();}
|
||||
}
|
||||
function objprop(type, value) {
|
||||
if (type == "async") {
|
||||
return cont(objprop);
|
||||
} else if (type == "variable" || cx.style == "keyword") {
|
||||
if (type == "variable" || cx.style == "keyword") {
|
||||
cx.marked = "property";
|
||||
if (value == "get" || value == "set") return cont(getterSetter);
|
||||
return cont(afterprop);
|
||||
|
@ -465,6 +461,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
return cont(afterprop);
|
||||
} else if (type == "[") {
|
||||
return cont(expression, expect("]"), afterprop);
|
||||
} else if (type == "spread") {
|
||||
return cont(expression);
|
||||
}
|
||||
}
|
||||
function getterSetter(type) {
|
||||
|
|
2
resources/lib/codemirror/mode/julia/julia.js
vendored
2
resources/lib/codemirror/mode/julia/julia.js
vendored
|
@ -283,7 +283,7 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
|
|||
if(textAfter=="end" || textAfter=="]" || textAfter=="}" || textAfter=="else" || textAfter=="elseif" || textAfter=="catch" || textAfter=="finally") {
|
||||
delta = -1;
|
||||
}
|
||||
return (state.scopes.length + delta) * 4;
|
||||
return (state.scopes.length + delta) * _conf.indentUnit;
|
||||
},
|
||||
|
||||
lineComment: "#",
|
||||
|
|
|
@ -712,7 +712,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
f: s.f,
|
||||
|
||||
prevLine: s.prevLine,
|
||||
thisLine: s.this,
|
||||
thisLine: s.thisLine,
|
||||
|
||||
block: s.block,
|
||||
htmlState: s.htmlState && CodeMirror.copyState(htmlMode, s.htmlState),
|
||||
|
|
20
resources/lib/codemirror/mode/nsis/index.html
vendored
20
resources/lib/codemirror/mode/nsis/index.html
vendored
|
@ -38,14 +38,32 @@
|
|||
|
||||
OutFile "demo.exe"
|
||||
RequestExecutionLevel user
|
||||
SetDetailsPrint listonly
|
||||
|
||||
!include "LogicLib.nsh"
|
||||
!include "WinVer.nsh"
|
||||
|
||||
Section -mandatory
|
||||
|
||||
Call logWinVer
|
||||
|
||||
${If} 1 > 0
|
||||
MessageBox MB_OK "Hello world"
|
||||
${EndIf}
|
||||
|
||||
SectionEnd
|
||||
|
||||
Function logWinVer
|
||||
|
||||
${If} ${IsWin10}
|
||||
DetailPrint "Windows 10!"
|
||||
${ElseIf} ${AtLeastWinVista}
|
||||
DetailPrint "We're post-XP"
|
||||
${Else}
|
||||
DetailPrint "Legacy system"
|
||||
${EndIf}
|
||||
|
||||
FunctionEnd
|
||||
</textarea>
|
||||
|
||||
<script>
|
||||
|
@ -59,4 +77,4 @@ SectionEnd
|
|||
</script>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>text/x-nsis</code>.</p>
|
||||
</article>
|
||||
</article>
|
42
resources/lib/codemirror/mode/nsis/nsis.js
vendored
42
resources/lib/codemirror/mode/nsis/nsis.js
vendored
|
@ -17,33 +17,65 @@ CodeMirror.defineSimpleMode("nsis",{
|
|||
start:[
|
||||
// Numbers
|
||||
{regex: /(?:[+-]?)(?:0x[\d,a-f]+)|(?:0o[0-7]+)|(?:0b[0,1]+)|(?:\d+.?\d*)/, token: "number"},
|
||||
|
||||
// Strings
|
||||
{ regex: /"(?:[^\\"]|\\.)*"?/, token: "string" },
|
||||
{ regex: /'(?:[^\\']|\\.)*'?/, token: "string" },
|
||||
{ regex: /`(?:[^\\`]|\\.)*`?/, token: "string" },
|
||||
|
||||
// Compile Time Commands
|
||||
{regex: /(?:\!(include|addincludedir|addplugindir|appendfile|cd|delfile|echo|error|execute|packhdr|finalize|getdllversion|system|tempfile|warning|verbose|define|undef|insertmacro|makensis|searchparse|searchreplace))\b/, token: "keyword"},
|
||||
|
||||
// Conditional Compilation
|
||||
{regex: /(?:\!(if(?:n?def)?|ifmacron?def|macro))\b/, token: "keyword", indent: true},
|
||||
{regex: /(?:\!(else|endif|macroend))\b/, token: "keyword", dedent: true},
|
||||
|
||||
// Runtime Commands
|
||||
{regex: /(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetLabelAddress|GetTempFileName|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|IntCmp|IntCmpU|IntFmt|IntOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetPluginUnload|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegStr|WriteUninstaller|XPStyle)\b/, token: "keyword"},
|
||||
{regex: /\b(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetLabelAddress|GetTempFileName|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|IntCmp|IntCmpU|IntFmt|IntOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetPluginUnload|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegStr|WriteUninstaller|XPStyle)\b/, token: "keyword"},
|
||||
{regex: /\b(?:Function|PageEx|Section(?:Group)?)\b/, token: "keyword", indent: true},
|
||||
{regex: /\b(?:(Function|PageEx|Section(?:Group)?)End)\b/, token: "keyword", dedent: true},
|
||||
// Options
|
||||
|
||||
// Command Options
|
||||
{regex: /\b(?:ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HIDDEN|HKCC|HKCR|HKCU|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM|HKPD|HKU|IDABORT|IDCANCEL|IDD_DIR|IDD_INST|IDD_INSTFILES|IDD_LICENSE|IDD_SELCOM|IDD_UNINST|IDD_VERIFY|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|MB_YESNOCANCEL|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SW_HIDE|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWNORMAL|SYSTEM|TEMPORARY)\b/, token: "atom"},
|
||||
{regex: /\b(?:admin|all|auto|both|bottom|bzip2|components|current|custom|directory|force|hide|highest|ifdiff|ifnewer|instfiles|lastused|leave|left|license|listonly|lzma|nevershow|none|normal|notset|right|show|silent|silentlog|textonly|top|try|un\.components|un\.custom|un\.directory|un\.instfiles|un\.license|uninstConfirm|user|Win10|Win7|Win8|WinVista|zlib)\b/, token: "builtin"},
|
||||
|
||||
// LogicLib
|
||||
{regex: /\$\{(?:End(If|Unless|While)|Loop(?:Until)|Next)\}/, token: "variable-2", dedent: true},
|
||||
{regex: /\$\{(?:Do(Until|While)|Else(?:If(?:Not)?)?|For(?:Each)?|(?:(?:And|Else|Or)?If(?:Cmd|Not|Then)?|Unless)|While)\}/, token: "variable-2", indent: true},
|
||||
// LogicLib.nsh
|
||||
{regex: /\$\{(?:And(?:If(?:Not)?|Unless)|Break|Case(?:Else)?|Continue|Default|Do(?:Until|While)?|Else(?:If(?:Not)?|Unless)?|End(?:If|Select|Switch)|Exit(?:Do|For|While)|For(?:Each)?|If(?:Cmd|Not(?:Then)?|Then)?|Loop(?:Until|While)?|Or(?:If(?:Not)?|Unless)|Select|Switch|Unless|While)\}/, token: "variable-2", indent: true},
|
||||
|
||||
// FileFunc.nsh
|
||||
{regex: /\$\{(?:BannerTrimPath|DirState|DriveSpace|Get(BaseName|Drives|ExeName|ExePath|FileAttributes|FileExt|FileName|FileVersion|Options|OptionsS|Parameters|Parent|Root|Size|Time)|Locate|RefreshShellIcons)\}/, token: "variable-2", dedent: true},
|
||||
|
||||
// Memento.nsh
|
||||
{regex: /\$\{(?:Memento(?:Section(?:Done|End|Restore|Save)?|UnselectedSection))\}/, token: "variable-2", dedent: true},
|
||||
|
||||
// TextFunc.nsh
|
||||
{regex: /\$\{(?:Config(?:Read|ReadS|Write|WriteS)|File(?:Join|ReadFromEnd|Recode)|Line(?:Find|Read|Sum)|Text(?:Compare|CompareS)|TrimNewLines)\}/, token: "variable-2", dedent: true},
|
||||
|
||||
// WinVer.nsh
|
||||
{regex: /\$\{(?:(?:At(?:Least|Most)|Is)(?:ServicePack|Win(?:7|8|10|95|98|200(?:0|3|8(?:R2)?)|ME|NT4|Vista|XP))|Is(?:NT|Server))\}/, token: "variable", dedent: true},
|
||||
|
||||
// WordFunc.nsh
|
||||
{regex: /\$\{(?:StrFilterS?|Version(?:Compare|Convert)|Word(?:AddS?|Find(?:(?:2|3)X)?S?|InsertS?|ReplaceS?))\}/, token: "variable-2", dedent: true},
|
||||
|
||||
// x64.nsh
|
||||
{regex: /\$\{(?:RunningX64)\}/, token: "variable", dedent: true},
|
||||
{regex: /\$\{(?:Disable|Enable)X64FSRedirection\}/, token: "variable-2", dedent: true},
|
||||
|
||||
// Line Comment
|
||||
{regex: /(#|;).*/, token: "comment"},
|
||||
|
||||
// Block Comment
|
||||
{regex: /\/\*/, token: "comment", next: "comment"},
|
||||
|
||||
// Operator
|
||||
{regex: /[-+\/*=<>!]+/, token: "operator"},
|
||||
|
||||
// Variable
|
||||
{regex: /\$[\w]+/, token: "variable"},
|
||||
|
||||
// Constant
|
||||
{regex: /\${[\w]+}/,token: "variable-2"},
|
||||
|
||||
// Language String
|
||||
{regex: /\$\([\w]+\)/,token: "variable-3"}
|
||||
],
|
||||
|
|
45
resources/lib/codemirror/mode/python/python.js
vendored
45
resources/lib/codemirror/mode/python/python.js
vendored
|
@ -48,18 +48,18 @@
|
|||
CodeMirror.defineMode("python", function(conf, parserConf) {
|
||||
var ERRORCLASS = "error";
|
||||
|
||||
var singleDelimiters = parserConf.singleDelimiters || new RegExp("^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]");
|
||||
var doubleOperators = parserConf.doubleOperators || new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))");
|
||||
var doubleDelimiters = parserConf.doubleDelimiters || new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
|
||||
var tripleDelimiters = parserConf.tripleDelimiters || new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");
|
||||
var singleDelimiters = parserConf.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.]/;
|
||||
var doubleOperators = parserConf.doubleOperators || /^([!<>]==|<>|<<|>>|\/\/|\*\*)/;
|
||||
var doubleDelimiters = parserConf.doubleDelimiters || /^(\+=|\-=|\*=|%=|\/=|&=|\|=|\^=)/;
|
||||
var tripleDelimiters = parserConf.tripleDelimiters || /^(\/\/=|>>=|<<=|\*\*=)/;
|
||||
|
||||
if (parserConf.version && parseInt(parserConf.version, 10) == 3){
|
||||
// since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator
|
||||
var singleOperators = parserConf.singleOperators || new RegExp("^[\\+\\-\\*/%&|\\^~<>!@]");
|
||||
var identifiers = parserConf.identifiers|| new RegExp("^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*");
|
||||
var singleOperators = parserConf.singleOperators || /^[\+\-\*\/%&|\^~<>!@]/;
|
||||
var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;
|
||||
} else {
|
||||
var singleOperators = parserConf.singleOperators || new RegExp("^[\\+\\-\\*/%&|\\^~<>!]");
|
||||
var identifiers = parserConf.identifiers|| new RegExp("^[_A-Za-z][_A-Za-z0-9]*");
|
||||
var singleOperators = parserConf.singleOperators || /^[\+\-\*\/%&|\^~<>!]/;
|
||||
var identifiers = parserConf.identifiers|| /^[_A-Za-z][_A-Za-z0-9]*/;
|
||||
}
|
||||
|
||||
var hangingIndent = parserConf.hangingIndent || conf.indentUnit;
|
||||
|
@ -160,13 +160,16 @@
|
|||
|
||||
// Handle operators and Delimiters
|
||||
if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters))
|
||||
return null;
|
||||
return "punctuation";
|
||||
|
||||
if (stream.match(doubleOperators) || stream.match(singleOperators))
|
||||
return "operator";
|
||||
|
||||
if (stream.match(singleDelimiters))
|
||||
return null;
|
||||
return "punctuation";
|
||||
|
||||
if (state.lastToken == "." && stream.match(identifiers))
|
||||
return "property";
|
||||
|
||||
if (stream.match(keywords) || stream.match(wordOperators))
|
||||
return "keyword";
|
||||
|
@ -246,17 +249,6 @@
|
|||
var style = state.tokenize(stream, state);
|
||||
var current = stream.current();
|
||||
|
||||
// Handle '.' connected identifiers
|
||||
if (current == ".") {
|
||||
style = stream.match(identifiers, false) ? null : ERRORCLASS;
|
||||
if (style == null && state.lastStyle == "meta") {
|
||||
// Apply 'meta' style to '.' connected identifiers when
|
||||
// appropriate.
|
||||
style = "meta";
|
||||
}
|
||||
return style;
|
||||
}
|
||||
|
||||
// Handle decorators
|
||||
if (current == "@"){
|
||||
if(parserConf.version && parseInt(parserConf.version, 10) == 3){
|
||||
|
@ -267,7 +259,7 @@
|
|||
}
|
||||
|
||||
if ((style == "variable" || style == "builtin")
|
||||
&& state.lastStyle == "meta")
|
||||
&& state.lastToken == "meta")
|
||||
style = "meta";
|
||||
|
||||
// Handle scope changes.
|
||||
|
@ -300,7 +292,6 @@
|
|||
return {
|
||||
tokenize: tokenBase,
|
||||
scopes: [{offset: basecolumn || 0, type: "py", align: null}],
|
||||
lastStyle: null,
|
||||
lastToken: null,
|
||||
lambda: false,
|
||||
dedent: 0
|
||||
|
@ -312,11 +303,9 @@
|
|||
if (addErr) state.errorToken = false;
|
||||
var style = tokenLexer(stream, state);
|
||||
|
||||
state.lastStyle = style;
|
||||
|
||||
var current = stream.current();
|
||||
if (current && style)
|
||||
state.lastToken = current;
|
||||
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;
|
||||
|
|
19
resources/lib/codemirror/mode/rust/rust.js
vendored
19
resources/lib/codemirror/mode/rust/rust.js
vendored
|
@ -12,11 +12,12 @@
|
|||
"use strict";
|
||||
|
||||
CodeMirror.defineSimpleMode("rust",{
|
||||
start:[
|
||||
start: [
|
||||
// string and byte string
|
||||
{regex: /b?"(?:[^\\]|\\.)*?"/, token: "string"},
|
||||
{regex: /b?"/, token: "string", next: "string"},
|
||||
// raw string and raw byte string
|
||||
{regex: /(b?r)(#*)(".*?)("\2)/, token: ["string", "string", "string", "string"]},
|
||||
{regex: /b?r"/, token: "string", next: "string_raw"},
|
||||
{regex: /b?r#+"/, token: "string", next: "string_raw_hash"},
|
||||
// character
|
||||
{regex: /'(?:[^'\\]|\\(?:[nrt0'"]|x[\da-fA-F]{2}|u\{[\da-fA-F]{6}\}))'/, token: "string-2"},
|
||||
// byte
|
||||
|
@ -39,6 +40,18 @@ CodeMirror.defineSimpleMode("rust",{
|
|||
{regex: /[\{\[\(]/, indent: true},
|
||||
{regex: /[\}\]\)]/, dedent: true}
|
||||
],
|
||||
string: [
|
||||
{regex: /"/, token: "string", next: "start"},
|
||||
{regex: /(?:[^\\"]|\\(?:.|$))*/, token: "string"}
|
||||
],
|
||||
string_raw: [
|
||||
{regex: /"/, token: "string", next: "start"},
|
||||
{regex: /[^"]*/, token: "string"}
|
||||
],
|
||||
string_raw_hash: [
|
||||
{regex: /"#+/, token: "string", next: "start"},
|
||||
{regex: /(?:[^"]|"(?!#))*/, token: "string"}
|
||||
],
|
||||
comment: [
|
||||
{regex: /.*?\*\//, token: "comment", next: "start"},
|
||||
{regex: /.*/, token: "comment"}
|
||||
|
|
1
resources/lib/codemirror/mode/rust/test.js
vendored
1
resources/lib/codemirror/mode/rust/test.js
vendored
|
@ -26,7 +26,6 @@
|
|||
'[string "\\"foo\\""]',
|
||||
'[string r#""foo""#]',
|
||||
'[string "foo #\\"# bar"]',
|
||||
'[string r##"foo #"# bar"##]',
|
||||
|
||||
'[string b"foo"]',
|
||||
'[string br"foo"]',
|
||||
|
|
2
resources/lib/codemirror/mode/sql/sql.js
vendored
2
resources/lib/codemirror/mode/sql/sql.js
vendored
|
@ -257,7 +257,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
|
|||
}
|
||||
|
||||
// these keywords are used by all SQL dialects (however, a mode can still overwrite it)
|
||||
var sqlKeywords = "alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where ";
|
||||
var sqlKeywords = "alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where limit";
|
||||
|
||||
// turn a space-separated list into an array
|
||||
function set(str) {
|
||||
|
|
8
resources/lib/codemirror/theme/material.css
vendored
8
resources/lib/codemirror/theme/material.css
vendored
|
@ -32,10 +32,6 @@
|
|||
.cm-s-material .cm-atom { color: #F77669; }
|
||||
.cm-s-material .cm-number { color: #F77669; }
|
||||
.cm-s-material .cm-def { color: rgba(233, 237, 237, 1); }
|
||||
.cm-s-material .cm-error {
|
||||
color: rgba(255, 255, 255, 1.0);
|
||||
background-color: #EC5F67;
|
||||
}
|
||||
.cm-s-material .cm-string { color: #C3E88D; }
|
||||
.cm-s-material .cm-string-2 { color: #80CBC4; }
|
||||
.cm-s-material .cm-comment { color: #546E7A; }
|
||||
|
@ -47,6 +43,10 @@
|
|||
.cm-s-material .cm-qualifier { color: #DECB6B; }
|
||||
.cm-s-material .cm-variable-3 { color: #DECB6B; }
|
||||
.cm-s-material .cm-tag { color: rgba(255, 83, 112, 1); }
|
||||
.cm-s-material .cm-error {
|
||||
color: rgba(255, 255, 255, 1.0);
|
||||
background-color: #EC5F67;
|
||||
}
|
||||
.cm-s-material .CodeMirror-matchingbracket {
|
||||
text-decoration: underline;
|
||||
color: white !important;
|
||||
|
|
Loading…
Reference in a new issue