diff options
author | Wu Cheng-Han | 2016-01-17 14:28:04 -0600 |
---|---|---|
committer | Wu Cheng-Han | 2016-01-17 14:28:04 -0600 |
commit | eaa8ccaccb1091820d0a8d1223996a6dd057347d (patch) | |
tree | 6b4aaa3b3d1a2fed68147510142663222533775a /public/vendor/codemirror/mode/d | |
parent | ce65e58096d57ace02723d11a125673f9d48c293 (diff) |
Upgrade CodeMirror to 5.10.1 and now support fullscreen, jump-to-line in editor
Diffstat (limited to '')
-rw-r--r--[-rwxr-xr-x] | public/vendor/codemirror/mode/d/d.js | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | public/vendor/codemirror/mode/d/index.html | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | public/vendor/codemirror/mode/dart/dart.js | 86 | ||||
-rw-r--r--[-rwxr-xr-x] | public/vendor/codemirror/mode/dart/index.html | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | public/vendor/codemirror/mode/diff/diff.js | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | public/vendor/codemirror/mode/diff/index.html | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | public/vendor/codemirror/mode/django/django.js | 25 | ||||
-rw-r--r--[-rwxr-xr-x] | public/vendor/codemirror/mode/django/index.html | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | public/vendor/codemirror/mode/dockerfile/dockerfile.js | 5 | ||||
-rw-r--r--[-rwxr-xr-x] | public/vendor/codemirror/mode/dockerfile/index.html | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | public/vendor/codemirror/mode/dtd/dtd.js | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | public/vendor/codemirror/mode/dtd/index.html | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | public/vendor/codemirror/mode/dylan/dylan.js | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | public/vendor/codemirror/mode/dylan/index.html | 0 |
14 files changed, 103 insertions, 13 deletions
diff --git a/public/vendor/codemirror/mode/d/d.js b/public/vendor/codemirror/mode/d/d.js index c927a7e3..c927a7e3 100755..100644 --- a/public/vendor/codemirror/mode/d/d.js +++ b/public/vendor/codemirror/mode/d/d.js diff --git a/public/vendor/codemirror/mode/d/index.html b/public/vendor/codemirror/mode/d/index.html index 08cabd8a..08cabd8a 100755..100644 --- a/public/vendor/codemirror/mode/d/index.html +++ b/public/vendor/codemirror/mode/d/index.html diff --git a/public/vendor/codemirror/mode/dart/dart.js b/public/vendor/codemirror/mode/dart/dart.js index a49e218c..d92eb519 100755..100644 --- a/public/vendor/codemirror/mode/dart/dart.js +++ b/public/vendor/codemirror/mode/dart/dart.js @@ -15,7 +15,7 @@ "implements get native operator set typedef with enum throw rethrow " + "assert break case continue default in return new deferred async await " + "try catch finally do else for if switch while import library export " + - "part of show hide is").split(" "); + "part of show hide is as").split(" "); var blockKeywords = "try catch finally do else for if switch while".split(" "); var atoms = "true false null".split(" "); var builtins = "void bool num int double dynamic var String".split(" "); @@ -26,21 +26,101 @@ return obj; } + function pushInterpolationStack(state) { + (state.interpolationStack || (state.interpolationStack = [])).push(state.tokenize); + } + + function popInterpolationStack(state) { + return (state.interpolationStack || (state.interpolationStack = [])).pop(); + } + + function sizeInterpolationStack(state) { + return state.interpolationStack ? state.interpolationStack.length : 0; + } + CodeMirror.defineMIME("application/dart", { name: "clike", keywords: set(keywords), - multiLineStrings: true, blockKeywords: set(blockKeywords), builtin: set(builtins), atoms: set(atoms), hooks: { "@": function(stream) { - stream.eatWhile(/[\w\$_]/); + stream.eatWhile(/[\w\$_\.]/); return "meta"; + }, + + // custom string handling to deal with triple-quoted strings and string interpolation + "'": function(stream, state) { + return tokenString("'", stream, state, false); + }, + "\"": function(stream, state) { + return tokenString("\"", stream, state, false); + }, + "r": function(stream, state) { + var peek = stream.peek(); + if (peek == "'" || peek == "\"") { + return tokenString(stream.next(), stream, state, true); + } + return false; + }, + + "}": function(_stream, state) { + // "}" is end of interpolation, if interpolation stack is non-empty + if (sizeInterpolationStack(state) > 0) { + state.tokenize = popInterpolationStack(state); + return null; + } + return false; } } }); + function tokenString(quote, stream, state, raw) { + var tripleQuoted = false; + if (stream.eat(quote)) { + if (stream.eat(quote)) tripleQuoted = true; + else return "string"; //empty string + } + function tokenStringHelper(stream, state) { + var escaped = false; + while (!stream.eol()) { + if (!raw && !escaped && stream.peek() == "$") { + pushInterpolationStack(state); + state.tokenize = tokenInterpolation; + return "string"; + } + var next = stream.next(); + if (next == quote && !escaped && (!tripleQuoted || stream.match(quote + quote))) { + state.tokenize = null; + break; + } + escaped = !raw && !escaped && next == "\\"; + } + return "string"; + } + state.tokenize = tokenStringHelper; + return tokenStringHelper(stream, state); + } + + function tokenInterpolation(stream, state) { + stream.eat("$"); + if (stream.eat("{")) { + // let clike handle the content of ${...}, + // we take over again when "}" appears (see hooks). + state.tokenize = null; + } else { + state.tokenize = tokenInterpolationIdentifier; + } + return null; + } + + function tokenInterpolationIdentifier(stream, state) { + stream.eatWhile(/[\w_]/); + state.tokenize = popInterpolationStack(state); + return "variable"; + } + CodeMirror.registerHelper("hintWords", "application/dart", keywords.concat(atoms).concat(builtins)); // This is needed to make loading through meta.js work. diff --git a/public/vendor/codemirror/mode/dart/index.html b/public/vendor/codemirror/mode/dart/index.html index e79da5a8..e79da5a8 100755..100644 --- a/public/vendor/codemirror/mode/dart/index.html +++ b/public/vendor/codemirror/mode/dart/index.html diff --git a/public/vendor/codemirror/mode/diff/diff.js b/public/vendor/codemirror/mode/diff/diff.js index fe0305e7..fe0305e7 100755..100644 --- a/public/vendor/codemirror/mode/diff/diff.js +++ b/public/vendor/codemirror/mode/diff/diff.js diff --git a/public/vendor/codemirror/mode/diff/index.html b/public/vendor/codemirror/mode/diff/index.html index 0af611fa..0af611fa 100755..100644 --- a/public/vendor/codemirror/mode/diff/index.html +++ b/public/vendor/codemirror/mode/diff/index.html diff --git a/public/vendor/codemirror/mode/django/django.js b/public/vendor/codemirror/mode/django/django.js index 2f08b063..eb8d6591 100755..100644 --- a/public/vendor/codemirror/mode/django/django.js +++ b/public/vendor/codemirror/mode/django/django.js @@ -14,14 +14,14 @@ "use strict"; CodeMirror.defineMode("django:inner", function() { - var keywords = ["block", "endblock", "for", "endfor", "true", "false", - "loop", "none", "self", "super", "if", "endif", "as", - "else", "import", "with", "endwith", "without", "context", "ifequal", "endifequal", - "ifnotequal", "endifnotequal", "extends", "include", "load", "comment", - "endcomment", "empty", "url", "static", "trans", "blocktrans", "now", "regroup", - "lorem", "ifchanged", "endifchanged", "firstof", "debug", "cycle", "csrf_token", - "autoescape", "endautoescape", "spaceless", "ssi", "templatetag", - "verbatim", "endverbatim", "widthratio"], + var keywords = ["block", "endblock", "for", "endfor", "true", "false", "filter", "endfilter", + "loop", "none", "self", "super", "if", "elif", "endif", "as", "else", "import", + "with", "endwith", "without", "context", "ifequal", "endifequal", "ifnotequal", + "endifnotequal", "extends", "include", "load", "comment", "endcomment", + "empty", "url", "static", "trans", "blocktrans", "endblocktrans", "now", + "regroup", "lorem", "ifchanged", "endifchanged", "firstof", "debug", "cycle", + "csrf_token", "autoescape", "endautoescape", "spaceless", "endspaceless", + "ssi", "templatetag", "verbatim", "endverbatim", "widthratio"], filters = ["add", "addslashes", "capfirst", "center", "cut", "date", "default", "default_if_none", "dictsort", "dictsortreversed", "divisibleby", "escape", "escapejs", @@ -35,11 +35,13 @@ "truncatechars_html", "truncatewords", "truncatewords_html", "unordered_list", "upper", "urlencode", "urlize", "urlizetrunc", "wordcount", "wordwrap", "yesno"], - operators = ["==", "!=", "<", ">", "<=", ">=", "in", "not", "or", "and"]; + operators = ["==", "!=", "<", ">", "<=", ">="], + wordOperators = ["in", "not", "or", "and"]; keywords = new RegExp("^\\b(" + keywords.join("|") + ")\\b"); filters = new RegExp("^\\b(" + filters.join("|") + ")\\b"); operators = new RegExp("^\\b(" + operators.join("|") + ")\\b"); + wordOperators = new RegExp("^\\b(" + wordOperators.join("|") + ")\\b"); // We have to return "null" instead of null, in order to avoid string // styling as the default, when using Django templates inside HTML @@ -270,6 +272,11 @@ return "operator"; } + // Attempt to match a word operator + if (stream.match(wordOperators)) { + return "keyword"; + } + // Attempt to match a keyword var keywordMatch = stream.match(keywords); if (keywordMatch) { diff --git a/public/vendor/codemirror/mode/django/index.html b/public/vendor/codemirror/mode/django/index.html index 41ea07c9..41ea07c9 100755..100644 --- a/public/vendor/codemirror/mode/django/index.html +++ b/public/vendor/codemirror/mode/django/index.html diff --git a/public/vendor/codemirror/mode/dockerfile/dockerfile.js b/public/vendor/codemirror/mode/dockerfile/dockerfile.js index 6d517750..4419009a 100755..100644 --- a/public/vendor/codemirror/mode/dockerfile/dockerfile.js +++ b/public/vendor/codemirror/mode/dockerfile/dockerfile.js @@ -69,7 +69,10 @@ token: null, next: "start" } - ] + ], + meta: { + lineComment: "#" + } }); CodeMirror.defineMIME("text/x-dockerfile", "dockerfile"); diff --git a/public/vendor/codemirror/mode/dockerfile/index.html b/public/vendor/codemirror/mode/dockerfile/index.html index a31759bc..a31759bc 100755..100644 --- a/public/vendor/codemirror/mode/dockerfile/index.html +++ b/public/vendor/codemirror/mode/dockerfile/index.html diff --git a/public/vendor/codemirror/mode/dtd/dtd.js b/public/vendor/codemirror/mode/dtd/dtd.js index f37029a7..f37029a7 100755..100644 --- a/public/vendor/codemirror/mode/dtd/dtd.js +++ b/public/vendor/codemirror/mode/dtd/dtd.js diff --git a/public/vendor/codemirror/mode/dtd/index.html b/public/vendor/codemirror/mode/dtd/index.html index e6798a74..e6798a74 100755..100644 --- a/public/vendor/codemirror/mode/dtd/index.html +++ b/public/vendor/codemirror/mode/dtd/index.html diff --git a/public/vendor/codemirror/mode/dylan/dylan.js b/public/vendor/codemirror/mode/dylan/dylan.js index 85f0166c..85f0166c 100755..100644 --- a/public/vendor/codemirror/mode/dylan/dylan.js +++ b/public/vendor/codemirror/mode/dylan/dylan.js diff --git a/public/vendor/codemirror/mode/dylan/index.html b/public/vendor/codemirror/mode/dylan/index.html index ddf5ad06..ddf5ad06 100755..100644 --- a/public/vendor/codemirror/mode/dylan/index.html +++ b/public/vendor/codemirror/mode/dylan/index.html |