the class "CodeMirror-activeline-background".
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -21,16 +15,18 @@
var GUTT_CLASS = "CodeMirror-activeline-gutter";
CodeMirror.defineOption("styleActiveLine", false, function(cm, val, old) {
- var prev = old && old != CodeMirror.Init;
- if (val && !prev) {
- cm.state.activeLines = [];
- updateActiveLines(cm, cm.listSelections());
- cm.on("beforeSelectionChange", selectionChange);
- } else if (!val && prev) {
+ var prev = old == CodeMirror.Init ? false : old;
+ if (val == prev) return
+ if (prev) {
cm.off("beforeSelectionChange", selectionChange);
clearActiveLines(cm);
delete cm.state.activeLines;
}
+ if (val) {
+ cm.state.activeLines = [];
+ updateActiveLines(cm, cm.listSelections());
+ cm.on("beforeSelectionChange", selectionChange);
+ }
});
function clearActiveLines(cm) {
@@ -52,7 +48,9 @@
var active = [];
for (var i = 0; i < ranges.length; i++) {
var range = ranges[i];
- if (!range.empty()) continue;
+ var option = cm.getOption("styleActiveLine");
+ if (typeof option == "object" && option.nonEmpty ? range.anchor.line != range.head.line : !range.empty())
+ continue
var line = cm.getLineHandleVisualStart(range.head.line);
if (active[active.length - 1] != line) active.push(line);
}
diff --git a/vendor/assets/javascripts/codemirror/addons/selection/mark-selection.js b/vendor/assets/javascripts/codemirror/addons/selection/mark-selection.js
index 5c42d21..adfaa62 100644
--- a/vendor/assets/javascripts/codemirror/addons/selection/mark-selection.js
+++ b/vendor/assets/javascripts/codemirror/addons/selection/mark-selection.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
// Because sometimes you need to mark the selected *text*.
//
@@ -34,11 +34,12 @@
});
function onCursorActivity(cm) {
- cm.operation(function() { update(cm); });
+ if (cm.state.markedSelection)
+ cm.operation(function() { update(cm); });
}
function onChange(cm) {
- if (cm.state.markedSelection.length)
+ if (cm.state.markedSelection && cm.state.markedSelection.length)
cm.operation(function() { clear(cm); });
}
@@ -85,7 +86,7 @@
if (!array.length) return coverRange(cm, from, to);
var coverStart = array[0].find(), coverEnd = array[array.length - 1].find();
- if (!coverStart || !coverEnd || to.line - from.line < CHUNK_SIZE ||
+ if (!coverStart || !coverEnd || to.line - from.line <= CHUNK_SIZE ||
cmp(from, coverEnd.to) >= 0 || cmp(to, coverStart.from) <= 0)
return reset(cm);
diff --git a/vendor/assets/javascripts/codemirror/addons/selection/selection-pointer.js b/vendor/assets/javascripts/codemirror/addons/selection/selection-pointer.js
index ef5e404..f0bd61a 100644
--- a/vendor/assets/javascripts/codemirror/addons/selection/selection-pointer.js
+++ b/vendor/assets/javascripts/codemirror/addons/selection/selection-pointer.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/addons/tern/tern.js b/vendor/assets/javascripts/codemirror/addons/tern/tern.js
index efdf2ed..253309d 100644
--- a/vendor/assets/javascripts/codemirror/addons/tern/tern.js
+++ b/vendor/assets/javascripts/codemirror/addons/tern/tern.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
// Glue code between CodeMirror and Tern.
//
@@ -334,7 +334,11 @@
tip.appendChild(document.createTextNode(tp.rettype ? ") ->\u00a0" : ")"));
if (tp.rettype) tip.appendChild(elt("span", cls + "type", tp.rettype));
var place = cm.cursorCoords(null, "page");
- ts.activeArgHints = makeTooltip(place.right + 1, place.bottom, tip);
+ var tooltip = ts.activeArgHints = makeTooltip(place.right + 1, place.bottom, tip)
+ setTimeout(function() {
+ tooltip.clear = onEditorActivity(cm, function() {
+ if (ts.activeArgHints == tooltip) closeArgHints(ts) })
+ }, 20)
}
function parseFnType(text) {
@@ -567,7 +571,7 @@
return {type: "part",
name: data.name,
offsetLines: from.line,
- text: doc.getRange(from, Pos(endLine, 0))};
+ text: doc.getRange(from, Pos(endLine, end.line == endLine ? null : 0))};
}
// Generic utilities
@@ -604,24 +608,33 @@
}
function clear() {
cm.state.ternTooltip = null;
- if (!tip.parentNode) return;
- cm.off("cursorActivity", clear);
- cm.off('blur', clear);
- cm.off('scroll', clear);
- fadeOut(tip);
+ if (tip.parentNode) fadeOut(tip)
+ clearActivity()
}
var mouseOnTip = false, old = false;
CodeMirror.on(tip, "mousemove", function() { mouseOnTip = true; });
CodeMirror.on(tip, "mouseout", function(e) {
- if (!CodeMirror.contains(tip, e.relatedTarget || e.toElement)) {
+ var related = e.relatedTarget || e.toElement
+ if (!related || !CodeMirror.contains(tip, related)) {
if (old) clear();
else mouseOnTip = false;
}
});
setTimeout(maybeClear, ts.options.hintDelay ? ts.options.hintDelay : 1700);
- cm.on("cursorActivity", clear);
- cm.on('blur', clear);
- cm.on('scroll', clear);
+ var clearActivity = onEditorActivity(cm, clear)
+ }
+
+ function onEditorActivity(cm, f) {
+ cm.on("cursorActivity", f)
+ cm.on("blur", f)
+ cm.on("scroll", f)
+ cm.on("setDoc", f)
+ return function() {
+ cm.off("cursorActivity", f)
+ cm.off("blur", f)
+ cm.off("scroll", f)
+ cm.off("setDoc", f)
+ }
}
function makeTooltip(x, y, content) {
@@ -650,7 +663,11 @@
}
function closeArgHints(ts) {
- if (ts.activeArgHints) { remove(ts.activeArgHints); ts.activeArgHints = null; }
+ if (ts.activeArgHints) {
+ if (ts.activeArgHints.clear) ts.activeArgHints.clear()
+ remove(ts.activeArgHints)
+ ts.activeArgHints = null
+ }
}
function docValue(ts, doc) {
diff --git a/vendor/assets/javascripts/codemirror/addons/tern/worker.js b/vendor/assets/javascripts/codemirror/addons/tern/worker.js
index 887f906..e134ad4 100644
--- a/vendor/assets/javascripts/codemirror/addons/tern/worker.js
+++ b/vendor/assets/javascripts/codemirror/addons/tern/worker.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
// declare global: tern, server
diff --git a/vendor/assets/javascripts/codemirror/addons/wrap/hardwrap.js b/vendor/assets/javascripts/codemirror/addons/wrap/hardwrap.js
index 04851f9..29cc15f 100644
--- a/vendor/assets/javascripts/codemirror/addons/wrap/hardwrap.js
+++ b/vendor/assets/javascripts/codemirror/addons/wrap/hardwrap.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -52,6 +52,7 @@
var lines = cm.getRange(from, to, false);
if (!lines.length) return null;
var leadingSpace = lines[0].match(/^[ \t]*/)[0];
+ if (leadingSpace.length >= column) column = leadingSpace.length + 1
for (var i = 0; i < lines.length; ++i) {
var text = lines[i], oldLen = curLine.length, spaceInserted = 0;
diff --git a/vendor/assets/javascripts/codemirror/keymaps/emacs.js b/vendor/assets/javascripts/codemirror/keymaps/emacs.js
index 3eec1e5..fe62d44 100644
--- a/vendor/assets/javascripts/codemirror/keymaps/emacs.js
+++ b/vendor/assets/javascripts/codemirror/keymaps/emacs.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -30,16 +30,16 @@
var lastKill = null;
- function kill(cm, from, to, mayGrow, text) {
+ function kill(cm, from, to, ring, text) {
if (text == null) text = cm.getRange(from, to);
- if (mayGrow && lastKill && lastKill.cm == cm && posEq(from, lastKill.pos) && cm.isClean(lastKill.gen))
+ if (ring == "grow" && lastKill && lastKill.cm == cm && posEq(from, lastKill.pos) && cm.isClean(lastKill.gen))
growRingTop(text);
- else
+ else if (ring !== false)
addToRing(text);
cm.replaceRange("", from, to, "+delete");
- if (mayGrow) lastKill = {cm: cm, pos: from, gen: cm.changeGeneration()};
+ if (ring == "grow") lastKill = {cm: cm, pos: from, gen: cm.changeGeneration()};
else lastKill = null;
}
@@ -97,7 +97,7 @@
function byExpr(cm, pos, dir) {
var wrap;
- if (cm.findMatchingBracket && (wrap = cm.findMatchingBracket(pos, true))
+ if (cm.findMatchingBracket && (wrap = cm.findMatchingBracket(pos, {strict: true}))
&& wrap.match && (wrap.forward ? 1 : -1) == dir)
return dir > 0 ? Pos(wrap.to.line, wrap.to.ch + 1) : wrap.to;
@@ -151,22 +151,22 @@
return f;
}
- function killTo(cm, by, dir) {
+ function killTo(cm, by, dir, ring) {
var selections = cm.listSelections(), cursor;
var i = selections.length;
while (i--) {
cursor = selections[i].head;
- kill(cm, cursor, findEnd(cm, cursor, by, dir), true);
+ kill(cm, cursor, findEnd(cm, cursor, by, dir), ring);
}
}
- function killRegion(cm) {
+ function killRegion(cm, ring) {
if (cm.somethingSelected()) {
var selections = cm.listSelections(), selection;
var i = selections.length;
while (i--) {
selection = selections[i];
- kill(cm, selection.anchor, selection.head);
+ kill(cm, selection.anchor, selection.head, ring);
}
return true;
}
@@ -271,10 +271,12 @@
clearMark(cm);
}
+ CodeMirror.emacs = {kill: kill, killRegion: killRegion, repeated: repeated};
+
// Actual keymap
var keyMap = CodeMirror.keyMap.emacs = CodeMirror.normalizeKeyMap({
- "Ctrl-W": function(cm) {kill(cm, cm.getCursor("start"), cm.getCursor("end"));},
+ "Ctrl-W": function(cm) {kill(cm, cm.getCursor("start"), cm.getCursor("end"), true);},
"Ctrl-K": repeated(function(cm) {
var start = cm.getCursor(), end = cm.clipPos(Pos(start.line));
var text = cm.getRange(start, end);
@@ -282,7 +284,7 @@
text += "\n";
end = Pos(start.line + 1, 0);
}
- kill(cm, start, end, true, text);
+ kill(cm, start, end, "grow", text);
}),
"Alt-W": function(cm) {
addToRing(cm.getSelection());
@@ -299,14 +301,15 @@
"Ctrl-F": move(byChar, 1), "Ctrl-B": move(byChar, -1),
"Right": move(byChar, 1), "Left": move(byChar, -1),
- "Ctrl-D": function(cm) { killTo(cm, byChar, 1); },
- "Delete": function(cm) { killRegion(cm) || killTo(cm, byChar, 1); },
- "Ctrl-H": function(cm) { killTo(cm, byChar, -1); },
- "Backspace": function(cm) { killRegion(cm) || killTo(cm, byChar, -1); },
+ "Ctrl-D": function(cm) { killTo(cm, byChar, 1, false); },
+ "Delete": function(cm) { killRegion(cm, false) || killTo(cm, byChar, 1, false); },
+ "Ctrl-H": function(cm) { killTo(cm, byChar, -1, false); },
+ "Backspace": function(cm) { killRegion(cm, false) || killTo(cm, byChar, -1, false); },
"Alt-F": move(byWord, 1), "Alt-B": move(byWord, -1),
- "Alt-D": function(cm) { killTo(cm, byWord, 1); },
- "Alt-Backspace": function(cm) { killTo(cm, byWord, -1); },
+ "Alt-Right": move(byWord, 1), "Alt-Left": move(byWord, -1),
+ "Alt-D": function(cm) { killTo(cm, byWord, 1, "grow"); },
+ "Alt-Backspace": function(cm) { killTo(cm, byWord, -1, "grow"); },
"Ctrl-N": move(byLine, 1), "Ctrl-P": move(byLine, -1),
"Down": move(byLine, 1), "Up": move(byLine, -1),
@@ -319,11 +322,11 @@
"Ctrl-Up": move(byParagraph, -1), "Ctrl-Down": move(byParagraph, 1),
"Alt-A": move(bySentence, -1), "Alt-E": move(bySentence, 1),
- "Alt-K": function(cm) { killTo(cm, bySentence, 1); },
+ "Alt-K": function(cm) { killTo(cm, bySentence, 1, "grow"); },
- "Ctrl-Alt-K": function(cm) { killTo(cm, byExpr, 1); },
- "Ctrl-Alt-Backspace": function(cm) { killTo(cm, byExpr, -1); },
- "Ctrl-Alt-F": move(byExpr, 1), "Ctrl-Alt-B": move(byExpr, -1),
+ "Ctrl-Alt-K": function(cm) { killTo(cm, byExpr, 1, "grow"); },
+ "Ctrl-Alt-Backspace": function(cm) { killTo(cm, byExpr, -1, "grow"); },
+ "Ctrl-Alt-F": move(byExpr, 1), "Ctrl-Alt-B": move(byExpr, -1, "grow"),
"Shift-Ctrl-Alt-2": function(cm) {
var cursor = cm.getCursor();
@@ -366,10 +369,13 @@
"Ctrl-/": repeated("undo"), "Shift-Ctrl--": repeated("undo"),
"Ctrl-Z": repeated("undo"), "Cmd-Z": repeated("undo"),
+ "Shift-Ctrl-Z": "redo",
"Shift-Alt-,": "goDocStart", "Shift-Alt-.": "goDocEnd",
- "Ctrl-S": "findNext", "Ctrl-R": "findPrev", "Ctrl-G": quit, "Shift-Alt-5": "replace",
+ "Ctrl-S": "findPersistentNext", "Ctrl-R": "findPersistentPrev", "Ctrl-G": quit, "Shift-Alt-5": "replace",
"Alt-/": "autocomplete",
- "Ctrl-J": "newlineAndIndent", "Enter": false, "Tab": "indentAuto",
+ "Enter": "newlineAndIndent",
+ "Ctrl-J": repeated(function(cm) { cm.replaceSelection("\n", "end"); }),
+ "Tab": "indentAuto",
"Alt-G G": function(cm) {
var prefix = getPrefix(cm, true);
@@ -394,7 +400,7 @@
"Ctrl-X F": "open",
"Ctrl-X U": repeated("undo"),
"Ctrl-X K": "close",
- "Ctrl-X Delete": function(cm) { kill(cm, cm.getCursor(), bySentence(cm, cm.getCursor(), 1), true); },
+ "Ctrl-X Delete": function(cm) { kill(cm, cm.getCursor(), bySentence(cm, cm.getCursor(), 1), "grow"); },
"Ctrl-X H": "selectAll",
"Ctrl-Q Tab": repeated("insertTab"),
diff --git a/vendor/assets/javascripts/codemirror/keymaps/sublime.js b/vendor/assets/javascripts/codemirror/keymaps/sublime.js
index ed6b847..799641a 100644
--- a/vendor/assets/javascripts/codemirror/keymaps/sublime.js
+++ b/vendor/assets/javascripts/codemirror/keymaps/sublime.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
// A rough approximation of Sublime Text's keybindings
// Depends on addon/search/searchcursor.js and optionally addon/dialog/dialogs.js
@@ -14,11 +14,8 @@
})(function(CodeMirror) {
"use strict";
- var map = CodeMirror.keyMap.sublime = {fallthrough: "default"};
var cmds = CodeMirror.commands;
var Pos = CodeMirror.Pos;
- var mac = CodeMirror.keyMap["default"] == CodeMirror.keyMap.macDefault;
- var ctrl = mac ? "Cmd-" : "Ctrl-";
// This is not exactly Sublime's algorithm. I couldn't make heads or tails of that.
function findPosSubword(doc, start, dir) {
@@ -52,14 +49,10 @@
});
}
- cmds[map["Alt-Left"] = "goSubwordLeft"] = function(cm) { moveSubword(cm, -1); };
- cmds[map["Alt-Right"] = "goSubwordRight"] = function(cm) { moveSubword(cm, 1); };
+ cmds.goSubwordLeft = function(cm) { moveSubword(cm, -1); };
+ cmds.goSubwordRight = function(cm) { moveSubword(cm, 1); };
- if (mac) map["Cmd-Left"] = "goLineStartSmart";
-
- var scrollLineCombo = mac ? "Ctrl-Alt-" : "Ctrl-";
-
- cmds[map[scrollLineCombo + "Up"] = "scrollLineUp"] = function(cm) {
+ cmds.scrollLineUp = function(cm) {
var info = cm.getScrollInfo();
if (!cm.somethingSelected()) {
var visibleBottomLine = cm.lineAtHeight(info.top + info.clientHeight, "local");
@@ -68,7 +61,7 @@
}
cm.scrollTo(null, info.top - cm.defaultTextHeight());
};
- cmds[map[scrollLineCombo + "Down"] = "scrollLineDown"] = function(cm) {
+ cmds.scrollLineDown = function(cm) {
var info = cm.getScrollInfo();
if (!cm.somethingSelected()) {
var visibleTopLine = cm.lineAtHeight(info.top, "local")+1;
@@ -78,7 +71,7 @@
cm.scrollTo(null, info.top + cm.defaultTextHeight());
};
- cmds[map["Shift-" + ctrl + "L"] = "splitSelectionByLine"] = function(cm) {
+ cmds.splitSelectionByLine = function(cm) {
var ranges = cm.listSelections(), lineRanges = [];
for (var i = 0; i < ranges.length; i++) {
var from = ranges[i].from(), to = ranges[i].to();
@@ -90,14 +83,12 @@
cm.setSelections(lineRanges, 0);
};
- map["Shift-Tab"] = "indentLess";
-
- cmds[map["Esc"] = "singleSelectionTop"] = function(cm) {
+ cmds.singleSelectionTop = function(cm) {
var range = cm.listSelections()[0];
cm.setSelection(range.anchor, range.head, {scroll: false});
};
- cmds[map[ctrl + "L"] = "selectLine"] = function(cm) {
+ cmds.selectLine = function(cm) {
var ranges = cm.listSelections(), extended = [];
for (var i = 0; i < ranges.length; i++) {
var range = ranges[i];
@@ -107,8 +98,6 @@
cm.setSelections(extended);
};
- map["Shift-Ctrl-K"] = "deleteLine";
-
function insertLine(cm, above) {
if (cm.isReadOnly()) return CodeMirror.Pass
cm.operation(function() {
@@ -127,9 +116,9 @@
cm.execCommand("indentAuto");
}
- cmds[map[ctrl + "Enter"] = "insertLineAfter"] = function(cm) { return insertLine(cm, false); };
+ cmds.insertLineAfter = function(cm) { return insertLine(cm, false); };
- cmds[map["Shift-" + ctrl + "Enter"] = "insertLineBefore"] = function(cm) { return insertLine(cm, true); };
+ cmds.insertLineBefore = function(cm) { return insertLine(cm, true); };
function wordAt(cm, pos) {
var start = pos.ch, end = start, line = cm.getLine(pos.line);
@@ -138,7 +127,7 @@
return {from: Pos(pos.line, start), to: Pos(pos.line, end), word: line.slice(start, end)};
}
- cmds[map[ctrl + "D"] = "selectNextOccurrence"] = function(cm) {
+ cmds.selectNextOccurrence = function(cm) {
var from = cm.getCursor("from"), to = cm.getCursor("to");
var fullWord = cm.state.sublimeFindFullWord == cm.doc.sel;
if (CodeMirror.cmpPos(from, to) == 0) {
@@ -150,41 +139,81 @@
var text = cm.getRange(from, to);
var query = fullWord ? new RegExp("\\b" + text + "\\b") : text;
var cur = cm.getSearchCursor(query, to);
- if (cur.findNext()) {
- cm.addSelection(cur.from(), cur.to());
- } else {
+ var found = cur.findNext();
+ if (!found) {
cur = cm.getSearchCursor(query, Pos(cm.firstLine(), 0));
- if (cur.findNext())
- cm.addSelection(cur.from(), cur.to());
+ found = cur.findNext();
}
+ if (!found || isSelectedRange(cm.listSelections(), cur.from(), cur.to()))
+ return CodeMirror.Pass
+ cm.addSelection(cur.from(), cur.to());
}
if (fullWord)
cm.state.sublimeFindFullWord = cm.doc.sel;
};
+ function addCursorToSelection(cm, dir) {
+ var ranges = cm.listSelections(), newRanges = [];
+ for (var i = 0; i < ranges.length; i++) {
+ var range = ranges[i];
+ var newAnchor = cm.findPosV(
+ range.anchor, dir, "line", range.anchor.goalColumn);
+ var newHead = cm.findPosV(
+ range.head, dir, "line", range.head.goalColumn);
+ newAnchor.goalColumn = range.anchor.goalColumn != null ?
+ range.anchor.goalColumn : cm.cursorCoords(range.anchor, "div").left;
+ newHead.goalColumn = range.head.goalColumn != null ?
+ range.head.goalColumn : cm.cursorCoords(range.head, "div").left;
+ var newRange = {anchor: newAnchor, head: newHead};
+ newRanges.push(range);
+ newRanges.push(newRange);
+ }
+ cm.setSelections(newRanges);
+ }
+ cmds.addCursorToPrevLine = function(cm) { addCursorToSelection(cm, -1); };
+ cmds.addCursorToNextLine = function(cm) { addCursorToSelection(cm, 1); };
+
+ function isSelectedRange(ranges, from, to) {
+ for (var i = 0; i < ranges.length; i++)
+ if (ranges[i].from() == from && ranges[i].to() == to) return true
+ return false
+ }
+
var mirror = "(){}[]";
function selectBetweenBrackets(cm) {
- var pos = cm.getCursor(), opening = cm.scanForBracket(pos, -1);
- if (!opening) return;
- for (;;) {
- var closing = cm.scanForBracket(pos, 1);
- if (!closing) return;
- if (closing.ch == mirror.charAt(mirror.indexOf(opening.ch) + 1)) {
- cm.setSelection(Pos(opening.pos.line, opening.pos.ch + 1), closing.pos, false);
- return true;
+ var ranges = cm.listSelections(), newRanges = []
+ for (var i = 0; i < ranges.length; i++) {
+ var range = ranges[i], pos = range.head, opening = cm.scanForBracket(pos, -1);
+ if (!opening) return false;
+ for (;;) {
+ var closing = cm.scanForBracket(pos, 1);
+ if (!closing) return false;
+ if (closing.ch == mirror.charAt(mirror.indexOf(opening.ch) + 1)) {
+ var startPos = Pos(opening.pos.line, opening.pos.ch + 1);
+ if (CodeMirror.cmpPos(startPos, range.from()) == 0 &&
+ CodeMirror.cmpPos(closing.pos, range.to()) == 0) {
+ opening = cm.scanForBracket(opening.pos, -1);
+ if (!opening) return false;
+ } else {
+ newRanges.push({anchor: startPos, head: closing.pos});
+ break;
+ }
+ }
+ pos = Pos(closing.pos.line, closing.pos.ch + 1);
}
- pos = Pos(closing.pos.line, closing.pos.ch + 1);
}
+ cm.setSelections(newRanges);
+ return true;
}
- cmds[map["Shift-" + ctrl + "Space"] = "selectScope"] = function(cm) {
+ cmds.selectScope = function(cm) {
selectBetweenBrackets(cm) || cm.execCommand("selectAll");
};
- cmds[map["Shift-" + ctrl + "M"] = "selectBetweenBrackets"] = function(cm) {
+ cmds.selectBetweenBrackets = function(cm) {
if (!selectBetweenBrackets(cm)) return CodeMirror.Pass;
};
- cmds[map[ctrl + "M"] = "goToBracket"] = function(cm) {
+ cmds.goToBracket = function(cm) {
cm.extendSelectionsBy(function(range) {
var next = cm.scanForBracket(range.head, 1);
if (next && CodeMirror.cmpPos(next.pos, range.head) != 0) return next.pos;
@@ -193,9 +222,7 @@
});
};
- var swapLineCombo = mac ? "Cmd-Ctrl-" : "Shift-Ctrl-";
-
- cmds[map[swapLineCombo + "Up"] = "swapLineUp"] = function(cm) {
+ cmds.swapLineUp = function(cm) {
if (cm.isReadOnly()) return CodeMirror.Pass
var ranges = cm.listSelections(), linesToMove = [], at = cm.firstLine() - 1, newSels = [];
for (var i = 0; i < ranges.length; i++) {
@@ -222,7 +249,7 @@
});
};
- cmds[map[swapLineCombo + "Down"] = "swapLineDown"] = function(cm) {
+ cmds.swapLineDown = function(cm) {
if (cm.isReadOnly()) return CodeMirror.Pass
var ranges = cm.listSelections(), linesToMove = [], at = cm.lastLine() + 1;
for (var i = ranges.length - 1; i >= 0; i--) {
@@ -246,11 +273,11 @@
});
};
- cmds[map[ctrl + "/"] = "toggleCommentIndented"] = function(cm) {
+ cmds.toggleCommentIndented = function(cm) {
cm.toggleComment({ indent: true });
}
- cmds[map[ctrl + "J"] = "joinLines"] = function(cm) {
+ cmds.joinLines = function(cm) {
var ranges = cm.listSelections(), joined = [];
for (var i = 0; i < ranges.length; i++) {
var range = ranges[i], from = range.from();
@@ -278,7 +305,7 @@
});
};
- cmds[map["Shift-" + ctrl + "D"] = "duplicateLine"] = function(cm) {
+ cmds.duplicateLine = function(cm) {
cm.operation(function() {
var rangeCount = cm.listSelections().length;
for (var i = 0; i < rangeCount; i++) {
@@ -292,7 +319,6 @@
});
};
- map[ctrl + "T"] = "transposeChars";
function sortLines(cm, caseSensitive) {
if (cm.isReadOnly()) return CodeMirror.Pass
@@ -302,7 +328,8 @@
if (range.empty()) continue;
var from = range.from().line, to = range.to().line;
while (i < ranges.length - 1 && ranges[i + 1].from().line == to)
- to = range[++i].to().line;
+ to = ranges[++i].to().line;
+ if (!ranges[i].to().ch) to--;
toSort.push(from, to);
}
if (toSort.length) selected = true;
@@ -323,16 +350,16 @@
return a < b ? -1 : a == b ? 0 : 1;
});
cm.replaceRange(lines, start, end);
- if (selected) ranges.push({anchor: start, head: end});
+ if (selected) ranges.push({anchor: start, head: Pos(to + 1, 0)});
}
if (selected) cm.setSelections(ranges, 0);
});
}
- cmds[map["F9"] = "sortLines"] = function(cm) { sortLines(cm, true); };
- cmds[map[ctrl + "F9"] = "sortLinesInsensitive"] = function(cm) { sortLines(cm, false); };
+ cmds.sortLines = function(cm) { sortLines(cm, true); };
+ cmds.sortLinesInsensitive = function(cm) { sortLines(cm, false); };
- cmds[map["F2"] = "nextBookmark"] = function(cm) {
+ cmds.nextBookmark = function(cm) {
var marks = cm.state.sublimeBookmarks;
if (marks) while (marks.length) {
var current = marks.shift();
@@ -344,7 +371,7 @@
}
};
- cmds[map["Shift-F2"] = "prevBookmark"] = function(cm) {
+ cmds.prevBookmark = function(cm) {
var marks = cm.state.sublimeBookmarks;
if (marks) while (marks.length) {
marks.unshift(marks.pop());
@@ -356,12 +383,12 @@
}
};
- cmds[map[ctrl + "F2"] = "toggleBookmark"] = function(cm) {
+ cmds.toggleBookmark = function(cm) {
var ranges = cm.listSelections();
var marks = cm.state.sublimeBookmarks || (cm.state.sublimeBookmarks = []);
for (var i = 0; i < ranges.length; i++) {
var from = ranges[i].from(), to = ranges[i].to();
- var found = cm.findMarks(from, to);
+ var found = ranges[i].empty() ? cm.findMarksAt(from) : cm.findMarks(from, to);
for (var j = 0; j < found.length; j++) {
if (found[j].sublimeBookmark) {
found[j].clear();
@@ -376,13 +403,13 @@
}
};
- cmds[map["Shift-" + ctrl + "F2"] = "clearBookmarks"] = function(cm) {
+ cmds.clearBookmarks = function(cm) {
var marks = cm.state.sublimeBookmarks;
if (marks) for (var i = 0; i < marks.length; i++) marks[i].clear();
marks.length = 0;
};
- cmds[map["Alt-F2"] = "selectBookmarks"] = function(cm) {
+ cmds.selectBookmarks = function(cm) {
var marks = cm.state.sublimeBookmarks, ranges = [];
if (marks) for (var i = 0; i < marks.length; i++) {
var found = marks[i].find();
@@ -395,10 +422,6 @@
cm.setSelections(ranges, 0);
};
- map["Alt-Q"] = "wrapLines";
-
- var cK = ctrl + "K ";
-
function modifyWordOrSelection(cm, mod) {
cm.operation(function() {
var ranges = cm.listSelections(), indices = [], replacements = [];
@@ -418,9 +441,7 @@
});
}
- map[cK + ctrl + "Backspace"] = "delLineLeft";
-
- cmds[map["Backspace"] = "smartBackspace"] = function(cm) {
+ cmds.smartBackspace = function(cm) {
if (cm.somethingSelected()) return CodeMirror.Pass;
cm.operation(function() {
@@ -448,7 +469,7 @@
});
};
- cmds[map[cK + ctrl + "K"] = "delLineRight"] = function(cm) {
+ cmds.delLineRight = function(cm) {
cm.operation(function() {
var ranges = cm.listSelections();
for (var i = ranges.length - 1; i >= 0; i--)
@@ -457,22 +478,22 @@
});
};
- cmds[map[cK + ctrl + "U"] = "upcaseAtCursor"] = function(cm) {
+ cmds.upcaseAtCursor = function(cm) {
modifyWordOrSelection(cm, function(str) { return str.toUpperCase(); });
};
- cmds[map[cK + ctrl + "L"] = "downcaseAtCursor"] = function(cm) {
+ cmds.downcaseAtCursor = function(cm) {
modifyWordOrSelection(cm, function(str) { return str.toLowerCase(); });
};
- cmds[map[cK + ctrl + "Space"] = "setSublimeMark"] = function(cm) {
+ cmds.setSublimeMark = function(cm) {
if (cm.state.sublimeMark) cm.state.sublimeMark.clear();
cm.state.sublimeMark = cm.setBookmark(cm.getCursor());
};
- cmds[map[cK + ctrl + "A"] = "selectToSublimeMark"] = function(cm) {
+ cmds.selectToSublimeMark = function(cm) {
var found = cm.state.sublimeMark && cm.state.sublimeMark.find();
if (found) cm.setSelection(cm.getCursor(), found);
};
- cmds[map[cK + ctrl + "W"] = "deleteToSublimeMark"] = function(cm) {
+ cmds.deleteToSublimeMark = function(cm) {
var found = cm.state.sublimeMark && cm.state.sublimeMark.find();
if (found) {
var from = cm.getCursor(), to = found;
@@ -481,7 +502,7 @@
cm.replaceRange("", from, to);
}
};
- cmds[map[cK + ctrl + "X"] = "swapWithSublimeMark"] = function(cm) {
+ cmds.swapWithSublimeMark = function(cm) {
var found = cm.state.sublimeMark && cm.state.sublimeMark.find();
if (found) {
cm.state.sublimeMark.clear();
@@ -489,39 +510,16 @@
cm.setCursor(found);
}
};
- cmds[map[cK + ctrl + "Y"] = "sublimeYank"] = function(cm) {
+ cmds.sublimeYank = function(cm) {
if (cm.state.sublimeKilled != null)
cm.replaceSelection(cm.state.sublimeKilled, null, "paste");
};
- map[cK + ctrl + "G"] = "clearBookmarks";
- cmds[map[cK + ctrl + "C"] = "showInCenter"] = function(cm) {
+ cmds.showInCenter = function(cm) {
var pos = cm.cursorCoords(null, "local");
cm.scrollTo(null, (pos.top + pos.bottom) / 2 - cm.getScrollInfo().clientHeight / 2);
};
- var selectLinesCombo = mac ? "Ctrl-Shift-" : "Ctrl-Alt-";
- cmds[map[selectLinesCombo + "Up"] = "selectLinesUpward"] = function(cm) {
- cm.operation(function() {
- var ranges = cm.listSelections();
- for (var i = 0; i < ranges.length; i++) {
- var range = ranges[i];
- if (range.head.line > cm.firstLine())
- cm.addSelection(Pos(range.head.line - 1, range.head.ch));
- }
- });
- };
- cmds[map[selectLinesCombo + "Down"] = "selectLinesDownward"] = function(cm) {
- cm.operation(function() {
- var ranges = cm.listSelections();
- for (var i = 0; i < ranges.length; i++) {
- var range = ranges[i];
- if (range.head.line < cm.lastLine())
- cm.addSelection(Pos(range.head.line + 1, range.head.ch));
- }
- });
- };
-
function getTarget(cm) {
var from = cm.getCursor("from"), to = cm.getCursor("to");
if (CodeMirror.cmpPos(from, to) == 0) {
@@ -550,9 +548,9 @@
cm.setSelection(target.from, target.to);
}
};
- cmds[map[ctrl + "F3"] = "findUnder"] = function(cm) { findAndGoTo(cm, true); };
- cmds[map["Shift-" + ctrl + "F3"] = "findUnderPrevious"] = function(cm) { findAndGoTo(cm,false); };
- cmds[map["Alt-F3"] = "findAllUnder"] = function(cm) {
+ cmds.findUnder = function(cm) { findAndGoTo(cm, true); };
+ cmds.findUnderPrevious = function(cm) { findAndGoTo(cm,false); };
+ cmds.findAllUnder = function(cm) {
var target = getTarget(cm);
if (!target) return;
var cur = cm.getSearchCursor(target.query);
@@ -566,15 +564,128 @@
cm.setSelections(matches, primaryIndex);
};
- map["Shift-" + ctrl + "["] = "fold";
- map["Shift-" + ctrl + "]"] = "unfold";
- map[cK + ctrl + "0"] = map[cK + ctrl + "j"] = "unfoldAll";
-
- map[ctrl + "I"] = "findIncremental";
- map["Shift-" + ctrl + "I"] = "findIncrementalReverse";
- map[ctrl + "H"] = "replace";
- map["F3"] = "findNext";
- map["Shift-F3"] = "findPrev";
- CodeMirror.normalizeKeyMap(map);
+ var keyMap = CodeMirror.keyMap;
+ keyMap.macSublime = {
+ "Cmd-Left": "goLineStartSmart",
+ "Shift-Tab": "indentLess",
+ "Shift-Ctrl-K": "deleteLine",
+ "Alt-Q": "wrapLines",
+ "Ctrl-Left": "goSubwordLeft",
+ "Ctrl-Right": "goSubwordRight",
+ "Ctrl-Alt-Up": "scrollLineUp",
+ "Ctrl-Alt-Down": "scrollLineDown",
+ "Cmd-L": "selectLine",
+ "Shift-Cmd-L": "splitSelectionByLine",
+ "Esc": "singleSelectionTop",
+ "Cmd-Enter": "insertLineAfter",
+ "Shift-Cmd-Enter": "insertLineBefore",
+ "Cmd-D": "selectNextOccurrence",
+ "Shift-Cmd-Space": "selectScope",
+ "Shift-Cmd-M": "selectBetweenBrackets",
+ "Cmd-M": "goToBracket",
+ "Cmd-Ctrl-Up": "swapLineUp",
+ "Cmd-Ctrl-Down": "swapLineDown",
+ "Cmd-/": "toggleCommentIndented",
+ "Cmd-J": "joinLines",
+ "Shift-Cmd-D": "duplicateLine",
+ "F5": "sortLines",
+ "Cmd-F5": "sortLinesInsensitive",
+ "F2": "nextBookmark",
+ "Shift-F2": "prevBookmark",
+ "Cmd-F2": "toggleBookmark",
+ "Shift-Cmd-F2": "clearBookmarks",
+ "Alt-F2": "selectBookmarks",
+ "Backspace": "smartBackspace",
+ "Cmd-K Cmd-K": "delLineRight",
+ "Cmd-K Cmd-U": "upcaseAtCursor",
+ "Cmd-K Cmd-L": "downcaseAtCursor",
+ "Cmd-K Cmd-Space": "setSublimeMark",
+ "Cmd-K Cmd-A": "selectToSublimeMark",
+ "Cmd-K Cmd-W": "deleteToSublimeMark",
+ "Cmd-K Cmd-X": "swapWithSublimeMark",
+ "Cmd-K Cmd-Y": "sublimeYank",
+ "Cmd-K Cmd-C": "showInCenter",
+ "Cmd-K Cmd-G": "clearBookmarks",
+ "Cmd-K Cmd-Backspace": "delLineLeft",
+ "Cmd-K Cmd-0": "unfoldAll",
+ "Cmd-K Cmd-J": "unfoldAll",
+ "Ctrl-Shift-Up": "addCursorToPrevLine",
+ "Ctrl-Shift-Down": "addCursorToNextLine",
+ "Cmd-F3": "findUnder",
+ "Shift-Cmd-F3": "findUnderPrevious",
+ "Alt-F3": "findAllUnder",
+ "Shift-Cmd-[": "fold",
+ "Shift-Cmd-]": "unfold",
+ "Cmd-I": "findIncremental",
+ "Shift-Cmd-I": "findIncrementalReverse",
+ "Cmd-H": "replace",
+ "F3": "findNext",
+ "Shift-F3": "findPrev",
+ "fallthrough": "macDefault"
+ };
+ CodeMirror.normalizeKeyMap(keyMap.macSublime);
+
+ keyMap.pcSublime = {
+ "Shift-Tab": "indentLess",
+ "Shift-Ctrl-K": "deleteLine",
+ "Alt-Q": "wrapLines",
+ "Ctrl-T": "transposeChars",
+ "Alt-Left": "goSubwordLeft",
+ "Alt-Right": "goSubwordRight",
+ "Ctrl-Up": "scrollLineUp",
+ "Ctrl-Down": "scrollLineDown",
+ "Ctrl-L": "selectLine",
+ "Shift-Ctrl-L": "splitSelectionByLine",
+ "Esc": "singleSelectionTop",
+ "Ctrl-Enter": "insertLineAfter",
+ "Shift-Ctrl-Enter": "insertLineBefore",
+ "Ctrl-D": "selectNextOccurrence",
+ "Shift-Ctrl-Space": "selectScope",
+ "Shift-Ctrl-M": "selectBetweenBrackets",
+ "Ctrl-M": "goToBracket",
+ "Shift-Ctrl-Up": "swapLineUp",
+ "Shift-Ctrl-Down": "swapLineDown",
+ "Ctrl-/": "toggleCommentIndented",
+ "Ctrl-J": "joinLines",
+ "Shift-Ctrl-D": "duplicateLine",
+ "F9": "sortLines",
+ "Ctrl-F9": "sortLinesInsensitive",
+ "F2": "nextBookmark",
+ "Shift-F2": "prevBookmark",
+ "Ctrl-F2": "toggleBookmark",
+ "Shift-Ctrl-F2": "clearBookmarks",
+ "Alt-F2": "selectBookmarks",
+ "Backspace": "smartBackspace",
+ "Ctrl-K Ctrl-K": "delLineRight",
+ "Ctrl-K Ctrl-U": "upcaseAtCursor",
+ "Ctrl-K Ctrl-L": "downcaseAtCursor",
+ "Ctrl-K Ctrl-Space": "setSublimeMark",
+ "Ctrl-K Ctrl-A": "selectToSublimeMark",
+ "Ctrl-K Ctrl-W": "deleteToSublimeMark",
+ "Ctrl-K Ctrl-X": "swapWithSublimeMark",
+ "Ctrl-K Ctrl-Y": "sublimeYank",
+ "Ctrl-K Ctrl-C": "showInCenter",
+ "Ctrl-K Ctrl-G": "clearBookmarks",
+ "Ctrl-K Ctrl-Backspace": "delLineLeft",
+ "Ctrl-K Ctrl-0": "unfoldAll",
+ "Ctrl-K Ctrl-J": "unfoldAll",
+ "Ctrl-Alt-Up": "addCursorToPrevLine",
+ "Ctrl-Alt-Down": "addCursorToNextLine",
+ "Ctrl-F3": "findUnder",
+ "Shift-Ctrl-F3": "findUnderPrevious",
+ "Alt-F3": "findAllUnder",
+ "Shift-Ctrl-[": "fold",
+ "Shift-Ctrl-]": "unfold",
+ "Ctrl-I": "findIncremental",
+ "Shift-Ctrl-I": "findIncrementalReverse",
+ "Ctrl-H": "replace",
+ "F3": "findNext",
+ "Shift-F3": "findPrev",
+ "fallthrough": "pcDefault"
+ };
+ CodeMirror.normalizeKeyMap(keyMap.pcSublime);
+
+ var mac = keyMap.default == keyMap.macDefault;
+ keyMap.sublime = mac ? keyMap.macSublime : keyMap.pcSublime;
});
diff --git a/vendor/assets/javascripts/codemirror/keymaps/vim.js b/vendor/assets/javascripts/codemirror/keymaps/vim.js
index 4278ee9..95b19b2 100644
--- a/vendor/assets/javascripts/codemirror/keymaps/vim.js
+++ b/vendor/assets/javascripts/codemirror/keymaps/vim.js
@@ -1,9 +1,9 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
/**
* Supported keybindings:
- * Too many to list. Refer to defaultKeyMap below.
+ * Too many to list. Refer to defaultKeymap below.
*
* Supported Ex commands:
* Refer to defaultExCommandMap below.
@@ -53,6 +53,7 @@
{ keys: '
', type: 'keyToKey', toKeys: 'j' },
{ keys: '', type: 'keyToKey', toKeys: 'l' },
{ keys: '', type: 'keyToKey', toKeys: 'h', context: 'normal'},
+ { keys: '', type: 'keyToKey', toKeys: 'x', context: 'normal'},
{ keys: '', type: 'keyToKey', toKeys: 'W' },
{ keys: '', type: 'keyToKey', toKeys: 'B', context: 'normal' },
{ keys: '', type: 'keyToKey', toKeys: 'w' },
@@ -72,6 +73,7 @@
{ keys: '', type: 'keyToKey', toKeys: '' },
{ keys: '', type: 'keyToKey', toKeys: '' },
{ keys: '', type: 'keyToKey', toKeys: 'j^', context: 'normal' },
+ { keys: '', type: 'action', action: 'toggleOverwrite', context: 'insert' },
// Motions
{ keys: 'H', type: 'motion', motion: 'moveToTopLine', motionArgs: { linewise: true, toJumplist: true }},
{ keys: 'M', type: 'motion', motion: 'moveToMiddleLine', motionArgs: { linewise: true, toJumplist: true }},
@@ -92,6 +94,8 @@
{ keys: 'gE', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: true, bigWord: true, inclusive: true }},
{ keys: '{', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: false, toJumplist: true }},
{ keys: '}', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: true, toJumplist: true }},
+ { keys: '(', type: 'motion', motion: 'moveBySentence', motionArgs: { forward: false }},
+ { keys: ')', type: 'motion', motion: 'moveBySentence', motionArgs: { forward: true }},
{ keys: '', type: 'motion', motion: 'moveByPage', motionArgs: { forward: true }},
{ keys: '', type: 'motion', motion: 'moveByPage', motionArgs: { forward: false }},
{ keys: '', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: true, explicitRepeat: true }},
@@ -129,6 +133,7 @@
{ keys: 'd', type: 'operator', operator: 'delete' },
{ keys: 'y', type: 'operator', operator: 'yank' },
{ keys: 'c', type: 'operator', operator: 'change' },
+ { keys: '=', type: 'operator', operator: 'indentAuto' },
{ keys: '>', type: 'operator', operator: 'indent', operatorArgs: { indentRight: true }},
{ keys: '<', type: 'operator', operator: 'indent', operatorArgs: { indentRight: false }},
{ keys: 'g~', type: 'operator', operator: 'changeCase' },
@@ -141,13 +146,15 @@
{ keys: 'X', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: false }, operatorMotionArgs: { visualLine: true }},
{ keys: 'D', type: 'operatorMotion', operator: 'delete', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'},
{ keys: 'D', type: 'operator', operator: 'delete', operatorArgs: { linewise: true }, context: 'visual'},
- { keys: 'Y', type: 'operatorMotion', operator: 'yank', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'},
+ { keys: 'Y', type: 'operatorMotion', operator: 'yank', motion: 'expandToLine', motionArgs: { linewise: true }, context: 'normal'},
{ keys: 'Y', type: 'operator', operator: 'yank', operatorArgs: { linewise: true }, context: 'visual'},
{ keys: 'C', type: 'operatorMotion', operator: 'change', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'},
{ keys: 'C', type: 'operator', operator: 'change', operatorArgs: { linewise: true }, context: 'visual'},
{ keys: '~', type: 'operatorMotion', operator: 'changeCase', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorArgs: { shouldMoveCursor: true }, context: 'normal'},
{ keys: '~', type: 'operator', operator: 'changeCase', context: 'visual'},
{ keys: '', type: 'operatorMotion', operator: 'delete', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }, context: 'insert' },
+ //ignore C-w in normal mode
+ { keys: '', type: 'idle', context: 'normal' },
// Actions
{ keys: '', type: 'action', action: 'jumpListWalk', actionArgs: { forward: true }},
{ keys: '', type: 'action', action: 'jumpListWalk', actionArgs: { forward: false }},
@@ -189,6 +196,8 @@
{ keys: '.', type: 'action', action: 'repeatLastEdit' },
{ keys: '', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: {increase: true, backtrack: false}},
{ keys: '', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: {increase: false, backtrack: false}},
+ { keys: '', type: 'action', action: 'indent', actionArgs: { indentRight: true }, context: 'insert' },
+ { keys: '', type: 'action', action: 'indent', actionArgs: { indentRight: false }, context: 'insert' },
// Text object motions
{ keys: 'a', type: 'motion', motion: 'textObjectManipulation' },
{ keys: 'i', type: 'motion', motion: 'textObjectManipulation', motionArgs: { textObjectInner: true }},
@@ -202,6 +211,7 @@
// Ex command
{ keys: ':', type: 'ex' }
];
+ var defaultKeymapLength = defaultKeymap.length;
/**
* Ex commands
@@ -252,20 +262,70 @@
}
function detachVimMap(cm, next) {
- if (this == CodeMirror.keyMap.vim)
+ if (this == CodeMirror.keyMap.vim) {
CodeMirror.rmClass(cm.getWrapperElement(), "cm-fat-cursor");
+ if (cm.getOption("inputStyle") == "contenteditable" && document.body.style.caretColor != null) {
+ disableFatCursorMark(cm);
+ cm.getInputField().style.caretColor = "";
+ }
+ }
if (!next || next.attach != attachVimMap)
- leaveVimMode(cm, false);
+ leaveVimMode(cm);
}
function attachVimMap(cm, prev) {
- if (this == CodeMirror.keyMap.vim)
+ if (this == CodeMirror.keyMap.vim) {
CodeMirror.addClass(cm.getWrapperElement(), "cm-fat-cursor");
+ if (cm.getOption("inputStyle") == "contenteditable" && document.body.style.caretColor != null) {
+ enableFatCursorMark(cm);
+ cm.getInputField().style.caretColor = "transparent";
+ }
+ }
if (!prev || prev.attach != attachVimMap)
enterVimMode(cm);
}
+ function updateFatCursorMark(cm) {
+ if (!cm.state.fatCursorMarks) return;
+ clearFatCursorMark(cm);
+ var ranges = cm.listSelections(), result = []
+ for (var i = 0; i < ranges.length; i++) {
+ var range = ranges[i]
+ if (range.empty()) {
+ if (range.anchor.ch < cm.getLine(range.anchor.line).length) {
+ result.push(cm.markText(range.anchor, Pos(range.anchor.line, range.anchor.ch + 1),
+ {className: "cm-fat-cursor-mark"}))
+ } else {
+ var widget = document.createElement("span")
+ widget.textContent = "\u00a0"
+ widget.className = "cm-fat-cursor-mark"
+ result.push(cm.setBookmark(range.anchor, {widget: widget}))
+ }
+ }
+ }
+ cm.state.fatCursorMarks = result;
+ }
+
+ function clearFatCursorMark(cm) {
+ var marks = cm.state.fatCursorMarks;
+ if (marks) for (var i = 0; i < marks.length; i++) marks[i].clear();
+ }
+
+ function enableFatCursorMark(cm) {
+ cm.state.fatCursorMarks = [];
+ updateFatCursorMark(cm)
+ cm.on("cursorActivity", updateFatCursorMark)
+ }
+
+ function disableFatCursorMark(cm) {
+ clearFatCursorMark(cm);
+ cm.off("cursorActivity", updateFatCursorMark);
+ // explicitly set fatCursorMarks to null because event listener above
+ // can be invoke after removing it, if off is called from operation
+ cm.state.fatCursorMarks = null;
+ }
+
// Deprecated, simply setting the keymap works again.
CodeMirror.defineOption('vimMode', false, function(cm, val, prev) {
if (val && cm.getOption("keyMap") != "vim")
@@ -276,6 +336,7 @@
function cmKey(key, cm) {
if (!cm) { return undefined; }
+ if (this[key]) { return this[key]; }
var vimKey = cmKeyToVimKey(key);
if (!vimKey) {
return false;
@@ -288,7 +349,7 @@
}
var modifiers = {'Shift': 'S', 'Ctrl': 'C', 'Alt': 'A', 'Cmd': 'D', 'Mod': 'A'};
- var specialKeys = {Enter:'CR',Backspace:'BS',Delete:'Del'};
+ var specialKeys = {Enter:'CR',Backspace:'BS',Delete:'Del',Insert:'Ins'};
function cmKeyToVimKey(key) {
if (key.charAt(0) == '\'') {
// Keypress character binding of format "'a'"
@@ -372,6 +433,9 @@
function isWhiteSpaceString(k) {
return (/^\s*$/).test(k);
}
+ function isEndOfSentenceSymbol(k) {
+ return '.?!'.indexOf(k) != -1;
+ }
function inArray(val, arr) {
for (var i = 0; i < arr.length; i++) {
if (arr[i] == val) {
@@ -407,11 +471,11 @@
cfg = cfg || {};
var scope = cfg.scope;
if (!option) {
- throw Error('Unknown option: ' + name);
+ return new Error('Unknown option: ' + name);
}
if (option.type == 'boolean') {
if (value && value !== true) {
- throw Error('Invalid argument: ' + name + '=' + value);
+ return new Error('Invalid argument: ' + name + '=' + value);
} else if (value !== false) {
// Boolean options are set to true if value is not defined.
value = true;
@@ -439,7 +503,7 @@
cfg = cfg || {};
var scope = cfg.scope;
if (!option) {
- throw Error('Unknown option: ' + name);
+ return new Error('Unknown option: ' + name);
}
if (option.callback) {
var local = cm && option.callback(undefined, cm);
@@ -645,9 +709,9 @@
lastCharacterSearch: {increment:0, forward:true, selectedCharacter:''},
registerController: new RegisterController({}),
// search history buffer
- searchHistoryController: new HistoryController({}),
+ searchHistoryController: new HistoryController(),
// ex Command history buffer
- exCommandHistoryController : new HistoryController({})
+ exCommandHistoryController : new HistoryController()
};
for (var optionName in options) {
var option = options[optionName];
@@ -686,6 +750,78 @@
unmap: function(lhs, ctx) {
exCommandDispatcher.unmap(lhs, ctx);
},
+ // Non-recursive map function.
+ // NOTE: This will not create mappings to key maps that aren't present
+ // in the default key map. See TODO at bottom of function.
+ noremap: function(lhs, rhs, ctx) {
+ function toCtxArray(ctx) {
+ return ctx ? [ctx] : ['normal', 'insert', 'visual'];
+ }
+ var ctxsToMap = toCtxArray(ctx);
+ // Look through all actual defaults to find a map candidate.
+ var actualLength = defaultKeymap.length, origLength = defaultKeymapLength;
+ for (var i = actualLength - origLength;
+ i < actualLength && ctxsToMap.length;
+ i++) {
+ var mapping = defaultKeymap[i];
+ // Omit mappings that operate in the wrong context(s) and those of invalid type.
+ if (mapping.keys == rhs &&
+ (!ctx || !mapping.context || mapping.context === ctx) &&
+ mapping.type.substr(0, 2) !== 'ex' &&
+ mapping.type.substr(0, 3) !== 'key') {
+ // Make a shallow copy of the original keymap entry.
+ var newMapping = {};
+ for (var key in mapping) {
+ newMapping[key] = mapping[key];
+ }
+ // Modify it point to the new mapping with the proper context.
+ newMapping.keys = lhs;
+ if (ctx && !newMapping.context) {
+ newMapping.context = ctx;
+ }
+ // Add it to the keymap with a higher priority than the original.
+ this._mapCommand(newMapping);
+ // Record the mapped contexts as complete.
+ var mappedCtxs = toCtxArray(mapping.context);
+ ctxsToMap = ctxsToMap.filter(function(el) { return mappedCtxs.indexOf(el) === -1; });
+ }
+ }
+ // TODO: Create non-recursive keyToKey mappings for the unmapped contexts once those exist.
+ },
+ // Remove all user-defined mappings for the provided context.
+ mapclear: function(ctx) {
+ // Partition the existing keymap into user-defined and true defaults.
+ var actualLength = defaultKeymap.length,
+ origLength = defaultKeymapLength;
+ var userKeymap = defaultKeymap.slice(0, actualLength - origLength);
+ defaultKeymap = defaultKeymap.slice(actualLength - origLength);
+ if (ctx) {
+ // If a specific context is being cleared, we need to keep mappings
+ // from all other contexts.
+ for (var i = userKeymap.length - 1; i >= 0; i--) {
+ var mapping = userKeymap[i];
+ if (ctx !== mapping.context) {
+ if (mapping.context) {
+ this._mapCommand(mapping);
+ } else {
+ // `mapping` applies to all contexts so create keymap copies
+ // for each context except the one being cleared.
+ var contexts = ['normal', 'insert', 'visual'];
+ for (var j in contexts) {
+ if (contexts[j] !== ctx) {
+ var newMapping = {};
+ for (var key in mapping) {
+ newMapping[key] = mapping[key];
+ }
+ newMapping.context = contexts[j];
+ this._mapCommand(newMapping);
+ }
+ }
+ }
+ }
+ }
+ }
+ },
// TODO: Expose setOption and getOption as instance methods. Need to decide how to namespace
// them, or somehow make them work with the existing CodeMirror setOption/getOption API.
setOption: setOption,
@@ -778,15 +914,19 @@
if (lastInsertModeKeyTimer) { window.clearTimeout(lastInsertModeKeyTimer); }
if (keysAreChars) {
- var here = cm.getCursor();
- cm.replaceRange('', offsetCursor(here, 0, -(keys.length - 1)), here, '+input');
+ var selections = cm.listSelections();
+ for (var i = 0; i < selections.length; i++) {
+ var here = selections[i].head;
+ cm.replaceRange('', offsetCursor(here, 0, -(keys.length - 1)), here, '+input');
+ }
+ vimGlobalState.macroModeState.lastInsertModeChanges.changes.pop();
}
clearInputState(cm);
return match.command;
}
function handleKeyNonInsertMode() {
- if (handleMacroRecording() || handleEsc()) { return true; };
+ if (handleMacroRecording() || handleEsc()) { return true; }
var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key;
if (/^[1-9]\d*$/.test(keys)) { return true; }
@@ -811,12 +951,12 @@
if (vim.insertMode) { command = handleKeyInsertMode(); }
else { command = handleKeyNonInsertMode(); }
if (command === false) {
- return undefined;
+ return !vim.insertMode && key.length === 1 ? function() { return true; } : undefined;
} else if (command === true) {
// TODO: Look into using CodeMirror's multi-key handling.
// Return no-op since we are caching the key. Counts as handled, but
// don't want act on it just yet.
- return function() {};
+ return function() { return true; };
} else {
return function() {
return cm.operation(function() {
@@ -950,7 +1090,7 @@
* for a reference implementation.
*/
function defineRegister(name, register) {
- var registers = vimGlobalState.registerController.registers[name];
+ var registers = vimGlobalState.registerController.registers;
if (!name || name.length != 1) {
throw Error('Register name must be 1 character');
}
@@ -978,9 +1118,6 @@
}
RegisterController.prototype = {
pushText: function(registerName, operator, text, linewise, blockwise) {
- if (linewise && text.charAt(0) == '\n') {
- text = text.slice(1) + '\n';
- }
if (linewise && text.charAt(text.length - 1) !== '\n'){
text += '\n';
}
@@ -1102,7 +1239,9 @@
}
}
if (bestMatch.keys.slice(-11) == '') {
- inputState.selectedCharacter = lastChar(keys);
+ var character = lastChar(keys);
+ if (!character) return {type: 'none'};
+ inputState.selectedCharacter = character;
}
return {type: 'full', command: bestMatch};
},
@@ -1237,11 +1376,13 @@
}
}
function onPromptKeyUp(e, query, close) {
- var keyName = CodeMirror.keyName(e), up;
+ var keyName = CodeMirror.keyName(e), up, offset;
if (keyName == 'Up' || keyName == 'Down') {
up = keyName == 'Up' ? true : false;
+ offset = e.target ? e.target.selectionEnd : 0;
query = vimGlobalState.searchHistoryController.nextMatch(query, up) || '';
close(query);
+ if (offset && e.target) e.target.selectionEnd = e.target.selectionStart = Math.min(offset, e.target.value.length);
} else {
if ( keyName != 'Left' && keyName != 'Right' && keyName != 'Ctrl' && keyName != 'Alt' && keyName != 'Shift')
vimGlobalState.searchHistoryController.reset();
@@ -1273,6 +1414,8 @@
clearInputState(cm);
close();
cm.focus();
+ } else if (keyName == 'Up' || keyName == 'Down') {
+ CodeMirror.e_stop(e);
} else if (keyName == 'Ctrl-U') {
// Ctrl-U clears input.
CodeMirror.e_stop(e);
@@ -1336,7 +1479,7 @@
exCommandDispatcher.processCommand(cm, input);
}
function onPromptKeyDown(e, input, close) {
- var keyName = CodeMirror.keyName(e), up;
+ var keyName = CodeMirror.keyName(e), up, offset;
if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[' ||
(keyName == 'Backspace' && input == '')) {
vimGlobalState.exCommandHistoryController.pushInput(input);
@@ -1347,9 +1490,12 @@
cm.focus();
}
if (keyName == 'Up' || keyName == 'Down') {
+ CodeMirror.e_stop(e);
up = keyName == 'Up' ? true : false;
+ offset = e.target ? e.target.selectionEnd : 0;
input = vimGlobalState.exCommandHistoryController.nextMatch(input, up) || '';
close(input);
+ if (offset && e.target) e.target.selectionEnd = e.target.selectionStart = Math.min(offset, e.target.value.length);
} else if (keyName == 'Ctrl-U') {
// Ctrl-U clears input.
CodeMirror.e_stop(e);
@@ -1365,7 +1511,7 @@
} else {
if (vim.visualMode) {
showPrompt(cm, { onClose: onPromptClose, prefix: ':', value: '\'<,\'>',
- onKeyDown: onPromptKeyDown});
+ onKeyDown: onPromptKeyDown, selectValueOnOpen: false});
} else {
showPrompt(cm, { onClose: onPromptClose, prefix: ':',
onKeyDown: onPromptKeyDown});
@@ -1571,6 +1717,7 @@
vim.lastEditActionCommand = actionCommand;
macroModeState.lastInsertModeChanges.changes = [];
macroModeState.lastInsertModeChanges.expectCursorActivityForChange = false;
+ macroModeState.lastInsertModeChanges.visualBlock = vim.visualBlock ? vim.sel.head.line - vim.sel.anchor.line : 0;
}
};
@@ -1612,9 +1759,8 @@
return findNext(cm, prev/** prev */, query, motionArgs.repeat);
},
goToMark: function(cm, _head, motionArgs, vim) {
- var mark = vim.marks[motionArgs.selectedCharacter];
- if (mark) {
- var pos = mark.find();
+ var pos = getMarkPos(cm, vim, motionArgs.selectedCharacter);
+ if (pos) {
return motionArgs.linewise ? { line: pos.line, ch: findFirstNonWhiteSpaceCharacter(cm.getLine(pos.line)) } : pos;
}
return null;
@@ -1702,7 +1848,7 @@
if (line < first && cur.line == first){
return this.moveToStartOfLine(cm, head, motionArgs, vim);
}else if (line > last && cur.line == last){
- return this.moveToEol(cm, head, motionArgs, vim);
+ return this.moveToEol(cm, head, motionArgs, vim, true);
}
if (motionArgs.toFirstChar){
endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line));
@@ -1751,6 +1897,10 @@
var dir = motionArgs.forward ? 1 : -1;
return findParagraph(cm, head, motionArgs.repeat, dir);
},
+ moveBySentence: function(cm, head, motionArgs) {
+ var dir = motionArgs.forward ? 1 : -1;
+ return findSentence(cm, head, motionArgs.repeat, dir);
+ },
moveByScroll: function(cm, head, motionArgs, vim) {
var scrollbox = cm.getScrollInfo();
var curEnd = null;
@@ -1800,13 +1950,15 @@
vim.lastHSPos = cm.charCoords(head,'div').left;
return moveToColumn(cm, repeat);
},
- moveToEol: function(cm, head, motionArgs, vim) {
+ moveToEol: function(cm, head, motionArgs, vim, keepHPos) {
var cur = head;
- vim.lastHPos = Infinity;
var retval= Pos(cur.line + motionArgs.repeat - 1, Infinity);
var end=cm.clipPos(retval);
end.ch--;
- vim.lastHSPos = cm.charCoords(end,'div').left;
+ if (!keepHPos) {
+ vim.lastHPos = Infinity;
+ vim.lastHSPos = cm.charCoords(end,'div').left;
+ }
return retval;
},
moveToFirstNonWhiteSpaceCharacter: function(cm, head) {
@@ -1822,17 +1974,19 @@
var ch = cursor.ch;
var lineText = cm.getLine(line);
var symbol;
- do {
- symbol = lineText.charAt(ch++);
+ for (; ch < lineText.length; ch++) {
+ symbol = lineText.charAt(ch);
if (symbol && isMatchableSymbol(symbol)) {
- var style = cm.getTokenTypeAt(Pos(line, ch));
+ var style = cm.getTokenTypeAt(Pos(line, ch + 1));
if (style !== "string" && style !== "comment") {
break;
}
}
- } while (symbol);
- if (symbol) {
- var matched = cm.findMatchingBracket(Pos(line, ch));
+ }
+ if (ch < lineText.length) {
+ // Only include angle brackets in analysis if they are being matched.
+ var re = (ch === '<' || ch === '>') ? /[(){}[\]<>]/ : /[(){}[\]]/;
+ var matched = cm.findMatchingBracket(Pos(line, ch), {bracketRegex: re});
return matched.to;
} else {
return cursor;
@@ -1852,13 +2006,11 @@
textObjectManipulation: function(cm, head, motionArgs, vim) {
// TODO: lots of possible exceptions that can be thrown here. Try da(
// outside of a () block.
-
- // TODO: adding <> >< to this map doesn't work, presumably because
- // they're operators
var mirroredPairs = {'(': ')', ')': '(',
'{': '}', '}': '{',
- '[': ']', ']': '['};
- var selfPaired = {'\'': true, '"': true};
+ '[': ']', ']': '[',
+ '<': '>', '>': '<'};
+ var selfPaired = {'\'': true, '"': true, '`': true};
var character = motionArgs.selectedCharacter;
// 'b' refers to '()' block.
@@ -1946,7 +2098,6 @@
change: function(cm, args, ranges) {
var finalHead, text;
var vim = cm.state.vim;
- vimGlobalState.macroModeState.lastInsertModeChanges.inVisualBlock = vim.visualBlock;
if (!vim.visualMode) {
var anchor = ranges[0].anchor,
head = ranges[0].head;
@@ -2021,7 +2172,8 @@
vimGlobalState.registerController.pushText(
args.registerName, 'delete', text,
args.linewise, vim.visualBlock);
- return clipCursorToContent(cm, finalHead);
+ var includeLineBreak = vim.insertMode
+ return clipCursorToContent(cm, finalHead, includeLineBreak);
},
indent: function(cm, args, ranges) {
var vim = cm.state.vim;
@@ -2045,6 +2197,10 @@
}
return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor);
},
+ indentAuto: function(cm, _args, ranges) {
+ cm.execCommand("indentAuto");
+ return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor);
+ },
changeCase: function(cm, args, ranges, oldAnchor, newHead) {
var selections = cm.getSelections();
var swapped = [];
@@ -2164,6 +2320,8 @@
var macroModeState = vimGlobalState.macroModeState;
if (registerName == '@') {
registerName = macroModeState.latestRegister;
+ } else {
+ macroModeState.latestRegister = registerName;
}
while(repeat--){
executeMacroRegister(cm, vim, macroModeState, registerName);
@@ -2172,7 +2330,20 @@
enterMacroRecordMode: function(cm, actionArgs) {
var macroModeState = vimGlobalState.macroModeState;
var registerName = actionArgs.selectedCharacter;
- macroModeState.enterMacroRecordMode(cm, registerName);
+ if (vimGlobalState.registerController.isValidRegister(registerName)) {
+ macroModeState.enterMacroRecordMode(cm, registerName);
+ }
+ },
+ toggleOverwrite: function(cm) {
+ if (!cm.state.overwrite) {
+ cm.toggleOverwrite(true);
+ cm.setOption('keyMap', 'vim-replace');
+ CodeMirror.signal(cm, "vim-mode-change", {mode: "replace"});
+ } else {
+ cm.toggleOverwrite(false);
+ cm.setOption('keyMap', 'vim-insert');
+ CodeMirror.signal(cm, "vim-mode-change", {mode: "insert"});
+ }
},
enterInsertMode: function(cm, actionArgs, vim) {
if (cm.getOption('readOnly')) { return; }
@@ -2189,6 +2360,8 @@
} else if (insertAt == 'firstNonBlank') {
head = motions.moveToFirstNonWhiteSpaceCharacter(cm, head);
} else if (insertAt == 'startOfSelectedArea') {
+ if (!vim.visualMode)
+ return;
if (!vim.visualBlock) {
if (sel.head.line < sel.anchor.line) {
head = sel.head;
@@ -2202,6 +2375,8 @@
height = Math.abs(sel.head.line - sel.anchor.line) + 1;
}
} else if (insertAt == 'endOfSelectedArea') {
+ if (!vim.visualMode)
+ return;
if (!vim.visualBlock) {
if (sel.head.line >= sel.anchor.line) {
head = offsetCursor(sel.head, 0, 1);
@@ -2219,7 +2394,6 @@
return;
}
}
- cm.setOption('keyMap', 'vim-insert');
cm.setOption('disableInput', false);
if (actionArgs && actionArgs.replace) {
// Handle Replace-mode as a special case of insert mode.
@@ -2227,6 +2401,7 @@
cm.setOption('keyMap', 'vim-replace');
CodeMirror.signal(cm, "vim-mode-change", {mode: "replace"});
} else {
+ cm.toggleOverwrite(false);
cm.setOption('keyMap', 'vim-insert');
CodeMirror.signal(cm, "vim-mode-change", {mode: "insert"});
}
@@ -2395,7 +2570,17 @@
}
var linewise = register.linewise;
var blockwise = register.blockwise;
- if (linewise) {
+ if (blockwise) {
+ text = text.split('\n');
+ if (linewise) {
+ text.pop();
+ }
+ for (var i = 0; i < text.length; i++) {
+ text[i] = (text[i] == '') ? ' ' : text[i];
+ }
+ cur.ch += actionArgs.after ? 1 : 0;
+ cur.ch = Math.min(lineLength(cm, cur.line), cur.ch);
+ } else if (linewise) {
if(vim.visualMode) {
text = vim.visualLine ? text.slice(0, -1) : '\n' + text.slice(0, text.length - 1) + '\n';
} else if (actionArgs.after) {
@@ -2407,12 +2592,6 @@
cur.ch = 0;
}
} else {
- if (blockwise) {
- text = text.split('\n');
- for (var i = 0; i < text.length; i++) {
- text[i] = (text[i] == '') ? ' ' : text[i];
- }
- }
cur.ch += actionArgs.after ? 1 : 0;
}
var curPosFinal;
@@ -2563,25 +2742,32 @@
incrementNumberToken: function(cm, actionArgs) {
var cur = cm.getCursor();
var lineStr = cm.getLine(cur.line);
- var re = /-?\d+/g;
+ var re = /(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi;
var match;
var start;
var end;
var numberStr;
- var token;
while ((match = re.exec(lineStr)) !== null) {
- token = match[0];
start = match.index;
- end = start + token.length;
+ end = start + match[0].length;
if (cur.ch < end)break;
}
if (!actionArgs.backtrack && (end <= cur.ch))return;
- if (token) {
+ if (match) {
+ var baseStr = match[2] || match[4]
+ var digits = match[3] || match[5]
var increment = actionArgs.increase ? 1 : -1;
- var number = parseInt(token) + (increment * actionArgs.repeat);
+ var base = {'0b': 2, '0': 8, '': 10, '0x': 16}[baseStr.toLowerCase()];
+ var number = parseInt(match[1] + digits, base) + (increment * actionArgs.repeat);
+ numberStr = number.toString(base);
+ var zeroPadding = baseStr ? new Array(digits.length - numberStr.length + 1 + match[1].length).join('0') : ''
+ if (numberStr.charAt(0) === '-') {
+ numberStr = '-' + baseStr + zeroPadding + numberStr.substr(1);
+ } else {
+ numberStr = baseStr + zeroPadding + numberStr;
+ }
var from = Pos(cur.line, start);
var to = Pos(cur.line, end);
- numberStr = number.toString();
cm.replaceRange(numberStr, from, to);
} else {
return;
@@ -2599,6 +2785,9 @@
}
repeatLastEdit(cm, vim, repeat, false /** repeatForInsert */);
},
+ indent: function(cm, actionArgs) {
+ cm.indentLine(cm.getCursor().line, actionArgs.indentRight);
+ },
exitInsertMode: exitInsertMode
};
@@ -2637,12 +2826,6 @@
}
return Pos(cur.line + offsetLine, cur.ch + offsetCh);
}
- function getOffset(anchor, head) {
- return {
- line: head.line - anchor.line,
- ch: head.line - anchor.line
- };
- }
function commandMatches(keys, keyMap, context, inputState) {
// Partial matches are not applied. They inform the key handler
// that the current key sequence is a subsequence of a valid key
@@ -2676,7 +2859,7 @@
}
}
function lastChar(keys) {
- var match = /^.*(<[\w\-]+>)$/.exec(keys);
+ var match = /^.*(<[^>]+>)$/.exec(keys);
var selectedCharacter = match ? match[1] : keys.slice(-1);
if (selectedCharacter.length > 1){
switch(selectedCharacter){
@@ -2687,6 +2870,7 @@
selectedCharacter=' ';
break;
default:
+ selectedCharacter='';
break;
}
}
@@ -2787,7 +2971,6 @@
var range = {anchor: new Pos(line, baseCh), head: new Pos(line, headCh)};
selections.push(range);
}
- primIndex = head.line == lastLine ? selections.length - 1 : 0;
cm.setSelections(selections);
selectionEnd.ch = headCh;
base.ch = baseCh;
@@ -3215,7 +3398,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
@@ -3450,6 +3633,179 @@
return { start: start, end: end };
}
+ function findSentence(cm, cur, repeat, dir) {
+
+ /*
+ Takes an index object
+ {
+ line: the line string,
+ ln: line number,
+ pos: index in line,
+ dir: direction of traversal (-1 or 1)
+ }
+ and modifies the line, ln, and pos members to represent the
+ next valid position or sets them to null if there are
+ no more valid positions.
+ */
+ function nextChar(cm, idx) {
+ if (idx.pos + idx.dir < 0 || idx.pos + idx.dir >= idx.line.length) {
+ idx.ln += idx.dir;
+ if (!isLine(cm, idx.ln)) {
+ idx.line = null;
+ idx.ln = null;
+ idx.pos = null;
+ return;
+ }
+ idx.line = cm.getLine(idx.ln);
+ idx.pos = (idx.dir > 0) ? 0 : idx.line.length - 1;
+ }
+ else {
+ idx.pos += idx.dir;
+ }
+ }
+
+ /*
+ Performs one iteration of traversal in forward direction
+ Returns an index object of the new location
+ */
+ function forward(cm, ln, pos, dir) {
+ var line = cm.getLine(ln);
+ var stop = (line === "");
+
+ var curr = {
+ line: line,
+ ln: ln,
+ pos: pos,
+ dir: dir,
+ }
+
+ var last_valid = {
+ ln: curr.ln,
+ pos: curr.pos,
+ }
+
+ var skip_empty_lines = (curr.line === "");
+
+ // Move one step to skip character we start on
+ nextChar(cm, curr);
+
+ while (curr.line !== null) {
+ last_valid.ln = curr.ln;
+ last_valid.pos = curr.pos;
+
+ if (curr.line === "" && !skip_empty_lines) {
+ return { ln: curr.ln, pos: curr.pos, };
+ }
+ else if (stop && curr.line !== "" && !isWhiteSpaceString(curr.line[curr.pos])) {
+ return { ln: curr.ln, pos: curr.pos, };
+ }
+ else if (isEndOfSentenceSymbol(curr.line[curr.pos])
+ && !stop
+ && (curr.pos === curr.line.length - 1
+ || isWhiteSpaceString(curr.line[curr.pos + 1]))) {
+ stop = true;
+ }
+
+ nextChar(cm, curr);
+ }
+
+ /*
+ Set the position to the last non whitespace character on the last
+ valid line in the case that we reach the end of the document.
+ */
+ var line = cm.getLine(last_valid.ln);
+ last_valid.pos = 0;
+ for(var i = line.length - 1; i >= 0; --i) {
+ if (!isWhiteSpaceString(line[i])) {
+ last_valid.pos = i;
+ break;
+ }
+ }
+
+ return last_valid;
+
+ }
+
+ /*
+ Performs one iteration of traversal in reverse direction
+ Returns an index object of the new location
+ */
+ function reverse(cm, ln, pos, dir) {
+ var line = cm.getLine(ln);
+
+ var curr = {
+ line: line,
+ ln: ln,
+ pos: pos,
+ dir: dir,
+ }
+
+ var last_valid = {
+ ln: curr.ln,
+ pos: null,
+ };
+
+ var skip_empty_lines = (curr.line === "");
+
+ // Move one step to skip character we start on
+ nextChar(cm, curr);
+
+ while (curr.line !== null) {
+
+ if (curr.line === "" && !skip_empty_lines) {
+ if (last_valid.pos !== null) {
+ return last_valid;
+ }
+ else {
+ return { ln: curr.ln, pos: curr.pos };
+ }
+ }
+ else if (isEndOfSentenceSymbol(curr.line[curr.pos])
+ && last_valid.pos !== null
+ && !(curr.ln === last_valid.ln && curr.pos + 1 === last_valid.pos)) {
+ return last_valid;
+ }
+ else if (curr.line !== "" && !isWhiteSpaceString(curr.line[curr.pos])) {
+ skip_empty_lines = false;
+ last_valid = { ln: curr.ln, pos: curr.pos }
+ }
+
+ nextChar(cm, curr);
+ }
+
+ /*
+ Set the position to the first non whitespace character on the last
+ valid line in the case that we reach the beginning of the document.
+ */
+ var line = cm.getLine(last_valid.ln);
+ last_valid.pos = 0;
+ for(var i = 0; i < line.length; ++i) {
+ if (!isWhiteSpaceString(line[i])) {
+ last_valid.pos = i;
+ break;
+ }
+ }
+ return last_valid;
+ }
+
+ var curr_index = {
+ ln: cur.line,
+ pos: cur.ch,
+ };
+
+ while (repeat > 0) {
+ if (dir < 0) {
+ curr_index = reverse(cm, curr_index.ln, curr_index.pos, dir);
+ }
+ else {
+ curr_index = forward(cm, curr_index.ln, curr_index.pos, dir);
+ }
+ repeat--;
+ }
+
+ return Pos(curr_index.ln, curr_index.pos);
+ }
+
// TODO: perhaps this finagling of start and end positions belonds
// in codemirror/replaceRange?
function selectCompanionObject(cm, head, symb, inclusive) {
@@ -3458,18 +3814,20 @@
var bracketRegexp = ({
'(': /[()]/, ')': /[()]/,
'[': /[[\]]/, ']': /[[\]]/,
- '{': /[{}]/, '}': /[{}]/})[symb];
+ '{': /[{}]/, '}': /[{}]/,
+ '<': /[<>]/, '>': /[<>]/})[symb];
var openSym = ({
'(': '(', ')': '(',
'[': '[', ']': '[',
- '{': '{', '}': '{'})[symb];
+ '{': '{', '}': '{',
+ '<': '<', '>': '<'})[symb];
var curChar = cm.getLine(cur.line).charAt(cur.ch);
// Due to the behavior of scanForBracket, we need to add an offset if the
// cursor is on a matching open bracket.
var offset = curChar === openSym ? 1 : 0;
- start = cm.scanForBracket(Pos(cur.line, cur.ch + offset), -1, null, {'bracketRegex': bracketRegexp});
- end = cm.scanForBracket(Pos(cur.line, cur.ch + offset), 1, null, {'bracketRegex': bracketRegexp});
+ start = cm.scanForBracket(Pos(cur.line, cur.ch + offset), -1, undefined, {'bracketRegex': bracketRegexp});
+ end = cm.scanForBracket(Pos(cur.line, cur.ch + offset), 1, undefined, {'bracketRegex': bracketRegexp});
if (!start || !end) {
return { start: cur, end: cur };
@@ -3599,7 +3957,15 @@
}
}
function splitBySlash(argString) {
- var slashes = findUnescapedSlashes(argString) || [];
+ return splitBySeparator(argString, '/');
+ }
+
+ function findUnescapedSlashes(argString) {
+ return findUnescapedSeparators(argString, '/');
+ }
+
+ function splitBySeparator(argString, separator) {
+ var slashes = findUnescapedSeparators(argString, separator) || [];
if (!slashes.length) return [];
var tokens = [];
// in case of strings like foo/bar
@@ -3611,12 +3977,15 @@
return tokens;
}
- function findUnescapedSlashes(str) {
+ function findUnescapedSeparators(str, separator) {
+ if (!separator)
+ separator = '/';
+
var escapeNextChar = false;
var slashes = [];
for (var i = 0; i < str.length; i++) {
var c = str.charAt(i);
- if (!escapeNextChar && c == '/') {
+ if (!escapeNextChar && c == separator) {
slashes.push(i);
}
escapeNextChar = !escapeNextChar && (c == '\\');
@@ -3704,7 +4073,7 @@
}
// Unescape \ and / in the replace part, for PCRE mode.
- var unescapes = {'\\/': '/', '\\\\': '\\', '\\n': '\n', '\\r': '\r', '\\t': '\t'};
+ var unescapes = {'\\/': '/', '\\\\': '\\', '\\n': '\n', '\\r': '\r', '\\t': '\t', '\\&':'&'};
function unescapeRegexReplace(str) {
var stream = new CodeMirror.StringStream(str);
var output = [];
@@ -3860,23 +4229,27 @@
query: query
};
}
+ var highlightTimeout = 0;
function highlightSearchMatches(cm, query) {
- var searchState = getSearchState(cm);
- var overlay = searchState.getOverlay();
- if (!overlay || query != overlay.query) {
- if (overlay) {
- cm.removeOverlay(overlay);
- }
- overlay = searchOverlay(query);
- cm.addOverlay(overlay);
- if (cm.showMatchesOnScrollbar) {
- if (searchState.getScrollbarAnnotate()) {
- searchState.getScrollbarAnnotate().clear();
+ clearTimeout(highlightTimeout);
+ highlightTimeout = setTimeout(function() {
+ var searchState = getSearchState(cm);
+ var overlay = searchState.getOverlay();
+ if (!overlay || query != overlay.query) {
+ if (overlay) {
+ cm.removeOverlay(overlay);
}
- searchState.setScrollbarAnnotate(cm.showMatchesOnScrollbar(query));
+ overlay = searchOverlay(query);
+ cm.addOverlay(overlay);
+ if (cm.showMatchesOnScrollbar) {
+ if (searchState.getScrollbarAnnotate()) {
+ searchState.getScrollbarAnnotate().clear();
+ }
+ searchState.setScrollbarAnnotate(cm.showMatchesOnScrollbar(query));
+ }
+ searchState.setOverlay(overlay);
}
- searchState.setOverlay(overlay);
- }
+ }, 50);
}
function findNext(cm, prev, query, repeat) {
if (repeat === undefined) { repeat = 1; }
@@ -3944,6 +4317,26 @@
return {top: from.line, bottom: to.line};
}
+ function getMarkPos(cm, vim, markName) {
+ if (markName == '\'') {
+ var history = cm.doc.history.done;
+ var event = history[history.length - 2];
+ return event && event.ranges && event.ranges[0].head;
+ } else if (markName == '.') {
+ if (cm.doc.history.lastModTime == 0) {
+ return // If no changes, bail out; don't bother to copy or reverse history array.
+ } else {
+ var changeHistory = cm.doc.history.done.filter(function(el){ if (el.changes !== undefined) { return el } });
+ changeHistory.reverse();
+ var lastEditPos = changeHistory[0].changes[0].to;
+ }
+ return lastEditPos;
+ }
+
+ var mark = vim.marks[markName];
+ return mark && mark.find();
+ }
+
var ExCommandDispatcher = function() {
this.buildCommandMap_();
};
@@ -4044,24 +4437,42 @@
parseLineSpec_: function(cm, inputStream) {
var numberMatch = inputStream.match(/^(\d+)/);
if (numberMatch) {
+ // Absolute line number plus offset (N+M or N-M) is probably a typo,
+ // not something the user actually wanted. (NB: vim does allow this.)
return parseInt(numberMatch[1], 10) - 1;
}
switch (inputStream.next()) {
case '.':
- return cm.getCursor().line;
+ return this.parseLineSpecOffset_(inputStream, cm.getCursor().line);
case '$':
- return cm.lastLine();
+ return this.parseLineSpecOffset_(inputStream, cm.lastLine());
case '\'':
- var mark = cm.state.vim.marks[inputStream.next()];
- if (mark && mark.find()) {
- return mark.find().line;
- }
- throw new Error('Mark not set');
+ var markName = inputStream.next();
+ var markPos = getMarkPos(cm, cm.state.vim, markName);
+ if (!markPos) throw new Error('Mark not set');
+ return this.parseLineSpecOffset_(inputStream, markPos.line);
+ case '-':
+ case '+':
+ inputStream.backUp(1);
+ // Offset is relative to current line if not otherwise specified.
+ return this.parseLineSpecOffset_(inputStream, cm.getCursor().line);
default:
inputStream.backUp(1);
return undefined;
}
},
+ parseLineSpecOffset_: function(inputStream, line) {
+ var offsetMatch = inputStream.match(/^([+-])?(\d+)/);
+ if (offsetMatch) {
+ var offset = parseInt(offsetMatch[2], 10);
+ if (offsetMatch[1] == "-") {
+ line -= offset;
+ } else {
+ line += offset;
+ }
+ }
+ return line;
+ },
parseCommandArgs_: function(inputStream, params, command) {
if (inputStream.eol()) {
return;
@@ -4125,8 +4536,8 @@
var mapping = {
keys: lhs,
type: 'keyToEx',
- exArgs: { input: rhs.substring(1) },
- user: true};
+ exArgs: { input: rhs.substring(1) }
+ };
if (ctx) { mapping.context = ctx; }
defaultKeymap.unshift(mapping);
} else {
@@ -4134,8 +4545,7 @@
var mapping = {
keys: lhs,
type: 'keyToKey',
- toKeys: rhs,
- user: true
+ toKeys: rhs
};
if (ctx) { mapping.context = ctx; }
defaultKeymap.unshift(mapping);
@@ -4156,8 +4566,7 @@
var keys = lhs;
for (var i = 0; i < defaultKeymap.length; i++) {
if (keys == defaultKeymap[i].keys
- && defaultKeymap[i].context === ctx
- && defaultKeymap[i].user) {
+ && defaultKeymap[i].context === ctx) {
defaultKeymap.splice(i, 1);
return;
}
@@ -4243,13 +4652,18 @@
// If no value is provided, then we assume this is a get.
if (!optionIsBoolean && value === undefined || forceGet) {
var oldValue = getOption(optionName, cm, setCfg);
- if (oldValue === true || oldValue === false) {
+ if (oldValue instanceof Error) {
+ showConfirm(cm, oldValue.message);
+ } else if (oldValue === true || oldValue === false) {
showConfirm(cm, ' ' + (oldValue ? '' : 'no') + optionName);
} else {
showConfirm(cm, ' ' + optionName + '=' + oldValue);
}
} else {
- setOption(optionName, value, cm, setCfg);
+ var setOptionReturn = setOption(optionName, value, cm, setCfg);
+ if (setOptionReturn instanceof Error) {
+ showConfirm(cm, setOptionReturn.message);
+ }
}
},
setlocal: function (cm, params) {
@@ -4288,25 +4702,27 @@
showConfirm(cm, regInfo);
},
sort: function(cm, params) {
- var reverse, ignoreCase, unique, number;
+ var reverse, ignoreCase, unique, number, pattern;
function parseArgs() {
if (params.argString) {
var args = new CodeMirror.StringStream(params.argString);
if (args.eat('!')) { reverse = true; }
if (args.eol()) { return; }
if (!args.eatSpace()) { return 'Invalid arguments'; }
- var opts = args.match(/[a-z]+/);
- if (opts) {
- opts = opts[0];
- ignoreCase = opts.indexOf('i') != -1;
- unique = opts.indexOf('u') != -1;
- var decimal = opts.indexOf('d') != -1 && 1;
- var hex = opts.indexOf('x') != -1 && 1;
- var octal = opts.indexOf('o') != -1 && 1;
+ var opts = args.match(/([dinuox]+)?\s*(\/.+\/)?\s*/);
+ if (!opts && !args.eol()) { return 'Invalid arguments'; }
+ if (opts[1]) {
+ ignoreCase = opts[1].indexOf('i') != -1;
+ unique = opts[1].indexOf('u') != -1;
+ var decimal = opts[1].indexOf('d') != -1 || opts[1].indexOf('n') != -1 && 1;
+ var hex = opts[1].indexOf('x') != -1 && 1;
+ var octal = opts[1].indexOf('o') != -1 && 1;
if (decimal + hex + octal > 1) { return 'Invalid arguments'; }
number = decimal && 'decimal' || hex && 'hex' || octal && 'octal';
}
- if (args.match(/\/.*\//)) { return 'patterns not supported'; }
+ if (opts[2]) {
+ pattern = new RegExp(opts[2].substr(1, opts[2].length - 2), ignoreCase ? 'i' : '');
+ }
}
}
var err = parseArgs();
@@ -4320,14 +4736,18 @@
var curStart = Pos(lineStart, 0);
var curEnd = Pos(lineEnd, lineLength(cm, lineEnd));
var text = cm.getRange(curStart, curEnd).split('\n');
- var numberRegex = (number == 'decimal') ? /(-?)([\d]+)/ :
+ var numberRegex = pattern ? pattern :
+ (number == 'decimal') ? /(-?)([\d]+)/ :
(number == 'hex') ? /(-?)(?:0x)?([0-9a-f]+)/i :
(number == 'octal') ? /([0-7]+)/ : null;
var radix = (number == 'decimal') ? 10 : (number == 'hex') ? 16 : (number == 'octal') ? 8 : null;
var numPart = [], textPart = [];
- if (number) {
+ if (number || pattern) {
for (var i = 0; i < text.length; i++) {
- if (numberRegex.exec(text[i])) {
+ var matchPart = pattern ? text[i].match(pattern) : null;
+ if (matchPart && matchPart[0] != '') {
+ numPart.push(matchPart);
+ } else if (!pattern && numberRegex.exec(text[i])) {
numPart.push(text[i]);
} else {
textPart.push(text[i]);
@@ -4346,8 +4766,17 @@
bnum = parseInt((bnum[1] + bnum[2]).toLowerCase(), radix);
return anum - bnum;
}
- numPart.sort(compareFn);
- textPart.sort(compareFn);
+ function comparePatternFn(a, b) {
+ if (reverse) { var tmp; tmp = a; a = b; b = tmp; }
+ if (ignoreCase) { a[0] = a[0].toLowerCase(); b[0] = b[0].toLowerCase(); }
+ return (a[0] < b[0]) ? -1 : 1;
+ }
+ numPart.sort(pattern ? comparePatternFn : compareFn);
+ if (pattern) {
+ for (var i = 0; i < numPart.length; i++) {
+ numPart[i] = numPart[i].input;
+ }
+ } else if (!number) { textPart.sort(compareFn); }
text = (!reverse) ? textPart.concat(numPart) : numPart.concat(textPart);
if (unique) { // Remove duplicate lines
var textOld = text;
@@ -4426,16 +4855,23 @@
'any other getSearchCursor implementation.');
}
var argString = params.argString;
- var tokens = argString ? splitBySlash(argString) : [];
+ var tokens = argString ? splitBySeparator(argString, argString[0]) : [];
var regexPart, replacePart = '', trailing, flagsPart, count;
var confirm = false; // Whether to confirm each replace.
var global = false; // True to replace all instances on a line, false to replace only 1.
if (tokens.length) {
regexPart = tokens[0];
+ if (getOption('pcre') && regexPart !== '') {
+ regexPart = new RegExp(regexPart).source; //normalize not escaped characters
+ }
replacePart = tokens[1];
+ if (regexPart && regexPart[regexPart.length - 1] === '$') {
+ regexPart = regexPart.slice(0, regexPart.length - 1) + '\\n';
+ replacePart = replacePart ? replacePart + '\n' : '\n';
+ }
if (replacePart !== undefined) {
if (getOption('pcre')) {
- replacePart = unescapeRegexReplace(replacePart);
+ replacePart = unescapeRegexReplace(replacePart.replace(/([^\\])&/g,"$1$$&"));
} else {
replacePart = translateRegexReplace(replacePart);
}
@@ -4466,7 +4902,11 @@
global = true;
flagsPart.replace('g', '');
}
- regexPart = regexPart + '/' + flagsPart;
+ if (getOption('pcre')) {
+ regexPart = regexPart + '/' + flagsPart;
+ } else {
+ regexPart = regexPart.replace(/\//g, "\\/") + '/' + flagsPart;
+ }
}
}
if (regexPart) {
@@ -4682,7 +5122,7 @@
}
if (!confirm) {
replaceAll();
- if (callback) { callback(); };
+ if (callback) { callback(); }
return;
}
showPrompt(cm, {
@@ -4703,31 +5143,7 @@
var insertModeChangeRegister = vimGlobalState.registerController.getRegister('.');
var isPlaying = macroModeState.isPlaying;
var lastChange = macroModeState.lastInsertModeChanges;
- // In case of visual block, the insertModeChanges are not saved as a
- // single word, so we convert them to a single word
- // so as to update the ". register as expected in real vim.
- var text = [];
if (!isPlaying) {
- var selLength = lastChange.inVisualBlock ? vim.lastSelection.visualBlock.height : 1;
- var changes = lastChange.changes;
- var text = [];
- var i = 0;
- // In case of multiple selections in blockwise visual,
- // the inserted text, for example: 'foo', is stored as
- // 'f', 'f', InsertModeKey 'o', 'o', 'o', 'o'. (if you have a block with 2 lines).
- // We push the contents of the changes array as per the following:
- // 1. In case of InsertModeKey, just increment by 1.
- // 2. In case of a character, jump by selLength (2 in the example).
- while (i < changes.length) {
- // This loop will convert 'ffoooo' to 'foo'.
- text.push(changes[i]);
- if (changes[i] instanceof InsertModeKey) {
- i++;
- } else {
- i+= selLength;
- }
- }
- lastChange.changes = text;
cm.off('change', onChange);
CodeMirror.off(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown);
}
@@ -4771,13 +5187,6 @@
CodeMirror.keyMap['vim-insert'] = {
// TODO: override navigation keys so that Esc will cancel automatic
// indentation from o, O, i_
- 'Ctrl-N': 'autocomplete',
- 'Ctrl-P': 'autocomplete',
- 'Enter': function(cm) {
- var fn = CodeMirror.commands.newlineAndIndentContinueComment ||
- CodeMirror.commands.newlineAndIndent;
- fn(cm);
- },
fallthrough: ['default'],
attach: attachVimMap,
detach: detachVimMap,
@@ -4824,7 +5233,7 @@
exitInsertMode(cm);
}
}
- };
+ }
macroModeState.isPlaying = false;
}
@@ -4859,16 +5268,31 @@
* Listens for changes made in insert mode.
* Should only be active in insert mode.
*/
- function onChange(_cm, changeObj) {
+ function onChange(cm, changeObj) {
var macroModeState = vimGlobalState.macroModeState;
var lastChange = macroModeState.lastInsertModeChanges;
if (!macroModeState.isPlaying) {
while(changeObj) {
lastChange.expectCursorActivityForChange = true;
- if (changeObj.origin == '+input' || changeObj.origin == 'paste'
+ if (lastChange.ignoreCount > 1) {
+ lastChange.ignoreCount--;
+ } else if (changeObj.origin == '+input' || changeObj.origin == 'paste'
|| changeObj.origin === undefined /* only in testing */) {
+ var selectionCount = cm.listSelections().length;
+ if (selectionCount > 1)
+ lastChange.ignoreCount = selectionCount;
var text = changeObj.text.join('\n');
- lastChange.changes.push(text);
+ if (lastChange.maybeReset) {
+ lastChange.changes = [];
+ lastChange.maybeReset = false;
+ }
+ if (text) {
+ if (cm.state.overwrite && !/\n/.test(text)) {
+ lastChange.changes.push([text]);
+ } else {
+ lastChange.changes.push(text);
+ }
+ }
}
// Change objects may be chained with next.
changeObj = changeObj.next;
@@ -4890,7 +5314,7 @@
lastChange.expectCursorActivityForChange = false;
} else {
// Cursor moved outside the context of an edit. Reset the change.
- lastChange.changes = [];
+ lastChange.maybeReset = true;
}
} else if (!cm.curOp.isVimOp) {
handleExternalSelection(cm, vim);
@@ -4954,6 +5378,10 @@
var keyName = CodeMirror.keyName(e);
if (!keyName) { return; }
function onKeyFound() {
+ if (lastChange.maybeReset) {
+ lastChange.changes = [];
+ lastChange.maybeReset = false;
+ }
lastChange.changes.push(new InsertModeKey(keyName));
return true;
}
@@ -5016,7 +5444,7 @@
exitInsertMode(cm);
}
macroModeState.isPlaying = false;
- };
+ }
function repeatInsertModeChanges(cm, changes, repeat) {
function keyHandler(binding) {
@@ -5028,31 +5456,32 @@
return true;
}
var head = cm.getCursor('head');
- var inVisualBlock = vimGlobalState.macroModeState.lastInsertModeChanges.inVisualBlock;
- if (inVisualBlock) {
+ var visualBlock = vimGlobalState.macroModeState.lastInsertModeChanges.visualBlock;
+ if (visualBlock) {
// Set up block selection again for repeating the changes.
- var vim = cm.state.vim;
- var lastSel = vim.lastSelection;
- var offset = getOffset(lastSel.anchor, lastSel.head);
- selectForInsert(cm, head, offset.line + 1);
+ selectForInsert(cm, head, visualBlock + 1);
repeat = cm.listSelections().length;
cm.setCursor(head);
}
for (var i = 0; i < repeat; i++) {
- if (inVisualBlock) {
+ if (visualBlock) {
cm.setCursor(offsetCursor(head, i, 0));
}
for (var j = 0; j < changes.length; j++) {
var change = changes[j];
if (change instanceof InsertModeKey) {
CodeMirror.lookupKey(change.keyName, 'vim-insert', keyHandler);
- } else {
+ } else if (typeof change == "string") {
var cur = cm.getCursor();
cm.replaceRange(change, cur, cur);
+ } else {
+ var start = cm.getCursor();
+ var end = offsetCursor(start, 0, change[0].length);
+ cm.replaceRange(change[0], start, end);
}
}
}
- if (inVisualBlock) {
+ if (visualBlock) {
cm.setCursor(offsetCursor(head, 0, 1));
}
}
diff --git a/vendor/assets/javascripts/codemirror/modes/apl.js b/vendor/assets/javascripts/codemirror/modes/apl.js
index caafe4e..b1955f6 100644
--- a/vendor/assets/javascripts/codemirror/modes/apl.js
+++ b/vendor/assets/javascripts/codemirror/modes/apl.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/asciiarmor.js b/vendor/assets/javascripts/codemirror/modes/asciiarmor.js
index d830903..f560f42 100644
--- a/vendor/assets/javascripts/codemirror/modes/asciiarmor.js
+++ b/vendor/assets/javascripts/codemirror/modes/asciiarmor.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -68,6 +68,7 @@
});
CodeMirror.defineMIME("application/pgp", "asciiarmor");
+ CodeMirror.defineMIME("application/pgp-encrypted", "asciiarmor");
CodeMirror.defineMIME("application/pgp-keys", "asciiarmor");
CodeMirror.defineMIME("application/pgp-signature", "asciiarmor");
});
diff --git a/vendor/assets/javascripts/codemirror/modes/asn.1.js b/vendor/assets/javascripts/codemirror/modes/asn.1.js
index 9600247..d3ecb08 100644
--- a/vendor/assets/javascripts/codemirror/modes/asn.1.js
+++ b/vendor/assets/javascripts/codemirror/modes/asn.1.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/asterisk.js b/vendor/assets/javascripts/codemirror/modes/asterisk.js
index b7ebfc5..025a8b3 100644
--- a/vendor/assets/javascripts/codemirror/modes/asterisk.js
+++ b/vendor/assets/javascripts/codemirror/modes/asterisk.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
/*
* =====================================================================================
diff --git a/vendor/assets/javascripts/codemirror/modes/brainfuck.js b/vendor/assets/javascripts/codemirror/modes/brainfuck.js
index 3becf2a..af6d889 100644
--- a/vendor/assets/javascripts/codemirror/modes/brainfuck.js
+++ b/vendor/assets/javascripts/codemirror/modes/brainfuck.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
// Brainfuck mode created by Michael Kaminsky https://github.com/mkaminsky11
diff --git a/vendor/assets/javascripts/codemirror/modes/clike.js b/vendor/assets/javascripts/codemirror/modes/clike.js
index a37921f..4c8b993 100644
--- a/vendor/assets/javascripts/codemirror/modes/clike.js
+++ b/vendor/assets/javascripts/codemirror/modes/clike.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -21,7 +21,7 @@ function Context(indented, column, type, info, align, prev) {
}
function pushContext(state, col, type, info) {
var indent = state.indented;
- if (state.context && state.context.type != "statement" && type != "statement")
+ if (state.context && state.context.type == "statement" && type != "statement")
indent = state.context.indented;
return state.context = new Context(indent, col, type, info, null, state.context);
}
@@ -33,7 +33,7 @@ function popContext(state) {
}
function typeBefore(stream, state, pos) {
- if (state.prevToken == "variable" || state.prevToken == "variable-3") return true;
+ if (state.prevToken == "variable" || state.prevToken == "type") return true;
if (/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(stream.string.slice(0, pos))) return true;
if (state.typeAtEndOfLine && stream.column() == stream.indentation()) return true;
}
@@ -65,7 +65,10 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
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 || /^[;:,]$/;
+ isIdentifierChar = parserConfig.isIdentifierChar || /[\w\$_\xa1-\uffff]/,
+ // An optional function that takes a {string} token and returns true if it
+ // should be treated as a builtin.
+ isReservedIdentifier = parserConfig.isReservedIdentifier || false;
var curPunc, isDefKeyword;
@@ -102,9 +105,9 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
while (!stream.match(/^\/[\/*]/, false) && stream.eat(isOperatorChar)) {}
return "operator";
}
- stream.eatWhile(/[\w\$_\xa1-\uffff]/);
+ stream.eatWhile(isIdentifierChar);
if (namespaceSeparator) while (stream.match(namespaceSeparator))
- stream.eatWhile(/[\w\$_\xa1-\uffff]/);
+ stream.eatWhile(isIdentifierChar);
var cur = stream.current();
if (contains(keywords, cur)) {
@@ -112,8 +115,9 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
if (contains(defKeywords, cur)) isDefKeyword = true;
return "keyword";
}
- if (contains(types, cur)) return "variable-3";
- if (contains(builtin, cur)) {
+ if (contains(types, cur)) return "type";
+ if (contains(builtin, cur)
+ || (isReservedIdentifier && isReservedIdentifier(cur))) {
if (contains(blockKeywords, cur)) curPunc = "newstatement";
return "builtin";
}
@@ -177,7 +181,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
if (style == "comment" || style == "meta") return style;
if (ctx.align == null) ctx.align = true;
- if (endStatement.test(curPunc)) while (state.context.type == "statement") popContext(state);
+ if (curPunc == ";" || curPunc == ":" || (curPunc == "," && stream.match(/^\s*(?:\/\/.*)?$/, false)))
+ while (state.context.type == "statement") popContext(state);
else if (curPunc == "{") pushContext(state, stream.column(), "}");
else if (curPunc == "[") pushContext(state, stream.column(), "]");
else if (curPunc == "(") pushContext(state, stream.column(), ")");
@@ -215,15 +220,15 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
indent: function(state, textAfter) {
if (state.tokenize != tokenBase && state.tokenize != null || state.typeAtEndOfLine) return CodeMirror.Pass;
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
+ var closing = firstChar == ctx.type;
if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
if (parserConfig.dontIndentStatements)
while (ctx.type == "statement" && parserConfig.dontIndentStatements.test(ctx.info))
ctx = ctx.prev
if (hooks.indent) {
- var hook = hooks.indent(state, ctx, textAfter);
+ var hook = hooks.indent(state, ctx, textAfter, indentUnit);
if (typeof hook == "number") return hook
}
- var closing = firstChar == ctx.type;
var switchBlock = ctx.prev && ctx.prev.info == "switch";
if (parserConfig.allmanIndentation && /[{(]/.test(firstChar)) {
while (ctx.type != "top" && ctx.type != "}") ctx = ctx.prev
@@ -243,6 +248,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
electricInput: indentSwitch ? /^\s*(?:case .*?:|default:|\{\}?|\})$/ : /^\s*[{}]$/,
blockCommentStart: "/*",
blockCommentEnd: "*/",
+ blockCommentContinue: " * ",
lineComment: "//",
fold: "brace"
};
@@ -261,8 +267,33 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
}
}
var cKeywords = "auto if break case register continue return default do sizeof " +
- "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";
+ "static else struct switch extern typedef union for goto while enum const " +
+ "volatile inline restrict asm fortran";
+
+ // Do not use this. Use the cTypes function below. This is global just to avoid
+ // excessive calls when cTypes is being called multiple times during a parse.
+ var basicCTypes = words("int long char short double float unsigned signed " +
+ "void bool");
+
+ // Do not use this. Use the objCTypes function below. This is global just to avoid
+ // excessive calls when objCTypes is being called multiple times during a parse.
+ var basicObjCTypes = words("SEL instancetype id Class Protocol BOOL");
+
+ // Returns true if identifier is a "C" type.
+ // C type is defined as those that are reserved by the compiler (basicTypes),
+ // and those that end in _t (Reserved by POSIX for types)
+ // http://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html
+ function cTypes(identifier) {
+ return contains(basicCTypes, identifier) || /.+_t$/.test(identifier);
+ }
+
+ // Returns true if identifier is a "Objective C" type.
+ function objCTypes(identifier) {
+ return cTypes(identifier) || contains(basicObjCTypes, identifier);
+ }
+
+ var cBlockKeywords = "case do else for if switch while struct enum union";
+ var cDefKeywords = "struct enum union";
function cppHook(stream, state) {
if (!state.startOfLine) return false
@@ -280,10 +311,18 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
}
function pointerHook(_stream, state) {
- if (state.prevToken == "variable-3") return "variable-3";
+ if (state.prevToken == "type") return "type";
return false;
}
+ // For C and C++ (and ObjC): identifiers starting with __
+ // or _ followed by a capital letter are reserved for the compiler.
+ function cIsReservedIdentifier(token) {
+ if (!token || token.length < 2) return false;
+ if (token[0] != '_') return false;
+ return (token[1] == '_') || (token[1] !== token[1].toLowerCase());
+ }
+
function cpp14Literal(stream) {
stream.eatWhile(/[\w\.']/);
return "number";
@@ -314,7 +353,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
}
function cppLooksLikeConstructor(word) {
- var lastTwo = /(\w+)::(\w+)$/.exec(word);
+ var lastTwo = /(\w+)::~?(\w+)$/.exec(word);
return lastTwo && lastTwo[1] == lastTwo[2];
}
@@ -366,30 +405,36 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
def(["text/x-csrc", "text/x-c", "text/x-chdr"], {
name: "clike",
keywords: words(cKeywords),
- types: words(cTypes + " bool _Complex _Bool float_t double_t intptr_t intmax_t " +
- "int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t " +
- "uint32_t uint64_t"),
- blockKeywords: words("case do else for if switch while struct"),
- defKeywords: words("struct"),
+ types: cTypes,
+ blockKeywords: words(cBlockKeywords),
+ defKeywords: words(cDefKeywords),
typeFirstDefinitions: true,
- atoms: words("null true false"),
- hooks: {"#": cppHook, "*": pointerHook},
+ atoms: words("NULL true false"),
+ isReservedIdentifier: cIsReservedIdentifier,
+ hooks: {
+ "#": cppHook,
+ "*": pointerHook,
+ },
modeProps: {fold: ["brace", "include"]}
});
def(["text/x-c++src", "text/x-c++hdr"], {
name: "clike",
- keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try explicit new " +
- "static_cast typeid catch operator template typename class friend private " +
- "this using const_cast inline public throw virtual delete mutable protected " +
- "alignas alignof constexpr decltype nullptr noexcept thread_local final " +
- "static_assert override"),
- types: words(cTypes + " bool wchar_t"),
- blockKeywords: words("catch class do else finally for if struct switch try while"),
- defKeywords: words("class namespace struct enum union"),
+ // Keywords from https://en.cppreference.com/w/cpp/keyword includes C++20.
+ keywords: words(cKeywords + "alignas alignof and and_eq audit axiom bitand bitor catch " +
+ "class compl concept constexpr const_cast decltype delete dynamic_cast " +
+ "explicit export final friend import module mutable namespace new noexcept " +
+ "not not_eq operator or or_eq override private protected public " +
+ "reinterpret_cast requires static_assert static_cast template this " +
+ "thread_local throw try typeid typename using virtual xor xor_eq"),
+ types: cTypes,
+ blockKeywords: words(cBlockKeywords + " class try catch"),
+ defKeywords: words(cDefKeywords + " class namespace"),
typeFirstDefinitions: true,
- atoms: words("true false null"),
+ atoms: words("true false NULL nullptr"),
dontIndentStatements: /^template$/,
+ isIdentifierChar: /[\w\$_~\xa1-\uffff]/,
+ isReservedIdentifier: cIsReservedIdentifier,
hooks: {
"#": cppHook,
"*": pointerHook,
@@ -422,20 +467,22 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
def("text/x-java", {
name: "clike",
keywords: words("abstract assert break case catch class const continue default " +
- "do else enum extends final finally float for goto if implements import " +
+ "do else enum extends final finally for goto if implements import " +
"instanceof interface native new package private protected public " +
"return static strictfp super switch synchronized this throw throws transient " +
- "try volatile while"),
+ "try volatile while @interface"),
types: words("byte short int long float double boolean char void Boolean Byte Character Double Float " +
"Integer Long Number Object Short String StringBuffer StringBuilder Void"),
blockKeywords: words("catch class do else finally for if switch try while"),
- defKeywords: words("class interface package enum"),
+ defKeywords: words("class interface enum @interface"),
typeFirstDefinitions: true,
atoms: words("true false null"),
- endStatement: /^[;:]$/,
number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,
hooks: {
"@": function(stream) {
+ // Don't match the @interface keyword.
+ if (stream.match('interface', false)) return false;
+
stream.eatWhile(/[\w\$_]/);
return "meta";
}
@@ -484,21 +531,38 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
return "string";
}
+ function tokenNestedComment(depth) {
+ return function (stream, state) {
+ var ch
+ while (ch = stream.next()) {
+ if (ch == "*" && stream.eat("/")) {
+ if (depth == 1) {
+ state.tokenize = null
+ break
+ } else {
+ state.tokenize = tokenNestedComment(depth - 1)
+ return state.tokenize(stream, state)
+ }
+ } else if (ch == "/" && stream.eat("*")) {
+ state.tokenize = tokenNestedComment(depth + 1)
+ return state.tokenize(stream, state)
+ }
+ }
+ return "comment"
+ }
+ }
+
def("text/x-scala", {
name: "clike",
keywords: words(
-
/* scala */
"abstract case catch class def do else extends final finally for forSome if " +
"implicit import lazy match new null object override package private protected return " +
- "sealed super this throw trait try type val var while with yield _ : = => <- <: " +
- "<% >: # @ " +
+ "sealed super this throw trait try type val var while with yield _ " +
/* package scala */
"assert assume require print println printf readLine readBoolean readByte readShort " +
- "readChar readInt readLong readFloat readDouble " +
-
- ":: #:: "
+ "readChar readInt readLong readFloat readDouble"
),
types: words(
"AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " +
@@ -514,11 +578,12 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
"StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"
),
multiLineStrings: true,
- blockKeywords: words("catch class do else finally for forSome if match switch try while"),
- defKeywords: words("class def object package trait type val var"),
+ blockKeywords: words("catch class enum do else finally for forSome if match switch try while"),
+ defKeywords: words("class enum def object package trait type val var"),
atoms: words("true false null"),
indentStatements: false,
indentSwitch: false,
+ isOperatorChar: /[+\-*&%=<>!?|\/#:@]/,
hooks: {
"@": function(stream) {
stream.eatWhile(/[\w\$_]/);
@@ -541,9 +606,15 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
} else {
return false
}
+ },
+
+ "/": function(stream, state) {
+ if (!stream.eat("*")) return false
+ state.tokenize = tokenNestedComment(1)
+ return state.tokenize(stream, state)
}
},
- modeProps: {closeBrackets: {triples: '"'}}
+ modeProps: {closeBrackets: {pairs: '()[]{}""', triples: '"'}}
});
function tokenKotlinString(tripleString){
@@ -567,33 +638,54 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
name: "clike",
keywords: words(
/*keywords*/
- "package as typealias class interface this super val " +
- "var fun for is in This throw return " +
+ "package as typealias class interface this super val operator " +
+ "var fun for is in This throw return annotation " +
"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 const operator infix"
+ "external annotation crossinline const operator infix suspend actual expect setparam"
),
types: words(
/* package java.lang */
"Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " +
"Compiler Double Exception Float Integer Long Math Number Object Package Pair Process " +
"Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " +
- "StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"
+ "StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray " +
+ "ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy " +
+ "LazyThreadSafetyMode LongArray Nothing ShortArray Unit"
),
intendSwitch: false,
indentStatements: false,
multiLineStrings: true,
+ number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,
blockKeywords: words("catch class do else finally for if where try while enum"),
- defKeywords: words("class val var object package interface fun"),
+ defKeywords: words("class val var object interface fun"),
atoms: words("true false null this"),
hooks: {
+ "@": function(stream) {
+ stream.eatWhile(/[\w\$_]/);
+ return "meta";
+ },
+ '*': function(_stream, state) {
+ return state.prevToken == '.' ? 'variable' : 'operator';
+ },
'"': function(stream, state) {
state.tokenize = tokenKotlinString(stream.match('""'));
return state.tokenize(stream, state);
+ },
+ indent: function(state, ctx, textAfter, indentUnit) {
+ var firstChar = textAfter && textAfter.charAt(0);
+ if ((state.prevToken == "}" || state.prevToken == ")") && textAfter == "")
+ return state.indented;
+ if (state.prevToken == "operator" && textAfter != "}" ||
+ state.prevToken == "variable" && firstChar == "." ||
+ (state.prevToken == "}" || state.prevToken == ")") && firstChar == ".")
+ return indentUnit * 2 + ctx.indented;
+ if (ctx.align && ctx.type == "}")
+ return ctx.indented + (state.context.type == (textAfter || "").charAt(0) ? 0 : indentUnit);
}
},
modeProps: {closeBrackets: {triples: '"'}}
@@ -660,11 +752,11 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
def("text/x-nesc", {
name: "clike",
- keywords: words(cKeywords + "as atomic async call command component components configuration event generic " +
+ keywords: words(cKeywords + " as atomic async call command component components configuration event generic " +
"implementation includes interface module new norace nx_struct nx_union post provides " +
"signal task uses abstract extends"),
- types: words(cTypes),
- blockKeywords: words("case do else for if switch while struct"),
+ types: cTypes,
+ blockKeywords: words(cBlockKeywords),
atoms: words("null true false"),
hooks: {"#": cppHook},
modeProps: {fold: ["brace", "include"]}
@@ -672,28 +764,34 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
def("text/x-objectivec", {
name: "clike",
- keywords: words(cKeywords + "inline restrict _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in " +
- "inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),
- types: words(cTypes),
- atoms: words("YES NO NULL NILL ON OFF true false"),
+ keywords: words(cKeywords + " bycopy byref in inout oneway out self super atomic nonatomic retain copy " +
+ "readwrite readonly strong weak assign typeof nullable nonnull null_resettable _cmd " +
+ "@interface @implementation @end @protocol @encode @property @synthesize @dynamic @class " +
+ "@public @package @private @protected @required @optional @try @catch @finally @import " +
+ "@selector @encode @defs @synchronized @autoreleasepool @compatibility_alias @available"),
+ types: objCTypes,
+ builtin: words("FOUNDATION_EXPORT FOUNDATION_EXTERN NS_INLINE NS_FORMAT_FUNCTION NS_RETURNS_RETAINED " +
+ "NS_ERROR_ENUM NS_RETURNS_NOT_RETAINED NS_RETURNS_INNER_POINTER NS_DESIGNATED_INITIALIZER " +
+ "NS_ENUM NS_OPTIONS NS_REQUIRES_NIL_TERMINATION NS_ASSUME_NONNULL_BEGIN " +
+ "NS_ASSUME_NONNULL_END NS_SWIFT_NAME NS_REFINED_FOR_SWIFT"),
+ blockKeywords: words(cBlockKeywords + " @synthesize @try @catch @finally @autoreleasepool @synchronized"),
+ defKeywords: words(cDefKeywords + " @interface @implementation @protocol @class"),
+ dontIndentStatements: /^@.*$/,
+ typeFirstDefinitions: true,
+ atoms: words("YES NO NULL Nil nil true false nullptr"),
+ isReservedIdentifier: cIsReservedIdentifier,
hooks: {
- "@": function(stream) {
- stream.eatWhile(/[\w\$]/);
- return "keyword";
- },
"#": cppHook,
- indent: function(_state, ctx, textAfter) {
- if (ctx.type == "statement" && /^@\w/.test(textAfter)) return ctx.indented
- }
+ "*": pointerHook,
},
- modeProps: {fold: "brace"}
+ modeProps: {fold: ["brace", "include"]}
});
def("text/x-squirrel", {
name: "clike",
keywords: words("base break clone continue const default delete enum extends function in class" +
" foreach local resume return this throw typeof yield constructor instanceof static"),
- types: words(cTypes),
+ types: cTypes,
blockKeywords: words("case catch class else for foreach if switch try while"),
defKeywords: words("function local class"),
typeFirstDefinitions: true,
@@ -771,7 +869,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
return "atom";
},
token: function(_stream, state, style) {
- if ((style == "variable" || style == "variable-3") &&
+ if ((style == "variable" || style == "type") &&
state.prevToken == ".") {
return "variable-2";
}
diff --git a/vendor/assets/javascripts/codemirror/modes/clojure.js b/vendor/assets/javascripts/codemirror/modes/clojure.js
index ed6af2c..25d308a 100644
--- a/vendor/assets/javascripts/codemirror/modes/clojure.js
+++ b/vendor/assets/javascripts/codemirror/modes/clojure.js
@@ -1,15 +1,10 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-/**
- * Author: Hans Engel
- * Branched from CodeMirror's Scheme mode (by Koh Zi Han, based on implementation by Koh Zi Chun)
- */
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
+ if (typeof exports === "object" && typeof module === "object") // CommonJS
mod(require("../../lib/codemirror"));
- else if (typeof define == "function" && define.amd) // AMD
+ else if (typeof define === "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
@@ -17,286 +12,277 @@
"use strict";
CodeMirror.defineMode("clojure", function (options) {
- var BUILTIN = "builtin", COMMENT = "comment", STRING = "string", CHARACTER = "string-2",
- ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD = "keyword", VAR = "variable";
- var INDENT_WORD_SKIP = options.indentUnit || 2;
- var NORMAL_INDENT_UNIT = options.indentUnit || 2;
-
- function makeKeywords(str) {
- var obj = {}, words = str.split(" ");
- for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
- return obj;
+ var atoms = ["false", "nil", "true"];
+ var specialForms = [".", "catch", "def", "do", "if", "monitor-enter",
+ "monitor-exit", "new", "quote", "recur", "set!", "throw", "try", "var"];
+ var coreSymbols = ["*", "*'", "*1", "*2", "*3", "*agent*",
+ "*allow-unresolved-vars*", "*assert*", "*clojure-version*",
+ "*command-line-args*", "*compile-files*", "*compile-path*",
+ "*compiler-options*", "*data-readers*", "*default-data-reader-fn*", "*e",
+ "*err*", "*file*", "*flush-on-newline*", "*fn-loader*", "*in*",
+ "*math-context*", "*ns*", "*out*", "*print-dup*", "*print-length*",
+ "*print-level*", "*print-meta*", "*print-namespace-maps*",
+ "*print-readably*", "*read-eval*", "*reader-resolver*", "*source-path*",
+ "*suppress-read*", "*unchecked-math*", "*use-context-classloader*",
+ "*verbose-defrecords*", "*warn-on-reflection*", "+", "+'", "-", "-'",
+ "->", "->>", "->ArrayChunk", "->Eduction", "->Vec", "->VecNode",
+ "->VecSeq", "-cache-protocol-fn", "-reset-methods", "..", "/", "<", "<=",
+ "=", "==", ">", ">=", "EMPTY-NODE", "Inst", "StackTraceElement->vec",
+ "Throwable->map", "accessor", "aclone", "add-classpath", "add-watch",
+ "agent", "agent-error", "agent-errors", "aget", "alength", "alias",
+ "all-ns", "alter", "alter-meta!", "alter-var-root", "amap", "ancestors",
+ "and", "any?", "apply", "areduce", "array-map", "as->", "aset",
+ "aset-boolean", "aset-byte", "aset-char", "aset-double", "aset-float",
+ "aset-int", "aset-long", "aset-short", "assert", "assoc", "assoc!",
+ "assoc-in", "associative?", "atom", "await", "await-for", "await1",
+ "bases", "bean", "bigdec", "bigint", "biginteger", "binding", "bit-and",
+ "bit-and-not", "bit-clear", "bit-flip", "bit-not", "bit-or", "bit-set",
+ "bit-shift-left", "bit-shift-right", "bit-test", "bit-xor", "boolean",
+ "boolean-array", "boolean?", "booleans", "bound-fn", "bound-fn*",
+ "bound?", "bounded-count", "butlast", "byte", "byte-array", "bytes",
+ "bytes?", "case", "cast", "cat", "char", "char-array",
+ "char-escape-string", "char-name-string", "char?", "chars", "chunk",
+ "chunk-append", "chunk-buffer", "chunk-cons", "chunk-first", "chunk-next",
+ "chunk-rest", "chunked-seq?", "class", "class?", "clear-agent-errors",
+ "clojure-version", "coll?", "comment", "commute", "comp", "comparator",
+ "compare", "compare-and-set!", "compile", "complement", "completing",
+ "concat", "cond", "cond->", "cond->>", "condp", "conj", "conj!", "cons",
+ "constantly", "construct-proxy", "contains?", "count", "counted?",
+ "create-ns", "create-struct", "cycle", "dec", "dec'", "decimal?",
+ "declare", "dedupe", "default-data-readers", "definline", "definterface",
+ "defmacro", "defmethod", "defmulti", "defn", "defn-", "defonce",
+ "defprotocol", "defrecord", "defstruct", "deftype", "delay", "delay?",
+ "deliver", "denominator", "deref", "derive", "descendants", "destructure",
+ "disj", "disj!", "dissoc", "dissoc!", "distinct", "distinct?", "doall",
+ "dorun", "doseq", "dosync", "dotimes", "doto", "double", "double-array",
+ "double?", "doubles", "drop", "drop-last", "drop-while", "eduction",
+ "empty", "empty?", "ensure", "ensure-reduced", "enumeration-seq",
+ "error-handler", "error-mode", "eval", "even?", "every-pred", "every?",
+ "ex-data", "ex-info", "extend", "extend-protocol", "extend-type",
+ "extenders", "extends?", "false?", "ffirst", "file-seq", "filter",
+ "filterv", "find", "find-keyword", "find-ns", "find-protocol-impl",
+ "find-protocol-method", "find-var", "first", "flatten", "float",
+ "float-array", "float?", "floats", "flush", "fn", "fn?", "fnext", "fnil",
+ "for", "force", "format", "frequencies", "future", "future-call",
+ "future-cancel", "future-cancelled?", "future-done?", "future?",
+ "gen-class", "gen-interface", "gensym", "get", "get-in", "get-method",
+ "get-proxy-class", "get-thread-bindings", "get-validator", "group-by",
+ "halt-when", "hash", "hash-combine", "hash-map", "hash-ordered-coll",
+ "hash-set", "hash-unordered-coll", "ident?", "identical?", "identity",
+ "if-let", "if-not", "if-some", "ifn?", "import", "in-ns", "inc", "inc'",
+ "indexed?", "init-proxy", "inst-ms", "inst-ms*", "inst?", "instance?",
+ "int", "int-array", "int?", "integer?", "interleave", "intern",
+ "interpose", "into", "into-array", "ints", "io!", "isa?", "iterate",
+ "iterator-seq", "juxt", "keep", "keep-indexed", "key", "keys", "keyword",
+ "keyword?", "last", "lazy-cat", "lazy-seq", "let", "letfn", "line-seq",
+ "list", "list*", "list?", "load", "load-file", "load-reader",
+ "load-string", "loaded-libs", "locking", "long", "long-array", "longs",
+ "loop", "macroexpand", "macroexpand-1", "make-array", "make-hierarchy",
+ "map", "map-entry?", "map-indexed", "map?", "mapcat", "mapv", "max",
+ "max-key", "memfn", "memoize", "merge", "merge-with", "meta",
+ "method-sig", "methods", "min", "min-key", "mix-collection-hash", "mod",
+ "munge", "name", "namespace", "namespace-munge", "nat-int?", "neg-int?",
+ "neg?", "newline", "next", "nfirst", "nil?", "nnext", "not", "not-any?",
+ "not-empty", "not-every?", "not=", "ns", "ns-aliases", "ns-imports",
+ "ns-interns", "ns-map", "ns-name", "ns-publics", "ns-refers",
+ "ns-resolve", "ns-unalias", "ns-unmap", "nth", "nthnext", "nthrest",
+ "num", "number?", "numerator", "object-array", "odd?", "or", "parents",
+ "partial", "partition", "partition-all", "partition-by", "pcalls", "peek",
+ "persistent!", "pmap", "pop", "pop!", "pop-thread-bindings", "pos-int?",
+ "pos?", "pr", "pr-str", "prefer-method", "prefers",
+ "primitives-classnames", "print", "print-ctor", "print-dup",
+ "print-method", "print-simple", "print-str", "printf", "println",
+ "println-str", "prn", "prn-str", "promise", "proxy",
+ "proxy-call-with-super", "proxy-mappings", "proxy-name", "proxy-super",
+ "push-thread-bindings", "pvalues", "qualified-ident?",
+ "qualified-keyword?", "qualified-symbol?", "quot", "rand", "rand-int",
+ "rand-nth", "random-sample", "range", "ratio?", "rational?",
+ "rationalize", "re-find", "re-groups", "re-matcher", "re-matches",
+ "re-pattern", "re-seq", "read", "read-line", "read-string",
+ "reader-conditional", "reader-conditional?", "realized?", "record?",
+ "reduce", "reduce-kv", "reduced", "reduced?", "reductions", "ref",
+ "ref-history-count", "ref-max-history", "ref-min-history", "ref-set",
+ "refer", "refer-clojure", "reify", "release-pending-sends", "rem",
+ "remove", "remove-all-methods", "remove-method", "remove-ns",
+ "remove-watch", "repeat", "repeatedly", "replace", "replicate", "require",
+ "reset!", "reset-meta!", "reset-vals!", "resolve", "rest",
+ "restart-agent", "resultset-seq", "reverse", "reversible?", "rseq",
+ "rsubseq", "run!", "satisfies?", "second", "select-keys", "send",
+ "send-off", "send-via", "seq", "seq?", "seqable?", "seque", "sequence",
+ "sequential?", "set", "set-agent-send-executor!",
+ "set-agent-send-off-executor!", "set-error-handler!", "set-error-mode!",
+ "set-validator!", "set?", "short", "short-array", "shorts", "shuffle",
+ "shutdown-agents", "simple-ident?", "simple-keyword?", "simple-symbol?",
+ "slurp", "some", "some->", "some->>", "some-fn", "some?", "sort",
+ "sort-by", "sorted-map", "sorted-map-by", "sorted-set", "sorted-set-by",
+ "sorted?", "special-symbol?", "spit", "split-at", "split-with", "str",
+ "string?", "struct", "struct-map", "subs", "subseq", "subvec", "supers",
+ "swap!", "swap-vals!", "symbol", "symbol?", "sync", "tagged-literal",
+ "tagged-literal?", "take", "take-last", "take-nth", "take-while", "test",
+ "the-ns", "thread-bound?", "time", "to-array", "to-array-2d",
+ "trampoline", "transduce", "transient", "tree-seq", "true?", "type",
+ "unchecked-add", "unchecked-add-int", "unchecked-byte", "unchecked-char",
+ "unchecked-dec", "unchecked-dec-int", "unchecked-divide-int",
+ "unchecked-double", "unchecked-float", "unchecked-inc",
+ "unchecked-inc-int", "unchecked-int", "unchecked-long",
+ "unchecked-multiply", "unchecked-multiply-int", "unchecked-negate",
+ "unchecked-negate-int", "unchecked-remainder-int", "unchecked-short",
+ "unchecked-subtract", "unchecked-subtract-int", "underive", "unquote",
+ "unquote-splicing", "unreduced", "unsigned-bit-shift-right", "update",
+ "update-in", "update-proxy", "uri?", "use", "uuid?", "val", "vals",
+ "var-get", "var-set", "var?", "vary-meta", "vec", "vector", "vector-of",
+ "vector?", "volatile!", "volatile?", "vreset!", "vswap!", "when",
+ "when-first", "when-let", "when-not", "when-some", "while",
+ "with-bindings", "with-bindings*", "with-in-str", "with-loading-context",
+ "with-local-vars", "with-meta", "with-open", "with-out-str",
+ "with-precision", "with-redefs", "with-redefs-fn", "xml-seq", "zero?",
+ "zipmap"];
+ var haveBodyParameter = [
+ "->", "->>", "as->", "binding", "bound-fn", "case", "catch", "comment",
+ "cond", "cond->", "cond->>", "condp", "def", "definterface", "defmethod",
+ "defn", "defmacro", "defprotocol", "defrecord", "defstruct", "deftype",
+ "do", "doseq", "dotimes", "doto", "extend", "extend-protocol",
+ "extend-type", "fn", "for", "future", "if", "if-let", "if-not", "if-some",
+ "let", "letfn", "locking", "loop", "ns", "proxy", "reify", "struct-map",
+ "some->", "some->>", "try", "when", "when-first", "when-let", "when-not",
+ "when-some", "while", "with-bindings", "with-bindings*", "with-in-str",
+ "with-loading-context", "with-local-vars", "with-meta", "with-open",
+ "with-out-str", "with-precision", "with-redefs", "with-redefs-fn"];
+
+ CodeMirror.registerHelper("hintWords", "clojure",
+ [].concat(atoms, specialForms, coreSymbols));
+
+ var atom = createLookupMap(atoms);
+ var specialForm = createLookupMap(specialForms);
+ var coreSymbol = createLookupMap(coreSymbols);
+ var hasBodyParameter = createLookupMap(haveBodyParameter);
+ var delimiter = /^(?:[\\\[\]\s"(),;@^`{}~]|$)/;
+ var numberLiteral = /^(?:[+\-]?\d+(?:(?:N|(?:[eE][+\-]?\d+))|(?:\.?\d*(?:M|(?:[eE][+\-]?\d+))?)|\/\d+|[xX][0-9a-fA-F]+|r[0-9a-zA-Z]+)?(?=[\\\[\]\s"#'(),;@^`{}~]|$))/;
+ var characterLiteral = /^(?:\\(?:backspace|formfeed|newline|return|space|tab|o[0-7]{3}|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{4}|.)?(?=[\\\[\]\s"(),;@^`{}~]|$))/;
+
+ // simple-namespace := /^[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*/
+ // simple-symbol := /^(?:\/|[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)/
+ // qualified-symbol := ((<.>)*>)?
+ var qualifiedSymbol = /^(?:(?:[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*(?:\.[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)*\/)?(?:\/|[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)*(?=[\\\[\]\s"(),;@^`{}~]|$))/;
+
+ function base(stream, state) {
+ if (stream.eatSpace() || stream.eat(",")) return ["space", null];
+ if (stream.match(numberLiteral)) return [null, "number"];
+ if (stream.match(characterLiteral)) return [null, "string-2"];
+ if (stream.eat(/^"/)) return (state.tokenize = inString)(stream, state);
+ if (stream.eat(/^[(\[{]/)) return ["open", "bracket"];
+ if (stream.eat(/^[)\]}]/)) return ["close", "bracket"];
+ if (stream.eat(/^;/)) {stream.skipToEnd(); return ["space", "comment"];}
+ if (stream.eat(/^[#'@^`~]/)) return [null, "meta"];
+
+ var matches = stream.match(qualifiedSymbol);
+ var symbol = matches && matches[0];
+
+ if (!symbol) {
+ // advance stream by at least one character so we don't get stuck.
+ stream.next();
+ stream.eatWhile(function (c) {return !is(c, delimiter);});
+ return [null, "error"];
}
- var atoms = makeKeywords("true false nil");
-
- var keywords = makeKeywords(
- "defn defn- def def- defonce defmulti defmethod defmacro defstruct deftype defprotocol defrecord defproject deftest " +
- "slice defalias defhinted defmacro- defn-memo defnk defnk defonce- defunbound defunbound- defvar defvar- let letfn " +
- "do case cond condp for loop recur when when-not when-let when-first if if-let if-not . .. -> ->> doto and or dosync " +
- "doseq dotimes dorun doall load import unimport ns in-ns refer try catch finally throw with-open with-local-vars " +
- "binding gen-class gen-and-load-class gen-and-save-class handler-case handle");
-
- var builtins = makeKeywords(
- "* *' *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* *command-line-args* *compile-files* " +
- "*compile-path* *compiler-options* *data-readers* *e *err* *file* *flush-on-newline* *fn-loader* *in* " +
- "*math-context* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* *print-readably* *read-eval* " +
- "*source-path* *unchecked-math* *use-context-classloader* *verbose-defrecords* *warn-on-reflection* + +' - -' -> " +
- "->> ->ArrayChunk ->Vec ->VecNode ->VecSeq -cache-protocol-fn -reset-methods .. / < <= = == > >= EMPTY-NODE accessor " +
- "aclone add-classpath add-watch agent agent-error agent-errors aget alength alias all-ns alter alter-meta! " +
- "alter-var-root amap ancestors and apply areduce array-map aset aset-boolean aset-byte aset-char aset-double " +
- "aset-float aset-int aset-long aset-short assert assoc assoc! assoc-in associative? atom await await-for await1 " +
- "bases bean bigdec bigint biginteger binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set " +
- "bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn bound-fn* bound? butlast " +
- "byte byte-array bytes case cat cast char char-array char-escape-string char-name-string char? chars chunk chunk-append " +
- "chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? class class? clear-agent-errors " +
- "clojure-version coll? comment commute comp comparator compare compare-and-set! compile complement completing concat cond condp " +
- "conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec dec' decimal? " +
- "declare dedupe default-data-readers definline definterface defmacro defmethod defmulti defn defn- defonce defprotocol " +
- "defrecord defstruct deftype delay delay? deliver denominator deref derive descendants destructure disj disj! dissoc " +
- "dissoc! distinct distinct? doall dorun doseq dosync dotimes doto double double-array doubles drop drop-last " +
- "drop-while eduction empty empty? ensure enumeration-seq error-handler error-mode eval even? every-pred every? ex-data ex-info " +
- "extend extend-protocol extend-type extenders extends? false? ffirst file-seq filter filterv find find-keyword " +
- "find-ns find-protocol-impl find-protocol-method find-var first flatten float float-array float? floats flush fn fn? " +
- "fnext fnil for force format frequencies future future-call future-cancel future-cancelled? future-done? future? " +
- "gen-class gen-interface gensym get get-in get-method get-proxy-class get-thread-bindings get-validator group-by hash " +
- "hash-combine hash-map hash-set identical? identity if-let if-not ifn? import in-ns inc inc' init-proxy instance? " +
- "int int-array integer? interleave intern interpose into into-array ints io! isa? iterate iterator-seq juxt keep " +
- "keep-indexed key keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list list* list? load load-file " +
- "load-reader load-string loaded-libs locking long long-array longs loop macroexpand macroexpand-1 make-array " +
- "make-hierarchy map map-indexed map? mapcat mapv max max-key memfn memoize merge merge-with meta method-sig methods " +
- "min min-key mod munge name namespace namespace-munge neg? newline next nfirst nil? nnext not not-any? not-empty " +
- "not-every? not= ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias " +
- "ns-unmap nth nthnext nthrest num number? numerator object-array odd? or parents partial partition partition-all " +
- "partition-by pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers " +
- "primitives-classnames print print-ctor print-dup print-method print-simple print-str printf println println-str " +
- "prn prn-str promise proxy proxy-call-with-super proxy-mappings proxy-name proxy-super push-thread-bindings pvalues " +
- "quot rand rand-int rand-nth random-sample range ratio? rational? rationalize re-find re-groups re-matcher re-matches re-pattern " +
- "re-seq read read-line read-string realized? reduce reduce-kv reductions ref ref-history-count ref-max-history " +
- "ref-min-history ref-set refer refer-clojure reify release-pending-sends rem remove remove-all-methods " +
- "remove-method remove-ns remove-watch repeat repeatedly replace replicate require reset! reset-meta! resolve rest " +
- "restart-agent resultset-seq reverse reversible? rseq rsubseq satisfies? second select-keys send send-off seq seq? " +
- "seque sequence sequential? set set-error-handler! set-error-mode! set-validator! set? short short-array shorts " +
- "shuffle shutdown-agents slurp some some-fn sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? " +
- "special-symbol? spit split-at split-with str string? struct struct-map subs subseq subvec supers swap! symbol " +
- "symbol? sync take take-last take-nth take-while test the-ns thread-bound? time to-array to-array-2d trampoline transduce " +
- "transient tree-seq true? type unchecked-add unchecked-add-int unchecked-byte unchecked-char unchecked-dec " +
- "unchecked-dec-int unchecked-divide-int unchecked-double unchecked-float unchecked-inc unchecked-inc-int " +
- "unchecked-int unchecked-long unchecked-multiply unchecked-multiply-int unchecked-negate unchecked-negate-int "+
- "unchecked-remainder-int unchecked-short unchecked-subtract unchecked-subtract-int underive unquote " +
- "unquote-splicing update update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector-of " +
- "vector? volatile! volatile? vreset! vswap! when when-first when-let when-not while with-bindings with-bindings* with-in-str with-loading-context " +
- "with-local-vars with-meta with-open with-out-str with-precision with-redefs with-redefs-fn xml-seq zero? zipmap " +
- "*default-data-reader-fn* as-> cond-> cond->> reduced reduced? send-via set-agent-send-executor! " +
- "set-agent-send-off-executor! some-> some->>");
-
- var indentKeys = makeKeywords(
- // Built-ins
- "ns fn def defn defmethod bound-fn if if-not case condp when while when-not when-first do future comment doto " +
- "locking proxy with-open with-precision reify deftype defrecord defprotocol extend extend-protocol extend-type " +
- "try catch " +
-
- // Binding forms
- "let letfn binding loop for doseq dotimes when-let if-let " +
-
- // Data structures
- "defstruct struct-map assoc " +
-
- // clojure.test
- "testing deftest " +
-
- // contrib
- "handler-case handle dotrace deftrace");
-
- var tests = {
- digit: /\d/,
- digit_or_colon: /[\d:]/,
- hex: /[0-9a-f]/i,
- sign: /[+-]/,
- exponent: /e/i,
- keyword_char: /[^\s\(\[\;\)\]]/,
- symbol: /[\w*+!\-\._?:<>\/\xa1-\uffff]/,
- block_indent: /^(?:def|with)[^\/]+$|\/(?:def|with)/
- };
-
- function stateStack(indent, type, prev) { // represents a state stack object
- this.indent = indent;
- this.type = type;
- this.prev = prev;
- }
+ if (symbol === "comment" && state.lastToken === "(")
+ return (state.tokenize = inComment)(stream, state);
+ if (is(symbol, atom) || symbol.charAt(0) === ":") return ["symbol", "atom"];
+ if (is(symbol, specialForm) || is(symbol, coreSymbol)) return ["symbol", "keyword"];
+ if (state.lastToken === "(") return ["symbol", "builtin"]; // other operator
- function pushStack(state, indent, type) {
- state.indentStack = new stateStack(indent, type, state.indentStack);
- }
+ return ["symbol", "variable"];
+ }
- function popStack(state) {
- state.indentStack = state.indentStack.prev;
+ function inString(stream, state) {
+ var escaped = false, next;
+
+ while (next = stream.next()) {
+ if (next === "\"" && !escaped) {state.tokenize = base; break;}
+ escaped = !escaped && next === "\\";
}
- function isNumber(ch, stream){
- // hex
- if ( ch === '0' && stream.eat(/x/i) ) {
- stream.eatWhile(tests.hex);
- return true;
- }
+ return [null, "string"];
+ }
+
+ function inComment(stream, state) {
+ var parenthesisCount = 1;
+ var next;
+
+ while (next = stream.next()) {
+ if (next === ")") parenthesisCount--;
+ if (next === "(") parenthesisCount++;
+ if (parenthesisCount === 0) {
+ stream.backUp(1);
+ state.tokenize = base;
+ break;
+ }
+ }
- // leading sign
- if ( ( ch == '+' || ch == '-' ) && ( tests.digit.test(stream.peek()) ) ) {
- stream.eat(tests.sign);
- ch = stream.next();
+ return ["space", "comment"];
+ }
+
+ function createLookupMap(words) {
+ var obj = {};
+
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+
+ return obj;
+ }
+
+ function is(value, test) {
+ if (test instanceof RegExp) return test.test(value);
+ if (test instanceof Object) return test.propertyIsEnumerable(value);
+ }
+
+ return {
+ startState: function () {
+ return {
+ ctx: {prev: null, start: 0, indentTo: 0},
+ lastToken: null,
+ tokenize: base
+ };
+ },
+
+ token: function (stream, state) {
+ if (stream.sol() && (typeof state.ctx.indentTo !== "number"))
+ state.ctx.indentTo = state.ctx.start + 1;
+
+ var typeStylePair = state.tokenize(stream, state);
+ var type = typeStylePair[0];
+ var style = typeStylePair[1];
+ var current = stream.current();
+
+ if (type !== "space") {
+ if (state.lastToken === "(" && state.ctx.indentTo === null) {
+ if (type === "symbol" && is(current, hasBodyParameter))
+ state.ctx.indentTo = state.ctx.start + options.indentUnit;
+ else state.ctx.indentTo = "next";
+ } else if (state.ctx.indentTo === "next") {
+ state.ctx.indentTo = stream.column();
}
- if ( tests.digit.test(ch) ) {
- stream.eat(ch);
- stream.eatWhile(tests.digit);
+ state.lastToken = current;
+ }
- if ( '.' == stream.peek() ) {
- stream.eat('.');
- stream.eatWhile(tests.digit);
- } else if ('/' == stream.peek() ) {
- stream.eat('/');
- stream.eatWhile(tests.digit);
- }
+ if (type === "open")
+ state.ctx = {prev: state.ctx, start: stream.column(), indentTo: null};
+ else if (type === "close") state.ctx = state.ctx.prev || state.ctx;
- if ( stream.eat(tests.exponent) ) {
- stream.eat(tests.sign);
- stream.eatWhile(tests.digit);
- }
+ return style;
+ },
- return true;
- }
-
- return false;
- }
+ indent: function (state) {
+ var i = state.ctx.indentTo;
- // Eat character that starts after backslash \
- function eatCharacter(stream) {
- var first = stream.next();
- // Read special literals: backspace, newline, space, return.
- // Just read all lowercase letters.
- if (first && first.match(/[a-z]/) && stream.match(/[a-z]+/, true)) {
- return;
- }
- // Read unicode character: \u1000 \uA0a1
- if (first === "u") {
- stream.match(/[0-9a-z]{4}/i, true);
- }
- }
+ return (typeof i === "number") ?
+ i :
+ state.ctx.start + 1;
+ },
- return {
- startState: function () {
- return {
- indentStack: null,
- indentation: 0,
- mode: false
- };
- },
-
- token: function (stream, state) {
- if (state.indentStack == null && stream.sol()) {
- // update indentation, but only if indentStack is empty
- state.indentation = stream.indentation();
- }
-
- // skip spaces
- if (state.mode != "string" && stream.eatSpace()) {
- return null;
- }
- var returnType = null;
-
- switch(state.mode){
- case "string": // multi-line string parsing mode
- var next, escaped = false;
- while ((next = stream.next()) != null) {
- if (next == "\"" && !escaped) {
-
- state.mode = false;
- break;
- }
- escaped = !escaped && next == "\\";
- }
- returnType = STRING; // continue on in string mode
- break;
- default: // default parsing mode
- var ch = stream.next();
-
- if (ch == "\"") {
- state.mode = "string";
- returnType = STRING;
- } else if (ch == "\\") {
- eatCharacter(stream);
- returnType = CHARACTER;
- } else if (ch == "'" && !( tests.digit_or_colon.test(stream.peek()) )) {
- returnType = ATOM;
- } else if (ch == ";") { // comment
- stream.skipToEnd(); // rest of the line is a comment
- returnType = COMMENT;
- } else if (isNumber(ch,stream)){
- returnType = NUMBER;
- } else if (ch == "(" || ch == "[" || ch == "{" ) {
- var keyWord = '', indentTemp = stream.column(), letter;
- /**
- Either
- (indent-word ..
- (non-indent-word ..
- (;something else, bracket, etc.
- */
-
- if (ch == "(") while ((letter = stream.eat(tests.keyword_char)) != null) {
- keyWord += letter;
- }
-
- if (keyWord.length > 0 && (indentKeys.propertyIsEnumerable(keyWord) ||
- tests.block_indent.test(keyWord))) { // indent-word
- pushStack(state, indentTemp + INDENT_WORD_SKIP, ch);
- } else { // non-indent word
- // we continue eating the spaces
- stream.eatSpace();
- if (stream.eol() || stream.peek() == ";") {
- // nothing significant after
- // we restart indentation the user defined spaces after
- pushStack(state, indentTemp + NORMAL_INDENT_UNIT, ch);
- } else {
- pushStack(state, indentTemp + stream.current().length, ch); // else we match
- }
- }
- stream.backUp(stream.current().length - 1); // undo all the eating
-
- returnType = BRACKET;
- } else if (ch == ")" || ch == "]" || ch == "}") {
- returnType = BRACKET;
- if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : (ch == "]" ? "[" :"{"))) {
- popStack(state);
- }
- } else if ( ch == ":" ) {
- stream.eatWhile(tests.symbol);
- return ATOM;
- } else {
- stream.eatWhile(tests.symbol);
-
- if (keywords && keywords.propertyIsEnumerable(stream.current())) {
- returnType = KEYWORD;
- } else if (builtins && builtins.propertyIsEnumerable(stream.current())) {
- returnType = BUILTIN;
- } else if (atoms && atoms.propertyIsEnumerable(stream.current())) {
- returnType = ATOM;
- } else {
- returnType = VAR;
- }
- }
- }
-
- return returnType;
- },
-
- indent: function (state) {
- if (state.indentStack == null) return state.indentation;
- return state.indentStack.indent;
- },
-
- closeBrackets: {pairs: "()[]{}\"\""},
- lineComment: ";;"
- };
+ closeBrackets: {pairs: "()[]{}\"\""},
+ lineComment: ";;"
+ };
});
CodeMirror.defineMIME("text/x-clojure", "clojure");
diff --git a/vendor/assets/javascripts/codemirror/modes/cmake.js b/vendor/assets/javascripts/codemirror/modes/cmake.js
index 9f9eda5..496c71d 100644
--- a/vendor/assets/javascripts/codemirror/modes/cmake.js
+++ b/vendor/assets/javascripts/codemirror/modes/cmake.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object")
diff --git a/vendor/assets/javascripts/codemirror/modes/cobol.js b/vendor/assets/javascripts/codemirror/modes/cobol.js
index 897022b..275857b 100644
--- a/vendor/assets/javascripts/codemirror/modes/cobol.js
+++ b/vendor/assets/javascripts/codemirror/modes/cobol.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
/**
* Author: Gautam Mehta
diff --git a/vendor/assets/javascripts/codemirror/modes/coffeescript.js b/vendor/assets/javascripts/codemirror/modes/coffeescript.js
index adf2184..a54e9d5 100644
--- a/vendor/assets/javascripts/codemirror/modes/coffeescript.js
+++ b/vendor/assets/javascripts/codemirror/modes/coffeescript.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
/**
* Link to the project's GitHub page:
@@ -349,6 +349,10 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
return external;
});
+// IANA registered media type
+// https://www.iana.org/assignments/media-types/
+CodeMirror.defineMIME("application/vnd.coffeescript", "coffeescript");
+
CodeMirror.defineMIME("text/x-coffeescript", "coffeescript");
CodeMirror.defineMIME("text/coffeescript", "coffeescript");
diff --git a/vendor/assets/javascripts/codemirror/modes/commonlisp.js b/vendor/assets/javascripts/codemirror/modes/commonlisp.js
index fb1f99c..52abbb2 100644
--- a/vendor/assets/javascripts/codemirror/modes/commonlisp.js
+++ b/vendor/assets/javascripts/codemirror/modes/commonlisp.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -43,11 +43,12 @@ CodeMirror.defineMode("commonlisp", function (config) {
else { stream.skipToEnd(); return "error"; }
} else if (ch == "#") {
var ch = stream.next();
- if (ch == "[") { type = "open"; return "bracket"; }
+ if (ch == "(") { type = "open"; return "bracket"; }
else if (/[+\-=\.']/.test(ch)) return null;
else if (/\d/.test(ch) && stream.match(/^\d*#/)) return null;
else if (ch == "|") return (state.tokenize = inComment)(stream, state);
else if (ch == ":") { readSym(stream); return "meta"; }
+ else if (ch == "\\") { stream.next(); readSym(stream); return "string-2" }
else return "error";
} else {
var name = readSym(stream);
diff --git a/vendor/assets/javascripts/codemirror/modes/crystal.js b/vendor/assets/javascripts/codemirror/modes/crystal.js
index e63627c..5c601c6 100644
--- a/vendor/assets/javascripts/codemirror/modes/crystal.js
+++ b/vendor/assets/javascripts/codemirror/modes/crystal.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -29,26 +29,22 @@
var types = /^[A-Z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/;
var keywords = wordRegExp([
"abstract", "alias", "as", "asm", "begin", "break", "case", "class", "def", "do",
- "else", "elsif", "end", "ensure", "enum", "extend", "for", "fun", "if", "ifdef",
+ "else", "elsif", "end", "ensure", "enum", "extend", "for", "fun", "if",
"include", "instance_sizeof", "lib", "macro", "module", "next", "of", "out", "pointerof",
- "private", "protected", "rescue", "return", "require", "sizeof", "struct",
- "super", "then", "type", "typeof", "union", "unless", "until", "when", "while", "with",
- "yield", "__DIR__", "__FILE__", "__LINE__"
+ "private", "protected", "rescue", "return", "require", "select", "sizeof", "struct",
+ "super", "then", "type", "typeof", "uninitialized", "union", "unless", "until", "when", "while", "with",
+ "yield", "__DIR__", "__END_LINE__", "__FILE__", "__LINE__"
]);
var atomWords = wordRegExp(["true", "false", "nil", "self"]);
var indentKeywordsArray = [
"def", "fun", "macro",
"class", "module", "struct", "lib", "enum", "union",
- "if", "unless", "case", "while", "until", "begin", "then",
- "do",
- "for", "ifdef"
+ "do", "for"
];
var indentKeywords = wordRegExp(indentKeywordsArray);
- var dedentKeywordsArray = [
- "end",
- "else", "elsif",
- "rescue", "ensure"
- ];
+ var indentExpressionKeywordsArray = ["if", "unless", "case", "while", "until", "begin", "then"];
+ var indentExpressionKeywords = wordRegExp(indentExpressionKeywordsArray);
+ var dedentKeywordsArray = ["end", "else", "elsif", "rescue", "ensure"];
var dedentKeywords = wordRegExp(dedentKeywordsArray);
var dedentPunctualsArray = ["\\)", "\\}", "\\]"];
var dedentPunctuals = new RegExp("^(?:" + dedentPunctualsArray.join("|") + ")$");
@@ -90,12 +86,15 @@
} else if (state.lastToken == ".") {
return "property";
} else if (keywords.test(matched)) {
- if (state.lastToken != "abstract" && indentKeywords.test(matched)) {
- if (!(matched == "fun" && state.blocks.indexOf("lib") >= 0)) {
+ if (indentKeywords.test(matched)) {
+ if (!(matched == "fun" && state.blocks.indexOf("lib") >= 0) && !(matched == "def" && state.lastToken == "abstract")) {
state.blocks.push(matched);
state.currentIndent += 1;
}
- } else if (dedentKeywords.test(matched)) {
+ } else if ((state.lastStyle == "operator" || !state.lastStyle) && indentExpressionKeywords.test(matched)) {
+ state.blocks.push(matched);
+ state.currentIndent += 1;
+ } else if (matched == "end") {
state.blocks.pop();
state.currentIndent -= 1;
}
@@ -124,12 +123,6 @@
return "variable-2";
}
- // Global variables
- if (stream.eat("$")) {
- stream.eat(/[0-9]+|\?/) || stream.match(idents) || stream.match(types);
- return "variable-3";
- }
-
// Constants and types
if (stream.match(types)) {
return "tag";
@@ -165,6 +158,9 @@
} else if (stream.match("%w")) {
embed = false;
delim = stream.next();
+ } else if (stream.match("%q")) {
+ embed = false;
+ delim = stream.next();
} else {
if(delim = stream.match(/^%([^\w\s=])/)) {
delim = delim[1];
@@ -183,6 +179,11 @@
return chain(tokenQuote(delim, style, embed), stream, state);
}
+ // Here Docs
+ if (matched = stream.match(/^<<-('?)([A-Z]\w*)\1/)) {
+ return chain(tokenHereDoc(matched[2], !matched[1]), stream, state)
+ }
+
// Characters
if (stream.eat("'")) {
stream.match(/^(?:[^']|\\(?:[befnrtv0'"]|[0-7]{3}|u(?:[0-9a-fA-F]{4}|\{[0-9a-fA-F]{1,6}\})))/);
@@ -202,7 +203,7 @@
return "number";
}
- if (stream.eat(/\d/)) {
+ if (stream.eat(/^\d/)) {
stream.match(/^\d*(?:\.\d+)?(?:[eE][+-]?\d+)?/);
return "number";
}
@@ -339,7 +340,7 @@
return style;
}
- escaped = ch == "\\";
+ escaped = embed && ch == "\\";
} else {
stream.next();
escaped = false;
@@ -350,12 +351,52 @@
};
}
+ function tokenHereDoc(phrase, embed) {
+ return function (stream, state) {
+ if (stream.sol()) {
+ stream.eatSpace()
+ if (stream.match(phrase)) {
+ state.tokenize.pop();
+ return "string";
+ }
+ }
+
+ var escaped = false;
+ while (stream.peek()) {
+ if (!escaped) {
+ if (stream.match("{%", false)) {
+ state.tokenize.push(tokenMacro("%", "%"));
+ return "string";
+ }
+
+ if (stream.match("{{", false)) {
+ state.tokenize.push(tokenMacro("{", "}"));
+ return "string";
+ }
+
+ if (embed && stream.match("#{", false)) {
+ state.tokenize.push(tokenNest("#{", "}", "meta"));
+ return "string";
+ }
+
+ escaped = embed && stream.next() == "\\";
+ } else {
+ stream.next();
+ escaped = false;
+ }
+ }
+
+ return "string";
+ }
+ }
+
return {
startState: function () {
return {
tokenize: [tokenBase],
currentIndent: 0,
lastToken: null,
+ lastStyle: null,
blocks: []
};
},
@@ -366,6 +407,7 @@
if (style && style != "comment") {
state.lastToken = token;
+ state.lastStyle = style;
}
return style;
diff --git a/vendor/assets/javascripts/codemirror/modes/css.js b/vendor/assets/javascripts/codemirror/modes/css.js
index ea7bd01..05742c5 100644
--- a/vendor/assets/javascripts/codemirror/modes/css.js
+++ b/vendor/assets/javascripts/codemirror/modes/css.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -28,6 +28,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
colorKeywords = parserConfig.colorKeywords || {},
valueKeywords = parserConfig.valueKeywords || {},
allowNested = parserConfig.allowNested,
+ lineComment = parserConfig.lineComment,
supportsAtComponent = parserConfig.supportsAtComponent === true;
var type, override;
@@ -62,7 +63,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
if (/[\d.]/.test(stream.peek())) {
stream.eatWhile(/[\w.%]/);
return ret("number", "unit");
- } else if (stream.match(/^-[\w\\\-]+/)) {
+ } else if (stream.match(/^-[\w\\\-]*/)) {
stream.eatWhile(/[\w\\\-]/);
if (stream.match(/^\s*:/, false))
return ret("variable-2", "variable-definition");
@@ -76,12 +77,11 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
return ret("qualifier", "qualifier");
} else if (/[:;{}\[\]\(\)]/.test(ch)) {
return ret(null, ch);
- } else if ((ch == "u" && stream.match(/rl(-prefix)?\(/)) ||
- (ch == "d" && stream.match("omain(")) ||
- (ch == "r" && stream.match("egexp("))) {
- stream.backUp(1);
- state.tokenize = tokenParenthesized;
- return ret("property", "word");
+ } else if (stream.match(/[\w-.]+(?=\()/)) {
+ if (/^(url(-prefix)?|domain|regexp)$/.test(stream.current().toLowerCase())) {
+ state.tokenize = tokenParenthesized;
+ }
+ return ret("variable callee", "variable");
} else if (/[\w\\\-]/.test(ch)) {
stream.eatWhile(/[\w\\\-]/);
return ret("property", "word");
@@ -161,16 +161,16 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
return pushContext(state, stream, "block");
} else if (type == "}" && state.context.prev) {
return popContext(state);
- } else if (supportsAtComponent && /@component/.test(type)) {
+ } else if (supportsAtComponent && /@component/i.test(type)) {
return pushContext(state, stream, "atComponentBlock");
- } else if (/^@(-moz-)?document$/.test(type)) {
+ } else if (/^@(-moz-)?document$/i.test(type)) {
return pushContext(state, stream, "documentTypes");
- } else if (/^@(media|supports|(-moz-)?document|import)$/.test(type)) {
+ } else if (/^@(media|supports|(-moz-)?document|import)$/i.test(type)) {
return pushContext(state, stream, "atBlock");
- } else if (/^@(font-face|counter-style)/.test(type)) {
+ } else if (/^@(font-face|counter-style)/i.test(type)) {
state.stateArg = type;
return "restricted_atBlock_before";
- } else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) {
+ } else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(type)) {
return "keyframes";
} else if (type && type.charAt(0) == "@") {
return pushContext(state, stream, "at");
@@ -253,6 +253,8 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
};
states.pseudo = function(type, stream, state) {
+ if (type == "meta") return "pseudo";
+
if (type == "word") {
override = "variable-3";
return state.context.type;
@@ -380,7 +382,8 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
style = style[0];
}
override = style;
- state.state = states[state.state](type, stream, state);
+ if (type != "comment")
+ state.state = states[state.state](type, stream, state);
return override;
},
@@ -398,7 +401,6 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
ch == "{" && (cx.type == "at" || cx.type == "atBlock")) {
// Dedent relative to current context.
indent = Math.max(0, cx.indent - indentUnit);
- cx = cx.prev;
}
}
return indent;
@@ -407,6 +409,8 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
electricChars: "}",
blockCommentStart: "/*",
blockCommentEnd: "*/",
+ blockCommentContinue: " * ",
+ lineComment: lineComment,
fold: "brace"
};
});
@@ -414,7 +418,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
function keySet(array) {
var keys = {};
for (var i = 0; i < array.length; ++i) {
- keys[array[i]] = true;
+ keys[array[i].toLowerCase()] = true;
}
return keys;
}
@@ -468,7 +472,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"border-top-left-radius", "border-top-right-radius", "border-top-style",
"border-top-width", "border-width", "bottom", "box-decoration-break",
"box-shadow", "box-sizing", "break-after", "break-before", "break-inside",
- "caption-side", "clear", "clip", "color", "color-profile", "column-count",
+ "caption-side", "caret-color", "clear", "clip", "color", "color-profile", "column-count",
"column-fill", "column-gap", "column-rule", "column-rule-color",
"column-rule-style", "column-rule-width", "column-span", "column-width",
"columns", "content", "counter-increment", "counter-reset", "crop", "cue",
@@ -489,14 +493,14 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"grid-row-start", "grid-template", "grid-template-areas", "grid-template-columns",
"grid-template-rows", "hanging-punctuation", "height", "hyphens",
"icon", "image-orientation", "image-rendering", "image-resolution",
- "inline-box-align", "justify-content", "left", "letter-spacing",
+ "inline-box-align", "justify-content", "justify-items", "justify-self", "left", "letter-spacing",
"line-break", "line-height", "line-stacking", "line-stacking-ruby",
"line-stacking-shift", "line-stacking-strategy", "list-style",
"list-style-image", "list-style-position", "list-style-type", "margin",
"margin-bottom", "margin-left", "margin-right", "margin-top",
- "marker-offset", "marks", "marquee-direction", "marquee-loop",
+ "marks", "marquee-direction", "marquee-loop",
"marquee-play-count", "marquee-speed", "marquee-style", "max-height",
- "max-width", "min-height", "min-width", "move-to", "nav-down", "nav-index",
+ "max-width", "min-height", "min-width", "mix-blend-mode", "move-to", "nav-down", "nav-index",
"nav-left", "nav-right", "nav-up", "object-fit", "object-position",
"opacity", "order", "orphans", "outline",
"outline-color", "outline-offset", "outline-style", "outline-width",
@@ -504,7 +508,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"padding", "padding-bottom", "padding-left", "padding-right", "padding-top",
"page", "page-break-after", "page-break-before", "page-break-inside",
"page-policy", "pause", "pause-after", "pause-before", "perspective",
- "perspective-origin", "pitch", "pitch-range", "play-during", "position",
+ "perspective-origin", "pitch", "pitch-range", "place-content", "place-items", "place-self", "play-during", "position",
"presentation-level", "punctuation-trim", "quotes", "region-break-after",
"region-break-before", "region-break-inside", "region-fragment",
"rendering-intent", "resize", "rest", "rest-after", "rest-before", "richness",
@@ -522,9 +526,9 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"text-wrap", "top", "transform", "transform-origin", "transform-style",
"transition", "transition-delay", "transition-duration",
"transition-property", "transition-timing-function", "unicode-bidi",
- "vertical-align", "visibility", "voice-balance", "voice-duration",
+ "user-select", "vertical-align", "visibility", "voice-balance", "voice-duration",
"voice-family", "voice-pitch", "voice-range", "voice-rate", "voice-stress",
- "voice-volume", "volume", "white-space", "widows", "width", "word-break",
+ "voice-volume", "volume", "white-space", "widows", "width", "will-change", "word-break",
"word-spacing", "word-wrap", "z-index",
// SVG-specific
"clip-path", "clip-rule", "mask", "enable-background", "filter", "flood-color",
@@ -589,7 +593,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"above", "absolute", "activeborder", "additive", "activecaption", "afar",
"after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate",
"always", "amharic", "amharic-abegede", "antialiased", "appworkspace",
- "arabic-indic", "armenian", "asterisks", "attr", "auto", "avoid", "avoid-column", "avoid-page",
+ "arabic-indic", "armenian", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page",
"avoid-region", "background", "backwards", "baseline", "below", "bidi-override", "binary",
"bengali", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box",
"both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel",
@@ -598,7 +602,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch",
"cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
"col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse",
- "compact", "condensed", "contain", "content",
+ "compact", "condensed", "contain", "content", "contents",
"content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop",
"cross", "crosshair", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal",
"decimal-leading-zero", "default", "default-button", "dense", "destination-atop",
@@ -641,7 +645,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"mix", "mongolian", "monospace", "move", "multiple", "multiply", "myanmar", "n-resize",
"narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
"no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
- "ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "open-quote",
+ "ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "opacity", "open-quote",
"optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset",
"outside", "outside-shape", "overlay", "overline", "padding", "padding-box",
"painted", "page", "paused", "persian", "perspective", "plus-darker", "plus-lighter",
@@ -653,17 +657,17 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY",
"rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running",
"s-resize", "sans-serif", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen",
- "scroll", "scrollbar", "se-resize", "searchfield",
+ "scroll", "scrollbar", "scroll-position", "se-resize", "searchfield",
"searchfield-cancel-button", "searchfield-decoration",
- "searchfield-results-button", "searchfield-results-decoration",
+ "searchfield-results-button", "searchfield-results-decoration", "self-start", "self-end",
"semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama",
"simp-chinese-formal", "simp-chinese-informal", "single",
"skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal",
"slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
"small", "small-caps", "small-caption", "smaller", "soft-light", "solid", "somali",
- "source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "spell-out", "square",
+ "source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "space-evenly", "spell-out", "square",
"square-button", "start", "static", "status-bar", "stretch", "stroke", "sub",
- "subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "table",
+ "subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "system-ui", "table",
"table-caption", "table-cell", "table-column", "table-column-group",
"table-footer-group", "table-header-group", "table-row", "table-row-group",
"tamil",
@@ -671,9 +675,9 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"thick", "thin", "threeddarkshadow", "threedface", "threedhighlight",
"threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er",
"tigrinya-er-abegede", "tigrinya-et", "tigrinya-et-abegede", "to", "top",
- "trad-chinese-formal", "trad-chinese-informal",
+ "trad-chinese-formal", "trad-chinese-informal", "transform",
"translate", "translate3d", "translateX", "translateY", "translateZ",
- "transparent", "ultra-condensed", "ultra-expanded", "underline", "up",
+ "transparent", "ultra-condensed", "ultra-expanded", "underline", "unset", "up",
"upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal",
"upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url",
"var", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted",
@@ -730,6 +734,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
valueKeywords: valueKeywords,
fontProperties: fontProperties,
allowNested: true,
+ lineComment: "//",
tokenHooks: {
"/": function(stream, state) {
if (stream.eat("/")) {
@@ -743,8 +748,8 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
}
},
":": function(stream) {
- if (stream.match(/\s*\{/))
- return [null, "{"];
+ if (stream.match(/\s*\{/, false))
+ return [null, null]
return false;
},
"$": function(stream) {
@@ -772,6 +777,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
valueKeywords: valueKeywords,
fontProperties: fontProperties,
allowNested: true,
+ lineComment: "//",
tokenHooks: {
"/": function(stream, state) {
if (stream.eat("/")) {
@@ -786,7 +792,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
},
"@": function(stream) {
if (stream.eat("{")) return [null, "interpolation"];
- if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/, false)) return false;
+ if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/i, false)) return false;
stream.eatWhile(/[\w\\\-]/);
if (stream.match(/^\s*:/, false))
return ["variable-2", "variable-definition"];
diff --git a/vendor/assets/javascripts/codemirror/modes/cypher.js b/vendor/assets/javascripts/codemirror/modes/cypher.js
index 107e4f6..8b22e65 100644
--- a/vendor/assets/javascripts/codemirror/modes/cypher.js
+++ b/vendor/assets/javascripts/codemirror/modes/cypher.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
// By the Neo4j Team and contributors.
// https://github.com/neo4j-contrib/CodeMirror
@@ -20,8 +20,12 @@
CodeMirror.defineMode("cypher", function(config) {
var tokenBase = function(stream/*, state*/) {
var ch = stream.next();
- if (ch === "\"" || ch === "'") {
- stream.match(/.+?["']/);
+ if (ch ==='"') {
+ stream.match(/.*?"/);
+ return "string";
+ }
+ if (ch === "'") {
+ stream.match(/.*?'/);
return "string";
}
if (/[{}\(\),\.;\[\]]/.test(ch)) {
@@ -62,7 +66,7 @@
var curPunc;
var funcs = wordRegexp(["abs", "acos", "allShortestPaths", "asin", "atan", "atan2", "avg", "ceil", "coalesce", "collect", "cos", "cot", "count", "degrees", "e", "endnode", "exp", "extract", "filter", "floor", "haversin", "head", "id", "keys", "labels", "last", "left", "length", "log", "log10", "lower", "ltrim", "max", "min", "node", "nodes", "percentileCont", "percentileDisc", "pi", "radians", "rand", "range", "reduce", "rel", "relationship", "relationships", "replace", "reverse", "right", "round", "rtrim", "shortestPath", "sign", "sin", "size", "split", "sqrt", "startnode", "stdev", "stdevp", "str", "substring", "sum", "tail", "tan", "timestamp", "toFloat", "toInt", "toString", "trim", "type", "upper"]);
var preds = wordRegexp(["all", "and", "any", "contains", "exists", "has", "in", "none", "not", "or", "single", "xor"]);
- var keywords = wordRegexp(["as", "asc", "ascending", "assert", "by", "case", "commit", "constraint", "create", "csv", "cypher", "delete", "desc", "descending", "detach", "distinct", "drop", "else", "end", "ends", "explain", "false", "fieldterminator", "foreach", "from", "headers", "in", "index", "is", "join", "limit", "load", "match", "merge", "null", "on", "optional", "order", "periodic", "profile", "remove", "return", "scan", "set", "skip", "start", "starts", "then", "true", "union", "unique", "unwind", "using", "when", "where", "with"]);
+ var keywords = wordRegexp(["as", "asc", "ascending", "assert", "by", "case", "commit", "constraint", "create", "csv", "cypher", "delete", "desc", "descending", "detach", "distinct", "drop", "else", "end", "ends", "explain", "false", "fieldterminator", "foreach", "from", "headers", "in", "index", "is", "join", "limit", "load", "match", "merge", "null", "on", "optional", "order", "periodic", "profile", "remove", "return", "scan", "set", "skip", "start", "starts", "then", "true", "union", "unique", "unwind", "using", "when", "where", "with", "call", "yield"]);
var operatorChars = /[*+\-<>=&|~%^]/;
return {
diff --git a/vendor/assets/javascripts/codemirror/modes/d.js b/vendor/assets/javascripts/codemirror/modes/d.js
index c927a7e..efab570 100644
--- a/vendor/assets/javascripts/codemirror/modes/d.js
+++ b/vendor/assets/javascripts/codemirror/modes/d.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -44,7 +44,7 @@ CodeMirror.defineMode("d", function(config, parserConfig) {
}
if (ch == "/") {
if (stream.eat("+")) {
- state.tokenize = tokenComment;
+ state.tokenize = tokenNestedComment;
return tokenNestedComment(stream, state);
}
if (stream.eat("*")) {
@@ -182,7 +182,12 @@ CodeMirror.defineMode("d", function(config, parserConfig) {
else return ctx.indented + (closing ? 0 : indentUnit);
},
- electricChars: "{}"
+ electricChars: "{}",
+ blockCommentStart: "/*",
+ blockCommentEnd: "*/",
+ blockCommentContinue: " * ",
+ lineComment: "//",
+ fold: "brace"
};
});
diff --git a/vendor/assets/javascripts/codemirror/modes/dart.js b/vendor/assets/javascripts/codemirror/modes/dart.js
index 8d383a9..0a66bf1 100644
--- a/vendor/assets/javascripts/codemirror/modes/dart.js
+++ b/vendor/assets/javascripts/codemirror/modes/dart.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -12,8 +12,8 @@
"use strict";
var keywords = ("this super static final const abstract class extends external factory " +
- "implements get native operator set typedef with enum throw rethrow " +
- "assert break case continue default in return new deferred async await " +
+ "implements mixin get native set typedef with enum throw rethrow " +
+ "assert break case continue default in return new deferred async await covariant " +
"try catch finally do else for if switch while import library export " +
"part of show hide is as").split(" ");
var blockKeywords = "try catch finally do else for if switch while".split(" ");
diff --git a/vendor/assets/javascripts/codemirror/modes/diff.js b/vendor/assets/javascripts/codemirror/modes/diff.js
index fe0305e..a30fd37 100644
--- a/vendor/assets/javascripts/codemirror/modes/diff.js
+++ b/vendor/assets/javascripts/codemirror/modes/diff.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/django.js b/vendor/assets/javascripts/codemirror/modes/django.js
index 7b4ef3b..07be123 100644
--- a/vendor/assets/javascripts/codemirror/modes/django.js
+++ b/vendor/assets/javascripts/codemirror/modes/django.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/dockerfile.js b/vendor/assets/javascripts/codemirror/modes/dockerfile.js
index 4419009..983170f 100644
--- a/vendor/assets/javascripts/codemirror/modes/dockerfile.js
+++ b/vendor/assets/javascripts/codemirror/modes/dockerfile.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -11,30 +11,64 @@
})(function(CodeMirror) {
"use strict";
+ var from = "from";
+ var fromRegex = new RegExp("^(\\s*)\\b(" + from + ")\\b", "i");
+
+ var shells = ["run", "cmd", "entrypoint", "shell"];
+ var shellsAsArrayRegex = new RegExp("^(\\s*)(" + shells.join('|') + ")(\\s+\\[)", "i");
+
+ var expose = "expose";
+ var exposeRegex = new RegExp("^(\\s*)(" + expose + ")(\\s+)", "i");
+
+ var others = [
+ "arg", "from", "maintainer", "label", "env",
+ "add", "copy", "volume", "user",
+ "workdir", "onbuild", "stopsignal", "healthcheck", "shell"
+ ];
+
// Collect all Dockerfile directives
- var instructions = ["from", "maintainer", "run", "cmd", "expose", "env",
- "add", "copy", "entrypoint", "volume", "user",
- "workdir", "onbuild"],
+ var instructions = [from, expose].concat(shells).concat(others),
instructionRegex = "(" + instructions.join('|') + ")",
- instructionOnlyLine = new RegExp(instructionRegex + "\\s*$", "i"),
- instructionWithArguments = new RegExp(instructionRegex + "(\\s+)", "i");
+ instructionOnlyLine = new RegExp("^(\\s*)" + instructionRegex + "(\\s*)(#.*)?$", "i"),
+ instructionWithArguments = new RegExp("^(\\s*)" + instructionRegex + "(\\s+)", "i");
CodeMirror.defineSimpleMode("dockerfile", {
start: [
// Block comment: This is a line starting with a comment
{
- regex: /#.*$/,
+ regex: /^\s*#.*$/,
+ sol: true,
token: "comment"
},
+ {
+ regex: fromRegex,
+ token: [null, "keyword"],
+ sol: true,
+ next: "from"
+ },
// Highlight an instruction without any arguments (for convenience)
{
regex: instructionOnlyLine,
- token: "variable-2"
+ token: [null, "keyword", null, "error"],
+ sol: true
+ },
+ {
+ regex: shellsAsArrayRegex,
+ token: [null, "keyword", null],
+ sol: true,
+ next: "array"
+ },
+ {
+ regex: exposeRegex,
+ token: [null, "keyword", null],
+ sol: true,
+ next: "expose"
},
// Highlight an instruction followed by arguments
{
regex: instructionWithArguments,
- token: ["variable-2", null],
+ token: [null, "keyword", null],
+ sol: true,
next: "arguments"
},
{
@@ -42,37 +76,135 @@
token: null
}
],
- arguments: [
+ from: [
+ {
+ regex: /\s*$/,
+ token: null,
+ next: "start"
+ },
{
// Line comment without instruction arguments is an error
- regex: /#.*$/,
- token: "error",
+ regex: /(\s*)(#.*)$/,
+ token: [null, "error"],
next: "start"
},
{
- regex: /[^#]+\\$/,
- token: null
+ regex: /(\s*\S+\s+)(as)/i,
+ token: [null, "keyword"],
+ next: "start"
},
+ // Fail safe return to start
{
- // Match everything except for the inline comment
- regex: /[^#]+/,
token: null,
next: "start"
+ }
+ ],
+ single: [
+ {
+ regex: /(?:[^\\']|\\.)/,
+ token: "string"
},
{
- regex: /$/,
+ regex: /'/,
+ token: "string",
+ pop: true
+ }
+ ],
+ double: [
+ {
+ regex: /(?:[^\\"]|\\.)/,
+ token: "string"
+ },
+ {
+ regex: /"/,
+ token: "string",
+ pop: true
+ }
+ ],
+ array: [
+ {
+ regex: /\]/,
token: null,
next: "start"
},
+ {
+ regex: /"(?:[^\\"]|\\.)*"?/,
+ token: "string"
+ }
+ ],
+ expose: [
+ {
+ regex: /\d+$/,
+ token: "number",
+ next: "start"
+ },
+ {
+ regex: /[^\d]+$/,
+ token: null,
+ next: "start"
+ },
+ {
+ regex: /\d+/,
+ token: "number"
+ },
+ {
+ regex: /[^\d]+/,
+ token: null
+ },
// Fail safe return to start
{
token: null,
next: "start"
}
],
- meta: {
- lineComment: "#"
+ arguments: [
+ {
+ regex: /^\s*#.*$/,
+ sol: true,
+ token: "comment"
+ },
+ {
+ regex: /"(?:[^\\"]|\\.)*"?$/,
+ token: "string",
+ next: "start"
+ },
+ {
+ regex: /"/,
+ token: "string",
+ push: "double"
+ },
+ {
+ regex: /'(?:[^\\']|\\.)*'?$/,
+ token: "string",
+ next: "start"
+ },
+ {
+ regex: /'/,
+ token: "string",
+ push: "single"
+ },
+ {
+ regex: /[^#"']+[\\`]$/,
+ token: null
+ },
+ {
+ regex: /[^#"']+$/,
+ token: null,
+ next: "start"
+ },
+ {
+ regex: /[^#"']+/,
+ token: null
+ },
+ // Fail safe return to start
+ {
+ token: null,
+ next: "start"
}
+ ],
+ meta: {
+ lineComment: "#"
+ }
});
CodeMirror.defineMIME("text/x-dockerfile", "dockerfile");
diff --git a/vendor/assets/javascripts/codemirror/modes/dtd.js b/vendor/assets/javascripts/codemirror/modes/dtd.js
index 52d76ee..74b8c6b 100644
--- a/vendor/assets/javascripts/codemirror/modes/dtd.js
+++ b/vendor/assets/javascripts/codemirror/modes/dtd.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
/*
DTD mode
diff --git a/vendor/assets/javascripts/codemirror/modes/dylan.js b/vendor/assets/javascripts/codemirror/modes/dylan.js
index 1b46bc8..6725edc 100644
--- a/vendor/assets/javascripts/codemirror/modes/dylan.js
+++ b/vendor/assets/javascripts/codemirror/modes/dylan.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -11,6 +11,14 @@
})(function(CodeMirror) {
"use strict";
+function forEach(arr, f) {
+ for (var i = 0; i < arr.length; i++) f(arr[i], i)
+}
+function some(arr, f) {
+ for (var i = 0; i < arr.length; i++) if (f(arr[i], i)) return true
+ return false
+}
+
CodeMirror.defineMode("dylan", function(_config) {
// Words
var words = {
@@ -136,13 +144,13 @@ CodeMirror.defineMode("dylan", function(_config) {
var wordLookup = {};
var styleLookup = {};
- [
+ forEach([
"keyword",
"definition",
"simpleDefinition",
"signalingCalls"
- ].forEach(function(type) {
- words[type].forEach(function(word) {
+ ], function(type) {
+ forEach(words[type], function(word) {
wordLookup[word] = type;
styleLookup[word] = styles[type];
});
@@ -258,7 +266,7 @@ CodeMirror.defineMode("dylan", function(_config) {
for (var name in patterns) {
if (patterns.hasOwnProperty(name)) {
var pattern = patterns[name];
- if ((pattern instanceof Array && pattern.some(function(p) {
+ if ((pattern instanceof Array && some(pattern, function(p) {
return stream.match(p);
})) || stream.match(pattern))
return patternStyles[name];
@@ -273,7 +281,7 @@ CodeMirror.defineMode("dylan", function(_config) {
} else {
stream.eatWhile(/[\w\-]/);
// Keyword
- if (wordLookup[stream.current()]) {
+ if (wordLookup.hasOwnProperty(stream.current())) {
return styleLookup[stream.current()];
} else if (stream.current().match(symbol)) {
return "variable";
diff --git a/vendor/assets/javascripts/codemirror/modes/ebnf.js b/vendor/assets/javascripts/codemirror/modes/ebnf.js
index 9618f8e..238bbe2 100644
--- a/vendor/assets/javascripts/codemirror/modes/ebnf.js
+++ b/vendor/assets/javascripts/codemirror/modes/ebnf.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/ecl.js b/vendor/assets/javascripts/codemirror/modes/ecl.js
index 8df7ebe..9af8aee 100644
--- a/vendor/assets/javascripts/codemirror/modes/ecl.js
+++ b/vendor/assets/javascripts/codemirror/modes/ecl.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/eiffel.js b/vendor/assets/javascripts/codemirror/modes/eiffel.js
index b8b70e3..f6f3f45 100644
--- a/vendor/assets/javascripts/codemirror/modes/eiffel.js
+++ b/vendor/assets/javascripts/codemirror/modes/eiffel.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/elm.js b/vendor/assets/javascripts/codemirror/modes/elm.js
index b31e663..fe8dd49 100644
--- a/vendor/assets/javascripts/codemirror/modes/elm.js
+++ b/vendor/assets/javascripts/codemirror/modes/elm.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -70,7 +70,7 @@
if (smallRE.test(ch)) {
var isDef = source.pos === 1;
source.eatWhile(idRE);
- return isDef ? "variable-3" : "variable";
+ return isDef ? "type" : "variable";
}
if (digitRE.test(ch)) {
diff --git a/vendor/assets/javascripts/codemirror/modes/erlang.js b/vendor/assets/javascripts/codemirror/modes/erlang.js
index 5aed76a..f0541bb 100644
--- a/vendor/assets/javascripts/codemirror/modes/erlang.js
+++ b/vendor/assets/javascripts/codemirror/modes/erlang.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
/*jshint unused:true, eqnull:true, curly:true, bitwise:true */
/*jshint undef:true, latedef:true, trailing:true */
@@ -433,15 +433,16 @@ CodeMirror.defineMode("erlang", function(cmCfg) {
}
function maybe_drop_post(s) {
+ if (!s.length) return s
var last = s.length-1;
if (s[last].type === "dot") {
return [];
}
- if (s[last].type === "fun" && s[last-1].token === "fun") {
+ if (last > 1 && s[last].type === "fun" && s[last-1].token === "fun") {
return s.slice(0,last-1);
}
- switch (s[s.length-1].token) {
+ switch (s[last].token) {
case "}": return d(s,{g:["{"]});
case "]": return d(s,{i:["["]});
case ")": return d(s,{i:["("]});
diff --git a/vendor/assets/javascripts/codemirror/modes/factor.js b/vendor/assets/javascripts/codemirror/modes/factor.js
index 86d7adf..7108278 100644
--- a/vendor/assets/javascripts/codemirror/modes/factor.js
+++ b/vendor/assets/javascripts/codemirror/modes/factor.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
// Factor syntax highlight - simple mode
//
@@ -22,52 +22,54 @@
{regex: /#?!.*/, token: "comment"},
// strings """, multiline --> state
{regex: /"""/, token: "string", next: "string3"},
- {regex: /"/, token: "string", next: "string"},
+ {regex: /(STRING:)(\s)/, token: ["keyword", null], next: "string2"},
+ {regex: /\S*?"/, token: "string", next: "string"},
// numbers: dec, hex, unicode, bin, fractional, complex
- {regex: /(?:[+-]?)(?:0x[\d,a-f]+)|(?:0o[0-7]+)|(?:0b[0,1]+)|(?:\d+.?\d*)/, token: "number"},
+ {regex: /(?:0x[\d,a-f]+)|(?:0o[0-7]+)|(?:0b[0,1]+)|(?:\-?\d+.?\d*)(?=\s)/, token: "number"},
//{regex: /[+-]?/} //fractional
// definition: defining word, defined word, etc
- {regex: /(\:)(\s+)(\S+)(\s+)(\()/, token: ["keyword", null, "def", null, "keyword"], next: "stack"},
+ {regex: /((?:GENERIC)|\:?\:)(\s+)(\S+)(\s+)(\()/, token: ["keyword", null, "def", null, "bracket"], next: "stack"},
+ // method definition: defining word, type, defined word, etc
+ {regex: /(M\:)(\s+)(\S+)(\s+)(\S+)/, token: ["keyword", null, "def", null, "tag"]},
// vocabulary using --> state
{regex: /USING\:/, token: "keyword", next: "vocabulary"},
// vocabulary definition/use
- {regex: /(USE\:|IN\:)(\s+)(\S+)/, token: ["keyword", null, "variable-2"]},
- //
- {regex: /<\S+>/, token: "builtin"},
+ {regex: /(USE\:|IN\:)(\s+)(\S+)(?=\s|$)/, token: ["keyword", null, "tag"]},
+ // definition: a defining word, defined word
+ {regex: /(\S+\:)(\s+)(\S+)(?=\s|$)/, token: ["keyword", null, "def"]},
// "keywords", incl. ; t f . [ ] { } defining words
- {regex: /;|t|f|if|\.|\[|\]|\{|\}|MAIN:/, token: "keyword"},
+ {regex: /(?:;|\\|t|f|if|loop|while|until|do|PRIVATE>| and the like
+ {regex: /\S+[\)>\.\*\?]+(?=\s|$)/, token: "builtin"},
+ {regex: /[\)><]+\S+(?=\s|$)/, token: "builtin"},
+ // operators
+ {regex: /(?:[\+\-\=\/\*<>])(?=\s|$)/, token: "keyword"},
// any id (?)
{regex: /\S+/, token: "variable"},
-
- {
- regex: /./,
- token: null
- }
+ {regex: /\s+|./, token: null}
],
vocabulary: [
{regex: /;/, token: "keyword", next: "start"},
- {regex: /\S+/, token: "variable-2"},
- {
- regex: /./,
- token: null
- }
+ {regex: /\S+/, token: "tag"},
+ {regex: /\s+|./, token: null}
],
string: [
{regex: /(?:[^\\]|\\.)*?"/, token: "string", next: "start"},
{regex: /.*/, token: "string"}
],
+ string2: [
+ {regex: /^;/, token: "keyword", next: "start"},
+ {regex: /.*/, token: "string"}
+ ],
string3: [
{regex: /(?:[^\\]|\\.)*?"""/, token: "string", next: "start"},
{regex: /.*/, token: "string"}
],
stack: [
- {regex: /\)/, token: "meta", next: "start"},
- {regex: /--/, token: "meta"},
- {regex: /\S+/, token: "variable-3"},
- {
- regex: /./,
- token: null
- }
+ {regex: /\)/, token: "bracket", next: "start"},
+ {regex: /--/, token: "bracket"},
+ {regex: /\S+/, token: "meta"},
+ {regex: /\s+|./, token: null}
],
// The meta property contains global information about the mode. It
// can contain properties like lineComment, which are supported by
diff --git a/vendor/assets/javascripts/codemirror/modes/fcl.js b/vendor/assets/javascripts/codemirror/modes/fcl.js
index 5181169..2d3f200 100644
--- a/vendor/assets/javascripts/codemirror/modes/fcl.js
+++ b/vendor/assets/javascripts/codemirror/modes/fcl.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/forth.js b/vendor/assets/javascripts/codemirror/modes/forth.js
index 1f519d8..f2caa27 100644
--- a/vendor/assets/javascripts/codemirror/modes/forth.js
+++ b/vendor/assets/javascripts/codemirror/modes/forth.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
// Author: Aliaksei Chapyzhenka
diff --git a/vendor/assets/javascripts/codemirror/modes/fortran.js b/vendor/assets/javascripts/codemirror/modes/fortran.js
index 4d88f00..85bacc4 100644
--- a/vendor/assets/javascripts/codemirror/modes/fortran.js
+++ b/vendor/assets/javascripts/codemirror/modes/fortran.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/gas.js b/vendor/assets/javascripts/codemirror/modes/gas.js
index 0c74bed..e34d7a7 100644
--- a/vendor/assets/javascripts/codemirror/modes/gas.js
+++ b/vendor/assets/javascripts/codemirror/modes/gas.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/gfm.js b/vendor/assets/javascripts/codemirror/modes/gfm.js
index 6e74ad4..492c948 100644
--- a/vendor/assets/javascripts/codemirror/modes/gfm.js
+++ b/vendor/assets/javascripts/codemirror/modes/gfm.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -81,7 +81,7 @@ CodeMirror.defineMode("gfm", function(config, modeConfig) {
if (stream.sol() || state.ateSpace) {
state.ateSpace = false;
if (modeConfig.gitHubSpice !== false) {
- if(stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/)) {
+ if(stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?=.{0,6}\d)(?:[a-f0-9]{7,40}\b)/)) {
// User/Project@SHA
// User@SHA
// SHA
@@ -113,10 +113,9 @@ CodeMirror.defineMode("gfm", function(config, modeConfig) {
};
var markdownConfig = {
- underscoresBreakWords: false,
taskLists: true,
- fencedCodeBlocks: '```',
- strikethrough: true
+ strikethrough: true,
+ emoji: true
};
for (var attr in modeConfig) {
markdownConfig[attr] = modeConfig[attr];
diff --git a/vendor/assets/javascripts/codemirror/modes/gherkin.js b/vendor/assets/javascripts/codemirror/modes/gherkin.js
index fc2ebee..1b438b9 100644
--- a/vendor/assets/javascripts/codemirror/modes/gherkin.js
+++ b/vendor/assets/javascripts/codemirror/modes/gherkin.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
/*
Gherkin mode - http://www.cukes.info/
diff --git a/vendor/assets/javascripts/codemirror/modes/go.js b/vendor/assets/javascripts/codemirror/modes/go.js
index 3c9ef6b..c005e42 100644
--- a/vendor/assets/javascripts/codemirror/modes/go.js
+++ b/vendor/assets/javascripts/codemirror/modes/go.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -23,12 +23,13 @@ CodeMirror.defineMode("go", function(config) {
"bool":true, "byte":true, "complex64":true, "complex128":true,
"float32":true, "float64":true, "int8":true, "int16":true, "int32":true,
"int64":true, "string":true, "uint8":true, "uint16":true, "uint32":true,
- "uint64":true, "int":true, "uint":true, "uintptr":true, "error": true
+ "uint64":true, "int":true, "uint":true, "uintptr":true, "error": true,
+ "rune":true
};
var atoms = {
"true":true, "false":true, "iota":true, "nil":true, "append":true,
- "cap":true, "close":true, "complex":true, "copy":true, "imag":true,
+ "cap":true, "close":true, "complex":true, "copy":true, "delete":true, "imag":true,
"len":true, "make":true, "new":true, "panic":true, "print":true,
"println":true, "real":true, "recover":true
};
@@ -154,14 +155,14 @@ CodeMirror.defineMode("go", function(config) {
else if (curPunc == "[") pushContext(state, stream.column(), "]");
else if (curPunc == "(") pushContext(state, stream.column(), ")");
else if (curPunc == "case") ctx.type = "case";
- else if (curPunc == "}" && ctx.type == "}") ctx = popContext(state);
+ else if (curPunc == "}" && ctx.type == "}") popContext(state);
else if (curPunc == ctx.type) popContext(state);
state.startOfLine = false;
return style;
},
indent: function(state, textAfter) {
- if (state.tokenize != tokenBase && state.tokenize != null) return 0;
+ if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass;
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
if (ctx.type == "case" && /^(?:case|default)\b/.test(textAfter)) {
state.context.type = "}";
@@ -173,6 +174,7 @@ CodeMirror.defineMode("go", function(config) {
},
electricChars: "{}):",
+ closeBrackets: "()[]{}''\"\"``",
fold: "brace",
blockCommentStart: "/*",
blockCommentEnd: "*/",
diff --git a/vendor/assets/javascripts/codemirror/modes/groovy.js b/vendor/assets/javascripts/codemirror/modes/groovy.js
index 721933b..2b90d01 100644
--- a/vendor/assets/javascripts/codemirror/modes/groovy.js
+++ b/vendor/assets/javascripts/codemirror/modes/groovy.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -21,9 +21,9 @@ CodeMirror.defineMode("groovy", function(config) {
"abstract as assert boolean break byte case catch char class const continue def default " +
"do double else enum extends final finally float for goto if implements import in " +
"instanceof int interface long native new package private protected public return " +
- "short static strictfp super switch synchronized threadsafe throw throws transient " +
+ "short static strictfp super switch synchronized threadsafe throw throws trait transient " +
"try void volatile while");
- var blockKeywords = words("catch class do else finally for if switch try while enum interface def");
+ var blockKeywords = words("catch class def do else enum finally for if interface switch trait try while");
var standaloneKeywords = words("return break continue");
var atoms = words("null true false this");
@@ -210,7 +210,7 @@ CodeMirror.defineMode("groovy", function(config) {
},
indent: function(state, textAfter) {
- if (!state.tokenize[state.tokenize.length-1].isBase) return 0;
+ if (!state.tokenize[state.tokenize.length-1].isBase) return CodeMirror.Pass;
var firstChar = textAfter && textAfter.charAt(0), ctx = state.context;
if (ctx.type == "statement" && !expectExpression(state.lastToken, true)) ctx = ctx.prev;
var closing = firstChar == ctx.type;
@@ -221,7 +221,10 @@ CodeMirror.defineMode("groovy", function(config) {
electricChars: "{}",
closeBrackets: {triples: "'\""},
- fold: "brace"
+ fold: "brace",
+ blockCommentStart: "/*",
+ blockCommentEnd: "*/",
+ lineComment: "//"
};
});
diff --git a/vendor/assets/javascripts/codemirror/modes/haml.js b/vendor/assets/javascripts/codemirror/modes/haml.js
index 20ae1e1..3c8f505 100644
--- a/vendor/assets/javascripts/codemirror/modes/haml.js
+++ b/vendor/assets/javascripts/codemirror/modes/haml.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/handlebars.js b/vendor/assets/javascripts/codemirror/modes/handlebars.js
index 2174e53..93865b7 100644
--- a/vendor/assets/javascripts/codemirror/modes/handlebars.js
+++ b/vendor/assets/javascripts/codemirror/modes/handlebars.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -46,7 +46,11 @@
comment: [
{ regex: /\}\}/, pop: true, token: "comment" },
{ regex: /./, token: "comment" }
- ]
+ ],
+ meta: {
+ blockCommentStart: "{{--",
+ blockCommentEnd: "--}}"
+ }
});
CodeMirror.defineMode("handlebars", function(config, parserConfig) {
diff --git a/vendor/assets/javascripts/codemirror/modes/haskell-literate.js b/vendor/assets/javascripts/codemirror/modes/haskell-literate.js
index 906415b..4bb9268 100644
--- a/vendor/assets/javascripts/codemirror/modes/haskell-literate.js
+++ b/vendor/assets/javascripts/codemirror/modes/haskell-literate.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function (mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/haskell.js b/vendor/assets/javascripts/codemirror/modes/haskell.js
index fe0bab6..2e882dc 100644
--- a/vendor/assets/javascripts/codemirror/modes/haskell.js
+++ b/vendor/assets/javascripts/codemirror/modes/haskell.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -56,7 +56,7 @@ CodeMirror.defineMode("haskell", function(_config, modeConfig) {
if (source.eat('\'')) {
return "string";
}
- return "error";
+ return "string error";
}
if (ch == '"') {
@@ -166,7 +166,7 @@ CodeMirror.defineMode("haskell", function(_config, modeConfig) {
}
}
setState(normal);
- return "error";
+ return "string error";
}
function stringGap(source, setState) {
@@ -194,16 +194,17 @@ CodeMirror.defineMode("haskell", function(_config, modeConfig) {
"module", "newtype", "of", "then", "type", "where", "_");
setType("keyword")(
- "\.\.", ":", "::", "=", "\\", "\"", "<-", "->", "@", "~", "=>");
+ "\.\.", ":", "::", "=", "\\", "<-", "->", "@", "~", "=>");
setType("builtin")(
- "!!", "$!", "$", "&&", "+", "++", "-", ".", "/", "/=", "<", "<=", "=<<",
- "==", ">", ">=", ">>", ">>=", "^", "^^", "||", "*", "**");
+ "!!", "$!", "$", "&&", "+", "++", "-", ".", "/", "/=", "<", "<*", "<=",
+ "<$>", "<*>", "=<<", "==", ">", ">=", ">>", ">>=", "^", "^^", "||", "*",
+ "*>", "**");
setType("builtin")(
- "Bool", "Bounded", "Char", "Double", "EQ", "Either", "Enum", "Eq",
- "False", "FilePath", "Float", "Floating", "Fractional", "Functor", "GT",
- "IO", "IOError", "Int", "Integer", "Integral", "Just", "LT", "Left",
+ "Applicative", "Bool", "Bounded", "Char", "Double", "EQ", "Either", "Enum",
+ "Eq", "False", "FilePath", "Float", "Floating", "Fractional", "Functor",
+ "GT", "IO", "IOError", "Int", "Integer", "Integral", "Just", "LT", "Left",
"Maybe", "Monad", "Nothing", "Num", "Ord", "Ordering", "Rational", "Read",
"ReadS", "Real", "RealFloat", "RealFrac", "Right", "Show", "ShowS",
"String", "True");
@@ -223,7 +224,7 @@ CodeMirror.defineMode("haskell", function(_config, modeConfig) {
"lcm", "length", "lex", "lines", "log", "logBase", "lookup", "map",
"mapM", "mapM_", "max", "maxBound", "maximum", "maybe", "min", "minBound",
"minimum", "mod", "negate", "not", "notElem", "null", "odd", "or",
- "otherwise", "pi", "pred", "print", "product", "properFraction",
+ "otherwise", "pi", "pred", "print", "product", "properFraction", "pure",
"putChar", "putStr", "putStrLn", "quot", "quotRem", "read", "readFile",
"readIO", "readList", "readLn", "readParen", "reads", "readsPrec",
"realToFrac", "recip", "rem", "repeat", "replicate", "return", "reverse",
diff --git a/vendor/assets/javascripts/codemirror/modes/haxe.js b/vendor/assets/javascripts/codemirror/modes/haxe.js
index a9573dd..4537685 100644
--- a/vendor/assets/javascripts/codemirror/modes/haxe.js
+++ b/vendor/assets/javascripts/codemirror/modes/haxe.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -485,7 +485,7 @@ CodeMirror.defineMode("hxml", function () {
if (state.inString == false && ch == "'") {
state.inString = true;
- ch = stream.next();
+ stream.next();
}
if (state.inString == true) {
diff --git a/vendor/assets/javascripts/codemirror/modes/htmlembedded.js b/vendor/assets/javascripts/codemirror/modes/htmlembedded.js
index 464dc57..439e63a 100644
--- a/vendor/assets/javascripts/codemirror/modes/htmlembedded.js
+++ b/vendor/assets/javascripts/codemirror/modes/htmlembedded.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -14,7 +14,16 @@
"use strict";
CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
+ var closeComment = parserConfig.closeComment || "--%>"
return CodeMirror.multiplexingMode(CodeMirror.getMode(config, "htmlmixed"), {
+ open: parserConfig.openComment || "<%--",
+ close: closeComment,
+ delimStyle: "comment",
+ mode: {token: function(stream) {
+ stream.skipTo(closeComment) || stream.skipToEnd()
+ return "comment"
+ }}
+ }, {
open: parserConfig.open || parserConfig.scriptStartRegex || "<%",
close: parserConfig.close || parserConfig.scriptEndRegex || "%>",
mode: CodeMirror.getMode(config, parserConfig.scriptingModeSpec)
diff --git a/vendor/assets/javascripts/codemirror/modes/htmlmixed.js b/vendor/assets/javascripts/codemirror/modes/htmlmixed.js
index d74083e..8341ac8 100644
--- a/vendor/assets/javascripts/codemirror/modes/htmlmixed.js
+++ b/vendor/assets/javascripts/codemirror/modes/htmlmixed.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -14,7 +14,7 @@
var defaultTags = {
script: [
["lang", /(javascript|babel)/i, "javascript"],
- ["type", /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i, "javascript"],
+ ["type", /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i, "javascript"],
["type", /./, "text/plain"],
[null, null, "javascript"]
],
@@ -46,7 +46,7 @@
function getAttrValue(text, attr) {
var match = text.match(getAttrRegexp(attr))
- return match ? match[2] : ""
+ return match ? /^\s*(.*?)\s*$/.exec(match[2])[1] : ""
}
function getTagRegexp(tagName, anchored) {
@@ -105,7 +105,7 @@
return maybeBackup(stream, endTag, state.localMode.token(stream, state.localState));
};
state.localMode = mode;
- state.localState = CodeMirror.startState(mode, htmlMode.indent(state.htmlState, ""));
+ state.localState = CodeMirror.startState(mode, htmlMode.indent(state.htmlState, "", ""));
} else if (state.inTag) {
state.inTag += stream.current()
if (stream.eol()) state.inTag += " "
@@ -133,11 +133,11 @@
return state.token(stream, state);
},
- indent: function (state, textAfter) {
+ indent: function (state, textAfter, line) {
if (!state.localMode || /^\s*<\//.test(textAfter))
- return htmlMode.indent(state.htmlState, textAfter);
+ return htmlMode.indent(state.htmlState, textAfter, line);
else if (state.localMode.indent)
- return state.localMode.indent(state.localState, textAfter);
+ return state.localMode.indent(state.localState, textAfter, line);
else
return CodeMirror.Pass;
},
diff --git a/vendor/assets/javascripts/codemirror/modes/http.js b/vendor/assets/javascripts/codemirror/modes/http.js
index 9a3c5f9..0923532 100644
--- a/vendor/assets/javascripts/codemirror/modes/http.js
+++ b/vendor/assets/javascripts/codemirror/modes/http.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/idl.js b/vendor/assets/javascripts/codemirror/modes/idl.js
index 07308d7..168761c 100644
--- a/vendor/assets/javascripts/codemirror/modes/idl.js
+++ b/vendor/assets/javascripts/codemirror/modes/idl.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/javascript.js b/vendor/assets/javascripts/codemirror/modes/javascript.js
index ca87541..8055f1b 100644
--- a/vendor/assets/javascripts/codemirror/modes/javascript.js
+++ b/vendor/assets/javascripts/codemirror/modes/javascript.js
@@ -1,7 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-// TODO actually recognize syntax of TypeScript constructs
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -13,11 +11,6 @@
})(function(CodeMirror) {
"use strict";
-function expressionAllowed(stream, state, backUp) {
- return /^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(state.lastType) ||
- (state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))
-}
-
CodeMirror.defineMode("javascript", function(config, parserConfig) {
var indentUnit = config.indentUnit;
var statementIndent = parserConfig.statementIndent;
@@ -30,55 +23,24 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
var keywords = function(){
function kw(type) {return {type: type, style: "keyword"};}
- var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
+ var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"), D = kw("keyword d");
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
- var jsKeywords = {
+ return {
"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"),
+ "return": D, "break": D, "continue": D, "new": kw("new"), "delete": C, "void": C, "throw": C,
+ "debugger": kw("debugger"), "var": kw("var"), "const": kw("var"), "let": kw("var"),
"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"),
"yield": C, "export": kw("export"), "import": kw("import"), "extends": C,
- "await": C, "async": kw("async")
+ "await": C
};
-
- // Extend the 'normal' keywords with the TypeScript language extensions
- if (isTS) {
- var type = {type: "variable", style: "variable-3"};
- var tsKeywords = {
- // object-like things
- "interface": kw("class"),
- "implements": C,
- "namespace": C,
- "module": kw("module"),
- "enum": kw("module"),
-
- // scope modifiers
- "public": kw("modifier"),
- "private": kw("modifier"),
- "protected": kw("modifier"),
- "abstract": kw("modifier"),
-
- // operators
- "as": operator,
-
- // types
- "string": type, "number": type, "boolean": type, "any": type
- };
-
- for (var attr in tsKeywords) {
- jsKeywords[attr] = tsKeywords[attr];
- }
- }
-
- return jsKeywords;
}();
- var isOperatorChar = /[+\-*&%=<>!?|~^]/;
+ var isOperatorChar = /[+\-*&%=<>!?|~^@]/;
var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;
function readRegexp(stream) {
@@ -105,7 +67,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (ch == '"' || ch == "'") {
state.tokenize = tokenString(ch);
return state.tokenize(stream, state);
- } else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) {
+ } else if (ch == "." && stream.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/)) {
return ret("number", "number");
} else if (ch == "." && stream.match("..")) {
return ret("spread", "meta");
@@ -113,17 +75,10 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
return ret(ch);
} else if (ch == "=" && stream.eat(">")) {
return ret("=>", "operator");
- } else if (ch == "0" && stream.eat(/x/i)) {
- stream.eatWhile(/[\da-f]/i);
- return ret("number", "number");
- } else if (ch == "0" && stream.eat(/o/i)) {
- stream.eatWhile(/[0-7]/i);
- return ret("number", "number");
- } else if (ch == "0" && stream.eat(/b/i)) {
- stream.eatWhile(/[01]/i);
+ } else if (ch == "0" && stream.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/)) {
return ret("number", "number");
} else if (/\d/.test(ch)) {
- stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
+ stream.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/);
return ret("number", "number");
} else if (ch == "/") {
if (stream.eat("*")) {
@@ -134,10 +89,10 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
return ret("comment", "comment");
} else if (expressionAllowed(stream, state, 1)) {
readRegexp(stream);
- stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);
+ stream.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/);
return ret("regexp", "string-2");
} else {
- stream.eatWhile(isOperatorChar);
+ stream.eat("=");
return ret("operator", "operator", stream.current());
}
} else if (ch == "`") {
@@ -147,13 +102,27 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
stream.skipToEnd();
return ret("error", "error");
} else if (isOperatorChar.test(ch)) {
- stream.eatWhile(isOperatorChar);
+ if (ch != ">" || !state.lexical || state.lexical.type != ">") {
+ if (stream.eat("=")) {
+ if (ch == "!" || ch == "=") stream.eat("=")
+ } else if (/[<>*+\-]/.test(ch)) {
+ stream.eat(ch)
+ if (ch == ">") stream.eat(ch)
+ }
+ }
return ret("operator", "operator", stream.current());
} else if (wordRE.test(ch)) {
stream.eatWhile(wordRE);
- var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
- return (known && state.lastType != ".") ? ret(known.type, known.style, word) :
- ret("variable", "variable", word);
+ var word = stream.current()
+ if (state.lastType != ".") {
+ if (keywords.propertyIsEnumerable(word)) {
+ var kw = keywords[word]
+ return ret(kw.type, kw.style, word)
+ }
+ if (word == "async" && stream.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/, false))
+ return ret("async", "keyword", word)
+ }
+ return ret("variable", "variable", word)
}
}
@@ -210,19 +179,28 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
var arrow = stream.string.indexOf("=>", stream.start);
if (arrow < 0) return;
+ if (isTS) { // Try to skip TypeScript return type declarations after the arguments
+ var m = /:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(stream.string.slice(stream.start, arrow))
+ if (m) arrow = m.index
+ }
+
var depth = 0, sawSomething = false;
for (var pos = arrow - 1; pos >= 0; --pos) {
var ch = stream.string.charAt(pos);
var bracket = brackets.indexOf(ch);
if (bracket >= 0 && bracket < 3) {
if (!depth) { ++pos; break; }
- if (--depth == 0) break;
+ if (--depth == 0) { if (ch == "(") sawSomething = true; break; }
} else if (bracket >= 3 && bracket < 6) {
++depth;
} else if (wordRE.test(ch)) {
sawSomething = true;
- } else if (/["'\/]/.test(ch)) {
- return;
+ } else if (/["'\/`]/.test(ch)) {
+ for (;; --pos) {
+ if (pos == 0) return
+ var next = stream.string.charAt(pos - 1)
+ if (next == ch && stream.string.charAt(pos - 2) != "\\") { pos--; break }
+ }
} else if (sawSomething && !depth) {
++pos;
break;
@@ -284,35 +262,68 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
pass.apply(null, arguments);
return true;
}
+ function inList(name, list) {
+ for (var v = list; v; v = v.next) if (v.name == name) return true
+ return false;
+ }
function register(varname) {
- function inList(list) {
- for (var v = list; v; v = v.next)
- if (v.name == varname) return true;
- return false;
- }
var state = cx.state;
cx.marked = "def";
if (state.context) {
- if (inList(state.localVars)) return;
- state.localVars = {name: varname, next: state.localVars};
+ if (state.lexical.info == "var" && state.context && state.context.block) {
+ // FIXME function decls are also not block scoped
+ var newContext = registerVarScoped(varname, state.context)
+ if (newContext != null) {
+ state.context = newContext
+ return
+ }
+ } else if (!inList(varname, state.localVars)) {
+ state.localVars = new Var(varname, state.localVars)
+ return
+ }
+ }
+ // Fall through means this is global
+ if (parserConfig.globalVars && !inList(varname, state.globalVars))
+ state.globalVars = new Var(varname, state.globalVars)
+ }
+ function registerVarScoped(varname, context) {
+ if (!context) {
+ return null
+ } else if (context.block) {
+ var inner = registerVarScoped(varname, context.prev)
+ if (!inner) return null
+ if (inner == context.prev) return context
+ return new Context(inner, context.vars, true)
+ } else if (inList(varname, context.vars)) {
+ return context
} else {
- if (inList(state.globalVars)) return;
- if (parserConfig.globalVars)
- state.globalVars = {name: varname, next: state.globalVars};
+ return new Context(context.prev, new Var(varname, context.vars), false)
}
}
+ function isModifier(name) {
+ return name == "public" || name == "private" || name == "protected" || name == "abstract" || name == "readonly"
+ }
+
// Combinators
- var defaultVars = {name: "this", next: {name: "arguments"}};
+ function Context(prev, vars, block) { this.prev = prev; this.vars = vars; this.block = block }
+ function Var(name, next) { this.name = name; this.next = next }
+
+ var defaultVars = new Var("this", new Var("arguments", null))
function pushcontext() {
- cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
- cx.state.localVars = defaultVars;
+ cx.state.context = new Context(cx.state.context, cx.state.localVars, false)
+ cx.state.localVars = defaultVars
+ }
+ function pushblockcontext() {
+ cx.state.context = new Context(cx.state.context, cx.state.localVars, true)
+ cx.state.localVars = null
}
function popcontext() {
- cx.state.localVars = cx.state.context.vars;
- cx.state.context = cx.state.context.prev;
+ cx.state.localVars = cx.state.context.vars
+ cx.state.context = cx.state.context.prev
}
+ popcontext.lex = true
function pushlex(type, info) {
var result = function() {
var state = cx.state, indent = state.indented;
@@ -337,72 +348,99 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
function expect(wanted) {
function exp(type) {
if (type == wanted) return cont();
- else if (wanted == ";") return pass();
+ else if (wanted == ";" || type == "}" || type == ")" || type == "]") return pass();
else return cont(exp);
};
return exp;
}
function statement(type, value) {
- if (type == "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex);
- if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
+ if (type == "var") return cont(pushlex("vardef", value), vardef, expect(";"), poplex);
+ if (type == "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex);
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
- if (type == "{") return cont(pushlex("}"), block, poplex);
+ if (type == "keyword d") return cx.stream.match(/^\s*$/, false) ? cont() : cont(pushlex("stat"), maybeexpression, expect(";"), poplex);
+ if (type == "debugger") return cont(expect(";"));
+ if (type == "{") return cont(pushlex("}"), pushblockcontext, block, poplex, popcontext);
if (type == ";") return cont();
if (type == "if") {
if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex)
cx.state.cc.pop()();
- return cont(pushlex("form"), expression, statement, poplex, maybeelse);
+ return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse);
}
if (type == "function") return cont(functiondef);
if (type == "for") return cont(pushlex("form"), forspec, statement, poplex);
- if (type == "variable") return cont(pushlex("stat"), maybelabel);
- if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
- block, poplex, poplex);
+ if (type == "class" || (isTS && value == "interface")) {
+ cx.marked = "keyword"
+ return cont(pushlex("form", type == "class" ? type : value), className, poplex)
+ }
+ if (type == "variable") {
+ if (isTS && value == "declare") {
+ cx.marked = "keyword"
+ return cont(statement)
+ } else if (isTS && (value == "module" || value == "enum" || value == "type") && cx.stream.match(/^\s*\w/, false)) {
+ cx.marked = "keyword"
+ if (value == "enum") return cont(enumdef);
+ else if (value == "type") return cont(typename, expect("operator"), typeexpr, expect(";"));
+ else return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex)
+ } else if (isTS && value == "namespace") {
+ cx.marked = "keyword"
+ return cont(pushlex("form"), expression, statement, poplex)
+ } else if (isTS && value == "abstract") {
+ cx.marked = "keyword"
+ return cont(statement)
+ } else {
+ return cont(pushlex("stat"), maybelabel);
+ }
+ }
+ if (type == "switch") return cont(pushlex("form"), parenExpr, expect("{"), pushlex("}", "switch"), pushblockcontext,
+ block, poplex, poplex, popcontext);
if (type == "case") return cont(expression, expect(":"));
if (type == "default") return cont(expect(":"));
- if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
- statement, poplex, popcontext);
- if (type == "class") return cont(pushlex("form"), className, poplex);
+ if (type == "catch") return cont(pushlex("form"), pushcontext, maybeCatchBinding, statement, poplex, popcontext);
if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
- if (type == "module") return cont(pushlex("form"), pattern, pushlex("}"), expect("{"), block, poplex, poplex)
if (type == "async") return cont(statement)
+ if (value == "@") return cont(expression, statement)
return pass(pushlex("stat"), expression, expect(";"), poplex);
}
- function expression(type) {
- return expressionInner(type, false);
+ function maybeCatchBinding(type) {
+ if (type == "(") return cont(funarg, expect(")"))
}
- function expressionNoComma(type) {
- return expressionInner(type, true);
+ function expression(type, value) {
+ return expressionInner(type, value, false);
}
- function expressionInner(type, noComma) {
+ function expressionNoComma(type, value) {
+ return expressionInner(type, value, true);
+ }
+ function parenExpr(type) {
+ if (type != "(") return pass()
+ return cont(pushlex(")"), expression, expect(")"), poplex)
+ }
+ function expressionInner(type, value, noComma) {
if (cx.state.fatArrowAt == cx.stream.start) {
var body = noComma ? arrowBodyNoComma : arrowBody;
- if (type == "(") return cont(pushcontext, pushlex(")"), commasep(pattern, ")"), poplex, expect("=>"), body, popcontext);
+ if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, expect("=>"), body, popcontext);
else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext);
}
var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
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);
+ if (type == "class" || (isTS && value == "interface")) { cx.marked = "keyword"; return cont(pushlex("form"), classExpression, poplex); }
+ if (type == "keyword c" || type == "async") return cont(noComma ? expressionNoComma : expression);
+ if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop);
if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression);
if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop);
if (type == "{") return contCommasep(objprop, "}", null, maybeop);
if (type == "quasi") return pass(quasi, maybeop);
if (type == "new") return cont(maybeTarget(noComma));
+ if (type == "import") return cont(expression);
return cont();
}
function maybeexpression(type) {
if (type.match(/[;\}\)\],]/)) return pass();
return pass(expression);
}
- function maybeexpressionNoComma(type) {
- if (type.match(/[;\}\)\],]/)) return pass();
- return pass(expressionNoComma);
- }
function maybeoperatorComma(type, value) {
if (type == ",") return cont(expression);
@@ -413,7 +451,9 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
var expr = noComma == false ? expression : expressionNoComma;
if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
if (type == "operator") {
- if (/\+\+|--/.test(value)) return cont(me);
+ if (/\+\+|--/.test(value) || isTS && value == "!") return cont(me);
+ if (isTS && value == "<" && cx.stream.match(/^([^>]|<.*?>)*>\s*\(/, false))
+ return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, me);
if (value == "?") return cont(expression, expect(":"), expr);
return cont(expr);
}
@@ -422,6 +462,12 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (type == "(") return contCommasep(expressionNoComma, ")", "call", me);
if (type == ".") return cont(property, me);
if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
+ if (isTS && value == "as") { cx.marked = "keyword"; return cont(typeexpr, me) }
+ if (type == "regexp") {
+ cx.state.lastType = cx.marked = "operator"
+ cx.stream.backUp(cx.stream.pos - cx.stream.start - 1)
+ return cont(expr)
+ }
}
function quasi(type, value) {
if (type != "quasi") return pass();
@@ -446,6 +492,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
function maybeTarget(noComma) {
return function(type) {
if (type == ".") return cont(noComma ? targetNoComma : target);
+ else if (type == "variable" && isTS) return cont(maybeTypeArgs, noComma ? maybeoperatorNoComma : maybeoperatorComma)
else return pass(noComma ? expressionNoComma : expression);
};
}
@@ -463,21 +510,33 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (type == "variable") {cx.marked = "property"; return cont();}
}
function objprop(type, value) {
- if (type == "variable" || cx.style == "keyword") {
+ if (type == "async") {
+ cx.marked = "property";
+ return cont(objprop);
+ } else if (type == "variable" || cx.style == "keyword") {
cx.marked = "property";
if (value == "get" || value == "set") return cont(getterSetter);
+ var m // Work around fat-arrow-detection complication for detecting typescript typed arrow params
+ if (isTS && cx.state.fatArrowAt == cx.stream.start && (m = cx.stream.match(/^\s*:\s*/, false)))
+ cx.state.fatArrowAt = cx.stream.pos + m[0].length
return cont(afterprop);
} else if (type == "number" || type == "string") {
cx.marked = jsonldMode ? "property" : (cx.style + " property");
return cont(afterprop);
} else if (type == "jsonld-keyword") {
return cont(afterprop);
- } else if (type == "modifier") {
+ } else if (isTS && isModifier(value)) {
+ cx.marked = "keyword"
return cont(objprop)
} else if (type == "[") {
- return cont(expression, expect("]"), afterprop);
+ return cont(expression, maybetype, expect("]"), afterprop);
} else if (type == "spread") {
- return cont(expression);
+ return cont(expressionNoComma, afterprop);
+ } else if (value == "*") {
+ cx.marked = "keyword";
+ return cont(objprop);
+ } else if (type == ":") {
+ return pass(afterprop)
}
}
function getterSetter(type) {
@@ -489,14 +548,18 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (type == ":") return cont(expressionNoComma);
if (type == "(") return pass(functiondef);
}
- function commasep(what, end) {
+ function commasep(what, end, sep) {
function proceed(type, value) {
- if (type == ",") {
+ if (sep ? sep.indexOf(type) > -1 : type == ",") {
var lex = cx.state.lexical;
if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
- return cont(what, proceed);
+ return cont(function(type, value) {
+ if (type == end || value == end) return pass()
+ return pass(what)
+ }, proceed);
}
if (type == end || value == end) return cont();
+ if (sep && sep.indexOf(";") > -1) return pass(what)
return cont(expect(end));
}
return function(type, value) {
@@ -513,27 +576,91 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (type == "}") return cont();
return pass(statement, block);
}
- function maybetype(type) {
- if (isTS && type == ":") return cont(typeexpr);
+ function maybetype(type, value) {
+ if (isTS) {
+ if (type == ":") return cont(typeexpr);
+ if (value == "?") return cont(maybetype);
+ }
+ }
+ function maybetypeOrIn(type, value) {
+ if (isTS && (type == ":" || value == "in")) return cont(typeexpr)
}
- function maybedefault(_, value) {
- if (value == "=") return cont(expressionNoComma);
+ function mayberettype(type) {
+ if (isTS && type == ":") {
+ if (cx.stream.match(/^\s*\w+\s+is\b/, false)) return cont(expression, isKW, typeexpr)
+ else return cont(typeexpr)
+ }
+ }
+ function isKW(_, value) {
+ if (value == "is") {
+ cx.marked = "keyword"
+ return cont()
+ }
}
- function typeexpr(type) {
- if (type == "variable") {cx.marked = "variable-3"; return cont(afterType);}
+ function typeexpr(type, value) {
+ if (value == "keyof" || value == "typeof" || value == "infer") {
+ cx.marked = "keyword"
+ return cont(value == "typeof" ? expressionNoComma : typeexpr)
+ }
+ if (type == "variable" || value == "void") {
+ cx.marked = "type"
+ return cont(afterType)
+ }
+ if (value == "|" || value == "&") return cont(typeexpr)
+ if (type == "string" || type == "number" || type == "atom") return cont(afterType);
+ if (type == "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType)
+ if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex, afterType)
+ if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType, afterType)
+ if (type == "<") return cont(commasep(typeexpr, ">"), typeexpr)
+ }
+ function maybeReturnType(type) {
+ if (type == "=>") return cont(typeexpr)
+ }
+ function typeprop(type, value) {
+ if (type == "variable" || cx.style == "keyword") {
+ cx.marked = "property"
+ return cont(typeprop)
+ } else if (value == "?" || type == "number" || type == "string") {
+ return cont(typeprop)
+ } else if (type == ":") {
+ return cont(typeexpr)
+ } else if (type == "[") {
+ return cont(expect("variable"), maybetypeOrIn, expect("]"), typeprop)
+ } else if (type == "(") {
+ return pass(functiondecl, typeprop)
+ }
+ }
+ function typearg(type, value) {
+ if (type == "variable" && cx.stream.match(/^\s*[?:]/, false) || value == "?") return cont(typearg)
+ if (type == ":") return cont(typeexpr)
+ if (type == "spread") return cont(typearg)
+ return pass(typeexpr)
}
function afterType(type, value) {
- if (value == "<") return cont(commasep(typeexpr, ">"), afterType)
- if (type == "[") return cont(expect("]"), afterType)
+ if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
+ if (value == "|" || type == "." || value == "&") return cont(typeexpr)
+ if (type == "[") return cont(typeexpr, expect("]"), afterType)
+ if (value == "extends" || value == "implements") { cx.marked = "keyword"; return cont(typeexpr) }
+ if (value == "?") return cont(typeexpr, expect(":"), typeexpr)
+ }
+ function maybeTypeArgs(_, value) {
+ if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
}
- function vardef() {
+ function typeparam() {
+ return pass(typeexpr, maybeTypeDefault)
+ }
+ function maybeTypeDefault(_, value) {
+ if (value == "=") return cont(typeexpr)
+ }
+ function vardef(_, value) {
+ if (value == "enum") {cx.marked = "keyword"; return cont(enumdef)}
return pass(pattern, maybetype, maybeAssign, vardefCont);
}
function pattern(type, value) {
- if (type == "modifier") return cont(pattern)
+ if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(pattern) }
if (type == "variable") { register(value); return cont(); }
if (type == "spread") return cont(pattern);
- if (type == "[") return contCommasep(pattern, "]");
+ if (type == "[") return contCommasep(eltpattern, "]");
if (type == "{") return contCommasep(proppattern, "}");
}
function proppattern(type, value) {
@@ -544,8 +671,12 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (type == "variable") cx.marked = "property";
if (type == "spread") return cont(pattern);
if (type == "}") return pass();
+ if (type == "[") return cont(expression, expect(']'), expect(':'), proppattern);
return cont(expect(":"), pattern, maybeAssign);
}
+ function eltpattern() {
+ return pass(pattern, maybeAssign)
+ }
function maybeAssign(_type, value) {
if (value == "=") return cont(expressionNoComma);
}
@@ -555,73 +686,109 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
function maybeelse(type, value) {
if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex);
}
- function forspec(type) {
- if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex);
+ function forspec(type, value) {
+ if (value == "await") return cont(forspec);
+ if (type == "(") return cont(pushlex(")"), forspec1, poplex);
}
function forspec1(type) {
- if (type == "var") return cont(vardef, expect(";"), forspec2);
- if (type == ";") return cont(forspec2);
- if (type == "variable") return cont(formaybeinof);
- return pass(expression, expect(";"), forspec2);
- }
- function formaybeinof(_type, value) {
- if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
- return cont(maybeoperatorComma, forspec2);
+ if (type == "var") return cont(vardef, forspec2);
+ if (type == "variable") return cont(forspec2);
+ return pass(forspec2)
}
function forspec2(type, value) {
- if (type == ";") return cont(forspec3);
- if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
- return pass(expression, expect(";"), forspec3);
- }
- function forspec3(type) {
- if (type != ")") cont(expression);
+ if (type == ")") return cont()
+ if (type == ";") return cont(forspec2)
+ if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression, forspec2) }
+ return pass(expression, forspec2)
}
function functiondef(type, value) {
if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
if (type == "variable") {register(value); return cont(functiondef);}
- if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, maybetype, statement, popcontext);
+ if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, mayberettype, statement, popcontext);
+ if (isTS && value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, functiondef)
+ }
+ function functiondecl(type, value) {
+ if (value == "*") {cx.marked = "keyword"; return cont(functiondecl);}
+ if (type == "variable") {register(value); return cont(functiondecl);}
+ if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, mayberettype, popcontext);
+ if (isTS && value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, functiondecl)
+ }
+ function typename(type, value) {
+ if (type == "keyword" || type == "variable") {
+ cx.marked = "type"
+ return cont(typename)
+ } else if (value == "<") {
+ return cont(pushlex(">"), commasep(typeparam, ">"), poplex)
+ }
}
- function funarg(type) {
+ function funarg(type, value) {
+ if (value == "@") cont(expression, funarg)
if (type == "spread") return cont(funarg);
- return pass(pattern, maybetype, maybedefault);
+ if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(funarg); }
+ if (isTS && type == "this") return cont(maybetype, maybeAssign)
+ return pass(pattern, maybetype, maybeAssign);
+ }
+ function classExpression(type, value) {
+ // Class expressions may have an optional name.
+ if (type == "variable") return className(type, value);
+ return classNameAfter(type, value);
}
function className(type, value) {
if (type == "variable") {register(value); return cont(classNameAfter);}
}
function classNameAfter(type, value) {
- if (value == "extends") return cont(expression, classNameAfter);
+ if (value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, classNameAfter)
+ if (value == "extends" || value == "implements" || (isTS && type == ",")) {
+ if (value == "implements") cx.marked = "keyword";
+ return cont(isTS ? typeexpr : expression, classNameAfter);
+ }
if (type == "{") return cont(pushlex("}"), classBody, poplex);
}
function classBody(type, value) {
+ if (type == "async" ||
+ (type == "variable" &&
+ (value == "static" || value == "get" || value == "set" || (isTS && isModifier(value))) &&
+ cx.stream.match(/^\s+[\w$\xa1-\uffff]/, false))) {
+ cx.marked = "keyword";
+ return cont(classBody);
+ }
if (type == "variable" || cx.style == "keyword") {
- if (value == "static") {
- cx.marked = "keyword";
- return cont(classBody);
- }
cx.marked = "property";
- if (value == "get" || value == "set") return cont(classGetterSetter, functiondef, classBody);
- return cont(functiondef, classBody);
+ return cont(isTS ? classfield : functiondef, classBody);
}
+ if (type == "number" || type == "string") return cont(isTS ? classfield : functiondef, classBody);
+ if (type == "[")
+ return cont(expression, maybetype, expect("]"), isTS ? classfield : functiondef, classBody)
if (value == "*") {
cx.marked = "keyword";
return cont(classBody);
}
- if (type == ";") return cont(classBody);
+ if (isTS && type == "(") return pass(functiondecl, classBody)
+ if (type == ";" || type == ",") return cont(classBody);
if (type == "}") return cont();
+ if (value == "@") return cont(expression, classBody)
}
- function classGetterSetter(type) {
- if (type != "variable") return pass();
- cx.marked = "property";
- return cont();
+ function classfield(type, value) {
+ if (value == "?") return cont(classfield)
+ if (type == ":") return cont(typeexpr, maybeAssign)
+ if (value == "=") return cont(expressionNoComma)
+ var context = cx.state.lexical.prev, isInterface = context && context.info == "interface"
+ return pass(isInterface ? functiondecl : functiondef)
}
- function afterExport(_type, value) {
+ function afterExport(type, value) {
if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); }
if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); }
+ if (type == "{") return cont(commasep(exportField, "}"), maybeFrom, expect(";"));
return pass(statement);
}
+ function exportField(type, value) {
+ if (value == "as") { cx.marked = "keyword"; return cont(expect("variable")); }
+ if (type == "variable") return pass(expressionNoComma, exportField);
+ }
function afterImport(type) {
if (type == "string") return cont();
- return pass(importSpec, maybeFrom);
+ if (type == "(") return pass(expression);
+ return pass(importSpec, maybeMoreImports, maybeFrom);
}
function importSpec(type, value) {
if (type == "{") return contCommasep(importSpec, "}");
@@ -629,6 +796,9 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (value == "*") cx.marked = "keyword";
return cont(maybeAs);
}
+ function maybeMoreImports(type) {
+ if (type == ",") return cont(importSpec, maybeMoreImports)
+ }
function maybeAs(_type, value) {
if (value == "as") { cx.marked = "keyword"; return cont(importSpec); }
}
@@ -637,16 +807,13 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
}
function arrayLiteral(type) {
if (type == "]") return cont();
- return pass(expressionNoComma, maybeArrayComprehension);
- }
- function maybeArrayComprehension(type) {
- if (type == "for") return pass(comprehension, expect("]"));
- if (type == ",") return cont(commasep(maybeexpressionNoComma, "]"));
return pass(commasep(expressionNoComma, "]"));
}
- function comprehension(type) {
- if (type == "for") return cont(forspec, comprehension);
- if (type == "if") return cont(expression, comprehension);
+ function enumdef() {
+ return pass(pushlex("form"), pattern, expect("{"), pushlex("}"), commasep(enummember, "}"), poplex, poplex)
+ }
+ function enummember() {
+ return pass(pattern, maybeAssign);
}
function isContinuedStatement(state, textAfter) {
@@ -655,6 +822,12 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
/[,.]/.test(textAfter.charAt(0));
}
+ function expressionAllowed(stream, state, backUp) {
+ return state.tokenize == tokenBase &&
+ /^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(state.lastType) ||
+ (state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))
+ }
+
// Interface
return {
@@ -665,7 +838,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
cc: [],
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
localVars: parserConfig.localVars,
- context: parserConfig.localVars && {vars: parserConfig.localVars},
+ context: parserConfig.localVars && new Context(null, null, false),
indented: basecolumn || 0
};
if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
@@ -690,19 +863,23 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
indent: function(state, textAfter) {
if (state.tokenize == tokenComment) return CodeMirror.Pass;
if (state.tokenize != tokenBase) return 0;
- var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;
+ var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top
// Kludge to prevent 'maybelse' from blocking lexical scope pops
if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {
var c = state.cc[i];
if (c == poplex) lexical = lexical.prev;
else if (c != maybeelse) break;
}
- if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev;
+ while ((lexical.type == "stat" || lexical.type == "form") &&
+ (firstChar == "}" || ((top = state.cc[state.cc.length - 1]) &&
+ (top == maybeoperatorComma || top == maybeoperatorNoComma) &&
+ !/^[,\.=+\-*:?[\(]/.test(textAfter))))
+ lexical = lexical.prev;
if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat")
lexical = lexical.prev;
var type = lexical.type, closing = firstChar == type;
- if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info + 1 : 0);
+ if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info.length + 1 : 0);
else if (type == "form" && firstChar == "{") return lexical.indented;
else if (type == "form") return lexical.indented + indentUnit;
else if (type == "stat")
@@ -716,6 +893,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
electricInput: /^\s*(?:case .*?:|default:|\{|\})$/,
blockCommentStart: jsonMode ? null : "/*",
blockCommentEnd: jsonMode ? null : "*/",
+ blockCommentContinue: jsonMode ? null : " * ",
lineComment: jsonMode ? null : "//",
fold: "brace",
closeBrackets: "()[]{}''\"\"``",
@@ -725,6 +903,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
jsonMode: jsonMode,
expressionAllowed: expressionAllowed,
+
skipExpression: function(state) {
var top = state.cc[state.cc.length - 1]
if (top == expression || top == expressionNoComma) state.cc.pop()
diff --git a/vendor/assets/javascripts/codemirror/modes/jinja2.js b/vendor/assets/javascripts/codemirror/modes/jinja2.js
index ed19558..77c9b22 100644
--- a/vendor/assets/javascripts/codemirror/modes/jinja2.js
+++ b/vendor/assets/javascripts/codemirror/modes/jinja2.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -107,7 +107,7 @@
}
return "variable";
} else if (stream.eat("{")) {
- if (ch = stream.eat("#")) {
+ if (stream.eat("#")) {
state.incomment = true;
if(!stream.skipTo("#}")) {
stream.skipToEnd();
@@ -136,7 +136,11 @@
},
token: function (stream, state) {
return state.tokenize(stream, state);
- }
+ },
+ blockCommentStart: "{#",
+ blockCommentEnd: "#}"
};
});
+
+ CodeMirror.defineMIME("text/jinja2", "jinja2");
});
diff --git a/vendor/assets/javascripts/codemirror/modes/jsx.js b/vendor/assets/javascripts/codemirror/modes/jsx.js
index aff01b8..889d3fe 100644
--- a/vendor/assets/javascripts/codemirror/modes/jsx.js
+++ b/vendor/assets/javascripts/codemirror/modes/jsx.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -26,13 +26,13 @@
}
CodeMirror.defineMode("jsx", function(config, modeConfig) {
- var xmlMode = CodeMirror.getMode(config, {name: "xml", allowMissing: true, multilineTagIndentPastTag: false})
+ var xmlMode = CodeMirror.getMode(config, {name: "xml", allowMissing: true, multilineTagIndentPastTag: false, allowMissingTagName: true})
var jsMode = CodeMirror.getMode(config, modeConfig && modeConfig.base || "javascript")
function flatXMLIndent(state) {
var tagName = state.tagName
state.tagName = null
- var result = xmlMode.indent(state, "")
+ var result = xmlMode.indent(state, "", "")
state.tagName = tagName
return result
}
@@ -105,7 +105,7 @@
function jsToken(stream, state, cx) {
if (stream.peek() == "<" && jsMode.expressionAllowed(stream, cx.state)) {
jsMode.skipExpression(cx.state)
- state.context = new Context(CodeMirror.startState(xmlMode, jsMode.indent(cx.state, "")),
+ state.context = new Context(CodeMirror.startState(xmlMode, jsMode.indent(cx.state, "", "")),
xmlMode, 0, state.context)
return null
}
@@ -144,4 +144,5 @@
}, "xml", "javascript")
CodeMirror.defineMIME("text/jsx", "jsx")
+ CodeMirror.defineMIME("text/typescript-jsx", {name: "jsx", base: {name: "javascript", typescript: true}})
});
diff --git a/vendor/assets/javascripts/codemirror/modes/julia.js b/vendor/assets/javascripts/codemirror/modes/julia.js
index 004de44..5873d8c 100644
--- a/vendor/assets/javascripts/codemirror/modes/julia.js
+++ b/vendor/assets/javascripts/codemirror/modes/julia.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -11,51 +11,70 @@
})(function(CodeMirror) {
"use strict";
-CodeMirror.defineMode("julia", function(_conf, parserConf) {
- var ERRORCLASS = 'error';
-
+CodeMirror.defineMode("julia", function(config, parserConf) {
function wordRegexp(words, end) {
- if (typeof end === 'undefined') { end = "\\b"; }
+ if (typeof end === "undefined") { end = "\\b"; }
return new RegExp("^((" + words.join(")|(") + "))" + end);
}
var octChar = "\\\\[0-7]{1,3}";
var hexChar = "\\\\x[A-Fa-f0-9]{1,2}";
- var specialChar = "\\\\[abfnrtv0%?'\"\\\\]";
- var singleChar = "([^\\u0027\\u005C\\uD800-\\uDFFF]|[\\uD800-\\uDFFF][\\uDC00-\\uDFFF])";
- var operators = parserConf.operators || /^\.?[|&^\\%*+\-<>!=\/]=?|\?|~|:|\$|\.[<>]|<<=?|>>>?=?|\.[<>=]=|->?|\/\/|\bin\b(?!\()|[\u2208\u2209](?!\()/;
+ var sChar = "\\\\[abefnrtv0%?'\"\\\\]";
+ var uChar = "([^\\u0027\\u005C\\uD800-\\uDFFF]|[\\uD800-\\uDFFF][\\uDC00-\\uDFFF])";
+
+ var operators = parserConf.operators || wordRegexp([
+ "[<>]:", "[<>=]=", "<<=?", ">>>?=?", "=>", "->", "\\/\\/",
+ "[\\\\%*+\\-<>!=\\/^|&\\u00F7\\u22BB]=?", "\\?", "\\$", "~", ":",
+ "\\u00D7", "\\u2208", "\\u2209", "\\u220B", "\\u220C", "\\u2218",
+ "\\u221A", "\\u221B", "\\u2229", "\\u222A", "\\u2260", "\\u2264",
+ "\\u2265", "\\u2286", "\\u2288", "\\u228A", "\\u22C5",
+ "\\b(in|isa)\\b(?!\.?\\()"], "");
var delimiters = parserConf.delimiters || /^[;,()[\]{}]/;
- var identifiers = parserConf.identifiers || /^[_A-Za-z\u00A1-\uFFFF][\w\u00A1-\uFFFF]*!*/;
- var charsList = [octChar, hexChar, specialChar, singleChar];
- var blockOpeners = ["begin", "function", "type", "immutable", "let", "macro", "for", "while", "quote", "if", "else", "elseif", "try", "finally", "catch", "do"];
- var blockClosers = ["end", "else", "elseif", "catch", "finally"];
- var keywordList = ['if', 'else', 'elseif', 'while', 'for', 'begin', 'let', 'end', 'do', 'try', 'catch', 'finally', 'return', 'break', 'continue', 'global', 'local', 'const', 'export', 'import', 'importall', 'using', 'function', 'macro', 'module', 'baremodule', 'type', 'immutable', 'quote', 'typealias', 'abstract', 'bitstype'];
- var builtinList = ['true', 'false', 'nothing', 'NaN', 'Inf'];
-
- //var stringPrefixes = new RegExp("^[br]?('|\")")
- var stringPrefixes = /^(`|"{3}|([brv]?"))/;
- var chars = wordRegexp(charsList, "'");
- var keywords = wordRegexp(keywordList);
- var builtins = wordRegexp(builtinList);
- var openers = wordRegexp(blockOpeners);
- var closers = wordRegexp(blockClosers);
+ var identifiers = parserConf.identifiers ||
+ /^[_A-Za-z\u00A1-\u2217\u2219-\uFFFF][\w\u00A1-\u2217\u2219-\uFFFF]*!*/;
+
+ var chars = wordRegexp([octChar, hexChar, sChar, uChar], "'");
+
+ var openersList = ["begin", "function", "type", "struct", "immutable", "let",
+ "macro", "for", "while", "quote", "if", "else", "elseif", "try",
+ "finally", "catch", "do"];
+
+ var closersList = ["end", "else", "elseif", "catch", "finally"];
+
+ var keywordsList = ["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"];
+
+ var builtinsList = ["true", "false", "nothing", "NaN", "Inf"];
+
+ CodeMirror.registerHelper("hintWords", "julia", keywordsList.concat(builtinsList));
+
+ var openers = wordRegexp(openersList);
+ var closers = wordRegexp(closersList);
+ var keywords = wordRegexp(keywordsList);
+ var builtins = wordRegexp(builtinsList);
+
var macro = /^@[_A-Za-z][\w]*/;
var symbol = /^:[_A-Za-z\u00A1-\uFFFF][\w\u00A1-\uFFFF]*!*/;
- var typeAnnotation = /^::[^,;"{()=$\s]+({[^}]*}+)*/;
+ var stringPrefixes = /^(`|([_A-Za-z\u00A1-\uFFFF]*"("")?))/;
function inArray(state) {
- var ch = currentScope(state);
- if (ch == '[') {
- return true;
- }
- return false;
+ return (state.nestedArrays > 0);
+ }
+
+ function inGenerator(state) {
+ return (state.nestedGenerators > 0);
}
- function currentScope(state) {
- if (state.scopes.length == 0) {
+ function currentScope(state, n) {
+ if (typeof(n) === "undefined") { n = 0; }
+ if (state.scopes.length <= n) {
return null;
}
- return state.scopes[state.scopes.length - 1];
+ return state.scopes[state.scopes.length - (n + 1)];
}
// tokenizers
@@ -72,14 +91,17 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
leavingExpr = false;
}
state.leavingExpr = false;
+
if (leavingExpr) {
if (stream.match(/^'+/)) {
- return 'operator';
+ return "operator";
}
}
- if (stream.match(/^\.{2,3}/)) {
- return 'operator';
+ if (stream.match(/\.{4,}/)) {
+ return "error";
+ } else if (stream.match(/\.{1,3}/)) {
+ return "operator";
}
if (stream.eatSpace()) {
@@ -91,53 +113,77 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
// Handle single line comments
if (ch === '#') {
stream.skipToEnd();
- return 'comment';
+ return "comment";
}
if (ch === '[') {
state.scopes.push('[');
+ state.nestedArrays++;
}
if (ch === '(') {
state.scopes.push('(');
+ state.nestedGenerators++;
}
- var scope = currentScope(state);
-
- if (scope == '[' && ch === ']') {
+ if (inArray(state) && ch === ']') {
+ if (currentScope(state) === "if") { state.scopes.pop(); }
+ while (currentScope(state) === "for") { state.scopes.pop(); }
state.scopes.pop();
+ state.nestedArrays--;
state.leavingExpr = true;
}
- if (scope == '(' && ch === ')') {
+ if (inGenerator(state) && ch === ')') {
+ if (currentScope(state) === "if") { state.scopes.pop(); }
+ while (currentScope(state) === "for") { state.scopes.pop(); }
state.scopes.pop();
+ state.nestedGenerators--;
state.leavingExpr = true;
}
+ if (inArray(state)) {
+ if (state.lastToken == "end" && stream.match(/^:/)) {
+ return "operator";
+ }
+ if (stream.match(/^end/)) {
+ return "number";
+ }
+ }
+
var match;
- if (!inArray(state) && (match=stream.match(openers, false))) {
- state.scopes.push(match);
+ if (match = stream.match(openers, false)) {
+ state.scopes.push(match[0]);
}
- if (!inArray(state) && stream.match(closers, false)) {
+ if (stream.match(closers, false)) {
state.scopes.pop();
}
- if (inArray(state)) {
- if (state.lastToken == 'end' && stream.match(/^:/)) {
- return 'operator';
- }
- if (stream.match(/^end/)) {
- return 'number';
- }
+ // Handle type annotations
+ if (stream.match(/^::(?![:\$])/)) {
+ state.tokenize = tokenAnnotation;
+ return state.tokenize(stream, state);
}
- if (stream.match(/^=>/)) {
- return 'operator';
+ // Handle symbols
+ if (!leavingExpr && stream.match(symbol) ||
+ stream.match(/:([<>]:|<<=?|>>>?=?|->|\/\/|\.{2,3}|[\.\\%*+\-<>!\/^|&]=?|[~\?\$])/)) {
+ return "builtin";
+ }
+
+ // Handle parametric types
+ //if (stream.match(/^{[^}]*}(?=\()/)) {
+ // return "builtin";
+ //}
+
+ // Handle operators and Delimiters
+ if (stream.match(operators)) {
+ return "operator";
}
// Handle Number Literals
- if (stream.match(/^[0-9\.]/, false)) {
+ if (stream.match(/^\.?\d/, false)) {
var imMatcher = RegExp(/^im\b/);
var numberLiteral = false;
// Floats
@@ -156,33 +202,10 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
// Integer literals may be "long"
stream.match(imMatcher);
state.leavingExpr = true;
- return 'number';
+ return "number";
}
}
- if (stream.match(/^<:/)) {
- return 'operator';
- }
-
- if (stream.match(typeAnnotation)) {
- return 'builtin';
- }
-
- // Handle symbols
- if (!leavingExpr && stream.match(symbol) || stream.match(/:\./)) {
- return 'builtin';
- }
-
- // Handle parametric types
- if (stream.match(/^{[^}]*}(?=\()/)) {
- return 'builtin';
- }
-
- // Handle operators and Delimiters
- if (stream.match(operators)) {
- return 'operator';
- }
-
// Handle Chars
if (stream.match(/^'/)) {
state.tokenize = tokenChar;
@@ -196,7 +219,7 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
}
if (stream.match(macro)) {
- return 'meta';
+ return "meta";
}
if (stream.match(delimiters)) {
@@ -204,41 +227,40 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
}
if (stream.match(keywords)) {
- return 'keyword';
+ return "keyword";
}
if (stream.match(builtins)) {
- return 'builtin';
+ return "builtin";
}
- var isDefinition = state.isDefinition ||
- state.lastToken == 'function' ||
- state.lastToken == 'macro' ||
- state.lastToken == 'type' ||
- state.lastToken == 'immutable';
+ var isDefinition = state.isDefinition || state.lastToken == "function" ||
+ state.lastToken == "macro" || state.lastToken == "type" ||
+ state.lastToken == "struct" || state.lastToken == "immutable";
if (stream.match(identifiers)) {
if (isDefinition) {
if (stream.peek() === '.') {
state.isDefinition = true;
- return 'variable';
+ return "variable";
}
state.isDefinition = false;
- return 'def';
+ return "def";
}
if (stream.match(/^({[^}]*})*\(/, false)) {
- return callOrDef(stream, state);
+ state.tokenize = tokenCallOrDef;
+ return state.tokenize(stream, state);
}
state.leavingExpr = true;
- return 'variable';
+ return "variable";
}
// Handle non-detected items
stream.next();
- return ERRORCLASS;
+ return "error";
}
- function callOrDef(stream, state) {
+ function tokenCallOrDef(stream, state) {
var match = stream.match(/^(\(\s*)/);
if (match) {
if (state.firstParenPos < 0)
@@ -250,13 +272,14 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
state.scopes.pop();
state.charsAdvanced += 1;
if (state.scopes.length <= state.firstParenPos) {
- var isDefinition = stream.match(/^\s*?=(?!=)/, false);
+ var isDefinition = stream.match(/^(\s*where\s+[^\s=]+)*\s*?=(?!=)/, false);
stream.backUp(state.charsAdvanced);
state.firstParenPos = -1;
state.charsAdvanced = 0;
+ state.tokenize = tokenBase;
if (isDefinition)
- return 'def';
- return 'builtin';
+ return "def";
+ return "builtin";
}
}
// Unfortunately javascript does not support multiline strings, so we have
@@ -268,25 +291,41 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
state.scopes.pop();
state.firstParenPos = -1;
state.charsAdvanced = 0;
- return 'builtin';
+ state.tokenize = tokenBase;
+ return "builtin";
}
state.charsAdvanced += stream.match(/^([^()]*)/)[1].length;
- return callOrDef(stream, state);
+ return state.tokenize(stream, state);
+ }
+
+ function tokenAnnotation(stream, state) {
+ stream.match(/.*?(?=,|;|{|}|\(|\)|=|$|\s)/);
+ if (stream.match(/^{/)) {
+ state.nestedParameters++;
+ } else if (stream.match(/^}/) && state.nestedParameters > 0) {
+ state.nestedParameters--;
+ }
+ if (state.nestedParameters > 0) {
+ stream.match(/.*?(?={|})/) || stream.next();
+ } else if (state.nestedParameters == 0) {
+ state.tokenize = tokenBase;
+ }
+ return "builtin";
}
function tokenComment(stream, state) {
if (stream.match(/^#=/)) {
- state.weakScopes++;
+ state.nestedComments++;
}
if (!stream.match(/.*?(?=(#=|=#))/)) {
stream.skipToEnd();
}
if (stream.match(/^=#/)) {
- state.weakScopes--;
- if (state.weakScopes == 0)
+ state.nestedComments--;
+ if (state.nestedComments == 0)
state.tokenize = tokenBase;
}
- return 'comment';
+ return "comment";
}
function tokenChar(stream, state) {
@@ -309,35 +348,32 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
if (isChar) {
state.leavingExpr = true;
state.tokenize = tokenBase;
- return 'string';
+ return "string";
}
if (!stream.match(/^[^']+(?=')/)) { stream.skipToEnd(); }
if (stream.match(/^'/)) { state.tokenize = tokenBase; }
- return ERRORCLASS;
+ return "error";
}
function tokenStringFactory(delimiter) {
- while ('bruv'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) {
- delimiter = delimiter.substr(1);
+ if (delimiter.substr(-3) === '"""') {
+ delimiter = '"""';
+ } else if (delimiter.substr(-1) === '"') {
+ delimiter = '"';
}
- var OUTCLASS = 'string';
-
function tokenString(stream, state) {
- while (!stream.eol()) {
- stream.eatWhile(/[^"\\]/);
- if (stream.eat('\\')) {
- stream.next();
- } else if (stream.match(delimiter)) {
- state.tokenize = tokenBase;
- state.leavingExpr = true;
- return OUTCLASS;
- } else {
- stream.eat(/["]/);
- }
+ if (stream.eat('\\')) {
+ stream.next();
+ } else if (stream.match(delimiter)) {
+ state.tokenize = tokenBase;
+ state.leavingExpr = true;
+ return "string";
+ } else {
+ stream.eat(/[`"]/);
}
- return OUTCLASS;
+ stream.eatWhile(/[^\\`"]/);
+ return "string";
}
- tokenString.isString = true;
return tokenString;
}
@@ -346,10 +382,13 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
return {
tokenize: tokenBase,
scopes: [],
- weakScopes: 0,
lastToken: null,
leavingExpr: false,
isDefinition: false,
+ nestedArrays: 0,
+ nestedComments: 0,
+ nestedGenerators: 0,
+ nestedParameters: 0,
charsAdvanced: 0,
firstParenPos: -1
};
@@ -363,24 +402,24 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
state.lastToken = current;
}
- // Handle '.' connected identifiers
- if (current === '.') {
- style = stream.match(identifiers, false) || stream.match(macro, false) ||
- stream.match(/\(/, false) ? 'operator' : ERRORCLASS;
- }
return style;
},
indent: function(state, textAfter) {
var delta = 0;
- if (textAfter == "]" || textAfter == ")" || textAfter == "end" || textAfter == "else" || textAfter == "elseif" || textAfter == "catch" || textAfter == "finally") {
+ if ( textAfter === ']' || textAfter === ')' || textAfter === "end" ||
+ textAfter === "else" || textAfter === "catch" || textAfter === "elseif" ||
+ textAfter === "finally" ) {
delta = -1;
}
- return (state.scopes.length + delta) * _conf.indentUnit;
+ return (state.scopes.length + delta) * config.indentUnit;
},
- electricInput: /(end|else(if)?|catch|finally)$/,
+ electricInput: /\b(end|else|catch|finally)\b/,
+ blockCommentStart: "#=",
+ blockCommentEnd: "=#",
lineComment: "#",
+ closeBrackets: "()[]{}\"\"",
fold: "indent"
};
return external;
diff --git a/vendor/assets/javascripts/codemirror/modes/livescript.js b/vendor/assets/javascripts/codemirror/modes/livescript.js
index 4b26e04..595e067 100644
--- a/vendor/assets/javascripts/codemirror/modes/livescript.js
+++ b/vendor/assets/javascripts/codemirror/modes/livescript.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
/**
* Link to the project's GitHub page:
@@ -50,7 +50,7 @@
startState: function(){
return {
next: 'start',
- lastToken: null
+ lastToken: {style: null, indent: 0, content: ""}
};
},
token: function(stream, state){
diff --git a/vendor/assets/javascripts/codemirror/modes/lua.js b/vendor/assets/javascripts/codemirror/modes/lua.js
index 0b19abd..202f373 100644
--- a/vendor/assets/javascripts/codemirror/modes/lua.js
+++ b/vendor/assets/javascripts/codemirror/modes/lua.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
// LUA mode. Ported to CodeMirror 2 from Franciszek Wawrzak's
// CodeMirror 1 mode.
diff --git a/vendor/assets/javascripts/codemirror/modes/markdown.js b/vendor/assets/javascripts/codemirror/modes/markdown.js
index 37329c2..7aa3a3e 100644
--- a/vendor/assets/javascripts/codemirror/modes/markdown.js
+++ b/vendor/assets/javascripts/codemirror/modes/markdown.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -35,15 +35,6 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
if (modeCfg.maxBlockquoteDepth === undefined)
modeCfg.maxBlockquoteDepth = 0;
- // Should underscores in words open/close em/strong?
- if (modeCfg.underscoresBreakWords === undefined)
- modeCfg.underscoresBreakWords = true;
-
- // Use `fencedCodeBlocks` to configure fenced code blocks. false to
- // disable, string to specify a precise regexp that the fence should
- // match, and true to allow three or more backticks or tildes (as
- // per CommonMark).
-
// Turn on task lists? ("- [ ] " and "- [x] ")
if (modeCfg.taskLists === undefined) modeCfg.taskLists = false;
@@ -51,6 +42,15 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
if (modeCfg.strikethrough === undefined)
modeCfg.strikethrough = false;
+ if (modeCfg.emoji === undefined)
+ modeCfg.emoji = false;
+
+ if (modeCfg.fencedCodeBlockHighlighting === undefined)
+ modeCfg.fencedCodeBlockHighlighting = true;
+
+ if (modeCfg.xml === undefined)
+ modeCfg.xml = true;
+
// Allow token types to be overridden by user-provided token types.
if (modeCfg.tokenTypeOverrides === undefined)
modeCfg.tokenTypeOverrides = {};
@@ -63,7 +63,9 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
list2: "variable-3",
list3: "keyword",
hr: "hr",
- image: "tag",
+ image: "image",
+ imageAltText: "image-alt-text",
+ imageMarker: "image-marker",
formatting: "formatting",
linkInline: "link",
linkEmail: "link",
@@ -71,7 +73,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
linkHref: "string",
em: "em",
strong: "strong",
- strikethrough: "strikethrough"
+ strikethrough: "strikethrough",
+ emoji: "builtin"
};
for (var tokenType in tokenTypes) {
@@ -81,14 +84,15 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
}
var hrRE = /^([*\-_])(?:\s*\1){2,}\s*$/
- , ulRE = /^[*\-+]\s+/
- , olRE = /^[0-9]+([.)])\s+/
- , taskListRE = /^\[(x| )\](?=\s)/ // Must follow ulRE or olRE
+ , listRE = /^(?:[*\-+]|^[0-9]+([.)]))\s+/
+ , taskListRE = /^\[(x| )\](?=\s)/i // Must follow listRE
, atxHeaderRE = modeCfg.allowAtxHeaderWithoutSpace ? /^(#+)/ : /^(#+)(?: |$)/
, setextHeaderRE = /^ *(?:\={1,}|-{1,})\s*$/
- , textRE = /^[^#!\[\]*_\\<>` "'(~]+/
- , fencedCodeRE = new RegExp("^(" + (modeCfg.fencedCodeBlocks === true ? "~~~+|```+" : modeCfg.fencedCodeBlocks) +
- ")[ \\t]*([\\w+#\-]*)");
+ , textRE = /^[^#!\[\]*_\\<>` "'(~:]+/
+ , fencedCodeRE = /^(~~~+|```+)[ \t]*([\w+#-]*)[^\n`]*$/
+ , linkDefRE = /^\s*\[[^\]]+?\]:.*$/ // naive link-definition
+ , punctuation = /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/
+ , expandedTab = " " // CommonMark specifies tab as 4 spaces
function switchInline(stream, state, f) {
state.f = state.inline = f;
@@ -109,6 +113,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
function blankLine(state) {
// Reset linkTitle state
state.linkTitle = false;
+ state.linkHref = false;
+ state.linkText = false;
// Reset EM state
state.em = false;
// Reset STRONG state
@@ -119,91 +125,104 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
state.quote = 0;
// Reset state.indentedCode
state.indentedCode = false;
- if (htmlModeMissing && state.f == htmlBlock) {
- state.f = inlineNormal;
- state.block = blockNormal;
+ if (state.f == htmlBlock) {
+ var exit = htmlModeMissing
+ if (!exit) {
+ var inner = CodeMirror.innerMode(htmlMode, state.htmlState)
+ exit = inner.mode.name == "xml" && inner.state.tagStart === null &&
+ (!inner.state.context && inner.state.tokenize.isInText)
+ }
+ if (exit) {
+ state.f = inlineNormal;
+ state.block = blockNormal;
+ state.htmlState = null;
+ }
}
// Reset state.trailingSpace
state.trailingSpace = 0;
state.trailingSpaceNewLine = false;
// Mark this line as blank
state.prevLine = state.thisLine
- state.thisLine = null
+ state.thisLine = {stream: null}
return null;
}
function blockNormal(stream, state) {
-
- var sol = stream.sol();
-
- var prevLineIsList = state.list !== false,
- prevLineIsIndentedCode = state.indentedCode;
+ var firstTokenOnLine = stream.column() === state.indentation;
+ var prevLineLineIsEmpty = lineIsEmpty(state.prevLine.stream);
+ var prevLineIsIndentedCode = state.indentedCode;
+ var prevLineIsHr = state.prevLine.hr;
+ var prevLineIsList = state.list !== false;
+ var maxNonCodeIndentation = (state.listStack[state.listStack.length - 1] || 0) + 3;
state.indentedCode = false;
- if (prevLineIsList) {
- if (state.indentationDiff >= 0) { // Continued list
- if (state.indentationDiff < 4) { // Only adjust indentation if *not* a code block
- state.indentation -= state.indentationDiff;
- }
- state.list = null;
- } else if (state.indentation > 0) {
+ var lineIndentation = state.indentation;
+ // compute once per line (on first token)
+ if (state.indentationDiff === null) {
+ state.indentationDiff = state.indentation;
+ if (prevLineIsList) {
+ // Reset inline styles which shouldn't propagate aross list items
+ state.em = false;
+ state.strong = false;
+ state.code = false;
+ state.strikethrough = false;
+
state.list = null;
- } else { // No longer a list
- state.list = false;
+ // While this list item's marker's indentation is less than the deepest
+ // list item's content's indentation,pop the deepest list item
+ // indentation off the stack, and update block indentation state
+ while (lineIndentation < state.listStack[state.listStack.length - 1]) {
+ state.listStack.pop();
+ if (state.listStack.length) {
+ state.indentation = state.listStack[state.listStack.length - 1];
+ // less than the first list's indent -> the line is no longer a list
+ } else {
+ state.list = false;
+ }
+ }
+ if (state.list !== false) {
+ state.indentationDiff = lineIndentation - state.listStack[state.listStack.length - 1]
+ }
}
}
+ // not comprehensive (currently only for setext detection purposes)
+ var allowsInlineContinuation = (
+ !prevLineLineIsEmpty && !prevLineIsHr && !state.prevLine.header &&
+ (!prevLineIsList || !prevLineIsIndentedCode) &&
+ !state.prevLine.fencedCodeEnd
+ );
+
+ var isHr = (state.list === false || prevLineIsHr || prevLineLineIsEmpty) &&
+ state.indentation <= maxNonCodeIndentation && stream.match(hrRE);
+
var match = null;
- if (state.indentationDiff >= 4) {
+ if (state.indentationDiff >= 4 && (prevLineIsIndentedCode || state.prevLine.fencedCodeEnd ||
+ state.prevLine.header || prevLineLineIsEmpty)) {
stream.skipToEnd();
- if (prevLineIsIndentedCode || lineIsEmpty(state.prevLine)) {
- state.indentation -= 4;
- state.indentedCode = true;
- return tokenTypes.code;
- } else {
- return null;
- }
+ state.indentedCode = true;
+ return tokenTypes.code;
} else if (stream.eatSpace()) {
return null;
- } else if ((match = stream.match(atxHeaderRE)) && match[1].length <= 6) {
+ } else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(atxHeaderRE)) && match[1].length <= 6) {
+ state.quote = 0;
state.header = match[1].length;
+ state.thisLine.header = true;
if (modeCfg.highlightFormatting) state.formatting = "header";
state.f = state.inline;
return getType(state);
- } else if (!lineIsEmpty(state.prevLine) && !state.quote && !prevLineIsList &&
- !prevLineIsIndentedCode && (match = stream.match(setextHeaderRE))) {
- state.header = match[0].charAt(0) == '=' ? 1 : 2;
- if (modeCfg.highlightFormatting) state.formatting = "header";
- state.f = state.inline;
- return getType(state);
- } else if (stream.eat('>')) {
- state.quote = sol ? 1 : state.quote + 1;
+ } else if (state.indentation <= maxNonCodeIndentation && stream.eat('>')) {
+ state.quote = firstTokenOnLine ? 1 : state.quote + 1;
if (modeCfg.highlightFormatting) state.formatting = "quote";
stream.eatSpace();
return getType(state);
- } else if (stream.peek() === '[') {
- return switchInline(stream, state, footnoteLink);
- } else if (stream.match(hrRE, true)) {
- state.hr = true;
- return tokenTypes.hr;
- } else if ((lineIsEmpty(state.prevLine) || prevLineIsList) && (stream.match(ulRE, false) || stream.match(olRE, false))) {
- var listType = null;
- if (stream.match(ulRE, true)) {
- listType = 'ul';
- } else {
- stream.match(olRE, true);
- listType = 'ol';
- }
- state.indentation = stream.column() + stream.current().length;
- state.list = true;
+ } else if (!isHr && !state.setext && firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(listRE))) {
+ var listType = match[1] ? "ol" : "ul";
- // While this list item's marker's indentation
- // is less than the deepest list item's content's indentation,
- // pop the deepest list item indentation off the stack.
- while (state.listStack && stream.column() < state.listStack[state.listStack.length - 1]) {
- state.listStack.pop();
- }
+ state.indentation = lineIndentation + stream.current().length;
+ state.list = true;
+ state.quote = 0;
// Add this list item's content's indentation to the stack
state.listStack.push(state.indentation);
@@ -214,15 +233,47 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
state.f = state.inline;
if (modeCfg.highlightFormatting) state.formatting = ["list", "list-" + listType];
return getType(state);
- } else if (modeCfg.fencedCodeBlocks && (match = stream.match(fencedCodeRE, true))) {
- state.fencedChars = match[1]
+ } else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(fencedCodeRE, true))) {
+ state.quote = 0;
+ state.fencedEndRE = new RegExp(match[1] + "+ *$");
// try switching mode
- state.localMode = getMode(match[2]);
+ state.localMode = modeCfg.fencedCodeBlockHighlighting && getMode(match[2]);
if (state.localMode) state.localState = CodeMirror.startState(state.localMode);
state.f = state.block = local;
if (modeCfg.highlightFormatting) state.formatting = "code-block";
state.code = -1
return getType(state);
+ // SETEXT has lowest block-scope precedence after HR, so check it after
+ // the others (code, blockquote, list...)
+ } else if (
+ // if setext set, indicates line after ---/===
+ state.setext || (
+ // line before ---/===
+ (!allowsInlineContinuation || !prevLineIsList) && !state.quote && state.list === false &&
+ !state.code && !isHr && !linkDefRE.test(stream.string) &&
+ (match = stream.lookAhead(1)) && (match = match.match(setextHeaderRE))
+ )
+ ) {
+ if ( !state.setext ) {
+ state.header = match[0].charAt(0) == '=' ? 1 : 2;
+ state.setext = state.header;
+ } else {
+ state.header = state.setext;
+ // has no effect on type so we can reset it now
+ state.setext = 0;
+ stream.skipToEnd();
+ if (modeCfg.highlightFormatting) state.formatting = "header";
+ }
+ state.thisLine.header = true;
+ state.f = state.inline;
+ return getType(state);
+ } else if (isHr) {
+ stream.skipToEnd();
+ state.hr = true;
+ state.thisLine.hr = true;
+ return tokenTypes.hr;
+ } else if (stream.peek() === '[') {
+ return switchInline(stream, state, footnoteLink);
}
return switchInline(stream, state, state.inline);
@@ -244,10 +295,21 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
}
function local(stream, state) {
- if (state.fencedChars && stream.match(state.fencedChars, false)) {
+ var currListInd = state.listStack[state.listStack.length - 1] || 0;
+ var hasExitedList = state.indentation < currListInd;
+ var maxFencedEndInd = currListInd + 3;
+ if (state.fencedEndRE && state.indentation <= maxFencedEndInd && (hasExitedList || stream.match(state.fencedEndRE))) {
+ if (modeCfg.highlightFormatting) state.formatting = "code-block";
+ var returnType;
+ if (!hasExitedList) returnType = getType(state)
state.localMode = state.localState = null;
- state.f = state.block = leavingLocal;
- return null;
+ state.block = blockNormal;
+ state.f = inlineNormal;
+ state.fencedEndRE = null;
+ state.code = 0
+ state.thisLine.fencedCodeEnd = true;
+ if (hasExitedList) return switchBlock(stream, state, state.block);
+ return returnType;
} else if (state.localMode) {
return state.localMode.token(stream, state.localState);
} else {
@@ -256,18 +318,6 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
}
}
- function leavingLocal(stream, state) {
- stream.match(state.fencedChars);
- state.block = blockNormal;
- state.f = inlineNormal;
- state.fencedChars = null;
- if (modeCfg.highlightFormatting) state.formatting = "code-block";
- state.code = 1
- var returnType = getType(state);
- state.code = 0
- return returnType;
- }
-
// Inline
function getType(state) {
var styles = [];
@@ -311,8 +361,12 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
if (state.strong) { styles.push(tokenTypes.strong); }
if (state.em) { styles.push(tokenTypes.em); }
if (state.strikethrough) { styles.push(tokenTypes.strikethrough); }
+ if (state.emoji) { styles.push(tokenTypes.emoji); }
if (state.linkText) { styles.push(tokenTypes.linkText); }
if (state.code) { styles.push(tokenTypes.code); }
+ if (state.image) { styles.push(tokenTypes.image); }
+ if (state.imageAltText) { styles.push(tokenTypes.imageAltText, "link"); }
+ if (state.imageMarker) { styles.push(tokenTypes.imageMarker); }
}
if (state.header) { styles.push(tokenTypes.header, tokenTypes.header + "-" + state.header); }
@@ -366,7 +420,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
}
if (state.taskList) {
- var taskOpen = stream.match(taskListRE, true)[1] !== "x";
+ var taskOpen = stream.match(taskListRE, true)[1] === " ";
if (taskOpen) state.taskOpen = true;
else state.taskClosed = true;
if (modeCfg.highlightFormatting) state.formatting = "task";
@@ -382,9 +436,6 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
return getType(state);
}
- // Get sol() value now, before character is consumed
- var sol = stream.sol();
-
var ch = stream.next();
// Matches link titles present on next line
@@ -394,7 +445,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
if (ch === '(') {
matchCh = ')';
}
- matchCh = (matchCh+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
+ matchCh = (matchCh+'').replace(/([.?*+^\[\]\\(){}|-])/g, "\\$1");
var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh;
if (stream.match(new RegExp(regex), true)) {
return tokenTypes.linkHref;
@@ -407,7 +458,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
if (modeCfg.highlightFormatting) state.formatting = "code";
stream.eatWhile('`');
var count = stream.current().length
- if (state.code == 0) {
+ if (state.code == 0 && (!state.quote || count == 1)) {
state.code = count
return getType(state)
} else if (count == state.code) { // Must be exact
@@ -432,22 +483,40 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
}
if (ch === '!' && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) {
- stream.match(/\[[^\]]*\]/);
+ state.imageMarker = true;
+ state.image = true;
+ if (modeCfg.highlightFormatting) state.formatting = "image";
+ return getType(state);
+ }
+
+ if (ch === '[' && state.imageMarker && stream.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/, false)) {
+ state.imageMarker = false;
+ state.imageAltText = true
+ if (modeCfg.highlightFormatting) state.formatting = "image";
+ return getType(state);
+ }
+
+ if (ch === ']' && state.imageAltText) {
+ if (modeCfg.highlightFormatting) state.formatting = "image";
+ var type = getType(state);
+ state.imageAltText = false;
+ state.image = false;
state.inline = state.f = linkHref;
- return tokenTypes.image;
+ return type;
}
- if (ch === '[' && stream.match(/[^\]]*\](\(.*\)| ?\[.*?\])/, false)) {
+ if (ch === '[' && !state.image) {
+ if (state.linkText && stream.match(/^.*?\]/)) return getType(state)
state.linkText = true;
if (modeCfg.highlightFormatting) state.formatting = "link";
return getType(state);
}
- if (ch === ']' && state.linkText && stream.match(/\(.*?\)| ?\[.*?\]/, false)) {
+ if (ch === ']' && state.linkText) {
if (modeCfg.highlightFormatting) state.formatting = "link";
var type = getType(state);
state.linkText = false;
- state.inline = state.f = linkHref;
+ state.inline = state.f = stream.match(/\(.*?\)| ?\[.*?\]/, false) ? linkHref : inlineNormal
return type;
}
@@ -475,7 +544,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
return type + tokenTypes.linkEmail;
}
- if (ch === '<' && stream.match(/^(!--|\w)/, false)) {
+ if (modeCfg.xml && ch === '<' && stream.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i, false)) {
var end = stream.string.indexOf(">", stream.pos);
if (end != -1) {
var atts = stream.string.substring(stream.start, end);
@@ -486,44 +555,37 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
return switchBlock(stream, state, htmlBlock);
}
- if (ch === '<' && stream.match(/^\/\w*?>/)) {
+ if (modeCfg.xml && ch === '<' && stream.match(/^\/\w*?>/)) {
state.md_inside = false;
return "tag";
- }
-
- var ignoreUnderscore = false;
- if (!modeCfg.underscoresBreakWords) {
- if (ch === '_' && stream.peek() !== '_' && stream.match(/(\w)/, false)) {
- var prevPos = stream.pos - 2;
- if (prevPos >= 0) {
- var prevCh = stream.string.charAt(prevPos);
- if (prevCh !== '_' && prevCh.match(/(\w)/, false)) {
- ignoreUnderscore = true;
- }
- }
+ } else if (ch === "*" || ch === "_") {
+ var len = 1, before = stream.pos == 1 ? " " : stream.string.charAt(stream.pos - 2)
+ while (len < 3 && stream.eat(ch)) len++
+ var after = stream.peek() || " "
+ // See http://spec.commonmark.org/0.27/#emphasis-and-strong-emphasis
+ var leftFlanking = !/\s/.test(after) && (!punctuation.test(after) || /\s/.test(before) || punctuation.test(before))
+ var rightFlanking = !/\s/.test(before) && (!punctuation.test(before) || /\s/.test(after) || punctuation.test(after))
+ var setEm = null, setStrong = null
+ if (len % 2) { // Em
+ if (!state.em && leftFlanking && (ch === "*" || !rightFlanking || punctuation.test(before)))
+ setEm = true
+ else if (state.em == ch && rightFlanking && (ch === "*" || !leftFlanking || punctuation.test(after)))
+ setEm = false
}
- }
- if (ch === '*' || (ch === '_' && !ignoreUnderscore)) {
- if (sol && stream.peek() === ' ') {
- // Do nothing, surrounded by newline and space
- } else if (state.strong === ch && stream.eat(ch)) { // Remove STRONG
- if (modeCfg.highlightFormatting) state.formatting = "strong";
- var t = getType(state);
- state.strong = false;
- return t;
- } else if (!state.strong && stream.eat(ch)) { // Add STRONG
- state.strong = ch;
- if (modeCfg.highlightFormatting) state.formatting = "strong";
- return getType(state);
- } else if (state.em === ch) { // Remove EM
- if (modeCfg.highlightFormatting) state.formatting = "em";
- var t = getType(state);
- state.em = false;
- return t;
- } else if (!state.em) { // Add EM
- state.em = ch;
- if (modeCfg.highlightFormatting) state.formatting = "em";
- return getType(state);
+ if (len > 1) { // Strong
+ if (!state.strong && leftFlanking && (ch === "*" || !rightFlanking || punctuation.test(before)))
+ setStrong = true
+ else if (state.strong == ch && rightFlanking && (ch === "*" || !leftFlanking || punctuation.test(after)))
+ setStrong = false
+ }
+ if (setStrong != null || setEm != null) {
+ if (modeCfg.highlightFormatting) state.formatting = setEm == null ? "strong" : setStrong == null ? "em" : "strong em"
+ if (setEm === true) state.em = ch
+ if (setStrong === true) state.strong = ch
+ var t = getType(state)
+ if (setEm === false) state.em = false
+ if (setStrong === false) state.strong = false
+ return t
}
} else if (ch === ' ') {
if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces
@@ -558,8 +620,16 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
}
}
+ if (modeCfg.emoji && ch === ":" && stream.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)) {
+ state.emoji = true;
+ if (modeCfg.highlightFormatting) state.formatting = "emoji";
+ var retType = getType(state);
+ state.emoji = false;
+ return retType;
+ }
+
if (ch === ' ') {
- if (stream.match(/ +$/, false)) {
+ if (stream.match(/^ +$/, false)) {
state.trailingSpace++;
} else if (state.trailingSpace) {
state.trailingSpaceNewLine = true;
@@ -596,7 +666,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
}
var ch = stream.next();
if (ch === '(' || ch === '[') {
- state.f = state.inline = getLinkHrefInside(ch === "(" ? ")" : "]", 0);
+ state.f = state.inline = getLinkHrefInside(ch === "(" ? ")" : "]");
if (modeCfg.highlightFormatting) state.formatting = "link-string";
state.linkHref = true;
return getType(state);
@@ -606,7 +676,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
var linkRE = {
")": /^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,
- "]": /^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\\]]|\\.)*\])*?(?=\])/
+ "]": /^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/
}
function getLinkHrefInside(endChar) {
@@ -674,8 +744,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
return {
f: blockNormal,
- prevLine: null,
- thisLine: null,
+ prevLine: {stream: null},
+ thisLine: {stream: null},
block: blockNormal,
htmlState: null,
@@ -692,6 +762,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
em: false,
strong: false,
header: 0,
+ setext: 0,
hr: false,
taskList: false,
list: false,
@@ -700,7 +771,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
trailingSpace: 0,
trailingSpaceNewLine: false,
strikethrough: false,
- fencedChars: null
+ emoji: false,
+ fencedEndRE: null
};
},
@@ -721,12 +793,16 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
inline: s.inline,
text: s.text,
formatting: false,
+ linkText: s.linkText,
linkTitle: s.linkTitle,
+ linkHref: s.linkHref,
code: s.code,
em: s.em,
strong: s.strong,
strikethrough: s.strikethrough,
+ emoji: s.emoji,
header: s.header,
+ setext: s.setext,
hr: s.hr,
taskList: s.taskList,
list: s.list,
@@ -736,7 +812,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
trailingSpace: s.trailingSpace,
trailingSpaceNewLine: s.trailingSpaceNewLine,
md_inside: s.md_inside,
- fencedChars: s.fencedChars
+ fencedEndRE: s.fencedEndRE
};
},
@@ -745,21 +821,17 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
// Reset state.formatting
state.formatting = false;
- if (stream != state.thisLine) {
- var forceBlankLine = state.header || state.hr;
-
- // Reset state.header and state.hr
+ if (stream != state.thisLine.stream) {
state.header = 0;
state.hr = false;
- if (stream.match(/^\s*$/, true) || forceBlankLine) {
+ if (stream.match(/^\s*$/, true)) {
blankLine(state);
- if (!forceBlankLine) return null
- state.prevLine = null
+ return null;
}
state.prevLine = state.thisLine
- state.thisLine = stream
+ state.thisLine = {stream: stream}
// Reset state.taskList
state.taskList = false;
@@ -768,11 +840,15 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
state.trailingSpace = 0;
state.trailingSpaceNewLine = false;
- state.f = state.block;
- var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, ' ').length;
- state.indentationDiff = Math.min(indentation - state.indentation, 4);
- state.indentation = state.indentation + state.indentationDiff;
- if (indentation > 0) return null;
+ if (!state.localState) {
+ state.f = state.block;
+ if (state.f != htmlBlock) {
+ var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, expandedTab).length;
+ state.indentation = indentation;
+ state.indentationDiff = null;
+ if (indentation > 0) return null;
+ }
+ }
}
return state.f(stream, state);
},
@@ -783,15 +859,26 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
return {state: state, mode: mode};
},
+ indent: function(state, textAfter, line) {
+ if (state.block == htmlBlock && htmlMode.indent) return htmlMode.indent(state.htmlState, textAfter, line)
+ if (state.localState && state.localMode.indent) return state.localMode.indent(state.localState, textAfter, line)
+ return CodeMirror.Pass
+ },
+
blankLine: blankLine,
getType: getType,
+ blockCommentStart: "",
+ closeBrackets: "()[]{}''\"\"``",
fold: "markdown"
};
return mode;
}, "xml");
+CodeMirror.defineMIME("text/markdown", "markdown");
+
CodeMirror.defineMIME("text/x-markdown", "markdown");
});
diff --git a/vendor/assets/javascripts/codemirror/modes/mathematica.js b/vendor/assets/javascripts/codemirror/modes/mathematica.js
index d697708..72b3492 100644
--- a/vendor/assets/javascripts/codemirror/modes/mathematica.js
+++ b/vendor/assets/javascripts/codemirror/modes/mathematica.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
// Mathematica mode copyright (c) 2015 by Calin Barbat
// Based on code by Patrick Scheibe (halirutan)
@@ -71,12 +71,12 @@ CodeMirror.defineMode('mathematica', function(_config, _parserConfig) {
}
// usage
- if (stream.match(/([a-zA-Z\$]+(?:`?[a-zA-Z0-9\$])*::usage)/, true, false)) {
+ if (stream.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/, true, false)) {
return 'meta';
}
// message
- if (stream.match(/([a-zA-Z\$]+(?:`?[a-zA-Z0-9\$])*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/, true, false)) {
+ if (stream.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/, true, false)) {
return 'string-2';
}
diff --git a/vendor/assets/javascripts/codemirror/modes/mbox.js b/vendor/assets/javascripts/codemirror/modes/mbox.js
index ba2416a..640437e 100644
--- a/vendor/assets/javascripts/codemirror/modes/mbox.js
+++ b/vendor/assets/javascripts/codemirror/modes/mbox.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/meta.js b/vendor/assets/javascripts/codemirror/modes/meta.js
new file mode 100644
index 0000000..95d4731
--- /dev/null
+++ b/vendor/assets/javascripts/codemirror/modes/meta.js
@@ -0,0 +1,218 @@
+// 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";
+
+ CodeMirror.modeInfo = [
+ {name: "APL", mime: "text/apl", mode: "apl", ext: ["dyalog", "apl"]},
+ {name: "PGP", mimes: ["application/pgp", "application/pgp-encrypted", "application/pgp-keys", "application/pgp-signature"], mode: "asciiarmor", ext: ["asc", "pgp", "sig"]},
+ {name: "ASN.1", mime: "text/x-ttcn-asn", mode: "asn.1", ext: ["asn", "asn1"]},
+ {name: "Asterisk", mime: "text/x-asterisk", mode: "asterisk", file: /^extensions\.conf$/i},
+ {name: "Brainfuck", mime: "text/x-brainfuck", mode: "brainfuck", ext: ["b", "bf"]},
+ {name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h", "ino"]},
+ {name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"], alias: ["cpp"]},
+ {name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy"]},
+ {name: "C#", mime: "text/x-csharp", mode: "clike", ext: ["cs"], alias: ["csharp", "cs"]},
+ {name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj", "cljc", "cljx"]},
+ {name: "ClojureScript", mime: "text/x-clojurescript", mode: "clojure", ext: ["cljs"]},
+ {name: "Closure Stylesheets (GSS)", mime: "text/x-gss", mode: "css", ext: ["gss"]},
+ {name: "CMake", mime: "text/x-cmake", mode: "cmake", ext: ["cmake", "cmake.in"], file: /^CMakeLists.txt$/},
+ {name: "CoffeeScript", mimes: ["application/vnd.coffeescript", "text/coffeescript", "text/x-coffeescript"], mode: "coffeescript", ext: ["coffee"], alias: ["coffee", "coffee-script"]},
+ {name: "Common Lisp", mime: "text/x-common-lisp", mode: "commonlisp", ext: ["cl", "lisp", "el"], alias: ["lisp"]},
+ {name: "Cypher", mime: "application/x-cypher-query", mode: "cypher", ext: ["cyp", "cypher"]},
+ {name: "Cython", mime: "text/x-cython", mode: "python", ext: ["pyx", "pxd", "pxi"]},
+ {name: "Crystal", mime: "text/x-crystal", mode: "crystal", ext: ["cr"]},
+ {name: "CSS", mime: "text/css", mode: "css", ext: ["css"]},
+ {name: "CQL", mime: "text/x-cassandra", mode: "sql", ext: ["cql"]},
+ {name: "D", mime: "text/x-d", mode: "d", ext: ["d"]},
+ {name: "Dart", mimes: ["application/dart", "text/x-dart"], mode: "dart", ext: ["dart"]},
+ {name: "diff", mime: "text/x-diff", mode: "diff", ext: ["diff", "patch"]},
+ {name: "Django", mime: "text/x-django", mode: "django"},
+ {name: "Dockerfile", mime: "text/x-dockerfile", mode: "dockerfile", file: /^Dockerfile$/},
+ {name: "DTD", mime: "application/xml-dtd", mode: "dtd", ext: ["dtd"]},
+ {name: "Dylan", mime: "text/x-dylan", mode: "dylan", ext: ["dylan", "dyl", "intr"]},
+ {name: "EBNF", mime: "text/x-ebnf", mode: "ebnf"},
+ {name: "ECL", mime: "text/x-ecl", mode: "ecl", ext: ["ecl"]},
+ {name: "edn", mime: "application/edn", mode: "clojure", ext: ["edn"]},
+ {name: "Eiffel", mime: "text/x-eiffel", mode: "eiffel", ext: ["e"]},
+ {name: "Elm", mime: "text/x-elm", mode: "elm", ext: ["elm"]},
+ {name: "Embedded Javascript", mime: "application/x-ejs", mode: "htmlembedded", ext: ["ejs"]},
+ {name: "Embedded Ruby", mime: "application/x-erb", mode: "htmlembedded", ext: ["erb"]},
+ {name: "Erlang", mime: "text/x-erlang", mode: "erlang", ext: ["erl"]},
+ {name: "Esper", mime: "text/x-esper", mode: "sql"},
+ {name: "Factor", mime: "text/x-factor", mode: "factor", ext: ["factor"]},
+ {name: "FCL", mime: "text/x-fcl", mode: "fcl"},
+ {name: "Forth", mime: "text/x-forth", mode: "forth", ext: ["forth", "fth", "4th"]},
+ {name: "Fortran", mime: "text/x-fortran", mode: "fortran", ext: ["f", "for", "f77", "f90", "f95"]},
+ {name: "F#", mime: "text/x-fsharp", mode: "mllike", ext: ["fs"], alias: ["fsharp"]},
+ {name: "Gas", mime: "text/x-gas", mode: "gas", ext: ["s"]},
+ {name: "Gherkin", mime: "text/x-feature", mode: "gherkin", ext: ["feature"]},
+ {name: "GitHub Flavored Markdown", mime: "text/x-gfm", mode: "gfm", file: /^(readme|contributing|history).md$/i},
+ {name: "Go", mime: "text/x-go", mode: "go", ext: ["go"]},
+ {name: "Groovy", mime: "text/x-groovy", mode: "groovy", ext: ["groovy", "gradle"], file: /^Jenkinsfile$/},
+ {name: "HAML", mime: "text/x-haml", mode: "haml", ext: ["haml"]},
+ {name: "Haskell", mime: "text/x-haskell", mode: "haskell", ext: ["hs"]},
+ {name: "Haskell (Literate)", mime: "text/x-literate-haskell", mode: "haskell-literate", ext: ["lhs"]},
+ {name: "Haxe", mime: "text/x-haxe", mode: "haxe", ext: ["hx"]},
+ {name: "HXML", mime: "text/x-hxml", mode: "haxe", ext: ["hxml"]},
+ {name: "ASP.NET", mime: "application/x-aspx", mode: "htmlembedded", ext: ["aspx"], alias: ["asp", "aspx"]},
+ {name: "HTML", mime: "text/html", mode: "htmlmixed", ext: ["html", "htm", "handlebars", "hbs"], alias: ["xhtml"]},
+ {name: "HTTP", mime: "message/http", mode: "http"},
+ {name: "IDL", mime: "text/x-idl", mode: "idl", ext: ["pro"]},
+ {name: "Pug", mime: "text/x-pug", mode: "pug", ext: ["jade", "pug"], alias: ["jade"]},
+ {name: "Java", mime: "text/x-java", mode: "clike", ext: ["java"]},
+ {name: "Java Server Pages", mime: "application/x-jsp", mode: "htmlembedded", ext: ["jsp"], alias: ["jsp"]},
+ {name: "JavaScript", mimes: ["text/javascript", "text/ecmascript", "application/javascript", "application/x-javascript", "application/ecmascript"],
+ mode: "javascript", ext: ["js"], alias: ["ecmascript", "js", "node"]},
+ {name: "JSON", mimes: ["application/json", "application/x-json"], mode: "javascript", ext: ["json", "map"], alias: ["json5"]},
+ {name: "JSON-LD", mime: "application/ld+json", mode: "javascript", ext: ["jsonld"], alias: ["jsonld"]},
+ {name: "JSX", mime: "text/jsx", mode: "jsx", ext: ["jsx"]},
+ {name: "Jinja2", mime: "text/jinja2", mode: "jinja2", ext: ["j2", "jinja", "jinja2"]},
+ {name: "Julia", mime: "text/x-julia", mode: "julia", ext: ["jl"]},
+ {name: "Kotlin", mime: "text/x-kotlin", mode: "clike", ext: ["kt"]},
+ {name: "LESS", mime: "text/x-less", mode: "css", ext: ["less"]},
+ {name: "LiveScript", mime: "text/x-livescript", mode: "livescript", ext: ["ls"], alias: ["ls"]},
+ {name: "Lua", mime: "text/x-lua", mode: "lua", ext: ["lua"]},
+ {name: "Markdown", mime: "text/x-markdown", mode: "markdown", ext: ["markdown", "md", "mkd"]},
+ {name: "mIRC", mime: "text/mirc", mode: "mirc"},
+ {name: "MariaDB SQL", mime: "text/x-mariadb", mode: "sql"},
+ {name: "Mathematica", mime: "text/x-mathematica", mode: "mathematica", ext: ["m", "nb"]},
+ {name: "Modelica", mime: "text/x-modelica", mode: "modelica", ext: ["mo"]},
+ {name: "MUMPS", mime: "text/x-mumps", mode: "mumps", ext: ["mps"]},
+ {name: "MS SQL", mime: "text/x-mssql", mode: "sql"},
+ {name: "mbox", mime: "application/mbox", mode: "mbox", ext: ["mbox"]},
+ {name: "MySQL", mime: "text/x-mysql", mode: "sql"},
+ {name: "Nginx", mime: "text/x-nginx-conf", mode: "nginx", file: /nginx.*\.conf$/i},
+ {name: "NSIS", mime: "text/x-nsis", mode: "nsis", ext: ["nsh", "nsi"]},
+ {name: "NTriples", mimes: ["application/n-triples", "application/n-quads", "text/n-triples"],
+ mode: "ntriples", ext: ["nt", "nq"]},
+ {name: "Objective-C", mime: "text/x-objectivec", mode: "clike", ext: ["m", "mm"], alias: ["objective-c", "objc"]},
+ {name: "OCaml", mime: "text/x-ocaml", mode: "mllike", ext: ["ml", "mli", "mll", "mly"]},
+ {name: "Octave", mime: "text/x-octave", mode: "octave", ext: ["m"]},
+ {name: "Oz", mime: "text/x-oz", mode: "oz", ext: ["oz"]},
+ {name: "Pascal", mime: "text/x-pascal", mode: "pascal", ext: ["p", "pas"]},
+ {name: "PEG.js", mime: "null", mode: "pegjs", ext: ["jsonld"]},
+ {name: "Perl", mime: "text/x-perl", mode: "perl", ext: ["pl", "pm"]},
+ {name: "PHP", mimes: ["text/x-php", "application/x-httpd-php", "application/x-httpd-php-open"], mode: "php", ext: ["php", "php3", "php4", "php5", "php7", "phtml"]},
+ {name: "Pig", mime: "text/x-pig", mode: "pig", ext: ["pig"]},
+ {name: "Plain Text", mime: "text/plain", mode: "null", ext: ["txt", "text", "conf", "def", "list", "log"]},
+ {name: "PLSQL", mime: "text/x-plsql", mode: "sql", ext: ["pls"]},
+ {name: "PostgreSQL", mime: "text/x-pgsql", mode: "sql"},
+ {name: "PowerShell", mime: "application/x-powershell", mode: "powershell", ext: ["ps1", "psd1", "psm1"]},
+ {name: "Properties files", mime: "text/x-properties", mode: "properties", ext: ["properties", "ini", "in"], alias: ["ini", "properties"]},
+ {name: "ProtoBuf", mime: "text/x-protobuf", mode: "protobuf", ext: ["proto"]},
+ {name: "Python", mime: "text/x-python", mode: "python", ext: ["BUILD", "bzl", "py", "pyw"], file: /^(BUCK|BUILD)$/},
+ {name: "Puppet", mime: "text/x-puppet", mode: "puppet", ext: ["pp"]},
+ {name: "Q", mime: "text/x-q", mode: "q", ext: ["q"]},
+ {name: "R", mime: "text/x-rsrc", mode: "r", ext: ["r", "R"], alias: ["rscript"]},
+ {name: "reStructuredText", mime: "text/x-rst", mode: "rst", ext: ["rst"], alias: ["rst"]},
+ {name: "RPM Changes", mime: "text/x-rpm-changes", mode: "rpm"},
+ {name: "RPM Spec", mime: "text/x-rpm-spec", mode: "rpm", ext: ["spec"]},
+ {name: "Ruby", mime: "text/x-ruby", mode: "ruby", ext: ["rb"], alias: ["jruby", "macruby", "rake", "rb", "rbx"]},
+ {name: "Rust", mime: "text/x-rustsrc", mode: "rust", ext: ["rs"]},
+ {name: "SAS", mime: "text/x-sas", mode: "sas", ext: ["sas"]},
+ {name: "Sass", mime: "text/x-sass", mode: "sass", ext: ["sass"]},
+ {name: "Scala", mime: "text/x-scala", mode: "clike", ext: ["scala"]},
+ {name: "Scheme", mime: "text/x-scheme", mode: "scheme", ext: ["scm", "ss"]},
+ {name: "SCSS", mime: "text/x-scss", mode: "css", ext: ["scss"]},
+ {name: "Shell", mimes: ["text/x-sh", "application/x-sh"], mode: "shell", ext: ["sh", "ksh", "bash"], alias: ["bash", "sh", "zsh"], file: /^PKGBUILD$/},
+ {name: "Sieve", mime: "application/sieve", mode: "sieve", ext: ["siv", "sieve"]},
+ {name: "Slim", mimes: ["text/x-slim", "application/x-slim"], mode: "slim", ext: ["slim"]},
+ {name: "Smalltalk", mime: "text/x-stsrc", mode: "smalltalk", ext: ["st"]},
+ {name: "Smarty", mime: "text/x-smarty", mode: "smarty", ext: ["tpl"]},
+ {name: "Solr", mime: "text/x-solr", mode: "solr"},
+ {name: "SML", mime: "text/x-sml", mode: "mllike", ext: ["sml", "sig", "fun", "smackspec"]},
+ {name: "Soy", mime: "text/x-soy", mode: "soy", ext: ["soy"], alias: ["closure template"]},
+ {name: "SPARQL", mime: "application/sparql-query", mode: "sparql", ext: ["rq", "sparql"], alias: ["sparul"]},
+ {name: "Spreadsheet", mime: "text/x-spreadsheet", mode: "spreadsheet", alias: ["excel", "formula"]},
+ {name: "SQL", mime: "text/x-sql", mode: "sql", ext: ["sql"]},
+ {name: "SQLite", mime: "text/x-sqlite", mode: "sql"},
+ {name: "Squirrel", mime: "text/x-squirrel", mode: "clike", ext: ["nut"]},
+ {name: "Stylus", mime: "text/x-styl", mode: "stylus", ext: ["styl"]},
+ {name: "Swift", mime: "text/x-swift", mode: "swift", ext: ["swift"]},
+ {name: "sTeX", mime: "text/x-stex", mode: "stex"},
+ {name: "LaTeX", mime: "text/x-latex", mode: "stex", ext: ["text", "ltx", "tex"], alias: ["tex"]},
+ {name: "SystemVerilog", mime: "text/x-systemverilog", mode: "verilog", ext: ["v", "sv", "svh"]},
+ {name: "Tcl", mime: "text/x-tcl", mode: "tcl", ext: ["tcl"]},
+ {name: "Textile", mime: "text/x-textile", mode: "textile", ext: ["textile"]},
+ {name: "TiddlyWiki ", mime: "text/x-tiddlywiki", mode: "tiddlywiki"},
+ {name: "Tiki wiki", mime: "text/tiki", mode: "tiki"},
+ {name: "TOML", mime: "text/x-toml", mode: "toml", ext: ["toml"]},
+ {name: "Tornado", mime: "text/x-tornado", mode: "tornado"},
+ {name: "troff", mime: "text/troff", mode: "troff", ext: ["1", "2", "3", "4", "5", "6", "7", "8", "9"]},
+ {name: "TTCN", mime: "text/x-ttcn", mode: "ttcn", ext: ["ttcn", "ttcn3", "ttcnpp"]},
+ {name: "TTCN_CFG", mime: "text/x-ttcn-cfg", mode: "ttcn-cfg", ext: ["cfg"]},
+ {name: "Turtle", mime: "text/turtle", mode: "turtle", ext: ["ttl"]},
+ {name: "TypeScript", mime: "application/typescript", mode: "javascript", ext: ["ts"], alias: ["ts"]},
+ {name: "TypeScript-JSX", mime: "text/typescript-jsx", mode: "jsx", ext: ["tsx"], alias: ["tsx"]},
+ {name: "Twig", mime: "text/x-twig", mode: "twig"},
+ {name: "Web IDL", mime: "text/x-webidl", mode: "webidl", ext: ["webidl"]},
+ {name: "VB.NET", mime: "text/x-vb", mode: "vb", ext: ["vb"]},
+ {name: "VBScript", mime: "text/vbscript", mode: "vbscript", ext: ["vbs"]},
+ {name: "Velocity", mime: "text/velocity", mode: "velocity", ext: ["vtl"]},
+ {name: "Verilog", mime: "text/x-verilog", mode: "verilog", ext: ["v"]},
+ {name: "VHDL", mime: "text/x-vhdl", mode: "vhdl", ext: ["vhd", "vhdl"]},
+ {name: "Vue.js Component", mimes: ["script/x-vue", "text/x-vue"], mode: "vue", ext: ["vue"]},
+ {name: "XML", mimes: ["application/xml", "text/xml"], mode: "xml", ext: ["xml", "xsl", "xsd", "svg"], alias: ["rss", "wsdl", "xsd"]},
+ {name: "XQuery", mime: "application/xquery", mode: "xquery", ext: ["xy", "xquery"]},
+ {name: "Yacas", mime: "text/x-yacas", mode: "yacas", ext: ["ys"]},
+ {name: "YAML", mimes: ["text/x-yaml", "text/yaml"], mode: "yaml", ext: ["yaml", "yml"], alias: ["yml"]},
+ {name: "Z80", mime: "text/x-z80", mode: "z80", ext: ["z80"]},
+ {name: "mscgen", mime: "text/x-mscgen", mode: "mscgen", ext: ["mscgen", "mscin", "msc"]},
+ {name: "xu", mime: "text/x-xu", mode: "mscgen", ext: ["xu"]},
+ {name: "msgenny", mime: "text/x-msgenny", mode: "mscgen", ext: ["msgenny"]}
+ ];
+ // Ensure all modes have a mime property for backwards compatibility
+ for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
+ var info = CodeMirror.modeInfo[i];
+ if (info.mimes) info.mime = info.mimes[0];
+ }
+
+ CodeMirror.findModeByMIME = function(mime) {
+ mime = mime.toLowerCase();
+ for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
+ var info = CodeMirror.modeInfo[i];
+ if (info.mime == mime) return info;
+ if (info.mimes) for (var j = 0; j < info.mimes.length; j++)
+ if (info.mimes[j] == mime) return info;
+ }
+ if (/\+xml$/.test(mime)) return CodeMirror.findModeByMIME("application/xml")
+ if (/\+json$/.test(mime)) return CodeMirror.findModeByMIME("application/json")
+ };
+
+ CodeMirror.findModeByExtension = function(ext) {
+ for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
+ var info = CodeMirror.modeInfo[i];
+ if (info.ext) for (var j = 0; j < info.ext.length; j++)
+ if (info.ext[j] == ext) return info;
+ }
+ };
+
+ CodeMirror.findModeByFileName = function(filename) {
+ for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
+ var info = CodeMirror.modeInfo[i];
+ if (info.file && info.file.test(filename)) return info;
+ }
+ var dot = filename.lastIndexOf(".");
+ var ext = dot > -1 && filename.substring(dot + 1, filename.length);
+ if (ext) return CodeMirror.findModeByExtension(ext);
+ };
+
+ CodeMirror.findModeByName = function(name) {
+ name = name.toLowerCase();
+ for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
+ var info = CodeMirror.modeInfo[i];
+ if (info.name.toLowerCase() == name) return info;
+ if (info.alias) for (var j = 0; j < info.alias.length; j++)
+ if (info.alias[j].toLowerCase() == name) return info;
+ }
+ };
+});
diff --git a/vendor/assets/javascripts/codemirror/modes/mirc.js b/vendor/assets/javascripts/codemirror/modes/mirc.js
index f0d5c6a..d27b015 100644
--- a/vendor/assets/javascripts/codemirror/modes/mirc.js
+++ b/vendor/assets/javascripts/codemirror/modes/mirc.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
//mIRC mode by Ford_Lawnmower :: Based on Velocity mode by Steve O'Hara
@@ -130,7 +130,7 @@ CodeMirror.defineMode("mirc", function() {
}
}
else if (ch == "%") {
- stream.eatWhile(/[^,^\s^\(^\)]/);
+ stream.eatWhile(/[^,\s()]/);
state.beforeParams = true;
return "string";
}
diff --git a/vendor/assets/javascripts/codemirror/modes/mllike.js b/vendor/assets/javascripts/codemirror/modes/mllike.js
index bf0b8a6..a1538f7 100644
--- a/vendor/assets/javascripts/codemirror/modes/mllike.js
+++ b/vendor/assets/javascripts/codemirror/modes/mllike.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -13,31 +13,26 @@
CodeMirror.defineMode('mllike', function(_config, parserConfig) {
var words = {
- 'let': 'keyword',
- 'rec': 'keyword',
+ 'as': 'keyword',
+ 'do': 'keyword',
+ 'else': 'keyword',
+ 'end': 'keyword',
+ 'exception': 'keyword',
+ 'fun': 'keyword',
+ 'functor': 'keyword',
+ 'if': 'keyword',
'in': 'keyword',
+ 'include': 'keyword',
+ 'let': 'keyword',
'of': 'keyword',
- 'and': 'keyword',
- 'if': 'keyword',
+ 'open': 'keyword',
+ 'rec': 'keyword',
+ 'struct': 'keyword',
'then': 'keyword',
- 'else': 'keyword',
- 'for': 'keyword',
- 'to': 'keyword',
- 'while': 'keyword',
- 'do': 'keyword',
- 'done': 'keyword',
- 'fun': 'keyword',
- 'function': 'keyword',
- 'val': 'keyword',
'type': 'keyword',
- 'mutable': 'keyword',
- 'match': 'keyword',
- 'with': 'keyword',
- 'try': 'keyword',
- 'open': 'builtin',
- 'ignore': 'builtin',
- 'begin': 'keyword',
- 'end': 'keyword'
+ 'val': 'keyword',
+ 'while': 'keyword',
+ 'with': 'keyword'
};
var extraWords = parserConfig.extraWords || {};
@@ -46,6 +41,9 @@ CodeMirror.defineMode('mllike', function(_config, parserConfig) {
words[prop] = parserConfig.extraWords[prop];
}
}
+ var hintWords = [];
+ for (var k in words) { hintWords.push(k); }
+ CodeMirror.registerHelper("hintWords", "mllike", hintWords);
function tokenBase(stream, state) {
var ch = stream.next();
@@ -54,6 +52,13 @@ CodeMirror.defineMode('mllike', function(_config, parserConfig) {
state.tokenize = tokenString;
return state.tokenize(stream, state);
}
+ if (ch === '{') {
+ if (stream.eat('|')) {
+ state.longString = true;
+ state.tokenize = tokenLongString;
+ return state.tokenize(stream, state);
+ }
+ }
if (ch === '(') {
if (stream.eat('*')) {
state.commentLevel++;
@@ -61,7 +66,7 @@ CodeMirror.defineMode('mllike', function(_config, parserConfig) {
return state.tokenize(stream, state);
}
}
- if (ch === '~') {
+ if (ch === '~' || ch === '?') {
stream.eatWhile(/\w/);
return 'variable-2';
}
@@ -74,18 +79,32 @@ CodeMirror.defineMode('mllike', function(_config, parserConfig) {
return 'comment';
}
if (/\d/.test(ch)) {
- stream.eatWhile(/[\d]/);
- if (stream.eat('.')) {
- stream.eatWhile(/[\d]/);
+ if (ch === '0' && stream.eat(/[bB]/)) {
+ stream.eatWhile(/[01]/);
+ } if (ch === '0' && stream.eat(/[xX]/)) {
+ stream.eatWhile(/[0-9a-fA-F]/)
+ } if (ch === '0' && stream.eat(/[oO]/)) {
+ stream.eatWhile(/[0-7]/);
+ } else {
+ stream.eatWhile(/[\d_]/);
+ if (stream.eat('.')) {
+ stream.eatWhile(/[\d]/);
+ }
+ if (stream.eat(/[eE]/)) {
+ stream.eatWhile(/[\d\-+]/);
+ }
}
return 'number';
}
- if ( /[+\-*&%=<>!?|]/.test(ch)) {
+ if ( /[+\-*&%=<>!?|@\.~:]/.test(ch)) {
return 'operator';
}
- stream.eatWhile(/\w/);
- var cur = stream.current();
- return words.hasOwnProperty(cur) ? words[cur] : 'variable';
+ if (/[\w\xa1-\uffff]/.test(ch)) {
+ stream.eatWhile(/[\w\xa1-\uffff]/);
+ var cur = stream.current();
+ return words.hasOwnProperty(cur) ? words[cur] : 'variable';
+ }
+ return null
}
function tokenString(stream, state) {
@@ -116,8 +135,20 @@ CodeMirror.defineMode('mllike', function(_config, parserConfig) {
return 'comment';
}
+ function tokenLongString(stream, state) {
+ var prev, next;
+ while (state.longString && (next = stream.next()) != null) {
+ if (prev === '|' && next === '}') state.longString = false;
+ prev = next;
+ }
+ if (!state.longString) {
+ state.tokenize = tokenBase;
+ }
+ return 'string';
+ }
+
return {
- startState: function() {return {tokenize: tokenBase, commentLevel: 0};},
+ startState: function() {return {tokenize: tokenBase, commentLevel: 0, longString: false};},
token: function(stream, state) {
if (stream.eatSpace()) return null;
return state.tokenize(stream, state);
@@ -132,14 +163,64 @@ CodeMirror.defineMode('mllike', function(_config, parserConfig) {
CodeMirror.defineMIME('text/x-ocaml', {
name: 'mllike',
extraWords: {
- 'succ': 'keyword',
+ 'and': 'keyword',
+ 'assert': 'keyword',
+ 'begin': 'keyword',
+ 'class': 'keyword',
+ 'constraint': 'keyword',
+ 'done': 'keyword',
+ 'downto': 'keyword',
+ 'external': 'keyword',
+ 'function': 'keyword',
+ 'initializer': 'keyword',
+ 'lazy': 'keyword',
+ 'match': 'keyword',
+ 'method': 'keyword',
+ 'module': 'keyword',
+ 'mutable': 'keyword',
+ 'new': 'keyword',
+ 'nonrec': 'keyword',
+ 'object': 'keyword',
+ 'private': 'keyword',
+ 'sig': 'keyword',
+ 'to': 'keyword',
+ 'try': 'keyword',
+ 'value': 'keyword',
+ 'virtual': 'keyword',
+ 'when': 'keyword',
+
+ // builtins
+ 'raise': 'builtin',
+ 'failwith': 'builtin',
+ 'true': 'builtin',
+ 'false': 'builtin',
+
+ // Pervasives builtins
+ 'asr': 'builtin',
+ 'land': 'builtin',
+ 'lor': 'builtin',
+ 'lsl': 'builtin',
+ 'lsr': 'builtin',
+ 'lxor': 'builtin',
+ 'mod': 'builtin',
+ 'or': 'builtin',
+
+ // More Pervasives
+ 'raise_notrace': 'builtin',
'trace': 'builtin',
'exit': 'builtin',
'print_string': 'builtin',
'print_endline': 'builtin',
- 'true': 'atom',
- 'false': 'atom',
- 'raise': 'keyword'
+
+ 'int': 'type',
+ 'float': 'type',
+ 'bool': 'type',
+ 'char': 'type',
+ 'string': 'type',
+ 'unit': 'type',
+
+ // Modules
+ 'List': 'builtin'
}
});
@@ -147,18 +228,21 @@ CodeMirror.defineMIME('text/x-fsharp', {
name: 'mllike',
extraWords: {
'abstract': 'keyword',
- 'as': 'keyword',
'assert': 'keyword',
'base': 'keyword',
+ 'begin': 'keyword',
'class': 'keyword',
'default': 'keyword',
'delegate': 'keyword',
+ 'do!': 'keyword',
+ 'done': 'keyword',
'downcast': 'keyword',
'downto': 'keyword',
'elif': 'keyword',
- 'exception': 'keyword',
'extern': 'keyword',
'finally': 'keyword',
+ 'for': 'keyword',
+ 'function': 'keyword',
'global': 'keyword',
'inherit': 'keyword',
'inline': 'keyword',
@@ -166,38 +250,108 @@ CodeMirror.defineMIME('text/x-fsharp', {
'internal': 'keyword',
'lazy': 'keyword',
'let!': 'keyword',
- 'member' : 'keyword',
+ 'match': 'keyword',
+ 'member': 'keyword',
'module': 'keyword',
+ 'mutable': 'keyword',
'namespace': 'keyword',
'new': 'keyword',
'null': 'keyword',
'override': 'keyword',
'private': 'keyword',
'public': 'keyword',
- 'return': 'keyword',
'return!': 'keyword',
+ 'return': 'keyword',
'select': 'keyword',
'static': 'keyword',
- 'struct': 'keyword',
+ 'to': 'keyword',
+ 'try': 'keyword',
'upcast': 'keyword',
- 'use': 'keyword',
'use!': 'keyword',
- 'val': 'keyword',
+ 'use': 'keyword',
+ 'void': 'keyword',
'when': 'keyword',
- 'yield': 'keyword',
'yield!': 'keyword',
+ 'yield': 'keyword',
+
+ // Reserved words
+ 'atomic': 'keyword',
+ 'break': 'keyword',
+ 'checked': 'keyword',
+ 'component': 'keyword',
+ 'const': 'keyword',
+ 'constraint': 'keyword',
+ 'constructor': 'keyword',
+ 'continue': 'keyword',
+ 'eager': 'keyword',
+ 'event': 'keyword',
+ 'external': 'keyword',
+ 'fixed': 'keyword',
+ 'method': 'keyword',
+ 'mixin': 'keyword',
+ 'object': 'keyword',
+ 'parallel': 'keyword',
+ 'process': 'keyword',
+ 'protected': 'keyword',
+ 'pure': 'keyword',
+ 'sealed': 'keyword',
+ 'tailcall': 'keyword',
+ 'trait': 'keyword',
+ 'virtual': 'keyword',
+ 'volatile': 'keyword',
+ // builtins
'List': 'builtin',
'Seq': 'builtin',
'Map': 'builtin',
'Set': 'builtin',
+ 'Option': 'builtin',
'int': 'builtin',
'string': 'builtin',
- 'raise': 'builtin',
- 'failwith': 'builtin',
'not': 'builtin',
'true': 'builtin',
- 'false': 'builtin'
+ 'false': 'builtin',
+
+ 'raise': 'builtin',
+ 'failwith': 'builtin'
+ },
+ slashComments: true
+});
+
+
+CodeMirror.defineMIME('text/x-sml', {
+ name: 'mllike',
+ extraWords: {
+ 'abstype': 'keyword',
+ 'and': 'keyword',
+ 'andalso': 'keyword',
+ 'case': 'keyword',
+ 'datatype': 'keyword',
+ 'fn': 'keyword',
+ 'handle': 'keyword',
+ 'infix': 'keyword',
+ 'infixr': 'keyword',
+ 'local': 'keyword',
+ 'nonfix': 'keyword',
+ 'op': 'keyword',
+ 'orelse': 'keyword',
+ 'raise': 'keyword',
+ 'withtype': 'keyword',
+ 'eqtype': 'keyword',
+ 'sharing': 'keyword',
+ 'sig': 'keyword',
+ 'signature': 'keyword',
+ 'structure': 'keyword',
+ 'where': 'keyword',
+ 'true': 'keyword',
+ 'false': 'keyword',
+
+ // types
+ 'int': 'builtin',
+ 'real': 'builtin',
+ 'string': 'builtin',
+ 'char': 'builtin',
+ 'bool': 'builtin'
},
slashComments: true
});
diff --git a/vendor/assets/javascripts/codemirror/modes/modelica.js b/vendor/assets/javascripts/codemirror/modes/modelica.js
index 77ec7a3..a83a413 100644
--- a/vendor/assets/javascripts/codemirror/modes/modelica.js
+++ b/vendor/assets/javascripts/codemirror/modes/modelica.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
// Modelica support for CodeMirror, copyright (c) by Lennart Ochel
diff --git a/vendor/assets/javascripts/codemirror/modes/mscgen.js b/vendor/assets/javascripts/codemirror/modes/mscgen.js
index d61b470..6f4f9cd 100644
--- a/vendor/assets/javascripts/codemirror/modes/mscgen.js
+++ b/vendor/assets/javascripts/codemirror/modes/mscgen.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
// mode(s) for the sequence chart dsl's mscgen, xĂą and msgenny
// For more information on mscgen, see the site of the original author:
@@ -23,6 +23,7 @@
mscgen: {
"keywords" : ["msc"],
"options" : ["hscale", "width", "arcgradient", "wordwraparcs"],
+ "constants" : ["true", "false", "on", "off"],
"attributes" : ["label", "idurl", "id", "url", "linecolor", "linecolour", "textcolor", "textcolour", "textbgcolor", "textbgcolour", "arclinecolor", "arclinecolour", "arctextcolor", "arctextcolour", "arctextbgcolor", "arctextbgcolour", "arcskip"],
"brackets" : ["\\{", "\\}"], // [ and ] are brackets too, but these get handled in with lists
"arcsWords" : ["note", "abox", "rbox", "box"],
@@ -31,9 +32,10 @@
"operators" : ["="]
},
xu: {
- "keywords" : ["msc"],
- "options" : ["hscale", "width", "arcgradient", "wordwraparcs", "watermark"],
- "attributes" : ["label", "idurl", "id", "url", "linecolor", "linecolour", "textcolor", "textcolour", "textbgcolor", "textbgcolour", "arclinecolor", "arclinecolour", "arctextcolor", "arctextcolour", "arctextbgcolor", "arctextbgcolour", "arcskip"],
+ "keywords" : ["msc", "xu"],
+ "options" : ["hscale", "width", "arcgradient", "wordwraparcs", "wordwrapentities", "watermark"],
+ "constants" : ["true", "false", "on", "off", "auto"],
+ "attributes" : ["label", "idurl", "id", "url", "linecolor", "linecolour", "textcolor", "textcolour", "textbgcolor", "textbgcolour", "arclinecolor", "arclinecolour", "arctextcolor", "arctextcolour", "arctextbgcolor", "arctextbgcolour", "arcskip", "title", "deactivate", "activate", "activation"],
"brackets" : ["\\{", "\\}"], // [ and ] are brackets too, but these get handled in with lists
"arcsWords" : ["note", "abox", "rbox", "box", "alt", "else", "opt", "break", "par", "seq", "strict", "neg", "critical", "ignore", "consider", "assert", "loop", "ref", "exc"],
"arcsOthers" : ["\\|\\|\\|", "\\.\\.\\.", "---", "--", "<->", "==", "<<=>>", "<=>", "\\.\\.", "<<>>", "::", "<:>", "->", "=>>", "=>", ">>", ":>", "<-", "<<=", "<=", "<<", "<:", "x-", "-x"],
@@ -42,7 +44,8 @@
},
msgenny: {
"keywords" : null,
- "options" : ["hscale", "width", "arcgradient", "wordwraparcs", "watermark"],
+ "options" : ["hscale", "width", "arcgradient", "wordwraparcs", "wordwrapentities", "watermark"],
+ "constants" : ["true", "false", "on", "off", "auto"],
"attributes" : null,
"brackets" : ["\\{", "\\}"],
"arcsWords" : ["note", "abox", "rbox", "box", "alt", "else", "opt", "break", "par", "seq", "strict", "neg", "critical", "ignore", "consider", "assert", "loop", "ref", "exc"],
@@ -146,6 +149,9 @@
if (!!pConfig.operators && pStream.match(wordRegexp(pConfig.operators), true, true))
return "operator";
+ if (!!pConfig.constants && pStream.match(wordRegexp(pConfig.constants), true, true))
+ return "variable";
+
/* attribute lists */
if (!pConfig.inAttributeList && !!pConfig.attributes && pStream.match(/\[/, true, true)) {
pConfig.inAttributeList = true;
diff --git a/vendor/assets/javascripts/codemirror/modes/mumps.js b/vendor/assets/javascripts/codemirror/modes/mumps.js
index 469f8c3..3671c9c 100644
--- a/vendor/assets/javascripts/codemirror/modes/mumps.js
+++ b/vendor/assets/javascripts/codemirror/modes/mumps.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
/*
This MUMPS Language script was constructed using vbscript.js as a template.
diff --git a/vendor/assets/javascripts/codemirror/modes/nginx.js b/vendor/assets/javascripts/codemirror/modes/nginx.js
index 00a3224..a09f150 100644
--- a/vendor/assets/javascripts/codemirror/modes/nginx.js
+++ b/vendor/assets/javascripts/codemirror/modes/nginx.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/nsis.js b/vendor/assets/javascripts/codemirror/modes/nsis.js
index 172207c..94b8eae 100644
--- a/vendor/assets/javascripts/codemirror/modes/nsis.js
+++ b/vendor/assets/javascripts/codemirror/modes/nsis.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
// Author: Jan T. Sott (http://github.com/idleberg)
@@ -24,20 +24,20 @@ CodeMirror.defineSimpleMode("nsis",{
{ 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"},
+ {regex: /^\s*(?:\!(include|addincludedir|addplugindir|appendfile|cd|delfile|echo|error|execute|packhdr|pragma|finalize|getdllversion|gettlbversion|system|tempfile|warning|verbose|define|undef|insertmacro|macro|macroend|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},
+ {regex: /^\s*(?:\!(if(?:n?def)?|ifmacron?def|macro))\b/, token: "keyword", indent: true},
+ {regex: /^\s*(?:\!(else|endif|macroend))\b/, token: "keyword", dedent: true},
// Runtime Commands
- {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},
+ {regex: /^\s*(?: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|ExecShellWait|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|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEDllCharacteristics|PESubsysVer|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|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|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/, token: "keyword"},
+ {regex: /^\s*(?:Function|PageEx|Section(?:Group)?)\b/, token: "keyword", indent: true},
+ {regex: /^\s*(?:(Function|PageEx|Section(?:Group)?)End)\b/, token: "keyword", dedent: true},
// 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"},
+ {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(32|64)?|HKCU(32|64)?|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM(32|64)?|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|false|force|hide|highest|ifdiff|ifnewer|instfiles|lastused|leave|left|license|listonly|lzma|nevershow|none|normal|notset|off|on|right|show|silent|silentlog|textonly|top|true|try|un\.components|un\.custom|un\.directory|un\.instfiles|un\.license|uninstConfirm|user|Win10|Win7|Win8|WinVista|zlib)\b/, token: "builtin"},
// 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},
@@ -71,13 +71,13 @@ CodeMirror.defineSimpleMode("nsis",{
{regex: /[-+\/*=<>!]+/, token: "operator"},
// Variable
- {regex: /\$[\w]+/, token: "variable"},
+ {regex: /\$\w+/, token: "variable"},
// Constant
- {regex: /\${[\w]+}/,token: "variable-2"},
+ {regex: /\${[\w\.:-]+}/, token: "variable-2"},
// Language String
- {regex: /\$\([\w]+\)/,token: "variable-3"}
+ {regex: /\$\([\w\.:-]+\)/, token: "variable-3"}
],
comment: [
{regex: /.*?\*\//, token: "comment", next: "start"},
diff --git a/vendor/assets/javascripts/codemirror/modes/ntriples.js b/vendor/assets/javascripts/codemirror/modes/ntriples.js
index 0524b1e..5dd0272 100644
--- a/vendor/assets/javascripts/codemirror/modes/ntriples.js
+++ b/vendor/assets/javascripts/codemirror/modes/ntriples.js
@@ -1,11 +1,11 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
/**********************************************************
* This script provides syntax highlighting support for
-* the Ntriples format.
-* Ntriples format specification:
-* http://www.w3.org/TR/rdf-testcases/#ntriples
+* the N-Triples format.
+* N-Triples format specification:
+* https://www.w3.org/TR/n-triples/
***********************************************************/
/*
@@ -181,6 +181,15 @@ CodeMirror.defineMode("ntriples", function() {
};
});
+// define the registered Media Type for n-triples:
+// https://www.w3.org/TR/n-triples/#n-triples-mediatype
+CodeMirror.defineMIME("application/n-triples", "ntriples");
+
+// N-Quads is based on the N-Triples format (so same highlighting works)
+// https://www.w3.org/TR/n-quads/
+CodeMirror.defineMIME("application/n-quads", "ntriples");
+
+// previously used, though technically incorrect media type for n-triples
CodeMirror.defineMIME("text/n-triples", "ntriples");
});
diff --git a/vendor/assets/javascripts/codemirror/modes/octave.js b/vendor/assets/javascripts/codemirror/modes/octave.js
index a7bec03..4040b67 100644
--- a/vendor/assets/javascripts/codemirror/modes/octave.js
+++ b/vendor/assets/javascripts/codemirror/modes/octave.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -90,8 +90,8 @@ CodeMirror.defineMode("octave", function() {
if (stream.match(wordRegexp(['nan','NaN','inf','Inf']))) { return 'number'; };
// Handle Strings
- if (stream.match(/^"([^"]|(""))*"/)) { return 'string'; } ;
- if (stream.match(/^'([^']|(''))*'/)) { return 'string'; } ;
+ var m = stream.match(/^"(?:[^"]|"")*("|$)/) || stream.match(/^'(?:[^']|'')*('|$)/)
+ if (m) { return m[1] ? 'string' : "string error"; }
// Handle words
if (stream.match(keywords)) { return 'keyword'; } ;
@@ -126,7 +126,11 @@ CodeMirror.defineMode("octave", function() {
state.tokenize = tokenTranspose;
}
return style;
- }
+ },
+
+ lineComment: '%',
+
+ fold: 'indent'
};
});
diff --git a/vendor/assets/javascripts/codemirror/modes/oz.js b/vendor/assets/javascripts/codemirror/modes/oz.js
index ee8cb0a..a973849 100644
--- a/vendor/assets/javascripts/codemirror/modes/oz.js
+++ b/vendor/assets/javascripts/codemirror/modes/oz.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -27,7 +27,7 @@ CodeMirror.defineMode("oz", function (conf) {
var atoms = wordRegexp(["true", "false", "nil", "unit"]);
var commonKeywords = wordRegexp(["andthen", "at", "attr", "declare", "feat", "from", "lex",
- "mod", "mode", "orelse", "parser", "prod", "prop", "scanner", "self", "syn", "token"]);
+ "mod", "div", "mode", "orelse", "parser", "prod", "prop", "scanner", "self", "syn", "token"]);
var openingKeywords = wordRegexp(["local", "proc", "fun", "case", "class", "if", "cond", "or", "dis",
"choice", "not", "thread", "try", "raise", "lock", "for", "suchthat", "meth", "functor"]);
var middleKeywords = wordRegexp(middle);
diff --git a/vendor/assets/javascripts/codemirror/modes/pascal.js b/vendor/assets/javascripts/codemirror/modes/pascal.js
index 2d0c3d4..dc3b1a3 100644
--- a/vendor/assets/javascripts/codemirror/modes/pascal.js
+++ b/vendor/assets/javascripts/codemirror/modes/pascal.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -17,9 +17,21 @@ CodeMirror.defineMode("pascal", function() {
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
return obj;
}
- var keywords = words("and array begin case const div do downto else end file for forward integer " +
- "boolean char function goto if in label mod nil not of or packed procedure " +
- "program record repeat set string then to type until var while with");
+ var keywords = words(
+ "absolute and array asm begin case const constructor destructor div do " +
+ "downto else end file for function goto if implementation in inherited " +
+ "inline interface label mod nil not object of operator or packed procedure " +
+ "program record reintroduce repeat self set shl shr string then to type " +
+ "unit until uses var while with xor as class dispinterface except exports " +
+ "finalization finally initialization inline is library on out packed " +
+ "property raise resourcestring threadvar try absolute abstract alias " +
+ "assembler bitpacked break cdecl continue cppdecl cvar default deprecated " +
+ "dynamic enumerator experimental export external far far16 forward generic " +
+ "helper implements index interrupt iocheck local message name near " +
+ "nodefault noreturn nostackframe oldfpccall otherwise overload override " +
+ "pascal platform private protected public published read register " +
+ "reintroduce result safecall saveregisters softfloat specialize static " +
+ "stdcall stored strict unaligned unimplemented varargs virtual write");
var atoms = {"null": true};
var isOperatorChar = /[+\-*&%=<>!?|\/]/;
diff --git a/vendor/assets/javascripts/codemirror/modes/pegjs.js b/vendor/assets/javascripts/codemirror/modes/pegjs.js
index 6c72074..19d5fa4 100644
--- a/vendor/assets/javascripts/codemirror/modes/pegjs.js
+++ b/vendor/assets/javascripts/codemirror/modes/pegjs.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/perl.js b/vendor/assets/javascripts/codemirror/modes/perl.js
index 66e4ed0..a3101a7 100644
--- a/vendor/assets/javascripts/codemirror/modes/perl.js
+++ b/vendor/assets/javascripts/codemirror/modes/perl.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
// CodeMirror2 mode/perl/perl.js (text/x-perl) beta 0.10 (2011-11-08)
// This is a part of CodeMirror from https://github.com/sabaca/CodeMirror_mode_perl (mail@sabaca.com)
diff --git a/vendor/assets/javascripts/codemirror/modes/php.js b/vendor/assets/javascripts/codemirror/modes/php.js
index 57ba812..5f3a143 100644
--- a/vendor/assets/javascripts/codemirror/modes/php.js
+++ b/vendor/assets/javascripts/codemirror/modes/php.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -151,7 +151,7 @@
};
CodeMirror.defineMode("php", function(config, parserConfig) {
- var htmlMode = CodeMirror.getMode(config, "text/html");
+ var htmlMode = CodeMirror.getMode(config, (parserConfig && parserConfig.htmlMode) || "text/html");
var phpMode = CodeMirror.getMode(config, phpConfig);
function dispatch(stream, state) {
@@ -160,7 +160,7 @@
if (!isPHP) {
if (stream.match(/^<\?\w*/)) {
state.curMode = phpMode;
- if (!state.php) state.php = CodeMirror.startState(phpMode, htmlMode.indent(state.html, ""))
+ if (!state.php) state.php = CodeMirror.startState(phpMode, htmlMode.indent(state.html, "", ""))
state.curState = state.php;
return "meta";
}
@@ -213,11 +213,11 @@
token: dispatch,
- indent: function(state, textAfter) {
+ indent: function(state, textAfter, line) {
if ((state.curMode != phpMode && /^\s*<\//.test(textAfter)) ||
(state.curMode == phpMode && /^\?>/.test(textAfter)))
- return htmlMode.indent(state.html, textAfter);
- return state.curMode.indent(state.curState, textAfter);
+ return htmlMode.indent(state.html, textAfter, line);
+ return state.curMode.indent(state.curState, textAfter, line);
},
blockCommentStart: "/*",
diff --git a/vendor/assets/javascripts/codemirror/modes/pig.js b/vendor/assets/javascripts/codemirror/modes/pig.js
index 5b56727..3b9c774 100644
--- a/vendor/assets/javascripts/codemirror/modes/pig.js
+++ b/vendor/assets/javascripts/codemirror/modes/pig.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
/*
* Pig Latin Mode for CodeMirror 2
diff --git a/vendor/assets/javascripts/codemirror/modes/powershell.js b/vendor/assets/javascripts/codemirror/modes/powershell.js
index c443e72..85f89b9 100644
--- a/vendor/assets/javascripts/codemirror/modes/powershell.js
+++ b/vendor/assets/javascripts/codemirror/modes/powershell.js
@@ -1,12 +1,12 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
'use strict';
if (typeof exports == 'object' && typeof module == 'object') // CommonJS
- mod(require('codemirror'));
+ mod(require('../../lib/codemirror'));
else if (typeof define == 'function' && define.amd) // AMD
- define(['codemirror'], mod);
+ define(['../../lib/codemirror'], mod);
else // Plain browser env
mod(window.CodeMirror);
})(function(CodeMirror) {
@@ -222,6 +222,8 @@ CodeMirror.defineMode('powershell', function() {
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)) {
diff --git a/vendor/assets/javascripts/codemirror/modes/properties.js b/vendor/assets/javascripts/codemirror/modes/properties.js
index ef8bf37..02fd7fe 100644
--- a/vendor/assets/javascripts/codemirror/modes/properties.js
+++ b/vendor/assets/javascripts/codemirror/modes/properties.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/protobuf.js b/vendor/assets/javascripts/codemirror/modes/protobuf.js
index bcae276..68b240a 100644
--- a/vendor/assets/javascripts/codemirror/modes/protobuf.js
+++ b/vendor/assets/javascripts/codemirror/modes/protobuf.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -19,7 +19,8 @@
"package", "message", "import", "syntax",
"required", "optional", "repeated", "reserved", "default", "extensions", "packed",
"bool", "bytes", "double", "enum", "float", "string",
- "int32", "int64", "uint32", "uint64", "sint32", "sint64", "fixed32", "fixed64", "sfixed32", "sfixed64"
+ "int32", "int64", "uint32", "uint64", "sint32", "sint64", "fixed32", "fixed64", "sfixed32", "sfixed64",
+ "option", "service", "rpc", "returns"
];
var keywords = wordRegexp(keywordArray);
diff --git a/vendor/assets/javascripts/codemirror/modes/pug.js b/vendor/assets/javascripts/codemirror/modes/pug.js
new file mode 100644
index 0000000..8701b02
--- /dev/null
+++ b/vendor/assets/javascripts/codemirror/modes/pug.js
@@ -0,0 +1,591 @@
+// 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"), require("../javascript/javascript"), require("../css/css"), require("../htmlmixed/htmlmixed"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror", "../javascript/javascript", "../css/css", "../htmlmixed/htmlmixed"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+CodeMirror.defineMode("pug", function (config) {
+ // token types
+ var KEYWORD = 'keyword';
+ var DOCTYPE = 'meta';
+ var ID = 'builtin';
+ var CLASS = 'qualifier';
+
+ var ATTRS_NEST = {
+ '{': '}',
+ '(': ')',
+ '[': ']'
+ };
+
+ var jsMode = CodeMirror.getMode(config, 'javascript');
+
+ function State() {
+ this.javaScriptLine = false;
+ this.javaScriptLineExcludesColon = false;
+
+ this.javaScriptArguments = false;
+ this.javaScriptArgumentsDepth = 0;
+
+ this.isInterpolating = false;
+ this.interpolationNesting = 0;
+
+ this.jsState = CodeMirror.startState(jsMode);
+
+ this.restOfLine = '';
+
+ this.isIncludeFiltered = false;
+ this.isEach = false;
+
+ this.lastTag = '';
+ this.scriptType = '';
+
+ // Attributes Mode
+ this.isAttrs = false;
+ this.attrsNest = [];
+ this.inAttributeName = true;
+ this.attributeIsType = false;
+ this.attrValue = '';
+
+ // Indented Mode
+ this.indentOf = Infinity;
+ this.indentToken = '';
+
+ this.innerMode = null;
+ this.innerState = null;
+
+ this.innerModeForLine = false;
+ }
+ /**
+ * Safely copy a state
+ *
+ * @return {State}
+ */
+ State.prototype.copy = function () {
+ var res = new State();
+ res.javaScriptLine = this.javaScriptLine;
+ res.javaScriptLineExcludesColon = this.javaScriptLineExcludesColon;
+ res.javaScriptArguments = this.javaScriptArguments;
+ res.javaScriptArgumentsDepth = this.javaScriptArgumentsDepth;
+ res.isInterpolating = this.isInterpolating;
+ res.interpolationNesting = this.interpolationNesting;
+
+ res.jsState = CodeMirror.copyState(jsMode, this.jsState);
+
+ res.innerMode = this.innerMode;
+ if (this.innerMode && this.innerState) {
+ res.innerState = CodeMirror.copyState(this.innerMode, this.innerState);
+ }
+
+ res.restOfLine = this.restOfLine;
+
+ res.isIncludeFiltered = this.isIncludeFiltered;
+ res.isEach = this.isEach;
+ res.lastTag = this.lastTag;
+ res.scriptType = this.scriptType;
+ res.isAttrs = this.isAttrs;
+ res.attrsNest = this.attrsNest.slice();
+ res.inAttributeName = this.inAttributeName;
+ res.attributeIsType = this.attributeIsType;
+ res.attrValue = this.attrValue;
+ res.indentOf = this.indentOf;
+ res.indentToken = this.indentToken;
+
+ res.innerModeForLine = this.innerModeForLine;
+
+ return res;
+ };
+
+ function javaScript(stream, state) {
+ if (stream.sol()) {
+ // if javaScriptLine was set at end of line, ignore it
+ state.javaScriptLine = false;
+ state.javaScriptLineExcludesColon = false;
+ }
+ if (state.javaScriptLine) {
+ if (state.javaScriptLineExcludesColon && stream.peek() === ':') {
+ state.javaScriptLine = false;
+ state.javaScriptLineExcludesColon = false;
+ return;
+ }
+ var tok = jsMode.token(stream, state.jsState);
+ if (stream.eol()) state.javaScriptLine = false;
+ return tok || true;
+ }
+ }
+ function javaScriptArguments(stream, state) {
+ if (state.javaScriptArguments) {
+ if (state.javaScriptArgumentsDepth === 0 && stream.peek() !== '(') {
+ state.javaScriptArguments = false;
+ return;
+ }
+ if (stream.peek() === '(') {
+ state.javaScriptArgumentsDepth++;
+ } else if (stream.peek() === ')') {
+ state.javaScriptArgumentsDepth--;
+ }
+ if (state.javaScriptArgumentsDepth === 0) {
+ state.javaScriptArguments = false;
+ return;
+ }
+
+ var tok = jsMode.token(stream, state.jsState);
+ return tok || true;
+ }
+ }
+
+ function yieldStatement(stream) {
+ if (stream.match(/^yield\b/)) {
+ return 'keyword';
+ }
+ }
+
+ function doctype(stream) {
+ if (stream.match(/^(?:doctype) *([^\n]+)?/)) {
+ return DOCTYPE;
+ }
+ }
+
+ function interpolation(stream, state) {
+ if (stream.match('#{')) {
+ state.isInterpolating = true;
+ state.interpolationNesting = 0;
+ return 'punctuation';
+ }
+ }
+
+ function interpolationContinued(stream, state) {
+ if (state.isInterpolating) {
+ if (stream.peek() === '}') {
+ state.interpolationNesting--;
+ if (state.interpolationNesting < 0) {
+ stream.next();
+ state.isInterpolating = false;
+ return 'punctuation';
+ }
+ } else if (stream.peek() === '{') {
+ state.interpolationNesting++;
+ }
+ return jsMode.token(stream, state.jsState) || true;
+ }
+ }
+
+ function caseStatement(stream, state) {
+ if (stream.match(/^case\b/)) {
+ state.javaScriptLine = true;
+ return KEYWORD;
+ }
+ }
+
+ function when(stream, state) {
+ if (stream.match(/^when\b/)) {
+ state.javaScriptLine = true;
+ state.javaScriptLineExcludesColon = true;
+ return KEYWORD;
+ }
+ }
+
+ function defaultStatement(stream) {
+ if (stream.match(/^default\b/)) {
+ return KEYWORD;
+ }
+ }
+
+ function extendsStatement(stream, state) {
+ if (stream.match(/^extends?\b/)) {
+ state.restOfLine = 'string';
+ return KEYWORD;
+ }
+ }
+
+ function append(stream, state) {
+ if (stream.match(/^append\b/)) {
+ state.restOfLine = 'variable';
+ return KEYWORD;
+ }
+ }
+ function prepend(stream, state) {
+ if (stream.match(/^prepend\b/)) {
+ state.restOfLine = 'variable';
+ return KEYWORD;
+ }
+ }
+ function block(stream, state) {
+ if (stream.match(/^block\b *(?:(prepend|append)\b)?/)) {
+ state.restOfLine = 'variable';
+ return KEYWORD;
+ }
+ }
+
+ function include(stream, state) {
+ if (stream.match(/^include\b/)) {
+ state.restOfLine = 'string';
+ return KEYWORD;
+ }
+ }
+
+ function includeFiltered(stream, state) {
+ if (stream.match(/^include:([a-zA-Z0-9\-]+)/, false) && stream.match('include')) {
+ state.isIncludeFiltered = true;
+ return KEYWORD;
+ }
+ }
+
+ function includeFilteredContinued(stream, state) {
+ if (state.isIncludeFiltered) {
+ var tok = filter(stream, state);
+ state.isIncludeFiltered = false;
+ state.restOfLine = 'string';
+ return tok;
+ }
+ }
+
+ function mixin(stream, state) {
+ if (stream.match(/^mixin\b/)) {
+ state.javaScriptLine = true;
+ return KEYWORD;
+ }
+ }
+
+ function call(stream, state) {
+ if (stream.match(/^\+([-\w]+)/)) {
+ if (!stream.match(/^\( *[-\w]+ *=/, false)) {
+ state.javaScriptArguments = true;
+ state.javaScriptArgumentsDepth = 0;
+ }
+ return 'variable';
+ }
+ if (stream.match(/^\+#{/, false)) {
+ stream.next();
+ state.mixinCallAfter = true;
+ return interpolation(stream, state);
+ }
+ }
+ function callArguments(stream, state) {
+ if (state.mixinCallAfter) {
+ state.mixinCallAfter = false;
+ if (!stream.match(/^\( *[-\w]+ *=/, false)) {
+ state.javaScriptArguments = true;
+ state.javaScriptArgumentsDepth = 0;
+ }
+ return true;
+ }
+ }
+
+ function conditional(stream, state) {
+ if (stream.match(/^(if|unless|else if|else)\b/)) {
+ state.javaScriptLine = true;
+ return KEYWORD;
+ }
+ }
+
+ function each(stream, state) {
+ if (stream.match(/^(- *)?(each|for)\b/)) {
+ state.isEach = true;
+ return KEYWORD;
+ }
+ }
+ function eachContinued(stream, state) {
+ if (state.isEach) {
+ if (stream.match(/^ in\b/)) {
+ state.javaScriptLine = true;
+ state.isEach = false;
+ return KEYWORD;
+ } else if (stream.sol() || stream.eol()) {
+ state.isEach = false;
+ } else if (stream.next()) {
+ while (!stream.match(/^ in\b/, false) && stream.next());
+ return 'variable';
+ }
+ }
+ }
+
+ function whileStatement(stream, state) {
+ if (stream.match(/^while\b/)) {
+ state.javaScriptLine = true;
+ return KEYWORD;
+ }
+ }
+
+ function tag(stream, state) {
+ var captures;
+ if (captures = stream.match(/^(\w(?:[-:\w]*\w)?)\/?/)) {
+ state.lastTag = captures[1].toLowerCase();
+ if (state.lastTag === 'script') {
+ state.scriptType = 'application/javascript';
+ }
+ return 'tag';
+ }
+ }
+
+ function filter(stream, state) {
+ if (stream.match(/^:([\w\-]+)/)) {
+ var innerMode;
+ if (config && config.innerModes) {
+ innerMode = config.innerModes(stream.current().substring(1));
+ }
+ if (!innerMode) {
+ innerMode = stream.current().substring(1);
+ }
+ if (typeof innerMode === 'string') {
+ innerMode = CodeMirror.getMode(config, innerMode);
+ }
+ setInnerMode(stream, state, innerMode);
+ return 'atom';
+ }
+ }
+
+ function code(stream, state) {
+ if (stream.match(/^(!?=|-)/)) {
+ state.javaScriptLine = true;
+ return 'punctuation';
+ }
+ }
+
+ function id(stream) {
+ if (stream.match(/^#([\w-]+)/)) {
+ return ID;
+ }
+ }
+
+ function className(stream) {
+ if (stream.match(/^\.([\w-]+)/)) {
+ return CLASS;
+ }
+ }
+
+ function attrs(stream, state) {
+ if (stream.peek() == '(') {
+ stream.next();
+ state.isAttrs = true;
+ state.attrsNest = [];
+ state.inAttributeName = true;
+ state.attrValue = '';
+ state.attributeIsType = false;
+ return 'punctuation';
+ }
+ }
+
+ function attrsContinued(stream, state) {
+ if (state.isAttrs) {
+ if (ATTRS_NEST[stream.peek()]) {
+ state.attrsNest.push(ATTRS_NEST[stream.peek()]);
+ }
+ if (state.attrsNest[state.attrsNest.length - 1] === stream.peek()) {
+ state.attrsNest.pop();
+ } else if (stream.eat(')')) {
+ state.isAttrs = false;
+ return 'punctuation';
+ }
+ if (state.inAttributeName && stream.match(/^[^=,\)!]+/)) {
+ if (stream.peek() === '=' || stream.peek() === '!') {
+ state.inAttributeName = false;
+ state.jsState = CodeMirror.startState(jsMode);
+ if (state.lastTag === 'script' && stream.current().trim().toLowerCase() === 'type') {
+ state.attributeIsType = true;
+ } else {
+ state.attributeIsType = false;
+ }
+ }
+ return 'attribute';
+ }
+
+ var tok = jsMode.token(stream, state.jsState);
+ if (state.attributeIsType && tok === 'string') {
+ state.scriptType = stream.current().toString();
+ }
+ if (state.attrsNest.length === 0 && (tok === 'string' || tok === 'variable' || tok === 'keyword')) {
+ try {
+ Function('', 'var x ' + state.attrValue.replace(/,\s*$/, '').replace(/^!/, ''));
+ state.inAttributeName = true;
+ state.attrValue = '';
+ stream.backUp(stream.current().length);
+ return attrsContinued(stream, state);
+ } catch (ex) {
+ //not the end of an attribute
+ }
+ }
+ state.attrValue += stream.current();
+ return tok || true;
+ }
+ }
+
+ function attributesBlock(stream, state) {
+ if (stream.match(/^&attributes\b/)) {
+ state.javaScriptArguments = true;
+ state.javaScriptArgumentsDepth = 0;
+ return 'keyword';
+ }
+ }
+
+ function indent(stream) {
+ if (stream.sol() && stream.eatSpace()) {
+ return 'indent';
+ }
+ }
+
+ function comment(stream, state) {
+ if (stream.match(/^ *\/\/(-)?([^\n]*)/)) {
+ state.indentOf = stream.indentation();
+ state.indentToken = 'comment';
+ return 'comment';
+ }
+ }
+
+ function colon(stream) {
+ if (stream.match(/^: */)) {
+ return 'colon';
+ }
+ }
+
+ function text(stream, state) {
+ if (stream.match(/^(?:\| ?| )([^\n]+)/)) {
+ return 'string';
+ }
+ if (stream.match(/^(<[^\n]*)/, false)) {
+ // html string
+ setInnerMode(stream, state, 'htmlmixed');
+ state.innerModeForLine = true;
+ return innerMode(stream, state, true);
+ }
+ }
+
+ function dot(stream, state) {
+ if (stream.eat('.')) {
+ var innerMode = null;
+ if (state.lastTag === 'script' && state.scriptType.toLowerCase().indexOf('javascript') != -1) {
+ innerMode = state.scriptType.toLowerCase().replace(/"|'/g, '');
+ } else if (state.lastTag === 'style') {
+ innerMode = 'css';
+ }
+ setInnerMode(stream, state, innerMode);
+ return 'dot';
+ }
+ }
+
+ function fail(stream) {
+ stream.next();
+ return null;
+ }
+
+
+ function setInnerMode(stream, state, mode) {
+ mode = CodeMirror.mimeModes[mode] || mode;
+ mode = config.innerModes ? config.innerModes(mode) || mode : mode;
+ mode = CodeMirror.mimeModes[mode] || mode;
+ mode = CodeMirror.getMode(config, mode);
+ state.indentOf = stream.indentation();
+
+ if (mode && mode.name !== 'null') {
+ state.innerMode = mode;
+ } else {
+ state.indentToken = 'string';
+ }
+ }
+ function innerMode(stream, state, force) {
+ if (stream.indentation() > state.indentOf || (state.innerModeForLine && !stream.sol()) || force) {
+ if (state.innerMode) {
+ if (!state.innerState) {
+ state.innerState = state.innerMode.startState ? CodeMirror.startState(state.innerMode, stream.indentation()) : {};
+ }
+ return stream.hideFirstChars(state.indentOf + 2, function () {
+ return state.innerMode.token(stream, state.innerState) || true;
+ });
+ } else {
+ stream.skipToEnd();
+ return state.indentToken;
+ }
+ } else if (stream.sol()) {
+ state.indentOf = Infinity;
+ state.indentToken = null;
+ state.innerMode = null;
+ state.innerState = null;
+ }
+ }
+ function restOfLine(stream, state) {
+ if (stream.sol()) {
+ // if restOfLine was set at end of line, ignore it
+ state.restOfLine = '';
+ }
+ if (state.restOfLine) {
+ stream.skipToEnd();
+ var tok = state.restOfLine;
+ state.restOfLine = '';
+ return tok;
+ }
+ }
+
+
+ function startState() {
+ return new State();
+ }
+ function copyState(state) {
+ return state.copy();
+ }
+ /**
+ * Get the next token in the stream
+ *
+ * @param {Stream} stream
+ * @param {State} state
+ */
+ function nextToken(stream, state) {
+ var tok = innerMode(stream, state)
+ || restOfLine(stream, state)
+ || interpolationContinued(stream, state)
+ || includeFilteredContinued(stream, state)
+ || eachContinued(stream, state)
+ || attrsContinued(stream, state)
+ || javaScript(stream, state)
+ || javaScriptArguments(stream, state)
+ || callArguments(stream, state)
+
+ || yieldStatement(stream, state)
+ || doctype(stream, state)
+ || interpolation(stream, state)
+ || caseStatement(stream, state)
+ || when(stream, state)
+ || defaultStatement(stream, state)
+ || extendsStatement(stream, state)
+ || append(stream, state)
+ || prepend(stream, state)
+ || block(stream, state)
+ || include(stream, state)
+ || includeFiltered(stream, state)
+ || mixin(stream, state)
+ || call(stream, state)
+ || conditional(stream, state)
+ || each(stream, state)
+ || whileStatement(stream, state)
+ || tag(stream, state)
+ || filter(stream, state)
+ || code(stream, state)
+ || id(stream, state)
+ || className(stream, state)
+ || attrs(stream, state)
+ || attributesBlock(stream, state)
+ || indent(stream, state)
+ || text(stream, state)
+ || comment(stream, state)
+ || colon(stream, state)
+ || dot(stream, state)
+ || fail(stream, state);
+
+ return tok === true ? null : tok;
+ }
+ return {
+ startState: startState,
+ copyState: copyState,
+ token: nextToken
+ };
+}, 'javascript', 'css', 'htmlmixed');
+
+CodeMirror.defineMIME('text/x-pug', 'pug');
+CodeMirror.defineMIME('text/x-jade', 'pug');
+
+});
diff --git a/vendor/assets/javascripts/codemirror/modes/puppet.js b/vendor/assets/javascripts/codemirror/modes/puppet.js
index 5704130..3649342 100644
--- a/vendor/assets/javascripts/codemirror/modes/puppet.js
+++ b/vendor/assets/javascripts/codemirror/modes/puppet.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/python.js b/vendor/assets/javascripts/codemirror/modes/python.js
index ec662b1..9745103 100644
--- a/vendor/assets/javascripts/codemirror/modes/python.js
+++ b/vendor/assets/javascripts/codemirror/modes/python.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -41,10 +41,11 @@
CodeMirror.defineMode("python", function(conf, parserConf) {
var ERRORCLASS = "error";
- var singleDelimiters = parserConf.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.]/;
- var doubleOperators = parserConf.doubleOperators || /^([!<>]==|<>|<<|>>|\/\/|\*\*)/;
- var doubleDelimiters = parserConf.doubleDelimiters || /^(\+=|\-=|\*=|%=|\/=|&=|\|=|\^=)/;
- var tripleDelimiters = parserConf.tripleDelimiters || /^(\/\/=|>>=|<<=|\*\*=)/;
+ 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;
@@ -55,37 +56,36 @@
if (parserConf.extra_builtins != undefined)
myBuiltins = myBuiltins.concat(parserConf.extra_builtins);
- var py3 = parserConf.version && parseInt(parserConf.version, 10) == 3
+ var py3 = !(parserConf.version && Number(parserConf.version) < 3)
if (py3) {
// since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator
- var singleOperators = parserConf.singleOperators || /^[\+\-\*\/%&|\^~<>!@]/;
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))?('{3}|\"{3}|['\"]))", "i");
+ var stringPrefixes = new RegExp("^(([rbuf]|(br)|(fr))?('{3}|\"{3}|['\"]))", "i");
} else {
- var singleOperators = parserConf.singleOperators || /^[\+\-\*\/%&|\^~<>!]/;
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("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
+ var stringPrefixes = new RegExp("^(([rubf]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
}
var keywords = wordRegexp(myKeywords);
var builtins = wordRegexp(myBuiltins);
// tokenizers
function tokenBase(stream, state) {
- if (stream.sol()) state.indent = stream.indentation()
+ var sol = stream.sol() && state.lastToken != "\\"
+ if (sol) state.indent = stream.indentation()
// Handle scope changes
- if (stream.sol() && top(state).type == "py") {
+ 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))
+ else if (lineOffset < scopeOffset && dedent(stream, state) && stream.peek() != "#")
state.errorToken = true;
return null;
} else {
@@ -101,20 +101,15 @@
function tokenBaseInner(stream, state) {
if (stream.eatSpace()) return null;
- var ch = stream.peek();
-
// Handle Comments
- if (ch == "#") {
- stream.skipToEnd();
- return "comment";
- }
+ 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_]*\.\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"
@@ -124,13 +119,13 @@
// Integers
var intLiteral = false;
// Hex
- if (stream.match(/^0x[0-9a-f]+/i)) intLiteral = true;
+ if (stream.match(/^0x[0-9a-f_]+/i)) intLiteral = true;
// Binary
- if (stream.match(/^0b[01]+/i)) intLiteral = true;
+ if (stream.match(/^0b[01_]+/i)) intLiteral = true;
// Octal
- if (stream.match(/^0o[0-7]+/i)) intLiteral = true;
+ if (stream.match(/^0o[0-7_]+/i)) intLiteral = true;
// Decimal
- if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) {
+ if (stream.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)) {
// Decimal literals may be "imaginary"
stream.eat(/J/i);
// TODO - Can you have imaginary longs?
@@ -147,19 +142,20 @@
// Handle Strings
if (stream.match(stringPrefixes)) {
- state.tokenize = tokenStringFactory(stream.current());
- return state.tokenize(stream, state);
+ var isFmtString = stream.current().toLowerCase().indexOf('f') !== -1;
+ if (!isFmtString) {
+ state.tokenize = tokenStringFactory(stream.current(), state.tokenize);
+ return state.tokenize(stream, state);
+ } else {
+ state.tokenize = formatStringFactory(stream.current(), state.tokenize);
+ return state.tokenize(stream, state);
+ }
}
- // Handle operators and Delimiters
- if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters))
- return "punctuation";
-
- if (stream.match(doubleOperators) || stream.match(singleOperators))
- return "operator";
+ for (var i = 0; i < operators.length; i++)
+ if (stream.match(operators[i])) return "operator"
- if (stream.match(singleDelimiters))
- return "punctuation";
+ if (stream.match(delimiters)) return "punctuation";
if (state.lastToken == "." && stream.match(identifiers))
return "property";
@@ -184,8 +180,69 @@
return ERRORCLASS;
}
- function tokenStringFactory(delimiter) {
- while ("rub".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
+ 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 tokenNestedExpr(depth) {
+ return function(stream, state) {
+ var inner = tokenBaseInner(stream, state)
+ if (inner == "punctuation") {
+ if (stream.current() == "{") {
+ state.tokenize = tokenNestedExpr(depth + 1)
+ } else if (stream.current() == "}") {
+ if (depth > 1) state.tokenize = tokenNestedExpr(depth - 1)
+ else state.tokenize = tokenString
+ }
+ }
+ return inner
+ }
+ }
+
+ 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 = tokenNestedExpr(0)
+ if (stream.current()) return OUTCLASS;
+ else return state.tokenize(stream, state)
+ } 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, tokenOuter) {
+ while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
delimiter = delimiter.substr(1);
var singleline = delimiter.length == 1;
@@ -199,7 +256,7 @@
if (singleline && stream.eol())
return OUTCLASS;
} else if (stream.match(delimiter)) {
- state.tokenize = tokenBase;
+ state.tokenize = tokenOuter;
return OUTCLASS;
} else {
stream.eat(/['"]/);
@@ -209,7 +266,7 @@
if (parserConf.singleLineStringErrors)
return ERRORCLASS;
else
- state.tokenize = tokenBase;
+ state.tokenize = tokenOuter;
}
return OUTCLASS;
}
@@ -233,7 +290,7 @@
function dedent(stream, state) {
var indented = stream.indentation();
- while (top(state).offset > indented) {
+ while (state.scopes.length > 1 && top(state).offset > indented) {
if (top(state).type != "py") return true;
state.scopes.pop();
}
@@ -264,14 +321,16 @@
if (current == ":" && !state.lambda && top(state).type == "py")
pushPyScope(state);
- var delimiter_index = current.length == 1 ? "[({".indexOf(current) : -1;
- if (delimiter_index != -1)
- pushBracketScope(stream, state, "])}".slice(delimiter_index, delimiter_index+1));
+ 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;
+ 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();
@@ -332,8 +391,8 @@
CodeMirror.defineMIME("text/x-cython", {
name: "python",
- extra_keywords: words("by cdef cimport cpdef ctypedef enum except"+
- "extern gil include nogil property public"+
+ extra_keywords: words("by cdef cimport cpdef ctypedef enum except "+
+ "extern gil include nogil property public "+
"readonly struct union DEF IF ELIF ELSE")
});
diff --git a/vendor/assets/javascripts/codemirror/modes/q.js b/vendor/assets/javascripts/codemirror/modes/q.js
index a4af938..c016a6a 100644
--- a/vendor/assets/javascripts/codemirror/modes/q.js
+++ b/vendor/assets/javascripts/codemirror/modes/q.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -25,7 +25,7 @@ CodeMirror.defineMode("q",function(config){
return(state.tokenize=tokenLineComment)(stream,state);
else if(c=="\\"){
if(stream.eol()||/\s/.test(stream.peek()))
- return stream.skipToEnd(),/^\\\s*$/.test(stream.current())?(state.tokenize=tokenCommentToEOF)(stream, state):state.tokenize=tokenBase,"comment";
+ return stream.skipToEnd(),/^\\\s*$/.test(stream.current())?(state.tokenize=tokenCommentToEOF)(stream):state.tokenize=tokenBase,"comment";
else
return state.tokenize=tokenBase,"builtin";
}
@@ -34,25 +34,25 @@ CodeMirror.defineMode("q",function(config){
if(c=='"')
return(state.tokenize=tokenString)(stream,state);
if(c=='`')
- return stream.eatWhile(/[A-Z|a-z|\d|_|:|\/|\.]/),"symbol";
+ return stream.eatWhile(/[A-Za-z\d_:\/.]/),"symbol";
if(("."==c&&/\d/.test(stream.peek()))||/\d/.test(c)){
var t=null;
stream.backUp(1);
- if(stream.match(/^\d{4}\.\d{2}(m|\.\d{2}([D|T](\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)?)?)/)
+ if(stream.match(/^\d{4}\.\d{2}(m|\.\d{2}([DT](\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)?)?)/)
|| stream.match(/^\d+D(\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)/)
|| stream.match(/^\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?/)
|| stream.match(/^\d+[ptuv]{1}/))
t="temporal";
else if(stream.match(/^0[NwW]{1}/)
- || stream.match(/^0x[\d|a-f|A-F]*/)
- || stream.match(/^[0|1]+[b]{1}/)
+ || stream.match(/^0x[\da-fA-F]*/)
+ || stream.match(/^[01]+[b]{1}/)
|| stream.match(/^\d+[chijn]{1}/)
|| stream.match(/-?\d*(\.\d*)?(e[+\-]?\d+)?(e|f)?/))
t="number";
return(t&&(!(c=stream.peek())||E.test(c)))?t:(stream.next(),"error");
}
- if(/[A-Z|a-z]|\./.test(c))
- return stream.eatWhile(/[A-Z|a-z|\.|_|\d]/),keywords.test(stream.current())?"keyword":"variable";
+ if(/[A-Za-z]|\./.test(c))
+ return stream.eatWhile(/[A-Za-z._\d]/),keywords.test(stream.current())?"keyword":"variable";
if(/[|/&^!+:\\\-*%$=~#;@><\.,?_\']/.test(c))
return null;
if(/[{}\(\[\]\)]/.test(c))
diff --git a/vendor/assets/javascripts/codemirror/modes/r.js b/vendor/assets/javascripts/codemirror/modes/r.js
index d41d1c5..c422af9 100644
--- a/vendor/assets/javascripts/codemirror/modes/r.js
+++ b/vendor/assets/javascripts/codemirror/modes/r.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -14,15 +14,22 @@
CodeMirror.registerHelper("wordChars", "r", /[\w.]/);
CodeMirror.defineMode("r", function(config) {
- function wordObj(str) {
- var words = str.split(" "), res = {};
+ function wordObj(words) {
+ var res = {};
for (var i = 0; i < words.length; ++i) res[words[i]] = true;
return res;
}
- var atoms = wordObj("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_");
- var builtins = wordObj("list quote bquote eval return call parse deparse");
- var keywords = wordObj("if else repeat while function for in next break");
- var blockkeywords = wordObj("if else repeat while function for");
+ var commonAtoms = ["NULL", "NA", "Inf", "NaN", "NA_integer_", "NA_real_", "NA_complex_", "NA_character_", "TRUE", "FALSE"];
+ var commonBuiltins = ["list", "quote", "bquote", "eval", "return", "call", "parse", "deparse"];
+ var commonKeywords = ["if", "else", "repeat", "while", "function", "for", "in", "next", "break"];
+ var commonBlockKeywords = ["if", "else", "repeat", "while", "function", "for"];
+
+ CodeMirror.registerHelper("hintWords", "r", commonAtoms.concat(commonBuiltins, commonKeywords));
+
+ var atoms = wordObj(commonAtoms);
+ var builtins = wordObj(commonBuiltins);
+ var keywords = wordObj(commonKeywords);
+ var blockkeywords = wordObj(commonBlockKeywords);
var opChars = /[+\-*\/^<>=!&|~$:]/;
var curPunc;
@@ -44,6 +51,9 @@ CodeMirror.defineMode("r", function(config) {
} else if (ch == "'" || ch == '"') {
state.tokenize = tokenString(ch);
return "string";
+ } else if (ch == "`") {
+ stream.match(/[^`]+`/);
+ return "variable-3";
} else if (ch == "." && stream.match(/.[.\d]+/)) {
return "keyword";
} else if (/[\w\.]/.test(ch) && ch != "_") {
@@ -62,13 +72,17 @@ CodeMirror.defineMode("r", function(config) {
return "variable";
} else if (ch == "%") {
if (stream.skipTo("%")) stream.next();
- return "variable-2";
- } else if (ch == "<" && stream.eat("-")) {
- return "arrow";
+ return "operator variable-2";
+ } else if (
+ (ch == "<" && stream.eat("-")) ||
+ (ch == "<" && stream.match("<-")) ||
+ (ch == "-" && stream.match(/>>?/))
+ ) {
+ return "operator arrow";
} else if (ch == "=" && state.ctx.argList) {
return "arg-is";
} else if (opChars.test(ch)) {
- if (ch == "$") return "dollar";
+ if (ch == "$") return "operator dollar";
stream.eatWhile(opChars);
return "operator";
} else if (/[\(\){}\[\];]/.test(ch)) {
@@ -101,13 +115,23 @@ CodeMirror.defineMode("r", function(config) {
};
}
+ var ALIGN_YES = 1, ALIGN_NO = 2, BRACELESS = 4
+
function push(state, type, stream) {
state.ctx = {type: type,
indent: state.indent,
- align: null,
+ flags: 0,
column: stream.column(),
prev: state.ctx};
}
+ function setFlag(state, flag) {
+ var ctx = state.ctx
+ state.ctx = {type: ctx.type,
+ indent: ctx.indent,
+ flags: ctx.flags | flag,
+ column: ctx.column,
+ prev: ctx.prev}
+ }
function pop(state) {
state.indent = state.ctx.indent;
state.ctx = state.ctx.prev;
@@ -118,22 +142,22 @@ CodeMirror.defineMode("r", function(config) {
return {tokenize: tokenBase,
ctx: {type: "top",
indent: -config.indentUnit,
- align: false},
+ flags: ALIGN_NO},
indent: 0,
afterIdent: false};
},
token: function(stream, state) {
if (stream.sol()) {
- if (state.ctx.align == null) state.ctx.align = false;
+ if ((state.ctx.flags & 3) == 0) state.ctx.flags |= ALIGN_NO
+ if (state.ctx.flags & BRACELESS) pop(state)
state.indent = stream.indentation();
}
if (stream.eatSpace()) return null;
var style = state.tokenize(stream, state);
- if (style != "comment" && state.ctx.align == null) state.ctx.align = true;
+ if (style != "comment" && (state.ctx.flags & ALIGN_NO) == 0) setFlag(state, ALIGN_YES)
- var ctype = state.ctx.type;
- if ((curPunc == ";" || curPunc == "{" || curPunc == "}") && ctype == "block") pop(state);
+ if ((curPunc == ";" || curPunc == "{" || curPunc == "}") && state.ctx.type == "block") pop(state);
if (curPunc == "{") push(state, "}", stream);
else if (curPunc == "(") {
push(state, ")", stream);
@@ -141,7 +165,8 @@ CodeMirror.defineMode("r", function(config) {
}
else if (curPunc == "[") push(state, "]", stream);
else if (curPunc == "block") push(state, "block", stream);
- else if (curPunc == ctype) pop(state);
+ else if (curPunc == state.ctx.type) pop(state);
+ else if (state.ctx.type == "block" && style != "comment") setFlag(state, BRACELESS)
state.afterIdent = style == "variable" || style == "keyword";
return style;
},
@@ -150,8 +175,9 @@ CodeMirror.defineMode("r", function(config) {
if (state.tokenize != tokenBase) return 0;
var firstChar = textAfter && textAfter.charAt(0), ctx = state.ctx,
closing = firstChar == ctx.type;
+ if (ctx.flags & BRACELESS) ctx = ctx.prev
if (ctx.type == "block") return ctx.indent + (firstChar == "{" ? 0 : config.indentUnit);
- else if (ctx.align) return ctx.column + (closing ? 0 : 1);
+ else if (ctx.flags & ALIGN_YES) return ctx.column + (closing ? 0 : 1);
else return ctx.indent + (closing ? 0 : config.indentUnit);
},
diff --git a/vendor/assets/javascripts/codemirror/modes/rpm.js b/vendor/assets/javascripts/codemirror/modes/rpm.js
index 87cde59..2dece2e 100644
--- a/vendor/assets/javascripts/codemirror/modes/rpm.js
+++ b/vendor/assets/javascripts/codemirror/modes/rpm.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/rst.js b/vendor/assets/javascripts/codemirror/modes/rst.js
index bcf110c..f14eb27 100644
--- a/vendor/assets/javascripts/codemirror/modes/rst.js
+++ b/vendor/assets/javascripts/codemirror/modes/rst.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/ruby.js b/vendor/assets/javascripts/codemirror/modes/ruby.js
index 10cad8d..dd0e603 100644
--- a/vendor/assets/javascripts/codemirror/modes/ruby.js
+++ b/vendor/assets/javascripts/codemirror/modes/ruby.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -28,7 +28,8 @@ CodeMirror.defineMode("ruby", function(config) {
var indentWords = wordObj(["def", "class", "case", "for", "while", "until", "module", "then",
"catch", "loop", "proc", "begin"]);
var dedentWords = wordObj(["end", "until"]);
- var matching = {"[": "]", "{": "}", "(": ")"};
+ var opening = {"[": "]", "{": "}", "(": ")"};
+ var closing = {"]": "[", "}": "{", ")": "("};
var curPunc;
function chain(newtok, stream, state) {
@@ -46,22 +47,10 @@ CodeMirror.defineMode("ruby", function(config) {
if (ch == "`" || ch == "'" || ch == '"') {
return chain(readQuoted(ch, "string", ch == '"' || ch == "`"), stream, state);
} else if (ch == "/") {
- var currentIndex = stream.current().length;
- if (stream.skipTo("/")) {
- var search_till = stream.current().length;
- stream.backUp(stream.current().length - currentIndex);
- var balance = 0; // balance brackets
- while (stream.current().length < search_till) {
- var chchr = stream.next();
- if (chchr == "(") balance += 1;
- else if (chchr == ")") balance -= 1;
- if (balance < 0) break;
- }
- stream.backUp(stream.current().length - currentIndex);
- if (balance == 0)
- return chain(readQuoted(ch, "string-2", true), stream, state);
- }
- return "operator";
+ if (regexpAhead(stream))
+ return chain(readQuoted(ch, "string-2", true), stream, state);
+ else
+ return "operator";
} else if (ch == "%") {
var style = "string", embed = true;
if (stream.eat("s")) style = "atom";
@@ -70,13 +59,13 @@ CodeMirror.defineMode("ruby", function(config) {
else if (stream.eat(/[wxq]/)) { style = "string"; embed = false; }
var delim = stream.eat(/[^\w\s=]/);
if (!delim) return "operator";
- if (matching.propertyIsEnumerable(delim)) delim = matching[delim];
+ if (opening.propertyIsEnumerable(delim)) delim = opening[delim];
return chain(readQuoted(delim, style, embed, true), stream, state);
} else if (ch == "#") {
stream.skipToEnd();
return "comment";
- } else if (ch == "<" && (m = stream.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/))) {
- return chain(readHereDoc(m[1]), stream, state);
+ } else if (ch == "<" && (m = stream.match(/^<([-~])[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/))) {
+ return chain(readHereDoc(m[2], m[1]), stream, state);
} else if (ch == "0") {
if (stream.eat("x")) stream.eatWhile(/[\da-fA-F]/);
else if (stream.eat("b")) stream.eatWhile(/[01]/);
@@ -148,6 +137,28 @@ CodeMirror.defineMode("ruby", function(config) {
}
}
+ function regexpAhead(stream) {
+ var start = stream.pos, depth = 0, next, found = false, escaped = false
+ while ((next = stream.next()) != null) {
+ if (!escaped) {
+ if ("[{(".indexOf(next) > -1) {
+ depth++
+ } else if ("]})".indexOf(next) > -1) {
+ depth--
+ if (depth < 0) break
+ } else if (next == "/" && depth == 0) {
+ found = true
+ break
+ }
+ escaped = next == "\\"
+ } else {
+ escaped = false
+ }
+ }
+ stream.backUp(stream.pos - start)
+ return found
+ }
+
function tokenBaseUntilBrace(depth) {
if (!depth) depth = 1;
return function(stream, state) {
@@ -206,8 +217,9 @@ CodeMirror.defineMode("ruby", function(config) {
return style;
};
}
- function readHereDoc(phrase) {
+ function readHereDoc(phrase, mayIndent) {
return function(stream, state) {
+ if (mayIndent) stream.eatSpace()
if (stream.match(phrase)) state.tokenize.pop();
else stream.skipToEnd();
return "string";
@@ -266,17 +278,18 @@ CodeMirror.defineMode("ruby", function(config) {
},
indent: function(state, textAfter) {
- if (state.tokenize[state.tokenize.length-1] != tokenBase) return 0;
+ if (state.tokenize[state.tokenize.length-1] != tokenBase) return CodeMirror.Pass;
var firstChar = textAfter && textAfter.charAt(0);
var ct = state.context;
- var closing = ct.type == matching[firstChar] ||
+ var closed = ct.type == closing[firstChar] ||
ct.type == "keyword" && /^(?:end|until|else|elsif|when|rescue)\b/.test(textAfter);
- return ct.indented + (closing ? 0 : config.indentUnit) +
+ return ct.indented + (closed ? 0 : config.indentUnit) +
(state.continuedLine ? config.indentUnit : 0);
},
- electricInput: /^\s*(?:end|rescue|\})$/,
- lineComment: "#"
+ electricInput: /^\s*(?:end|rescue|elsif|else|\})$/,
+ lineComment: "#",
+ fold: "indent"
};
});
diff --git a/vendor/assets/javascripts/codemirror/modes/rust.js b/vendor/assets/javascripts/codemirror/modes/rust.js
index 8558b53..6bcfbc4 100644
--- a/vendor/assets/javascripts/codemirror/modes/rust.js
+++ b/vendor/assets/javascripts/codemirror/modes/rust.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -68,4 +68,5 @@ CodeMirror.defineSimpleMode("rust",{
CodeMirror.defineMIME("text/x-rustsrc", "rust");
+CodeMirror.defineMIME("text/rust", "rust");
});
diff --git a/vendor/assets/javascripts/codemirror/modes/sas.js b/vendor/assets/javascripts/codemirror/modes/sas.js
index fe11482..c6f528e 100755
--- a/vendor/assets/javascripts/codemirror/modes/sas.js
+++ b/vendor/assets/javascripts/codemirror/modes/sas.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
// SAS mode copyright (c) 2016 Jared Dean, SAS Institute
@@ -11,7 +11,7 @@
//Definitions
-// comment -- text withing * ; or /* */
+// comment -- text within * ; or /* */
// keyword -- SAS language variable
// variable -- macro variables starts with '&' or variable formats
// variable-2 -- DATA Step, proc, or macro names
@@ -116,33 +116,21 @@
return "comment";
}
+ if (ch == "*" && stream.column() == stream.indentation()) {
+ stream.skipToEnd()
+ return "comment"
+ }
+
// DoubleOperator match
var doubleOperator = ch + stream.peek();
- // Match all line comments.
- var myString = stream.string;
- var myRegexp = /(?:^\s*|[;]\s*)(\*.*?);/ig;
- var match = myRegexp.exec(myString);
- if (match !== null) {
- if (match.index === 0 && (stream.column() !== (match.index + match[0].length - 1))) {
- stream.backUp(stream.column());
- stream.skipTo(';');
- stream.next();
- return 'comment';
- } else if (match.index + 1 < stream.column() && stream.column() < match.index + match[0].length - 1) {
- // the ';' triggers the match so move one past it to start
- // the comment block that is why match.index+1
- stream.backUp(stream.column() - match.index - 1);
- stream.skipTo(';');
- stream.next();
- return 'comment';
- }
- } else if (!state.continueString && (ch === '"' || ch === "'")) {
- // Have we found a string?
- state.continueString = ch; //save the matching quote in the state
- return "string";
- } else if (state.continueString !== null) {
- if (stream.skipTo(state.continueString)) {
+ if ((ch === '"' || ch === "'") && !state.continueString) {
+ state.continueString = ch
+ return "string"
+ } else if (state.continueString) {
+ if (state.continueString == ch) {
+ state.continueString = null;
+ } else if (stream.skipTo(state.continueString)) {
// quote found on this line
stream.next();
state.continueString = null;
@@ -187,12 +175,12 @@
if (stream.peek() === '.') stream.skipTo(' ');
state.nextword = false;
return 'variable-2';
-
}
+ word = word.toLowerCase()
// Are we in a DATA Step?
if (state.inDataStep) {
- if (word.toLowerCase() === 'run;' || stream.match(/run\s;/)) {
+ if (word === 'run;' || stream.match(/run\s;/)) {
state.inDataStep = false;
return 'builtin';
}
@@ -203,84 +191,84 @@
else return 'variable';
}
// do we have a DATA Step keyword
- if (word && words.hasOwnProperty(word.toLowerCase()) &&
- (words[word.toLowerCase()].state.indexOf("inDataStep") !== -1 ||
- words[word.toLowerCase()].state.indexOf("ALL") !== -1)) {
+ if (word && words.hasOwnProperty(word) &&
+ (words[word].state.indexOf("inDataStep") !== -1 ||
+ words[word].state.indexOf("ALL") !== -1)) {
//backup to the start of the word
if (stream.start < stream.pos)
stream.backUp(stream.pos - stream.start);
//advance the length of the word and return
for (var i = 0; i < word.length; ++i) stream.next();
- return words[word.toLowerCase()].style;
+ return words[word].style;
}
}
// Are we in an Proc statement?
if (state.inProc) {
- if (word.toLowerCase() === 'run;' || word.toLowerCase() === 'quit;') {
+ if (word === 'run;' || word === 'quit;') {
state.inProc = false;
return 'builtin';
}
// do we have a proc keyword
- if (word && words.hasOwnProperty(word.toLowerCase()) &&
- (words[word.toLowerCase()].state.indexOf("inProc") !== -1 ||
- words[word.toLowerCase()].state.indexOf("ALL") !== -1)) {
+ if (word && words.hasOwnProperty(word) &&
+ (words[word].state.indexOf("inProc") !== -1 ||
+ words[word].state.indexOf("ALL") !== -1)) {
stream.match(/[\w]+/);
return words[word].style;
}
}
// Are we in a Macro statement?
if (state.inMacro) {
- if (word.toLowerCase() === '%mend') {
+ if (word === '%mend') {
if (stream.peek() === ';') stream.next();
state.inMacro = false;
return 'builtin';
}
- if (word && words.hasOwnProperty(word.toLowerCase()) &&
- (words[word.toLowerCase()].state.indexOf("inMacro") !== -1 ||
- words[word.toLowerCase()].state.indexOf("ALL") !== -1)) {
+ if (word && words.hasOwnProperty(word) &&
+ (words[word].state.indexOf("inMacro") !== -1 ||
+ words[word].state.indexOf("ALL") !== -1)) {
stream.match(/[\w]+/);
- return words[word.toLowerCase()].style;
+ return words[word].style;
}
return 'atom';
}
// Do we have Keywords specific words?
- if (word && words.hasOwnProperty(word.toLowerCase())) {
+ if (word && words.hasOwnProperty(word)) {
// Negates the initial next()
stream.backUp(1);
// Actually move the stream
stream.match(/[\w]+/);
- if (word.toLowerCase() === 'data' && /=/.test(stream.peek()) === false) {
+ if (word === 'data' && /=/.test(stream.peek()) === false) {
state.inDataStep = true;
state.nextword = true;
return 'builtin';
}
- if (word.toLowerCase() === 'proc') {
+ if (word === 'proc') {
state.inProc = true;
state.nextword = true;
return 'builtin';
}
- if (word.toLowerCase() === '%macro') {
+ if (word === '%macro') {
state.inMacro = true;
state.nextword = true;
return 'builtin';
}
- if (/title[1-9]/i.test(word)) return 'def';
+ if (/title[1-9]/.test(word)) return 'def';
- if (word.toLowerCase() === 'footnote') {
+ if (word === 'footnote') {
stream.eat(/[1-9]/);
return 'def';
}
// Returns their value as state in the prior define methods
- if (state.inDataStep === true && words[word.toLowerCase()].state.indexOf("inDataStep") !== -1)
- return words[word.toLowerCase()].style;
- if (state.inProc === true && words[word.toLowerCase()].state.indexOf("inProc") !== -1)
- return words[word.toLowerCase()].style;
- if (state.inMacro === true && words[word.toLowerCase()].state.indexOf("inMacro") !== -1)
- return words[word.toLowerCase()].style;
- if (words[word.toLowerCase()].state.indexOf("ALL") !== -1)
- return words[word.toLowerCase()].style;
+ if (state.inDataStep === true && words[word].state.indexOf("inDataStep") !== -1)
+ return words[word].style;
+ if (state.inProc === true && words[word].state.indexOf("inProc") !== -1)
+ return words[word].style;
+ if (state.inMacro === true && words[word].state.indexOf("inMacro") !== -1)
+ return words[word].style;
+ if (words[word].state.indexOf("ALL") !== -1)
+ return words[word].style;
return null;
}
// Unrecognized syntax
diff --git a/vendor/assets/javascripts/codemirror/modes/sass.js b/vendor/assets/javascripts/codemirror/modes/sass.js
index 6973ece..c37ab0b 100644
--- a/vendor/assets/javascripts/codemirror/modes/sass.js
+++ b/vendor/assets/javascripts/codemirror/modes/sass.js
@@ -1,17 +1,23 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"));
+ mod(require("../../lib/codemirror"), require("../css/css"));
else if (typeof define == "function" && define.amd) // AMD
- define(["../../lib/codemirror"], mod);
+ define(["../../lib/codemirror", "../css/css"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.defineMode("sass", function(config) {
+ var cssMode = CodeMirror.mimeModes["text/css"];
+ var propertyKeywords = cssMode.propertyKeywords || {},
+ colorKeywords = cssMode.colorKeywords || {},
+ valueKeywords = cssMode.valueKeywords || {},
+ fontProperties = cssMode.fontProperties || {};
+
function tokenRegexp(words) {
return new RegExp("^" + words.join("|"));
}
@@ -25,6 +31,12 @@ CodeMirror.defineMode("sass", function(config) {
var pseudoElementsRegexp = /^::?[a-zA-Z_][\w\-]*/;
+ var word;
+
+ function isEndLine(stream) {
+ return !stream.peek() || stream.match(/\s+$/, false);
+ }
+
function urlTokens(stream, state) {
var ch = stream.peek();
@@ -76,6 +88,9 @@ CodeMirror.defineMode("sass", function(config) {
if (endingString) {
if (nextChar !== quote && greedy) { stream.next(); }
+ if (isEndLine(stream)) {
+ state.cursorHalf = 0;
+ }
state.tokenizer = tokenBase;
return "string";
} else if (nextChar === "#" && peekChar === "{") {
@@ -147,14 +162,20 @@ CodeMirror.defineMode("sass", function(config) {
// first half i.e. before : for key-value pairs
// including selectors
+ if (ch === "-") {
+ if (stream.match(/^-\w+-/)) {
+ return "meta";
+ }
+ }
+
if (ch === ".") {
stream.next();
if (stream.match(/^[\w-]+/)) {
indent(state);
- return "atom";
+ return "qualifier";
} else if (stream.peek() === "#") {
indent(state);
- return "atom";
+ return "tag";
}
}
@@ -163,11 +184,11 @@ CodeMirror.defineMode("sass", function(config) {
// ID selectors
if (stream.match(/^[\w-]+/)) {
indent(state);
- return "atom";
+ return "builtin";
}
if (stream.peek() === "#") {
indent(state);
- return "atom";
+ return "tag";
}
}
@@ -220,37 +241,48 @@ CodeMirror.defineMode("sass", function(config) {
// Indent Directives
if (stream.match(/^@(else if|if|media|else|for|each|while|mixin|function)/)) {
indent(state);
- return "meta";
+ return "def";
}
// Other Directives
if (ch === "@") {
stream.next();
stream.eatWhile(/[\w-]/);
- return "meta";
+ return "def";
}
if (stream.eatWhile(/[\w-]/)){
if(stream.match(/ *: *[\w-\+\$#!\("']/,false)){
- return "property";
+ word = stream.current().toLowerCase();
+ var prop = state.prevProp + "-" + word;
+ if (propertyKeywords.hasOwnProperty(prop)) {
+ return "property";
+ } else if (propertyKeywords.hasOwnProperty(word)) {
+ state.prevProp = word;
+ return "property";
+ } else if (fontProperties.hasOwnProperty(word)) {
+ return "property";
+ }
+ return "tag";
}
else if(stream.match(/ *:/,false)){
indent(state);
state.cursorHalf = 1;
- return "atom";
+ state.prevProp = stream.current().toLowerCase();
+ return "property";
}
else if(stream.match(/ *,/,false)){
- return "atom";
+ return "tag";
}
else{
indent(state);
- return "atom";
+ return "tag";
}
}
if(ch === ":"){
if (stream.match(pseudoElementsRegexp)){ // could be a pseudo-element
- return "keyword";
+ return "variable-3";
}
stream.next();
state.cursorHalf=1;
@@ -264,7 +296,7 @@ CodeMirror.defineMode("sass", function(config) {
stream.next();
// Hex numbers
if (stream.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)){
- if(!stream.peek()){
+ if (isEndLine(stream)) {
state.cursorHalf = 0;
}
return "number";
@@ -273,7 +305,7 @@ CodeMirror.defineMode("sass", function(config) {
// Numbers
if (stream.match(/^-?[0-9\.]+/)){
- if(!stream.peek()){
+ if (isEndLine(stream)) {
state.cursorHalf = 0;
}
return "number";
@@ -281,14 +313,14 @@ CodeMirror.defineMode("sass", function(config) {
// Units
if (stream.match(/^(px|em|in)\b/)){
- if(!stream.peek()){
+ if (isEndLine(stream)) {
state.cursorHalf = 0;
}
return "unit";
}
if (stream.match(keywordsRegexp)){
- if(!stream.peek()){
+ if (isEndLine(stream)) {
state.cursorHalf = 0;
}
return "keyword";
@@ -296,7 +328,7 @@ CodeMirror.defineMode("sass", function(config) {
if (stream.match(/^url/) && stream.peek() === "(") {
state.tokenizer = urlTokens;
- if(!stream.peek()){
+ if (isEndLine(stream)) {
state.cursorHalf = 0;
}
return "atom";
@@ -306,23 +338,21 @@ CodeMirror.defineMode("sass", function(config) {
if (ch === "$") {
stream.next();
stream.eatWhile(/[\w-]/);
- if(!stream.peek()){
+ if (isEndLine(stream)) {
state.cursorHalf = 0;
}
- return "variable-3";
+ return "variable-2";
}
// bang character for !important, !default, etc.
if (ch === "!") {
stream.next();
- if(!stream.peek()){
- state.cursorHalf = 0;
- }
+ state.cursorHalf = 0;
return stream.match(/^[\w]+/) ? "keyword": "operator";
}
if (stream.match(opRegexp)){
- if(!stream.peek()){
+ if (isEndLine(stream)) {
state.cursorHalf = 0;
}
return "operator";
@@ -330,14 +360,24 @@ CodeMirror.defineMode("sass", function(config) {
// attributes
if (stream.eatWhile(/[\w-]/)) {
- if(!stream.peek()){
+ if (isEndLine(stream)) {
state.cursorHalf = 0;
}
- return "attribute";
+ word = stream.current().toLowerCase();
+ if (valueKeywords.hasOwnProperty(word)) {
+ return "atom";
+ } else if (colorKeywords.hasOwnProperty(word)) {
+ return "keyword";
+ } else if (propertyKeywords.hasOwnProperty(word)) {
+ state.prevProp = stream.current().toLowerCase();
+ return "property";
+ } else {
+ return "tag";
+ }
}
//stream.eatSpace();
- if(!stream.peek()){
+ if (isEndLine(stream)) {
state.cursorHalf = 0;
return null;
}
@@ -407,7 +447,7 @@ CodeMirror.defineMode("sass", function(config) {
return state.scopes[0].offset;
}
};
-});
+}, "css");
CodeMirror.defineMIME("text/x-sass", "sass");
diff --git a/vendor/assets/javascripts/codemirror/modes/scheme.js b/vendor/assets/javascripts/codemirror/modes/scheme.js
index 2234645..56e4e33 100644
--- a/vendor/assets/javascripts/codemirror/modes/scheme.js
+++ b/vendor/assets/javascripts/codemirror/modes/scheme.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
/**
* Author: Koh Zi Han, based on implementation by Koh Zi Chun
@@ -73,7 +73,8 @@ CodeMirror.defineMode("scheme", function () {
indentStack: null,
indentation: 0,
mode: false,
- sExprComment: false
+ sExprComment: false,
+ sExprQuote: false
};
},
@@ -121,7 +122,7 @@ CodeMirror.defineMode("scheme", function () {
state.sExprComment = 0;
}else{
// if not we just comment the entire of the next token
- stream.eatWhile(/[^/s]/); // eat non spaces
+ stream.eatWhile(/[^\s\(\)\[\]]/); // eat symbol atom
returnType = COMMENT;
break;
}
@@ -133,7 +134,15 @@ CodeMirror.defineMode("scheme", function () {
returnType = STRING;
} else if (ch == "'") {
- returnType = ATOM;
+ if (stream.peek() == "(" || stream.peek() == "["){
+ if (typeof state.sExprQuote != "number") {
+ state.sExprQuote = 0;
+ } // else already in a quoted expression
+ returnType = ATOM;
+ } else {
+ stream.eatWhile(/[\w_\-!$%&*+\.\/:<=>?@\^~]/);
+ returnType = ATOM;
+ }
} else if (ch == '#') {
if (stream.eat("|")) { // Multi-line comment
state.mode = "comment"; // toggle to comment mode
@@ -209,6 +218,7 @@ CodeMirror.defineMode("scheme", function () {
stream.backUp(stream.current().length - 1); // undo all the eating
if(typeof state.sExprComment == "number") state.sExprComment++;
+ if(typeof state.sExprQuote == "number") state.sExprQuote++;
returnType = BRACKET;
} else if (ch == ")" || ch == "]") {
@@ -222,16 +232,22 @@ CodeMirror.defineMode("scheme", function () {
state.sExprComment = false; // turn off s-expr commenting mode
}
}
+ if(typeof state.sExprQuote == "number"){
+ if(--state.sExprQuote == 0){
+ returnType = ATOM; // final closing bracket
+ state.sExprQuote = false; // turn off s-expr quote mode
+ }
+ }
}
} else {
- stream.eatWhile(/[\w\$_\-!$%&*+\.\/:<=>?@\^~]/);
+ stream.eatWhile(/[\w_\-!$%&*+\.\/:<=>?@\^~]/);
if (keywords && keywords.propertyIsEnumerable(stream.current())) {
returnType = BUILTIN;
} else returnType = "variable";
}
}
- return (typeof state.sExprComment == "number") ? COMMENT : returnType;
+ return (typeof state.sExprComment == "number") ? COMMENT : ((typeof state.sExprQuote == "number") ? ATOM : returnType);
},
indent: function (state) {
diff --git a/vendor/assets/javascripts/codemirror/modes/shell.js b/vendor/assets/javascripts/codemirror/modes/shell.js
index a684e8c..5af1241 100644
--- a/vendor/assets/javascripts/codemirror/modes/shell.js
+++ b/vendor/assets/javascripts/codemirror/modes/shell.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -14,26 +14,27 @@
CodeMirror.defineMode('shell', function() {
var words = {};
- function define(style, string) {
- var split = string.split(' ');
- for(var i = 0; i < split.length; i++) {
- words[split[i]] = style;
+ function define(style, dict) {
+ for(var i = 0; i < dict.length; i++) {
+ words[dict[i]] = style;
}
};
- // Atoms
- define('atom', 'true false');
+ var commonAtoms = ["true", "false"];
+ var commonKeywords = ["if", "then", "do", "else", "elif", "while", "until", "for", "in", "esac", "fi",
+ "fin", "fil", "done", "exit", "set", "unset", "export", "function"];
+ var commonCommands = ["ab", "awk", "bash", "beep", "cat", "cc", "cd", "chown", "chmod", "chroot", "clear",
+ "cp", "curl", "cut", "diff", "echo", "find", "gawk", "gcc", "get", "git", "grep", "hg", "kill", "killall",
+ "ln", "ls", "make", "mkdir", "openssl", "mv", "nc", "nl", "node", "npm", "ping", "ps", "restart", "rm",
+ "rmdir", "sed", "service", "sh", "shopt", "shred", "source", "sort", "sleep", "ssh", "start", "stop",
+ "su", "sudo", "svn", "tee", "telnet", "top", "touch", "vi", "vim", "wall", "wc", "wget", "who", "write",
+ "yes", "zsh"];
- // Keywords
- define('keyword', 'if then do else elif while until for in esac fi fin ' +
- 'fil done exit set unset export function');
+ CodeMirror.registerHelper("hintWords", "shell", commonAtoms.concat(commonKeywords, commonCommands));
- // Commands
- define('builtin', 'ab awk bash beep cat cc cd chown chmod chroot clear cp ' +
- 'curl cut diff echo find gawk gcc get git grep kill killall ln ls make ' +
- 'mkdir openssl mv nc node npm ping ps restart rm rmdir sed service sh ' +
- 'shopt shred source sort sleep ssh start stop su sudo tee telnet top ' +
- 'touch vi vim wall wc wget who write yes zsh');
+ define('atom', commonAtoms);
+ define('keyword', commonKeywords);
+ define('builtin', commonCommands);
function tokenBase(stream, state) {
if (stream.eatSpace()) return null;
@@ -46,7 +47,7 @@ CodeMirror.defineMode('shell', function() {
return null;
}
if (ch === '\'' || ch === '"' || ch === '`') {
- state.tokens.unshift(tokenString(ch));
+ state.tokens.unshift(tokenString(ch, ch === "`" ? "quote" : "string"));
return tokenize(stream, state);
}
if (ch === '#') {
@@ -81,41 +82,49 @@ CodeMirror.defineMode('shell', function() {
return words.hasOwnProperty(cur) ? words[cur] : null;
}
- function tokenString(quote) {
+ function tokenString(quote, style) {
+ var close = quote == "(" ? ")" : quote == "{" ? "}" : quote
return function(stream, state) {
- var next, end = false, escaped = false;
+ var next, escaped = false;
while ((next = stream.next()) != null) {
- if (next === quote && !escaped) {
- end = true;
+ if (next === close && !escaped) {
+ state.tokens.shift();
break;
- }
- if (next === '$' && !escaped && quote !== '\'') {
+ } else if (next === '$' && !escaped && quote !== "'" && stream.peek() != close) {
escaped = true;
stream.backUp(1);
state.tokens.unshift(tokenDollar);
break;
+ } else if (!escaped && quote !== close && next === quote) {
+ state.tokens.unshift(tokenString(quote, style))
+ return tokenize(stream, state)
+ } else if (!escaped && /['"]/.test(next) && !/['"]/.test(quote)) {
+ state.tokens.unshift(tokenStringStart(next, "string"));
+ stream.backUp(1);
+ break;
}
escaped = !escaped && next === '\\';
}
- if (end || !escaped) {
- state.tokens.shift();
- }
- return (quote === '`' || quote === ')' ? 'quote' : 'string');
+ return style;
};
};
+ function tokenStringStart(quote, style) {
+ return function(stream, state) {
+ state.tokens[0] = tokenString(quote, style)
+ stream.next()
+ return tokenize(stream, state)
+ }
+ }
+
var tokenDollar = function(stream, state) {
if (state.tokens.length > 1) stream.eat('$');
- var ch = stream.next(), hungry = /\w/;
- if (ch === '{') hungry = /[^}]/;
- if (ch === '(') {
- state.tokens[0] = tokenString(')');
+ var ch = stream.next()
+ if (/['"({]/.test(ch)) {
+ state.tokens[0] = tokenString(ch, ch == "(" ? "quote" : ch == "{" ? "def" : "string");
return tokenize(stream, state);
}
- if (!/\d/.test(ch)) {
- stream.eatWhile(hungry);
- stream.eat('}');
- }
+ if (!/\d/.test(ch)) stream.eatWhile(/\w/);
state.tokens.shift();
return 'def';
};
@@ -129,11 +138,15 @@ CodeMirror.defineMode('shell', function() {
token: function(stream, state) {
return tokenize(stream, state);
},
+ closeBrackets: "()[]{}''\"\"``",
lineComment: '#',
fold: "brace"
};
});
CodeMirror.defineMIME('text/x-sh', 'shell');
+// Apache uses a slightly different Media Type for Shell scripts
+// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
+CodeMirror.defineMIME('application/x-sh', 'shell');
});
diff --git a/vendor/assets/javascripts/codemirror/modes/sieve.js b/vendor/assets/javascripts/codemirror/modes/sieve.js
index f67db2f..f02a867 100644
--- a/vendor/assets/javascripts/codemirror/modes/sieve.js
+++ b/vendor/assets/javascripts/codemirror/modes/sieve.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -170,7 +170,7 @@ CodeMirror.defineMode("sieve", function(config) {
if (stream.eatSpace())
return null;
- return (state.tokenize || tokenBase)(stream, state);;
+ return (state.tokenize || tokenBase)(stream, state);
},
indent: function(state, _textAfter) {
diff --git a/vendor/assets/javascripts/codemirror/modes/slim.js b/vendor/assets/javascripts/codemirror/modes/slim.js
index 991a97e..b8ccb13 100644
--- a/vendor/assets/javascripts/codemirror/modes/slim.js
+++ b/vendor/assets/javascripts/codemirror/modes/slim.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
// Slim Highlighting for CodeMirror copyright (c) HicknHack Software Gmbh
diff --git a/vendor/assets/javascripts/codemirror/modes/smalltalk.js b/vendor/assets/javascripts/codemirror/modes/smalltalk.js
index bb510ba..5039fe2 100644
--- a/vendor/assets/javascripts/codemirror/modes/smalltalk.js
+++ b/vendor/assets/javascripts/codemirror/modes/smalltalk.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/smarty.js b/vendor/assets/javascripts/codemirror/modes/smarty.js
index 6e0fbed..57852fe 100644
--- a/vendor/assets/javascripts/codemirror/modes/smarty.js
+++ b/vendor/assets/javascripts/codemirror/modes/smarty.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
/**
* Smarty 2 and 3 mode.
@@ -210,9 +210,9 @@
state.last = last;
return style;
},
- indent: function(state, text) {
+ indent: function(state, text, line) {
if (state.tokenize == tokenTop && baseMode.indent)
- return baseMode.indent(state.base, text);
+ return baseMode.indent(state.base, text, line);
else
return CodeMirror.Pass;
},
diff --git a/vendor/assets/javascripts/codemirror/modes/solr.js b/vendor/assets/javascripts/codemirror/modes/solr.js
index f7f7087..eda4a7a 100644
--- a/vendor/assets/javascripts/codemirror/modes/solr.js
+++ b/vendor/assets/javascripts/codemirror/modes/solr.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -14,12 +14,12 @@
CodeMirror.defineMode("solr", function() {
"use strict";
- var isStringChar = /[^\s\|\!\+\-\*\?\~\^\&\:\(\)\[\]\{\}\^\"\\]/;
+ var isStringChar = /[^\s\|\!\+\-\*\?\~\^\&\:\(\)\[\]\{\}\"\\]/;
var isOperatorChar = /[\|\!\+\-\*\?\~\^\&]/;
var isOperatorString = /^(OR|AND|NOT|TO)$/i;
function isNumber(word) {
- return parseFloat(word, 10).toString() === word;
+ return parseFloat(word).toString() === word;
}
function tokenString(quote) {
diff --git a/vendor/assets/javascripts/codemirror/modes/soy.js b/vendor/assets/javascripts/codemirror/modes/soy.js
index 580c306..b42d0da 100644
--- a/vendor/assets/javascripts/codemirror/modes/soy.js
+++ b/vendor/assets/javascripts/codemirror/modes/soy.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -11,9 +11,43 @@
})(function(CodeMirror) {
"use strict";
- var indentingTags = ["template", "literal", "msg", "fallbackmsg", "let", "if", "elseif",
- "else", "switch", "case", "default", "foreach", "ifempty", "for",
- "call", "param", "deltemplate", "delcall", "log"];
+ var paramData = { noEndTag: true, soyState: "param-def" };
+ var tags = {
+ "alias": { noEndTag: true },
+ "delpackage": { noEndTag: true },
+ "namespace": { noEndTag: true, soyState: "namespace-def" },
+ "@param": paramData,
+ "@param?": paramData,
+ "@inject": paramData,
+ "@inject?": paramData,
+ "@state": paramData,
+ "@state?": paramData,
+ "template": { soyState: "templ-def", variableScope: true},
+ "literal": { },
+ "msg": {},
+ "fallbackmsg": { noEndTag: true, reduceIndent: true},
+ "let": { soyState: "var-def" },
+ "if": {},
+ "elseif": { noEndTag: true, reduceIndent: true},
+ "else": { noEndTag: true, reduceIndent: true},
+ "switch": {},
+ "case": { noEndTag: true, reduceIndent: true},
+ "default": { noEndTag: true, reduceIndent: true},
+ "foreach": { variableScope: true, soyState: "var-def" },
+ "ifempty": { noEndTag: true, reduceIndent: true},
+ "for": { variableScope: true, soyState: "var-def" },
+ "call": { soyState: "templ-ref" },
+ "param": { soyState: "param-ref"},
+ "print": { noEndTag: true },
+ "deltemplate": { soyState: "templ-def", variableScope: true},
+ "delcall": { soyState: "templ-ref" },
+ "log": {},
+ "element": { variableScope: true },
+ };
+
+ var indentingTags = Object.keys(tags).filter(function(tag) {
+ return !tags[tag].noEndTag || tags[tag].reduceIndent;
+ });
CodeMirror.defineMode("soy", function(config) {
var textMode = CodeMirror.getMode(config, "text/plain");
@@ -22,6 +56,7 @@
attributes: textMode,
text: textMode,
uri: textMode,
+ trusted_resource_uri: textMode,
css: CodeMirror.getMode(config, "text/css"),
js: CodeMirror.getMode(config, {name: "text/javascript", statementIndent: 2 * config.indentUnit})
};
@@ -31,6 +66,12 @@
}
function tokenUntil(stream, state, untilRegExp) {
+ if (stream.sol()) {
+ for (var indent = 0; indent < state.indent; indent++) {
+ if (!stream.eat(/\s/)) break;
+ }
+ if (indent) return null;
+ }
var oldString = stream.string;
var match = untilRegExp.exec(oldString.substr(stream.pos));
if (match) {
@@ -39,33 +80,82 @@
stream.string = oldString.substr(0, stream.pos + match.index);
}
var result = stream.hideFirstChars(state.indent, function() {
- return state.localMode.token(stream, state.localState);
+ var localState = last(state.localStates);
+ return localState.mode.token(stream, localState.state);
});
stream.string = oldString;
return result;
}
+ function contains(list, element) {
+ while (list) {
+ if (list.element === element) return true;
+ list = list.next;
+ }
+ return false;
+ }
+
+ function prepend(list, element) {
+ return {
+ element: element,
+ next: list
+ };
+ }
+
+ function popcontext(state) {
+ if (!state.context) return;
+ if (state.context.scope) {
+ state.variables = state.context.scope;
+ }
+ state.context = state.context.previousContext;
+ }
+
+ // Reference a variable `name` in `list`.
+ // Let `loose` be truthy to ignore missing identifiers.
+ function ref(list, name, loose) {
+ return contains(list, name) ? "variable-2" : (loose ? "variable" : "variable-2 error");
+ }
+
+ // Data for an open soy tag.
+ function Context(previousContext, tag, scope) {
+ this.previousContext = previousContext;
+ this.tag = tag;
+ this.kind = null;
+ this.scope = scope;
+ }
+
return {
startState: function() {
return {
- kind: [],
- kindTag: [],
soyState: [],
+ templates: null,
+ variables: prepend(null, 'ij'),
+ scopes: null,
indent: 0,
- localMode: modes.html,
- localState: CodeMirror.startState(modes.html)
+ quoteKind: null,
+ context: null,
+ localStates: [{
+ mode: modes.html,
+ state: CodeMirror.startState(modes.html)
+ }]
};
},
copyState: function(state) {
return {
tag: state.tag, // Last seen Soy tag.
- kind: state.kind.concat([]), // Values of kind="" attributes.
- kindTag: state.kindTag.concat([]), // Opened tags with kind="" attributes.
soyState: state.soyState.concat([]),
+ templates: state.templates,
+ variables: state.variables,
+ context: state.context,
indent: state.indent, // Indentation of the following line.
- localMode: state.localMode,
- localState: CodeMirror.copyState(state.localMode, state.localState)
+ quoteKind: state.quoteKind,
+ localStates: state.localStates.map(function(localState) {
+ return {
+ mode: localState.mode,
+ state: CodeMirror.copyState(localState.mode, localState.state)
+ };
+ })
};
},
@@ -79,36 +169,159 @@
} else {
stream.skipToEnd();
}
+ if (!state.context || !state.context.scope) {
+ var paramRe = /@param\??\s+(\S+)/g;
+ var current = stream.current();
+ for (var match; (match = paramRe.exec(current)); ) {
+ state.variables = prepend(state.variables, match[1]);
+ }
+ }
+ return "comment";
+
+ case "string":
+ var match = stream.match(/^.*?(["']|\\[\s\S])/);
+ if (!match) {
+ stream.skipToEnd();
+ } else if (match[1] == state.quoteKind) {
+ state.quoteKind = null;
+ state.soyState.pop();
+ }
+ return "string";
+ }
+
+ if (!state.soyState.length || last(state.soyState) != "literal") {
+ if (stream.match(/^\/\*/)) {
+ state.soyState.push("comment");
+ return "comment";
+ } else if (stream.match(stream.sol() ? /^\s*\/\/.*/ : /^\s+\/\/.*/)) {
return "comment";
+ }
+ }
+
+ switch (last(state.soyState)) {
+ case "templ-def":
+ if (match = stream.match(/^\.?([\w]+(?!\.[\w]+)*)/)) {
+ state.templates = prepend(state.templates, match[1]);
+ state.soyState.pop();
+ return "def";
+ }
+ stream.next();
+ return null;
- case "variable":
- if (stream.match(/^}/)) {
- state.indent -= 2 * config.indentUnit;
+ case "templ-ref":
+ if (match = stream.match(/(\.?[a-zA-Z_][a-zA-Z_0-9]+)+/)) {
state.soyState.pop();
- return "variable-2";
+ // If the first character is '.', it can only be a local template.
+ if (match[0][0] == '.') {
+ return "variable-2"
+ }
+ // Otherwise
+ return "variable";
+ }
+ stream.next();
+ return null;
+
+ case "namespace-def":
+ if (match = stream.match(/^\.?([\w\.]+)/)) {
+ state.soyState.pop();
+ return "variable";
+ }
+ stream.next();
+ return null;
+
+ case "param-def":
+ if (match = stream.match(/^\w+/)) {
+ state.variables = prepend(state.variables, match[0]);
+ state.soyState.pop();
+ state.soyState.push("param-type");
+ return "def";
+ }
+ stream.next();
+ return null;
+
+ case "param-ref":
+ if (match = stream.match(/^\w+/)) {
+ state.soyState.pop();
+ return "property";
+ }
+ stream.next();
+ return null;
+
+ case "param-type":
+ if (stream.peek() == "}") {
+ state.soyState.pop();
+ return null;
+ }
+ if (stream.eatWhile(/^([\w]+|[?])/)) {
+ return "type";
+ }
+ stream.next();
+ return null;
+
+ case "var-def":
+ if (match = stream.match(/^\$([\w]+)/)) {
+ state.variables = prepend(state.variables, match[1]);
+ state.soyState.pop();
+ return "def";
}
stream.next();
return null;
case "tag":
+ var endTag = state.tag[0] == "/";
+ var tagName = endTag ? state.tag.substring(1) : state.tag;
+ var tag = tags[tagName];
if (stream.match(/^\/?}/)) {
- if (state.tag == "/template" || state.tag == "/deltemplate") state.indent = 0;
- else state.indent -= (stream.current() == "/}" || indentingTags.indexOf(state.tag) == -1 ? 2 : 1) * config.indentUnit;
+ var selfClosed = stream.current() == "/}";
+ if (selfClosed && !endTag) {
+ popcontext(state);
+ }
+ if (state.tag == "/template" || state.tag == "/deltemplate") {
+ state.variables = prepend(null, 'ij');
+ state.indent = 0;
+ } else {
+ state.indent -= config.indentUnit *
+ (selfClosed || indentingTags.indexOf(state.tag) == -1 ? 2 : 1);
+ }
state.soyState.pop();
return "keyword";
} else if (stream.match(/^([\w?]+)(?==)/)) {
if (stream.current() == "kind" && (match = stream.match(/^="([^"]+)/, false))) {
var kind = match[1];
- state.kind.push(kind);
- state.kindTag.push(state.tag);
- state.localMode = modes[kind] || modes.html;
- state.localState = CodeMirror.startState(state.localMode);
+ state.context.kind = kind;
+ var mode = modes[kind] || modes.html;
+ var localState = last(state.localStates);
+ if (localState.mode.indent) {
+ state.indent += localState.mode.indent(localState.state, "", "");
+ }
+ state.localStates.push({
+ mode: mode,
+ state: CodeMirror.startState(mode)
+ });
}
return "attribute";
- } else if (stream.match(/^"/)) {
+ } else if (match = stream.match(/([\w]+)(?=\()/)) {
+ return "variable callee";
+ } else if (match = stream.match(/^["']/)) {
state.soyState.push("string");
+ state.quoteKind = match;
return "string";
}
+ if (stream.match(/(null|true|false)(?!\w)/) ||
+ stream.match(/0x([0-9a-fA-F]{2,})/) ||
+ stream.match(/-?([0-9]*[.])?[0-9]+(e[0-9]*)?/)) {
+ return "atom";
+ }
+ if (stream.match(/(\||[+\-*\/%]|[=!]=|\?:|[<>]=?)/)) {
+ // Tokenize filter, binary, null propagator, and equality operators.
+ return "operator";
+ }
+ if (match = stream.match(/^\$([\w]+)/)) {
+ return ref(state.variables, match[1]);
+ }
+ if (match = stream.match(/^\w+/)) {
+ return /^(?:as|and|or|not|in)$/.test(match[0]) ? "keyword" : null;
+ }
stream.next();
return null;
@@ -119,41 +332,59 @@
return this.token(stream, state);
}
return tokenUntil(stream, state, /\{\/literal}/);
-
- case "string":
- var match = stream.match(/^.*?("|\\[\s\S])/);
- if (!match) {
- stream.skipToEnd();
- } else if (match[1] == "\"") {
- state.soyState.pop();
- }
- return "string";
}
- if (stream.match(/^\/\*/)) {
- state.soyState.push("comment");
- return "comment";
- } else if (stream.match(stream.sol() ? /^\s*\/\/.*/ : /^\s+\/\/.*/)) {
- return "comment";
- } else if (stream.match(/^\{\$[\w?]*/)) {
- state.indent += 2 * config.indentUnit;
- state.soyState.push("variable");
- return "variable-2";
- } else if (stream.match(/^\{literal}/)) {
+ if (stream.match(/^\{literal}/)) {
state.indent += config.indentUnit;
state.soyState.push("literal");
+ state.context = new Context(state.context, "literal", state.variables);
return "keyword";
- } else if (match = stream.match(/^\{([\/@\\]?[\w?]*)/)) {
- if (match[1] != "/switch")
- state.indent += (/^(\/|(else|elseif|case|default)$)/.test(match[1]) && state.tag != "switch" ? 1 : 2) * config.indentUnit;
+
+ // A tag-keyword must be followed by whitespace, comment or a closing tag.
+ } else if (match = stream.match(/^\{([/@\\]?\w+\??)(?=$|[\s}]|\/[/*])/)) {
+ var prevTag = state.tag;
state.tag = match[1];
- if (state.tag == "/" + last(state.kindTag)) {
- // We found the tag that opened the current kind="".
- state.kind.pop();
- state.kindTag.pop();
- state.localMode = modes[last(state.kind)] || modes.html;
- state.localState = CodeMirror.startState(state.localMode);
+ var endTag = state.tag[0] == "/";
+ var indentingTag = !!tags[state.tag];
+ var tagName = endTag ? state.tag.substring(1) : state.tag;
+ var tag = tags[tagName];
+ if (state.tag != "/switch")
+ state.indent += ((endTag || tag && tag.reduceIndent) && prevTag != "switch" ? 1 : 2) * config.indentUnit;
+
+ state.soyState.push("tag");
+ var tagError = false;
+ if (tag) {
+ if (!endTag) {
+ if (tag.soyState) state.soyState.push(tag.soyState);
+ }
+ // If a new tag, open a new context.
+ if (!tag.noEndTag && (indentingTag || !endTag)) {
+ state.context = new Context(state.context, state.tag, tag.variableScope ? state.variables : null);
+ // Otherwise close the current context.
+ } else if (endTag) {
+ if (!state.context || state.context.tag != tagName) {
+ tagError = true;
+ } else if (state.context) {
+ if (state.context.kind) {
+ state.localStates.pop();
+ var localState = last(state.localStates);
+ if (localState.mode.indent) {
+ state.indent -= localState.mode.indent(localState.state, "", "");
+ }
+ }
+ popcontext(state);
+ }
+ }
+ } else if (endTag) {
+ // Assume all tags with a closing tag are defined in the config.
+ tagError = true;
}
+ return (tagError ? "error " : "") + "keyword";
+
+ // Not a tag-keyword; it's an implicit print tag.
+ } else if (stream.eat('{')) {
+ state.tag = "print";
+ state.indent += 2 * config.indentUnit;
state.soyState.push("tag");
return "keyword";
}
@@ -161,7 +392,7 @@
return tokenUntil(stream, state, /\{|\s+\/\/|\/\*/);
},
- indent: function(state, textAfter) {
+ indent: function(state, textAfter, line) {
var indent = state.indent, top = last(state.soyState);
if (top == "comment") return CodeMirror.Pass;
@@ -173,14 +404,16 @@
if (state.tag != "switch" && /^\{(case|default)\b/.test(textAfter)) indent -= config.indentUnit;
if (/^\{\/switch\b/.test(textAfter)) indent -= config.indentUnit;
}
- if (indent && state.localMode.indent)
- indent += state.localMode.indent(state.localState, textAfter);
+ var localState = last(state.localStates);
+ if (indent && localState.mode.indent) {
+ indent += localState.mode.indent(localState.state, textAfter, line);
+ }
return indent;
},
innerMode: function(state) {
if (state.soyState.length && last(state.soyState) != "literal") return null;
- else return {state: state.localState, mode: state.localMode};
+ else return last(state.localStates);
},
electricInput: /^\s*\{(\/|\/template|\/deltemplate|\/switch|fallbackmsg|elseif|else|case|default|ifempty|\/literal\})$/,
@@ -188,12 +421,15 @@
blockCommentStart: "/*",
blockCommentEnd: "*/",
blockCommentContinue: " * ",
+ useInnerComments: false,
fold: "indent"
};
}, "htmlmixed");
- CodeMirror.registerHelper("hintWords", "soy", indentingTags.concat(
- ["delpackage", "namespace", "alias", "print", "css", "debugger"]));
+ CodeMirror.registerHelper("wordChars", "soy", /[\w$]/);
+
+ CodeMirror.registerHelper("hintWords", "soy", Object.keys(tags).concat(
+ ["css", "debugger"]));
CodeMirror.defineMIME("text/x-soy", "soy");
});
diff --git a/vendor/assets/javascripts/codemirror/modes/sparql.js b/vendor/assets/javascripts/codemirror/modes/sparql.js
index 095dcca..bb79abf 100644
--- a/vendor/assets/javascripts/codemirror/modes/sparql.js
+++ b/vendor/assets/javascripts/codemirror/modes/sparql.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -41,7 +41,7 @@ CodeMirror.defineMode("sparql", function(config) {
if(ch == "?" && stream.match(/\s/, false)){
return "operator";
}
- stream.match(/^[\w\d]*/);
+ stream.match(/^[A-Za-z0-9_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][A-Za-z0-9_\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]*/);
return "variable-2";
}
else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) {
diff --git a/vendor/assets/javascripts/codemirror/modes/spreadsheet.js b/vendor/assets/javascripts/codemirror/modes/spreadsheet.js
index 222f297..d87f988 100644
--- a/vendor/assets/javascripts/codemirror/modes/spreadsheet.js
+++ b/vendor/assets/javascripts/codemirror/modes/spreadsheet.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/sql.js b/vendor/assets/javascripts/codemirror/modes/sql.js
index 01ebd80..35902bb 100644
--- a/vendor/assets/javascripts/codemirror/modes/sql.js
+++ b/vendor/assets/javascripts/codemirror/modes/sql.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -12,16 +12,17 @@
"use strict";
CodeMirror.defineMode("sql", function(config, parserConfig) {
- "use strict";
-
var client = parserConfig.client || {},
atoms = parserConfig.atoms || {"false": true, "true": true, "null": true},
- builtin = parserConfig.builtin || {},
- keywords = parserConfig.keywords || {},
- operatorChars = parserConfig.operatorChars || /^[*+\-%<>!=&|~^]/,
+ builtin = parserConfig.builtin || set(defaultBuiltin),
+ keywords = parserConfig.keywords || set(sqlKeywords),
+ operatorChars = parserConfig.operatorChars || /^[*+\-%<>!=&|~^\/]/,
support = parserConfig.support || {},
hooks = parserConfig.hooks || {},
- dateSQL = parserConfig.dateSQL || {"date" : true, "time" : true, "timestamp" : true};
+ dateSQL = parserConfig.dateSQL || {"date" : true, "time" : true, "timestamp" : true},
+ backslashStringEscapes = parserConfig.backslashStringEscapes !== false,
+ brackets = parserConfig.brackets || /^[\{}\(\)\[\]]/,
+ punctuation = parserConfig.punctuation || /^[;.,:]/
function tokenBase(stream, state) {
var ch = stream.next();
@@ -32,13 +33,13 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
if (result !== false) return result;
}
- if (support.hexNumber == true &&
+ if (support.hexNumber &&
((ch == "0" && stream.match(/^[xX][0-9a-fA-F]+/))
|| (ch == "x" || ch == "X") && stream.match(/^'[0-9a-fA-F]+'/))) {
// hex
// ref: http://dev.mysql.com/doc/refman/5.5/en/hexadecimal-literals.html
return "number";
- } else if (support.binaryNumber == true &&
+ } else if (support.binaryNumber &&
(((ch == "b" || ch == "B") && stream.match(/^'[01]+'/))
|| (ch == "0" && stream.match(/^b[01]+/)))) {
// bitstring
@@ -47,8 +48,8 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
} else if (ch.charCodeAt(0) > 47 && ch.charCodeAt(0) < 58) {
// numbers
// ref: http://dev.mysql.com/doc/refman/5.5/en/number-literals.html
- stream.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/);
- support.decimallessFloat == true && stream.eat('.');
+ stream.match(/^[0-9]*(\.[0-9]+)?([eE][-+]?[0-9]+)?/);
+ support.decimallessFloat && stream.match(/^\.(?!\.)/);
return "number";
} else if (ch == "?" && (stream.eatSpace() || stream.eol() || stream.eat(";"))) {
// placeholders
@@ -58,15 +59,12 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
// ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html
state.tokenize = tokenLiteral(ch);
return state.tokenize(stream, state);
- } else if ((((support.nCharCast == true && (ch == "n" || ch == "N"))
- || (support.charsetCast == true && ch == "_" && stream.match(/[a-z][a-z0-9]*/i)))
+ } else if ((((support.nCharCast && (ch == "n" || ch == "N"))
+ || (support.charsetCast && ch == "_" && stream.match(/[a-z][a-z0-9]*/i)))
&& (stream.peek() == "'" || stream.peek() == '"'))) {
// charset casting: _utf8'str', N'str', n'str'
// ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html
return "keyword";
- } else if (/^[\(\),\;\[\]]/.test(ch)) {
- // no highlighting
- return null;
} else if (support.commentSlashSlash && ch == "/" && stream.eat("/")) {
// 1-line comment
stream.skipToEnd();
@@ -80,22 +78,29 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
} else if (ch == "/" && stream.eat("*")) {
// multi-line comments
// ref: https://kb.askmonty.org/en/comment-syntax/
- state.tokenize = tokenComment;
+ state.tokenize = tokenComment(1);
return state.tokenize(stream, state);
} else if (ch == ".") {
// .1 for 0.1
- if (support.zerolessFloat == true && stream.match(/^(?:\d+(?:e[+-]?\d+)?)/i)) {
+ if (support.zerolessFloat && stream.match(/^(?:\d+(?:e[+-]?\d+)?)/i))
return "number";
- }
+ if (stream.match(/^\.+/))
+ return null
// .table_name (ODBC)
// // ref: http://dev.mysql.com/doc/refman/5.6/en/identifier-qualifiers.html
- if (support.ODBCdotTable == true && stream.match(/^[a-zA-Z_]+/)) {
+ if (support.ODBCdotTable && stream.match(/^[\w\d_]+/))
return "variable-2";
- }
} else if (operatorChars.test(ch)) {
// operators
stream.eatWhile(operatorChars);
- return null;
+ return "operator";
+ } else if (brackets.test(ch)) {
+ // brackets
+ return "bracket";
+ } else if (punctuation.test(ch)) {
+ // punctuation
+ stream.eatWhile(punctuation);
+ return "punctuation";
} else if (ch == '{' &&
(stream.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/) || stream.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/))) {
// dates (weird ODBC syntax)
@@ -125,25 +130,20 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
state.tokenize = tokenBase;
break;
}
- escaped = !escaped && ch == "\\";
+ escaped = backslashStringEscapes && !escaped && ch == "\\";
}
return "string";
};
}
- function tokenComment(stream, state) {
- while (true) {
- if (stream.skipTo("*")) {
- stream.next();
- if (stream.eat("/")) {
- state.tokenize = tokenBase;
- break;
- }
- } else {
- stream.skipToEnd();
- break;
- }
+ function tokenComment(depth) {
+ return function(stream, state) {
+ var m = stream.match(/^.*?(\/\*|\*\/)/)
+ if (!m) stream.skipToEnd()
+ else if (m[1] == "/*") state.tokenize = tokenComment(depth + 1)
+ else if (depth > 1) state.tokenize = tokenComment(depth - 1)
+ else state.tokenize = tokenBase
+ return "comment"
}
- return "comment";
}
function pushContext(stream, state, type) {
@@ -170,7 +170,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
if (state.context && state.context.align == null)
state.context.align = false;
}
- if (stream.eatSpace()) return null;
+ if (state.tokenize == tokenBase && stream.eatSpace()) return null;
var style = state.tokenize(stream, state);
if (style == "comment") return style;
@@ -198,13 +198,11 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
blockCommentStart: "/*",
blockCommentEnd: "*/",
- lineComment: support.commentSlashSlash ? "//" : support.commentHash ? "#" : null
+ lineComment: support.commentSlashSlash ? "//" : support.commentHash ? "#" : "--",
+ closeBrackets: "()[]{}''\"\"``"
};
});
-(function() {
- "use strict";
-
// `identifier`
function hookIdentifier(stream) {
// MySQL/MariaDB identifiers
@@ -217,6 +215,19 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
return stream.eatWhile(/\w/) ? "variable-2" : null;
}
+ // "identifier"
+ function hookIdentifierDoublequote(stream) {
+ // Standard SQL /SQLite identifiers
+ // ref: http://web.archive.org/web/20160813185132/http://savage.net.au/SQL/sql-99.bnf.html#delimited%20identifier
+ // ref: http://sqlite.org/lang_keywords.html
+ var ch;
+ while ((ch = stream.next()) != null) {
+ if (ch == "\"" && !stream.eat("\"")) return "variable-2";
+ }
+ stream.backUp(stream.current().length - 1);
+ return stream.eatWhile(/\w/) ? "variable-2" : null;
+ }
+
// variable token
function hookVar(stream) {
// variables
@@ -266,24 +277,28 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
return obj;
}
+ var defaultBuiltin = "bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric"
+
// A generic SQL Mode. It's not a standard, it just try to support what is generally supported
CodeMirror.defineMIME("text/x-sql", {
name: "sql",
keywords: set(sqlKeywords + "begin"),
- builtin: set("bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric"),
+ builtin: set(defaultBuiltin),
atoms: set("false true null unknown"),
- operatorChars: /^[*+\-%<>!=]/,
dateSQL: set("date time timestamp"),
support: set("ODBCdotTable doubleQuote binaryNumber hexNumber")
});
CodeMirror.defineMIME("text/x-mssql", {
name: "sql",
- client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),
- keywords: set(sqlKeywords + "begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare"),
+ client: set("$partition binary_checksum checksum connectionproperty context_info current_request_id error_line error_message error_number error_procedure error_severity error_state formatmessage get_filestream_transaction_context getansinull host_id host_name isnull isnumeric min_active_rowversion newid newsequentialid rowcount_big xact_state object_id"),
+ keywords: set(sqlKeywords + "begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare exec go if use index holdlock nolock nowait paglock readcommitted readcommittedlock readpast readuncommitted repeatableread rowlock serializable snapshot tablock tablockx updlock with"),
builtin: set("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),
- atoms: set("false true null unknown"),
- operatorChars: /^[*+\-%<>!=]/,
+ atoms: set("is not null like and or in left right between inner outer join all any some cross unpivot pivot exists"),
+ operatorChars: /^[*+\-%<>!=^\&|\/]/,
+ brackets: /^[\{}\(\)]/,
+ punctuation: /^[;.,:/]/,
+ backslashStringEscapes: false,
dateSQL: set("date datetimeoffset datetime2 smalldatetime datetime time"),
hooks: {
"@": hookVar
@@ -322,6 +337,36 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
}
});
+ // provided by the phpLiteAdmin project - phpliteadmin.org
+ CodeMirror.defineMIME("text/x-sqlite", {
+ name: "sql",
+ // commands of the official SQLite client, ref: https://www.sqlite.org/cli.html#dotcmd
+ client: set("auth backup bail binary changes check clone databases dbinfo dump echo eqp exit explain fullschema headers help import imposter indexes iotrace limit lint load log mode nullvalue once open output print prompt quit read restore save scanstats schema separator session shell show stats system tables testcase timeout timer trace vfsinfo vfslist vfsname width"),
+ // ref: http://sqlite.org/lang_keywords.html
+ keywords: set(sqlKeywords + "abort action add after all analyze attach autoincrement before begin cascade case cast check collate column commit conflict constraint cross current_date current_time current_timestamp database default deferrable deferred detach each else end escape except exclusive exists explain fail for foreign full glob if ignore immediate index indexed initially inner instead intersect isnull key left limit match natural no notnull null of offset outer plan pragma primary query raise recursive references regexp reindex release rename replace restrict right rollback row savepoint temp temporary then to transaction trigger unique using vacuum view virtual when with without"),
+ // SQLite is weakly typed, ref: http://sqlite.org/datatype3.html. This is just a list of some common types.
+ builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text clob bigint int int2 int8 integer float double char varchar date datetime year unsigned signed numeric real"),
+ // ref: http://sqlite.org/syntax/literal-value.html
+ atoms: set("null current_date current_time current_timestamp"),
+ // ref: http://sqlite.org/lang_expr.html#binaryops
+ operatorChars: /^[*+\-%<>!=&|/~]/,
+ // SQLite is weakly typed, ref: http://sqlite.org/datatype3.html. This is just a list of some common types.
+ dateSQL: set("date time timestamp datetime"),
+ support: set("decimallessFloat zerolessFloat"),
+ identifierQuote: "\"", //ref: http://sqlite.org/lang_keywords.html
+ hooks: {
+ // bind-parameters ref:http://sqlite.org/lang_expr.html#varparam
+ "@": hookVar,
+ ":": hookVar,
+ "?": hookVar,
+ "$": hookVar,
+ // The preferred way to escape Identifiers is using double quotes, ref: http://sqlite.org/lang_keywords.html
+ "\"": hookIdentifierDoublequote,
+ // there is also support for backtics, ref: http://sqlite.org/lang_keywords.html
+ "`": hookIdentifier
+ }
+ });
+
// the query language used by Apache Cassandra is called CQL, but this mime type
// is called Cassandra to avoid confusion with Contextual Query Language
CodeMirror.defineMIME("text/x-cassandra", {
@@ -342,7 +387,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
client: set("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),
keywords: set("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),
builtin: set("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least length lengthb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),
- operatorChars: /^[*+\-%<>!=~]/,
+ operatorChars: /^[*\/+\-%<>!=~]/,
dateSQL: set("date time timestamp"),
support: set("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")
});
@@ -350,8 +395,8 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
// Created to support specific hive keywords
CodeMirror.defineMIME("text/x-hive", {
name: "sql",
- keywords: set("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"),
- builtin: set("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"),
+ keywords: set("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with admin authorization char compact compactions conf cube current current_date current_timestamp day decimal defined dependency directories elem_type exchange file following for grouping hour ignore inner interval jar less logical macro minute month more none noscan over owner partialscan preceding pretty principals protection reload rewrite role roles rollup rows second server sets skewed transactions truncate unbounded unset uri user values window year"),
+ builtin: set("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype key_type utctimestamp value_type varchar"),
atoms: set("false true null unknown"),
operatorChars: /^[*+\-%<>!=]/,
dateSQL: set("date timestamp"),
@@ -361,12 +406,13 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
CodeMirror.defineMIME("text/x-pgsql", {
name: "sql",
client: set("source"),
- // http://www.postgresql.org/docs/9.5/static/sql-keywords-appendix.html
- keywords: set(sqlKeywords + "a abort abs absent absolute access according action ada add admin after aggregate all allocate also always analyse analyze any are array array_agg array_max_cardinality asensitive assertion assignment asymmetric at atomic attribute attributes authorization avg backward base64 before begin begin_frame begin_partition bernoulli binary bit_length blob blocked bom both breadth c cache call called cardinality cascade cascaded case cast catalog catalog_name ceil ceiling chain characteristics characters character_length character_set_catalog character_set_name character_set_schema char_length check checkpoint class class_origin clob close cluster coalesce cobol collate collation collation_catalog collation_name collation_schema collect column columns column_name command_function command_function_code comment comments commit committed concurrently condition condition_number configuration conflict connect connection connection_name constraint constraints constraint_catalog constraint_name constraint_schema constructor contains content continue control conversion convert copy corr corresponding cost covar_pop covar_samp cross csv cube cume_dist current current_catalog current_date current_default_transform_group current_path current_role current_row current_schema current_time current_timestamp current_transform_group_for_type current_user cursor cursor_name cycle data database datalink datetime_interval_code datetime_interval_precision day db deallocate dec declare default defaults deferrable deferred defined definer degree delimiter delimiters dense_rank depth deref derived describe descriptor deterministic diagnostics dictionary disable discard disconnect dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue do document domain dynamic dynamic_function dynamic_function_code each element else empty enable encoding encrypted end end-exec end_frame end_partition enforced enum equals escape event every except exception exclude excluding exclusive exec execute exists exp explain expression extension external extract false family fetch file filter final first first_value flag float floor following for force foreign fortran forward found frame_row free freeze fs full function functions fusion g general generated get global go goto grant granted greatest grouping groups handler header hex hierarchy hold hour id identity if ignore ilike immediate immediately immutable implementation implicit import including increment indent index indexes indicator inherit inherits initially inline inner inout input insensitive instance instantiable instead integrity intersect intersection invoker isnull isolation k key key_member key_type label lag language large last last_value lateral lead leading leakproof least left length level library like_regex link listen ln load local localtime localtimestamp location locator lock locked logged lower m map mapping match matched materialized max maxvalue max_cardinality member merge message_length message_octet_length message_text method min minute minvalue mod mode modifies module month more move multiset mumps name names namespace national natural nchar nclob nesting new next nfc nfd nfkc nfkd nil no none normalize normalized nothing notify notnull nowait nth_value ntile null nullable nullif nulls number object occurrences_regex octets octet_length of off offset oids old only open operator option options ordering ordinality others out outer output over overlaps overlay overriding owned owner p pad parameter parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partial partition pascal passing passthrough password percent percentile_cont percentile_disc percent_rank period permission placing plans pli policy portion position position_regex power precedes preceding prepare prepared preserve primary prior privileges procedural procedure program public quote range rank read reads reassign recheck recovery recursive ref references referencing refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release rename repeatable replace replica requiring reset respect restart restore restrict result return returned_cardinality returned_length returned_octet_length returned_sqlstate returning returns revoke right role rollback rollup routine routine_catalog routine_name routine_schema row rows row_count row_number rule savepoint scale schema schema_name scope scope_catalog scope_name scope_schema scroll search second section security selective self sensitive sequence sequences serializable server server_name session session_user setof sets share show similar simple size skip snapshot some source space specific specifictype specific_name sql sqlcode sqlerror sqlexception sqlstate sqlwarning sqrt stable standalone start state statement static statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset substring substring_regex succeeds sum symmetric sysid system system_time system_user t tables tablesample tablespace table_name temp template temporary then ties timezone_hour timezone_minute to token top_level_count trailing transaction transactions_committed transactions_rolled_back transaction_active transform transforms translate translate_regex translation treat trigger trigger_catalog trigger_name trigger_schema trim trim_array true truncate trusted type types uescape unbounded uncommitted under unencrypted unique unknown unlink unlisten unlogged unnamed unnest until untyped upper uri usage user user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema using vacuum valid validate validator value value_of varbinary variadic var_pop var_samp verbose version versioning view views volatile when whenever whitespace width_bucket window within work wrapper write xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate year yes loop repeat"),
- // http://www.postgresql.org/docs/9.5/static/datatype.html
- builtin: set("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),
+ // For PostgreSQL - https://www.postgresql.org/docs/11/sql-keywords-appendix.html
+ // For pl/pgsql lang - https://github.com/postgres/postgres/blob/REL_11_2/src/pl/plpgsql/src/pl_scanner.c
+ keywords: set(sqlKeywords + "a abort abs absent absolute access according action ada add admin after aggregate alias all allocate also alter always analyse analyze and any are array array_agg array_max_cardinality as asc asensitive assert assertion assignment asymmetric at atomic attach attribute attributes authorization avg backward base64 before begin begin_frame begin_partition bernoulli between bigint binary bit bit_length blob blocked bom boolean both breadth by c cache call called cardinality cascade cascaded case cast catalog catalog_name ceil ceiling chain char char_length character character_length character_set_catalog character_set_name character_set_schema characteristics characters check checkpoint class class_origin clob close cluster coalesce cobol collate collation collation_catalog collation_name collation_schema collect column column_name columns command_function command_function_code comment comments commit committed concurrently condition condition_number configuration conflict connect connection connection_name constant constraint constraint_catalog constraint_name constraint_schema constraints constructor contains content continue control conversion convert copy corr corresponding cost count covar_pop covar_samp create cross csv cube cume_dist current current_catalog current_date current_default_transform_group current_path current_role current_row current_schema current_time current_timestamp current_transform_group_for_type current_user cursor cursor_name cycle data database datalink datatype date datetime_interval_code datetime_interval_precision day db deallocate debug dec decimal declare default defaults deferrable deferred defined definer degree delete delimiter delimiters dense_rank depends depth deref derived desc describe descriptor detach detail deterministic diagnostics dictionary disable discard disconnect dispatch distinct dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue do document domain double drop dump dynamic dynamic_function dynamic_function_code each element else elseif elsif empty enable encoding encrypted end end_frame end_partition endexec enforced enum equals errcode error escape event every except exception exclude excluding exclusive exec execute exists exit exp explain expression extension external extract false family fetch file filter final first first_value flag float floor following for force foreach foreign fortran forward found frame_row free freeze from fs full function functions fusion g general generated get global go goto grant granted greatest group grouping groups handler having header hex hierarchy hint hold hour id identity if ignore ilike immediate immediately immutable implementation implicit import in include including increment indent index indexes indicator info inherit inherits initially inline inner inout input insensitive insert instance instantiable instead int integer integrity intersect intersection interval into invoker is isnull isolation join k key key_member key_type label lag language large last last_value lateral lead leading leakproof least left length level library like like_regex limit link listen ln load local localtime localtimestamp location locator lock locked log logged loop lower m map mapping match matched materialized max max_cardinality maxvalue member merge message message_length message_octet_length message_text method min minute minvalue mod mode modifies module month more move multiset mumps name names namespace national natural nchar nclob nesting new next nfc nfd nfkc nfkd nil no none normalize normalized not nothing notice notify notnull nowait nth_value ntile null nullable nullif nulls number numeric object occurrences_regex octet_length octets of off offset oids old on only open operator option options or order ordering ordinality others out outer output over overlaps overlay overriding owned owner p pad parallel parameter parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partial partition pascal passing passthrough password path percent percent_rank percentile_cont percentile_disc perform period permission pg_context pg_datatype_name pg_exception_context pg_exception_detail pg_exception_hint placing plans pli policy portion position position_regex power precedes preceding precision prepare prepared preserve primary print_strict_params prior privileges procedural procedure procedures program public publication query quote raise range rank read reads real reassign recheck recovery recursive ref references referencing refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release rename repeatable replace replica requiring reset respect restart restore restrict result result_oid return returned_cardinality returned_length returned_octet_length returned_sqlstate returning returns reverse revoke right role rollback rollup routine routine_catalog routine_name routine_schema routines row row_count row_number rows rowtype rule savepoint scale schema schema_name schemas scope scope_catalog scope_name scope_schema scroll search second section security select selective self sensitive sequence sequences serializable server server_name session session_user set setof sets share show similar simple size skip slice smallint snapshot some source space specific specific_name specifictype sql sqlcode sqlerror sqlexception sqlstate sqlwarning sqrt stable stacked standalone start state statement static statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset subscription substring substring_regex succeeds sum symmetric sysid system system_time system_user t table table_name tables tablesample tablespace temp template temporary text then ties time timestamp timezone_hour timezone_minute to token top_level_count trailing transaction transaction_active transactions_committed transactions_rolled_back transform transforms translate translate_regex translation treat trigger trigger_catalog trigger_name trigger_schema trim trim_array true truncate trusted type types uescape unbounded uncommitted under unencrypted union unique unknown unlink unlisten unlogged unnamed unnest until untyped update upper uri usage use_column use_variable user user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema using vacuum valid validate validator value value_of values var_pop var_samp varbinary varchar variable_conflict variadic varying verbose version versioning view views volatile warning when whenever where while whitespace width_bucket window with within without work wrapper write xml xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate year yes zone"),
+ // https://www.postgresql.org/docs/11/datatype.html
+ builtin: set("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr macaddr8 money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),
atoms: set("false true null unknown"),
- operatorChars: /^[*+\-%<>!=&|^\/#@?~]/,
+ operatorChars: /^[*\/+\-%<>!=&|^\/#@?~]/,
dateSQL: set("date time timestamp"),
support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast")
});
@@ -379,8 +425,43 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
builtin: set("blob datetime first key __key__ string integer double boolean null"),
operatorChars: /^[*+\-%<>!=]/
});
-}());
+ // Greenplum
+ CodeMirror.defineMIME("text/x-gpsql", {
+ name: "sql",
+ client: set("source"),
+ //https://github.com/greenplum-db/gpdb/blob/master/src/include/parser/kwlist.h
+ keywords: set("abort absolute access action active add admin after aggregate all also alter always analyse analyze and any array as asc assertion assignment asymmetric at authorization backward before begin between bigint binary bit boolean both by cache called cascade cascaded case cast chain char character characteristics check checkpoint class close cluster coalesce codegen collate column comment commit committed concurrency concurrently configuration connection constraint constraints contains content continue conversion copy cost cpu_rate_limit create createdb createexttable createrole createuser cross csv cube current current_catalog current_date current_role current_schema current_time current_timestamp current_user cursor cycle data database day deallocate dec decimal declare decode default defaults deferrable deferred definer delete delimiter delimiters deny desc dictionary disable discard distinct distributed do document domain double drop dxl each else enable encoding encrypted end enum errors escape every except exchange exclude excluding exclusive execute exists explain extension external extract false family fetch fields filespace fill filter first float following for force foreign format forward freeze from full function global grant granted greatest group group_id grouping handler hash having header hold host hour identity if ignore ilike immediate immutable implicit in including inclusive increment index indexes inherit inherits initially inline inner inout input insensitive insert instead int integer intersect interval into invoker is isnull isolation join key language large last leading least left level like limit list listen load local localtime localtimestamp location lock log login mapping master match maxvalue median merge minute minvalue missing mode modifies modify month move name names national natural nchar new newline next no nocreatedb nocreateexttable nocreaterole nocreateuser noinherit nologin none noovercommit nosuperuser not nothing notify notnull nowait null nullif nulls numeric object of off offset oids old on only operator option options or order ordered others out outer over overcommit overlaps overlay owned owner parser partial partition partitions passing password percent percentile_cont percentile_disc placing plans position preceding precision prepare prepared preserve primary prior privileges procedural procedure protocol queue quote randomly range read readable reads real reassign recheck recursive ref references reindex reject relative release rename repeatable replace replica reset resource restart restrict returning returns revoke right role rollback rollup rootpartition row rows rule savepoint scatter schema scroll search second security segment select sequence serializable session session_user set setof sets share show similar simple smallint some split sql stable standalone start statement statistics stdin stdout storage strict strip subpartition subpartitions substring superuser symmetric sysid system table tablespace temp template temporary text then threshold ties time timestamp to trailing transaction treat trigger trim true truncate trusted type unbounded uncommitted unencrypted union unique unknown unlisten until update user using vacuum valid validation validator value values varchar variadic varying verbose version view volatile web when where whitespace window with within without work writable write xml xmlattributes xmlconcat xmlelement xmlexists xmlforest xmlparse xmlpi xmlroot xmlserialize year yes zone"),
+ builtin: set("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float float8 inet integer int int4 interval json jsonb line lseg macaddr macaddr8 money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),
+ atoms: set("false true null unknown"),
+ operatorChars: /^[*+\-%<>!=&|^\/#@?~]/,
+ dateSQL: set("date time timestamp"),
+ support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast")
+ });
+
+ // Spark SQL
+ CodeMirror.defineMIME("text/x-sparksql", {
+ name: "sql",
+ keywords: set("add after all alter analyze and anti archive array as asc at between bucket buckets by cache cascade case cast change clear cluster clustered codegen collection column columns comment commit compact compactions compute concatenate cost create cross cube current current_date current_timestamp database databases datata dbproperties defined delete delimited deny desc describe dfs directories distinct distribute drop else end escaped except exchange exists explain export extended external false fields fileformat first following for format formatted from full function functions global grant group grouping having if ignore import in index indexes inner inpath inputformat insert intersect interval into is items join keys last lateral lazy left like limit lines list load local location lock locks logical macro map minus msck natural no not null nulls of on optimize option options or order out outer outputformat over overwrite partition partitioned partitions percent preceding principals purge range recordreader recordwriter recover reduce refresh regexp rename repair replace reset restrict revoke right rlike role roles rollback rollup row rows schema schemas select semi separated serde serdeproperties set sets show skewed sort sorted start statistics stored stratify struct table tables tablesample tblproperties temp temporary terminated then to touch transaction transactions transform true truncate unarchive unbounded uncache union unlock unset use using values view when where window with"),
+ builtin: set("tinyint smallint int bigint boolean float double string binary timestamp decimal array map struct uniontype delimited serde sequencefile textfile rcfile inputformat outputformat"),
+ atoms: set("false true null"),
+ operatorChars: /^[*\/+\-%<>!=~&|^]/,
+ dateSQL: set("date time timestamp"),
+ support: set("ODBCdotTable doubleQuote zerolessFloat")
+ });
+
+ // Esper
+ CodeMirror.defineMIME("text/x-esper", {
+ name: "sql",
+ client: set("source"),
+ // http://www.espertech.com/esper/release-5.5.0/esper-reference/html/appendix_keywords.html
+ keywords: set("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 after all and as at asc avedev avg between by case cast coalesce count create current_timestamp day days delete define desc distinct else end escape events every exists false first from full group having hour hours in inner insert instanceof into irstream is istream join last lastweekday left limit like max match_recognize matches median measures metadatasql min minute minutes msec millisecond milliseconds not null offset on or order outer output partition pattern prev prior regexp retain-union retain-intersection right rstream sec second seconds select set some snapshot sql stddev sum then true unidirectional until update variable weekday when where window"),
+ builtin: {},
+ atoms: set("false true null"),
+ operatorChars: /^[*+\-%<>!=&|^\/#@?~]/,
+ dateSQL: set("time"),
+ support: set("decimallessFloat zerolessFloat binaryNumber hexNumber")
+ });
});
/*
diff --git a/vendor/assets/javascripts/codemirror/modes/stex.js b/vendor/assets/javascripts/codemirror/modes/stex.js
index 835ed46..140e5a8 100644
--- a/vendor/assets/javascripts/codemirror/modes/stex.js
+++ b/vendor/assets/javascripts/codemirror/modes/stex.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
/*
* Author: Constantin Jucovschi (c.jucovschi@jacobs-university.de)
@@ -16,7 +16,7 @@
})(function(CodeMirror) {
"use strict";
- CodeMirror.defineMode("stex", function() {
+ CodeMirror.defineMode("stex", function(_config, parserConfig) {
"use strict";
function pushCommand(state, command) {
@@ -78,6 +78,14 @@
plugins["begin"] = addPluginPattern("begin", "tag", ["atom"]);
plugins["end"] = addPluginPattern("end", "tag", ["atom"]);
+ plugins["label" ] = addPluginPattern("label" , "tag", ["atom"]);
+ plugins["ref" ] = addPluginPattern("ref" , "tag", ["atom"]);
+ plugins["eqref" ] = addPluginPattern("eqref" , "tag", ["atom"]);
+ plugins["cite" ] = addPluginPattern("cite" , "tag", ["atom"]);
+ plugins["bibitem" ] = addPluginPattern("bibitem" , "tag", ["atom"]);
+ plugins["Bibitem" ] = addPluginPattern("Bibitem" , "tag", ["atom"]);
+ plugins["RBibitem" ] = addPluginPattern("RBibitem" , "tag", ["atom"]);
+
plugins["DEFAULT"] = function () {
this.name = "DEFAULT";
this.style = "tag";
@@ -117,6 +125,10 @@
setState(state, function(source, state){ return inMathMode(source, state, "\\]"); });
return "keyword";
}
+ if (source.match("\\(")) {
+ setState(state, function(source, state){ return inMathMode(source, state, "\\)"); });
+ return "keyword";
+ }
if (source.match("$$")) {
setState(state, function(source, state){ return inMathMode(source, state, "$$"); });
return "keyword";
@@ -161,7 +173,7 @@
if (source.eatSpace()) {
return null;
}
- if (source.match(endModeSeq)) {
+ if (endModeSeq && source.match(endModeSeq)) {
setState(state, normal);
return "keyword";
}
@@ -223,9 +235,10 @@
return {
startState: function() {
+ var f = parserConfig.inMathMode ? function(source, state){ return inMathMode(source, state); } : normal;
return {
cmdState: [],
- f: normal
+ f: f
};
},
copyState: function(s) {
diff --git a/vendor/assets/javascripts/codemirror/modes/stylus.js b/vendor/assets/javascripts/codemirror/modes/stylus.js
index 662cd03..dbe241d 100644
--- a/vendor/assets/javascripts/codemirror/modes/stylus.js
+++ b/vendor/assets/javascripts/codemirror/modes/stylus.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
// Stylus mode created by Dmitry Kiselyov http://git.io/AaRB
@@ -15,6 +15,7 @@
CodeMirror.defineMode("stylus", function(config) {
var indentUnit = config.indentUnit,
+ indentUnitString = '',
tagKeywords = keySet(tagKeywords_),
tagVariablesRegexp = /^(a|b|i|s|col|em)$/i,
propertyKeywords = keySet(propertyKeywords_),
@@ -38,6 +39,8 @@
type,
override;
+ while (indentUnitString.length < indentUnit) indentUnitString += ' ';
+
/**
* Tokenizers
*/
@@ -73,7 +76,7 @@
if (ch == "#") {
stream.next();
// Hex color
- if (stream.match(/^[0-9a-f]{6}|[0-9a-f]{3}/i)) {
+ if (stream.match(/^[0-9a-f]{3}([0-9a-f]([0-9a-f]{2}){0,2})?\b/i)) {
return ["atom", "atom"];
}
// ID selector
@@ -313,7 +316,7 @@
return pushContext(state, stream, "block", 0);
}
}
- if (typeIsBlock(type, stream, state)) {
+ if (typeIsBlock(type, stream)) {
return pushContext(state, stream, "block");
}
if (type == "}" && endOfLine(stream)) {
@@ -513,7 +516,7 @@
*/
states.atBlock = function(type, stream, state) {
if (type == "(") return pushContext(state, stream, "atBlock_parens");
- if (typeIsBlock(type, stream, state)) {
+ if (typeIsBlock(type, stream)) {
return pushContext(state, stream, "block");
}
if (typeIsInterpolation(type, stream)) {
@@ -672,7 +675,7 @@
ch = textAfter && textAfter.charAt(0),
indent = cx.indent,
lineFirstWord = firstWordOfLine(textAfter),
- lineIndent = line.length - line.replace(/^\s*/, "").length,
+ lineIndent = line.match(/^\s*/)[0].replace(/\t/g, indentUnitString).length,
prevLineFirstWord = state.context.prev ? state.context.prev.line.firstWord : "",
prevLineIndent = state.context.prev ? state.context.prev.line.indent : lineIndent;
@@ -681,7 +684,6 @@
ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") ||
ch == "{" && (cx.type == "at"))) {
indent = cx.indent - indentUnit;
- cx = cx.prev;
} else if (!(/(\})/.test(ch))) {
if (/@|\$|\d/.test(ch) ||
/^\{/.test(textAfter) ||
@@ -732,11 +734,11 @@
var documentTypes_ = ["domain", "regexp", "url", "url-prefix"];
var mediaTypes_ = ["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"];
var mediaFeatures_ = ["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"];
- var propertyKeywords_ = ["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode","font-smoothing","osx-font-smoothing"];
+ var propertyKeywords_ = ["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode","font-smoothing","osx-font-smoothing"];
var nonStandardPropertyKeywords_ = ["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"];
var fontProperties_ = ["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"];
var colorKeywords_ = ["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"];
- var valueKeywords_ = ["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","x-large","x-small","xor","xx-large","xx-small","bicubic","optimizespeed","grayscale","row","row-reverse","wrap","wrap-reverse","column-reverse","flex-start","flex-end","space-between","space-around"];
+ var valueKeywords_ = ["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","x-large","x-small","xor","xx-large","xx-small","bicubic","optimizespeed","grayscale","row","row-reverse","wrap","wrap-reverse","column-reverse","flex-start","flex-end","space-between","space-around", "unset"];
var wordOperatorKeywords_ = ["in","and","or","not","is not","is a","is","isnt","defined","if unless"],
blockKeywords_ = ["for","if","else","unless", "from", "to"],
diff --git a/vendor/assets/javascripts/codemirror/modes/swift.js b/vendor/assets/javascripts/codemirror/modes/swift.js
index 3c28ced..55e31e2 100644
--- a/vendor/assets/javascripts/codemirror/modes/swift.js
+++ b/vendor/assets/javascripts/codemirror/modes/swift.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
// Swift mode created by Michael Kaminsky https://github.com/mkaminsky11
@@ -19,25 +19,28 @@
return set
}
- var keywords = wordSet(["var","let","class","deinit","enum","extension","func","import","init","protocol",
- "static","struct","subscript","typealias","as","dynamicType","is","new","super",
- "self","Self","Type","__COLUMN__","__FILE__","__FUNCTION__","__LINE__","break","case",
- "continue","default","do","else","fallthrough","if","in","for","return","switch",
- "where","while","associativity","didSet","get","infix","inout","left","mutating",
- "none","nonmutating","operator","override","postfix","precedence","prefix","right",
- "set","unowned","weak","willSet"])
- var definingKeywords = wordSet(["var","let","class","enum","extension","func","import","protocol","struct",
- "typealias","dynamicType","for"])
- var atoms = wordSet(["Infinity","NaN","undefined","null","true","false","on","off","yes","no","nil","null",
- "this","super"])
- var types = wordSet(["String","bool","int","string","double","Double","Int","Float","float","public",
- "private","extension"])
- var operators = "+-/*%=|&<>#"
- var punc = ";,.(){}[]"
- var number = /^-?(?:(?:[\d_]+\.[_\d]*|\.[_\d]+|0o[0-7_\.]+|0b[01_\.]+)(?:e-?[\d_]+)?|0x[\d_a-f\.]+(?:p-?[\d_]+)?)/i
- var identifier = /^[_A-Za-z$][_A-Za-z$0-9]*/
- var property = /^[@\.][_A-Za-z$][_A-Za-z$0-9]*/
- var regexp = /^\/(?!\s)(?:\/\/)?(?:\\.|[^\/])+\//
+ var keywords = wordSet(["_","var","let","class","enum","extension","import","protocol","struct","func","typealias","associatedtype",
+ "open","public","internal","fileprivate","private","deinit","init","new","override","self","subscript","super",
+ "convenience","dynamic","final","indirect","lazy","required","static","unowned","unowned(safe)","unowned(unsafe)","weak","as","is",
+ "break","case","continue","default","else","fallthrough","for","guard","if","in","repeat","switch","where","while",
+ "defer","return","inout","mutating","nonmutating","catch","do","rethrows","throw","throws","try","didSet","get","set","willSet",
+ "assignment","associativity","infix","left","none","operator","postfix","precedence","precedencegroup","prefix","right",
+ "Any","AnyObject","Type","dynamicType","Self","Protocol","__COLUMN__","__FILE__","__FUNCTION__","__LINE__"])
+ var definingKeywords = wordSet(["var","let","class","enum","extension","import","protocol","struct","func","typealias","associatedtype","for"])
+ var atoms = wordSet(["true","false","nil","self","super","_"])
+ var types = wordSet(["Array","Bool","Character","Dictionary","Double","Float","Int","Int8","Int16","Int32","Int64","Never","Optional","Set","String",
+ "UInt8","UInt16","UInt32","UInt64","Void"])
+ var operators = "+-/*%=|&<>~^?!"
+ var punc = ":;,.(){}[]"
+ var binary = /^\-?0b[01][01_]*/
+ var octal = /^\-?0o[0-7][0-7_]*/
+ var hexadecimal = /^\-?0x[\dA-Fa-f][\dA-Fa-f_]*(?:(?:\.[\dA-Fa-f][\dA-Fa-f_]*)?[Pp]\-?\d[\d_]*)?/
+ var decimal = /^\-?\d[\d_]*(?:\.\d[\d_]*)?(?:[Ee]\-?\d[\d_]*)?/
+ var identifier = /^\$\d+|(`?)[_A-Za-z][_A-Za-z$0-9]*\1/
+ var property = /^\.(?:\$\d+|(`?)[_A-Za-z][_A-Za-z$0-9]*\1)/
+ var instruction = /^\#[A-Za-z]+/
+ var attribute = /^@(?:\$\d+|(`?)[_A-Za-z][_A-Za-z$0-9]*\1)/
+ //var regexp = /^\/(?!\s)(?:\/\/)?(?:\\.|[^\/])+\//
function tokenBase(stream, state, prev) {
if (stream.sol()) state.indented = stream.indentation()
@@ -53,8 +56,14 @@
state.tokenize.push(tokenComment)
return tokenComment(stream, state)
}
- if (stream.match(regexp)) return "string-2"
}
+ if (stream.match(instruction)) return "builtin"
+ if (stream.match(attribute)) return "attribute"
+ if (stream.match(binary)) return "number"
+ if (stream.match(octal)) return "number"
+ if (stream.match(hexadecimal)) return "number"
+ if (stream.match(decimal)) return "number"
+ if (stream.match(property)) return "property"
if (operators.indexOf(ch) > -1) {
stream.next()
return "operator"
@@ -64,25 +73,22 @@
stream.match("..")
return "punctuation"
}
- if (ch == '"' || ch == "'") {
- stream.next()
- var tokenize = tokenString(ch)
+ var stringMatch
+ if (stringMatch = stream.match(/("""|"|')/)) {
+ var tokenize = tokenString.bind(null, stringMatch[0])
state.tokenize.push(tokenize)
return tokenize(stream, state)
}
- if (stream.match(number)) return "number"
- if (stream.match(property)) return "property"
-
if (stream.match(identifier)) {
var ident = stream.current()
+ if (types.hasOwnProperty(ident)) return "variable-2"
+ if (atoms.hasOwnProperty(ident)) return "atom"
if (keywords.hasOwnProperty(ident)) {
if (definingKeywords.hasOwnProperty(ident))
state.prev = "define"
return "keyword"
}
- if (types.hasOwnProperty(ident)) return "variable-2"
- if (atoms.hasOwnProperty(ident)) return "atom"
if (prev == "define") return "def"
return "variable"
}
@@ -110,30 +116,43 @@
}
}
- function tokenString(quote) {
- return function(stream, state) {
- var ch, escaped = false
- while (ch = stream.next()) {
- if (escaped) {
- if (ch == "(") {
- state.tokenize.push(tokenUntilClosingParen())
- return "string"
- }
- escaped = false
- } else if (ch == quote) {
- break
- } else {
- escaped = ch == "\\"
+ function tokenString(openQuote, stream, state) {
+ var singleLine = openQuote.length == 1
+ var ch, escaped = false
+ while (ch = stream.peek()) {
+ if (escaped) {
+ stream.next()
+ if (ch == "(") {
+ state.tokenize.push(tokenUntilClosingParen())
+ return "string"
}
+ escaped = false
+ } else if (stream.match(openQuote)) {
+ state.tokenize.pop()
+ return "string"
+ } else {
+ stream.next()
+ escaped = ch == "\\"
}
+ }
+ if (singleLine) {
state.tokenize.pop()
- return "string"
}
+ return "string"
}
function tokenComment(stream, state) {
- stream.match(/^(?:[^*]|\*(?!\/))*/)
- if (stream.match("*/")) state.tokenize.pop()
+ var ch
+ while (true) {
+ stream.match(/^[^/*]+/, true)
+ ch = stream.next()
+ if (!ch) break
+ if (ch === "/" && stream.eat("*")) {
+ state.tokenize.push(tokenComment)
+ } else if (ch === "*" && stream.eat("/")) {
+ state.tokenize.pop()
+ }
+ }
return "comment"
}
@@ -194,7 +213,9 @@
lineComment: "//",
blockCommentStart: "/*",
- blockCommentEnd: "*/"
+ blockCommentEnd: "*/",
+ fold: "brace",
+ closeBrackets: "()[]{}''\"\"``"
}
})
diff --git a/vendor/assets/javascripts/codemirror/modes/tcl.js b/vendor/assets/javascripts/codemirror/modes/tcl.js
index 8c76d52..a7ec89c 100644
--- a/vendor/assets/javascripts/codemirror/modes/tcl.js
+++ b/vendor/assets/javascripts/codemirror/modes/tcl.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
//tcl mode by Ford_Lawnmower :: Based on Velocity mode by Steve O'Hara
diff --git a/vendor/assets/javascripts/codemirror/modes/textile.js b/vendor/assets/javascripts/codemirror/modes/textile.js
index a6f7576..b378fb6 100644
--- a/vendor/assets/javascripts/codemirror/modes/textile.js
+++ b/vendor/assets/javascripts/codemirror/modes/textile.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") { // CommonJS
@@ -203,7 +203,7 @@
single: {
bc: "bc",
bq: "bq",
- definitionList: /- [^(?::=)]+:=+/,
+ definitionList: /- .*?:=+/,
definitionListEnd: /.*=:\s*$/,
div: "div",
drawTable: /\|.*\|/,
diff --git a/vendor/assets/javascripts/codemirror/modes/tiddlywiki.js b/vendor/assets/javascripts/codemirror/modes/tiddlywiki.js
index 1a3b3bc..a4fb89f 100644
--- a/vendor/assets/javascripts/codemirror/modes/tiddlywiki.js
+++ b/vendor/assets/javascripts/codemirror/modes/tiddlywiki.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
/***
|''Name''|tiddlywiki.js|
@@ -8,7 +8,7 @@
|''Version''|0.1.7|
|''Status''|''stable''|
|''Source''|[[GitHub|https://github.com/pmario/CodeMirror2/blob/tw-syntax/mode/tiddlywiki]]|
- |''Documentation''|http://codemirror.tiddlyspace.com/|
+ |''Documentation''|https://codemirror.tiddlyspace.com/|
|''License''|[[MIT License|http://www.opensource.org/licenses/mit-license.php]]|
|''CoreVersion''|2.5.0|
|''Requires''|codemirror.js|
diff --git a/vendor/assets/javascripts/codemirror/modes/tiki.js b/vendor/assets/javascripts/codemirror/modes/tiki.js
index 5e05b1f..092b859 100644
--- a/vendor/assets/javascripts/codemirror/modes/tiki.js
+++ b/vendor/assets/javascripts/codemirror/modes/tiki.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -144,7 +144,7 @@ CodeMirror.defineMode('tiki', function(config) {
type = "equals";
if (peek == ">") {
- ch = stream.next();
+ stream.next();
peek = stream.peek();
}
@@ -298,13 +298,13 @@ return {
if (context && context.noIndent) return 0;
if (context && /^{\//.test(textAfter))
context = context.prev;
- while (context && !context.startOfLine)
- context = context.prev;
- if (context) return context.indent + indentUnit;
- else return 0;
- },
- electricChars: "/"
- };
+ while (context && !context.startOfLine)
+ context = context.prev;
+ if (context) return context.indent + indentUnit;
+ else return 0;
+ },
+ electricChars: "/"
+};
});
CodeMirror.defineMIME("text/tiki", "tiki");
diff --git a/vendor/assets/javascripts/codemirror/modes/toml.js b/vendor/assets/javascripts/codemirror/modes/toml.js
index baeca15..891f384 100644
--- a/vendor/assets/javascripts/codemirror/modes/toml.js
+++ b/vendor/assets/javascripts/codemirror/modes/toml.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/tornado.js b/vendor/assets/javascripts/codemirror/modes/tornado.js
index dbfbc34..aa589a0 100644
--- a/vendor/assets/javascripts/codemirror/modes/tornado.js
+++ b/vendor/assets/javascripts/codemirror/modes/tornado.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/troff.js b/vendor/assets/javascripts/codemirror/modes/troff.js
index 86154b6..0c2220d 100644
--- a/vendor/assets/javascripts/codemirror/modes/troff.js
+++ b/vendor/assets/javascripts/codemirror/modes/troff.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object")
diff --git a/vendor/assets/javascripts/codemirror/modes/ttcn-cfg.js b/vendor/assets/javascripts/codemirror/modes/ttcn-cfg.js
index e108051..9d4b840 100644
--- a/vendor/assets/javascripts/codemirror/modes/ttcn-cfg.js
+++ b/vendor/assets/javascripts/codemirror/modes/ttcn-cfg.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/ttcn.js b/vendor/assets/javascripts/codemirror/modes/ttcn.js
index 3051851..0304e7c 100644
--- a/vendor/assets/javascripts/codemirror/modes/ttcn.js
+++ b/vendor/assets/javascripts/codemirror/modes/ttcn.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/turtle.js b/vendor/assets/javascripts/codemirror/modes/turtle.js
index 0988f0a..6952396 100644
--- a/vendor/assets/javascripts/codemirror/modes/turtle.js
+++ b/vendor/assets/javascripts/codemirror/modes/turtle.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/twig.js b/vendor/assets/javascripts/codemirror/modes/twig.js
index 1f2854b..a6dd3f1 100644
--- a/vendor/assets/javascripts/codemirror/modes/twig.js
+++ b/vendor/assets/javascripts/codemirror/modes/twig.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -95,7 +95,7 @@
}
return "variable";
} else if (stream.eat("{")) {
- if (ch = stream.eat("#")) {
+ if (stream.eat("#")) {
state.incomment = true;
if (!stream.skipTo("#}")) {
stream.skipToEnd();
diff --git a/vendor/assets/javascripts/codemirror/modes/vb.js b/vendor/assets/javascripts/codemirror/modes/vb.js
index d78f91f..6e4b476 100644
--- a/vendor/assets/javascripts/codemirror/modes/vb.js
+++ b/vendor/assets/javascripts/codemirror/modes/vb.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -25,16 +25,16 @@ CodeMirror.defineMode("vb", function(conf, parserConf) {
var tripleDelimiters = new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");
var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*");
- var openingKeywords = ['class','module', 'sub','enum','select','while','if','function', 'get','set','property', 'try'];
- var middleKeywords = ['else','elseif','case', 'catch'];
+ var openingKeywords = ['class','module', 'sub','enum','select','while','if','function', 'get','set','property', 'try', 'structure', 'synclock', 'using', 'with'];
+ var middleKeywords = ['else','elseif','case', 'catch', 'finally'];
var endKeywords = ['next','loop'];
- var operatorKeywords = ['and', 'or', 'not', 'xor', 'in'];
+ var operatorKeywords = ['and', "andalso", 'or', 'orelse', 'xor', 'in', 'not', 'is', 'isnot', 'like'];
var wordOperators = wordRegexp(operatorKeywords);
- var commonKeywords = ['as', 'dim', 'break', 'continue','optional', 'then', 'until',
- 'goto', 'byval','byref','new','handles','property', 'return',
- 'const','private', 'protected', 'friend', 'public', 'shared', 'static', 'true','false'];
- var commontypes = ['integer','string','double','decimal','boolean','short','char', 'float','single'];
+
+ var commonKeywords = ["#const", "#else", "#elseif", "#end", "#if", "#region", "addhandler", "addressof", "alias", "as", "byref", "byval", "cbool", "cbyte", "cchar", "cdate", "cdbl", "cdec", "cint", "clng", "cobj", "compare", "const", "continue", "csbyte", "cshort", "csng", "cstr", "cuint", "culng", "cushort", "declare", "default", "delegate", "dim", "directcast", "each", "erase", "error", "event", "exit", "explicit", "false", "for", "friend", "gettype", "goto", "handles", "implements", "imports", "infer", "inherits", "interface", "isfalse", "istrue", "lib", "me", "mod", "mustinherit", "mustoverride", "my", "mybase", "myclass", "namespace", "narrowing", "new", "nothing", "notinheritable", "notoverridable", "of", "off", "on", "operator", "option", "optional", "out", "overloads", "overridable", "overrides", "paramarray", "partial", "private", "protected", "public", "raiseevent", "readonly", "redim", "removehandler", "resume", "return", "shadows", "shared", "static", "step", "stop", "strict", "then", "throw", "to", "true", "trycast", "typeof", "until", "until", "when", "widening", "withevents", "writeonly"];
+
+ var commontypes = ['object', 'boolean', 'char', 'string', 'byte', 'sbyte', 'short', 'ushort', 'int16', 'uint16', 'integer', 'uinteger', 'int32', 'uint32', 'long', 'ulong', 'int64', 'uint64', 'decimal', 'single', 'double', 'float', 'date', 'datetime', 'intptr', 'uintptr'];
var keywords = wordRegexp(commonKeywords);
var types = wordRegexp(commontypes);
@@ -202,7 +202,6 @@ CodeMirror.defineMode("vb", function(conf, parserConf) {
// Handle '.' connected identifiers
if (current === '.') {
style = state.tokenize(stream, state);
- current = stream.current();
if (style === 'variable') {
return 'variable';
} else {
diff --git a/vendor/assets/javascripts/codemirror/modes/vbscript.js b/vendor/assets/javascripts/codemirror/modes/vbscript.js
index b66df22..0670c0c 100644
--- a/vendor/assets/javascripts/codemirror/modes/vbscript.js
+++ b/vendor/assets/javascripts/codemirror/modes/vbscript.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
/*
For extra ASP classic objects, initialize CodeMirror instance with this option:
diff --git a/vendor/assets/javascripts/codemirror/modes/velocity.js b/vendor/assets/javascripts/codemirror/modes/velocity.js
index 12ee221..56caa67 100644
--- a/vendor/assets/javascripts/codemirror/modes/velocity.js
+++ b/vendor/assets/javascripts/codemirror/modes/velocity.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -82,7 +82,7 @@ CodeMirror.defineMode("velocity", function() {
}
// variable?
else if (ch == "$") {
- stream.eatWhile(/[\w\d\$_\.{}]/);
+ stream.eatWhile(/[\w\d\$_\.{}-]/);
// is it one of the specials?
if (specials && specials.propertyIsEnumerable(stream.current())) {
return "keyword";
diff --git a/vendor/assets/javascripts/codemirror/modes/verilog.js b/vendor/assets/javascripts/codemirror/modes/verilog.js
index 7513dce..2b68506 100644
--- a/vendor/assets/javascripts/codemirror/modes/verilog.js
+++ b/vendor/assets/javascripts/codemirror/modes/verilog.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -81,7 +81,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
// Block openings which are closed by a matching keyword in the form of ("end" + keyword)
// E.g. "task" => "endtask"
var blockKeywords = words(
- "case checker class clocking config function generate interface module package" +
+ "case checker class clocking config function generate interface module package " +
"primitive program property specify sequence table task"
);
@@ -302,7 +302,13 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
state.indented = stream.indentation();
state.startOfLine = true;
}
- if (hooks.token) hooks.token(stream, state);
+ if (hooks.token) {
+ // Call hook, with an optional return value of a style to override verilog styling.
+ var style = hooks.token(stream, state);
+ if (style !== undefined) {
+ return style;
+ }
+ }
if (stream.eatSpace()) return null;
curPunc = null;
curKeyword = null;
@@ -375,163 +381,295 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
name: "verilog"
});
- // TLVVerilog mode
- var tlvchScopePrefixes = {
- ">": "property", "->": "property", "-": "hr", "|": "link", "?$": "qualifier", "?*": "qualifier",
- "@-": "variable-3", "@": "variable-3", "?": "qualifier"
+
+ // TL-Verilog mode.
+ // See tl-x.org for language spec.
+ // See the mode in action at makerchip.com.
+ // Contact: steve.hoover@redwoodeda.com
+
+ // TLV Identifier prefixes.
+ // Note that sign is not treated separately, so "+/-" versions of numeric identifiers
+ // are included.
+ var tlvIdentifierStyle = {
+ "|": "link",
+ ">": "property", // Should condition this off for > TLV 1c.
+ "$": "variable",
+ "$$": "variable",
+ "?$": "qualifier",
+ "?*": "qualifier",
+ "-": "hr",
+ "/": "property",
+ "/-": "property",
+ "@": "variable-3",
+ "@-": "variable-3",
+ "@++": "variable-3",
+ "@+=": "variable-3",
+ "@+=-": "variable-3",
+ "@--": "variable-3",
+ "@-=": "variable-3",
+ "%+": "tag",
+ "%-": "tag",
+ "%": "tag",
+ ">>": "tag",
+ "<<": "tag",
+ "<>": "tag",
+ "#": "tag", // Need to choose a style for this.
+ "^": "attribute",
+ "^^": "attribute",
+ "^!": "attribute",
+ "*": "variable-2",
+ "**": "variable-2",
+ "\\": "keyword",
+ "\"": "comment"
};
- function tlvGenIndent(stream, state) {
- var tlvindentUnit = 2;
- var rtnIndent = -1, indentUnitRq = 0, curIndent = stream.indentation();
- switch (state.tlvCurCtlFlowChar) {
- case "\\":
- curIndent = 0;
- break;
- case "|":
- if (state.tlvPrevPrevCtlFlowChar == "@") {
- indentUnitRq = -2; //-2 new pipe rq after cur pipe
- break;
- }
- if (tlvchScopePrefixes[state.tlvPrevCtlFlowChar])
- indentUnitRq = 1; // +1 new scope
- break;
- case "M": // m4
- if (state.tlvPrevPrevCtlFlowChar == "@") {
- indentUnitRq = -2; //-2 new inst rq after pipe
- break;
- }
- if (tlvchScopePrefixes[state.tlvPrevCtlFlowChar])
- indentUnitRq = 1; // +1 new scope
- break;
- case "@":
- if (state.tlvPrevCtlFlowChar == "S")
- indentUnitRq = -1; // new pipe stage after stmts
- if (state.tlvPrevCtlFlowChar == "|")
- indentUnitRq = 1; // 1st pipe stage
- break;
- case "S":
- if (state.tlvPrevCtlFlowChar == "@")
- indentUnitRq = 1; // flow in pipe stage
- if (tlvchScopePrefixes[state.tlvPrevCtlFlowChar])
- indentUnitRq = 1; // +1 new scope
- break;
- }
- var statementIndentUnit = tlvindentUnit;
- rtnIndent = curIndent + (indentUnitRq*statementIndentUnit);
- return rtnIndent >= 0 ? rtnIndent : curIndent;
+ // Lines starting with these characters define scope (result in indentation).
+ var tlvScopePrefixChars = {
+ "/": "beh-hier",
+ ">": "beh-hier",
+ "-": "phys-hier",
+ "|": "pipe",
+ "?": "when",
+ "@": "stage",
+ "\\": "keyword"
+ };
+ var tlvIndentUnit = 3;
+ var tlvTrackStatements = false;
+ var tlvIdentMatch = /^([~!@#\$%\^&\*-\+=\?\/\\\|'"<>]+)([\d\w_]*)/; // Matches an identifiere.
+ // Note that ':' is excluded, because of it's use in [:].
+ var tlvFirstLevelIndentMatch = /^[! ] /;
+ var tlvLineIndentationMatch = /^[! ] */;
+ var tlvCommentMatch = /^\/[\/\*]/;
+
+
+ // Returns a style specific to the scope at the given indentation column.
+ // Type is one of: "indent", "scope-ident", "before-scope-ident".
+ function tlvScopeStyle(state, indentation, type) {
+ // Begin scope.
+ var depth = indentation / tlvIndentUnit; // TODO: Pass this in instead.
+ return "tlv-" + state.tlvIndentationStyle[depth] + "-" + type;
+ }
+
+ // Return true if the next thing in the stream is an identifier with a mnemonic.
+ function tlvIdentNext(stream) {
+ var match;
+ return (match = stream.match(tlvIdentMatch, false)) && match[2].length > 0;
}
CodeMirror.defineMIME("text/x-tlv", {
name: "verilog",
+
hooks: {
- "\\": function(stream, state) {
- var vxIndent = 0, style = false;
- var curPunc = stream.string;
- if ((stream.sol()) && ((/\\SV/.test(stream.string)) || (/\\TLV/.test(stream.string)))) {
- curPunc = (/\\TLV_version/.test(stream.string))
- ? "\\TLV_version" : stream.string;
- stream.skipToEnd();
- if (curPunc == "\\SV" && state.vxCodeActive) {state.vxCodeActive = false;};
- if ((/\\TLV/.test(curPunc) && !state.vxCodeActive)
- || (curPunc=="\\TLV_version" && state.vxCodeActive)) {state.vxCodeActive = true;};
- style = "keyword";
- state.tlvCurCtlFlowChar = state.tlvPrevPrevCtlFlowChar
- = state.tlvPrevCtlFlowChar = "";
- if (state.vxCodeActive == true) {
- state.tlvCurCtlFlowChar = "\\";
- vxIndent = tlvGenIndent(stream, state);
+
+ electricInput: false,
+
+
+ // Return undefined for verilog tokenizing, or style for TLV token (null not used).
+ // Standard CM styles are used for most formatting, but some TL-Verilog-specific highlighting
+ // can be enabled with the definition of cm-tlv-* styles, including highlighting for:
+ // - M4 tokens
+ // - TLV scope indentation
+ // - Statement delimitation (enabled by tlvTrackStatements)
+ token: function(stream, state) {
+ var style = undefined;
+ var match; // Return value of pattern matches.
+
+ // Set highlighting mode based on code region (TLV or SV).
+ if (stream.sol() && ! state.tlvInBlockComment) {
+ // Process region.
+ if (stream.peek() == '\\') {
+ style = "def";
+ stream.skipToEnd();
+ if (stream.string.match(/\\SV/)) {
+ state.tlvCodeActive = false;
+ } else if (stream.string.match(/\\TLV/)){
+ state.tlvCodeActive = true;
+ }
+ }
+ // Correct indentation in the face of a line prefix char.
+ if (state.tlvCodeActive && stream.pos == 0 &&
+ (state.indented == 0) && (match = stream.match(tlvLineIndentationMatch, false))) {
+ state.indented = match[0].length;
+ }
+
+ // Compute indentation state:
+ // o Auto indentation on next line
+ // o Indentation scope styles
+ var indented = state.indented;
+ var depth = indented / tlvIndentUnit;
+ if (depth <= state.tlvIndentationStyle.length) {
+ // not deeper than current scope
+
+ var blankline = stream.string.length == indented;
+ var chPos = depth * tlvIndentUnit;
+ if (chPos < stream.string.length) {
+ var bodyString = stream.string.slice(chPos);
+ var ch = bodyString[0];
+ if (tlvScopePrefixChars[ch] && ((match = bodyString.match(tlvIdentMatch)) &&
+ tlvIdentifierStyle[match[1]])) {
+ // This line begins scope.
+ // Next line gets indented one level.
+ indented += tlvIndentUnit;
+ // Style the next level of indentation (except non-region keyword identifiers,
+ // which are statements themselves)
+ if (!(ch == "\\" && chPos > 0)) {
+ state.tlvIndentationStyle[depth] = tlvScopePrefixChars[ch];
+ if (tlvTrackStatements) {state.statementComment = false;}
+ depth++;
+ }
+ }
+ }
+ // Clear out deeper indentation levels unless line is blank.
+ if (!blankline) {
+ while (state.tlvIndentationStyle.length > depth) {
+ state.tlvIndentationStyle.pop();
+ }
+ }
}
- state.vxIndentRq = vxIndent;
+ // Set next level of indentation.
+ state.tlvNextIndent = indented;
}
- return style;
- },
- tokenBase: function(stream, state) {
- var vxIndent = 0, style = false;
- var tlvisOperatorChar = /[\[\]=:]/;
- var tlvkpScopePrefixs = {
- "**":"variable-2", "*":"variable-2", "$$":"variable", "$":"variable",
- "^^":"attribute", "^":"attribute"};
- var ch = stream.peek();
- var vxCurCtlFlowCharValueAtStart = state.tlvCurCtlFlowChar;
- if (state.vxCodeActive == true) {
- if (/[\[\]{}\(\);\:]/.test(ch)) {
- // bypass nesting and 1 char punc
- style = "meta";
- stream.next();
- } else if (ch == "/") {
- stream.next();
- if (stream.eat("/")) {
+
+ if (state.tlvCodeActive) {
+ // Highlight as TLV.
+
+ var beginStatement = false;
+ if (tlvTrackStatements) {
+ // This starts a statement if the position is at the scope level
+ // and we're not within a statement leading comment.
+ beginStatement =
+ (stream.peek() != " ") && // not a space
+ (style === undefined) && // not a region identifier
+ !state.tlvInBlockComment && // not in block comment
+ //!stream.match(tlvCommentMatch, false) && // not comment start
+ (stream.column() == state.tlvIndentationStyle.length * tlvIndentUnit); // at scope level
+ if (beginStatement) {
+ if (state.statementComment) {
+ // statement already started by comment
+ beginStatement = false;
+ }
+ state.statementComment =
+ stream.match(tlvCommentMatch, false); // comment start
+ }
+ }
+
+ var match;
+ if (style !== undefined) {
+ // Region line.
+ style += " " + tlvScopeStyle(state, 0, "scope-ident")
+ } else if (((stream.pos / tlvIndentUnit) < state.tlvIndentationStyle.length) &&
+ (match = stream.match(stream.sol() ? tlvFirstLevelIndentMatch : /^ /))) {
+ // Indentation
+ style = // make this style distinct from the previous one to prevent
+ // codemirror from combining spans
+ "tlv-indent-" + (((stream.pos % 2) == 0) ? "even" : "odd") +
+ // and style it
+ " " + tlvScopeStyle(state, stream.pos - tlvIndentUnit, "indent");
+ // Style the line prefix character.
+ if (match[0].charAt(0) == "!") {
+ style += " tlv-alert-line-prefix";
+ }
+ // Place a class before a scope identifier.
+ if (tlvIdentNext(stream)) {
+ style += " " + tlvScopeStyle(state, stream.pos, "before-scope-ident");
+ }
+ } else if (state.tlvInBlockComment) {
+ // In a block comment.
+ if (stream.match(/^.*?\*\//)) {
+ // Exit block comment.
+ state.tlvInBlockComment = false;
+ if (tlvTrackStatements && !stream.eol()) {
+ // Anything after comment is assumed to be real statement content.
+ state.statementComment = false;
+ }
+ } else {
+ stream.skipToEnd();
+ }
+ style = "comment";
+ } else if ((match = stream.match(tlvCommentMatch)) && !state.tlvInBlockComment) {
+ // Start comment.
+ if (match[0] == "//") {
+ // Line comment.
stream.skipToEnd();
- style = "comment";
- state.tlvCurCtlFlowChar = "S";
} else {
- stream.backUp(1);
+ // Block comment.
+ state.tlvInBlockComment = true;
}
- } else if (ch == "@") {
- // pipeline stage
- style = tlvchScopePrefixes[ch];
- state.tlvCurCtlFlowChar = "@";
- stream.next();
- stream.eatWhile(/[\w\$_]/);
- } else if (stream.match(/\b[mM]4+/, true)) { // match: function(pattern, consume, caseInsensitive)
- // m4 pre proc
- stream.skipTo("(");
- style = "def";
- state.tlvCurCtlFlowChar = "M";
- } else if (ch == "!" && stream.sol()) {
- // v stmt in tlv region
- // state.tlvCurCtlFlowChar = "S";
style = "comment";
+ } else if (match = stream.match(tlvIdentMatch)) {
+ // looks like an identifier (or identifier prefix)
+ var prefix = match[1];
+ var mnemonic = match[2];
+ if (// is identifier prefix
+ tlvIdentifierStyle.hasOwnProperty(prefix) &&
+ // has mnemonic or we're at the end of the line (maybe it hasn't been typed yet)
+ (mnemonic.length > 0 || stream.eol())) {
+ style = tlvIdentifierStyle[prefix];
+ if (stream.column() == state.indented) {
+ // Begin scope.
+ style += " " + tlvScopeStyle(state, stream.column(), "scope-ident")
+ }
+ } else {
+ // Just swallow one character and try again.
+ // This enables subsequent identifier match with preceding symbol character, which
+ // is legal within a statement. (Eg, !$reset). It also enables detection of
+ // comment start with preceding symbols.
+ stream.backUp(stream.current().length - 1);
+ style = "tlv-default";
+ }
+ } else if (stream.match(/^\t+/)) {
+ // Highlight tabs, which are illegal.
+ style = "tlv-tab";
+ } else if (stream.match(/^[\[\]{}\(\);\:]+/)) {
+ // [:], (), {}, ;.
+ style = "meta";
+ } else if (match = stream.match(/^[mM]4([\+_])?[\w\d_]*/)) {
+ // m4 pre proc
+ style = (match[1] == "+") ? "tlv-m4-plus" : "tlv-m4";
+ } else if (stream.match(/^ +/)){
+ // Skip over spaces.
+ if (stream.eol()) {
+ // Trailing spaces.
+ style = "error";
+ } else {
+ // Non-trailing spaces.
+ style = "tlv-default";
+ }
+ } else if (stream.match(/^[\w\d_]+/)) {
+ // alpha-numeric token.
+ style = "number";
+ } else {
+ // Eat the next char w/ no formatting.
stream.next();
- } else if (tlvisOperatorChar.test(ch)) {
- // operators
- stream.eatWhile(tlvisOperatorChar);
- style = "operator";
- } else if (ch == "#") {
- // phy hier
- state.tlvCurCtlFlowChar = (state.tlvCurCtlFlowChar == "")
- ? ch : state.tlvCurCtlFlowChar;
- stream.next();
- stream.eatWhile(/[+-]\d/);
- style = "tag";
- } else if (tlvkpScopePrefixs.propertyIsEnumerable(ch)) {
- // special TLV operators
- style = tlvkpScopePrefixs[ch];
- state.tlvCurCtlFlowChar = state.tlvCurCtlFlowChar == "" ? "S" : state.tlvCurCtlFlowChar; // stmt
- stream.next();
- stream.match(/[a-zA-Z_0-9]+/);
- } else if (style = tlvchScopePrefixes[ch] || false) {
- // special TLV operators
- state.tlvCurCtlFlowChar = state.tlvCurCtlFlowChar == "" ? ch : state.tlvCurCtlFlowChar;
- stream.next();
- stream.match(/[a-zA-Z_0-9]+/);
+ style = "tlv-default";
+ }
+ if (beginStatement) {
+ style += " tlv-statement";
}
- if (state.tlvCurCtlFlowChar != vxCurCtlFlowCharValueAtStart) { // flow change
- vxIndent = tlvGenIndent(stream, state);
- state.vxIndentRq = vxIndent;
+ } else {
+ if (stream.match(/^[mM]4([\w\d_]*)/)) {
+ // m4 pre proc
+ style = "tlv-m4";
}
}
return style;
},
- token: function(stream, state) {
- if (state.vxCodeActive == true && stream.sol() && state.tlvCurCtlFlowChar != "") {
- state.tlvPrevPrevCtlFlowChar = state.tlvPrevCtlFlowChar;
- state.tlvPrevCtlFlowChar = state.tlvCurCtlFlowChar;
- state.tlvCurCtlFlowChar = "";
- }
- },
+
indent: function(state) {
- return (state.vxCodeActive == true) ? state.vxIndentRq : -1;
+ return (state.tlvCodeActive == true) ? state.tlvNextIndent : -1;
},
+
startState: function(state) {
- state.tlvCurCtlFlowChar = "";
- state.tlvPrevCtlFlowChar = "";
- state.tlvPrevPrevCtlFlowChar = "";
- state.vxCodeActive = true;
- state.vxIndentRq = 0;
+ state.tlvIndentationStyle = []; // Styles to use for each level of indentation.
+ state.tlvCodeActive = true; // True when we're in a TLV region (and at beginning of file).
+ state.tlvNextIndent = -1; // The number of spaces to autoindent the next line if tlvCodeActive.
+ state.tlvInBlockComment = false; // True inside /**/ comment.
+ if (tlvTrackStatements) {
+ state.statementComment = false; // True inside a statement's header comment.
+ }
}
+
}
});
});
diff --git a/vendor/assets/javascripts/codemirror/modes/vhdl.js b/vendor/assets/javascripts/codemirror/modes/vhdl.js
index 97e086e..133e67a 100644
--- a/vendor/assets/javascripts/codemirror/modes/vhdl.js
+++ b/vendor/assets/javascripts/codemirror/modes/vhdl.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
// Originally written by Alf Nielsen, re-written by Michael Zhou
(function(mod) {
diff --git a/vendor/assets/javascripts/codemirror/modes/vue.js b/vendor/assets/javascripts/codemirror/modes/vue.js
index d89a552..b6e6cc5 100644
--- a/vendor/assets/javascripts/codemirror/modes/vue.js
+++ b/vendor/assets/javascripts/codemirror/modes/vue.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function (mod) {
"use strict";
@@ -12,7 +12,7 @@
require("../css/css"),
require("../sass/sass"),
require("../stylus/stylus"),
- require("../jade/jade"),
+ require("../pug/pug"),
require("../handlebars/handlebars"));
} else if (typeof define === "function" && define.amd) { // AMD
define(["../../lib/codemirror",
@@ -23,7 +23,7 @@
"../css/css",
"../sass/sass",
"../stylus/stylus",
- "../jade/jade",
+ "../pug/pug",
"../handlebars/handlebars"], mod);
} else { // Plain browser env
mod(CodeMirror);
@@ -32,19 +32,26 @@
var tagLanguages = {
script: [
["lang", /coffee(script)?/, "coffeescript"],
- ["type", /^(?:text|application)\/(?:x-)?coffee(?:script)?$/, "coffeescript"]
+ ["type", /^(?:text|application)\/(?:x-)?coffee(?:script)?$/, "coffeescript"],
+ ["lang", /^babel$/, "javascript"],
+ ["type", /^text\/babel$/, "javascript"],
+ ["type", /^text\/ecmascript-\d+$/, "javascript"]
],
style: [
["lang", /^stylus$/i, "stylus"],
["lang", /^sass$/i, "sass"],
+ ["lang", /^less$/i, "text/x-less"],
+ ["lang", /^scss$/i, "text/x-scss"],
["type", /^(text\/)?(x-)?styl(us)?$/i, "stylus"],
- ["type", /^text\/sass/i, "sass"]
+ ["type", /^text\/sass/i, "sass"],
+ ["type", /^(text\/)?(x-)?scss$/i, "text/x-scss"],
+ ["type", /^(text\/)?(x-)?less$/i, "text/x-less"]
],
template: [
["lang", /^vue-template$/i, "vue"],
- ["lang", /^jade$/i, "jade"],
+ ["lang", /^pug$/i, "pug"],
["lang", /^handlebars$/i, "handlebars"],
- ["type", /^(text\/)?(x-)?jade$/i, "jade"],
+ ["type", /^(text\/)?(x-)?pug$/i, "pug"],
["type", /^text\/x-handlebars-template$/i, "handlebars"],
[null, null, "vue-template"]
]
@@ -63,7 +70,8 @@
CodeMirror.defineMode("vue", function (config) {
return CodeMirror.getMode(config, {name: "htmlmixed", tags: tagLanguages});
- }, "htmlmixed", "xml", "javascript", "coffeescript", "css", "sass", "stylus", "jade", "handlebars");
+ }, "htmlmixed", "xml", "javascript", "coffeescript", "css", "sass", "stylus", "pug", "handlebars");
CodeMirror.defineMIME("script/x-vue", "vue");
+ CodeMirror.defineMIME("text/x-vue", "vue");
});
diff --git a/vendor/assets/javascripts/codemirror/modes/webidl.js b/vendor/assets/javascripts/codemirror/modes/webidl.js
index 8143336..120de6b 100644
--- a/vendor/assets/javascripts/codemirror/modes/webidl.js
+++ b/vendor/assets/javascripts/codemirror/modes/webidl.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/xml.js b/vendor/assets/javascripts/codemirror/modes/xml.js
index f987a3a..b67bf85 100644
--- a/vendor/assets/javascripts/codemirror/modes/xml.js
+++ b/vendor/assets/javascripts/codemirror/modes/xml.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -52,6 +52,7 @@ var xmlConfig = {
doNotIndent: {},
allowUnquoted: false,
allowMissing: false,
+ allowMissingTagName: false,
caseFold: false
}
@@ -162,8 +163,9 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
stream.next();
}
return style;
- };
+ }
}
+
function doctype(depth) {
return function(stream, state) {
var ch;
@@ -226,6 +228,9 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
state.tagName = stream.current();
setStyle = "tag";
return attrState;
+ } else if (config.allowMissingTagName && type == "endTag") {
+ setStyle = "tag bracket";
+ return attrState(type, stream, state);
} else {
setStyle = "error";
return tagNameState;
@@ -244,6 +249,9 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
setStyle = "tag error";
return closeStateErr;
}
+ } else if (config.allowMissingTagName && type == "endTag") {
+ setStyle = "tag bracket";
+ return closeState(type, stream, state);
} else {
setStyle = "error";
return closeStateErr;
diff --git a/vendor/assets/javascripts/codemirror/modes/xquery.js b/vendor/assets/javascripts/codemirror/modes/xquery.js
index 75dcbee..395b6a7 100644
--- a/vendor/assets/javascripts/codemirror/modes/xquery.js
+++ b/vendor/assets/javascripts/codemirror/modes/xquery.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -19,41 +19,52 @@ CodeMirror.defineMode("xquery", function() {
var keywords = function(){
// convenience functions used to build keywords object
function kw(type) {return {type: type, style: "keyword"};}
- var A = kw("keyword a")
- , B = kw("keyword b")
- , C = kw("keyword c")
- , operator = kw("operator")
+ var operator = kw("operator")
, atom = {type: "atom", style: "atom"}
, punctuation = {type: "punctuation", style: null}
, qualifier = {type: "axis_specifier", style: "qualifier"};
// kwObj is what is return from this function at the end
var kwObj = {
- 'if': A, 'switch': A, 'while': A, 'for': A,
- 'else': B, 'then': B, 'try': B, 'finally': B, 'catch': B,
- 'element': C, 'attribute': C, 'let': C, 'implements': C, 'import': C, 'module': C, 'namespace': C,
- 'return': C, 'super': C, 'this': C, 'throws': C, 'where': C, 'private': C,
- ',': punctuation,
- 'null': atom, 'fn:false()': atom, 'fn:true()': atom
+ ',': punctuation
};
// a list of 'basic' keywords. For each add a property to kwObj with the value of
// {type: basic[i], style: "keyword"} e.g. 'after' --> {type: "after", style: "keyword"}
- var basic = ['after','ancestor','ancestor-or-self','and','as','ascending','assert','attribute','before',
- 'by','case','cast','child','comment','declare','default','define','descendant','descendant-or-self',
- 'descending','document','document-node','element','else','eq','every','except','external','following',
- 'following-sibling','follows','for','function','if','import','in','instance','intersect','item',
- 'let','module','namespace','node','node','of','only','or','order','parent','precedes','preceding',
- 'preceding-sibling','processing-instruction','ref','return','returns','satisfies','schema','schema-element',
- 'self','some','sortby','stable','text','then','to','treat','typeswitch','union','variable','version','where',
- 'xquery', 'empty-sequence'];
+ var basic = ['after', 'all', 'allowing', 'ancestor', 'ancestor-or-self', 'any', 'array', 'as',
+ 'ascending', 'at', 'attribute', 'base-uri', 'before', 'boundary-space', 'by', 'case', 'cast',
+ 'castable', 'catch', 'child', 'collation', 'comment', 'construction', 'contains', 'content',
+ 'context', 'copy', 'copy-namespaces', 'count', 'decimal-format', 'declare', 'default', 'delete',
+ 'descendant', 'descendant-or-self', 'descending', 'diacritics', 'different', 'distance',
+ 'document', 'document-node', 'element', 'else', 'empty', 'empty-sequence', 'encoding', 'end',
+ 'entire', 'every', 'exactly', 'except', 'external', 'first', 'following', 'following-sibling',
+ 'for', 'from', 'ftand', 'ftnot', 'ft-option', 'ftor', 'function', 'fuzzy', 'greatest', 'group',
+ 'if', 'import', 'in', 'inherit', 'insensitive', 'insert', 'instance', 'intersect', 'into',
+ 'invoke', 'is', 'item', 'language', 'last', 'lax', 'least', 'let', 'levels', 'lowercase', 'map',
+ 'modify', 'module', 'most', 'namespace', 'next', 'no', 'node', 'nodes', 'no-inherit',
+ 'no-preserve', 'not', 'occurs', 'of', 'only', 'option', 'order', 'ordered', 'ordering',
+ 'paragraph', 'paragraphs', 'parent', 'phrase', 'preceding', 'preceding-sibling', 'preserve',
+ 'previous', 'processing-instruction', 'relationship', 'rename', 'replace', 'return',
+ 'revalidation', 'same', 'satisfies', 'schema', 'schema-attribute', 'schema-element', 'score',
+ 'self', 'sensitive', 'sentence', 'sentences', 'sequence', 'skip', 'sliding', 'some', 'stable',
+ 'start', 'stemming', 'stop', 'strict', 'strip', 'switch', 'text', 'then', 'thesaurus', 'times',
+ 'to', 'transform', 'treat', 'try', 'tumbling', 'type', 'typeswitch', 'union', 'unordered',
+ 'update', 'updating', 'uppercase', 'using', 'validate', 'value', 'variable', 'version',
+ 'weight', 'when', 'where', 'wildcards', 'window', 'with', 'without', 'word', 'words', 'xquery'];
for(var i=0, l=basic.length; i < l; i++) { kwObj[basic[i]] = kw(basic[i]);};
// a list of types. For each add a property to kwObj with the value of
// {type: "atom", style: "atom"}
- var types = ['xs:string', 'xs:float', 'xs:decimal', 'xs:double', 'xs:integer', 'xs:boolean', 'xs:date', 'xs:dateTime',
- 'xs:time', 'xs:duration', 'xs:dayTimeDuration', 'xs:time', 'xs:yearMonthDuration', 'numeric', 'xs:hexBinary',
- 'xs:base64Binary', 'xs:anyURI', 'xs:QName', 'xs:byte','xs:boolean','xs:anyURI','xf:yearMonthDuration'];
+ var types = ['xs:anyAtomicType', 'xs:anySimpleType', 'xs:anyType', 'xs:anyURI',
+ 'xs:base64Binary', 'xs:boolean', 'xs:byte', 'xs:date', 'xs:dateTime', 'xs:dateTimeStamp',
+ 'xs:dayTimeDuration', 'xs:decimal', 'xs:double', 'xs:duration', 'xs:ENTITIES', 'xs:ENTITY',
+ 'xs:float', 'xs:gDay', 'xs:gMonth', 'xs:gMonthDay', 'xs:gYear', 'xs:gYearMonth', 'xs:hexBinary',
+ 'xs:ID', 'xs:IDREF', 'xs:IDREFS', 'xs:int', 'xs:integer', 'xs:item', 'xs:java', 'xs:language',
+ 'xs:long', 'xs:Name', 'xs:NCName', 'xs:negativeInteger', 'xs:NMTOKEN', 'xs:NMTOKENS',
+ 'xs:nonNegativeInteger', 'xs:nonPositiveInteger', 'xs:normalizedString', 'xs:NOTATION',
+ 'xs:numeric', 'xs:positiveInteger', 'xs:precisionDecimal', 'xs:QName', 'xs:short', 'xs:string',
+ 'xs:time', 'xs:token', 'xs:unsignedByte', 'xs:unsignedInt', 'xs:unsignedLong',
+ 'xs:unsignedShort', 'xs:untyped', 'xs:untypedAtomic', 'xs:yearMonthDuration'];
for(var i=0, l=types.length; i < l; i++) { kwObj[types[i]] = atom;};
// each operator will add a property to kwObj with value of {type: "operator", style: "keyword"}
@@ -102,7 +113,7 @@ CodeMirror.defineMode("xquery", function() {
}
// start code block
else if(ch == "{") {
- pushStateStack(state,{ type: "codeblock"});
+ pushStateStack(state, { type: "codeblock"});
return null;
}
// end code block
@@ -132,7 +143,7 @@ CodeMirror.defineMode("xquery", function() {
return chain(stream, state, tokenComment);
}
// quoted string
- else if ( !isEQName && (ch === '"' || ch === "'"))
+ else if (!isEQName && (ch === '"' || ch === "'"))
return chain(stream, state, tokenString(ch));
// variable
else if(ch === "$") {
diff --git a/vendor/assets/javascripts/codemirror/modes/yacas.js b/vendor/assets/javascripts/codemirror/modes/yacas.js
index 30bd60b..b7ac96b 100644
--- a/vendor/assets/javascripts/codemirror/modes/yacas.js
+++ b/vendor/assets/javascripts/codemirror/modes/yacas.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
// Yacas mode copyright (c) 2015 by Grzegorz Mazur
// Loosely based on mathematica mode by Calin Barbat
@@ -125,7 +125,7 @@ CodeMirror.defineMode('yacas', function(_config, _parserConfig) {
}
// operators; note that operators like @@ or /; are matched separately for each symbol.
- if (stream.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/, true, false)) {
+ if (stream.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%|#)/, true, false)) {
return 'operator';
}
diff --git a/vendor/assets/javascripts/codemirror/modes/yaml-frontmatter.js b/vendor/assets/javascripts/codemirror/modes/yaml-frontmatter.js
index 5f49772..e9faefc 100644
--- a/vendor/assets/javascripts/codemirror/modes/yaml-frontmatter.js
+++ b/vendor/assets/javascripts/codemirror/modes/yaml-frontmatter.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function (mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/javascripts/codemirror/modes/yaml.js b/vendor/assets/javascripts/codemirror/modes/yaml.js
index b7015e5..a29d7ea 100644
--- a/vendor/assets/javascripts/codemirror/modes/yaml.js
+++ b/vendor/assets/javascripts/codemirror/modes/yaml.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -108,10 +108,13 @@ CodeMirror.defineMode("yaml", function() {
literal: false,
escaped: false
};
- }
+ },
+ lineComment: "#",
+ fold: "indent"
};
});
CodeMirror.defineMIME("text/x-yaml", "yaml");
+CodeMirror.defineMIME("text/yaml", "yaml");
});
diff --git a/vendor/assets/javascripts/codemirror/modes/z80.js b/vendor/assets/javascripts/codemirror/modes/z80.js
index aae7021..8cea4ff 100644
--- a/vendor/assets/javascripts/codemirror/modes/z80.js
+++ b/vendor/assets/javascripts/codemirror/modes/z80.js
@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
diff --git a/vendor/assets/stylesheets/codemirror.css b/vendor/assets/stylesheets/codemirror.css
index 18b0bf7..c7a8ae7 100644
--- a/vendor/assets/stylesheets/codemirror.css
+++ b/vendor/assets/stylesheets/codemirror.css
@@ -5,6 +5,7 @@
font-family: monospace;
height: 300px;
color: black;
+ direction: ltr;
}
/* PADDING */
@@ -58,7 +59,12 @@
.cm-fat-cursor div.CodeMirror-cursors {
z-index: 1;
}
-
+.cm-fat-cursor-mark {
+ background-color: rgba(20, 255, 20, 0.5);
+ -webkit-animation: blink 1.06s steps(1) infinite;
+ -moz-animation: blink 1.06s steps(1) infinite;
+ animation: blink 1.06s steps(1) infinite;
+}
.cm-animate-fat-cursor {
width: auto;
border: 0;
@@ -119,7 +125,7 @@
.cm-s-default .cm-property,
.cm-s-default .cm-operator {}
.cm-s-default .cm-variable-2 {color: #05a;}
-.cm-s-default .cm-variable-3 {color: #085;}
+.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}
.cm-s-default .cm-comment {color: #a50;}
.cm-s-default .cm-string {color: #a11;}
.cm-s-default .cm-string-2 {color: #f50;}
@@ -139,8 +145,8 @@
/* Default styles for common addons */
-div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
-div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
+div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}
+div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
.CodeMirror-activeline-background {background: #e8f2ff;}
@@ -206,9 +212,6 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
display: inline-block;
vertical-align: top;
margin-bottom: -30px;
- /* Hack to make IE7 behave */
- *zoom:1;
- *display:inline;
}
.CodeMirror-gutter-wrapper {
position: absolute;
@@ -226,11 +229,8 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
cursor: default;
z-index: 4;
}
-.CodeMirror-gutter-wrapper {
- -webkit-user-select: none;
- -moz-user-select: none;
- user-select: none;
-}
+.CodeMirror-gutter-wrapper ::selection { background-color: transparent }
+.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
.CodeMirror-lines {
cursor: text;
@@ -252,8 +252,8 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
position: relative;
overflow: visible;
-webkit-tap-highlight-color: transparent;
- -webkit-font-variant-ligatures: none;
- font-variant-ligatures: none;
+ -webkit-font-variant-ligatures: contextual;
+ font-variant-ligatures: contextual;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
@@ -270,11 +270,13 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
.CodeMirror-linewidget {
position: relative;
z-index: 2;
- overflow: auto;
+ padding: 0.1px; /* Force widget margins to stay inside of the container */
}
.CodeMirror-widget {}
+.CodeMirror-rtl pre { direction: rtl; }
+
.CodeMirror-code {
outline: none;
}
@@ -323,13 +325,10 @@ div.CodeMirror-dragcursors {
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
.cm-searching {
- background: #ffa;
- background: rgba(255, 255, 0, .4);
+ background-color: #ffa;
+ background-color: rgba(255, 255, 0, .4);
}
-/* IE7 hack to prevent it from returning funny offsetTops on the spans */
-.CodeMirror span { *vertical-align: text-bottom; }
-
/* Used to force a border model for a node */
.cm-force-border { padding-right: .1px; }
diff --git a/vendor/assets/stylesheets/codemirror/addons/hint/show-hint.css b/vendor/assets/stylesheets/codemirror/addons/hint/show-hint.css
index 453dee4..5617ccc 100644
--- a/vendor/assets/stylesheets/codemirror/addons/hint/show-hint.css
+++ b/vendor/assets/stylesheets/codemirror/addons/hint/show-hint.css
@@ -16,7 +16,6 @@
background: white;
font-size: 90%;
font-family: monospace;
- max-width: 19em;
max-height: 20em;
overflow-y: auto;
diff --git a/vendor/assets/stylesheets/codemirror/addons/merge/merge.css b/vendor/assets/stylesheets/codemirror/addons/merge/merge.css
index bda3d9f..dadd7f5 100644
--- a/vendor/assets/stylesheets/codemirror/addons/merge/merge.css
+++ b/vendor/assets/stylesheets/codemirror/addons/merge/merge.css
@@ -48,6 +48,12 @@
color: #555;
line-height: 1;
}
+.CodeMirror-merge-scrolllock:after {
+ content: "\21db\00a0\00a0\21da";
+}
+.CodeMirror-merge-scrolllock.CodeMirror-merge-scrolllock-enabled:after {
+ content: "\21db\21da";
+}
.CodeMirror-merge-copybuttons-left, .CodeMirror-merge-copybuttons-right {
position: absolute;
diff --git a/vendor/assets/stylesheets/codemirror/themes/abcdef.css b/vendor/assets/stylesheets/codemirror/themes/abcdef.css
index 7f9d788..cf93530 100644
--- a/vendor/assets/stylesheets/codemirror/themes/abcdef.css
+++ b/vendor/assets/stylesheets/codemirror/themes/abcdef.css
@@ -14,7 +14,7 @@
.cm-s-abcdef span.cm-def { color: #fffabc; }
.cm-s-abcdef span.cm-variable { color: #abcdef; }
.cm-s-abcdef span.cm-variable-2 { color: #cacbcc; }
-.cm-s-abcdef span.cm-variable-3 { color: #def; }
+.cm-s-abcdef span.cm-variable-3, .cm-s-abcdef span.cm-type { color: #def; }
.cm-s-abcdef span.cm-property { color: #fedcba; }
.cm-s-abcdef span.cm-operator { color: #ff0; }
.cm-s-abcdef span.cm-comment { color: #7a7b7c; font-style: italic;}
diff --git a/vendor/assets/stylesheets/codemirror/themes/ambiance.css b/vendor/assets/stylesheets/codemirror/themes/ambiance.css
index bce3446..782fca4 100644
--- a/vendor/assets/stylesheets/codemirror/themes/ambiance.css
+++ b/vendor/assets/stylesheets/codemirror/themes/ambiance.css
@@ -11,7 +11,7 @@
.cm-s-ambiance .cm-def { color: #aac6e3; }
.cm-s-ambiance .cm-variable { color: #ffb795; }
.cm-s-ambiance .cm-variable-2 { color: #eed1b3; }
-.cm-s-ambiance .cm-variable-3 { color: #faded3; }
+.cm-s-ambiance .cm-variable-3, .cm-s-ambiance .cm-type { color: #faded3; }
.cm-s-ambiance .cm-property { color: #eed1b3; }
.cm-s-ambiance .cm-operator { color: #fa8d6a; }
.cm-s-ambiance .cm-comment { color: #555; font-style:italic; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/base16-light.css b/vendor/assets/stylesheets/codemirror/themes/base16-light.css
index 474e0ca..1d5f582 100644
--- a/vendor/assets/stylesheets/codemirror/themes/base16-light.css
+++ b/vendor/assets/stylesheets/codemirror/themes/base16-light.css
@@ -35,4 +35,4 @@
.cm-s-base16-light span.cm-error { background: #ac4142; color: #505050; }
.cm-s-base16-light .CodeMirror-activeline-background { background: #DDDCDC; }
-.cm-s-base16-light .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; }
+.cm-s-base16-light .CodeMirror-matchingbracket { color: #f5f5f5 !important; background-color: #6A9FB5 !important}
diff --git a/vendor/assets/stylesheets/codemirror/themes/cobalt.css b/vendor/assets/stylesheets/codemirror/themes/cobalt.css
index d88223e..bbbda3b 100644
--- a/vendor/assets/stylesheets/codemirror/themes/cobalt.css
+++ b/vendor/assets/stylesheets/codemirror/themes/cobalt.css
@@ -15,7 +15,7 @@
.cm-s-cobalt span.cm-string { color: #3ad900; }
.cm-s-cobalt span.cm-meta { color: #ff9d00; }
.cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; }
-.cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; }
+.cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def, .cm-s-cobalt .cm-type { color: white; }
.cm-s-cobalt span.cm-bracket { color: #d8d8d8; }
.cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; }
.cm-s-cobalt span.cm-link { color: #845dc4; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/colorforth.css b/vendor/assets/stylesheets/codemirror/themes/colorforth.css
index 606899f..19095e4 100644
--- a/vendor/assets/stylesheets/codemirror/themes/colorforth.css
+++ b/vendor/assets/stylesheets/codemirror/themes/colorforth.css
@@ -15,7 +15,7 @@
.cm-s-colorforth span.cm-atom { color: #606060; }
.cm-s-colorforth span.cm-variable-2 { color: #EEE; }
-.cm-s-colorforth span.cm-variable-3 { color: #DDD; }
+.cm-s-colorforth span.cm-variable-3, .cm-s-colorforth span.cm-type { color: #DDD; }
.cm-s-colorforth span.cm-property {}
.cm-s-colorforth span.cm-operator {}
diff --git a/vendor/assets/stylesheets/codemirror/themes/darcula.css b/vendor/assets/stylesheets/codemirror/themes/darcula.css
new file mode 100644
index 0000000..d4a0b53
--- /dev/null
+++ b/vendor/assets/stylesheets/codemirror/themes/darcula.css
@@ -0,0 +1,51 @@
+/**
+ Name: IntelliJ IDEA darcula theme
+ From IntelliJ IDEA by JetBrains
+ */
+
+.cm-s-darcula { font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;}
+.cm-s-darcula.CodeMirror { background: #2B2B2B; color: #A9B7C6; }
+
+.cm-s-darcula span.cm-meta { color: #BBB529; }
+.cm-s-darcula span.cm-number { color: #6897BB; }
+.cm-s-darcula span.cm-keyword { color: #CC7832; line-height: 1em; font-weight: bold; }
+.cm-s-darcula span.cm-def { color: #A9B7C6; font-style: italic; }
+.cm-s-darcula span.cm-variable { color: #A9B7C6; }
+.cm-s-darcula span.cm-variable-2 { color: #A9B7C6; }
+.cm-s-darcula span.cm-variable-3 { color: #9876AA; }
+.cm-s-darcula span.cm-type { color: #AABBCC; font-weight: bold; }
+.cm-s-darcula span.cm-property { color: #FFC66D; }
+.cm-s-darcula span.cm-operator { color: #A9B7C6; }
+.cm-s-darcula span.cm-string { color: #6A8759; }
+.cm-s-darcula span.cm-string-2 { color: #6A8759; }
+.cm-s-darcula span.cm-comment { color: #61A151; font-style: italic; }
+.cm-s-darcula span.cm-link { color: #CC7832; }
+.cm-s-darcula span.cm-atom { color: #CC7832; }
+.cm-s-darcula span.cm-error { color: #BC3F3C; }
+.cm-s-darcula span.cm-tag { color: #629755; font-weight: bold; font-style: italic; text-decoration: underline; }
+.cm-s-darcula span.cm-attribute { color: #6897bb; }
+.cm-s-darcula span.cm-qualifier { color: #6A8759; }
+.cm-s-darcula span.cm-bracket { color: #A9B7C6; }
+.cm-s-darcula span.cm-builtin { color: #FF9E59; }
+.cm-s-darcula span.cm-special { color: #FF9E59; }
+
+.cm-s-darcula .CodeMirror-cursor { border-left: 1px solid #A9B7C6; }
+.cm-s-darcula .CodeMirror-activeline-background { background: #323232; }
+.cm-s-darcula .CodeMirror-gutters { background: #313335; border-right: 1px solid #313335; }
+.cm-s-darcula .CodeMirror-guttermarker { color: #FFEE80; }
+.cm-s-darcula .CodeMirror-guttermarker-subtle { color: #D0D0D0; }
+.cm-s-darcula .CodeMirrir-linenumber { color: #606366; }
+.cm-s-darcula .CodeMirror-matchingbracket { background-color: #3B514D; color: #FFEF28 !important; font-weight: bold; }
+
+.cm-s-darcula div.CodeMirror-selected { background: #214283; }
+
+.CodeMirror-hints.darcula {
+ font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
+ color: #9C9E9E;
+ background-color: #3B3E3F !important;
+}
+
+.CodeMirror-hints.darcula .CodeMirror-hint-active {
+ background-color: #494D4E !important;
+ color: #9C9E9E !important;
+}
diff --git a/vendor/assets/stylesheets/codemirror/themes/dracula.css b/vendor/assets/stylesheets/codemirror/themes/dracula.css
index 57f979a..253133e 100644
--- a/vendor/assets/stylesheets/codemirror/themes/dracula.css
+++ b/vendor/assets/stylesheets/codemirror/themes/dracula.css
@@ -16,7 +16,7 @@
.cm-s-dracula .CodeMirror-gutters { color: #282a36; }
.cm-s-dracula .CodeMirror-cursor { border-left: solid thin #f8f8f0; }
.cm-s-dracula .CodeMirror-linenumber { color: #6D8A88; }
-.cm-s-dracula.CodeMirror-focused div.CodeMirror-selected { background: rgba(255, 255, 255, 0.10); }
+.cm-s-dracula .CodeMirror-selected { background: rgba(255, 255, 255, 0.10); }
.cm-s-dracula .CodeMirror-line::selection, .cm-s-dracula .CodeMirror-line > span::selection, .cm-s-dracula .CodeMirror-line > span > span::selection { background: rgba(255, 255, 255, 0.10); }
.cm-s-dracula .CodeMirror-line::-moz-selection, .cm-s-dracula .CodeMirror-line > span::-moz-selection, .cm-s-dracula .CodeMirror-line > span > span::-moz-selection { background: rgba(255, 255, 255, 0.10); }
.cm-s-dracula span.cm-comment { color: #6272a4; }
@@ -24,8 +24,7 @@
.cm-s-dracula span.cm-number { color: #bd93f9; }
.cm-s-dracula span.cm-variable { color: #50fa7b; }
.cm-s-dracula span.cm-variable-2 { color: white; }
-.cm-s-dracula span.cm-def { color: #ffb86c; }
-.cm-s-dracula span.cm-keyword { color: #ff79c6; }
+.cm-s-dracula span.cm-def { color: #50fa7b; }
.cm-s-dracula span.cm-operator { color: #ff79c6; }
.cm-s-dracula span.cm-keyword { color: #ff79c6; }
.cm-s-dracula span.cm-atom { color: #bd93f9; }
@@ -35,7 +34,7 @@
.cm-s-dracula span.cm-qualifier { color: #50fa7b; }
.cm-s-dracula span.cm-property { color: #66d9ef; }
.cm-s-dracula span.cm-builtin { color: #50fa7b; }
-.cm-s-dracula span.cm-variable-3 { color: #50fa7b; }
+.cm-s-dracula span.cm-variable-3, .cm-s-dracula span.cm-type { color: #ffb86c; }
.cm-s-dracula .CodeMirror-activeline-background { background: rgba(255,255,255,0.1); }
.cm-s-dracula .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/duotone-dark.css b/vendor/assets/stylesheets/codemirror/themes/duotone-dark.css
new file mode 100644
index 0000000..88fdc76
--- /dev/null
+++ b/vendor/assets/stylesheets/codemirror/themes/duotone-dark.css
@@ -0,0 +1,35 @@
+/*
+Name: DuoTone-Dark
+Author: by Bram de Haan, adapted from DuoTone themes by Simurai (http://simurai.com/projects/2016/01/01/duotone-themes)
+
+CodeMirror template by Jan T. Sott (https://github.com/idleberg), adapted by Bram de Haan (https://github.com/atelierbram/)
+*/
+
+.cm-s-duotone-dark.CodeMirror { background: #2a2734; color: #6c6783; }
+.cm-s-duotone-dark div.CodeMirror-selected { background: #545167!important; }
+.cm-s-duotone-dark .CodeMirror-gutters { background: #2a2734; border-right: 0px; }
+.cm-s-duotone-dark .CodeMirror-linenumber { color: #545167; }
+
+/* begin cursor */
+.cm-s-duotone-dark .CodeMirror-cursor { border-left: 1px solid #ffad5c; /* border-left: 1px solid #ffad5c80; */ border-right: .5em solid #ffad5c; /* border-right: .5em solid #ffad5c80; */ opacity: .5; }
+.cm-s-duotone-dark .CodeMirror-activeline-background { background: #363342; /* background: #36334280; */ opacity: .5;}
+.cm-s-duotone-dark .cm-fat-cursor .CodeMirror-cursor { background: #ffad5c; /* background: #ffad5c80; */ opacity: .5;}
+/* end cursor */
+
+.cm-s-duotone-dark span.cm-atom, .cm-s-duotone-dark span.cm-number, .cm-s-duotone-dark span.cm-keyword, .cm-s-duotone-dark span.cm-variable, .cm-s-duotone-dark span.cm-attribute, .cm-s-duotone-dark span.cm-quote, .cm-s-duotone-dark span.cm-hr, .cm-s-duotone-dark span.cm-link { color: #ffcc99; }
+
+.cm-s-duotone-dark span.cm-property { color: #9a86fd; }
+.cm-s-duotone-dark span.cm-punctuation, .cm-s-duotone-dark span.cm-unit, .cm-s-duotone-dark span.cm-negative { color: #e09142; }
+.cm-s-duotone-dark span.cm-string { color: #ffb870; }
+.cm-s-duotone-dark span.cm-operator { color: #ffad5c; }
+.cm-s-duotone-dark span.cm-positive { color: #6a51e6; }
+
+.cm-s-duotone-dark span.cm-variable-2, .cm-s-duotone-dark span.cm-variable-3, .cm-s-duotone-dark span.cm-type, .cm-s-duotone-dark span.cm-string-2, .cm-s-duotone-dark span.cm-url { color: #7a63ee; }
+.cm-s-duotone-dark span.cm-def, .cm-s-duotone-dark span.cm-tag, .cm-s-duotone-dark span.cm-builtin, .cm-s-duotone-dark span.cm-qualifier, .cm-s-duotone-dark span.cm-header, .cm-s-duotone-dark span.cm-em { color: #eeebff; }
+.cm-s-duotone-dark span.cm-bracket, .cm-s-duotone-dark span.cm-comment { color: #6c6783; }
+
+/* using #f00 red for errors, don't think any of the colorscheme variables will stand out enough, ... maybe by giving it a background-color ... */
+.cm-s-duotone-dark span.cm-error, .cm-s-duotone-dark span.cm-invalidchar { color: #f00; }
+
+.cm-s-duotone-dark span.cm-header { font-weight: normal; }
+.cm-s-duotone-dark .CodeMirror-matchingbracket { text-decoration: underline; color: #eeebff !important; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/duotone-light.css b/vendor/assets/stylesheets/codemirror/themes/duotone-light.css
new file mode 100644
index 0000000..d99480f
--- /dev/null
+++ b/vendor/assets/stylesheets/codemirror/themes/duotone-light.css
@@ -0,0 +1,36 @@
+/*
+Name: DuoTone-Light
+Author: by Bram de Haan, adapted from DuoTone themes by Simurai (http://simurai.com/projects/2016/01/01/duotone-themes)
+
+CodeMirror template by Jan T. Sott (https://github.com/idleberg), adapted by Bram de Haan (https://github.com/atelierbram/)
+*/
+
+.cm-s-duotone-light.CodeMirror { background: #faf8f5; color: #b29762; }
+.cm-s-duotone-light div.CodeMirror-selected { background: #e3dcce !important; }
+.cm-s-duotone-light .CodeMirror-gutters { background: #faf8f5; border-right: 0px; }
+.cm-s-duotone-light .CodeMirror-linenumber { color: #cdc4b1; }
+
+/* begin cursor */
+.cm-s-duotone-light .CodeMirror-cursor { border-left: 1px solid #93abdc; /* border-left: 1px solid #93abdc80; */ border-right: .5em solid #93abdc; /* border-right: .5em solid #93abdc80; */ opacity: .5; }
+.cm-s-duotone-light .CodeMirror-activeline-background { background: #e3dcce; /* background: #e3dcce80; */ opacity: .5; }
+.cm-s-duotone-light .cm-fat-cursor .CodeMirror-cursor { background: #93abdc; /* #93abdc80; */ opacity: .5; }
+/* end cursor */
+
+.cm-s-duotone-light span.cm-atom, .cm-s-duotone-light span.cm-number, .cm-s-duotone-light span.cm-keyword, .cm-s-duotone-light span.cm-variable, .cm-s-duotone-light span.cm-attribute, .cm-s-duotone-light span.cm-quote, .cm-s-duotone-light-light span.cm-hr, .cm-s-duotone-light-light span.cm-link { color: #063289; }
+
+.cm-s-duotone-light span.cm-property { color: #b29762; }
+.cm-s-duotone-light span.cm-punctuation, .cm-s-duotone-light span.cm-unit, .cm-s-duotone-light span.cm-negative { color: #063289; }
+.cm-s-duotone-light span.cm-string, .cm-s-duotone-light span.cm-operator { color: #1659df; }
+.cm-s-duotone-light span.cm-positive { color: #896724; }
+
+.cm-s-duotone-light span.cm-variable-2, .cm-s-duotone-light span.cm-variable-3, .cm-s-duotone-light span.cm-type, .cm-s-duotone-light span.cm-string-2, .cm-s-duotone-light span.cm-url { color: #896724; }
+.cm-s-duotone-light span.cm-def, .cm-s-duotone-light span.cm-tag, .cm-s-duotone-light span.cm-builtin, .cm-s-duotone-light span.cm-qualifier, .cm-s-duotone-light span.cm-header, .cm-s-duotone-light span.cm-em { color: #2d2006; }
+.cm-s-duotone-light span.cm-bracket, .cm-s-duotone-light span.cm-comment { color: #b6ad9a; }
+
+/* using #f00 red for errors, don't think any of the colorscheme variables will stand out enough, ... maybe by giving it a background-color ... */
+/* .cm-s-duotone-light span.cm-error { background: #896724; color: #728fcb; } */
+.cm-s-duotone-light span.cm-error, .cm-s-duotone-light span.cm-invalidchar { color: #f00; }
+
+.cm-s-duotone-light span.cm-header { font-weight: normal; }
+.cm-s-duotone-light .CodeMirror-matchingbracket { text-decoration: underline; color: #faf8f5 !important; }
+
diff --git a/vendor/assets/stylesheets/codemirror/themes/eclipse.css b/vendor/assets/stylesheets/codemirror/themes/eclipse.css
index 1bde460..800d603 100644
--- a/vendor/assets/stylesheets/codemirror/themes/eclipse.css
+++ b/vendor/assets/stylesheets/codemirror/themes/eclipse.css
@@ -5,7 +5,7 @@
.cm-s-eclipse span.cm-def { color: #00f; }
.cm-s-eclipse span.cm-variable { color: black; }
.cm-s-eclipse span.cm-variable-2 { color: #0000C0; }
-.cm-s-eclipse span.cm-variable-3 { color: #0000C0; }
+.cm-s-eclipse span.cm-variable-3, .cm-s-eclipse span.cm-type { color: #0000C0; }
.cm-s-eclipse span.cm-property { color: black; }
.cm-s-eclipse span.cm-operator { color: black; }
.cm-s-eclipse span.cm-comment { color: #3F7F5F; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/erlang-dark.css b/vendor/assets/stylesheets/codemirror/themes/erlang-dark.css
index 65fe481..8c8a417 100644
--- a/vendor/assets/stylesheets/codemirror/themes/erlang-dark.css
+++ b/vendor/assets/stylesheets/codemirror/themes/erlang-dark.css
@@ -27,7 +27,7 @@
.cm-s-erlang-dark span.cm-tag { color: #9effff; }
.cm-s-erlang-dark span.cm-variable { color: #50fe50; }
.cm-s-erlang-dark span.cm-variable-2 { color: #e0e; }
-.cm-s-erlang-dark span.cm-variable-3 { color: #ccc; }
+.cm-s-erlang-dark span.cm-variable-3, .cm-s-erlang-dark span.cm-type { color: #ccc; }
.cm-s-erlang-dark span.cm-error { color: #9d1e15; }
.cm-s-erlang-dark .CodeMirror-activeline-background { background: #013461; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/gruvbox-dark.css b/vendor/assets/stylesheets/codemirror/themes/gruvbox-dark.css
new file mode 100644
index 0000000..ded215f
--- /dev/null
+++ b/vendor/assets/stylesheets/codemirror/themes/gruvbox-dark.css
@@ -0,0 +1,37 @@
+/*
+
+ Name: gruvbox-dark
+ Author: kRkk (https://github.com/krkk)
+
+ Original gruvbox color scheme by Pavel Pertsev (https://github.com/morhetz/gruvbox)
+
+*/
+
+.cm-s-gruvbox-dark.CodeMirror, .cm-s-gruvbox-dark .CodeMirror-gutters { background-color: #282828; color: #bdae93; }
+.cm-s-gruvbox-dark .CodeMirror-gutters {background: #282828; border-right: 0px;}
+.cm-s-gruvbox-dark .CodeMirror-linenumber {color: #7c6f64;}
+.cm-s-gruvbox-dark .CodeMirror-cursor { border-left: 1px solid #ebdbb2; }
+.cm-s-gruvbox-dark div.CodeMirror-selected { background: #928374; }
+.cm-s-gruvbox-dark span.cm-meta { color: #83a598; }
+
+.cm-s-gruvbox-dark span.cm-comment { color: #928374; }
+.cm-s-gruvbox-dark span.cm-number, span.cm-atom { color: #d3869b; }
+.cm-s-gruvbox-dark span.cm-keyword { color: #f84934; }
+
+.cm-s-gruvbox-dark span.cm-variable { color: #ebdbb2; }
+.cm-s-gruvbox-dark span.cm-variable-2 { color: #ebdbb2; }
+.cm-s-gruvbox-dark span.cm-variable-3, .cm-s-gruvbox-dark span.cm-type { color: #fabd2f; }
+.cm-s-gruvbox-dark span.cm-operator { color: #ebdbb2; }
+.cm-s-gruvbox-dark span.cm-callee { color: #ebdbb2; }
+.cm-s-gruvbox-dark span.cm-def { color: #ebdbb2; }
+.cm-s-gruvbox-dark span.cm-property { color: #ebdbb2; }
+.cm-s-gruvbox-dark span.cm-string { color: #b8bb26; }
+.cm-s-gruvbox-dark span.cm-string-2 { color: #8ec07c; }
+.cm-s-gruvbox-dark span.cm-qualifier { color: #8ec07c; }
+.cm-s-gruvbox-dark span.cm-attribute { color: #8ec07c; }
+
+.cm-s-gruvbox-dark .CodeMirror-activeline-background { background: #3c3836; }
+.cm-s-gruvbox-dark .CodeMirror-matchingbracket { background: #928374; color:#282828 !important; }
+
+.cm-s-gruvbox-dark span.cm-builtin { color: #fe8019; }
+.cm-s-gruvbox-dark span.cm-tag { color: #fe8019; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/icecoder.css b/vendor/assets/stylesheets/codemirror/themes/icecoder.css
index ffebaf2..5440fbe 100644
--- a/vendor/assets/stylesheets/codemirror/themes/icecoder.css
+++ b/vendor/assets/stylesheets/codemirror/themes/icecoder.css
@@ -11,7 +11,7 @@ ICEcoder default theme by Matt Pass, used in code editor available at https://ic
.cm-s-icecoder span.cm-variable { color: #6cb5d9; } /* blue */
.cm-s-icecoder span.cm-variable-2 { color: #cc1e5c; } /* pink */
-.cm-s-icecoder span.cm-variable-3 { color: #f9602c; } /* orange */
+.cm-s-icecoder span.cm-variable-3, .cm-s-icecoder span.cm-type { color: #f9602c; } /* orange */
.cm-s-icecoder span.cm-property { color: #eee; } /* off-white 1 */
.cm-s-icecoder span.cm-operator { color: #9179bb; } /* purple */
diff --git a/vendor/assets/stylesheets/codemirror/themes/idea.css b/vendor/assets/stylesheets/codemirror/themes/idea.css
new file mode 100644
index 0000000..eab3671
--- /dev/null
+++ b/vendor/assets/stylesheets/codemirror/themes/idea.css
@@ -0,0 +1,42 @@
+/**
+ Name: IDEA default theme
+ From IntelliJ IDEA by JetBrains
+ */
+
+.cm-s-idea span.cm-meta { color: #808000; }
+.cm-s-idea span.cm-number { color: #0000FF; }
+.cm-s-idea span.cm-keyword { line-height: 1em; font-weight: bold; color: #000080; }
+.cm-s-idea span.cm-atom { font-weight: bold; color: #000080; }
+.cm-s-idea span.cm-def { color: #000000; }
+.cm-s-idea span.cm-variable { color: black; }
+.cm-s-idea span.cm-variable-2 { color: black; }
+.cm-s-idea span.cm-variable-3, .cm-s-idea span.cm-type { color: black; }
+.cm-s-idea span.cm-property { color: black; }
+.cm-s-idea span.cm-operator { color: black; }
+.cm-s-idea span.cm-comment { color: #808080; }
+.cm-s-idea span.cm-string { color: #008000; }
+.cm-s-idea span.cm-string-2 { color: #008000; }
+.cm-s-idea span.cm-qualifier { color: #555; }
+.cm-s-idea span.cm-error { color: #FF0000; }
+.cm-s-idea span.cm-attribute { color: #0000FF; }
+.cm-s-idea span.cm-tag { color: #000080; }
+.cm-s-idea span.cm-link { color: #0000FF; }
+.cm-s-idea .CodeMirror-activeline-background { background: #FFFAE3; }
+
+.cm-s-idea span.cm-builtin { color: #30a; }
+.cm-s-idea span.cm-bracket { color: #cc7; }
+.cm-s-idea { font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;}
+
+
+.cm-s-idea .CodeMirror-matchingbracket { outline:1px solid grey; color:black !important; }
+
+.CodeMirror-hints.idea {
+ font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
+ color: #616569;
+ background-color: #ebf3fd !important;
+}
+
+.CodeMirror-hints.idea .CodeMirror-hint-active {
+ background-color: #a2b8c9 !important;
+ color: #5c6065 !important;
+}
\ No newline at end of file
diff --git a/vendor/assets/stylesheets/codemirror/themes/lesser-dark.css b/vendor/assets/stylesheets/codemirror/themes/lesser-dark.css
index 690c183..f96bf43 100644
--- a/vendor/assets/stylesheets/codemirror/themes/lesser-dark.css
+++ b/vendor/assets/stylesheets/codemirror/themes/lesser-dark.css
@@ -27,7 +27,7 @@ Ported to CodeMirror by Peter Kroon
.cm-s-lesser-dark span.cm-def { color: white; }
.cm-s-lesser-dark span.cm-variable { color:#D9BF8C; }
.cm-s-lesser-dark span.cm-variable-2 { color: #669199; }
-.cm-s-lesser-dark span.cm-variable-3 { color: white; }
+.cm-s-lesser-dark span.cm-variable-3, .cm-s-lesser-dark span.cm-type { color: white; }
.cm-s-lesser-dark span.cm-property { color: #92A75C; }
.cm-s-lesser-dark span.cm-operator { color: #92A75C; }
.cm-s-lesser-dark span.cm-comment { color: #666; }
@@ -38,9 +38,9 @@ Ported to CodeMirror by Peter Kroon
.cm-s-lesser-dark span.cm-builtin { color: #ff9e59; }
.cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; }
.cm-s-lesser-dark span.cm-tag { color: #669199; }
-.cm-s-lesser-dark span.cm-attribute { color: #00c; }
+.cm-s-lesser-dark span.cm-attribute { color: #81a4d5; }
.cm-s-lesser-dark span.cm-hr { color: #999; }
-.cm-s-lesser-dark span.cm-link { color: #00c; }
+.cm-s-lesser-dark span.cm-link { color: #7070E6; }
.cm-s-lesser-dark span.cm-error { color: #9d1e15; }
.cm-s-lesser-dark .CodeMirror-activeline-background { background: #3C3A3A; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/liquibyte.css b/vendor/assets/stylesheets/codemirror/themes/liquibyte.css
index 9db8bde..393825e 100644
--- a/vendor/assets/stylesheets/codemirror/themes/liquibyte.css
+++ b/vendor/assets/stylesheets/codemirror/themes/liquibyte.css
@@ -36,7 +36,7 @@
.cm-s-liquibyte span.cm-atom { color: #bf3030; font-weight: bold; }
.cm-s-liquibyte span.cm-variable-2 { color: #007f7f; font-weight: bold; }
-.cm-s-liquibyte span.cm-variable-3 { color: #c080ff; font-weight: bold; }
+.cm-s-liquibyte span.cm-variable-3, .cm-s-liquibyte span.cm-type { color: #c080ff; font-weight: bold; }
.cm-s-liquibyte span.cm-property { color: #999; font-weight: bold; }
.cm-s-liquibyte span.cm-operator { color: #fff; }
@@ -59,10 +59,10 @@
.CodeMirror-matchingtag { background-color: rgba(150, 255, 0, .3); }
/* Scrollbars */
/* Simple */
-.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal div:hover, div.CodeMirror-simplescroll-vertical div:hover {
+.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal div:hover, .cm-s-liquibyte div.CodeMirror-simplescroll-vertical div:hover {
background-color: rgba(80, 80, 80, .7);
}
-.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal div, div.CodeMirror-simplescroll-vertical div {
+.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal div, .cm-s-liquibyte div.CodeMirror-simplescroll-vertical div {
background-color: rgba(80, 80, 80, .3);
border: 1px solid #404040;
border-radius: 5px;
diff --git a/vendor/assets/stylesheets/codemirror/themes/lucario.css b/vendor/assets/stylesheets/codemirror/themes/lucario.css
new file mode 100644
index 0000000..17a1551
--- /dev/null
+++ b/vendor/assets/stylesheets/codemirror/themes/lucario.css
@@ -0,0 +1,37 @@
+/*
+ Name: lucario
+ Author: Raphael Amorim
+
+ Original Lucario color scheme (https://github.com/raphamorim/lucario)
+*/
+
+.cm-s-lucario.CodeMirror, .cm-s-lucario .CodeMirror-gutters {
+ background-color: #2b3e50 !important;
+ color: #f8f8f2 !important;
+ border: none;
+}
+.cm-s-lucario .CodeMirror-gutters { color: #2b3e50; }
+.cm-s-lucario .CodeMirror-cursor { border-left: solid thin #E6C845; }
+.cm-s-lucario .CodeMirror-linenumber { color: #f8f8f2; }
+.cm-s-lucario .CodeMirror-selected { background: #243443; }
+.cm-s-lucario .CodeMirror-line::selection, .cm-s-lucario .CodeMirror-line > span::selection, .cm-s-lucario .CodeMirror-line > span > span::selection { background: #243443; }
+.cm-s-lucario .CodeMirror-line::-moz-selection, .cm-s-lucario .CodeMirror-line > span::-moz-selection, .cm-s-lucario .CodeMirror-line > span > span::-moz-selection { background: #243443; }
+.cm-s-lucario span.cm-comment { color: #5c98cd; }
+.cm-s-lucario span.cm-string, .cm-s-lucario span.cm-string-2 { color: #E6DB74; }
+.cm-s-lucario span.cm-number { color: #ca94ff; }
+.cm-s-lucario span.cm-variable { color: #f8f8f2; }
+.cm-s-lucario span.cm-variable-2 { color: #f8f8f2; }
+.cm-s-lucario span.cm-def { color: #72C05D; }
+.cm-s-lucario span.cm-operator { color: #66D9EF; }
+.cm-s-lucario span.cm-keyword { color: #ff6541; }
+.cm-s-lucario span.cm-atom { color: #bd93f9; }
+.cm-s-lucario span.cm-meta { color: #f8f8f2; }
+.cm-s-lucario span.cm-tag { color: #ff6541; }
+.cm-s-lucario span.cm-attribute { color: #66D9EF; }
+.cm-s-lucario span.cm-qualifier { color: #72C05D; }
+.cm-s-lucario span.cm-property { color: #f8f8f2; }
+.cm-s-lucario span.cm-builtin { color: #72C05D; }
+.cm-s-lucario span.cm-variable-3, .cm-s-lucario span.cm-type { color: #ffb86c; }
+
+.cm-s-lucario .CodeMirror-activeline-background { background: #243443; }
+.cm-s-lucario .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/material.css b/vendor/assets/stylesheets/codemirror/themes/material.css
index 91ed6ce..84962a2 100644
--- a/vendor/assets/stylesheets/codemirror/themes/material.css
+++ b/vendor/assets/stylesheets/codemirror/themes/material.css
@@ -7,7 +7,7 @@
*/
-.cm-s-material {
+.cm-s-material.CodeMirror {
background-color: #263238;
color: rgba(233, 237, 237, 1);
}
@@ -27,7 +27,7 @@
.cm-s-material .cm-keyword { color: rgba(199, 146, 234, 1); }
.cm-s-material .cm-operator { color: rgba(233, 237, 237, 1); }
.cm-s-material .cm-variable-2 { color: #80CBC4; }
-.cm-s-material .cm-variable-3 { color: #82B1FF; }
+.cm-s-material .cm-variable-3, .cm-s-material .cm-type { color: #82B1FF; }
.cm-s-material .cm-builtin { color: #DECB6B; }
.cm-s-material .cm-atom { color: #F77669; }
.cm-s-material .cm-number { color: #F77669; }
@@ -41,7 +41,7 @@
.cm-s-material .cm-attribute { color: #FFCB6B; }
.cm-s-material .cm-property { color: #80CBAE; }
.cm-s-material .cm-qualifier { color: #DECB6B; }
-.cm-s-material .cm-variable-3 { color: #DECB6B; }
+.cm-s-material .cm-variable-3, .cm-s-material .cm-type { 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);
diff --git a/vendor/assets/stylesheets/codemirror/themes/mdn-like.css b/vendor/assets/stylesheets/codemirror/themes/mdn-like.css
index f325d45..622ed3e 100644
--- a/vendor/assets/stylesheets/codemirror/themes/mdn-like.css
+++ b/vendor/assets/stylesheets/codemirror/themes/mdn-like.css
@@ -21,7 +21,7 @@
.cm-s-mdn-like .cm-number { color: #ca7841; }
.cm-s-mdn-like .cm-def { color: #8DA6CE; }
.cm-s-mdn-like span.cm-variable-2, .cm-s-mdn-like span.cm-tag { color: #690; }
-.cm-s-mdn-like span.cm-variable-3, .cm-s-mdn-like span.cm-def { color: #07a; }
+.cm-s-mdn-like span.cm-variable-3, .cm-s-mdn-like span.cm-def, .cm-s-mdn-like span.cm-type { color: #07a; }
.cm-s-mdn-like .cm-variable { color: #07a; }
.cm-s-mdn-like .cm-property { color: #905; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/midnight.css b/vendor/assets/stylesheets/codemirror/themes/midnight.css
index e41f105..fc26474 100644
--- a/vendor/assets/stylesheets/codemirror/themes/midnight.css
+++ b/vendor/assets/stylesheets/codemirror/themes/midnight.css
@@ -1,9 +1,5 @@
/* Based on the theme at http://bonsaiden.github.com/JavaScript-Garden */
-/**/
-.cm-s-midnight span.CodeMirror-matchhighlight { background: #494949; }
-.cm-s-midnight.CodeMirror-focused span.CodeMirror-matchhighlight { background: #314D67 !important; }
-
/**/
.cm-s-midnight .CodeMirror-activeline-background { background: #253540; }
@@ -12,8 +8,6 @@
color: #D1EDFF;
}
-.cm-s-midnight.CodeMirror { border-top: 1px solid black; border-bottom: 1px solid black; }
-
.cm-s-midnight div.CodeMirror-selected { background: #314D67; }
.cm-s-midnight .CodeMirror-line::selection, .cm-s-midnight .CodeMirror-line > span::selection, .cm-s-midnight .CodeMirror-line > span > span::selection { background: rgba(49, 77, 103, .99); }
.cm-s-midnight .CodeMirror-line::-moz-selection, .cm-s-midnight .CodeMirror-line > span::-moz-selection, .cm-s-midnight .CodeMirror-line > span > span::-moz-selection { background: rgba(49, 77, 103, .99); }
diff --git a/vendor/assets/stylesheets/codemirror/themes/monokai.css b/vendor/assets/stylesheets/codemirror/themes/monokai.css
index 7c8a4c5..cd4cd55 100644
--- a/vendor/assets/stylesheets/codemirror/themes/monokai.css
+++ b/vendor/assets/stylesheets/codemirror/themes/monokai.css
@@ -14,6 +14,11 @@
.cm-s-monokai span.cm-atom { color: #ae81ff; }
.cm-s-monokai span.cm-number { color: #ae81ff; }
+.cm-s-monokai span.cm-comment.cm-attribute { color: #97b757; }
+.cm-s-monokai span.cm-comment.cm-def { color: #bc9262; }
+.cm-s-monokai span.cm-comment.cm-tag { color: #bc6283; }
+.cm-s-monokai span.cm-comment.cm-type { color: #5998a6; }
+
.cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute { color: #a6e22e; }
.cm-s-monokai span.cm-keyword { color: #f92672; }
.cm-s-monokai span.cm-builtin { color: #66d9ef; }
@@ -21,7 +26,7 @@
.cm-s-monokai span.cm-variable { color: #f8f8f2; }
.cm-s-monokai span.cm-variable-2 { color: #9effff; }
-.cm-s-monokai span.cm-variable-3 { color: #66d9ef; }
+.cm-s-monokai span.cm-variable-3, .cm-s-monokai span.cm-type { color: #66d9ef; }
.cm-s-monokai span.cm-def { color: #fd971f; }
.cm-s-monokai span.cm-bracket { color: #f8f8f2; }
.cm-s-monokai span.cm-tag { color: #f92672; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/night.css b/vendor/assets/stylesheets/codemirror/themes/night.css
index fd4e561..f631bf4 100644
--- a/vendor/assets/stylesheets/codemirror/themes/night.css
+++ b/vendor/assets/stylesheets/codemirror/themes/night.css
@@ -17,7 +17,7 @@
.cm-s-night span.cm-string { color: #37f14a; }
.cm-s-night span.cm-meta { color: #7678e2; }
.cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; }
-.cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; }
+.cm-s-night span.cm-variable-3, .cm-s-night span.cm-def, .cm-s-night span.cm-type { color: white; }
.cm-s-night span.cm-bracket { color: #8da6ce; }
.cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; }
.cm-s-night span.cm-link { color: #845dc4; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/nord.css b/vendor/assets/stylesheets/codemirror/themes/nord.css
new file mode 100644
index 0000000..41a8ad7
--- /dev/null
+++ b/vendor/assets/stylesheets/codemirror/themes/nord.css
@@ -0,0 +1,42 @@
+/* Based on arcticicestudio's Nord theme */
+/* https://github.com/arcticicestudio/nord */
+
+.cm-s-nord.CodeMirror { background: #2e3440; color: #d8dee9; }
+.cm-s-nord div.CodeMirror-selected { background: #434c5e; }
+.cm-s-nord .CodeMirror-line::selection, .cm-s-nord .CodeMirror-line > span::selection, .cm-s-nord .CodeMirror-line > span > span::selection { background: #3b4252; }
+.cm-s-nord .CodeMirror-line::-moz-selection, .cm-s-nord .CodeMirror-line > span::-moz-selection, .cm-s-nord .CodeMirror-line > span > span::-moz-selection { background: #3b4252; }
+.cm-s-nord .CodeMirror-gutters { background: #2e3440; border-right: 0px; }
+.cm-s-nord .CodeMirror-guttermarker { color: #4c566a; }
+.cm-s-nord .CodeMirror-guttermarker-subtle { color: #4c566a; }
+.cm-s-nord .CodeMirror-linenumber { color: #4c566a; }
+.cm-s-nord .CodeMirror-cursor { border-left: 1px solid #f8f8f0; }
+
+.cm-s-nord span.cm-comment { color: #4c566a; }
+.cm-s-nord span.cm-atom { color: #b48ead; }
+.cm-s-nord span.cm-number { color: #b48ead; }
+
+.cm-s-nord span.cm-comment.cm-attribute { color: #97b757; }
+.cm-s-nord span.cm-comment.cm-def { color: #bc9262; }
+.cm-s-nord span.cm-comment.cm-tag { color: #bc6283; }
+.cm-s-nord span.cm-comment.cm-type { color: #5998a6; }
+
+.cm-s-nord span.cm-property, .cm-s-nord span.cm-attribute { color: #8FBCBB; }
+.cm-s-nord span.cm-keyword { color: #81A1C1; }
+.cm-s-nord span.cm-builtin { color: #81A1C1; }
+.cm-s-nord span.cm-string { color: #A3BE8C; }
+
+.cm-s-nord span.cm-variable { color: #d8dee9; }
+.cm-s-nord span.cm-variable-2 { color: #d8dee9; }
+.cm-s-nord span.cm-variable-3, .cm-s-nord span.cm-type { color: #d8dee9; }
+.cm-s-nord span.cm-def { color: #8FBCBB; }
+.cm-s-nord span.cm-bracket { color: #81A1C1; }
+.cm-s-nord span.cm-tag { color: #bf616a; }
+.cm-s-nord span.cm-header { color: #b48ead; }
+.cm-s-nord span.cm-link { color: #b48ead; }
+.cm-s-nord span.cm-error { background: #bf616a; color: #f8f8f0; }
+
+.cm-s-nord .CodeMirror-activeline-background { background: #3b4252; }
+.cm-s-nord .CodeMirror-matchingbracket {
+ text-decoration: underline;
+ color: white !important;
+}
diff --git a/vendor/assets/stylesheets/codemirror/themes/oceanic-next.css b/vendor/assets/stylesheets/codemirror/themes/oceanic-next.css
new file mode 100644
index 0000000..296277b
--- /dev/null
+++ b/vendor/assets/stylesheets/codemirror/themes/oceanic-next.css
@@ -0,0 +1,44 @@
+/*
+
+ Name: oceanic-next
+ Author: Filype Pereira (https://github.com/fpereira1)
+
+ Original oceanic-next color scheme by Dmitri Voronianski (https://github.com/voronianski/oceanic-next-color-scheme)
+
+*/
+
+.cm-s-oceanic-next.CodeMirror { background: #304148; color: #f8f8f2; }
+.cm-s-oceanic-next div.CodeMirror-selected { background: rgba(101, 115, 126, 0.33); }
+.cm-s-oceanic-next .CodeMirror-line::selection, .cm-s-oceanic-next .CodeMirror-line > span::selection, .cm-s-oceanic-next .CodeMirror-line > span > span::selection { background: rgba(101, 115, 126, 0.33); }
+.cm-s-oceanic-next .CodeMirror-line::-moz-selection, .cm-s-oceanic-next .CodeMirror-line > span::-moz-selection, .cm-s-oceanic-next .CodeMirror-line > span > span::-moz-selection { background: rgba(101, 115, 126, 0.33); }
+.cm-s-oceanic-next .CodeMirror-gutters { background: #304148; border-right: 10px; }
+.cm-s-oceanic-next .CodeMirror-guttermarker { color: white; }
+.cm-s-oceanic-next .CodeMirror-guttermarker-subtle { color: #d0d0d0; }
+.cm-s-oceanic-next .CodeMirror-linenumber { color: #d0d0d0; }
+.cm-s-oceanic-next .CodeMirror-cursor { border-left: 1px solid #f8f8f0; }
+
+.cm-s-oceanic-next span.cm-comment { color: #65737E; }
+.cm-s-oceanic-next span.cm-atom { color: #C594C5; }
+.cm-s-oceanic-next span.cm-number { color: #F99157; }
+
+.cm-s-oceanic-next span.cm-property { color: #99C794; }
+.cm-s-oceanic-next span.cm-attribute,
+.cm-s-oceanic-next span.cm-keyword { color: #C594C5; }
+.cm-s-oceanic-next span.cm-builtin { color: #66d9ef; }
+.cm-s-oceanic-next span.cm-string { color: #99C794; }
+
+.cm-s-oceanic-next span.cm-variable,
+.cm-s-oceanic-next span.cm-variable-2,
+.cm-s-oceanic-next span.cm-variable-3 { color: #f8f8f2; }
+.cm-s-oceanic-next span.cm-def { color: #6699CC; }
+.cm-s-oceanic-next span.cm-bracket { color: #5FB3B3; }
+.cm-s-oceanic-next span.cm-tag { color: #C594C5; }
+.cm-s-oceanic-next span.cm-header { color: #C594C5; }
+.cm-s-oceanic-next span.cm-link { color: #C594C5; }
+.cm-s-oceanic-next span.cm-error { background: #C594C5; color: #f8f8f0; }
+
+.cm-s-oceanic-next .CodeMirror-activeline-background { background: rgba(101, 115, 126, 0.33); }
+.cm-s-oceanic-next .CodeMirror-matchingbracket {
+ text-decoration: underline;
+ color: white !important;
+}
diff --git a/vendor/assets/stylesheets/codemirror/themes/panda-syntax.css b/vendor/assets/stylesheets/codemirror/themes/panda-syntax.css
new file mode 100644
index 0000000..de14e91
--- /dev/null
+++ b/vendor/assets/stylesheets/codemirror/themes/panda-syntax.css
@@ -0,0 +1,85 @@
+/*
+ Name: Panda Syntax
+ Author: Siamak Mokhtari (http://github.com/siamak/)
+ CodeMirror template by Siamak Mokhtari (https://github.com/siamak/atom-panda-syntax)
+*/
+.cm-s-panda-syntax {
+ background: #292A2B;
+ color: #E6E6E6;
+ line-height: 1.5;
+ font-family: 'Operator Mono', 'Source Code Pro', Menlo, Monaco, Consolas, Courier New, monospace;
+}
+.cm-s-panda-syntax .CodeMirror-cursor { border-color: #ff2c6d; }
+.cm-s-panda-syntax .CodeMirror-activeline-background {
+ background: rgba(99, 123, 156, 0.1);
+}
+.cm-s-panda-syntax .CodeMirror-selected {
+ background: #FFF;
+}
+.cm-s-panda-syntax .cm-comment {
+ font-style: italic;
+ color: #676B79;
+}
+.cm-s-panda-syntax .cm-operator {
+ color: #f3f3f3;
+}
+.cm-s-panda-syntax .cm-string {
+ color: #19F9D8;
+}
+.cm-s-panda-syntax .cm-string-2 {
+ color: #FFB86C;
+}
+
+.cm-s-panda-syntax .cm-tag {
+ color: #ff2c6d;
+}
+.cm-s-panda-syntax .cm-meta {
+ color: #b084eb;
+}
+
+.cm-s-panda-syntax .cm-number {
+ color: #FFB86C;
+}
+.cm-s-panda-syntax .cm-atom {
+ color: #ff2c6d;
+}
+.cm-s-panda-syntax .cm-keyword {
+ color: #FF75B5;
+}
+.cm-s-panda-syntax .cm-variable {
+ color: #ffb86c;
+}
+.cm-s-panda-syntax .cm-variable-2 {
+ color: #ff9ac1;
+}
+.cm-s-panda-syntax .cm-variable-3, .cm-s-panda-syntax .cm-type {
+ color: #ff9ac1;
+}
+
+.cm-s-panda-syntax .cm-def {
+ color: #e6e6e6;
+}
+.cm-s-panda-syntax .cm-property {
+ color: #f3f3f3;
+}
+.cm-s-panda-syntax .cm-unit {
+ color: #ffb86c;
+}
+
+.cm-s-panda-syntax .cm-attribute {
+ color: #ffb86c;
+}
+
+.cm-s-panda-syntax .CodeMirror-matchingbracket {
+ border-bottom: 1px dotted #19F9D8;
+ padding-bottom: 2px;
+ color: #e6e6e6;
+}
+.cm-s-panda-syntax .CodeMirror-gutters {
+ background: #292a2b;
+ border-right-color: rgba(255, 255, 255, 0.1);
+}
+.cm-s-panda-syntax .CodeMirror-linenumber {
+ color: #e6e6e6;
+ opacity: 0.6;
+}
diff --git a/vendor/assets/stylesheets/codemirror/themes/pastel-on-dark.css b/vendor/assets/stylesheets/codemirror/themes/pastel-on-dark.css
index 7197509..60435dd 100644
--- a/vendor/assets/stylesheets/codemirror/themes/pastel-on-dark.css
+++ b/vendor/assets/stylesheets/codemirror/themes/pastel-on-dark.css
@@ -11,7 +11,6 @@
background: #2c2827;
color: #8F938F;
line-height: 1.5;
- font-size: 14px;
}
.cm-s-pastel-on-dark div.CodeMirror-selected { background: rgba(221,240,255,0.2); }
.cm-s-pastel-on-dark .CodeMirror-line::selection, .cm-s-pastel-on-dark .CodeMirror-line > span::selection, .cm-s-pastel-on-dark .CodeMirror-line > span > span::selection { background: rgba(221,240,255,0.2); }
@@ -35,7 +34,7 @@
.cm-s-pastel-on-dark span.cm-string { color: #66A968; }
.cm-s-pastel-on-dark span.cm-variable { color: #AEB2F8; }
.cm-s-pastel-on-dark span.cm-variable-2 { color: #BEBF55; }
-.cm-s-pastel-on-dark span.cm-variable-3 { color: #DE8E30; }
+.cm-s-pastel-on-dark span.cm-variable-3, .cm-s-pastel-on-dark span.cm-type { color: #DE8E30; }
.cm-s-pastel-on-dark span.cm-def { color: #757aD8; }
.cm-s-pastel-on-dark span.cm-bracket { color: #f8f8f2; }
.cm-s-pastel-on-dark span.cm-tag { color: #C1C144; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/rubyblue.css b/vendor/assets/stylesheets/codemirror/themes/rubyblue.css
index 76d33e7..1f181b0 100644
--- a/vendor/assets/stylesheets/codemirror/themes/rubyblue.css
+++ b/vendor/assets/stylesheets/codemirror/themes/rubyblue.css
@@ -15,7 +15,7 @@
.cm-s-rubyblue span.cm-string { color: #F08047; }
.cm-s-rubyblue span.cm-meta { color: #F0F; }
.cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { color: #7BD827; }
-.cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def { color: white; }
+.cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def, .cm-s-rubyblue span.cm-type { color: white; }
.cm-s-rubyblue span.cm-bracket { color: #F0F; }
.cm-s-rubyblue span.cm-link { color: #F4C20B; }
.cm-s-rubyblue span.CodeMirror-matchingbracket { color:#F0F !important; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/seti.css b/vendor/assets/stylesheets/codemirror/themes/seti.css
index 6632d3f..814f76f 100644
--- a/vendor/assets/stylesheets/codemirror/themes/seti.css
+++ b/vendor/assets/stylesheets/codemirror/themes/seti.css
@@ -38,7 +38,7 @@
.cm-s-seti span.cm-attribute { color: #9fca56; }
.cm-s-seti span.cm-qualifier { color: #9fca56; }
.cm-s-seti span.cm-property { color: #a074c4; }
-.cm-s-seti span.cm-variable-3 { color: #9fca56; }
+.cm-s-seti span.cm-variable-3, .cm-s-seti span.cm-type { color: #9fca56; }
.cm-s-seti span.cm-builtin { color: #9fca56; }
.cm-s-seti .CodeMirror-activeline-background { background: #101213; }
.cm-s-seti .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/shadowfox.css b/vendor/assets/stylesheets/codemirror/themes/shadowfox.css
new file mode 100644
index 0000000..32d59b1
--- /dev/null
+++ b/vendor/assets/stylesheets/codemirror/themes/shadowfox.css
@@ -0,0 +1,52 @@
+/*
+
+ Name: shadowfox
+ Author: overdodactyl (http://github.com/overdodactyl)
+
+ Original shadowfox color scheme by Firefox
+
+*/
+
+.cm-s-shadowfox.CodeMirror { background: #2a2a2e; color: #b1b1b3; }
+.cm-s-shadowfox div.CodeMirror-selected { background: #353B48; }
+.cm-s-shadowfox .CodeMirror-line::selection, .cm-s-shadowfox .CodeMirror-line > span::selection, .cm-s-shadowfox .CodeMirror-line > span > span::selection { background: #353B48; }
+.cm-s-shadowfox .CodeMirror-line::-moz-selection, .cm-s-shadowfox .CodeMirror-line > span::-moz-selection, .cm-s-shadowfox .CodeMirror-line > span > span::-moz-selection { background: #353B48; }
+.cm-s-shadowfox .CodeMirror-gutters { background: #0c0c0d ; border-right: 1px solid #0c0c0d; }
+.cm-s-shadowfox .CodeMirror-guttermarker { color: #555; }
+.cm-s-shadowfox .CodeMirror-linenumber { color: #939393; }
+.cm-s-shadowfox .CodeMirror-cursor { border-left: 1px solid #fff; }
+
+.cm-s-shadowfox span.cm-comment { color: #939393; }
+.cm-s-shadowfox span.cm-atom { color: #FF7DE9; }
+.cm-s-shadowfox span.cm-quote { color: #FF7DE9; }
+.cm-s-shadowfox span.cm-builtin { color: #FF7DE9; }
+.cm-s-shadowfox span.cm-attribute { color: #FF7DE9; }
+.cm-s-shadowfox span.cm-keyword { color: #FF7DE9; }
+.cm-s-shadowfox span.cm-error { color: #FF7DE9; }
+
+.cm-s-shadowfox span.cm-number { color: #6B89FF; }
+.cm-s-shadowfox span.cm-string { color: #6B89FF; }
+.cm-s-shadowfox span.cm-string-2 { color: #6B89FF; }
+
+.cm-s-shadowfox span.cm-meta { color: #939393; }
+.cm-s-shadowfox span.cm-hr { color: #939393; }
+
+.cm-s-shadowfox span.cm-header { color: #75BFFF; }
+.cm-s-shadowfox span.cm-qualifier { color: #75BFFF; }
+.cm-s-shadowfox span.cm-variable-2 { color: #75BFFF; }
+
+.cm-s-shadowfox span.cm-property { color: #86DE74; }
+
+.cm-s-shadowfox span.cm-def { color: #75BFFF; }
+.cm-s-shadowfox span.cm-bracket { color: #75BFFF; }
+.cm-s-shadowfox span.cm-tag { color: #75BFFF; }
+.cm-s-shadowfox span.cm-link:visited { color: #75BFFF; }
+
+.cm-s-shadowfox span.cm-variable { color: #B98EFF; }
+.cm-s-shadowfox span.cm-variable-3 { color: #d7d7db; }
+.cm-s-shadowfox span.cm-link { color: #737373; }
+.cm-s-shadowfox span.cm-operator { color: #b1b1b3; }
+.cm-s-shadowfox span.cm-special { color: #d7d7db; }
+
+.cm-s-shadowfox .CodeMirror-activeline-background { background: rgba(185, 215, 253, .15) }
+.cm-s-shadowfox .CodeMirror-matchingbracket { outline: solid 1px rgba(255, 255, 255, .25); color: white !important; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/solarized.css b/vendor/assets/stylesheets/codemirror/themes/solarized.css
index 4b1e163..fcd1d70 100644
--- a/vendor/assets/stylesheets/codemirror/themes/solarized.css
+++ b/vendor/assets/stylesheets/codemirror/themes/solarized.css
@@ -57,7 +57,7 @@ http://ethanschoonover.com/solarized/img/solarized-palette.png
.cm-s-solarized .cm-variable { color: #839496; }
.cm-s-solarized .cm-variable-2 { color: #b58900; }
-.cm-s-solarized .cm-variable-3 { color: #6c71c4; }
+.cm-s-solarized .cm-variable-3, .cm-s-solarized .cm-type { color: #6c71c4; }
.cm-s-solarized .cm-property { color: #2aa198; }
.cm-s-solarized .cm-operator { color: #6c71c4; }
@@ -87,7 +87,6 @@ http://ethanschoonover.com/solarized/img/solarized-palette.png
text-decoration: underline;
text-decoration-style: dotted;
}
-.cm-s-solarized .cm-strong { color: #eee; }
.cm-s-solarized .cm-error,
.cm-s-solarized .cm-invalidchar {
color: #586e75;
@@ -155,8 +154,8 @@ http://ethanschoonover.com/solarized/img/solarized-palette.png
.cm-s-solarized .CodeMirror-cursor { border-left: 1px solid #819090; }
/* Fat cursor */
-.cm-s-solarized.cm-s-light.cm-fat-cursor .CodeMirror-cursor { background: #fdf6e3; }
-.cm-s-solarized.cm-s-light .cm-animate-fat-cursor { background-color: #fdf6e3; }
+.cm-s-solarized.cm-s-light.cm-fat-cursor .CodeMirror-cursor { background: #77ee77; }
+.cm-s-solarized.cm-s-light .cm-animate-fat-cursor { background-color: #77ee77; }
.cm-s-solarized.cm-s-dark.cm-fat-cursor .CodeMirror-cursor { background: #586e75; }
.cm-s-solarized.cm-s-dark .cm-animate-fat-cursor { background-color: #586e75; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/ssms.css b/vendor/assets/stylesheets/codemirror/themes/ssms.css
new file mode 100644
index 0000000..9494c14
--- /dev/null
+++ b/vendor/assets/stylesheets/codemirror/themes/ssms.css
@@ -0,0 +1,16 @@
+.cm-s-ssms span.cm-keyword { color: blue; }
+.cm-s-ssms span.cm-comment { color: darkgreen; }
+.cm-s-ssms span.cm-string { color: red; }
+.cm-s-ssms span.cm-def { color: black; }
+.cm-s-ssms span.cm-variable { color: black; }
+.cm-s-ssms span.cm-variable-2 { color: black; }
+.cm-s-ssms span.cm-atom { color: darkgray; }
+.cm-s-ssms .CodeMirror-linenumber { color: teal; }
+.cm-s-ssms .CodeMirror-activeline-background { background: #ffffff; }
+.cm-s-ssms span.cm-string-2 { color: #FF00FF; }
+.cm-s-ssms span.cm-operator,
+.cm-s-ssms span.cm-bracket,
+.cm-s-ssms span.cm-punctuation { color: darkgray; }
+.cm-s-ssms .CodeMirror-gutters { border-right: 3px solid #ffee62; background-color: #ffffff; }
+.cm-s-ssms div.CodeMirror-selected { background: #ADD6FF; }
+
diff --git a/vendor/assets/stylesheets/codemirror/themes/the-matrix.css b/vendor/assets/stylesheets/codemirror/themes/the-matrix.css
index 3912a8d..c4c93c1 100644
--- a/vendor/assets/stylesheets/codemirror/themes/the-matrix.css
+++ b/vendor/assets/stylesheets/codemirror/themes/the-matrix.css
@@ -14,7 +14,7 @@
.cm-s-the-matrix span.cm-def { color: #99C; }
.cm-s-the-matrix span.cm-variable { color: #F6C; }
.cm-s-the-matrix span.cm-variable-2 { color: #C6F; }
-.cm-s-the-matrix span.cm-variable-3 { color: #96F; }
+.cm-s-the-matrix span.cm-variable-3, .cm-s-the-matrix span.cm-type { color: #96F; }
.cm-s-the-matrix span.cm-property { color: #62FFA0; }
.cm-s-the-matrix span.cm-operator { color: #999; }
.cm-s-the-matrix span.cm-comment { color: #CCCCCC; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/ttcn.css b/vendor/assets/stylesheets/codemirror/themes/ttcn.css
index b3d4656..0b14ac3 100644
--- a/vendor/assets/stylesheets/codemirror/themes/ttcn.css
+++ b/vendor/assets/stylesheets/codemirror/themes/ttcn.css
@@ -29,7 +29,7 @@
.cm-s-ttcn .cm-tag { color: #170; }
.cm-s-ttcn .cm-variable { color: #8B2252; }
.cm-s-ttcn .cm-variable-2 { color: #05a; }
-.cm-s-ttcn .cm-variable-3 { color: #085; }
+.cm-s-ttcn .cm-variable-3, .cm-s-ttcn .cm-type { color: #085; }
.cm-s-ttcn .cm-invalidchar { color: #f00; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/twilight.css b/vendor/assets/stylesheets/codemirror/themes/twilight.css
index d342b89..b2b1b2a 100644
--- a/vendor/assets/stylesheets/codemirror/themes/twilight.css
+++ b/vendor/assets/stylesheets/codemirror/themes/twilight.css
@@ -14,7 +14,7 @@
.cm-s-twilight .cm-number { color: #ca7841; } /**/
.cm-s-twilight .cm-def { color: #8DA6CE; }
.cm-s-twilight span.cm-variable-2, .cm-s-twilight span.cm-tag { color: #607392; } /**/
-.cm-s-twilight span.cm-variable-3, .cm-s-twilight span.cm-def { color: #607392; } /**/
+.cm-s-twilight span.cm-variable-3, .cm-s-twilight span.cm-def, .cm-s-twilight span.cm-type { color: #607392; } /**/
.cm-s-twilight .cm-operator { color: #cda869; } /**/
.cm-s-twilight .cm-comment { color:#777; font-style:italic; font-weight:normal; } /**/
.cm-s-twilight .cm-string { color:#8f9d6a; font-style:italic; } /**/
diff --git a/vendor/assets/stylesheets/codemirror/themes/vibrant-ink.css b/vendor/assets/stylesheets/codemirror/themes/vibrant-ink.css
index ac4ec6d..6358ad3 100644
--- a/vendor/assets/stylesheets/codemirror/themes/vibrant-ink.css
+++ b/vendor/assets/stylesheets/codemirror/themes/vibrant-ink.css
@@ -16,7 +16,7 @@
.cm-s-vibrant-ink .cm-number { color: #FFEE98; }
.cm-s-vibrant-ink .cm-def { color: #8DA6CE; }
.cm-s-vibrant-ink span.cm-variable-2, .cm-s-vibrant span.cm-tag { color: #FFC66D; }
-.cm-s-vibrant-ink span.cm-variable-3, .cm-s-vibrant span.cm-def { color: #FFC66D; }
+.cm-s-vibrant-ink span.cm-variable-3, .cm-s-vibrant span.cm-def, .cm-s-vibrant span.cm-type { color: #FFC66D; }
.cm-s-vibrant-ink .cm-operator { color: #888; }
.cm-s-vibrant-ink .cm-comment { color: gray; font-weight: bold; }
.cm-s-vibrant-ink .cm-string { color: #A5C25C; }
@@ -27,7 +27,7 @@
.cm-s-vibrant-ink .cm-attribute { color: #8DA6CE; }
.cm-s-vibrant-ink .cm-header { color: #FF6400; }
.cm-s-vibrant-ink .cm-hr { color: #AEAEAE; }
-.cm-s-vibrant-ink .cm-link { color: blue; }
+.cm-s-vibrant-ink .cm-link { color: #5656F3; }
.cm-s-vibrant-ink .cm-error { border-bottom: 1px solid red; }
.cm-s-vibrant-ink .CodeMirror-activeline-background { background: #27282E; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/xq-dark.css b/vendor/assets/stylesheets/codemirror/themes/xq-dark.css
index e3bd960..7da1a0f 100644
--- a/vendor/assets/stylesheets/codemirror/themes/xq-dark.css
+++ b/vendor/assets/stylesheets/codemirror/themes/xq-dark.css
@@ -36,7 +36,7 @@ THE SOFTWARE.
.cm-s-xq-dark span.cm-def { color: #FFF; text-decoration:underline; }
.cm-s-xq-dark span.cm-variable { color: #FFF; }
.cm-s-xq-dark span.cm-variable-2 { color: #EEE; }
-.cm-s-xq-dark span.cm-variable-3 { color: #DDD; }
+.cm-s-xq-dark span.cm-variable-3, .cm-s-xq-dark span.cm-type { color: #DDD; }
.cm-s-xq-dark span.cm-property {}
.cm-s-xq-dark span.cm-operator {}
.cm-s-xq-dark span.cm-comment { color: gray; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/xq-light.css b/vendor/assets/stylesheets/codemirror/themes/xq-light.css
index 8d2fcb6..7b182ea 100644
--- a/vendor/assets/stylesheets/codemirror/themes/xq-light.css
+++ b/vendor/assets/stylesheets/codemirror/themes/xq-light.css
@@ -26,7 +26,7 @@ THE SOFTWARE.
.cm-s-xq-light span.cm-def { text-decoration:underline; }
.cm-s-xq-light span.cm-variable { color: black; }
.cm-s-xq-light span.cm-variable-2 { color:black; }
-.cm-s-xq-light span.cm-variable-3 { color: black; }
+.cm-s-xq-light span.cm-variable-3, .cm-s-xq-light span.cm-type { color: black; }
.cm-s-xq-light span.cm-property {}
.cm-s-xq-light span.cm-operator {}
.cm-s-xq-light span.cm-comment { color: #0080FF; font-style: italic; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/yeti.css b/vendor/assets/stylesheets/codemirror/themes/yeti.css
index c70d4d2..d085f72 100644
--- a/vendor/assets/stylesheets/codemirror/themes/yeti.css
+++ b/vendor/assets/stylesheets/codemirror/themes/yeti.css
@@ -39,6 +39,6 @@
.cm-s-yeti span.cm-qualifier { color: #96c0d8; }
.cm-s-yeti span.cm-property { color: #a074c4; }
.cm-s-yeti span.cm-builtin { color: #a074c4; }
-.cm-s-yeti span.cm-variable-3 { color: #96c0d8; }
+.cm-s-yeti span.cm-variable-3, .cm-s-yeti span.cm-type { color: #96c0d8; }
.cm-s-yeti .CodeMirror-activeline-background { background: #E7E4E0; }
.cm-s-yeti .CodeMirror-matchingbracket { text-decoration: underline; }
diff --git a/vendor/assets/stylesheets/codemirror/themes/yonce.css b/vendor/assets/stylesheets/codemirror/themes/yonce.css
new file mode 100644
index 0000000..e01c0c3
--- /dev/null
+++ b/vendor/assets/stylesheets/codemirror/themes/yonce.css
@@ -0,0 +1,59 @@
+/*
+
+ Name: yoncé
+ Author: Thomas MacLean (http://github.com/thomasmaclean)
+
+ Original yoncé color scheme by Mina Markham (https://github.com/minamarkham)
+
+*/
+
+.cm-s-yonce.CodeMirror { background: #1C1C1C; color: #d4d4d4; } /**/
+.cm-s-yonce div.CodeMirror-selected { background: rgba(252, 69, 133, 0.478); } /**/
+.cm-s-yonce .CodeMirror-selectedtext,
+.cm-s-yonce .CodeMirror-selected,
+.cm-s-yonce .CodeMirror-line::selection,
+.cm-s-yonce .CodeMirror-line > span::selection,
+.cm-s-yonce .CodeMirror-line > span > span::selection,
+.cm-s-yonce .CodeMirror-line::-moz-selection,
+.cm-s-yonce .CodeMirror-line > span::-moz-selection,
+.cm-s-yonce .CodeMirror-line > span > span::-moz-selection { background: rgba(252, 67, 132, 0.47); }
+
+.cm-s-yonce.CodeMirror pre { padding-left: 0px; }
+.cm-s-yonce .CodeMirror-gutters {background: #1C1C1C; border-right: 0px;}
+.cm-s-yonce .CodeMirror-linenumber {color: #777777; padding-right: 10px; }
+.cm-s-yonce .CodeMirror-activeline .CodeMirror-linenumber.CodeMirror-gutter-elt { background: #1C1C1C; color: #fc4384; }
+.cm-s-yonce .CodeMirror-linenumber { color: #777; }
+.cm-s-yonce .CodeMirror-cursor { border-left: 2px solid #FC4384; }
+.cm-s-yonce .cm-searching { background: rgb(243, 155, 53, .3) !important; outline: 1px solid #F39B35; }
+.cm-s-yonce .cm-searching.CodeMirror-selectedtext { background: rgb(243, 155, 53, .7) !important; color: white; }
+
+.cm-s-yonce .cm-keyword { color: #00A7AA; } /**/
+.cm-s-yonce .cm-atom { color: #F39B35; }
+.cm-s-yonce .cm-number, .cm-s-yonce span.cm-type { color: #A06FCA; } /**/
+.cm-s-yonce .cm-def { color: #98E342; }
+.cm-s-yonce .cm-property,
+.cm-s-yonce span.cm-variable { color: #D4D4D4; font-style: italic; }
+.cm-s-yonce span.cm-variable-2 { color: #da7dae; font-style: italic; }
+.cm-s-yonce span.cm-variable-3 { color: #A06FCA; }
+.cm-s-yonce .cm-type.cm-def { color: #FC4384; font-style: normal; text-decoration: underline; }
+.cm-s-yonce .cm-property.cm-def { color: #FC4384; font-style: normal; }
+.cm-s-yonce .cm-callee { color: #FC4384; font-style: normal; }
+.cm-s-yonce .cm-operator { color: #FC4384; } /**/
+.cm-s-yonce .cm-qualifier,
+.cm-s-yonce .cm-tag { color: #FC4384; }
+.cm-s-yonce .cm-tag.cm-bracket { color: #D4D4D4; }
+.cm-s-yonce .cm-attribute { color: #A06FCA; }
+.cm-s-yonce .cm-comment { color:#696d70; font-style:italic; font-weight:normal; } /**/
+.cm-s-yonce .cm-comment.cm-tag { color: #FC4384 }
+.cm-s-yonce .cm-comment.cm-attribute { color: #D4D4D4; }
+.cm-s-yonce .cm-string { color:#E6DB74; } /**/
+.cm-s-yonce .cm-string-2 { color:#F39B35; } /*?*/
+.cm-s-yonce .cm-meta { color: #D4D4D4; background: inherit; }
+.cm-s-yonce .cm-builtin { color: #FC4384; } /*?*/
+.cm-s-yonce .cm-header { color: #da7dae; }
+.cm-s-yonce .cm-hr { color: #98E342; }
+.cm-s-yonce .cm-link { color:#696d70; font-style:italic; text-decoration:none; } /**/
+.cm-s-yonce .cm-error { border-bottom: 1px solid #C42412; }
+
+.cm-s-yonce .CodeMirror-activeline-background { background: #272727; }
+.cm-s-yonce .CodeMirror-matchingbracket { outline:1px solid grey; color:#D4D4D4 !important; }