Updated codemirror to 5.4.0
This commit is contained in:
parent
1d843c8ac2
commit
01685c255f
69 changed files with 2988 additions and 558 deletions
|
@ -630,6 +630,7 @@ function connection(socket) {
|
|||
case 'drag':
|
||||
case '*compose':
|
||||
case 'case':
|
||||
case '+insert':
|
||||
case '+insertLine':
|
||||
case '+swapLine':
|
||||
case '+joinLines':
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
cm.operation(function() {
|
||||
for (var i = ranges.length - 1; i >= 0; i--)
|
||||
cm.replaceRange(inserts[i], ranges[i].from(), ranges[i].to(), "+input");
|
||||
cm.replaceRange(inserts[i], ranges[i].from(), ranges[i].to(), "+insert");
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
.CodeMirror-dialog {
|
||||
position: absolute;
|
||||
left: 0; right: 0;
|
||||
background: white;
|
||||
background: inherit;
|
||||
z-index: 15;
|
||||
padding: .1em .8em;
|
||||
overflow: hidden;
|
||||
color: #333;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.CodeMirror-dialog-top {
|
||||
|
@ -27,10 +27,6 @@
|
|||
font-family: monospace;
|
||||
}
|
||||
|
||||
.CodeMirror-dialog input::selection {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.CodeMirror-dialog button {
|
||||
font-size: 70%;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
for (var i = 0; i < val.length; i++) {
|
||||
var elt = document.createElement("div");
|
||||
elt.className = "CodeMirror-ruler";
|
||||
var col, cls = null, conf = val[i];
|
||||
var col, conf = val[i];
|
||||
if (typeof conf == "number") {
|
||||
col = conf;
|
||||
} else {
|
||||
|
@ -47,7 +47,6 @@
|
|||
if (conf.color) elt.style.borderColor = conf.color;
|
||||
if (conf.lineStyle) elt.style.borderLeftStyle = conf.lineStyle;
|
||||
if (conf.width) elt.style.borderLeftWidth = conf.width;
|
||||
cls = val[i].className;
|
||||
}
|
||||
elt.style.left = (left + col * cw) + "px";
|
||||
elt.style.top = "-50px";
|
||||
|
|
|
@ -147,6 +147,7 @@
|
|||
cm.replaceSelections(sels, "around", "+input");
|
||||
} else if (type == "both") {
|
||||
cm.replaceSelection(left + right, null, "+input");
|
||||
cm.triggerElectric(left + right);
|
||||
cm.execCommand("goCharLeft");
|
||||
} else if (type == "addFour") {
|
||||
cm.replaceSelection(left + left + left + left, "before", "+input");
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
|
||||
for (var i = ranges.length - 1; i >= 0; i--) {
|
||||
var info = replacements[i];
|
||||
cm.replaceRange(info.text, ranges[i].head, ranges[i].anchor, "+input");
|
||||
cm.replaceRange(info.text, ranges[i].head, ranges[i].anchor, "+insert");
|
||||
var sel = cm.listSelections().slice(0);
|
||||
sel[i] = {head: info.newPos, anchor: info.newPos};
|
||||
cm.setSelections(sel);
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
var listRE = /^(\s*)(>[> ]*|[*+-]\s|(\d+)\.)(\[\s\]\s|\[x\]\s|\s*)/,
|
||||
emptyListRE = /^(\s*)(>[> ]*|[*+-]\s|(\d+)\.)(\[\s\]\s*|\[x\]\s|\s*)$/,
|
||||
var listRE = /^(\s*)(>[> ]*|[*+-]\s|(\d+)([.)]))(\[\s\]\s|\[x\]\s|\s*)/,
|
||||
emptyListRE = /^(\s*)(>[> ]*|[*+-]\s|(\d+)[.)])(\[\s\]\s*|\[x\]\s|\s*)$/,
|
||||
unorderedListRE = /[*+-]\s/;
|
||||
|
||||
CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {
|
||||
|
@ -36,12 +36,11 @@
|
|||
line: pos.line, ch: pos.ch + 1
|
||||
}, "+delete");
|
||||
replacements[i] = "\n";
|
||||
|
||||
} else {
|
||||
var indent = match[1], after = match[4];
|
||||
var indent = match[1], after = match[5];
|
||||
var bullet = unorderedListRE.test(match[2]) || match[2].indexOf(">") >= 0
|
||||
? match[2]
|
||||
: (parseInt(match[3], 10) + 1) + ".";
|
||||
: (parseInt(match[3], 10) + 1) + match[4];
|
||||
|
||||
replacements[i] = "\n" + indent + bullet + after;
|
||||
}
|
||||
|
|
35
public/vendor/codemirror/addon/hint/show-hint.js
vendored
35
public/vendor/codemirror/addon/hint/show-hint.js
vendored
|
@ -33,7 +33,7 @@
|
|||
if (!completion.options.hint) return;
|
||||
|
||||
CodeMirror.signal(this, "startCompletion", this);
|
||||
completion.update();
|
||||
completion.update(true);
|
||||
});
|
||||
|
||||
function Completion(cm, options) {
|
||||
|
@ -61,6 +61,7 @@
|
|||
this.tick = null;
|
||||
this.cm.off("cursorActivity", this.activityFunc);
|
||||
|
||||
if (this.widget && this.data) CodeMirror.signal(this.data, "close");
|
||||
if (this.widget) this.widget.close();
|
||||
CodeMirror.signal(this.cm, "endCompletion", this.cm);
|
||||
},
|
||||
|
@ -78,15 +79,6 @@
|
|||
this.close();
|
||||
},
|
||||
|
||||
showHints: function(data) {
|
||||
if (!data || !data.list.length || !this.active()) return this.close();
|
||||
|
||||
if (this.options.completeSingle && data.list.length == 1)
|
||||
this.pick(data, 0);
|
||||
else
|
||||
this.showWidget(data);
|
||||
},
|
||||
|
||||
cursorActivity: function() {
|
||||
if (this.debounce) {
|
||||
cancelAnimationFrame(this.debounce);
|
||||
|
@ -105,33 +97,32 @@
|
|||
}
|
||||
},
|
||||
|
||||
update: function() {
|
||||
update: function(first) {
|
||||
if (this.tick == null) return;
|
||||
if (this.data) CodeMirror.signal(this.data, "update");
|
||||
if (!this.options.hint.async) {
|
||||
this.finishUpdate(this.options.hint(this.cm, this.options), myTick);
|
||||
this.finishUpdate(this.options.hint(this.cm, this.options), first);
|
||||
} else {
|
||||
var myTick = ++this.tick, self = this;
|
||||
this.options.hint(this.cm, function(data) {
|
||||
if (self.tick == myTick) self.finishUpdate(data);
|
||||
if (self.tick == myTick) self.finishUpdate(data, first);
|
||||
}, this.options);
|
||||
}
|
||||
},
|
||||
|
||||
finishUpdate: function(data) {
|
||||
finishUpdate: function(data, first) {
|
||||
this.data = data;
|
||||
var picked = this.widget && this.widget.picked;
|
||||
|
||||
var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle);
|
||||
if (this.widget) this.widget.close();
|
||||
if (data && data.list.length) {
|
||||
if (picked && data.list.length == 1) this.pick(data, 0);
|
||||
else this.widget = new Widget(this, data);
|
||||
}
|
||||
},
|
||||
|
||||
showWidget: function(data) {
|
||||
this.data = data;
|
||||
if (picked && data.list.length == 1) {
|
||||
this.pick(data, 0);
|
||||
} else {
|
||||
this.widget = new Widget(this, data);
|
||||
CodeMirror.signal(data, "shown");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
buildOptions: function(options) {
|
||||
|
|
15
public/vendor/codemirror/addon/hint/sql-hint.js
vendored
15
public/vendor/codemirror/addon/hint/sql-hint.js
vendored
|
@ -112,9 +112,14 @@
|
|||
string = nameParts.pop();
|
||||
var table = nameParts.join(".");
|
||||
|
||||
var alias = false;
|
||||
var aliasTable = table;
|
||||
// Check if table is available. If not, find table by Alias
|
||||
if (!getItem(tables, table))
|
||||
if (!getItem(tables, table)) {
|
||||
var oldTable = table;
|
||||
table = findTableByAlias(table, editor);
|
||||
if (table !== oldTable) alias = true;
|
||||
}
|
||||
|
||||
var columns = getItem(tables, table);
|
||||
if (columns && columns.columns)
|
||||
|
@ -122,11 +127,13 @@
|
|||
|
||||
if (columns) {
|
||||
addMatches(result, string, columns, function(w) {
|
||||
var tableInsert = table;
|
||||
if (alias == true) tableInsert = aliasTable;
|
||||
if (typeof w == "string") {
|
||||
w = table + "." + w;
|
||||
w = tableInsert + "." + w;
|
||||
} else {
|
||||
w = shallowClone(w);
|
||||
w.text = table + "." + w.text;
|
||||
w.text = tableInsert + "." + w.text;
|
||||
}
|
||||
return useBacktick ? insertBackticks(w) : w;
|
||||
});
|
||||
|
@ -205,6 +212,7 @@
|
|||
CodeMirror.registerHelper("hint", "sql", function(editor, options) {
|
||||
tables = (options && options.tables) || {};
|
||||
var defaultTableName = options && options.defaultTable;
|
||||
var disableKeywords = options && options.disableKeywords;
|
||||
defaultTable = defaultTableName && getItem(tables, defaultTableName);
|
||||
keywords = keywords || getKeywords(editor);
|
||||
|
||||
|
@ -237,6 +245,7 @@
|
|||
} else {
|
||||
addMatches(result, search, tables, function(w) {return w;});
|
||||
addMatches(result, search, defaultTable, function(w) {return w;});
|
||||
if (!disableKeywords)
|
||||
addMatches(result, search, keywords, function(w) {return w.toUpperCase();});
|
||||
}
|
||||
|
||||
|
|
12
public/vendor/codemirror/addon/lint/lint.js
vendored
12
public/vendor/codemirror/addon/lint/lint.js
vendored
|
@ -63,11 +63,9 @@
|
|||
this.onMouseOver = function(e) { onMouseOver(cm, e); };
|
||||
}
|
||||
|
||||
function parseOptions(cm, options) {
|
||||
function parseOptions(_cm, options) {
|
||||
if (options instanceof Function) return {getAnnotations: options};
|
||||
if (!options || options === true) options = {};
|
||||
if (!options.getAnnotations) options.getAnnotations = cm.getHelper(CodeMirror.Pos(0, 0), "lint");
|
||||
if (!options.getAnnotations) throw new Error("Required option 'getAnnotations' missing (lint addon)");
|
||||
return options;
|
||||
}
|
||||
|
||||
|
@ -120,10 +118,12 @@
|
|||
function startLinting(cm) {
|
||||
var state = cm.state.lint, options = state.options;
|
||||
var passOptions = options.options || options; // Support deprecated passing of `options` property in options
|
||||
if (options.async || options.getAnnotations.async)
|
||||
options.getAnnotations(cm.getValue(), updateLinting, passOptions, cm);
|
||||
var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint");
|
||||
if (!getAnnotations) return;
|
||||
if (options.async || getAnnotations.async)
|
||||
getAnnotations(cm.getValue(), updateLinting, passOptions, cm);
|
||||
else
|
||||
updateLinting(cm, options.getAnnotations(cm.getValue(), passOptions, cm));
|
||||
updateLinting(cm, getAnnotations(cm.getValue(), passOptions, cm));
|
||||
}
|
||||
|
||||
function updateLinting(cm, annotationsNotSorted) {
|
||||
|
|
|
@ -3,19 +3,37 @@
|
|||
|
||||
/* Just enough of CodeMirror to run runMode under node.js */
|
||||
|
||||
// declare global: StringStream
|
||||
function splitLines(string){return string.split(/\r\n?|\n/);};
|
||||
|
||||
function splitLines(string){ return string.split(/\r?\n|\r/); };
|
||||
// Counts the column offset in a string, taking tabs into account.
|
||||
// Used mostly to find indentation.
|
||||
var countColumn = function(string, end, tabSize, startIndex, startValue) {
|
||||
if (end == null) {
|
||||
end = string.search(/[^\s\u00a0]/);
|
||||
if (end == -1) end = string.length;
|
||||
}
|
||||
for (var i = startIndex || 0, n = startValue || 0;;) {
|
||||
var nextTab = string.indexOf("\t", i);
|
||||
if (nextTab < 0 || nextTab >= end)
|
||||
return n + (end - i);
|
||||
n += nextTab - i;
|
||||
n += tabSize - (n % tabSize);
|
||||
i = nextTab + 1;
|
||||
}
|
||||
};
|
||||
|
||||
function StringStream(string) {
|
||||
function StringStream(string, tabSize) {
|
||||
this.pos = this.start = 0;
|
||||
this.string = string;
|
||||
this.tabSize = tabSize || 8;
|
||||
this.lastColumnPos = this.lastColumnValue = 0;
|
||||
this.lineStart = 0;
|
||||
}
|
||||
};
|
||||
|
||||
StringStream.prototype = {
|
||||
eol: function() {return this.pos >= this.string.length;},
|
||||
sol: function() {return this.pos == 0;},
|
||||
peek: function() {return this.string.charAt(this.pos) || null;},
|
||||
sol: function() {return this.pos == this.lineStart;},
|
||||
peek: function() {return this.string.charAt(this.pos) || undefined;},
|
||||
next: function() {
|
||||
if (this.pos < this.string.length)
|
||||
return this.string.charAt(this.pos++);
|
||||
|
@ -42,8 +60,17 @@ StringStream.prototype = {
|
|||
if (found > -1) {this.pos = found; return true;}
|
||||
},
|
||||
backUp: function(n) {this.pos -= n;},
|
||||
column: function() {return this.start - this.lineStart;},
|
||||
indentation: function() {return 0;},
|
||||
column: function() {
|
||||
if (this.lastColumnPos < this.start) {
|
||||
this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
|
||||
this.lastColumnPos = this.start;
|
||||
}
|
||||
return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0);
|
||||
},
|
||||
indentation: function() {
|
||||
return countColumn(this.string, null, this.tabSize) -
|
||||
(this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0);
|
||||
},
|
||||
match: function(pattern, consume, caseInsensitive) {
|
||||
if (typeof pattern == "string") {
|
||||
var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;};
|
||||
|
@ -94,11 +121,42 @@ exports.resolveMode = function(spec) {
|
|||
if (typeof spec == "string") return {name: spec};
|
||||
else return spec || {name: "null"};
|
||||
};
|
||||
|
||||
function copyObj(obj, target, overwrite) {
|
||||
if (!target) target = {};
|
||||
for (var prop in obj)
|
||||
if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
|
||||
target[prop] = obj[prop];
|
||||
return target;
|
||||
}
|
||||
|
||||
// This can be used to attach properties to mode objects from
|
||||
// outside the actual mode definition.
|
||||
var modeExtensions = exports.modeExtensions = {};
|
||||
exports.extendMode = function(mode, properties) {
|
||||
var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
|
||||
copyObj(properties, exts);
|
||||
};
|
||||
|
||||
exports.getMode = function(options, spec) {
|
||||
spec = exports.resolveMode(spec);
|
||||
var spec = exports.resolveMode(spec);
|
||||
var mfactory = modes[spec.name];
|
||||
if (!mfactory) throw new Error("Unknown mode: " + spec);
|
||||
return mfactory(options, spec);
|
||||
if (!mfactory) return exports.getMode(options, "text/plain");
|
||||
var modeObj = mfactory(options, spec);
|
||||
if (modeExtensions.hasOwnProperty(spec.name)) {
|
||||
var exts = modeExtensions[spec.name];
|
||||
for (var prop in exts) {
|
||||
if (!exts.hasOwnProperty(prop)) continue;
|
||||
if (modeObj.hasOwnProperty(prop)) modeObj["_" + prop] = modeObj[prop];
|
||||
modeObj[prop] = exts[prop];
|
||||
}
|
||||
}
|
||||
modeObj.name = spec.name;
|
||||
if (spec.helperType) modeObj.helperType = spec.helperType;
|
||||
if (spec.modeProps) for (var prop in spec.modeProps)
|
||||
modeObj[prop] = spec.modeProps[prop];
|
||||
|
||||
return modeObj;
|
||||
};
|
||||
exports.registerHelper = exports.registerGlobalHelper = Math.min;
|
||||
|
||||
|
|
|
@ -177,9 +177,9 @@
|
|||
});
|
||||
|
||||
CodeMirror.defineExtension("selectMatches", function(query, caseFold) {
|
||||
var ranges = [], next;
|
||||
var ranges = [];
|
||||
var cur = this.getSearchCursor(query, this.getCursor("from"), caseFold);
|
||||
while (next = cur.findNext()) {
|
||||
while (cur.findNext()) {
|
||||
if (CodeMirror.cmpPos(cur.to(), this.getCursor("to")) > 0) break;
|
||||
ranges.push({anchor: cur.from(), head: cur.to()});
|
||||
}
|
||||
|
|
6
public/vendor/codemirror/addon/tern/tern.js
vendored
6
public/vendor/codemirror/addon/tern/tern.js
vendored
|
@ -59,6 +59,7 @@
|
|||
this.options = options || {};
|
||||
var plugins = this.options.plugins || (this.options.plugins = {});
|
||||
if (!plugins.doc_comment) plugins.doc_comment = true;
|
||||
this.docs = Object.create(null);
|
||||
if (this.options.useWorker) {
|
||||
this.server = new WorkerServer(this);
|
||||
} else {
|
||||
|
@ -69,7 +70,6 @@
|
|||
plugins: plugins
|
||||
});
|
||||
}
|
||||
this.docs = Object.create(null);
|
||||
this.trackChange = function(doc, change) { trackChange(self, doc, change); };
|
||||
|
||||
this.cachedArgHints = null;
|
||||
|
@ -124,6 +124,8 @@
|
|||
var self = this;
|
||||
var doc = findDoc(this, cm.getDoc());
|
||||
var request = buildRequest(this, doc, query, pos);
|
||||
var extraOptions = request.query && this.options.queryOptions && this.options.queryOptions[request.query.type]
|
||||
if (extraOptions) for (var prop in extraOptions) request.query[prop] = extraOptions[prop];
|
||||
|
||||
this.server.request(request, function (error, data) {
|
||||
if (!error && self.options.responseFilter)
|
||||
|
@ -442,7 +444,7 @@
|
|||
|
||||
function atInterestingExpression(cm) {
|
||||
var pos = cm.getCursor("end"), tok = cm.getTokenAt(pos);
|
||||
if (tok.start < pos.ch && (tok.type == "comment" || tok.type == "string")) return false;
|
||||
if (tok.start < pos.ch && tok.type == "comment") return false;
|
||||
return /[\w)\]]/.test(cm.getLine(pos.line).slice(Math.max(pos.ch - 1, 0), pos.ch + 1));
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,6 @@ function startServer(defs, plugins, scripts) {
|
|||
});
|
||||
}
|
||||
|
||||
var console = {
|
||||
this.console = {
|
||||
log: function(v) { postMessage({type: "debug", message: v}); }
|
||||
};
|
||||
|
|
22
public/vendor/codemirror/codemirror.min.js
vendored
22
public/vendor/codemirror/codemirror.min.js
vendored
File diff suppressed because one or more lines are too long
158
public/vendor/codemirror/keymap/vim.js
vendored
158
public/vendor/codemirror/keymap/vim.js
vendored
|
@ -3,42 +3,16 @@
|
|||
|
||||
/**
|
||||
* Supported keybindings:
|
||||
* Too many to list. Refer to defaultKeyMap below.
|
||||
*
|
||||
* Motion:
|
||||
* h, j, k, l
|
||||
* gj, gk
|
||||
* e, E, w, W, b, B, ge, gE
|
||||
* f<character>, F<character>, t<character>, T<character>
|
||||
* $, ^, 0, -, +, _
|
||||
* gg, G
|
||||
* %
|
||||
* '<character>, `<character>
|
||||
*
|
||||
* Operator:
|
||||
* d, y, c
|
||||
* dd, yy, cc
|
||||
* g~, g~g~
|
||||
* >, <, >>, <<
|
||||
*
|
||||
* Operator-Motion:
|
||||
* x, X, D, Y, C, ~
|
||||
*
|
||||
* Action:
|
||||
* a, i, s, A, I, S, o, O
|
||||
* zz, z., z<CR>, zt, zb, z-
|
||||
* J
|
||||
* u, Ctrl-r
|
||||
* m<character>
|
||||
* r<character>
|
||||
*
|
||||
* Modes:
|
||||
* ESC - leave insert mode, visual mode, and clear input state.
|
||||
* Ctrl-[, Ctrl-c - same as ESC.
|
||||
* Supported Ex commands:
|
||||
* Refer to defaultExCommandMap below.
|
||||
*
|
||||
* Registers: unnamed, -, a-z, A-Z, 0-9
|
||||
* (Does not respect the special case for number registers when delete
|
||||
* operator is made with these commands: %, (, ), , /, ?, n, N, {, } )
|
||||
* TODO: Implement the remaining registers.
|
||||
*
|
||||
* Marks: a-z, A-Z, and 0-9
|
||||
* TODO: Implement the remaining special marks. They have more complex
|
||||
* behavior.
|
||||
|
@ -57,6 +31,7 @@
|
|||
* 6. Motion, operator, and action implementations
|
||||
* 7. Helper functions for the key handler, motions, operators, and actions
|
||||
* 8. Set up Vim to work as a keymap for CodeMirror.
|
||||
* 9. Ex command implementations.
|
||||
*/
|
||||
|
||||
(function(mod) {
|
||||
|
@ -227,6 +202,34 @@
|
|||
{ keys: ':', type: 'ex' }
|
||||
];
|
||||
|
||||
/**
|
||||
* Ex commands
|
||||
* Care must be taken when adding to the default Ex command map. For any
|
||||
* pair of commands that have a shared prefix, at least one of their
|
||||
* shortNames must not match the prefix of the other command.
|
||||
*/
|
||||
var defaultExCommandMap = [
|
||||
{ name: 'colorscheme', shortName: 'colo' },
|
||||
{ name: 'map' },
|
||||
{ name: 'imap', shortName: 'im' },
|
||||
{ name: 'nmap', shortName: 'nm' },
|
||||
{ name: 'vmap', shortName: 'vm' },
|
||||
{ name: 'unmap' },
|
||||
{ name: 'write', shortName: 'w' },
|
||||
{ name: 'undo', shortName: 'u' },
|
||||
{ name: 'redo', shortName: 'red' },
|
||||
{ name: 'set', shortName: 'se' },
|
||||
{ name: 'set', shortName: 'se' },
|
||||
{ name: 'setlocal', shortName: 'setl' },
|
||||
{ name: 'setglobal', shortName: 'setg' },
|
||||
{ name: 'sort', shortName: 'sor' },
|
||||
{ name: 'substitute', shortName: 's', possiblyAsync: true },
|
||||
{ name: 'nohlsearch', shortName: 'noh' },
|
||||
{ name: 'delmarks', shortName: 'delm' },
|
||||
{ name: 'registers', shortName: 'reg', excludeFromCommandHistory: true },
|
||||
{ name: 'global', shortName: 'g' }
|
||||
];
|
||||
|
||||
var Pos = CodeMirror.Pos;
|
||||
|
||||
var Vim = function() {
|
||||
|
@ -463,7 +466,7 @@
|
|||
}
|
||||
// The 'filetype' option proxies to the CodeMirror 'mode' option.
|
||||
if (name === undefined) {
|
||||
var mode = cm.getMode().name;
|
||||
var mode = cm.getOption('mode');
|
||||
return mode == 'null' ? '' : mode;
|
||||
} else {
|
||||
var mode = name == '' ? 'null' : name;
|
||||
|
@ -689,7 +692,9 @@
|
|||
getOption: getOption,
|
||||
defineOption: defineOption,
|
||||
defineEx: function(name, prefix, func){
|
||||
if (name.indexOf(prefix) !== 0) {
|
||||
if (!prefix) {
|
||||
prefix = name;
|
||||
} else if (name.indexOf(prefix) !== 0) {
|
||||
throw new Error('(Vim.defineEx) "'+prefix+'" is not a prefix of "'+name+'", command not registered');
|
||||
}
|
||||
exCommands[name]=func;
|
||||
|
@ -846,6 +851,8 @@
|
|||
mapCommand: mapCommand,
|
||||
_mapCommand: _mapCommand,
|
||||
|
||||
defineRegister: defineRegister,
|
||||
|
||||
exitVisualMode: exitVisualMode,
|
||||
exitInsertMode: exitInsertMode
|
||||
};
|
||||
|
@ -935,6 +942,25 @@
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Defines an external register.
|
||||
*
|
||||
* The name should be a single character that will be used to reference the register.
|
||||
* The register should support setText, pushText, clear, and toString(). See Register
|
||||
* for a reference implementation.
|
||||
*/
|
||||
function defineRegister(name, register) {
|
||||
var registers = vimGlobalState.registerController.registers[name];
|
||||
if (!name || name.length != 1) {
|
||||
throw Error('Register name must be 1 character');
|
||||
}
|
||||
if (registers[name]) {
|
||||
throw Error('Register already defined ' + name);
|
||||
}
|
||||
registers[name] = register;
|
||||
validRegisters.push(name);
|
||||
}
|
||||
|
||||
/*
|
||||
* vim registers allow you to keep many independent copy and paste buffers.
|
||||
* See http://usevim.com/2012/04/13/registers/ for an introduction.
|
||||
|
@ -3635,13 +3661,17 @@
|
|||
// Translates the replace part of a search and replace from ex (vim) syntax into
|
||||
// javascript form. Similar to translateRegex, but additionally fixes back references
|
||||
// (translates '\[0..9]' to '$[0..9]') and follows different rules for escaping '$'.
|
||||
var charUnescapes = {'\\n': '\n', '\\r': '\r', '\\t': '\t'};
|
||||
function translateRegexReplace(str) {
|
||||
var escapeNextChar = false;
|
||||
var out = [];
|
||||
for (var i = -1; i < str.length; i++) {
|
||||
var c = str.charAt(i) || '';
|
||||
var n = str.charAt(i+1) || '';
|
||||
if (escapeNextChar) {
|
||||
if (charUnescapes[c + n]) {
|
||||
out.push(charUnescapes[c+n]);
|
||||
i++;
|
||||
} else if (escapeNextChar) {
|
||||
// At any point in the loop, escapeNextChar is true if the previous
|
||||
// character was a '\' and was not escaped.
|
||||
out.push(c);
|
||||
|
@ -3669,6 +3699,7 @@
|
|||
}
|
||||
|
||||
// Unescape \ and / in the replace part, for PCRE mode.
|
||||
var unescapes = {'\\/': '/', '\\\\': '\\', '\\n': '\n', '\\r': '\r', '\\t': '\t'};
|
||||
function unescapeRegexReplace(str) {
|
||||
var stream = new CodeMirror.StringStream(str);
|
||||
var output = [];
|
||||
|
@ -3677,13 +3708,15 @@
|
|||
while (stream.peek() && stream.peek() != '\\') {
|
||||
output.push(stream.next());
|
||||
}
|
||||
if (stream.match('\\/', true)) {
|
||||
// \/ => /
|
||||
output.push('/');
|
||||
} else if (stream.match('\\\\', true)) {
|
||||
// \\ => \
|
||||
output.push('\\');
|
||||
} else {
|
||||
var matched = false;
|
||||
for (var matcher in unescapes) {
|
||||
if (stream.match(matcher, true)) {
|
||||
matched = true;
|
||||
output.push(unescapes[matcher]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!matched) {
|
||||
// Don't change anything
|
||||
output.push(stream.next());
|
||||
}
|
||||
|
@ -3913,31 +3946,6 @@
|
|||
return {top: from.line, bottom: to.line};
|
||||
}
|
||||
|
||||
// Ex command handling
|
||||
// Care must be taken when adding to the default Ex command map. For any
|
||||
// pair of commands that have a shared prefix, at least one of their
|
||||
// shortNames must not match the prefix of the other command.
|
||||
var defaultExCommandMap = [
|
||||
{ name: 'colorscheme', shortName: 'colo' },
|
||||
{ name: 'map' },
|
||||
{ name: 'imap', shortName: 'im' },
|
||||
{ name: 'nmap', shortName: 'nm' },
|
||||
{ name: 'vmap', shortName: 'vm' },
|
||||
{ name: 'unmap' },
|
||||
{ name: 'write', shortName: 'w' },
|
||||
{ name: 'undo', shortName: 'u' },
|
||||
{ name: 'redo', shortName: 'red' },
|
||||
{ name: 'set', shortName: 'se' },
|
||||
{ name: 'set', shortName: 'se' },
|
||||
{ name: 'setlocal', shortName: 'setl' },
|
||||
{ name: 'setglobal', shortName: 'setg' },
|
||||
{ name: 'sort', shortName: 'sor' },
|
||||
{ name: 'substitute', shortName: 's', possiblyAsync: true },
|
||||
{ name: 'nohlsearch', shortName: 'noh' },
|
||||
{ name: 'delmarks', shortName: 'delm' },
|
||||
{ name: 'registers', shortName: 'reg', excludeFromCommandHistory: true },
|
||||
{ name: 'global', shortName: 'g' }
|
||||
];
|
||||
var ExCommandDispatcher = function() {
|
||||
this.buildCommandMap_();
|
||||
};
|
||||
|
@ -4483,6 +4491,9 @@
|
|||
var query = state.getQuery();
|
||||
var lineStart = (params.line !== undefined) ? params.line : cm.getCursor().line;
|
||||
var lineEnd = params.lineEnd || lineStart;
|
||||
if (lineStart == cm.firstLine() && lineEnd == cm.lastLine()) {
|
||||
lineEnd = Infinity;
|
||||
}
|
||||
if (count) {
|
||||
lineStart = lineEnd;
|
||||
lineEnd = lineStart + count - 1;
|
||||
|
@ -4601,10 +4612,9 @@
|
|||
searchCursor.replace(newText);
|
||||
}
|
||||
function next() {
|
||||
var found;
|
||||
// The below only loops to skip over multiple occurrences on the same
|
||||
// line when 'global' is not true.
|
||||
while(found = searchCursor.findNext() &&
|
||||
while(searchCursor.findNext() &&
|
||||
isInRange(searchCursor.from(), lineStart, lineEnd)) {
|
||||
if (!global && lastPos && searchCursor.from().line == lastPos.line) {
|
||||
continue;
|
||||
|
@ -4737,7 +4747,7 @@
|
|||
}
|
||||
|
||||
function _mapCommand(command) {
|
||||
defaultKeymap.push(command);
|
||||
defaultKeymap.unshift(command);
|
||||
}
|
||||
|
||||
function mapCommand(keys, type, name, args, extra) {
|
||||
|
@ -4779,6 +4789,14 @@
|
|||
|
||||
function executeMacroRegister(cm, vim, macroModeState, registerName) {
|
||||
var register = vimGlobalState.registerController.getRegister(registerName);
|
||||
if (registerName == ':') {
|
||||
// Read-only register containing last Ex command.
|
||||
if (register.keyBuffer[0]) {
|
||||
exCommandDispatcher.processCommand(cm, register.keyBuffer[0]);
|
||||
}
|
||||
macroModeState.isPlaying = false;
|
||||
return;
|
||||
}
|
||||
var keyBuffer = register.keyBuffer;
|
||||
var imc = 0;
|
||||
macroModeState.isPlaying = true;
|
||||
|
@ -4818,7 +4836,7 @@
|
|||
if (macroModeState.isPlaying) { return; }
|
||||
var registerName = macroModeState.latestRegister;
|
||||
var register = vimGlobalState.registerController.getRegister(registerName);
|
||||
if (register) {
|
||||
if (register && register.pushInsertModeChanges) {
|
||||
register.pushInsertModeChanges(macroModeState.lastInsertModeChanges);
|
||||
}
|
||||
}
|
||||
|
@ -4827,7 +4845,7 @@
|
|||
if (macroModeState.isPlaying) { return; }
|
||||
var registerName = macroModeState.latestRegister;
|
||||
var register = vimGlobalState.registerController.getRegister(registerName);
|
||||
if (register) {
|
||||
if (register && register.pushSearchQuery) {
|
||||
register.pushSearchQuery(query);
|
||||
}
|
||||
}
|
||||
|
|
18
public/vendor/codemirror/lib/codemirror.css
vendored
18
public/vendor/codemirror/lib/codemirror.css
vendored
|
@ -92,6 +92,15 @@ div.CodeMirror-overwrite div.CodeMirror-cursor {}
|
|||
|
||||
/* DEFAULT THEME */
|
||||
|
||||
.cm-s-default .cm-header {color: blue;}
|
||||
.cm-s-default .cm-quote {color: #090;}
|
||||
.cm-negative {color: #d44;}
|
||||
.cm-positive {color: #292;}
|
||||
.cm-header, .cm-strong {font-weight: bold;}
|
||||
.cm-em {font-style: italic;}
|
||||
.cm-link {text-decoration: underline;}
|
||||
.cm-strikethrough {text-decoration: line-through;}
|
||||
|
||||
.cm-s-default .cm-keyword {color: #708;}
|
||||
.cm-s-default .cm-atom {color: #219;}
|
||||
.cm-s-default .cm-number {color: #164;}
|
||||
|
@ -111,18 +120,9 @@ div.CodeMirror-overwrite div.CodeMirror-cursor {}
|
|||
.cm-s-default .cm-bracket {color: #997;}
|
||||
.cm-s-default .cm-tag {color: #170;}
|
||||
.cm-s-default .cm-attribute {color: #00c;}
|
||||
.cm-s-default .cm-header {color: blue;}
|
||||
.cm-s-default .cm-quote {color: #090;}
|
||||
.cm-s-default .cm-hr {color: #999;}
|
||||
.cm-s-default .cm-link {color: #00c;}
|
||||
|
||||
.cm-negative {color: #d44;}
|
||||
.cm-positive {color: #292;}
|
||||
.cm-header, .cm-strong {font-weight: bold;}
|
||||
.cm-em {font-style: italic;}
|
||||
.cm-link {text-decoration: underline;}
|
||||
.cm-strikethrough {text-decoration: line-through;}
|
||||
|
||||
.cm-s-default .cm-error {color: #f00;}
|
||||
.cm-invalidchar {color: #f00;}
|
||||
|
||||
|
|
119
public/vendor/codemirror/lib/codemirror.js
vendored
119
public/vendor/codemirror/lib/codemirror.js
vendored
|
@ -728,12 +728,9 @@
|
|||
}
|
||||
|
||||
function postUpdateDisplay(cm, update) {
|
||||
var force = update.force, viewport = update.viewport;
|
||||
var viewport = update.viewport;
|
||||
for (var first = true;; first = false) {
|
||||
if (first && cm.options.lineWrapping && update.oldDisplayWidth != displayWidth(cm)) {
|
||||
force = true;
|
||||
} else {
|
||||
force = false;
|
||||
if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
|
||||
// Clip forced viewport to actual scrollable area.
|
||||
if (viewport && viewport.top != null)
|
||||
viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)};
|
||||
|
@ -1084,9 +1081,10 @@
|
|||
cm.display.shift = false;
|
||||
if (!sel) sel = doc.sel;
|
||||
|
||||
var paste = cm.state.pasteIncoming || origin == "paste";
|
||||
var textLines = splitLines(inserted), multiPaste = null;
|
||||
// When pasing N lines into N selections, insert one line per selection
|
||||
if (cm.state.pasteIncoming && sel.ranges.length > 1) {
|
||||
if (paste && sel.ranges.length > 1) {
|
||||
if (lastCopied && lastCopied.join("\n") == inserted)
|
||||
multiPaste = sel.ranges.length % lastCopied.length == 0 && map(lastCopied, splitLines);
|
||||
else if (textLines.length == sel.ranges.length)
|
||||
|
@ -1100,40 +1098,57 @@
|
|||
if (range.empty()) {
|
||||
if (deleted && deleted > 0) // Handle deletion
|
||||
from = Pos(from.line, from.ch - deleted);
|
||||
else if (cm.state.overwrite && !cm.state.pasteIncoming) // Handle overwrite
|
||||
else if (cm.state.overwrite && !paste) // Handle overwrite
|
||||
to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length));
|
||||
}
|
||||
var updateInput = cm.curOp.updateInput;
|
||||
var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i % multiPaste.length] : textLines,
|
||||
origin: origin || (cm.state.pasteIncoming ? "paste" : cm.state.cutIncoming ? "cut" : "+input")};
|
||||
origin: origin || (paste ? "paste" : cm.state.cutIncoming ? "cut" : "+input")};
|
||||
makeChange(cm.doc, changeEvent);
|
||||
signalLater(cm, "inputRead", cm, changeEvent);
|
||||
// When an 'electric' character is inserted, immediately trigger a reindent
|
||||
if (inserted && !cm.state.pasteIncoming && cm.options.electricChars &&
|
||||
cm.options.smartIndent && range.head.ch < 100 &&
|
||||
(!i || sel.ranges[i - 1].head.line != range.head.line)) {
|
||||
var mode = cm.getModeAt(range.head);
|
||||
var end = changeEnd(changeEvent);
|
||||
var indented = false;
|
||||
if (mode.electricChars) {
|
||||
for (var j = 0; j < mode.electricChars.length; j++)
|
||||
if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
|
||||
indented = indentLine(cm, end.line, "smart");
|
||||
break;
|
||||
}
|
||||
} else if (mode.electricInput) {
|
||||
if (mode.electricInput.test(getLine(doc, end.line).text.slice(0, end.ch)))
|
||||
indented = indentLine(cm, end.line, "smart");
|
||||
}
|
||||
if (indented) signalLater(cm, "electricInput", cm, end.line);
|
||||
}
|
||||
}
|
||||
if (inserted && !paste)
|
||||
triggerElectric(cm, inserted);
|
||||
|
||||
ensureCursorVisible(cm);
|
||||
cm.curOp.updateInput = updateInput;
|
||||
cm.curOp.typing = true;
|
||||
cm.state.pasteIncoming = cm.state.cutIncoming = false;
|
||||
}
|
||||
|
||||
function handlePaste(e, cm) {
|
||||
var pasted = e.clipboardData && e.clipboardData.getData("text/plain");
|
||||
if (pasted) {
|
||||
e.preventDefault();
|
||||
runInOp(cm, function() { applyTextInput(cm, pasted, 0, null, "paste"); });
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function triggerElectric(cm, inserted) {
|
||||
// When an 'electric' character is inserted, immediately trigger a reindent
|
||||
if (!cm.options.electricChars || !cm.options.smartIndent) return;
|
||||
var sel = cm.doc.sel;
|
||||
|
||||
for (var i = sel.ranges.length - 1; i >= 0; i--) {
|
||||
var range = sel.ranges[i];
|
||||
if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) continue;
|
||||
var mode = cm.getModeAt(range.head);
|
||||
var indented = false;
|
||||
if (mode.electricChars) {
|
||||
for (var j = 0; j < mode.electricChars.length; j++)
|
||||
if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
|
||||
indented = indentLine(cm, range.head.line, "smart");
|
||||
break;
|
||||
}
|
||||
} else if (mode.electricInput) {
|
||||
if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch)))
|
||||
indented = indentLine(cm, range.head.line, "smart");
|
||||
}
|
||||
if (indented) signalLater(cm, "electricInput", cm, range.head.line);
|
||||
}
|
||||
}
|
||||
|
||||
function copyableRanges(cm) {
|
||||
var text = [], ranges = [];
|
||||
for (var i = 0; i < cm.doc.sel.ranges.length; i++) {
|
||||
|
@ -1206,21 +1221,9 @@
|
|||
input.poll();
|
||||
});
|
||||
|
||||
on(te, "paste", function() {
|
||||
// Workaround for webkit bug https://bugs.webkit.org/show_bug.cgi?id=90206
|
||||
// Add a char to the end of textarea before paste occur so that
|
||||
// selection doesn't span to the end of textarea.
|
||||
if (webkit && !cm.state.fakedLastChar && !(new Date - cm.state.lastMiddleDown < 200)) {
|
||||
var start = te.selectionStart, end = te.selectionEnd;
|
||||
te.value += "$";
|
||||
// The selection end needs to be set before the start, otherwise there
|
||||
// can be an intermediate non-empty selection between the two, which
|
||||
// can override the middle-click paste buffer on linux and cause the
|
||||
// wrong thing to get pasted.
|
||||
te.selectionEnd = end;
|
||||
te.selectionStart = start;
|
||||
cm.state.fakedLastChar = true;
|
||||
}
|
||||
on(te, "paste", function(e) {
|
||||
if (handlePaste(e, cm)) return true;
|
||||
|
||||
cm.state.pasteIncoming = true;
|
||||
input.fastPoll();
|
||||
});
|
||||
|
@ -1386,14 +1389,11 @@
|
|||
// possible when it is clear that nothing happened. hasSelection
|
||||
// will be the case when there is a lot of text in the textarea,
|
||||
// in which case reading its value would be expensive.
|
||||
if (!cm.state.focused || (hasSelection(input) && !prevInput) ||
|
||||
if (this.contextMenuPending || !cm.state.focused ||
|
||||
(hasSelection(input) && !prevInput) ||
|
||||
isReadOnly(cm) || cm.options.disableInput || cm.state.keySeq)
|
||||
return false;
|
||||
// See paste handler for more on the fakedLastChar kludge
|
||||
if (cm.state.pasteIncoming && cm.state.fakedLastChar) {
|
||||
input.value = input.value.substring(0, input.value.length - 1);
|
||||
cm.state.fakedLastChar = false;
|
||||
}
|
||||
|
||||
var text = input.value;
|
||||
// If nothing changed, bail.
|
||||
if (text == prevInput && !cm.somethingSelected()) return false;
|
||||
|
@ -1539,13 +1539,7 @@
|
|||
div.contentEditable = "true";
|
||||
disableBrowserMagic(div);
|
||||
|
||||
on(div, "paste", function(e) {
|
||||
var pasted = e.clipboardData && e.clipboardData.getData("text/plain");
|
||||
if (pasted) {
|
||||
e.preventDefault();
|
||||
cm.replaceSelection(pasted, null, "paste");
|
||||
}
|
||||
});
|
||||
on(div, "paste", function(e) { handlePaste(e, cm); })
|
||||
|
||||
on(div, "compositionstart", function(e) {
|
||||
var data = e.data;
|
||||
|
@ -1758,7 +1752,7 @@
|
|||
var toIndex = findViewIndex(cm, to.line);
|
||||
if (toIndex == display.view.length - 1) {
|
||||
var toLine = display.viewTo - 1;
|
||||
var toNode = display.view[toIndex].node;
|
||||
var toNode = display.lineDiv.lastChild;
|
||||
} else {
|
||||
var toLine = lineNo(display.view[toIndex + 1].line) - 1;
|
||||
var toNode = display.view[toIndex + 1].node.previousSibling;
|
||||
|
@ -1838,7 +1832,7 @@
|
|||
var partPos = getBidiPartAt(order, pos.ch);
|
||||
side = partPos % 2 ? "right" : "left";
|
||||
}
|
||||
var result = nodeAndOffsetInLineMap(info.map, pos.ch, "left");
|
||||
var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);
|
||||
result.offset = result.collapse == "right" ? result.end : result.start;
|
||||
return result;
|
||||
}
|
||||
|
@ -3574,7 +3568,8 @@
|
|||
var sel = cm.doc.sel, modifier = mac ? e.metaKey : e.ctrlKey, contained;
|
||||
if (cm.options.dragDrop && dragAndDrop && !isReadOnly(cm) &&
|
||||
type == "single" && (contained = sel.contains(start)) > -1 &&
|
||||
!sel.ranges[contained].empty())
|
||||
(cmp((contained = sel.ranges[contained]).from(), start) < 0 || start.xRel > 0) &&
|
||||
(cmp(contained.to(), start) > 0 || start.xRel < 0))
|
||||
leftButtonStartDrag(cm, e, start, modifier);
|
||||
else
|
||||
leftButtonSelect(cm, e, start, type, modifier);
|
||||
|
@ -5065,6 +5060,8 @@
|
|||
return commands[cmd](this);
|
||||
},
|
||||
|
||||
triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),
|
||||
|
||||
findPosH: function(from, amount, unit, visually) {
|
||||
var dir = 1;
|
||||
if (amount < 0) { dir = -1; amount = -amount; }
|
||||
|
@ -5732,7 +5729,7 @@
|
|||
for (var i = 0; i < keys.length; i++) {
|
||||
var val, name;
|
||||
if (i == keys.length - 1) {
|
||||
name = keyname;
|
||||
name = keys.join(" ");
|
||||
val = value;
|
||||
} else {
|
||||
name = keys.slice(0, i + 1).join(" ");
|
||||
|
@ -7592,7 +7589,7 @@
|
|||
Doc.prototype.eachLine = Doc.prototype.iter;
|
||||
|
||||
// Set up methods on CodeMirror's prototype to redirect to the editor's document.
|
||||
var dontDelegate = "iter insert remove copy getEditor".split(" ");
|
||||
var dontDelegate = "iter insert remove copy getEditor constructor".split(" ");
|
||||
for (var prop in Doc.prototype) if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
|
||||
CodeMirror.prototype[prop] = (function(method) {
|
||||
return function() {return method.apply(this.doc, arguments);};
|
||||
|
@ -8745,7 +8742,7 @@
|
|||
|
||||
// THE END
|
||||
|
||||
CodeMirror.version = "5.2.0";
|
||||
CodeMirror.version = "5.4.0";
|
||||
|
||||
return CodeMirror;
|
||||
});
|
||||
|
|
3
public/vendor/codemirror/mode/apl/apl.js
vendored
3
public/vendor/codemirror/mode/apl/apl.js
vendored
|
@ -102,7 +102,7 @@ CodeMirror.defineMode("apl", function() {
|
|||
};
|
||||
},
|
||||
token: function(stream, state) {
|
||||
var ch, funcName, word;
|
||||
var ch, funcName;
|
||||
if (stream.eatSpace()) {
|
||||
return null;
|
||||
}
|
||||
|
@ -163,7 +163,6 @@ CodeMirror.defineMode("apl", function() {
|
|||
return "function jot-dot";
|
||||
}
|
||||
stream.eatWhile(/[\w\$_]/);
|
||||
word = stream.current();
|
||||
state.prev = true;
|
||||
return "keyword";
|
||||
}
|
||||
|
|
204
public/vendor/codemirror/mode/asn.1/asn.1.js
vendored
Executable file
204
public/vendor/codemirror/mode/asn.1/asn.1.js
vendored
Executable file
|
@ -0,0 +1,204 @@
|
|||
// 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("asn.1", function(config, parserConfig) {
|
||||
var indentUnit = config.indentUnit,
|
||||
keywords = parserConfig.keywords || {},
|
||||
cmipVerbs = parserConfig.cmipVerbs || {},
|
||||
compareTypes = parserConfig.compareTypes || {},
|
||||
status = parserConfig.status || {},
|
||||
tags = parserConfig.tags || {},
|
||||
storage = parserConfig.storage || {},
|
||||
modifier = parserConfig.modifier || {},
|
||||
accessTypes = parserConfig.accessTypes|| {},
|
||||
multiLineStrings = parserConfig.multiLineStrings,
|
||||
indentStatements = parserConfig.indentStatements !== false;
|
||||
var isOperatorChar = /[\|\^]/;
|
||||
var curPunc;
|
||||
|
||||
function tokenBase(stream, state) {
|
||||
var ch = stream.next();
|
||||
if (ch == '"' || ch == "'") {
|
||||
state.tokenize = tokenString(ch);
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
if (/[\[\]\(\){}:=,;]/.test(ch)) {
|
||||
curPunc = ch;
|
||||
return "punctuation";
|
||||
}
|
||||
if (ch == "-"){
|
||||
if (stream.eat("-")) {
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
}
|
||||
if (/\d/.test(ch)) {
|
||||
stream.eatWhile(/[\w\.]/);
|
||||
return "number";
|
||||
}
|
||||
if (isOperatorChar.test(ch)) {
|
||||
stream.eatWhile(isOperatorChar);
|
||||
return "operator";
|
||||
}
|
||||
|
||||
stream.eatWhile(/[\w\-]/);
|
||||
var cur = stream.current();
|
||||
if (keywords.propertyIsEnumerable(cur)) return "keyword";
|
||||
if (cmipVerbs.propertyIsEnumerable(cur)) return "variable cmipVerbs";
|
||||
if (compareTypes.propertyIsEnumerable(cur)) return "atom compareTypes";
|
||||
if (status.propertyIsEnumerable(cur)) return "comment status";
|
||||
if (tags.propertyIsEnumerable(cur)) return "variable-3 tags";
|
||||
if (storage.propertyIsEnumerable(cur)) return "builtin storage";
|
||||
if (modifier.propertyIsEnumerable(cur)) return "string-2 modifier";
|
||||
if (accessTypes.propertyIsEnumerable(cur)) return "atom accessTypes";
|
||||
|
||||
return "variable";
|
||||
}
|
||||
|
||||
function tokenString(quote) {
|
||||
return function(stream, state) {
|
||||
var escaped = false, next, end = false;
|
||||
while ((next = stream.next()) != null) {
|
||||
if (next == quote && !escaped){
|
||||
var afterNext = stream.peek();
|
||||
//look if the character if the quote is like the B in '10100010'B
|
||||
if (afterNext){
|
||||
afterNext = afterNext.toLowerCase();
|
||||
if(afterNext == "b" || afterNext == "h" || afterNext == "o")
|
||||
stream.next();
|
||||
}
|
||||
end = true; break;
|
||||
}
|
||||
escaped = !escaped && next == "\\";
|
||||
}
|
||||
if (end || !(escaped || multiLineStrings))
|
||||
state.tokenize = null;
|
||||
return "string";
|
||||
};
|
||||
}
|
||||
|
||||
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) {
|
||||
var indent = state.indented;
|
||||
if (state.context && state.context.type == "statement")
|
||||
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;
|
||||
}
|
||||
|
||||
//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;
|
||||
curPunc = null;
|
||||
var style = (state.tokenize || tokenBase)(stream, state);
|
||||
if (style == "comment") return style;
|
||||
if (ctx.align == null) ctx.align = true;
|
||||
|
||||
if ((curPunc == ";" || curPunc == ":" || curPunc == ",")
|
||||
&& ctx.type == "statement"){
|
||||
popContext(state);
|
||||
}
|
||||
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
||||
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
||||
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
||||
else if (curPunc == "}") {
|
||||
while (ctx.type == "statement") ctx = popContext(state);
|
||||
if (ctx.type == "}") ctx = popContext(state);
|
||||
while (ctx.type == "statement") ctx = popContext(state);
|
||||
}
|
||||
else if (curPunc == ctx.type) popContext(state);
|
||||
else if (indentStatements && (((ctx.type == "}" || ctx.type == "top")
|
||||
&& curPunc != ';') || (ctx.type == "statement"
|
||||
&& curPunc == "newstatement")))
|
||||
pushContext(state, stream.column(), "statement");
|
||||
|
||||
state.startOfLine = false;
|
||||
return style;
|
||||
},
|
||||
|
||||
electricChars: "{}",
|
||||
lineComment: "--",
|
||||
fold: "brace"
|
||||
};
|
||||
});
|
||||
|
||||
function words(str) {
|
||||
var obj = {}, words = str.split(" ");
|
||||
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
||||
return obj;
|
||||
}
|
||||
|
||||
CodeMirror.defineMIME("text/x-ttcn-asn", {
|
||||
name: "asn.1",
|
||||
keywords: words("DEFINITIONS OBJECTS IF DERIVED INFORMATION ACTION" +
|
||||
" REPLY ANY NAMED CHARACTERIZED BEHAVIOUR REGISTERED" +
|
||||
" WITH AS IDENTIFIED CONSTRAINED BY PRESENT BEGIN" +
|
||||
" IMPORTS FROM UNITS SYNTAX MIN-ACCESS MAX-ACCESS" +
|
||||
" MINACCESS MAXACCESS REVISION STATUS DESCRIPTION" +
|
||||
" SEQUENCE SET COMPONENTS OF CHOICE DistinguishedName" +
|
||||
" ENUMERATED SIZE MODULE END INDEX AUGMENTS EXTENSIBILITY" +
|
||||
" IMPLIED EXPORTS"),
|
||||
cmipVerbs: words("ACTIONS ADD GET NOTIFICATIONS REPLACE REMOVE"),
|
||||
compareTypes: words("OPTIONAL DEFAULT MANAGED MODULE-TYPE MODULE_IDENTITY" +
|
||||
" MODULE-COMPLIANCE OBJECT-TYPE OBJECT-IDENTITY" +
|
||||
" OBJECT-COMPLIANCE MODE CONFIRMED CONDITIONAL" +
|
||||
" SUBORDINATE SUPERIOR CLASS TRUE FALSE NULL" +
|
||||
" TEXTUAL-CONVENTION"),
|
||||
status: words("current deprecated mandatory obsolete"),
|
||||
tags: words("APPLICATION AUTOMATIC EXPLICIT IMPLICIT PRIVATE TAGS" +
|
||||
" UNIVERSAL"),
|
||||
storage: words("BOOLEAN INTEGER OBJECT IDENTIFIER BIT OCTET STRING" +
|
||||
" UTCTime InterfaceIndex IANAifType CMIP-Attribute" +
|
||||
" REAL PACKAGE PACKAGES IpAddress PhysAddress" +
|
||||
" NetworkAddress BITS BMPString TimeStamp TimeTicks" +
|
||||
" TruthValue RowStatus DisplayString GeneralString" +
|
||||
" GraphicString IA5String NumericString" +
|
||||
" PrintableString SnmpAdminAtring TeletexString" +
|
||||
" UTF8String VideotexString VisibleString StringStore" +
|
||||
" ISO646String T61String UniversalString Unsigned32" +
|
||||
" Integer32 Gauge Gauge32 Counter Counter32 Counter64"),
|
||||
modifier: words("ATTRIBUTE ATTRIBUTES MANDATORY-GROUP MANDATORY-GROUPS" +
|
||||
" GROUP GROUPS ELEMENTS EQUALITY ORDERING SUBSTRINGS" +
|
||||
" DEFINED"),
|
||||
accessTypes: words("not-accessible accessible-for-notify read-only" +
|
||||
" read-create read-write"),
|
||||
multiLineStrings: true
|
||||
});
|
||||
});
|
78
public/vendor/codemirror/mode/asn.1/index.html
vendored
Executable file
78
public/vendor/codemirror/mode/asn.1/index.html
vendored
Executable file
|
@ -0,0 +1,78 @@
|
|||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: ASN.1 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="asn.1.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="http://en.wikipedia.org/wiki/Abstract_Syntax_Notation_One">ASN.1</a>
|
||||
</ul>
|
||||
</div>
|
||||
<article>
|
||||
<h2>ASN.1 example</h2>
|
||||
<div>
|
||||
<textarea id="ttcn-asn-code">
|
||||
--
|
||||
-- Sample ASN.1 Code
|
||||
--
|
||||
MyModule DEFINITIONS ::=
|
||||
BEGIN
|
||||
|
||||
MyTypes ::= SEQUENCE {
|
||||
myObjectId OBJECT IDENTIFIER,
|
||||
mySeqOf SEQUENCE OF MyInt,
|
||||
myBitString BIT STRING {
|
||||
muxToken(0),
|
||||
modemToken(1)
|
||||
}
|
||||
}
|
||||
|
||||
MyInt ::= INTEGER (0..65535)
|
||||
|
||||
END
|
||||
</textarea>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var ttcnEditor = CodeMirror.fromTextArea(document.getElementById("ttcn-asn-code"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
mode: "text/x-ttcn-asn"
|
||||
});
|
||||
ttcnEditor.setSize(400, 400);
|
||||
var mac = CodeMirror.keyMap.default == CodeMirror.keyMap.macDefault;
|
||||
CodeMirror.keyMap.default[(mac ? "Cmd" : "Ctrl") + "-Space"] = "autocomplete";
|
||||
</script>
|
||||
<br/>
|
||||
<p><strong>Language:</strong> Abstract Syntax Notation One
|
||||
(<a href="http://www.itu.int/en/ITU-T/asn1/Pages/introduction.aspx">ASN.1</a>)
|
||||
</p>
|
||||
<p><strong>MIME types defined:</strong> <code>text/x-ttcn-asn</code></p>
|
||||
|
||||
<br/>
|
||||
<p>The development of this mode has been sponsored by <a href="http://www.ericsson.com/">Ericsson
|
||||
</a>.</p>
|
||||
<p>Coded by Asmelash Tsegay Gebretsadkan </p>
|
||||
</article>
|
||||
</article>
|
||||
|
|
@ -65,8 +65,7 @@ CodeMirror.defineMode("asterisk", function() {
|
|||
|
||||
function basicToken(stream,state){
|
||||
var cur = '';
|
||||
var ch = '';
|
||||
ch = stream.next();
|
||||
var ch = stream.next();
|
||||
// comment
|
||||
if(ch == ";") {
|
||||
stream.skipToEnd();
|
||||
|
@ -136,7 +135,6 @@ CodeMirror.defineMode("asterisk", function() {
|
|||
token: function(stream, state) {
|
||||
|
||||
var cur = '';
|
||||
var ch = '';
|
||||
if(stream.eatSpace()) return null;
|
||||
// extension started
|
||||
if(state.extenStart){
|
||||
|
@ -170,7 +168,7 @@ CodeMirror.defineMode("asterisk", function() {
|
|||
} else if(state.extenPriority) {
|
||||
state.extenPriority = false;
|
||||
state.extenApplication = true;
|
||||
ch = stream.next(); // get comma
|
||||
stream.next(); // get comma
|
||||
if(state.extenSame) return null;
|
||||
stream.eatWhile(/[^,]/);
|
||||
return "number";
|
||||
|
|
181
public/vendor/codemirror/mode/clike/clike.js
vendored
181
public/vendor/codemirror/mode/clike/clike.js
vendored
|
@ -16,15 +16,19 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
|
||||
dontAlignCalls = parserConfig.dontAlignCalls,
|
||||
keywords = parserConfig.keywords || {},
|
||||
types = parserConfig.types || {},
|
||||
builtin = parserConfig.builtin || {},
|
||||
blockKeywords = parserConfig.blockKeywords || {},
|
||||
defKeywords = parserConfig.defKeywords || {},
|
||||
atoms = parserConfig.atoms || {},
|
||||
hooks = parserConfig.hooks || {},
|
||||
multiLineStrings = parserConfig.multiLineStrings,
|
||||
indentStatements = parserConfig.indentStatements !== false;
|
||||
indentStatements = parserConfig.indentStatements !== false,
|
||||
indentSwitch = parserConfig.indentSwitch !== false,
|
||||
namespaceSeparator = parserConfig.namespaceSeparator;
|
||||
var isOperatorChar = /[+\-*&%=<>!?|\/]/;
|
||||
|
||||
var curPunc;
|
||||
var curPunc, isDefKeyword;
|
||||
|
||||
function tokenBase(stream, state) {
|
||||
var ch = stream.next();
|
||||
|
@ -59,11 +63,16 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
return "operator";
|
||||
}
|
||||
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
|
||||
if (namespaceSeparator) while (stream.match(namespaceSeparator))
|
||||
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
|
||||
|
||||
var cur = stream.current();
|
||||
if (keywords.propertyIsEnumerable(cur)) {
|
||||
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
||||
if (defKeywords.propertyIsEnumerable(cur)) isDefKeyword = true;
|
||||
return "keyword";
|
||||
}
|
||||
if (types.propertyIsEnumerable(cur)) return "variable-3";
|
||||
if (builtin.propertyIsEnumerable(cur)) {
|
||||
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
||||
return "builtin";
|
||||
|
@ -104,9 +113,12 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
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 && state.context.type == "statement")
|
||||
if (state.context && isStatement(state.context.type) && !isStatement(type))
|
||||
indent = state.context.indented;
|
||||
return state.context = new Context(indent, col, type, null, state.context);
|
||||
}
|
||||
|
@ -117,6 +129,19 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
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 {
|
||||
|
@ -125,7 +150,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
tokenize: null,
|
||||
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
|
||||
indented: 0,
|
||||
startOfLine: true
|
||||
startOfLine: true,
|
||||
prevToken: null
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -137,41 +163,69 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
state.startOfLine = true;
|
||||
}
|
||||
if (stream.eatSpace()) return null;
|
||||
curPunc = null;
|
||||
curPunc = isDefKeyword = null;
|
||||
var style = (state.tokenize || tokenBase)(stream, state);
|
||||
if (style == "comment" || style == "meta") return style;
|
||||
if (ctx.align == null) ctx.align = true;
|
||||
|
||||
if ((curPunc == ";" || curPunc == ":" || curPunc == ",") && ctx.type == "statement") popContext(state);
|
||||
if ((curPunc == ";" || curPunc == ":" || curPunc == ","))
|
||||
while (isStatement(state.context.type)) popContext(state);
|
||||
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
||||
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
||||
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
||||
else if (curPunc == "}") {
|
||||
while (ctx.type == "statement") ctx = popContext(state);
|
||||
while (isStatement(ctx.type)) ctx = popContext(state);
|
||||
if (ctx.type == "}") ctx = popContext(state);
|
||||
while (ctx.type == "statement") ctx = popContext(state);
|
||||
while (isStatement(ctx.type)) ctx = popContext(state);
|
||||
}
|
||||
else if (curPunc == ctx.type) popContext(state);
|
||||
else if (indentStatements &&
|
||||
(((ctx.type == "}" || ctx.type == "top") && curPunc != ';') ||
|
||||
(ctx.type == "statement" && curPunc == "newstatement")))
|
||||
pushContext(state, stream.column(), "statement");
|
||||
(((ctx.type == "}" || ctx.type == "top") && curPunc != ";") ||
|
||||
(isStatement(ctx.type) && curPunc == "newstatement"))) {
|
||||
var type = "statement";
|
||||
if (curPunc == "newstatement" && indentSwitch && stream.current() == "switch")
|
||||
type = "switchstatement";
|
||||
else if (style == "keyword" && stream.current() == "namespace")
|
||||
type = "namespace";
|
||||
pushContext(state, stream.column(), type);
|
||||
}
|
||||
|
||||
if (style == "variable" &&
|
||||
((state.prevToken == "def" ||
|
||||
(parserConfig.typeFirstDefinitions && typeBefore(stream, state) &&
|
||||
isTopScope(state.context) && stream.match(/^\s*\(/, false)))))
|
||||
style = "def";
|
||||
|
||||
if (hooks.token) {
|
||||
var result = hooks.token(stream, state, style);
|
||||
if (result !== undefined) style = result;
|
||||
}
|
||||
|
||||
if (style == "def" && parserConfig.styleDefs === false) style = "variable";
|
||||
|
||||
state.startOfLine = false;
|
||||
state.prevToken = isDefKeyword ? "def" : style || curPunc;
|
||||
return style;
|
||||
},
|
||||
|
||||
indent: function(state, textAfter) {
|
||||
if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass;
|
||||
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
|
||||
if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
|
||||
if (isStatement(ctx.type) && firstChar == "}") ctx = ctx.prev;
|
||||
var closing = firstChar == ctx.type;
|
||||
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
|
||||
else if (ctx.align && (!dontAlignCalls || ctx.type != ")")) return ctx.column + (closing ? 0 : 1);
|
||||
else if (ctx.type == ")" && !closing) return ctx.indented + statementIndentUnit;
|
||||
else return ctx.indented + (closing ? 0 : indentUnit);
|
||||
var switchBlock = ctx.prev && ctx.prev.type == "switchstatement";
|
||||
if (isStatement(ctx.type))
|
||||
return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
|
||||
if (ctx.align && (!dontAlignCalls || ctx.type != ")"))
|
||||
return ctx.column + (closing ? 0 : 1);
|
||||
if (ctx.type == ")" && !closing)
|
||||
return ctx.indented + statementIndentUnit;
|
||||
|
||||
return ctx.indented + (closing ? 0 : indentUnit) +
|
||||
(!closing && switchBlock && !/^(?:case|default)\b/.test(textAfter) ? indentUnit : 0);
|
||||
},
|
||||
|
||||
electricChars: "{}",
|
||||
electricInput: indentSwitch ? /^\s*(?:case .*?:|default:|\{\}?|\})$/ : /^\s*[{}]$/,
|
||||
blockCommentStart: "/*",
|
||||
blockCommentEnd: "*/",
|
||||
lineComment: "//",
|
||||
|
@ -184,9 +238,10 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
||||
return obj;
|
||||
}
|
||||
var cKeywords = "auto if break int case long char register continue return default short do sizeof " +
|
||||
"double static else struct switch extern typedef float union for unsigned " +
|
||||
"goto while enum void const signed volatile";
|
||||
var cKeywords = "auto if break case register continue return default do sizeof " +
|
||||
"static else struct switch extern typedef float union for " +
|
||||
"goto while enum const volatile";
|
||||
var cTypes = "int long char short double float unsigned signed void size_t ptrdiff_t";
|
||||
|
||||
function cppHook(stream, state) {
|
||||
if (!state.startOfLine) return false;
|
||||
|
@ -206,6 +261,11 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
return "meta";
|
||||
}
|
||||
|
||||
function pointerHook(_stream, state) {
|
||||
if (state.prevToken == "variable-3") return "variable-3";
|
||||
return false;
|
||||
}
|
||||
|
||||
function cpp11StringHook(stream, state) {
|
||||
stream.backUp(1);
|
||||
// Raw strings.
|
||||
|
@ -230,6 +290,11 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function cppLooksLikeConstructor(word) {
|
||||
var lastTwo = /(\w+)::(\w+)$/.exec(word);
|
||||
return lastTwo && lastTwo[1] == lastTwo[2];
|
||||
}
|
||||
|
||||
// C#-style strings where "" escapes a quote.
|
||||
function tokenAtString(stream, state) {
|
||||
var next;
|
||||
|
@ -263,6 +328,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
words.push(prop);
|
||||
}
|
||||
add(mode.keywords);
|
||||
add(mode.types);
|
||||
add(mode.builtin);
|
||||
add(mode.atoms);
|
||||
if (words.length) {
|
||||
|
@ -277,39 +343,60 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
def(["text/x-csrc", "text/x-c", "text/x-chdr"], {
|
||||
name: "clike",
|
||||
keywords: words(cKeywords),
|
||||
types: words(cTypes + " bool _Complex _Bool float_t double_t intptr_t intmax_t " +
|
||||
"int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t " +
|
||||
"uint32_t uint64_t"),
|
||||
blockKeywords: words("case do else for if switch while struct"),
|
||||
atoms: words("null"),
|
||||
hooks: {"#": cppHook},
|
||||
defKeywords: words("struct"),
|
||||
typeFirstDefinitions: true,
|
||||
atoms: words("null true false"),
|
||||
hooks: {"#": cppHook, "*": pointerHook},
|
||||
modeProps: {fold: ["brace", "include"]}
|
||||
});
|
||||
|
||||
def(["text/x-c++src", "text/x-c++hdr"], {
|
||||
name: "clike",
|
||||
keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try bool explicit new " +
|
||||
keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try explicit new " +
|
||||
"static_cast typeid catch operator template typename class friend private " +
|
||||
"this using const_cast inline public throw virtual delete mutable protected " +
|
||||
"wchar_t alignas alignof constexpr decltype nullptr noexcept thread_local final " +
|
||||
"alignas alignof constexpr decltype nullptr noexcept thread_local final " +
|
||||
"static_assert override"),
|
||||
types: words(cTypes + " bool wchar_t"),
|
||||
blockKeywords: words("catch class do else finally for if struct switch try while"),
|
||||
defKeywords: words("class namespace struct enum union"),
|
||||
typeFirstDefinitions: true,
|
||||
atoms: words("true false null"),
|
||||
hooks: {
|
||||
"#": cppHook,
|
||||
"*": pointerHook,
|
||||
"u": cpp11StringHook,
|
||||
"U": cpp11StringHook,
|
||||
"L": cpp11StringHook,
|
||||
"R": cpp11StringHook
|
||||
"R": cpp11StringHook,
|
||||
token: function(stream, state, style) {
|
||||
if (style == "variable" && stream.peek() == "(" &&
|
||||
(state.prevToken == ";" || state.prevToken == null ||
|
||||
state.prevToken == "}") &&
|
||||
cppLooksLikeConstructor(stream.current()))
|
||||
return "def";
|
||||
}
|
||||
},
|
||||
namespaceSeparator: "::",
|
||||
modeProps: {fold: ["brace", "include"]}
|
||||
});
|
||||
|
||||
def("text/x-java", {
|
||||
name: "clike",
|
||||
keywords: words("abstract assert boolean break byte case catch char class const continue default " +
|
||||
"do double else enum extends final finally float for goto if implements import " +
|
||||
"instanceof int interface long native new package private protected public " +
|
||||
"return short static strictfp super switch synchronized this throw throws transient " +
|
||||
"try void volatile while"),
|
||||
keywords: words("abstract assert break case catch class const continue default " +
|
||||
"do else enum extends final finally float for goto if implements import " +
|
||||
"instanceof interface native new package private protected public " +
|
||||
"return static strictfp super switch synchronized this throw throws transient " +
|
||||
"try volatile while"),
|
||||
types: words("byte short int long float double boolean char void Boolean Byte Character Double Float " +
|
||||
"Integer Long Number Object Short String StringBuffer StringBuilder Void"),
|
||||
blockKeywords: words("catch class do else finally for if switch try while"),
|
||||
defKeywords: words("class interface package enum"),
|
||||
typeFirstDefinitions: true,
|
||||
atoms: words("true false null"),
|
||||
hooks: {
|
||||
"@": function(stream) {
|
||||
|
@ -322,18 +409,20 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
|
||||
def("text/x-csharp", {
|
||||
name: "clike",
|
||||
keywords: words("abstract as base break case catch checked class const continue" +
|
||||
keywords: words("abstract as async await base break case catch checked class const continue" +
|
||||
" default delegate do else enum event explicit extern finally fixed for" +
|
||||
" foreach goto if implicit in interface internal is lock namespace new" +
|
||||
" operator out override params private protected public readonly ref return sealed" +
|
||||
" sizeof stackalloc static struct switch this throw try typeof unchecked" +
|
||||
" unsafe using virtual void volatile while add alias ascending descending dynamic from get" +
|
||||
" global group into join let orderby partial remove select set value var yield"),
|
||||
blockKeywords: words("catch class do else finally for foreach if struct switch try while"),
|
||||
builtin: words("Boolean Byte Char DateTime DateTimeOffset Decimal Double" +
|
||||
" Guid Int16 Int32 Int64 Object SByte Single String TimeSpan UInt16 UInt32" +
|
||||
types: words("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func" +
|
||||
" Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32" +
|
||||
" UInt64 bool byte char decimal double short int long object" +
|
||||
" sbyte float string ushort uint ulong"),
|
||||
blockKeywords: words("catch class do else finally for foreach if struct switch try while"),
|
||||
defKeywords: words("class interface namespace struct var"),
|
||||
typeFirstDefinitions: true,
|
||||
atoms: words("true false null"),
|
||||
hooks: {
|
||||
"@": function(stream, state) {
|
||||
|
@ -366,18 +455,21 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
/* scala */
|
||||
"abstract case catch class def do else extends false final finally for forSome if " +
|
||||
"implicit import lazy match new null object override package private protected return " +
|
||||
"sealed super this throw trait try trye type val var while with yield _ : = => <- <: " +
|
||||
"sealed super this throw trait try type val var while with yield _ : = => <- <: " +
|
||||
"<% >: # @ " +
|
||||
|
||||
/* package scala */
|
||||
"assert assume require print println printf readLine readBoolean readByte readShort " +
|
||||
"readChar readInt readLong readFloat readDouble " +
|
||||
|
||||
":: #:: "
|
||||
),
|
||||
types: words(
|
||||
"AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " +
|
||||
"Enumeration Equiv Error Exception Fractional Function IndexedSeq 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 :: #:: " +
|
||||
"StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector " +
|
||||
|
||||
/* package java.lang */
|
||||
"Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " +
|
||||
|
@ -387,8 +479,10 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
),
|
||||
multiLineStrings: true,
|
||||
blockKeywords: words("catch class do else finally for forSome if match switch try while"),
|
||||
defKeywords: words("class def object package trait type val var"),
|
||||
atoms: words("true false null"),
|
||||
indentStatements: false,
|
||||
indentSwitch: false,
|
||||
hooks: {
|
||||
"@": function(stream) {
|
||||
stream.eatWhile(/[\w\$_]/);
|
||||
|
@ -409,15 +503,15 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
|
||||
def(["x-shader/x-vertex", "x-shader/x-fragment"], {
|
||||
name: "clike",
|
||||
keywords: words("float int bool void " +
|
||||
"vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 " +
|
||||
"mat2 mat3 mat4 " +
|
||||
"sampler1D sampler2D sampler3D samplerCube " +
|
||||
keywords: words("sampler1D sampler2D sampler3D samplerCube " +
|
||||
"sampler1DShadow sampler2DShadow " +
|
||||
"const attribute uniform varying " +
|
||||
"break continue discard return " +
|
||||
"for while do if else struct " +
|
||||
"in out inout"),
|
||||
types: words("float int bool void " +
|
||||
"vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 " +
|
||||
"mat2 mat3 mat4"),
|
||||
blockKeywords: words("for while do if else struct"),
|
||||
builtin: words("radians degrees sin cos tan asin acos atan " +
|
||||
"pow exp log exp2 sqrt inversesqrt " +
|
||||
|
@ -461,6 +555,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
"gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits " +
|
||||
"gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits " +
|
||||
"gl_MaxDrawBuffers"),
|
||||
indentSwitch: false,
|
||||
hooks: {"#": cppHook},
|
||||
modeProps: {fold: ["brace", "include"]}
|
||||
});
|
||||
|
@ -470,8 +565,9 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
keywords: words(cKeywords + "as atomic async call command component components configuration event generic " +
|
||||
"implementation includes interface module new norace nx_struct nx_union post provides " +
|
||||
"signal task uses abstract extends"),
|
||||
types: words(cTypes),
|
||||
blockKeywords: words("case do else for if switch while struct"),
|
||||
atoms: words("null"),
|
||||
atoms: words("null true false"),
|
||||
hooks: {"#": cppHook},
|
||||
modeProps: {fold: ["brace", "include"]}
|
||||
});
|
||||
|
@ -480,7 +576,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
|||
name: "clike",
|
||||
keywords: words(cKeywords + "inline restrict _Bool _Complex _Imaginery BOOL Class bycopy byref id IMP in " +
|
||||
"inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),
|
||||
atoms: words("YES NO NULL NILL ON OFF"),
|
||||
types: words(cTypes),
|
||||
atoms: words("YES NO NULL NILL ON OFF true false"),
|
||||
hooks: {
|
||||
"@": function(stream) {
|
||||
stream.eatWhile(/[\w\$]/);
|
||||
|
|
33
public/vendor/codemirror/mode/clike/test.js
vendored
Executable file
33
public/vendor/codemirror/mode/clike/test.js
vendored
Executable file
|
@ -0,0 +1,33 @@
|
|||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function() {
|
||||
var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-c");
|
||||
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
|
||||
|
||||
MT("indent",
|
||||
"[variable-3 void] [def foo]([variable-3 void*] [variable a], [variable-3 int] [variable b]) {",
|
||||
" [variable-3 int] [variable c] [operator =] [variable b] [operator +]",
|
||||
" [number 1];",
|
||||
" [keyword return] [operator *][variable a];",
|
||||
"}");
|
||||
|
||||
MT("indent_switch",
|
||||
"[keyword switch] ([variable x]) {",
|
||||
" [keyword case] [number 10]:",
|
||||
" [keyword return] [number 20];",
|
||||
" [keyword default]:",
|
||||
" [variable printf]([string \"foo %c\"], [variable x]);",
|
||||
"}");
|
||||
|
||||
MT("def",
|
||||
"[variable-3 void] [def foo]() {}",
|
||||
"[keyword struct] [def bar]{}",
|
||||
"[variable-3 int] [variable-3 *][def baz]() {}");
|
||||
|
||||
MT("double_block",
|
||||
"[keyword for] (;;)",
|
||||
" [keyword for] (;;)",
|
||||
" [variable x][operator ++];",
|
||||
"[keyword return];");
|
||||
})();
|
17
public/vendor/codemirror/mode/css/css.js
vendored
17
public/vendor/codemirror/mode/css/css.js
vendored
|
@ -329,7 +329,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
|
|||
if (type == "}") return popContext(state);
|
||||
if (type == "{" || type == ";") return popAndPass(type, stream, state);
|
||||
if (type == "word") override = "variable";
|
||||
else if (type != "variable") override = "error";
|
||||
else if (type != "variable" && type != "(" && type != ")") override = "error";
|
||||
return "interpolation";
|
||||
};
|
||||
|
||||
|
@ -653,16 +653,6 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
|
|||
return ["comment", "comment"];
|
||||
}
|
||||
|
||||
function tokenSGMLComment(stream, state) {
|
||||
if (stream.skipTo("-->")) {
|
||||
stream.match("-->");
|
||||
state.tokenize = null;
|
||||
} else {
|
||||
stream.skipToEnd();
|
||||
}
|
||||
return ["comment", "comment"];
|
||||
}
|
||||
|
||||
CodeMirror.defineMIME("text/css", {
|
||||
documentTypes: documentTypes,
|
||||
mediaTypes: mediaTypes,
|
||||
|
@ -674,11 +664,6 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
|
|||
colorKeywords: colorKeywords,
|
||||
valueKeywords: valueKeywords,
|
||||
tokenHooks: {
|
||||
"<": function(stream, state) {
|
||||
if (!stream.match("!--")) return false;
|
||||
state.tokenize = tokenSGMLComment;
|
||||
return tokenSGMLComment(stream, state);
|
||||
},
|
||||
"/": function(stream, state) {
|
||||
if (!stream.eat("*")) return false;
|
||||
state.tokenize = tokenCComment;
|
||||
|
|
7
public/vendor/codemirror/mode/css/test.js
vendored
7
public/vendor/codemirror/mode/css/test.js
vendored
|
@ -76,13 +76,6 @@
|
|||
MT("tagTwoPropertiesURL",
|
||||
"[tag foo] { [property background]: [atom url]([string //example.com/foo.png]); [property padding]: [number 0]; }");
|
||||
|
||||
MT("commentSGML",
|
||||
"[comment <!--comment-->]");
|
||||
|
||||
MT("commentSGML2",
|
||||
"[comment <!--comment]",
|
||||
"[comment -->] [tag div] {}");
|
||||
|
||||
MT("indent_tagSelector",
|
||||
"[tag strong], [tag em] {",
|
||||
" [property background]: [atom rgba](",
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
CodeMirror.defineMode("cypher", function(config) {
|
||||
var tokenBase = function(stream/*, state*/) {
|
||||
var ch = stream.next(), curPunc = null;
|
||||
var ch = stream.next();
|
||||
if (ch === "\"" || ch === "'") {
|
||||
stream.match(/.+?["']/);
|
||||
return "string";
|
||||
|
|
44
public/vendor/codemirror/mode/dylan/dylan.js
vendored
44
public/vendor/codemirror/mode/dylan/dylan.js
vendored
|
@ -154,20 +154,12 @@ CodeMirror.defineMode("dylan", function(_config) {
|
|||
return f(stream, state);
|
||||
}
|
||||
|
||||
var type, content;
|
||||
|
||||
function ret(_type, style, _content) {
|
||||
type = _type;
|
||||
content = _content;
|
||||
return style;
|
||||
}
|
||||
|
||||
function tokenBase(stream, state) {
|
||||
// String
|
||||
var ch = stream.peek();
|
||||
if (ch == "'" || ch == '"') {
|
||||
stream.next();
|
||||
return chain(stream, state, tokenString(ch, "string", "string"));
|
||||
return chain(stream, state, tokenString(ch, "string"));
|
||||
}
|
||||
// Comment
|
||||
else if (ch == "/") {
|
||||
|
@ -176,16 +168,16 @@ CodeMirror.defineMode("dylan", function(_config) {
|
|||
return chain(stream, state, tokenComment);
|
||||
} else if (stream.eat("/")) {
|
||||
stream.skipToEnd();
|
||||
return ret("comment", "comment");
|
||||
return "comment";
|
||||
} else {
|
||||
stream.skipTo(" ");
|
||||
return ret("operator", "operator");
|
||||
return "operator";
|
||||
}
|
||||
}
|
||||
// Decimal
|
||||
else if (/\d/.test(ch)) {
|
||||
stream.match(/^\d*(?:\.\d*)?(?:e[+\-]?\d+)?/);
|
||||
return ret("number", "number");
|
||||
return "number";
|
||||
}
|
||||
// Hash
|
||||
else if (ch == "#") {
|
||||
|
@ -194,33 +186,33 @@ CodeMirror.defineMode("dylan", function(_config) {
|
|||
ch = stream.peek();
|
||||
if (ch == '"') {
|
||||
stream.next();
|
||||
return chain(stream, state, tokenString('"', "symbol", "string-2"));
|
||||
return chain(stream, state, tokenString('"', "string-2"));
|
||||
}
|
||||
// Binary number
|
||||
else if (ch == "b") {
|
||||
stream.next();
|
||||
stream.eatWhile(/[01]/);
|
||||
return ret("number", "number");
|
||||
return "number";
|
||||
}
|
||||
// Hex number
|
||||
else if (ch == "x") {
|
||||
stream.next();
|
||||
stream.eatWhile(/[\da-f]/i);
|
||||
return ret("number", "number");
|
||||
return "number";
|
||||
}
|
||||
// Octal number
|
||||
else if (ch == "o") {
|
||||
stream.next();
|
||||
stream.eatWhile(/[0-7]/);
|
||||
return ret("number", "number");
|
||||
return "number";
|
||||
}
|
||||
// Hash symbol
|
||||
else {
|
||||
stream.eatWhile(/[-a-zA-Z]/);
|
||||
return ret("hash", "keyword");
|
||||
return "keyword";
|
||||
}
|
||||
} else if (stream.match("end")) {
|
||||
return ret("end", "keyword");
|
||||
return "keyword";
|
||||
}
|
||||
for (var name in patterns) {
|
||||
if (patterns.hasOwnProperty(name)) {
|
||||
|
@ -228,21 +220,21 @@ CodeMirror.defineMode("dylan", function(_config) {
|
|||
if ((pattern instanceof Array && pattern.some(function(p) {
|
||||
return stream.match(p);
|
||||
})) || stream.match(pattern))
|
||||
return ret(name, patternStyles[name], stream.current());
|
||||
return patternStyles[name];
|
||||
}
|
||||
}
|
||||
if (stream.match("define")) {
|
||||
return ret("definition", "def");
|
||||
return "def";
|
||||
} else {
|
||||
stream.eatWhile(/[\w\-]/);
|
||||
// Keyword
|
||||
if (wordLookup[stream.current()]) {
|
||||
return ret(wordLookup[stream.current()], styleLookup[stream.current()], stream.current());
|
||||
return styleLookup[stream.current()];
|
||||
} else if (stream.current().match(symbol)) {
|
||||
return ret("variable", "variable");
|
||||
return "variable";
|
||||
} else {
|
||||
stream.next();
|
||||
return ret("other", "variable-2");
|
||||
return "variable-2";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -257,10 +249,10 @@ CodeMirror.defineMode("dylan", function(_config) {
|
|||
}
|
||||
maybeEnd = (ch == "*");
|
||||
}
|
||||
return ret("comment", "comment");
|
||||
return "comment";
|
||||
}
|
||||
|
||||
function tokenString(quote, type, style) {
|
||||
function tokenString(quote, style) {
|
||||
return function(stream, state) {
|
||||
var next, end = false;
|
||||
while ((next = stream.next()) != null) {
|
||||
|
@ -271,7 +263,7 @@ CodeMirror.defineMode("dylan", function(_config) {
|
|||
}
|
||||
if (end)
|
||||
state.tokenize = tokenBase;
|
||||
return ret(type, style);
|
||||
return style;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
3
public/vendor/codemirror/mode/ecl/ecl.js
vendored
3
public/vendor/codemirror/mode/ecl/ecl.js
vendored
|
@ -34,7 +34,6 @@ CodeMirror.defineMode("ecl", function(config) {
|
|||
var blockKeywords = words("catch class do else finally for if switch try while");
|
||||
var atoms = words("true false null");
|
||||
var hooks = {"#": metaHook};
|
||||
var multiLineStrings;
|
||||
var isOperatorChar = /[+\-*&%=<>!?|\/]/;
|
||||
|
||||
var curPunc;
|
||||
|
@ -112,7 +111,7 @@ CodeMirror.defineMode("ecl", function(config) {
|
|||
if (next == quote && !escaped) {end = true; break;}
|
||||
escaped = !escaped && next == "\\";
|
||||
}
|
||||
if (end || !(escaped || multiLineStrings))
|
||||
if (end || !escaped)
|
||||
state.tokenize = tokenBase;
|
||||
return "string";
|
||||
};
|
||||
|
|
|
@ -84,7 +84,6 @@ CodeMirror.defineMode("eiffel", function() {
|
|||
'or'
|
||||
]);
|
||||
var operators = wordObj([":=", "and then","and", "or","<<",">>"]);
|
||||
var curPunc;
|
||||
|
||||
function chain(newtok, stream, state) {
|
||||
state.tokenize.push(newtok);
|
||||
|
@ -92,7 +91,6 @@ CodeMirror.defineMode("eiffel", function() {
|
|||
}
|
||||
|
||||
function tokenBase(stream, state) {
|
||||
curPunc = null;
|
||||
if (stream.eatSpace()) return null;
|
||||
var ch = stream.next();
|
||||
if (ch == '"'||ch == "'") {
|
||||
|
|
205
public/vendor/codemirror/mode/elm/elm.js
vendored
Executable file
205
public/vendor/codemirror/mode/elm/elm.js
vendored
Executable file
|
@ -0,0 +1,205 @@
|
|||
// 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("elm", function() {
|
||||
|
||||
function switchState(source, setState, f) {
|
||||
setState(f);
|
||||
return f(source, setState);
|
||||
}
|
||||
|
||||
// These should all be Unicode extended, as per the Haskell 2010 report
|
||||
var smallRE = /[a-z_]/;
|
||||
var largeRE = /[A-Z]/;
|
||||
var digitRE = /[0-9]/;
|
||||
var hexitRE = /[0-9A-Fa-f]/;
|
||||
var octitRE = /[0-7]/;
|
||||
var idRE = /[a-z_A-Z0-9\']/;
|
||||
var symbolRE = /[-!#$%&*+.\/<=>?@\\^|~:\u03BB\u2192]/;
|
||||
var specialRE = /[(),;[\]`{}]/;
|
||||
var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer
|
||||
|
||||
function normal() {
|
||||
return function (source, setState) {
|
||||
if (source.eatWhile(whiteCharRE)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var ch = source.next();
|
||||
if (specialRE.test(ch)) {
|
||||
if (ch == '{' && source.eat('-')) {
|
||||
var t = "comment";
|
||||
if (source.eat('#')) t = "meta";
|
||||
return switchState(source, setState, ncomment(t, 1));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if (ch == '\'') {
|
||||
if (source.eat('\\'))
|
||||
source.next(); // should handle other escapes here
|
||||
else
|
||||
source.next();
|
||||
|
||||
if (source.eat('\''))
|
||||
return "string";
|
||||
return "error";
|
||||
}
|
||||
|
||||
if (ch == '"') {
|
||||
return switchState(source, setState, stringLiteral);
|
||||
}
|
||||
|
||||
if (largeRE.test(ch)) {
|
||||
source.eatWhile(idRE);
|
||||
if (source.eat('.'))
|
||||
return "qualifier";
|
||||
return "variable-2";
|
||||
}
|
||||
|
||||
if (smallRE.test(ch)) {
|
||||
var isDef = source.pos === 1;
|
||||
source.eatWhile(idRE);
|
||||
return isDef ? "variable-3" : "variable";
|
||||
}
|
||||
|
||||
if (digitRE.test(ch)) {
|
||||
if (ch == '0') {
|
||||
if (source.eat(/[xX]/)) {
|
||||
source.eatWhile(hexitRE); // should require at least 1
|
||||
return "integer";
|
||||
}
|
||||
if (source.eat(/[oO]/)) {
|
||||
source.eatWhile(octitRE); // should require at least 1
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
source.eatWhile(digitRE);
|
||||
var t = "number";
|
||||
if (source.eat('.')) {
|
||||
t = "number";
|
||||
source.eatWhile(digitRE); // should require at least 1
|
||||
}
|
||||
if (source.eat(/[eE]/)) {
|
||||
t = "number";
|
||||
source.eat(/[-+]/);
|
||||
source.eatWhile(digitRE); // should require at least 1
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
if (symbolRE.test(ch)) {
|
||||
if (ch == '-' && source.eat(/-/)) {
|
||||
source.eatWhile(/-/);
|
||||
if (!source.eat(symbolRE)) {
|
||||
source.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
}
|
||||
source.eatWhile(symbolRE);
|
||||
return "builtin";
|
||||
}
|
||||
|
||||
return "error";
|
||||
}
|
||||
}
|
||||
|
||||
function ncomment(type, nest) {
|
||||
if (nest == 0) {
|
||||
return normal();
|
||||
}
|
||||
return function(source, setState) {
|
||||
var currNest = nest;
|
||||
while (!source.eol()) {
|
||||
var ch = source.next();
|
||||
if (ch == '{' && source.eat('-')) {
|
||||
++currNest;
|
||||
} else if (ch == '-' && source.eat('}')) {
|
||||
--currNest;
|
||||
if (currNest == 0) {
|
||||
setState(normal());
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
setState(ncomment(type, currNest));
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
function stringLiteral(source, setState) {
|
||||
while (!source.eol()) {
|
||||
var ch = source.next();
|
||||
if (ch == '"') {
|
||||
setState(normal());
|
||||
return "string";
|
||||
}
|
||||
if (ch == '\\') {
|
||||
if (source.eol() || source.eat(whiteCharRE)) {
|
||||
setState(stringGap);
|
||||
return "string";
|
||||
}
|
||||
if (!source.eat('&')) source.next(); // should handle other escapes here
|
||||
}
|
||||
}
|
||||
setState(normal());
|
||||
return "error";
|
||||
}
|
||||
|
||||
function stringGap(source, setState) {
|
||||
if (source.eat('\\')) {
|
||||
return switchState(source, setState, stringLiteral);
|
||||
}
|
||||
source.next();
|
||||
setState(normal());
|
||||
return "error";
|
||||
}
|
||||
|
||||
|
||||
var wellKnownWords = (function() {
|
||||
var wkw = {};
|
||||
|
||||
var keywords = [
|
||||
"case", "of", "as",
|
||||
"if", "then", "else",
|
||||
"let", "in",
|
||||
"infix", "infixl", "infixr",
|
||||
"type", "alias",
|
||||
"input", "output", "foreign", "loopback",
|
||||
"module", "where", "import", "exposing",
|
||||
"_", "..", "|", ":", "=", "\\", "\"", "->", "<-"
|
||||
];
|
||||
|
||||
for (var i = keywords.length; i--;)
|
||||
wkw[keywords[i]] = "keyword";
|
||||
|
||||
return wkw;
|
||||
})();
|
||||
|
||||
|
||||
|
||||
return {
|
||||
startState: function () { return { f: normal() }; },
|
||||
copyState: function (s) { return { f: s.f }; },
|
||||
|
||||
token: function(stream, state) {
|
||||
var t = state.f(stream, function(s) { state.f = s; });
|
||||
var w = stream.current();
|
||||
return (wellKnownWords.hasOwnProperty(w)) ? wellKnownWords[w] : t;
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("text/x-elm", "elm");
|
||||
})();
|
61
public/vendor/codemirror/mode/elm/index.html
vendored
Executable file
61
public/vendor/codemirror/mode/elm/index.html
vendored
Executable file
|
@ -0,0 +1,61 @@
|
|||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: Elm 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="elm.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="#">Elm</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>Elm mode</h2>
|
||||
|
||||
<div><textarea id="code" name="code">
|
||||
import Color exposing (..)
|
||||
import Graphics.Collage exposing (..)
|
||||
import Graphics.Element exposing (..)
|
||||
import Time exposing (..)
|
||||
|
||||
main =
|
||||
Signal.map clock (every second)
|
||||
|
||||
clock t =
|
||||
collage 400 400
|
||||
[ filled lightGrey (ngon 12 110)
|
||||
, outlined (solid grey) (ngon 12 110)
|
||||
, hand orange 100 t
|
||||
, hand charcoal 100 (t/60)
|
||||
, hand charcoal 60 (t/720)
|
||||
]
|
||||
|
||||
hand clr len time =
|
||||
let angle = degrees (90 - 6 * inSeconds time)
|
||||
in
|
||||
segment (0,0) (fromPolar (len,angle))
|
||||
|> traced (solid clr)
|
||||
</textarea></div>
|
||||
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
lineNumbers: true,
|
||||
mode: "text/x-elm"
|
||||
});
|
||||
</script>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>text/x-elm</code>.</p>
|
||||
</article>
|
83
public/vendor/codemirror/mode/factor/factor.js
vendored
Executable file
83
public/vendor/codemirror/mode/factor/factor.js
vendored
Executable file
|
@ -0,0 +1,83 @@
|
|||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
// Factor syntax highlight - simple mode
|
||||
//
|
||||
// by Dimage Sapelkin (https://github.com/kerabromsmu)
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"), require("../../addon/mode/simple"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror", "../../addon/mode/simple"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
"use strict";
|
||||
|
||||
CodeMirror.defineSimpleMode("factor", {
|
||||
// The start state contains the rules that are intially used
|
||||
start: [
|
||||
// comments
|
||||
{regex: /#?!.*/, token: "comment"},
|
||||
// strings """, multiline --> state
|
||||
{regex: /"""/, token: "string", next: "string3"},
|
||||
{regex: /"/, token: "string", next: "string"},
|
||||
// numbers: dec, hex, unicode, bin, fractional, complex
|
||||
{regex: /(?:[+-]?)(?:0x[\d,a-f]+)|(?:0o[0-7]+)|(?:0b[0,1]+)|(?:\d+.?\d*)/, token: "number"},
|
||||
//{regex: /[+-]?/} //fractional
|
||||
// definition: defining word, defined word, etc
|
||||
{regex: /(\:)(\s+)(\S+)(\s+)(\()/, token: ["keyword", null, "def", null, "keyword"], next: "stack"},
|
||||
// vocabulary using --> state
|
||||
{regex: /USING\:/, token: "keyword", next: "vocabulary"},
|
||||
// vocabulary definition/use
|
||||
{regex: /(USE\:|IN\:)(\s+)(\S+)/, token: ["keyword", null, "variable-2"]},
|
||||
// <constructors>
|
||||
{regex: /<\S+>/, token: "builtin"},
|
||||
// "keywords", incl. ; t f . [ ] { } defining words
|
||||
{regex: /;|t|f|if|\.|\[|\]|\{|\}|MAIN:/, token: "keyword"},
|
||||
// any id (?)
|
||||
{regex: /\S+/, token: "variable"},
|
||||
|
||||
{
|
||||
regex: /./,
|
||||
token: null
|
||||
}
|
||||
],
|
||||
vocabulary: [
|
||||
{regex: /;/, token: "keyword", next: "start"},
|
||||
{regex: /\S+/, token: "variable-2"},
|
||||
{
|
||||
regex: /./,
|
||||
token: null
|
||||
}
|
||||
],
|
||||
string: [
|
||||
{regex: /(?:[^\\]|\\.)*?"/, token: "string", next: "start"},
|
||||
{regex: /.*/, token: "string"}
|
||||
],
|
||||
string3: [
|
||||
{regex: /(?:[^\\]|\\.)*?"""/, token: "string", next: "start"},
|
||||
{regex: /.*/, token: "string"}
|
||||
],
|
||||
stack: [
|
||||
{regex: /\)/, token: "meta", next: "start"},
|
||||
{regex: /--/, token: "meta"},
|
||||
{regex: /\S+/, token: "variable-3"},
|
||||
{
|
||||
regex: /./,
|
||||
token: null
|
||||
}
|
||||
],
|
||||
// The meta property contains global information about the mode. It
|
||||
// can contain properties like lineComment, which are supported by
|
||||
// all modes, and also directives like dontIndentStates, which are
|
||||
// specific to simple modes.
|
||||
meta: {
|
||||
dontIndentStates: ["start", "vocabulary", "string", "string3", "stack"],
|
||||
lineComment: [ "!", "#!" ]
|
||||
}
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("text/x-factor", "factor");
|
||||
});
|
77
public/vendor/codemirror/mode/factor/index.html
vendored
Executable file
77
public/vendor/codemirror/mode/factor/index.html
vendored
Executable file
|
@ -0,0 +1,77 @@
|
|||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: Factor mode</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel=stylesheet href="../../doc/docs.css">
|
||||
|
||||
<link href='http://fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" href="../../lib/codemirror.css">
|
||||
<script src="../../lib/codemirror.js"></script>
|
||||
<script src="../../addon/mode/simple.js"></script>
|
||||
<script src="factor.js"></script>
|
||||
<style>
|
||||
.CodeMirror {
|
||||
font-family: 'Droid Sans Mono', monospace;
|
||||
font-size: 14px;
|
||||
}
|
||||
</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="#">Factor</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
|
||||
<h2>Factor mode</h2>
|
||||
|
||||
<form><textarea id="code" name="code">
|
||||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
|
||||
! A simple time server
|
||||
|
||||
USING: accessors calendar calendar.format io io.encodings.ascii
|
||||
io.servers kernel threads ;
|
||||
IN: time-server
|
||||
|
||||
: handle-time-client ( -- )
|
||||
now timestamp>rfc822 print ;
|
||||
|
||||
: <time-server> ( -- threaded-server )
|
||||
ascii <threaded-server>
|
||||
"time-server" >>name
|
||||
1234 >>insecure
|
||||
[ handle-time-client ] >>handler ;
|
||||
|
||||
: start-time-server ( -- )
|
||||
<time-server> start-server drop ;
|
||||
|
||||
MAIN: start-time-server
|
||||
</textarea>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
lineNumbers: true,
|
||||
lineWrapping: true,
|
||||
indentUnit: 2,
|
||||
tabSize: 2,
|
||||
autofocus: true,
|
||||
mode: "text/x-factor"
|
||||
});
|
||||
</script>
|
||||
<p/>
|
||||
<p>Simple mode that handles Factor Syntax (<a href="http://en.wikipedia.org/wiki/Factor_(programming_language)">Factor on WikiPedia</a>).</p>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>text/x-factor</code>.</p>
|
||||
|
||||
</article>
|
13
public/vendor/codemirror/mode/groovy/groovy.js
vendored
13
public/vendor/codemirror/mode/groovy/groovy.js
vendored
|
@ -24,6 +24,7 @@ CodeMirror.defineMode("groovy", function(config) {
|
|||
"short static strictfp super switch synchronized threadsafe throw throws transient " +
|
||||
"try void volatile while");
|
||||
var blockKeywords = words("catch class do else finally for if switch try while enum interface def");
|
||||
var standaloneKeywords = words("return break continue");
|
||||
var atoms = words("null true false this");
|
||||
|
||||
var curPunc;
|
||||
|
@ -50,7 +51,7 @@ CodeMirror.defineMode("groovy", function(config) {
|
|||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
if (expectExpression(state.lastToken)) {
|
||||
if (expectExpression(state.lastToken, false)) {
|
||||
return startString(ch, stream, state);
|
||||
}
|
||||
}
|
||||
|
@ -70,6 +71,7 @@ CodeMirror.defineMode("groovy", function(config) {
|
|||
if (atoms.propertyIsEnumerable(cur)) { return "atom"; }
|
||||
if (keywords.propertyIsEnumerable(cur)) {
|
||||
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
||||
else if (standaloneKeywords.propertyIsEnumerable(cur)) curPunc = "standalone";
|
||||
return "keyword";
|
||||
}
|
||||
return "variable";
|
||||
|
@ -132,9 +134,10 @@ CodeMirror.defineMode("groovy", function(config) {
|
|||
return "comment";
|
||||
}
|
||||
|
||||
function expectExpression(last) {
|
||||
function expectExpression(last, newline) {
|
||||
return !last || last == "operator" || last == "->" || /[\.\[\{\(,;:]/.test(last) ||
|
||||
last == "newstatement" || last == "keyword" || last == "proplabel";
|
||||
last == "newstatement" || last == "keyword" || last == "proplabel" ||
|
||||
(last == "standalone" && !newline);
|
||||
}
|
||||
|
||||
function Context(indented, column, type, align, prev) {
|
||||
|
@ -174,7 +177,7 @@ CodeMirror.defineMode("groovy", function(config) {
|
|||
state.indented = stream.indentation();
|
||||
state.startOfLine = true;
|
||||
// Automatic semicolon insertion
|
||||
if (ctx.type == "statement" && !expectExpression(state.lastToken)) {
|
||||
if (ctx.type == "statement" && !expectExpression(state.lastToken, true)) {
|
||||
popContext(state); ctx = state.context;
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +212,7 @@ CodeMirror.defineMode("groovy", function(config) {
|
|||
indent: function(state, textAfter) {
|
||||
if (!state.tokenize[state.tokenize.length-1].isBase) return 0;
|
||||
var firstChar = textAfter && textAfter.charAt(0), ctx = state.context;
|
||||
if (ctx.type == "statement" && !expectExpression(state.lastToken)) ctx = ctx.prev;
|
||||
if (ctx.type == "statement" && !expectExpression(state.lastToken, true)) ctx = ctx.prev;
|
||||
var closing = firstChar == ctx.type;
|
||||
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : config.indentUnit);
|
||||
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
|
||||
|
|
|
@ -57,9 +57,9 @@ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
|
|||
}
|
||||
function maybeBackup(stream, pat, style) {
|
||||
var cur = stream.current();
|
||||
var close = cur.search(pat), m;
|
||||
var close = cur.search(pat);
|
||||
if (close > -1) stream.backUp(cur.length - close);
|
||||
else if (m = cur.match(/<\/?$/)) {
|
||||
else if (cur.match(/<\/?$/)) {
|
||||
stream.backUp(cur.length);
|
||||
if (!stream.match(pat, false)) stream.match(cur);
|
||||
}
|
||||
|
|
9
public/vendor/codemirror/mode/index.html
vendored
9
public/vendor/codemirror/mode/index.html
vendored
|
@ -31,6 +31,7 @@ option.</p>
|
|||
<div style="-webkit-columns: 100px 2; -moz-columns: 100px 2; columns: 100px 2;">
|
||||
<ul style="margin-top: 0">
|
||||
<li><a href="apl/index.html">APL</a></li>
|
||||
<li><a href="asn.1/index.html">ASN.1</a></li>
|
||||
<li><a href="asterisk/index.html">Asterisk dialplan</a></li>
|
||||
<li><a href="clike/index.html">C, C++, C#</a></li>
|
||||
<li><a href="clojure/index.html">Clojure</a></li>
|
||||
|
@ -51,7 +52,9 @@ option.</p>
|
|||
<li><a href="ebnf/index.html">EBNF</a></li>
|
||||
<li><a href="ecl/index.html">ECL</a></li>
|
||||
<li><a href="eiffel/index.html">Eiffel</a></li>
|
||||
<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="forth/index.html">Forth</a></li>
|
||||
<li><a href="fortran/index.html">Fortran</a></li>
|
||||
<li><a href="mllike/index.html">F#</a></li>
|
||||
|
@ -63,6 +66,7 @@ option.</p>
|
|||
<li><a href="handlebars/index.html">Handlebars</a></li>
|
||||
<li><a href="haskell/index.html">Haskell</a></li>
|
||||
<li><a href="haxe/index.html">Haxe</a></li>
|
||||
<li><a href="htmlembedded/index.html">HTML embedded</a> (JSP, ASP.NET)</li>
|
||||
<li><a href="htmlmixed/index.html">HTML mixed-mode</a></li>
|
||||
<li><a href="http/index.html">HTTP</a></li>
|
||||
<li><a href="idl/index.html">IDL</a></li>
|
||||
|
@ -76,6 +80,7 @@ option.</p>
|
|||
<li><a href="livescript/index.html">LiveScript</a></li>
|
||||
<li><a href="lua/index.html">Lua</a></li>
|
||||
<li><a href="markdown/index.html">Markdown</a> (<a href="gfm/index.html">GitHub-flavour</a>)</li>
|
||||
<li><a href="mathematica/index.html">Mathematica</a></li>
|
||||
<li><a href="mirc/index.html">mIRC</a></li>
|
||||
<li><a href="modelica/index.html">Modelica</a></li>
|
||||
<li><a href="mumps/index.html">MUMPS</a></li>
|
||||
|
@ -114,6 +119,7 @@ option.</p>
|
|||
<li><a href="stylus/index.html">Stylus</a></li>
|
||||
<li><a href="sql/index.html">SQL</a> (several dialects)</li>
|
||||
<li><a href="sparql/index.html">SPARQL</a></li>
|
||||
<li><a href="swift/index.html">Swift</a></li>
|
||||
<li><a href="stex/index.html">sTeX, LaTeX</a></li>
|
||||
<li><a href="tcl/index.html">Tcl</a></li>
|
||||
<li><a href="textile/index.html">Textile</a></li>
|
||||
|
@ -122,7 +128,10 @@ option.</p>
|
|||
<li><a href="toml/index.html">TOML</a></li>
|
||||
<li><a href="tornado/index.html">Tornado</a> (templating language)</li>
|
||||
<li><a href="troff/index.html">troff</a> (for manpages)</li>
|
||||
<li><a href="ttcn/index.html">TTCN</a></li>
|
||||
<li><a href="ttcn-cfg/index.html">TTCN Configuration</a></li>
|
||||
<li><a href="turtle/index.html">Turtle</a></li>
|
||||
<li><a href="twig/index.html">Twig</a></li>
|
||||
<li><a href="vb/index.html">VB.NET</a></li>
|
||||
<li><a href="vbscript/index.html">VBScript</a></li>
|
||||
<li><a href="velocity/index.html">Velocity</a></li>
|
||||
|
|
|
@ -482,8 +482,11 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
function maybetype(type) {
|
||||
if (isTS && type == ":") return cont(typedef);
|
||||
}
|
||||
function maybedefault(_, value) {
|
||||
if (value == "=") return cont(expressionNoComma);
|
||||
}
|
||||
function typedef(type) {
|
||||
if (type == "variable"){cx.marked = "variable-3"; return cont();}
|
||||
if (type == "variable") {cx.marked = "variable-3"; return cont();}
|
||||
}
|
||||
function vardef() {
|
||||
return pass(pattern, maybetype, maybeAssign, vardefCont);
|
||||
|
@ -538,7 +541,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|||
}
|
||||
function funarg(type) {
|
||||
if (type == "spread") return cont(funarg);
|
||||
return pass(pattern, maybetype);
|
||||
return pass(pattern, maybetype, maybedefault);
|
||||
}
|
||||
function className(type, value) {
|
||||
if (type == "variable") {register(value); return cont(classNameAfter);}
|
||||
|
|
|
@ -160,6 +160,11 @@
|
|||
"]];",
|
||||
"[number 10];");
|
||||
|
||||
MT("param_default",
|
||||
"[keyword function] [variable foo]([def x] [operator =] [string-2 `foo${][number 10][string-2 }bar`]) {",
|
||||
" [keyword return] [variable-2 x];",
|
||||
"}");
|
||||
|
||||
var jsonld_mode = CodeMirror.getMode(
|
||||
{indentUnit: 2},
|
||||
{name: "javascript", jsonld: true}
|
||||
|
|
2
public/vendor/codemirror/mode/julia/julia.js
vendored
2
public/vendor/codemirror/mode/julia/julia.js
vendored
|
@ -34,7 +34,6 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
|
|||
var closers = wordRegexp(blockClosers);
|
||||
var macro = /^@[_A-Za-z][_A-Za-z0-9]*/;
|
||||
var symbol = /^:[_A-Za-z][_A-Za-z0-9]*/;
|
||||
var indentInfo = null;
|
||||
|
||||
function in_array(state) {
|
||||
var ch = cur_scope(state);
|
||||
|
@ -247,7 +246,6 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
|
|||
}
|
||||
|
||||
function tokenLexer(stream, state) {
|
||||
indentInfo = null;
|
||||
var style = state.tokenize(stream, state);
|
||||
var current = stream.current();
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ CodeMirror.defineMode("kotlin", function (config, parserConfig) {
|
|||
var multiLineStrings = parserConfig.multiLineStrings;
|
||||
|
||||
var keywords = words(
|
||||
"package continue return object while break class data trait throw super" +
|
||||
"package continue return object while break class data trait interface throw super" +
|
||||
" when type this else This try val var fun for is in if do as true false null get set");
|
||||
var softKeywords = words("import" +
|
||||
" where by get set abstract enum open annotation override private public internal" +
|
||||
|
@ -272,7 +272,10 @@ CodeMirror.defineMode("kotlin", function (config, parserConfig) {
|
|||
},
|
||||
|
||||
closeBrackets: {triples: "'\""},
|
||||
electricChars: "{}"
|
||||
electricChars: "{}",
|
||||
blockCommentStart: "/*",
|
||||
blockCommentEnd: "*/",
|
||||
lineComment: "//"
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
var nr = Rules[next_rule];
|
||||
if (nr.splice) {
|
||||
for (var i$ = 0; i$ < nr.length; ++i$) {
|
||||
var r = nr[i$], m;
|
||||
if (r.regex && (m = stream.match(r.regex))) {
|
||||
var r = nr[i$];
|
||||
if (r.regex && stream.match(r.regex)) {
|
||||
state.next = r.next || state.next;
|
||||
return r.token;
|
||||
}
|
||||
|
|
|
@ -68,12 +68,12 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
, strong = 'strong'
|
||||
, strikethrough = 'strikethrough';
|
||||
|
||||
var hrRE = /^([*\-=_])(?:\s*\1){2,}\s*$/
|
||||
var hrRE = /^([*\-_])(?:\s*\1){2,}\s*$/
|
||||
, ulRE = /^[*\-+]\s+/
|
||||
, olRE = /^[0-9]+\.\s+/
|
||||
, olRE = /^[0-9]+([.)])\s+/
|
||||
, taskListRE = /^\[(x| )\](?=\s)/ // Must follow ulRE or olRE
|
||||
, atxHeaderRE = /^#+ ?/
|
||||
, setextHeaderRE = /^(?:\={1,}|-{1,})$/
|
||||
, atxHeaderRE = /^(#+)(?: |$)/
|
||||
, setextHeaderRE = /^ *(?:\={1,}|-{1,})\s*$/
|
||||
, textRE = /^[^#!\[\]*_\\<>` "'(~]+/;
|
||||
|
||||
function switchInline(stream, state, f) {
|
||||
|
@ -100,6 +100,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
state.strikethrough = false;
|
||||
// Reset state.quote
|
||||
state.quote = 0;
|
||||
// Reset state.indentedCode
|
||||
state.indentedCode = false;
|
||||
if (!htmlFound && state.f == htmlBlock) {
|
||||
state.f = inlineNormal;
|
||||
state.block = blockNormal;
|
||||
|
@ -116,7 +118,11 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
|
||||
var sol = stream.sol();
|
||||
|
||||
var prevLineIsList = state.list !== false;
|
||||
var prevLineIsList = state.list !== false,
|
||||
prevLineIsIndentedCode = state.indentedCode;
|
||||
|
||||
state.indentedCode = false;
|
||||
|
||||
if (prevLineIsList) {
|
||||
if (state.indentationDiff >= 0) { // Continued list
|
||||
if (state.indentationDiff < 4) { // Only adjust indentation if *not* a code block
|
||||
|
@ -134,23 +140,27 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
|
||||
var match = null;
|
||||
if (state.indentationDiff >= 4) {
|
||||
state.indentation -= 4;
|
||||
stream.skipToEnd();
|
||||
if (prevLineIsIndentedCode || !state.prevLineHasContent) {
|
||||
state.indentation -= 4;
|
||||
state.indentedCode = true;
|
||||
return code;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else if (stream.eatSpace()) {
|
||||
return null;
|
||||
} else if (match = stream.match(atxHeaderRE)) {
|
||||
state.header = Math.min(6, match[0].indexOf(" ") !== -1 ? match[0].length - 1 : match[0].length);
|
||||
} else if ((match = stream.match(atxHeaderRE)) && match[1].length <= 6) {
|
||||
state.header = match[1].length;
|
||||
if (modeCfg.highlightFormatting) state.formatting = "header";
|
||||
state.f = state.inline;
|
||||
return getType(state);
|
||||
} else if (state.prevLineHasContent && (match = stream.match(setextHeaderRE))) {
|
||||
} else if (state.prevLineHasContent && !state.quote && !prevLineIsList && !prevLineIsIndentedCode && (match = stream.match(setextHeaderRE))) {
|
||||
state.header = match[0].charAt(0) == '=' ? 1 : 2;
|
||||
if (modeCfg.highlightFormatting) state.formatting = "header";
|
||||
state.f = state.inline;
|
||||
return getType(state);
|
||||
} else if (stream.eat('>')) {
|
||||
state.indentation++;
|
||||
state.quote = sol ? 1 : state.quote + 1;
|
||||
if (modeCfg.highlightFormatting) state.formatting = "quote";
|
||||
stream.eatSpace();
|
||||
|
@ -158,6 +168,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
} else if (stream.peek() === '[') {
|
||||
return switchInline(stream, state, footnoteLink);
|
||||
} else if (stream.match(hrRE, true)) {
|
||||
state.hr = true;
|
||||
return hr;
|
||||
} else if ((!state.prevLineHasContent || prevLineIsList) && (stream.match(ulRE, false) || stream.match(olRE, false))) {
|
||||
var listType = null;
|
||||
|
@ -262,10 +273,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
}
|
||||
|
||||
if (state.linkHref) {
|
||||
styles.push(linkhref);
|
||||
return styles.length ? styles.join(' ') : null;
|
||||
}
|
||||
|
||||
styles.push(linkhref, "url");
|
||||
} else { // Only apply inline styles to non-url text
|
||||
if (state.strong) { styles.push(strong); }
|
||||
if (state.em) { styles.push(em); }
|
||||
if (state.strikethrough) { styles.push(strikethrough); }
|
||||
|
@ -273,6 +282,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
if (state.linkText) { styles.push(linktext); }
|
||||
|
||||
if (state.code) { styles.push(code); }
|
||||
}
|
||||
|
||||
if (state.header) { styles.push(header); styles.push(header + "-" + state.header); }
|
||||
|
||||
|
@ -626,7 +636,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true);
|
||||
}
|
||||
state.f = state.inline = inlineNormal;
|
||||
return linkhref;
|
||||
return linkhref + " url";
|
||||
}
|
||||
|
||||
var savedInlineRE = [];
|
||||
|
@ -663,6 +673,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
em: false,
|
||||
strong: false,
|
||||
header: 0,
|
||||
hr: false,
|
||||
taskList: false,
|
||||
list: false,
|
||||
listDepth: 0,
|
||||
|
@ -695,10 +706,12 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
strong: s.strong,
|
||||
strikethrough: s.strikethrough,
|
||||
header: s.header,
|
||||
hr: s.hr,
|
||||
taskList: s.taskList,
|
||||
list: s.list,
|
||||
listDepth: s.listDepth,
|
||||
quote: s.quote,
|
||||
indentedCode: s.indentedCode,
|
||||
trailingSpace: s.trailingSpace,
|
||||
trailingSpaceNewLine: s.trailingSpaceNewLine,
|
||||
md_inside: s.md_inside
|
||||
|
@ -711,10 +724,11 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|||
state.formatting = false;
|
||||
|
||||
if (stream.sol()) {
|
||||
var forceBlankLine = !!state.header;
|
||||
var forceBlankLine = !!state.header || state.hr;
|
||||
|
||||
// Reset state.header
|
||||
// Reset state.header and state.hr
|
||||
state.header = 0;
|
||||
state.hr = false;
|
||||
|
||||
if (stream.match(/^\s*$/, true) || forceBlankLine) {
|
||||
state.prevLineHasContent = false;
|
||||
|
|
122
public/vendor/codemirror/mode/markdown/test.js
vendored
122
public/vendor/codemirror/mode/markdown/test.js
vendored
|
@ -41,11 +41,11 @@
|
|||
"[variable-2&formatting&formatting-list&formatting-list-ol 1. ][variable-2 foo]");
|
||||
|
||||
FT("formatting_link",
|
||||
"[link&formatting&formatting-link [][link foo][link&formatting&formatting-link ]]][string&formatting&formatting-link-string (][string http://example.com/][string&formatting&formatting-link-string )]");
|
||||
"[link&formatting&formatting-link [][link foo][link&formatting&formatting-link ]]][string&formatting&formatting-link-string&url (][string&url http://example.com/][string&formatting&formatting-link-string&url )]");
|
||||
|
||||
FT("formatting_linkReference",
|
||||
"[link&formatting&formatting-link [][link foo][link&formatting&formatting-link ]]][string&formatting&formatting-link-string [][string bar][string&formatting&formatting-link-string ]]]",
|
||||
"[link&formatting&formatting-link [][link bar][link&formatting&formatting-link ]]:] [string http://example.com/]");
|
||||
"[link&formatting&formatting-link [][link foo][link&formatting&formatting-link ]]][string&formatting&formatting-link-string&url [][string&url bar][string&formatting&formatting-link-string&url ]]]",
|
||||
"[link&formatting&formatting-link [][link bar][link&formatting&formatting-link ]]:] [string&url http://example.com/]");
|
||||
|
||||
FT("formatting_linkWeb",
|
||||
"[link&formatting&formatting-link <][link http://example.com/][link&formatting&formatting-link >]");
|
||||
|
@ -85,13 +85,6 @@
|
|||
" [comment foo]",
|
||||
"bar");
|
||||
|
||||
// Code blocks using 4 spaces with internal indentation
|
||||
MT("codeBlocksUsing4SpacesIndentation",
|
||||
" foo",
|
||||
" [comment bar]",
|
||||
" [comment hello]",
|
||||
" [comment world]");
|
||||
|
||||
// Code blocks should end even after extra indented lines
|
||||
MT("codeBlocksWithTrailingIndentedLine",
|
||||
" [comment foo]",
|
||||
|
@ -104,6 +97,12 @@
|
|||
MT("codeBlocksUsing1Tab",
|
||||
"\t[comment foo]");
|
||||
|
||||
// No code blocks directly after paragraph
|
||||
// http://spec.commonmark.org/0.19/#example-65
|
||||
MT("noCodeBlocksAfterParagraph",
|
||||
"Foo",
|
||||
" Bar");
|
||||
|
||||
// Inline code using backticks
|
||||
MT("inlineCodeUsingBackticks",
|
||||
"foo [comment `bar`]");
|
||||
|
@ -166,10 +165,13 @@
|
|||
MT("atxH6",
|
||||
"[header&header-6 ###### foo]");
|
||||
|
||||
// H6 - 7x '#' should still be H6, per Dingus
|
||||
// http://daringfireball.net/projects/markdown/dingus
|
||||
MT("atxH6NotH7",
|
||||
"[header&header-6 ####### foo]");
|
||||
// http://spec.commonmark.org/0.19/#example-24
|
||||
MT("noAtxH7",
|
||||
"####### foo");
|
||||
|
||||
// http://spec.commonmark.org/0.19/#example-25
|
||||
MT("noAtxH1WithoutSpace",
|
||||
"#5 bolt");
|
||||
|
||||
// Inline styles should be parsed inside headers
|
||||
MT("atxH1inline",
|
||||
|
@ -202,6 +204,25 @@
|
|||
"foo",
|
||||
"[header&header-2 ---]");
|
||||
|
||||
// http://spec.commonmark.org/0.19/#example-45
|
||||
MT("setextH2AllowSpaces",
|
||||
"foo",
|
||||
" [header&header-2 ---- ]");
|
||||
|
||||
// http://spec.commonmark.org/0.19/#example-44
|
||||
MT("noSetextAfterIndentedCodeBlock",
|
||||
" [comment foo]",
|
||||
"[hr ---]");
|
||||
|
||||
// http://spec.commonmark.org/0.19/#example-51
|
||||
MT("noSetextAfterQuote",
|
||||
"[quote"e-1 > foo]",
|
||||
"[hr ---]");
|
||||
|
||||
MT("noSetextAfterList",
|
||||
"[variable-2 - foo]",
|
||||
"[hr ---]");
|
||||
|
||||
// Single-line blockquote with trailing space
|
||||
MT("blockquoteSpace",
|
||||
"[quote"e-1 > foo]");
|
||||
|
@ -251,6 +272,13 @@
|
|||
"",
|
||||
"hello");
|
||||
|
||||
// Header with leading space after continued blockquote (#3287, negative indentation)
|
||||
MT("headerAfterContinuedBlockquote",
|
||||
"[quote"e-1 > foo]",
|
||||
"[quote"e-1 bar]",
|
||||
"",
|
||||
" [header&header-1 # hello]");
|
||||
|
||||
// Check list types
|
||||
|
||||
MT("listAsterisk",
|
||||
|
@ -287,11 +315,21 @@
|
|||
"1. bar",
|
||||
"2. hello");
|
||||
|
||||
// List after hr
|
||||
MT("listAfterHr",
|
||||
"[hr ---]",
|
||||
"[variable-2 - bar]");
|
||||
|
||||
// List after header
|
||||
MT("listAfterHeader",
|
||||
"[header&header-1 # foo]",
|
||||
"[variable-2 - bar]");
|
||||
|
||||
// hr after list
|
||||
MT("hrAfterList",
|
||||
"[variable-2 - foo]",
|
||||
"[hr -----]");
|
||||
|
||||
// Formatting in lists (*)
|
||||
MT("listAsteriskFormatting",
|
||||
"[variable-2 * ][variable-2&em *foo*][variable-2 bar]",
|
||||
|
@ -498,39 +536,39 @@
|
|||
|
||||
// Inline link with title
|
||||
MT("linkTitle",
|
||||
"[link [[foo]]][string (http://example.com/ \"bar\")] hello");
|
||||
"[link [[foo]]][string&url (http://example.com/ \"bar\")] hello");
|
||||
|
||||
// Inline link without title
|
||||
MT("linkNoTitle",
|
||||
"[link [[foo]]][string (http://example.com/)] bar");
|
||||
"[link [[foo]]][string&url (http://example.com/)] bar");
|
||||
|
||||
// Inline link with image
|
||||
MT("linkImage",
|
||||
"[link [[][tag ![[foo]]][string (http://example.com/)][link ]]][string (http://example.com/)] bar");
|
||||
"[link [[][tag ![[foo]]][string&url (http://example.com/)][link ]]][string&url (http://example.com/)] bar");
|
||||
|
||||
// Inline link with Em
|
||||
MT("linkEm",
|
||||
"[link [[][link&em *foo*][link ]]][string (http://example.com/)] bar");
|
||||
"[link [[][link&em *foo*][link ]]][string&url (http://example.com/)] bar");
|
||||
|
||||
// Inline link with Strong
|
||||
MT("linkStrong",
|
||||
"[link [[][link&strong **foo**][link ]]][string (http://example.com/)] bar");
|
||||
"[link [[][link&strong **foo**][link ]]][string&url (http://example.com/)] bar");
|
||||
|
||||
// Inline link with EmStrong
|
||||
MT("linkEmStrong",
|
||||
"[link [[][link&strong **][link&em&strong *foo**][link&em *][link ]]][string (http://example.com/)] bar");
|
||||
"[link [[][link&strong **][link&em&strong *foo**][link&em *][link ]]][string&url (http://example.com/)] bar");
|
||||
|
||||
// Image with title
|
||||
MT("imageTitle",
|
||||
"[tag ![[foo]]][string (http://example.com/ \"bar\")] hello");
|
||||
"[tag ![[foo]]][string&url (http://example.com/ \"bar\")] hello");
|
||||
|
||||
// Image without title
|
||||
MT("imageNoTitle",
|
||||
"[tag ![[foo]]][string (http://example.com/)] bar");
|
||||
"[tag ![[foo]]][string&url (http://example.com/)] bar");
|
||||
|
||||
// Image with asterisks
|
||||
MT("imageAsterisks",
|
||||
"[tag ![[*foo*]]][string (http://example.com/)] bar");
|
||||
"[tag ![[*foo*]]][string&url (http://example.com/)] bar");
|
||||
|
||||
// Not a link. Should be normal text due to square brackets being used
|
||||
// regularly in text, especially in quoted material, and no space is allowed
|
||||
|
@ -540,24 +578,24 @@
|
|||
|
||||
// Reference-style links
|
||||
MT("linkReference",
|
||||
"[link [[foo]]][string [[bar]]] hello");
|
||||
"[link [[foo]]][string&url [[bar]]] hello");
|
||||
|
||||
// Reference-style links with Em
|
||||
MT("linkReferenceEm",
|
||||
"[link [[][link&em *foo*][link ]]][string [[bar]]] hello");
|
||||
"[link [[][link&em *foo*][link ]]][string&url [[bar]]] hello");
|
||||
|
||||
// Reference-style links with Strong
|
||||
MT("linkReferenceStrong",
|
||||
"[link [[][link&strong **foo**][link ]]][string [[bar]]] hello");
|
||||
"[link [[][link&strong **foo**][link ]]][string&url [[bar]]] hello");
|
||||
|
||||
// Reference-style links with EmStrong
|
||||
MT("linkReferenceEmStrong",
|
||||
"[link [[][link&strong **][link&em&strong *foo**][link&em *][link ]]][string [[bar]]] hello");
|
||||
"[link [[][link&strong **][link&em&strong *foo**][link&em *][link ]]][string&url [[bar]]] hello");
|
||||
|
||||
// Reference-style links with optional space separator (per docuentation)
|
||||
// "You can optionally use a space to separate the sets of brackets"
|
||||
MT("linkReferenceSpace",
|
||||
"[link [[foo]]] [string [[bar]]] hello");
|
||||
"[link [[foo]]] [string&url [[bar]]] hello");
|
||||
|
||||
// Should only allow a single space ("...use *a* space...")
|
||||
MT("linkReferenceDoubleSpace",
|
||||
|
@ -565,7 +603,7 @@
|
|||
|
||||
// Reference-style links with implicit link name
|
||||
MT("linkImplicit",
|
||||
"[link [[foo]]][string [[]]] hello");
|
||||
"[link [[foo]]][string&url [[]]] hello");
|
||||
|
||||
// @todo It would be nice if, at some point, the document was actually
|
||||
// checked to see if the referenced link exists
|
||||
|
@ -573,46 +611,46 @@
|
|||
// Link label, for reference-style links (taken from documentation)
|
||||
|
||||
MT("labelNoTitle",
|
||||
"[link [[foo]]:] [string http://example.com/]");
|
||||
"[link [[foo]]:] [string&url http://example.com/]");
|
||||
|
||||
MT("labelIndented",
|
||||
" [link [[foo]]:] [string http://example.com/]");
|
||||
" [link [[foo]]:] [string&url http://example.com/]");
|
||||
|
||||
MT("labelSpaceTitle",
|
||||
"[link [[foo bar]]:] [string http://example.com/ \"hello\"]");
|
||||
"[link [[foo bar]]:] [string&url http://example.com/ \"hello\"]");
|
||||
|
||||
MT("labelDoubleTitle",
|
||||
"[link [[foo bar]]:] [string http://example.com/ \"hello\"] \"world\"");
|
||||
"[link [[foo bar]]:] [string&url http://example.com/ \"hello\"] \"world\"");
|
||||
|
||||
MT("labelTitleDoubleQuotes",
|
||||
"[link [[foo]]:] [string http://example.com/ \"bar\"]");
|
||||
"[link [[foo]]:] [string&url http://example.com/ \"bar\"]");
|
||||
|
||||
MT("labelTitleSingleQuotes",
|
||||
"[link [[foo]]:] [string http://example.com/ 'bar']");
|
||||
"[link [[foo]]:] [string&url http://example.com/ 'bar']");
|
||||
|
||||
MT("labelTitleParenthese",
|
||||
"[link [[foo]]:] [string http://example.com/ (bar)]");
|
||||
"[link [[foo]]:] [string&url http://example.com/ (bar)]");
|
||||
|
||||
MT("labelTitleInvalid",
|
||||
"[link [[foo]]:] [string http://example.com/] bar");
|
||||
"[link [[foo]]:] [string&url http://example.com/] bar");
|
||||
|
||||
MT("labelLinkAngleBrackets",
|
||||
"[link [[foo]]:] [string <http://example.com/> \"bar\"]");
|
||||
"[link [[foo]]:] [string&url <http://example.com/> \"bar\"]");
|
||||
|
||||
MT("labelTitleNextDoubleQuotes",
|
||||
"[link [[foo]]:] [string http://example.com/]",
|
||||
"[link [[foo]]:] [string&url http://example.com/]",
|
||||
"[string \"bar\"] hello");
|
||||
|
||||
MT("labelTitleNextSingleQuotes",
|
||||
"[link [[foo]]:] [string http://example.com/]",
|
||||
"[link [[foo]]:] [string&url http://example.com/]",
|
||||
"[string 'bar'] hello");
|
||||
|
||||
MT("labelTitleNextParenthese",
|
||||
"[link [[foo]]:] [string http://example.com/]",
|
||||
"[link [[foo]]:] [string&url http://example.com/]",
|
||||
"[string (bar)] hello");
|
||||
|
||||
MT("labelTitleNextMixed",
|
||||
"[link [[foo]]:] [string http://example.com/]",
|
||||
"[link [[foo]]:] [string&url http://example.com/]",
|
||||
"(bar\" hello");
|
||||
|
||||
MT("linkWeb",
|
||||
|
|
72
public/vendor/codemirror/mode/mathematica/index.html
vendored
Executable file
72
public/vendor/codemirror/mode/mathematica/index.html
vendored
Executable file
|
@ -0,0 +1,72 @@
|
|||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: Mathematica 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=mathematica.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="#">Mathematica</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>Mathematica mode</h2>
|
||||
|
||||
|
||||
<textarea id="mathematicaCode">
|
||||
(* example Mathematica code *)
|
||||
(* Dualisiert wird anhand einer Polarität an einer
|
||||
Quadrik $x^t Q x = 0$ mit regulärer Matrix $Q$ (also
|
||||
mit $det(Q) \neq 0$), z.B. die Identitätsmatrix.
|
||||
$p$ ist eine Liste von Polynomen - ein Ideal. *)
|
||||
dualize::"singular" = "Q must be regular: found Det[Q]==0.";
|
||||
dualize[ Q_, p_ ] := Block[
|
||||
{ m, n, xv, lv, uv, vars, polys, dual },
|
||||
If[Det[Q] == 0,
|
||||
Message[dualize::"singular"],
|
||||
m = Length[p];
|
||||
n = Length[Q] - 1;
|
||||
xv = Table[Subscript[x, i], {i, 0, n}];
|
||||
lv = Table[Subscript[l, i], {i, 1, m}];
|
||||
uv = Table[Subscript[u, i], {i, 0, n}];
|
||||
(* Konstruiere Ideal polys. *)
|
||||
If[m == 0,
|
||||
polys = Q.uv,
|
||||
polys = Join[p, Q.uv - Transpose[Outer[D, p, xv]].lv]
|
||||
];
|
||||
(* Eliminiere die ersten n + 1 + m Variablen xv und lv
|
||||
aus dem Ideal polys. *)
|
||||
vars = Join[xv, lv];
|
||||
dual = GroebnerBasis[polys, uv, vars];
|
||||
(* Ersetze u mit x im Ergebnis. *)
|
||||
ReplaceAll[dual, Rule[u, x]]
|
||||
]
|
||||
]
|
||||
</textarea>
|
||||
|
||||
<script>
|
||||
var mathematicaEditor = CodeMirror.fromTextArea(document.getElementById('mathematicaCode'), {
|
||||
mode: 'text/x-mathematica',
|
||||
lineNumbers: true,
|
||||
matchBrackets: true
|
||||
});
|
||||
</script>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>text/x-mathematica</code> (Mathematica).</p>
|
||||
</article>
|
175
public/vendor/codemirror/mode/mathematica/mathematica.js
vendored
Executable file
175
public/vendor/codemirror/mode/mathematica/mathematica.js
vendored
Executable file
|
@ -0,0 +1,175 @@
|
|||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
// Mathematica mode copyright (c) 2015 by Calin Barbat
|
||||
// Based on code by Patrick Scheibe (halirutan)
|
||||
// See: https://github.com/halirutan/Mathematica-Source-Highlighting/tree/master/src/lang-mma.js
|
||||
|
||||
(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('mathematica', function(_config, _parserConfig) {
|
||||
|
||||
// used pattern building blocks
|
||||
var Identifier = '[a-zA-Z\\$][a-zA-Z0-9\\$]*';
|
||||
var pBase = "(?:\\d+)";
|
||||
var pFloat = "(?:\\.\\d+|\\d+\\.\\d*|\\d+)";
|
||||
var pFloatBase = "(?:\\.\\w+|\\w+\\.\\w*|\\w+)";
|
||||
var pPrecision = "(?:`(?:`?"+pFloat+")?)";
|
||||
|
||||
// regular expressions
|
||||
var reBaseForm = new RegExp('(?:'+pBase+'(?:\\^\\^'+pFloatBase+pPrecision+'?(?:\\*\\^[+-]?\\d+)?))');
|
||||
var reFloatForm = new RegExp('(?:' + pFloat + pPrecision + '?(?:\\*\\^[+-]?\\d+)?)');
|
||||
var reIdInContext = new RegExp('(?:`?)(?:' + Identifier + ')(?:`(?:' + Identifier + '))*(?:`?)');
|
||||
|
||||
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.commentLevel++;
|
||||
state.tokenize = tokenComment;
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
}
|
||||
|
||||
// go back one character
|
||||
stream.backUp(1);
|
||||
|
||||
// look for numbers
|
||||
// Numbers in a baseform
|
||||
if (stream.match(reBaseForm, true, false)) {
|
||||
return 'number';
|
||||
}
|
||||
|
||||
// Mathematica numbers. Floats (1.2, .2, 1.) can have optionally a precision (`float) or an accuracy definition
|
||||
// (``float). Note: while 1.2` is possible 1.2`` is not. At the end an exponent (float*^+12) can follow.
|
||||
if (stream.match(reFloatForm, true, false)) {
|
||||
return 'number';
|
||||
}
|
||||
|
||||
/* In[23] and Out[34] */
|
||||
if (stream.match(/(?:In|Out)\[[0-9]*\]/, true, false)) {
|
||||
return 'atom';
|
||||
}
|
||||
|
||||
// usage
|
||||
if (stream.match(/([a-zA-Z\$]+(?:`?[a-zA-Z0-9\$])*::usage)/, true, false)) {
|
||||
return 'meta';
|
||||
}
|
||||
|
||||
// message
|
||||
if (stream.match(/([a-zA-Z\$]+(?:`?[a-zA-Z0-9\$])*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/, true, false)) {
|
||||
return 'string-2';
|
||||
}
|
||||
|
||||
// this makes a look-ahead match for something like variable:{_Integer}
|
||||
// the match is then forwarded to the mma-patterns tokenizer.
|
||||
if (stream.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/, true, false)) {
|
||||
return 'variable-2';
|
||||
}
|
||||
|
||||
// catch variables which are used together with Blank (_), BlankSequence (__) or BlankNullSequence (___)
|
||||
// Cannot start with a number, but can have numbers at any other position. Examples
|
||||
// blub__Integer, a1_, b34_Integer32
|
||||
if (stream.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/, true, false)) {
|
||||
return 'variable-2';
|
||||
}
|
||||
if (stream.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/, true, false)) {
|
||||
return 'variable-2';
|
||||
}
|
||||
if (stream.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/, true, false)) {
|
||||
return 'variable-2';
|
||||
}
|
||||
|
||||
// Named characters in Mathematica, like \[Gamma].
|
||||
if (stream.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/, true, false)) {
|
||||
return 'variable-3';
|
||||
}
|
||||
|
||||
// Match all braces separately
|
||||
if (stream.match(/(?:\[|\]|{|}|\(|\))/, true, false)) {
|
||||
return 'bracket';
|
||||
}
|
||||
|
||||
// Catch Slots (#, ##, #3, ##9 and the V10 named slots #name). I have never seen someone using more than one digit after #, so we match
|
||||
// only one.
|
||||
if (stream.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/, true, false)) {
|
||||
return 'variable-2';
|
||||
}
|
||||
|
||||
// Literals like variables, keywords, functions
|
||||
if (stream.match(reIdInContext, true, false)) {
|
||||
return 'keyword';
|
||||
}
|
||||
|
||||
// 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(state.commentLevel > 0 && (next = stream.next()) != null) {
|
||||
if (prev === '(' && next === '*') state.commentLevel++;
|
||||
if (prev === '*' && next === ')') state.commentLevel--;
|
||||
prev = next;
|
||||
}
|
||||
if (state.commentLevel <= 0) {
|
||||
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: "*)"
|
||||
};
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME('text/x-mathematica', {
|
||||
name: 'mathematica'
|
||||
});
|
||||
|
||||
});
|
8
public/vendor/codemirror/mode/meta.js
vendored
8
public/vendor/codemirror/mode/meta.js
vendored
|
@ -14,6 +14,7 @@
|
|||
CodeMirror.modeInfo = [
|
||||
{name: "APL", mime: "text/apl", mode: "apl", ext: ["dyalog", "apl"]},
|
||||
{name: "PGP", mimes: ["application/pgp", "application/pgp-keys", "application/pgp-signature"], mode: "asciiarmor", ext: ["pgp"]},
|
||||
{name: "ASN.1", mime: "text/x-ttcn-asn", mode: "asn.1", ext: ["asn, asn1"]},
|
||||
{name: "Asterisk", mime: "text/x-asterisk", mode: "asterisk", file: /^extensions\.conf$/i},
|
||||
{name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h"]},
|
||||
{name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"], alias: ["cpp"]},
|
||||
|
@ -37,9 +38,11 @@
|
|||
{name: "EBNF", mime: "text/x-ebnf", mode: "ebnf"},
|
||||
{name: "ECL", mime: "text/x-ecl", mode: "ecl", ext: ["ecl"]},
|
||||
{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: "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"]},
|
||||
|
@ -72,6 +75,7 @@
|
|||
{name: "Markdown", mime: "text/x-markdown", mode: "markdown", ext: ["markdown", "md", "mkd"]},
|
||||
{name: "mIRC", mime: "text/mirc", mode: "mirc"},
|
||||
{name: "MariaDB SQL", mime: "text/x-mariadb", mode: "sql"},
|
||||
{name: "Mathematica", mime: "text/x-mathematica", mode: "mathematica", ext: ["m", "nb"]},
|
||||
{name: "Modelica", mime: "text/x-modelica", mode: "modelica", ext: ["mo"]},
|
||||
{name: "MUMPS", mime: "text/x-mumps", mode: "mumps"},
|
||||
{name: "MS SQL", mime: "text/x-mssql", mode: "sql"},
|
||||
|
@ -112,6 +116,7 @@
|
|||
{name: "SPARQL", mime: "application/sparql-query", mode: "sparql", ext: ["rq", "sparql"], alias: ["sparul"]},
|
||||
{name: "Spreadsheet", mime: "text/x-spreadsheet", mode: "spreadsheet", alias: ["excel", "formula"]},
|
||||
{name: "SQL", mime: "text/x-sql", mode: "sql", ext: ["sql"]},
|
||||
{name: "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"]},
|
||||
|
@ -123,8 +128,11 @@
|
|||
{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: "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: "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"]},
|
||||
|
|
36
public/vendor/codemirror/mode/php/php.js
vendored
36
public/vendor/codemirror/mode/php/php.js
vendored
|
@ -17,31 +17,31 @@
|
|||
return obj;
|
||||
}
|
||||
|
||||
// Helper for stringWithEscapes
|
||||
function matchSequence(list, end) {
|
||||
if (list.length == 0) return stringWithEscapes(end);
|
||||
// Helper for phpString
|
||||
function matchSequence(list, end, escapes) {
|
||||
if (list.length == 0) return phpString(end);
|
||||
return function (stream, state) {
|
||||
var patterns = list[0];
|
||||
for (var i = 0; i < patterns.length; i++) if (stream.match(patterns[i][0])) {
|
||||
state.tokenize = matchSequence(list.slice(1), end);
|
||||
return patterns[i][1];
|
||||
}
|
||||
state.tokenize = stringWithEscapes(end);
|
||||
state.tokenize = phpString(end, escapes);
|
||||
return "string";
|
||||
};
|
||||
}
|
||||
function stringWithEscapes(closing) {
|
||||
return function(stream, state) { return stringWithEscapes_(stream, state, closing); };
|
||||
function phpString(closing, escapes) {
|
||||
return function(stream, state) { return phpString_(stream, state, closing, escapes); };
|
||||
}
|
||||
function stringWithEscapes_(stream, state, closing) {
|
||||
function phpString_(stream, state, closing, escapes) {
|
||||
// "Complex" syntax
|
||||
if (stream.match("${", false) || stream.match("{$", false)) {
|
||||
if (escapes !== false && stream.match("${", false) || stream.match("{$", false)) {
|
||||
state.tokenize = null;
|
||||
return "string";
|
||||
}
|
||||
|
||||
// Simple syntax
|
||||
if (stream.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/)) {
|
||||
if (escapes !== false && stream.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/)) {
|
||||
// After the variable name there may appear array or object operator.
|
||||
if (stream.match("[", false)) {
|
||||
// Match array operator
|
||||
|
@ -51,14 +51,14 @@
|
|||
[/\$[a-zA-Z_][a-zA-Z0-9_]*/, "variable-2"],
|
||||
[/[\w\$]+/, "variable"]],
|
||||
[["]", null]]
|
||||
], closing);
|
||||
], closing, escapes);
|
||||
}
|
||||
if (stream.match(/\-\>\w/, false)) {
|
||||
// Match object operator
|
||||
state.tokenize = matchSequence([
|
||||
[["->", null]],
|
||||
[[/[\w]+/, "variable"]]
|
||||
], closing);
|
||||
], closing, escapes);
|
||||
}
|
||||
return "variable-2";
|
||||
}
|
||||
|
@ -66,7 +66,8 @@
|
|||
var escaped = false;
|
||||
// Normal string
|
||||
while (!stream.eol() &&
|
||||
(escaped || (!stream.match("{$", false) &&
|
||||
(escaped || escapes === false ||
|
||||
(!stream.match("{$", false) &&
|
||||
!stream.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/, false)))) {
|
||||
if (!escaped && stream.match(closing)) {
|
||||
state.tokenize = null;
|
||||
|
@ -94,6 +95,7 @@
|
|||
helperType: "php",
|
||||
keywords: keywords(phpKeywords),
|
||||
blockKeywords: keywords("catch do else elseif for foreach if switch try while finally"),
|
||||
defKeywords: keywords("class function interface namespace trait"),
|
||||
atoms: keywords(phpAtoms),
|
||||
builtin: keywords(phpBuiltin),
|
||||
multiLineStrings: true,
|
||||
|
@ -104,11 +106,13 @@
|
|||
},
|
||||
"<": function(stream, state) {
|
||||
if (stream.match(/<</)) {
|
||||
var nowDoc = stream.eat("'");
|
||||
stream.eatWhile(/[\w\.]/);
|
||||
var delim = stream.current().slice(3);
|
||||
var delim = stream.current().slice(3 + (nowDoc ? 1 : 0));
|
||||
if (nowDoc) stream.eat("'");
|
||||
if (delim) {
|
||||
(state.tokStack || (state.tokStack = [])).push(delim, 0);
|
||||
state.tokenize = stringWithEscapes(delim);
|
||||
state.tokenize = phpString(delim, nowDoc ? false : true);
|
||||
return "string";
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +131,7 @@
|
|||
},
|
||||
'"': function(_stream, state) {
|
||||
(state.tokStack || (state.tokStack = [])).push('"', 0);
|
||||
state.tokenize = stringWithEscapes('"');
|
||||
state.tokenize = phpString('"');
|
||||
return "string";
|
||||
},
|
||||
"{": function(_stream, state) {
|
||||
|
@ -138,7 +142,7 @@
|
|||
"}": function(_stream, state) {
|
||||
if (state.tokStack && state.tokStack.length > 0 &&
|
||||
!--state.tokStack[state.tokStack.length - 1]) {
|
||||
state.tokenize = stringWithEscapes(state.tokStack[state.tokStack.length - 2]);
|
||||
state.tokenize = phpString(state.tokStack[state.tokStack.length - 2]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
38
public/vendor/codemirror/mode/pig/pig.js
vendored
38
public/vendor/codemirror/mode/pig/pig.js
vendored
|
@ -30,12 +30,6 @@ CodeMirror.defineMode("pig", function(_config, parserConfig) {
|
|||
return f(stream, state);
|
||||
}
|
||||
|
||||
var type;
|
||||
function ret(tp, style) {
|
||||
type = tp;
|
||||
return style;
|
||||
}
|
||||
|
||||
function tokenComment(stream, state) {
|
||||
var isEnd = false;
|
||||
var ch;
|
||||
|
@ -46,7 +40,7 @@ CodeMirror.defineMode("pig", function(_config, parserConfig) {
|
|||
}
|
||||
isEnd = (ch == "*");
|
||||
}
|
||||
return ret("comment", "comment");
|
||||
return "comment";
|
||||
}
|
||||
|
||||
function tokenString(quote) {
|
||||
|
@ -60,10 +54,11 @@ CodeMirror.defineMode("pig", function(_config, parserConfig) {
|
|||
}
|
||||
if (end || !(escaped || multiLineStrings))
|
||||
state.tokenize = tokenBase;
|
||||
return ret("string", "error");
|
||||
return "error";
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function tokenBase(stream, state) {
|
||||
var ch = stream.next();
|
||||
|
||||
|
@ -72,11 +67,11 @@ CodeMirror.defineMode("pig", function(_config, parserConfig) {
|
|||
return chain(stream, state, tokenString(ch));
|
||||
// is it one of the special chars
|
||||
else if(/[\[\]{}\(\),;\.]/.test(ch))
|
||||
return ret(ch);
|
||||
return null;
|
||||
// is it a number?
|
||||
else if(/\d/.test(ch)) {
|
||||
stream.eatWhile(/[\w\.]/);
|
||||
return ret("number", "number");
|
||||
return "number";
|
||||
}
|
||||
// multi line comment or operator
|
||||
else if (ch == "/") {
|
||||
|
@ -85,47 +80,42 @@ CodeMirror.defineMode("pig", function(_config, parserConfig) {
|
|||
}
|
||||
else {
|
||||
stream.eatWhile(isOperatorChar);
|
||||
return ret("operator", "operator");
|
||||
return "operator";
|
||||
}
|
||||
}
|
||||
// single line comment or operator
|
||||
else if (ch=="-") {
|
||||
if(stream.eat("-")){
|
||||
stream.skipToEnd();
|
||||
return ret("comment", "comment");
|
||||
return "comment";
|
||||
}
|
||||
else {
|
||||
stream.eatWhile(isOperatorChar);
|
||||
return ret("operator", "operator");
|
||||
return "operator";
|
||||
}
|
||||
}
|
||||
// is it an operator
|
||||
else if (isOperatorChar.test(ch)) {
|
||||
stream.eatWhile(isOperatorChar);
|
||||
return ret("operator", "operator");
|
||||
return "operator";
|
||||
}
|
||||
else {
|
||||
// get the while word
|
||||
stream.eatWhile(/[\w\$_]/);
|
||||
// is it one of the listed keywords?
|
||||
if (keywords && keywords.propertyIsEnumerable(stream.current().toUpperCase())) {
|
||||
if (stream.eat(")") || stream.eat(".")) {
|
||||
//keywords can be used as variables like flatten(group), group.$0 etc..
|
||||
}
|
||||
else {
|
||||
return ("keyword", "keyword");
|
||||
}
|
||||
if (!stream.eat(")") && !stream.eat("."))
|
||||
return "keyword";
|
||||
}
|
||||
// is it one of the builtin functions?
|
||||
if (builtins && builtins.propertyIsEnumerable(stream.current().toUpperCase()))
|
||||
{
|
||||
return ("keyword", "variable-2");
|
||||
}
|
||||
return "variable-2";
|
||||
// is it one of the listed types?
|
||||
if (types && types.propertyIsEnumerable(stream.current().toUpperCase()))
|
||||
return ("keyword", "variable-3");
|
||||
return "variable-3";
|
||||
// default is a 'variable'
|
||||
return ret("variable", "pig-word");
|
||||
return "variable";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
"unichr", "unicode", "xrange", "False", "True", "None"],
|
||||
keywords: ["exec", "print"]};
|
||||
var py3 = {builtins: ["ascii", "bytes", "exec", "print"],
|
||||
keywords: ["nonlocal", "False", "True", "None"]};
|
||||
keywords: ["nonlocal", "False", "True", "None", "async", "await"]};
|
||||
|
||||
CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins));
|
||||
|
||||
|
|
4
public/vendor/codemirror/mode/sql/sql.js
vendored
4
public/vendor/codemirror/mode/sql/sql.js
vendored
|
@ -257,7 +257,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
|
|||
}
|
||||
|
||||
// these keywords are used by all SQL dialects (however, a mode can still overwrite it)
|
||||
var sqlKeywords = "alter and as asc between by count create delete desc distinct drop from having in insert into is join like not on or order select set table union update values where ";
|
||||
var sqlKeywords = "alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where ";
|
||||
|
||||
// turn a space-separated list into an array
|
||||
function set(str) {
|
||||
|
@ -293,7 +293,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
|
|||
CodeMirror.defineMIME("text/x-mysql", {
|
||||
name: "sql",
|
||||
client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),
|
||||
keywords: set(sqlKeywords + "accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group groupby_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
|
||||
keywords: set(sqlKeywords + "accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group group_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
|
||||
builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),
|
||||
atoms: set("false true null unknown"),
|
||||
operatorChars: /^[*+\-%<>!=&|^]/,
|
||||
|
|
88
public/vendor/codemirror/mode/swift/index.html
vendored
Executable file
88
public/vendor/codemirror/mode/swift/index.html
vendored
Executable file
|
@ -0,0 +1,88 @@
|
|||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: Swift 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="./swift.js"></script>
|
||||
<style>
|
||||
.CodeMirror { border: 2px inset #dee; }
|
||||
</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="#">Swift</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>Swift mode</h2>
|
||||
<form><textarea id="code" name="code">
|
||||
//
|
||||
// TipCalculatorModel.swift
|
||||
// TipCalculator
|
||||
//
|
||||
// Created by Main Account on 12/18/14.
|
||||
// Copyright (c) 2014 Razeware LLC. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
class TipCalculatorModel {
|
||||
|
||||
var total: Double
|
||||
var taxPct: Double
|
||||
var subtotal: Double {
|
||||
get {
|
||||
return total / (taxPct + 1)
|
||||
}
|
||||
}
|
||||
|
||||
init(total: Double, taxPct: Double) {
|
||||
self.total = total
|
||||
self.taxPct = taxPct
|
||||
}
|
||||
|
||||
func calcTipWithTipPct(tipPct: Double) -> Double {
|
||||
return subtotal * tipPct
|
||||
}
|
||||
|
||||
func returnPossibleTips() -> [Int: Double] {
|
||||
|
||||
let possibleTipsInferred = [0.15, 0.18, 0.20]
|
||||
let possibleTipsExplicit:[Double] = [0.15, 0.18, 0.20]
|
||||
|
||||
var retval = [Int: Double]()
|
||||
for possibleTip in possibleTipsInferred {
|
||||
let intPct = Int(possibleTip*100)
|
||||
retval[intPct] = calcTipWithTipPct(possibleTip)
|
||||
}
|
||||
return retval
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
</textarea></form>
|
||||
|
||||
<script>
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
mode: "text/x-swift"
|
||||
});
|
||||
</script>
|
||||
|
||||
<p>A simple mode for Swift</p>
|
||||
|
||||
<p><strong>MIME types defined:</strong> <code>text/x-swift</code> (Swift code)</p>
|
||||
</article>
|
203
public/vendor/codemirror/mode/swift/swift.js
vendored
Executable file
203
public/vendor/codemirror/mode/swift/swift.js
vendored
Executable file
|
@ -0,0 +1,203 @@
|
|||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
// Swift mode created by Michael Kaminsky https://github.com/mkaminsky11
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object")
|
||||
mod(require("../../lib/codemirror"))
|
||||
else if (typeof define == "function" && define.amd)
|
||||
define(["../../lib/codemirror"], mod)
|
||||
else
|
||||
mod(CodeMirror)
|
||||
})(function(CodeMirror) {
|
||||
"use strict"
|
||||
|
||||
function trim(str) { return /^\s*(.*?)\s*$/.exec(str)[1] }
|
||||
|
||||
var separators = [" ","\\\+","\\\-","\\\(","\\\)","\\\*","/",":","\\\?","\\\<","\\\>"," ","\\\."]
|
||||
var tokens = new RegExp(separators.join("|"),"g")
|
||||
|
||||
function getWord(string, pos) {
|
||||
var index = -1, count = 1
|
||||
var words = string.split(tokens)
|
||||
for (var i = 0; i < words.length; i++) {
|
||||
for(var j = 1; j <= words[i].length; j++) {
|
||||
if (count==pos) index = i
|
||||
count++
|
||||
}
|
||||
count++
|
||||
}
|
||||
var ret = ["", ""]
|
||||
if (pos == 0) {
|
||||
ret[1] = words[0]
|
||||
ret[0] = null
|
||||
} else {
|
||||
ret[1] = words[index]
|
||||
ret[0] = words[index-1]
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
CodeMirror.defineMode("swift", function() {
|
||||
var keywords=["var","let","class","deinit","enum","extension","func","import","init","let","protocol","static","struct","subscript","typealias","var","as","dynamicType","is","new","super","self","Self","Type","__COLUMN__","__FILE__","__FUNCTION__","__LINE__","break","case","continue","default","do","else","fallthrough","if","in","for","return","switch","where","while","associativity","didSet","get","infix","inout","left","mutating","none","nonmutating","operator","override","postfix","precedence","prefix","right","set","unowned","unowned(safe)","unowned(unsafe)","weak","willSet"]
|
||||
var commonConstants=["Infinity","NaN","undefined","null","true","false","on","off","yes","no","nil","null","this","super"]
|
||||
var types=["String","bool","int","string","double","Double","Int","Float","float","public","private","extension"]
|
||||
var numbers=["0","1","2","3","4","5","6","7","8","9"]
|
||||
var operators=["+","-","/","*","%","=","|","&","<",">"]
|
||||
var punc=[";",",",".","(",")","{","}","[","]"]
|
||||
var delimiters=/^(?:[()\[\]{},:`=;]|\.\.?\.?)/
|
||||
var identifiers=/^[_A-Za-z$][_A-Za-z$0-9]*/
|
||||
var properties=/^(@|this\.)[_A-Za-z$][_A-Za-z$0-9]*/
|
||||
var regexPrefixes=/^(\/{3}|\/)/
|
||||
|
||||
return {
|
||||
startState: function() {
|
||||
return {
|
||||
prev: false,
|
||||
string: false,
|
||||
escape: false,
|
||||
inner: false,
|
||||
comment: false,
|
||||
num_left: 0,
|
||||
num_right: 0,
|
||||
doubleString: false,
|
||||
singleString: false
|
||||
}
|
||||
},
|
||||
token: function(stream, state) {
|
||||
if (stream.eatSpace()) return null
|
||||
|
||||
var ch = stream.next()
|
||||
if (state.string) {
|
||||
if (state.escape) {
|
||||
state.escape = false
|
||||
return "string"
|
||||
} else {
|
||||
if ((ch == "\"" && (state.doubleString && !state.singleString) ||
|
||||
(ch == "'" && (!state.doubleString && state.singleString))) &&
|
||||
!state.escape) {
|
||||
state.string = false
|
||||
state.doubleString = false
|
||||
state.singleString = false
|
||||
return "string"
|
||||
} else if (ch == "\\" && stream.peek() == "(") {
|
||||
state.inner = true
|
||||
state.string = false
|
||||
return "keyword"
|
||||
} else if (ch == "\\" && stream.peek() != "(") {
|
||||
state.escape = true
|
||||
state.string = true
|
||||
return "string"
|
||||
} else {
|
||||
return "string"
|
||||
}
|
||||
}
|
||||
} else if (state.comment) {
|
||||
if (ch == "*" && stream.peek() == "/") {
|
||||
state.prev = "*"
|
||||
return "comment"
|
||||
} else if (ch == "/" && state.prev == "*") {
|
||||
state.prev = false
|
||||
state.comment = false
|
||||
return "comment"
|
||||
}
|
||||
return "comment"
|
||||
} else {
|
||||
if (ch == "/") {
|
||||
if (stream.peek() == "/") {
|
||||
stream.skipToEnd()
|
||||
return "comment"
|
||||
}
|
||||
if (stream.peek() == "*") {
|
||||
state.comment = true
|
||||
return "comment"
|
||||
}
|
||||
}
|
||||
if (ch == "(" && state.inner) {
|
||||
state.num_left++
|
||||
return null
|
||||
}
|
||||
if (ch == ")" && state.inner) {
|
||||
state.num_right++
|
||||
if (state.num_left == state.num_right) {
|
||||
state.inner=false
|
||||
state.string=true
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
var ret = getWord(stream.string, stream.pos)
|
||||
var the_word = ret[1]
|
||||
var prev_word = ret[0]
|
||||
|
||||
if (operators.indexOf(ch + "") > -1) return "operator"
|
||||
if (punc.indexOf(ch) > -1) return "punctuation"
|
||||
|
||||
if (typeof the_word != "undefined") {
|
||||
the_word = trim(the_word)
|
||||
if (typeof prev_word != "undefined") prev_word = trim(prev_word)
|
||||
if (the_word.charAt(0) == "#") return null
|
||||
|
||||
if (types.indexOf(the_word) > -1) return "def"
|
||||
if (commonConstants.indexOf(the_word) > -1) return "atom"
|
||||
if (numbers.indexOf(the_word) > -1) return "number"
|
||||
|
||||
if ((numbers.indexOf(the_word.charAt(0) + "") > -1 ||
|
||||
operators.indexOf(the_word.charAt(0) + "") > -1) &&
|
||||
numbers.indexOf(ch) > -1) {
|
||||
return "number"
|
||||
}
|
||||
|
||||
if (keywords.indexOf(the_word) > -1 ||
|
||||
keywords.indexOf(the_word.split(tokens)[0]) > -1)
|
||||
return "keyword"
|
||||
if (keywords.indexOf(prev_word) > -1) return "def"
|
||||
}
|
||||
if (ch == '"' && !state.doubleString) {
|
||||
state.string = true
|
||||
state.doubleString = true
|
||||
return "string"
|
||||
}
|
||||
if (ch == "'" && !state.singleString) {
|
||||
state.string = true
|
||||
state.singleString = true
|
||||
return "string"
|
||||
}
|
||||
if (ch == "(" && state.inner)
|
||||
state.num_left++
|
||||
if (ch == ")" && state.inner) {
|
||||
state.num_right++
|
||||
if (state.num_left == state.num_right) {
|
||||
state.inner = false
|
||||
state.string = true
|
||||
}
|
||||
return null
|
||||
}
|
||||
if (stream.match(/^-?[0-9\.]/, false)) {
|
||||
if (stream.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i) ||
|
||||
stream.match(/^-?\d+\.\d*/) ||
|
||||
stream.match(/^-?\.\d+/)) {
|
||||
if (stream.peek() == ".") stream.backUp(1)
|
||||
return "number"
|
||||
}
|
||||
if (stream.match(/^-?0x[0-9a-f]+/i) ||
|
||||
stream.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/) ||
|
||||
stream.match(/^-?0(?![\dx])/i))
|
||||
return "number"
|
||||
}
|
||||
if (stream.match(regexPrefixes)) {
|
||||
if (stream.current()!="/" || stream.match(/^.*\//,false)) return "string"
|
||||
else stream.backUp(1)
|
||||
}
|
||||
if (stream.match(delimiters)) return "punctuation"
|
||||
if (stream.match(identifiers)) return "variable"
|
||||
if (stream.match(properties)) return "property"
|
||||
return "variable"
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
CodeMirror.defineMIME("text/x-swift","swift")
|
||||
})
|
|
@ -71,16 +71,6 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
return f(stream, state);
|
||||
}
|
||||
|
||||
// Used as scratch variables to communicate multiple values without
|
||||
// consing up tons of objects.
|
||||
var type, content;
|
||||
|
||||
function ret(tp, style, cont) {
|
||||
type = tp;
|
||||
content = cont;
|
||||
return style;
|
||||
}
|
||||
|
||||
function jsTokenBase(stream, state) {
|
||||
var sol = stream.sol(), ch;
|
||||
|
||||
|
@ -95,16 +85,16 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
return chain(stream, state, twTokenCode);
|
||||
}
|
||||
if (stream.match(reBlockQuote)) {
|
||||
return ret('quote', 'quote');
|
||||
return 'quote';
|
||||
}
|
||||
if (stream.match(reWikiCommentStart) || stream.match(reWikiCommentStop)) {
|
||||
return ret('code', 'comment');
|
||||
return 'comment';
|
||||
}
|
||||
if (stream.match(reJsCodeStart) || stream.match(reJsCodeStop) || stream.match(reXmlCodeStart) || stream.match(reXmlCodeStop)) {
|
||||
return ret('code', 'comment');
|
||||
return 'comment';
|
||||
}
|
||||
if (stream.match(reHR)) {
|
||||
return ret('hr', 'hr');
|
||||
return 'hr';
|
||||
}
|
||||
} // sol
|
||||
ch = stream.next();
|
||||
|
@ -112,30 +102,30 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
if (sol && /[\/\*!#;:>|]/.test(ch)) {
|
||||
if (ch == "!") { // tw header
|
||||
stream.skipToEnd();
|
||||
return ret("header", "header");
|
||||
return "header";
|
||||
}
|
||||
if (ch == "*") { // tw list
|
||||
stream.eatWhile('*');
|
||||
return ret("list", "comment");
|
||||
return "comment";
|
||||
}
|
||||
if (ch == "#") { // tw numbered list
|
||||
stream.eatWhile('#');
|
||||
return ret("list", "comment");
|
||||
return "comment";
|
||||
}
|
||||
if (ch == ";") { // definition list, term
|
||||
stream.eatWhile(';');
|
||||
return ret("list", "comment");
|
||||
return "comment";
|
||||
}
|
||||
if (ch == ":") { // definition list, description
|
||||
stream.eatWhile(':');
|
||||
return ret("list", "comment");
|
||||
return "comment";
|
||||
}
|
||||
if (ch == ">") { // single line quote
|
||||
stream.eatWhile(">");
|
||||
return ret("quote", "quote");
|
||||
return "quote";
|
||||
}
|
||||
if (ch == '|') {
|
||||
return ret('table', 'header');
|
||||
return 'header';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,29 +136,29 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
// 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 ret("link", "link");
|
||||
return "link";
|
||||
}
|
||||
}
|
||||
// just a little string indicator, don't want to have the whole string covered
|
||||
if (ch == '"') {
|
||||
return ret('string', 'string');
|
||||
return 'string';
|
||||
}
|
||||
if (ch == '~') { // _no_ CamelCase indicator should be bold
|
||||
return ret('text', 'brace');
|
||||
return 'brace';
|
||||
}
|
||||
if (/[\[\]]/.test(ch)) { // check for [[..]]
|
||||
if (stream.peek() == ch) {
|
||||
stream.next();
|
||||
return ret('brace', 'brace');
|
||||
return 'brace';
|
||||
}
|
||||
}
|
||||
if (ch == "@") { // check for space link. TODO fix @@...@@ highlighting
|
||||
stream.eatWhile(isSpaceName);
|
||||
return ret("link", "link");
|
||||
return "link";
|
||||
}
|
||||
if (/\d/.test(ch)) { // numbers
|
||||
stream.eatWhile(/\d/);
|
||||
return ret("number", "number");
|
||||
return "number";
|
||||
}
|
||||
if (ch == "/") { // tw invisible comment
|
||||
if (stream.eat("%")) {
|
||||
|
@ -191,7 +181,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
return chain(stream, state, twTokenStrike);
|
||||
// mdash
|
||||
if (stream.peek() == ' ')
|
||||
return ret('text', 'brace');
|
||||
return 'brace';
|
||||
}
|
||||
}
|
||||
if (ch == "'") { // tw bold
|
||||
|
@ -205,7 +195,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
}
|
||||
}
|
||||
else {
|
||||
return ret(ch);
|
||||
return null;
|
||||
}
|
||||
|
||||
// core macro handling
|
||||
|
@ -213,8 +203,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
var word = stream.current(),
|
||||
known = textwords.propertyIsEnumerable(word) && textwords[word];
|
||||
|
||||
return known ? ret(known.type, known.style, word) : ret("text", null, word);
|
||||
|
||||
return known ? known.style : null;
|
||||
} // jsTokenBase()
|
||||
|
||||
// tw invisible comment
|
||||
|
@ -228,7 +217,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
}
|
||||
maybeEnd = (ch == "%");
|
||||
}
|
||||
return ret("comment", "comment");
|
||||
return "comment";
|
||||
}
|
||||
|
||||
// tw strong / bold
|
||||
|
@ -242,29 +231,29 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
}
|
||||
maybeEnd = (ch == "'");
|
||||
}
|
||||
return ret("text", "strong");
|
||||
return "strong";
|
||||
}
|
||||
|
||||
// tw code
|
||||
function twTokenCode(stream, state) {
|
||||
var ch, sb = state.block;
|
||||
var sb = state.block;
|
||||
|
||||
if (sb && stream.current()) {
|
||||
return ret("code", "comment");
|
||||
return "comment";
|
||||
}
|
||||
|
||||
if (!sb && stream.match(reUntilCodeStop)) {
|
||||
state.tokenize = jsTokenBase;
|
||||
return ret("code", "comment");
|
||||
return "comment";
|
||||
}
|
||||
|
||||
if (sb && stream.sol() && stream.match(reCodeBlockStop)) {
|
||||
state.tokenize = jsTokenBase;
|
||||
return ret("code", "comment");
|
||||
return "comment";
|
||||
}
|
||||
|
||||
ch = stream.next();
|
||||
return (sb) ? ret("code", "comment") : ret("code", "comment");
|
||||
stream.next();
|
||||
return "comment";
|
||||
}
|
||||
|
||||
// tw em / italic
|
||||
|
@ -278,7 +267,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
}
|
||||
maybeEnd = (ch == "/");
|
||||
}
|
||||
return ret("text", "em");
|
||||
return "em";
|
||||
}
|
||||
|
||||
// tw underlined text
|
||||
|
@ -292,7 +281,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
}
|
||||
maybeEnd = (ch == "_");
|
||||
}
|
||||
return ret("text", "underlined");
|
||||
return "underlined";
|
||||
}
|
||||
|
||||
// tw strike through text looks ugly
|
||||
|
@ -307,7 +296,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
}
|
||||
maybeEnd = (ch == "-");
|
||||
}
|
||||
return ret("text", "strikethrough");
|
||||
return "strikethrough";
|
||||
}
|
||||
|
||||
// macro
|
||||
|
@ -315,19 +304,19 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
var ch, word, known;
|
||||
|
||||
if (stream.current() == '<<') {
|
||||
return ret('brace', 'macro');
|
||||
return 'macro';
|
||||
}
|
||||
|
||||
ch = stream.next();
|
||||
if (!ch) {
|
||||
state.tokenize = jsTokenBase;
|
||||
return ret(ch);
|
||||
return null;
|
||||
}
|
||||
if (ch == ">") {
|
||||
if (stream.peek() == '>') {
|
||||
stream.next();
|
||||
state.tokenize = jsTokenBase;
|
||||
return ret("brace", "macro");
|
||||
return "macro";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -336,10 +325,10 @@ CodeMirror.defineMode("tiddlywiki", function () {
|
|||
known = keywords.propertyIsEnumerable(word) && keywords[word];
|
||||
|
||||
if (known) {
|
||||
return ret(known.type, known.style, word);
|
||||
return known.style, word;
|
||||
}
|
||||
else {
|
||||
return ret("macro", null, word);
|
||||
return null, word;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
27
public/vendor/codemirror/mode/tiki/tiki.js
vendored
27
public/vendor/codemirror/mode/tiki/tiki.js
vendored
|
@ -52,35 +52,27 @@ CodeMirror.defineMode('tiki', function(config) {
|
|||
case "{": //plugin
|
||||
stream.eat("/");
|
||||
stream.eatSpace();
|
||||
var tagName = "";
|
||||
var c;
|
||||
while ((c = stream.eat(/[^\s\u00a0=\"\'\/?(}]/))) tagName += c;
|
||||
stream.eatWhile(/[^\s\u00a0=\"\'\/?(}]/);
|
||||
state.tokenize = inPlugin;
|
||||
return "tag";
|
||||
break;
|
||||
case "_": //bold
|
||||
if (stream.eat("_")) {
|
||||
if (stream.eat("_"))
|
||||
return chain(inBlock("strong", "__", inText));
|
||||
}
|
||||
break;
|
||||
case "'": //italics
|
||||
if (stream.eat("'")) {
|
||||
// Italic text
|
||||
if (stream.eat("'"))
|
||||
return chain(inBlock("em", "''", inText));
|
||||
}
|
||||
break;
|
||||
case "(":// Wiki Link
|
||||
if (stream.eat("(")) {
|
||||
if (stream.eat("("))
|
||||
return chain(inBlock("variable-2", "))", inText));
|
||||
}
|
||||
break;
|
||||
case "[":// Weblink
|
||||
return chain(inBlock("variable-3", "]", inText));
|
||||
break;
|
||||
case "|": //table
|
||||
if (stream.eat("|")) {
|
||||
if (stream.eat("|"))
|
||||
return chain(inBlock("comment", "||"));
|
||||
}
|
||||
break;
|
||||
case "-":
|
||||
if (stream.eat("=")) {//titleBar
|
||||
|
@ -90,22 +82,19 @@ CodeMirror.defineMode('tiki', function(config) {
|
|||
}
|
||||
break;
|
||||
case "=": //underline
|
||||
if (stream.match("==")) {
|
||||
if (stream.match("=="))
|
||||
return chain(inBlock("tw-underline", "===", inText));
|
||||
}
|
||||
break;
|
||||
case ":":
|
||||
if (stream.eat(":")) {
|
||||
if (stream.eat(":"))
|
||||
return chain(inBlock("comment", "::"));
|
||||
}
|
||||
break;
|
||||
case "^": //box
|
||||
return chain(inBlock("tw-box", "^"));
|
||||
break;
|
||||
case "~": //np
|
||||
if (stream.match("np~")) {
|
||||
if (stream.match("np~"))
|
||||
return chain(inBlock("meta", "~/np~"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
115
public/vendor/codemirror/mode/ttcn-cfg/index.html
vendored
Executable file
115
public/vendor/codemirror/mode/ttcn-cfg/index.html
vendored
Executable file
|
@ -0,0 +1,115 @@
|
|||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: TTCN-CFG 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="ttcn-cfg.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="http://en.wikipedia.org/wiki/TTCN">TTCN-CFG</a>
|
||||
</ul>
|
||||
</div>
|
||||
<article>
|
||||
<h2>TTCN-CFG example</h2>
|
||||
<div>
|
||||
<textarea id="ttcn-cfg-code">
|
||||
[MODULE_PARAMETERS]
|
||||
# This section shall contain the values of all parameters that are defined in your TTCN-3 modules.
|
||||
|
||||
[LOGGING]
|
||||
# In this section you can specify the name of the log file and the classes of events
|
||||
# you want to log into the file or display on console (standard error).
|
||||
|
||||
LogFile := "logs/%e.%h-%r.%s"
|
||||
FileMask := LOG_ALL | DEBUG | MATCHING
|
||||
ConsoleMask := ERROR | WARNING | TESTCASE | STATISTICS | PORTEVENT
|
||||
|
||||
LogSourceInfo := Yes
|
||||
AppendFile := No
|
||||
TimeStampFormat := DateTime
|
||||
LogEventTypes := Yes
|
||||
SourceInfoFormat := Single
|
||||
LogEntityName := Yes
|
||||
|
||||
[TESTPORT_PARAMETERS]
|
||||
# In this section you can specify parameters that are passed to Test Ports.
|
||||
|
||||
[DEFINE]
|
||||
# In this section you can create macro definitions,
|
||||
# that can be used in other configuration file sections except [INCLUDE].
|
||||
|
||||
[INCLUDE]
|
||||
# To use configuration settings given in other configuration files,
|
||||
# the configuration files just need to be listed in this section, with their full or relative pathnames.
|
||||
|
||||
[EXTERNAL_COMMANDS]
|
||||
# This section can define external commands (shell scripts) to be executed by the ETS
|
||||
# whenever a control part or test case is started or terminated.
|
||||
|
||||
BeginTestCase := ""
|
||||
EndTestCase := ""
|
||||
BeginControlPart := ""
|
||||
EndControlPart := ""
|
||||
|
||||
[EXECUTE]
|
||||
# In this section you can specify what parts of your test suite you want to execute.
|
||||
|
||||
[GROUPS]
|
||||
# In this section you can specify groups of hosts. These groups can be used inside the
|
||||
# [COMPONENTS] section to restrict the creation of certain PTCs to a given set of hosts.
|
||||
|
||||
[COMPONENTS]
|
||||
# This section consists of rules restricting the location of created PTCs.
|
||||
|
||||
[MAIN_CONTROLLER]
|
||||
# The options herein control the behavior of MC.
|
||||
|
||||
TCPPort := 0
|
||||
KillTimer := 10.0
|
||||
NumHCs := 0
|
||||
LocalAddress :=
|
||||
</textarea>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var ttcnEditor = CodeMirror.fromTextArea(document.getElementById("ttcn-cfg-code"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
mode: "text/x-ttcn-cfg"
|
||||
});
|
||||
ttcnEditor.setSize(600, 860);
|
||||
var mac = CodeMirror.keyMap.default == CodeMirror.keyMap.macDefault;
|
||||
CodeMirror.keyMap.default[(mac ? "Cmd" : "Ctrl") + "-Space"] = "autocomplete";
|
||||
</script>
|
||||
<br/>
|
||||
<p><strong>Language:</strong> Testing and Test Control Notation -
|
||||
Configuration files
|
||||
(<a href="http://en.wikipedia.org/wiki/TTCN">TTCN-CFG</a>)
|
||||
</p>
|
||||
<p><strong>MIME types defined:</strong> <code>text/x-ttcn-cfg</code>.</p>
|
||||
|
||||
<br/>
|
||||
<p>The development of this mode has been sponsored by <a href="http://www.ericsson.com/">Ericsson
|
||||
</a>.</p>
|
||||
<p>Coded by Asmelash Tsegay Gebretsadkan </p>
|
||||
</article>
|
||||
|
214
public/vendor/codemirror/mode/ttcn-cfg/ttcn-cfg.js
vendored
Executable file
214
public/vendor/codemirror/mode/ttcn-cfg/ttcn-cfg.js
vendored
Executable file
|
@ -0,0 +1,214 @@
|
|||
// 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("ttcn-cfg", function(config, parserConfig) {
|
||||
var indentUnit = config.indentUnit,
|
||||
keywords = parserConfig.keywords || {},
|
||||
fileNCtrlMaskOptions = parserConfig.fileNCtrlMaskOptions || {},
|
||||
externalCommands = parserConfig.externalCommands || {},
|
||||
multiLineStrings = parserConfig.multiLineStrings,
|
||||
indentStatements = parserConfig.indentStatements !== false;
|
||||
var isOperatorChar = /[\|]/;
|
||||
var curPunc;
|
||||
|
||||
function tokenBase(stream, state) {
|
||||
var ch = stream.next();
|
||||
if (ch == '"' || ch == "'") {
|
||||
state.tokenize = tokenString(ch);
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
if (/[:=]/.test(ch)) {
|
||||
curPunc = ch;
|
||||
return "punctuation";
|
||||
}
|
||||
if (ch == "#"){
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
if (/\d/.test(ch)) {
|
||||
stream.eatWhile(/[\w\.]/);
|
||||
return "number";
|
||||
}
|
||||
if (isOperatorChar.test(ch)) {
|
||||
stream.eatWhile(isOperatorChar);
|
||||
return "operator";
|
||||
}
|
||||
if (ch == "["){
|
||||
stream.eatWhile(/[\w_\]]/);
|
||||
return "number sectionTitle";
|
||||
}
|
||||
|
||||
stream.eatWhile(/[\w\$_]/);
|
||||
var cur = stream.current();
|
||||
if (keywords.propertyIsEnumerable(cur)) return "keyword";
|
||||
if (fileNCtrlMaskOptions.propertyIsEnumerable(cur))
|
||||
return "negative fileNCtrlMaskOptions";
|
||||
if (externalCommands.propertyIsEnumerable(cur)) return "negative externalCommands";
|
||||
|
||||
return "variable";
|
||||
}
|
||||
|
||||
function tokenString(quote) {
|
||||
return function(stream, state) {
|
||||
var escaped = false, next, end = false;
|
||||
while ((next = stream.next()) != null) {
|
||||
if (next == quote && !escaped){
|
||||
var afterNext = stream.peek();
|
||||
//look if the character if the quote is like the B in '10100010'B
|
||||
if (afterNext){
|
||||
afterNext = afterNext.toLowerCase();
|
||||
if(afterNext == "b" || afterNext == "h" || afterNext == "o")
|
||||
stream.next();
|
||||
}
|
||||
end = true; break;
|
||||
}
|
||||
escaped = !escaped && next == "\\";
|
||||
}
|
||||
if (end || !(escaped || multiLineStrings))
|
||||
state.tokenize = null;
|
||||
return "string";
|
||||
};
|
||||
}
|
||||
|
||||
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) {
|
||||
var indent = state.indented;
|
||||
if (state.context && state.context.type == "statement")
|
||||
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;
|
||||
}
|
||||
|
||||
//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;
|
||||
curPunc = null;
|
||||
var style = (state.tokenize || tokenBase)(stream, state);
|
||||
if (style == "comment") return style;
|
||||
if (ctx.align == null) ctx.align = true;
|
||||
|
||||
if ((curPunc == ";" || curPunc == ":" || curPunc == ",")
|
||||
&& ctx.type == "statement"){
|
||||
popContext(state);
|
||||
}
|
||||
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
||||
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
||||
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
||||
else if (curPunc == "}") {
|
||||
while (ctx.type == "statement") ctx = popContext(state);
|
||||
if (ctx.type == "}") ctx = popContext(state);
|
||||
while (ctx.type == "statement") ctx = popContext(state);
|
||||
}
|
||||
else if (curPunc == ctx.type) popContext(state);
|
||||
else if (indentStatements && (((ctx.type == "}" || ctx.type == "top")
|
||||
&& curPunc != ';') || (ctx.type == "statement"
|
||||
&& curPunc == "newstatement")))
|
||||
pushContext(state, stream.column(), "statement");
|
||||
state.startOfLine = false;
|
||||
return style;
|
||||
},
|
||||
|
||||
electricChars: "{}",
|
||||
lineComment: "#",
|
||||
fold: "brace"
|
||||
};
|
||||
});
|
||||
|
||||
function words(str) {
|
||||
var obj = {}, words = str.split(" ");
|
||||
for (var i = 0; i < words.length; ++i)
|
||||
obj[words[i]] = true;
|
||||
return obj;
|
||||
}
|
||||
|
||||
CodeMirror.defineMIME("text/x-ttcn-cfg", {
|
||||
name: "ttcn-cfg",
|
||||
keywords: words("Yes No LogFile FileMask ConsoleMask AppendFile" +
|
||||
" TimeStampFormat LogEventTypes SourceInfoFormat" +
|
||||
" LogEntityName LogSourceInfo DiskFullAction" +
|
||||
" LogFileNumber LogFileSize MatchingHints Detailed" +
|
||||
" Compact SubCategories Stack Single None Seconds" +
|
||||
" DateTime Time Stop Error Retry Delete TCPPort KillTimer" +
|
||||
" NumHCs UnixSocketsEnabled LocalAddress"),
|
||||
fileNCtrlMaskOptions: words("TTCN_EXECUTOR TTCN_ERROR TTCN_WARNING" +
|
||||
" TTCN_PORTEVENT TTCN_TIMEROP TTCN_VERDICTOP" +
|
||||
" TTCN_DEFAULTOP TTCN_TESTCASE TTCN_ACTION" +
|
||||
" TTCN_USER TTCN_FUNCTION TTCN_STATISTICS" +
|
||||
" TTCN_PARALLEL TTCN_MATCHING TTCN_DEBUG" +
|
||||
" EXECUTOR ERROR WARNING PORTEVENT TIMEROP" +
|
||||
" VERDICTOP DEFAULTOP TESTCASE ACTION USER" +
|
||||
" FUNCTION STATISTICS PARALLEL MATCHING DEBUG" +
|
||||
" LOG_ALL LOG_NOTHING ACTION_UNQUALIFIED" +
|
||||
" DEBUG_ENCDEC DEBUG_TESTPORT" +
|
||||
" DEBUG_UNQUALIFIED DEFAULTOP_ACTIVATE" +
|
||||
" DEFAULTOP_DEACTIVATE DEFAULTOP_EXIT" +
|
||||
" DEFAULTOP_UNQUALIFIED ERROR_UNQUALIFIED" +
|
||||
" EXECUTOR_COMPONENT EXECUTOR_CONFIGDATA" +
|
||||
" EXECUTOR_EXTCOMMAND EXECUTOR_LOGOPTIONS" +
|
||||
" EXECUTOR_RUNTIME EXECUTOR_UNQUALIFIED" +
|
||||
" FUNCTION_RND FUNCTION_UNQUALIFIED" +
|
||||
" MATCHING_DONE MATCHING_MCSUCCESS" +
|
||||
" MATCHING_MCUNSUCC MATCHING_MMSUCCESS" +
|
||||
" MATCHING_MMUNSUCC MATCHING_PCSUCCESS" +
|
||||
" MATCHING_PCUNSUCC MATCHING_PMSUCCESS" +
|
||||
" MATCHING_PMUNSUCC MATCHING_PROBLEM" +
|
||||
" MATCHING_TIMEOUT MATCHING_UNQUALIFIED" +
|
||||
" PARALLEL_PORTCONN PARALLEL_PORTMAP" +
|
||||
" PARALLEL_PTC PARALLEL_UNQUALIFIED" +
|
||||
" PORTEVENT_DUALRECV PORTEVENT_DUALSEND" +
|
||||
" PORTEVENT_MCRECV PORTEVENT_MCSEND" +
|
||||
" PORTEVENT_MMRECV PORTEVENT_MMSEND" +
|
||||
" PORTEVENT_MQUEUE PORTEVENT_PCIN" +
|
||||
" PORTEVENT_PCOUT PORTEVENT_PMIN" +
|
||||
" PORTEVENT_PMOUT PORTEVENT_PQUEUE" +
|
||||
" PORTEVENT_STATE PORTEVENT_UNQUALIFIED" +
|
||||
" STATISTICS_UNQUALIFIED STATISTICS_VERDICT" +
|
||||
" TESTCASE_FINISH TESTCASE_START" +
|
||||
" TESTCASE_UNQUALIFIED TIMEROP_GUARD" +
|
||||
" TIMEROP_READ TIMEROP_START TIMEROP_STOP" +
|
||||
" TIMEROP_TIMEOUT TIMEROP_UNQUALIFIED" +
|
||||
" USER_UNQUALIFIED VERDICTOP_FINAL" +
|
||||
" VERDICTOP_GETVERDICT VERDICTOP_SETVERDICT" +
|
||||
" VERDICTOP_UNQUALIFIED WARNING_UNQUALIFIED"),
|
||||
externalCommands: words("BeginControlPart EndControlPart BeginTestCase" +
|
||||
" EndTestCase"),
|
||||
multiLineStrings: true
|
||||
});
|
||||
});
|
118
public/vendor/codemirror/mode/ttcn/index.html
vendored
Executable file
118
public/vendor/codemirror/mode/ttcn/index.html
vendored
Executable file
|
@ -0,0 +1,118 @@
|
|||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: TTCN 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="ttcn.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="http://en.wikipedia.org/wiki/TTCN">TTCN</a>
|
||||
</ul>
|
||||
</div>
|
||||
<article>
|
||||
<h2>TTCN example</h2>
|
||||
<div>
|
||||
<textarea id="ttcn-code">
|
||||
module Templates {
|
||||
/* import types from ASN.1 */
|
||||
import from Types language "ASN.1:1997" all;
|
||||
|
||||
/* During the conversion phase from ASN.1 to TTCN-3 */
|
||||
/* - the minus sign (Message-Type) within the identifiers will be replaced by underscore (Message_Type)*/
|
||||
/* - the ASN.1 identifiers matching a TTCN-3 keyword (objid) will be postfixed with an underscore (objid_)*/
|
||||
|
||||
// simple types
|
||||
|
||||
template SenderID localObjid := objid {itu_t(0) identified_organization(4) etsi(0)};
|
||||
|
||||
// complex types
|
||||
|
||||
/* ASN.1 Message-Type mapped to TTCN-3 Message_Type */
|
||||
template Message receiveMsg(template (present) Message_Type p_messageType) := {
|
||||
header := p_messageType,
|
||||
body := ?
|
||||
}
|
||||
|
||||
/* ASN.1 objid mapped to TTCN-3 objid_ */
|
||||
template Message sendInviteMsg := {
|
||||
header := inviteType,
|
||||
body := {
|
||||
/* optional fields may be assigned by omit or may be ignored/skipped */
|
||||
description := "Invite Message",
|
||||
data := 'FF'O,
|
||||
objid_ := localObjid
|
||||
}
|
||||
}
|
||||
|
||||
template Message sendAcceptMsg modifies sendInviteMsg := {
|
||||
header := acceptType,
|
||||
body := {
|
||||
description := "Accept Message"
|
||||
}
|
||||
};
|
||||
|
||||
template Message sendErrorMsg modifies sendInviteMsg := {
|
||||
header := errorType,
|
||||
body := {
|
||||
description := "Error Message"
|
||||
}
|
||||
};
|
||||
|
||||
template Message expectedErrorMsg := {
|
||||
header := errorType,
|
||||
body := ?
|
||||
};
|
||||
|
||||
template Message expectedInviteMsg modifies expectedErrorMsg := {
|
||||
header := inviteType
|
||||
};
|
||||
|
||||
template Message expectedAcceptMsg modifies expectedErrorMsg := {
|
||||
header := acceptType
|
||||
};
|
||||
|
||||
} with { encode "BER:1997" }
|
||||
</textarea>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var ttcnEditor = CodeMirror.fromTextArea(document.getElementById("ttcn-code"), {
|
||||
lineNumbers: true,
|
||||
matchBrackets: true,
|
||||
mode: "text/x-ttcn"
|
||||
});
|
||||
ttcnEditor.setSize(600, 860);
|
||||
var mac = CodeMirror.keyMap.default == CodeMirror.keyMap.macDefault;
|
||||
CodeMirror.keyMap.default[(mac ? "Cmd" : "Ctrl") + "-Space"] = "autocomplete";
|
||||
</script>
|
||||
<br/>
|
||||
<p><strong>Language:</strong> Testing and Test Control Notation
|
||||
(<a href="http://en.wikipedia.org/wiki/TTCN">TTCN</a>)
|
||||
</p>
|
||||
<p><strong>MIME types defined:</strong> <code>text/x-ttcn,
|
||||
text/x-ttcn3, text/x-ttcnpp</code>.</p>
|
||||
<br/>
|
||||
<p>The development of this mode has been sponsored by <a href="http://www.ericsson.com/">Ericsson
|
||||
</a>.</p>
|
||||
<p>Coded by Asmelash Tsegay Gebretsadkan </p>
|
||||
</article>
|
||||
|
283
public/vendor/codemirror/mode/ttcn/ttcn.js
vendored
Executable file
283
public/vendor/codemirror/mode/ttcn/ttcn.js
vendored
Executable file
|
@ -0,0 +1,283 @@
|
|||
// 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("ttcn", function(config, parserConfig) {
|
||||
var indentUnit = config.indentUnit,
|
||||
keywords = parserConfig.keywords || {},
|
||||
builtin = parserConfig.builtin || {},
|
||||
timerOps = parserConfig.timerOps || {},
|
||||
portOps = parserConfig.portOps || {},
|
||||
configOps = parserConfig.configOps || {},
|
||||
verdictOps = parserConfig.verdictOps || {},
|
||||
sutOps = parserConfig.sutOps || {},
|
||||
functionOps = parserConfig.functionOps || {},
|
||||
|
||||
verdictConsts = parserConfig.verdictConsts || {},
|
||||
booleanConsts = parserConfig.booleanConsts || {},
|
||||
otherConsts = parserConfig.otherConsts || {},
|
||||
|
||||
types = parserConfig.types || {},
|
||||
visibilityModifiers = parserConfig.visibilityModifiers || {},
|
||||
templateMatch = parserConfig.templateMatch || {},
|
||||
multiLineStrings = parserConfig.multiLineStrings,
|
||||
indentStatements = parserConfig.indentStatements !== false;
|
||||
var isOperatorChar = /[+\-*&@=<>!\/]/;
|
||||
var curPunc;
|
||||
|
||||
function tokenBase(stream, state) {
|
||||
var ch = stream.next();
|
||||
|
||||
if (ch == '"' || ch == "'") {
|
||||
state.tokenize = tokenString(ch);
|
||||
return state.tokenize(stream, state);
|
||||
}
|
||||
if (/[\[\]{}\(\),;\\:\?\.]/.test(ch)) {
|
||||
curPunc = ch;
|
||||
return "punctuation";
|
||||
}
|
||||
if (ch == "#"){
|
||||
stream.skipToEnd();
|
||||
return "atom preprocessor";
|
||||
}
|
||||
if (ch == "%"){
|
||||
stream.eatWhile(/\b/);
|
||||
return "atom ttcn3Macros";
|
||||
}
|
||||
if (/\d/.test(ch)) {
|
||||
stream.eatWhile(/[\w\.]/);
|
||||
return "number";
|
||||
}
|
||||
if (ch == "/") {
|
||||
if (stream.eat("*")) {
|
||||
state.tokenize = tokenComment;
|
||||
return tokenComment(stream, state);
|
||||
}
|
||||
if (stream.eat("/")) {
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
}
|
||||
}
|
||||
if (isOperatorChar.test(ch)) {
|
||||
if(ch == "@"){
|
||||
if(stream.match("try") || stream.match("catch")
|
||||
|| stream.match("lazy")){
|
||||
return "keyword";
|
||||
}
|
||||
}
|
||||
stream.eatWhile(isOperatorChar);
|
||||
return "operator";
|
||||
}
|
||||
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
|
||||
var cur = stream.current();
|
||||
|
||||
if (keywords.propertyIsEnumerable(cur)) return "keyword";
|
||||
if (builtin.propertyIsEnumerable(cur)) return "builtin";
|
||||
|
||||
if (timerOps.propertyIsEnumerable(cur)) return "def timerOps";
|
||||
if (configOps.propertyIsEnumerable(cur)) return "def configOps";
|
||||
if (verdictOps.propertyIsEnumerable(cur)) return "def verdictOps";
|
||||
if (portOps.propertyIsEnumerable(cur)) return "def portOps";
|
||||
if (sutOps.propertyIsEnumerable(cur)) return "def sutOps";
|
||||
if (functionOps.propertyIsEnumerable(cur)) return "def functionOps";
|
||||
|
||||
if (verdictConsts.propertyIsEnumerable(cur)) return "string verdictConsts";
|
||||
if (booleanConsts.propertyIsEnumerable(cur)) return "string booleanConsts";
|
||||
if (otherConsts.propertyIsEnumerable(cur)) return "string otherConsts";
|
||||
|
||||
if (types.propertyIsEnumerable(cur)) return "builtin types";
|
||||
if (visibilityModifiers.propertyIsEnumerable(cur))
|
||||
return "builtin visibilityModifiers";
|
||||
if (templateMatch.propertyIsEnumerable(cur)) return "atom templateMatch";
|
||||
|
||||
return "variable";
|
||||
}
|
||||
|
||||
function tokenString(quote) {
|
||||
return function(stream, state) {
|
||||
var escaped = false, next, end = false;
|
||||
while ((next = stream.next()) != null) {
|
||||
if (next == quote && !escaped){
|
||||
var afterQuote = stream.peek();
|
||||
//look if the character after the quote is like the B in '10100010'B
|
||||
if (afterQuote){
|
||||
afterQuote = afterQuote.toLowerCase();
|
||||
if(afterQuote == "b" || afterQuote == "h" || afterQuote == "o")
|
||||
stream.next();
|
||||
}
|
||||
end = true; break;
|
||||
}
|
||||
escaped = !escaped && next == "\\";
|
||||
}
|
||||
if (end || !(escaped || multiLineStrings))
|
||||
state.tokenize = null;
|
||||
return "string";
|
||||
};
|
||||
}
|
||||
|
||||
function tokenComment(stream, state) {
|
||||
var maybeEnd = false, ch;
|
||||
while (ch = stream.next()) {
|
||||
if (ch == "/" && maybeEnd) {
|
||||
state.tokenize = null;
|
||||
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) {
|
||||
var indent = state.indented;
|
||||
if (state.context && state.context.type == "statement")
|
||||
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;
|
||||
}
|
||||
|
||||
//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;
|
||||
curPunc = null;
|
||||
var style = (state.tokenize || tokenBase)(stream, state);
|
||||
if (style == "comment") return style;
|
||||
if (ctx.align == null) ctx.align = true;
|
||||
|
||||
if ((curPunc == ";" || curPunc == ":" || curPunc == ",")
|
||||
&& ctx.type == "statement"){
|
||||
popContext(state);
|
||||
}
|
||||
else if (curPunc == "{") pushContext(state, stream.column(), "}");
|
||||
else if (curPunc == "[") pushContext(state, stream.column(), "]");
|
||||
else if (curPunc == "(") pushContext(state, stream.column(), ")");
|
||||
else if (curPunc == "}") {
|
||||
while (ctx.type == "statement") ctx = popContext(state);
|
||||
if (ctx.type == "}") ctx = popContext(state);
|
||||
while (ctx.type == "statement") ctx = popContext(state);
|
||||
}
|
||||
else if (curPunc == ctx.type) popContext(state);
|
||||
else if (indentStatements &&
|
||||
(((ctx.type == "}" || ctx.type == "top") && curPunc != ';') ||
|
||||
(ctx.type == "statement" && curPunc == "newstatement")))
|
||||
pushContext(state, stream.column(), "statement");
|
||||
|
||||
state.startOfLine = false;
|
||||
|
||||
return style;
|
||||
},
|
||||
|
||||
electricChars: "{}",
|
||||
blockCommentStart: "/*",
|
||||
blockCommentEnd: "*/",
|
||||
lineComment: "//",
|
||||
fold: "brace"
|
||||
};
|
||||
});
|
||||
|
||||
function words(str) {
|
||||
var obj = {}, words = str.split(" ");
|
||||
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
||||
return obj;
|
||||
}
|
||||
|
||||
function def(mimes, mode) {
|
||||
if (typeof mimes == "string") mimes = [mimes];
|
||||
var words = [];
|
||||
function add(obj) {
|
||||
if (obj) for (var prop in obj) if (obj.hasOwnProperty(prop))
|
||||
words.push(prop);
|
||||
}
|
||||
|
||||
add(mode.keywords);
|
||||
add(mode.builtin);
|
||||
add(mode.timerOps);
|
||||
add(mode.portOps);
|
||||
|
||||
if (words.length) {
|
||||
mode.helperType = mimes[0];
|
||||
CodeMirror.registerHelper("hintWords", mimes[0], words);
|
||||
}
|
||||
|
||||
for (var i = 0; i < mimes.length; ++i)
|
||||
CodeMirror.defineMIME(mimes[i], mode);
|
||||
}
|
||||
|
||||
def(["text/x-ttcn", "text/x-ttcn3", "text/x-ttcnpp"], {
|
||||
name: "ttcn",
|
||||
keywords: words("activate address alive all alt altstep and and4b any" +
|
||||
" break case component const continue control deactivate" +
|
||||
" display do else encode enumerated except exception" +
|
||||
" execute extends extension external for from function" +
|
||||
" goto group if import in infinity inout interleave" +
|
||||
" label language length log match message mixed mod" +
|
||||
" modifies module modulepar mtc noblock not not4b nowait" +
|
||||
" of on optional or or4b out override param pattern port" +
|
||||
" procedure record recursive rem repeat return runs select" +
|
||||
" self sender set signature system template testcase to" +
|
||||
" type union value valueof var variant while with xor xor4b"),
|
||||
builtin: words("bit2hex bit2int bit2oct bit2str char2int char2oct encvalue" +
|
||||
" decomp decvalue float2int float2str hex2bit hex2int" +
|
||||
" hex2oct hex2str int2bit int2char int2float int2hex" +
|
||||
" int2oct int2str int2unichar isbound ischosen ispresent" +
|
||||
" isvalue lengthof log2str oct2bit oct2char oct2hex oct2int" +
|
||||
" oct2str regexp replace rnd sizeof str2bit str2float" +
|
||||
" str2hex str2int str2oct substr unichar2int unichar2char" +
|
||||
" enum2int"),
|
||||
types: words("anytype bitstring boolean char charstring default float" +
|
||||
" hexstring integer objid octetstring universal verdicttype timer"),
|
||||
timerOps: words("read running start stop timeout"),
|
||||
portOps: words("call catch check clear getcall getreply halt raise receive" +
|
||||
" reply send trigger"),
|
||||
configOps: words("create connect disconnect done kill killed map unmap"),
|
||||
verdictOps: words("getverdict setverdict"),
|
||||
sutOps: words("action"),
|
||||
functionOps: words("apply derefers refers"),
|
||||
|
||||
verdictConsts: words("error fail inconc none pass"),
|
||||
booleanConsts: words("true false"),
|
||||
otherConsts: words("null NULL omit"),
|
||||
|
||||
visibilityModifiers: words("private public friend"),
|
||||
templateMatch: words("complement ifpresent subset superset permutation"),
|
||||
multiLineStrings: true
|
||||
});
|
||||
});
|
45
public/vendor/codemirror/mode/twig/index.html
vendored
Executable file
45
public/vendor/codemirror/mode/twig/index.html
vendored
Executable file
|
@ -0,0 +1,45 @@
|
|||
<!doctype html>
|
||||
|
||||
<title>CodeMirror: Twig 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="twig.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="#">Twig</a>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<article>
|
||||
<h2>Twig mode</h2>
|
||||
<form><textarea id="code" name="code">
|
||||
{% extends "layout.twig" %}
|
||||
{% block title %}CodeMirror: Twig mode{% endblock %}
|
||||
{# this is a comment #}
|
||||
{% block content %}
|
||||
{% for foo in bar if foo.baz is divisible by(3) %}
|
||||
Hello {{ foo.world }}
|
||||
{% else %}
|
||||
{% set msg = "Result not found" %}
|
||||
{% include "empty.twig" with { message: msg } %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
</textarea></form>
|
||||
<script>
|
||||
var editor =
|
||||
CodeMirror.fromTextArea(document.getElementById("code"), {mode:
|
||||
{name: "twig", htmlMode: true}});
|
||||
</script>
|
||||
</article>
|
132
public/vendor/codemirror/mode/twig/twig.js
vendored
Executable file
132
public/vendor/codemirror/mode/twig/twig.js
vendored
Executable file
|
@ -0,0 +1,132 @@
|
|||
// 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("twig", 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 = /^[:\[\(\{]/,
|
||||
atom = ["true", "false", "null", "empty", "defined", "divisibleby", "divisible by", "even", "odd", "iterable", "sameas", "same as"],
|
||||
number = /^(\d[+\-\*\/])?\d+(\.\d+)?/;
|
||||
|
||||
keywords = new RegExp("((" + keywords.join(")|(") + "))\\b");
|
||||
atom = new RegExp("((" + atom.join(")|(") + "))\\b");
|
||||
|
||||
function tokenBase (stream, state) {
|
||||
var ch = stream.peek();
|
||||
|
||||
//Comment
|
||||
if (state.incomment) {
|
||||
if (!stream.skipTo("#}")) {
|
||||
stream.skipToEnd();
|
||||
} else {
|
||||
stream.eatWhile(/\#|}/);
|
||||
state.incomment = false;
|
||||
}
|
||||
return "comment";
|
||||
//Tag
|
||||
} else if (state.intag) {
|
||||
//After operator
|
||||
if (state.operator) {
|
||||
state.operator = false;
|
||||
if (stream.match(atom)) {
|
||||
return "atom";
|
||||
}
|
||||
if (stream.match(number)) {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
//After sign
|
||||
if (state.sign) {
|
||||
state.sign = false;
|
||||
if (stream.match(atom)) {
|
||||
return "atom";
|
||||
}
|
||||
if (stream.match(number)) {
|
||||
return "number";
|
||||
}
|
||||
}
|
||||
|
||||
if (state.instring) {
|
||||
if (ch == state.instring) {
|
||||
state.instring = false;
|
||||
}
|
||||
stream.next();
|
||||
return "string";
|
||||
} else if (ch == "'" || ch == '"') {
|
||||
state.instring = ch;
|
||||
stream.next();
|
||||
return "string";
|
||||
} else if (stream.match(state.intag + "}") || stream.eat("-") && stream.match(state.intag + "}")) {
|
||||
state.intag = false;
|
||||
return "tag";
|
||||
} else if (stream.match(operator)) {
|
||||
state.operator = true;
|
||||
return "operator";
|
||||
} else if (stream.match(sign)) {
|
||||
state.sign = true;
|
||||
} else {
|
||||
if (stream.eat(" ") || stream.sol()) {
|
||||
if (stream.match(keywords)) {
|
||||
return "keyword";
|
||||
}
|
||||
if (stream.match(atom)) {
|
||||
return "atom";
|
||||
}
|
||||
if (stream.match(number)) {
|
||||
return "number";
|
||||
}
|
||||
if (stream.sol()) {
|
||||
stream.next();
|
||||
}
|
||||
} else {
|
||||
stream.next();
|
||||
}
|
||||
|
||||
}
|
||||
return "variable";
|
||||
} else if (stream.eat("{")) {
|
||||
if (ch = stream.eat("#")) {
|
||||
state.incomment = true;
|
||||
if (!stream.skipTo("#}")) {
|
||||
stream.skipToEnd();
|
||||
} else {
|
||||
stream.eatWhile(/\#|}/);
|
||||
state.incomment = false;
|
||||
}
|
||||
return "comment";
|
||||
//Open tag
|
||||
} else if (ch = stream.eat(/\{|%/)) {
|
||||
//Cache close tag
|
||||
state.intag = ch;
|
||||
if (ch == "{") {
|
||||
state.intag = "}";
|
||||
}
|
||||
stream.eat("-");
|
||||
return "tag";
|
||||
}
|
||||
}
|
||||
stream.next();
|
||||
};
|
||||
|
||||
return {
|
||||
startState: function () {
|
||||
return {};
|
||||
},
|
||||
token: function (stream, state) {
|
||||
return tokenBase(stream, state);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
CodeMirror.defineMIME("text/x-twig", "twig");
|
||||
});
|
3
public/vendor/codemirror/mode/vb/vb.js
vendored
3
public/vendor/codemirror/mode/vb/vb.js
vendored
|
@ -264,8 +264,9 @@ CodeMirror.defineMode("vb", function(conf, parserConf) {
|
|||
if (trueText.match(closing) || trueText.match(doubleClosing) || trueText.match(middle)) return conf.indentUnit*(state.currentIndent-1);
|
||||
if(state.currentIndent < 0) return 0;
|
||||
return state.currentIndent * conf.indentUnit;
|
||||
}
|
||||
},
|
||||
|
||||
lineComment: "'"
|
||||
};
|
||||
return external;
|
||||
});
|
||||
|
|
70
public/vendor/codemirror/mode/xquery/xquery.js
vendored
70
public/vendor/codemirror/mode/xquery/xquery.js
vendored
|
@ -68,15 +68,6 @@ CodeMirror.defineMode("xquery", function() {
|
|||
return kwObj;
|
||||
}();
|
||||
|
||||
// Used as scratch variables to communicate multiple values without
|
||||
// consing up tons of objects.
|
||||
var type, content;
|
||||
|
||||
function ret(tp, style, cont) {
|
||||
type = tp; content = cont;
|
||||
return style;
|
||||
}
|
||||
|
||||
function chain(stream, state, f) {
|
||||
state.tokenize = f;
|
||||
return f(stream, state);
|
||||
|
@ -95,7 +86,7 @@ CodeMirror.defineMode("xquery", function() {
|
|||
|
||||
if(stream.match("![CDATA", false)) {
|
||||
state.tokenize = tokenCDATA;
|
||||
return ret("tag", "tag");
|
||||
return "tag";
|
||||
}
|
||||
|
||||
if(stream.match("?", false)) {
|
||||
|
@ -112,28 +103,28 @@ CodeMirror.defineMode("xquery", function() {
|
|||
// start code block
|
||||
else if(ch == "{") {
|
||||
pushStateStack(state,{ type: "codeblock"});
|
||||
return ret("", null);
|
||||
return null;
|
||||
}
|
||||
// end code block
|
||||
else if(ch == "}") {
|
||||
popStateStack(state);
|
||||
return ret("", null);
|
||||
return null;
|
||||
}
|
||||
// if we're in an XML block
|
||||
else if(isInXmlBlock(state)) {
|
||||
if(ch == ">")
|
||||
return ret("tag", "tag");
|
||||
return "tag";
|
||||
else if(ch == "/" && stream.eat(">")) {
|
||||
popStateStack(state);
|
||||
return ret("tag", "tag");
|
||||
return "tag";
|
||||
}
|
||||
else
|
||||
return ret("word", "variable");
|
||||
return "variable";
|
||||
}
|
||||
// if a number
|
||||
else if (/\d/.test(ch)) {
|
||||
stream.match(/^\d*(?:\.\d*)?(?:E[+\-]?\d+)?/);
|
||||
return ret("number", "atom");
|
||||
return "atom";
|
||||
}
|
||||
// comment start
|
||||
else if (ch === "(" && stream.eat(":")) {
|
||||
|
@ -149,27 +140,27 @@ CodeMirror.defineMode("xquery", function() {
|
|||
}
|
||||
// assignment
|
||||
else if(ch ===":" && stream.eat("=")) {
|
||||
return ret("operator", "keyword");
|
||||
return "keyword";
|
||||
}
|
||||
// open paren
|
||||
else if(ch === "(") {
|
||||
pushStateStack(state, { type: "paren"});
|
||||
return ret("", null);
|
||||
return null;
|
||||
}
|
||||
// close paren
|
||||
else if(ch === ")") {
|
||||
popStateStack(state);
|
||||
return ret("", null);
|
||||
return null;
|
||||
}
|
||||
// open paren
|
||||
else if(ch === "[") {
|
||||
pushStateStack(state, { type: "bracket"});
|
||||
return ret("", null);
|
||||
return null;
|
||||
}
|
||||
// close paren
|
||||
else if(ch === "]") {
|
||||
popStateStack(state);
|
||||
return ret("", null);
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
var known = keywords.propertyIsEnumerable(ch) && keywords[ch];
|
||||
|
@ -204,15 +195,14 @@ CodeMirror.defineMode("xquery", function() {
|
|||
// if the previous word was element, attribute, axis specifier, this word should be the name of that
|
||||
if(isInXmlConstructor(state)) {
|
||||
popStateStack(state);
|
||||
return ret("word", "variable", word);
|
||||
return "variable";
|
||||
}
|
||||
// as previously checked, if the word is element,attribute, axis specifier, call it an "xmlconstructor" and
|
||||
// push the stack so we know to look for it on the next word
|
||||
if(word == "element" || word == "attribute" || known.type == "axis_specifier") pushStateStack(state, {type: "xmlconstructor"});
|
||||
|
||||
// if the word is known, return the details of that else just call this a generic 'word'
|
||||
return known ? ret(known.type, known.style, word) :
|
||||
ret("word", "variable", word);
|
||||
return known ? known.style : "variable";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,7 +225,7 @@ CodeMirror.defineMode("xquery", function() {
|
|||
maybeNested = (ch == "(");
|
||||
}
|
||||
|
||||
return ret("comment", "comment");
|
||||
return "comment";
|
||||
}
|
||||
|
||||
// tokenizer for string literals
|
||||
|
@ -247,7 +237,7 @@ CodeMirror.defineMode("xquery", function() {
|
|||
if(isInString(state) && stream.current() == quote) {
|
||||
popStateStack(state);
|
||||
if(f) state.tokenize = f;
|
||||
return ret("string", "string");
|
||||
return "string";
|
||||
}
|
||||
|
||||
pushStateStack(state, { type: "string", name: quote, tokenize: tokenString(quote, f) });
|
||||
|
@ -255,7 +245,7 @@ CodeMirror.defineMode("xquery", function() {
|
|||
// if we're in a string and in an XML block, allow an embedded code block
|
||||
if(stream.match("{", false) && isInXmlAttributeBlock(state)) {
|
||||
state.tokenize = tokenBase;
|
||||
return ret("string", "string");
|
||||
return "string";
|
||||
}
|
||||
|
||||
|
||||
|
@ -269,13 +259,13 @@ CodeMirror.defineMode("xquery", function() {
|
|||
// if we're in a string and in an XML block, allow an embedded code block in an attribute
|
||||
if(stream.match("{", false) && isInXmlAttributeBlock(state)) {
|
||||
state.tokenize = tokenBase;
|
||||
return ret("string", "string");
|
||||
return "string";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return ret("string", "string");
|
||||
return "string";
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -293,7 +283,7 @@ CodeMirror.defineMode("xquery", function() {
|
|||
}
|
||||
stream.eatWhile(isVariableChar);
|
||||
state.tokenize = tokenBase;
|
||||
return ret("variable", "variable");
|
||||
return "variable";
|
||||
}
|
||||
|
||||
// tokenizer for XML tags
|
||||
|
@ -303,19 +293,19 @@ CodeMirror.defineMode("xquery", function() {
|
|||
if(isclose && stream.eat(">")) {
|
||||
popStateStack(state);
|
||||
state.tokenize = tokenBase;
|
||||
return ret("tag", "tag");
|
||||
return "tag";
|
||||
}
|
||||
// self closing tag without attributes?
|
||||
if(!stream.eat("/"))
|
||||
pushStateStack(state, { type: "tag", name: name, tokenize: tokenBase});
|
||||
if(!stream.eat(">")) {
|
||||
state.tokenize = tokenAttribute;
|
||||
return ret("tag", "tag");
|
||||
return "tag";
|
||||
}
|
||||
else {
|
||||
state.tokenize = tokenBase;
|
||||
}
|
||||
return ret("tag", "tag");
|
||||
return "tag";
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -326,14 +316,14 @@ CodeMirror.defineMode("xquery", function() {
|
|||
if(ch == "/" && stream.eat(">")) {
|
||||
if(isInXmlAttributeBlock(state)) popStateStack(state);
|
||||
if(isInXmlBlock(state)) popStateStack(state);
|
||||
return ret("tag", "tag");
|
||||
return "tag";
|
||||
}
|
||||
if(ch == ">") {
|
||||
if(isInXmlAttributeBlock(state)) popStateStack(state);
|
||||
return ret("tag", "tag");
|
||||
return "tag";
|
||||
}
|
||||
if(ch == "=")
|
||||
return ret("", null);
|
||||
return null;
|
||||
// quoted string
|
||||
if (ch == '"' || ch == "'")
|
||||
return chain(stream, state, tokenString(ch, tokenAttribute));
|
||||
|
@ -351,7 +341,7 @@ CodeMirror.defineMode("xquery", function() {
|
|||
state.tokenize = tokenBase;
|
||||
}
|
||||
|
||||
return ret("attribute", "attribute");
|
||||
return "attribute";
|
||||
}
|
||||
|
||||
// handle comments, including nested
|
||||
|
@ -360,7 +350,7 @@ CodeMirror.defineMode("xquery", function() {
|
|||
while (ch = stream.next()) {
|
||||
if (ch == "-" && stream.match("->", true)) {
|
||||
state.tokenize = tokenBase;
|
||||
return ret("comment", "comment");
|
||||
return "comment";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -372,7 +362,7 @@ CodeMirror.defineMode("xquery", function() {
|
|||
while (ch = stream.next()) {
|
||||
if (ch == "]" && stream.match("]", true)) {
|
||||
state.tokenize = tokenBase;
|
||||
return ret("comment", "comment");
|
||||
return "comment";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -383,7 +373,7 @@ CodeMirror.defineMode("xquery", function() {
|
|||
while (ch = stream.next()) {
|
||||
if (ch == "?" && stream.match(">", true)) {
|
||||
state.tokenize = tokenBase;
|
||||
return ret("comment", "comment meta");
|
||||
return "comment meta";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
5
public/vendor/codemirror/theme/ambiance.css
vendored
5
public/vendor/codemirror/theme/ambiance.css
vendored
|
@ -2,6 +2,9 @@
|
|||
|
||||
/* Color scheme */
|
||||
|
||||
.cm-s-ambiance .cm-header {color: blue;}
|
||||
.cm-s-ambiance .cm-quote { color: #24C2C7; }
|
||||
|
||||
.cm-s-ambiance .cm-keyword { color: #cda869; }
|
||||
.cm-s-ambiance .cm-atom { color: #CF7EA9; }
|
||||
.cm-s-ambiance .cm-number { color: #78CF8A; }
|
||||
|
@ -20,8 +23,6 @@
|
|||
.cm-s-ambiance .cm-bracket { color: #24C2C7; }
|
||||
.cm-s-ambiance .cm-tag { color: #fee4ff }
|
||||
.cm-s-ambiance .cm-attribute { color: #9B859D; }
|
||||
.cm-s-ambiance .cm-header {color: blue;}
|
||||
.cm-s-ambiance .cm-quote { color: #24C2C7; }
|
||||
.cm-s-ambiance .cm-hr { color: pink; }
|
||||
.cm-s-ambiance .cm-link { color: #F4C20B; }
|
||||
.cm-s-ambiance .cm-special { color: #FF9D00; }
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
.cm-s-erlang-dark .CodeMirror-linenumber { color: #d0d0d0; }
|
||||
.cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white !important; }
|
||||
|
||||
.cm-s-erlang-dark span.cm-quote { color: #ccc; }
|
||||
.cm-s-erlang-dark span.cm-atom { color: #f133f1; }
|
||||
.cm-s-erlang-dark span.cm-attribute { color: #ff80e1; }
|
||||
.cm-s-erlang-dark span.cm-bracket { color: #ff9d00; }
|
||||
|
@ -20,7 +21,6 @@
|
|||
.cm-s-erlang-dark span.cm-operator { color: #d55; }
|
||||
.cm-s-erlang-dark span.cm-property { color: #ccc; }
|
||||
.cm-s-erlang-dark span.cm-qualifier { color: #ccc; }
|
||||
.cm-s-erlang-dark span.cm-quote { color: #ccc; }
|
||||
.cm-s-erlang-dark span.cm-special { color: #ffbbbb; }
|
||||
.cm-s-erlang-dark span.cm-string { color: #3ad900; }
|
||||
.cm-s-erlang-dark span.cm-string-2 { color: #ccc; }
|
||||
|
|
|
@ -19,6 +19,8 @@ Ported to CodeMirror by Peter Kroon
|
|||
.cm-s-lesser-dark .CodeMirror-guttermarker-subtle { color: #777; }
|
||||
.cm-s-lesser-dark .CodeMirror-linenumber { color: #777; }
|
||||
|
||||
.cm-s-lesser-dark span.cm-header {color: #a0a;}
|
||||
.cm-s-lesser-dark span.cm-quote {color: #090;}
|
||||
.cm-s-lesser-dark span.cm-keyword { color: #599eff; }
|
||||
.cm-s-lesser-dark span.cm-atom { color: #C2B470; }
|
||||
.cm-s-lesser-dark span.cm-number { color: #B35E4D; }
|
||||
|
@ -37,8 +39,6 @@ Ported to CodeMirror by Peter Kroon
|
|||
.cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; }
|
||||
.cm-s-lesser-dark span.cm-tag { color: #669199; }
|
||||
.cm-s-lesser-dark span.cm-attribute {color: #00c;}
|
||||
.cm-s-lesser-dark span.cm-header {color: #a0a;}
|
||||
.cm-s-lesser-dark span.cm-quote {color: #090;}
|
||||
.cm-s-lesser-dark span.cm-hr {color: #999;}
|
||||
.cm-s-lesser-dark span.cm-link {color: #00c;}
|
||||
.cm-s-lesser-dark span.cm-error { color: #9d1e15; }
|
||||
|
|
2
public/vendor/codemirror/theme/monokai.css
vendored
2
public/vendor/codemirror/theme/monokai.css
vendored
|
@ -20,9 +20,11 @@
|
|||
|
||||
.cm-s-monokai span.cm-variable {color: #f8f8f2;}
|
||||
.cm-s-monokai span.cm-variable-2 {color: #9effff;}
|
||||
.cm-s-monokai span.cm-variable-3 {color: #66d9ef;}
|
||||
.cm-s-monokai span.cm-def {color: #fd971f;}
|
||||
.cm-s-monokai span.cm-bracket {color: #f8f8f2;}
|
||||
.cm-s-monokai span.cm-tag {color: #f92672;}
|
||||
.cm-s-monokai span.cm-header {color: #ae81ff;}
|
||||
.cm-s-monokai span.cm-link {color: #ae81ff;}
|
||||
.cm-s-monokai span.cm-error {background: #f92672; color: #f8f8f0;}
|
||||
|
||||
|
|
4
public/vendor/codemirror/theme/solarized.css
vendored
4
public/vendor/codemirror/theme/solarized.css
vendored
|
@ -47,6 +47,8 @@ http://ethanschoonover.com/solarized/img/solarized-palette.png
|
|||
text-shadow: none;
|
||||
}
|
||||
|
||||
.cm-s-solarized .cm-header { color: #586e75; }
|
||||
.cm-s-solarized .cm-quote { color: #93a1a1; }
|
||||
|
||||
.cm-s-solarized .cm-keyword { color: #cb4b16 }
|
||||
.cm-s-solarized .cm-atom { color: #d33682; }
|
||||
|
@ -73,8 +75,6 @@ http://ethanschoonover.com/solarized/img/solarized-palette.png
|
|||
.cm-s-solarized .CodeMirror-nonmatchingbracket { color: #dc322f; }
|
||||
.cm-s-solarized .cm-tag { color: #93a1a1 }
|
||||
.cm-s-solarized .cm-attribute { color: #2aa198; }
|
||||
.cm-s-solarized .cm-header { color: #586e75; }
|
||||
.cm-s-solarized .cm-quote { color: #93a1a1; }
|
||||
.cm-s-solarized .cm-hr {
|
||||
color: transparent;
|
||||
border-top: 1px solid #586e75;
|
||||
|
|
65
public/vendor/codemirror/theme/ttcn.css
vendored
Executable file
65
public/vendor/codemirror/theme/ttcn.css
vendored
Executable file
|
@ -0,0 +1,65 @@
|
|||
.cm-quote {color: #090;}
|
||||
.cm-negative {color: #d44;}
|
||||
.cm-positive {color: #292;}
|
||||
.cm-header, .cm-strong {font-weight: bold;}
|
||||
.cm-em {font-style: italic;}
|
||||
.cm-link {text-decoration: underline;}
|
||||
.cm-strikethrough {text-decoration: line-through;}
|
||||
.cm-header {color: #00f; font-weight: bold;}
|
||||
|
||||
.cm-atom {color: #219;}
|
||||
.cm-attribute {color: #00c;}
|
||||
.cm-bracket {color: #997;}
|
||||
.cm-comment {color: #333333;}
|
||||
.cm-def {color: #00f;}
|
||||
.cm-em {font-style: italic;}
|
||||
.cm-error {color: #f00;}
|
||||
.cm-hr {color: #999;}
|
||||
.cm-invalidchar {color: #f00;}
|
||||
.cm-keyword {font-weight:bold}
|
||||
.cm-link {color: #00c; text-decoration: underline;}
|
||||
.cm-meta {color: #555;}
|
||||
.cm-negative {color: #d44;}
|
||||
.cm-positive {color: #292;}
|
||||
.cm-qualifier {color: #555;}
|
||||
.cm-strikethrough {text-decoration: line-through;}
|
||||
.cm-string {color: #006400;}
|
||||
.cm-string-2 {color: #f50;}
|
||||
.cm-strong {font-weight: bold;}
|
||||
.cm-tag {color: #170;}
|
||||
.cm-variable {color: #8B2252;}
|
||||
.cm-variable-2 {color: #05a;}
|
||||
.cm-variable-3 {color: #085;}
|
||||
|
||||
.cm-s-default .cm-error {color: #f00;}
|
||||
.cm-invalidchar {color: #f00;}
|
||||
|
||||
/* ASN */
|
||||
.cm-s-ttcn .cm-accessTypes,
|
||||
.cm-s-ttcn .cm-compareTypes {color: #27408B}
|
||||
.cm-s-ttcn .cm-cmipVerbs {color: #8B2252}
|
||||
.cm-s-ttcn .cm-modifier {color:#D2691E}
|
||||
.cm-s-ttcn .cm-status {color:#8B4545}
|
||||
.cm-s-ttcn .cm-storage {color:#A020F0}
|
||||
.cm-s-ttcn .cm-tags {color:#006400}
|
||||
|
||||
/* CFG */
|
||||
.cm-s-ttcn .cm-externalCommands {color: #8B4545; font-weight:bold}
|
||||
.cm-s-ttcn .cm-fileNCtrlMaskOptions,
|
||||
.cm-s-ttcn .cm-sectionTitle {color: #2E8B57; font-weight:bold}
|
||||
|
||||
/* TTCN */
|
||||
.cm-s-ttcn .cm-booleanConsts,
|
||||
.cm-s-ttcn .cm-otherConsts,
|
||||
.cm-s-ttcn .cm-verdictConsts {color: #006400}
|
||||
.cm-s-ttcn .cm-configOps,
|
||||
.cm-s-ttcn .cm-functionOps,
|
||||
.cm-s-ttcn .cm-portOps,
|
||||
.cm-s-ttcn .cm-sutOps,
|
||||
.cm-s-ttcn .cm-timerOps,
|
||||
.cm-s-ttcn .cm-verdictOps {color: #0000FF}
|
||||
.cm-s-ttcn .cm-preprocessor,
|
||||
.cm-s-ttcn .cm-templateMatch,
|
||||
.cm-s-ttcn .cm-ttcn3Macros {color: #27408B}
|
||||
.cm-s-ttcn .cm-types {color: #A52A2A; font-weight:bold}
|
||||
.cm-s-ttcn .cm-visibilityModifiers {font-weight:bold}
|
Loading…
Reference in a new issue