mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 09:46:30 -05:00
Update CodeMirror to 5.13.5
This commit is contained in:
parent
edc3a31dfd
commit
8bf516263c
84 changed files with 2837 additions and 504 deletions
|
@ -44,9 +44,17 @@
|
|||
}
|
||||
});
|
||||
|
||||
// Rough heuristic to try and detect lines that are part of multi-line string
|
||||
function probablyInsideString(cm, pos, line) {
|
||||
return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"`]/.test(line)
|
||||
}
|
||||
|
||||
CodeMirror.defineExtension("lineComment", function(from, to, options) {
|
||||
if (!options) options = noOptions;
|
||||
var self = this, mode = self.getModeAt(from);
|
||||
var firstLine = self.getLine(from.line);
|
||||
if (firstLine == null || probablyInsideString(self, from, firstLine)) return;
|
||||
|
||||
var commentString = options.lineComment || mode.lineComment;
|
||||
if (!commentString) {
|
||||
if (options.blockCommentStart || mode.blockCommentStart) {
|
||||
|
@ -55,8 +63,7 @@
|
|||
}
|
||||
return;
|
||||
}
|
||||
var firstLine = self.getLine(from.line);
|
||||
if (firstLine == null) return;
|
||||
|
||||
var end = Math.min(to.ch != 0 || to.line == from.line ? to.line + 1 : to.line, self.lastLine() + 1);
|
||||
var pad = options.padding == null ? " " : options.padding;
|
||||
var blankLines = options.commentBlankLines || from.line == to.line;
|
||||
|
|
|
@ -56,6 +56,8 @@
|
|||
|
||||
var inp = dialog.getElementsByTagName("input")[0], button;
|
||||
if (inp) {
|
||||
inp.focus();
|
||||
|
||||
if (options.value) {
|
||||
inp.value = options.value;
|
||||
if (options.selectValueOnOpen !== false) {
|
||||
|
@ -79,8 +81,6 @@
|
|||
});
|
||||
|
||||
if (options.closeOnBlur !== false) CodeMirror.on(inp, "blur", close);
|
||||
|
||||
inp.focus();
|
||||
} else if (button = dialog.getElementsByTagName("button")[0]) {
|
||||
CodeMirror.on(button, "click", function() {
|
||||
close();
|
||||
|
|
|
@ -14,10 +14,12 @@
|
|||
if (val && !prev) {
|
||||
cm.on("blur", onBlur);
|
||||
cm.on("change", onChange);
|
||||
cm.on("swapDoc", onChange);
|
||||
onChange(cm);
|
||||
} else if (!val && prev) {
|
||||
cm.off("blur", onBlur);
|
||||
cm.off("change", onChange);
|
||||
cm.off("swapDoc", onChange);
|
||||
clearPlaceholder(cm);
|
||||
var wrapper = cm.getWrapperElement();
|
||||
wrapper.className = wrapper.className.replace(" CodeMirror-empty", "");
|
||||
|
|
11
public/vendor/codemirror/addon/hint/show-hint.js
vendored
11
public/vendor/codemirror/addon/hint/show-hint.js
vendored
|
@ -121,11 +121,13 @@
|
|||
|
||||
finishUpdate: function(data, first) {
|
||||
if (this.data) CodeMirror.signal(this.data, "update");
|
||||
if (data && this.data && CodeMirror.cmpPos(data.from, this.data.from)) data = null;
|
||||
this.data = data;
|
||||
|
||||
var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle);
|
||||
if (this.widget) this.widget.close();
|
||||
|
||||
if (data && this.data && isNewCompletion(this.data, data)) return;
|
||||
this.data = data;
|
||||
|
||||
if (data && data.list.length) {
|
||||
if (picked && data.list.length == 1) {
|
||||
this.pick(data, 0);
|
||||
|
@ -137,6 +139,11 @@
|
|||
}
|
||||
};
|
||||
|
||||
function isNewCompletion(old, nw) {
|
||||
var moved = CodeMirror.cmpPos(nw.from, old.from)
|
||||
return moved > 0 && old.to.ch - old.from.ch != nw.to.ch - nw.from.ch
|
||||
}
|
||||
|
||||
function parseOptions(cm, pos, options) {
|
||||
var editor = cm.options.hintOptions;
|
||||
var out = {};
|
||||
|
|
59
public/vendor/codemirror/addon/hint/sql-hint.js
vendored
59
public/vendor/codemirror/addon/hint/sql-hint.js
vendored
|
@ -20,6 +20,8 @@
|
|||
};
|
||||
var Pos = CodeMirror.Pos;
|
||||
|
||||
function isArray(val) { return Object.prototype.toString.call(val) == "[object Array]" }
|
||||
|
||||
function getKeywords(editor) {
|
||||
var mode = editor.doc.modeOption;
|
||||
if (mode === "sql") mode = "text/x-sql";
|
||||
|
@ -30,10 +32,28 @@
|
|||
return typeof item == "string" ? item : item.text;
|
||||
}
|
||||
|
||||
function getItem(list, item) {
|
||||
if (!list.slice) return list[item];
|
||||
for (var i = list.length - 1; i >= 0; i--) if (getText(list[i]) == item)
|
||||
return list[i];
|
||||
function wrapTable(name, value) {
|
||||
if (isArray(value)) value = {columns: value}
|
||||
if (!value.text) value.text = name
|
||||
return value
|
||||
}
|
||||
|
||||
function parseTables(input) {
|
||||
var result = {}
|
||||
if (isArray(input)) {
|
||||
for (var i = input.length - 1; i >= 0; i--) {
|
||||
var item = input[i]
|
||||
result[getText(item).toUpperCase()] = wrapTable(getText(item), item)
|
||||
}
|
||||
} else if (input) {
|
||||
for (var name in input)
|
||||
result[name.toUpperCase()] = wrapTable(name, input[name])
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
function getTable(name) {
|
||||
return tables[name.toUpperCase()]
|
||||
}
|
||||
|
||||
function shallowClone(object) {
|
||||
|
@ -50,11 +70,18 @@
|
|||
}
|
||||
|
||||
function addMatches(result, search, wordlist, formatter) {
|
||||
for (var word in wordlist) {
|
||||
if (!wordlist.hasOwnProperty(word)) continue;
|
||||
if (wordlist.slice) word = wordlist[word];
|
||||
|
||||
if (match(search, word)) result.push(formatter(word));
|
||||
if (isArray(wordlist)) {
|
||||
for (var i = 0; i < wordlist.length; i++)
|
||||
if (match(search, wordlist[i])) result.push(formatter(wordlist[i]))
|
||||
} else {
|
||||
for (var word in wordlist) if (wordlist.hasOwnProperty(word)) {
|
||||
var val = wordlist[word]
|
||||
if (!val || val === true)
|
||||
val = word
|
||||
else
|
||||
val = val.displayText ? {text: val.text, displayText: val.displayText} : val.text
|
||||
if (match(search, val)) result.push(formatter(val))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +105,7 @@
|
|||
}
|
||||
|
||||
function nameCompletion(cur, token, result, editor) {
|
||||
// Try to complete table, colunm names and return start position of completion
|
||||
// Try to complete table, column names and return start position of completion
|
||||
var useBacktick = false;
|
||||
var nameParts = [];
|
||||
var start = token.start;
|
||||
|
@ -115,13 +142,13 @@
|
|||
var alias = false;
|
||||
var aliasTable = table;
|
||||
// Check if table is available. If not, find table by Alias
|
||||
if (!getItem(tables, table)) {
|
||||
if (!getTable(table)) {
|
||||
var oldTable = table;
|
||||
table = findTableByAlias(table, editor);
|
||||
if (table !== oldTable) alias = true;
|
||||
}
|
||||
|
||||
var columns = getItem(tables, table);
|
||||
var columns = getTable(table);
|
||||
if (columns && columns.columns)
|
||||
columns = columns.columns;
|
||||
|
||||
|
@ -184,7 +211,7 @@
|
|||
//find valid range
|
||||
var prevItem = 0;
|
||||
var current = convertCurToNumber(editor.getCursor());
|
||||
for (var i=0; i< separator.length; i++) {
|
||||
for (var i = 0; i < separator.length; i++) {
|
||||
var _v = convertCurToNumber(separator[i]);
|
||||
if (current > prevItem && current <= _v) {
|
||||
validRange = { start: convertNumberToCur(prevItem), end: convertNumberToCur(_v) };
|
||||
|
@ -199,7 +226,7 @@
|
|||
var lineText = query[i];
|
||||
eachWord(lineText, function(word) {
|
||||
var wordUpperCase = word.toUpperCase();
|
||||
if (wordUpperCase === aliasUpperCase && getItem(tables, previousWord))
|
||||
if (wordUpperCase === aliasUpperCase && getTable(previousWord))
|
||||
table = previousWord;
|
||||
if (wordUpperCase !== CONS.ALIAS_KEYWORD)
|
||||
previousWord = word;
|
||||
|
@ -210,10 +237,10 @@
|
|||
}
|
||||
|
||||
CodeMirror.registerHelper("hint", "sql", function(editor, options) {
|
||||
tables = (options && options.tables) || {};
|
||||
tables = parseTables(options && options.tables)
|
||||
var defaultTableName = options && options.defaultTable;
|
||||
var disableKeywords = options && options.disableKeywords;
|
||||
defaultTable = defaultTableName && getItem(tables, defaultTableName);
|
||||
defaultTable = defaultTableName && getTable(defaultTableName);
|
||||
keywords = keywords || getKeywords(editor);
|
||||
|
||||
if (defaultTableName && !defaultTable)
|
||||
|
|
15
public/vendor/codemirror/addon/lint/lint.js
vendored
15
public/vendor/codemirror/addon/lint/lint.js
vendored
|
@ -186,9 +186,14 @@
|
|||
state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay || 500);
|
||||
}
|
||||
|
||||
function popupSpanTooltip(ann, e) {
|
||||
function popupTooltips(annotations, e) {
|
||||
var target = e.target || e.srcElement;
|
||||
showTooltipFor(e, annotationTooltip(ann), target);
|
||||
var tooltip = document.createDocumentFragment();
|
||||
for (var i = 0; i < annotations.length; i++) {
|
||||
var ann = annotations[i];
|
||||
tooltip.appendChild(annotationTooltip(ann));
|
||||
}
|
||||
showTooltipFor(e, tooltip, target);
|
||||
}
|
||||
|
||||
function onMouseOver(cm, e) {
|
||||
|
@ -196,10 +201,12 @@
|
|||
if (!/\bCodeMirror-lint-mark-/.test(target.className)) return;
|
||||
var box = target.getBoundingClientRect(), x = (box.left + box.right) / 2, y = (box.top + box.bottom) / 2;
|
||||
var spans = cm.findMarksAt(cm.coordsChar({left: x, top: y}, "client"));
|
||||
|
||||
var annotations = [];
|
||||
for (var i = 0; i < spans.length; ++i) {
|
||||
var ann = spans[i].__annotation;
|
||||
if (ann) return popupSpanTooltip(ann, e);
|
||||
annotations.push(spans[i].__annotation);
|
||||
}
|
||||
if (annotations.length) popupTooltips(annotations, e);
|
||||
}
|
||||
|
||||
CodeMirror.defineOption("lint", false, function(cm, val, old) {
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
position: absolute;
|
||||
cursor: pointer;
|
||||
color: #44c;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.CodeMirror-merge-copy-reverse {
|
||||
|
|
|
@ -427,8 +427,9 @@
|
|||
|
||||
function copyChunk(dv, to, from, chunk) {
|
||||
if (dv.diffOutOfDate) return;
|
||||
to.replaceRange(from.getRange(Pos(chunk.origFrom, 0), Pos(chunk.origTo, 0)),
|
||||
Pos(chunk.editFrom, 0), Pos(chunk.editTo, 0));
|
||||
var editStart = chunk.editTo > to.lastLine() ? Pos(chunk.editFrom - 1) : Pos(chunk.editFrom, 0)
|
||||
var origStart = chunk.origTo > from.lastLine() ? Pos(chunk.origFrom - 1) : Pos(chunk.origFrom, 0)
|
||||
to.replaceRange(from.getRange(origStart, Pos(chunk.origTo, 0)), editStart, Pos(chunk.editTo, 0))
|
||||
}
|
||||
|
||||
// Merge view, containing 0, 1, or 2 diff views.
|
||||
|
|
|
@ -59,16 +59,20 @@
|
|||
CodeMirror.on(this.node, "DOMMouseScroll", onWheel);
|
||||
}
|
||||
|
||||
Bar.prototype.moveTo = function(pos, update) {
|
||||
Bar.prototype.setPos = function(pos) {
|
||||
if (pos < 0) pos = 0;
|
||||
if (pos > this.total - this.screen) pos = this.total - this.screen;
|
||||
if (pos == this.pos) return;
|
||||
if (pos == this.pos) return false;
|
||||
this.pos = pos;
|
||||
this.inner.style[this.orientation == "horizontal" ? "left" : "top"] =
|
||||
(pos * (this.size / this.total)) + "px";
|
||||
if (update !== false) this.scroll(pos, this.orientation);
|
||||
return true
|
||||
};
|
||||
|
||||
Bar.prototype.moveTo = function(pos) {
|
||||
if (this.setPos(pos)) this.scroll(pos, this.orientation);
|
||||
}
|
||||
|
||||
var minButtonSize = 10;
|
||||
|
||||
Bar.prototype.update = function(scrollSize, clientSize, barSize) {
|
||||
|
@ -83,8 +87,7 @@
|
|||
}
|
||||
this.inner.style[this.orientation == "horizontal" ? "width" : "height"] =
|
||||
buttonSize + "px";
|
||||
this.inner.style[this.orientation == "horizontal" ? "left" : "top"] =
|
||||
this.pos * (this.size / this.total) + "px";
|
||||
this.setPos(this.pos);
|
||||
};
|
||||
|
||||
function SimpleScrollbars(cls, place, scroll) {
|
||||
|
@ -111,7 +114,6 @@
|
|||
if (needsV) {
|
||||
this.vert.update(measure.scrollHeight, measure.clientHeight,
|
||||
measure.viewHeight - (needsH ? width : 0));
|
||||
this.vert.node.style.display = "block";
|
||||
this.vert.node.style.bottom = needsH ? width + "px" : "0";
|
||||
}
|
||||
if (needsH) {
|
||||
|
@ -125,11 +127,11 @@
|
|||
};
|
||||
|
||||
SimpleScrollbars.prototype.setScrollTop = function(pos) {
|
||||
this.vert.moveTo(pos, false);
|
||||
this.vert.setPos(pos);
|
||||
};
|
||||
|
||||
SimpleScrollbars.prototype.setScrollLeft = function(pos) {
|
||||
this.horiz.moveTo(pos, false);
|
||||
this.horiz.setPos(pos);
|
||||
};
|
||||
|
||||
SimpleScrollbars.prototype.clear = function() {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
// highlighted only if the selected text is a word. showToken, when enabled,
|
||||
// will cause the current token to be highlighted when nothing is selected.
|
||||
// delay is used to specify how much time to wait, in milliseconds, before
|
||||
// highlighting the matches. If annotateScrollbar is enabled, the occurances
|
||||
// highlighting the matches. If annotateScrollbar is enabled, the occurences
|
||||
// will be highlighted on the scrollbar via the matchesonscrollbar addon.
|
||||
|
||||
(function(mod) {
|
||||
|
|
|
@ -121,7 +121,10 @@
|
|||
persistentDialog(cm, queryDialog, q, function(query, event) {
|
||||
CodeMirror.e_stop(event);
|
||||
if (!query) return;
|
||||
if (query != state.queryText) startSearch(cm, state, query);
|
||||
if (query != state.queryText) {
|
||||
startSearch(cm, state, query);
|
||||
state.posFrom = state.posTo = cm.getCursor();
|
||||
}
|
||||
if (hiding) hiding.style.opacity = 1
|
||||
findNext(cm, event.shiftKey, function(_, to) {
|
||||
var dialog
|
||||
|
@ -193,7 +196,7 @@
|
|||
replaceAll(cm, query, text)
|
||||
} else {
|
||||
clearSearch(cm);
|
||||
var cursor = getSearchCursor(cm, query, cm.getCursor());
|
||||
var cursor = getSearchCursor(cm, query, cm.getCursor("from"));
|
||||
var advance = function() {
|
||||
var start = cursor.from(), match;
|
||||
if (!(match = cursor.findNext())) {
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
"use strict";
|
||||
var WRAP_CLASS = "CodeMirror-activeline";
|
||||
var BACK_CLASS = "CodeMirror-activeline-background";
|
||||
var GUTT_CLASS = "CodeMirror-activeline-gutter";
|
||||
|
||||
CodeMirror.defineOption("styleActiveLine", false, function(cm, val, old) {
|
||||
var prev = old && old != CodeMirror.Init;
|
||||
|
@ -36,6 +37,7 @@
|
|||
for (var i = 0; i < cm.state.activeLines.length; i++) {
|
||||
cm.removeLineClass(cm.state.activeLines[i], "wrap", WRAP_CLASS);
|
||||
cm.removeLineClass(cm.state.activeLines[i], "background", BACK_CLASS);
|
||||
cm.removeLineClass(cm.state.activeLines[i], "gutter", GUTT_CLASS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,6 +62,7 @@
|
|||
for (var i = 0; i < active.length; i++) {
|
||||
cm.addLineClass(active[i], "wrap", WRAP_CLASS);
|
||||
cm.addLineClass(active[i], "background", BACK_CLASS);
|
||||
cm.addLineClass(active[i], "gutter", GUTT_CLASS);
|
||||
}
|
||||
cm.state.activeLines = active;
|
||||
});
|
||||
|
|
4
public/vendor/codemirror/addon/tern/tern.js
vendored
4
public/vendor/codemirror/addon/tern/tern.js
vendored
|
@ -179,7 +179,7 @@
|
|||
var data = findDoc(ts, doc);
|
||||
|
||||
var argHints = ts.cachedArgHints;
|
||||
if (argHints && argHints.doc == doc && cmpPos(argHints.start, change.to) <= 0)
|
||||
if (argHints && argHints.doc == doc && cmpPos(argHints.start, change.to) >= 0)
|
||||
ts.cachedArgHints = null;
|
||||
|
||||
var changed = data.changed;
|
||||
|
@ -306,7 +306,7 @@
|
|||
ts.request(cm, {type: "type", preferFunction: true, end: start}, function(error, data) {
|
||||
if (error || !data.type || !(/^fn\(/).test(data.type)) return;
|
||||
ts.cachedArgHints = {
|
||||
start: pos,
|
||||
start: start,
|
||||
type: parseFnType(data.type),
|
||||
name: data.exprName || data.name || "fn",
|
||||
guess: data.guess,
|
||||
|
|
32
public/vendor/codemirror/codemirror.min.js
vendored
32
public/vendor/codemirror/codemirror.min.js
vendored
File diff suppressed because one or more lines are too long
4
public/vendor/codemirror/keymap/sublime.js
vendored
4
public/vendor/codemirror/keymap/sublime.js
vendored
|
@ -55,6 +55,8 @@
|
|||
cmds[map["Alt-Left"] = "goSubwordLeft"] = function(cm) { moveSubword(cm, -1); };
|
||||
cmds[map["Alt-Right"] = "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) {
|
||||
|
@ -105,7 +107,7 @@
|
|||
cm.setSelections(extended);
|
||||
};
|
||||
|
||||
map["Shift-" + ctrl + "K"] = "deleteLine";
|
||||
map["Shift-Ctrl-K"] = "deleteLine";
|
||||
|
||||
function insertLine(cm, above) {
|
||||
if (cm.isReadOnly()) return CodeMirror.Pass
|
||||
|
|
53
public/vendor/codemirror/keymap/vim.js
vendored
53
public/vendor/codemirror/keymap/vim.js
vendored
|
@ -26,7 +26,7 @@
|
|||
* 2. Variable declarations and short basic helpers
|
||||
* 3. Instance (External API) implementation
|
||||
* 4. Internal state tracking objects (input state, counter) implementation
|
||||
* and instanstiation
|
||||
* and instantiation
|
||||
* 5. Key handler (the main command dispatcher) implementation
|
||||
* 6. Motion, operator, and action implementations
|
||||
* 7. Helper functions for the key handler, motions, operators, and actions
|
||||
|
@ -64,9 +64,9 @@
|
|||
{ keys: '<C-[>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' },
|
||||
{ keys: '<C-c>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' },
|
||||
{ keys: 's', type: 'keyToKey', toKeys: 'cl', context: 'normal' },
|
||||
{ keys: 's', type: 'keyToKey', toKeys: 'xi', context: 'visual'},
|
||||
{ keys: 's', type: 'keyToKey', toKeys: 'c', context: 'visual'},
|
||||
{ keys: 'S', type: 'keyToKey', toKeys: 'cc', context: 'normal' },
|
||||
{ keys: 'S', type: 'keyToKey', toKeys: 'dcc', context: 'visual' },
|
||||
{ keys: 'S', type: 'keyToKey', toKeys: 'VdO', context: 'visual' },
|
||||
{ keys: '<Home>', type: 'keyToKey', toKeys: '0' },
|
||||
{ keys: '<End>', type: 'keyToKey', toKeys: '$' },
|
||||
{ keys: '<PageUp>', type: 'keyToKey', toKeys: '<C-b>' },
|
||||
|
@ -164,6 +164,7 @@
|
|||
{ keys: 'v', type: 'action', action: 'toggleVisualMode' },
|
||||
{ keys: 'V', type: 'action', action: 'toggleVisualMode', actionArgs: { linewise: true }},
|
||||
{ keys: '<C-v>', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }},
|
||||
{ keys: '<C-q>', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }},
|
||||
{ keys: 'gv', type: 'action', action: 'reselectLastSelection' },
|
||||
{ keys: 'J', type: 'action', action: 'joinLines', isEdit: true },
|
||||
{ keys: 'p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true }},
|
||||
|
@ -225,6 +226,7 @@
|
|||
{ name: 'sort', shortName: 'sor' },
|
||||
{ name: 'substitute', shortName: 's', possiblyAsync: true },
|
||||
{ name: 'nohlsearch', shortName: 'noh' },
|
||||
{ name: 'yank', shortName: 'y' },
|
||||
{ name: 'delmarks', shortName: 'delm' },
|
||||
{ name: 'registers', shortName: 'reg', excludeFromCommandHistory: true },
|
||||
{ name: 'global', shortName: 'g' }
|
||||
|
@ -640,7 +642,7 @@
|
|||
jumpList: createCircularJumpList(),
|
||||
macroModeState: new MacroModeState,
|
||||
// Recording latest f, t, F or T motion command.
|
||||
lastChararacterSearch: {increment:0, forward:true, selectedCharacter:''},
|
||||
lastCharacterSearch: {increment:0, forward:true, selectedCharacter:''},
|
||||
registerController: new RegisterController({}),
|
||||
// search history buffer
|
||||
searchHistoryController: new HistoryController({}),
|
||||
|
@ -681,6 +683,9 @@
|
|||
// Add user defined key bindings.
|
||||
exCommandDispatcher.map(lhs, rhs, ctx);
|
||||
},
|
||||
unmap: function(lhs, ctx) {
|
||||
exCommandDispatcher.unmap(lhs, ctx);
|
||||
},
|
||||
// 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,
|
||||
|
@ -1043,7 +1048,7 @@
|
|||
};
|
||||
function HistoryController() {
|
||||
this.historyBuffer = [];
|
||||
this.iterator;
|
||||
this.iterator = 0;
|
||||
this.initialPrefix = null;
|
||||
}
|
||||
HistoryController.prototype = {
|
||||
|
@ -1368,7 +1373,7 @@
|
|||
}
|
||||
},
|
||||
evalInput: function(cm, vim) {
|
||||
// If the motion comand is set, execute both the operator and motion.
|
||||
// If the motion command is set, execute both the operator and motion.
|
||||
// Otherwise return.
|
||||
var inputState = vim.inputState;
|
||||
var motion = inputState.motion;
|
||||
|
@ -1692,11 +1697,12 @@
|
|||
var line = motionArgs.forward ? cur.line + repeat : cur.line - repeat;
|
||||
var first = cm.firstLine();
|
||||
var last = cm.lastLine();
|
||||
// Vim cancels linewise motions that start on an edge and move beyond
|
||||
// that edge. It does not cancel motions that do not start on an edge.
|
||||
if ((line < first && cur.line == first) ||
|
||||
(line > last && cur.line == last)) {
|
||||
return;
|
||||
// Vim go to line begin or line end when cursor at first/last line and
|
||||
// move to previous/next line is triggered.
|
||||
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);
|
||||
}
|
||||
if (motionArgs.toFirstChar){
|
||||
endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line));
|
||||
|
@ -1904,7 +1910,7 @@
|
|||
},
|
||||
|
||||
repeatLastCharacterSearch: function(cm, head, motionArgs) {
|
||||
var lastSearch = vimGlobalState.lastChararacterSearch;
|
||||
var lastSearch = vimGlobalState.lastCharacterSearch;
|
||||
var repeat = motionArgs.repeat;
|
||||
var forward = motionArgs.forward === lastSearch.forward;
|
||||
var increment = (lastSearch.increment ? 1 : 0) * (forward ? -1 : 1);
|
||||
|
@ -2997,7 +3003,7 @@
|
|||
// Only clip if the selection ends with trailing newline + whitespace
|
||||
if (/\n\s*$/.test(selection)) {
|
||||
var lines = selection.split('\n');
|
||||
// We know this is all whitepsace.
|
||||
// We know this is all whitespace.
|
||||
lines.pop();
|
||||
|
||||
// Cases:
|
||||
|
@ -3083,9 +3089,9 @@
|
|||
}
|
||||
|
||||
function recordLastCharacterSearch(increment, args) {
|
||||
vimGlobalState.lastChararacterSearch.increment = increment;
|
||||
vimGlobalState.lastChararacterSearch.forward = args.forward;
|
||||
vimGlobalState.lastChararacterSearch.selectedCharacter = args.selectedCharacter;
|
||||
vimGlobalState.lastCharacterSearch.increment = increment;
|
||||
vimGlobalState.lastCharacterSearch.forward = args.forward;
|
||||
vimGlobalState.lastCharacterSearch.selectedCharacter = args.selectedCharacter;
|
||||
}
|
||||
|
||||
var symbolToMode = {
|
||||
|
@ -3284,8 +3290,6 @@
|
|||
line = cm.getLine(lineNum);
|
||||
pos = (dir > 0) ? 0 : line.length;
|
||||
}
|
||||
// Should never get here.
|
||||
throw new Error('The impossible happened.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3447,7 +3451,7 @@
|
|||
}
|
||||
|
||||
// TODO: perhaps this finagling of start and end positions belonds
|
||||
// in codmirror/replaceRange?
|
||||
// in codemirror/replaceRange?
|
||||
function selectCompanionObject(cm, head, symb, inclusive) {
|
||||
var cur = head, start, end;
|
||||
|
||||
|
@ -4509,14 +4513,21 @@
|
|||
if (CodeMirror.commands.save) {
|
||||
// If a save command is defined, call it.
|
||||
CodeMirror.commands.save(cm);
|
||||
} else {
|
||||
// Saves to text area if no save command is defined.
|
||||
} else if (cm.save) {
|
||||
// Saves to text area if no save command is defined and cm.save() is available.
|
||||
cm.save();
|
||||
}
|
||||
},
|
||||
nohlsearch: function(cm) {
|
||||
clearSearchHighlight(cm);
|
||||
},
|
||||
yank: function (cm) {
|
||||
var cur = copyCursor(cm.getCursor());
|
||||
var line = cur.line;
|
||||
var lineText = cm.getLine(line);
|
||||
vimGlobalState.registerController.pushText(
|
||||
'0', 'yank', lineText, true, true);
|
||||
},
|
||||
delmarks: function(cm, params) {
|
||||
if (!params.argString || !trim(params.argString)) {
|
||||
showConfirm(cm, 'Argument required');
|
||||
|
|
4
public/vendor/codemirror/lib/codemirror.css
vendored
4
public/vendor/codemirror/lib/codemirror.css
vendored
|
@ -191,12 +191,14 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
|||
|
||||
.CodeMirror-gutters {
|
||||
position: absolute; left: 0; top: 0;
|
||||
min-height: 100%;
|
||||
z-index: 3;
|
||||
}
|
||||
.CodeMirror-gutter {
|
||||
white-space: normal;
|
||||
height: 100%;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-bottom: -30px;
|
||||
/* Hack to make IE7 behave */
|
||||
*zoom:1;
|
||||
|
@ -244,6 +246,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;
|
||||
}
|
||||
.CodeMirror-wrap pre {
|
||||
word-wrap: break-word;
|
||||
|
|
55
public/vendor/codemirror/lib/codemirror.js
vendored
55
public/vendor/codemirror/lib/codemirror.js
vendored
|
@ -41,6 +41,7 @@
|
|||
// This is woefully incomplete. Suggestions for alternative methods welcome.
|
||||
var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
|
||||
var mac = ios || /Mac/.test(platform);
|
||||
var chromeOS = /\bCrOS\b/.test(userAgent);
|
||||
var windows = /win/i.test(platform);
|
||||
|
||||
var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/);
|
||||
|
@ -543,6 +544,7 @@
|
|||
|
||||
d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
|
||||
d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
|
||||
d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent"
|
||||
|
||||
if (sizes.right && sizes.bottom) {
|
||||
d.scrollbarFiller.style.display = "block";
|
||||
|
@ -746,6 +748,7 @@
|
|||
|
||||
function postUpdateDisplay(cm, update) {
|
||||
var viewport = update.viewport;
|
||||
|
||||
for (var first = true;; first = false) {
|
||||
if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
|
||||
// Clip forced viewport to actual scrollable area.
|
||||
|
@ -761,8 +764,8 @@
|
|||
updateHeightsInViewport(cm);
|
||||
var barMeasure = measureForScrollbars(cm);
|
||||
updateSelection(cm);
|
||||
setDocumentHeight(cm, barMeasure);
|
||||
updateScrollbars(cm, barMeasure);
|
||||
setDocumentHeight(cm, barMeasure);
|
||||
}
|
||||
|
||||
update.signal(cm, "update", cm);
|
||||
|
@ -779,17 +782,16 @@
|
|||
postUpdateDisplay(cm, update);
|
||||
var barMeasure = measureForScrollbars(cm);
|
||||
updateSelection(cm);
|
||||
setDocumentHeight(cm, barMeasure);
|
||||
updateScrollbars(cm, barMeasure);
|
||||
setDocumentHeight(cm, barMeasure);
|
||||
update.finish();
|
||||
}
|
||||
}
|
||||
|
||||
function setDocumentHeight(cm, measure) {
|
||||
cm.display.sizer.style.minHeight = measure.docHeight + "px";
|
||||
var total = measure.docHeight + cm.display.barHeight;
|
||||
cm.display.heightForcer.style.top = total + "px";
|
||||
cm.display.gutters.style.height = Math.max(total + scrollGap(cm), measure.clientHeight) + "px";
|
||||
cm.display.heightForcer.style.top = measure.docHeight + "px";
|
||||
cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px";
|
||||
}
|
||||
|
||||
// Read the actual heights of the rendered lines, and update their
|
||||
|
@ -1484,10 +1486,11 @@
|
|||
if (reset && cm.doc.sel.contains(pos) == -1)
|
||||
operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll);
|
||||
|
||||
var oldCSS = te.style.cssText;
|
||||
input.wrapper.style.position = "absolute";
|
||||
te.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) +
|
||||
"px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: " +
|
||||
var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;
|
||||
input.wrapper.style.cssText = "position: absolute"
|
||||
var wrapperBox = input.wrapper.getBoundingClientRect()
|
||||
te.style.cssText = "position: absolute; width: 30px; height: 30px; top: " + (e.clientY - wrapperBox.top - 5) +
|
||||
"px; left: " + (e.clientX - wrapperBox.left - 5) + "px; z-index: 1000; background: " +
|
||||
(ie ? "rgba(255, 255, 255, .05)" : "transparent") +
|
||||
"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
|
||||
if (webkit) var oldScrollY = window.scrollY; // Work around Chrome issue (#2712)
|
||||
|
@ -1518,7 +1521,7 @@
|
|||
}
|
||||
function rehide() {
|
||||
input.contextMenuPending = false;
|
||||
input.wrapper.style.position = "relative";
|
||||
input.wrapper.style.cssText = oldWrapperCSS
|
||||
te.style.cssText = oldCSS;
|
||||
if (ie && ie_version < 9) display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos);
|
||||
|
||||
|
@ -2258,13 +2261,15 @@
|
|||
|
||||
if (oldPos) {
|
||||
var near = m.find(dir < 0 ? 1 : -1), diff;
|
||||
if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft) near = movePos(doc, near, -dir, line);
|
||||
if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft)
|
||||
near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null);
|
||||
if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
|
||||
return skipAtomicInner(doc, near, pos, dir, mayClear);
|
||||
}
|
||||
|
||||
var far = m.find(dir < 0 ? -1 : 1);
|
||||
if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight) far = movePos(doc, far, dir, line);
|
||||
if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight)
|
||||
far = movePos(doc, far, dir, far.line == pos.line ? line : null);
|
||||
return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null;
|
||||
}
|
||||
}
|
||||
|
@ -2311,6 +2316,7 @@
|
|||
for (var i = 0; i < doc.sel.ranges.length; i++) {
|
||||
if (primary === false && i == doc.sel.primIndex) continue;
|
||||
var range = doc.sel.ranges[i];
|
||||
if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) continue;
|
||||
var collapsed = range.empty();
|
||||
if (collapsed || cm.options.showCursorWhenSelecting)
|
||||
drawSelectionCursor(cm, range.head, curFragment);
|
||||
|
@ -3122,10 +3128,10 @@
|
|||
|
||||
if (op.preparedSelection)
|
||||
cm.display.input.showSelection(op.preparedSelection);
|
||||
if (op.updatedDisplay)
|
||||
setDocumentHeight(cm, op.barMeasure);
|
||||
if (op.updatedDisplay || op.startHeight != cm.doc.height)
|
||||
updateScrollbars(cm, op.barMeasure);
|
||||
if (op.updatedDisplay)
|
||||
setDocumentHeight(cm, op.barMeasure);
|
||||
|
||||
if (op.selectionChanged) restartBlink(cm);
|
||||
|
||||
|
@ -3151,7 +3157,7 @@
|
|||
display.scroller.scrollTop = doc.scrollTop;
|
||||
}
|
||||
if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) {
|
||||
doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - displayWidth(cm), op.scrollLeft));
|
||||
doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft));
|
||||
display.scrollbars.setScrollLeft(doc.scrollLeft);
|
||||
display.scroller.scrollLeft = doc.scrollLeft;
|
||||
alignHorizontally(cm);
|
||||
|
@ -3502,7 +3508,7 @@
|
|||
over: function(e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},
|
||||
start: function(e){onDragStart(cm, e);},
|
||||
drop: operation(cm, onDrop),
|
||||
leave: function() {clearDragCursor(cm);}
|
||||
leave: function(e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}
|
||||
};
|
||||
|
||||
var inp = d.input.getField();
|
||||
|
@ -3687,7 +3693,7 @@
|
|||
ourIndex = doc.sel.primIndex;
|
||||
}
|
||||
|
||||
if (e.altKey) {
|
||||
if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) {
|
||||
type = "rect";
|
||||
if (!addNew) ourRange = new Range(start, start);
|
||||
start = posFromMouse(cm, e, true, true);
|
||||
|
@ -7632,9 +7638,9 @@
|
|||
var spans = line.markedSpans;
|
||||
if (spans) for (var i = 0; i < spans.length; i++) {
|
||||
var span = spans[i];
|
||||
if (!(lineNo == from.line && from.ch > span.to ||
|
||||
span.from == null && lineNo != from.line||
|
||||
lineNo == to.line && span.from > to.ch) &&
|
||||
if (!(span.to != null && lineNo == from.line && from.ch > span.to ||
|
||||
span.from == null && lineNo != from.line ||
|
||||
span.from != null && lineNo == to.line && span.from > to.ch) &&
|
||||
(!filter || filter(span.marker)))
|
||||
found.push(span.marker.parent || span.marker);
|
||||
}
|
||||
|
@ -7653,9 +7659,9 @@
|
|||
},
|
||||
|
||||
posFromIndex: function(off) {
|
||||
var ch, lineNo = this.first;
|
||||
var ch, lineNo = this.first, sepSize = this.lineSeparator().length;
|
||||
this.iter(function(line) {
|
||||
var sz = line.text.length + 1;
|
||||
var sz = line.text.length + sepSize;
|
||||
if (sz > off) { ch = off; return true; }
|
||||
off -= sz;
|
||||
++lineNo;
|
||||
|
@ -7666,8 +7672,9 @@
|
|||
coords = clipPos(this, coords);
|
||||
var index = coords.ch;
|
||||
if (coords.line < this.first || coords.ch < 0) return 0;
|
||||
var sepSize = this.lineSeparator().length;
|
||||
this.iter(this.first, coords.line, function (line) {
|
||||
index += line.text.length + 1;
|
||||
index += line.text.length + sepSize;
|
||||
});
|
||||
return index;
|
||||
},
|
||||
|
@ -8897,7 +8904,7 @@
|
|||
|
||||
// THE END
|
||||
|
||||
CodeMirror.version = "5.10.1";
|
||||
CodeMirror.version = "5.13.5";
|
||||
|
||||
return CodeMirror;
|
||||
});
|
||||
|
|
87
public/vendor/codemirror/mode/clike/clike.js
vendored
87
public/vendor/codemirror/mode/clike/clike.js
vendored
|
@ -11,6 +11,42 @@
|
|||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
function Context(indented, column, type, align, prev) {
|
||||
this.indented = indented;
|
||||
this.column = column;
|
||||
this.type = type;
|
||||
this.align = align;
|
||||
this.prev = prev;
|
||||
}
|
||||
function isStatement(type) {
|
||||
return type == "statement" || type == "switchstatement" || type == "namespace";
|
||||
}
|
||||
function pushContext(state, col, type) {
|
||||
var indent = state.indented;
|
||||
if (state.context && isStatement(state.context.type) && !isStatement(type))
|
||||
indent = state.context.indented;
|
||||
return state.context = new Context(indent, col, type, null, state.context);
|
||||
}
|
||||
function popContext(state) {
|
||||
var t = state.context.type;
|
||||
if (t == ")" || t == "]" || t == "}")
|
||||
state.indented = state.context.indented;
|
||||
return state.context = state.context.prev;
|
||||
}
|
||||
|
||||
function typeBefore(stream, state) {
|
||||
if (state.prevToken == "variable" || state.prevToken == "variable-3") return true;
|
||||
if (/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(stream.string.slice(0, stream.start))) return true;
|
||||
}
|
||||
|
||||
function isTopScope(context) {
|
||||
for (;;) {
|
||||
if (!context || context.type == "top") return true;
|
||||
if (context.type == "}" && context.prev.type != "namespace") return false;
|
||||
context = context.prev;
|
||||
}
|
||||
}
|
||||
|
||||
CodeMirror.defineMode("clike", function(config, parserConfig) {
|
||||
var indentUnit = config.indentUnit,
|
||||
statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
|
||||
|
@ -64,7 +100,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
}
|
||||
}
|
||||
if (isOperatorChar.test(ch)) {
|
||||
stream.eatWhile(isOperatorChar);
|
||||
while (!stream.match(/^\/[\/*]/, false) && stream.eat(isOperatorChar)) {}
|
||||
return "operator";
|
||||
}
|
||||
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
|
||||
|
@ -111,42 +147,6 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
return "comment";
|
||||
}
|
||||
|
||||
function Context(indented, column, type, align, prev) {
|
||||
this.indented = indented;
|
||||
this.column = column;
|
||||
this.type = type;
|
||||
this.align = align;
|
||||
this.prev = prev;
|
||||
}
|
||||
function isStatement(type) {
|
||||
return type == "statement" || type == "switchstatement" || type == "namespace";
|
||||
}
|
||||
function pushContext(state, col, type) {
|
||||
var indent = state.indented;
|
||||
if (state.context && isStatement(state.context.type) && !isStatement(type))
|
||||
indent = state.context.indented;
|
||||
return state.context = new Context(indent, col, type, null, state.context);
|
||||
}
|
||||
function popContext(state) {
|
||||
var t = state.context.type;
|
||||
if (t == ")" || t == "]" || t == "}")
|
||||
state.indented = state.context.indented;
|
||||
return state.context = state.context.prev;
|
||||
}
|
||||
|
||||
function typeBefore(stream, state) {
|
||||
if (state.prevToken == "variable" || state.prevToken == "variable-3") return true;
|
||||
if (/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(stream.string.slice(0, stream.start))) return true;
|
||||
}
|
||||
|
||||
function isTopScope(context) {
|
||||
for (;;) {
|
||||
if (!context || context.type == "top") return true;
|
||||
if (context.type == "}" && context.prev.type != "namespace") return false;
|
||||
context = context.prev;
|
||||
}
|
||||
}
|
||||
|
||||
// Interface
|
||||
|
||||
return {
|
||||
|
@ -497,7 +497,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
),
|
||||
types: words(
|
||||
"AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " +
|
||||
"Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable " +
|
||||
"Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable " +
|
||||
"Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering " +
|
||||
"Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder " +
|
||||
"StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector " +
|
||||
|
@ -527,6 +527,15 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
"'": function(stream) {
|
||||
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
|
||||
return "atom";
|
||||
},
|
||||
"=": function(stream, state) {
|
||||
var cx = state.context
|
||||
if (cx.type == "}" && cx.align && stream.eat(">")) {
|
||||
state.context = new Context(cx.indented, cx.column, cx.type, null, cx.prev)
|
||||
return "operator"
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
modeProps: {closeBrackets: {triples: '"'}}
|
||||
|
@ -658,7 +667,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
|
||||
def("text/x-objectivec", {
|
||||
name: "clike",
|
||||
keywords: words(cKeywords + "inline restrict _Bool _Complex _Imaginery BOOL Class bycopy byref id IMP in " +
|
||||
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"),
|
||||
|
|
|
@ -59,7 +59,8 @@ CodeMirror.defineMode("clojure", function (options) {
|
|||
sign: /[+-]/,
|
||||
exponent: /e/i,
|
||||
keyword_char: /[^\s\(\[\;\)\]]/,
|
||||
symbol: /[\w*+!\-\._?:<>\/\xa1-\uffff]/
|
||||
symbol: /[\w*+!\-\._?:<>\/\xa1-\uffff]/,
|
||||
block_indent: /^(?:def|with)[^\/]+$|\/(?:def|with)/
|
||||
};
|
||||
|
||||
function stateStack(indent, type, prev) { // represents a state stack object
|
||||
|
@ -142,7 +143,7 @@ CodeMirror.defineMode("clojure", function (options) {
|
|||
}
|
||||
|
||||
// skip spaces
|
||||
if (stream.eatSpace()) {
|
||||
if (state.mode != "string" && stream.eatSpace()) {
|
||||
return null;
|
||||
}
|
||||
var returnType = null;
|
||||
|
@ -190,7 +191,7 @@ CodeMirror.defineMode("clojure", function (options) {
|
|||
}
|
||||
|
||||
if (keyWord.length > 0 && (indentKeys.propertyIsEnumerable(keyWord) ||
|
||||
/^(?:def|with)/.test(keyWord))) { // indent-word
|
||||
tests.block_indent.test(keyWord))) { // indent-word
|
||||
pushStack(state, indentTemp + INDENT_WORD_SKIP, ch);
|
||||
} else { // non-indent word
|
||||
// we continue eating the spaces
|
||||
|
@ -243,5 +244,7 @@ CodeMirror.defineMode("clojure", function (options) {
|
|||
});
|
||||
|
||||
CodeMirror.defineMIME("text/x-clojure", "clojure");
|
||||
CodeMirror.defineMIME("text/x-clojurescript", "clojure");
|
||||
CodeMirror.defineMIME("application/edn", "clojure");
|
||||
|
||||
});
|
||||
|
|
|
@ -209,7 +209,7 @@
|
|||
|
||||
// Operators
|
||||
if (stream.match(operators)) {
|
||||
stream.eat("="); // Operators can follow assigin symbol.
|
||||
stream.eat("="); // Operators can follow assign symbol.
|
||||
return "operator";
|
||||
}
|
||||
|
||||
|
|
27
public/vendor/codemirror/mode/dart/dart.js
vendored
27
public/vendor/codemirror/mode/dart/dart.js
vendored
|
@ -72,6 +72,12 @@
|
|||
return null;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
"/": function(stream, state) {
|
||||
if (!stream.eat("*")) return false
|
||||
state.tokenize = tokenNestedComment(1)
|
||||
return state.tokenize(stream, state)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -121,6 +127,27 @@
|
|||
return "variable";
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
CodeMirror.registerHelper("hintWords", "application/dart", keywords.concat(atoms).concat(builtins));
|
||||
|
||||
// This is needed to make loading through meta.js work.
|
||||
|
|
23
public/vendor/codemirror/mode/django/django.js
vendored
23
public/vendor/codemirror/mode/django/django.js
vendored
|
@ -61,16 +61,16 @@
|
|||
|
||||
// Ignore completely any stream series that do not match the
|
||||
// Django template opening tags.
|
||||
while (stream.next() != null && !stream.match("{{", false) && !stream.match("{%", false)) {}
|
||||
while (stream.next() != null && !stream.match(/\{[{%#]/, false)) {}
|
||||
return null;
|
||||
}
|
||||
|
||||
// A string can be included in either single or double quotes (this is
|
||||
// the delimeter). Mark everything as a string until the start delimeter
|
||||
// the delimiter). Mark everything as a string until the start delimiter
|
||||
// occurs again.
|
||||
function inString (delimeter, previousTokenizer) {
|
||||
function inString (delimiter, previousTokenizer) {
|
||||
return function (stream, state) {
|
||||
if (!state.escapeNext && stream.eat(delimeter)) {
|
||||
if (!state.escapeNext && stream.eat(delimiter)) {
|
||||
state.tokenize = previousTokenizer;
|
||||
} else {
|
||||
if (state.escapeNext) {
|
||||
|
@ -80,7 +80,7 @@
|
|||
var ch = stream.next();
|
||||
|
||||
// Take into account the backslash for escaping characters, such as
|
||||
// the string delimeter.
|
||||
// the string delimiter.
|
||||
if (ch == "\\") {
|
||||
state.escapeNext = true;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@
|
|||
return "null";
|
||||
}
|
||||
|
||||
// Dot folowed by a non-word character should be considered an error.
|
||||
// Dot followed by a non-word character should be considered an error.
|
||||
if (stream.match(/\.\W+/)) {
|
||||
return "error";
|
||||
} else if (stream.eat(".")) {
|
||||
|
@ -119,7 +119,7 @@
|
|||
return "null";
|
||||
}
|
||||
|
||||
// Pipe folowed by a non-word character should be considered an error.
|
||||
// Pipe followed by a non-word character should be considered an error.
|
||||
if (stream.match(/\.\W+/)) {
|
||||
return "error";
|
||||
} else if (stream.eat("|")) {
|
||||
|
@ -199,7 +199,7 @@
|
|||
return "null";
|
||||
}
|
||||
|
||||
// Dot folowed by a non-word character should be considered an error.
|
||||
// Dot followed by a non-word character should be considered an error.
|
||||
if (stream.match(/\.\W+/)) {
|
||||
return "error";
|
||||
} else if (stream.eat(".")) {
|
||||
|
@ -218,7 +218,7 @@
|
|||
return "null";
|
||||
}
|
||||
|
||||
// Pipe folowed by a non-word character should be considered an error.
|
||||
// Pipe followed by a non-word character should be considered an error.
|
||||
if (stream.match(/\.\W+/)) {
|
||||
return "error";
|
||||
} else if (stream.eat("|")) {
|
||||
|
@ -317,9 +317,8 @@
|
|||
|
||||
// Mark everything as comment inside the tag and the tag itself.
|
||||
function inComment (stream, state) {
|
||||
if (stream.match("#}")) {
|
||||
state.tokenize = tokenBase;
|
||||
}
|
||||
if (stream.match(/^.*?#\}/)) state.tokenize = tokenBase
|
||||
else stream.skipToEnd()
|
||||
return "comment";
|
||||
}
|
||||
|
||||
|
|
12
public/vendor/codemirror/mode/dtd/dtd.js
vendored
12
public/vendor/codemirror/mode/dtd/dtd.js
vendored
|
@ -114,17 +114,17 @@ CodeMirror.defineMode("dtd", function(config) {
|
|||
|
||||
if( textAfter.match(/\]\s+|\]/) )n=n-1;
|
||||
else if(textAfter.substr(textAfter.length-1, textAfter.length) === ">"){
|
||||
if(textAfter.substr(0,1) === "<")n;
|
||||
else if( type == "doindent" && textAfter.length > 1 )n;
|
||||
if(textAfter.substr(0,1) === "<") {}
|
||||
else if( type == "doindent" && textAfter.length > 1 ) {}
|
||||
else if( type == "doindent")n--;
|
||||
else if( type == ">" && textAfter.length > 1)n;
|
||||
else if( type == "tag" && textAfter !== ">")n;
|
||||
else if( type == ">" && textAfter.length > 1) {}
|
||||
else if( type == "tag" && textAfter !== ">") {}
|
||||
else if( type == "tag" && state.stack[state.stack.length-1] == "rule")n--;
|
||||
else if( type == "tag")n++;
|
||||
else if( textAfter === ">" && state.stack[state.stack.length-1] == "rule" && type === ">")n--;
|
||||
else if( textAfter === ">" && state.stack[state.stack.length-1] == "rule")n;
|
||||
else if( textAfter === ">" && state.stack[state.stack.length-1] == "rule") {}
|
||||
else if( textAfter.substr(0,1) !== "<" && textAfter.substr(0,1) === ">" )n=n-1;
|
||||
else if( textAfter === ">")n;
|
||||
else if( textAfter === ">") {}
|
||||
else n=n-1;
|
||||
//over rule them all
|
||||
if(type == null || type == "]")n--;
|
||||
|
|
89
public/vendor/codemirror/mode/dylan/dylan.js
vendored
89
public/vendor/codemirror/mode/dylan/dylan.js
vendored
|
@ -169,15 +169,16 @@ CodeMirror.defineMode("dylan", function(_config) {
|
|||
} else if (stream.eat("/")) {
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
} else {
|
||||
stream.skipTo(" ");
|
||||
return "operator";
|
||||
}
|
||||
stream.backUp(1);
|
||||
}
|
||||
// Decimal
|
||||
else if (/\d/.test(ch)) {
|
||||
stream.match(/^\d*(?:\.\d*)?(?:e[+\-]?\d+)?/);
|
||||
return "number";
|
||||
else if (/[+\-\d\.]/.test(ch)) {
|
||||
if (stream.match(/^[+-]?[0-9]*\.[0-9]*([esdx][+-]?[0-9]+)?/i) ||
|
||||
stream.match(/^[+-]?[0-9]+([esdx][+-]?[0-9]+)/i) ||
|
||||
stream.match(/^[+-]?\d+/)) {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
// Hash
|
||||
else if (ch == "#") {
|
||||
|
@ -186,7 +187,7 @@ CodeMirror.defineMode("dylan", function(_config) {
|
|||
ch = stream.peek();
|
||||
if (ch == '"') {
|
||||
stream.next();
|
||||
return chain(stream, state, tokenString('"', "string-2"));
|
||||
return chain(stream, state, tokenString('"', "string"));
|
||||
}
|
||||
// Binary number
|
||||
else if (ch == "b") {
|
||||
|
@ -206,11 +207,51 @@ CodeMirror.defineMode("dylan", function(_config) {
|
|||
stream.eatWhile(/[0-7]/);
|
||||
return "number";
|
||||
}
|
||||
// Hash symbol
|
||||
else {
|
||||
stream.eatWhile(/[-a-zA-Z]/);
|
||||
return "keyword";
|
||||
// Token concatenation in macros
|
||||
else if (ch == '#') {
|
||||
stream.next();
|
||||
return "punctuation";
|
||||
}
|
||||
// Sequence literals
|
||||
else if ((ch == '[') || (ch == '(')) {
|
||||
stream.next();
|
||||
return "bracket";
|
||||
// Hash symbol
|
||||
} else if (stream.match(/f|t|all-keys|include|key|next|rest/i)) {
|
||||
return "atom";
|
||||
} else {
|
||||
stream.eatWhile(/[-a-zA-Z]/);
|
||||
return "error";
|
||||
}
|
||||
} else if (ch == "~") {
|
||||
stream.next();
|
||||
ch = stream.peek();
|
||||
if (ch == "=") {
|
||||
stream.next();
|
||||
ch = stream.peek();
|
||||
if (ch == "=") {
|
||||
stream.next();
|
||||
return "operator";
|
||||
}
|
||||
return "operator";
|
||||
}
|
||||
return "operator";
|
||||
} else if (ch == ":") {
|
||||
stream.next();
|
||||
ch = stream.peek();
|
||||
if (ch == "=") {
|
||||
stream.next();
|
||||
return "operator";
|
||||
} else if (ch == ":") {
|
||||
stream.next();
|
||||
return "punctuation";
|
||||
}
|
||||
} else if ("[](){}".indexOf(ch) != -1) {
|
||||
stream.next();
|
||||
return "bracket";
|
||||
} else if (".,".indexOf(ch) != -1) {
|
||||
stream.next();
|
||||
return "punctuation";
|
||||
} else if (stream.match("end")) {
|
||||
return "keyword";
|
||||
}
|
||||
|
@ -223,6 +264,10 @@ CodeMirror.defineMode("dylan", function(_config) {
|
|||
return patternStyles[name];
|
||||
}
|
||||
}
|
||||
if (/[+\-*\/^=<>&|]/.test(ch)) {
|
||||
stream.next();
|
||||
return "operator";
|
||||
}
|
||||
if (stream.match("define")) {
|
||||
return "def";
|
||||
} else {
|
||||
|
@ -240,29 +285,37 @@ CodeMirror.defineMode("dylan", function(_config) {
|
|||
}
|
||||
|
||||
function tokenComment(stream, state) {
|
||||
var maybeEnd = false,
|
||||
ch;
|
||||
var maybeEnd = false, maybeNested = false, nestedCount = 0, ch;
|
||||
while ((ch = stream.next())) {
|
||||
if (ch == "/" && maybeEnd) {
|
||||
state.tokenize = tokenBase;
|
||||
break;
|
||||
if (nestedCount > 0) {
|
||||
nestedCount--;
|
||||
} else {
|
||||
state.tokenize = tokenBase;
|
||||
break;
|
||||
}
|
||||
} else if (ch == "*" && maybeNested) {
|
||||
nestedCount++;
|
||||
}
|
||||
maybeEnd = (ch == "*");
|
||||
maybeNested = (ch == "/");
|
||||
}
|
||||
return "comment";
|
||||
}
|
||||
|
||||
function tokenString(quote, style) {
|
||||
return function(stream, state) {
|
||||
var next, end = false;
|
||||
var escaped = false, next, end = false;
|
||||
while ((next = stream.next()) != null) {
|
||||
if (next == quote) {
|
||||
if (next == quote && !escaped) {
|
||||
end = true;
|
||||
break;
|
||||
}
|
||||
escaped = !escaped && next == "\\";
|
||||
}
|
||||
if (end)
|
||||
if (end || !escaped) {
|
||||
state.tokenize = tokenBase;
|
||||
}
|
||||
return style;
|
||||
};
|
||||
}
|
||||
|
|
88
public/vendor/codemirror/mode/dylan/test.js
vendored
Normal file
88
public/vendor/codemirror/mode/dylan/test.js
vendored
Normal file
|
@ -0,0 +1,88 @@
|
|||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function() {
|
||||
var mode = CodeMirror.getMode({indentUnit: 2}, "dylan");
|
||||
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
|
||||
|
||||
MT('comments',
|
||||
'[comment // This is a line comment]',
|
||||
'[comment /* This is a block comment */]',
|
||||
'[comment /* This is a multi]',
|
||||
'[comment line comment]',
|
||||
'[comment */]',
|
||||
'[comment /* And this is a /*]',
|
||||
'[comment /* nested */ comment */]');
|
||||
|
||||
MT('unary_operators',
|
||||
'[operator -][variable a]',
|
||||
'[operator -] [variable a]',
|
||||
'[operator ~][variable a]',
|
||||
'[operator ~] [variable a]');
|
||||
|
||||
MT('binary_operators',
|
||||
'[variable a] [operator +] [variable b]',
|
||||
'[variable a] [operator -] [variable b]',
|
||||
'[variable a] [operator *] [variable b]',
|
||||
'[variable a] [operator /] [variable b]',
|
||||
'[variable a] [operator ^] [variable b]',
|
||||
'[variable a] [operator =] [variable b]',
|
||||
'[variable a] [operator ==] [variable b]',
|
||||
'[variable a] [operator ~=] [variable b]',
|
||||
'[variable a] [operator ~==] [variable b]',
|
||||
'[variable a] [operator <] [variable b]',
|
||||
'[variable a] [operator <=] [variable b]',
|
||||
'[variable a] [operator >] [variable b]',
|
||||
'[variable a] [operator >=] [variable b]',
|
||||
'[variable a] [operator &] [variable b]',
|
||||
'[variable a] [operator |] [variable b]',
|
||||
'[variable a] [operator :=] [variable b]');
|
||||
|
||||
MT('integers',
|
||||
'[number 1]',
|
||||
'[number 123]',
|
||||
'[number -123]',
|
||||
'[number +456]',
|
||||
'[number #b010]',
|
||||
'[number #o073]',
|
||||
'[number #xabcDEF123]');
|
||||
|
||||
MT('floats',
|
||||
'[number .3]',
|
||||
'[number -1.]',
|
||||
'[number -2.335]',
|
||||
'[number +3.78d1]',
|
||||
'[number 3.78s-1]',
|
||||
'[number -3.32e+5]');
|
||||
|
||||
MT('characters_and_strings',
|
||||
"[string 'a']",
|
||||
"[string '\\\\'']",
|
||||
'[string ""]',
|
||||
'[string "a"]',
|
||||
'[string "abc def"]',
|
||||
'[string "More escaped characters: \\\\\\\\ \\\\a \\\\b \\\\e \\\\f \\\\n \\\\r \\\\t \\\\0 ..."]');
|
||||
|
||||
MT('brackets',
|
||||
'[bracket #[[]]]',
|
||||
'[bracket #()]',
|
||||
'[bracket #(][number 1][bracket )]',
|
||||
'[bracket [[][number 1][punctuation ,] [number 3][bracket ]]]',
|
||||
'[bracket ()]',
|
||||
'[bracket {}]',
|
||||
'[keyword if] [bracket (][variable foo][bracket )]',
|
||||
'[bracket (][number 1][bracket )]',
|
||||
'[bracket [[][number 1][bracket ]]]');
|
||||
|
||||
MT('hash_words',
|
||||
'[punctuation ##]',
|
||||
'[atom #f]', '[atom #F]',
|
||||
'[atom #t]', '[atom #T]',
|
||||
'[atom #all-keys]',
|
||||
'[atom #include]',
|
||||
'[atom #key]',
|
||||
'[atom #next]',
|
||||
'[atom #rest]',
|
||||
'[string #"foo"]',
|
||||
'[error #invalid]');
|
||||
})();
|
173
public/vendor/codemirror/mode/fcl/fcl.js
vendored
Normal file
173
public/vendor/codemirror/mode/fcl/fcl.js
vendored
Normal file
|
@ -0,0 +1,173 @@
|
|||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://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.defineMode("fcl", function(config) {
|
||||
var indentUnit = config.indentUnit;
|
||||
|
||||
var keywords = {
|
||||
"term": true,
|
||||
"method": true, "accu": true,
|
||||
"rule": true, "then": true, "is": true, "and": true, "or": true,
|
||||
"if": true, "default": true
|
||||
};
|
||||
|
||||
var start_blocks = {
|
||||
"var_input": true,
|
||||
"var_output": true,
|
||||
"fuzzify": true,
|
||||
"defuzzify": true,
|
||||
"function_block": true,
|
||||
"ruleblock": true
|
||||
};
|
||||
|
||||
var end_blocks = {
|
||||
"end_ruleblock": true,
|
||||
"end_defuzzify": true,
|
||||
"end_function_block": true,
|
||||
"end_fuzzify": true,
|
||||
"end_var": true
|
||||
};
|
||||
|
||||
var atoms = {
|
||||
"true": true, "false": true, "nan": true,
|
||||
"real": true, "min": true, "max": true, "cog": true, "cogs": true
|
||||
};
|
||||
|
||||
var isOperatorChar = /[+\-*&^%:=<>!|\/]/;
|
||||
|
||||
function tokenBase(stream, state) {
|
||||
var ch = stream.next();
|
||||
|
||||
if (/[\d\.]/.test(ch)) {
|
||||
if (ch == ".") {
|
||||
stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/);
|
||||
} else if (ch == "0") {
|
||||
stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/);
|
||||
} else {
|
||||
stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/);
|
||||
}
|
||||
return "number";
|
||||
}
|
||||
|
||||
if (ch == "/" || ch == "(") {
|
||||
if (stream.eat("*")) {
|
||||
state.tokenize = tokenComment;
|
||||
return tokenComment(stream, state);
|
||||
}
|
||||
if (stream.eat("/")) {
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
}
|
||||
if (isOperatorChar.test(ch)) {
|
||||
stream.eatWhile(isOperatorChar);
|
||||
return "operator";
|
||||
}
|
||||
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
|
||||
|
||||
var cur = stream.current().toLowerCase();
|
||||
if (keywords.propertyIsEnumerable(cur) ||
|
||||
start_blocks.propertyIsEnumerable(cur) ||
|
||||
end_blocks.propertyIsEnumerable(cur)) {
|
||||
return "keyword";
|
||||
}
|
||||
if (atoms.propertyIsEnumerable(cur)) return "atom";
|
||||
return "variable";
|
||||
}
|
||||
|
||||
|
||||
function tokenComment(stream, state) {
|
||||
var maybeEnd = false, ch;
|
||||
while (ch = stream.next()) {
|
||||
if ((ch == "/" || ch == ")") && maybeEnd) {
|
||||
state.tokenize = tokenBase;
|
||||
break;
|
||||
}
|
||||
maybeEnd = (ch == "*");
|
||||
}
|
||||
return "comment";
|
||||
}
|
||||
|
||||
function Context(indented, column, type, align, prev) {
|
||||
this.indented = indented;
|
||||
this.column = column;
|
||||
this.type = type;
|
||||
this.align = align;
|
||||
this.prev = prev;
|
||||
}
|
||||
|
||||
function pushContext(state, col, type) {
|
||||
return state.context = new Context(state.indented, col, type, null, state.context);
|
||||
}
|
||||
|
||||
function popContext(state) {
|
||||
if (!state.context.prev) return;
|
||||
var t = state.context.type;
|
||||
if (t == "end_block")
|
||||
state.indented = state.context.indented;
|
||||
return state.context = state.context.prev;
|
||||
}
|
||||
|
||||
// Interface
|
||||
|
||||
return {
|
||||
startState: function(basecolumn) {
|
||||
return {
|
||||
tokenize: null,
|
||||
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
|
||||
indented: 0,
|
||||
startOfLine: true
|
||||
};
|
||||
},
|
||||
|
||||
token: function(stream, state) {
|
||||
var ctx = state.context;
|
||||
if (stream.sol()) {
|
||||
if (ctx.align == null) ctx.align = false;
|
||||
state.indented = stream.indentation();
|
||||
state.startOfLine = true;
|
||||
}
|
||||
if (stream.eatSpace()) return null;
|
||||
|
||||
var style = (state.tokenize || tokenBase)(stream, state);
|
||||
if (style == "comment") return style;
|
||||
if (ctx.align == null) ctx.align = true;
|
||||
|
||||
var cur = stream.current().toLowerCase();
|
||||
|
||||
if (start_blocks.propertyIsEnumerable(cur)) pushContext(state, stream.column(), "end_block");
|
||||
else if (end_blocks.propertyIsEnumerable(cur)) popContext(state);
|
||||
|
||||
state.startOfLine = false;
|
||||
return style;
|
||||
},
|
||||
|
||||
indent: function(state, textAfter) {
|
||||
if (state.tokenize != tokenBase && state.tokenize != null) return 0;
|
||||
var ctx = state.context;
|
||||
|
||||
var closing = end_blocks.propertyIsEnumerable(textAfter);
|
||||
if (ctx.align) return ctx.column + (closing ? 0 : 1);
|
||||
else return ctx.indented + (closing ? 0 : indentUnit);
|
||||
},
|
||||
|
||||
electricChars: "ryk",
|
||||
fold: "brace",
|
||||
blockCommentStart: "(*",
|
||||
blockCommentEnd: "*)",
|
||||
lineComment: "//"
|
||||
};
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("text/x-fcl", "fcl");
|
||||
});
|
108
public/vendor/codemirror/mode/fcl/index.html
vendored
Normal file
108
public/vendor/codemirror/mode/fcl/index.html
vendored
Normal file
|
@ -0,0 +1,108 @@
|
|||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: FCL mode</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel=stylesheet href="../../doc/docs.css">
|
||||
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<link rel="stylesheet" href="../../theme/elegant.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="../../addon/edit/matchbrackets.js"></script>
|
||||
<script src="fcl.js"></script>
|
||||
<style>.CodeMirror {border:1px solid #999; background:#ffc}</style>
|
||||
<div id=nav>
|
||||
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
|
||||
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a>
|
||||
<li><a href="../../doc/manual.html">Manual</a>
|
||||
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="../index.html">Language modes</a>
|
||||
<li><a class=active href="#">FCL</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>FCL mode</h2>
|
||||
<form><textarea id="code" name="code">
|
||||
FUNCTION_BLOCK Fuzzy_FB
|
||||
VAR_INPUT
|
||||
TimeDay : REAL; (* RANGE(0 .. 23) *)
|
||||
ApplicateHost: REAL;
|
||||
TimeConfiguration: REAL;
|
||||
TimeRequirements: REAL;
|
||||
END_VAR
|
||||
|
||||
VAR_OUTPUT
|
||||
ProbabilityDistribution: REAL;
|
||||
ProbabilityAccess: REAL;
|
||||
END_VAR
|
||||
|
||||
FUZZIFY TimeDay
|
||||
TERM inside := (0, 0) (8, 1) (22,0);
|
||||
TERM outside := (0, 1) (8, 0) (22, 1);
|
||||
END_FUZZIFY
|
||||
|
||||
FUZZIFY ApplicateHost
|
||||
TERM few := (0, 1) (100, 0) (200, 0);
|
||||
TERM many := (0, 0) (100, 0) (200, 1);
|
||||
END_FUZZIFY
|
||||
|
||||
FUZZIFY TimeConfiguration
|
||||
TERM recently := (0, 1) (30, 1) (120, 0);
|
||||
TERM long := (0, 0) (30, 0) (120, 1);
|
||||
END_FUZZIFY
|
||||
|
||||
FUZZIFY TimeRequirements
|
||||
TERM recently := (0, 1) (30, 1) (365, 0);
|
||||
TERM long := (0, 0) (30, 0) (365, 1);
|
||||
END_FUZZIFY
|
||||
|
||||
DEFUZZIFY ProbabilityAccess
|
||||
TERM hight := 1;
|
||||
TERM medium := 0.5;
|
||||
TERM low := 0;
|
||||
ACCU: MAX;
|
||||
METHOD: COGS;
|
||||
DEFAULT := 0;
|
||||
END_DEFUZZIFY
|
||||
|
||||
DEFUZZIFY ProbabilityDistribution
|
||||
TERM hight := 1;
|
||||
TERM medium := 0.5;
|
||||
TERM low := 0;
|
||||
ACCU: MAX;
|
||||
METHOD: COGS;
|
||||
DEFAULT := 0;
|
||||
END_DEFUZZIFY
|
||||
|
||||
RULEBLOCK No1
|
||||
AND : MIN;
|
||||
RULE 1 : IF TimeDay IS outside AND ApplicateHost IS few THEN ProbabilityAccess IS hight;
|
||||
RULE 2 : IF ApplicateHost IS many THEN ProbabilityAccess IS hight;
|
||||
RULE 3 : IF TimeDay IS inside AND ApplicateHost IS few THEN ProbabilityAccess IS low;
|
||||
END_RULEBLOCK
|
||||
|
||||
RULEBLOCK No2
|
||||
AND : MIN;
|
||||
RULE 1 : IF ApplicateHost IS many THEN ProbabilityDistribution IS hight;
|
||||
END_RULEBLOCK
|
||||
|
||||
END_FUNCTION_BLOCK
|
||||
</textarea></form>
|
||||
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
theme: "elegant",
|
||||
matchBrackets: true,
|
||||
indentUnit: 8,
|
||||
tabSize: 8,
|
||||
indentWithTabs: true,
|
||||
mode: "text/x-fcl"
|
||||
});
|
||||
</script>
|
||||
|
||||
<p><strong>MIME type:</strong> <code>text/x-fcl</code></p>
|
||||
</article>
|
2
public/vendor/codemirror/mode/gfm/index.html
vendored
2
public/vendor/codemirror/mode/gfm/index.html
vendored
|
@ -47,7 +47,7 @@ Underscores_are_allowed_between_words.
|
|||
GFM adds syntax to strikethrough text, which is missing from standard Markdown.
|
||||
|
||||
~~Mistaken text.~~
|
||||
~~**works with other fomatting**~~
|
||||
~~**works with other formatting**~~
|
||||
|
||||
~~spans across
|
||||
lines~~
|
||||
|
|
6
public/vendor/codemirror/mode/gfm/test.js
vendored
6
public/vendor/codemirror/mode/gfm/test.js
vendored
|
@ -51,6 +51,12 @@
|
|||
"[comment ```]",
|
||||
"bar");
|
||||
|
||||
MT("fencedCodeBlockModeSwitchingObjc",
|
||||
"[comment ```objective-c]",
|
||||
"[keyword @property] [variable NSString] [operator *] [variable foo];",
|
||||
"[comment ```]",
|
||||
"bar");
|
||||
|
||||
MT("fencedCodeBlocksNoTildes",
|
||||
"~~~",
|
||||
"foo",
|
||||
|
|
2
public/vendor/codemirror/mode/haml/haml.js
vendored
2
public/vendor/codemirror/mode/haml/haml.js
vendored
|
@ -11,7 +11,7 @@
|
|||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
// full haml mode. This handled embeded ruby and html fragments too
|
||||
// full haml mode. This handled embedded ruby and html fragments too
|
||||
CodeMirror.defineMode("haml", function(config) {
|
||||
var htmlMode = CodeMirror.getMode(config, {name: "htmlmixed"});
|
||||
var rubyMode = CodeMirror.getMode(config, "ruby");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!doctype html>
|
||||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: Handlebars mode</title>
|
||||
<meta charset="utf-8"/>
|
||||
|
@ -71,4 +71,9 @@
|
|||
<p>Handlebars syntax highlighting for CodeMirror.</p>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>text/x-handlebars-template</code></p>
|
||||
|
||||
<p>Supported options: <code>base</code> to set the mode to
|
||||
wrap. For example, use</p>
|
||||
<pre>mode: {name: "handlebars", base: "text/html"}</pre>
|
||||
<p>to highlight an HTML template.</p>
|
||||
</article>
|
||||
|
|
|
@ -40,4 +40,4 @@
|
|||
}, "haskell")
|
||||
|
||||
CodeMirror.defineMIME("text/x-literate-haskell", "haskell-literate")
|
||||
})
|
||||
});
|
||||
|
|
|
@ -52,7 +52,7 @@ This is an example of EJS (embedded javascript)
|
|||
</script>
|
||||
|
||||
<p>Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on
|
||||
JavaScript, CSS and XML.<br />Other dependancies include those of the scriping language chosen.</p>
|
||||
JavaScript, CSS and XML.<br />Other dependencies include those of the scripting language chosen.</p>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>application/x-aspx</code> (ASP.NET),
|
||||
<code>application/x-ejs</code> (Embedded Javascript), <code>application/x-jsp</code> (JavaServer Pages)</p>
|
||||
|
|
|
@ -44,13 +44,9 @@
|
|||
return attrRegexpCache[attr] = new RegExp("\\s+" + attr + "\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*");
|
||||
}
|
||||
|
||||
function getAttrValue(stream, attr) {
|
||||
var pos = stream.pos, match;
|
||||
while (pos >= 0 && stream.string.charAt(pos) !== "<") pos--;
|
||||
if (pos < 0) return pos;
|
||||
if (match = stream.string.slice(pos, stream.pos).match(getAttrRegexp(attr)))
|
||||
return match[2];
|
||||
return "";
|
||||
function getAttrValue(text, attr) {
|
||||
var match = text.match(getAttrRegexp(attr))
|
||||
return match ? match[2] : ""
|
||||
}
|
||||
|
||||
function getTagRegexp(tagName, anchored) {
|
||||
|
@ -66,10 +62,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
function findMatchingMode(tagInfo, stream) {
|
||||
function findMatchingMode(tagInfo, tagText) {
|
||||
for (var i = 0; i < tagInfo.length; i++) {
|
||||
var spec = tagInfo[i];
|
||||
if (!spec[0] || spec[1].test(getAttrValue(stream, spec[0]))) return spec[2];
|
||||
if (!spec[0] || spec[1].test(getAttrValue(tagText, spec[0]))) return spec[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,15 +85,17 @@
|
|||
tags.script.unshift(["type", configScript[i].matches, configScript[i].mode])
|
||||
|
||||
function html(stream, state) {
|
||||
var tagName = state.htmlState.tagName && state.htmlState.tagName.toLowerCase();
|
||||
var tagInfo = tagName && tags.hasOwnProperty(tagName) && tags[tagName];
|
||||
|
||||
var style = htmlMode.token(stream, state.htmlState), modeSpec;
|
||||
|
||||
if (tagInfo && /\btag\b/.test(style) && stream.current() === ">" &&
|
||||
(modeSpec = findMatchingMode(tagInfo, stream))) {
|
||||
var mode = CodeMirror.getMode(config, modeSpec);
|
||||
var endTagA = getTagRegexp(tagName, true), endTag = getTagRegexp(tagName, false);
|
||||
var style = htmlMode.token(stream, state.htmlState), tag = /\btag\b/.test(style), tagName
|
||||
if (tag && !/[<>\s\/]/.test(stream.current()) &&
|
||||
(tagName = state.htmlState.tagName && state.htmlState.tagName.toLowerCase()) &&
|
||||
tags.hasOwnProperty(tagName)) {
|
||||
state.inTag = tagName + " "
|
||||
} else if (state.inTag && tag && />$/.test(stream.current())) {
|
||||
var inTag = /^([\S]+) (.*)/.exec(state.inTag)
|
||||
state.inTag = null
|
||||
var modeSpec = stream.current() == ">" && findMatchingMode(tags[inTag[1]], inTag[2])
|
||||
var mode = CodeMirror.getMode(config, modeSpec)
|
||||
var endTagA = getTagRegexp(inTag[1], true), endTag = getTagRegexp(inTag[1], false);
|
||||
state.token = function (stream, state) {
|
||||
if (stream.match(endTagA, false)) {
|
||||
state.token = html;
|
||||
|
@ -108,6 +106,9 @@
|
|||
};
|
||||
state.localMode = mode;
|
||||
state.localState = CodeMirror.startState(mode, htmlMode.indent(state.htmlState, ""));
|
||||
} else if (state.inTag) {
|
||||
state.inTag += stream.current()
|
||||
if (stream.eol()) state.inTag += " "
|
||||
}
|
||||
return style;
|
||||
};
|
||||
|
@ -115,7 +116,7 @@
|
|||
return {
|
||||
startState: function () {
|
||||
var state = htmlMode.startState();
|
||||
return {token: html, localMode: null, localState: null, htmlState: state};
|
||||
return {token: html, inTag: null, localMode: null, localState: null, htmlState: state};
|
||||
},
|
||||
|
||||
copyState: function (state) {
|
||||
|
@ -123,7 +124,8 @@
|
|||
if (state.localState) {
|
||||
local = CodeMirror.copyState(state.localMode, state.localState);
|
||||
}
|
||||
return {token: state.token, localMode: state.localMode, localState: local,
|
||||
return {token: state.token, inTag: state.inTag,
|
||||
localMode: state.localMode, localState: local,
|
||||
htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
|
||||
},
|
||||
|
||||
|
|
6
public/vendor/codemirror/mode/index.html
vendored
6
public/vendor/codemirror/mode/index.html
vendored
|
@ -59,6 +59,7 @@ option.</p>
|
|||
<li><a href="elm/index.html">Elm</a></li>
|
||||
<li><a href="erlang/index.html">Erlang</a></li>
|
||||
<li><a href="factor/index.html">Factor</a></li>
|
||||
<li><a href="fcl/index.html">FCL</a></li>
|
||||
<li><a href="forth/index.html">Forth</a></li>
|
||||
<li><a href="fortran/index.html">Fortran</a></li>
|
||||
<li><a href="mllike/index.html">F#</a></li>
|
||||
|
@ -102,7 +103,9 @@ option.</p>
|
|||
<li><a href="asciiarmor/index.html">PGP (ASCII armor)</a></li>
|
||||
<li><a href="php/index.html">PHP</a></li>
|
||||
<li><a href="pig/index.html">Pig Latin</a></li>
|
||||
<li><a href="powershell/index.html">PowerShell</a></li>
|
||||
<li><a href="properties/index.html">Properties files</a></li>
|
||||
<li><a href="protobuf/index.html">ProtoBuf</a></li>
|
||||
<li><a href="puppet/index.html">Puppet</a></li>
|
||||
<li><a href="python/index.html">Python</a></li>
|
||||
<li><a href="q/index.html">Q</a></li>
|
||||
|
@ -111,6 +114,7 @@ option.</p>
|
|||
<li><a href="rst/index.html">reStructuredText</a></li>
|
||||
<li><a href="ruby/index.html">Ruby</a></li>
|
||||
<li><a href="rust/index.html">Rust</a></li>
|
||||
<li><a href="sas/index.html">SAS</a></li>
|
||||
<li><a href="sass/index.html">Sass</a></li>
|
||||
<li><a href="spreadsheet/index.html">Spreadsheet</a></li>
|
||||
<li><a href="clike/scala.html">Scala</a></li>
|
||||
|
@ -146,8 +150,10 @@ option.</p>
|
|||
<li><a href="verilog/index.html">Verilog/SystemVerilog</a></li>
|
||||
<li><a href="vhdl/index.html">VHDL</a></li>
|
||||
<li><a href="vue/index.html">Vue.js app</a></li>
|
||||
<li><a href="webidl/index.html">Web IDL</a></li>
|
||||
<li><a href="xml/index.html">XML/HTML</a></li>
|
||||
<li><a href="xquery/index.html">XQuery</a></li>
|
||||
<li><a href="yacas/index.html">Yacas</a></li>
|
||||
<li><a href="yaml/index.html">YAML</a></li>
|
||||
<li><a href="yaml-frontmatter/index.html">YAML frontmatter</a></li>
|
||||
<li><a href="z80/index.html">Z80</a></li>
|
||||
|
|
6
public/vendor/codemirror/mode/jsx/jsx.js
vendored
6
public/vendor/codemirror/mode/jsx/jsx.js
vendored
|
@ -25,9 +25,9 @@
|
|||
context.prev && copyContext(context.prev))
|
||||
}
|
||||
|
||||
CodeMirror.defineMode("jsx", function(config) {
|
||||
CodeMirror.defineMode("jsx", function(config, modeConfig) {
|
||||
var xmlMode = CodeMirror.getMode(config, {name: "xml", allowMissing: true, multilineTagIndentPastTag: false})
|
||||
var jsMode = CodeMirror.getMode(config, "javascript")
|
||||
var jsMode = CodeMirror.getMode(config, modeConfig && modeConfig.base || "javascript")
|
||||
|
||||
function flatXMLIndent(state) {
|
||||
var tagName = state.tagName
|
||||
|
@ -144,4 +144,4 @@
|
|||
}, "xml", "javascript")
|
||||
|
||||
CodeMirror.defineMIME("text/jsx", "jsx")
|
||||
})
|
||||
});
|
||||
|
|
150
public/vendor/codemirror/mode/julia/julia.js
vendored
150
public/vendor/codemirror/mode/julia/julia.js
vendored
|
@ -14,27 +14,34 @@
|
|||
CodeMirror.defineMode("julia", function(_conf, parserConf) {
|
||||
var ERRORCLASS = 'error';
|
||||
|
||||
function wordRegexp(words) {
|
||||
return new RegExp("^((" + words.join(")|(") + "))\\b");
|
||||
function wordRegexp(words, end) {
|
||||
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 delimiters = parserConf.delimiters || /^[;,()[\]{}]/;
|
||||
var identifiers = parserConf.identifiers || /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*!*/;
|
||||
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 stringPrefixes = /^(`|"{3}|([brv]?"))/;
|
||||
var chars = wordRegexp(charsList, "'");
|
||||
var keywords = wordRegexp(keywordList);
|
||||
var builtins = wordRegexp(builtinList);
|
||||
var openers = wordRegexp(blockOpeners);
|
||||
var closers = wordRegexp(blockClosers);
|
||||
var macro = /^@[_A-Za-z][_A-Za-z0-9]*/;
|
||||
var symbol = /^:[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*!*/;
|
||||
var typeAnnotation = /^::[^.,;"{()=$\s]+({[^}]*}+)*/;
|
||||
var macro = /^@[_A-Za-z][\w]*/;
|
||||
var symbol = /^:[_A-Za-z\u00A1-\uFFFF][\w\u00A1-\uFFFF]*!*/;
|
||||
var typeAnnotation = /^::[^,;"{()=$\s]+({[^}]*}+)*/;
|
||||
|
||||
function inArray(state) {
|
||||
var ch = currentScope(state);
|
||||
|
@ -53,19 +60,10 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
|
|||
|
||||
// tokenizers
|
||||
function tokenBase(stream, state) {
|
||||
//Handle multiline comments
|
||||
if (stream.match(/^#=\s*/)) {
|
||||
state.scopes.push('#=');
|
||||
}
|
||||
if (currentScope(state) == '#=' && stream.match(/^=#/)) {
|
||||
state.scopes.pop();
|
||||
return 'comment';
|
||||
}
|
||||
if (state.scopes.indexOf('#=') >= 0) {
|
||||
if (!stream.match(/.*?(?=(#=|=#))/)) {
|
||||
stream.skipToEnd();
|
||||
}
|
||||
return 'comment';
|
||||
// Handle multiline comments
|
||||
if (stream.match(/^#=/, false)) {
|
||||
state.tokenize = tokenComment;
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
|
||||
// Handle scope changes
|
||||
|
@ -100,6 +98,10 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
|
|||
state.scopes.push('[');
|
||||
}
|
||||
|
||||
if (ch === '(') {
|
||||
state.scopes.push('(');
|
||||
}
|
||||
|
||||
var scope = currentScope(state);
|
||||
|
||||
if (scope == '[' && ch === ']') {
|
||||
|
@ -137,33 +139,20 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
|
|||
// Handle Number Literals
|
||||
if (stream.match(/^[0-9\.]/, false)) {
|
||||
var imMatcher = RegExp(/^im\b/);
|
||||
var floatLiteral = false;
|
||||
var numberLiteral = false;
|
||||
// Floats
|
||||
if (stream.match(/^\d*\.(?!\.)\d+([ef][\+\-]?\d+)?/i)) { floatLiteral = true; }
|
||||
if (stream.match(/^\d+\.(?!\.)\d*/)) { floatLiteral = true; }
|
||||
if (stream.match(/^\.\d+/)) { floatLiteral = true; }
|
||||
if (stream.match(/^0x\.[0-9a-f]+p[\+\-]?\d+/i)) { floatLiteral = true; }
|
||||
if (floatLiteral) {
|
||||
// Float literals may be "imaginary"
|
||||
stream.match(imMatcher);
|
||||
state.leavingExpr = true;
|
||||
return 'number';
|
||||
}
|
||||
if (stream.match(/^\d*\.(?!\.)\d*([Eef][\+\-]?\d+)?/i)) { numberLiteral = true; }
|
||||
if (stream.match(/^\d+\.(?!\.)\d*/)) { numberLiteral = true; }
|
||||
if (stream.match(/^\.\d+/)) { numberLiteral = true; }
|
||||
if (stream.match(/^0x\.[0-9a-f]+p[\+\-]?\d+/i)) { numberLiteral = true; }
|
||||
// Integers
|
||||
var intLiteral = false;
|
||||
// Hex
|
||||
if (stream.match(/^0x[0-9a-f]+/i)) { intLiteral = true; }
|
||||
// Binary
|
||||
if (stream.match(/^0b[01]+/i)) { intLiteral = true; }
|
||||
// Octal
|
||||
if (stream.match(/^0o[0-7]+/i)) { intLiteral = true; }
|
||||
// Decimal
|
||||
if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) {
|
||||
intLiteral = true;
|
||||
}
|
||||
if (stream.match(/^0x[0-9a-f]+/i)) { numberLiteral = true; } // Hex
|
||||
if (stream.match(/^0b[01]+/i)) { numberLiteral = true; } // Binary
|
||||
if (stream.match(/^0o[0-7]+/i)) { numberLiteral = true; } // Octal
|
||||
if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) { numberLiteral = true; } // Decimal
|
||||
// Zero by itself with no other piece of number.
|
||||
if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; }
|
||||
if (intLiteral) {
|
||||
if (stream.match(/^0(?![\dx])/i)) { numberLiteral = true; }
|
||||
if (numberLiteral) {
|
||||
// Integer literals may be "long"
|
||||
stream.match(imMatcher);
|
||||
state.leavingExpr = true;
|
||||
|
@ -194,6 +183,12 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
|
|||
return 'operator';
|
||||
}
|
||||
|
||||
// Handle Chars
|
||||
if (stream.match(/^'/)) {
|
||||
state.tokenize = tokenChar;
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
|
||||
// Handle Strings
|
||||
if (stream.match(stringPrefixes)) {
|
||||
state.tokenize = tokenStringFactory(stream.current());
|
||||
|
@ -269,7 +264,7 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
|
|||
// over two or more lines.
|
||||
if (stream.match(/^$/g, false)) {
|
||||
stream.backUp(state.charsAdvanced);
|
||||
while (state.scopes.length > state.firstParenPos + 1)
|
||||
while (state.scopes.length > state.firstParenPos)
|
||||
state.scopes.pop();
|
||||
state.firstParenPos = -1;
|
||||
state.charsAdvanced = 0;
|
||||
|
@ -279,33 +274,65 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
|
|||
return callOrDef(stream, state);
|
||||
}
|
||||
|
||||
function tokenComment(stream, state) {
|
||||
if (stream.match(/^#=/)) {
|
||||
state.weakScopes++;
|
||||
}
|
||||
if (!stream.match(/.*?(?=(#=|=#))/)) {
|
||||
stream.skipToEnd();
|
||||
}
|
||||
if (stream.match(/^=#/)) {
|
||||
state.weakScopes--;
|
||||
if (state.weakScopes == 0)
|
||||
state.tokenize = tokenBase;
|
||||
}
|
||||
return 'comment';
|
||||
}
|
||||
|
||||
function tokenChar(stream, state) {
|
||||
var isChar = false, match;
|
||||
if (stream.match(chars)) {
|
||||
isChar = true;
|
||||
} else if (match = stream.match(/\\u([a-f0-9]{1,4})(?=')/i)) {
|
||||
var value = parseInt(match[1], 16);
|
||||
if (value <= 55295 || value >= 57344) { // (U+0,U+D7FF), (U+E000,U+FFFF)
|
||||
isChar = true;
|
||||
stream.next();
|
||||
}
|
||||
} else if (match = stream.match(/\\U([A-Fa-f0-9]{5,8})(?=')/)) {
|
||||
var value = parseInt(match[1], 16);
|
||||
if (value <= 1114111) { // U+10FFFF
|
||||
isChar = true;
|
||||
stream.next();
|
||||
}
|
||||
}
|
||||
if (isChar) {
|
||||
state.leavingExpr = true;
|
||||
state.tokenize = tokenBase;
|
||||
return 'string';
|
||||
}
|
||||
if (!stream.match(/^[^']+(?=')/)) { stream.skipToEnd(); }
|
||||
if (stream.match(/^'/)) { state.tokenize = tokenBase; }
|
||||
return ERRORCLASS;
|
||||
}
|
||||
|
||||
function tokenStringFactory(delimiter) {
|
||||
while ('bruv'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) {
|
||||
delimiter = delimiter.substr(1);
|
||||
}
|
||||
var singleline = delimiter == "'";
|
||||
var OUTCLASS = 'string';
|
||||
|
||||
function tokenString(stream, state) {
|
||||
while (!stream.eol()) {
|
||||
stream.eatWhile(/[^'"\\]/);
|
||||
stream.eatWhile(/[^"\\]/);
|
||||
if (stream.eat('\\')) {
|
||||
stream.next();
|
||||
if (singleline && stream.eol()) {
|
||||
return OUTCLASS;
|
||||
}
|
||||
} else if (stream.match(delimiter)) {
|
||||
state.tokenize = tokenBase;
|
||||
state.leavingExpr = true;
|
||||
return OUTCLASS;
|
||||
} else {
|
||||
stream.eat(/['"]/);
|
||||
}
|
||||
}
|
||||
if (singleline) {
|
||||
if (parserConf.singleLineStringErrors) {
|
||||
return ERRORCLASS;
|
||||
} else {
|
||||
state.tokenize = tokenBase;
|
||||
stream.eat(/["]/);
|
||||
}
|
||||
}
|
||||
return OUTCLASS;
|
||||
|
@ -319,6 +346,7 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
|
|||
return {
|
||||
tokenize: tokenBase,
|
||||
scopes: [],
|
||||
weakScopes: 0,
|
||||
lastToken: null,
|
||||
leavingExpr: false,
|
||||
isDefinition: false,
|
||||
|
@ -345,15 +373,15 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
|
|||
|
||||
indent: function(state, textAfter) {
|
||||
var delta = 0;
|
||||
if (textAfter == "end" || textAfter == "]" || textAfter == "}" || textAfter == "else" || textAfter == "elseif" || textAfter == "catch" || textAfter == "finally") {
|
||||
if (textAfter == "]" || textAfter == ")" || textAfter == "end" || textAfter == "else" || textAfter == "elseif" || textAfter == "catch" || textAfter == "finally") {
|
||||
delta = -1;
|
||||
}
|
||||
return (state.scopes.length + delta) * _conf.indentUnit;
|
||||
},
|
||||
|
||||
electricInput: /(end|else(if)?|catch|finally)$/,
|
||||
lineComment: "#",
|
||||
fold: "indent",
|
||||
electricChars: "edlsifyh]}"
|
||||
fold: "indent"
|
||||
};
|
||||
return external;
|
||||
});
|
||||
|
|
|
@ -88,7 +88,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
, setextHeaderRE = /^ *(?:\={1,}|-{1,})\s*$/
|
||||
, textRE = /^[^#!\[\]*_\\<>` "'(~]+/
|
||||
, fencedCodeRE = new RegExp("^(" + (modeCfg.fencedCodeBlocks === true ? "~~~+|```+" : modeCfg.fencedCodeBlocks) +
|
||||
")[ \\t]*([\\w+#]*)");
|
||||
")[ \\t]*([\\w+#\-]*)");
|
||||
|
||||
function switchInline(stream, state, f) {
|
||||
state.f = state.inline = f;
|
||||
|
@ -804,4 +804,4 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
|
||||
CodeMirror.defineMIME("text/x-markdown", "markdown");
|
||||
|
||||
});
|
||||
});
|
||||
|
|
18
public/vendor/codemirror/mode/markdown/test.js
vendored
18
public/vendor/codemirror/mode/markdown/test.js
vendored
|
@ -452,6 +452,18 @@
|
|||
"",
|
||||
"hello");
|
||||
|
||||
MT("listCommonMarkIndentationCode",
|
||||
"[variable-2 * Code blocks also affect]",
|
||||
" [variable-3 * The next level starts where the contents start.]",
|
||||
" [variable-3 * Anything less than that will keep the item on the same level.]",
|
||||
" [variable-3 * Each list item can indent the first level further and further.]",
|
||||
" [variable-3 * For the most part, this makes sense while writing a list.]",
|
||||
" [keyword * This means two items with same indentation can be different levels.]",
|
||||
" [keyword * Each level has an indent requirement that can change between items.]",
|
||||
" [keyword * A list item that meets this will be part of the next level.]",
|
||||
" [variable-3 * Otherwise, it will be part of the level where it does meet this.]",
|
||||
" [variable-2 * World]");
|
||||
|
||||
// Blockquote
|
||||
MT("blockquote",
|
||||
"[variable-2 * foo]",
|
||||
|
@ -635,7 +647,7 @@
|
|||
MT("linkReferenceEmStrong",
|
||||
"[link [[][link&strong **][link&em&strong *foo**][link&em *][link ]]][string&url [[bar]]] hello");
|
||||
|
||||
// Reference-style links with optional space separator (per docuentation)
|
||||
// Reference-style links with optional space separator (per documentation)
|
||||
// "You can optionally use a space to separate the sets of brackets"
|
||||
MT("linkReferenceSpace",
|
||||
"[link [[foo]]] [string&url [[bar]]] hello");
|
||||
|
@ -671,7 +683,7 @@
|
|||
MT("labelTitleSingleQuotes",
|
||||
"[link [[foo]]:] [string&url http://example.com/ 'bar']");
|
||||
|
||||
MT("labelTitleParenthese",
|
||||
MT("labelTitleParentheses",
|
||||
"[link [[foo]]:] [string&url http://example.com/ (bar)]");
|
||||
|
||||
MT("labelTitleInvalid",
|
||||
|
@ -688,7 +700,7 @@
|
|||
"[link [[foo]]:] [string&url http://example.com/]",
|
||||
"[string 'bar'] hello");
|
||||
|
||||
MT("labelTitleNextParenthese",
|
||||
MT("labelTitleNextParentheses",
|
||||
"[link [[foo]]:] [string&url http://example.com/]",
|
||||
"[string (bar)] hello");
|
||||
|
||||
|
|
|
@ -126,6 +126,7 @@ CodeMirror.defineMode('mathematica', function(_config, _parserConfig) {
|
|||
}
|
||||
|
||||
// everything else is an error
|
||||
stream.next(); // advance the stream.
|
||||
return 'error';
|
||||
}
|
||||
|
||||
|
|
21
public/vendor/codemirror/mode/meta.js
vendored
21
public/vendor/codemirror/mode/meta.js
vendored
|
@ -21,7 +21,8 @@
|
|||
{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"]},
|
||||
{name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj"]},
|
||||
{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", mime: "text/x-coffeescript", mode: "coffeescript", ext: ["coffee"], alias: ["coffee", "coffee-script"]},
|
||||
|
@ -40,12 +41,14 @@
|
|||
{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: "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"]},
|
||||
{name: "F#", mime: "text/x-fsharp", mode: "mllike", ext: ["fs"], alias: ["fsharp"]},
|
||||
|
@ -53,7 +56,7 @@
|
|||
{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"]},
|
||||
{name: "Groovy", mime: "text/x-groovy", mode: "groovy", ext: ["groovy", "gradle"]},
|
||||
{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"]},
|
||||
|
@ -82,13 +85,13 @@
|
|||
{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"},
|
||||
{name: "MUMPS", mime: "text/x-mumps", mode: "mumps", ext: ["mps"]},
|
||||
{name: "MS SQL", mime: "text/x-mssql", mode: "sql"},
|
||||
{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", mime: "text/n-triples", mode: "ntriples", ext: ["nt"]},
|
||||
{name: "Objective C", mime: "text/x-objectivec", mode: "clike", ext: ["m", "mm"]},
|
||||
{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"]},
|
||||
|
@ -99,8 +102,10 @@
|
|||
{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: "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: "Python", mime: "text/x-python", mode: "python", ext: ["py", "pyw"]},
|
||||
{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"], alias: ["rscript"]},
|
||||
|
@ -109,6 +114,7 @@
|
|||
{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"]},
|
||||
|
@ -125,7 +131,6 @@
|
|||
{name: "SQL", mime: "text/x-sql", mode: "sql", ext: ["sql"]},
|
||||
{name: "Squirrel", mime: "text/x-squirrel", mode: "clike", ext: ["nut"]},
|
||||
{name: "Swift", mime: "text/x-swift", mode: "swift", ext: ["swift"]},
|
||||
{name: "MariaDB", mime: "text/x-mariadb", mode: "sql"},
|
||||
{name: "sTeX", mime: "text/x-stex", mode: "stex"},
|
||||
{name: "LaTeX", mime: "text/x-latex", mode: "stex", ext: ["text", "ltx"], alias: ["tex"]},
|
||||
{name: "SystemVerilog", mime: "text/x-systemverilog", mode: "verilog", ext: ["v"]},
|
||||
|
@ -135,12 +140,13 @@
|
|||
{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: "troff", mode: "troff", ext: ["1", "2", "3", "4", "5", "6", "7", "8", "9"]},
|
||||
{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: "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"]},
|
||||
|
@ -148,6 +154,7 @@
|
|||
{name: "VHDL", mime: "text/x-vhdl", mode: "vhdl", ext: ["vhd", "vhdl"]},
|
||||
{name: "XML", mimes: ["application/xml", "text/xml"], mode: "xml", ext: ["xml", "xsl", "xsd"], 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", mime: "text/x-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"]},
|
||||
|
|
|
@ -65,7 +65,7 @@ global persistent
|
|||
|
||||
%one line comment
|
||||
%{ multi
|
||||
line commment %}
|
||||
line comment %}
|
||||
|
||||
</textarea></div>
|
||||
<script>
|
||||
|
|
10
public/vendor/codemirror/mode/pegjs/pegjs.js
vendored
10
public/vendor/codemirror/mode/pegjs/pegjs.js
vendored
|
@ -24,7 +24,7 @@ CodeMirror.defineMode("pegjs", function (config) {
|
|||
inString: false,
|
||||
stringType: null,
|
||||
inComment: false,
|
||||
inChracterClass: false,
|
||||
inCharacterClass: false,
|
||||
braced: 0,
|
||||
lhs: true,
|
||||
localState: null
|
||||
|
@ -66,15 +66,15 @@ CodeMirror.defineMode("pegjs", function (config) {
|
|||
}
|
||||
}
|
||||
return "comment";
|
||||
} else if (state.inChracterClass) {
|
||||
while (state.inChracterClass && !stream.eol()) {
|
||||
} else if (state.inCharacterClass) {
|
||||
while (state.inCharacterClass && !stream.eol()) {
|
||||
if (!(stream.match(/^[^\]\\]+/) || stream.match(/^\\./))) {
|
||||
state.inChracterClass = false;
|
||||
state.inCharacterClass = false;
|
||||
}
|
||||
}
|
||||
} else if (stream.peek() === '[') {
|
||||
stream.next();
|
||||
state.inChracterClass = true;
|
||||
state.inCharacterClass = true;
|
||||
return 'bracket';
|
||||
} else if (stream.match(/^\/\//)) {
|
||||
stream.skipToEnd();
|
||||
|
|
2
public/vendor/codemirror/mode/perl/perl.js
vendored
2
public/vendor/codemirror/mode/perl/perl.js
vendored
|
@ -268,7 +268,7 @@ CodeMirror.defineMode("perl",function(){
|
|||
chmod :1, // - changes the permissions on a list of files
|
||||
chomp :1, // - remove a trailing record separator from a string
|
||||
chop :1, // - remove the last character from a string
|
||||
chown :1, // - change the owership on a list of files
|
||||
chown :1, // - change the ownership on a list of files
|
||||
chr :1, // - get character this number represents
|
||||
chroot :1, // - make directory new root for path lookups
|
||||
close :1, // - close file (or pipe or socket) handle
|
||||
|
|
204
public/vendor/codemirror/mode/powershell/index.html
vendored
Normal file
204
public/vendor/codemirror/mode/powershell/index.html
vendored
Normal file
|
@ -0,0 +1,204 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CodeMirror: Powershell mode</title>
|
||||
<link rel="stylesheet" href="../../doc/docs.css">
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="powershell.js"></script>
|
||||
<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id=nav>
|
||||
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
|
||||
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a>
|
||||
<li><a href="../../doc/manual.html">Manual</a>
|
||||
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="../index.html">Language modes</a>
|
||||
<li><a class=active href="#">JavaScript</a>
|
||||
</ul>
|
||||
</div>
|
||||
<article>
|
||||
<h2>PowerShell mode</h2>
|
||||
|
||||
<div><textarea id="code" name="code">
|
||||
# Number Literals
|
||||
0 12345
|
||||
12kb 12mb 12gB 12Tb 12PB 12L 12D 12lkb 12dtb
|
||||
1.234 1.234e56 1. 1.e2 .2 .2e34
|
||||
1.2MB 1.kb .1dTb 1.e1gb
|
||||
0x1 0xabcdef 0x3tb 0xelmb
|
||||
|
||||
# String Literals
|
||||
'Literal escaping'''
|
||||
'Literal $variable'
|
||||
"Escaping 1`""
|
||||
"Escaping 2"""
|
||||
"Escaped `$variable"
|
||||
"Text, $variable and more text"
|
||||
"Text, ${variable with spaces} and more text."
|
||||
"Text, $($expression + 3) and more text."
|
||||
"Text, $("interpolation $("inception")") and more text."
|
||||
|
||||
@"
|
||||
Multiline
|
||||
string
|
||||
"@
|
||||
# --
|
||||
@"
|
||||
Multiline
|
||||
string with quotes "'
|
||||
"@
|
||||
# --
|
||||
@'
|
||||
Multiline literal
|
||||
string with quotes "'
|
||||
'@
|
||||
|
||||
# Array and Hash literals
|
||||
@( 'a','b','c' )
|
||||
@{ 'key': 'value' }
|
||||
|
||||
# Variables
|
||||
$Variable = 5
|
||||
$global:variable = 5
|
||||
${Variable with spaces} = 5
|
||||
|
||||
# Operators
|
||||
= += -= *= /= %=
|
||||
++ -- .. -f * / % + -
|
||||
-not ! -bnot
|
||||
-split -isplit -csplit
|
||||
-join
|
||||
-is -isnot -as
|
||||
-eq -ieq -ceq -ne -ine -cne
|
||||
-gt -igt -cgt -ge -ige -cge
|
||||
-lt -ilt -clt -le -ile -cle
|
||||
-like -ilike -clike -notlike -inotlike -cnotlike
|
||||
-match -imatch -cmatch -notmatch -inotmatch -cnotmatch
|
||||
-contains -icontains -ccontains -notcontains -inotcontains -cnotcontains
|
||||
-replace -ireplace -creplace
|
||||
-band -bor -bxor
|
||||
-and -or -xor
|
||||
|
||||
# Punctuation
|
||||
() [] {} , : ` = ; .
|
||||
|
||||
# Keywords
|
||||
elseif begin function for foreach return else trap while do data dynamicparam
|
||||
until end break if throw param continue finally in switch exit filter from try
|
||||
process catch
|
||||
|
||||
# Built-in variables
|
||||
$$ $? $^ $_
|
||||
$args $ConfirmPreference $ConsoleFileName $DebugPreference $Error
|
||||
$ErrorActionPreference $ErrorView $ExecutionContext $false $FormatEnumerationLimit
|
||||
$HOME $Host $input $MaximumAliasCount $MaximumDriveCount $MaximumErrorCount
|
||||
$MaximumFunctionCount $MaximumHistoryCount $MaximumVariableCount $MyInvocation
|
||||
$NestedPromptLevel $null $OutputEncoding $PID $PROFILE $ProgressPreference
|
||||
$PSBoundParameters $PSCommandPath $PSCulture $PSDefaultParameterValues
|
||||
$PSEmailServer $PSHOME $PSScriptRoot $PSSessionApplicationName
|
||||
$PSSessionConfigurationName $PSSessionOption $PSUICulture $PSVersionTable $PWD
|
||||
$ShellId $StackTrace $true $VerbosePreference $WarningPreference $WhatIfPreference
|
||||
$true $false $null
|
||||
|
||||
# Built-in functions
|
||||
A:
|
||||
Add-Computer Add-Content Add-History Add-Member Add-PSSnapin Add-Type
|
||||
B:
|
||||
C:
|
||||
Checkpoint-Computer Clear-Content Clear-EventLog Clear-History Clear-Host Clear-Item
|
||||
Clear-ItemProperty Clear-Variable Compare-Object Complete-Transaction Connect-PSSession
|
||||
ConvertFrom-Csv ConvertFrom-Json ConvertFrom-SecureString ConvertFrom-StringData
|
||||
Convert-Path ConvertTo-Csv ConvertTo-Html ConvertTo-Json ConvertTo-SecureString
|
||||
ConvertTo-Xml Copy-Item Copy-ItemProperty
|
||||
D:
|
||||
Debug-Process Disable-ComputerRestore Disable-PSBreakpoint Disable-PSRemoting
|
||||
Disable-PSSessionConfiguration Disconnect-PSSession
|
||||
E:
|
||||
Enable-ComputerRestore Enable-PSBreakpoint Enable-PSRemoting Enable-PSSessionConfiguration
|
||||
Enter-PSSession Exit-PSSession Export-Alias Export-Clixml Export-Console Export-Counter
|
||||
Export-Csv Export-FormatData Export-ModuleMember Export-PSSession
|
||||
F:
|
||||
ForEach-Object Format-Custom Format-List Format-Table Format-Wide
|
||||
G:
|
||||
Get-Acl Get-Alias Get-AuthenticodeSignature Get-ChildItem Get-Command Get-ComputerRestorePoint
|
||||
Get-Content Get-ControlPanelItem Get-Counter Get-Credential Get-Culture Get-Date
|
||||
Get-Event Get-EventLog Get-EventSubscriber Get-ExecutionPolicy Get-FormatData Get-Help
|
||||
Get-History Get-Host Get-HotFix Get-Item Get-ItemProperty Get-Job Get-Location Get-Member
|
||||
Get-Module Get-PfxCertificate Get-Process Get-PSBreakpoint Get-PSCallStack Get-PSDrive
|
||||
Get-PSProvider Get-PSSession Get-PSSessionConfiguration Get-PSSnapin Get-Random Get-Service
|
||||
Get-TraceSource Get-Transaction Get-TypeData Get-UICulture Get-Unique Get-Variable Get-Verb
|
||||
Get-WinEvent Get-WmiObject Group-Object
|
||||
H:
|
||||
help
|
||||
I:
|
||||
Import-Alias Import-Clixml Import-Counter Import-Csv Import-LocalizedData Import-Module
|
||||
Import-PSSession ImportSystemModules Invoke-Command Invoke-Expression Invoke-History
|
||||
Invoke-Item Invoke-RestMethod Invoke-WebRequest Invoke-WmiMethod
|
||||
J:
|
||||
Join-Path
|
||||
K:
|
||||
L:
|
||||
Limit-EventLog
|
||||
M:
|
||||
Measure-Command Measure-Object mkdir more Move-Item Move-ItemProperty
|
||||
N:
|
||||
New-Alias New-Event New-EventLog New-Item New-ItemProperty New-Module New-ModuleManifest
|
||||
New-Object New-PSDrive New-PSSession New-PSSessionConfigurationFile New-PSSessionOption
|
||||
New-PSTransportOption New-Service New-TimeSpan New-Variable New-WebServiceProxy
|
||||
New-WinEvent
|
||||
O:
|
||||
oss Out-Default Out-File Out-GridView Out-Host Out-Null Out-Printer Out-String
|
||||
P:
|
||||
Pause Pop-Location prompt Push-Location
|
||||
Q:
|
||||
R:
|
||||
Read-Host Receive-Job Receive-PSSession Register-EngineEvent Register-ObjectEvent
|
||||
Register-PSSessionConfiguration Register-WmiEvent Remove-Computer Remove-Event
|
||||
Remove-EventLog Remove-Item Remove-ItemProperty Remove-Job Remove-Module
|
||||
Remove-PSBreakpoint Remove-PSDrive Remove-PSSession Remove-PSSnapin Remove-TypeData
|
||||
Remove-Variable Remove-WmiObject Rename-Computer Rename-Item Rename-ItemProperty
|
||||
Reset-ComputerMachinePassword Resolve-Path Restart-Computer Restart-Service
|
||||
Restore-Computer Resume-Job Resume-Service
|
||||
S:
|
||||
Save-Help Select-Object Select-String Select-Xml Send-MailMessage Set-Acl Set-Alias
|
||||
Set-AuthenticodeSignature Set-Content Set-Date Set-ExecutionPolicy Set-Item
|
||||
Set-ItemProperty Set-Location Set-PSBreakpoint Set-PSDebug
|
||||
Set-PSSessionConfiguration Set-Service Set-StrictMode Set-TraceSource Set-Variable
|
||||
Set-WmiInstance Show-Command Show-ControlPanelItem Show-EventLog Sort-Object
|
||||
Split-Path Start-Job Start-Process Start-Service Start-Sleep Start-Transaction
|
||||
Start-Transcript Stop-Computer Stop-Job Stop-Process Stop-Service Stop-Transcript
|
||||
Suspend-Job Suspend-Service
|
||||
T:
|
||||
TabExpansion2 Tee-Object Test-ComputerSecureChannel Test-Connection
|
||||
Test-ModuleManifest Test-Path Test-PSSessionConfigurationFile Trace-Command
|
||||
U:
|
||||
Unblock-File Undo-Transaction Unregister-Event Unregister-PSSessionConfiguration
|
||||
Update-FormatData Update-Help Update-List Update-TypeData Use-Transaction
|
||||
V:
|
||||
W:
|
||||
Wait-Event Wait-Job Wait-Process Where-Object Write-Debug Write-Error Write-EventLog
|
||||
Write-Host Write-Output Write-Progress Write-Verbose Write-Warning
|
||||
X:
|
||||
Y:
|
||||
Z:</textarea></div>
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
mode: "powershell",
|
||||
lineNumbers: true,
|
||||
indentUnit: 4,
|
||||
tabMode: "shift",
|
||||
matchBrackets: true
|
||||
});
|
||||
</script>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>application/x-powershell</code>.</p>
|
||||
</article>
|
||||
</body>
|
||||
</html>
|
396
public/vendor/codemirror/mode/powershell/powershell.js
vendored
Normal file
396
public/vendor/codemirror/mode/powershell/powershell.js
vendored
Normal file
|
@ -0,0 +1,396 @@
|
|||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
'use strict';
|
||||
if (typeof exports == 'object' && typeof module == 'object') // CommonJS
|
||||
mod(require('codemirror'));
|
||||
else if (typeof define == 'function' && define.amd) // AMD
|
||||
define(['codemirror'], mod);
|
||||
else // Plain browser env
|
||||
mod(window.CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
'use strict';
|
||||
|
||||
CodeMirror.defineMode('powershell', function() {
|
||||
function buildRegexp(patterns, options) {
|
||||
options = options || {};
|
||||
var prefix = options.prefix !== undefined ? options.prefix : '^';
|
||||
var suffix = options.suffix !== undefined ? options.suffix : '\\b';
|
||||
|
||||
for (var i = 0; i < patterns.length; i++) {
|
||||
if (patterns[i] instanceof RegExp) {
|
||||
patterns[i] = patterns[i].source;
|
||||
}
|
||||
else {
|
||||
patterns[i] = patterns[i].replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
||||
}
|
||||
}
|
||||
|
||||
return new RegExp(prefix + '(' + patterns.join('|') + ')' + suffix, 'i');
|
||||
}
|
||||
|
||||
var notCharacterOrDash = '(?=[^A-Za-z\\d\\-_]|$)';
|
||||
var varNames = /[\w\-:]/
|
||||
var keywords = buildRegexp([
|
||||
/begin|break|catch|continue|data|default|do|dynamicparam/,
|
||||
/else|elseif|end|exit|filter|finally|for|foreach|from|function|if|in/,
|
||||
/param|process|return|switch|throw|trap|try|until|where|while/
|
||||
], { suffix: notCharacterOrDash });
|
||||
|
||||
var punctuation = /[\[\]{},;`\.]|@[({]/;
|
||||
var wordOperators = buildRegexp([
|
||||
'f',
|
||||
/b?not/,
|
||||
/[ic]?split/, 'join',
|
||||
/is(not)?/, 'as',
|
||||
/[ic]?(eq|ne|[gl][te])/,
|
||||
/[ic]?(not)?(like|match|contains)/,
|
||||
/[ic]?replace/,
|
||||
/b?(and|or|xor)/
|
||||
], { prefix: '-' });
|
||||
var symbolOperators = /[+\-*\/%]=|\+\+|--|\.\.|[+\-*&^%:=!|\/]|<(?!#)|(?!#)>/;
|
||||
var operators = buildRegexp([wordOperators, symbolOperators], { suffix: '' });
|
||||
|
||||
var numbers = /^((0x[\da-f]+)|((\d+\.\d+|\d\.|\.\d+|\d+)(e[\+\-]?\d+)?))[ld]?([kmgtp]b)?/i;
|
||||
|
||||
var identifiers = /^[A-Za-z\_][A-Za-z\-\_\d]*\b/;
|
||||
|
||||
var symbolBuiltins = /[A-Z]:|%|\?/i;
|
||||
var namedBuiltins = buildRegexp([
|
||||
/Add-(Computer|Content|History|Member|PSSnapin|Type)/,
|
||||
/Checkpoint-Computer/,
|
||||
/Clear-(Content|EventLog|History|Host|Item(Property)?|Variable)/,
|
||||
/Compare-Object/,
|
||||
/Complete-Transaction/,
|
||||
/Connect-PSSession/,
|
||||
/ConvertFrom-(Csv|Json|SecureString|StringData)/,
|
||||
/Convert-Path/,
|
||||
/ConvertTo-(Csv|Html|Json|SecureString|Xml)/,
|
||||
/Copy-Item(Property)?/,
|
||||
/Debug-Process/,
|
||||
/Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)/,
|
||||
/Disconnect-PSSession/,
|
||||
/Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)/,
|
||||
/(Enter|Exit)-PSSession/,
|
||||
/Export-(Alias|Clixml|Console|Counter|Csv|FormatData|ModuleMember|PSSession)/,
|
||||
/ForEach-Object/,
|
||||
/Format-(Custom|List|Table|Wide)/,
|
||||
new RegExp('Get-(Acl|Alias|AuthenticodeSignature|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Counter|Credential'
|
||||
+ '|Culture|Date|Event|EventLog|EventSubscriber|ExecutionPolicy|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job'
|
||||
+ '|Location|Member|Module|PfxCertificate|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration'
|
||||
+ '|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|Verb|WinEvent|WmiObject)'),
|
||||
/Group-Object/,
|
||||
/Import-(Alias|Clixml|Counter|Csv|LocalizedData|Module|PSSession)/,
|
||||
/ImportSystemModules/,
|
||||
/Invoke-(Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)/,
|
||||
/Join-Path/,
|
||||
/Limit-EventLog/,
|
||||
/Measure-(Command|Object)/,
|
||||
/Move-Item(Property)?/,
|
||||
new RegExp('New-(Alias|Event|EventLog|Item(Property)?|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile'
|
||||
+ '|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy|WinEvent)'),
|
||||
/Out-(Default|File|GridView|Host|Null|Printer|String)/,
|
||||
/Pause/,
|
||||
/(Pop|Push)-Location/,
|
||||
/Read-Host/,
|
||||
/Receive-(Job|PSSession)/,
|
||||
/Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)/,
|
||||
/Remove-(Computer|Event|EventLog|Item(Property)?|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)/,
|
||||
/Rename-(Computer|Item(Property)?)/,
|
||||
/Reset-ComputerMachinePassword/,
|
||||
/Resolve-Path/,
|
||||
/Restart-(Computer|Service)/,
|
||||
/Restore-Computer/,
|
||||
/Resume-(Job|Service)/,
|
||||
/Save-Help/,
|
||||
/Select-(Object|String|Xml)/,
|
||||
/Send-MailMessage/,
|
||||
new RegExp('Set-(Acl|Alias|AuthenticodeSignature|Content|Date|ExecutionPolicy|Item(Property)?|Location|PSBreakpoint|PSDebug' +
|
||||
'|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)'),
|
||||
/Show-(Command|ControlPanelItem|EventLog)/,
|
||||
/Sort-Object/,
|
||||
/Split-Path/,
|
||||
/Start-(Job|Process|Service|Sleep|Transaction|Transcript)/,
|
||||
/Stop-(Computer|Job|Process|Service|Transcript)/,
|
||||
/Suspend-(Job|Service)/,
|
||||
/TabExpansion2/,
|
||||
/Tee-Object/,
|
||||
/Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)/,
|
||||
/Trace-Command/,
|
||||
/Unblock-File/,
|
||||
/Undo-Transaction/,
|
||||
/Unregister-(Event|PSSessionConfiguration)/,
|
||||
/Update-(FormatData|Help|List|TypeData)/,
|
||||
/Use-Transaction/,
|
||||
/Wait-(Event|Job|Process)/,
|
||||
/Where-Object/,
|
||||
/Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning)/,
|
||||
/cd|help|mkdir|more|oss|prompt/,
|
||||
/ac|asnp|cat|cd|chdir|clc|clear|clhy|cli|clp|cls|clv|cnsn|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|dnsn|ebp/,
|
||||
/echo|epal|epcsv|epsn|erase|etsn|exsn|fc|fl|foreach|ft|fw|gal|gbp|gc|gci|gcm|gcs|gdr|ghy|gi|gjb|gl|gm|gmo|gp|gps/,
|
||||
/group|gsn|gsnp|gsv|gu|gv|gwmi|h|history|icm|iex|ihy|ii|ipal|ipcsv|ipmo|ipsn|irm|ise|iwmi|iwr|kill|lp|ls|man|md/,
|
||||
/measure|mi|mount|move|mp|mv|nal|ndr|ni|nmo|npssc|nsn|nv|ogv|oh|popd|ps|pushd|pwd|r|rbp|rcjb|rcsn|rd|rdr|ren|ri/,
|
||||
/rjb|rm|rmdir|rmo|rni|rnp|rp|rsn|rsnp|rujb|rv|rvpa|rwmi|sajb|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls/,
|
||||
/sort|sp|spjb|spps|spsv|start|sujb|sv|swmi|tee|trcm|type|where|wjb|write/
|
||||
], { prefix: '', suffix: '' });
|
||||
var variableBuiltins = buildRegexp([
|
||||
/[$?^_]|Args|ConfirmPreference|ConsoleFileName|DebugPreference|Error|ErrorActionPreference|ErrorView|ExecutionContext/,
|
||||
/FormatEnumerationLimit|Home|Host|Input|MaximumAliasCount|MaximumDriveCount|MaximumErrorCount|MaximumFunctionCount/,
|
||||
/MaximumHistoryCount|MaximumVariableCount|MyInvocation|NestedPromptLevel|OutputEncoding|Pid|Profile|ProgressPreference/,
|
||||
/PSBoundParameters|PSCommandPath|PSCulture|PSDefaultParameterValues|PSEmailServer|PSHome|PSScriptRoot|PSSessionApplicationName/,
|
||||
/PSSessionConfigurationName|PSSessionOption|PSUICulture|PSVersionTable|Pwd|ShellId|StackTrace|VerbosePreference/,
|
||||
/WarningPreference|WhatIfPreference/,
|
||||
|
||||
/Event|EventArgs|EventSubscriber|Sender/,
|
||||
/Matches|Ofs|ForEach|LastExitCode|PSCmdlet|PSItem|PSSenderInfo|This/,
|
||||
/true|false|null/
|
||||
], { prefix: '\\$', suffix: '' });
|
||||
|
||||
var builtins = buildRegexp([symbolBuiltins, namedBuiltins, variableBuiltins], { suffix: notCharacterOrDash });
|
||||
|
||||
var grammar = {
|
||||
keyword: keywords,
|
||||
number: numbers,
|
||||
operator: operators,
|
||||
builtin: builtins,
|
||||
punctuation: punctuation,
|
||||
identifier: identifiers
|
||||
};
|
||||
|
||||
// tokenizers
|
||||
function tokenBase(stream, state) {
|
||||
// Handle Comments
|
||||
//var ch = stream.peek();
|
||||
|
||||
var parent = state.returnStack[state.returnStack.length - 1];
|
||||
if (parent && parent.shouldReturnFrom(state)) {
|
||||
state.tokenize = parent.tokenize;
|
||||
state.returnStack.pop();
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
|
||||
if (stream.eatSpace()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (stream.eat('(')) {
|
||||
state.bracketNesting += 1;
|
||||
return 'punctuation';
|
||||
}
|
||||
|
||||
if (stream.eat(')')) {
|
||||
state.bracketNesting -= 1;
|
||||
return 'punctuation';
|
||||
}
|
||||
|
||||
for (var key in grammar) {
|
||||
if (stream.match(grammar[key])) {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
var ch = stream.next();
|
||||
|
||||
// single-quote string
|
||||
if (ch === "'") {
|
||||
return tokenSingleQuoteString(stream, state);
|
||||
}
|
||||
|
||||
if (ch === '$') {
|
||||
return tokenVariable(stream, state);
|
||||
}
|
||||
|
||||
// double-quote string
|
||||
if (ch === '"') {
|
||||
return tokenDoubleQuoteString(stream, state);
|
||||
}
|
||||
|
||||
if (ch === '<' && stream.eat('#')) {
|
||||
state.tokenize = tokenComment;
|
||||
return tokenComment(stream, state);
|
||||
}
|
||||
|
||||
if (ch === '#') {
|
||||
stream.skipToEnd();
|
||||
return 'comment';
|
||||
}
|
||||
|
||||
if (ch === '@') {
|
||||
var quoteMatch = stream.eat(/["']/);
|
||||
if (quoteMatch && stream.eol()) {
|
||||
state.tokenize = tokenMultiString;
|
||||
state.startQuote = quoteMatch[0];
|
||||
return tokenMultiString(stream, state);
|
||||
} else if (stream.peek().match(/[({]/)) {
|
||||
return 'punctuation';
|
||||
} else if (stream.peek().match(varNames)) {
|
||||
// splatted variable
|
||||
return tokenVariable(stream, state);
|
||||
}
|
||||
}
|
||||
return 'error';
|
||||
}
|
||||
|
||||
function tokenSingleQuoteString(stream, state) {
|
||||
var ch;
|
||||
while ((ch = stream.peek()) != null) {
|
||||
stream.next();
|
||||
|
||||
if (ch === "'" && !stream.eat("'")) {
|
||||
state.tokenize = tokenBase;
|
||||
return 'string';
|
||||
}
|
||||
}
|
||||
|
||||
return 'error';
|
||||
}
|
||||
|
||||
function tokenDoubleQuoteString(stream, state) {
|
||||
var ch;
|
||||
while ((ch = stream.peek()) != null) {
|
||||
if (ch === '$') {
|
||||
state.tokenize = tokenStringInterpolation;
|
||||
return 'string';
|
||||
}
|
||||
|
||||
stream.next();
|
||||
if (ch === '`') {
|
||||
stream.next();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch === '"' && !stream.eat('"')) {
|
||||
state.tokenize = tokenBase;
|
||||
return 'string';
|
||||
}
|
||||
}
|
||||
|
||||
return 'error';
|
||||
}
|
||||
|
||||
function tokenStringInterpolation(stream, state) {
|
||||
return tokenInterpolation(stream, state, tokenDoubleQuoteString);
|
||||
}
|
||||
|
||||
function tokenMultiStringReturn(stream, state) {
|
||||
state.tokenize = tokenMultiString;
|
||||
state.startQuote = '"'
|
||||
return tokenMultiString(stream, state);
|
||||
}
|
||||
|
||||
function tokenHereStringInterpolation(stream, state) {
|
||||
return tokenInterpolation(stream, state, tokenMultiStringReturn);
|
||||
}
|
||||
|
||||
function tokenInterpolation(stream, state, parentTokenize) {
|
||||
if (stream.match('$(')) {
|
||||
var savedBracketNesting = state.bracketNesting;
|
||||
state.returnStack.push({
|
||||
/*jshint loopfunc:true */
|
||||
shouldReturnFrom: function(state) {
|
||||
return state.bracketNesting === savedBracketNesting;
|
||||
},
|
||||
tokenize: parentTokenize
|
||||
});
|
||||
state.tokenize = tokenBase;
|
||||
state.bracketNesting += 1;
|
||||
return 'punctuation';
|
||||
} else {
|
||||
stream.next();
|
||||
state.returnStack.push({
|
||||
shouldReturnFrom: function() { return true; },
|
||||
tokenize: parentTokenize
|
||||
});
|
||||
state.tokenize = tokenVariable;
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
}
|
||||
|
||||
function tokenComment(stream, state) {
|
||||
var maybeEnd = false, ch;
|
||||
while ((ch = stream.next()) != null) {
|
||||
if (maybeEnd && ch == '>') {
|
||||
state.tokenize = tokenBase;
|
||||
break;
|
||||
}
|
||||
maybeEnd = (ch === '#');
|
||||
}
|
||||
return 'comment';
|
||||
}
|
||||
|
||||
function tokenVariable(stream, state) {
|
||||
var ch = stream.peek();
|
||||
if (stream.eat('{')) {
|
||||
state.tokenize = tokenVariableWithBraces;
|
||||
return tokenVariableWithBraces(stream, state);
|
||||
} else if (ch != undefined && ch.match(varNames)) {
|
||||
stream.eatWhile(varNames);
|
||||
state.tokenize = tokenBase;
|
||||
return 'variable-2';
|
||||
} else {
|
||||
state.tokenize = tokenBase;
|
||||
return 'error';
|
||||
}
|
||||
}
|
||||
|
||||
function tokenVariableWithBraces(stream, state) {
|
||||
var ch;
|
||||
while ((ch = stream.next()) != null) {
|
||||
if (ch === '}') {
|
||||
state.tokenize = tokenBase;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 'variable-2';
|
||||
}
|
||||
|
||||
function tokenMultiString(stream, state) {
|
||||
var quote = state.startQuote;
|
||||
if (stream.sol() && stream.match(new RegExp(quote + '@'))) {
|
||||
state.tokenize = tokenBase;
|
||||
}
|
||||
else if (quote === '"') {
|
||||
while (!stream.eol()) {
|
||||
var ch = stream.peek();
|
||||
if (ch === '$') {
|
||||
state.tokenize = tokenHereStringInterpolation;
|
||||
return 'string';
|
||||
}
|
||||
|
||||
stream.next();
|
||||
if (ch === '`') {
|
||||
stream.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
stream.skipToEnd();
|
||||
}
|
||||
|
||||
return 'string';
|
||||
}
|
||||
|
||||
var external = {
|
||||
startState: function() {
|
||||
return {
|
||||
returnStack: [],
|
||||
bracketNesting: 0,
|
||||
tokenize: tokenBase
|
||||
};
|
||||
},
|
||||
|
||||
token: function(stream, state) {
|
||||
return state.tokenize(stream, state);
|
||||
},
|
||||
|
||||
blockCommentStart: '<#',
|
||||
blockCommentEnd: '#>',
|
||||
lineComment: '#',
|
||||
fold: 'brace'
|
||||
};
|
||||
return external;
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME('application/x-powershell', 'powershell');
|
||||
});
|
72
public/vendor/codemirror/mode/powershell/test.js
vendored
Normal file
72
public/vendor/codemirror/mode/powershell/test.js
vendored
Normal file
|
@ -0,0 +1,72 @@
|
|||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function() {
|
||||
var mode = CodeMirror.getMode({indentUnit: 2}, "powershell");
|
||||
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
|
||||
|
||||
MT('comment', '[number 1][comment # A]');
|
||||
MT('comment_multiline', '[number 1][comment <#]',
|
||||
'[comment ABC]',
|
||||
'[comment #>][number 2]');
|
||||
|
||||
[
|
||||
'0', '1234',
|
||||
'12kb', '12mb', '12Gb', '12Tb', '12PB', '12L', '12D', '12lkb', '12dtb',
|
||||
'1.234', '1.234e56', '1.', '1.e2', '.2', '.2e34',
|
||||
'1.2MB', '1.kb', '.1dTB', '1.e1gb', '.2', '.2e34',
|
||||
'0x1', '0xabcdef', '0x3tb', '0xelmb'
|
||||
].forEach(function(number) {
|
||||
MT("number_" + number, "[number " + number + "]");
|
||||
});
|
||||
|
||||
MT('string_literal_escaping', "[string 'a''']");
|
||||
MT('string_literal_variable', "[string 'a $x']");
|
||||
MT('string_escaping_1', '[string "a `""]');
|
||||
MT('string_escaping_2', '[string "a """]');
|
||||
MT('string_variable_escaping', '[string "a `$x"]');
|
||||
MT('string_variable', '[string "a ][variable-2 $x][string b"]');
|
||||
MT('string_variable_spaces', '[string "a ][variable-2 ${x y}][string b"]');
|
||||
MT('string_expression', '[string "a ][punctuation $(][variable-2 $x][operator +][number 3][punctuation )][string b"]');
|
||||
MT('string_expression_nested', '[string "A][punctuation $(][string "a][punctuation $(][string "w"][punctuation )][string b"][punctuation )][string B"]');
|
||||
|
||||
MT('string_heredoc', '[string @"]',
|
||||
'[string abc]',
|
||||
'[string "@]');
|
||||
MT('string_heredoc_quotes', '[string @"]',
|
||||
'[string abc "\']',
|
||||
'[string "@]');
|
||||
MT('string_heredoc_variable', '[string @"]',
|
||||
'[string a ][variable-2 $x][string b]',
|
||||
'[string "@]');
|
||||
MT('string_heredoc_nested_string', '[string @"]',
|
||||
'[string a][punctuation $(][string "w"][punctuation )][string b]',
|
||||
'[string "@]');
|
||||
MT('string_heredoc_literal_quotes', "[string @']",
|
||||
'[string abc "\']',
|
||||
"[string '@]");
|
||||
|
||||
MT('array', "[punctuation @(][string 'a'][punctuation ,][string 'b'][punctuation )]");
|
||||
MT('hash', "[punctuation @{][string 'key'][operator :][string 'value'][punctuation }]");
|
||||
|
||||
MT('variable', "[variable-2 $test]");
|
||||
MT('variable_global', "[variable-2 $global:test]");
|
||||
MT('variable_spaces', "[variable-2 ${test test}]");
|
||||
MT('operator_splat', "[variable-2 @x]");
|
||||
MT('variable_builtin', "[builtin $ErrorActionPreference]");
|
||||
MT('variable_builtin_symbols', "[builtin $$]");
|
||||
|
||||
MT('operator', "[operator +]");
|
||||
MT('operator_unary', "[operator +][number 3]");
|
||||
MT('operator_long', "[operator -match]");
|
||||
|
||||
[
|
||||
'(', ')', '[[', ']]', '{', '}', ',', '`', ';', '.'
|
||||
].forEach(function(punctuation) {
|
||||
MT("punctuation_" + punctuation.replace(/^[\[\]]/,''), "[punctuation " + punctuation + "]");
|
||||
});
|
||||
|
||||
MT('keyword', "[keyword if]");
|
||||
|
||||
MT('call_builtin', "[builtin Get-ChildItem]");
|
||||
})();
|
|
@ -34,7 +34,7 @@ CodeMirror.defineMode("properties", function() {
|
|||
}
|
||||
|
||||
if (sol) {
|
||||
while(stream.eatSpace());
|
||||
while(stream.eatSpace()) {}
|
||||
}
|
||||
|
||||
var ch = stream.next();
|
||||
|
|
64
public/vendor/codemirror/mode/protobuf/index.html
vendored
Normal file
64
public/vendor/codemirror/mode/protobuf/index.html
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: ProtoBuf mode</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel=stylesheet href="../../doc/docs.css">
|
||||
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="protobuf.js"></script>
|
||||
<style>.CodeMirror { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; }</style>
|
||||
<div id=nav>
|
||||
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
|
||||
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a>
|
||||
<li><a href="../../doc/manual.html">Manual</a>
|
||||
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="../index.html">Language modes</a>
|
||||
<li><a class=active href="#">ProtoBuf</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>ProtoBuf mode</h2>
|
||||
<form><textarea id="code" name="code">
|
||||
package addressbook;
|
||||
|
||||
message Address {
|
||||
required string street = 1;
|
||||
required string postCode = 2;
|
||||
}
|
||||
|
||||
message PhoneNumber {
|
||||
required string number = 1;
|
||||
}
|
||||
|
||||
message Person {
|
||||
optional int32 id = 1;
|
||||
required string name = 2;
|
||||
required string surname = 3;
|
||||
optional Address address = 4;
|
||||
repeated PhoneNumber phoneNumbers = 5;
|
||||
optional uint32 age = 6;
|
||||
repeated uint32 favouriteNumbers = 7;
|
||||
optional string license = 8;
|
||||
enum Gender {
|
||||
MALE = 0;
|
||||
FEMALE = 1;
|
||||
}
|
||||
optional Gender gender = 9;
|
||||
optional fixed64 lastUpdate = 10;
|
||||
required bool deleted = 11 [default = false];
|
||||
}
|
||||
|
||||
</textarea></form>
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
|
||||
</script>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>text/x-protobuf</code>.</p>
|
||||
|
||||
</article>
|
68
public/vendor/codemirror/mode/protobuf/protobuf.js
vendored
Normal file
68
public/vendor/codemirror/mode/protobuf/protobuf.js
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
function wordRegexp(words) {
|
||||
return new RegExp("^((" + words.join(")|(") + "))\\b", "i");
|
||||
};
|
||||
|
||||
var keywordArray = [
|
||||
"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"
|
||||
];
|
||||
var keywords = wordRegexp(keywordArray);
|
||||
|
||||
CodeMirror.registerHelper("hintWords", "protobuf", keywordArray);
|
||||
|
||||
var identifiers = new RegExp("^[_A-Za-z\xa1-\uffff][_A-Za-z0-9\xa1-\uffff]*");
|
||||
|
||||
function tokenBase(stream) {
|
||||
// whitespaces
|
||||
if (stream.eatSpace()) return null;
|
||||
|
||||
// Handle one line Comments
|
||||
if (stream.match("//")) {
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
|
||||
// Handle Number Literals
|
||||
if (stream.match(/^[0-9\.+-]/, false)) {
|
||||
if (stream.match(/^[+-]?0x[0-9a-fA-F]+/))
|
||||
return "number";
|
||||
if (stream.match(/^[+-]?\d*\.\d+([EeDd][+-]?\d+)?/))
|
||||
return "number";
|
||||
if (stream.match(/^[+-]?\d+([EeDd][+-]?\d+)?/))
|
||||
return "number";
|
||||
}
|
||||
|
||||
// Handle Strings
|
||||
if (stream.match(/^"([^"]|(""))*"/)) { return "string"; }
|
||||
if (stream.match(/^'([^']|(''))*'/)) { return "string"; }
|
||||
|
||||
// Handle words
|
||||
if (stream.match(keywords)) { return "keyword"; }
|
||||
if (stream.match(identifiers)) { return "variable"; } ;
|
||||
|
||||
// Handle non-detected items
|
||||
stream.next();
|
||||
return null;
|
||||
};
|
||||
|
||||
CodeMirror.defineMode("protobuf", function() {
|
||||
return {token: tokenBase};
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("text/x-protobuf", "protobuf");
|
||||
});
|
|
@ -126,7 +126,7 @@ CodeMirror.defineMode("puppet", function () {
|
|||
if (word && words.hasOwnProperty(word)) {
|
||||
// Negates the initial next()
|
||||
stream.backUp(1);
|
||||
// Acutally move the stream
|
||||
// rs move the stream
|
||||
stream.match(/[\w]+/);
|
||||
// We want to process these words differently
|
||||
// do to the importance they have in Puppet
|
||||
|
|
|
@ -186,7 +186,7 @@ def pairwise_cython(double[:, ::1] X):
|
|||
<li>singleOperators - RegEx - Regular Expression for single operator matching, default : <pre>^[\\+\\-\\*/%&|\\^~<>!]</pre> including <pre>@</pre> on Python 3</li>
|
||||
<li>singleDelimiters - RegEx - Regular Expression for single delimiter matching, default : <pre>^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]</pre></li>
|
||||
<li>doubleOperators - RegEx - Regular Expression for double operators matching, default : <pre>^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))</pre></li>
|
||||
<li>doubleDelimiters - RegEx - Regular Expressoin for double delimiters matching, default : <pre>^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))</pre></li>
|
||||
<li>doubleDelimiters - RegEx - Regular Expression for double delimiters matching, default : <pre>^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))</pre></li>
|
||||
<li>tripleDelimiters - RegEx - Regular Expression for triple delimiters matching, default : <pre>^((//=)|(>>=)|(<<=)|(\\*\\*=))</pre></li>
|
||||
<li>identifiers - RegEx - Regular Expression for identifier, default : <pre>^[_A-Za-z][_A-Za-z0-9]*</pre> on Python 2 and <pre>^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*</pre> on Python 3.</li>
|
||||
<li>extra_keywords - list of string - List of extra words ton consider as keywords</li>
|
||||
|
|
63
public/vendor/codemirror/mode/python/python.js
vendored
63
public/vendor/codemirror/mode/python/python.js
vendored
|
@ -53,7 +53,7 @@
|
|||
var doubleDelimiters = parserConf.doubleDelimiters || /^(\+=|\-=|\*=|%=|\/=|&=|\|=|\^=)/;
|
||||
var tripleDelimiters = parserConf.tripleDelimiters || /^(\/\/=|>>=|<<=|\*\*=)/;
|
||||
|
||||
if (parserConf.version && parseInt(parserConf.version, 10) == 3){
|
||||
if (parserConf.version && parseInt(parserConf.version, 10) == 3) {
|
||||
// since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator
|
||||
var singleOperators = parserConf.singleOperators || /^[\+\-\*\/%&|\^~<>!@]/;
|
||||
var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;
|
||||
|
@ -65,12 +65,12 @@
|
|||
var hangingIndent = parserConf.hangingIndent || conf.indentUnit;
|
||||
|
||||
var myKeywords = commonKeywords, myBuiltins = commonBuiltins;
|
||||
if(parserConf.extra_keywords != undefined){
|
||||
if (parserConf.extra_keywords != undefined)
|
||||
myKeywords = myKeywords.concat(parserConf.extra_keywords);
|
||||
}
|
||||
if(parserConf.extra_builtins != undefined){
|
||||
|
||||
if (parserConf.extra_builtins != undefined)
|
||||
myBuiltins = myBuiltins.concat(parserConf.extra_builtins);
|
||||
}
|
||||
|
||||
if (parserConf.version && parseInt(parserConf.version, 10) == 3) {
|
||||
myKeywords = myKeywords.concat(py3.keywords);
|
||||
myBuiltins = myBuiltins.concat(py3.builtins);
|
||||
|
@ -85,13 +85,14 @@
|
|||
|
||||
// tokenizers
|
||||
function tokenBase(stream, state) {
|
||||
if (stream.sol()) state.indent = stream.indentation()
|
||||
// Handle scope changes
|
||||
if (stream.sol() && top(state).type == "py") {
|
||||
var scopeOffset = top(state).offset;
|
||||
if (stream.eatSpace()) {
|
||||
var lineOffset = stream.indentation();
|
||||
if (lineOffset > scopeOffset)
|
||||
pushScope(stream, state, "py");
|
||||
pushPyScope(state);
|
||||
else if (lineOffset < scopeOffset && dedent(stream, state))
|
||||
state.errorToken = true;
|
||||
return null;
|
||||
|
@ -224,16 +225,18 @@
|
|||
return tokenString;
|
||||
}
|
||||
|
||||
function pushScope(stream, state, type) {
|
||||
var offset = 0, align = null;
|
||||
if (type == "py") {
|
||||
while (top(state).type != "py")
|
||||
state.scopes.pop();
|
||||
}
|
||||
offset = top(state).offset + (type == "py" ? conf.indentUnit : hangingIndent);
|
||||
if (type != "py" && !stream.match(/^(\s|#.*)*$/, false))
|
||||
align = stream.column() + 1;
|
||||
state.scopes.push({offset: offset, type: type, align: align});
|
||||
function pushPyScope(state) {
|
||||
while (top(state).type != "py") state.scopes.pop()
|
||||
state.scopes.push({offset: top(state).offset + conf.indentUnit,
|
||||
type: "py",
|
||||
align: null})
|
||||
}
|
||||
|
||||
function pushBracketScope(stream, state, type) {
|
||||
var align = stream.match(/^([\s\[\{\(]|#.*)*$/, false) ? null : stream.column() + 1
|
||||
state.scopes.push({offset: state.indent + hangingIndent,
|
||||
type: type,
|
||||
align: align})
|
||||
}
|
||||
|
||||
function dedent(stream, state) {
|
||||
|
@ -250,12 +253,11 @@
|
|||
var current = stream.current();
|
||||
|
||||
// Handle decorators
|
||||
if (current == "@"){
|
||||
if(parserConf.version && parseInt(parserConf.version, 10) == 3){
|
||||
return stream.match(identifiers, false) ? "meta" : "operator";
|
||||
} else {
|
||||
return stream.match(identifiers, false) ? "meta" : ERRORCLASS;
|
||||
}
|
||||
if (current == "@") {
|
||||
if (parserConf.version && parseInt(parserConf.version, 10) == 3)
|
||||
return stream.match(identifiers, false) ? "meta" : "operator";
|
||||
else
|
||||
return stream.match(identifiers, false) ? "meta" : ERRORCLASS;
|
||||
}
|
||||
|
||||
if ((style == "variable" || style == "builtin")
|
||||
|
@ -268,15 +270,15 @@
|
|||
|
||||
if (current == "lambda") state.lambda = true;
|
||||
if (current == ":" && !state.lambda && top(state).type == "py")
|
||||
pushScope(stream, state, "py");
|
||||
pushPyScope(state);
|
||||
|
||||
var delimiter_index = current.length == 1 ? "[({".indexOf(current) : -1;
|
||||
if (delimiter_index != -1)
|
||||
pushScope(stream, state, "])}".slice(delimiter_index, 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.scopes.pop();
|
||||
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") {
|
||||
|
@ -292,6 +294,7 @@
|
|||
return {
|
||||
tokenize: tokenBase,
|
||||
scopes: [{offset: basecolumn || 0, type: "py", align: null}],
|
||||
indent: basecolumn || 0,
|
||||
lastToken: null,
|
||||
lambda: false,
|
||||
dedent: 0
|
||||
|
@ -316,16 +319,14 @@
|
|||
if (state.tokenize != tokenBase)
|
||||
return state.tokenize.isString ? CodeMirror.Pass : 0;
|
||||
|
||||
var scope = top(state);
|
||||
var closing = textAfter && textAfter.charAt(0) == scope.type;
|
||||
var scope = top(state), closing = scope.type == textAfter.charAt(0)
|
||||
if (scope.align != null)
|
||||
return scope.align - (closing ? 1 : 0);
|
||||
else if (closing && state.scopes.length > 1)
|
||||
return state.scopes[state.scopes.length - 2].offset;
|
||||
return scope.align - (closing ? 1 : 0)
|
||||
else
|
||||
return scope.offset;
|
||||
return scope.offset - (closing ? hangingIndent : 0)
|
||||
},
|
||||
|
||||
electricInput: /^\s*[\}\]\)]$/,
|
||||
closeBrackets: {triples: "'\""},
|
||||
lineComment: "#",
|
||||
fold: "indent"
|
||||
|
|
2
public/vendor/codemirror/mode/r/r.js
vendored
2
public/vendor/codemirror/mode/r/r.js
vendored
|
@ -11,6 +11,8 @@
|
|||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
CodeMirror.registerHelper("wordChars", "r", /[\w.]/);
|
||||
|
||||
CodeMirror.defineMode("r", function(config) {
|
||||
function wordObj(str) {
|
||||
var words = str.split(" "), res = {};
|
||||
|
|
81
public/vendor/codemirror/mode/sas/index.html
vendored
Normal file
81
public/vendor/codemirror/mode/sas/index.html
vendored
Normal file
|
@ -0,0 +1,81 @@
|
|||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: SAS mode</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel=stylesheet href="../../doc/docs.css">
|
||||
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="../xml/xml.js"></script>
|
||||
<script src="sas.js"></script>
|
||||
<style type="text/css">
|
||||
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
||||
.cm-s-default .cm-trailing-space-a:before,
|
||||
.cm-s-default .cm-trailing-space-b:before {position: absolute; content: "\00B7"; color: #777;}
|
||||
.cm-s-default .cm-trailing-space-new-line:before {position: absolute; content: "\21B5"; color: #777;}
|
||||
</style>
|
||||
<div id=nav>
|
||||
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
|
||||
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a>
|
||||
<li><a href="../../doc/manual.html">Manual</a>
|
||||
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="../index.html">Language modes</a>
|
||||
<li><a class=active href="#">SAS</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>SAS mode</h2>
|
||||
<form><textarea id="code" name="code">
|
||||
libname foo "/tmp/foobar";
|
||||
%let count=1;
|
||||
|
||||
/* Multi line
|
||||
Comment
|
||||
*/
|
||||
data _null_;
|
||||
x=ranuni();
|
||||
* single comment;
|
||||
x2=x**2;
|
||||
sx=sqrt(x);
|
||||
if x=x2 then put "x must be 1";
|
||||
else do;
|
||||
put x=;
|
||||
end;
|
||||
run;
|
||||
|
||||
/* embedded comment
|
||||
* comment;
|
||||
*/
|
||||
|
||||
proc glm data=sashelp.class;
|
||||
class sex;
|
||||
model weight = height sex;
|
||||
run;
|
||||
|
||||
proc sql;
|
||||
select count(*)
|
||||
from sashelp.class;
|
||||
|
||||
create table foo as
|
||||
select * from sashelp.class;
|
||||
|
||||
select *
|
||||
from foo;
|
||||
quit;
|
||||
</textarea></form>
|
||||
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
mode: 'sas',
|
||||
lineNumbers: true
|
||||
});
|
||||
</script>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>text/x-sas</code>.</p>
|
||||
|
||||
</article>
|
315
public/vendor/codemirror/mode/sas/sas.js
vendored
Executable file
315
public/vendor/codemirror/mode/sas/sas.js
vendored
Executable file
|
@ -0,0 +1,315 @@
|
|||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
|
||||
// SAS mode copyright (c) 2016 Jared Dean, SAS Institute
|
||||
// Created by Jared Dean
|
||||
|
||||
// TODO
|
||||
// indent and de-indent
|
||||
// identify macro variables
|
||||
|
||||
|
||||
//Definitions
|
||||
// comment -- text withing * ; or /* */
|
||||
// keyword -- SAS language variable
|
||||
// variable -- macro variables starts with '&' or variable formats
|
||||
// variable-2 -- DATA Step, proc, or macro names
|
||||
// string -- text within ' ' or " "
|
||||
// operator -- numeric operator + / - * ** le eq ge ... and so on
|
||||
// builtin -- proc %macro data run mend
|
||||
// atom
|
||||
// def
|
||||
|
||||
(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.defineMode("sas", function () {
|
||||
var words = {};
|
||||
var isDoubleOperatorSym = {
|
||||
eq: 'operator',
|
||||
lt: 'operator',
|
||||
le: 'operator',
|
||||
gt: 'operator',
|
||||
ge: 'operator',
|
||||
"in": 'operator',
|
||||
ne: 'operator',
|
||||
or: 'operator'
|
||||
};
|
||||
var isDoubleOperatorChar = /(<=|>=|!=|<>)/;
|
||||
var isSingleOperatorChar = /[=\(:\),{}.*<>+\-\/^\[\]]/;
|
||||
|
||||
// Takes a string of words separated by spaces and adds them as
|
||||
// keys with the value of the first argument 'style'
|
||||
function define(style, string, context) {
|
||||
if (context) {
|
||||
var split = string.split(' ');
|
||||
for (var i = 0; i < split.length; i++) {
|
||||
words[split[i]] = {style: style, state: context};
|
||||
}
|
||||
}
|
||||
}
|
||||
//datastep
|
||||
define('def', 'stack pgm view source debug nesting nolist', ['inDataStep']);
|
||||
define('def', 'if while until for do do; end end; then else cancel', ['inDataStep']);
|
||||
define('def', 'label format _n_ _error_', ['inDataStep']);
|
||||
define('def', 'ALTER BUFNO BUFSIZE CNTLLEV COMPRESS DLDMGACTION ENCRYPT ENCRYPTKEY EXTENDOBSCOUNTER GENMAX GENNUM INDEX LABEL OBSBUF OUTREP PW PWREQ READ REPEMPTY REPLACE REUSE ROLE SORTEDBY SPILL TOBSNO TYPE WRITE FILECLOSE FIRSTOBS IN OBS POINTOBS WHERE WHEREUP IDXNAME IDXWHERE DROP KEEP RENAME', ['inDataStep']);
|
||||
define('def', 'filevar finfo finv fipname fipnamel fipstate first firstobs floor', ['inDataStep']);
|
||||
define('def', 'varfmt varinfmt varlabel varlen varname varnum varray varrayx vartype verify vformat vformatd vformatdx vformatn vformatnx vformatw vformatwx vformatx vinarray vinarrayx vinformat vinformatd vinformatdx vinformatn vinformatnx vinformatw vinformatwx vinformatx vlabel vlabelx vlength vlengthx vname vnamex vnferr vtype vtypex weekday', ['inDataStep']);
|
||||
define('def', 'zipfips zipname zipnamel zipstate', ['inDataStep']);
|
||||
define('def', 'put putc putn', ['inDataStep']);
|
||||
define('builtin', 'data run', ['inDataStep']);
|
||||
|
||||
|
||||
//proc
|
||||
define('def', 'data', ['inProc']);
|
||||
|
||||
// flow control for macros
|
||||
define('def', '%if %end %end; %else %else; %do %do; %then', ['inMacro']);
|
||||
|
||||
//everywhere
|
||||
define('builtin', 'proc run; quit; libname filename %macro %mend option options', ['ALL']);
|
||||
|
||||
define('def', 'footnote title libname ods', ['ALL']);
|
||||
define('def', '%let %put %global %sysfunc %eval ', ['ALL']);
|
||||
// automatic macro variables http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a003167023.htm
|
||||
define('variable', '&sysbuffr &syscc &syscharwidth &syscmd &sysdate &sysdate9 &sysday &sysdevic &sysdmg &sysdsn &sysencoding &sysenv &syserr &syserrortext &sysfilrc &syshostname &sysindex &sysinfo &sysjobid &syslast &syslckrc &syslibrc &syslogapplname &sysmacroname &sysmenv &sysmsg &sysncpu &sysodspath &sysparm &syspbuff &sysprocessid &sysprocessname &sysprocname &sysrc &sysscp &sysscpl &sysscpl &syssite &sysstartid &sysstartname &systcpiphostname &systime &sysuserid &sysver &sysvlong &sysvlong4 &syswarningtext', ['ALL']);
|
||||
|
||||
//footnote[1-9]? title[1-9]?
|
||||
|
||||
//options statement
|
||||
define('def', 'source2 nosource2 page pageno pagesize', ['ALL']);
|
||||
|
||||
//proc and datastep
|
||||
define('def', '_all_ _character_ _cmd_ _freq_ _i_ _infile_ _last_ _msg_ _null_ _numeric_ _temporary_ _type_ abort abs addr adjrsq airy alpha alter altlog altprint and arcos array arsin as atan attrc attrib attrn authserver autoexec awscontrol awsdef awsmenu awsmenumerge awstitle backward band base betainv between blocksize blshift bnot bor brshift bufno bufsize bxor by byerr byline byte calculated call cards cards4 catcache cbufno cdf ceil center cexist change chisq cinv class cleanup close cnonct cntllev coalesce codegen col collate collin column comamid comaux1 comaux2 comdef compbl compound compress config continue convert cos cosh cpuid create cross crosstab css curobs cv daccdb daccdbsl daccsl daccsyd dacctab dairy datalines datalines4 datejul datepart datetime day dbcslang dbcstype dclose ddm delete delimiter depdb depdbsl depsl depsyd deptab dequote descending descript design= device dflang dhms dif digamma dim dinfo display distinct dkricond dkrocond dlm dnum do dopen doptname doptnum dread drop dropnote dsname dsnferr echo else emaildlg emailid emailpw emailserver emailsys encrypt end endsas engine eof eov erf erfc error errorcheck errors exist exp fappend fclose fcol fdelete feedback fetch fetchobs fexist fget file fileclose fileexist filefmt filename fileref fmterr fmtsearch fnonct fnote font fontalias fopen foptname foptnum force formatted formchar formdelim formdlim forward fpoint fpos fput fread frewind frlen from fsep fuzz fwrite gaminv gamma getoption getvarc getvarn go goto group gwindow hbar hbound helpenv helploc hms honorappearance hosthelp hostprint hour hpct html hvar ibessel ibr id if index indexc indexw initcmd initstmt inner input inputc inputn inr insert int intck intnx into intrr invaliddata irr is jbessel join juldate keep kentb kurtosis label lag last lbound leave left length levels lgamma lib library libref line linesize link list log log10 log2 logpdf logpmf logsdf lostcard lowcase lrecl ls macro macrogen maps mautosource max maxdec maxr mdy mean measures median memtype merge merror min minute missing missover mlogic mod mode model modify month mopen mort mprint mrecall msglevel msymtabmax mvarsize myy n nest netpv new news nmiss no nobatch nobs nocaps nocardimage nocenter nocharcode nocmdmac nocol nocum nodate nodbcs nodetails nodmr nodms nodmsbatch nodup nodupkey noduplicates noechoauto noequals noerrorabend noexitwindows nofullstimer noicon noimplmac noint nolist noloadlist nomiss nomlogic nomprint nomrecall nomsgcase nomstored nomultenvappl nonotes nonumber noobs noovp nopad nopercent noprint noprintinit normal norow norsasuser nosetinit nosplash nosymbolgen note notes notitle notitles notsorted noverbose noxsync noxwait npv null number numkeys nummousekeys nway obs on open order ordinal otherwise out outer outp= output over ovp p(1 5 10 25 50 75 90 95 99) pad pad2 paired parm parmcards path pathdll pathname pdf peek peekc pfkey pmf point poisson poke position printer probbeta probbnml probchi probf probgam probhypr probit probnegb probnorm probsig probt procleave prt ps pw pwreq qtr quote r ranbin rancau ranexp rangam range ranks rannor ranpoi rantbl rantri ranuni read recfm register regr remote remove rename repeat replace resolve retain return reuse reverse rewind right round rsquare rtf rtrace rtraceloc s s2 samploc sasautos sascontrol sasfrscr sasmsg sasmstore sasscript sasuser saving scan sdf second select selection separated seq serror set setcomm setot sign simple sin sinh siteinfo skewness skip sle sls sortedby sortpgm sortseq sortsize soundex spedis splashlocation split spool sqrt start std stderr stdin stfips stimer stname stnamel stop stopover subgroup subpopn substr sum sumwgt symbol symbolgen symget symput sysget sysin sysleave sysmsg sysparm sysprint sysprintfont sysprod sysrc system t table tables tan tanh tapeclose tbufsize terminal test then timepart tinv tnonct to today tol tooldef totper transformout translate trantab tranwrd trigamma trim trimn trunc truncover type unformatted uniform union until upcase update user usericon uss validate value var weight when where while wincharset window work workinit workterm write wsum xsync xwait yearcutoff yes yyq min max', ['inDataStep', 'inProc']);
|
||||
define('operator', 'and not ', ['inDataStep', 'inProc']);
|
||||
|
||||
// Main function
|
||||
function tokenize(stream, state) {
|
||||
// Finally advance the stream
|
||||
var ch = stream.next();
|
||||
|
||||
// BLOCKCOMMENT
|
||||
if (ch === '/' && stream.eat('*')) {
|
||||
state.continueComment = true;
|
||||
return "comment";
|
||||
} else if (state.continueComment === true) { // in comment block
|
||||
//comment ends at the beginning of the line
|
||||
if (ch === '*' && stream.peek() === '/') {
|
||||
stream.next();
|
||||
state.continueComment = false;
|
||||
} else if (stream.skipTo('*')) { //comment is potentially later in line
|
||||
stream.skipTo('*');
|
||||
stream.next();
|
||||
if (stream.eat('/'))
|
||||
state.continueComment = false;
|
||||
} else {
|
||||
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)) {
|
||||
// quote found on this line
|
||||
stream.next();
|
||||
state.continueString = null;
|
||||
} else {
|
||||
stream.skipToEnd();
|
||||
}
|
||||
return "string";
|
||||
} else if (state.continueString !== null && stream.eol()) {
|
||||
stream.skipTo(state.continueString) || stream.skipToEnd();
|
||||
return "string";
|
||||
} else if (/[\d\.]/.test(ch)) { //find numbers
|
||||
if (ch === ".")
|
||||
stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/);
|
||||
else if (ch === "0")
|
||||
stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/);
|
||||
else
|
||||
stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/);
|
||||
return "number";
|
||||
} else if (isDoubleOperatorChar.test(ch + stream.peek())) { // TWO SYMBOL TOKENS
|
||||
stream.next();
|
||||
return "operator";
|
||||
} else if (isDoubleOperatorSym.hasOwnProperty(doubleOperator)) {
|
||||
stream.next();
|
||||
if (stream.peek() === ' ')
|
||||
return isDoubleOperatorSym[doubleOperator.toLowerCase()];
|
||||
} else if (isSingleOperatorChar.test(ch)) { // SINGLE SYMBOL TOKENS
|
||||
return "operator";
|
||||
}
|
||||
|
||||
// Matches one whole word -- even if the word is a character
|
||||
var word;
|
||||
if (stream.match(/[%&;\w]+/, false) != null) {
|
||||
word = ch + stream.match(/[%&;\w]+/, true);
|
||||
if (/&/.test(word)) return 'variable'
|
||||
} else {
|
||||
word = ch;
|
||||
}
|
||||
// the word after DATA PROC or MACRO
|
||||
if (state.nextword) {
|
||||
stream.match(/[\w]+/);
|
||||
// match memname.libname
|
||||
if (stream.peek() === '.') stream.skipTo(' ');
|
||||
state.nextword = false;
|
||||
return 'variable-2';
|
||||
|
||||
}
|
||||
|
||||
// Are we in a DATA Step?
|
||||
if (state.inDataStep) {
|
||||
if (word.toLowerCase() === 'run;' || stream.match(/run\s;/)) {
|
||||
state.inDataStep = false;
|
||||
return 'builtin';
|
||||
}
|
||||
// variable formats
|
||||
if ((word) && stream.next() === '.') {
|
||||
//either a format or libname.memname
|
||||
if (/\w/.test(stream.peek())) return 'variable-2';
|
||||
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)) {
|
||||
//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;
|
||||
}
|
||||
}
|
||||
// Are we in an Proc statement?
|
||||
if (state.inProc) {
|
||||
if (word.toLowerCase() === 'run;' || word.toLowerCase() === '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)) {
|
||||
stream.match(/[\w]+/);
|
||||
return words[word].style;
|
||||
}
|
||||
}
|
||||
// Are we in a Macro statement?
|
||||
if (state.inMacro) {
|
||||
if (word.toLowerCase() === '%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)) {
|
||||
stream.match(/[\w]+/);
|
||||
return words[word.toLowerCase()].style;
|
||||
}
|
||||
|
||||
return 'atom';
|
||||
}
|
||||
// Do we have Keywords specific words?
|
||||
if (word && words.hasOwnProperty(word.toLowerCase())) {
|
||||
// Negates the initial next()
|
||||
stream.backUp(1);
|
||||
// Actually move the stream
|
||||
stream.match(/[\w]+/);
|
||||
if (word.toLowerCase() === 'data' && /=/.test(stream.peek()) === false) {
|
||||
state.inDataStep = true;
|
||||
state.nextword = true;
|
||||
return 'builtin';
|
||||
}
|
||||
if (word.toLowerCase() === 'proc') {
|
||||
state.inProc = true;
|
||||
state.nextword = true;
|
||||
return 'builtin';
|
||||
}
|
||||
if (word.toLowerCase() === '%macro') {
|
||||
state.inMacro = true;
|
||||
state.nextword = true;
|
||||
return 'builtin';
|
||||
}
|
||||
if (/title[1-9]/i.test(word)) return 'def';
|
||||
|
||||
if (word.toLowerCase() === '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;
|
||||
return null;
|
||||
}
|
||||
// Unrecognized syntax
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
startState: function () {
|
||||
return {
|
||||
inDataStep: false,
|
||||
inProc: false,
|
||||
inMacro: false,
|
||||
nextword: false,
|
||||
continueString: null,
|
||||
continueComment: false
|
||||
};
|
||||
},
|
||||
token: function (stream, state) {
|
||||
// Strip the spaces, but regex will account for them either way
|
||||
if (stream.eatSpace()) return null;
|
||||
// Go through the main process
|
||||
return tokenize(stream, state);
|
||||
},
|
||||
|
||||
blockCommentStart: "/*",
|
||||
blockCommentEnd: "*/"
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("text/x-sas", "sas");
|
||||
});
|
|
@ -25,7 +25,7 @@ CodeMirror.defineMode("sparql", function(config) {
|
|||
"strbefore", "strafter", "year", "month", "day", "hours", "minutes", "seconds",
|
||||
"timezone", "tz", "now", "uuid", "struuid", "md5", "sha1", "sha256", "sha384",
|
||||
"sha512", "coalesce", "if", "strlang", "strdt", "isnumeric", "regex", "exists",
|
||||
"isblank", "isliteral", "a"]);
|
||||
"isblank", "isliteral", "a", "bind"]);
|
||||
var keywords = wordRegexp(["base", "prefix", "select", "distinct", "reduced", "construct", "describe",
|
||||
"ask", "from", "named", "where", "order", "limit", "offset", "filter", "optional",
|
||||
"graph", "by", "asc", "desc", "as", "having", "undef", "values", "group",
|
||||
|
@ -135,7 +135,11 @@ CodeMirror.defineMode("sparql", function(config) {
|
|||
else if (curPunc == "{") pushContext(state, "}", stream.column());
|
||||
else if (/[\]\}\)]/.test(curPunc)) {
|
||||
while (state.context && state.context.type == "pattern") popContext(state);
|
||||
if (state.context && curPunc == state.context.type) popContext(state);
|
||||
if (state.context && curPunc == state.context.type) {
|
||||
popContext(state);
|
||||
if (curPunc == "}" && state.context && state.context.type == "pattern")
|
||||
popContext(state);
|
||||
}
|
||||
}
|
||||
else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state);
|
||||
else if (/atom|string|variable/.test(style) && state.context) {
|
||||
|
|
|
@ -70,7 +70,10 @@
|
|||
return "operator";
|
||||
case "\\":
|
||||
if (stream.match(/\\[a-z]+/)) return "string-2";
|
||||
else return null;
|
||||
else {
|
||||
stream.next();
|
||||
return "atom";
|
||||
}
|
||||
case ".":
|
||||
case ",":
|
||||
case ";":
|
||||
|
|
4
public/vendor/codemirror/mode/sql/index.html
vendored
4
public/vendor/codemirror/mode/sql/index.html
vendored
|
@ -56,7 +56,9 @@ SELECT SQL_NO_CACHE DISTINCT
|
|||
<code><a href="?mime=text/x-cassandra">text/x-cassandra</a></code>,
|
||||
<code><a href="?mime=text/x-plsql">text/x-plsql</a></code>,
|
||||
<code><a href="?mime=text/x-mssql">text/x-mssql</a></code>,
|
||||
<code><a href="?mime=text/x-hive">text/x-hive</a></code>.
|
||||
<code><a href="?mime=text/x-hive">text/x-hive</a></code>,
|
||||
<code><a href="?mime=text/x-pgsql">text/x-pgsql</a></code>,
|
||||
<code><a href="?mime=text/x-gql">text/x-gql</a></code>.
|
||||
</p>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
|
|
28
public/vendor/codemirror/mode/sql/sql.js
vendored
28
public/vendor/codemirror/mode/sql/sql.js
vendored
File diff suppressed because one or more lines are too long
47
public/vendor/codemirror/mode/swift/swift.js
vendored
47
public/vendor/codemirror/mode/swift/swift.js
vendored
|
@ -34,13 +34,13 @@
|
|||
"private","extension"])
|
||||
var operators = "+-/*%=|&<>#"
|
||||
var punc = ";,.(){}[]"
|
||||
var delimiters = /^(?:[()\[\]{},:`=;]|\.\.?\.?)/
|
||||
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)(?:\/\/)?(?:\\.|[^\/])+\//
|
||||
|
||||
function tokenBase(stream, state, prev) {
|
||||
if (stream.sol()) state.indented = stream.indentation()
|
||||
if (stream.eatSpace()) return null
|
||||
|
||||
var ch = stream.peek()
|
||||
|
@ -60,7 +60,8 @@
|
|||
return "operator"
|
||||
}
|
||||
if (punc.indexOf(ch) > -1) {
|
||||
stream.match(delimiters)
|
||||
stream.next()
|
||||
stream.match("..")
|
||||
return "punctuation"
|
||||
}
|
||||
if (ch == '"' || ch == "'") {
|
||||
|
@ -136,14 +137,35 @@
|
|||
return "comment"
|
||||
}
|
||||
|
||||
CodeMirror.defineMode("swift", function() {
|
||||
function Context(prev, align, indented) {
|
||||
this.prev = prev
|
||||
this.align = align
|
||||
this.indented = indented
|
||||
}
|
||||
|
||||
function pushContext(state, stream) {
|
||||
var align = stream.match(/^\s*($|\/[\/\*])/, false) ? null : stream.column() + 1
|
||||
state.context = new Context(state.context, align, state.indented)
|
||||
}
|
||||
|
||||
function popContext(state) {
|
||||
if (state.context) {
|
||||
state.indented = state.context.indented
|
||||
state.context = state.context.prev
|
||||
}
|
||||
}
|
||||
|
||||
CodeMirror.defineMode("swift", function(config) {
|
||||
return {
|
||||
startState: function() {
|
||||
return {
|
||||
prev: null,
|
||||
context: null,
|
||||
indented: 0,
|
||||
tokenize: []
|
||||
}
|
||||
},
|
||||
|
||||
token: function(stream, state) {
|
||||
var prev = state.prev
|
||||
state.prev = null
|
||||
|
@ -151,8 +173,25 @@
|
|||
var style = tokenize(stream, state, prev)
|
||||
if (!style || style == "comment") state.prev = prev
|
||||
else if (!state.prev) state.prev = style
|
||||
|
||||
if (style == "punctuation") {
|
||||
var bracket = /[\(\[\{]|([\]\)\}])/.exec(stream.current())
|
||||
if (bracket) (bracket[1] ? popContext : pushContext)(state, stream)
|
||||
}
|
||||
|
||||
return style
|
||||
},
|
||||
|
||||
indent: function(state, textAfter) {
|
||||
var cx = state.context
|
||||
if (!cx) return 0
|
||||
var closing = /^[\]\}\)]/.test(textAfter)
|
||||
if (cx.align != null) return cx.align - (closing ? 1 : 0)
|
||||
return cx.indented + (closing ? 0 : config.indentUnit)
|
||||
},
|
||||
|
||||
electricInput: /^\s*[\)\}\]]$/,
|
||||
|
||||
lineComment: "//",
|
||||
blockCommentStart: "/*",
|
||||
blockCommentEnd: "*/"
|
||||
|
@ -160,4 +199,4 @@
|
|||
})
|
||||
|
||||
CodeMirror.defineMIME("text/x-swift","swift")
|
||||
})
|
||||
});
|
||||
|
|
32
public/vendor/codemirror/mode/tcl/tcl.js
vendored
32
public/vendor/codemirror/mode/tcl/tcl.js
vendored
|
@ -42,42 +42,34 @@ CodeMirror.defineMode("tcl", function() {
|
|||
var beforeParams = state.beforeParams;
|
||||
state.beforeParams = false;
|
||||
var ch = stream.next();
|
||||
if ((ch == '"' || ch == "'") && state.inParams)
|
||||
if ((ch == '"' || ch == "'") && state.inParams) {
|
||||
return chain(stream, state, tokenString(ch));
|
||||
else if (/[\[\]{}\(\),;\.]/.test(ch)) {
|
||||
} else if (/[\[\]{}\(\),;\.]/.test(ch)) {
|
||||
if (ch == "(" && beforeParams) state.inParams = true;
|
||||
else if (ch == ")") state.inParams = false;
|
||||
return null;
|
||||
}
|
||||
else if (/\d/.test(ch)) {
|
||||
} else if (/\d/.test(ch)) {
|
||||
stream.eatWhile(/[\w\.]/);
|
||||
return "number";
|
||||
}
|
||||
else if (ch == "#" && stream.eat("*")) {
|
||||
return chain(stream, state, tokenComment);
|
||||
}
|
||||
else if (ch == "#" && stream.match(/ *\[ *\[/)) {
|
||||
return chain(stream, state, tokenUnparsed);
|
||||
}
|
||||
else if (ch == "#" && stream.eat("#")) {
|
||||
} else if (ch == "#") {
|
||||
if (stream.eat("*"))
|
||||
return chain(stream, state, tokenComment);
|
||||
if (ch == "#" && stream.match(/ *\[ *\[/))
|
||||
return chain(stream, state, tokenUnparsed);
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
else if (ch == '"') {
|
||||
} else if (ch == '"') {
|
||||
stream.skipTo(/"/);
|
||||
return "comment";
|
||||
}
|
||||
else if (ch == "$") {
|
||||
} else if (ch == "$") {
|
||||
stream.eatWhile(/[$_a-z0-9A-Z\.{:]/);
|
||||
stream.eatWhile(/}/);
|
||||
state.beforeParams = true;
|
||||
return "builtin";
|
||||
}
|
||||
else if (isOperatorChar.test(ch)) {
|
||||
} else if (isOperatorChar.test(ch)) {
|
||||
stream.eatWhile(isOperatorChar);
|
||||
return "comment";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
stream.eatWhile(/[\w\$_{}\xa1-\uffff]/);
|
||||
var word = stream.current().toLowerCase();
|
||||
if (keywords && keywords.propertyIsEnumerable(word))
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
! Info
|
||||
CoreVersion parameter is needed for TiddlyWiki only!
|
||||
***/
|
||||
//{{{
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
|
@ -32,73 +31,60 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
// Tokenizer
|
||||
var textwords = {};
|
||||
|
||||
var keywords = function () {
|
||||
function kw(type) {
|
||||
return { type: type, style: "macro"};
|
||||
}
|
||||
return {
|
||||
"allTags": kw('allTags'), "closeAll": kw('closeAll'), "list": kw('list'),
|
||||
"newJournal": kw('newJournal'), "newTiddler": kw('newTiddler'),
|
||||
"permaview": kw('permaview'), "saveChanges": kw('saveChanges'),
|
||||
"search": kw('search'), "slider": kw('slider'), "tabs": kw('tabs'),
|
||||
"tag": kw('tag'), "tagging": kw('tagging'), "tags": kw('tags'),
|
||||
"tiddler": kw('tiddler'), "timeline": kw('timeline'),
|
||||
"today": kw('today'), "version": kw('version'), "option": kw('option'),
|
||||
|
||||
"with": kw('with'),
|
||||
"filter": kw('filter')
|
||||
};
|
||||
}();
|
||||
var keywords = {
|
||||
"allTags": true, "closeAll": true, "list": true,
|
||||
"newJournal": true, "newTiddler": true,
|
||||
"permaview": true, "saveChanges": true,
|
||||
"search": true, "slider": true, "tabs": true,
|
||||
"tag": true, "tagging": true, "tags": true,
|
||||
"tiddler": true, "timeline": true,
|
||||
"today": true, "version": true, "option": true,
|
||||
"with": true, "filter": true
|
||||
};
|
||||
|
||||
var isSpaceName = /[\w_\-]/i,
|
||||
reHR = /^\-\-\-\-+$/, // <hr>
|
||||
reWikiCommentStart = /^\/\*\*\*$/, // /***
|
||||
reWikiCommentStop = /^\*\*\*\/$/, // ***/
|
||||
reBlockQuote = /^<<<$/,
|
||||
reHR = /^\-\-\-\-+$/, // <hr>
|
||||
reWikiCommentStart = /^\/\*\*\*$/, // /***
|
||||
reWikiCommentStop = /^\*\*\*\/$/, // ***/
|
||||
reBlockQuote = /^<<<$/,
|
||||
|
||||
reJsCodeStart = /^\/\/\{\{\{$/, // //{{{ js block start
|
||||
reJsCodeStop = /^\/\/\}\}\}$/, // //}}} js stop
|
||||
reXmlCodeStart = /^<!--\{\{\{-->$/, // xml block start
|
||||
reXmlCodeStop = /^<!--\}\}\}-->$/, // xml stop
|
||||
reJsCodeStart = /^\/\/\{\{\{$/, // //{{{ js block start
|
||||
reJsCodeStop = /^\/\/\}\}\}$/, // //}}} js stop
|
||||
reXmlCodeStart = /^<!--\{\{\{-->$/, // xml block start
|
||||
reXmlCodeStop = /^<!--\}\}\}-->$/, // xml stop
|
||||
|
||||
reCodeBlockStart = /^\{\{\{$/, // {{{ TW text div block start
|
||||
reCodeBlockStop = /^\}\}\}$/, // }}} TW text stop
|
||||
reCodeBlockStart = /^\{\{\{$/, // {{{ TW text div block start
|
||||
reCodeBlockStop = /^\}\}\}$/, // }}} TW text stop
|
||||
|
||||
reUntilCodeStop = /.*?\}\}\}/;
|
||||
reUntilCodeStop = /.*?\}\}\}/;
|
||||
|
||||
function chain(stream, state, f) {
|
||||
state.tokenize = f;
|
||||
return f(stream, state);
|
||||
}
|
||||
|
||||
function jsTokenBase(stream, state) {
|
||||
var sol = stream.sol(), ch;
|
||||
function tokenBase(stream, state) {
|
||||
var sol = stream.sol(), ch = stream.peek();
|
||||
|
||||
state.block = false; // indicates the start of a code block.
|
||||
|
||||
ch = stream.peek(); // don't eat, to make matching simpler
|
||||
|
||||
// check start of blocks
|
||||
if (sol && /[<\/\*{}\-]/.test(ch)) {
|
||||
if (stream.match(reCodeBlockStart)) {
|
||||
state.block = true;
|
||||
return chain(stream, state, twTokenCode);
|
||||
}
|
||||
if (stream.match(reBlockQuote)) {
|
||||
if (stream.match(reBlockQuote))
|
||||
return 'quote';
|
||||
}
|
||||
if (stream.match(reWikiCommentStart) || stream.match(reWikiCommentStop)) {
|
||||
if (stream.match(reWikiCommentStart) || stream.match(reWikiCommentStop))
|
||||
return 'comment';
|
||||
}
|
||||
if (stream.match(reJsCodeStart) || stream.match(reJsCodeStop) || stream.match(reXmlCodeStart) || stream.match(reXmlCodeStop)) {
|
||||
if (stream.match(reJsCodeStart) || stream.match(reJsCodeStop) || stream.match(reXmlCodeStart) || stream.match(reXmlCodeStop))
|
||||
return 'comment';
|
||||
}
|
||||
if (stream.match(reHR)) {
|
||||
if (stream.match(reHR))
|
||||
return 'hr';
|
||||
}
|
||||
} // sol
|
||||
ch = stream.next();
|
||||
}
|
||||
|
||||
stream.next();
|
||||
if (sol && /[\/\*!#;:>|]/.test(ch)) {
|
||||
if (ch == "!") { // tw header
|
||||
stream.skipToEnd();
|
||||
|
@ -124,95 +110,77 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
stream.eatWhile(">");
|
||||
return "quote";
|
||||
}
|
||||
if (ch == '|') {
|
||||
if (ch == '|')
|
||||
return 'header';
|
||||
}
|
||||
}
|
||||
|
||||
if (ch == '{' && stream.match(/\{\{/)) {
|
||||
if (ch == '{' && stream.match(/\{\{/))
|
||||
return chain(stream, state, twTokenCode);
|
||||
}
|
||||
|
||||
// rudimentary html:// file:// link matching. TW knows much more ...
|
||||
if (/[hf]/i.test(ch)) {
|
||||
if (/[ti]/i.test(stream.peek()) && stream.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i)) {
|
||||
return "link";
|
||||
}
|
||||
}
|
||||
if (/[hf]/i.test(ch) &&
|
||||
/[ti]/i.test(stream.peek()) &&
|
||||
stream.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i))
|
||||
return "link";
|
||||
|
||||
// just a little string indicator, don't want to have the whole string covered
|
||||
if (ch == '"') {
|
||||
if (ch == '"')
|
||||
return 'string';
|
||||
}
|
||||
if (ch == '~') { // _no_ CamelCase indicator should be bold
|
||||
|
||||
if (ch == '~') // _no_ CamelCase indicator should be bold
|
||||
return 'brace';
|
||||
}
|
||||
if (/[\[\]]/.test(ch)) { // check for [[..]]
|
||||
if (stream.peek() == ch) {
|
||||
stream.next();
|
||||
return 'brace';
|
||||
}
|
||||
}
|
||||
|
||||
if (/[\[\]]/.test(ch) && stream.match(ch)) // check for [[..]]
|
||||
return 'brace';
|
||||
|
||||
if (ch == "@") { // check for space link. TODO fix @@...@@ highlighting
|
||||
stream.eatWhile(isSpaceName);
|
||||
return "link";
|
||||
}
|
||||
|
||||
if (/\d/.test(ch)) { // numbers
|
||||
stream.eatWhile(/\d/);
|
||||
return "number";
|
||||
}
|
||||
|
||||
if (ch == "/") { // tw invisible comment
|
||||
if (stream.eat("%")) {
|
||||
return chain(stream, state, twTokenComment);
|
||||
}
|
||||
else if (stream.eat("/")) { //
|
||||
} else if (stream.eat("/")) { //
|
||||
return chain(stream, state, twTokenEm);
|
||||
}
|
||||
}
|
||||
if (ch == "_") { // tw underline
|
||||
if (stream.eat("_")) {
|
||||
|
||||
if (ch == "_" && stream.eat("_")) // tw underline
|
||||
return chain(stream, state, twTokenUnderline);
|
||||
}
|
||||
}
|
||||
|
||||
// strikethrough and mdash handling
|
||||
if (ch == "-") {
|
||||
if (stream.eat("-")) {
|
||||
// if strikethrough looks ugly, change CSS.
|
||||
if (stream.peek() != ' ')
|
||||
return chain(stream, state, twTokenStrike);
|
||||
// mdash
|
||||
if (stream.peek() == ' ')
|
||||
return 'brace';
|
||||
}
|
||||
}
|
||||
if (ch == "'") { // tw bold
|
||||
if (stream.eat("'")) {
|
||||
return chain(stream, state, twTokenStrong);
|
||||
}
|
||||
}
|
||||
if (ch == "<") { // tw macro
|
||||
if (stream.eat("<")) {
|
||||
return chain(stream, state, twTokenMacro);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
if (ch == "-" && stream.eat("-")) {
|
||||
// if strikethrough looks ugly, change CSS.
|
||||
if (stream.peek() != ' ')
|
||||
return chain(stream, state, twTokenStrike);
|
||||
// mdash
|
||||
if (stream.peek() == ' ')
|
||||
return 'brace';
|
||||
}
|
||||
|
||||
if (ch == "'" && stream.eat("'")) // tw bold
|
||||
return chain(stream, state, twTokenStrong);
|
||||
|
||||
if (ch == "<" && stream.eat("<")) // tw macro
|
||||
return chain(stream, state, twTokenMacro);
|
||||
|
||||
// core macro handling
|
||||
stream.eatWhile(/[\w\$_]/);
|
||||
var word = stream.current(),
|
||||
known = textwords.propertyIsEnumerable(word) && textwords[word];
|
||||
|
||||
return known ? known.style : null;
|
||||
} // jsTokenBase()
|
||||
return textwords.propertyIsEnumerable(stream.current()) ? "keyword" : null
|
||||
}
|
||||
|
||||
// tw invisible comment
|
||||
function twTokenComment(stream, state) {
|
||||
var maybeEnd = false,
|
||||
ch;
|
||||
var maybeEnd = false, ch;
|
||||
while (ch = stream.next()) {
|
||||
if (ch == "/" && maybeEnd) {
|
||||
state.tokenize = jsTokenBase;
|
||||
state.tokenize = tokenBase;
|
||||
break;
|
||||
}
|
||||
maybeEnd = (ch == "%");
|
||||
|
@ -226,7 +194,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
ch;
|
||||
while (ch = stream.next()) {
|
||||
if (ch == "'" && maybeEnd) {
|
||||
state.tokenize = jsTokenBase;
|
||||
state.tokenize = tokenBase;
|
||||
break;
|
||||
}
|
||||
maybeEnd = (ch == "'");
|
||||
|
@ -243,12 +211,12 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
}
|
||||
|
||||
if (!sb && stream.match(reUntilCodeStop)) {
|
||||
state.tokenize = jsTokenBase;
|
||||
state.tokenize = tokenBase;
|
||||
return "comment";
|
||||
}
|
||||
|
||||
if (sb && stream.sol() && stream.match(reCodeBlockStop)) {
|
||||
state.tokenize = jsTokenBase;
|
||||
state.tokenize = tokenBase;
|
||||
return "comment";
|
||||
}
|
||||
|
||||
|
@ -262,7 +230,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
ch;
|
||||
while (ch = stream.next()) {
|
||||
if (ch == "/" && maybeEnd) {
|
||||
state.tokenize = jsTokenBase;
|
||||
state.tokenize = tokenBase;
|
||||
break;
|
||||
}
|
||||
maybeEnd = (ch == "/");
|
||||
|
@ -276,7 +244,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
ch;
|
||||
while (ch = stream.next()) {
|
||||
if (ch == "_" && maybeEnd) {
|
||||
state.tokenize = jsTokenBase;
|
||||
state.tokenize = tokenBase;
|
||||
break;
|
||||
}
|
||||
maybeEnd = (ch == "_");
|
||||
|
@ -291,7 +259,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
|
||||
while (ch = stream.next()) {
|
||||
if (ch == "-" && maybeEnd) {
|
||||
state.tokenize = jsTokenBase;
|
||||
state.tokenize = tokenBase;
|
||||
break;
|
||||
}
|
||||
maybeEnd = (ch == "-");
|
||||
|
@ -301,58 +269,40 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
|
||||
// macro
|
||||
function twTokenMacro(stream, state) {
|
||||
var ch, word, known;
|
||||
|
||||
if (stream.current() == '<<') {
|
||||
return 'macro';
|
||||
}
|
||||
|
||||
ch = stream.next();
|
||||
var ch = stream.next();
|
||||
if (!ch) {
|
||||
state.tokenize = jsTokenBase;
|
||||
state.tokenize = tokenBase;
|
||||
return null;
|
||||
}
|
||||
if (ch == ">") {
|
||||
if (stream.peek() == '>') {
|
||||
stream.next();
|
||||
state.tokenize = jsTokenBase;
|
||||
state.tokenize = tokenBase;
|
||||
return "macro";
|
||||
}
|
||||
}
|
||||
|
||||
stream.eatWhile(/[\w\$_]/);
|
||||
word = stream.current();
|
||||
known = keywords.propertyIsEnumerable(word) && keywords[word];
|
||||
|
||||
if (known) {
|
||||
return known.style, word;
|
||||
}
|
||||
else {
|
||||
return null, word;
|
||||
}
|
||||
return keywords.propertyIsEnumerable(stream.current()) ? "keyword" : null
|
||||
}
|
||||
|
||||
// Interface
|
||||
return {
|
||||
startState: function () {
|
||||
return {
|
||||
tokenize: jsTokenBase,
|
||||
indented: 0,
|
||||
level: 0
|
||||
};
|
||||
return {tokenize: tokenBase};
|
||||
},
|
||||
|
||||
token: function (stream, state) {
|
||||
if (stream.eatSpace()) return null;
|
||||
var style = state.tokenize(stream, state);
|
||||
return style;
|
||||
},
|
||||
|
||||
electricChars: ""
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("text/x-tiddlywiki", "tiddlywiki");
|
||||
});
|
||||
|
||||
//}}}
|
||||
|
|
4
public/vendor/codemirror/mode/troff/troff.js
vendored
4
public/vendor/codemirror/mode/troff/troff.js
vendored
|
@ -77,6 +77,8 @@ CodeMirror.defineMode('troff', function() {
|
|||
};
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME('troff', 'troff');
|
||||
CodeMirror.defineMIME('text/troff', 'troff');
|
||||
CodeMirror.defineMIME('text/x-troff', 'troff');
|
||||
CodeMirror.defineMIME('application/x-troff', 'troff');
|
||||
|
||||
});
|
||||
|
|
15
public/vendor/codemirror/mode/twig/twig.js
vendored
15
public/vendor/codemirror/mode/twig/twig.js
vendored
|
@ -3,15 +3,15 @@
|
|||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"));
|
||||
mod(require("../../lib/codemirror"), require("../../addon/mode/multiplex"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod);
|
||||
define(["../../lib/codemirror", "../../addon/mode/multiplex"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
CodeMirror.defineMode("twig", function() {
|
||||
CodeMirror.defineMode("twig:inner", function() {
|
||||
var keywords = ["and", "as", "autoescape", "endautoescape", "block", "do", "endblock", "else", "elseif", "extends", "for", "endfor", "embed", "endembed", "filter", "endfilter", "flush", "from", "if", "endif", "in", "is", "include", "import", "not", "or", "set", "spaceless", "endspaceless", "with", "endwith", "trans", "endtrans", "blocktrans", "endblocktrans", "macro", "endmacro", "use", "verbatim", "endverbatim"],
|
||||
operator = /^[+\-*&%=<>!?|~^]/,
|
||||
sign = /^[:\[\(\{]/,
|
||||
|
@ -128,5 +128,14 @@
|
|||
};
|
||||
});
|
||||
|
||||
CodeMirror.defineMode("twig", function(config, parserConfig) {
|
||||
var twigInner = CodeMirror.getMode(config, "twig:inner");
|
||||
if (!parserConfig || !parserConfig.base) return twigInner;
|
||||
return CodeMirror.multiplexingMode(
|
||||
CodeMirror.getMode(config, parserConfig.base), {
|
||||
open: /\{[{#%]/, close: /[}#%]\}/, mode: twigInner, parseDelimiters: true
|
||||
}
|
||||
);
|
||||
});
|
||||
CodeMirror.defineMIME("text/x-twig", "twig");
|
||||
});
|
||||
|
|
|
@ -77,6 +77,8 @@ $someObject.getValues("this is a string split
|
|||
|
||||
$someObject("This plus $something in the middle").method(7567).property
|
||||
|
||||
#set($something = "Parseable string with '$quotes'!")
|
||||
|
||||
#macro( tablerows $color $somelist )
|
||||
#foreach( $something in $somelist )
|
||||
<tr><td bgcolor=$color>$something</td></tr>
|
||||
|
|
|
@ -34,7 +34,7 @@ CodeMirror.defineMode("velocity", function() {
|
|||
state.beforeParams = false;
|
||||
var ch = stream.next();
|
||||
// start of unparsed string?
|
||||
if ((ch == "'") && state.inParams) {
|
||||
if ((ch == "'") && !state.inString && state.inParams) {
|
||||
state.lastTokenWasBuiltin = false;
|
||||
return chain(stream, state, tokenString(ch));
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ endclass
|
|||
Syntax highlighting and indentation for the Verilog and SystemVerilog languages (IEEE 1800).
|
||||
<h2>Configuration options:</h2>
|
||||
<ul>
|
||||
<li><strong>noIndentKeywords</strong> - List of keywords which should not cause identation to increase. E.g. ["package", "module"]. Default: None</li>
|
||||
<li><strong>noIndentKeywords</strong> - List of keywords which should not cause indentation to increase. E.g. ["package", "module"]. Default: None</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@
|
|||
""
|
||||
);
|
||||
|
||||
MT("covergoup_with_function_indents_properly",
|
||||
MT("covergroup_with_function_indents_properly",
|
||||
"[keyword covergroup] [variable cg] [keyword with] [keyword function] [variable sample][bracket (][keyword bit] [variable b][bracket )];",
|
||||
" [variable c] : [keyword coverpoint] [variable c];",
|
||||
"[keyword endgroup]: [variable cg]",
|
||||
|
|
|
@ -250,7 +250,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
|
|||
if (text == contextClosing) {
|
||||
return true;
|
||||
} else {
|
||||
// contextClosing may be mulitple keywords separated by ;
|
||||
// contextClosing may be multiple keywords separated by ;
|
||||
var closingKeywords = contextClosing.split(";");
|
||||
for (var i in closingKeywords) {
|
||||
if (text == closingKeywords[i]) {
|
||||
|
|
2
public/vendor/codemirror/mode/vhdl/vhdl.js
vendored
2
public/vendor/codemirror/mode/vhdl/vhdl.js
vendored
|
@ -36,7 +36,7 @@ CodeMirror.defineMode("vhdl", function(config, parserConfig) {
|
|||
multiLineStrings = parserConfig.multiLineStrings;
|
||||
|
||||
var keywords = words("abs,access,after,alias,all,and,architecture,array,assert,attribute,begin,block," +
|
||||
"body,buffer,bus,case,component,configuration,constant,disconnent,downto,else,elsif,end,end block,end case," +
|
||||
"body,buffer,bus,case,component,configuration,constant,disconnect,downto,else,elsif,end,end block,end case," +
|
||||
"end component,end for,end generate,end if,end loop,end process,end record,end units,entity,exit,file,for," +
|
||||
"function,generate,generic,generic map,group,guarded,if,impure,in,inertial,inout,is,label,library,linkage," +
|
||||
"literal,loop,map,mod,nand,new,next,nor,null,of,on,open,or,others,out,package,package body,port,port map," +
|
||||
|
|
71
public/vendor/codemirror/mode/webidl/index.html
vendored
Normal file
71
public/vendor/codemirror/mode/webidl/index.html
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: Web IDL mode</title>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="../../doc/docs.css">
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="../../addon/edit/matchbrackets.js"></script>
|
||||
<script src="webidl.js"></script>
|
||||
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
||||
|
||||
<div id="nav">
|
||||
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id="logo" src="../../doc/logo.png"></a>
|
||||
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a>
|
||||
<li><a href="../../doc/manual.html">Manual</a>
|
||||
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="../index.html">Language modes</a>
|
||||
<li><a class="active" href="#">Web IDL</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>Web IDL mode</h2>
|
||||
|
||||
<div>
|
||||
<textarea id="code" name="code">
|
||||
[NamedConstructor=Image(optional unsigned long width, optional unsigned long height)]
|
||||
interface HTMLImageElement : HTMLElement {
|
||||
attribute DOMString alt;
|
||||
attribute DOMString src;
|
||||
attribute DOMString srcset;
|
||||
attribute DOMString sizes;
|
||||
attribute DOMString? crossOrigin;
|
||||
attribute DOMString useMap;
|
||||
attribute boolean isMap;
|
||||
attribute unsigned long width;
|
||||
attribute unsigned long height;
|
||||
readonly attribute unsigned long naturalWidth;
|
||||
readonly attribute unsigned long naturalHeight;
|
||||
readonly attribute boolean complete;
|
||||
readonly attribute DOMString currentSrc;
|
||||
|
||||
// also has obsolete members
|
||||
};
|
||||
|
||||
partial interface HTMLImageElement {
|
||||
attribute DOMString name;
|
||||
attribute DOMString lowsrc;
|
||||
attribute DOMString align;
|
||||
attribute unsigned long hspace;
|
||||
attribute unsigned long vspace;
|
||||
attribute DOMString longDesc;
|
||||
|
||||
[TreatNullAs=EmptyString] attribute DOMString border;
|
||||
};
|
||||
</textarea>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true
|
||||
});
|
||||
</script>
|
||||
|
||||
<p><strong>MIME type defined:</strong> <code>text/x-webidl</code>.</p>
|
||||
</article>
|
195
public/vendor/codemirror/mode/webidl/webidl.js
vendored
Normal file
195
public/vendor/codemirror/mode/webidl/webidl.js
vendored
Normal file
|
@ -0,0 +1,195 @@
|
|||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
function wordRegexp(words) {
|
||||
return new RegExp("^((" + words.join(")|(") + "))\\b");
|
||||
};
|
||||
|
||||
var builtinArray = [
|
||||
"Clamp",
|
||||
"Constructor",
|
||||
"EnforceRange",
|
||||
"Exposed",
|
||||
"ImplicitThis",
|
||||
"Global", "PrimaryGlobal",
|
||||
"LegacyArrayClass",
|
||||
"LegacyUnenumerableNamedProperties",
|
||||
"LenientThis",
|
||||
"NamedConstructor",
|
||||
"NewObject",
|
||||
"NoInterfaceObject",
|
||||
"OverrideBuiltins",
|
||||
"PutForwards",
|
||||
"Replaceable",
|
||||
"SameObject",
|
||||
"TreatNonObjectAsNull",
|
||||
"TreatNullAs",
|
||||
"EmptyString",
|
||||
"Unforgeable",
|
||||
"Unscopeable"
|
||||
];
|
||||
var builtins = wordRegexp(builtinArray);
|
||||
|
||||
var typeArray = [
|
||||
"unsigned", "short", "long", // UnsignedIntegerType
|
||||
"unrestricted", "float", "double", // UnrestrictedFloatType
|
||||
"boolean", "byte", "octet", // Rest of PrimitiveType
|
||||
"Promise", // PromiseType
|
||||
"ArrayBuffer", "DataView", "Int8Array", "Int16Array", "Int32Array",
|
||||
"Uint8Array", "Uint16Array", "Uint32Array", "Uint8ClampedArray",
|
||||
"Float32Array", "Float64Array", // BufferRelatedType
|
||||
"ByteString", "DOMString", "USVString", "sequence", "object", "RegExp",
|
||||
"Error", "DOMException", "FrozenArray", // Rest of NonAnyType
|
||||
"any", // Rest of SingleType
|
||||
"void" // Rest of ReturnType
|
||||
];
|
||||
var types = wordRegexp(typeArray);
|
||||
|
||||
var keywordArray = [
|
||||
"attribute", "callback", "const", "deleter", "dictionary", "enum", "getter",
|
||||
"implements", "inherit", "interface", "iterable", "legacycaller", "maplike",
|
||||
"partial", "required", "serializer", "setlike", "setter", "static",
|
||||
"stringifier", "typedef", // ArgumentNameKeyword except
|
||||
// "unrestricted"
|
||||
"optional", "readonly", "or"
|
||||
];
|
||||
var keywords = wordRegexp(keywordArray);
|
||||
|
||||
var atomArray = [
|
||||
"true", "false", // BooleanLiteral
|
||||
"Infinity", "NaN", // FloatLiteral
|
||||
"null" // Rest of ConstValue
|
||||
];
|
||||
var atoms = wordRegexp(atomArray);
|
||||
|
||||
CodeMirror.registerHelper("hintWords", "webidl",
|
||||
builtinArray.concat(typeArray).concat(keywordArray).concat(atomArray));
|
||||
|
||||
var startDefArray = ["callback", "dictionary", "enum", "interface"];
|
||||
var startDefs = wordRegexp(startDefArray);
|
||||
|
||||
var endDefArray = ["typedef"];
|
||||
var endDefs = wordRegexp(endDefArray);
|
||||
|
||||
var singleOperators = /^[:<=>?]/;
|
||||
var integers = /^-?([1-9][0-9]*|0[Xx][0-9A-Fa-f]+|0[0-7]*)/;
|
||||
var floats = /^-?(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+)/;
|
||||
var identifiers = /^_?[A-Za-z][0-9A-Z_a-z-]*/;
|
||||
var strings = /^"[^"]*"/;
|
||||
var multilineComments = /^\/\*.*?\*\//;
|
||||
var multilineCommentsStart = /^\/\*.*/;
|
||||
var multilineCommentsEnd = /^.*?\*\//;
|
||||
|
||||
function readToken(stream, state) {
|
||||
// whitespace
|
||||
if (stream.eatSpace()) return null;
|
||||
|
||||
// comment
|
||||
if (state.inComment) {
|
||||
if (stream.match(multilineCommentsEnd)) {
|
||||
state.inComment = false;
|
||||
return "comment";
|
||||
}
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
if (stream.match("//")) {
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
if (stream.match(multilineComments)) return "comment";
|
||||
if (stream.match(multilineCommentsStart)) {
|
||||
state.inComment = true;
|
||||
return "comment";
|
||||
}
|
||||
|
||||
// integer and float
|
||||
if (stream.match(/^-?[0-9\.]/, false)) {
|
||||
if (stream.match(integers) || stream.match(floats)) return "number";
|
||||
}
|
||||
|
||||
// string
|
||||
if (stream.match(strings)) return "string";
|
||||
|
||||
// identifier
|
||||
if (stream.match(identifiers)) {
|
||||
if (state.startDef) return "def";
|
||||
if (state.endDef && stream.match(/^\s*;/, false)) {
|
||||
state.endDef = false;
|
||||
return "def";
|
||||
}
|
||||
}
|
||||
|
||||
if (stream.match(keywords)) return "keyword";
|
||||
|
||||
if (stream.match(types)) {
|
||||
var lastToken = state.lastToken;
|
||||
var nextToken = (stream.match(/^\s*(.+?)\b/, false) || [])[1];
|
||||
|
||||
if (lastToken === ":" || lastToken === "implements" ||
|
||||
nextToken === "implements" || nextToken === "=") {
|
||||
// Used as identifier
|
||||
return "builtin";
|
||||
} else {
|
||||
// Used as type
|
||||
return "variable-3";
|
||||
}
|
||||
}
|
||||
|
||||
if (stream.match(builtins)) return "builtin";
|
||||
if (stream.match(atoms)) return "atom";
|
||||
if (stream.match(identifiers)) return "variable";
|
||||
|
||||
// other
|
||||
if (stream.match(singleOperators)) return "operator";
|
||||
|
||||
// unrecognized
|
||||
stream.next();
|
||||
return null;
|
||||
};
|
||||
|
||||
CodeMirror.defineMode("webidl", function() {
|
||||
return {
|
||||
startState: function() {
|
||||
return {
|
||||
// Is in multiline comment
|
||||
inComment: false,
|
||||
// Last non-whitespace, matched token
|
||||
lastToken: "",
|
||||
// Next token is a definition
|
||||
startDef: false,
|
||||
// Last token of the statement is a definition
|
||||
endDef: false
|
||||
};
|
||||
},
|
||||
token: function(stream, state) {
|
||||
var style = readToken(stream, state);
|
||||
|
||||
if (style) {
|
||||
var cur = stream.current();
|
||||
state.lastToken = cur;
|
||||
if (style === "keyword") {
|
||||
state.startDef = startDefs.test(cur);
|
||||
state.endDef = state.endDef || endDefs.test(cur);
|
||||
} else {
|
||||
state.startDef = false;
|
||||
}
|
||||
}
|
||||
|
||||
return style;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("text/x-webidl", "webidl");
|
||||
});
|
6
public/vendor/codemirror/mode/xml/index.html
vendored
6
public/vendor/codemirror/mode/xml/index.html
vendored
|
@ -42,12 +42,16 @@
|
|||
lineNumbers: true
|
||||
});
|
||||
</script>
|
||||
<p>The XML mode supports two configuration parameters:</p>
|
||||
<p>The XML mode supports these configuration parameters:</p>
|
||||
<dl>
|
||||
<dt><code>htmlMode (boolean)</code></dt>
|
||||
<dd>This switches the mode to parse HTML instead of XML. This
|
||||
means attributes do not have to be quoted, and some elements
|
||||
(such as <code>br</code>) do not require a closing tag.</dd>
|
||||
<dt><code>matchClosing (boolean)</code></dt>
|
||||
<dd>Controls whether the mode checks that close tags match the
|
||||
corresponding opening tag, and highlights mismatches as errors.
|
||||
Defaults to true.</dd>
|
||||
<dt><code>alignCDATA (boolean)</code></dt>
|
||||
<dd>Setting this to true will force the opening tag of CDATA
|
||||
blocks to not be indented.</dd>
|
||||
|
|
2
public/vendor/codemirror/mode/xml/xml.js
vendored
2
public/vendor/codemirror/mode/xml/xml.js
vendored
|
@ -237,7 +237,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
|
|||
if (state.context && state.context.tagName != tagName &&
|
||||
config.implicitlyClosed.hasOwnProperty(state.context.tagName))
|
||||
popContext(state);
|
||||
if (state.context && state.context.tagName == tagName) {
|
||||
if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {
|
||||
setStyle = "tag";
|
||||
return closeState;
|
||||
} else {
|
||||
|
|
|
@ -17,7 +17,7 @@ CodeMirror.defineMode("xquery", function() {
|
|||
// function. Each keyword is a property of the keywords object whose
|
||||
// value is {type: atype, style: astyle}
|
||||
var keywords = function(){
|
||||
// conveinence functions used to build keywords object
|
||||
// convenience functions used to build keywords object
|
||||
function kw(type) {return {type: type, style: "keyword"};}
|
||||
var A = kw("keyword a")
|
||||
, B = kw("keyword b")
|
||||
|
|
87
public/vendor/codemirror/mode/yacas/index.html
vendored
Normal file
87
public/vendor/codemirror/mode/yacas/index.html
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: yacas mode</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel=stylesheet href="../../doc/docs.css">
|
||||
|
||||
<link rel=stylesheet href=../../lib/codemirror.css>
|
||||
<script src=../../lib/codemirror.js></script>
|
||||
<script src=../../addon/edit/matchbrackets.js></script>
|
||||
<script src=yacas.js></script>
|
||||
<style type=text/css>
|
||||
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
||||
</style>
|
||||
<div id=nav>
|
||||
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
|
||||
|
||||
<ul>
|
||||
<li><a href="../../index.html">Home</a>
|
||||
<li><a href="../../doc/manual.html">Manual</a>
|
||||
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="../index.html">Language modes</a>
|
||||
<li><a class=active href="#">yacas</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>yacas mode</h2>
|
||||
|
||||
|
||||
<textarea id="yacasCode">
|
||||
// example yacas code
|
||||
Graph(edges_IsList) <-- [
|
||||
Local(v, e, f, t);
|
||||
|
||||
vertices := {};
|
||||
|
||||
ForEach (e, edges) [
|
||||
If (IsList(e), e := Head(e));
|
||||
{f, t} := Tail(Listify(e));
|
||||
|
||||
DestructiveAppend(vertices, f);
|
||||
DestructiveAppend(vertices, t);
|
||||
];
|
||||
|
||||
Graph(RemoveDuplicates(vertices), edges);
|
||||
];
|
||||
|
||||
10 # IsGraph(Graph(vertices_IsList, edges_IsList)) <-- True;
|
||||
20 # IsGraph(_x) <-- False;
|
||||
|
||||
Edges(Graph(vertices_IsList, edges_IsList)) <-- edges;
|
||||
Vertices(Graph(vertices_IsList, edges_IsList)) <-- vertices;
|
||||
|
||||
AdjacencyList(g_IsGraph) <-- [
|
||||
Local(l, vertices, edges, e, op, f, t);
|
||||
|
||||
l := Association'Create();
|
||||
|
||||
vertices := Vertices(g);
|
||||
ForEach (v, vertices)
|
||||
Association'Set(l, v, {});
|
||||
|
||||
edges := Edges(g);
|
||||
|
||||
ForEach(e, edges) [
|
||||
If (IsList(e), e := Head(e));
|
||||
{op, f, t} := Listify(e);
|
||||
DestructiveAppend(Association'Get(l, f), t);
|
||||
If (String(op) = "<->", DestructiveAppend(Association'Get(l, t), f));
|
||||
];
|
||||
|
||||
l;
|
||||
];
|
||||
</textarea>
|
||||
|
||||
<script>
|
||||
var yacasEditor = CodeMirror.fromTextArea(document.getElementById('yacasCode'), {
|
||||
mode: 'text/x-yacas',
|
||||
lineNumbers: true,
|
||||
matchBrackets: true
|
||||
});
|
||||
</script>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>text/x-yacas</code> (yacas).</p>
|
||||
</article>
|
138
public/vendor/codemirror/mode/yacas/yacas.js
vendored
Normal file
138
public/vendor/codemirror/mode/yacas/yacas.js
vendored
Normal file
|
@ -0,0 +1,138 @@
|
|||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
// Yacas mode copyright (c) 2015 by Grzegorz Mazur
|
||||
// Loosely based on mathematica mode by Calin Barbat
|
||||
|
||||
(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.defineMode('yacas', function(_config, _parserConfig) {
|
||||
|
||||
// patterns
|
||||
var pFloatForm = "(?:(?:\\.\\d+|\\d+\\.\\d*|\\d+)(?:[eE][+-]?\\d+)?)";
|
||||
var pIdentifier = "(?:[a-zA-Z\\$'][a-zA-Z0-9\\$']*)";
|
||||
|
||||
// regular expressions
|
||||
var reFloatForm = new RegExp(pFloatForm);
|
||||
var reIdentifier = new RegExp(pIdentifier);
|
||||
var rePattern = new RegExp(pIdentifier + "?_" + pIdentifier);
|
||||
var reFunctionLike = new RegExp(pIdentifier + "\\s*\\(");
|
||||
|
||||
function tokenBase(stream, state) {
|
||||
var ch;
|
||||
|
||||
// get next character
|
||||
ch = stream.next();
|
||||
|
||||
// string
|
||||
if (ch === '"') {
|
||||
state.tokenize = tokenString;
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
|
||||
// comment
|
||||
if (ch === '/') {
|
||||
if (stream.eat('*')) {
|
||||
state.tokenize = tokenComment;
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
if (stream.eat("/")) {
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
}
|
||||
|
||||
// go back one character
|
||||
stream.backUp(1);
|
||||
|
||||
// look for ordered rules
|
||||
if (stream.match(/\d+ *#/, true, false)) {
|
||||
return 'qualifier';
|
||||
}
|
||||
|
||||
// look for numbers
|
||||
if (stream.match(reFloatForm, true, false)) {
|
||||
return 'number';
|
||||
}
|
||||
|
||||
// look for placeholders
|
||||
if (stream.match(rePattern, true, false)) {
|
||||
return 'variable-3';
|
||||
}
|
||||
|
||||
// match all braces separately
|
||||
if (stream.match(/(?:\[|\]|{|}|\(|\))/, true, false)) {
|
||||
return 'bracket';
|
||||
}
|
||||
|
||||
// literals looking like function calls
|
||||
if (stream.match(reFunctionLike, true, false)) {
|
||||
stream.backUp(1);
|
||||
return 'variable';
|
||||
}
|
||||
|
||||
// all other identifiers
|
||||
if (stream.match(reIdentifier, true, false)) {
|
||||
return 'variable-2';
|
||||
}
|
||||
|
||||
// operators; note that operators like @@ or /; are matched separately for each symbol.
|
||||
if (stream.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/, true, false)) {
|
||||
return 'operator';
|
||||
}
|
||||
|
||||
// everything else is an error
|
||||
return 'error';
|
||||
}
|
||||
|
||||
function tokenString(stream, state) {
|
||||
var next, end = false, escaped = false;
|
||||
while ((next = stream.next()) != null) {
|
||||
if (next === '"' && !escaped) {
|
||||
end = true;
|
||||
break;
|
||||
}
|
||||
escaped = !escaped && next === '\\';
|
||||
}
|
||||
if (end && !escaped) {
|
||||
state.tokenize = tokenBase;
|
||||
}
|
||||
return 'string';
|
||||
};
|
||||
|
||||
function tokenComment(stream, state) {
|
||||
var prev, next;
|
||||
while((next = stream.next()) != null) {
|
||||
if (prev === '*' && next === '/')
|
||||
break;
|
||||
prev = next;
|
||||
}
|
||||
state.tokenize = tokenBase;
|
||||
return 'comment';
|
||||
}
|
||||
|
||||
return {
|
||||
startState: function() {return {tokenize: tokenBase, commentLevel: 0};},
|
||||
token: function(stream, state) {
|
||||
if (stream.eatSpace()) return null;
|
||||
return state.tokenize(stream, state);
|
||||
},
|
||||
blockCommentStart: "/*",
|
||||
blockCommentEnd: "*/",
|
||||
lineComment: "//"
|
||||
};
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME('text/x-yacas', {
|
||||
name: 'yacas'
|
||||
});
|
||||
|
||||
});
|
|
@ -78,7 +78,7 @@ Underscores_are_allowed_between_words.
|
|||
GFM adds syntax to strikethrough text, which is missing from standard Markdown.
|
||||
|
||||
~~Mistaken text.~~
|
||||
~~**works with other fomatting**~~
|
||||
~~**works with other formatting**~~
|
||||
|
||||
~~spans across
|
||||
lines~~
|
||||
|
|
|
@ -65,4 +65,4 @@
|
|||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
|
|
8
public/vendor/codemirror/theme/icecoder.css
vendored
8
public/vendor/codemirror/theme/icecoder.css
vendored
|
@ -2,7 +2,7 @@
|
|||
ICEcoder default theme by Matt Pass, used in code editor available at https://icecoder.net
|
||||
*/
|
||||
|
||||
.cm-s-icecoder { color: #666; background: #141612; }
|
||||
.cm-s-icecoder { color: #666; background: #1d1d1b; }
|
||||
|
||||
.cm-s-icecoder span.cm-keyword { color: #eee; font-weight:bold; } /* off-white 1 */
|
||||
.cm-s-icecoder span.cm-atom { color: #e1c76e; } /* yellow */
|
||||
|
@ -37,7 +37,7 @@ ICEcoder default theme by Matt Pass, used in code editor available at https://ic
|
|||
|
||||
.cm-s-icecoder .CodeMirror-cursor { border-left: 1px solid white; }
|
||||
.cm-s-icecoder div.CodeMirror-selected { color: #fff; background: #037; }
|
||||
.cm-s-icecoder .CodeMirror-gutters { background: #141612; min-width: 41px; border-right: 0; }
|
||||
.cm-s-icecoder .CodeMirror-gutters { background: #1d1d1b; min-width: 41px; border-right: 0; }
|
||||
.cm-s-icecoder .CodeMirror-linenumber { color: #555; cursor: default; }
|
||||
.cm-s-icecoder .CodeMirror-matchingbracket { border: 1px solid grey; color: black !important; }
|
||||
.cm-s-icecoder .CodeMirror-activeline-background { background: #000; }
|
||||
.cm-s-icecoder .CodeMirror-matchingbracket { color: #fff !important; background: #555 !important; }
|
||||
.cm-s-icecoder .CodeMirror-activeline-background { background: #000; }
|
||||
|
|
2
public/vendor/codemirror/theme/mbo.css
vendored
2
public/vendor/codemirror/theme/mbo.css
vendored
|
@ -33,5 +33,5 @@
|
|||
.cm-s-mbo span.cm-qualifier { color: #ffffec; }
|
||||
|
||||
.cm-s-mbo .CodeMirror-activeline-background { background: #494b41; }
|
||||
.cm-s-mbo .CodeMirror-matchingbracket { color: #222 !important; }
|
||||
.cm-s-mbo .CodeMirror-matchingbracket { color: #ffb928 !important; }
|
||||
.cm-s-mbo .CodeMirror-matchingtag { background: rgba(255, 255, 255, .37); }
|
||||
|
|
3
public/vendor/codemirror/theme/night.css
vendored
3
public/vendor/codemirror/theme/night.css
vendored
|
@ -10,7 +10,7 @@
|
|||
.cm-s-night .CodeMirror-linenumber { color: #f8f8f8; }
|
||||
.cm-s-night .CodeMirror-cursor { border-left: 1px solid white; }
|
||||
|
||||
.cm-s-night span.cm-comment { color: #6900a1; }
|
||||
.cm-s-night span.cm-comment { color: #8900d1; }
|
||||
.cm-s-night span.cm-atom { color: #845dc4; }
|
||||
.cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; }
|
||||
.cm-s-night span.cm-keyword { color: #599eff; }
|
||||
|
@ -19,7 +19,6 @@
|
|||
.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-bracket { color: #8da6ce; }
|
||||
.cm-s-night span.cm-comment { color: #6900a1; }
|
||||
.cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; }
|
||||
.cm-s-night span.cm-link { color: #845dc4; }
|
||||
.cm-s-night span.cm-error { color: #9d1e15; }
|
||||
|
|
Loading…
Reference in a new issue