-
diff --git a/shared/codemirror/mode/rpm/rpm.js b/shared/codemirror/mode/rpm/rpm.js
deleted file mode 100644
index 87cde59..0000000
--- a/shared/codemirror/mode/rpm/rpm.js
+++ /dev/null
@@ -1,109 +0,0 @@
-// 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("rpm-changes", function() {
- var headerSeperator = /^-+$/;
- var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /;
- var simpleEmail = /^[\w+.-]+@[\w.-]+/;
-
- return {
- token: function(stream) {
- if (stream.sol()) {
- if (stream.match(headerSeperator)) { return 'tag'; }
- if (stream.match(headerLine)) { return 'tag'; }
- }
- if (stream.match(simpleEmail)) { return 'string'; }
- stream.next();
- return null;
- }
- };
-});
-
-CodeMirror.defineMIME("text/x-rpm-changes", "rpm-changes");
-
-// Quick and dirty spec file highlighting
-
-CodeMirror.defineMode("rpm-spec", function() {
- var arch = /^(i386|i586|i686|x86_64|ppc64le|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/;
-
- var preamble = /^[a-zA-Z0-9()]+:/;
- var section = /^%(debug_package|package|description|prep|build|install|files|clean|changelog|preinstall|preun|postinstall|postun|pretrans|posttrans|pre|post|triggerin|triggerun|verifyscript|check|triggerpostun|triggerprein|trigger)/;
- var control_flow_complex = /^%(ifnarch|ifarch|if)/; // rpm control flow macros
- var control_flow_simple = /^%(else|endif)/; // rpm control flow macros
- var operators = /^(\!|\?|\<\=|\<|\>\=|\>|\=\=|\&\&|\|\|)/; // operators in control flow macros
-
- return {
- startState: function () {
- return {
- controlFlow: false,
- macroParameters: false,
- section: false
- };
- },
- token: function (stream, state) {
- var ch = stream.peek();
- if (ch == "#") { stream.skipToEnd(); return "comment"; }
-
- if (stream.sol()) {
- if (stream.match(preamble)) { return "header"; }
- if (stream.match(section)) { return "atom"; }
- }
-
- if (stream.match(/^\$\w+/)) { return "def"; } // Variables like '$RPM_BUILD_ROOT'
- if (stream.match(/^\$\{\w+\}/)) { return "def"; } // Variables like '${RPM_BUILD_ROOT}'
-
- if (stream.match(control_flow_simple)) { return "keyword"; }
- if (stream.match(control_flow_complex)) {
- state.controlFlow = true;
- return "keyword";
- }
- if (state.controlFlow) {
- if (stream.match(operators)) { return "operator"; }
- if (stream.match(/^(\d+)/)) { return "number"; }
- if (stream.eol()) { state.controlFlow = false; }
- }
-
- if (stream.match(arch)) {
- if (stream.eol()) { state.controlFlow = false; }
- return "number";
- }
-
- // Macros like '%make_install' or '%attr(0775,root,root)'
- if (stream.match(/^%[\w]+/)) {
- if (stream.match(/^\(/)) { state.macroParameters = true; }
- return "keyword";
- }
- if (state.macroParameters) {
- if (stream.match(/^\d+/)) { return "number";}
- if (stream.match(/^\)/)) {
- state.macroParameters = false;
- return "keyword";
- }
- }
-
- // Macros like '%{defined fedora}'
- if (stream.match(/^%\{\??[\w \-\:\!]+\}/)) {
- if (stream.eol()) { state.controlFlow = false; }
- return "def";
- }
-
- //TODO: Include bash script sub-parser (CodeMirror supports that)
- stream.next();
- return null;
- }
- };
-});
-
-CodeMirror.defineMIME("text/x-rpm-spec", "rpm-spec");
-
-});
diff --git a/shared/codemirror/mode/rst/rst.js b/shared/codemirror/mode/rst/rst.js
deleted file mode 100644
index bcf110c..0000000
--- a/shared/codemirror/mode/rst/rst.js
+++ /dev/null
@@ -1,557 +0,0 @@
-// 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"), require("../python/python"), require("../stex/stex"), require("../../addon/mode/overlay"));
- else if (typeof define == "function" && define.amd) // AMD
- define(["../../lib/codemirror", "../python/python", "../stex/stex", "../../addon/mode/overlay"], mod);
- else // Plain browser env
- mod(CodeMirror);
-})(function(CodeMirror) {
-"use strict";
-
-CodeMirror.defineMode('rst', function (config, options) {
-
- var rx_strong = /^\*\*[^\*\s](?:[^\*]*[^\*\s])?\*\*/;
- var rx_emphasis = /^\*[^\*\s](?:[^\*]*[^\*\s])?\*/;
- var rx_literal = /^``[^`\s](?:[^`]*[^`\s])``/;
-
- var rx_number = /^(?:[\d]+(?:[\.,]\d+)*)/;
- var rx_positive = /^(?:\s\+[\d]+(?:[\.,]\d+)*)/;
- var rx_negative = /^(?:\s\-[\d]+(?:[\.,]\d+)*)/;
-
- var rx_uri_protocol = "[Hh][Tt][Tt][Pp][Ss]?://";
- var rx_uri_domain = "(?:[\\d\\w.-]+)\\.(?:\\w{2,6})";
- var rx_uri_path = "(?:/[\\d\\w\\#\\%\\&\\-\\.\\,\\/\\:\\=\\?\\~]+)*";
- var rx_uri = new RegExp("^" + rx_uri_protocol + rx_uri_domain + rx_uri_path);
-
- var overlay = {
- token: function (stream) {
-
- if (stream.match(rx_strong) && stream.match (/\W+|$/, false))
- return 'strong';
- if (stream.match(rx_emphasis) && stream.match (/\W+|$/, false))
- return 'em';
- if (stream.match(rx_literal) && stream.match (/\W+|$/, false))
- return 'string-2';
- if (stream.match(rx_number))
- return 'number';
- if (stream.match(rx_positive))
- return 'positive';
- if (stream.match(rx_negative))
- return 'negative';
- if (stream.match(rx_uri))
- return 'link';
-
- while (stream.next() != null) {
- if (stream.match(rx_strong, false)) break;
- if (stream.match(rx_emphasis, false)) break;
- if (stream.match(rx_literal, false)) break;
- if (stream.match(rx_number, false)) break;
- if (stream.match(rx_positive, false)) break;
- if (stream.match(rx_negative, false)) break;
- if (stream.match(rx_uri, false)) break;
- }
-
- return null;
- }
- };
-
- var mode = CodeMirror.getMode(
- config, options.backdrop || 'rst-base'
- );
-
- return CodeMirror.overlayMode(mode, overlay, true); // combine
-}, 'python', 'stex');
-
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-
-CodeMirror.defineMode('rst-base', function (config) {
-
- ///////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////
-
- function format(string) {
- var args = Array.prototype.slice.call(arguments, 1);
- return string.replace(/{(\d+)}/g, function (match, n) {
- return typeof args[n] != 'undefined' ? args[n] : match;
- });
- }
-
- ///////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////
-
- var mode_python = CodeMirror.getMode(config, 'python');
- var mode_stex = CodeMirror.getMode(config, 'stex');
-
- ///////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////
-
- var SEPA = "\\s+";
- var TAIL = "(?:\\s*|\\W|$)",
- rx_TAIL = new RegExp(format('^{0}', TAIL));
-
- var NAME =
- "(?:[^\\W\\d_](?:[\\w!\"#$%&'()\\*\\+,\\-\\.\/:;<=>\\?]*[^\\W_])?)",
- rx_NAME = new RegExp(format('^{0}', NAME));
- var NAME_WWS =
- "(?:[^\\W\\d_](?:[\\w\\s!\"#$%&'()\\*\\+,\\-\\.\/:;<=>\\?]*[^\\W_])?)";
- var REF_NAME = format('(?:{0}|`{1}`)', NAME, NAME_WWS);
-
- var TEXT1 = "(?:[^\\s\\|](?:[^\\|]*[^\\s\\|])?)";
- var TEXT2 = "(?:[^\\`]+)",
- rx_TEXT2 = new RegExp(format('^{0}', TEXT2));
-
- var rx_section = new RegExp(
- "^([!'#$%&\"()*+,-./:;<=>?@\\[\\\\\\]^_`{|}~])\\1{3,}\\s*$");
- var rx_explicit = new RegExp(
- format('^\\.\\.{0}', SEPA));
- var rx_link = new RegExp(
- format('^_{0}:{1}|^__:{1}', REF_NAME, TAIL));
- var rx_directive = new RegExp(
- format('^{0}::{1}', REF_NAME, TAIL));
- var rx_substitution = new RegExp(
- format('^\\|{0}\\|{1}{2}::{3}', TEXT1, SEPA, REF_NAME, TAIL));
- var rx_footnote = new RegExp(
- format('^\\[(?:\\d+|#{0}?|\\*)]{1}', REF_NAME, TAIL));
- var rx_citation = new RegExp(
- format('^\\[{0}\\]{1}', REF_NAME, TAIL));
-
- var rx_substitution_ref = new RegExp(
- format('^\\|{0}\\|', TEXT1));
- var rx_footnote_ref = new RegExp(
- format('^\\[(?:\\d+|#{0}?|\\*)]_', REF_NAME));
- var rx_citation_ref = new RegExp(
- format('^\\[{0}\\]_', REF_NAME));
- var rx_link_ref1 = new RegExp(
- format('^{0}__?', REF_NAME));
- var rx_link_ref2 = new RegExp(
- format('^`{0}`_', TEXT2));
-
- var rx_role_pre = new RegExp(
- format('^:{0}:`{1}`{2}', NAME, TEXT2, TAIL));
- var rx_role_suf = new RegExp(
- format('^`{1}`:{0}:{2}', NAME, TEXT2, TAIL));
- var rx_role = new RegExp(
- format('^:{0}:{1}', NAME, TAIL));
-
- var rx_directive_name = new RegExp(format('^{0}', REF_NAME));
- var rx_directive_tail = new RegExp(format('^::{0}', TAIL));
- var rx_substitution_text = new RegExp(format('^\\|{0}\\|', TEXT1));
- var rx_substitution_sepa = new RegExp(format('^{0}', SEPA));
- var rx_substitution_name = new RegExp(format('^{0}', REF_NAME));
- var rx_substitution_tail = new RegExp(format('^::{0}', TAIL));
- var rx_link_head = new RegExp("^_");
- var rx_link_name = new RegExp(format('^{0}|_', REF_NAME));
- var rx_link_tail = new RegExp(format('^:{0}', TAIL));
-
- var rx_verbatim = new RegExp('^::\\s*$');
- var rx_examples = new RegExp('^\\s+(?:>>>|In \\[\\d+\\]:)\\s');
-
- ///////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////
-
- function to_normal(stream, state) {
- var token = null;
-
- if (stream.sol() && stream.match(rx_examples, false)) {
- change(state, to_mode, {
- mode: mode_python, local: CodeMirror.startState(mode_python)
- });
- } else if (stream.sol() && stream.match(rx_explicit)) {
- change(state, to_explicit);
- token = 'meta';
- } else if (stream.sol() && stream.match(rx_section)) {
- change(state, to_normal);
- token = 'header';
- } else if (phase(state) == rx_role_pre ||
- stream.match(rx_role_pre, false)) {
-
- switch (stage(state)) {
- case 0:
- change(state, to_normal, context(rx_role_pre, 1));
- stream.match(/^:/);
- token = 'meta';
- break;
- case 1:
- change(state, to_normal, context(rx_role_pre, 2));
- stream.match(rx_NAME);
- token = 'keyword';
-
- if (stream.current().match(/^(?:math|latex)/)) {
- state.tmp_stex = true;
- }
- break;
- case 2:
- change(state, to_normal, context(rx_role_pre, 3));
- stream.match(/^:`/);
- token = 'meta';
- break;
- case 3:
- if (state.tmp_stex) {
- state.tmp_stex = undefined; state.tmp = {
- mode: mode_stex, local: CodeMirror.startState(mode_stex)
- };
- }
-
- if (state.tmp) {
- if (stream.peek() == '`') {
- change(state, to_normal, context(rx_role_pre, 4));
- state.tmp = undefined;
- break;
- }
-
- token = state.tmp.mode.token(stream, state.tmp.local);
- break;
- }
-
- change(state, to_normal, context(rx_role_pre, 4));
- stream.match(rx_TEXT2);
- token = 'string';
- break;
- case 4:
- change(state, to_normal, context(rx_role_pre, 5));
- stream.match(/^`/);
- token = 'meta';
- break;
- case 5:
- change(state, to_normal, context(rx_role_pre, 6));
- stream.match(rx_TAIL);
- break;
- default:
- change(state, to_normal);
- }
- } else if (phase(state) == rx_role_suf ||
- stream.match(rx_role_suf, false)) {
-
- switch (stage(state)) {
- case 0:
- change(state, to_normal, context(rx_role_suf, 1));
- stream.match(/^`/);
- token = 'meta';
- break;
- case 1:
- change(state, to_normal, context(rx_role_suf, 2));
- stream.match(rx_TEXT2);
- token = 'string';
- break;
- case 2:
- change(state, to_normal, context(rx_role_suf, 3));
- stream.match(/^`:/);
- token = 'meta';
- break;
- case 3:
- change(state, to_normal, context(rx_role_suf, 4));
- stream.match(rx_NAME);
- token = 'keyword';
- break;
- case 4:
- change(state, to_normal, context(rx_role_suf, 5));
- stream.match(/^:/);
- token = 'meta';
- break;
- case 5:
- change(state, to_normal, context(rx_role_suf, 6));
- stream.match(rx_TAIL);
- break;
- default:
- change(state, to_normal);
- }
- } else if (phase(state) == rx_role || stream.match(rx_role, false)) {
-
- switch (stage(state)) {
- case 0:
- change(state, to_normal, context(rx_role, 1));
- stream.match(/^:/);
- token = 'meta';
- break;
- case 1:
- change(state, to_normal, context(rx_role, 2));
- stream.match(rx_NAME);
- token = 'keyword';
- break;
- case 2:
- change(state, to_normal, context(rx_role, 3));
- stream.match(/^:/);
- token = 'meta';
- break;
- case 3:
- change(state, to_normal, context(rx_role, 4));
- stream.match(rx_TAIL);
- break;
- default:
- change(state, to_normal);
- }
- } else if (phase(state) == rx_substitution_ref ||
- stream.match(rx_substitution_ref, false)) {
-
- switch (stage(state)) {
- case 0:
- change(state, to_normal, context(rx_substitution_ref, 1));
- stream.match(rx_substitution_text);
- token = 'variable-2';
- break;
- case 1:
- change(state, to_normal, context(rx_substitution_ref, 2));
- if (stream.match(/^_?_?/)) token = 'link';
- break;
- default:
- change(state, to_normal);
- }
- } else if (stream.match(rx_footnote_ref)) {
- change(state, to_normal);
- token = 'quote';
- } else if (stream.match(rx_citation_ref)) {
- change(state, to_normal);
- token = 'quote';
- } else if (stream.match(rx_link_ref1)) {
- change(state, to_normal);
- if (!stream.peek() || stream.peek().match(/^\W$/)) {
- token = 'link';
- }
- } else if (phase(state) == rx_link_ref2 ||
- stream.match(rx_link_ref2, false)) {
-
- switch (stage(state)) {
- case 0:
- if (!stream.peek() || stream.peek().match(/^\W$/)) {
- change(state, to_normal, context(rx_link_ref2, 1));
- } else {
- stream.match(rx_link_ref2);
- }
- break;
- case 1:
- change(state, to_normal, context(rx_link_ref2, 2));
- stream.match(/^`/);
- token = 'link';
- break;
- case 2:
- change(state, to_normal, context(rx_link_ref2, 3));
- stream.match(rx_TEXT2);
- break;
- case 3:
- change(state, to_normal, context(rx_link_ref2, 4));
- stream.match(/^`_/);
- token = 'link';
- break;
- default:
- change(state, to_normal);
- }
- } else if (stream.match(rx_verbatim)) {
- change(state, to_verbatim);
- }
-
- else {
- if (stream.next()) change(state, to_normal);
- }
-
- return token;
- }
-
- ///////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////
-
- function to_explicit(stream, state) {
- var token = null;
-
- if (phase(state) == rx_substitution ||
- stream.match(rx_substitution, false)) {
-
- switch (stage(state)) {
- case 0:
- change(state, to_explicit, context(rx_substitution, 1));
- stream.match(rx_substitution_text);
- token = 'variable-2';
- break;
- case 1:
- change(state, to_explicit, context(rx_substitution, 2));
- stream.match(rx_substitution_sepa);
- break;
- case 2:
- change(state, to_explicit, context(rx_substitution, 3));
- stream.match(rx_substitution_name);
- token = 'keyword';
- break;
- case 3:
- change(state, to_explicit, context(rx_substitution, 4));
- stream.match(rx_substitution_tail);
- token = 'meta';
- break;
- default:
- change(state, to_normal);
- }
- } else if (phase(state) == rx_directive ||
- stream.match(rx_directive, false)) {
-
- switch (stage(state)) {
- case 0:
- change(state, to_explicit, context(rx_directive, 1));
- stream.match(rx_directive_name);
- token = 'keyword';
-
- if (stream.current().match(/^(?:math|latex)/))
- state.tmp_stex = true;
- else if (stream.current().match(/^python/))
- state.tmp_py = true;
- break;
- case 1:
- change(state, to_explicit, context(rx_directive, 2));
- stream.match(rx_directive_tail);
- token = 'meta';
-
- if (stream.match(/^latex\s*$/) || state.tmp_stex) {
- state.tmp_stex = undefined; change(state, to_mode, {
- mode: mode_stex, local: CodeMirror.startState(mode_stex)
- });
- }
- break;
- case 2:
- change(state, to_explicit, context(rx_directive, 3));
- if (stream.match(/^python\s*$/) || state.tmp_py) {
- state.tmp_py = undefined; change(state, to_mode, {
- mode: mode_python, local: CodeMirror.startState(mode_python)
- });
- }
- break;
- default:
- change(state, to_normal);
- }
- } else if (phase(state) == rx_link || stream.match(rx_link, false)) {
-
- switch (stage(state)) {
- case 0:
- change(state, to_explicit, context(rx_link, 1));
- stream.match(rx_link_head);
- stream.match(rx_link_name);
- token = 'link';
- break;
- case 1:
- change(state, to_explicit, context(rx_link, 2));
- stream.match(rx_link_tail);
- token = 'meta';
- break;
- default:
- change(state, to_normal);
- }
- } else if (stream.match(rx_footnote)) {
- change(state, to_normal);
- token = 'quote';
- } else if (stream.match(rx_citation)) {
- change(state, to_normal);
- token = 'quote';
- }
-
- else {
- stream.eatSpace();
- if (stream.eol()) {
- change(state, to_normal);
- } else {
- stream.skipToEnd();
- change(state, to_comment);
- token = 'comment';
- }
- }
-
- return token;
- }
-
- ///////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////
-
- function to_comment(stream, state) {
- return as_block(stream, state, 'comment');
- }
-
- function to_verbatim(stream, state) {
- return as_block(stream, state, 'meta');
- }
-
- function as_block(stream, state, token) {
- if (stream.eol() || stream.eatSpace()) {
- stream.skipToEnd();
- return token;
- } else {
- change(state, to_normal);
- return null;
- }
- }
-
- ///////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////
-
- function to_mode(stream, state) {
-
- if (state.ctx.mode && state.ctx.local) {
-
- if (stream.sol()) {
- if (!stream.eatSpace()) change(state, to_normal);
- return null;
- }
-
- return state.ctx.mode.token(stream, state.ctx.local);
- }
-
- change(state, to_normal);
- return null;
- }
-
- ///////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////
-
- function context(phase, stage, mode, local) {
- return {phase: phase, stage: stage, mode: mode, local: local};
- }
-
- function change(state, tok, ctx) {
- state.tok = tok;
- state.ctx = ctx || {};
- }
-
- function stage(state) {
- return state.ctx.stage || 0;
- }
-
- function phase(state) {
- return state.ctx.phase;
- }
-
- ///////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////
-
- return {
- startState: function () {
- return {tok: to_normal, ctx: context(undefined, 0)};
- },
-
- copyState: function (state) {
- var ctx = state.ctx, tmp = state.tmp;
- if (ctx.local)
- ctx = {mode: ctx.mode, local: CodeMirror.copyState(ctx.mode, ctx.local)};
- if (tmp)
- tmp = {mode: tmp.mode, local: CodeMirror.copyState(tmp.mode, tmp.local)};
- return {tok: state.tok, ctx: ctx, tmp: tmp};
- },
-
- innerMode: function (state) {
- return state.tmp ? {state: state.tmp.local, mode: state.tmp.mode}
- : state.ctx.mode ? {state: state.ctx.local, mode: state.ctx.mode}
- : null;
- },
-
- token: function (stream, state) {
- return state.tok(stream, state);
- }
- };
-}, 'python', 'stex');
-
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-
-CodeMirror.defineMIME('text/x-rst', 'rst');
-
-///////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////
-
-});
diff --git a/shared/codemirror/mode/ruby/ruby.js b/shared/codemirror/mode/ruby/ruby.js
deleted file mode 100644
index 10cad8d..0000000
--- a/shared/codemirror/mode/ruby/ruby.js
+++ /dev/null
@@ -1,285 +0,0 @@
-// 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("ruby", function(config) {
- function wordObj(words) {
- var o = {};
- for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true;
- return o;
- }
- var keywords = wordObj([
- "alias", "and", "BEGIN", "begin", "break", "case", "class", "def", "defined?", "do", "else",
- "elsif", "END", "end", "ensure", "false", "for", "if", "in", "module", "next", "not", "or",
- "redo", "rescue", "retry", "return", "self", "super", "then", "true", "undef", "unless",
- "until", "when", "while", "yield", "nil", "raise", "throw", "catch", "fail", "loop", "callcc",
- "caller", "lambda", "proc", "public", "protected", "private", "require", "load",
- "require_relative", "extend", "autoload", "__END__", "__FILE__", "__LINE__", "__dir__"
- ]);
- var indentWords = wordObj(["def", "class", "case", "for", "while", "until", "module", "then",
- "catch", "loop", "proc", "begin"]);
- var dedentWords = wordObj(["end", "until"]);
- var matching = {"[": "]", "{": "}", "(": ")"};
- var curPunc;
-
- function chain(newtok, stream, state) {
- state.tokenize.push(newtok);
- return newtok(stream, state);
- }
-
- function tokenBase(stream, state) {
- if (stream.sol() && stream.match("=begin") && stream.eol()) {
- state.tokenize.push(readBlockComment);
- return "comment";
- }
- if (stream.eatSpace()) return null;
- var ch = stream.next(), m;
- if (ch == "`" || ch == "'" || ch == '"') {
- return chain(readQuoted(ch, "string", ch == '"' || ch == "`"), stream, state);
- } else if (ch == "/") {
- var currentIndex = stream.current().length;
- if (stream.skipTo("/")) {
- var search_till = stream.current().length;
- stream.backUp(stream.current().length - currentIndex);
- var balance = 0; // balance brackets
- while (stream.current().length < search_till) {
- var chchr = stream.next();
- if (chchr == "(") balance += 1;
- else if (chchr == ")") balance -= 1;
- if (balance < 0) break;
- }
- stream.backUp(stream.current().length - currentIndex);
- if (balance == 0)
- return chain(readQuoted(ch, "string-2", true), stream, state);
- }
- return "operator";
- } else if (ch == "%") {
- var style = "string", embed = true;
- if (stream.eat("s")) style = "atom";
- else if (stream.eat(/[WQ]/)) style = "string";
- else if (stream.eat(/[r]/)) style = "string-2";
- else if (stream.eat(/[wxq]/)) { style = "string"; embed = false; }
- var delim = stream.eat(/[^\w\s=]/);
- if (!delim) return "operator";
- if (matching.propertyIsEnumerable(delim)) delim = matching[delim];
- return chain(readQuoted(delim, style, embed, true), stream, state);
- } else if (ch == "#") {
- stream.skipToEnd();
- return "comment";
- } else if (ch == "<" && (m = stream.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/))) {
- return chain(readHereDoc(m[1]), stream, state);
- } else if (ch == "0") {
- if (stream.eat("x")) stream.eatWhile(/[\da-fA-F]/);
- else if (stream.eat("b")) stream.eatWhile(/[01]/);
- else stream.eatWhile(/[0-7]/);
- return "number";
- } else if (/\d/.test(ch)) {
- stream.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/);
- return "number";
- } else if (ch == "?") {
- while (stream.match(/^\\[CM]-/)) {}
- if (stream.eat("\\")) stream.eatWhile(/\w/);
- else stream.next();
- return "string";
- } else if (ch == ":") {
- if (stream.eat("'")) return chain(readQuoted("'", "atom", false), stream, state);
- if (stream.eat('"')) return chain(readQuoted('"', "atom", true), stream, state);
-
- // :> :>> :< :<< are valid symbols
- if (stream.eat(/[\<\>]/)) {
- stream.eat(/[\<\>]/);
- return "atom";
- }
-
- // :+ :- :/ :* :| :& :! are valid symbols
- if (stream.eat(/[\+\-\*\/\&\|\:\!]/)) {
- return "atom";
- }
-
- // Symbols can't start by a digit
- if (stream.eat(/[a-zA-Z$@_\xa1-\uffff]/)) {
- stream.eatWhile(/[\w$\xa1-\uffff]/);
- // Only one ? ! = is allowed and only as the last character
- stream.eat(/[\?\!\=]/);
- return "atom";
- }
- return "operator";
- } else if (ch == "@" && stream.match(/^@?[a-zA-Z_\xa1-\uffff]/)) {
- stream.eat("@");
- stream.eatWhile(/[\w\xa1-\uffff]/);
- return "variable-2";
- } else if (ch == "$") {
- if (stream.eat(/[a-zA-Z_]/)) {
- stream.eatWhile(/[\w]/);
- } else if (stream.eat(/\d/)) {
- stream.eat(/\d/);
- } else {
- stream.next(); // Must be a special global like $: or $!
- }
- return "variable-3";
- } else if (/[a-zA-Z_\xa1-\uffff]/.test(ch)) {
- stream.eatWhile(/[\w\xa1-\uffff]/);
- stream.eat(/[\?\!]/);
- if (stream.eat(":")) return "atom";
- return "ident";
- } else if (ch == "|" && (state.varList || state.lastTok == "{" || state.lastTok == "do")) {
- curPunc = "|";
- return null;
- } else if (/[\(\)\[\]{}\\;]/.test(ch)) {
- curPunc = ch;
- return null;
- } else if (ch == "-" && stream.eat(">")) {
- return "arrow";
- } else if (/[=+\-\/*:\.^%<>~|]/.test(ch)) {
- var more = stream.eatWhile(/[=+\-\/*:\.^%<>~|]/);
- if (ch == "." && !more) curPunc = ".";
- return "operator";
- } else {
- return null;
- }
- }
-
- function tokenBaseUntilBrace(depth) {
- if (!depth) depth = 1;
- return function(stream, state) {
- if (stream.peek() == "}") {
- if (depth == 1) {
- state.tokenize.pop();
- return state.tokenize[state.tokenize.length-1](stream, state);
- } else {
- state.tokenize[state.tokenize.length - 1] = tokenBaseUntilBrace(depth - 1);
- }
- } else if (stream.peek() == "{") {
- state.tokenize[state.tokenize.length - 1] = tokenBaseUntilBrace(depth + 1);
- }
- return tokenBase(stream, state);
- };
- }
- function tokenBaseOnce() {
- var alreadyCalled = false;
- return function(stream, state) {
- if (alreadyCalled) {
- state.tokenize.pop();
- return state.tokenize[state.tokenize.length-1](stream, state);
- }
- alreadyCalled = true;
- return tokenBase(stream, state);
- };
- }
- function readQuoted(quote, style, embed, unescaped) {
- return function(stream, state) {
- var escaped = false, ch;
-
- if (state.context.type === 'read-quoted-paused') {
- state.context = state.context.prev;
- stream.eat("}");
- }
-
- while ((ch = stream.next()) != null) {
- if (ch == quote && (unescaped || !escaped)) {
- state.tokenize.pop();
- break;
- }
- if (embed && ch == "#" && !escaped) {
- if (stream.eat("{")) {
- if (quote == "}") {
- state.context = {prev: state.context, type: 'read-quoted-paused'};
- }
- state.tokenize.push(tokenBaseUntilBrace());
- break;
- } else if (/[@\$]/.test(stream.peek())) {
- state.tokenize.push(tokenBaseOnce());
- break;
- }
- }
- escaped = !escaped && ch == "\\";
- }
- return style;
- };
- }
- function readHereDoc(phrase) {
- return function(stream, state) {
- if (stream.match(phrase)) state.tokenize.pop();
- else stream.skipToEnd();
- return "string";
- };
- }
- function readBlockComment(stream, state) {
- if (stream.sol() && stream.match("=end") && stream.eol())
- state.tokenize.pop();
- stream.skipToEnd();
- return "comment";
- }
-
- return {
- startState: function() {
- return {tokenize: [tokenBase],
- indented: 0,
- context: {type: "top", indented: -config.indentUnit},
- continuedLine: false,
- lastTok: null,
- varList: false};
- },
-
- token: function(stream, state) {
- curPunc = null;
- if (stream.sol()) state.indented = stream.indentation();
- var style = state.tokenize[state.tokenize.length-1](stream, state), kwtype;
- var thisTok = curPunc;
- if (style == "ident") {
- var word = stream.current();
- style = state.lastTok == "." ? "property"
- : keywords.propertyIsEnumerable(stream.current()) ? "keyword"
- : /^[A-Z]/.test(word) ? "tag"
- : (state.lastTok == "def" || state.lastTok == "class" || state.varList) ? "def"
- : "variable";
- if (style == "keyword") {
- thisTok = word;
- if (indentWords.propertyIsEnumerable(word)) kwtype = "indent";
- else if (dedentWords.propertyIsEnumerable(word)) kwtype = "dedent";
- else if ((word == "if" || word == "unless") && stream.column() == stream.indentation())
- kwtype = "indent";
- else if (word == "do" && state.context.indented < state.indented)
- kwtype = "indent";
- }
- }
- if (curPunc || (style && style != "comment")) state.lastTok = thisTok;
- if (curPunc == "|") state.varList = !state.varList;
-
- if (kwtype == "indent" || /[\(\[\{]/.test(curPunc))
- state.context = {prev: state.context, type: curPunc || style, indented: state.indented};
- else if ((kwtype == "dedent" || /[\)\]\}]/.test(curPunc)) && state.context.prev)
- state.context = state.context.prev;
-
- if (stream.eol())
- state.continuedLine = (curPunc == "\\" || style == "operator");
- return style;
- },
-
- indent: function(state, textAfter) {
- if (state.tokenize[state.tokenize.length-1] != tokenBase) return 0;
- var firstChar = textAfter && textAfter.charAt(0);
- var ct = state.context;
- var closing = ct.type == matching[firstChar] ||
- ct.type == "keyword" && /^(?:end|until|else|elsif|when|rescue)\b/.test(textAfter);
- return ct.indented + (closing ? 0 : config.indentUnit) +
- (state.continuedLine ? config.indentUnit : 0);
- },
-
- electricInput: /^\s*(?:end|rescue|\})$/,
- lineComment: "#"
- };
-});
-
-CodeMirror.defineMIME("text/x-ruby", "ruby");
-
-});
diff --git a/shared/codemirror/mode/rust/rust.js b/shared/codemirror/mode/rust/rust.js
deleted file mode 100644
index 8558b53..0000000
--- a/shared/codemirror/mode/rust/rust.js
+++ /dev/null
@@ -1,71 +0,0 @@
-// 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"), 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("rust",{
- start: [
- // string and byte string
- {regex: /b?"/, token: "string", next: "string"},
- // raw string and raw byte string
- {regex: /b?r"/, token: "string", next: "string_raw"},
- {regex: /b?r#+"/, token: "string", next: "string_raw_hash"},
- // character
- {regex: /'(?:[^'\\]|\\(?:[nrt0'"]|x[\da-fA-F]{2}|u\{[\da-fA-F]{6}\}))'/, token: "string-2"},
- // byte
- {regex: /b'(?:[^']|\\(?:['\\nrt0]|x[\da-fA-F]{2}))'/, token: "string-2"},
-
- {regex: /(?:(?:[0-9][0-9_]*)(?:(?:[Ee][+-]?[0-9_]+)|\.[0-9_]+(?:[Ee][+-]?[0-9_]+)?)(?:f32|f64)?)|(?:0(?:b[01_]+|(?:o[0-7_]+)|(?:x[0-9a-fA-F_]+))|(?:[0-9][0-9_]*))(?:u8|u16|u32|u64|i8|i16|i32|i64|isize|usize)?/,
- token: "number"},
- {regex: /(let(?:\s+mut)?|fn|enum|mod|struct|type)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)/, token: ["keyword", null, "def"]},
- {regex: /(?:abstract|alignof|as|box|break|continue|const|crate|do|else|enum|extern|fn|for|final|if|impl|in|loop|macro|match|mod|move|offsetof|override|priv|proc|pub|pure|ref|return|self|sizeof|static|struct|super|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\b/, token: "keyword"},
- {regex: /\b(?:Self|isize|usize|char|bool|u8|u16|u32|u64|f16|f32|f64|i8|i16|i32|i64|str|Option)\b/, token: "atom"},
- {regex: /\b(?:true|false|Some|None|Ok|Err)\b/, token: "builtin"},
- {regex: /\b(fn)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)/,
- token: ["keyword", null ,"def"]},
- {regex: /#!?\[.*\]/, token: "meta"},
- {regex: /\/\/.*/, token: "comment"},
- {regex: /\/\*/, token: "comment", next: "comment"},
- {regex: /[-+\/*=<>!]+/, token: "operator"},
- {regex: /[a-zA-Z_]\w*!/,token: "variable-3"},
- {regex: /[a-zA-Z_]\w*/, token: "variable"},
- {regex: /[\{\[\(]/, indent: true},
- {regex: /[\}\]\)]/, dedent: true}
- ],
- string: [
- {regex: /"/, token: "string", next: "start"},
- {regex: /(?:[^\\"]|\\(?:.|$))*/, token: "string"}
- ],
- string_raw: [
- {regex: /"/, token: "string", next: "start"},
- {regex: /[^"]*/, token: "string"}
- ],
- string_raw_hash: [
- {regex: /"#+/, token: "string", next: "start"},
- {regex: /(?:[^"]|"(?!#))*/, token: "string"}
- ],
- comment: [
- {regex: /.*?\*\//, token: "comment", next: "start"},
- {regex: /.*/, token: "comment"}
- ],
- meta: {
- dontIndentStates: ["comment"],
- electricInput: /^\s*\}$/,
- blockCommentStart: "/*",
- blockCommentEnd: "*/",
- lineComment: "//",
- fold: "brace"
- }
-});
-
-
-CodeMirror.defineMIME("text/x-rustsrc", "rust");
-});
diff --git a/shared/codemirror/mode/sas/sas.js b/shared/codemirror/mode/sas/sas.js
deleted file mode 100644
index fe11482..0000000
--- a/shared/codemirror/mode/sas/sas.js
+++ /dev/null
@@ -1,315 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-
-// SAS mode copyright (c) 2016 Jared Dean, SAS Institute
-// Created by Jared Dean
-
-// TODO
-// indent and de-indent
-// identify macro variables
-
-
-//Definitions
-// comment -- text withing * ; or /* */
-// keyword -- SAS language variable
-// variable -- macro variables starts with '&' or variable formats
-// variable-2 -- DATA Step, proc, or macro names
-// string -- text within ' ' or " "
-// operator -- numeric operator + / - * ** le eq ge ... and so on
-// builtin -- proc %macro data run mend
-// atom
-// def
-
-(function(mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"));
- else if (typeof define == "function" && define.amd) // AMD
- define(["../../lib/codemirror"], mod);
- else // Plain browser env
- mod(CodeMirror);
-})(function(CodeMirror) {
- "use strict";
-
- CodeMirror.defineMode("sas", function () {
- var words = {};
- var isDoubleOperatorSym = {
- eq: 'operator',
- lt: 'operator',
- le: 'operator',
- gt: 'operator',
- ge: 'operator',
- "in": 'operator',
- ne: 'operator',
- or: 'operator'
- };
- var isDoubleOperatorChar = /(<=|>=|!=|<>)/;
- var isSingleOperatorChar = /[=\(:\),{}.*<>+\-\/^\[\]]/;
-
- // Takes a string of words separated by spaces and adds them as
- // keys with the value of the first argument 'style'
- function define(style, string, context) {
- if (context) {
- var split = string.split(' ');
- for (var i = 0; i < split.length; i++) {
- words[split[i]] = {style: style, state: context};
- }
- }
- }
- //datastep
- define('def', 'stack pgm view source debug nesting nolist', ['inDataStep']);
- define('def', 'if while until for do do; end end; then else cancel', ['inDataStep']);
- define('def', 'label format _n_ _error_', ['inDataStep']);
- define('def', 'ALTER BUFNO BUFSIZE CNTLLEV COMPRESS DLDMGACTION ENCRYPT ENCRYPTKEY EXTENDOBSCOUNTER GENMAX GENNUM INDEX LABEL OBSBUF OUTREP PW PWREQ READ REPEMPTY REPLACE REUSE ROLE SORTEDBY SPILL TOBSNO TYPE WRITE FILECLOSE FIRSTOBS IN OBS POINTOBS WHERE WHEREUP IDXNAME IDXWHERE DROP KEEP RENAME', ['inDataStep']);
- define('def', 'filevar finfo finv fipname fipnamel fipstate first firstobs floor', ['inDataStep']);
- define('def', 'varfmt varinfmt varlabel varlen varname varnum varray varrayx vartype verify vformat vformatd vformatdx vformatn vformatnx vformatw vformatwx vformatx vinarray vinarrayx vinformat vinformatd vinformatdx vinformatn vinformatnx vinformatw vinformatwx vinformatx vlabel vlabelx vlength vlengthx vname vnamex vnferr vtype vtypex weekday', ['inDataStep']);
- define('def', 'zipfips zipname zipnamel zipstate', ['inDataStep']);
- define('def', 'put putc putn', ['inDataStep']);
- define('builtin', 'data run', ['inDataStep']);
-
-
- //proc
- define('def', 'data', ['inProc']);
-
- // flow control for macros
- define('def', '%if %end %end; %else %else; %do %do; %then', ['inMacro']);
-
- //everywhere
- define('builtin', 'proc run; quit; libname filename %macro %mend option options', ['ALL']);
-
- define('def', 'footnote title libname ods', ['ALL']);
- define('def', '%let %put %global %sysfunc %eval ', ['ALL']);
- // automatic macro variables http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a003167023.htm
- define('variable', '&sysbuffr &syscc &syscharwidth &syscmd &sysdate &sysdate9 &sysday &sysdevic &sysdmg &sysdsn &sysencoding &sysenv &syserr &syserrortext &sysfilrc &syshostname &sysindex &sysinfo &sysjobid &syslast &syslckrc &syslibrc &syslogapplname &sysmacroname &sysmenv &sysmsg &sysncpu &sysodspath &sysparm &syspbuff &sysprocessid &sysprocessname &sysprocname &sysrc &sysscp &sysscpl &sysscpl &syssite &sysstartid &sysstartname &systcpiphostname &systime &sysuserid &sysver &sysvlong &sysvlong4 &syswarningtext', ['ALL']);
-
- //footnote[1-9]? title[1-9]?
-
- //options statement
- define('def', 'source2 nosource2 page pageno pagesize', ['ALL']);
-
- //proc and datastep
- define('def', '_all_ _character_ _cmd_ _freq_ _i_ _infile_ _last_ _msg_ _null_ _numeric_ _temporary_ _type_ abort abs addr adjrsq airy alpha alter altlog altprint and arcos array arsin as atan attrc attrib attrn authserver autoexec awscontrol awsdef awsmenu awsmenumerge awstitle backward band base betainv between blocksize blshift bnot bor brshift bufno bufsize bxor by byerr byline byte calculated call cards cards4 catcache cbufno cdf ceil center cexist change chisq cinv class cleanup close cnonct cntllev coalesce codegen col collate collin column comamid comaux1 comaux2 comdef compbl compound compress config continue convert cos cosh cpuid create cross crosstab css curobs cv daccdb daccdbsl daccsl daccsyd dacctab dairy datalines datalines4 datejul datepart datetime day dbcslang dbcstype dclose ddm delete delimiter depdb depdbsl depsl depsyd deptab dequote descending descript design= device dflang dhms dif digamma dim dinfo display distinct dkricond dkrocond dlm dnum do dopen doptname doptnum dread drop dropnote dsname dsnferr echo else emaildlg emailid emailpw emailserver emailsys encrypt end endsas engine eof eov erf erfc error errorcheck errors exist exp fappend fclose fcol fdelete feedback fetch fetchobs fexist fget file fileclose fileexist filefmt filename fileref fmterr fmtsearch fnonct fnote font fontalias fopen foptname foptnum force formatted formchar formdelim formdlim forward fpoint fpos fput fread frewind frlen from fsep fuzz fwrite gaminv gamma getoption getvarc getvarn go goto group gwindow hbar hbound helpenv helploc hms honorappearance hosthelp hostprint hour hpct html hvar ibessel ibr id if index indexc indexw initcmd initstmt inner input inputc inputn inr insert int intck intnx into intrr invaliddata irr is jbessel join juldate keep kentb kurtosis label lag last lbound leave left length levels lgamma lib library libref line linesize link list log log10 log2 logpdf logpmf logsdf lostcard lowcase lrecl ls macro macrogen maps mautosource max maxdec maxr mdy mean measures median memtype merge merror min minute missing missover mlogic mod mode model modify month mopen mort mprint mrecall msglevel msymtabmax mvarsize myy n nest netpv new news nmiss no nobatch nobs nocaps nocardimage nocenter nocharcode nocmdmac nocol nocum nodate nodbcs nodetails nodmr nodms nodmsbatch nodup nodupkey noduplicates noechoauto noequals noerrorabend noexitwindows nofullstimer noicon noimplmac noint nolist noloadlist nomiss nomlogic nomprint nomrecall nomsgcase nomstored nomultenvappl nonotes nonumber noobs noovp nopad nopercent noprint noprintinit normal norow norsasuser nosetinit nosplash nosymbolgen note notes notitle notitles notsorted noverbose noxsync noxwait npv null number numkeys nummousekeys nway obs on open order ordinal otherwise out outer outp= output over ovp p(1 5 10 25 50 75 90 95 99) pad pad2 paired parm parmcards path pathdll pathname pdf peek peekc pfkey pmf point poisson poke position printer probbeta probbnml probchi probf probgam probhypr probit probnegb probnorm probsig probt procleave prt ps pw pwreq qtr quote r ranbin rancau ranexp rangam range ranks rannor ranpoi rantbl rantri ranuni read recfm register regr remote remove rename repeat replace resolve retain return reuse reverse rewind right round rsquare rtf rtrace rtraceloc s s2 samploc sasautos sascontrol sasfrscr sasmsg sasmstore sasscript sasuser saving scan sdf second select selection separated seq serror set setcomm setot sign simple sin sinh siteinfo skewness skip sle sls sortedby sortpgm sortseq sortsize soundex spedis splashlocation split spool sqrt start std stderr stdin stfips stimer stname stnamel stop stopover subgroup subpopn substr sum sumwgt symbol symbolgen symget symput sysget sysin sysleave sysmsg sysparm sysprint sysprintfont sysprod sysrc system t table tables tan tanh tapeclose tbufsize terminal test then timepart tinv tnonct to today tol tooldef totper transformout translate trantab tranwrd trigamma trim trimn trunc truncover type unformatted uniform union until upcase update user usericon uss validate value var weight when where while wincharset window work workinit workterm write wsum xsync xwait yearcutoff yes yyq min max', ['inDataStep', 'inProc']);
- define('operator', 'and not ', ['inDataStep', 'inProc']);
-
- // Main function
- function tokenize(stream, state) {
- // Finally advance the stream
- var ch = stream.next();
-
- // BLOCKCOMMENT
- if (ch === '/' && stream.eat('*')) {
- state.continueComment = true;
- return "comment";
- } else if (state.continueComment === true) { // in comment block
- //comment ends at the beginning of the line
- if (ch === '*' && stream.peek() === '/') {
- stream.next();
- state.continueComment = false;
- } else if (stream.skipTo('*')) { //comment is potentially later in line
- stream.skipTo('*');
- stream.next();
- if (stream.eat('/'))
- state.continueComment = false;
- } else {
- stream.skipToEnd();
- }
- return "comment";
- }
-
- // DoubleOperator match
- var doubleOperator = ch + stream.peek();
-
- // Match all line comments.
- var myString = stream.string;
- var myRegexp = /(?:^\s*|[;]\s*)(\*.*?);/ig;
- var match = myRegexp.exec(myString);
- if (match !== null) {
- if (match.index === 0 && (stream.column() !== (match.index + match[0].length - 1))) {
- stream.backUp(stream.column());
- stream.skipTo(';');
- stream.next();
- return 'comment';
- } else if (match.index + 1 < stream.column() && stream.column() < match.index + match[0].length - 1) {
- // the ';' triggers the match so move one past it to start
- // the comment block that is why match.index+1
- stream.backUp(stream.column() - match.index - 1);
- stream.skipTo(';');
- stream.next();
- return 'comment';
- }
- } else if (!state.continueString && (ch === '"' || ch === "'")) {
- // Have we found a string?
- state.continueString = ch; //save the matching quote in the state
- return "string";
- } else if (state.continueString !== null) {
- if (stream.skipTo(state.continueString)) {
- // quote found on this line
- stream.next();
- state.continueString = null;
- } else {
- stream.skipToEnd();
- }
- return "string";
- } else if (state.continueString !== null && stream.eol()) {
- stream.skipTo(state.continueString) || stream.skipToEnd();
- return "string";
- } else if (/[\d\.]/.test(ch)) { //find numbers
- if (ch === ".")
- stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/);
- else if (ch === "0")
- stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/);
- else
- stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/);
- return "number";
- } else if (isDoubleOperatorChar.test(ch + stream.peek())) { // TWO SYMBOL TOKENS
- stream.next();
- return "operator";
- } else if (isDoubleOperatorSym.hasOwnProperty(doubleOperator)) {
- stream.next();
- if (stream.peek() === ' ')
- return isDoubleOperatorSym[doubleOperator.toLowerCase()];
- } else if (isSingleOperatorChar.test(ch)) { // SINGLE SYMBOL TOKENS
- return "operator";
- }
-
- // Matches one whole word -- even if the word is a character
- var word;
- if (stream.match(/[%&;\w]+/, false) != null) {
- word = ch + stream.match(/[%&;\w]+/, true);
- if (/&/.test(word)) return 'variable'
- } else {
- word = ch;
- }
- // the word after DATA PROC or MACRO
- if (state.nextword) {
- stream.match(/[\w]+/);
- // match memname.libname
- if (stream.peek() === '.') stream.skipTo(' ');
- state.nextword = false;
- return 'variable-2';
-
- }
-
- // Are we in a DATA Step?
- if (state.inDataStep) {
- if (word.toLowerCase() === 'run;' || stream.match(/run\s;/)) {
- state.inDataStep = false;
- return 'builtin';
- }
- // variable formats
- if ((word) && stream.next() === '.') {
- //either a format or libname.memname
- if (/\w/.test(stream.peek())) return 'variable-2';
- else return 'variable';
- }
- // do we have a DATA Step keyword
- if (word && words.hasOwnProperty(word.toLowerCase()) &&
- (words[word.toLowerCase()].state.indexOf("inDataStep") !== -1 ||
- words[word.toLowerCase()].state.indexOf("ALL") !== -1)) {
- //backup to the start of the word
- if (stream.start < stream.pos)
- stream.backUp(stream.pos - stream.start);
- //advance the length of the word and return
- for (var i = 0; i < word.length; ++i) stream.next();
- return words[word.toLowerCase()].style;
- }
- }
- // Are we in an Proc statement?
- if (state.inProc) {
- if (word.toLowerCase() === 'run;' || word.toLowerCase() === 'quit;') {
- state.inProc = false;
- return 'builtin';
- }
- // do we have a proc keyword
- if (word && words.hasOwnProperty(word.toLowerCase()) &&
- (words[word.toLowerCase()].state.indexOf("inProc") !== -1 ||
- words[word.toLowerCase()].state.indexOf("ALL") !== -1)) {
- stream.match(/[\w]+/);
- return words[word].style;
- }
- }
- // Are we in a Macro statement?
- if (state.inMacro) {
- if (word.toLowerCase() === '%mend') {
- if (stream.peek() === ';') stream.next();
- state.inMacro = false;
- return 'builtin';
- }
- if (word && words.hasOwnProperty(word.toLowerCase()) &&
- (words[word.toLowerCase()].state.indexOf("inMacro") !== -1 ||
- words[word.toLowerCase()].state.indexOf("ALL") !== -1)) {
- stream.match(/[\w]+/);
- return words[word.toLowerCase()].style;
- }
-
- return 'atom';
- }
- // Do we have Keywords specific words?
- if (word && words.hasOwnProperty(word.toLowerCase())) {
- // Negates the initial next()
- stream.backUp(1);
- // Actually move the stream
- stream.match(/[\w]+/);
- if (word.toLowerCase() === 'data' && /=/.test(stream.peek()) === false) {
- state.inDataStep = true;
- state.nextword = true;
- return 'builtin';
- }
- if (word.toLowerCase() === 'proc') {
- state.inProc = true;
- state.nextword = true;
- return 'builtin';
- }
- if (word.toLowerCase() === '%macro') {
- state.inMacro = true;
- state.nextword = true;
- return 'builtin';
- }
- if (/title[1-9]/i.test(word)) return 'def';
-
- if (word.toLowerCase() === 'footnote') {
- stream.eat(/[1-9]/);
- return 'def';
- }
-
- // Returns their value as state in the prior define methods
- if (state.inDataStep === true && words[word.toLowerCase()].state.indexOf("inDataStep") !== -1)
- return words[word.toLowerCase()].style;
- if (state.inProc === true && words[word.toLowerCase()].state.indexOf("inProc") !== -1)
- return words[word.toLowerCase()].style;
- if (state.inMacro === true && words[word.toLowerCase()].state.indexOf("inMacro") !== -1)
- return words[word.toLowerCase()].style;
- if (words[word.toLowerCase()].state.indexOf("ALL") !== -1)
- return words[word.toLowerCase()].style;
- return null;
- }
- // Unrecognized syntax
- return null;
- }
-
- return {
- startState: function () {
- return {
- inDataStep: false,
- inProc: false,
- inMacro: false,
- nextword: false,
- continueString: null,
- continueComment: false
- };
- },
- token: function (stream, state) {
- // Strip the spaces, but regex will account for them either way
- if (stream.eatSpace()) return null;
- // Go through the main process
- return tokenize(stream, state);
- },
-
- blockCommentStart: "/*",
- blockCommentEnd: "*/"
- };
-
- });
-
- CodeMirror.defineMIME("text/x-sas", "sas");
-});
diff --git a/shared/codemirror/mode/sass/sass.js b/shared/codemirror/mode/sass/sass.js
deleted file mode 100644
index 6973ece..0000000
--- a/shared/codemirror/mode/sass/sass.js
+++ /dev/null
@@ -1,414 +0,0 @@
-// 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("sass", function(config) {
- function tokenRegexp(words) {
- return new RegExp("^" + words.join("|"));
- }
-
- var keywords = ["true", "false", "null", "auto"];
- var keywordsRegexp = new RegExp("^" + keywords.join("|"));
-
- var operators = ["\\(", "\\)", "=", ">", "<", "==", ">=", "<=", "\\+", "-",
- "\\!=", "/", "\\*", "%", "and", "or", "not", ";","\\{","\\}",":"];
- var opRegexp = tokenRegexp(operators);
-
- var pseudoElementsRegexp = /^::?[a-zA-Z_][\w\-]*/;
-
- function urlTokens(stream, state) {
- var ch = stream.peek();
-
- if (ch === ")") {
- stream.next();
- state.tokenizer = tokenBase;
- return "operator";
- } else if (ch === "(") {
- stream.next();
- stream.eatSpace();
-
- return "operator";
- } else if (ch === "'" || ch === '"') {
- state.tokenizer = buildStringTokenizer(stream.next());
- return "string";
- } else {
- state.tokenizer = buildStringTokenizer(")", false);
- return "string";
- }
- }
- function comment(indentation, multiLine) {
- return function(stream, state) {
- if (stream.sol() && stream.indentation() <= indentation) {
- state.tokenizer = tokenBase;
- return tokenBase(stream, state);
- }
-
- if (multiLine && stream.skipTo("*/")) {
- stream.next();
- stream.next();
- state.tokenizer = tokenBase;
- } else {
- stream.skipToEnd();
- }
-
- return "comment";
- };
- }
-
- function buildStringTokenizer(quote, greedy) {
- if (greedy == null) { greedy = true; }
-
- function stringTokenizer(stream, state) {
- var nextChar = stream.next();
- var peekChar = stream.peek();
- var previousChar = stream.string.charAt(stream.pos-2);
-
- var endingString = ((nextChar !== "\\" && peekChar === quote) || (nextChar === quote && previousChar !== "\\"));
-
- if (endingString) {
- if (nextChar !== quote && greedy) { stream.next(); }
- state.tokenizer = tokenBase;
- return "string";
- } else if (nextChar === "#" && peekChar === "{") {
- state.tokenizer = buildInterpolationTokenizer(stringTokenizer);
- stream.next();
- return "operator";
- } else {
- return "string";
- }
- }
-
- return stringTokenizer;
- }
-
- function buildInterpolationTokenizer(currentTokenizer) {
- return function(stream, state) {
- if (stream.peek() === "}") {
- stream.next();
- state.tokenizer = currentTokenizer;
- return "operator";
- } else {
- return tokenBase(stream, state);
- }
- };
- }
-
- function indent(state) {
- if (state.indentCount == 0) {
- state.indentCount++;
- var lastScopeOffset = state.scopes[0].offset;
- var currentOffset = lastScopeOffset + config.indentUnit;
- state.scopes.unshift({ offset:currentOffset });
- }
- }
-
- function dedent(state) {
- if (state.scopes.length == 1) return;
-
- state.scopes.shift();
- }
-
- function tokenBase(stream, state) {
- var ch = stream.peek();
-
- // Comment
- if (stream.match("/*")) {
- state.tokenizer = comment(stream.indentation(), true);
- return state.tokenizer(stream, state);
- }
- if (stream.match("//")) {
- state.tokenizer = comment(stream.indentation(), false);
- return state.tokenizer(stream, state);
- }
-
- // Interpolation
- if (stream.match("#{")) {
- state.tokenizer = buildInterpolationTokenizer(tokenBase);
- return "operator";
- }
-
- // Strings
- if (ch === '"' || ch === "'") {
- stream.next();
- state.tokenizer = buildStringTokenizer(ch);
- return "string";
- }
-
- if(!state.cursorHalf){// state.cursorHalf === 0
- // first half i.e. before : for key-value pairs
- // including selectors
-
- if (ch === ".") {
- stream.next();
- if (stream.match(/^[\w-]+/)) {
- indent(state);
- return "atom";
- } else if (stream.peek() === "#") {
- indent(state);
- return "atom";
- }
- }
-
- if (ch === "#") {
- stream.next();
- // ID selectors
- if (stream.match(/^[\w-]+/)) {
- indent(state);
- return "atom";
- }
- if (stream.peek() === "#") {
- indent(state);
- return "atom";
- }
- }
-
- // Variables
- if (ch === "$") {
- stream.next();
- stream.eatWhile(/[\w-]/);
- return "variable-2";
- }
-
- // Numbers
- if (stream.match(/^-?[0-9\.]+/))
- return "number";
-
- // Units
- if (stream.match(/^(px|em|in)\b/))
- return "unit";
-
- if (stream.match(keywordsRegexp))
- return "keyword";
-
- if (stream.match(/^url/) && stream.peek() === "(") {
- state.tokenizer = urlTokens;
- return "atom";
- }
-
- if (ch === "=") {
- // Match shortcut mixin definition
- if (stream.match(/^=[\w-]+/)) {
- indent(state);
- return "meta";
- }
- }
-
- if (ch === "+") {
- // Match shortcut mixin definition
- if (stream.match(/^\+[\w-]+/)){
- return "variable-3";
- }
- }
-
- if(ch === "@"){
- if(stream.match(/@extend/)){
- if(!stream.match(/\s*[\w]/))
- dedent(state);
- }
- }
-
-
- // Indent Directives
- if (stream.match(/^@(else if|if|media|else|for|each|while|mixin|function)/)) {
- indent(state);
- return "meta";
- }
-
- // Other Directives
- if (ch === "@") {
- stream.next();
- stream.eatWhile(/[\w-]/);
- return "meta";
- }
-
- if (stream.eatWhile(/[\w-]/)){
- if(stream.match(/ *: *[\w-\+\$#!\("']/,false)){
- return "property";
- }
- else if(stream.match(/ *:/,false)){
- indent(state);
- state.cursorHalf = 1;
- return "atom";
- }
- else if(stream.match(/ *,/,false)){
- return "atom";
- }
- else{
- indent(state);
- return "atom";
- }
- }
-
- if(ch === ":"){
- if (stream.match(pseudoElementsRegexp)){ // could be a pseudo-element
- return "keyword";
- }
- stream.next();
- state.cursorHalf=1;
- return "operator";
- }
-
- } // cursorHalf===0 ends here
- else{
-
- if (ch === "#") {
- stream.next();
- // Hex numbers
- if (stream.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)){
- if(!stream.peek()){
- state.cursorHalf = 0;
- }
- return "number";
- }
- }
-
- // Numbers
- if (stream.match(/^-?[0-9\.]+/)){
- if(!stream.peek()){
- state.cursorHalf = 0;
- }
- return "number";
- }
-
- // Units
- if (stream.match(/^(px|em|in)\b/)){
- if(!stream.peek()){
- state.cursorHalf = 0;
- }
- return "unit";
- }
-
- if (stream.match(keywordsRegexp)){
- if(!stream.peek()){
- state.cursorHalf = 0;
- }
- return "keyword";
- }
-
- if (stream.match(/^url/) && stream.peek() === "(") {
- state.tokenizer = urlTokens;
- if(!stream.peek()){
- state.cursorHalf = 0;
- }
- return "atom";
- }
-
- // Variables
- if (ch === "$") {
- stream.next();
- stream.eatWhile(/[\w-]/);
- if(!stream.peek()){
- state.cursorHalf = 0;
- }
- return "variable-3";
- }
-
- // bang character for !important, !default, etc.
- if (ch === "!") {
- stream.next();
- if(!stream.peek()){
- state.cursorHalf = 0;
- }
- return stream.match(/^[\w]+/) ? "keyword": "operator";
- }
-
- if (stream.match(opRegexp)){
- if(!stream.peek()){
- state.cursorHalf = 0;
- }
- return "operator";
- }
-
- // attributes
- if (stream.eatWhile(/[\w-]/)) {
- if(!stream.peek()){
- state.cursorHalf = 0;
- }
- return "attribute";
- }
-
- //stream.eatSpace();
- if(!stream.peek()){
- state.cursorHalf = 0;
- return null;
- }
-
- } // else ends here
-
- if (stream.match(opRegexp))
- return "operator";
-
- // If we haven't returned by now, we move 1 character
- // and return an error
- stream.next();
- return null;
- }
-
- function tokenLexer(stream, state) {
- if (stream.sol()) state.indentCount = 0;
- var style = state.tokenizer(stream, state);
- var current = stream.current();
-
- if (current === "@return" || current === "}"){
- dedent(state);
- }
-
- if (style !== null) {
- var startOfToken = stream.pos - current.length;
-
- var withCurrentIndent = startOfToken + (config.indentUnit * state.indentCount);
-
- var newScopes = [];
-
- for (var i = 0; i < state.scopes.length; i++) {
- var scope = state.scopes[i];
-
- if (scope.offset <= withCurrentIndent)
- newScopes.push(scope);
- }
-
- state.scopes = newScopes;
- }
-
-
- return style;
- }
-
- return {
- startState: function() {
- return {
- tokenizer: tokenBase,
- scopes: [{offset: 0, type: "sass"}],
- indentCount: 0,
- cursorHalf: 0, // cursor half tells us if cursor lies after (1)
- // or before (0) colon (well... more or less)
- definedVars: [],
- definedMixins: []
- };
- },
- token: function(stream, state) {
- var style = tokenLexer(stream, state);
-
- state.lastToken = { style: style, content: stream.current() };
-
- return style;
- },
-
- indent: function(state) {
- return state.scopes[0].offset;
- }
- };
-});
-
-CodeMirror.defineMIME("text/x-sass", "sass");
-
-});
diff --git a/shared/codemirror/mode/scheme/scheme.js b/shared/codemirror/mode/scheme/scheme.js
deleted file mode 100644
index 2234645..0000000
--- a/shared/codemirror/mode/scheme/scheme.js
+++ /dev/null
@@ -1,249 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-/**
- * Author: Koh Zi Han, based on implementation by Koh Zi Chun
- */
-
-(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("scheme", function () {
- var BUILTIN = "builtin", COMMENT = "comment", STRING = "string",
- ATOM = "atom", NUMBER = "number", BRACKET = "bracket";
- var INDENT_WORD_SKIP = 2;
-
- function makeKeywords(str) {
- var obj = {}, words = str.split(" ");
- for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
- return obj;
- }
-
- var keywords = makeKeywords("λ case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci char-ci=? char-ci>=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char char=? char>=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci string-ci=? string-ci>=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string string=? string>=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?");
- var indentKeys = makeKeywords("define let letrec let* lambda");
-
- function stateStack(indent, type, prev) { // represents a state stack object
- this.indent = indent;
- this.type = type;
- this.prev = prev;
- }
-
- function pushStack(state, indent, type) {
- state.indentStack = new stateStack(indent, type, state.indentStack);
- }
-
- function popStack(state) {
- state.indentStack = state.indentStack.prev;
- }
-
- var binaryMatcher = new RegExp(/^(?:[-+]i|[-+][01]+#*(?:\/[01]+#*)?i|[-+]?[01]+#*(?:\/[01]+#*)?@[-+]?[01]+#*(?:\/[01]+#*)?|[-+]?[01]+#*(?:\/[01]+#*)?[-+](?:[01]+#*(?:\/[01]+#*)?)?i|[-+]?[01]+#*(?:\/[01]+#*)?)(?=[()\s;"]|$)/i);
- var octalMatcher = new RegExp(/^(?:[-+]i|[-+][0-7]+#*(?:\/[0-7]+#*)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?@[-+]?[0-7]+#*(?:\/[0-7]+#*)?|[-+]?[0-7]+#*(?:\/[0-7]+#*)?[-+](?:[0-7]+#*(?:\/[0-7]+#*)?)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?)(?=[()\s;"]|$)/i);
- var hexMatcher = new RegExp(/^(?:[-+]i|[-+][\da-f]+#*(?:\/[\da-f]+#*)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?@[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?[-+](?:[\da-f]+#*(?:\/[\da-f]+#*)?)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?)(?=[()\s;"]|$)/i);
- var decimalMatcher = new RegExp(/^(?:[-+]i|[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)i|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)@[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)?i|(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*))(?=[()\s;"]|$)/i);
-
- function isBinaryNumber (stream) {
- return stream.match(binaryMatcher);
- }
-
- function isOctalNumber (stream) {
- return stream.match(octalMatcher);
- }
-
- function isDecimalNumber (stream, backup) {
- if (backup === true) {
- stream.backUp(1);
- }
- return stream.match(decimalMatcher);
- }
-
- function isHexNumber (stream) {
- return stream.match(hexMatcher);
- }
-
- return {
- startState: function () {
- return {
- indentStack: null,
- indentation: 0,
- mode: false,
- sExprComment: false
- };
- },
-
- token: function (stream, state) {
- if (state.indentStack == null && stream.sol()) {
- // update indentation, but only if indentStack is empty
- state.indentation = stream.indentation();
- }
-
- // skip spaces
- if (stream.eatSpace()) {
- return null;
- }
- var returnType = null;
-
- switch(state.mode){
- case "string": // multi-line string parsing mode
- var next, escaped = false;
- while ((next = stream.next()) != null) {
- if (next == "\"" && !escaped) {
-
- state.mode = false;
- break;
- }
- escaped = !escaped && next == "\\";
- }
- returnType = STRING; // continue on in scheme-string mode
- break;
- case "comment": // comment parsing mode
- var next, maybeEnd = false;
- while ((next = stream.next()) != null) {
- if (next == "#" && maybeEnd) {
-
- state.mode = false;
- break;
- }
- maybeEnd = (next == "|");
- }
- returnType = COMMENT;
- break;
- case "s-expr-comment": // s-expr commenting mode
- state.mode = false;
- if(stream.peek() == "(" || stream.peek() == "["){
- // actually start scheme s-expr commenting mode
- state.sExprComment = 0;
- }else{
- // if not we just comment the entire of the next token
- stream.eatWhile(/[^/s]/); // eat non spaces
- returnType = COMMENT;
- break;
- }
- default: // default parsing mode
- var ch = stream.next();
-
- if (ch == "\"") {
- state.mode = "string";
- returnType = STRING;
-
- } else if (ch == "'") {
- returnType = ATOM;
- } else if (ch == '#') {
- if (stream.eat("|")) { // Multi-line comment
- state.mode = "comment"; // toggle to comment mode
- returnType = COMMENT;
- } else if (stream.eat(/[tf]/i)) { // #t/#f (atom)
- returnType = ATOM;
- } else if (stream.eat(';')) { // S-Expr comment
- state.mode = "s-expr-comment";
- returnType = COMMENT;
- } else {
- var numTest = null, hasExactness = false, hasRadix = true;
- if (stream.eat(/[ei]/i)) {
- hasExactness = true;
- } else {
- stream.backUp(1); // must be radix specifier
- }
- if (stream.match(/^#b/i)) {
- numTest = isBinaryNumber;
- } else if (stream.match(/^#o/i)) {
- numTest = isOctalNumber;
- } else if (stream.match(/^#x/i)) {
- numTest = isHexNumber;
- } else if (stream.match(/^#d/i)) {
- numTest = isDecimalNumber;
- } else if (stream.match(/^[-+0-9.]/, false)) {
- hasRadix = false;
- numTest = isDecimalNumber;
- // re-consume the intial # if all matches failed
- } else if (!hasExactness) {
- stream.eat('#');
- }
- if (numTest != null) {
- if (hasRadix && !hasExactness) {
- // consume optional exactness after radix
- stream.match(/^#[ei]/i);
- }
- if (numTest(stream))
- returnType = NUMBER;
- }
- }
- } else if (/^[-+0-9.]/.test(ch) && isDecimalNumber(stream, true)) { // match non-prefixed number, must be decimal
- returnType = NUMBER;
- } else if (ch == ";") { // comment
- stream.skipToEnd(); // rest of the line is a comment
- returnType = COMMENT;
- } else if (ch == "(" || ch == "[") {
- var keyWord = ''; var indentTemp = stream.column(), letter;
- /**
- Either
- (indent-word ..
- (non-indent-word ..
- (;something else, bracket, etc.
- */
-
- while ((letter = stream.eat(/[^\s\(\[\;\)\]]/)) != null) {
- keyWord += letter;
- }
-
- if (keyWord.length > 0 && indentKeys.propertyIsEnumerable(keyWord)) { // indent-word
-
- pushStack(state, indentTemp + INDENT_WORD_SKIP, ch);
- } else { // non-indent word
- // we continue eating the spaces
- stream.eatSpace();
- if (stream.eol() || stream.peek() == ";") {
- // nothing significant after
- // we restart indentation 1 space after
- pushStack(state, indentTemp + 1, ch);
- } else {
- pushStack(state, indentTemp + stream.current().length, ch); // else we match
- }
- }
- stream.backUp(stream.current().length - 1); // undo all the eating
-
- if(typeof state.sExprComment == "number") state.sExprComment++;
-
- returnType = BRACKET;
- } else if (ch == ")" || ch == "]") {
- returnType = BRACKET;
- if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : "[")) {
- popStack(state);
-
- if(typeof state.sExprComment == "number"){
- if(--state.sExprComment == 0){
- returnType = COMMENT; // final closing bracket
- state.sExprComment = false; // turn off s-expr commenting mode
- }
- }
- }
- } else {
- stream.eatWhile(/[\w\$_\-!$%&*+\.\/:<=>?@\^~]/);
-
- if (keywords && keywords.propertyIsEnumerable(stream.current())) {
- returnType = BUILTIN;
- } else returnType = "variable";
- }
- }
- return (typeof state.sExprComment == "number") ? COMMENT : returnType;
- },
-
- indent: function (state) {
- if (state.indentStack == null) return state.indentation;
- return state.indentStack.indent;
- },
-
- closeBrackets: {pairs: "()[]{}\"\""},
- lineComment: ";;"
- };
-});
-
-CodeMirror.defineMIME("text/x-scheme", "scheme");
-
-});
diff --git a/shared/codemirror/mode/shell/shell.js b/shared/codemirror/mode/shell/shell.js
deleted file mode 100644
index a684e8c..0000000
--- a/shared/codemirror/mode/shell/shell.js
+++ /dev/null
@@ -1,139 +0,0 @@
-// 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('shell', function() {
-
- var words = {};
- function define(style, string) {
- var split = string.split(' ');
- for(var i = 0; i < split.length; i++) {
- words[split[i]] = style;
- }
- };
-
- // Atoms
- define('atom', 'true false');
-
- // Keywords
- define('keyword', 'if then do else elif while until for in esac fi fin ' +
- 'fil done exit set unset export function');
-
- // Commands
- define('builtin', 'ab awk bash beep cat cc cd chown chmod chroot clear cp ' +
- 'curl cut diff echo find gawk gcc get git grep kill killall ln ls make ' +
- 'mkdir openssl mv nc node npm ping ps restart rm rmdir sed service sh ' +
- 'shopt shred source sort sleep ssh start stop su sudo tee telnet top ' +
- 'touch vi vim wall wc wget who write yes zsh');
-
- function tokenBase(stream, state) {
- if (stream.eatSpace()) return null;
-
- var sol = stream.sol();
- var ch = stream.next();
-
- if (ch === '\\') {
- stream.next();
- return null;
- }
- if (ch === '\'' || ch === '"' || ch === '`') {
- state.tokens.unshift(tokenString(ch));
- return tokenize(stream, state);
- }
- if (ch === '#') {
- if (sol && stream.eat('!')) {
- stream.skipToEnd();
- return 'meta'; // 'comment'?
- }
- stream.skipToEnd();
- return 'comment';
- }
- if (ch === '$') {
- state.tokens.unshift(tokenDollar);
- return tokenize(stream, state);
- }
- if (ch === '+' || ch === '=') {
- return 'operator';
- }
- if (ch === '-') {
- stream.eat('-');
- stream.eatWhile(/\w/);
- return 'attribute';
- }
- if (/\d/.test(ch)) {
- stream.eatWhile(/\d/);
- if(stream.eol() || !/\w/.test(stream.peek())) {
- return 'number';
- }
- }
- stream.eatWhile(/[\w-]/);
- var cur = stream.current();
- if (stream.peek() === '=' && /\w+/.test(cur)) return 'def';
- return words.hasOwnProperty(cur) ? words[cur] : null;
- }
-
- function tokenString(quote) {
- return function(stream, state) {
- var next, end = false, escaped = false;
- while ((next = stream.next()) != null) {
- if (next === quote && !escaped) {
- end = true;
- break;
- }
- if (next === '$' && !escaped && quote !== '\'') {
- escaped = true;
- stream.backUp(1);
- state.tokens.unshift(tokenDollar);
- break;
- }
- escaped = !escaped && next === '\\';
- }
- if (end || !escaped) {
- state.tokens.shift();
- }
- return (quote === '`' || quote === ')' ? 'quote' : 'string');
- };
- };
-
- var tokenDollar = function(stream, state) {
- if (state.tokens.length > 1) stream.eat('$');
- var ch = stream.next(), hungry = /\w/;
- if (ch === '{') hungry = /[^}]/;
- if (ch === '(') {
- state.tokens[0] = tokenString(')');
- return tokenize(stream, state);
- }
- if (!/\d/.test(ch)) {
- stream.eatWhile(hungry);
- stream.eat('}');
- }
- state.tokens.shift();
- return 'def';
- };
-
- function tokenize(stream, state) {
- return (state.tokens[0] || tokenBase) (stream, state);
- };
-
- return {
- startState: function() {return {tokens:[]};},
- token: function(stream, state) {
- return tokenize(stream, state);
- },
- lineComment: '#',
- fold: "brace"
- };
-});
-
-CodeMirror.defineMIME('text/x-sh', 'shell');
-
-});
diff --git a/shared/codemirror/mode/sieve/sieve.js b/shared/codemirror/mode/sieve/sieve.js
deleted file mode 100644
index f67db2f..0000000
--- a/shared/codemirror/mode/sieve/sieve.js
+++ /dev/null
@@ -1,193 +0,0 @@
-// 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("sieve", function(config) {
- function words(str) {
- var obj = {}, words = str.split(" ");
- for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
- return obj;
- }
-
- var keywords = words("if elsif else stop require");
- var atoms = words("true false not");
- var indentUnit = config.indentUnit;
-
- function tokenBase(stream, state) {
-
- var ch = stream.next();
- if (ch == "/" && stream.eat("*")) {
- state.tokenize = tokenCComment;
- return tokenCComment(stream, state);
- }
-
- if (ch === '#') {
- stream.skipToEnd();
- return "comment";
- }
-
- if (ch == "\"") {
- state.tokenize = tokenString(ch);
- return state.tokenize(stream, state);
- }
-
- if (ch == "(") {
- state._indent.push("(");
- // add virtual angel wings so that editor behaves...
- // ...more sane incase of broken brackets
- state._indent.push("{");
- return null;
- }
-
- if (ch === "{") {
- state._indent.push("{");
- return null;
- }
-
- if (ch == ")") {
- state._indent.pop();
- state._indent.pop();
- }
-
- if (ch === "}") {
- state._indent.pop();
- return null;
- }
-
- if (ch == ",")
- return null;
-
- if (ch == ";")
- return null;
-
-
- if (/[{}\(\),;]/.test(ch))
- return null;
-
- // 1*DIGIT "K" / "M" / "G"
- if (/\d/.test(ch)) {
- stream.eatWhile(/[\d]/);
- stream.eat(/[KkMmGg]/);
- return "number";
- }
-
- // ":" (ALPHA / "_") *(ALPHA / DIGIT / "_")
- if (ch == ":") {
- stream.eatWhile(/[a-zA-Z_]/);
- stream.eatWhile(/[a-zA-Z0-9_]/);
-
- return "operator";
- }
-
- stream.eatWhile(/\w/);
- var cur = stream.current();
-
- // "text:" *(SP / HTAB) (hash-comment / CRLF)
- // *(multiline-literal / multiline-dotstart)
- // "." CRLF
- if ((cur == "text") && stream.eat(":"))
- {
- state.tokenize = tokenMultiLineString;
- return "string";
- }
-
- if (keywords.propertyIsEnumerable(cur))
- return "keyword";
-
- if (atoms.propertyIsEnumerable(cur))
- return "atom";
-
- return null;
- }
-
- function tokenMultiLineString(stream, state)
- {
- state._multiLineString = true;
- // the first line is special it may contain a comment
- if (!stream.sol()) {
- stream.eatSpace();
-
- if (stream.peek() == "#") {
- stream.skipToEnd();
- return "comment";
- }
-
- stream.skipToEnd();
- return "string";
- }
-
- if ((stream.next() == ".") && (stream.eol()))
- {
- state._multiLineString = false;
- state.tokenize = tokenBase;
- }
-
- return "string";
- }
-
- function tokenCComment(stream, state) {
- var maybeEnd = false, ch;
- while ((ch = stream.next()) != null) {
- if (maybeEnd && ch == "/") {
- state.tokenize = tokenBase;
- break;
- }
- maybeEnd = (ch == "*");
- }
- return "comment";
- }
-
- function tokenString(quote) {
- return function(stream, state) {
- var escaped = false, ch;
- while ((ch = stream.next()) != null) {
- if (ch == quote && !escaped)
- break;
- escaped = !escaped && ch == "\\";
- }
- if (!escaped) state.tokenize = tokenBase;
- return "string";
- };
- }
-
- return {
- startState: function(base) {
- return {tokenize: tokenBase,
- baseIndent: base || 0,
- _indent: []};
- },
-
- token: function(stream, state) {
- if (stream.eatSpace())
- return null;
-
- return (state.tokenize || tokenBase)(stream, state);;
- },
-
- indent: function(state, _textAfter) {
- var length = state._indent.length;
- if (_textAfter && (_textAfter[0] == "}"))
- length--;
-
- if (length <0)
- length = 0;
-
- return length * indentUnit;
- },
-
- electricChars: "}"
- };
-});
-
-CodeMirror.defineMIME("application/sieve", "sieve");
-
-});
diff --git a/shared/codemirror/mode/slim/slim.js b/shared/codemirror/mode/slim/slim.js
deleted file mode 100644
index 164464d..0000000
--- a/shared/codemirror/mode/slim/slim.js
+++ /dev/null
@@ -1,575 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-// Slim Highlighting for CodeMirror copyright (c) HicknHack Software Gmbh
-
-(function(mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), require("../ruby/ruby"));
- else if (typeof define == "function" && define.amd) // AMD
- define(["../../lib/codemirror", "../htmlmixed/htmlmixed", "../ruby/ruby"], mod);
- else // Plain browser env
- mod(CodeMirror);
-})(function(CodeMirror) {
-"use strict";
-
- CodeMirror.defineMode("slim", function(config) {
- var htmlMode = CodeMirror.getMode(config, {name: "htmlmixed"});
- var rubyMode = CodeMirror.getMode(config, "ruby");
- var modes = { html: htmlMode, ruby: rubyMode };
- var embedded = {
- ruby: "ruby",
- javascript: "javascript",
- css: "text/css",
- sass: "text/x-sass",
- scss: "text/x-scss",
- less: "text/x-less",
- styl: "text/x-styl", // no highlighting so far
- coffee: "coffeescript",
- asciidoc: "text/x-asciidoc",
- markdown: "text/x-markdown",
- textile: "text/x-textile", // no highlighting so far
- creole: "text/x-creole", // no highlighting so far
- wiki: "text/x-wiki", // no highlighting so far
- mediawiki: "text/x-mediawiki", // no highlighting so far
- rdoc: "text/x-rdoc", // no highlighting so far
- builder: "text/x-builder", // no highlighting so far
- nokogiri: "text/x-nokogiri", // no highlighting so far
- erb: "application/x-erb"
- };
- var embeddedRegexp = function(map){
- var arr = [];
- for(var key in map) arr.push(key);
- return new RegExp("^("+arr.join('|')+"):");
- }(embedded);
-
- var styleMap = {
- "commentLine": "comment",
- "slimSwitch": "operator special",
- "slimTag": "tag",
- "slimId": "attribute def",
- "slimClass": "attribute qualifier",
- "slimAttribute": "attribute",
- "slimSubmode": "keyword special",
- "closeAttributeTag": null,
- "slimDoctype": null,
- "lineContinuation": null
- };
- var closing = {
- "{": "}",
- "[": "]",
- "(": ")"
- };
-
- var nameStartChar = "_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD";
- var nameChar = nameStartChar + "\\-0-9\xB7\u0300-\u036F\u203F-\u2040";
- var nameRegexp = new RegExp("^[:"+nameStartChar+"](?::["+nameChar+"]|["+nameChar+"]*)");
- var attributeNameRegexp = new RegExp("^[:"+nameStartChar+"][:\\."+nameChar+"]*(?=\\s*=)");
- var wrappedAttributeNameRegexp = new RegExp("^[:"+nameStartChar+"][:\\."+nameChar+"]*");
- var classNameRegexp = /^\.-?[_a-zA-Z]+[\w\-]*/;
- var classIdRegexp = /^#[_a-zA-Z]+[\w\-]*/;
-
- function backup(pos, tokenize, style) {
- var restore = function(stream, state) {
- state.tokenize = tokenize;
- if (stream.pos < pos) {
- stream.pos = pos;
- return style;
- }
- return state.tokenize(stream, state);
- };
- return function(stream, state) {
- state.tokenize = restore;
- return tokenize(stream, state);
- };
- }
-
- function maybeBackup(stream, state, pat, offset, style) {
- var cur = stream.current();
- var idx = cur.search(pat);
- if (idx > -1) {
- state.tokenize = backup(stream.pos, state.tokenize, style);
- stream.backUp(cur.length - idx - offset);
- }
- return style;
- }
-
- function continueLine(state, column) {
- state.stack = {
- parent: state.stack,
- style: "continuation",
- indented: column,
- tokenize: state.line
- };
- state.line = state.tokenize;
- }
- function finishContinue(state) {
- if (state.line == state.tokenize) {
- state.line = state.stack.tokenize;
- state.stack = state.stack.parent;
- }
- }
-
- function lineContinuable(column, tokenize) {
- return function(stream, state) {
- finishContinue(state);
- if (stream.match(/^\\$/)) {
- continueLine(state, column);
- return "lineContinuation";
- }
- var style = tokenize(stream, state);
- if (stream.eol() && stream.current().match(/(?:^|[^\\])(?:\\\\)*\\$/)) {
- stream.backUp(1);
- }
- return style;
- };
- }
- function commaContinuable(column, tokenize) {
- return function(stream, state) {
- finishContinue(state);
- var style = tokenize(stream, state);
- if (stream.eol() && stream.current().match(/,$/)) {
- continueLine(state, column);
- }
- return style;
- };
- }
-
- function rubyInQuote(endQuote, tokenize) {
- // TODO: add multi line support
- return function(stream, state) {
- var ch = stream.peek();
- if (ch == endQuote && state.rubyState.tokenize.length == 1) {
- // step out of ruby context as it seems to complete processing all the braces
- stream.next();
- state.tokenize = tokenize;
- return "closeAttributeTag";
- } else {
- return ruby(stream, state);
- }
- };
- }
- function startRubySplat(tokenize) {
- var rubyState;
- var runSplat = function(stream, state) {
- if (state.rubyState.tokenize.length == 1 && !state.rubyState.context.prev) {
- stream.backUp(1);
- if (stream.eatSpace()) {
- state.rubyState = rubyState;
- state.tokenize = tokenize;
- return tokenize(stream, state);
- }
- stream.next();
- }
- return ruby(stream, state);
- };
- return function(stream, state) {
- rubyState = state.rubyState;
- state.rubyState = rubyMode.startState();
- state.tokenize = runSplat;
- return ruby(stream, state);
- };
- }
-
- function ruby(stream, state) {
- return rubyMode.token(stream, state.rubyState);
- }
-
- function htmlLine(stream, state) {
- if (stream.match(/^\\$/)) {
- return "lineContinuation";
- }
- return html(stream, state);
- }
- function html(stream, state) {
- if (stream.match(/^#\{/)) {
- state.tokenize = rubyInQuote("}", state.tokenize);
- return null;
- }
- return maybeBackup(stream, state, /[^\\]#\{/, 1, htmlMode.token(stream, state.htmlState));
- }
-
- function startHtmlLine(lastTokenize) {
- return function(stream, state) {
- var style = htmlLine(stream, state);
- if (stream.eol()) state.tokenize = lastTokenize;
- return style;
- };
- }
-
- function startHtmlMode(stream, state, offset) {
- state.stack = {
- parent: state.stack,
- style: "html",
- indented: stream.column() + offset, // pipe + space
- tokenize: state.line
- };
- state.line = state.tokenize = html;
- return null;
- }
-
- function comment(stream, state) {
- stream.skipToEnd();
- return state.stack.style;
- }
-
- function commentMode(stream, state) {
- state.stack = {
- parent: state.stack,
- style: "comment",
- indented: state.indented + 1,
- tokenize: state.line
- };
- state.line = comment;
- return comment(stream, state);
- }
-
- function attributeWrapper(stream, state) {
- if (stream.eat(state.stack.endQuote)) {
- state.line = state.stack.line;
- state.tokenize = state.stack.tokenize;
- state.stack = state.stack.parent;
- return null;
- }
- if (stream.match(wrappedAttributeNameRegexp)) {
- state.tokenize = attributeWrapperAssign;
- return "slimAttribute";
- }
- stream.next();
- return null;
- }
- function attributeWrapperAssign(stream, state) {
- if (stream.match(/^==?/)) {
- state.tokenize = attributeWrapperValue;
- return null;
- }
- return attributeWrapper(stream, state);
- }
- function attributeWrapperValue(stream, state) {
- var ch = stream.peek();
- if (ch == '"' || ch == "\'") {
- state.tokenize = readQuoted(ch, "string", true, false, attributeWrapper);
- stream.next();
- return state.tokenize(stream, state);
- }
- if (ch == '[') {
- return startRubySplat(attributeWrapper)(stream, state);
- }
- if (stream.match(/^(true|false|nil)\b/)) {
- state.tokenize = attributeWrapper;
- return "keyword";
- }
- return startRubySplat(attributeWrapper)(stream, state);
- }
-
- function startAttributeWrapperMode(state, endQuote, tokenize) {
- state.stack = {
- parent: state.stack,
- style: "wrapper",
- indented: state.indented + 1,
- tokenize: tokenize,
- line: state.line,
- endQuote: endQuote
- };
- state.line = state.tokenize = attributeWrapper;
- return null;
- }
-
- function sub(stream, state) {
- if (stream.match(/^#\{/)) {
- state.tokenize = rubyInQuote("}", state.tokenize);
- return null;
- }
- var subStream = new CodeMirror.StringStream(stream.string.slice(state.stack.indented), stream.tabSize);
- subStream.pos = stream.pos - state.stack.indented;
- subStream.start = stream.start - state.stack.indented;
- subStream.lastColumnPos = stream.lastColumnPos - state.stack.indented;
- subStream.lastColumnValue = stream.lastColumnValue - state.stack.indented;
- var style = state.subMode.token(subStream, state.subState);
- stream.pos = subStream.pos + state.stack.indented;
- return style;
- }
- function firstSub(stream, state) {
- state.stack.indented = stream.column();
- state.line = state.tokenize = sub;
- return state.tokenize(stream, state);
- }
-
- function createMode(mode) {
- var query = embedded[mode];
- var spec = CodeMirror.mimeModes[query];
- if (spec) {
- return CodeMirror.getMode(config, spec);
- }
- var factory = CodeMirror.modes[query];
- if (factory) {
- return factory(config, {name: query});
- }
- return CodeMirror.getMode(config, "null");
- }
-
- function getMode(mode) {
- if (!modes.hasOwnProperty(mode)) {
- return modes[mode] = createMode(mode);
- }
- return modes[mode];
- }
-
- function startSubMode(mode, state) {
- var subMode = getMode(mode);
- var subState = subMode.startState && subMode.startState();
-
- state.subMode = subMode;
- state.subState = subState;
-
- state.stack = {
- parent: state.stack,
- style: "sub",
- indented: state.indented + 1,
- tokenize: state.line
- };
- state.line = state.tokenize = firstSub;
- return "slimSubmode";
- }
-
- function doctypeLine(stream, _state) {
- stream.skipToEnd();
- return "slimDoctype";
- }
-
- function startLine(stream, state) {
- var ch = stream.peek();
- if (ch == '<') {
- return (state.tokenize = startHtmlLine(state.tokenize))(stream, state);
- }
- if (stream.match(/^[|']/)) {
- return startHtmlMode(stream, state, 1);
- }
- if (stream.match(/^\/(!|\[\w+])?/)) {
- return commentMode(stream, state);
- }
- if (stream.match(/^(-|==?[<>]?)/)) {
- state.tokenize = lineContinuable(stream.column(), commaContinuable(stream.column(), ruby));
- return "slimSwitch";
- }
- if (stream.match(/^doctype\b/)) {
- state.tokenize = doctypeLine;
- return "keyword";
- }
-
- var m = stream.match(embeddedRegexp);
- if (m) {
- return startSubMode(m[1], state);
- }
-
- return slimTag(stream, state);
- }
-
- function slim(stream, state) {
- if (state.startOfLine) {
- return startLine(stream, state);
- }
- return slimTag(stream, state);
- }
-
- function slimTag(stream, state) {
- if (stream.eat('*')) {
- state.tokenize = startRubySplat(slimTagExtras);
- return null;
- }
- if (stream.match(nameRegexp)) {
- state.tokenize = slimTagExtras;
- return "slimTag";
- }
- return slimClass(stream, state);
- }
- function slimTagExtras(stream, state) {
- if (stream.match(/^(<>?|>)/)) {
- state.tokenize = slimClass;
- return null;
- }
- return slimClass(stream, state);
- }
- function slimClass(stream, state) {
- if (stream.match(classIdRegexp)) {
- state.tokenize = slimClass;
- return "slimId";
- }
- if (stream.match(classNameRegexp)) {
- state.tokenize = slimClass;
- return "slimClass";
- }
- return slimAttribute(stream, state);
- }
- function slimAttribute(stream, state) {
- if (stream.match(/^([\[\{\(])/)) {
- return startAttributeWrapperMode(state, closing[RegExp.$1], slimAttribute);
- }
- if (stream.match(attributeNameRegexp)) {
- state.tokenize = slimAttributeAssign;
- return "slimAttribute";
- }
- if (stream.peek() == '*') {
- stream.next();
- state.tokenize = startRubySplat(slimContent);
- return null;
- }
- return slimContent(stream, state);
- }
- function slimAttributeAssign(stream, state) {
- if (stream.match(/^==?/)) {
- state.tokenize = slimAttributeValue;
- return null;
- }
- // should never happen, because of forward lookup
- return slimAttribute(stream, state);
- }
-
- function slimAttributeValue(stream, state) {
- var ch = stream.peek();
- if (ch == '"' || ch == "\'") {
- state.tokenize = readQuoted(ch, "string", true, false, slimAttribute);
- stream.next();
- return state.tokenize(stream, state);
- }
- if (ch == '[') {
- return startRubySplat(slimAttribute)(stream, state);
- }
- if (ch == ':') {
- return startRubySplat(slimAttributeSymbols)(stream, state);
- }
- if (stream.match(/^(true|false|nil)\b/)) {
- state.tokenize = slimAttribute;
- return "keyword";
- }
- return startRubySplat(slimAttribute)(stream, state);
- }
- function slimAttributeSymbols(stream, state) {
- stream.backUp(1);
- if (stream.match(/^[^\s],(?=:)/)) {
- state.tokenize = startRubySplat(slimAttributeSymbols);
- return null;
- }
- stream.next();
- return slimAttribute(stream, state);
- }
- function readQuoted(quote, style, embed, unescaped, nextTokenize) {
- return function(stream, state) {
- finishContinue(state);
- var fresh = stream.current().length == 0;
- if (stream.match(/^\\$/, fresh)) {
- if (!fresh) return style;
- continueLine(state, state.indented);
- return "lineContinuation";
- }
- if (stream.match(/^#\{/, fresh)) {
- if (!fresh) return style;
- state.tokenize = rubyInQuote("}", state.tokenize);
- return null;
- }
- var escaped = false, ch;
- while ((ch = stream.next()) != null) {
- if (ch == quote && (unescaped || !escaped)) {
- state.tokenize = nextTokenize;
- break;
- }
- if (embed && ch == "#" && !escaped) {
- if (stream.eat("{")) {
- stream.backUp(2);
- break;
- }
- }
- escaped = !escaped && ch == "\\";
- }
- if (stream.eol() && escaped) {
- stream.backUp(1);
- }
- return style;
- };
- }
- function slimContent(stream, state) {
- if (stream.match(/^==?/)) {
- state.tokenize = ruby;
- return "slimSwitch";
- }
- if (stream.match(/^\/$/)) { // tag close hint
- state.tokenize = slim;
- return null;
- }
- if (stream.match(/^:/)) { // inline tag
- state.tokenize = slimTag;
- return "slimSwitch";
- }
- startHtmlMode(stream, state, 0);
- return state.tokenize(stream, state);
- }
-
- var mode = {
- // default to html mode
- startState: function() {
- var htmlState = htmlMode.startState();
- var rubyState = rubyMode.startState();
- return {
- htmlState: htmlState,
- rubyState: rubyState,
- stack: null,
- last: null,
- tokenize: slim,
- line: slim,
- indented: 0
- };
- },
-
- copyState: function(state) {
- return {
- htmlState : CodeMirror.copyState(htmlMode, state.htmlState),
- rubyState: CodeMirror.copyState(rubyMode, state.rubyState),
- subMode: state.subMode,
- subState: state.subMode && CodeMirror.copyState(state.subMode, state.subState),
- stack: state.stack,
- last: state.last,
- tokenize: state.tokenize,
- line: state.line
- };
- },
-
- token: function(stream, state) {
- if (stream.sol()) {
- state.indented = stream.indentation();
- state.startOfLine = true;
- state.tokenize = state.line;
- while (state.stack && state.stack.indented > state.indented && state.last != "slimSubmode") {
- state.line = state.tokenize = state.stack.tokenize;
- state.stack = state.stack.parent;
- state.subMode = null;
- state.subState = null;
- }
- }
- if (stream.eatSpace()) return null;
- var style = state.tokenize(stream, state);
- state.startOfLine = false;
- if (style) state.last = style;
- return styleMap.hasOwnProperty(style) ? styleMap[style] : style;
- },
-
- blankLine: function(state) {
- if (state.subMode && state.subMode.blankLine) {
- return state.subMode.blankLine(state.subState);
- }
- },
-
- innerMode: function(state) {
- if (state.subMode) return {state: state.subState, mode: state.subMode};
- return {state: state, mode: mode};
- }
-
- //indent: function(state) {
- // return state.indented;
- //}
- };
- return mode;
- }, "htmlmixed", "ruby");
-
- CodeMirror.defineMIME("text/x-slim", "slim");
- CodeMirror.defineMIME("application/x-slim", "slim");
-});
diff --git a/shared/codemirror/mode/smalltalk/smalltalk.js b/shared/codemirror/mode/smalltalk/smalltalk.js
deleted file mode 100644
index bb510ba..0000000
--- a/shared/codemirror/mode/smalltalk/smalltalk.js
+++ /dev/null
@@ -1,168 +0,0 @@
-// 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('smalltalk', function(config) {
-
- var specialChars = /[+\-\/\\*~<>=@%|&?!.,:;^]/;
- var keywords = /true|false|nil|self|super|thisContext/;
-
- var Context = function(tokenizer, parent) {
- this.next = tokenizer;
- this.parent = parent;
- };
-
- var Token = function(name, context, eos) {
- this.name = name;
- this.context = context;
- this.eos = eos;
- };
-
- var State = function() {
- this.context = new Context(next, null);
- this.expectVariable = true;
- this.indentation = 0;
- this.userIndentationDelta = 0;
- };
-
- State.prototype.userIndent = function(indentation) {
- this.userIndentationDelta = indentation > 0 ? (indentation / config.indentUnit - this.indentation) : 0;
- };
-
- var next = function(stream, context, state) {
- var token = new Token(null, context, false);
- var aChar = stream.next();
-
- if (aChar === '"') {
- token = nextComment(stream, new Context(nextComment, context));
-
- } else if (aChar === '\'') {
- token = nextString(stream, new Context(nextString, context));
-
- } else if (aChar === '#') {
- if (stream.peek() === '\'') {
- stream.next();
- token = nextSymbol(stream, new Context(nextSymbol, context));
- } else {
- if (stream.eatWhile(/[^\s.{}\[\]()]/))
- token.name = 'string-2';
- else
- token.name = 'meta';
- }
-
- } else if (aChar === '$') {
- if (stream.next() === '<') {
- stream.eatWhile(/[^\s>]/);
- stream.next();
- }
- token.name = 'string-2';
-
- } else if (aChar === '|' && state.expectVariable) {
- token.context = new Context(nextTemporaries, context);
-
- } else if (/[\[\]{}()]/.test(aChar)) {
- token.name = 'bracket';
- token.eos = /[\[{(]/.test(aChar);
-
- if (aChar === '[') {
- state.indentation++;
- } else if (aChar === ']') {
- state.indentation = Math.max(0, state.indentation - 1);
- }
-
- } else if (specialChars.test(aChar)) {
- stream.eatWhile(specialChars);
- token.name = 'operator';
- token.eos = aChar !== ';'; // ; cascaded message expression
-
- } else if (/\d/.test(aChar)) {
- stream.eatWhile(/[\w\d]/);
- token.name = 'number';
-
- } else if (/[\w_]/.test(aChar)) {
- stream.eatWhile(/[\w\d_]/);
- token.name = state.expectVariable ? (keywords.test(stream.current()) ? 'keyword' : 'variable') : null;
-
- } else {
- token.eos = state.expectVariable;
- }
-
- return token;
- };
-
- var nextComment = function(stream, context) {
- stream.eatWhile(/[^"]/);
- return new Token('comment', stream.eat('"') ? context.parent : context, true);
- };
-
- var nextString = function(stream, context) {
- stream.eatWhile(/[^']/);
- return new Token('string', stream.eat('\'') ? context.parent : context, false);
- };
-
- var nextSymbol = function(stream, context) {
- stream.eatWhile(/[^']/);
- return new Token('string-2', stream.eat('\'') ? context.parent : context, false);
- };
-
- var nextTemporaries = function(stream, context) {
- var token = new Token(null, context, false);
- var aChar = stream.next();
-
- if (aChar === '|') {
- token.context = context.parent;
- token.eos = true;
-
- } else {
- stream.eatWhile(/[^|]/);
- token.name = 'variable';
- }
-
- return token;
- };
-
- return {
- startState: function() {
- return new State;
- },
-
- token: function(stream, state) {
- state.userIndent(stream.indentation());
-
- if (stream.eatSpace()) {
- return null;
- }
-
- var token = state.context.next(stream, state.context, state);
- state.context = token.context;
- state.expectVariable = token.eos;
-
- return token.name;
- },
-
- blankLine: function(state) {
- state.userIndent(0);
- },
-
- indent: function(state, textAfter) {
- var i = state.context.next === next && textAfter && textAfter.charAt(0) === ']' ? -1 : state.userIndentationDelta;
- return (state.indentation + i) * config.indentUnit;
- },
-
- electricChars: ']'
- };
-
-});
-
-CodeMirror.defineMIME('text/x-stsrc', {name: 'smalltalk'});
-
-});
diff --git a/shared/codemirror/mode/smarty/smarty.js b/shared/codemirror/mode/smarty/smarty.js
deleted file mode 100644
index 6e0fbed..0000000
--- a/shared/codemirror/mode/smarty/smarty.js
+++ /dev/null
@@ -1,225 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-/**
- * Smarty 2 and 3 mode.
- */
-
-(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("smarty", function(config, parserConf) {
- var rightDelimiter = parserConf.rightDelimiter || "}";
- var leftDelimiter = parserConf.leftDelimiter || "{";
- var version = parserConf.version || 2;
- var baseMode = CodeMirror.getMode(config, parserConf.baseMode || "null");
-
- var keyFunctions = ["debug", "extends", "function", "include", "literal"];
- var regs = {
- operatorChars: /[+\-*&%=<>!?]/,
- validIdentifier: /[a-zA-Z0-9_]/,
- stringChar: /['"]/
- };
-
- var last;
- function cont(style, lastType) {
- last = lastType;
- return style;
- }
-
- function chain(stream, state, parser) {
- state.tokenize = parser;
- return parser(stream, state);
- }
-
- // Smarty 3 allows { and } surrounded by whitespace to NOT slip into Smarty mode
- function doesNotCount(stream, pos) {
- if (pos == null) pos = stream.pos;
- return version === 3 && leftDelimiter == "{" &&
- (pos == stream.string.length || /\s/.test(stream.string.charAt(pos)));
- }
-
- function tokenTop(stream, state) {
- var string = stream.string;
- for (var scan = stream.pos;;) {
- var nextMatch = string.indexOf(leftDelimiter, scan);
- scan = nextMatch + leftDelimiter.length;
- if (nextMatch == -1 || !doesNotCount(stream, nextMatch + leftDelimiter.length)) break;
- }
- if (nextMatch == stream.pos) {
- stream.match(leftDelimiter);
- if (stream.eat("*")) {
- return chain(stream, state, tokenBlock("comment", "*" + rightDelimiter));
- } else {
- state.depth++;
- state.tokenize = tokenSmarty;
- last = "startTag";
- return "tag";
- }
- }
-
- if (nextMatch > -1) stream.string = string.slice(0, nextMatch);
- var token = baseMode.token(stream, state.base);
- if (nextMatch > -1) stream.string = string;
- return token;
- }
-
- // parsing Smarty content
- function tokenSmarty(stream, state) {
- if (stream.match(rightDelimiter, true)) {
- if (version === 3) {
- state.depth--;
- if (state.depth <= 0) {
- state.tokenize = tokenTop;
- }
- } else {
- state.tokenize = tokenTop;
- }
- return cont("tag", null);
- }
-
- if (stream.match(leftDelimiter, true)) {
- state.depth++;
- return cont("tag", "startTag");
- }
-
- var ch = stream.next();
- if (ch == "$") {
- stream.eatWhile(regs.validIdentifier);
- return cont("variable-2", "variable");
- } else if (ch == "|") {
- return cont("operator", "pipe");
- } else if (ch == ".") {
- return cont("operator", "property");
- } else if (regs.stringChar.test(ch)) {
- state.tokenize = tokenAttribute(ch);
- return cont("string", "string");
- } else if (regs.operatorChars.test(ch)) {
- stream.eatWhile(regs.operatorChars);
- return cont("operator", "operator");
- } else if (ch == "[" || ch == "]") {
- return cont("bracket", "bracket");
- } else if (ch == "(" || ch == ")") {
- return cont("bracket", "operator");
- } else if (/\d/.test(ch)) {
- stream.eatWhile(/\d/);
- return cont("number", "number");
- } else {
-
- if (state.last == "variable") {
- if (ch == "@") {
- stream.eatWhile(regs.validIdentifier);
- return cont("property", "property");
- } else if (ch == "|") {
- stream.eatWhile(regs.validIdentifier);
- return cont("qualifier", "modifier");
- }
- } else if (state.last == "pipe") {
- stream.eatWhile(regs.validIdentifier);
- return cont("qualifier", "modifier");
- } else if (state.last == "whitespace") {
- stream.eatWhile(regs.validIdentifier);
- return cont("attribute", "modifier");
- } if (state.last == "property") {
- stream.eatWhile(regs.validIdentifier);
- return cont("property", null);
- } else if (/\s/.test(ch)) {
- last = "whitespace";
- return null;
- }
-
- var str = "";
- if (ch != "/") {
- str += ch;
- }
- var c = null;
- while (c = stream.eat(regs.validIdentifier)) {
- str += c;
- }
- for (var i=0, j=keyFunctions.length; i=&|\^\/!\?]/;
-
- function tokenBase(stream, state) {
- var ch = stream.next();
- curPunc = null;
- if (ch == "$" || ch == "?") {
- if(ch == "?" && stream.match(/\s/, false)){
- return "operator";
- }
- stream.match(/^[\w\d]*/);
- return "variable-2";
- }
- else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) {
- stream.match(/^[^\s\u00a0>]*>?/);
- return "atom";
- }
- else if (ch == "\"" || ch == "'") {
- state.tokenize = tokenLiteral(ch);
- return state.tokenize(stream, state);
- }
- else if (/[{}\(\),\.;\[\]]/.test(ch)) {
- curPunc = ch;
- return "bracket";
- }
- else if (ch == "#") {
- stream.skipToEnd();
- return "comment";
- }
- else if (operatorChars.test(ch)) {
- stream.eatWhile(operatorChars);
- return "operator";
- }
- else if (ch == ":") {
- stream.eatWhile(/[\w\d\._\-]/);
- return "atom";
- }
- else if (ch == "@") {
- stream.eatWhile(/[a-z\d\-]/i);
- return "meta";
- }
- else {
- stream.eatWhile(/[_\w\d]/);
- if (stream.eat(":")) {
- stream.eatWhile(/[\w\d_\-]/);
- return "atom";
- }
- var word = stream.current();
- if (ops.test(word))
- return "builtin";
- else if (keywords.test(word))
- return "keyword";
- else
- return "variable";
- }
- }
-
- function tokenLiteral(quote) {
- return function(stream, state) {
- var escaped = false, ch;
- while ((ch = stream.next()) != null) {
- if (ch == quote && !escaped) {
- state.tokenize = tokenBase;
- break;
- }
- escaped = !escaped && ch == "\\";
- }
- return "string";
- };
- }
-
- function pushContext(state, type, col) {
- state.context = {prev: state.context, indent: state.indent, col: col, type: type};
- }
- function popContext(state) {
- state.indent = state.context.indent;
- state.context = state.context.prev;
- }
-
- return {
- startState: function() {
- return {tokenize: tokenBase,
- context: null,
- indent: 0,
- col: 0};
- },
-
- token: function(stream, state) {
- if (stream.sol()) {
- if (state.context && state.context.align == null) state.context.align = false;
- state.indent = stream.indentation();
- }
- if (stream.eatSpace()) return null;
- var style = state.tokenize(stream, state);
-
- if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") {
- state.context.align = true;
- }
-
- if (curPunc == "(") pushContext(state, ")", stream.column());
- else if (curPunc == "[") pushContext(state, "]", stream.column());
- else if (curPunc == "{") pushContext(state, "}", stream.column());
- else if (/[\]\}\)]/.test(curPunc)) {
- while (state.context && state.context.type == "pattern") popContext(state);
- if (state.context && curPunc == state.context.type) {
- popContext(state);
- if (curPunc == "}" && state.context && state.context.type == "pattern")
- popContext(state);
- }
- }
- else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state);
- else if (/atom|string|variable/.test(style) && state.context) {
- if (/[\}\]]/.test(state.context.type))
- pushContext(state, "pattern", stream.column());
- else if (state.context.type == "pattern" && !state.context.align) {
- state.context.align = true;
- state.context.col = stream.column();
- }
- }
-
- return style;
- },
-
- indent: function(state, textAfter) {
- var firstChar = textAfter && textAfter.charAt(0);
- var context = state.context;
- if (/[\]\}]/.test(firstChar))
- while (context && context.type == "pattern") context = context.prev;
-
- var closing = context && firstChar == context.type;
- if (!context)
- return 0;
- else if (context.type == "pattern")
- return context.col;
- else if (context.align)
- return context.col + (closing ? 0 : 1);
- else
- return context.indent + (closing ? 0 : indentUnit);
- },
-
- lineComment: "#"
- };
-});
-
-CodeMirror.defineMIME("application/sparql-query", "sparql");
-
-});
diff --git a/shared/codemirror/mode/spreadsheet/spreadsheet.js b/shared/codemirror/mode/spreadsheet/spreadsheet.js
deleted file mode 100644
index 222f297..0000000
--- a/shared/codemirror/mode/spreadsheet/spreadsheet.js
+++ /dev/null
@@ -1,112 +0,0 @@
-// 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("spreadsheet", function () {
- return {
- startState: function () {
- return {
- stringType: null,
- stack: []
- };
- },
- token: function (stream, state) {
- if (!stream) return;
-
- //check for state changes
- if (state.stack.length === 0) {
- //strings
- if ((stream.peek() == '"') || (stream.peek() == "'")) {
- state.stringType = stream.peek();
- stream.next(); // Skip quote
- state.stack.unshift("string");
- }
- }
-
- //return state
- //stack has
- switch (state.stack[0]) {
- case "string":
- while (state.stack[0] === "string" && !stream.eol()) {
- if (stream.peek() === state.stringType) {
- stream.next(); // Skip quote
- state.stack.shift(); // Clear flag
- } else if (stream.peek() === "\\") {
- stream.next();
- stream.next();
- } else {
- stream.match(/^.[^\\\"\']*/);
- }
- }
- return "string";
-
- case "characterClass":
- while (state.stack[0] === "characterClass" && !stream.eol()) {
- if (!(stream.match(/^[^\]\\]+/) || stream.match(/^\\./)))
- state.stack.shift();
- }
- return "operator";
- }
-
- var peek = stream.peek();
-
- //no stack
- switch (peek) {
- case "[":
- stream.next();
- state.stack.unshift("characterClass");
- return "bracket";
- case ":":
- stream.next();
- return "operator";
- case "\\":
- if (stream.match(/\\[a-z]+/)) return "string-2";
- else {
- stream.next();
- return "atom";
- }
- case ".":
- case ",":
- case ";":
- case "*":
- case "-":
- case "+":
- case "^":
- case "<":
- case "/":
- case "=":
- stream.next();
- return "atom";
- case "$":
- stream.next();
- return "builtin";
- }
-
- if (stream.match(/\d+/)) {
- if (stream.match(/^\w+/)) return "error";
- return "number";
- } else if (stream.match(/^[a-zA-Z_]\w*/)) {
- if (stream.match(/(?=[\(.])/, false)) return "keyword";
- return "variable-2";
- } else if (["[", "]", "(", ")", "{", "}"].indexOf(peek) != -1) {
- stream.next();
- return "bracket";
- } else if (!stream.eatSpace()) {
- stream.next();
- }
- return null;
- }
- };
- });
-
- CodeMirror.defineMIME("text/x-spreadsheet", "spreadsheet");
-});
diff --git a/shared/codemirror/mode/sql/sql.js b/shared/codemirror/mode/sql/sql.js
deleted file mode 100644
index daec60c..0000000
--- a/shared/codemirror/mode/sql/sql.js
+++ /dev/null
@@ -1,413 +0,0 @@
-// 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("sql", function(config, parserConfig) {
- "use strict";
-
- var client = parserConfig.client || {},
- atoms = parserConfig.atoms || {"false": true, "true": true, "null": true},
- builtin = parserConfig.builtin || {},
- keywords = parserConfig.keywords || {},
- operatorChars = parserConfig.operatorChars || /^[*+\-%<>!=&|~^]/,
- support = parserConfig.support || {},
- hooks = parserConfig.hooks || {},
- dateSQL = parserConfig.dateSQL || {"date" : true, "time" : true, "timestamp" : true};
-
- function tokenBase(stream, state) {
- var ch = stream.next();
-
- // call hooks from the mime type
- if (hooks[ch]) {
- var result = hooks[ch](stream, state);
- if (result !== false) return result;
- }
-
- if (support.hexNumber == true &&
- ((ch == "0" && stream.match(/^[xX][0-9a-fA-F]+/))
- || (ch == "x" || ch == "X") && stream.match(/^'[0-9a-fA-F]+'/))) {
- // hex
- // ref: http://dev.mysql.com/doc/refman/5.5/en/hexadecimal-literals.html
- return "number";
- } else if (support.binaryNumber == true &&
- (((ch == "b" || ch == "B") && stream.match(/^'[01]+'/))
- || (ch == "0" && stream.match(/^b[01]+/)))) {
- // bitstring
- // ref: http://dev.mysql.com/doc/refman/5.5/en/bit-field-literals.html
- return "number";
- } else if (ch.charCodeAt(0) > 47 && ch.charCodeAt(0) < 58) {
- // numbers
- // ref: http://dev.mysql.com/doc/refman/5.5/en/number-literals.html
- stream.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/);
- support.decimallessFloat == true && stream.eat('.');
- return "number";
- } else if (ch == "?" && (stream.eatSpace() || stream.eol() || stream.eat(";"))) {
- // placeholders
- return "variable-3";
- } else if (ch == "'" || (ch == '"' && support.doubleQuote)) {
- // strings
- // ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html
- state.tokenize = tokenLiteral(ch);
- return state.tokenize(stream, state);
- } else if ((((support.nCharCast == true && (ch == "n" || ch == "N"))
- || (support.charsetCast == true && ch == "_" && stream.match(/[a-z][a-z0-9]*/i)))
- && (stream.peek() == "'" || stream.peek() == '"'))) {
- // charset casting: _utf8'str', N'str', n'str'
- // ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html
- return "keyword";
- } else if (/^[\(\),\;\[\]]/.test(ch)) {
- // no highlighting
- return null;
- } else if (support.commentSlashSlash && ch == "/" && stream.eat("/")) {
- // 1-line comment
- stream.skipToEnd();
- return "comment";
- } else if ((support.commentHash && ch == "#")
- || (ch == "-" && stream.eat("-") && (!support.commentSpaceRequired || stream.eat(" ")))) {
- // 1-line comments
- // ref: https://kb.askmonty.org/en/comment-syntax/
- stream.skipToEnd();
- return "comment";
- } else if (ch == "/" && stream.eat("*")) {
- // multi-line comments
- // ref: https://kb.askmonty.org/en/comment-syntax/
- state.tokenize = tokenComment;
- return state.tokenize(stream, state);
- } else if (ch == ".") {
- // .1 for 0.1
- if (support.zerolessFloat == true && stream.match(/^(?:\d+(?:e[+-]?\d+)?)/i)) {
- return "number";
- }
- // .table_name (ODBC)
- // // ref: http://dev.mysql.com/doc/refman/5.6/en/identifier-qualifiers.html
- if (support.ODBCdotTable == true && stream.match(/^[a-zA-Z_]+/)) {
- return "variable-2";
- }
- } else if (operatorChars.test(ch)) {
- // operators
- stream.eatWhile(operatorChars);
- return null;
- } else if (ch == '{' &&
- (stream.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/) || stream.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/))) {
- // dates (weird ODBC syntax)
- // ref: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-literals.html
- return "number";
- } else {
- stream.eatWhile(/^[_\w\d]/);
- var word = stream.current().toLowerCase();
- // dates (standard SQL syntax)
- // ref: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-literals.html
- if (dateSQL.hasOwnProperty(word) && (stream.match(/^( )+'[^']*'/) || stream.match(/^( )+"[^"]*"/)))
- return "number";
- if (atoms.hasOwnProperty(word)) return "atom";
- if (builtin.hasOwnProperty(word)) return "builtin";
- if (keywords.hasOwnProperty(word)) return "keyword";
- if (client.hasOwnProperty(word)) return "string-2";
- return null;
- }
- }
-
- // 'string', with char specified in quote escaped by '\'
- function tokenLiteral(quote) {
- return function(stream, state) {
- var escaped = false, ch;
- while ((ch = stream.next()) != null) {
- if (ch == quote && !escaped) {
- state.tokenize = tokenBase;
- break;
- }
- escaped = !escaped && ch == "\\";
- }
- return "string";
- };
- }
- function tokenComment(stream, state) {
- while (true) {
- if (stream.skipTo("*")) {
- stream.next();
- if (stream.eat("/")) {
- state.tokenize = tokenBase;
- break;
- }
- } else {
- stream.skipToEnd();
- break;
- }
- }
- return "comment";
- }
-
- function pushContext(stream, state, type) {
- state.context = {
- prev: state.context,
- indent: stream.indentation(),
- col: stream.column(),
- type: type
- };
- }
-
- function popContext(state) {
- state.indent = state.context.indent;
- state.context = state.context.prev;
- }
-
- return {
- startState: function() {
- return {tokenize: tokenBase, context: null};
- },
-
- token: function(stream, state) {
- if (stream.sol()) {
- if (state.context && state.context.align == null)
- state.context.align = false;
- }
- if (stream.eatSpace()) return null;
-
- var style = state.tokenize(stream, state);
- if (style == "comment") return style;
-
- if (state.context && state.context.align == null)
- state.context.align = true;
-
- var tok = stream.current();
- if (tok == "(")
- pushContext(stream, state, ")");
- else if (tok == "[")
- pushContext(stream, state, "]");
- else if (state.context && state.context.type == tok)
- popContext(state);
- return style;
- },
-
- indent: function(state, textAfter) {
- var cx = state.context;
- if (!cx) return CodeMirror.Pass;
- var closing = textAfter.charAt(0) == cx.type;
- if (cx.align) return cx.col + (closing ? 0 : 1);
- else return cx.indent + (closing ? 0 : config.indentUnit);
- },
-
- blockCommentStart: "/*",
- blockCommentEnd: "*/",
- lineComment: support.commentSlashSlash ? "//" : support.commentHash ? "#" : null
- };
-});
-
-(function() {
- "use strict";
-
- // `identifier`
- function hookIdentifier(stream) {
- // MySQL/MariaDB identifiers
- // ref: http://dev.mysql.com/doc/refman/5.6/en/identifier-qualifiers.html
- var ch;
- while ((ch = stream.next()) != null) {
- if (ch == "`" && !stream.eat("`")) return "variable-2";
- }
- stream.backUp(stream.current().length - 1);
- return stream.eatWhile(/\w/) ? "variable-2" : null;
- }
-
- // variable token
- function hookVar(stream) {
- // variables
- // @@prefix.varName @varName
- // varName can be quoted with ` or ' or "
- // ref: http://dev.mysql.com/doc/refman/5.5/en/user-variables.html
- if (stream.eat("@")) {
- stream.match(/^session\./);
- stream.match(/^local\./);
- stream.match(/^global\./);
- }
-
- if (stream.eat("'")) {
- stream.match(/^.*'/);
- return "variable-2";
- } else if (stream.eat('"')) {
- stream.match(/^.*"/);
- return "variable-2";
- } else if (stream.eat("`")) {
- stream.match(/^.*`/);
- return "variable-2";
- } else if (stream.match(/^[0-9a-zA-Z$\.\_]+/)) {
- return "variable-2";
- }
- return null;
- };
-
- // short client keyword token
- function hookClient(stream) {
- // \N means NULL
- // ref: http://dev.mysql.com/doc/refman/5.5/en/null-values.html
- if (stream.eat("N")) {
- return "atom";
- }
- // \g, etc
- // ref: http://dev.mysql.com/doc/refman/5.5/en/mysql-commands.html
- return stream.match(/^[a-zA-Z.#!?]/) ? "variable-2" : null;
- }
-
- // these keywords are used by all SQL dialects (however, a mode can still overwrite it)
- var sqlKeywords = "alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where limit ";
-
- // turn a space-separated list into an array
- function set(str) {
- var obj = {}, words = str.split(" ");
- for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
- return obj;
- }
-
- // A generic SQL Mode. It's not a standard, it just try to support what is generally supported
- CodeMirror.defineMIME("text/x-sql", {
- name: "sql",
- keywords: set(sqlKeywords + "begin"),
- builtin: set("bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric"),
- atoms: set("false true null unknown"),
- operatorChars: /^[*+\-%<>!=]/,
- dateSQL: set("date time timestamp"),
- support: set("ODBCdotTable doubleQuote binaryNumber hexNumber")
- });
-
- CodeMirror.defineMIME("text/x-mssql", {
- name: "sql",
- client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),
- keywords: set(sqlKeywords + "begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare"),
- builtin: set("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),
- atoms: set("false true null unknown"),
- operatorChars: /^[*+\-%<>!=]/,
- dateSQL: set("date datetimeoffset datetime2 smalldatetime datetime time"),
- hooks: {
- "@": hookVar
- }
- });
-
- 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 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: /^[*+\-%<>!=&|^]/,
- dateSQL: set("date time timestamp"),
- support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),
- hooks: {
- "@": hookVar,
- "`": hookIdentifier,
- "\\": hookClient
- }
- });
-
- CodeMirror.defineMIME("text/x-mariadb", {
- 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 always 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 generated get global grant grants group groupby_concat handler hard 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 persistent 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 shutdown signal slave slow smallint snapshot soft 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 virtual 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: /^[*+\-%<>!=&|^]/,
- dateSQL: set("date time timestamp"),
- support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),
- hooks: {
- "@": hookVar,
- "`": hookIdentifier,
- "\\": hookClient
- }
- });
-
- // the query language used by Apache Cassandra is called CQL, but this mime type
- // is called Cassandra to avoid confusion with Contextual Query Language
- CodeMirror.defineMIME("text/x-cassandra", {
- name: "sql",
- client: { },
- keywords: set("add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime"),
- builtin: set("ascii bigint blob boolean counter decimal double float frozen inet int list map static text timestamp timeuuid tuple uuid varchar varint"),
- atoms: set("false true infinity NaN"),
- operatorChars: /^[<>=]/,
- dateSQL: { },
- support: set("commentSlashSlash decimallessFloat"),
- hooks: { }
- });
-
- // this is based on Peter Raganitsch's 'plsql' mode
- CodeMirror.defineMIME("text/x-plsql", {
- name: "sql",
- client: set("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),
- keywords: set("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),
- builtin: set("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least length lengthb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),
- operatorChars: /^[*+\-%<>!=~]/,
- dateSQL: set("date time timestamp"),
- support: set("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")
- });
-
- // Created to support specific hive keywords
- CodeMirror.defineMIME("text/x-hive", {
- name: "sql",
- keywords: set("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"),
- builtin: set("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"),
- atoms: set("false true null unknown"),
- operatorChars: /^[*+\-%<>!=]/,
- dateSQL: set("date timestamp"),
- support: set("ODBCdotTable doubleQuote binaryNumber hexNumber")
- });
-
- CodeMirror.defineMIME("text/x-pgsql", {
- name: "sql",
- client: set("source"),
- // http://www.postgresql.org/docs/9.5/static/sql-keywords-appendix.html
- keywords: set(sqlKeywords + "a abort abs absent absolute access according action ada add admin after aggregate all allocate also always analyse analyze any are array array_agg array_max_cardinality asensitive assertion assignment asymmetric at atomic attribute attributes authorization avg backward base64 before begin begin_frame begin_partition bernoulli binary bit_length blob blocked bom both breadth c cache call called cardinality cascade cascaded case cast catalog catalog_name ceil ceiling chain characteristics characters character_length character_set_catalog character_set_name character_set_schema char_length check checkpoint class class_origin clob close cluster coalesce cobol collate collation collation_catalog collation_name collation_schema collect column columns column_name command_function command_function_code comment comments commit committed concurrently condition condition_number configuration conflict connect connection connection_name constraint constraints constraint_catalog constraint_name constraint_schema constructor contains content continue control conversion convert copy corr corresponding cost covar_pop covar_samp cross csv cube cume_dist current current_catalog current_date current_default_transform_group current_path current_role current_row current_schema current_time current_timestamp current_transform_group_for_type current_user cursor cursor_name cycle data database datalink datetime_interval_code datetime_interval_precision day db deallocate dec declare default defaults deferrable deferred defined definer degree delimiter delimiters dense_rank depth deref derived describe descriptor deterministic diagnostics dictionary disable discard disconnect dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue do document domain dynamic dynamic_function dynamic_function_code each element else empty enable encoding encrypted end end-exec end_frame end_partition enforced enum equals escape event every except exception exclude excluding exclusive exec execute exists exp explain expression extension external extract false family fetch file filter final first first_value flag float floor following for force foreign fortran forward found frame_row free freeze fs full function functions fusion g general generated get global go goto grant granted greatest grouping groups handler header hex hierarchy hold hour id identity if ignore ilike immediate immediately immutable implementation implicit import including increment indent index indexes indicator inherit inherits initially inline inner inout input insensitive instance instantiable instead integrity intersect intersection invoker isnull isolation k key key_member key_type label lag language large last last_value lateral lead leading leakproof least left length level library like_regex link listen ln load local localtime localtimestamp location locator lock locked logged lower m map mapping match matched materialized max maxvalue max_cardinality member merge message_length message_octet_length message_text method min minute minvalue mod mode modifies module month more move multiset mumps name names namespace national natural nchar nclob nesting new next nfc nfd nfkc nfkd nil no none normalize normalized nothing notify notnull nowait nth_value ntile null nullable nullif nulls number object occurrences_regex octets octet_length of off offset oids old only open operator option options ordering ordinality others out outer output over overlaps overlay overriding owned owner p pad parameter parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partial partition pascal passing passthrough password percent percentile_cont percentile_disc percent_rank period permission placing plans pli policy portion position position_regex power precedes preceding prepare prepared preserve primary prior privileges procedural procedure program public quote range rank read reads reassign recheck recovery recursive ref references referencing refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release rename repeatable replace replica requiring reset respect restart restore restrict result return returned_cardinality returned_length returned_octet_length returned_sqlstate returning returns revoke right role rollback rollup routine routine_catalog routine_name routine_schema row rows row_count row_number rule savepoint scale schema schema_name scope scope_catalog scope_name scope_schema scroll search second section security selective self sensitive sequence sequences serializable server server_name session session_user setof sets share show similar simple size skip snapshot some source space specific specifictype specific_name sql sqlcode sqlerror sqlexception sqlstate sqlwarning sqrt stable standalone start state statement static statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset substring substring_regex succeeds sum symmetric sysid system system_time system_user t tables tablesample tablespace table_name temp template temporary then ties timezone_hour timezone_minute to token top_level_count trailing transaction transactions_committed transactions_rolled_back transaction_active transform transforms translate translate_regex translation treat trigger trigger_catalog trigger_name trigger_schema trim trim_array true truncate trusted type types uescape unbounded uncommitted under unencrypted unique unknown unlink unlisten unlogged unnamed unnest until untyped upper uri usage user user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema using vacuum valid validate validator value value_of varbinary variadic var_pop var_samp verbose version versioning view views volatile when whenever whitespace width_bucket window within work wrapper write xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate year yes loop repeat"),
- // http://www.postgresql.org/docs/9.5/static/datatype.html
- builtin: set("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),
- atoms: set("false true null unknown"),
- operatorChars: /^[*+\-%<>!=&|^]/,
- dateSQL: set("date time timestamp"),
- support: set("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast commentHash commentSpaceRequired")
- });
-
- // Google's SQL-like query language, GQL
- CodeMirror.defineMIME("text/x-gql", {
- name: "sql",
- keywords: set("ancestor and asc by contains desc descendant distinct from group has in is limit offset on order select superset where"),
- atoms: set("false true"),
- builtin: set("blob datetime first key __key__ string integer double boolean null"),
- operatorChars: /^[*+\-%<>!=]/
- });
-}());
-
-});
-
-/*
- How Properties of Mime Types are used by SQL Mode
- =================================================
-
- keywords:
- A list of keywords you want to be highlighted.
- builtin:
- A list of builtin types you want to be highlighted (if you want types to be of class "builtin" instead of "keyword").
- operatorChars:
- All characters that must be handled as operators.
- client:
- Commands parsed and executed by the client (not the server).
- support:
- A list of supported syntaxes which are not common, but are supported by more than 1 DBMS.
- * ODBCdotTable: .tableName
- * zerolessFloat: .1
- * doubleQuote
- * nCharCast: N'string'
- * charsetCast: _utf8'string'
- * commentHash: use # char for comments
- * commentSlashSlash: use // for comments
- * commentSpaceRequired: require a space after -- for comments
- atoms:
- Keywords that must be highlighted as atoms,. Some DBMS's support more atoms than others:
- UNKNOWN, INFINITY, UNDERFLOW, NaN...
- dateSQL:
- Used for date/time SQL standard syntax, because not all DBMS's support same temporal types.
-*/
diff --git a/shared/codemirror/mode/stex/stex.js b/shared/codemirror/mode/stex/stex.js
deleted file mode 100644
index 835ed46..0000000
--- a/shared/codemirror/mode/stex/stex.js
+++ /dev/null
@@ -1,251 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-/*
- * Author: Constantin Jucovschi (c.jucovschi@jacobs-university.de)
- * Licence: MIT
- */
-
-(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("stex", function() {
- "use strict";
-
- function pushCommand(state, command) {
- state.cmdState.push(command);
- }
-
- function peekCommand(state) {
- if (state.cmdState.length > 0) {
- return state.cmdState[state.cmdState.length - 1];
- } else {
- return null;
- }
- }
-
- function popCommand(state) {
- var plug = state.cmdState.pop();
- if (plug) {
- plug.closeBracket();
- }
- }
-
- // returns the non-default plugin closest to the end of the list
- function getMostPowerful(state) {
- var context = state.cmdState;
- for (var i = context.length - 1; i >= 0; i--) {
- var plug = context[i];
- if (plug.name == "DEFAULT") {
- continue;
- }
- return plug;
- }
- return { styleIdentifier: function() { return null; } };
- }
-
- function addPluginPattern(pluginName, cmdStyle, styles) {
- return function () {
- this.name = pluginName;
- this.bracketNo = 0;
- this.style = cmdStyle;
- this.styles = styles;
- this.argument = null; // \begin and \end have arguments that follow. These are stored in the plugin
-
- this.styleIdentifier = function() {
- return this.styles[this.bracketNo - 1] || null;
- };
- this.openBracket = function() {
- this.bracketNo++;
- return "bracket";
- };
- this.closeBracket = function() {};
- };
- }
-
- var plugins = {};
-
- plugins["importmodule"] = addPluginPattern("importmodule", "tag", ["string", "builtin"]);
- plugins["documentclass"] = addPluginPattern("documentclass", "tag", ["", "atom"]);
- plugins["usepackage"] = addPluginPattern("usepackage", "tag", ["atom"]);
- plugins["begin"] = addPluginPattern("begin", "tag", ["atom"]);
- plugins["end"] = addPluginPattern("end", "tag", ["atom"]);
-
- plugins["DEFAULT"] = function () {
- this.name = "DEFAULT";
- this.style = "tag";
-
- this.styleIdentifier = this.openBracket = this.closeBracket = function() {};
- };
-
- function setState(state, f) {
- state.f = f;
- }
-
- // called when in a normal (no environment) context
- function normal(source, state) {
- var plug;
- // Do we look like '\command' ? If so, attempt to apply the plugin 'command'
- if (source.match(/^\\[a-zA-Z@]+/)) {
- var cmdName = source.current().slice(1);
- plug = plugins[cmdName] || plugins["DEFAULT"];
- plug = new plug();
- pushCommand(state, plug);
- setState(state, beginParams);
- return plug.style;
- }
-
- // escape characters
- if (source.match(/^\\[$&%#{}_]/)) {
- return "tag";
- }
-
- // white space control characters
- if (source.match(/^\\[,;!\/\\]/)) {
- return "tag";
- }
-
- // find if we're starting various math modes
- if (source.match("\\[")) {
- setState(state, function(source, state){ return inMathMode(source, state, "\\]"); });
- return "keyword";
- }
- if (source.match("$$")) {
- setState(state, function(source, state){ return inMathMode(source, state, "$$"); });
- return "keyword";
- }
- if (source.match("$")) {
- setState(state, function(source, state){ return inMathMode(source, state, "$"); });
- return "keyword";
- }
-
- var ch = source.next();
- if (ch == "%") {
- source.skipToEnd();
- return "comment";
- } else if (ch == '}' || ch == ']') {
- plug = peekCommand(state);
- if (plug) {
- plug.closeBracket(ch);
- setState(state, beginParams);
- } else {
- return "error";
- }
- return "bracket";
- } else if (ch == '{' || ch == '[') {
- plug = plugins["DEFAULT"];
- plug = new plug();
- pushCommand(state, plug);
- return "bracket";
- } else if (/\d/.test(ch)) {
- source.eatWhile(/[\w.%]/);
- return "atom";
- } else {
- source.eatWhile(/[\w\-_]/);
- plug = getMostPowerful(state);
- if (plug.name == 'begin') {
- plug.argument = source.current();
- }
- return plug.styleIdentifier();
- }
- }
-
- function inMathMode(source, state, endModeSeq) {
- if (source.eatSpace()) {
- return null;
- }
- if (source.match(endModeSeq)) {
- setState(state, normal);
- return "keyword";
- }
- if (source.match(/^\\[a-zA-Z@]+/)) {
- return "tag";
- }
- if (source.match(/^[a-zA-Z]+/)) {
- return "variable-2";
- }
- // escape characters
- if (source.match(/^\\[$&%#{}_]/)) {
- return "tag";
- }
- // white space control characters
- if (source.match(/^\\[,;!\/]/)) {
- return "tag";
- }
- // special math-mode characters
- if (source.match(/^[\^_&]/)) {
- return "tag";
- }
- // non-special characters
- if (source.match(/^[+\-<>|=,\/@!*:;'"`~#?]/)) {
- return null;
- }
- if (source.match(/^(\d+\.\d*|\d*\.\d+|\d+)/)) {
- return "number";
- }
- var ch = source.next();
- if (ch == "{" || ch == "}" || ch == "[" || ch == "]" || ch == "(" || ch == ")") {
- return "bracket";
- }
-
- if (ch == "%") {
- source.skipToEnd();
- return "comment";
- }
- return "error";
- }
-
- function beginParams(source, state) {
- var ch = source.peek(), lastPlug;
- if (ch == '{' || ch == '[') {
- lastPlug = peekCommand(state);
- lastPlug.openBracket(ch);
- source.eat(ch);
- setState(state, normal);
- return "bracket";
- }
- if (/[ \t\r]/.test(ch)) {
- source.eat(ch);
- return null;
- }
- setState(state, normal);
- popCommand(state);
-
- return normal(source, state);
- }
-
- return {
- startState: function() {
- return {
- cmdState: [],
- f: normal
- };
- },
- copyState: function(s) {
- return {
- cmdState: s.cmdState.slice(),
- f: s.f
- };
- },
- token: function(stream, state) {
- return state.f(stream, state);
- },
- blankLine: function(state) {
- state.f = normal;
- state.cmdState.length = 0;
- },
- lineComment: "%"
- };
- });
-
- CodeMirror.defineMIME("text/x-stex", "stex");
- CodeMirror.defineMIME("text/x-latex", "stex");
-
-});
diff --git a/shared/codemirror/mode/stylus/stylus.js b/shared/codemirror/mode/stylus/stylus.js
deleted file mode 100644
index 662cd03..0000000
--- a/shared/codemirror/mode/stylus/stylus.js
+++ /dev/null
@@ -1,769 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-// Stylus mode created by Dmitry Kiselyov http://git.io/AaRB
-
-(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("stylus", function(config) {
- var indentUnit = config.indentUnit,
- tagKeywords = keySet(tagKeywords_),
- tagVariablesRegexp = /^(a|b|i|s|col|em)$/i,
- propertyKeywords = keySet(propertyKeywords_),
- nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_),
- valueKeywords = keySet(valueKeywords_),
- colorKeywords = keySet(colorKeywords_),
- documentTypes = keySet(documentTypes_),
- documentTypesRegexp = wordRegexp(documentTypes_),
- mediaFeatures = keySet(mediaFeatures_),
- mediaTypes = keySet(mediaTypes_),
- fontProperties = keySet(fontProperties_),
- operatorsRegexp = /^\s*([.]{2,3}|&&|\|\||\*\*|[?!=:]?=|[-+*\/%<>]=?|\?:|\~)/,
- wordOperatorKeywordsRegexp = wordRegexp(wordOperatorKeywords_),
- blockKeywords = keySet(blockKeywords_),
- vendorPrefixesRegexp = new RegExp(/^\-(moz|ms|o|webkit)-/i),
- commonAtoms = keySet(commonAtoms_),
- firstWordMatch = "",
- states = {},
- ch,
- style,
- type,
- override;
-
- /**
- * Tokenizers
- */
- function tokenBase(stream, state) {
- firstWordMatch = stream.string.match(/(^[\w-]+\s*=\s*$)|(^\s*[\w-]+\s*=\s*[\w-])|(^\s*(\.|#|@|\$|\&|\[|\d|\+|::?|\{|\>|~|\/)?\s*[\w-]*([a-z0-9-]|\*|\/\*)(\(|,)?)/);
- state.context.line.firstWord = firstWordMatch ? firstWordMatch[0].replace(/^\s*/, "") : "";
- state.context.line.indent = stream.indentation();
- ch = stream.peek();
-
- // Line comment
- if (stream.match("//")) {
- stream.skipToEnd();
- return ["comment", "comment"];
- }
- // Block comment
- if (stream.match("/*")) {
- state.tokenize = tokenCComment;
- return tokenCComment(stream, state);
- }
- // String
- if (ch == "\"" || ch == "'") {
- stream.next();
- state.tokenize = tokenString(ch);
- return state.tokenize(stream, state);
- }
- // Def
- if (ch == "@") {
- stream.next();
- stream.eatWhile(/[\w\\-]/);
- return ["def", stream.current()];
- }
- // ID selector or Hex color
- if (ch == "#") {
- stream.next();
- // Hex color
- if (stream.match(/^[0-9a-f]{6}|[0-9a-f]{3}/i)) {
- return ["atom", "atom"];
- }
- // ID selector
- if (stream.match(/^[a-z][\w-]*/i)) {
- return ["builtin", "hash"];
- }
- }
- // Vendor prefixes
- if (stream.match(vendorPrefixesRegexp)) {
- return ["meta", "vendor-prefixes"];
- }
- // Numbers
- if (stream.match(/^-?[0-9]?\.?[0-9]/)) {
- stream.eatWhile(/[a-z%]/i);
- return ["number", "unit"];
- }
- // !important|optional
- if (ch == "!") {
- stream.next();
- return [stream.match(/^(important|optional)/i) ? "keyword": "operator", "important"];
- }
- // Class
- if (ch == "." && stream.match(/^\.[a-z][\w-]*/i)) {
- return ["qualifier", "qualifier"];
- }
- // url url-prefix domain regexp
- if (stream.match(documentTypesRegexp)) {
- if (stream.peek() == "(") state.tokenize = tokenParenthesized;
- return ["property", "word"];
- }
- // Mixins / Functions
- if (stream.match(/^[a-z][\w-]*\(/i)) {
- stream.backUp(1);
- return ["keyword", "mixin"];
- }
- // Block mixins
- if (stream.match(/^(\+|-)[a-z][\w-]*\(/i)) {
- stream.backUp(1);
- return ["keyword", "block-mixin"];
- }
- // Parent Reference BEM naming
- if (stream.string.match(/^\s*&/) && stream.match(/^[-_]+[a-z][\w-]*/)) {
- return ["qualifier", "qualifier"];
- }
- // / Root Reference & Parent Reference
- if (stream.match(/^(\/|&)(-|_|:|\.|#|[a-z])/)) {
- stream.backUp(1);
- return ["variable-3", "reference"];
- }
- if (stream.match(/^&{1}\s*$/)) {
- return ["variable-3", "reference"];
- }
- // Word operator
- if (stream.match(wordOperatorKeywordsRegexp)) {
- return ["operator", "operator"];
- }
- // Word
- if (stream.match(/^\$?[-_]*[a-z0-9]+[\w-]*/i)) {
- // Variable
- if (stream.match(/^(\.|\[)[\w-\'\"\]]+/i, false)) {
- if (!wordIsTag(stream.current())) {
- stream.match(/\./);
- return ["variable-2", "variable-name"];
- }
- }
- return ["variable-2", "word"];
- }
- // Operators
- if (stream.match(operatorsRegexp)) {
- return ["operator", stream.current()];
- }
- // Delimiters
- if (/[:;,{}\[\]\(\)]/.test(ch)) {
- stream.next();
- return [null, ch];
- }
- // Non-detected items
- stream.next();
- return [null, null];
- }
-
- /**
- * Token comment
- */
- function tokenCComment(stream, state) {
- var maybeEnd = false, ch;
- while ((ch = stream.next()) != null) {
- if (maybeEnd && ch == "/") {
- state.tokenize = null;
- break;
- }
- maybeEnd = (ch == "*");
- }
- return ["comment", "comment"];
- }
-
- /**
- * Token string
- */
- function tokenString(quote) {
- return function(stream, state) {
- var escaped = false, ch;
- while ((ch = stream.next()) != null) {
- if (ch == quote && !escaped) {
- if (quote == ")") stream.backUp(1);
- break;
- }
- escaped = !escaped && ch == "\\";
- }
- if (ch == quote || !escaped && quote != ")") state.tokenize = null;
- return ["string", "string"];
- };
- }
-
- /**
- * Token parenthesized
- */
- function tokenParenthesized(stream, state) {
- stream.next(); // Must be "("
- if (!stream.match(/\s*[\"\')]/, false))
- state.tokenize = tokenString(")");
- else
- state.tokenize = null;
- return [null, "("];
- }
-
- /**
- * Context management
- */
- function Context(type, indent, prev, line) {
- this.type = type;
- this.indent = indent;
- this.prev = prev;
- this.line = line || {firstWord: "", indent: 0};
- }
-
- function pushContext(state, stream, type, indent) {
- indent = indent >= 0 ? indent : indentUnit;
- state.context = new Context(type, stream.indentation() + indent, state.context);
- return type;
- }
-
- function popContext(state, currentIndent) {
- var contextIndent = state.context.indent - indentUnit;
- currentIndent = currentIndent || false;
- state.context = state.context.prev;
- if (currentIndent) state.context.indent = contextIndent;
- return state.context.type;
- }
-
- function pass(type, stream, state) {
- return states[state.context.type](type, stream, state);
- }
-
- function popAndPass(type, stream, state, n) {
- for (var i = n || 1; i > 0; i--)
- state.context = state.context.prev;
- return pass(type, stream, state);
- }
-
-
- /**
- * Parser
- */
- function wordIsTag(word) {
- return word.toLowerCase() in tagKeywords;
- }
-
- function wordIsProperty(word) {
- word = word.toLowerCase();
- return word in propertyKeywords || word in fontProperties;
- }
-
- function wordIsBlock(word) {
- return word.toLowerCase() in blockKeywords;
- }
-
- function wordIsVendorPrefix(word) {
- return word.toLowerCase().match(vendorPrefixesRegexp);
- }
-
- function wordAsValue(word) {
- var wordLC = word.toLowerCase();
- var override = "variable-2";
- if (wordIsTag(word)) override = "tag";
- else if (wordIsBlock(word)) override = "block-keyword";
- else if (wordIsProperty(word)) override = "property";
- else if (wordLC in valueKeywords || wordLC in commonAtoms) override = "atom";
- else if (wordLC == "return" || wordLC in colorKeywords) override = "keyword";
-
- // Font family
- else if (word.match(/^[A-Z]/)) override = "string";
- return override;
- }
-
- function typeIsBlock(type, stream) {
- return ((endOfLine(stream) && (type == "{" || type == "]" || type == "hash" || type == "qualifier")) || type == "block-mixin");
- }
-
- function typeIsInterpolation(type, stream) {
- return type == "{" && stream.match(/^\s*\$?[\w-]+/i, false);
- }
-
- function typeIsPseudo(type, stream) {
- return type == ":" && stream.match(/^[a-z-]+/, false);
- }
-
- function startOfLine(stream) {
- return stream.sol() || stream.string.match(new RegExp("^\\s*" + escapeRegExp(stream.current())));
- }
-
- function endOfLine(stream) {
- return stream.eol() || stream.match(/^\s*$/, false);
- }
-
- function firstWordOfLine(line) {
- var re = /^\s*[-_]*[a-z0-9]+[\w-]*/i;
- var result = typeof line == "string" ? line.match(re) : line.string.match(re);
- return result ? result[0].replace(/^\s*/, "") : "";
- }
-
-
- /**
- * Block
- */
- states.block = function(type, stream, state) {
- if ((type == "comment" && startOfLine(stream)) ||
- (type == "," && endOfLine(stream)) ||
- type == "mixin") {
- return pushContext(state, stream, "block", 0);
- }
- if (typeIsInterpolation(type, stream)) {
- return pushContext(state, stream, "interpolation");
- }
- if (endOfLine(stream) && type == "]") {
- if (!/^\s*(\.|#|:|\[|\*|&)/.test(stream.string) && !wordIsTag(firstWordOfLine(stream))) {
- return pushContext(state, stream, "block", 0);
- }
- }
- if (typeIsBlock(type, stream, state)) {
- return pushContext(state, stream, "block");
- }
- if (type == "}" && endOfLine(stream)) {
- return pushContext(state, stream, "block", 0);
- }
- if (type == "variable-name") {
- if (stream.string.match(/^\s?\$[\w-\.\[\]\'\"]+$/) || wordIsBlock(firstWordOfLine(stream))) {
- return pushContext(state, stream, "variableName");
- }
- else {
- return pushContext(state, stream, "variableName", 0);
- }
- }
- if (type == "=") {
- if (!endOfLine(stream) && !wordIsBlock(firstWordOfLine(stream))) {
- return pushContext(state, stream, "block", 0);
- }
- return pushContext(state, stream, "block");
- }
- if (type == "*") {
- if (endOfLine(stream) || stream.match(/\s*(,|\.|#|\[|:|{)/,false)) {
- override = "tag";
- return pushContext(state, stream, "block");
- }
- }
- if (typeIsPseudo(type, stream)) {
- return pushContext(state, stream, "pseudo");
- }
- if (/@(font-face|media|supports|(-moz-)?document)/.test(type)) {
- return pushContext(state, stream, endOfLine(stream) ? "block" : "atBlock");
- }
- if (/@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) {
- return pushContext(state, stream, "keyframes");
- }
- if (/@extends?/.test(type)) {
- return pushContext(state, stream, "extend", 0);
- }
- if (type && type.charAt(0) == "@") {
-
- // Property Lookup
- if (stream.indentation() > 0 && wordIsProperty(stream.current().slice(1))) {
- override = "variable-2";
- return "block";
- }
- if (/(@import|@require|@charset)/.test(type)) {
- return pushContext(state, stream, "block", 0);
- }
- return pushContext(state, stream, "block");
- }
- if (type == "reference" && endOfLine(stream)) {
- return pushContext(state, stream, "block");
- }
- if (type == "(") {
- return pushContext(state, stream, "parens");
- }
-
- if (type == "vendor-prefixes") {
- return pushContext(state, stream, "vendorPrefixes");
- }
- if (type == "word") {
- var word = stream.current();
- override = wordAsValue(word);
-
- if (override == "property") {
- if (startOfLine(stream)) {
- return pushContext(state, stream, "block", 0);
- } else {
- override = "atom";
- return "block";
- }
- }
-
- if (override == "tag") {
-
- // tag is a css value
- if (/embed|menu|pre|progress|sub|table/.test(word)) {
- if (wordIsProperty(firstWordOfLine(stream))) {
- override = "atom";
- return "block";
- }
- }
-
- // tag is an attribute
- if (stream.string.match(new RegExp("\\[\\s*" + word + "|" + word +"\\s*\\]"))) {
- override = "atom";
- return "block";
- }
-
- // tag is a variable
- if (tagVariablesRegexp.test(word)) {
- if ((startOfLine(stream) && stream.string.match(/=/)) ||
- (!startOfLine(stream) &&
- !stream.string.match(/^(\s*\.|#|\&|\[|\/|>|\*)/) &&
- !wordIsTag(firstWordOfLine(stream)))) {
- override = "variable-2";
- if (wordIsBlock(firstWordOfLine(stream))) return "block";
- return pushContext(state, stream, "block", 0);
- }
- }
-
- if (endOfLine(stream)) return pushContext(state, stream, "block");
- }
- if (override == "block-keyword") {
- override = "keyword";
-
- // Postfix conditionals
- if (stream.current(/(if|unless)/) && !startOfLine(stream)) {
- return "block";
- }
- return pushContext(state, stream, "block");
- }
- if (word == "return") return pushContext(state, stream, "block", 0);
-
- // Placeholder selector
- if (override == "variable-2" && stream.string.match(/^\s?\$[\w-\.\[\]\'\"]+$/)) {
- return pushContext(state, stream, "block");
- }
- }
- return state.context.type;
- };
-
-
- /**
- * Parens
- */
- states.parens = function(type, stream, state) {
- if (type == "(") return pushContext(state, stream, "parens");
- if (type == ")") {
- if (state.context.prev.type == "parens") {
- return popContext(state);
- }
- if ((stream.string.match(/^[a-z][\w-]*\(/i) && endOfLine(stream)) ||
- wordIsBlock(firstWordOfLine(stream)) ||
- /(\.|#|:|\[|\*|&|>|~|\+|\/)/.test(firstWordOfLine(stream)) ||
- (!stream.string.match(/^-?[a-z][\w-\.\[\]\'\"]*\s*=/) &&
- wordIsTag(firstWordOfLine(stream)))) {
- return pushContext(state, stream, "block");
- }
- if (stream.string.match(/^[\$-]?[a-z][\w-\.\[\]\'\"]*\s*=/) ||
- stream.string.match(/^\s*(\(|\)|[0-9])/) ||
- stream.string.match(/^\s+[a-z][\w-]*\(/i) ||
- stream.string.match(/^\s+[\$-]?[a-z]/i)) {
- return pushContext(state, stream, "block", 0);
- }
- if (endOfLine(stream)) return pushContext(state, stream, "block");
- else return pushContext(state, stream, "block", 0);
- }
- if (type && type.charAt(0) == "@" && wordIsProperty(stream.current().slice(1))) {
- override = "variable-2";
- }
- if (type == "word") {
- var word = stream.current();
- override = wordAsValue(word);
- if (override == "tag" && tagVariablesRegexp.test(word)) {
- override = "variable-2";
- }
- if (override == "property" || word == "to") override = "atom";
- }
- if (type == "variable-name") {
- return pushContext(state, stream, "variableName");
- }
- if (typeIsPseudo(type, stream)) {
- return pushContext(state, stream, "pseudo");
- }
- return state.context.type;
- };
-
-
- /**
- * Vendor prefixes
- */
- states.vendorPrefixes = function(type, stream, state) {
- if (type == "word") {
- override = "property";
- return pushContext(state, stream, "block", 0);
- }
- return popContext(state);
- };
-
-
- /**
- * Pseudo
- */
- states.pseudo = function(type, stream, state) {
- if (!wordIsProperty(firstWordOfLine(stream.string))) {
- stream.match(/^[a-z-]+/);
- override = "variable-3";
- if (endOfLine(stream)) return pushContext(state, stream, "block");
- return popContext(state);
- }
- return popAndPass(type, stream, state);
- };
-
-
- /**
- * atBlock
- */
- states.atBlock = function(type, stream, state) {
- if (type == "(") return pushContext(state, stream, "atBlock_parens");
- if (typeIsBlock(type, stream, state)) {
- return pushContext(state, stream, "block");
- }
- if (typeIsInterpolation(type, stream)) {
- return pushContext(state, stream, "interpolation");
- }
- if (type == "word") {
- var word = stream.current().toLowerCase();
- if (/^(only|not|and|or)$/.test(word))
- override = "keyword";
- else if (documentTypes.hasOwnProperty(word))
- override = "tag";
- else if (mediaTypes.hasOwnProperty(word))
- override = "attribute";
- else if (mediaFeatures.hasOwnProperty(word))
- override = "property";
- else if (nonStandardPropertyKeywords.hasOwnProperty(word))
- override = "string-2";
- else override = wordAsValue(stream.current());
- if (override == "tag" && endOfLine(stream)) {
- return pushContext(state, stream, "block");
- }
- }
- if (type == "operator" && /^(not|and|or)$/.test(stream.current())) {
- override = "keyword";
- }
- return state.context.type;
- };
-
- states.atBlock_parens = function(type, stream, state) {
- if (type == "{" || type == "}") return state.context.type;
- if (type == ")") {
- if (endOfLine(stream)) return pushContext(state, stream, "block");
- else return pushContext(state, stream, "atBlock");
- }
- if (type == "word") {
- var word = stream.current().toLowerCase();
- override = wordAsValue(word);
- if (/^(max|min)/.test(word)) override = "property";
- if (override == "tag") {
- tagVariablesRegexp.test(word) ? override = "variable-2" : override = "atom";
- }
- return state.context.type;
- }
- return states.atBlock(type, stream, state);
- };
-
-
- /**
- * Keyframes
- */
- states.keyframes = function(type, stream, state) {
- if (stream.indentation() == "0" && ((type == "}" && startOfLine(stream)) || type == "]" || type == "hash"
- || type == "qualifier" || wordIsTag(stream.current()))) {
- return popAndPass(type, stream, state);
- }
- if (type == "{") return pushContext(state, stream, "keyframes");
- if (type == "}") {
- if (startOfLine(stream)) return popContext(state, true);
- else return pushContext(state, stream, "keyframes");
- }
- if (type == "unit" && /^[0-9]+\%$/.test(stream.current())) {
- return pushContext(state, stream, "keyframes");
- }
- if (type == "word") {
- override = wordAsValue(stream.current());
- if (override == "block-keyword") {
- override = "keyword";
- return pushContext(state, stream, "keyframes");
- }
- }
- if (/@(font-face|media|supports|(-moz-)?document)/.test(type)) {
- return pushContext(state, stream, endOfLine(stream) ? "block" : "atBlock");
- }
- if (type == "mixin") {
- return pushContext(state, stream, "block", 0);
- }
- return state.context.type;
- };
-
-
- /**
- * Interpolation
- */
- states.interpolation = function(type, stream, state) {
- if (type == "{") popContext(state) && pushContext(state, stream, "block");
- if (type == "}") {
- if (stream.string.match(/^\s*(\.|#|:|\[|\*|&|>|~|\+|\/)/i) ||
- (stream.string.match(/^\s*[a-z]/i) && wordIsTag(firstWordOfLine(stream)))) {
- return pushContext(state, stream, "block");
- }
- if (!stream.string.match(/^(\{|\s*\&)/) ||
- stream.match(/\s*[\w-]/,false)) {
- return pushContext(state, stream, "block", 0);
- }
- return pushContext(state, stream, "block");
- }
- if (type == "variable-name") {
- return pushContext(state, stream, "variableName", 0);
- }
- if (type == "word") {
- override = wordAsValue(stream.current());
- if (override == "tag") override = "atom";
- }
- return state.context.type;
- };
-
-
- /**
- * Extend/s
- */
- states.extend = function(type, stream, state) {
- if (type == "[" || type == "=") return "extend";
- if (type == "]") return popContext(state);
- if (type == "word") {
- override = wordAsValue(stream.current());
- return "extend";
- }
- return popContext(state);
- };
-
-
- /**
- * Variable name
- */
- states.variableName = function(type, stream, state) {
- if (type == "string" || type == "[" || type == "]" || stream.current().match(/^(\.|\$)/)) {
- if (stream.current().match(/^\.[\w-]+/i)) override = "variable-2";
- return "variableName";
- }
- return popAndPass(type, stream, state);
- };
-
-
- return {
- startState: function(base) {
- return {
- tokenize: null,
- state: "block",
- context: new Context("block", base || 0, null)
- };
- },
- token: function(stream, state) {
- if (!state.tokenize && stream.eatSpace()) return null;
- style = (state.tokenize || tokenBase)(stream, state);
- if (style && typeof style == "object") {
- type = style[1];
- style = style[0];
- }
- override = style;
- state.state = states[state.state](type, stream, state);
- return override;
- },
- indent: function(state, textAfter, line) {
-
- var cx = state.context,
- ch = textAfter && textAfter.charAt(0),
- indent = cx.indent,
- lineFirstWord = firstWordOfLine(textAfter),
- lineIndent = line.length - line.replace(/^\s*/, "").length,
- prevLineFirstWord = state.context.prev ? state.context.prev.line.firstWord : "",
- prevLineIndent = state.context.prev ? state.context.prev.line.indent : lineIndent;
-
- if (cx.prev &&
- (ch == "}" && (cx.type == "block" || cx.type == "atBlock" || cx.type == "keyframes") ||
- ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") ||
- ch == "{" && (cx.type == "at"))) {
- indent = cx.indent - indentUnit;
- cx = cx.prev;
- } else if (!(/(\})/.test(ch))) {
- if (/@|\$|\d/.test(ch) ||
- /^\{/.test(textAfter) ||
-/^\s*\/(\/|\*)/.test(textAfter) ||
- /^\s*\/\*/.test(prevLineFirstWord) ||
- /^\s*[\w-\.\[\]\'\"]+\s*(\?|:|\+)?=/i.test(textAfter) ||
-/^(\+|-)?[a-z][\w-]*\(/i.test(textAfter) ||
-/^return/.test(textAfter) ||
- wordIsBlock(lineFirstWord)) {
- indent = lineIndent;
- } else if (/(\.|#|:|\[|\*|&|>|~|\+|\/)/.test(ch) || wordIsTag(lineFirstWord)) {
- if (/\,\s*$/.test(prevLineFirstWord)) {
- indent = prevLineIndent;
- } else if (/^\s+/.test(line) && (/(\.|#|:|\[|\*|&|>|~|\+|\/)/.test(prevLineFirstWord) || wordIsTag(prevLineFirstWord))) {
- indent = lineIndent <= prevLineIndent ? prevLineIndent : prevLineIndent + indentUnit;
- } else {
- indent = lineIndent;
- }
- } else if (!/,\s*$/.test(line) && (wordIsVendorPrefix(lineFirstWord) || wordIsProperty(lineFirstWord))) {
- if (wordIsBlock(prevLineFirstWord)) {
- indent = lineIndent <= prevLineIndent ? prevLineIndent : prevLineIndent + indentUnit;
- } else if (/^\{/.test(prevLineFirstWord)) {
- indent = lineIndent <= prevLineIndent ? lineIndent : prevLineIndent + indentUnit;
- } else if (wordIsVendorPrefix(prevLineFirstWord) || wordIsProperty(prevLineFirstWord)) {
- indent = lineIndent >= prevLineIndent ? prevLineIndent : lineIndent;
- } else if (/^(\.|#|:|\[|\*|&|@|\+|\-|>|~|\/)/.test(prevLineFirstWord) ||
- /=\s*$/.test(prevLineFirstWord) ||
- wordIsTag(prevLineFirstWord) ||
- /^\$[\w-\.\[\]\'\"]/.test(prevLineFirstWord)) {
- indent = prevLineIndent + indentUnit;
- } else {
- indent = lineIndent;
- }
- }
- }
- return indent;
- },
- electricChars: "}",
- lineComment: "//",
- fold: "indent"
- };
- });
-
- // developer.mozilla.org/en-US/docs/Web/HTML/Element
- var tagKeywords_ = ["a","abbr","address","area","article","aside","audio", "b", "base","bdi", "bdo","bgsound","blockquote","body","br","button","canvas","caption","cite", "code","col","colgroup","data","datalist","dd","del","details","dfn","div", "dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1", "h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe", "img","input","ins","kbd","keygen","label","legend","li","link","main","map", "mark","marquee","menu","menuitem","meta","meter","nav","nobr","noframes", "noscript","object","ol","optgroup","option","output","p","param","pre", "progress","q","rp","rt","ruby","s","samp","script","section","select", "small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track", "u","ul","var","video"];
-
- // github.com/codemirror/CodeMirror/blob/master/mode/css/css.js
- var documentTypes_ = ["domain", "regexp", "url", "url-prefix"];
- var mediaTypes_ = ["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"];
- var mediaFeatures_ = ["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"];
- var propertyKeywords_ = ["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode","font-smoothing","osx-font-smoothing"];
- var nonStandardPropertyKeywords_ = ["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"];
- var fontProperties_ = ["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"];
- var colorKeywords_ = ["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"];
- var valueKeywords_ = ["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","x-large","x-small","xor","xx-large","xx-small","bicubic","optimizespeed","grayscale","row","row-reverse","wrap","wrap-reverse","column-reverse","flex-start","flex-end","space-between","space-around"];
-
- var wordOperatorKeywords_ = ["in","and","or","not","is not","is a","is","isnt","defined","if unless"],
- blockKeywords_ = ["for","if","else","unless", "from", "to"],
- commonAtoms_ = ["null","true","false","href","title","type","not-allowed","readonly","disabled"],
- commonDef_ = ["@font-face", "@keyframes", "@media", "@viewport", "@page", "@host", "@supports", "@block", "@css"];
-
- var hintWords = tagKeywords_.concat(documentTypes_,mediaTypes_,mediaFeatures_,
- propertyKeywords_,nonStandardPropertyKeywords_,
- colorKeywords_,valueKeywords_,fontProperties_,
- wordOperatorKeywords_,blockKeywords_,
- commonAtoms_,commonDef_);
-
- function wordRegexp(words) {
- words = words.sort(function(a,b){return b > a;});
- return new RegExp("^((" + words.join(")|(") + "))\\b");
- }
-
- function keySet(array) {
- var keys = {};
- for (var i = 0; i < array.length; ++i) keys[array[i]] = true;
- return keys;
- }
-
- function escapeRegExp(text) {
- return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
- }
-
- CodeMirror.registerHelper("hintWords", "stylus", hintWords);
- CodeMirror.defineMIME("text/x-styl", "stylus");
-});
diff --git a/shared/codemirror/mode/swift/swift.js b/shared/codemirror/mode/swift/swift.js
deleted file mode 100644
index 3c28ced..0000000
--- a/shared/codemirror/mode/swift/swift.js
+++ /dev/null
@@ -1,202 +0,0 @@
-// 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 wordSet(words) {
- var set = {}
- for (var i = 0; i < words.length; i++) set[words[i]] = true
- return set
- }
-
- var keywords = wordSet(["var","let","class","deinit","enum","extension","func","import","init","protocol",
- "static","struct","subscript","typealias","as","dynamicType","is","new","super",
- "self","Self","Type","__COLUMN__","__FILE__","__FUNCTION__","__LINE__","break","case",
- "continue","default","do","else","fallthrough","if","in","for","return","switch",
- "where","while","associativity","didSet","get","infix","inout","left","mutating",
- "none","nonmutating","operator","override","postfix","precedence","prefix","right",
- "set","unowned","weak","willSet"])
- var definingKeywords = wordSet(["var","let","class","enum","extension","func","import","protocol","struct",
- "typealias","dynamicType","for"])
- var atoms = wordSet(["Infinity","NaN","undefined","null","true","false","on","off","yes","no","nil","null",
- "this","super"])
- var types = wordSet(["String","bool","int","string","double","Double","Int","Float","float","public",
- "private","extension"])
- var operators = "+-/*%=|&<>#"
- var punc = ";,.(){}[]"
- var number = /^-?(?:(?:[\d_]+\.[_\d]*|\.[_\d]+|0o[0-7_\.]+|0b[01_\.]+)(?:e-?[\d_]+)?|0x[\d_a-f\.]+(?:p-?[\d_]+)?)/i
- var identifier = /^[_A-Za-z$][_A-Za-z$0-9]*/
- var property = /^[@\.][_A-Za-z$][_A-Za-z$0-9]*/
- var regexp = /^\/(?!\s)(?:\/\/)?(?:\\.|[^\/])+\//
-
- function tokenBase(stream, state, prev) {
- if (stream.sol()) state.indented = stream.indentation()
- if (stream.eatSpace()) return null
-
- var ch = stream.peek()
- if (ch == "/") {
- if (stream.match("//")) {
- stream.skipToEnd()
- return "comment"
- }
- if (stream.match("/*")) {
- state.tokenize.push(tokenComment)
- return tokenComment(stream, state)
- }
- if (stream.match(regexp)) return "string-2"
- }
- if (operators.indexOf(ch) > -1) {
- stream.next()
- return "operator"
- }
- if (punc.indexOf(ch) > -1) {
- stream.next()
- stream.match("..")
- return "punctuation"
- }
- if (ch == '"' || ch == "'") {
- stream.next()
- var tokenize = tokenString(ch)
- state.tokenize.push(tokenize)
- return tokenize(stream, state)
- }
-
- if (stream.match(number)) return "number"
- if (stream.match(property)) return "property"
-
- if (stream.match(identifier)) {
- var ident = stream.current()
- if (keywords.hasOwnProperty(ident)) {
- if (definingKeywords.hasOwnProperty(ident))
- state.prev = "define"
- return "keyword"
- }
- if (types.hasOwnProperty(ident)) return "variable-2"
- if (atoms.hasOwnProperty(ident)) return "atom"
- if (prev == "define") return "def"
- return "variable"
- }
-
- stream.next()
- return null
- }
-
- function tokenUntilClosingParen() {
- var depth = 0
- return function(stream, state, prev) {
- var inner = tokenBase(stream, state, prev)
- if (inner == "punctuation") {
- if (stream.current() == "(") ++depth
- else if (stream.current() == ")") {
- if (depth == 0) {
- stream.backUp(1)
- state.tokenize.pop()
- return state.tokenize[state.tokenize.length - 1](stream, state)
- }
- else --depth
- }
- }
- return inner
- }
- }
-
- function tokenString(quote) {
- return function(stream, state) {
- var ch, escaped = false
- while (ch = stream.next()) {
- if (escaped) {
- if (ch == "(") {
- state.tokenize.push(tokenUntilClosingParen())
- return "string"
- }
- escaped = false
- } else if (ch == quote) {
- break
- } else {
- escaped = ch == "\\"
- }
- }
- state.tokenize.pop()
- return "string"
- }
- }
-
- function tokenComment(stream, state) {
- stream.match(/^(?:[^*]|\*(?!\/))*/)
- if (stream.match("*/")) state.tokenize.pop()
- return "comment"
- }
-
- function Context(prev, align, indented) {
- this.prev = prev
- this.align = align
- this.indented = indented
- }
-
- function pushContext(state, stream) {
- var align = stream.match(/^\s*($|\/[\/\*])/, false) ? null : stream.column() + 1
- state.context = new Context(state.context, align, state.indented)
- }
-
- function popContext(state) {
- if (state.context) {
- state.indented = state.context.indented
- state.context = state.context.prev
- }
- }
-
- CodeMirror.defineMode("swift", function(config) {
- return {
- startState: function() {
- return {
- prev: null,
- context: null,
- indented: 0,
- tokenize: []
- }
- },
-
- token: function(stream, state) {
- var prev = state.prev
- state.prev = null
- var tokenize = state.tokenize[state.tokenize.length - 1] || tokenBase
- var style = tokenize(stream, state, prev)
- if (!style || style == "comment") state.prev = prev
- else if (!state.prev) state.prev = style
-
- if (style == "punctuation") {
- var bracket = /[\(\[\{]|([\]\)\}])/.exec(stream.current())
- if (bracket) (bracket[1] ? popContext : pushContext)(state, stream)
- }
-
- return style
- },
-
- indent: function(state, textAfter) {
- var cx = state.context
- if (!cx) return 0
- var closing = /^[\]\}\)]/.test(textAfter)
- if (cx.align != null) return cx.align - (closing ? 1 : 0)
- return cx.indented + (closing ? 0 : config.indentUnit)
- },
-
- electricInput: /^\s*[\)\}\]]$/,
-
- lineComment: "//",
- blockCommentStart: "/*",
- blockCommentEnd: "*/"
- }
- })
-
- CodeMirror.defineMIME("text/x-swift","swift")
-});
diff --git a/shared/codemirror/mode/tcl/tcl.js b/shared/codemirror/mode/tcl/tcl.js
deleted file mode 100644
index 8c76d52..0000000
--- a/shared/codemirror/mode/tcl/tcl.js
+++ /dev/null
@@ -1,139 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-//tcl mode by Ford_Lawnmower :: Based on Velocity mode by Steve O'Hara
-
-(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("tcl", function() {
- function parseWords(str) {
- var obj = {}, words = str.split(" ");
- for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
- return obj;
- }
- var keywords = parseWords("Tcl safe after append array auto_execok auto_import auto_load " +
- "auto_mkindex auto_mkindex_old auto_qualify auto_reset bgerror " +
- "binary break catch cd close concat continue dde eof encoding error " +
- "eval exec exit expr fblocked fconfigure fcopy file fileevent filename " +
- "filename flush for foreach format gets glob global history http if " +
- "incr info interp join lappend lindex linsert list llength load lrange " +
- "lreplace lsearch lset lsort memory msgcat namespace open package parray " +
- "pid pkg::create pkg_mkIndex proc puts pwd re_syntax read regex regexp " +
- "registry regsub rename resource return scan seek set socket source split " +
- "string subst switch tcl_endOfWord tcl_findLibrary tcl_startOfNextWord " +
- "tcl_wordBreakAfter tcl_startOfPreviousWord tcl_wordBreakBefore tcltest " +
- "tclvars tell time trace unknown unset update uplevel upvar variable " +
- "vwait");
- var functions = parseWords("if elseif else and not or eq ne in ni for foreach while switch");
- var isOperatorChar = /[+\-*&%=<>!?^\/\|]/;
- function chain(stream, state, f) {
- state.tokenize = f;
- return f(stream, state);
- }
- function tokenBase(stream, state) {
- var beforeParams = state.beforeParams;
- state.beforeParams = false;
- var ch = stream.next();
- if ((ch == '"' || ch == "'") && state.inParams) {
- return chain(stream, state, tokenString(ch));
- } else if (/[\[\]{}\(\),;\.]/.test(ch)) {
- if (ch == "(" && beforeParams) state.inParams = true;
- else if (ch == ")") state.inParams = false;
- return null;
- } else if (/\d/.test(ch)) {
- stream.eatWhile(/[\w\.]/);
- return "number";
- } else if (ch == "#") {
- if (stream.eat("*"))
- return chain(stream, state, tokenComment);
- if (ch == "#" && stream.match(/ *\[ *\[/))
- return chain(stream, state, tokenUnparsed);
- stream.skipToEnd();
- return "comment";
- } else if (ch == '"') {
- stream.skipTo(/"/);
- return "comment";
- } else if (ch == "$") {
- stream.eatWhile(/[$_a-z0-9A-Z\.{:]/);
- stream.eatWhile(/}/);
- state.beforeParams = true;
- return "builtin";
- } else if (isOperatorChar.test(ch)) {
- stream.eatWhile(isOperatorChar);
- return "comment";
- } else {
- stream.eatWhile(/[\w\$_{}\xa1-\uffff]/);
- var word = stream.current().toLowerCase();
- if (keywords && keywords.propertyIsEnumerable(word))
- return "keyword";
- if (functions && functions.propertyIsEnumerable(word)) {
- state.beforeParams = true;
- return "keyword";
- }
- return null;
- }
- }
- function tokenString(quote) {
- return function(stream, state) {
- var escaped = false, next, end = false;
- while ((next = stream.next()) != null) {
- if (next == quote && !escaped) {
- end = true;
- break;
- }
- escaped = !escaped && next == "\\";
- }
- if (end) state.tokenize = tokenBase;
- return "string";
- };
- }
- function tokenComment(stream, state) {
- var maybeEnd = false, ch;
- while (ch = stream.next()) {
- if (ch == "#" && maybeEnd) {
- state.tokenize = tokenBase;
- break;
- }
- maybeEnd = (ch == "*");
- }
- return "comment";
- }
- function tokenUnparsed(stream, state) {
- var maybeEnd = 0, ch;
- while (ch = stream.next()) {
- if (ch == "#" && maybeEnd == 2) {
- state.tokenize = tokenBase;
- break;
- }
- if (ch == "]")
- maybeEnd++;
- else if (ch != " ")
- maybeEnd = 0;
- }
- return "meta";
- }
- return {
- startState: function() {
- return {
- tokenize: tokenBase,
- beforeParams: false,
- inParams: false
- };
- },
- token: function(stream, state) {
- if (stream.eatSpace()) return null;
- return state.tokenize(stream, state);
- }
- };
-});
-CodeMirror.defineMIME("text/x-tcl", "tcl");
-
-});
diff --git a/shared/codemirror/mode/textile/textile.js b/shared/codemirror/mode/textile/textile.js
deleted file mode 100644
index a6f7576..0000000
--- a/shared/codemirror/mode/textile/textile.js
+++ /dev/null
@@ -1,469 +0,0 @@
-// 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";
-
- var TOKEN_STYLES = {
- addition: "positive",
- attributes: "attribute",
- bold: "strong",
- cite: "keyword",
- code: "atom",
- definitionList: "number",
- deletion: "negative",
- div: "punctuation",
- em: "em",
- footnote: "variable",
- footCite: "qualifier",
- header: "header",
- html: "comment",
- image: "string",
- italic: "em",
- link: "link",
- linkDefinition: "link",
- list1: "variable-2",
- list2: "variable-3",
- list3: "keyword",
- notextile: "string-2",
- pre: "operator",
- p: "property",
- quote: "bracket",
- span: "quote",
- specialChar: "tag",
- strong: "strong",
- sub: "builtin",
- sup: "builtin",
- table: "variable-3",
- tableHeading: "operator"
- };
-
- function startNewLine(stream, state) {
- state.mode = Modes.newLayout;
- state.tableHeading = false;
-
- if (state.layoutType === "definitionList" && state.spanningLayout &&
- stream.match(RE("definitionListEnd"), false))
- state.spanningLayout = false;
- }
-
- function handlePhraseModifier(stream, state, ch) {
- if (ch === "_") {
- if (stream.eat("_"))
- return togglePhraseModifier(stream, state, "italic", /__/, 2);
- else
- return togglePhraseModifier(stream, state, "em", /_/, 1);
- }
-
- if (ch === "*") {
- if (stream.eat("*")) {
- return togglePhraseModifier(stream, state, "bold", /\*\*/, 2);
- }
- return togglePhraseModifier(stream, state, "strong", /\*/, 1);
- }
-
- if (ch === "[") {
- if (stream.match(/\d+\]/)) state.footCite = true;
- return tokenStyles(state);
- }
-
- if (ch === "(") {
- var spec = stream.match(/^(r|tm|c)\)/);
- if (spec)
- return tokenStylesWith(state, TOKEN_STYLES.specialChar);
- }
-
- if (ch === "<" && stream.match(/(\w+)[^>]+>[^<]+<\/\1>/))
- return tokenStylesWith(state, TOKEN_STYLES.html);
-
- if (ch === "?" && stream.eat("?"))
- return togglePhraseModifier(stream, state, "cite", /\?\?/, 2);
-
- if (ch === "=" && stream.eat("="))
- return togglePhraseModifier(stream, state, "notextile", /==/, 2);
-
- if (ch === "-" && !stream.eat("-"))
- return togglePhraseModifier(stream, state, "deletion", /-/, 1);
-
- if (ch === "+")
- return togglePhraseModifier(stream, state, "addition", /\+/, 1);
-
- if (ch === "~")
- return togglePhraseModifier(stream, state, "sub", /~/, 1);
-
- if (ch === "^")
- return togglePhraseModifier(stream, state, "sup", /\^/, 1);
-
- if (ch === "%")
- return togglePhraseModifier(stream, state, "span", /%/, 1);
-
- if (ch === "@")
- return togglePhraseModifier(stream, state, "code", /@/, 1);
-
- if (ch === "!") {
- var type = togglePhraseModifier(stream, state, "image", /(?:\([^\)]+\))?!/, 1);
- stream.match(/^:\S+/); // optional Url portion
- return type;
- }
- return tokenStyles(state);
- }
-
- function togglePhraseModifier(stream, state, phraseModifier, closeRE, openSize) {
- var charBefore = stream.pos > openSize ? stream.string.charAt(stream.pos - openSize - 1) : null;
- var charAfter = stream.peek();
- if (state[phraseModifier]) {
- if ((!charAfter || /\W/.test(charAfter)) && charBefore && /\S/.test(charBefore)) {
- var type = tokenStyles(state);
- state[phraseModifier] = false;
- return type;
- }
- } else if ((!charBefore || /\W/.test(charBefore)) && charAfter && /\S/.test(charAfter) &&
- stream.match(new RegExp("^.*\\S" + closeRE.source + "(?:\\W|$)"), false)) {
- state[phraseModifier] = true;
- state.mode = Modes.attributes;
- }
- return tokenStyles(state);
- };
-
- function tokenStyles(state) {
- var disabled = textileDisabled(state);
- if (disabled) return disabled;
-
- var styles = [];
- if (state.layoutType) styles.push(TOKEN_STYLES[state.layoutType]);
-
- styles = styles.concat(activeStyles(
- state, "addition", "bold", "cite", "code", "deletion", "em", "footCite",
- "image", "italic", "link", "span", "strong", "sub", "sup", "table", "tableHeading"));
-
- if (state.layoutType === "header")
- styles.push(TOKEN_STYLES.header + "-" + state.header);
-
- return styles.length ? styles.join(" ") : null;
- }
-
- function textileDisabled(state) {
- var type = state.layoutType;
-
- switch(type) {
- case "notextile":
- case "code":
- case "pre":
- return TOKEN_STYLES[type];
- default:
- if (state.notextile)
- return TOKEN_STYLES.notextile + (type ? (" " + TOKEN_STYLES[type]) : "");
- return null;
- }
- }
-
- function tokenStylesWith(state, extraStyles) {
- var disabled = textileDisabled(state);
- if (disabled) return disabled;
-
- var type = tokenStyles(state);
- if (extraStyles)
- return type ? (type + " " + extraStyles) : extraStyles;
- else
- return type;
- }
-
- function activeStyles(state) {
- var styles = [];
- for (var i = 1; i < arguments.length; ++i) {
- if (state[arguments[i]])
- styles.push(TOKEN_STYLES[arguments[i]]);
- }
- return styles;
- }
-
- function blankLine(state) {
- var spanningLayout = state.spanningLayout, type = state.layoutType;
-
- for (var key in state) if (state.hasOwnProperty(key))
- delete state[key];
-
- state.mode = Modes.newLayout;
- if (spanningLayout) {
- state.layoutType = type;
- state.spanningLayout = true;
- }
- }
-
- var REs = {
- cache: {},
- single: {
- bc: "bc",
- bq: "bq",
- definitionList: /- [^(?::=)]+:=+/,
- definitionListEnd: /.*=:\s*$/,
- div: "div",
- drawTable: /\|.*\|/,
- foot: /fn\d+/,
- header: /h[1-6]/,
- html: /\s*<(?:\/)?(\w+)(?:[^>]+)?>(?:[^<]+<\/\1>)?/,
- link: /[^"]+":\S/,
- linkDefinition: /\[[^\s\]]+\]\S+/,
- list: /(?:#+|\*+)/,
- notextile: "notextile",
- para: "p",
- pre: "pre",
- table: "table",
- tableCellAttributes: /[\/\\]\d+/,
- tableHeading: /\|_\./,
- tableText: /[^"_\*\[\(\?\+~\^%@|-]+/,
- text: /[^!"_=\*\[\(<\?\+~\^%@-]+/
- },
- attributes: {
- align: /(?:<>|<|>|=)/,
- selector: /\([^\(][^\)]+\)/,
- lang: /\[[^\[\]]+\]/,
- pad: /(?:\(+|\)+){1,2}/,
- css: /\{[^\}]+\}/
- },
- createRe: function(name) {
- switch (name) {
- case "drawTable":
- return REs.makeRe("^", REs.single.drawTable, "$");
- case "html":
- return REs.makeRe("^", REs.single.html, "(?:", REs.single.html, ")*", "$");
- case "linkDefinition":
- return REs.makeRe("^", REs.single.linkDefinition, "$");
- case "listLayout":
- return REs.makeRe("^", REs.single.list, RE("allAttributes"), "*\\s+");
- case "tableCellAttributes":
- return REs.makeRe("^", REs.choiceRe(REs.single.tableCellAttributes,
- RE("allAttributes")), "+\\.");
- case "type":
- return REs.makeRe("^", RE("allTypes"));
- case "typeLayout":
- return REs.makeRe("^", RE("allTypes"), RE("allAttributes"),
- "*\\.\\.?", "(\\s+|$)");
- case "attributes":
- return REs.makeRe("^", RE("allAttributes"), "+");
-
- case "allTypes":
- return REs.choiceRe(REs.single.div, REs.single.foot,
- REs.single.header, REs.single.bc, REs.single.bq,
- REs.single.notextile, REs.single.pre, REs.single.table,
- REs.single.para);
-
- case "allAttributes":
- return REs.choiceRe(REs.attributes.selector, REs.attributes.css,
- REs.attributes.lang, REs.attributes.align, REs.attributes.pad);
-
- default:
- return REs.makeRe("^", REs.single[name]);
- }
- },
- makeRe: function() {
- var pattern = "";
- for (var i = 0; i < arguments.length; ++i) {
- var arg = arguments[i];
- pattern += (typeof arg === "string") ? arg : arg.source;
- }
- return new RegExp(pattern);
- },
- choiceRe: function() {
- var parts = [arguments[0]];
- for (var i = 1; i < arguments.length; ++i) {
- parts[i * 2 - 1] = "|";
- parts[i * 2] = arguments[i];
- }
-
- parts.unshift("(?:");
- parts.push(")");
- return REs.makeRe.apply(null, parts);
- }
- };
-
- function RE(name) {
- return (REs.cache[name] || (REs.cache[name] = REs.createRe(name)));
- }
-
- var Modes = {
- newLayout: function(stream, state) {
- if (stream.match(RE("typeLayout"), false)) {
- state.spanningLayout = false;
- return (state.mode = Modes.blockType)(stream, state);
- }
- var newMode;
- if (!textileDisabled(state)) {
- if (stream.match(RE("listLayout"), false))
- newMode = Modes.list;
- else if (stream.match(RE("drawTable"), false))
- newMode = Modes.table;
- else if (stream.match(RE("linkDefinition"), false))
- newMode = Modes.linkDefinition;
- else if (stream.match(RE("definitionList")))
- newMode = Modes.definitionList;
- else if (stream.match(RE("html"), false))
- newMode = Modes.html;
- }
- return (state.mode = (newMode || Modes.text))(stream, state);
- },
-
- blockType: function(stream, state) {
- var match, type;
- state.layoutType = null;
-
- if (match = stream.match(RE("type")))
- type = match[0];
- else
- return (state.mode = Modes.text)(stream, state);
-
- if (match = type.match(RE("header"))) {
- state.layoutType = "header";
- state.header = parseInt(match[0][1]);
- } else if (type.match(RE("bq"))) {
- state.layoutType = "quote";
- } else if (type.match(RE("bc"))) {
- state.layoutType = "code";
- } else if (type.match(RE("foot"))) {
- state.layoutType = "footnote";
- } else if (type.match(RE("notextile"))) {
- state.layoutType = "notextile";
- } else if (type.match(RE("pre"))) {
- state.layoutType = "pre";
- } else if (type.match(RE("div"))) {
- state.layoutType = "div";
- } else if (type.match(RE("table"))) {
- state.layoutType = "table";
- }
-
- state.mode = Modes.attributes;
- return tokenStyles(state);
- },
-
- text: function(stream, state) {
- if (stream.match(RE("text"))) return tokenStyles(state);
-
- var ch = stream.next();
- if (ch === '"')
- return (state.mode = Modes.link)(stream, state);
- return handlePhraseModifier(stream, state, ch);
- },
-
- attributes: function(stream, state) {
- state.mode = Modes.layoutLength;
-
- if (stream.match(RE("attributes")))
- return tokenStylesWith(state, TOKEN_STYLES.attributes);
- else
- return tokenStyles(state);
- },
-
- layoutLength: function(stream, state) {
- if (stream.eat(".") && stream.eat("."))
- state.spanningLayout = true;
-
- state.mode = Modes.text;
- return tokenStyles(state);
- },
-
- list: function(stream, state) {
- var match = stream.match(RE("list"));
- state.listDepth = match[0].length;
- var listMod = (state.listDepth - 1) % 3;
- if (!listMod)
- state.layoutType = "list1";
- else if (listMod === 1)
- state.layoutType = "list2";
- else
- state.layoutType = "list3";
-
- state.mode = Modes.attributes;
- return tokenStyles(state);
- },
-
- link: function(stream, state) {
- state.mode = Modes.text;
- if (stream.match(RE("link"))) {
- stream.match(/\S+/);
- return tokenStylesWith(state, TOKEN_STYLES.link);
- }
- return tokenStyles(state);
- },
-
- linkDefinition: function(stream, state) {
- stream.skipToEnd();
- return tokenStylesWith(state, TOKEN_STYLES.linkDefinition);
- },
-
- definitionList: function(stream, state) {
- stream.match(RE("definitionList"));
-
- state.layoutType = "definitionList";
-
- if (stream.match(/\s*$/))
- state.spanningLayout = true;
- else
- state.mode = Modes.attributes;
-
- return tokenStyles(state);
- },
-
- html: function(stream, state) {
- stream.skipToEnd();
- return tokenStylesWith(state, TOKEN_STYLES.html);
- },
-
- table: function(stream, state) {
- state.layoutType = "table";
- return (state.mode = Modes.tableCell)(stream, state);
- },
-
- tableCell: function(stream, state) {
- if (stream.match(RE("tableHeading")))
- state.tableHeading = true;
- else
- stream.eat("|");
-
- state.mode = Modes.tableCellAttributes;
- return tokenStyles(state);
- },
-
- tableCellAttributes: function(stream, state) {
- state.mode = Modes.tableText;
-
- if (stream.match(RE("tableCellAttributes")))
- return tokenStylesWith(state, TOKEN_STYLES.attributes);
- else
- return tokenStyles(state);
- },
-
- tableText: function(stream, state) {
- if (stream.match(RE("tableText")))
- return tokenStyles(state);
-
- if (stream.peek() === "|") { // end of cell
- state.mode = Modes.tableCell;
- return tokenStyles(state);
- }
- return handlePhraseModifier(stream, state, stream.next());
- }
- };
-
- CodeMirror.defineMode("textile", function() {
- return {
- startState: function() {
- return { mode: Modes.newLayout };
- },
- token: function(stream, state) {
- if (stream.sol()) startNewLine(stream, state);
- return state.mode(stream, state);
- },
- blankLine: blankLine
- };
- });
-
- CodeMirror.defineMIME("text/x-textile", "textile");
-});
diff --git a/shared/codemirror/mode/tiddlywiki/tiddlywiki.css b/shared/codemirror/mode/tiddlywiki/tiddlywiki.css
deleted file mode 100644
index 9a69b63..0000000
--- a/shared/codemirror/mode/tiddlywiki/tiddlywiki.css
+++ /dev/null
@@ -1,14 +0,0 @@
-span.cm-underlined {
- text-decoration: underline;
-}
-span.cm-strikethrough {
- text-decoration: line-through;
-}
-span.cm-brace {
- color: #170;
- font-weight: bold;
-}
-span.cm-table {
- color: blue;
- font-weight: bold;
-}
diff --git a/shared/codemirror/mode/tiddlywiki/tiddlywiki.js b/shared/codemirror/mode/tiddlywiki/tiddlywiki.js
deleted file mode 100644
index 1a3b3bc..0000000
--- a/shared/codemirror/mode/tiddlywiki/tiddlywiki.js
+++ /dev/null
@@ -1,308 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-/***
- |''Name''|tiddlywiki.js|
- |''Description''|Enables TiddlyWikiy syntax highlighting using CodeMirror|
- |''Author''|PMario|
- |''Version''|0.1.7|
- |''Status''|''stable''|
- |''Source''|[[GitHub|https://github.com/pmario/CodeMirror2/blob/tw-syntax/mode/tiddlywiki]]|
- |''Documentation''|http://codemirror.tiddlyspace.com/|
- |''License''|[[MIT License|http://www.opensource.org/licenses/mit-license.php]]|
- |''CoreVersion''|2.5.0|
- |''Requires''|codemirror.js|
- |''Keywords''|syntax highlighting color code mirror codemirror|
- ! Info
- CoreVersion parameter is needed for TiddlyWiki only!
-***/
-
-(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("tiddlywiki", function () {
- // Tokenizer
- var textwords = {};
-
- var keywords = {
- "allTags": true, "closeAll": true, "list": true,
- "newJournal": true, "newTiddler": true,
- "permaview": true, "saveChanges": true,
- "search": true, "slider": true, "tabs": true,
- "tag": true, "tagging": true, "tags": true,
- "tiddler": true, "timeline": true,
- "today": true, "version": true, "option": true,
- "with": true, "filter": true
- };
-
- var isSpaceName = /[\w_\-]/i,
- reHR = /^\-\-\-\-+$/, //
- reWikiCommentStart = /^\/\*\*\*$/, // /***
- reWikiCommentStop = /^\*\*\*\/$/, // ***/
- reBlockQuote = /^<<<$/,
-
- reJsCodeStart = /^\/\/\{\{\{$/, // //{{{ js block start
- reJsCodeStop = /^\/\/\}\}\}$/, // //}}} js stop
- reXmlCodeStart = /^$/, // xml block start
- reXmlCodeStop = /^$/, // xml stop
-
- reCodeBlockStart = /^\{\{\{$/, // {{{ TW text div block start
- reCodeBlockStop = /^\}\}\}$/, // }}} TW text stop
-
- reUntilCodeStop = /.*?\}\}\}/;
-
- function chain(stream, state, f) {
- state.tokenize = f;
- return f(stream, state);
- }
-
- function tokenBase(stream, state) {
- var sol = stream.sol(), ch = stream.peek();
-
- state.block = false; // indicates the start of a code block.
-
- // check start of blocks
- if (sol && /[<\/\*{}\-]/.test(ch)) {
- if (stream.match(reCodeBlockStart)) {
- state.block = true;
- return chain(stream, state, twTokenCode);
- }
- if (stream.match(reBlockQuote))
- return 'quote';
- if (stream.match(reWikiCommentStart) || stream.match(reWikiCommentStop))
- return 'comment';
- if (stream.match(reJsCodeStart) || stream.match(reJsCodeStop) || stream.match(reXmlCodeStart) || stream.match(reXmlCodeStop))
- return 'comment';
- if (stream.match(reHR))
- return 'hr';
- }
-
- stream.next();
- if (sol && /[\/\*!#;:>|]/.test(ch)) {
- if (ch == "!") { // tw header
- stream.skipToEnd();
- return "header";
- }
- if (ch == "*") { // tw list
- stream.eatWhile('*');
- return "comment";
- }
- if (ch == "#") { // tw numbered list
- stream.eatWhile('#');
- return "comment";
- }
- if (ch == ";") { // definition list, term
- stream.eatWhile(';');
- return "comment";
- }
- if (ch == ":") { // definition list, description
- stream.eatWhile(':');
- return "comment";
- }
- if (ch == ">") { // single line quote
- stream.eatWhile(">");
- return "quote";
- }
- if (ch == '|')
- return 'header';
- }
-
- if (ch == '{' && stream.match(/\{\{/))
- return chain(stream, state, twTokenCode);
-
- // rudimentary html:// file:// link matching. TW knows much more ...
- if (/[hf]/i.test(ch) &&
- /[ti]/i.test(stream.peek()) &&
- stream.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i))
- return "link";
-
- // just a little string indicator, don't want to have the whole string covered
- if (ch == '"')
- return 'string';
-
- if (ch == '~') // _no_ CamelCase indicator should be bold
- return 'brace';
-
- if (/[\[\]]/.test(ch) && stream.match(ch)) // check for [[..]]
- return 'brace';
-
- if (ch == "@") { // check for space link. TODO fix @@...@@ highlighting
- stream.eatWhile(isSpaceName);
- return "link";
- }
-
- if (/\d/.test(ch)) { // numbers
- stream.eatWhile(/\d/);
- return "number";
- }
-
- if (ch == "/") { // tw invisible comment
- if (stream.eat("%")) {
- return chain(stream, state, twTokenComment);
- } else if (stream.eat("/")) { //
- return chain(stream, state, twTokenEm);
- }
- }
-
- if (ch == "_" && stream.eat("_")) // tw underline
- return chain(stream, state, twTokenUnderline);
-
- // strikethrough and mdash handling
- if (ch == "-" && stream.eat("-")) {
- // if strikethrough looks ugly, change CSS.
- if (stream.peek() != ' ')
- return chain(stream, state, twTokenStrike);
- // mdash
- if (stream.peek() == ' ')
- return 'brace';
- }
-
- if (ch == "'" && stream.eat("'")) // tw bold
- return chain(stream, state, twTokenStrong);
-
- if (ch == "<" && stream.eat("<")) // tw macro
- return chain(stream, state, twTokenMacro);
-
- // core macro handling
- stream.eatWhile(/[\w\$_]/);
- return textwords.propertyIsEnumerable(stream.current()) ? "keyword" : null
- }
-
- // tw invisible comment
- function twTokenComment(stream, state) {
- var maybeEnd = false, ch;
- while (ch = stream.next()) {
- if (ch == "/" && maybeEnd) {
- state.tokenize = tokenBase;
- break;
- }
- maybeEnd = (ch == "%");
- }
- return "comment";
- }
-
- // tw strong / bold
- function twTokenStrong(stream, state) {
- var maybeEnd = false,
- ch;
- while (ch = stream.next()) {
- if (ch == "'" && maybeEnd) {
- state.tokenize = tokenBase;
- break;
- }
- maybeEnd = (ch == "'");
- }
- return "strong";
- }
-
- // tw code
- function twTokenCode(stream, state) {
- var sb = state.block;
-
- if (sb && stream.current()) {
- return "comment";
- }
-
- if (!sb && stream.match(reUntilCodeStop)) {
- state.tokenize = tokenBase;
- return "comment";
- }
-
- if (sb && stream.sol() && stream.match(reCodeBlockStop)) {
- state.tokenize = tokenBase;
- return "comment";
- }
-
- stream.next();
- return "comment";
- }
-
- // tw em / italic
- function twTokenEm(stream, state) {
- var maybeEnd = false,
- ch;
- while (ch = stream.next()) {
- if (ch == "/" && maybeEnd) {
- state.tokenize = tokenBase;
- break;
- }
- maybeEnd = (ch == "/");
- }
- return "em";
- }
-
- // tw underlined text
- function twTokenUnderline(stream, state) {
- var maybeEnd = false,
- ch;
- while (ch = stream.next()) {
- if (ch == "_" && maybeEnd) {
- state.tokenize = tokenBase;
- break;
- }
- maybeEnd = (ch == "_");
- }
- return "underlined";
- }
-
- // tw strike through text looks ugly
- // change CSS if needed
- function twTokenStrike(stream, state) {
- var maybeEnd = false, ch;
-
- while (ch = stream.next()) {
- if (ch == "-" && maybeEnd) {
- state.tokenize = tokenBase;
- break;
- }
- maybeEnd = (ch == "-");
- }
- return "strikethrough";
- }
-
- // macro
- function twTokenMacro(stream, state) {
- if (stream.current() == '<<') {
- return 'macro';
- }
-
- var ch = stream.next();
- if (!ch) {
- state.tokenize = tokenBase;
- return null;
- }
- if (ch == ">") {
- if (stream.peek() == '>') {
- stream.next();
- state.tokenize = tokenBase;
- return "macro";
- }
- }
-
- stream.eatWhile(/[\w\$_]/);
- return keywords.propertyIsEnumerable(stream.current()) ? "keyword" : null
- }
-
- // Interface
- return {
- startState: function () {
- return {tokenize: tokenBase};
- },
-
- token: function (stream, state) {
- if (stream.eatSpace()) return null;
- var style = state.tokenize(stream, state);
- return style;
- }
- };
-});
-
-CodeMirror.defineMIME("text/x-tiddlywiki", "tiddlywiki");
-});
diff --git a/shared/codemirror/mode/tiki/tiki.css b/shared/codemirror/mode/tiki/tiki.css
deleted file mode 100644
index 1d8704c..0000000
--- a/shared/codemirror/mode/tiki/tiki.css
+++ /dev/null
@@ -1,26 +0,0 @@
-.cm-tw-syntaxerror {
- color: #FFF;
- background-color: #900;
-}
-
-.cm-tw-deleted {
- text-decoration: line-through;
-}
-
-.cm-tw-header5 {
- font-weight: bold;
-}
-.cm-tw-listitem:first-child { /*Added first child to fix duplicate padding when highlighting*/
- padding-left: 10px;
-}
-
-.cm-tw-box {
- border-top-width: 0px !important;
- border-style: solid;
- border-width: 1px;
- border-color: inherit;
-}
-
-.cm-tw-underline {
- text-decoration: underline;
-}
\ No newline at end of file
diff --git a/shared/codemirror/mode/tiki/tiki.js b/shared/codemirror/mode/tiki/tiki.js
deleted file mode 100644
index 5e05b1f..0000000
--- a/shared/codemirror/mode/tiki/tiki.js
+++ /dev/null
@@ -1,312 +0,0 @@
-// 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('tiki', function(config) {
- function inBlock(style, terminator, returnTokenizer) {
- return function(stream, state) {
- while (!stream.eol()) {
- if (stream.match(terminator)) {
- state.tokenize = inText;
- break;
- }
- stream.next();
- }
-
- if (returnTokenizer) state.tokenize = returnTokenizer;
-
- return style;
- };
- }
-
- function inLine(style) {
- return function(stream, state) {
- while(!stream.eol()) {
- stream.next();
- }
- state.tokenize = inText;
- return style;
- };
- }
-
- function inText(stream, state) {
- function chain(parser) {
- state.tokenize = parser;
- return parser(stream, state);
- }
-
- var sol = stream.sol();
- var ch = stream.next();
-
- //non start of line
- switch (ch) { //switch is generally much faster than if, so it is used here
- case "{": //plugin
- stream.eat("/");
- stream.eatSpace();
- stream.eatWhile(/[^\s\u00a0=\"\'\/?(}]/);
- state.tokenize = inPlugin;
- return "tag";
- case "_": //bold
- if (stream.eat("_"))
- return chain(inBlock("strong", "__", inText));
- break;
- case "'": //italics
- if (stream.eat("'"))
- return chain(inBlock("em", "''", inText));
- break;
- case "(":// Wiki Link
- if (stream.eat("("))
- return chain(inBlock("variable-2", "))", inText));
- break;
- case "[":// Weblink
- return chain(inBlock("variable-3", "]", inText));
- break;
- case "|": //table
- if (stream.eat("|"))
- return chain(inBlock("comment", "||"));
- break;
- case "-":
- if (stream.eat("=")) {//titleBar
- return chain(inBlock("header string", "=-", inText));
- } else if (stream.eat("-")) {//deleted
- return chain(inBlock("error tw-deleted", "--", inText));
- }
- break;
- case "=": //underline
- if (stream.match("=="))
- return chain(inBlock("tw-underline", "===", inText));
- break;
- case ":":
- if (stream.eat(":"))
- return chain(inBlock("comment", "::"));
- break;
- case "^": //box
- return chain(inBlock("tw-box", "^"));
- break;
- case "~": //np
- if (stream.match("np~"))
- return chain(inBlock("meta", "~/np~"));
- break;
- }
-
- //start of line types
- if (sol) {
- switch (ch) {
- case "!": //header at start of line
- if (stream.match('!!!!!')) {
- return chain(inLine("header string"));
- } else if (stream.match('!!!!')) {
- return chain(inLine("header string"));
- } else if (stream.match('!!!')) {
- return chain(inLine("header string"));
- } else if (stream.match('!!')) {
- return chain(inLine("header string"));
- } else {
- return chain(inLine("header string"));
- }
- break;
- case "*": //unordered list line item, or at start of line
- case "#": //ordered list line item, or at start of line
- case "+": //ordered list line item, or at start of line
- return chain(inLine("tw-listitem bracket"));
- break;
- }
- }
-
- //stream.eatWhile(/[&{]/); was eating up plugins, turned off to act less like html and more like tiki
- return null;
- }
-
- var indentUnit = config.indentUnit;
-
- // Return variables for tokenizers
- var pluginName, type;
- function inPlugin(stream, state) {
- var ch = stream.next();
- var peek = stream.peek();
-
- if (ch == "}") {
- state.tokenize = inText;
- //type = ch == ")" ? "endPlugin" : "selfclosePlugin"; inPlugin
- return "tag";
- } else if (ch == "(" || ch == ")") {
- return "bracket";
- } else if (ch == "=") {
- type = "equals";
-
- if (peek == ">") {
- ch = stream.next();
- peek = stream.peek();
- }
-
- //here we detect values directly after equal character with no quotes
- if (!/[\'\"]/.test(peek)) {
- state.tokenize = inAttributeNoQuote();
- }
- //end detect values
-
- return "operator";
- } else if (/[\'\"]/.test(ch)) {
- state.tokenize = inAttribute(ch);
- return state.tokenize(stream, state);
- } else {
- stream.eatWhile(/[^\s\u00a0=\"\'\/?]/);
- return "keyword";
- }
- }
-
- function inAttribute(quote) {
- return function(stream, state) {
- while (!stream.eol()) {
- if (stream.next() == quote) {
- state.tokenize = inPlugin;
- break;
- }
- }
- return "string";
- };
- }
-
- function inAttributeNoQuote() {
- return function(stream, state) {
- while (!stream.eol()) {
- var ch = stream.next();
- var peek = stream.peek();
- if (ch == " " || ch == "," || /[ )}]/.test(peek)) {
- state.tokenize = inPlugin;
- break;
- }
- }
- return "string";
-};
- }
-
-var curState, setStyle;
-function pass() {
- for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]);
-}
-
-function cont() {
- pass.apply(null, arguments);
- return true;
-}
-
-function pushContext(pluginName, startOfLine) {
- var noIndent = curState.context && curState.context.noIndent;
- curState.context = {
- prev: curState.context,
- pluginName: pluginName,
- indent: curState.indented,
- startOfLine: startOfLine,
- noIndent: noIndent
- };
-}
-
-function popContext() {
- if (curState.context) curState.context = curState.context.prev;
-}
-
-function element(type) {
- if (type == "openPlugin") {curState.pluginName = pluginName; return cont(attributes, endplugin(curState.startOfLine));}
- else if (type == "closePlugin") {
- var err = false;
- if (curState.context) {
- err = curState.context.pluginName != pluginName;
- popContext();
- } else {
- err = true;
- }
- if (err) setStyle = "error";
- return cont(endcloseplugin(err));
- }
- else if (type == "string") {
- if (!curState.context || curState.context.name != "!cdata") pushContext("!cdata");
- if (curState.tokenize == inText) popContext();
- return cont();
- }
- else return cont();
-}
-
-function endplugin(startOfLine) {
- return function(type) {
- if (
- type == "selfclosePlugin" ||
- type == "endPlugin"
- )
- return cont();
- if (type == "endPlugin") {pushContext(curState.pluginName, startOfLine); return cont();}
- return cont();
- };
-}
-
-function endcloseplugin(err) {
- return function(type) {
- if (err) setStyle = "error";
- if (type == "endPlugin") return cont();
- return pass();
- };
-}
-
-function attributes(type) {
- if (type == "keyword") {setStyle = "attribute"; return cont(attributes);}
- if (type == "equals") return cont(attvalue, attributes);
- return pass();
-}
-function attvalue(type) {
- if (type == "keyword") {setStyle = "string"; return cont();}
- if (type == "string") return cont(attvaluemaybe);
- return pass();
-}
-function attvaluemaybe(type) {
- if (type == "string") return cont(attvaluemaybe);
- else return pass();
-}
-return {
- startState: function() {
- return {tokenize: inText, cc: [], indented: 0, startOfLine: true, pluginName: null, context: null};
- },
- token: function(stream, state) {
- if (stream.sol()) {
- state.startOfLine = true;
- state.indented = stream.indentation();
- }
- if (stream.eatSpace()) return null;
-
- setStyle = type = pluginName = null;
- var style = state.tokenize(stream, state);
- if ((style || type) && style != "comment") {
- curState = state;
- while (true) {
- var comb = state.cc.pop() || element;
- if (comb(type || style)) break;
- }
- }
- state.startOfLine = false;
- return setStyle || style;
- },
- indent: function(state, textAfter) {
- var context = state.context;
- if (context && context.noIndent) return 0;
- if (context && /^{\//.test(textAfter))
- context = context.prev;
- while (context && !context.startOfLine)
- context = context.prev;
- if (context) return context.indent + indentUnit;
- else return 0;
- },
- electricChars: "/"
- };
-});
-
-CodeMirror.defineMIME("text/tiki", "tiki");
-
-});
diff --git a/shared/codemirror/mode/toml/toml.js b/shared/codemirror/mode/toml/toml.js
deleted file mode 100644
index baeca15..0000000
--- a/shared/codemirror/mode/toml/toml.js
+++ /dev/null
@@ -1,88 +0,0 @@
-// 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("toml", function () {
- return {
- startState: function () {
- return {
- inString: false,
- stringType: "",
- lhs: true,
- inArray: 0
- };
- },
- token: function (stream, state) {
- //check for state changes
- if (!state.inString && ((stream.peek() == '"') || (stream.peek() == "'"))) {
- state.stringType = stream.peek();
- stream.next(); // Skip quote
- state.inString = true; // Update state
- }
- if (stream.sol() && state.inArray === 0) {
- state.lhs = true;
- }
- //return state
- if (state.inString) {
- while (state.inString && !stream.eol()) {
- if (stream.peek() === state.stringType) {
- stream.next(); // Skip quote
- state.inString = false; // Clear flag
- } else if (stream.peek() === '\\') {
- stream.next();
- stream.next();
- } else {
- stream.match(/^.[^\\\"\']*/);
- }
- }
- return state.lhs ? "property string" : "string"; // Token style
- } else if (state.inArray && stream.peek() === ']') {
- stream.next();
- state.inArray--;
- return 'bracket';
- } else if (state.lhs && stream.peek() === '[' && stream.skipTo(']')) {
- stream.next();//skip closing ]
- // array of objects has an extra open & close []
- if (stream.peek() === ']') stream.next();
- return "atom";
- } else if (stream.peek() === "#") {
- stream.skipToEnd();
- return "comment";
- } else if (stream.eatSpace()) {
- return null;
- } else if (state.lhs && stream.eatWhile(function (c) { return c != '=' && c != ' '; })) {
- return "property";
- } else if (state.lhs && stream.peek() === "=") {
- stream.next();
- state.lhs = false;
- return null;
- } else if (!state.lhs && stream.match(/^\d\d\d\d[\d\-\:\.T]*Z/)) {
- return 'atom'; //date
- } else if (!state.lhs && (stream.match('true') || stream.match('false'))) {
- return 'atom';
- } else if (!state.lhs && stream.peek() === '[') {
- state.inArray++;
- stream.next();
- return 'bracket';
- } else if (!state.lhs && stream.match(/^\-?\d+(?:\.\d+)?/)) {
- return 'number';
- } else if (!stream.eatSpace()) {
- stream.next();
- }
- return null;
- }
- };
-});
-
-CodeMirror.defineMIME('text/x-toml', 'toml');
-
-});
diff --git a/shared/codemirror/mode/tornado/tornado.js b/shared/codemirror/mode/tornado/tornado.js
deleted file mode 100644
index dbfbc34..0000000
--- a/shared/codemirror/mode/tornado/tornado.js
+++ /dev/null
@@ -1,68 +0,0 @@
-// 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"), require("../htmlmixed/htmlmixed"),
- require("../../addon/mode/overlay"));
- else if (typeof define == "function" && define.amd) // AMD
- define(["../../lib/codemirror", "../htmlmixed/htmlmixed",
- "../../addon/mode/overlay"], mod);
- else // Plain browser env
- mod(CodeMirror);
-})(function(CodeMirror) {
- "use strict";
-
- CodeMirror.defineMode("tornado:inner", function() {
- var keywords = ["and","as","assert","autoescape","block","break","class","comment","context",
- "continue","datetime","def","del","elif","else","end","escape","except",
- "exec","extends","false","finally","for","from","global","if","import","in",
- "include","is","json_encode","lambda","length","linkify","load","module",
- "none","not","or","pass","print","put","raise","raw","return","self","set",
- "squeeze","super","true","try","url_escape","while","with","without","xhtml_escape","yield"];
- keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b");
-
- function tokenBase (stream, state) {
- stream.eatWhile(/[^\{]/);
- var ch = stream.next();
- if (ch == "{") {
- if (ch = stream.eat(/\{|%|#/)) {
- state.tokenize = inTag(ch);
- return "tag";
- }
- }
- }
- function inTag (close) {
- if (close == "{") {
- close = "}";
- }
- return function (stream, state) {
- var ch = stream.next();
- if ((ch == close) && stream.eat("}")) {
- state.tokenize = tokenBase;
- return "tag";
- }
- if (stream.match(keywords)) {
- return "keyword";
- }
- return close == "#" ? "comment" : "string";
- };
- }
- return {
- startState: function () {
- return {tokenize: tokenBase};
- },
- token: function (stream, state) {
- return state.tokenize(stream, state);
- }
- };
- });
-
- CodeMirror.defineMode("tornado", function(config) {
- var htmlBase = CodeMirror.getMode(config, "text/html");
- var tornadoInner = CodeMirror.getMode(config, "tornado:inner");
- return CodeMirror.overlayMode(htmlBase, tornadoInner);
- });
-
- CodeMirror.defineMIME("text/x-tornado", "tornado");
-});
diff --git a/shared/codemirror/mode/troff/troff.js b/shared/codemirror/mode/troff/troff.js
deleted file mode 100644
index 86154b6..0000000
--- a/shared/codemirror/mode/troff/troff.js
+++ /dev/null
@@ -1,84 +0,0 @@
-// 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")
- mod(require("../../lib/codemirror"));
- else if (typeof define == "function" && define.amd)
- define(["../../lib/codemirror"], mod);
- else
- mod(CodeMirror);
-})(function(CodeMirror) {
-"use strict";
-
-CodeMirror.defineMode('troff', function() {
-
- var words = {};
-
- function tokenBase(stream) {
- if (stream.eatSpace()) return null;
-
- var sol = stream.sol();
- var ch = stream.next();
-
- if (ch === '\\') {
- if (stream.match('fB') || stream.match('fR') || stream.match('fI') ||
- stream.match('u') || stream.match('d') ||
- stream.match('%') || stream.match('&')) {
- return 'string';
- }
- if (stream.match('m[')) {
- stream.skipTo(']');
- stream.next();
- return 'string';
- }
- if (stream.match('s+') || stream.match('s-')) {
- stream.eatWhile(/[\d-]/);
- return 'string';
- }
- if (stream.match('\(') || stream.match('*\(')) {
- stream.eatWhile(/[\w-]/);
- return 'string';
- }
- return 'string';
- }
- if (sol && (ch === '.' || ch === '\'')) {
- if (stream.eat('\\') && stream.eat('\"')) {
- stream.skipToEnd();
- return 'comment';
- }
- }
- if (sol && ch === '.') {
- if (stream.match('B ') || stream.match('I ') || stream.match('R ')) {
- return 'attribute';
- }
- if (stream.match('TH ') || stream.match('SH ') || stream.match('SS ') || stream.match('HP ')) {
- stream.skipToEnd();
- return 'quote';
- }
- if ((stream.match(/[A-Z]/) && stream.match(/[A-Z]/)) || (stream.match(/[a-z]/) && stream.match(/[a-z]/))) {
- return 'attribute';
- }
- }
- stream.eatWhile(/[\w-]/);
- var cur = stream.current();
- return words.hasOwnProperty(cur) ? words[cur] : null;
- }
-
- function tokenize(stream, state) {
- return (state.tokens[0] || tokenBase) (stream, state);
- };
-
- return {
- startState: function() {return {tokens:[]};},
- token: function(stream, state) {
- return tokenize(stream, state);
- }
- };
-});
-
-CodeMirror.defineMIME('text/troff', 'troff');
-CodeMirror.defineMIME('text/x-troff', 'troff');
-CodeMirror.defineMIME('application/x-troff', 'troff');
-
-});
diff --git a/shared/codemirror/mode/ttcn-cfg/ttcn-cfg.js b/shared/codemirror/mode/ttcn-cfg/ttcn-cfg.js
deleted file mode 100644
index e108051..0000000
--- a/shared/codemirror/mode/ttcn-cfg/ttcn-cfg.js
+++ /dev/null
@@ -1,214 +0,0 @@
-// 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
- });
-});
\ No newline at end of file
diff --git a/shared/codemirror/mode/ttcn/ttcn.js b/shared/codemirror/mode/ttcn/ttcn.js
deleted file mode 100644
index 3051851..0000000
--- a/shared/codemirror/mode/ttcn/ttcn.js
+++ /dev/null
@@ -1,283 +0,0 @@
-// 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
- });
-});
diff --git a/shared/codemirror/mode/turtle/turtle.js b/shared/codemirror/mode/turtle/turtle.js
deleted file mode 100644
index 0988f0a..0000000
--- a/shared/codemirror/mode/turtle/turtle.js
+++ /dev/null
@@ -1,162 +0,0 @@
-// 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("turtle", function(config) {
- var indentUnit = config.indentUnit;
- var curPunc;
-
- function wordRegexp(words) {
- return new RegExp("^(?:" + words.join("|") + ")$", "i");
- }
- var ops = wordRegexp([]);
- var keywords = wordRegexp(["@prefix", "@base", "a"]);
- var operatorChars = /[*+\-<>=&|]/;
-
- function tokenBase(stream, state) {
- var ch = stream.next();
- curPunc = null;
- if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) {
- stream.match(/^[^\s\u00a0>]*>?/);
- return "atom";
- }
- else if (ch == "\"" || ch == "'") {
- state.tokenize = tokenLiteral(ch);
- return state.tokenize(stream, state);
- }
- else if (/[{}\(\),\.;\[\]]/.test(ch)) {
- curPunc = ch;
- return null;
- }
- else if (ch == "#") {
- stream.skipToEnd();
- return "comment";
- }
- else if (operatorChars.test(ch)) {
- stream.eatWhile(operatorChars);
- return null;
- }
- else if (ch == ":") {
- return "operator";
- } else {
- stream.eatWhile(/[_\w\d]/);
- if(stream.peek() == ":") {
- return "variable-3";
- } else {
- var word = stream.current();
-
- if(keywords.test(word)) {
- return "meta";
- }
-
- if(ch >= "A" && ch <= "Z") {
- return "comment";
- } else {
- return "keyword";
- }
- }
- var word = stream.current();
- if (ops.test(word))
- return null;
- else if (keywords.test(word))
- return "meta";
- else
- return "variable";
- }
- }
-
- function tokenLiteral(quote) {
- return function(stream, state) {
- var escaped = false, ch;
- while ((ch = stream.next()) != null) {
- if (ch == quote && !escaped) {
- state.tokenize = tokenBase;
- break;
- }
- escaped = !escaped && ch == "\\";
- }
- return "string";
- };
- }
-
- function pushContext(state, type, col) {
- state.context = {prev: state.context, indent: state.indent, col: col, type: type};
- }
- function popContext(state) {
- state.indent = state.context.indent;
- state.context = state.context.prev;
- }
-
- return {
- startState: function() {
- return {tokenize: tokenBase,
- context: null,
- indent: 0,
- col: 0};
- },
-
- token: function(stream, state) {
- if (stream.sol()) {
- if (state.context && state.context.align == null) state.context.align = false;
- state.indent = stream.indentation();
- }
- if (stream.eatSpace()) return null;
- var style = state.tokenize(stream, state);
-
- if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") {
- state.context.align = true;
- }
-
- if (curPunc == "(") pushContext(state, ")", stream.column());
- else if (curPunc == "[") pushContext(state, "]", stream.column());
- else if (curPunc == "{") pushContext(state, "}", stream.column());
- else if (/[\]\}\)]/.test(curPunc)) {
- while (state.context && state.context.type == "pattern") popContext(state);
- if (state.context && curPunc == state.context.type) popContext(state);
- }
- else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state);
- else if (/atom|string|variable/.test(style) && state.context) {
- if (/[\}\]]/.test(state.context.type))
- pushContext(state, "pattern", stream.column());
- else if (state.context.type == "pattern" && !state.context.align) {
- state.context.align = true;
- state.context.col = stream.column();
- }
- }
-
- return style;
- },
-
- indent: function(state, textAfter) {
- var firstChar = textAfter && textAfter.charAt(0);
- var context = state.context;
- if (/[\]\}]/.test(firstChar))
- while (context && context.type == "pattern") context = context.prev;
-
- var closing = context && firstChar == context.type;
- if (!context)
- return 0;
- else if (context.type == "pattern")
- return context.col;
- else if (context.align)
- return context.col + (closing ? 0 : 1);
- else
- return context.indent + (closing ? 0 : indentUnit);
- },
-
- lineComment: "#"
- };
-});
-
-CodeMirror.defineMIME("text/turtle", "turtle");
-
-});
diff --git a/shared/codemirror/mode/twig/twig.js b/shared/codemirror/mode/twig/twig.js
deleted file mode 100644
index 1f2854b..0000000
--- a/shared/codemirror/mode/twig/twig.js
+++ /dev/null
@@ -1,141 +0,0 @@
-// 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"), require("../../addon/mode/multiplex"));
- else if (typeof define == "function" && define.amd) // AMD
- define(["../../lib/codemirror", "../../addon/mode/multiplex"], mod);
- else // Plain browser env
- mod(CodeMirror);
-})(function(CodeMirror) {
- "use strict";
-
- CodeMirror.defineMode("twig:inner", function() {
- var keywords = ["and", "as", "autoescape", "endautoescape", "block", "do", "endblock", "else", "elseif", "extends", "for", "endfor", "embed", "endembed", "filter", "endfilter", "flush", "from", "if", "endif", "in", "is", "include", "import", "not", "or", "set", "spaceless", "endspaceless", "with", "endwith", "trans", "endtrans", "blocktrans", "endblocktrans", "macro", "endmacro", "use", "verbatim", "endverbatim"],
- operator = /^[+\-*&%=<>!?|~^]/,
- sign = /^[:\[\(\{]/,
- 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.defineMode("twig", function(config, parserConfig) {
- var twigInner = CodeMirror.getMode(config, "twig:inner");
- if (!parserConfig || !parserConfig.base) return twigInner;
- return CodeMirror.multiplexingMode(
- CodeMirror.getMode(config, parserConfig.base), {
- open: /\{[{#%]/, close: /[}#%]\}/, mode: twigInner, parseDelimiters: true
- }
- );
- });
- CodeMirror.defineMIME("text/x-twig", "twig");
-});
diff --git a/shared/codemirror/mode/vb/vb.js b/shared/codemirror/mode/vb/vb.js
deleted file mode 100644
index d78f91f..0000000
--- a/shared/codemirror/mode/vb/vb.js
+++ /dev/null
@@ -1,276 +0,0 @@
-// 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("vb", function(conf, parserConf) {
- var ERRORCLASS = 'error';
-
- function wordRegexp(words) {
- return new RegExp("^((" + words.join(")|(") + "))\\b", "i");
- }
-
- var singleOperators = new RegExp("^[\\+\\-\\*/%&\\\\|\\^~<>!]");
- var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
- var doubleOperators = new RegExp("^((==)|(<>)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))");
- var doubleDelimiters = new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
- var tripleDelimiters = new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");
- var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*");
-
- var openingKeywords = ['class','module', 'sub','enum','select','while','if','function', 'get','set','property', 'try'];
- var middleKeywords = ['else','elseif','case', 'catch'];
- var endKeywords = ['next','loop'];
-
- var operatorKeywords = ['and', 'or', 'not', 'xor', 'in'];
- var wordOperators = wordRegexp(operatorKeywords);
- var commonKeywords = ['as', 'dim', 'break', 'continue','optional', 'then', 'until',
- 'goto', 'byval','byref','new','handles','property', 'return',
- 'const','private', 'protected', 'friend', 'public', 'shared', 'static', 'true','false'];
- var commontypes = ['integer','string','double','decimal','boolean','short','char', 'float','single'];
-
- var keywords = wordRegexp(commonKeywords);
- var types = wordRegexp(commontypes);
- var stringPrefixes = '"';
-
- var opening = wordRegexp(openingKeywords);
- var middle = wordRegexp(middleKeywords);
- var closing = wordRegexp(endKeywords);
- var doubleClosing = wordRegexp(['end']);
- var doOpening = wordRegexp(['do']);
-
- var indentInfo = null;
-
- CodeMirror.registerHelper("hintWords", "vb", openingKeywords.concat(middleKeywords).concat(endKeywords)
- .concat(operatorKeywords).concat(commonKeywords).concat(commontypes));
-
- function indent(_stream, state) {
- state.currentIndent++;
- }
-
- function dedent(_stream, state) {
- state.currentIndent--;
- }
- // tokenizers
- function tokenBase(stream, state) {
- if (stream.eatSpace()) {
- return null;
- }
-
- var ch = stream.peek();
-
- // Handle Comments
- if (ch === "'") {
- stream.skipToEnd();
- return 'comment';
- }
-
-
- // Handle Number Literals
- if (stream.match(/^((&H)|(&O))?[0-9\.a-f]/i, false)) {
- var floatLiteral = false;
- // Floats
- if (stream.match(/^\d*\.\d+F?/i)) { floatLiteral = true; }
- else if (stream.match(/^\d+\.\d*F?/)) { floatLiteral = true; }
- else if (stream.match(/^\.\d+F?/)) { floatLiteral = true; }
-
- if (floatLiteral) {
- // Float literals may be "imaginary"
- stream.eat(/J/i);
- return 'number';
- }
- // Integers
- var intLiteral = false;
- // Hex
- if (stream.match(/^&H[0-9a-f]+/i)) { intLiteral = true; }
- // Octal
- else if (stream.match(/^&O[0-7]+/i)) { intLiteral = true; }
- // Decimal
- else if (stream.match(/^[1-9]\d*F?/)) {
- // Decimal literals may be "imaginary"
- stream.eat(/J/i);
- // TODO - Can you have imaginary longs?
- intLiteral = true;
- }
- // Zero by itself with no other piece of number.
- else if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; }
- if (intLiteral) {
- // Integer literals may be "long"
- stream.eat(/L/i);
- return 'number';
- }
- }
-
- // Handle Strings
- if (stream.match(stringPrefixes)) {
- state.tokenize = tokenStringFactory(stream.current());
- return state.tokenize(stream, state);
- }
-
- // Handle operators and Delimiters
- if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
- return null;
- }
- if (stream.match(doubleOperators)
- || stream.match(singleOperators)
- || stream.match(wordOperators)) {
- return 'operator';
- }
- if (stream.match(singleDelimiters)) {
- return null;
- }
- if (stream.match(doOpening)) {
- indent(stream,state);
- state.doInCurrentLine = true;
- return 'keyword';
- }
- if (stream.match(opening)) {
- if (! state.doInCurrentLine)
- indent(stream,state);
- else
- state.doInCurrentLine = false;
- return 'keyword';
- }
- if (stream.match(middle)) {
- return 'keyword';
- }
-
- if (stream.match(doubleClosing)) {
- dedent(stream,state);
- dedent(stream,state);
- return 'keyword';
- }
- if (stream.match(closing)) {
- dedent(stream,state);
- return 'keyword';
- }
-
- if (stream.match(types)) {
- return 'keyword';
- }
-
- if (stream.match(keywords)) {
- return 'keyword';
- }
-
- if (stream.match(identifiers)) {
- return 'variable';
- }
-
- // Handle non-detected items
- stream.next();
- return ERRORCLASS;
- }
-
- function tokenStringFactory(delimiter) {
- var singleline = delimiter.length == 1;
- var OUTCLASS = 'string';
-
- return function(stream, state) {
- while (!stream.eol()) {
- stream.eatWhile(/[^'"]/);
- if (stream.match(delimiter)) {
- state.tokenize = tokenBase;
- return OUTCLASS;
- } else {
- stream.eat(/['"]/);
- }
- }
- if (singleline) {
- if (parserConf.singleLineStringErrors) {
- return ERRORCLASS;
- } else {
- state.tokenize = tokenBase;
- }
- }
- return OUTCLASS;
- };
- }
-
-
- function tokenLexer(stream, state) {
- var style = state.tokenize(stream, state);
- var current = stream.current();
-
- // Handle '.' connected identifiers
- if (current === '.') {
- style = state.tokenize(stream, state);
- current = stream.current();
- if (style === 'variable') {
- return 'variable';
- } else {
- return ERRORCLASS;
- }
- }
-
-
- var delimiter_index = '[({'.indexOf(current);
- if (delimiter_index !== -1) {
- indent(stream, state );
- }
- if (indentInfo === 'dedent') {
- if (dedent(stream, state)) {
- return ERRORCLASS;
- }
- }
- delimiter_index = '])}'.indexOf(current);
- if (delimiter_index !== -1) {
- if (dedent(stream, state)) {
- return ERRORCLASS;
- }
- }
-
- return style;
- }
-
- var external = {
- electricChars:"dDpPtTfFeE ",
- startState: function() {
- return {
- tokenize: tokenBase,
- lastToken: null,
- currentIndent: 0,
- nextLineIndent: 0,
- doInCurrentLine: false
-
-
- };
- },
-
- token: function(stream, state) {
- if (stream.sol()) {
- state.currentIndent += state.nextLineIndent;
- state.nextLineIndent = 0;
- state.doInCurrentLine = 0;
- }
- var style = tokenLexer(stream, state);
-
- state.lastToken = {style:style, content: stream.current()};
-
-
-
- return style;
- },
-
- indent: function(state, textAfter) {
- var trueText = textAfter.replace(/^\s+|\s+$/g, '') ;
- 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;
-});
-
-CodeMirror.defineMIME("text/x-vb", "vb");
-
-});
diff --git a/shared/codemirror/mode/vbscript/vbscript.js b/shared/codemirror/mode/vbscript/vbscript.js
deleted file mode 100644
index b66df22..0000000
--- a/shared/codemirror/mode/vbscript/vbscript.js
+++ /dev/null
@@ -1,350 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-/*
-For extra ASP classic objects, initialize CodeMirror instance with this option:
- isASP: true
-
-E.G.:
- var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
- lineNumbers: true,
- isASP: true
- });
-*/
-
-(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("vbscript", function(conf, parserConf) {
- var ERRORCLASS = 'error';
-
- function wordRegexp(words) {
- return new RegExp("^((" + words.join(")|(") + "))\\b", "i");
- }
-
- var singleOperators = new RegExp("^[\\+\\-\\*/&\\\\\\^<>=]");
- var doubleOperators = new RegExp("^((<>)|(<=)|(>=))");
- var singleDelimiters = new RegExp('^[\\.,]');
- var brakets = new RegExp('^[\\(\\)]');
- var identifiers = new RegExp("^[A-Za-z][_A-Za-z0-9]*");
-
- var openingKeywords = ['class','sub','select','while','if','function', 'property', 'with', 'for'];
- var middleKeywords = ['else','elseif','case'];
- var endKeywords = ['next','loop','wend'];
-
- var wordOperators = wordRegexp(['and', 'or', 'not', 'xor', 'is', 'mod', 'eqv', 'imp']);
- var commonkeywords = ['dim', 'redim', 'then', 'until', 'randomize',
- 'byval','byref','new','property', 'exit', 'in',
- 'const','private', 'public',
- 'get','set','let', 'stop', 'on error resume next', 'on error goto 0', 'option explicit', 'call', 'me'];
-
- //This list was from: http://msdn.microsoft.com/en-us/library/f8tbc79x(v=vs.84).aspx
- var atomWords = ['true', 'false', 'nothing', 'empty', 'null'];
- //This list was from: http://msdn.microsoft.com/en-us/library/3ca8tfek(v=vs.84).aspx
- var builtinFuncsWords = ['abs', 'array', 'asc', 'atn', 'cbool', 'cbyte', 'ccur', 'cdate', 'cdbl', 'chr', 'cint', 'clng', 'cos', 'csng', 'cstr', 'date', 'dateadd', 'datediff', 'datepart',
- 'dateserial', 'datevalue', 'day', 'escape', 'eval', 'execute', 'exp', 'filter', 'formatcurrency', 'formatdatetime', 'formatnumber', 'formatpercent', 'getlocale', 'getobject',
- 'getref', 'hex', 'hour', 'inputbox', 'instr', 'instrrev', 'int', 'fix', 'isarray', 'isdate', 'isempty', 'isnull', 'isnumeric', 'isobject', 'join', 'lbound', 'lcase', 'left',
- 'len', 'loadpicture', 'log', 'ltrim', 'rtrim', 'trim', 'maths', 'mid', 'minute', 'month', 'monthname', 'msgbox', 'now', 'oct', 'replace', 'rgb', 'right', 'rnd', 'round',
- 'scriptengine', 'scriptenginebuildversion', 'scriptenginemajorversion', 'scriptengineminorversion', 'second', 'setlocale', 'sgn', 'sin', 'space', 'split', 'sqr', 'strcomp',
- 'string', 'strreverse', 'tan', 'time', 'timer', 'timeserial', 'timevalue', 'typename', 'ubound', 'ucase', 'unescape', 'vartype', 'weekday', 'weekdayname', 'year'];
-
- //This list was from: http://msdn.microsoft.com/en-us/library/ydz4cfk3(v=vs.84).aspx
- var builtinConsts = ['vbBlack', 'vbRed', 'vbGreen', 'vbYellow', 'vbBlue', 'vbMagenta', 'vbCyan', 'vbWhite', 'vbBinaryCompare', 'vbTextCompare',
- 'vbSunday', 'vbMonday', 'vbTuesday', 'vbWednesday', 'vbThursday', 'vbFriday', 'vbSaturday', 'vbUseSystemDayOfWeek', 'vbFirstJan1', 'vbFirstFourDays', 'vbFirstFullWeek',
- 'vbGeneralDate', 'vbLongDate', 'vbShortDate', 'vbLongTime', 'vbShortTime', 'vbObjectError',
- 'vbOKOnly', 'vbOKCancel', 'vbAbortRetryIgnore', 'vbYesNoCancel', 'vbYesNo', 'vbRetryCancel', 'vbCritical', 'vbQuestion', 'vbExclamation', 'vbInformation', 'vbDefaultButton1', 'vbDefaultButton2',
- 'vbDefaultButton3', 'vbDefaultButton4', 'vbApplicationModal', 'vbSystemModal', 'vbOK', 'vbCancel', 'vbAbort', 'vbRetry', 'vbIgnore', 'vbYes', 'vbNo',
- 'vbCr', 'VbCrLf', 'vbFormFeed', 'vbLf', 'vbNewLine', 'vbNullChar', 'vbNullString', 'vbTab', 'vbVerticalTab', 'vbUseDefault', 'vbTrue', 'vbFalse',
- 'vbEmpty', 'vbNull', 'vbInteger', 'vbLong', 'vbSingle', 'vbDouble', 'vbCurrency', 'vbDate', 'vbString', 'vbObject', 'vbError', 'vbBoolean', 'vbVariant', 'vbDataObject', 'vbDecimal', 'vbByte', 'vbArray'];
- //This list was from: http://msdn.microsoft.com/en-us/library/hkc375ea(v=vs.84).aspx
- var builtinObjsWords = ['WScript', 'err', 'debug', 'RegExp'];
- var knownProperties = ['description', 'firstindex', 'global', 'helpcontext', 'helpfile', 'ignorecase', 'length', 'number', 'pattern', 'source', 'value', 'count'];
- var knownMethods = ['clear', 'execute', 'raise', 'replace', 'test', 'write', 'writeline', 'close', 'open', 'state', 'eof', 'update', 'addnew', 'end', 'createobject', 'quit'];
-
- var aspBuiltinObjsWords = ['server', 'response', 'request', 'session', 'application'];
- var aspKnownProperties = ['buffer', 'cachecontrol', 'charset', 'contenttype', 'expires', 'expiresabsolute', 'isclientconnected', 'pics', 'status', //response
- 'clientcertificate', 'cookies', 'form', 'querystring', 'servervariables', 'totalbytes', //request
- 'contents', 'staticobjects', //application
- 'codepage', 'lcid', 'sessionid', 'timeout', //session
- 'scripttimeout']; //server
- var aspKnownMethods = ['addheader', 'appendtolog', 'binarywrite', 'end', 'flush', 'redirect', //response
- 'binaryread', //request
- 'remove', 'removeall', 'lock', 'unlock', //application
- 'abandon', //session
- 'getlasterror', 'htmlencode', 'mappath', 'transfer', 'urlencode']; //server
-
- var knownWords = knownMethods.concat(knownProperties);
-
- builtinObjsWords = builtinObjsWords.concat(builtinConsts);
-
- if (conf.isASP){
- builtinObjsWords = builtinObjsWords.concat(aspBuiltinObjsWords);
- knownWords = knownWords.concat(aspKnownMethods, aspKnownProperties);
- };
-
- var keywords = wordRegexp(commonkeywords);
- var atoms = wordRegexp(atomWords);
- var builtinFuncs = wordRegexp(builtinFuncsWords);
- var builtinObjs = wordRegexp(builtinObjsWords);
- var known = wordRegexp(knownWords);
- var stringPrefixes = '"';
-
- var opening = wordRegexp(openingKeywords);
- var middle = wordRegexp(middleKeywords);
- var closing = wordRegexp(endKeywords);
- var doubleClosing = wordRegexp(['end']);
- var doOpening = wordRegexp(['do']);
- var noIndentWords = wordRegexp(['on error resume next', 'exit']);
- var comment = wordRegexp(['rem']);
-
-
- function indent(_stream, state) {
- state.currentIndent++;
- }
-
- function dedent(_stream, state) {
- state.currentIndent--;
- }
- // tokenizers
- function tokenBase(stream, state) {
- if (stream.eatSpace()) {
- return 'space';
- //return null;
- }
-
- var ch = stream.peek();
-
- // Handle Comments
- if (ch === "'") {
- stream.skipToEnd();
- return 'comment';
- }
- if (stream.match(comment)){
- stream.skipToEnd();
- return 'comment';
- }
-
-
- // Handle Number Literals
- if (stream.match(/^((&H)|(&O))?[0-9\.]/i, false) && !stream.match(/^((&H)|(&O))?[0-9\.]+[a-z_]/i, false)) {
- var floatLiteral = false;
- // Floats
- if (stream.match(/^\d*\.\d+/i)) { floatLiteral = true; }
- else if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; }
- else if (stream.match(/^\.\d+/)) { floatLiteral = true; }
-
- if (floatLiteral) {
- // Float literals may be "imaginary"
- stream.eat(/J/i);
- return 'number';
- }
- // Integers
- var intLiteral = false;
- // Hex
- if (stream.match(/^&H[0-9a-f]+/i)) { intLiteral = true; }
- // Octal
- else if (stream.match(/^&O[0-7]+/i)) { intLiteral = true; }
- // Decimal
- else if (stream.match(/^[1-9]\d*F?/)) {
- // Decimal literals may be "imaginary"
- stream.eat(/J/i);
- // TODO - Can you have imaginary longs?
- intLiteral = true;
- }
- // Zero by itself with no other piece of number.
- else if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; }
- if (intLiteral) {
- // Integer literals may be "long"
- stream.eat(/L/i);
- return 'number';
- }
- }
-
- // Handle Strings
- if (stream.match(stringPrefixes)) {
- state.tokenize = tokenStringFactory(stream.current());
- return state.tokenize(stream, state);
- }
-
- // Handle operators and Delimiters
- if (stream.match(doubleOperators)
- || stream.match(singleOperators)
- || stream.match(wordOperators)) {
- return 'operator';
- }
- if (stream.match(singleDelimiters)) {
- return null;
- }
-
- if (stream.match(brakets)) {
- return "bracket";
- }
-
- if (stream.match(noIndentWords)) {
- state.doInCurrentLine = true;
-
- return 'keyword';
- }
-
- if (stream.match(doOpening)) {
- indent(stream,state);
- state.doInCurrentLine = true;
-
- return 'keyword';
- }
- if (stream.match(opening)) {
- if (! state.doInCurrentLine)
- indent(stream,state);
- else
- state.doInCurrentLine = false;
-
- return 'keyword';
- }
- if (stream.match(middle)) {
- return 'keyword';
- }
-
-
- if (stream.match(doubleClosing)) {
- dedent(stream,state);
- dedent(stream,state);
-
- return 'keyword';
- }
- if (stream.match(closing)) {
- if (! state.doInCurrentLine)
- dedent(stream,state);
- else
- state.doInCurrentLine = false;
-
- return 'keyword';
- }
-
- if (stream.match(keywords)) {
- return 'keyword';
- }
-
- if (stream.match(atoms)) {
- return 'atom';
- }
-
- if (stream.match(known)) {
- return 'variable-2';
- }
-
- if (stream.match(builtinFuncs)) {
- return 'builtin';
- }
-
- if (stream.match(builtinObjs)){
- return 'variable-2';
- }
-
- if (stream.match(identifiers)) {
- return 'variable';
- }
-
- // Handle non-detected items
- stream.next();
- return ERRORCLASS;
- }
-
- function tokenStringFactory(delimiter) {
- var singleline = delimiter.length == 1;
- var OUTCLASS = 'string';
-
- return function(stream, state) {
- while (!stream.eol()) {
- stream.eatWhile(/[^'"]/);
- if (stream.match(delimiter)) {
- state.tokenize = tokenBase;
- return OUTCLASS;
- } else {
- stream.eat(/['"]/);
- }
- }
- if (singleline) {
- if (parserConf.singleLineStringErrors) {
- return ERRORCLASS;
- } else {
- state.tokenize = tokenBase;
- }
- }
- return OUTCLASS;
- };
- }
-
-
- function tokenLexer(stream, state) {
- var style = state.tokenize(stream, state);
- var current = stream.current();
-
- // Handle '.' connected identifiers
- if (current === '.') {
- style = state.tokenize(stream, state);
-
- current = stream.current();
- if (style && (style.substr(0, 8) === 'variable' || style==='builtin' || style==='keyword')){//|| knownWords.indexOf(current.substring(1)) > -1) {
- if (style === 'builtin' || style === 'keyword') style='variable';
- if (knownWords.indexOf(current.substr(1)) > -1) style='variable-2';
-
- return style;
- } else {
- return ERRORCLASS;
- }
- }
-
- return style;
- }
-
- var external = {
- electricChars:"dDpPtTfFeE ",
- startState: function() {
- return {
- tokenize: tokenBase,
- lastToken: null,
- currentIndent: 0,
- nextLineIndent: 0,
- doInCurrentLine: false,
- ignoreKeyword: false
-
-
- };
- },
-
- token: function(stream, state) {
- if (stream.sol()) {
- state.currentIndent += state.nextLineIndent;
- state.nextLineIndent = 0;
- state.doInCurrentLine = 0;
- }
- var style = tokenLexer(stream, state);
-
- state.lastToken = {style:style, content: stream.current()};
-
- if (style==='space') style=null;
-
- return style;
- },
-
- indent: function(state, textAfter) {
- var trueText = textAfter.replace(/^\s+|\s+$/g, '') ;
- 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;
- }
-
- };
- return external;
-});
-
-CodeMirror.defineMIME("text/vbscript", "vbscript");
-
-});
diff --git a/shared/codemirror/mode/velocity/velocity.js b/shared/codemirror/mode/velocity/velocity.js
deleted file mode 100644
index 12ee221..0000000
--- a/shared/codemirror/mode/velocity/velocity.js
+++ /dev/null
@@ -1,201 +0,0 @@
-// 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("velocity", function() {
- function parseWords(str) {
- var obj = {}, words = str.split(" ");
- for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
- return obj;
- }
-
- var keywords = parseWords("#end #else #break #stop #[[ #]] " +
- "#{end} #{else} #{break} #{stop}");
- var functions = parseWords("#if #elseif #foreach #set #include #parse #macro #define #evaluate " +
- "#{if} #{elseif} #{foreach} #{set} #{include} #{parse} #{macro} #{define} #{evaluate}");
- var specials = parseWords("$foreach.count $foreach.hasNext $foreach.first $foreach.last $foreach.topmost $foreach.parent.count $foreach.parent.hasNext $foreach.parent.first $foreach.parent.last $foreach.parent $velocityCount $!bodyContent $bodyContent");
- var isOperatorChar = /[+\-*&%=<>!?:\/|]/;
-
- function chain(stream, state, f) {
- state.tokenize = f;
- return f(stream, state);
- }
- function tokenBase(stream, state) {
- var beforeParams = state.beforeParams;
- state.beforeParams = false;
- var ch = stream.next();
- // start of unparsed string?
- if ((ch == "'") && !state.inString && state.inParams) {
- state.lastTokenWasBuiltin = false;
- return chain(stream, state, tokenString(ch));
- }
- // start of parsed string?
- else if ((ch == '"')) {
- state.lastTokenWasBuiltin = false;
- if (state.inString) {
- state.inString = false;
- return "string";
- }
- else if (state.inParams)
- return chain(stream, state, tokenString(ch));
- }
- // is it one of the special signs []{}().,;? Seperator?
- else if (/[\[\]{}\(\),;\.]/.test(ch)) {
- if (ch == "(" && beforeParams)
- state.inParams = true;
- else if (ch == ")") {
- state.inParams = false;
- state.lastTokenWasBuiltin = true;
- }
- return null;
- }
- // start of a number value?
- else if (/\d/.test(ch)) {
- state.lastTokenWasBuiltin = false;
- stream.eatWhile(/[\w\.]/);
- return "number";
- }
- // multi line comment?
- else if (ch == "#" && stream.eat("*")) {
- state.lastTokenWasBuiltin = false;
- return chain(stream, state, tokenComment);
- }
- // unparsed content?
- else if (ch == "#" && stream.match(/ *\[ *\[/)) {
- state.lastTokenWasBuiltin = false;
- return chain(stream, state, tokenUnparsed);
- }
- // single line comment?
- else if (ch == "#" && stream.eat("#")) {
- state.lastTokenWasBuiltin = false;
- stream.skipToEnd();
- return "comment";
- }
- // variable?
- else if (ch == "$") {
- stream.eatWhile(/[\w\d\$_\.{}]/);
- // is it one of the specials?
- if (specials && specials.propertyIsEnumerable(stream.current())) {
- return "keyword";
- }
- else {
- state.lastTokenWasBuiltin = true;
- state.beforeParams = true;
- return "builtin";
- }
- }
- // is it a operator?
- else if (isOperatorChar.test(ch)) {
- state.lastTokenWasBuiltin = false;
- stream.eatWhile(isOperatorChar);
- return "operator";
- }
- else {
- // get the whole word
- stream.eatWhile(/[\w\$_{}@]/);
- var word = stream.current();
- // is it one of the listed keywords?
- if (keywords && keywords.propertyIsEnumerable(word))
- return "keyword";
- // is it one of the listed functions?
- if (functions && functions.propertyIsEnumerable(word) ||
- (stream.current().match(/^#@?[a-z0-9_]+ *$/i) && stream.peek()=="(") &&
- !(functions && functions.propertyIsEnumerable(word.toLowerCase()))) {
- state.beforeParams = true;
- state.lastTokenWasBuiltin = false;
- return "keyword";
- }
- if (state.inString) {
- state.lastTokenWasBuiltin = false;
- return "string";
- }
- if (stream.pos > word.length && stream.string.charAt(stream.pos-word.length-1)=="." && state.lastTokenWasBuiltin)
- return "builtin";
- // default: just a "word"
- state.lastTokenWasBuiltin = false;
- return null;
- }
- }
-
- function tokenString(quote) {
- return function(stream, state) {
- var escaped = false, next, end = false;
- while ((next = stream.next()) != null) {
- if ((next == quote) && !escaped) {
- end = true;
- break;
- }
- if (quote=='"' && stream.peek() == '$' && !escaped) {
- state.inString = true;
- end = true;
- break;
- }
- escaped = !escaped && next == "\\";
- }
- if (end) state.tokenize = tokenBase;
- return "string";
- };
- }
-
- function tokenComment(stream, state) {
- var maybeEnd = false, ch;
- while (ch = stream.next()) {
- if (ch == "#" && maybeEnd) {
- state.tokenize = tokenBase;
- break;
- }
- maybeEnd = (ch == "*");
- }
- return "comment";
- }
-
- function tokenUnparsed(stream, state) {
- var maybeEnd = 0, ch;
- while (ch = stream.next()) {
- if (ch == "#" && maybeEnd == 2) {
- state.tokenize = tokenBase;
- break;
- }
- if (ch == "]")
- maybeEnd++;
- else if (ch != " ")
- maybeEnd = 0;
- }
- return "meta";
- }
- // Interface
-
- return {
- startState: function() {
- return {
- tokenize: tokenBase,
- beforeParams: false,
- inParams: false,
- inString: false,
- lastTokenWasBuiltin: false
- };
- },
-
- token: function(stream, state) {
- if (stream.eatSpace()) return null;
- return state.tokenize(stream, state);
- },
- blockCommentStart: "#*",
- blockCommentEnd: "*#",
- lineComment: "##",
- fold: "velocity"
- };
-});
-
-CodeMirror.defineMIME("text/velocity", "velocity");
-
-});
diff --git a/shared/codemirror/mode/verilog/verilog.js b/shared/codemirror/mode/verilog/verilog.js
deleted file mode 100644
index 7513dce..0000000
--- a/shared/codemirror/mode/verilog/verilog.js
+++ /dev/null
@@ -1,537 +0,0 @@
-// 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("verilog", function(config, parserConfig) {
-
- var indentUnit = config.indentUnit,
- statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
- dontAlignCalls = parserConfig.dontAlignCalls,
- noIndentKeywords = parserConfig.noIndentKeywords || [],
- multiLineStrings = parserConfig.multiLineStrings,
- hooks = parserConfig.hooks || {};
-
- function words(str) {
- var obj = {}, words = str.split(" ");
- for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
- return obj;
- }
-
- /**
- * Keywords from IEEE 1800-2012
- */
- var keywords = words(
- "accept_on alias always always_comb always_ff always_latch and assert assign assume automatic before begin bind " +
- "bins binsof bit break buf bufif0 bufif1 byte case casex casez cell chandle checker class clocking cmos config " +
- "const constraint context continue cover covergroup coverpoint cross deassign default defparam design disable " +
- "dist do edge else end endcase endchecker endclass endclocking endconfig endfunction endgenerate endgroup " +
- "endinterface endmodule endpackage endprimitive endprogram endproperty endspecify endsequence endtable endtask " +
- "enum event eventually expect export extends extern final first_match for force foreach forever fork forkjoin " +
- "function generate genvar global highz0 highz1 if iff ifnone ignore_bins illegal_bins implements implies import " +
- "incdir include initial inout input inside instance int integer interconnect interface intersect join join_any " +
- "join_none large let liblist library local localparam logic longint macromodule matches medium modport module " +
- "nand negedge nettype new nexttime nmos nor noshowcancelled not notif0 notif1 null or output package packed " +
- "parameter pmos posedge primitive priority program property protected pull0 pull1 pulldown pullup " +
- "pulsestyle_ondetect pulsestyle_onevent pure rand randc randcase randsequence rcmos real realtime ref reg " +
- "reject_on release repeat restrict return rnmos rpmos rtran rtranif0 rtranif1 s_always s_eventually s_nexttime " +
- "s_until s_until_with scalared sequence shortint shortreal showcancelled signed small soft solve specify " +
- "specparam static string strong strong0 strong1 struct super supply0 supply1 sync_accept_on sync_reject_on " +
- "table tagged task this throughout time timeprecision timeunit tran tranif0 tranif1 tri tri0 tri1 triand trior " +
- "trireg type typedef union unique unique0 unsigned until until_with untyped use uwire var vectored virtual void " +
- "wait wait_order wand weak weak0 weak1 while wildcard wire with within wor xnor xor");
-
- /** Operators from IEEE 1800-2012
- unary_operator ::=
- + | - | ! | ~ | & | ~& | | | ~| | ^ | ~^ | ^~
- binary_operator ::=
- + | - | * | / | % | == | != | === | !== | ==? | !=? | && | || | **
- | < | <= | > | >= | & | | | ^ | ^~ | ~^ | >> | << | >>> | <<<
- | -> | <->
- inc_or_dec_operator ::= ++ | --
- unary_module_path_operator ::=
- ! | ~ | & | ~& | | | ~| | ^ | ~^ | ^~
- binary_module_path_operator ::=
- == | != | && | || | & | | | ^ | ^~ | ~^
- */
- var isOperatorChar = /[\+\-\*\/!~&|^%=?:]/;
- var isBracketChar = /[\[\]{}()]/;
-
- var unsignedNumber = /\d[0-9_]*/;
- var decimalLiteral = /\d*\s*'s?d\s*\d[0-9_]*/i;
- var binaryLiteral = /\d*\s*'s?b\s*[xz01][xz01_]*/i;
- var octLiteral = /\d*\s*'s?o\s*[xz0-7][xz0-7_]*/i;
- var hexLiteral = /\d*\s*'s?h\s*[0-9a-fxz?][0-9a-fxz?_]*/i;
- var realLiteral = /(\d[\d_]*(\.\d[\d_]*)?E-?[\d_]+)|(\d[\d_]*\.\d[\d_]*)/i;
-
- var closingBracketOrWord = /^((\w+)|[)}\]])/;
- var closingBracket = /[)}\]]/;
-
- var curPunc;
- var curKeyword;
-
- // Block openings which are closed by a matching keyword in the form of ("end" + keyword)
- // E.g. "task" => "endtask"
- var blockKeywords = words(
- "case checker class clocking config function generate interface module package" +
- "primitive program property specify sequence table task"
- );
-
- // Opening/closing pairs
- var openClose = {};
- for (var keyword in blockKeywords) {
- openClose[keyword] = "end" + keyword;
- }
- openClose["begin"] = "end";
- openClose["casex"] = "endcase";
- openClose["casez"] = "endcase";
- openClose["do" ] = "while";
- openClose["fork" ] = "join;join_any;join_none";
- openClose["covergroup"] = "endgroup";
-
- for (var i in noIndentKeywords) {
- var keyword = noIndentKeywords[i];
- if (openClose[keyword]) {
- openClose[keyword] = undefined;
- }
- }
-
- // Keywords which open statements that are ended with a semi-colon
- var statementKeywords = words("always always_comb always_ff always_latch assert assign assume else export for foreach forever if import initial repeat while");
-
- function tokenBase(stream, state) {
- var ch = stream.peek(), style;
- if (hooks[ch] && (style = hooks[ch](stream, state)) != false) return style;
- if (hooks.tokenBase && (style = hooks.tokenBase(stream, state)) != false)
- return style;
-
- if (/[,;:\.]/.test(ch)) {
- curPunc = stream.next();
- return null;
- }
- if (isBracketChar.test(ch)) {
- curPunc = stream.next();
- return "bracket";
- }
- // Macros (tick-defines)
- if (ch == '`') {
- stream.next();
- if (stream.eatWhile(/[\w\$_]/)) {
- return "def";
- } else {
- return null;
- }
- }
- // System calls
- if (ch == '$') {
- stream.next();
- if (stream.eatWhile(/[\w\$_]/)) {
- return "meta";
- } else {
- return null;
- }
- }
- // Time literals
- if (ch == '#') {
- stream.next();
- stream.eatWhile(/[\d_.]/);
- return "def";
- }
- // Strings
- if (ch == '"') {
- stream.next();
- state.tokenize = tokenString(ch);
- return state.tokenize(stream, state);
- }
- // Comments
- if (ch == "/") {
- stream.next();
- if (stream.eat("*")) {
- state.tokenize = tokenComment;
- return tokenComment(stream, state);
- }
- if (stream.eat("/")) {
- stream.skipToEnd();
- return "comment";
- }
- stream.backUp(1);
- }
-
- // Numeric literals
- if (stream.match(realLiteral) ||
- stream.match(decimalLiteral) ||
- stream.match(binaryLiteral) ||
- stream.match(octLiteral) ||
- stream.match(hexLiteral) ||
- stream.match(unsignedNumber) ||
- stream.match(realLiteral)) {
- return "number";
- }
-
- // Operators
- if (stream.eatWhile(isOperatorChar)) {
- return "meta";
- }
-
- // Keywords / plain variables
- if (stream.eatWhile(/[\w\$_]/)) {
- var cur = stream.current();
- if (keywords[cur]) {
- if (openClose[cur]) {
- curPunc = "newblock";
- }
- if (statementKeywords[cur]) {
- curPunc = "newstatement";
- }
- curKeyword = cur;
- return "keyword";
- }
- return "variable";
- }
-
- stream.next();
- return null;
- }
-
- function tokenString(quote) {
- return function(stream, state) {
- var escaped = false, next, end = false;
- while ((next = stream.next()) != null) {
- if (next == quote && !escaped) {end = true; break;}
- escaped = !escaped && next == "\\";
- }
- if (end || !(escaped || multiLineStrings))
- state.tokenize = tokenBase;
- return "string";
- };
- }
-
- function tokenComment(stream, state) {
- var maybeEnd = false, ch;
- while (ch = stream.next()) {
- if (ch == "/" && maybeEnd) {
- state.tokenize = tokenBase;
- break;
- }
- maybeEnd = (ch == "*");
- }
- return "comment";
- }
-
- function Context(indented, column, type, align, prev) {
- this.indented = indented;
- this.column = column;
- this.type = type;
- this.align = align;
- this.prev = prev;
- }
- function pushContext(state, col, type) {
- var indent = state.indented;
- var c = new Context(indent, col, type, null, state.context);
- return state.context = c;
- }
- function popContext(state) {
- var t = state.context.type;
- if (t == ")" || t == "]" || t == "}") {
- state.indented = state.context.indented;
- }
- return state.context = state.context.prev;
- }
-
- function isClosing(text, contextClosing) {
- if (text == contextClosing) {
- return true;
- } else {
- // contextClosing may be multiple keywords separated by ;
- var closingKeywords = contextClosing.split(";");
- for (var i in closingKeywords) {
- if (text == closingKeywords[i]) {
- return true;
- }
- }
- return false;
- }
- }
-
- function buildElectricInputRegEx() {
- // Reindentation should occur on any bracket char: {}()[]
- // or on a match of any of the block closing keywords, at
- // the end of a line
- var allClosings = [];
- for (var i in openClose) {
- if (openClose[i]) {
- var closings = openClose[i].split(";");
- for (var j in closings) {
- allClosings.push(closings[j]);
- }
- }
- }
- var re = new RegExp("[{}()\\[\\]]|(" + allClosings.join("|") + ")$");
- return re;
- }
-
- // Interface
- return {
-
- // Regex to force current line to reindent
- electricInput: buildElectricInputRegEx(),
-
- startState: function(basecolumn) {
- var state = {
- tokenize: null,
- context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
- indented: 0,
- startOfLine: true
- };
- if (hooks.startState) hooks.startState(state);
- return state;
- },
-
- 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 (hooks.token) hooks.token(stream, state);
- if (stream.eatSpace()) return null;
- curPunc = null;
- curKeyword = null;
- var style = (state.tokenize || tokenBase)(stream, state);
- if (style == "comment" || style == "meta" || style == "variable") return style;
- if (ctx.align == null) ctx.align = true;
-
- if (curPunc == ctx.type) {
- popContext(state);
- } else if ((curPunc == ";" && ctx.type == "statement") ||
- (ctx.type && isClosing(curKeyword, ctx.type))) {
- ctx = popContext(state);
- while (ctx && ctx.type == "statement") ctx = 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 (ctx && ctx.type == "endcase" && curPunc == ":") {
- pushContext(state, stream.column(), "statement");
- } else if (curPunc == "newstatement") {
- pushContext(state, stream.column(), "statement");
- } else if (curPunc == "newblock") {
- if (curKeyword == "function" && ctx && (ctx.type == "statement" || ctx.type == "endgroup")) {
- // The 'function' keyword can appear in some other contexts where it actually does not
- // indicate a function (import/export DPI and covergroup definitions).
- // Do nothing in this case
- } else if (curKeyword == "task" && ctx && ctx.type == "statement") {
- // Same thing for task
- } else {
- var close = openClose[curKeyword];
- pushContext(state, stream.column(), close);
- }
- }
-
- state.startOfLine = false;
- return style;
- },
-
- indent: function(state, textAfter) {
- if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass;
- if (hooks.indent) {
- var fromHook = hooks.indent(state);
- if (fromHook >= 0) return fromHook;
- }
- var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
- if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
- var closing = false;
- var possibleClosing = textAfter.match(closingBracketOrWord);
- if (possibleClosing)
- closing = isClosing(possibleClosing[0], ctx.type);
- if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
- else if (closingBracket.test(ctx.type) && ctx.align && !dontAlignCalls) return ctx.column + (closing ? 0 : 1);
- else if (ctx.type == ")" && !closing) return ctx.indented + statementIndentUnit;
- else return ctx.indented + (closing ? 0 : indentUnit);
- },
-
- blockCommentStart: "/*",
- blockCommentEnd: "*/",
- lineComment: "//"
- };
-});
-
- CodeMirror.defineMIME("text/x-verilog", {
- name: "verilog"
- });
-
- CodeMirror.defineMIME("text/x-systemverilog", {
- name: "verilog"
- });
-
- // TLVVerilog mode
-
- var tlvchScopePrefixes = {
- ">": "property", "->": "property", "-": "hr", "|": "link", "?$": "qualifier", "?*": "qualifier",
- "@-": "variable-3", "@": "variable-3", "?": "qualifier"
- };
-
- function tlvGenIndent(stream, state) {
- var tlvindentUnit = 2;
- var rtnIndent = -1, indentUnitRq = 0, curIndent = stream.indentation();
- switch (state.tlvCurCtlFlowChar) {
- case "\\":
- curIndent = 0;
- break;
- case "|":
- if (state.tlvPrevPrevCtlFlowChar == "@") {
- indentUnitRq = -2; //-2 new pipe rq after cur pipe
- break;
- }
- if (tlvchScopePrefixes[state.tlvPrevCtlFlowChar])
- indentUnitRq = 1; // +1 new scope
- break;
- case "M": // m4
- if (state.tlvPrevPrevCtlFlowChar == "@") {
- indentUnitRq = -2; //-2 new inst rq after pipe
- break;
- }
- if (tlvchScopePrefixes[state.tlvPrevCtlFlowChar])
- indentUnitRq = 1; // +1 new scope
- break;
- case "@":
- if (state.tlvPrevCtlFlowChar == "S")
- indentUnitRq = -1; // new pipe stage after stmts
- if (state.tlvPrevCtlFlowChar == "|")
- indentUnitRq = 1; // 1st pipe stage
- break;
- case "S":
- if (state.tlvPrevCtlFlowChar == "@")
- indentUnitRq = 1; // flow in pipe stage
- if (tlvchScopePrefixes[state.tlvPrevCtlFlowChar])
- indentUnitRq = 1; // +1 new scope
- break;
- }
- var statementIndentUnit = tlvindentUnit;
- rtnIndent = curIndent + (indentUnitRq*statementIndentUnit);
- return rtnIndent >= 0 ? rtnIndent : curIndent;
- }
-
- CodeMirror.defineMIME("text/x-tlv", {
- name: "verilog",
- hooks: {
- "\\": function(stream, state) {
- var vxIndent = 0, style = false;
- var curPunc = stream.string;
- if ((stream.sol()) && ((/\\SV/.test(stream.string)) || (/\\TLV/.test(stream.string)))) {
- curPunc = (/\\TLV_version/.test(stream.string))
- ? "\\TLV_version" : stream.string;
- stream.skipToEnd();
- if (curPunc == "\\SV" && state.vxCodeActive) {state.vxCodeActive = false;};
- if ((/\\TLV/.test(curPunc) && !state.vxCodeActive)
- || (curPunc=="\\TLV_version" && state.vxCodeActive)) {state.vxCodeActive = true;};
- style = "keyword";
- state.tlvCurCtlFlowChar = state.tlvPrevPrevCtlFlowChar
- = state.tlvPrevCtlFlowChar = "";
- if (state.vxCodeActive == true) {
- state.tlvCurCtlFlowChar = "\\";
- vxIndent = tlvGenIndent(stream, state);
- }
- state.vxIndentRq = vxIndent;
- }
- return style;
- },
- tokenBase: function(stream, state) {
- var vxIndent = 0, style = false;
- var tlvisOperatorChar = /[\[\]=:]/;
- var tlvkpScopePrefixs = {
- "**":"variable-2", "*":"variable-2", "$$":"variable", "$":"variable",
- "^^":"attribute", "^":"attribute"};
- var ch = stream.peek();
- var vxCurCtlFlowCharValueAtStart = state.tlvCurCtlFlowChar;
- if (state.vxCodeActive == true) {
- if (/[\[\]{}\(\);\:]/.test(ch)) {
- // bypass nesting and 1 char punc
- style = "meta";
- stream.next();
- } else if (ch == "/") {
- stream.next();
- if (stream.eat("/")) {
- stream.skipToEnd();
- style = "comment";
- state.tlvCurCtlFlowChar = "S";
- } else {
- stream.backUp(1);
- }
- } else if (ch == "@") {
- // pipeline stage
- style = tlvchScopePrefixes[ch];
- state.tlvCurCtlFlowChar = "@";
- stream.next();
- stream.eatWhile(/[\w\$_]/);
- } else if (stream.match(/\b[mM]4+/, true)) { // match: function(pattern, consume, caseInsensitive)
- // m4 pre proc
- stream.skipTo("(");
- style = "def";
- state.tlvCurCtlFlowChar = "M";
- } else if (ch == "!" && stream.sol()) {
- // v stmt in tlv region
- // state.tlvCurCtlFlowChar = "S";
- style = "comment";
- stream.next();
- } else if (tlvisOperatorChar.test(ch)) {
- // operators
- stream.eatWhile(tlvisOperatorChar);
- style = "operator";
- } else if (ch == "#") {
- // phy hier
- state.tlvCurCtlFlowChar = (state.tlvCurCtlFlowChar == "")
- ? ch : state.tlvCurCtlFlowChar;
- stream.next();
- stream.eatWhile(/[+-]\d/);
- style = "tag";
- } else if (tlvkpScopePrefixs.propertyIsEnumerable(ch)) {
- // special TLV operators
- style = tlvkpScopePrefixs[ch];
- state.tlvCurCtlFlowChar = state.tlvCurCtlFlowChar == "" ? "S" : state.tlvCurCtlFlowChar; // stmt
- stream.next();
- stream.match(/[a-zA-Z_0-9]+/);
- } else if (style = tlvchScopePrefixes[ch] || false) {
- // special TLV operators
- state.tlvCurCtlFlowChar = state.tlvCurCtlFlowChar == "" ? ch : state.tlvCurCtlFlowChar;
- stream.next();
- stream.match(/[a-zA-Z_0-9]+/);
- }
- if (state.tlvCurCtlFlowChar != vxCurCtlFlowCharValueAtStart) { // flow change
- vxIndent = tlvGenIndent(stream, state);
- state.vxIndentRq = vxIndent;
- }
- }
- return style;
- },
- token: function(stream, state) {
- if (state.vxCodeActive == true && stream.sol() && state.tlvCurCtlFlowChar != "") {
- state.tlvPrevPrevCtlFlowChar = state.tlvPrevCtlFlowChar;
- state.tlvPrevCtlFlowChar = state.tlvCurCtlFlowChar;
- state.tlvCurCtlFlowChar = "";
- }
- },
- indent: function(state) {
- return (state.vxCodeActive == true) ? state.vxIndentRq : -1;
- },
- startState: function(state) {
- state.tlvCurCtlFlowChar = "";
- state.tlvPrevCtlFlowChar = "";
- state.tlvPrevPrevCtlFlowChar = "";
- state.vxCodeActive = true;
- state.vxIndentRq = 0;
- }
- }
- });
-});
diff --git a/shared/codemirror/mode/vhdl/vhdl.js b/shared/codemirror/mode/vhdl/vhdl.js
deleted file mode 100644
index 97e086e..0000000
--- a/shared/codemirror/mode/vhdl/vhdl.js
+++ /dev/null
@@ -1,189 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-// Originally written by Alf Nielsen, re-written by Michael Zhou
-(function(mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"));
- else if (typeof define == "function" && define.amd) // AMD
- define(["../../lib/codemirror"], mod);
- else // Plain browser env
- mod(CodeMirror);
-})(function(CodeMirror) {
-"use strict";
-
-function words(str) {
- var obj = {}, words = str.split(",");
- for (var i = 0; i < words.length; ++i) {
- var allCaps = words[i].toUpperCase();
- var firstCap = words[i].charAt(0).toUpperCase() + words[i].slice(1);
- obj[words[i]] = true;
- obj[allCaps] = true;
- obj[firstCap] = true;
- }
- return obj;
-}
-
-function metaHook(stream) {
- stream.eatWhile(/[\w\$_]/);
- return "meta";
-}
-
-CodeMirror.defineMode("vhdl", function(config, parserConfig) {
- var indentUnit = config.indentUnit,
- atoms = parserConfig.atoms || words("null"),
- hooks = parserConfig.hooks || {"`": metaHook, "$": metaHook},
- multiLineStrings = parserConfig.multiLineStrings;
-
- var keywords = words("abs,access,after,alias,all,and,architecture,array,assert,attribute,begin,block," +
- "body,buffer,bus,case,component,configuration,constant,disconnect,downto,else,elsif,end,end block,end case," +
- "end component,end for,end generate,end if,end loop,end process,end record,end units,entity,exit,file,for," +
- "function,generate,generic,generic map,group,guarded,if,impure,in,inertial,inout,is,label,library,linkage," +
- "literal,loop,map,mod,nand,new,next,nor,null,of,on,open,or,others,out,package,package body,port,port map," +
- "postponed,procedure,process,pure,range,record,register,reject,rem,report,return,rol,ror,select,severity,signal," +
- "sla,sll,sra,srl,subtype,then,to,transport,type,unaffected,units,until,use,variable,wait,when,while,with,xnor,xor");
-
- var blockKeywords = words("architecture,entity,begin,case,port,else,elsif,end,for,function,if");
-
- var isOperatorChar = /[&|~>?]/;
-var integers = /^-?([1-9][0-9]*|0[Xx][0-9A-Fa-f]+|0[0-7]*)/;
-var floats = /^-?(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+)/;
-var identifiers = /^_?[A-Za-z][0-9A-Z_a-z-]*/;
-var identifiersEnd = /^_?[A-Za-z][0-9A-Z_a-z-]*(?=\s*;)/;
-var strings = /^"[^"]*"/;
-var multilineComments = /^\/\*.*?\*\//;
-var multilineCommentsStart = /^\/\*.*/;
-var multilineCommentsEnd = /^.*?\*\//;
-
-function readToken(stream, state) {
- // whitespace
- if (stream.eatSpace()) return null;
-
- // comment
- if (state.inComment) {
- if (stream.match(multilineCommentsEnd)) {
- state.inComment = false;
- return "comment";
- }
- stream.skipToEnd();
- return "comment";
- }
- if (stream.match("//")) {
- stream.skipToEnd();
- return "comment";
- }
- if (stream.match(multilineComments)) return "comment";
- if (stream.match(multilineCommentsStart)) {
- state.inComment = true;
- return "comment";
- }
-
- // integer and float
- if (stream.match(/^-?[0-9\.]/, false)) {
- if (stream.match(integers) || stream.match(floats)) return "number";
- }
-
- // string
- if (stream.match(strings)) return "string";
-
- // identifier
- if (state.startDef && stream.match(identifiers)) return "def";
-
- if (state.endDef && stream.match(identifiersEnd)) {
- state.endDef = false;
- return "def";
- }
-
- if (stream.match(keywords)) return "keyword";
-
- if (stream.match(types)) {
- var lastToken = state.lastToken;
- var nextToken = (stream.match(/^\s*(.+?)\b/, false) || [])[1];
-
- if (lastToken === ":" || lastToken === "implements" ||
- nextToken === "implements" || nextToken === "=") {
- // Used as identifier
- return "builtin";
- } else {
- // Used as type
- return "variable-3";
- }
- }
-
- if (stream.match(builtins)) return "builtin";
- if (stream.match(atoms)) return "atom";
- if (stream.match(identifiers)) return "variable";
-
- // other
- if (stream.match(singleOperators)) return "operator";
-
- // unrecognized
- stream.next();
- return null;
-};
-
-CodeMirror.defineMode("webidl", function() {
- return {
- startState: function() {
- return {
- // Is in multiline comment
- inComment: false,
- // Last non-whitespace, matched token
- lastToken: "",
- // Next token is a definition
- startDef: false,
- // Last token of the statement is a definition
- endDef: false
- };
- },
- token: function(stream, state) {
- var style = readToken(stream, state);
-
- if (style) {
- var cur = stream.current();
- state.lastToken = cur;
- if (style === "keyword") {
- state.startDef = startDefs.test(cur);
- state.endDef = state.endDef || endDefs.test(cur);
- } else {
- state.startDef = false;
- }
- }
-
- return style;
- }
- };
-});
-
-CodeMirror.defineMIME("text/x-webidl", "webidl");
-});
diff --git a/shared/codemirror/mode/xquery/xquery.js b/shared/codemirror/mode/xquery/xquery.js
deleted file mode 100644
index 75dcbee..0000000
--- a/shared/codemirror/mode/xquery/xquery.js
+++ /dev/null
@@ -1,437 +0,0 @@
-// 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("xquery", function() {
-
- // The keywords object is set to the result of this self executing
- // function. Each keyword is a property of the keywords object whose
- // value is {type: atype, style: astyle}
- var keywords = function(){
- // convenience functions used to build keywords object
- function kw(type) {return {type: type, style: "keyword"};}
- var A = kw("keyword a")
- , B = kw("keyword b")
- , C = kw("keyword c")
- , operator = kw("operator")
- , atom = {type: "atom", style: "atom"}
- , punctuation = {type: "punctuation", style: null}
- , qualifier = {type: "axis_specifier", style: "qualifier"};
-
- // kwObj is what is return from this function at the end
- var kwObj = {
- 'if': A, 'switch': A, 'while': A, 'for': A,
- 'else': B, 'then': B, 'try': B, 'finally': B, 'catch': B,
- 'element': C, 'attribute': C, 'let': C, 'implements': C, 'import': C, 'module': C, 'namespace': C,
- 'return': C, 'super': C, 'this': C, 'throws': C, 'where': C, 'private': C,
- ',': punctuation,
- 'null': atom, 'fn:false()': atom, 'fn:true()': atom
- };
-
- // a list of 'basic' keywords. For each add a property to kwObj with the value of
- // {type: basic[i], style: "keyword"} e.g. 'after' --> {type: "after", style: "keyword"}
- var basic = ['after','ancestor','ancestor-or-self','and','as','ascending','assert','attribute','before',
- 'by','case','cast','child','comment','declare','default','define','descendant','descendant-or-self',
- 'descending','document','document-node','element','else','eq','every','except','external','following',
- 'following-sibling','follows','for','function','if','import','in','instance','intersect','item',
- 'let','module','namespace','node','node','of','only','or','order','parent','precedes','preceding',
- 'preceding-sibling','processing-instruction','ref','return','returns','satisfies','schema','schema-element',
- 'self','some','sortby','stable','text','then','to','treat','typeswitch','union','variable','version','where',
- 'xquery', 'empty-sequence'];
- for(var i=0, l=basic.length; i < l; i++) { kwObj[basic[i]] = kw(basic[i]);};
-
- // a list of types. For each add a property to kwObj with the value of
- // {type: "atom", style: "atom"}
- var types = ['xs:string', 'xs:float', 'xs:decimal', 'xs:double', 'xs:integer', 'xs:boolean', 'xs:date', 'xs:dateTime',
- 'xs:time', 'xs:duration', 'xs:dayTimeDuration', 'xs:time', 'xs:yearMonthDuration', 'numeric', 'xs:hexBinary',
- 'xs:base64Binary', 'xs:anyURI', 'xs:QName', 'xs:byte','xs:boolean','xs:anyURI','xf:yearMonthDuration'];
- for(var i=0, l=types.length; i < l; i++) { kwObj[types[i]] = atom;};
-
- // each operator will add a property to kwObj with value of {type: "operator", style: "keyword"}
- var operators = ['eq', 'ne', 'lt', 'le', 'gt', 'ge', ':=', '=', '>', '>=', '<', '<=', '.', '|', '?', 'and', 'or', 'div', 'idiv', 'mod', '*', '/', '+', '-'];
- for(var i=0, l=operators.length; i < l; i++) { kwObj[operators[i]] = operator;};
-
- // each axis_specifiers will add a property to kwObj with value of {type: "axis_specifier", style: "qualifier"}
- var axis_specifiers = ["self::", "attribute::", "child::", "descendant::", "descendant-or-self::", "parent::",
- "ancestor::", "ancestor-or-self::", "following::", "preceding::", "following-sibling::", "preceding-sibling::"];
- for(var i=0, l=axis_specifiers.length; i < l; i++) { kwObj[axis_specifiers[i]] = qualifier; };
-
- return kwObj;
- }();
-
- function chain(stream, state, f) {
- state.tokenize = f;
- return f(stream, state);
- }
-
- // the primary mode tokenizer
- function tokenBase(stream, state) {
- var ch = stream.next(),
- mightBeFunction = false,
- isEQName = isEQNameAhead(stream);
-
- // an XML tag (if not in some sub, chained tokenizer)
- if (ch == "<") {
- if(stream.match("!--", true))
- return chain(stream, state, tokenXMLComment);
-
- if(stream.match("![CDATA", false)) {
- state.tokenize = tokenCDATA;
- return "tag";
- }
-
- if(stream.match("?", false)) {
- return chain(stream, state, tokenPreProcessing);
- }
-
- var isclose = stream.eat("/");
- stream.eatSpace();
- var tagName = "", c;
- while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
-
- return chain(stream, state, tokenTag(tagName, isclose));
- }
- // start code block
- else if(ch == "{") {
- pushStateStack(state,{ type: "codeblock"});
- return null;
- }
- // end code block
- else if(ch == "}") {
- popStateStack(state);
- return null;
- }
- // if we're in an XML block
- else if(isInXmlBlock(state)) {
- if(ch == ">")
- return "tag";
- else if(ch == "/" && stream.eat(">")) {
- popStateStack(state);
- return "tag";
- }
- else
- return "variable";
- }
- // if a number
- else if (/\d/.test(ch)) {
- stream.match(/^\d*(?:\.\d*)?(?:E[+\-]?\d+)?/);
- return "atom";
- }
- // comment start
- else if (ch === "(" && stream.eat(":")) {
- pushStateStack(state, { type: "comment"});
- return chain(stream, state, tokenComment);
- }
- // quoted string
- else if ( !isEQName && (ch === '"' || ch === "'"))
- return chain(stream, state, tokenString(ch));
- // variable
- else if(ch === "$") {
- return chain(stream, state, tokenVariable);
- }
- // assignment
- else if(ch ===":" && stream.eat("=")) {
- return "keyword";
- }
- // open paren
- else if(ch === "(") {
- pushStateStack(state, { type: "paren"});
- return null;
- }
- // close paren
- else if(ch === ")") {
- popStateStack(state);
- return null;
- }
- // open paren
- else if(ch === "[") {
- pushStateStack(state, { type: "bracket"});
- return null;
- }
- // close paren
- else if(ch === "]") {
- popStateStack(state);
- return null;
- }
- else {
- var known = keywords.propertyIsEnumerable(ch) && keywords[ch];
-
- // if there's a EQName ahead, consume the rest of the string portion, it's likely a function
- if(isEQName && ch === '\"') while(stream.next() !== '"'){}
- if(isEQName && ch === '\'') while(stream.next() !== '\''){}
-
- // gobble up a word if the character is not known
- if(!known) stream.eatWhile(/[\w\$_-]/);
-
- // gobble a colon in the case that is a lib func type call fn:doc
- var foundColon = stream.eat(":");
-
- // if there's not a second colon, gobble another word. Otherwise, it's probably an axis specifier
- // which should get matched as a keyword
- if(!stream.eat(":") && foundColon) {
- stream.eatWhile(/[\w\$_-]/);
- }
- // if the next non whitespace character is an open paren, this is probably a function (if not a keyword of other sort)
- if(stream.match(/^[ \t]*\(/, false)) {
- mightBeFunction = true;
- }
- // is the word a keyword?
- var word = stream.current();
- known = keywords.propertyIsEnumerable(word) && keywords[word];
-
- // if we think it's a function call but not yet known,
- // set style to variable for now for lack of something better
- if(mightBeFunction && !known) known = {type: "function_call", style: "variable def"};
-
- // if the previous word was element, attribute, axis specifier, this word should be the name of that
- if(isInXmlConstructor(state)) {
- popStateStack(state);
- 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 ? known.style : "variable";
- }
- }
-
- // handle comments, including nested
- function tokenComment(stream, state) {
- var maybeEnd = false, maybeNested = false, nestedCount = 0, ch;
- while (ch = stream.next()) {
- if (ch == ")" && maybeEnd) {
- if(nestedCount > 0)
- nestedCount--;
- else {
- popStateStack(state);
- break;
- }
- }
- else if(ch == ":" && maybeNested) {
- nestedCount++;
- }
- maybeEnd = (ch == ":");
- maybeNested = (ch == "(");
- }
-
- return "comment";
- }
-
- // tokenizer for string literals
- // optionally pass a tokenizer function to set state.tokenize back to when finished
- function tokenString(quote, f) {
- return function(stream, state) {
- var ch;
-
- if(isInString(state) && stream.current() == quote) {
- popStateStack(state);
- if(f) state.tokenize = f;
- return "string";
- }
-
- pushStateStack(state, { type: "string", name: quote, tokenize: tokenString(quote, f) });
-
- // 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 "string";
- }
-
-
- while (ch = stream.next()) {
- if (ch == quote) {
- popStateStack(state);
- if(f) state.tokenize = f;
- break;
- }
- else {
- // 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 "string";
- }
-
- }
- }
-
- return "string";
- };
- }
-
- // tokenizer for variables
- function tokenVariable(stream, state) {
- var isVariableChar = /[\w\$_-]/;
-
- // a variable may start with a quoted EQName so if the next character is quote, consume to the next quote
- if(stream.eat("\"")) {
- while(stream.next() !== '\"'){};
- stream.eat(":");
- } else {
- stream.eatWhile(isVariableChar);
- if(!stream.match(":=", false)) stream.eat(":");
- }
- stream.eatWhile(isVariableChar);
- state.tokenize = tokenBase;
- return "variable";
- }
-
- // tokenizer for XML tags
- function tokenTag(name, isclose) {
- return function(stream, state) {
- stream.eatSpace();
- if(isclose && stream.eat(">")) {
- popStateStack(state);
- state.tokenize = tokenBase;
- 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 "tag";
- }
- else {
- state.tokenize = tokenBase;
- }
- return "tag";
- };
- }
-
- // tokenizer for XML attributes
- function tokenAttribute(stream, state) {
- var ch = stream.next();
-
- if(ch == "/" && stream.eat(">")) {
- if(isInXmlAttributeBlock(state)) popStateStack(state);
- if(isInXmlBlock(state)) popStateStack(state);
- return "tag";
- }
- if(ch == ">") {
- if(isInXmlAttributeBlock(state)) popStateStack(state);
- return "tag";
- }
- if(ch == "=")
- return null;
- // quoted string
- if (ch == '"' || ch == "'")
- return chain(stream, state, tokenString(ch, tokenAttribute));
-
- if(!isInXmlAttributeBlock(state))
- pushStateStack(state, { type: "attribute", tokenize: tokenAttribute});
-
- stream.eat(/[a-zA-Z_:]/);
- stream.eatWhile(/[-a-zA-Z0-9_:.]/);
- stream.eatSpace();
-
- // the case where the attribute has not value and the tag was closed
- if(stream.match(">", false) || stream.match("/", false)) {
- popStateStack(state);
- state.tokenize = tokenBase;
- }
-
- return "attribute";
- }
-
- // handle comments, including nested
- function tokenXMLComment(stream, state) {
- var ch;
- while (ch = stream.next()) {
- if (ch == "-" && stream.match("->", true)) {
- state.tokenize = tokenBase;
- return "comment";
- }
- }
- }
-
-
- // handle CDATA
- function tokenCDATA(stream, state) {
- var ch;
- while (ch = stream.next()) {
- if (ch == "]" && stream.match("]", true)) {
- state.tokenize = tokenBase;
- return "comment";
- }
- }
- }
-
- // handle preprocessing instructions
- function tokenPreProcessing(stream, state) {
- var ch;
- while (ch = stream.next()) {
- if (ch == "?" && stream.match(">", true)) {
- state.tokenize = tokenBase;
- return "comment meta";
- }
- }
- }
-
-
- // functions to test the current context of the state
- function isInXmlBlock(state) { return isIn(state, "tag"); }
- function isInXmlAttributeBlock(state) { return isIn(state, "attribute"); }
- function isInXmlConstructor(state) { return isIn(state, "xmlconstructor"); }
- function isInString(state) { return isIn(state, "string"); }
-
- function isEQNameAhead(stream) {
- // assume we've already eaten a quote (")
- if(stream.current() === '"')
- return stream.match(/^[^\"]+\"\:/, false);
- else if(stream.current() === '\'')
- return stream.match(/^[^\"]+\'\:/, false);
- else
- return false;
- }
-
- function isIn(state, type) {
- return (state.stack.length && state.stack[state.stack.length - 1].type == type);
- }
-
- function pushStateStack(state, newState) {
- state.stack.push(newState);
- }
-
- function popStateStack(state) {
- state.stack.pop();
- var reinstateTokenize = state.stack.length && state.stack[state.stack.length-1].tokenize;
- state.tokenize = reinstateTokenize || tokenBase;
- }
-
- // the interface for the mode API
- return {
- startState: function() {
- return {
- tokenize: tokenBase,
- cc: [],
- stack: []
- };
- },
-
- token: function(stream, state) {
- if (stream.eatSpace()) return null;
- var style = state.tokenize(stream, state);
- return style;
- },
-
- blockCommentStart: "(:",
- blockCommentEnd: ":)"
-
- };
-
-});
-
-CodeMirror.defineMIME("application/xquery", "xquery");
-
-});
diff --git a/shared/codemirror/mode/yacas/yacas.js b/shared/codemirror/mode/yacas/yacas.js
deleted file mode 100644
index 30bd60b..0000000
--- a/shared/codemirror/mode/yacas/yacas.js
+++ /dev/null
@@ -1,204 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-// Yacas mode copyright (c) 2015 by Grzegorz Mazur
-// Loosely based on mathematica mode by Calin Barbat
-
-(function(mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"));
- else if (typeof define == "function" && define.amd) // AMD
- define(["../../lib/codemirror"], mod);
- else // Plain browser env
- mod(CodeMirror);
-})(function(CodeMirror) {
-"use strict";
-
-CodeMirror.defineMode('yacas', function(_config, _parserConfig) {
-
- function words(str) {
- var obj = {}, words = str.split(" ");
- for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
- return obj;
- }
-
- var bodiedOps = words("Assert BackQuote D Defun Deriv For ForEach FromFile " +
- "FromString Function Integrate InverseTaylor Limit " +
- "LocalSymbols Macro MacroRule MacroRulePattern " +
- "NIntegrate Rule RulePattern Subst TD TExplicitSum " +
- "TSum Taylor Taylor1 Taylor2 Taylor3 ToFile " +
- "ToStdout ToString TraceRule Until While");
-
- // patterns
- var pFloatForm = "(?:(?:\\.\\d+|\\d+\\.\\d*|\\d+)(?:[eE][+-]?\\d+)?)";
- var pIdentifier = "(?:[a-zA-Z\\$'][a-zA-Z0-9\\$']*)";
-
- // regular expressions
- var reFloatForm = new RegExp(pFloatForm);
- var reIdentifier = new RegExp(pIdentifier);
- var rePattern = new RegExp(pIdentifier + "?_" + pIdentifier);
- var reFunctionLike = new RegExp(pIdentifier + "\\s*\\(");
-
- function tokenBase(stream, state) {
- var ch;
-
- // get next character
- ch = stream.next();
-
- // string
- if (ch === '"') {
- state.tokenize = tokenString;
- return state.tokenize(stream, state);
- }
-
- // comment
- if (ch === '/') {
- if (stream.eat('*')) {
- state.tokenize = tokenComment;
- return state.tokenize(stream, state);
- }
- if (stream.eat("/")) {
- stream.skipToEnd();
- return "comment";
- }
- }
-
- // go back one character
- stream.backUp(1);
-
- // update scope info
- var m = stream.match(/^(\w+)\s*\(/, false);
- if (m !== null && bodiedOps.hasOwnProperty(m[1]))
- state.scopes.push('bodied');
-
- var scope = currentScope(state);
-
- if (scope === 'bodied' && ch === '[')
- state.scopes.pop();
-
- if (ch === '[' || ch === '{' || ch === '(')
- state.scopes.push(ch);
-
- scope = currentScope(state);
-
- if (scope === '[' && ch === ']' ||
- scope === '{' && ch === '}' ||
- scope === '(' && ch === ')')
- state.scopes.pop();
-
- if (ch === ';') {
- while (scope === 'bodied') {
- state.scopes.pop();
- scope = currentScope(state);
- }
- }
-
- // look for ordered rules
- if (stream.match(/\d+ *#/, true, false)) {
- return 'qualifier';
- }
-
- // look for numbers
- if (stream.match(reFloatForm, true, false)) {
- return 'number';
- }
-
- // look for placeholders
- if (stream.match(rePattern, true, false)) {
- return 'variable-3';
- }
-
- // match all braces separately
- if (stream.match(/(?:\[|\]|{|}|\(|\))/, true, false)) {
- return 'bracket';
- }
-
- // literals looking like function calls
- if (stream.match(reFunctionLike, true, false)) {
- stream.backUp(1);
- return 'variable';
- }
-
- // all other identifiers
- if (stream.match(reIdentifier, true, false)) {
- return 'variable-2';
- }
-
- // operators; note that operators like @@ or /; are matched separately for each symbol.
- if (stream.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/, true, false)) {
- return 'operator';
- }
-
- // everything else is an error
- return 'error';
- }
-
- function tokenString(stream, state) {
- var next, end = false, escaped = false;
- while ((next = stream.next()) != null) {
- if (next === '"' && !escaped) {
- end = true;
- break;
- }
- escaped = !escaped && next === '\\';
- }
- if (end && !escaped) {
- state.tokenize = tokenBase;
- }
- return 'string';
- };
-
- function tokenComment(stream, state) {
- var prev, next;
- while((next = stream.next()) != null) {
- if (prev === '*' && next === '/') {
- state.tokenize = tokenBase;
- break;
- }
- prev = next;
- }
- return 'comment';
- }
-
- function currentScope(state) {
- var scope = null;
- if (state.scopes.length > 0)
- scope = state.scopes[state.scopes.length - 1];
- return scope;
- }
-
- return {
- startState: function() {
- return {
- tokenize: tokenBase,
- scopes: []
- };
- },
- token: function(stream, state) {
- if (stream.eatSpace()) return null;
- return state.tokenize(stream, state);
- },
- indent: function(state, textAfter) {
- if (state.tokenize !== tokenBase && state.tokenize !== null)
- return CodeMirror.Pass;
-
- var delta = 0;
- if (textAfter === ']' || textAfter === '];' ||
- textAfter === '}' || textAfter === '};' ||
- textAfter === ');')
- delta = -1;
-
- return (state.scopes.length + delta) * _config.indentUnit;
- },
- electricChars: "{}[]();",
- blockCommentStart: "/*",
- blockCommentEnd: "*/",
- lineComment: "//"
- };
-});
-
-CodeMirror.defineMIME('text/x-yacas', {
- name: 'yacas'
-});
-
-});
diff --git a/shared/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js b/shared/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js
deleted file mode 100644
index 5f49772..0000000
--- a/shared/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js
+++ /dev/null
@@ -1,68 +0,0 @@
-// 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"), require("../yaml/yaml"))
- else if (typeof define == "function" && define.amd) // AMD
- define(["../../lib/codemirror", "../yaml/yaml"], mod)
- else // Plain browser env
- mod(CodeMirror)
-})(function (CodeMirror) {
-
- var START = 0, FRONTMATTER = 1, BODY = 2
-
- // a mixed mode for Markdown text with an optional YAML front matter
- CodeMirror.defineMode("yaml-frontmatter", function (config, parserConfig) {
- var yamlMode = CodeMirror.getMode(config, "yaml")
- var innerMode = CodeMirror.getMode(config, parserConfig && parserConfig.base || "gfm")
-
- function curMode(state) {
- return state.state == BODY ? innerMode : yamlMode
- }
-
- return {
- startState: function () {
- return {
- state: START,
- inner: CodeMirror.startState(yamlMode)
- }
- },
- copyState: function (state) {
- return {
- state: state.state,
- inner: CodeMirror.copyState(curMode(state), state.inner)
- }
- },
- token: function (stream, state) {
- if (state.state == START) {
- if (stream.match(/---/, false)) {
- state.state = FRONTMATTER
- return yamlMode.token(stream, state.inner)
- } else {
- state.state = BODY
- state.inner = CodeMirror.startState(innerMode)
- return innerMode.token(stream, state.inner)
- }
- } else if (state.state == FRONTMATTER) {
- var end = stream.sol() && stream.match(/---/, false)
- var style = yamlMode.token(stream, state.inner)
- if (end) {
- state.state = BODY
- state.inner = CodeMirror.startState(innerMode)
- }
- return style
- } else {
- return innerMode.token(stream, state.inner)
- }
- },
- innerMode: function (state) {
- return {mode: curMode(state), state: state.inner}
- },
- blankLine: function (state) {
- var mode = curMode(state)
- if (mode.blankLine) return mode.blankLine(state.inner)
- }
- }
- })
-});
diff --git a/shared/codemirror/mode/yaml/yaml.js b/shared/codemirror/mode/yaml/yaml.js
deleted file mode 100644
index b7015e5..0000000
--- a/shared/codemirror/mode/yaml/yaml.js
+++ /dev/null
@@ -1,117 +0,0 @@
-// 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("yaml", function() {
-
- var cons = ['true', 'false', 'on', 'off', 'yes', 'no'];
- var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i');
-
- return {
- token: function(stream, state) {
- var ch = stream.peek();
- var esc = state.escaped;
- state.escaped = false;
- /* comments */
- if (ch == "#" && (stream.pos == 0 || /\s/.test(stream.string.charAt(stream.pos - 1)))) {
- stream.skipToEnd();
- return "comment";
- }
-
- if (stream.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))
- return "string";
-
- if (state.literal && stream.indentation() > state.keyCol) {
- stream.skipToEnd(); return "string";
- } else if (state.literal) { state.literal = false; }
- if (stream.sol()) {
- state.keyCol = 0;
- state.pair = false;
- state.pairStart = false;
- /* document start */
- if(stream.match(/---/)) { return "def"; }
- /* document end */
- if (stream.match(/\.\.\./)) { return "def"; }
- /* array list item */
- if (stream.match(/\s*-\s+/)) { return 'meta'; }
- }
- /* inline pairs/lists */
- if (stream.match(/^(\{|\}|\[|\])/)) {
- if (ch == '{')
- state.inlinePairs++;
- else if (ch == '}')
- state.inlinePairs--;
- else if (ch == '[')
- state.inlineList++;
- else
- state.inlineList--;
- return 'meta';
- }
-
- /* list seperator */
- if (state.inlineList > 0 && !esc && ch == ',') {
- stream.next();
- return 'meta';
- }
- /* pairs seperator */
- if (state.inlinePairs > 0 && !esc && ch == ',') {
- state.keyCol = 0;
- state.pair = false;
- state.pairStart = false;
- stream.next();
- return 'meta';
- }
-
- /* start of value of a pair */
- if (state.pairStart) {
- /* block literals */
- if (stream.match(/^\s*(\||\>)\s*/)) { state.literal = true; return 'meta'; };
- /* references */
- if (stream.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) { return 'variable-2'; }
- /* numbers */
- if (state.inlinePairs == 0 && stream.match(/^\s*-?[0-9\.\,]+\s?$/)) { return 'number'; }
- if (state.inlinePairs > 0 && stream.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/)) { return 'number'; }
- /* keywords */
- if (stream.match(keywordRegex)) { return 'keyword'; }
- }
-
- /* pairs (associative arrays) -> key */
- if (!state.pair && stream.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)) {
- state.pair = true;
- state.keyCol = stream.indentation();
- return "atom";
- }
- if (state.pair && stream.match(/^:\s*/)) { state.pairStart = true; return 'meta'; }
-
- /* nothing found, continue */
- state.pairStart = false;
- state.escaped = (ch == '\\');
- stream.next();
- return null;
- },
- startState: function() {
- return {
- pair: false,
- pairStart: false,
- keyCol: 0,
- inlinePairs: 0,
- inlineList: 0,
- literal: false,
- escaped: false
- };
- }
- };
-});
-
-CodeMirror.defineMIME("text/x-yaml", "yaml");
-
-});
diff --git a/shared/codemirror/mode/z80/z80.js b/shared/codemirror/mode/z80/z80.js
deleted file mode 100644
index aae7021..0000000
--- a/shared/codemirror/mode/z80/z80.js
+++ /dev/null
@@ -1,116 +0,0 @@
-// 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('z80', function(_config, parserConfig) {
- var ez80 = parserConfig.ez80;
- var keywords1, keywords2;
- if (ez80) {
- keywords1 = /^(exx?|(ld|cp)([di]r?)?|[lp]ea|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|[de]i|halt|im|in([di]mr?|ir?|irx|2r?)|ot(dmr?|[id]rx|imr?)|out(0?|[di]r?|[di]2r?)|tst(io)?|slp)(\.([sl]?i)?[sl])?\b/i;
- keywords2 = /^(((call|j[pr]|rst|ret[in]?)(\.([sl]?i)?[sl])?)|(rs|st)mix)\b/i;
- } else {
- keywords1 = /^(exx?|(ld|cp|in)([di]r?)?|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|rst|[de]i|halt|im|ot[di]r|out[di]?)\b/i;
- keywords2 = /^(call|j[pr]|ret[in]?|b_?(call|jump))\b/i;
- }
-
- var variables1 = /^(af?|bc?|c|de?|e|hl?|l|i[xy]?|r|sp)\b/i;
- var variables2 = /^(n?[zc]|p[oe]?|m)\b/i;
- var errors = /^([hl][xy]|i[xy][hl]|slia|sll)\b/i;
- var numbers = /^([\da-f]+h|[0-7]+o|[01]+b|\d+d?)\b/i;
-
- return {
- startState: function() {
- return {
- context: 0
- };
- },
- token: function(stream, state) {
- if (!stream.column())
- state.context = 0;
-
- if (stream.eatSpace())
- return null;
-
- var w;
-
- if (stream.eatWhile(/\w/)) {
- if (ez80 && stream.eat('.')) {
- stream.eatWhile(/\w/);
- }
- w = stream.current();
-
- if (stream.indentation()) {
- if ((state.context == 1 || state.context == 4) && variables1.test(w)) {
- state.context = 4;
- return 'var2';
- }
-
- if (state.context == 2 && variables2.test(w)) {
- state.context = 4;
- return 'var3';
- }
-
- if (keywords1.test(w)) {
- state.context = 1;
- return 'keyword';
- } else if (keywords2.test(w)) {
- state.context = 2;
- return 'keyword';
- } else if (state.context == 4 && numbers.test(w)) {
- return 'number';
- }
-
- if (errors.test(w))
- return 'error';
- } else if (stream.match(numbers)) {
- return 'number';
- } else {
- return null;
- }
- } else if (stream.eat(';')) {
- stream.skipToEnd();
- return 'comment';
- } else if (stream.eat('"')) {
- while (w = stream.next()) {
- if (w == '"')
- break;
-
- if (w == '\\')
- stream.next();
- }
- return 'string';
- } else if (stream.eat('\'')) {
- if (stream.match(/\\?.'/))
- return 'number';
- } else if (stream.eat('.') || stream.sol() && stream.eat('#')) {
- state.context = 5;
-
- if (stream.eatWhile(/\w/))
- return 'def';
- } else if (stream.eat('$')) {
- if (stream.eatWhile(/[\da-f]/i))
- return 'number';
- } else if (stream.eat('%')) {
- if (stream.eatWhile(/[01]/))
- return 'number';
- } else {
- stream.next();
- }
- return null;
- }
- };
-});
-
-CodeMirror.defineMIME("text/x-z80", "z80");
-CodeMirror.defineMIME("text/x-ez80", { name: "z80", ez80: true });
-
-});
diff --git a/shared/naturalCrit/codeEditor/codeEditor.jsx b/shared/naturalCrit/codeEditor/codeEditor.jsx
index fae1516..7b60c7e 100644
--- a/shared/naturalCrit/codeEditor/codeEditor.jsx
+++ b/shared/naturalCrit/codeEditor/codeEditor.jsx
@@ -16,23 +16,40 @@ if(typeof navigator !== 'undefined'){
var CodeEditor = React.createClass({
getDefaultProps: function() {
return {
- language : 'javascript',
- text : 'yo dawg',
- onChange : function(){}
+ language : '',
+ value : '',
+ onChange : function(){},
+ onCursorActivity : function(){},
};
},
componentDidMount: function() {
- this.editor = CodeMirror(this.refs.editor,{
+ this.codeMirror = CodeMirror(this.refs.editor,{
+ value : this.props.value,
lineNumbers: true,
mode : this.props.language
});
+
+ this.codeMirror.on('change', this.handleChange);
+ this.codeMirror.on('cursorActivity', this.handleCursorActivity);
+ },
+
+ componentWillReceiveProps: _.debounce((nextProps)=>{
+ if(this.codeMirror && nextProps.value !== undefined && this.codeMirror.getValue() != nextProps.value) {
+ this.codeMirror.setValue(nextProps.value);
+ }
+ }, 0),
+
+
+ handleChange : function(editor){
+ this.props.onChange(editor.getValue());
+ },
+ handleCursorActivity : function(){
+ this.props.onCursorActivity(this.codeMirror.getCursor());
},
render : function(){
- return
- CodeEditor Ready!
-
+ return
}
});
diff --git a/todo.md b/todo.md
index 4690d1f..9df6f97 100644
--- a/todo.md
+++ b/todo.md
@@ -6,8 +6,8 @@ X Simplify the panel css to remove the current issues
- Build new `BrewRenderer`, clean support for partial rendering
- Add `infoBox` to BrewRenderer to show views, and current pages
- remove old status bar
-- remove jsoneditor (if we don't need it)
-- Add in markdown editor
+X remove jsoneditor (if we don't need it)
+X Add in markdown editor
- Add bleed snippet (bump)
- Add the '/new' page and force save to reduce database size
X Add pagniation and query to the homebrew api
@@ -16,7 +16,7 @@ X Test the old/small brew filtering for deleteion
- Partial rendering kills style tags on unrendered pages. Detect if pages have style tags and render them.
- Add in the link of Pateron?
- Add in brew title, use for metadata?
-
+- Add in specific entry point rendering in server.js
- Add in a tutorial page?
## v1.6