+C-like mode
+
+
+
+C++ example
+
+
+
+Objective-C example
+
+
+
+Java example
+
+
+
+Scala example
+
+
+
+Kotlin mode
+
+
+
+Ceylon mode
+
+
+
+
+
+ Simple mode that tries to handle C-like languages as well as it
+ can. Takes two configuration parameters: keywords
, an
+ object whose property names are the keywords in the language,
+ and useCPP
, which determines whether C preprocessor
+ directives are recognized.
+
+ MIME types defined: text/x-csrc
+ (C), text/x-c++src
(C++), text/x-java
+ (Java), text/x-csharp
(C#),
+ text/x-objectivec
(Objective-C),
+ text/x-scala
(Scala), text/x-vertex
+ x-shader/x-fragment
(shader programs),
+ text/x-squirrel
(Squirrel) and
+ text/x-ceylon
(Ceylon)
+
diff --git a/theme/plugins/codemirror/mode/clike/scala.html b/theme/plugins/codemirror/mode/clike/scala.html
new file mode 100644
index 0000000000000000000000000000000000000000..aa04cf0f04af5a0056af7949ed6cd06288f1d085
--- /dev/null
+++ b/theme/plugins/codemirror/mode/clike/scala.html
@@ -0,0 +1,767 @@
+
+
+ ][comment // comment]")
+
+
+ var mode_cpp = CodeMirror.getMode({indentUnit: 2}, "text/x-c++src");
+ function MTCPP(name) { test.mode(name, mode_cpp, Array.prototype.slice.call(arguments, 1)); }
+
+ MTCPP("cpp14_literal",
+ "[number 10'000];",
+ "[number 0b10'000];",
+ "[number 0x10'000];",
+ "[string '100000'];");
+
+ MTCPP("ctor_dtor",
+ "[def Foo::Foo]() {}",
+ "[def Foo::~Foo]() {}");
+
+ var mode_scala = CodeMirror.getMode({indentUnit: 2}, "text/x-scala");
+ function MTSCALA(name) { test.mode("scala_" + name, mode_scala, Array.prototype.slice.call(arguments, 1)); }
+ MTSCALA("nested_comments",
+ "[comment /*]",
+ "[comment But wait /* this is a nested comment */ for real]",
+ "[comment /**** let * me * show * you ****/]",
+ "[comment ///// let / me / show / you /////]",
+ "[comment */]");
+
+})();
diff --git a/theme/plugins/codemirror/mode/clojure/clojure.js b/theme/plugins/codemirror/mode/clojure/clojure.js
new file mode 100644
index 0000000000000000000000000000000000000000..ed6af2c83c19c9b445d9620dda6272617bb448e5
--- /dev/null
+++ b/theme/plugins/codemirror/mode/clojure/clojure.js
@@ -0,0 +1,306 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+/**
+ * Author: Hans Engel
+ * Branched from CodeMirror's Scheme mode (by Koh Zi Han, based on implementation by Koh Zi Chun)
+ */
+
+(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("clojure", function (options) {
+ var BUILTIN = "builtin", COMMENT = "comment", STRING = "string", CHARACTER = "string-2",
+ ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD = "keyword", VAR = "variable";
+ var INDENT_WORD_SKIP = options.indentUnit || 2;
+ var NORMAL_INDENT_UNIT = options.indentUnit || 2;
+
+ function makeKeywords(str) {
+ var obj = {}, words = str.split(" ");
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+ return obj;
+ }
+
+ var atoms = makeKeywords("true false nil");
+
+ var keywords = makeKeywords(
+ "defn defn- def def- defonce defmulti defmethod defmacro defstruct deftype defprotocol defrecord defproject deftest " +
+ "slice defalias defhinted defmacro- defn-memo defnk defnk defonce- defunbound defunbound- defvar defvar- let letfn " +
+ "do case cond condp for loop recur when when-not when-let when-first if if-let if-not . .. -> ->> doto and or dosync " +
+ "doseq dotimes dorun doall load import unimport ns in-ns refer try catch finally throw with-open with-local-vars " +
+ "binding gen-class gen-and-load-class gen-and-save-class handler-case handle");
+
+ var builtins = makeKeywords(
+ "* *' *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* *command-line-args* *compile-files* " +
+ "*compile-path* *compiler-options* *data-readers* *e *err* *file* *flush-on-newline* *fn-loader* *in* " +
+ "*math-context* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* *print-readably* *read-eval* " +
+ "*source-path* *unchecked-math* *use-context-classloader* *verbose-defrecords* *warn-on-reflection* + +' - -' -> " +
+ "->> ->ArrayChunk ->Vec ->VecNode ->VecSeq -cache-protocol-fn -reset-methods .. / < <= = == > >= EMPTY-NODE accessor " +
+ "aclone add-classpath add-watch agent agent-error agent-errors aget alength alias all-ns alter alter-meta! " +
+ "alter-var-root amap ancestors and apply areduce array-map aset aset-boolean aset-byte aset-char aset-double " +
+ "aset-float aset-int aset-long aset-short assert assoc assoc! assoc-in associative? atom await await-for await1 " +
+ "bases bean bigdec bigint biginteger binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set " +
+ "bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn bound-fn* bound? butlast " +
+ "byte byte-array bytes case cat cast char char-array char-escape-string char-name-string char? chars chunk chunk-append " +
+ "chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? class class? clear-agent-errors " +
+ "clojure-version coll? comment commute comp comparator compare compare-and-set! compile complement completing concat cond condp " +
+ "conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec dec' decimal? " +
+ "declare dedupe default-data-readers definline definterface defmacro defmethod defmulti defn defn- defonce defprotocol " +
+ "defrecord defstruct deftype delay delay? deliver denominator deref derive descendants destructure disj disj! dissoc " +
+ "dissoc! distinct distinct? doall dorun doseq dosync dotimes doto double double-array doubles drop drop-last " +
+ "drop-while eduction empty empty? ensure enumeration-seq error-handler error-mode eval even? every-pred every? ex-data ex-info " +
+ "extend extend-protocol extend-type extenders extends? false? ffirst file-seq filter filterv find find-keyword " +
+ "find-ns find-protocol-impl find-protocol-method find-var first flatten float float-array float? floats flush fn fn? " +
+ "fnext fnil for force format frequencies future future-call future-cancel future-cancelled? future-done? future? " +
+ "gen-class gen-interface gensym get get-in get-method get-proxy-class get-thread-bindings get-validator group-by hash " +
+ "hash-combine hash-map hash-set identical? identity if-let if-not ifn? import in-ns inc inc' init-proxy instance? " +
+ "int int-array integer? interleave intern interpose into into-array ints io! isa? iterate iterator-seq juxt keep " +
+ "keep-indexed key keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list list* list? load load-file " +
+ "load-reader load-string loaded-libs locking long long-array longs loop macroexpand macroexpand-1 make-array " +
+ "make-hierarchy map map-indexed map? mapcat mapv max max-key memfn memoize merge merge-with meta method-sig methods " +
+ "min min-key mod munge name namespace namespace-munge neg? newline next nfirst nil? nnext not not-any? not-empty " +
+ "not-every? not= ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias " +
+ "ns-unmap nth nthnext nthrest num number? numerator object-array odd? or parents partial partition partition-all " +
+ "partition-by pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers " +
+ "primitives-classnames print print-ctor print-dup print-method print-simple print-str printf println println-str " +
+ "prn prn-str promise proxy proxy-call-with-super proxy-mappings proxy-name proxy-super push-thread-bindings pvalues " +
+ "quot rand rand-int rand-nth random-sample range ratio? rational? rationalize re-find re-groups re-matcher re-matches re-pattern " +
+ "re-seq read read-line read-string realized? reduce reduce-kv reductions ref ref-history-count ref-max-history " +
+ "ref-min-history ref-set refer refer-clojure reify release-pending-sends rem remove remove-all-methods " +
+ "remove-method remove-ns remove-watch repeat repeatedly replace replicate require reset! reset-meta! resolve rest " +
+ "restart-agent resultset-seq reverse reversible? rseq rsubseq satisfies? second select-keys send send-off seq seq? " +
+ "seque sequence sequential? set set-error-handler! set-error-mode! set-validator! set? short short-array shorts " +
+ "shuffle shutdown-agents slurp some some-fn sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? " +
+ "special-symbol? spit split-at split-with str string? struct struct-map subs subseq subvec supers swap! symbol " +
+ "symbol? sync take take-last take-nth take-while test the-ns thread-bound? time to-array to-array-2d trampoline transduce " +
+ "transient tree-seq true? type unchecked-add unchecked-add-int unchecked-byte unchecked-char unchecked-dec " +
+ "unchecked-dec-int unchecked-divide-int unchecked-double unchecked-float unchecked-inc unchecked-inc-int " +
+ "unchecked-int unchecked-long unchecked-multiply unchecked-multiply-int unchecked-negate unchecked-negate-int "+
+ "unchecked-remainder-int unchecked-short unchecked-subtract unchecked-subtract-int underive unquote " +
+ "unquote-splicing update update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector-of " +
+ "vector? volatile! volatile? vreset! vswap! when when-first when-let when-not while with-bindings with-bindings* with-in-str with-loading-context " +
+ "with-local-vars with-meta with-open with-out-str with-precision with-redefs with-redefs-fn xml-seq zero? zipmap " +
+ "*default-data-reader-fn* as-> cond-> cond->> reduced reduced? send-via set-agent-send-executor! " +
+ "set-agent-send-off-executor! some-> some->>");
+
+ var indentKeys = makeKeywords(
+ // Built-ins
+ "ns fn def defn defmethod bound-fn if if-not case condp when while when-not when-first do future comment doto " +
+ "locking proxy with-open with-precision reify deftype defrecord defprotocol extend extend-protocol extend-type " +
+ "try catch " +
+
+ // Binding forms
+ "let letfn binding loop for doseq dotimes when-let if-let " +
+
+ // Data structures
+ "defstruct struct-map assoc " +
+
+ // clojure.test
+ "testing deftest " +
+
+ // contrib
+ "handler-case handle dotrace deftrace");
+
+ var tests = {
+ digit: /\d/,
+ digit_or_colon: /[\d:]/,
+ hex: /[0-9a-f]/i,
+ sign: /[+-]/,
+ exponent: /e/i,
+ keyword_char: /[^\s\(\[\;\)\]]/,
+ symbol: /[\w*+!\-\._?:<>\/\xa1-\uffff]/,
+ block_indent: /^(?:def|with)[^\/]+$|\/(?:def|with)/
+ };
+
+ function stateStack(indent, type, prev) { // represents a state stack object
+ this.indent = indent;
+ this.type = type;
+ this.prev = prev;
+ }
+
+ function pushStack(state, indent, type) {
+ state.indentStack = new stateStack(indent, type, state.indentStack);
+ }
+
+ function popStack(state) {
+ state.indentStack = state.indentStack.prev;
+ }
+
+ function isNumber(ch, stream){
+ // hex
+ if ( ch === '0' && stream.eat(/x/i) ) {
+ stream.eatWhile(tests.hex);
+ return true;
+ }
+
+ // leading sign
+ if ( ( ch == '+' || ch == '-' ) && ( tests.digit.test(stream.peek()) ) ) {
+ stream.eat(tests.sign);
+ ch = stream.next();
+ }
+
+ if ( tests.digit.test(ch) ) {
+ stream.eat(ch);
+ stream.eatWhile(tests.digit);
+
+ if ( '.' == stream.peek() ) {
+ stream.eat('.');
+ stream.eatWhile(tests.digit);
+ } else if ('/' == stream.peek() ) {
+ stream.eat('/');
+ stream.eatWhile(tests.digit);
+ }
+
+ if ( stream.eat(tests.exponent) ) {
+ stream.eat(tests.sign);
+ stream.eatWhile(tests.digit);
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ // Eat character that starts after backslash \
+ function eatCharacter(stream) {
+ var first = stream.next();
+ // Read special literals: backspace, newline, space, return.
+ // Just read all lowercase letters.
+ if (first && first.match(/[a-z]/) && stream.match(/[a-z]+/, true)) {
+ return;
+ }
+ // Read unicode character: \u1000 \uA0a1
+ if (first === "u") {
+ stream.match(/[0-9a-z]{4}/i, true);
+ }
+ }
+
+ return {
+ startState: function () {
+ return {
+ indentStack: null,
+ indentation: 0,
+ mode: false
+ };
+ },
+
+ token: function (stream, state) {
+ if (state.indentStack == null && stream.sol()) {
+ // update indentation, but only if indentStack is empty
+ state.indentation = stream.indentation();
+ }
+
+ // skip spaces
+ if (state.mode != "string" && stream.eatSpace()) {
+ return null;
+ }
+ var returnType = null;
+
+ switch(state.mode){
+ case "string": // multi-line string parsing mode
+ var next, escaped = false;
+ while ((next = stream.next()) != null) {
+ if (next == "\"" && !escaped) {
+
+ state.mode = false;
+ break;
+ }
+ escaped = !escaped && next == "\\";
+ }
+ returnType = STRING; // continue on in string mode
+ break;
+ default: // default parsing mode
+ var ch = stream.next();
+
+ if (ch == "\"") {
+ state.mode = "string";
+ returnType = STRING;
+ } else if (ch == "\\") {
+ eatCharacter(stream);
+ returnType = CHARACTER;
+ } else if (ch == "'" && !( tests.digit_or_colon.test(stream.peek()) )) {
+ returnType = ATOM;
+ } else if (ch == ";") { // comment
+ stream.skipToEnd(); // rest of the line is a comment
+ returnType = COMMENT;
+ } else if (isNumber(ch,stream)){
+ returnType = NUMBER;
+ } else if (ch == "(" || ch == "[" || ch == "{" ) {
+ var keyWord = '', indentTemp = stream.column(), letter;
+ /**
+ Either
+ (indent-word ..
+ (non-indent-word ..
+ (;something else, bracket, etc.
+ */
+
+ if (ch == "(") while ((letter = stream.eat(tests.keyword_char)) != null) {
+ keyWord += letter;
+ }
+
+ if (keyWord.length > 0 && (indentKeys.propertyIsEnumerable(keyWord) ||
+ tests.block_indent.test(keyWord))) { // indent-word
+ pushStack(state, indentTemp + INDENT_WORD_SKIP, ch);
+ } else { // non-indent word
+ // we continue eating the spaces
+ stream.eatSpace();
+ if (stream.eol() || stream.peek() == ";") {
+ // nothing significant after
+ // we restart indentation the user defined spaces after
+ pushStack(state, indentTemp + NORMAL_INDENT_UNIT, ch);
+ } else {
+ pushStack(state, indentTemp + stream.current().length, ch); // else we match
+ }
+ }
+ stream.backUp(stream.current().length - 1); // undo all the eating
+
+ returnType = BRACKET;
+ } else if (ch == ")" || ch == "]" || ch == "}") {
+ returnType = BRACKET;
+ if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : (ch == "]" ? "[" :"{"))) {
+ popStack(state);
+ }
+ } else if ( ch == ":" ) {
+ stream.eatWhile(tests.symbol);
+ return ATOM;
+ } else {
+ stream.eatWhile(tests.symbol);
+
+ if (keywords && keywords.propertyIsEnumerable(stream.current())) {
+ returnType = KEYWORD;
+ } else if (builtins && builtins.propertyIsEnumerable(stream.current())) {
+ returnType = BUILTIN;
+ } else if (atoms && atoms.propertyIsEnumerable(stream.current())) {
+ returnType = ATOM;
+ } else {
+ returnType = VAR;
+ }
+ }
+ }
+
+ return returnType;
+ },
+
+ indent: function (state) {
+ if (state.indentStack == null) return state.indentation;
+ return state.indentStack.indent;
+ },
+
+ closeBrackets: {pairs: "()[]{}\"\""},
+ lineComment: ";;"
+ };
+});
+
+CodeMirror.defineMIME("text/x-clojure", "clojure");
+CodeMirror.defineMIME("text/x-clojurescript", "clojure");
+CodeMirror.defineMIME("application/edn", "clojure");
+
+});
diff --git a/theme/plugins/codemirror/mode/clojure/index.html b/theme/plugins/codemirror/mode/clojure/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..81294bc14affebe0e0ceef78ed626357337555dc
--- /dev/null
+++ b/theme/plugins/codemirror/mode/clojure/index.html
@@ -0,0 +1,91 @@
+
+
+CodeMirror: Clojure mode
+
+
+
+
+
+
+
+
+
+
+Clojure mode
+
+
+
+ MIME types defined: text/x-clojure
.
+
+
diff --git a/theme/plugins/codemirror/mode/cmake/cmake.js b/theme/plugins/codemirror/mode/cmake/cmake.js
new file mode 100644
index 0000000000000000000000000000000000000000..9f9eda5417d376fcc4e2d7a9bb8787e624a7cb1b
--- /dev/null
+++ b/theme/plugins/codemirror/mode/cmake/cmake.js
@@ -0,0 +1,97 @@
+// 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("cmake", function () {
+ var variable_regex = /({)?[a-zA-Z0-9_]+(})?/;
+
+ function tokenString(stream, state) {
+ var current, prev, found_var = false;
+ while (!stream.eol() && (current = stream.next()) != state.pending) {
+ if (current === '$' && prev != '\\' && state.pending == '"') {
+ found_var = true;
+ break;
+ }
+ prev = current;
+ }
+ if (found_var) {
+ stream.backUp(1);
+ }
+ if (current == state.pending) {
+ state.continueString = false;
+ } else {
+ state.continueString = true;
+ }
+ return "string";
+ }
+
+ function tokenize(stream, state) {
+ var ch = stream.next();
+
+ // Have we found a variable?
+ if (ch === '$') {
+ if (stream.match(variable_regex)) {
+ return 'variable-2';
+ }
+ return 'variable';
+ }
+ // Should we still be looking for the end of a string?
+ if (state.continueString) {
+ // If so, go through the loop again
+ stream.backUp(1);
+ return tokenString(stream, state);
+ }
+ // Do we just have a function on our hands?
+ // In 'cmake_minimum_required (VERSION 2.8.8)', 'cmake_minimum_required' is matched
+ if (stream.match(/(\s+)?\w+\(/) || stream.match(/(\s+)?\w+\ \(/)) {
+ stream.backUp(1);
+ return 'def';
+ }
+ if (ch == "#") {
+ stream.skipToEnd();
+ return "comment";
+ }
+ // Have we found a string?
+ if (ch == "'" || ch == '"') {
+ // Store the type (single or double)
+ state.pending = ch;
+ // Perform the looping function to find the end
+ return tokenString(stream, state);
+ }
+ if (ch == '(' || ch == ')') {
+ return 'bracket';
+ }
+ if (ch.match(/[0-9]/)) {
+ return 'number';
+ }
+ stream.eatWhile(/[\w-]/);
+ return null;
+ }
+ return {
+ startState: function () {
+ var state = {};
+ state.inDefinition = false;
+ state.inInclude = false;
+ state.continueString = false;
+ state.pending = false;
+ return state;
+ },
+ token: function (stream, state) {
+ if (stream.eatSpace()) return null;
+ return tokenize(stream, state);
+ }
+ };
+});
+
+CodeMirror.defineMIME("text/x-cmake", "cmake");
+
+});
diff --git a/theme/plugins/codemirror/mode/cmake/index.html b/theme/plugins/codemirror/mode/cmake/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..ed114fece58baad3859095ffebef23928a225431
--- /dev/null
+++ b/theme/plugins/codemirror/mode/cmake/index.html
@@ -0,0 +1,129 @@
+
+
+CodeMirror: CMake mode
+
+
+
+
+
+
+
+
+
+
+
+CMake mode
+
+# vim: syntax=cmake
+if(NOT CMAKE_BUILD_TYPE)
+ # default to Release build for GCC builds
+ set(CMAKE_BUILD_TYPE Release CACHE STRING
+ "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel."
+ FORCE)
+endif()
+message(STATUS "cmake version ${CMAKE_VERSION}")
+if(POLICY CMP0025)
+ cmake_policy(SET CMP0025 OLD) # report Apple's Clang as just Clang
+endif()
+if(POLICY CMP0042)
+ cmake_policy(SET CMP0042 NEW) # MACOSX_RPATH
+endif()
+
+project (x265)
+cmake_minimum_required (VERSION 2.8.8) # OBJECT libraries require 2.8.8
+include(CheckIncludeFiles)
+include(CheckFunctionExists)
+include(CheckSymbolExists)
+include(CheckCXXCompilerFlag)
+
+# X265_BUILD must be incremented each time the public API is changed
+set(X265_BUILD 48)
+configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
+ "${PROJECT_BINARY_DIR}/x265.def")
+configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
+ "${PROJECT_BINARY_DIR}/x265_config.h")
+
+SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
+
+# System architecture detection
+string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSPROC)
+set(X86_ALIASES x86 i386 i686 x86_64 amd64)
+list(FIND X86_ALIASES "${SYSPROC}" X86MATCH)
+if("${SYSPROC}" STREQUAL "" OR X86MATCH GREATER "-1")
+ message(STATUS "Detected x86 target processor")
+ set(X86 1)
+ add_definitions(-DX265_ARCH_X86=1)
+ if("${CMAKE_SIZEOF_VOID_P}" MATCHES 8)
+ set(X64 1)
+ add_definitions(-DX86_64=1)
+ endif()
+elseif(${SYSPROC} STREQUAL "armv6l")
+ message(STATUS "Detected ARM target processor")
+ set(ARM 1)
+ add_definitions(-DX265_ARCH_ARM=1 -DHAVE_ARMV6=1)
+else()
+ message(STATUS "CMAKE_SYSTEM_PROCESSOR value `${CMAKE_SYSTEM_PROCESSOR}` is unknown")
+ message(STATUS "Please add this value near ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}")
+endif()
+
+if(UNIX)
+ list(APPEND PLATFORM_LIBS pthread)
+ find_library(LIBRT rt)
+ if(LIBRT)
+ list(APPEND PLATFORM_LIBS rt)
+ endif()
+ find_package(Numa)
+ if(NUMA_FOUND)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES ${NUMA_LIBRARY})
+ check_symbol_exists(numa_node_of_cpu numa.h NUMA_V2)
+ if(NUMA_V2)
+ add_definitions(-DHAVE_LIBNUMA)
+ message(STATUS "libnuma found, building with support for NUMA nodes")
+ list(APPEND PLATFORM_LIBS ${NUMA_LIBRARY})
+ link_directories(${NUMA_LIBRARY_DIR})
+ include_directories(${NUMA_INCLUDE_DIR})
+ endif()
+ endif()
+ mark_as_advanced(LIBRT NUMA_FOUND)
+endif(UNIX)
+
+if(X64 AND NOT WIN32)
+ option(ENABLE_PIC "Enable Position Independent Code" ON)
+else()
+ option(ENABLE_PIC "Enable Position Independent Code" OFF)
+endif(X64 AND NOT WIN32)
+
+# Compiler detection
+if(CMAKE_GENERATOR STREQUAL "Xcode")
+ set(XCODE 1)
+endif()
+if (APPLE)
+ add_definitions(-DMACOS)
+endif()
+
+
+
+ MIME types defined: text/x-cmake
.
+
+
diff --git a/theme/plugins/codemirror/mode/cobol/cobol.js b/theme/plugins/codemirror/mode/cobol/cobol.js
new file mode 100644
index 0000000000000000000000000000000000000000..897022b18ceb2dc599fe1c7c031113e74bc8631c
--- /dev/null
+++ b/theme/plugins/codemirror/mode/cobol/cobol.js
@@ -0,0 +1,255 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+/**
+ * Author: Gautam Mehta
+ * Branched from CodeMirror's Scheme 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("cobol", function () {
+ var BUILTIN = "builtin", COMMENT = "comment", STRING = "string",
+ ATOM = "atom", NUMBER = "number", KEYWORD = "keyword", MODTAG = "header",
+ COBOLLINENUM = "def", PERIOD = "link";
+ function makeKeywords(str) {
+ var obj = {}, words = str.split(" ");
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+ return obj;
+ }
+ var atoms = makeKeywords("TRUE FALSE ZEROES ZEROS ZERO SPACES SPACE LOW-VALUE LOW-VALUES ");
+ var keywords = makeKeywords(
+ "ACCEPT ACCESS ACQUIRE ADD ADDRESS " +
+ "ADVANCING AFTER ALIAS ALL ALPHABET " +
+ "ALPHABETIC ALPHABETIC-LOWER ALPHABETIC-UPPER ALPHANUMERIC ALPHANUMERIC-EDITED " +
+ "ALSO ALTER ALTERNATE AND ANY " +
+ "ARE AREA AREAS ARITHMETIC ASCENDING " +
+ "ASSIGN AT ATTRIBUTE AUTHOR AUTO " +
+ "AUTO-SKIP AUTOMATIC B-AND B-EXOR B-LESS " +
+ "B-NOT B-OR BACKGROUND-COLOR BACKGROUND-COLOUR BEEP " +
+ "BEFORE BELL BINARY BIT BITS " +
+ "BLANK BLINK BLOCK BOOLEAN BOTTOM " +
+ "BY CALL CANCEL CD CF " +
+ "CH CHARACTER CHARACTERS CLASS CLOCK-UNITS " +
+ "CLOSE COBOL CODE CODE-SET COL " +
+ "COLLATING COLUMN COMMA COMMIT COMMITMENT " +
+ "COMMON COMMUNICATION COMP COMP-0 COMP-1 " +
+ "COMP-2 COMP-3 COMP-4 COMP-5 COMP-6 " +
+ "COMP-7 COMP-8 COMP-9 COMPUTATIONAL COMPUTATIONAL-0 " +
+ "COMPUTATIONAL-1 COMPUTATIONAL-2 COMPUTATIONAL-3 COMPUTATIONAL-4 COMPUTATIONAL-5 " +
+ "COMPUTATIONAL-6 COMPUTATIONAL-7 COMPUTATIONAL-8 COMPUTATIONAL-9 COMPUTE " +
+ "CONFIGURATION CONNECT CONSOLE CONTAINED CONTAINS " +
+ "CONTENT CONTINUE CONTROL CONTROL-AREA CONTROLS " +
+ "CONVERTING COPY CORR CORRESPONDING COUNT " +
+ "CRT CRT-UNDER CURRENCY CURRENT CURSOR " +
+ "DATA DATE DATE-COMPILED DATE-WRITTEN DAY " +
+ "DAY-OF-WEEK DB DB-ACCESS-CONTROL-KEY DB-DATA-NAME DB-EXCEPTION " +
+ "DB-FORMAT-NAME DB-RECORD-NAME DB-SET-NAME DB-STATUS DBCS " +
+ "DBCS-EDITED DE DEBUG-CONTENTS DEBUG-ITEM DEBUG-LINE " +
+ "DEBUG-NAME DEBUG-SUB-1 DEBUG-SUB-2 DEBUG-SUB-3 DEBUGGING " +
+ "DECIMAL-POINT DECLARATIVES DEFAULT DELETE DELIMITED " +
+ "DELIMITER DEPENDING DESCENDING DESCRIBED DESTINATION " +
+ "DETAIL DISABLE DISCONNECT DISPLAY DISPLAY-1 " +
+ "DISPLAY-2 DISPLAY-3 DISPLAY-4 DISPLAY-5 DISPLAY-6 " +
+ "DISPLAY-7 DISPLAY-8 DISPLAY-9 DIVIDE DIVISION " +
+ "DOWN DROP DUPLICATE DUPLICATES DYNAMIC " +
+ "EBCDIC EGI EJECT ELSE EMI " +
+ "EMPTY EMPTY-CHECK ENABLE END END. END-ACCEPT END-ACCEPT. " +
+ "END-ADD END-CALL END-COMPUTE END-DELETE END-DISPLAY " +
+ "END-DIVIDE END-EVALUATE END-IF END-INVOKE END-MULTIPLY " +
+ "END-OF-PAGE END-PERFORM END-READ END-RECEIVE END-RETURN " +
+ "END-REWRITE END-SEARCH END-START END-STRING END-SUBTRACT " +
+ "END-UNSTRING END-WRITE END-XML ENTER ENTRY " +
+ "ENVIRONMENT EOP EQUAL EQUALS ERASE " +
+ "ERROR ESI EVALUATE EVERY EXCEEDS " +
+ "EXCEPTION EXCLUSIVE EXIT EXTEND EXTERNAL " +
+ "EXTERNALLY-DESCRIBED-KEY FD FETCH FILE FILE-CONTROL " +
+ "FILE-STREAM FILES FILLER FINAL FIND " +
+ "FINISH FIRST FOOTING FOR FOREGROUND-COLOR " +
+ "FOREGROUND-COLOUR FORMAT FREE FROM FULL " +
+ "FUNCTION GENERATE GET GIVING GLOBAL " +
+ "GO GOBACK GREATER GROUP HEADING " +
+ "HIGH-VALUE HIGH-VALUES HIGHLIGHT I-O I-O-CONTROL " +
+ "ID IDENTIFICATION IF IN INDEX " +
+ "INDEX-1 INDEX-2 INDEX-3 INDEX-4 INDEX-5 " +
+ "INDEX-6 INDEX-7 INDEX-8 INDEX-9 INDEXED " +
+ "INDIC INDICATE INDICATOR INDICATORS INITIAL " +
+ "INITIALIZE INITIATE INPUT INPUT-OUTPUT INSPECT " +
+ "INSTALLATION INTO INVALID INVOKE IS " +
+ "JUST JUSTIFIED KANJI KEEP KEY " +
+ "LABEL LAST LD LEADING LEFT " +
+ "LEFT-JUSTIFY LENGTH LENGTH-CHECK LESS LIBRARY " +
+ "LIKE LIMIT LIMITS LINAGE LINAGE-COUNTER " +
+ "LINE LINE-COUNTER LINES LINKAGE LOCAL-STORAGE " +
+ "LOCALE LOCALLY LOCK " +
+ "MEMBER MEMORY MERGE MESSAGE METACLASS " +
+ "MODE MODIFIED MODIFY MODULES MOVE " +
+ "MULTIPLE MULTIPLY NATIONAL NATIVE NEGATIVE " +
+ "NEXT NO NO-ECHO NONE NOT " +
+ "NULL NULL-KEY-MAP NULL-MAP NULLS NUMBER " +
+ "NUMERIC NUMERIC-EDITED OBJECT OBJECT-COMPUTER OCCURS " +
+ "OF OFF OMITTED ON ONLY " +
+ "OPEN OPTIONAL OR ORDER ORGANIZATION " +
+ "OTHER OUTPUT OVERFLOW OWNER PACKED-DECIMAL " +
+ "PADDING PAGE PAGE-COUNTER PARSE PERFORM " +
+ "PF PH PIC PICTURE PLUS " +
+ "POINTER POSITION POSITIVE PREFIX PRESENT " +
+ "PRINTING PRIOR PROCEDURE PROCEDURE-POINTER PROCEDURES " +
+ "PROCEED PROCESS PROCESSING PROGRAM PROGRAM-ID " +
+ "PROMPT PROTECTED PURGE QUEUE QUOTE " +
+ "QUOTES RANDOM RD READ READY " +
+ "REALM RECEIVE RECONNECT RECORD RECORD-NAME " +
+ "RECORDS RECURSIVE REDEFINES REEL REFERENCE " +
+ "REFERENCE-MONITOR REFERENCES RELATION RELATIVE RELEASE " +
+ "REMAINDER REMOVAL RENAMES REPEATED REPLACE " +
+ "REPLACING REPORT REPORTING REPORTS REPOSITORY " +
+ "REQUIRED RERUN RESERVE RESET RETAINING " +
+ "RETRIEVAL RETURN RETURN-CODE RETURNING REVERSE-VIDEO " +
+ "REVERSED REWIND REWRITE RF RH " +
+ "RIGHT RIGHT-JUSTIFY ROLLBACK ROLLING ROUNDED " +
+ "RUN SAME SCREEN SD SEARCH " +
+ "SECTION SECURE SECURITY SEGMENT SEGMENT-LIMIT " +
+ "SELECT SEND SENTENCE SEPARATE SEQUENCE " +
+ "SEQUENTIAL SET SHARED SIGN SIZE " +
+ "SKIP1 SKIP2 SKIP3 SORT SORT-MERGE " +
+ "SORT-RETURN SOURCE SOURCE-COMPUTER SPACE-FILL " +
+ "SPECIAL-NAMES STANDARD STANDARD-1 STANDARD-2 " +
+ "START STARTING STATUS STOP STORE " +
+ "STRING SUB-QUEUE-1 SUB-QUEUE-2 SUB-QUEUE-3 SUB-SCHEMA " +
+ "SUBFILE SUBSTITUTE SUBTRACT SUM SUPPRESS " +
+ "SYMBOLIC SYNC SYNCHRONIZED SYSIN SYSOUT " +
+ "TABLE TALLYING TAPE TENANT TERMINAL " +
+ "TERMINATE TEST TEXT THAN THEN " +
+ "THROUGH THRU TIME TIMES TITLE " +
+ "TO TOP TRAILING TRAILING-SIGN TRANSACTION " +
+ "TYPE TYPEDEF UNDERLINE UNEQUAL UNIT " +
+ "UNSTRING UNTIL UP UPDATE UPON " +
+ "USAGE USAGE-MODE USE USING VALID " +
+ "VALIDATE VALUE VALUES VARYING VLR " +
+ "WAIT WHEN WHEN-COMPILED WITH WITHIN " +
+ "WORDS WORKING-STORAGE WRITE XML XML-CODE " +
+ "XML-EVENT XML-NTEXT XML-TEXT ZERO ZERO-FILL " );
+
+ var builtins = makeKeywords("- * ** / + < <= = > >= ");
+ var tests = {
+ digit: /\d/,
+ digit_or_colon: /[\d:]/,
+ hex: /[0-9a-f]/i,
+ sign: /[+-]/,
+ exponent: /e/i,
+ keyword_char: /[^\s\(\[\;\)\]]/,
+ symbol: /[\w*+\-]/
+ };
+ function isNumber(ch, stream){
+ // hex
+ if ( ch === '0' && stream.eat(/x/i) ) {
+ stream.eatWhile(tests.hex);
+ return true;
+ }
+ // leading sign
+ if ( ( ch == '+' || ch == '-' ) && ( tests.digit.test(stream.peek()) ) ) {
+ stream.eat(tests.sign);
+ ch = stream.next();
+ }
+ if ( tests.digit.test(ch) ) {
+ stream.eat(ch);
+ stream.eatWhile(tests.digit);
+ if ( '.' == stream.peek()) {
+ stream.eat('.');
+ stream.eatWhile(tests.digit);
+ }
+ if ( stream.eat(tests.exponent) ) {
+ stream.eat(tests.sign);
+ stream.eatWhile(tests.digit);
+ }
+ return true;
+ }
+ return false;
+ }
+ return {
+ startState: function () {
+ return {
+ indentStack: null,
+ indentation: 0,
+ mode: false
+ };
+ },
+ token: function (stream, state) {
+ if (state.indentStack == null && stream.sol()) {
+ // update indentation, but only if indentStack is empty
+ state.indentation = 6 ; //stream.indentation();
+ }
+ // skip spaces
+ if (stream.eatSpace()) {
+ return null;
+ }
+ var returnType = null;
+ switch(state.mode){
+ case "string": // multi-line string parsing mode
+ var next = false;
+ while ((next = stream.next()) != null) {
+ if (next == "\"" || next == "\'") {
+ state.mode = false;
+ break;
+ }
+ }
+ returnType = STRING; // continue on in string mode
+ break;
+ default: // default parsing mode
+ var ch = stream.next();
+ var col = stream.column();
+ if (col >= 0 && col <= 5) {
+ returnType = COBOLLINENUM;
+ } else if (col >= 72 && col <= 79) {
+ stream.skipToEnd();
+ returnType = MODTAG;
+ } else if (ch == "*" && col == 6) { // comment
+ stream.skipToEnd(); // rest of the line is a comment
+ returnType = COMMENT;
+ } else if (ch == "\"" || ch == "\'") {
+ state.mode = "string";
+ returnType = STRING;
+ } else if (ch == "'" && !( tests.digit_or_colon.test(stream.peek()) )) {
+ returnType = ATOM;
+ } else if (ch == ".") {
+ returnType = PERIOD;
+ } else if (isNumber(ch,stream)){
+ returnType = NUMBER;
+ } else {
+ if (stream.current().match(tests.symbol)) {
+ while (col < 71) {
+ if (stream.eat(tests.symbol) === undefined) {
+ break;
+ } else {
+ col++;
+ }
+ }
+ }
+ if (keywords && keywords.propertyIsEnumerable(stream.current().toUpperCase())) {
+ returnType = KEYWORD;
+ } else if (builtins && builtins.propertyIsEnumerable(stream.current().toUpperCase())) {
+ returnType = BUILTIN;
+ } else if (atoms && atoms.propertyIsEnumerable(stream.current().toUpperCase())) {
+ returnType = ATOM;
+ } else returnType = null;
+ }
+ }
+ return returnType;
+ },
+ indent: function (state) {
+ if (state.indentStack == null) return state.indentation;
+ return state.indentStack.indent;
+ }
+ };
+});
+
+CodeMirror.defineMIME("text/x-cobol", "cobol");
+
+});
diff --git a/theme/plugins/codemirror/mode/cobol/index.html b/theme/plugins/codemirror/mode/cobol/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..4352419a0c810c6fa826d1e9e6cab1dc5c98e816
--- /dev/null
+++ b/theme/plugins/codemirror/mode/cobol/index.html
@@ -0,0 +1,210 @@
+
+
+CodeMirror: COBOL mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+COBOL mode
+
+ Select Theme
+ default
+ ambiance
+ blackboard
+ cobalt
+ eclipse
+ elegant
+ erlang-dark
+ lesser-dark
+ midnight
+ monokai
+ neat
+ night
+ rubyblue
+ solarized dark
+ solarized light
+ twilight
+ vibrant-ink
+ xq-dark
+ xq-light
+ Select Font Size
+ 13px
+ 14px
+ 16px
+ 18px
+ 20px
+ 24px
+ 26px
+ 28px
+ 30px
+ 32px
+ 34px
+ 36px
+
+Read-only
+
+Insert Spaces on Tab
+
+
+
+---------1---------2---------3---------4---------5---------6---------7---------8
+12345678911234567892123456789312345678941234567895123456789612345678971234567898
+000010 IDENTIFICATION DIVISION. MODTGHERE
+000020 PROGRAM-ID. SAMPLE.
+000030 AUTHOR. TEST SAM.
+000040 DATE-WRITTEN. 5 February 2013
+000041
+000042* A sample program just to show the form.
+000043* The program copies its input to the output,
+000044* and counts the number of records.
+000045* At the end this number is printed.
+000046
+000050 ENVIRONMENT DIVISION.
+000060 INPUT-OUTPUT SECTION.
+000070 FILE-CONTROL.
+000080 SELECT STUDENT-FILE ASSIGN TO SYSIN
+000090 ORGANIZATION IS LINE SEQUENTIAL.
+000100 SELECT PRINT-FILE ASSIGN TO SYSOUT
+000110 ORGANIZATION IS LINE SEQUENTIAL.
+000120
+000130 DATA DIVISION.
+000140 FILE SECTION.
+000150 FD STUDENT-FILE
+000160 RECORD CONTAINS 43 CHARACTERS
+000170 DATA RECORD IS STUDENT-IN.
+000180 01 STUDENT-IN PIC X(43).
+000190
+000200 FD PRINT-FILE
+000210 RECORD CONTAINS 80 CHARACTERS
+000220 DATA RECORD IS PRINT-LINE.
+000230 01 PRINT-LINE PIC X(80).
+000240
+000250 WORKING-STORAGE SECTION.
+000260 01 DATA-REMAINS-SWITCH PIC X(2) VALUE SPACES.
+000261 01 RECORDS-WRITTEN PIC 99.
+000270
+000280 01 DETAIL-LINE.
+000290 05 FILLER PIC X(7) VALUE SPACES.
+000300 05 RECORD-IMAGE PIC X(43).
+000310 05 FILLER PIC X(30) VALUE SPACES.
+000311
+000312 01 SUMMARY-LINE.
+000313 05 FILLER PIC X(7) VALUE SPACES.
+000314 05 TOTAL-READ PIC 99.
+000315 05 FILLER PIC X VALUE SPACE.
+000316 05 FILLER PIC X(17)
+000317 VALUE 'Records were read'.
+000318 05 FILLER PIC X(53) VALUE SPACES.
+000319
+000320 PROCEDURE DIVISION.
+000321
+000330 PREPARE-SENIOR-REPORT.
+000340 OPEN INPUT STUDENT-FILE
+000350 OUTPUT PRINT-FILE.
+000351 MOVE ZERO TO RECORDS-WRITTEN.
+000360 READ STUDENT-FILE
+000370 AT END MOVE 'NO' TO DATA-REMAINS-SWITCH
+000380 END-READ.
+000390 PERFORM PROCESS-RECORDS
+000410 UNTIL DATA-REMAINS-SWITCH = 'NO'.
+000411 PERFORM PRINT-SUMMARY.
+000420 CLOSE STUDENT-FILE
+000430 PRINT-FILE.
+000440 STOP RUN.
+000450
+000460 PROCESS-RECORDS.
+000470 MOVE STUDENT-IN TO RECORD-IMAGE.
+000480 MOVE DETAIL-LINE TO PRINT-LINE.
+000490 WRITE PRINT-LINE.
+000500 ADD 1 TO RECORDS-WRITTEN.
+000510 READ STUDENT-FILE
+000520 AT END MOVE 'NO' TO DATA-REMAINS-SWITCH
+000530 END-READ.
+000540
+000550 PRINT-SUMMARY.
+000560 MOVE RECORDS-WRITTEN TO TOTAL-READ.
+000570 MOVE SUMMARY-LINE TO PRINT-LINE.
+000571 WRITE PRINT-LINE.
+000572
+000580
+
+
+
diff --git a/theme/plugins/codemirror/mode/coffeescript/coffeescript.js b/theme/plugins/codemirror/mode/coffeescript/coffeescript.js
new file mode 100644
index 0000000000000000000000000000000000000000..ae955db344ae82e38b12138196363b59e6a8405b
--- /dev/null
+++ b/theme/plugins/codemirror/mode/coffeescript/coffeescript.js
@@ -0,0 +1,359 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+/**
+ * Link to the project's GitHub page:
+ * https://github.com/pickhardt/coffeescript-codemirror-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("coffeescript", function(conf, parserConf) {
+ var ERRORCLASS = "error";
+
+ function wordRegexp(words) {
+ return new RegExp("^((" + words.join(")|(") + "))\\b");
+ }
+
+ var operators = /^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/;
+ var delimiters = /^(?:[()\[\]{},:`=;]|\.\.?\.?)/;
+ var identifiers = /^[_A-Za-z$][_A-Za-z$0-9]*/;
+ var atProp = /^@[_A-Za-z$][_A-Za-z$0-9]*/;
+
+ var wordOperators = wordRegexp(["and", "or", "not",
+ "is", "isnt", "in",
+ "instanceof", "typeof"]);
+ var indentKeywords = ["for", "while", "loop", "if", "unless", "else",
+ "switch", "try", "catch", "finally", "class"];
+ var commonKeywords = ["break", "by", "continue", "debugger", "delete",
+ "do", "in", "of", "new", "return", "then",
+ "this", "@", "throw", "when", "until", "extends"];
+
+ var keywords = wordRegexp(indentKeywords.concat(commonKeywords));
+
+ indentKeywords = wordRegexp(indentKeywords);
+
+
+ var stringPrefixes = /^('{3}|\"{3}|['\"])/;
+ var regexPrefixes = /^(\/{3}|\/)/;
+ var commonConstants = ["Infinity", "NaN", "undefined", "null", "true", "false", "on", "off", "yes", "no"];
+ var constants = wordRegexp(commonConstants);
+
+ // Tokenizers
+ function tokenBase(stream, state) {
+ // Handle scope changes
+ if (stream.sol()) {
+ if (state.scope.align === null) state.scope.align = false;
+ var scopeOffset = state.scope.offset;
+ if (stream.eatSpace()) {
+ var lineOffset = stream.indentation();
+ if (lineOffset > scopeOffset && state.scope.type == "coffee") {
+ return "indent";
+ } else if (lineOffset < scopeOffset) {
+ return "dedent";
+ }
+ return null;
+ } else {
+ if (scopeOffset > 0) {
+ dedent(stream, state);
+ }
+ }
+ }
+ if (stream.eatSpace()) {
+ return null;
+ }
+
+ var ch = stream.peek();
+
+ // Handle docco title comment (single line)
+ if (stream.match("####")) {
+ stream.skipToEnd();
+ return "comment";
+ }
+
+ // Handle multi line comments
+ if (stream.match("###")) {
+ state.tokenize = longComment;
+ return state.tokenize(stream, state);
+ }
+
+ // Single line comment
+ if (ch === "#") {
+ stream.skipToEnd();
+ return "comment";
+ }
+
+ // Handle number literals
+ if (stream.match(/^-?[0-9\.]/, false)) {
+ var floatLiteral = false;
+ // Floats
+ if (stream.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)) {
+ floatLiteral = true;
+ }
+ if (stream.match(/^-?\d+\.\d*/)) {
+ floatLiteral = true;
+ }
+ if (stream.match(/^-?\.\d+/)) {
+ floatLiteral = true;
+ }
+
+ if (floatLiteral) {
+ // prevent from getting extra . on 1..
+ if (stream.peek() == "."){
+ stream.backUp(1);
+ }
+ return "number";
+ }
+ // Integers
+ var intLiteral = false;
+ // Hex
+ if (stream.match(/^-?0x[0-9a-f]+/i)) {
+ intLiteral = true;
+ }
+ // Decimal
+ if (stream.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)) {
+ intLiteral = true;
+ }
+ // Zero by itself with no other piece of number.
+ if (stream.match(/^-?0(?![\dx])/i)) {
+ intLiteral = true;
+ }
+ if (intLiteral) {
+ return "number";
+ }
+ }
+
+ // Handle strings
+ if (stream.match(stringPrefixes)) {
+ state.tokenize = tokenFactory(stream.current(), false, "string");
+ return state.tokenize(stream, state);
+ }
+ // Handle regex literals
+ if (stream.match(regexPrefixes)) {
+ if (stream.current() != "/" || stream.match(/^.*\//, false)) { // prevent highlight of division
+ state.tokenize = tokenFactory(stream.current(), true, "string-2");
+ return state.tokenize(stream, state);
+ } else {
+ stream.backUp(1);
+ }
+ }
+
+
+
+ // Handle operators and delimiters
+ if (stream.match(operators) || stream.match(wordOperators)) {
+ return "operator";
+ }
+ if (stream.match(delimiters)) {
+ return "punctuation";
+ }
+
+ if (stream.match(constants)) {
+ return "atom";
+ }
+
+ if (stream.match(atProp) || state.prop && stream.match(identifiers)) {
+ return "property";
+ }
+
+ if (stream.match(keywords)) {
+ return "keyword";
+ }
+
+ if (stream.match(identifiers)) {
+ return "variable";
+ }
+
+ // Handle non-detected items
+ stream.next();
+ return ERRORCLASS;
+ }
+
+ function tokenFactory(delimiter, singleline, outclass) {
+ return function(stream, state) {
+ while (!stream.eol()) {
+ stream.eatWhile(/[^'"\/\\]/);
+ if (stream.eat("\\")) {
+ stream.next();
+ if (singleline && stream.eol()) {
+ return outclass;
+ }
+ } else if (stream.match(delimiter)) {
+ state.tokenize = tokenBase;
+ return outclass;
+ } else {
+ stream.eat(/['"\/]/);
+ }
+ }
+ if (singleline) {
+ if (parserConf.singleLineStringErrors) {
+ outclass = ERRORCLASS;
+ } else {
+ state.tokenize = tokenBase;
+ }
+ }
+ return outclass;
+ };
+ }
+
+ function longComment(stream, state) {
+ while (!stream.eol()) {
+ stream.eatWhile(/[^#]/);
+ if (stream.match("###")) {
+ state.tokenize = tokenBase;
+ break;
+ }
+ stream.eatWhile("#");
+ }
+ return "comment";
+ }
+
+ function indent(stream, state, type) {
+ type = type || "coffee";
+ var offset = 0, align = false, alignOffset = null;
+ for (var scope = state.scope; scope; scope = scope.prev) {
+ if (scope.type === "coffee" || scope.type == "}") {
+ offset = scope.offset + conf.indentUnit;
+ break;
+ }
+ }
+ if (type !== "coffee") {
+ align = null;
+ alignOffset = stream.column() + stream.current().length;
+ } else if (state.scope.align) {
+ state.scope.align = false;
+ }
+ state.scope = {
+ offset: offset,
+ type: type,
+ prev: state.scope,
+ align: align,
+ alignOffset: alignOffset
+ };
+ }
+
+ function dedent(stream, state) {
+ if (!state.scope.prev) return;
+ if (state.scope.type === "coffee") {
+ var _indent = stream.indentation();
+ var matched = false;
+ for (var scope = state.scope; scope; scope = scope.prev) {
+ if (_indent === scope.offset) {
+ matched = true;
+ break;
+ }
+ }
+ if (!matched) {
+ return true;
+ }
+ while (state.scope.prev && state.scope.offset !== _indent) {
+ state.scope = state.scope.prev;
+ }
+ return false;
+ } else {
+ state.scope = state.scope.prev;
+ return false;
+ }
+ }
+
+ function tokenLexer(stream, state) {
+ var style = state.tokenize(stream, state);
+ var current = stream.current();
+
+ // Handle scope changes.
+ if (current === "return") {
+ state.dedent = true;
+ }
+ if (((current === "->" || current === "=>") && stream.eol())
+ || style === "indent") {
+ indent(stream, state);
+ }
+ var delimiter_index = "[({".indexOf(current);
+ if (delimiter_index !== -1) {
+ indent(stream, state, "])}".slice(delimiter_index, delimiter_index+1));
+ }
+ if (indentKeywords.exec(current)){
+ indent(stream, state);
+ }
+ if (current == "then"){
+ dedent(stream, state);
+ }
+
+
+ if (style === "dedent") {
+ if (dedent(stream, state)) {
+ return ERRORCLASS;
+ }
+ }
+ delimiter_index = "])}".indexOf(current);
+ if (delimiter_index !== -1) {
+ while (state.scope.type == "coffee" && state.scope.prev)
+ state.scope = state.scope.prev;
+ if (state.scope.type == current)
+ state.scope = state.scope.prev;
+ }
+ if (state.dedent && stream.eol()) {
+ if (state.scope.type == "coffee" && state.scope.prev)
+ state.scope = state.scope.prev;
+ state.dedent = false;
+ }
+
+ return style;
+ }
+
+ var external = {
+ startState: function(basecolumn) {
+ return {
+ tokenize: tokenBase,
+ scope: {offset:basecolumn || 0, type:"coffee", prev: null, align: false},
+ prop: false,
+ dedent: 0
+ };
+ },
+
+ token: function(stream, state) {
+ var fillAlign = state.scope.align === null && state.scope;
+ if (fillAlign && stream.sol()) fillAlign.align = false;
+
+ var style = tokenLexer(stream, state);
+ if (style && style != "comment") {
+ if (fillAlign) fillAlign.align = true;
+ state.prop = style == "punctuation" && stream.current() == "."
+ }
+
+ return style;
+ },
+
+ indent: function(state, text) {
+ if (state.tokenize != tokenBase) return 0;
+ var scope = state.scope;
+ var closer = text && "])}".indexOf(text.charAt(0)) > -1;
+ if (closer) while (scope.type == "coffee" && scope.prev) scope = scope.prev;
+ var closes = closer && scope.type === text.charAt(0);
+ if (scope.align)
+ return scope.alignOffset - (closes ? 1 : 0);
+ else
+ return (closes ? scope.prev : scope).offset;
+ },
+
+ lineComment: "#",
+ fold: "indent"
+ };
+ return external;
+});
+
+// IANA registered media type
+// https://www.iana.org/assignments/media-types/
+CodeMirror.defineMIME("application/vnd.coffeescript", "coffeescript");
+
+CodeMirror.defineMIME("text/x-coffeescript", "coffeescript");
+CodeMirror.defineMIME("text/coffeescript", "coffeescript");
+
+});
diff --git a/theme/plugins/codemirror/mode/coffeescript/index.html b/theme/plugins/codemirror/mode/coffeescript/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..92d161e9dd0ef19c2428e386926d87e4735602c7
--- /dev/null
+++ b/theme/plugins/codemirror/mode/coffeescript/index.html
@@ -0,0 +1,740 @@
+
+
+CodeMirror: CoffeeScript mode
+
+
+
+
+
+
+
+
+
+
+CoffeeScript mode
+
+# CoffeeScript mode for CodeMirror
+# Copyright (c) 2011 Jeff Pickhardt, released under
+# the MIT License.
+#
+# Modified from the Python CodeMirror mode, which also is
+# under the MIT License Copyright (c) 2010 Timothy Farrell.
+#
+# The following script, Underscore.coffee, is used to
+# demonstrate CoffeeScript mode for CodeMirror.
+#
+# To download CoffeeScript mode for CodeMirror, go to:
+# https://github.com/pickhardt/coffeescript-codemirror-mode
+
+# **Underscore.coffee
+# (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.**
+# Underscore is freely distributable under the terms of the
+# [MIT license](http://en.wikipedia.org/wiki/MIT_License).
+# Portions of Underscore are inspired by or borrowed from
+# [Prototype.js](http://prototypejs.org/api), Oliver Steele's
+# [Functional](http://osteele.com), and John Resig's
+# [Micro-Templating](http://ejohn.org).
+# For all details and documentation:
+# http://documentcloud.github.com/underscore/
+
+
+# Baseline setup
+# --------------
+
+# Establish the root object, `window` in the browser, or `global` on the server.
+root = this
+
+
+# Save the previous value of the `_` variable.
+previousUnderscore = root._
+
+### Multiline
+ comment
+###
+
+# Establish the object that gets thrown to break out of a loop iteration.
+# `StopIteration` is SOP on Mozilla.
+breaker = if typeof(StopIteration) is 'undefined' then '__break__' else StopIteration
+
+
+#### Docco style single line comment (title)
+
+
+# Helper function to escape **RegExp** contents, because JS doesn't have one.
+escapeRegExp = (string) -> string.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1')
+
+
+# Save bytes in the minified (but not gzipped) version:
+ArrayProto = Array.prototype
+ObjProto = Object.prototype
+
+
+# Create quick reference variables for speed access to core prototypes.
+slice = ArrayProto.slice
+unshift = ArrayProto.unshift
+toString = ObjProto.toString
+hasOwnProperty = ObjProto.hasOwnProperty
+propertyIsEnumerable = ObjProto.propertyIsEnumerable
+
+
+# All **ECMA5** native implementations we hope to use are declared here.
+nativeForEach = ArrayProto.forEach
+nativeMap = ArrayProto.map
+nativeReduce = ArrayProto.reduce
+nativeReduceRight = ArrayProto.reduceRight
+nativeFilter = ArrayProto.filter
+nativeEvery = ArrayProto.every
+nativeSome = ArrayProto.some
+nativeIndexOf = ArrayProto.indexOf
+nativeLastIndexOf = ArrayProto.lastIndexOf
+nativeIsArray = Array.isArray
+nativeKeys = Object.keys
+
+
+# Create a safe reference to the Underscore object for use below.
+_ = (obj) -> new wrapper(obj)
+
+
+# Export the Underscore object for **CommonJS**.
+if typeof(exports) != 'undefined' then exports._ = _
+
+
+# Export Underscore to global scope.
+root._ = _
+
+
+# Current version.
+_.VERSION = '1.1.0'
+
+
+# Collection Functions
+# --------------------
+
+# The cornerstone, an **each** implementation.
+# Handles objects implementing **forEach**, arrays, and raw objects.
+_.each = (obj, iterator, context) ->
+ try
+ if nativeForEach and obj.forEach is nativeForEach
+ obj.forEach iterator, context
+ else if _.isNumber obj.length
+ iterator.call context, obj[i], i, obj for i in [0...obj.length]
+ else
+ iterator.call context, val, key, obj for own key, val of obj
+ catch e
+ throw e if e isnt breaker
+ obj
+
+
+# Return the results of applying the iterator to each element. Use JavaScript
+# 1.6's version of **map**, if possible.
+_.map = (obj, iterator, context) ->
+ return obj.map(iterator, context) if nativeMap and obj.map is nativeMap
+ results = []
+ _.each obj, (value, index, list) ->
+ results.push iterator.call context, value, index, list
+ results
+
+
+# **Reduce** builds up a single result from a list of values. Also known as
+# **inject**, or **foldl**. Uses JavaScript 1.8's version of **reduce**, if possible.
+_.reduce = (obj, iterator, memo, context) ->
+ if nativeReduce and obj.reduce is nativeReduce
+ iterator = _.bind iterator, context if context
+ return obj.reduce iterator, memo
+ _.each obj, (value, index, list) ->
+ memo = iterator.call context, memo, value, index, list
+ memo
+
+
+# The right-associative version of **reduce**, also known as **foldr**. Uses
+# JavaScript 1.8's version of **reduceRight**, if available.
+_.reduceRight = (obj, iterator, memo, context) ->
+ if nativeReduceRight and obj.reduceRight is nativeReduceRight
+ iterator = _.bind iterator, context if context
+ return obj.reduceRight iterator, memo
+ reversed = _.clone(_.toArray(obj)).reverse()
+ _.reduce reversed, iterator, memo, context
+
+
+# Return the first value which passes a truth test.
+_.detect = (obj, iterator, context) ->
+ result = null
+ _.each obj, (value, index, list) ->
+ if iterator.call context, value, index, list
+ result = value
+ _.breakLoop()
+ result
+
+
+# Return all the elements that pass a truth test. Use JavaScript 1.6's
+# **filter**, if it exists.
+_.filter = (obj, iterator, context) ->
+ return obj.filter iterator, context if nativeFilter and obj.filter is nativeFilter
+ results = []
+ _.each obj, (value, index, list) ->
+ results.push value if iterator.call context, value, index, list
+ results
+
+
+# Return all the elements for which a truth test fails.
+_.reject = (obj, iterator, context) ->
+ results = []
+ _.each obj, (value, index, list) ->
+ results.push value if not iterator.call context, value, index, list
+ results
+
+
+# Determine whether all of the elements match a truth test. Delegate to
+# JavaScript 1.6's **every**, if it is present.
+_.every = (obj, iterator, context) ->
+ iterator ||= _.identity
+ return obj.every iterator, context if nativeEvery and obj.every is nativeEvery
+ result = true
+ _.each obj, (value, index, list) ->
+ _.breakLoop() unless (result = result and iterator.call(context, value, index, list))
+ result
+
+
+# Determine if at least one element in the object matches a truth test. Use
+# JavaScript 1.6's **some**, if it exists.
+_.some = (obj, iterator, context) ->
+ iterator ||= _.identity
+ return obj.some iterator, context if nativeSome and obj.some is nativeSome
+ result = false
+ _.each obj, (value, index, list) ->
+ _.breakLoop() if (result = iterator.call(context, value, index, list))
+ result
+
+
+# Determine if a given value is included in the array or object,
+# based on `===`.
+_.include = (obj, target) ->
+ return _.indexOf(obj, target) isnt -1 if nativeIndexOf and obj.indexOf is nativeIndexOf
+ return true for own key, val of obj when val is target
+ false
+
+
+# Invoke a method with arguments on every item in a collection.
+_.invoke = (obj, method) ->
+ args = _.rest arguments, 2
+ (if method then val[method] else val).apply(val, args) for val in obj
+
+
+# Convenience version of a common use case of **map**: fetching a property.
+_.pluck = (obj, key) ->
+ _.map(obj, (val) -> val[key])
+
+
+# Return the maximum item or (item-based computation).
+_.max = (obj, iterator, context) ->
+ return Math.max.apply(Math, obj) if not iterator and _.isArray(obj)
+ result = computed: -Infinity
+ _.each obj, (value, index, list) ->
+ computed = if iterator then iterator.call(context, value, index, list) else value
+ computed >= result.computed and (result = {value: value, computed: computed})
+ result.value
+
+
+# Return the minimum element (or element-based computation).
+_.min = (obj, iterator, context) ->
+ return Math.min.apply(Math, obj) if not iterator and _.isArray(obj)
+ result = computed: Infinity
+ _.each obj, (value, index, list) ->
+ computed = if iterator then iterator.call(context, value, index, list) else value
+ computed < result.computed and (result = {value: value, computed: computed})
+ result.value
+
+
+# Sort the object's values by a criterion produced by an iterator.
+_.sortBy = (obj, iterator, context) ->
+ _.pluck(((_.map obj, (value, index, list) ->
+ {value: value, criteria: iterator.call(context, value, index, list)}
+ ).sort((left, right) ->
+ a = left.criteria; b = right.criteria
+ if a < b then -1 else if a > b then 1 else 0
+ )), 'value')
+
+
+# Use a comparator function to figure out at what index an object should
+# be inserted so as to maintain order. Uses binary search.
+_.sortedIndex = (array, obj, iterator) ->
+ iterator ||= _.identity
+ low = 0
+ high = array.length
+ while low < high
+ mid = (low + high) >> 1
+ if iterator(array[mid]) < iterator(obj) then low = mid + 1 else high = mid
+ low
+
+
+# Convert anything iterable into a real, live array.
+_.toArray = (iterable) ->
+ return [] if (!iterable)
+ return iterable.toArray() if (iterable.toArray)
+ return iterable if (_.isArray(iterable))
+ return slice.call(iterable) if (_.isArguments(iterable))
+ _.values(iterable)
+
+
+# Return the number of elements in an object.
+_.size = (obj) -> _.toArray(obj).length
+
+
+# Array Functions
+# ---------------
+
+# Get the first element of an array. Passing `n` will return the first N
+# values in the array. Aliased as **head**. The `guard` check allows it to work
+# with **map**.
+_.first = (array, n, guard) ->
+ if n and not guard then slice.call(array, 0, n) else array[0]
+
+
+# Returns everything but the first entry of the array. Aliased as **tail**.
+# Especially useful on the arguments object. Passing an `index` will return
+# the rest of the values in the array from that index onward. The `guard`
+# check allows it to work with **map**.
+_.rest = (array, index, guard) ->
+ slice.call(array, if _.isUndefined(index) or guard then 1 else index)
+
+
+# Get the last element of an array.
+_.last = (array) -> array[array.length - 1]
+
+
+# Trim out all falsy values from an array.
+_.compact = (array) -> item for item in array when item
+
+
+# Return a completely flattened version of an array.
+_.flatten = (array) ->
+ _.reduce array, (memo, value) ->
+ return memo.concat(_.flatten(value)) if _.isArray value
+ memo.push value
+ memo
+ , []
+
+
+# Return a version of the array that does not contain the specified value(s).
+_.without = (array) ->
+ values = _.rest arguments
+ val for val in _.toArray(array) when not _.include values, val
+
+
+# Produce a duplicate-free version of the array. If the array has already
+# been sorted, you have the option of using a faster algorithm.
+_.uniq = (array, isSorted) ->
+ memo = []
+ for el, i in _.toArray array
+ memo.push el if i is 0 || (if isSorted is true then _.last(memo) isnt el else not _.include(memo, el))
+ memo
+
+
+# Produce an array that contains every item shared between all the
+# passed-in arrays.
+_.intersect = (array) ->
+ rest = _.rest arguments
+ _.select _.uniq(array), (item) ->
+ _.all rest, (other) ->
+ _.indexOf(other, item) >= 0
+
+
+# Zip together multiple lists into a single array -- elements that share
+# an index go together.
+_.zip = ->
+ length = _.max _.pluck arguments, 'length'
+ results = new Array length
+ for i in [0...length]
+ results[i] = _.pluck arguments, String i
+ results
+
+
+# If the browser doesn't supply us with **indexOf** (I'm looking at you, MSIE),
+# we need this function. Return the position of the first occurrence of an
+# item in an array, or -1 if the item is not included in the array.
+_.indexOf = (array, item) ->
+ return array.indexOf item if nativeIndexOf and array.indexOf is nativeIndexOf
+ i = 0; l = array.length
+ while l - i
+ if array[i] is item then return i else i++
+ -1
+
+
+# Provide JavaScript 1.6's **lastIndexOf**, delegating to the native function,
+# if possible.
+_.lastIndexOf = (array, item) ->
+ return array.lastIndexOf(item) if nativeLastIndexOf and array.lastIndexOf is nativeLastIndexOf
+ i = array.length
+ while i
+ if array[i] is item then return i else i--
+ -1
+
+
+# Generate an integer Array containing an arithmetic progression. A port of
+# [the native Python **range** function](http://docs.python.org/library/functions.html#range).
+_.range = (start, stop, step) ->
+ a = arguments
+ solo = a.length <= 1
+ i = start = if solo then 0 else a[0]
+ stop = if solo then a[0] else a[1]
+ step = a[2] or 1
+ len = Math.ceil((stop - start) / step)
+ return [] if len <= 0
+ range = new Array len
+ idx = 0
+ loop
+ return range if (if step > 0 then i - stop else stop - i) >= 0
+ range[idx] = i
+ idx++
+ i+= step
+
+
+# Function Functions
+# ------------------
+
+# Create a function bound to a given object (assigning `this`, and arguments,
+# optionally). Binding with arguments is also known as **curry**.
+_.bind = (func, obj) ->
+ args = _.rest arguments, 2
+ -> func.apply obj or root, args.concat arguments
+
+
+# Bind all of an object's methods to that object. Useful for ensuring that
+# all callbacks defined on an object belong to it.
+_.bindAll = (obj) ->
+ funcs = if arguments.length > 1 then _.rest(arguments) else _.functions(obj)
+ _.each funcs, (f) -> obj[f] = _.bind obj[f], obj
+ obj
+
+
+# Delays a function for the given number of milliseconds, and then calls
+# it with the arguments supplied.
+_.delay = (func, wait) ->
+ args = _.rest arguments, 2
+ setTimeout((-> func.apply(func, args)), wait)
+
+
+# Memoize an expensive function by storing its results.
+_.memoize = (func, hasher) ->
+ memo = {}
+ hasher or= _.identity
+ ->
+ key = hasher.apply this, arguments
+ return memo[key] if key of memo
+ memo[key] = func.apply this, arguments
+
+
+# Defers a function, scheduling it to run after the current call stack has
+# cleared.
+_.defer = (func) ->
+ _.delay.apply _, [func, 1].concat _.rest arguments
+
+
+# Returns the first function passed as an argument to the second,
+# allowing you to adjust arguments, run code before and after, and
+# conditionally execute the original function.
+_.wrap = (func, wrapper) ->
+ -> wrapper.apply wrapper, [func].concat arguments
+
+
+# Returns a function that is the composition of a list of functions, each
+# consuming the return value of the function that follows.
+_.compose = ->
+ funcs = arguments
+ ->
+ args = arguments
+ for i in [funcs.length - 1..0] by -1
+ args = [funcs[i].apply(this, args)]
+ args[0]
+
+
+# Object Functions
+# ----------------
+
+# Retrieve the names of an object's properties.
+_.keys = nativeKeys or (obj) ->
+ return _.range 0, obj.length if _.isArray(obj)
+ key for key, val of obj
+
+
+# Retrieve the values of an object's properties.
+_.values = (obj) ->
+ _.map obj, _.identity
+
+
+# Return a sorted list of the function names available in Underscore.
+_.functions = (obj) ->
+ _.filter(_.keys(obj), (key) -> _.isFunction(obj[key])).sort()
+
+
+# Extend a given object with all of the properties in a source object.
+_.extend = (obj) ->
+ for source in _.rest(arguments)
+ obj[key] = val for key, val of source
+ obj
+
+
+# Create a (shallow-cloned) duplicate of an object.
+_.clone = (obj) ->
+ return obj.slice 0 if _.isArray obj
+ _.extend {}, obj
+
+
+# Invokes interceptor with the obj, and then returns obj.
+# The primary purpose of this method is to "tap into" a method chain,
+# in order to perform operations on intermediate results within
+ the chain.
+_.tap = (obj, interceptor) ->
+ interceptor obj
+ obj
+
+
+# Perform a deep comparison to check if two objects are equal.
+_.isEqual = (a, b) ->
+ # Check object identity.
+ return true if a is b
+ # Different types?
+ atype = typeof(a); btype = typeof(b)
+ return false if atype isnt btype
+ # Basic equality test (watch out for coercions).
+ return true if `a == b`
+ # One is falsy and the other truthy.
+ return false if (!a and b) or (a and !b)
+ # One of them implements an `isEqual()`?
+ return a.isEqual(b) if a.isEqual
+ # Check dates' integer values.
+ return a.getTime() is b.getTime() if _.isDate(a) and _.isDate(b)
+ # Both are NaN?
+ return false if _.isNaN(a) and _.isNaN(b)
+ # Compare regular expressions.
+ if _.isRegExp(a) and _.isRegExp(b)
+ return a.source is b.source and
+ a.global is b.global and
+ a.ignoreCase is b.ignoreCase and
+ a.multiline is b.multiline
+ # If a is not an object by this point, we can't handle it.
+ return false if atype isnt 'object'
+ # Check for different array lengths before comparing contents.
+ return false if a.length and (a.length isnt b.length)
+ # Nothing else worked, deep compare the contents.
+ aKeys = _.keys(a); bKeys = _.keys(b)
+ # Different object sizes?
+ return false if aKeys.length isnt bKeys.length
+ # Recursive comparison of contents.
+ return false for key, val of a when !(key of b) or !_.isEqual(val, b[key])
+ true
+
+
+# Is a given array or object empty?
+_.isEmpty = (obj) ->
+ return obj.length is 0 if _.isArray(obj) or _.isString(obj)
+ return false for own key of obj
+ true
+
+
+# Is a given value a DOM element?
+_.isElement = (obj) -> obj and obj.nodeType is 1
+
+
+# Is a given value an array?
+_.isArray = nativeIsArray or (obj) -> !!(obj and obj.concat and obj.unshift and not obj.callee)
+
+
+# Is a given variable an arguments object?
+_.isArguments = (obj) -> obj and obj.callee
+
+
+# Is the given value a function?
+_.isFunction = (obj) -> !!(obj and obj.constructor and obj.call and obj.apply)
+
+
+# Is the given value a string?
+_.isString = (obj) -> !!(obj is '' or (obj and obj.charCodeAt and obj.substr))
+
+
+# Is a given value a number?
+_.isNumber = (obj) -> (obj is +obj) or toString.call(obj) is '[object Number]'
+
+
+# Is a given value a boolean?
+_.isBoolean = (obj) -> obj is true or obj is false
+
+
+# Is a given value a Date?
+_.isDate = (obj) -> !!(obj and obj.getTimezoneOffset and obj.setUTCFullYear)
+
+
+# Is the given value a regular expression?
+_.isRegExp = (obj) -> !!(obj and obj.exec and (obj.ignoreCase or obj.ignoreCase is false))
+
+
+# Is the given value NaN -- this one is interesting. `NaN != NaN`, and
+# `isNaN(undefined) == true`, so we make sure it's a number first.
+_.isNaN = (obj) -> _.isNumber(obj) and window.isNaN(obj)
+
+
+# Is a given value equal to null?
+_.isNull = (obj) -> obj is null
+
+
+# Is a given variable undefined?
+_.isUndefined = (obj) -> typeof obj is 'undefined'
+
+
+# Utility Functions
+# -----------------
+
+# Run Underscore.js in noConflict mode, returning the `_` variable to its
+# previous owner. Returns a reference to the Underscore object.
+_.noConflict = ->
+ root._ = previousUnderscore
+ this
+
+
+# Keep the identity function around for default iterators.
+_.identity = (value) -> value
+
+
+# Run a function `n` times.
+_.times = (n, iterator, context) ->
+ iterator.call context, i for i in [0...n]
+
+
+# Break out of the middle of an iteration.
+_.breakLoop = -> throw breaker
+
+
+# Add your own custom functions to the Underscore object, ensuring that
+# they're correctly added to the OOP wrapper as well.
+_.mixin = (obj) ->
+ for name in _.functions(obj)
+ addToWrapper name, _[name] = obj[name]
+
+
+# Generate a unique integer id (unique within the entire client session).
+# Useful for temporary DOM ids.
+idCounter = 0
+_.uniqueId = (prefix) ->
+ (prefix or '') + idCounter++
+
+
+# By default, Underscore uses **ERB**-style template delimiters, change the
+# following template settings to use alternative delimiters.
+_.templateSettings = {
+ start: '<%'
+ end: '%>'
+ interpolate: /<%=(.+?)%>/g
+}
+
+
+# JavaScript templating a-la **ERB**, pilfered from John Resig's
+# *Secrets of the JavaScript Ninja*, page 83.
+# Single-quote fix from Rick Strahl.
+# With alterations for arbitrary delimiters, and to preserve whitespace.
+_.template = (str, data) ->
+ c = _.templateSettings
+ endMatch = new RegExp("'(?=[^"+c.end.substr(0, 1)+"]*"+escapeRegExp(c.end)+")","g")
+ fn = new Function 'obj',
+ 'var p=[],print=function(){p.push.apply(p,arguments);};' +
+ 'with(obj||{}){p.push(\'' +
+ str.replace(/\r/g, '\\r')
+ .replace(/\n/g, '\\n')
+ .replace(/\t/g, '\\t')
+ .replace(endMatch,"���")
+ .split("'").join("\\'")
+ .split("���").join("'")
+ .replace(c.interpolate, "',$1,'")
+ .split(c.start).join("');")
+ .split(c.end).join("p.push('") +
+ "');}return p.join('');"
+ if data then fn(data) else fn
+
+
+# Aliases
+# -------
+
+_.forEach = _.each
+_.foldl = _.inject = _.reduce
+_.foldr = _.reduceRight
+_.select = _.filter
+_.all = _.every
+_.any = _.some
+_.contains = _.include
+_.head = _.first
+_.tail = _.rest
+_.methods = _.functions
+
+
+# Setup the OOP Wrapper
+# ---------------------
+
+# If Underscore is called as a function, it returns a wrapped object that
+# can be used OO-style. This wrapper holds altered versions of all the
+# underscore functions. Wrapped objects may be chained.
+wrapper = (obj) ->
+ this._wrapped = obj
+ this
+
+
+# Helper function to continue chaining intermediate results.
+result = (obj, chain) ->
+ if chain then _(obj).chain() else obj
+
+
+# A method to easily add functions to the OOP wrapper.
+addToWrapper = (name, func) ->
+ wrapper.prototype[name] = ->
+ args = _.toArray arguments
+ unshift.call args, this._wrapped
+ result func.apply(_, args), this._chain
+
+
+# Add all ofthe Underscore functions to the wrapper object.
+_.mixin _
+
+
+# Add all mutator Array functions to the wrapper.
+_.each ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], (name) ->
+ method = Array.prototype[name]
+ wrapper.prototype[name] = ->
+ method.apply(this._wrapped, arguments)
+ result(this._wrapped, this._chain)
+
+
+# Add all accessor Array functions to the wrapper.
+_.each ['concat', 'join', 'slice'], (name) ->
+ method = Array.prototype[name]
+ wrapper.prototype[name] = ->
+ result(method.apply(this._wrapped, arguments), this._chain)
+
+
+# Start chaining a wrapped Underscore object.
+wrapper::chain = ->
+ this._chain = true
+ this
+
+
+# Extracts the result from a wrapped and chained object.
+wrapper::value = -> this._wrapped
+
+
+
+ MIME types defined: application/vnd.coffeescript
, text/coffeescript
, text/x-coffeescript
.
+
+ The CoffeeScript mode was written by Jeff Pickhardt.
+
+
diff --git a/theme/plugins/codemirror/mode/commonlisp/commonlisp.js b/theme/plugins/codemirror/mode/commonlisp/commonlisp.js
new file mode 100644
index 0000000000000000000000000000000000000000..8cd212d3a8cda29a6571762dc399b182f053b610
--- /dev/null
+++ b/theme/plugins/codemirror/mode/commonlisp/commonlisp.js
@@ -0,0 +1,124 @@
+// 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("commonlisp", function (config) {
+ var specialForm = /^(block|let*|return-from|catch|load-time-value|setq|eval-when|locally|symbol-macrolet|flet|macrolet|tagbody|function|multiple-value-call|the|go|multiple-value-prog1|throw|if|progn|unwind-protect|labels|progv|let|quote)$/;
+ var assumeBody = /^with|^def|^do|^prog|case$|^cond$|bind$|when$|unless$/;
+ var numLiteral = /^(?:[+\-]?(?:\d+|\d*\.\d+)(?:[efd][+\-]?\d+)?|[+\-]?\d+(?:\/[+\-]?\d+)?|#b[+\-]?[01]+|#o[+\-]?[0-7]+|#x[+\-]?[\da-f]+)/;
+ var symbol = /[^\s'`,@()\[\]";]/;
+ var type;
+
+ function readSym(stream) {
+ var ch;
+ while (ch = stream.next()) {
+ if (ch == "\\") stream.next();
+ else if (!symbol.test(ch)) { stream.backUp(1); break; }
+ }
+ return stream.current();
+ }
+
+ function base(stream, state) {
+ if (stream.eatSpace()) {type = "ws"; return null;}
+ if (stream.match(numLiteral)) return "number";
+ var ch = stream.next();
+ if (ch == "\\") ch = stream.next();
+
+ if (ch == '"') return (state.tokenize = inString)(stream, state);
+ else if (ch == "(") { type = "open"; return "bracket"; }
+ else if (ch == ")" || ch == "]") { type = "close"; return "bracket"; }
+ else if (ch == ";") { stream.skipToEnd(); type = "ws"; return "comment"; }
+ else if (/['`,@]/.test(ch)) return null;
+ else if (ch == "|") {
+ if (stream.skipTo("|")) { stream.next(); return "symbol"; }
+ else { stream.skipToEnd(); return "error"; }
+ } else if (ch == "#") {
+ var ch = stream.next();
+ if (ch == "(") { type = "open"; return "bracket"; }
+ else if (/[+\-=\.']/.test(ch)) return null;
+ else if (/\d/.test(ch) && stream.match(/^\d*#/)) return null;
+ else if (ch == "|") return (state.tokenize = inComment)(stream, state);
+ else if (ch == ":") { readSym(stream); return "meta"; }
+ else if (ch == "\\") { stream.next(); readSym(stream); return "string-2" }
+ else return "error";
+ } else {
+ var name = readSym(stream);
+ if (name == ".") return null;
+ type = "symbol";
+ if (name == "nil" || name == "t" || name.charAt(0) == ":") return "atom";
+ if (state.lastType == "open" && (specialForm.test(name) || assumeBody.test(name))) return "keyword";
+ if (name.charAt(0) == "&") return "variable-2";
+ return "variable";
+ }
+ }
+
+ function inString(stream, state) {
+ var escaped = false, next;
+ while (next = stream.next()) {
+ if (next == '"' && !escaped) { state.tokenize = base; break; }
+ escaped = !escaped && next == "\\";
+ }
+ return "string";
+ }
+
+ function inComment(stream, state) {
+ var next, last;
+ while (next = stream.next()) {
+ if (next == "#" && last == "|") { state.tokenize = base; break; }
+ last = next;
+ }
+ type = "ws";
+ return "comment";
+ }
+
+ return {
+ startState: function () {
+ return {ctx: {prev: null, start: 0, indentTo: 0}, lastType: null, tokenize: base};
+ },
+
+ token: function (stream, state) {
+ if (stream.sol() && typeof state.ctx.indentTo != "number")
+ state.ctx.indentTo = state.ctx.start + 1;
+
+ type = null;
+ var style = state.tokenize(stream, state);
+ if (type != "ws") {
+ if (state.ctx.indentTo == null) {
+ if (type == "symbol" && assumeBody.test(stream.current()))
+ state.ctx.indentTo = state.ctx.start + config.indentUnit;
+ else
+ state.ctx.indentTo = "next";
+ } else if (state.ctx.indentTo == "next") {
+ state.ctx.indentTo = stream.column();
+ }
+ state.lastType = type;
+ }
+ if (type == "open") state.ctx = {prev: state.ctx, start: stream.column(), indentTo: null};
+ else if (type == "close") state.ctx = state.ctx.prev || state.ctx;
+ return style;
+ },
+
+ indent: function (state, _textAfter) {
+ var i = state.ctx.indentTo;
+ return typeof i == "number" ? i : state.ctx.start + 1;
+ },
+
+ closeBrackets: {pairs: "()[]{}\"\""},
+ lineComment: ";;",
+ blockCommentStart: "#|",
+ blockCommentEnd: "|#"
+ };
+});
+
+CodeMirror.defineMIME("text/x-common-lisp", "commonlisp");
+
+});
diff --git a/theme/plugins/codemirror/mode/commonlisp/index.html b/theme/plugins/codemirror/mode/commonlisp/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..f2bf4522d6a57b6f1d8377f90a4608f9d2fd1506
--- /dev/null
+++ b/theme/plugins/codemirror/mode/commonlisp/index.html
@@ -0,0 +1,177 @@
+
+
+CodeMirror: Common Lisp mode
+
+
+
+
+
+
+
+
+
+
+Common Lisp mode
+(in-package :cl-postgres)
+
+;; These are used to synthesize reader and writer names for integer
+;; reading/writing functions when the amount of bytes and the
+;; signedness is known. Both the macro that creates the functions and
+;; some macros that use them create names this way.
+(eval-when (:compile-toplevel :load-toplevel :execute)
+ (defun integer-reader-name (bytes signed)
+ (intern (with-standard-io-syntax
+ (format nil "~a~a~a~a" '#:read- (if signed "" '#:u) '#:int bytes))))
+ (defun integer-writer-name (bytes signed)
+ (intern (with-standard-io-syntax
+ (format nil "~a~a~a~a" '#:write- (if signed "" '#:u) '#:int bytes)))))
+
+(defmacro integer-reader (bytes)
+ "Create a function to read integers from a binary stream."
+ (let ((bits (* bytes 8)))
+ (labels ((return-form (signed)
+ (if signed
+ `(if (logbitp ,(1- bits) result)
+ (dpb result (byte ,(1- bits) 0) -1)
+ result)
+ `result))
+ (generate-reader (signed)
+ `(defun ,(integer-reader-name bytes signed) (socket)
+ (declare (type stream socket)
+ #.*optimize*)
+ ,(if (= bytes 1)
+ `(let ((result (the (unsigned-byte 8) (read-byte socket))))
+ (declare (type (unsigned-byte 8) result))
+ ,(return-form signed))
+ `(let ((result 0))
+ (declare (type (unsigned-byte ,bits) result))
+ ,@(loop :for byte :from (1- bytes) :downto 0
+ :collect `(setf (ldb (byte 8 ,(* 8 byte)) result)
+ (the (unsigned-byte 8) (read-byte socket))))
+ ,(return-form signed))))))
+ `(progn
+;; This causes weird errors on SBCL in some circumstances. Disabled for now.
+;; (declaim (inline ,(integer-reader-name bytes t)
+;; ,(integer-reader-name bytes nil)))
+ (declaim (ftype (function (t) (signed-byte ,bits))
+ ,(integer-reader-name bytes t)))
+ ,(generate-reader t)
+ (declaim (ftype (function (t) (unsigned-byte ,bits))
+ ,(integer-reader-name bytes nil)))
+ ,(generate-reader nil)))))
+
+(defmacro integer-writer (bytes)
+ "Create a function to write integers to a binary stream."
+ (let ((bits (* 8 bytes)))
+ `(progn
+ (declaim (inline ,(integer-writer-name bytes t)
+ ,(integer-writer-name bytes nil)))
+ (defun ,(integer-writer-name bytes nil) (socket value)
+ (declare (type stream socket)
+ (type (unsigned-byte ,bits) value)
+ #.*optimize*)
+ ,@(if (= bytes 1)
+ `((write-byte value socket))
+ (loop :for byte :from (1- bytes) :downto 0
+ :collect `(write-byte (ldb (byte 8 ,(* byte 8)) value)
+ socket)))
+ (values))
+ (defun ,(integer-writer-name bytes t) (socket value)
+ (declare (type stream socket)
+ (type (signed-byte ,bits) value)
+ #.*optimize*)
+ ,@(if (= bytes 1)
+ `((write-byte (ldb (byte 8 0) value) socket))
+ (loop :for byte :from (1- bytes) :downto 0
+ :collect `(write-byte (ldb (byte 8 ,(* byte 8)) value)
+ socket)))
+ (values)))))
+
+;; All the instances of the above that we need.
+
+(integer-reader 1)
+(integer-reader 2)
+(integer-reader 4)
+(integer-reader 8)
+
+(integer-writer 1)
+(integer-writer 2)
+(integer-writer 4)
+
+(defun write-bytes (socket bytes)
+ "Write a byte-array to a stream."
+ (declare (type stream socket)
+ (type (simple-array (unsigned-byte 8)) bytes)
+ #.*optimize*)
+ (write-sequence bytes socket))
+
+(defun write-str (socket string)
+ "Write a null-terminated string to a stream \(encoding it when UTF-8
+support is enabled.)."
+ (declare (type stream socket)
+ (type string string)
+ #.*optimize*)
+ (enc-write-string string socket)
+ (write-uint1 socket 0))
+
+(declaim (ftype (function (t unsigned-byte)
+ (simple-array (unsigned-byte 8) (*)))
+ read-bytes))
+(defun read-bytes (socket length)
+ "Read a byte array of the given length from a stream."
+ (declare (type stream socket)
+ (type fixnum length)
+ #.*optimize*)
+ (let ((result (make-array length :element-type '(unsigned-byte 8))))
+ (read-sequence result socket)
+ result))
+
+(declaim (ftype (function (t) string) read-str))
+(defun read-str (socket)
+ "Read a null-terminated string from a stream. Takes care of encoding
+when UTF-8 support is enabled."
+ (declare (type stream socket)
+ #.*optimize*)
+ (enc-read-string socket :null-terminated t))
+
+(defun skip-bytes (socket length)
+ "Skip a given number of bytes in a binary stream."
+ (declare (type stream socket)
+ (type (unsigned-byte 32) length)
+ #.*optimize*)
+ (dotimes (i length)
+ (read-byte socket)))
+
+(defun skip-str (socket)
+ "Skip a null-terminated string."
+ (declare (type stream socket)
+ #.*optimize*)
+ (loop :for char :of-type fixnum = (read-byte socket)
+ :until (zerop char)))
+
+(defun ensure-socket-is-closed (socket &key abort)
+ (when (open-stream-p socket)
+ (handler-case
+ (close socket :abort abort)
+ (error (error)
+ (warn "Ignoring the error which happened while trying to close PostgreSQL socket: ~A" error)))))
+
+
+
+ MIME types defined: text/x-common-lisp
.
+
+
diff --git a/theme/plugins/codemirror/mode/crystal/crystal.js b/theme/plugins/codemirror/mode/crystal/crystal.js
new file mode 100644
index 0000000000000000000000000000000000000000..dada112da81dd747a2c7ad09d7e7e2d5941d0054
--- /dev/null
+++ b/theme/plugins/codemirror/mode/crystal/crystal.js
@@ -0,0 +1,433 @@
+// 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("crystal", function(config) {
+ function wordRegExp(words, end) {
+ return new RegExp((end ? "" : "^") + "(?:" + words.join("|") + ")" + (end ? "$" : "\\b"));
+ }
+
+ function chain(tokenize, stream, state) {
+ state.tokenize.push(tokenize);
+ return tokenize(stream, state);
+ }
+
+ var operators = /^(?:[-+/%|&^]|\*\*?|[<>]{2})/;
+ var conditionalOperators = /^(?:[=!]~|===|<=>|[<>=!]=?|[|&]{2}|~)/;
+ var indexingOperators = /^(?:\[\][?=]?)/;
+ var anotherOperators = /^(?:\.(?:\.{2})?|->|[?:])/;
+ var idents = /^[a-z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/;
+ var types = /^[A-Z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/;
+ var keywords = wordRegExp([
+ "abstract", "alias", "as", "asm", "begin", "break", "case", "class", "def", "do",
+ "else", "elsif", "end", "ensure", "enum", "extend", "for", "fun", "if",
+ "include", "instance_sizeof", "lib", "macro", "module", "next", "of", "out", "pointerof",
+ "private", "protected", "rescue", "return", "require", "select", "sizeof", "struct",
+ "super", "then", "type", "typeof", "uninitialized", "union", "unless", "until", "when", "while", "with",
+ "yield", "__DIR__", "__END_LINE__", "__FILE__", "__LINE__"
+ ]);
+ var atomWords = wordRegExp(["true", "false", "nil", "self"]);
+ var indentKeywordsArray = [
+ "def", "fun", "macro",
+ "class", "module", "struct", "lib", "enum", "union",
+ "do", "for"
+ ];
+ var indentKeywords = wordRegExp(indentKeywordsArray);
+ var indentExpressionKeywordsArray = ["if", "unless", "case", "while", "until", "begin", "then"];
+ var indentExpressionKeywords = wordRegExp(indentExpressionKeywordsArray);
+ var dedentKeywordsArray = ["end", "else", "elsif", "rescue", "ensure"];
+ var dedentKeywords = wordRegExp(dedentKeywordsArray);
+ var dedentPunctualsArray = ["\\)", "\\}", "\\]"];
+ var dedentPunctuals = new RegExp("^(?:" + dedentPunctualsArray.join("|") + ")$");
+ var nextTokenizer = {
+ "def": tokenFollowIdent, "fun": tokenFollowIdent, "macro": tokenMacroDef,
+ "class": tokenFollowType, "module": tokenFollowType, "struct": tokenFollowType,
+ "lib": tokenFollowType, "enum": tokenFollowType, "union": tokenFollowType
+ };
+ var matching = {"[": "]", "{": "}", "(": ")", "<": ">"};
+
+ function tokenBase(stream, state) {
+ if (stream.eatSpace()) {
+ return null;
+ }
+
+ // Macros
+ if (state.lastToken != "\\" && stream.match("{%", false)) {
+ return chain(tokenMacro("%", "%"), stream, state);
+ }
+
+ if (state.lastToken != "\\" && stream.match("{{", false)) {
+ return chain(tokenMacro("{", "}"), stream, state);
+ }
+
+ // Comments
+ if (stream.peek() == "#") {
+ stream.skipToEnd();
+ return "comment";
+ }
+
+ // Variables and keywords
+ var matched;
+ if (stream.match(idents)) {
+ stream.eat(/[?!]/);
+
+ matched = stream.current();
+ if (stream.eat(":")) {
+ return "atom";
+ } else if (state.lastToken == ".") {
+ return "property";
+ } else if (keywords.test(matched)) {
+ if (indentKeywords.test(matched)) {
+ if (!(matched == "fun" && state.blocks.indexOf("lib") >= 0) && !(matched == "def" && state.lastToken == "abstract")) {
+ state.blocks.push(matched);
+ state.currentIndent += 1;
+ }
+ } else if ((state.lastStyle == "operator" || !state.lastStyle) && indentExpressionKeywords.test(matched)) {
+ state.blocks.push(matched);
+ state.currentIndent += 1;
+ } else if (matched == "end") {
+ state.blocks.pop();
+ state.currentIndent -= 1;
+ }
+
+ if (nextTokenizer.hasOwnProperty(matched)) {
+ state.tokenize.push(nextTokenizer[matched]);
+ }
+
+ return "keyword";
+ } else if (atomWords.test(matched)) {
+ return "atom";
+ }
+
+ return "variable";
+ }
+
+ // Class variables and instance variables
+ // or attributes
+ if (stream.eat("@")) {
+ if (stream.peek() == "[") {
+ return chain(tokenNest("[", "]", "meta"), stream, state);
+ }
+
+ stream.eat("@");
+ stream.match(idents) || stream.match(types);
+ return "variable-2";
+ }
+
+ // Constants and types
+ if (stream.match(types)) {
+ return "tag";
+ }
+
+ // Symbols or ':' operator
+ if (stream.eat(":")) {
+ if (stream.eat("\"")) {
+ return chain(tokenQuote("\"", "atom", false), stream, state);
+ } else if (stream.match(idents) || stream.match(types) ||
+ stream.match(operators) || stream.match(conditionalOperators) || stream.match(indexingOperators)) {
+ return "atom";
+ }
+ stream.eat(":");
+ return "operator";
+ }
+
+ // Strings
+ if (stream.eat("\"")) {
+ return chain(tokenQuote("\"", "string", true), stream, state);
+ }
+
+ // Strings or regexps or macro variables or '%' operator
+ if (stream.peek() == "%") {
+ var style = "string";
+ var embed = true;
+ var delim;
+
+ if (stream.match("%r")) {
+ // Regexps
+ style = "string-2";
+ delim = stream.next();
+ } else if (stream.match("%w")) {
+ embed = false;
+ delim = stream.next();
+ } else if (stream.match("%q")) {
+ embed = false;
+ delim = stream.next();
+ } else {
+ if(delim = stream.match(/^%([^\w\s=])/)) {
+ delim = delim[1];
+ } else if (stream.match(/^%[a-zA-Z0-9_\u009F-\uFFFF]*/)) {
+ // Macro variables
+ return "meta";
+ } else {
+ // '%' operator
+ return "operator";
+ }
+ }
+
+ if (matching.hasOwnProperty(delim)) {
+ delim = matching[delim];
+ }
+ return chain(tokenQuote(delim, style, embed), stream, state);
+ }
+
+ // Here Docs
+ if (matched = stream.match(/^<<-('?)([A-Z]\w*)\1/)) {
+ return chain(tokenHereDoc(matched[2], !matched[1]), stream, state)
+ }
+
+ // Characters
+ if (stream.eat("'")) {
+ stream.match(/^(?:[^']|\\(?:[befnrtv0'"]|[0-7]{3}|u(?:[0-9a-fA-F]{4}|\{[0-9a-fA-F]{1,6}\})))/);
+ stream.eat("'");
+ return "atom";
+ }
+
+ // Numbers
+ if (stream.eat("0")) {
+ if (stream.eat("x")) {
+ stream.match(/^[0-9a-fA-F]+/);
+ } else if (stream.eat("o")) {
+ stream.match(/^[0-7]+/);
+ } else if (stream.eat("b")) {
+ stream.match(/^[01]+/);
+ }
+ return "number";
+ }
+
+ if (stream.eat(/^\d/)) {
+ stream.match(/^\d*(?:\.\d+)?(?:[eE][+-]?\d+)?/);
+ return "number";
+ }
+
+ // Operators
+ if (stream.match(operators)) {
+ stream.eat("="); // Operators can follow assign symbol.
+ return "operator";
+ }
+
+ if (stream.match(conditionalOperators) || stream.match(anotherOperators)) {
+ return "operator";
+ }
+
+ // Parens and braces
+ if (matched = stream.match(/[({[]/, false)) {
+ matched = matched[0];
+ return chain(tokenNest(matched, matching[matched], null), stream, state);
+ }
+
+ // Escapes
+ if (stream.eat("\\")) {
+ stream.next();
+ return "meta";
+ }
+
+ stream.next();
+ return null;
+ }
+
+ function tokenNest(begin, end, style, started) {
+ return function (stream, state) {
+ if (!started && stream.match(begin)) {
+ state.tokenize[state.tokenize.length - 1] = tokenNest(begin, end, style, true);
+ state.currentIndent += 1;
+ return style;
+ }
+
+ var nextStyle = tokenBase(stream, state);
+ if (stream.current() === end) {
+ state.tokenize.pop();
+ state.currentIndent -= 1;
+ nextStyle = style;
+ }
+
+ return nextStyle;
+ };
+ }
+
+ function tokenMacro(begin, end, started) {
+ return function (stream, state) {
+ if (!started && stream.match("{" + begin)) {
+ state.currentIndent += 1;
+ state.tokenize[state.tokenize.length - 1] = tokenMacro(begin, end, true);
+ return "meta";
+ }
+
+ if (stream.match(end + "}")) {
+ state.currentIndent -= 1;
+ state.tokenize.pop();
+ return "meta";
+ }
+
+ return tokenBase(stream, state);
+ };
+ }
+
+ function tokenMacroDef(stream, state) {
+ if (stream.eatSpace()) {
+ return null;
+ }
+
+ var matched;
+ if (matched = stream.match(idents)) {
+ if (matched == "def") {
+ return "keyword";
+ }
+ stream.eat(/[?!]/);
+ }
+
+ state.tokenize.pop();
+ return "def";
+ }
+
+ function tokenFollowIdent(stream, state) {
+ if (stream.eatSpace()) {
+ return null;
+ }
+
+ if (stream.match(idents)) {
+ stream.eat(/[!?]/);
+ } else {
+ stream.match(operators) || stream.match(conditionalOperators) || stream.match(indexingOperators);
+ }
+ state.tokenize.pop();
+ return "def";
+ }
+
+ function tokenFollowType(stream, state) {
+ if (stream.eatSpace()) {
+ return null;
+ }
+
+ stream.match(types);
+ state.tokenize.pop();
+ return "def";
+ }
+
+ function tokenQuote(end, style, embed) {
+ return function (stream, state) {
+ var escaped = false;
+
+ while (stream.peek()) {
+ if (!escaped) {
+ if (stream.match("{%", false)) {
+ state.tokenize.push(tokenMacro("%", "%"));
+ return style;
+ }
+
+ if (stream.match("{{", false)) {
+ state.tokenize.push(tokenMacro("{", "}"));
+ return style;
+ }
+
+ if (embed && stream.match("#{", false)) {
+ state.tokenize.push(tokenNest("#{", "}", "meta"));
+ return style;
+ }
+
+ var ch = stream.next();
+
+ if (ch == end) {
+ state.tokenize.pop();
+ return style;
+ }
+
+ escaped = embed && ch == "\\";
+ } else {
+ stream.next();
+ escaped = false;
+ }
+ }
+
+ return style;
+ };
+ }
+
+ function tokenHereDoc(phrase, embed) {
+ return function (stream, state) {
+ if (stream.sol()) {
+ stream.eatSpace()
+ if (stream.match(phrase)) {
+ state.tokenize.pop();
+ return "string";
+ }
+ }
+
+ var escaped = false;
+ while (stream.peek()) {
+ if (!escaped) {
+ if (stream.match("{%", false)) {
+ state.tokenize.push(tokenMacro("%", "%"));
+ return "string";
+ }
+
+ if (stream.match("{{", false)) {
+ state.tokenize.push(tokenMacro("{", "}"));
+ return "string";
+ }
+
+ if (embed && stream.match("#{", false)) {
+ state.tokenize.push(tokenNest("#{", "}", "meta"));
+ return "string";
+ }
+
+ escaped = embed && stream.next() == "\\";
+ } else {
+ stream.next();
+ escaped = false;
+ }
+ }
+
+ return "string";
+ }
+ }
+
+ return {
+ startState: function () {
+ return {
+ tokenize: [tokenBase],
+ currentIndent: 0,
+ lastToken: null,
+ lastStyle: null,
+ blocks: []
+ };
+ },
+
+ token: function (stream, state) {
+ var style = state.tokenize[state.tokenize.length - 1](stream, state);
+ var token = stream.current();
+
+ if (style && style != "comment") {
+ state.lastToken = token;
+ state.lastStyle = style;
+ }
+
+ return style;
+ },
+
+ indent: function (state, textAfter) {
+ textAfter = textAfter.replace(/^\s*(?:\{%)?\s*|\s*(?:%\})?\s*$/g, "");
+
+ if (dedentKeywords.test(textAfter) || dedentPunctuals.test(textAfter)) {
+ return config.indentUnit * (state.currentIndent - 1);
+ }
+
+ return config.indentUnit * state.currentIndent;
+ },
+
+ fold: "indent",
+ electricInput: wordRegExp(dedentPunctualsArray.concat(dedentKeywordsArray), true),
+ lineComment: '#'
+ };
+ });
+
+ CodeMirror.defineMIME("text/x-crystal", "crystal");
+});
diff --git a/theme/plugins/codemirror/mode/crystal/index.html b/theme/plugins/codemirror/mode/crystal/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..95412579f253a2dc5391ef5509112295c8d4fbed
--- /dev/null
+++ b/theme/plugins/codemirror/mode/crystal/index.html
@@ -0,0 +1,116 @@
+
+
+CodeMirror: Crystal mode
+
+
+
+
+
+
+
+
+
+
+
+
+Crystal mode
+
+# Features of Crystal
+# - Ruby-inspired syntax.
+# - Statically type-checked but without having to specify the type of variables or method arguments.
+# - Be able to call C code by writing bindings to it in Crystal.
+# - Have compile-time evaluation and generation of code, to avoid boilerplate code.
+# - Compile to efficient native code.
+
+# A very basic HTTP server
+require "http/server"
+
+server = HTTP::Server.new(8080) do |request|
+ HTTP::Response.ok "text/plain", "Hello world, got #{request.path}!"
+end
+
+puts "Listening on http://0.0.0.0:8080"
+server.listen
+
+module Foo
+ abstract def abstract_method : String
+
+ @[AlwaysInline]
+ def with_foofoo
+ with Foo.new(self) yield
+ end
+
+ struct Foo
+ def initialize(@foo : ::Foo)
+ end
+
+ def hello_world
+ @foo.abstract_method
+ end
+ end
+end
+
+class Bar
+ include Foo
+
+ @@foobar = 12345
+
+ def initialize(@bar : Int32)
+ end
+
+ macro alias_method(name, method)
+ def {{ name }}(*args)
+ {{ method }}(*args)
+ end
+ end
+
+ def a_method
+ "Hello, World"
+ end
+
+ alias_method abstract_method, a_method
+
+ def show_instance_vars : Nil
+ {% for var in @type.instance_vars %}
+ puts "@{{ var }} = #{ @{{ var }} }"
+ {% end %}
+ end
+end
+
+class Baz < Bar; end
+
+lib LibC
+ fun c_puts = "puts"(str : Char*) : Int
+end
+
+baz = Baz.new(100)
+baz.show_instance_vars
+baz.with_foofoo do
+ LibC.c_puts hello_world
+end
+
+
+
+MIME types defined: text/x-crystal
.
+
diff --git a/theme/plugins/codemirror/mode/css/css.js b/theme/plugins/codemirror/mode/css/css.js
new file mode 100644
index 0000000000000000000000000000000000000000..f5f3a41ba8a060200ae36352978aded3ff87c81d
--- /dev/null
+++ b/theme/plugins/codemirror/mode/css/css.js
@@ -0,0 +1,832 @@
+// 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("css", function(config, parserConfig) {
+ var inline = parserConfig.inline
+ if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode("text/css");
+
+ var indentUnit = config.indentUnit,
+ tokenHooks = parserConfig.tokenHooks,
+ documentTypes = parserConfig.documentTypes || {},
+ mediaTypes = parserConfig.mediaTypes || {},
+ mediaFeatures = parserConfig.mediaFeatures || {},
+ mediaValueKeywords = parserConfig.mediaValueKeywords || {},
+ propertyKeywords = parserConfig.propertyKeywords || {},
+ nonStandardPropertyKeywords = parserConfig.nonStandardPropertyKeywords || {},
+ fontProperties = parserConfig.fontProperties || {},
+ counterDescriptors = parserConfig.counterDescriptors || {},
+ colorKeywords = parserConfig.colorKeywords || {},
+ valueKeywords = parserConfig.valueKeywords || {},
+ allowNested = parserConfig.allowNested,
+ lineComment = parserConfig.lineComment,
+ supportsAtComponent = parserConfig.supportsAtComponent === true;
+
+ var type, override;
+ function ret(style, tp) { type = tp; return style; }
+
+ // Tokenizers
+
+ function tokenBase(stream, state) {
+ var ch = stream.next();
+ if (tokenHooks[ch]) {
+ var result = tokenHooks[ch](stream, state);
+ if (result !== false) return result;
+ }
+ if (ch == "@") {
+ stream.eatWhile(/[\w\\\-]/);
+ return ret("def", stream.current());
+ } else if (ch == "=" || (ch == "~" || ch == "|") && stream.eat("=")) {
+ return ret(null, "compare");
+ } else if (ch == "\"" || ch == "'") {
+ state.tokenize = tokenString(ch);
+ return state.tokenize(stream, state);
+ } else if (ch == "#") {
+ stream.eatWhile(/[\w\\\-]/);
+ return ret("atom", "hash");
+ } else if (ch == "!") {
+ stream.match(/^\s*\w*/);
+ return ret("keyword", "important");
+ } else if (/\d/.test(ch) || ch == "." && stream.eat(/\d/)) {
+ stream.eatWhile(/[\w.%]/);
+ return ret("number", "unit");
+ } else if (ch === "-") {
+ if (/[\d.]/.test(stream.peek())) {
+ stream.eatWhile(/[\w.%]/);
+ return ret("number", "unit");
+ } else if (stream.match(/^-[\w\\\-]+/)) {
+ stream.eatWhile(/[\w\\\-]/);
+ if (stream.match(/^\s*:/, false))
+ return ret("variable-2", "variable-definition");
+ return ret("variable-2", "variable");
+ } else if (stream.match(/^\w+-/)) {
+ return ret("meta", "meta");
+ }
+ } else if (/[,+>*\/]/.test(ch)) {
+ return ret(null, "select-op");
+ } else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) {
+ return ret("qualifier", "qualifier");
+ } else if (/[:;{}\[\]\(\)]/.test(ch)) {
+ return ret(null, ch);
+ } else if (((ch == "u" || ch == "U") && stream.match(/rl(-prefix)?\(/i)) ||
+ ((ch == "d" || ch == "D") && stream.match("omain(", true, true)) ||
+ ((ch == "r" || ch == "R") && stream.match("egexp(", true, true))) {
+ stream.backUp(1);
+ state.tokenize = tokenParenthesized;
+ return ret("property", "word");
+ } else if (/[\w\\\-]/.test(ch)) {
+ stream.eatWhile(/[\w\\\-]/);
+ return ret("property", "word");
+ } else {
+ return ret(null, null);
+ }
+ }
+
+ 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 ret("string", "string");
+ };
+ }
+
+ function tokenParenthesized(stream, state) {
+ stream.next(); // Must be '('
+ if (!stream.match(/\s*[\"\')]/, false))
+ state.tokenize = tokenString(")");
+ else
+ state.tokenize = null;
+ return ret(null, "(");
+ }
+
+ // Context management
+
+ function Context(type, indent, prev) {
+ this.type = type;
+ this.indent = indent;
+ this.prev = prev;
+ }
+
+ function pushContext(state, stream, type, indent) {
+ state.context = new Context(type, stream.indentation() + (indent === false ? 0 : indentUnit), state.context);
+ return type;
+ }
+
+ function popContext(state) {
+ if (state.context.prev)
+ state.context = state.context.prev;
+ 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 wordAsValue(stream) {
+ var word = stream.current().toLowerCase();
+ if (valueKeywords.hasOwnProperty(word))
+ override = "atom";
+ else if (colorKeywords.hasOwnProperty(word))
+ override = "keyword";
+ else
+ override = "variable";
+ }
+
+ var states = {};
+
+ states.top = function(type, stream, state) {
+ if (type == "{") {
+ return pushContext(state, stream, "block");
+ } else if (type == "}" && state.context.prev) {
+ return popContext(state);
+ } else if (supportsAtComponent && /@component/i.test(type)) {
+ return pushContext(state, stream, "atComponentBlock");
+ } else if (/^@(-moz-)?document$/i.test(type)) {
+ return pushContext(state, stream, "documentTypes");
+ } else if (/^@(media|supports|(-moz-)?document|import)$/i.test(type)) {
+ return pushContext(state, stream, "atBlock");
+ } else if (/^@(font-face|counter-style)/i.test(type)) {
+ state.stateArg = type;
+ return "restricted_atBlock_before";
+ } else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(type)) {
+ return "keyframes";
+ } else if (type && type.charAt(0) == "@") {
+ return pushContext(state, stream, "at");
+ } else if (type == "hash") {
+ override = "builtin";
+ } else if (type == "word") {
+ override = "tag";
+ } else if (type == "variable-definition") {
+ return "maybeprop";
+ } else if (type == "interpolation") {
+ return pushContext(state, stream, "interpolation");
+ } else if (type == ":") {
+ return "pseudo";
+ } else if (allowNested && type == "(") {
+ return pushContext(state, stream, "parens");
+ }
+ return state.context.type;
+ };
+
+ states.block = function(type, stream, state) {
+ if (type == "word") {
+ var word = stream.current().toLowerCase();
+ if (propertyKeywords.hasOwnProperty(word)) {
+ override = "property";
+ return "maybeprop";
+ } else if (nonStandardPropertyKeywords.hasOwnProperty(word)) {
+ override = "string-2";
+ return "maybeprop";
+ } else if (allowNested) {
+ override = stream.match(/^\s*:(?:\s|$)/, false) ? "property" : "tag";
+ return "block";
+ } else {
+ override += " error";
+ return "maybeprop";
+ }
+ } else if (type == "meta") {
+ return "block";
+ } else if (!allowNested && (type == "hash" || type == "qualifier")) {
+ override = "error";
+ return "block";
+ } else {
+ return states.top(type, stream, state);
+ }
+ };
+
+ states.maybeprop = function(type, stream, state) {
+ if (type == ":") return pushContext(state, stream, "prop");
+ return pass(type, stream, state);
+ };
+
+ states.prop = function(type, stream, state) {
+ if (type == ";") return popContext(state);
+ if (type == "{" && allowNested) return pushContext(state, stream, "propBlock");
+ if (type == "}" || type == "{") return popAndPass(type, stream, state);
+ if (type == "(") return pushContext(state, stream, "parens");
+
+ if (type == "hash" && !/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(stream.current())) {
+ override += " error";
+ } else if (type == "word") {
+ wordAsValue(stream);
+ } else if (type == "interpolation") {
+ return pushContext(state, stream, "interpolation");
+ }
+ return "prop";
+ };
+
+ states.propBlock = function(type, _stream, state) {
+ if (type == "}") return popContext(state);
+ if (type == "word") { override = "property"; return "maybeprop"; }
+ return state.context.type;
+ };
+
+ states.parens = function(type, stream, state) {
+ if (type == "{" || type == "}") return popAndPass(type, stream, state);
+ if (type == ")") return popContext(state);
+ if (type == "(") return pushContext(state, stream, "parens");
+ if (type == "interpolation") return pushContext(state, stream, "interpolation");
+ if (type == "word") wordAsValue(stream);
+ return "parens";
+ };
+
+ states.pseudo = function(type, stream, state) {
+ if (type == "meta") return "pseudo";
+
+ if (type == "word") {
+ override = "variable-3";
+ return state.context.type;
+ }
+ return pass(type, stream, state);
+ };
+
+ states.documentTypes = function(type, stream, state) {
+ if (type == "word" && documentTypes.hasOwnProperty(stream.current())) {
+ override = "tag";
+ return state.context.type;
+ } else {
+ return states.atBlock(type, stream, state);
+ }
+ };
+
+ states.atBlock = function(type, stream, state) {
+ if (type == "(") return pushContext(state, stream, "atBlock_parens");
+ if (type == "}" || type == ";") return popAndPass(type, stream, state);
+ if (type == "{") return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top");
+
+ if (type == "interpolation") return pushContext(state, stream, "interpolation");
+
+ if (type == "word") {
+ var word = stream.current().toLowerCase();
+ if (word == "only" || word == "not" || word == "and" || word == "or")
+ override = "keyword";
+ else if (mediaTypes.hasOwnProperty(word))
+ override = "attribute";
+ else if (mediaFeatures.hasOwnProperty(word))
+ override = "property";
+ else if (mediaValueKeywords.hasOwnProperty(word))
+ override = "keyword";
+ else if (propertyKeywords.hasOwnProperty(word))
+ override = "property";
+ else if (nonStandardPropertyKeywords.hasOwnProperty(word))
+ override = "string-2";
+ else if (valueKeywords.hasOwnProperty(word))
+ override = "atom";
+ else if (colorKeywords.hasOwnProperty(word))
+ override = "keyword";
+ else
+ override = "error";
+ }
+ return state.context.type;
+ };
+
+ states.atComponentBlock = function(type, stream, state) {
+ if (type == "}")
+ return popAndPass(type, stream, state);
+ if (type == "{")
+ return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top", false);
+ if (type == "word")
+ override = "error";
+ return state.context.type;
+ };
+
+ states.atBlock_parens = function(type, stream, state) {
+ if (type == ")") return popContext(state);
+ if (type == "{" || type == "}") return popAndPass(type, stream, state, 2);
+ return states.atBlock(type, stream, state);
+ };
+
+ states.restricted_atBlock_before = function(type, stream, state) {
+ if (type == "{")
+ return pushContext(state, stream, "restricted_atBlock");
+ if (type == "word" && state.stateArg == "@counter-style") {
+ override = "variable";
+ return "restricted_atBlock_before";
+ }
+ return pass(type, stream, state);
+ };
+
+ states.restricted_atBlock = function(type, stream, state) {
+ if (type == "}") {
+ state.stateArg = null;
+ return popContext(state);
+ }
+ if (type == "word") {
+ if ((state.stateArg == "@font-face" && !fontProperties.hasOwnProperty(stream.current().toLowerCase())) ||
+ (state.stateArg == "@counter-style" && !counterDescriptors.hasOwnProperty(stream.current().toLowerCase())))
+ override = "error";
+ else
+ override = "property";
+ return "maybeprop";
+ }
+ return "restricted_atBlock";
+ };
+
+ states.keyframes = function(type, stream, state) {
+ if (type == "word") { override = "variable"; return "keyframes"; }
+ if (type == "{") return pushContext(state, stream, "top");
+ return pass(type, stream, state);
+ };
+
+ states.at = function(type, stream, state) {
+ if (type == ";") return popContext(state);
+ if (type == "{" || type == "}") return popAndPass(type, stream, state);
+ if (type == "word") override = "tag";
+ else if (type == "hash") override = "builtin";
+ return "at";
+ };
+
+ states.interpolation = function(type, stream, state) {
+ if (type == "}") return popContext(state);
+ if (type == "{" || type == ";") return popAndPass(type, stream, state);
+ if (type == "word") override = "variable";
+ else if (type != "variable" && type != "(" && type != ")") override = "error";
+ return "interpolation";
+ };
+
+ return {
+ startState: function(base) {
+ return {tokenize: null,
+ state: inline ? "block" : "top",
+ stateArg: null,
+ context: new Context(inline ? "block" : "top", base || 0, null)};
+ },
+
+ token: function(stream, state) {
+ if (!state.tokenize && stream.eatSpace()) return null;
+ var style = (state.tokenize || tokenBase)(stream, state);
+ if (style && typeof style == "object") {
+ type = style[1];
+ style = style[0];
+ }
+ override = style;
+ if (type != "comment")
+ state.state = states[state.state](type, stream, state);
+ return override;
+ },
+
+ indent: function(state, textAfter) {
+ var cx = state.context, ch = textAfter && textAfter.charAt(0);
+ var indent = cx.indent;
+ if (cx.type == "prop" && (ch == "}" || ch == ")")) cx = cx.prev;
+ if (cx.prev) {
+ if (ch == "}" && (cx.type == "block" || cx.type == "top" ||
+ cx.type == "interpolation" || cx.type == "restricted_atBlock")) {
+ // Resume indentation from parent context.
+ cx = cx.prev;
+ indent = cx.indent;
+ } else if (ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") ||
+ ch == "{" && (cx.type == "at" || cx.type == "atBlock")) {
+ // Dedent relative to current context.
+ indent = Math.max(0, cx.indent - indentUnit);
+ }
+ }
+ return indent;
+ },
+
+ electricChars: "}",
+ blockCommentStart: "/*",
+ blockCommentEnd: "*/",
+ blockCommentContinue: " * ",
+ lineComment: lineComment,
+ fold: "brace"
+ };
+});
+
+ function keySet(array) {
+ var keys = {};
+ for (var i = 0; i < array.length; ++i) {
+ keys[array[i].toLowerCase()] = true;
+ }
+ return keys;
+ }
+
+ var documentTypes_ = [
+ "domain", "regexp", "url", "url-prefix"
+ ], documentTypes = keySet(documentTypes_);
+
+ var mediaTypes_ = [
+ "all", "aural", "braille", "handheld", "print", "projection", "screen",
+ "tty", "tv", "embossed"
+ ], mediaTypes = keySet(mediaTypes_);
+
+ 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", "orientation",
+ "device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio",
+ "pointer", "any-pointer", "hover", "any-hover"
+ ], mediaFeatures = keySet(mediaFeatures_);
+
+ var mediaValueKeywords_ = [
+ "landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover",
+ "interlace", "progressive"
+ ], mediaValueKeywords = keySet(mediaValueKeywords_);
+
+ 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-blend-mode", "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", "caret-color", "clear", "clip", "color", "color-profile", "column-count",
+ "column-fill", "column-gap", "column-rule", "column-rule-color",
+ "column-rule-style", "column-rule-width", "column-span", "column-width",
+ "columns", "content", "counter-increment", "counter-reset", "crop", "cue",
+ "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-rows", "grid-column", "grid-column-end", "grid-column-gap",
+ "grid-column-start", "grid-gap", "grid-row", "grid-row-end", "grid-row-gap",
+ "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", "justify-items", "justify-self", "left", "letter-spacing",
+ "line-break", "line-height", "line-stacking", "line-stacking-ruby",
+ "line-stacking-shift", "line-stacking-strategy", "list-style",
+ "list-style-image", "list-style-position", "list-style-type", "margin",
+ "margin-bottom", "margin-left", "margin-right", "margin-top",
+ "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", "place-content", "place-items", "place-self", "play-during", "position",
+ "presentation-level", "punctuation-trim", "quotes", "region-break-after",
+ "region-break-before", "region-break-inside", "region-fragment",
+ "rendering-intent", "resize", "rest", "rest-after", "rest-before", "richness",
+ "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",
+ "user-select", "vertical-align", "visibility", "voice-balance", "voice-duration",
+ "voice-family", "voice-pitch", "voice-range", "voice-rate", "voice-stress",
+ "voice-volume", "volume", "white-space", "widows", "width", "will-change", "word-break",
+ "word-spacing", "word-wrap", "z-index",
+ // SVG-specific
+ "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"
+ ], propertyKeywords = keySet(propertyKeywords_);
+
+ 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"
+ ], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_);
+
+ var fontProperties_ = [
+ "font-family", "src", "unicode-range", "font-variant", "font-feature-settings",
+ "font-stretch", "font-weight", "font-style"
+ ], fontProperties = keySet(fontProperties_);
+
+ var counterDescriptors_ = [
+ "additive-symbols", "fallback", "negative", "pad", "prefix", "range",
+ "speak-as", "suffix", "symbols", "system"
+ ], counterDescriptors = keySet(counterDescriptors_);
+
+ 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"
+ ], colorKeywords = keySet(colorKeywords_);
+
+ 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", "auto-flow", "avoid", "avoid-column", "avoid-page",
+ "avoid-region", "background", "backwards", "baseline", "below", "bidi-override", "binary",
+ "bengali", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box",
+ "both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel",
+ "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", "color", "color-burn", "color-dodge", "column", "column-reverse",
+ "compact", "condensed", "contain", "content", "contents",
+ "content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop",
+ "cross", "crosshair", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal",
+ "decimal-leading-zero", "default", "default-button", "dense", "destination-atop",
+ "destination-in", "destination-out", "destination-over", "devanagari", "difference",
+ "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", "exclusion", "expanded", "extends", "extra-condensed",
+ "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes",
+ "forwards", "from", "geometricPrecision", "georgian", "graytext", "grid", "groove",
+ "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hard-light", "hebrew",
+ "help", "hidden", "hide", "higher", "highlight", "highlighttext",
+ "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "hue", "icon", "ignore",
+ "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite",
+ "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis",
+ "inline-block", "inline-flex", "inline-grid", "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", "lighten",
+ "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", "luminosity", "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", "multiply", "myanmar", "n-resize",
+ "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
+ "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
+ "ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "opacity", "open-quote",
+ "optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset",
+ "outside", "outside-shape", "overlay", "overline", "padding", "padding-box",
+ "painted", "page", "paused", "persian", "perspective", "plus-darker", "plus-lighter",
+ "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", "row-resize", "row-reverse", "rtl", "run-in", "running",
+ "s-resize", "sans-serif", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen",
+ "scroll", "scrollbar", "scroll-position", "se-resize", "searchfield",
+ "searchfield-cancel-button", "searchfield-decoration",
+ "searchfield-results-button", "searchfield-results-decoration", "self-start", "self-end",
+ "semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama",
+ "simp-chinese-formal", "simp-chinese-informal", "single",
+ "skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal",
+ "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
+ "small", "small-caps", "small-caption", "smaller", "soft-light", "solid", "somali",
+ "source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "space-evenly", "spell-out", "square",
+ "square-button", "start", "static", "status-bar", "stretch", "stroke", "sub",
+ "subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "system-ui", "table",
+ "table-caption", "table-cell", "table-column", "table-column-group",
+ "table-footer-group", "table-header-group", "table-row", "table-row-group",
+ "tamil",
+ "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", "transform",
+ "translate", "translate3d", "translateX", "translateY", "translateZ",
+ "transparent", "ultra-condensed", "ultra-expanded", "underline", "unset", "up",
+ "upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal",
+ "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url",
+ "var", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted",
+ "visibleStroke", "visual", "w-resize", "wait", "wave", "wider",
+ "window", "windowframe", "windowtext", "words", "wrap", "wrap-reverse", "x-large", "x-small", "xor",
+ "xx-large", "xx-small"
+ ], valueKeywords = keySet(valueKeywords_);
+
+ var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(mediaValueKeywords_)
+ .concat(propertyKeywords_).concat(nonStandardPropertyKeywords_).concat(colorKeywords_)
+ .concat(valueKeywords_);
+ CodeMirror.registerHelper("hintWords", "css", allWords);
+
+ 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"];
+ }
+
+ CodeMirror.defineMIME("text/css", {
+ documentTypes: documentTypes,
+ mediaTypes: mediaTypes,
+ mediaFeatures: mediaFeatures,
+ mediaValueKeywords: mediaValueKeywords,
+ propertyKeywords: propertyKeywords,
+ nonStandardPropertyKeywords: nonStandardPropertyKeywords,
+ fontProperties: fontProperties,
+ counterDescriptors: counterDescriptors,
+ colorKeywords: colorKeywords,
+ valueKeywords: valueKeywords,
+ tokenHooks: {
+ "/": function(stream, state) {
+ if (!stream.eat("*")) return false;
+ state.tokenize = tokenCComment;
+ return tokenCComment(stream, state);
+ }
+ },
+ name: "css"
+ });
+
+ CodeMirror.defineMIME("text/x-scss", {
+ mediaTypes: mediaTypes,
+ mediaFeatures: mediaFeatures,
+ mediaValueKeywords: mediaValueKeywords,
+ propertyKeywords: propertyKeywords,
+ nonStandardPropertyKeywords: nonStandardPropertyKeywords,
+ colorKeywords: colorKeywords,
+ valueKeywords: valueKeywords,
+ fontProperties: fontProperties,
+ allowNested: true,
+ lineComment: "//",
+ tokenHooks: {
+ "/": function(stream, state) {
+ if (stream.eat("/")) {
+ stream.skipToEnd();
+ return ["comment", "comment"];
+ } else if (stream.eat("*")) {
+ state.tokenize = tokenCComment;
+ return tokenCComment(stream, state);
+ } else {
+ return ["operator", "operator"];
+ }
+ },
+ ":": function(stream) {
+ if (stream.match(/\s*\{/, false))
+ return [null, null]
+ return false;
+ },
+ "$": function(stream) {
+ stream.match(/^[\w-]+/);
+ if (stream.match(/^\s*:/, false))
+ return ["variable-2", "variable-definition"];
+ return ["variable-2", "variable"];
+ },
+ "#": function(stream) {
+ if (!stream.eat("{")) return false;
+ return [null, "interpolation"];
+ }
+ },
+ name: "css",
+ helperType: "scss"
+ });
+
+ CodeMirror.defineMIME("text/x-less", {
+ mediaTypes: mediaTypes,
+ mediaFeatures: mediaFeatures,
+ mediaValueKeywords: mediaValueKeywords,
+ propertyKeywords: propertyKeywords,
+ nonStandardPropertyKeywords: nonStandardPropertyKeywords,
+ colorKeywords: colorKeywords,
+ valueKeywords: valueKeywords,
+ fontProperties: fontProperties,
+ allowNested: true,
+ lineComment: "//",
+ tokenHooks: {
+ "/": function(stream, state) {
+ if (stream.eat("/")) {
+ stream.skipToEnd();
+ return ["comment", "comment"];
+ } else if (stream.eat("*")) {
+ state.tokenize = tokenCComment;
+ return tokenCComment(stream, state);
+ } else {
+ return ["operator", "operator"];
+ }
+ },
+ "@": function(stream) {
+ if (stream.eat("{")) return [null, "interpolation"];
+ if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/i, false)) return false;
+ stream.eatWhile(/[\w\\\-]/);
+ if (stream.match(/^\s*:/, false))
+ return ["variable-2", "variable-definition"];
+ return ["variable-2", "variable"];
+ },
+ "&": function() {
+ return ["atom", "atom"];
+ }
+ },
+ name: "css",
+ helperType: "less"
+ });
+
+ CodeMirror.defineMIME("text/x-gss", {
+ documentTypes: documentTypes,
+ mediaTypes: mediaTypes,
+ mediaFeatures: mediaFeatures,
+ propertyKeywords: propertyKeywords,
+ nonStandardPropertyKeywords: nonStandardPropertyKeywords,
+ fontProperties: fontProperties,
+ counterDescriptors: counterDescriptors,
+ colorKeywords: colorKeywords,
+ valueKeywords: valueKeywords,
+ supportsAtComponent: true,
+ tokenHooks: {
+ "/": function(stream, state) {
+ if (!stream.eat("*")) return false;
+ state.tokenize = tokenCComment;
+ return tokenCComment(stream, state);
+ }
+ },
+ name: "css",
+ helperType: "gss"
+ });
+
+});
diff --git a/theme/plugins/codemirror/mode/css/gss.html b/theme/plugins/codemirror/mode/css/gss.html
new file mode 100644
index 0000000000000000000000000000000000000000..232fe8c12b4f250f1e672feb5b4f6ee48041c732
--- /dev/null
+++ b/theme/plugins/codemirror/mode/css/gss.html
@@ -0,0 +1,103 @@
+
+
+CodeMirror: Closure Stylesheets (GSS) mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+Closure Stylesheets (GSS) mode
+
+/* Some example Closure Stylesheets */
+
+@provide 'some.styles';
+
+@require 'other.styles';
+
+@component {
+
+@def FONT_FAMILY "Times New Roman", Georgia, Serif;
+@def FONT_SIZE_NORMAL 15px;
+@def FONT_NORMAL normal FONT_SIZE_NORMAL FONT_FAMILY;
+
+@def BG_COLOR rgb(235, 239, 249);
+
+@def DIALOG_BORDER_COLOR rgb(107, 144, 218);
+@def DIALOG_BG_COLOR BG_COLOR;
+
+@def LEFT_HAND_NAV_WIDTH 180px;
+@def LEFT_HAND_NAV_PADDING 3px;
+
+@defmixin size(WIDTH, HEIGHT) {
+ width: WIDTH;
+ height: HEIGHT;
+}
+
+body {
+ background-color: BG_COLOR;
+ margin: 0;
+ padding: 3em 6em;
+ font: FONT_NORMAL;
+ color: #000;
+}
+
+#navigation a {
+ font-weight: bold;
+ text-decoration: none !important;
+}
+
+.dialog {
+ background-color: DIALOG_BG_COLOR;
+ border: 1px solid DIALOG_BORDER_COLOR;
+}
+
+.content {
+ position: absolute;
+ margin-left: add(LEFT_HAND_NAV_PADDING, /* padding left */
+ LEFT_HAND_NAV_WIDTH,
+ LEFT_HAND_NAV_PADDING); /* padding right */
+
+}
+
+.logo {
+ @mixin size(150px, 55px);
+ background-image: url('http://www.google.com/images/logo_sm.gif');
+}
+
+}
+
+
+
+ A mode for Closure Stylesheets (GSS).
+ MIME type defined: text/x-gss
.
+
+ Parsing/Highlighting Tests: normal , verbose .
+
+
diff --git a/theme/plugins/codemirror/mode/css/gss_test.js b/theme/plugins/codemirror/mode/css/gss_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..d56e592803b54b35d034fc08f2c9df2c39c3afbf
--- /dev/null
+++ b/theme/plugins/codemirror/mode/css/gss_test.js
@@ -0,0 +1,17 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function() {
+ "use strict";
+
+ var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-gss");
+ function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "gss"); }
+
+ MT("atComponent",
+ "[def @component] {",
+ "[tag foo] {",
+ " [property color]: [keyword black];",
+ "}",
+ "}");
+
+})();
diff --git a/theme/plugins/codemirror/mode/css/index.html b/theme/plugins/codemirror/mode/css/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..0d85311f1d92086acb46be20692d5ba48a390f65
--- /dev/null
+++ b/theme/plugins/codemirror/mode/css/index.html
@@ -0,0 +1,75 @@
+
+
+CodeMirror: CSS mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+CSS mode
+
+/* Some example CSS */
+
+@import url("something.css");
+
+body {
+ margin: 0;
+ padding: 3em 6em;
+ font-family: tahoma, arial, sans-serif;
+ color: #000;
+}
+
+#navigation a {
+ font-weight: bold;
+ text-decoration: none !important;
+}
+
+h1 {
+ font-size: 2.5em;
+}
+
+h2 {
+ font-size: 1.7em;
+}
+
+h1:before, h2:before {
+ content: "::";
+}
+
+code {
+ font-family: courier, monospace;
+ font-size: 80%;
+ color: #418A8A;
+}
+
+
+
+ MIME types defined: text/css
, text/x-scss
(demo ), text/x-less
(demo ).
+
+ Parsing/Highlighting Tests: normal , verbose .
+
+
diff --git a/theme/plugins/codemirror/mode/css/less.html b/theme/plugins/codemirror/mode/css/less.html
new file mode 100644
index 0000000000000000000000000000000000000000..adf7427d3044b3a7049e92fc1e173022c9ef49c0
--- /dev/null
+++ b/theme/plugins/codemirror/mode/css/less.html
@@ -0,0 +1,152 @@
+
+
+CodeMirror: LESS mode
+
+
+
+
+
+
+
+
+
+
+
+LESS mode
+@media screen and (device-aspect-ratio: 16/9) { … }
+@media screen and (device-aspect-ratio: 1280/720) { … }
+@media screen and (device-aspect-ratio: 2560/1440) { … }
+
+html:lang(fr-be)
+
+tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+
+img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }
+
+body > h2:not(:first-of-type):not(:last-of-type)
+
+html|*:not(:link):not(:visited)
+*|*:not(:hover)
+p::first-line { text-transform: uppercase }
+
+@namespace foo url(http://www.example.com);
+foo|h1 { color: blue } /* first rule */
+
+span[hello="Ocean"][goodbye="Land"]
+
+E[foo]{
+ padding:65px;
+}
+
+input[type="search"]::-webkit-search-decoration,
+input[type="search"]::-webkit-search-cancel-button {
+ -webkit-appearance: none; // Inner-padding issues in Chrome OSX, Safari 5
+}
+button::-moz-focus-inner,
+input::-moz-focus-inner { // Inner padding and border oddities in FF3/4
+ padding: 0;
+ border: 0;
+}
+.btn {
+ // reset here as of 2.0.3 due to Recess property order
+ border-color: #ccc;
+ border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);
+}
+fieldset span button, fieldset span input[type="file"] {
+ font-size:12px;
+ font-family:Arial, Helvetica, sans-serif;
+}
+
+.rounded-corners (@radius: 5px) {
+ border-radius: @radius;
+ -webkit-border-radius: @radius;
+ -moz-border-radius: @radius;
+}
+
+@import url("something.css");
+
+@light-blue: hsl(190, 50%, 65%);
+
+#menu {
+ position: absolute;
+ width: 100%;
+ z-index: 3;
+ clear: both;
+ display: block;
+ background-color: @blue;
+ height: 42px;
+ border-top: 2px solid lighten(@alpha-blue, 20%);
+ border-bottom: 2px solid darken(@alpha-blue, 25%);
+ .box-shadow(0, 1px, 8px, 0.6);
+ -moz-box-shadow: 0 0 0 #000; // Because firefox sucks.
+
+ &.docked {
+ background-color: hsla(210, 60%, 40%, 0.4);
+ }
+ &:hover {
+ background-color: @blue;
+ }
+
+ #dropdown {
+ margin: 0 0 0 117px;
+ padding: 0;
+ padding-top: 5px;
+ display: none;
+ width: 190px;
+ border-top: 2px solid @medium;
+ color: @highlight;
+ border: 2px solid darken(@medium, 25%);
+ border-left-color: darken(@medium, 15%);
+ border-right-color: darken(@medium, 15%);
+ border-top-width: 0;
+ background-color: darken(@medium, 10%);
+ ul {
+ padding: 0px;
+ }
+ li {
+ font-size: 14px;
+ display: block;
+ text-align: left;
+ padding: 0;
+ border: 0;
+ a {
+ display: block;
+ padding: 0px 15px;
+ text-decoration: none;
+ color: white;
+ &:hover {
+ background-color: darken(@medium, 15%);
+ text-decoration: none;
+ }
+ }
+ }
+ .border-radius(5px, bottom);
+ .box-shadow(0, 6px, 8px, 0.5);
+ }
+}
+
+
+
+ The LESS mode is a sub-mode of the CSS mode (defined in css.js
).
+
+ Parsing/Highlighting Tests: normal , verbose .
+
diff --git a/theme/plugins/codemirror/mode/css/less_test.js b/theme/plugins/codemirror/mode/css/less_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..dd821558b0465eef563c9bebc2f1ca2c0fa6c8b9
--- /dev/null
+++ b/theme/plugins/codemirror/mode/css/less_test.js
@@ -0,0 +1,54 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function() {
+ "use strict";
+
+ var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-less");
+ function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "less"); }
+
+ MT("variable",
+ "[variable-2 @base]: [atom #f04615];",
+ "[qualifier .class] {",
+ " [property width]: [variable percentage]([number 0.5]); [comment // returns `50%`]",
+ " [property color]: [variable saturate]([variable-2 @base], [number 5%]);",
+ "}");
+
+ MT("amp",
+ "[qualifier .child], [qualifier .sibling] {",
+ " [qualifier .parent] [atom &] {",
+ " [property color]: [keyword black];",
+ " }",
+ " [atom &] + [atom &] {",
+ " [property color]: [keyword red];",
+ " }",
+ "}");
+
+ MT("mixin",
+ "[qualifier .mixin] ([variable dark]; [variable-2 @color]) {",
+ " [property color]: [atom darken]([variable-2 @color], [number 10%]);",
+ "}",
+ "[qualifier .mixin] ([variable light]; [variable-2 @color]) {",
+ " [property color]: [atom lighten]([variable-2 @color], [number 10%]);",
+ "}",
+ "[qualifier .mixin] ([variable-2 @_]; [variable-2 @color]) {",
+ " [property display]: [atom block];",
+ "}",
+ "[variable-2 @switch]: [variable light];",
+ "[qualifier .class] {",
+ " [qualifier .mixin]([variable-2 @switch]; [atom #888]);",
+ "}");
+
+ MT("nest",
+ "[qualifier .one] {",
+ " [def @media] ([property width]: [number 400px]) {",
+ " [property font-size]: [number 1.2em];",
+ " [def @media] [attribute print] [keyword and] [property color] {",
+ " [property color]: [keyword blue];",
+ " }",
+ " }",
+ "}");
+
+
+ MT("interpolation", ".@{[variable foo]} { [property font-weight]: [atom bold]; }");
+})();
diff --git a/theme/plugins/codemirror/mode/css/scss.html b/theme/plugins/codemirror/mode/css/scss.html
new file mode 100644
index 0000000000000000000000000000000000000000..f8e4d373689c3dc04d1917a96f7ea2530bdb9af5
--- /dev/null
+++ b/theme/plugins/codemirror/mode/css/scss.html
@@ -0,0 +1,157 @@
+
+
+CodeMirror: SCSS mode
+
+
+
+
+
+
+
+
+
+
+SCSS mode
+
+/* Some example SCSS */
+
+@import "compass/css3";
+$variable: #333;
+
+$blue: #3bbfce;
+$margin: 16px;
+
+.content-navigation {
+ #nested {
+ background-color: black;
+ }
+ border-color: $blue;
+ color:
+ darken($blue, 9%);
+}
+
+.border {
+ padding: $margin / 2;
+ margin: $margin / 2;
+ border-color: $blue;
+}
+
+@mixin table-base {
+ th {
+ text-align: center;
+ font-weight: bold;
+ }
+ td, th {padding: 2px}
+}
+
+table.hl {
+ margin: 2em 0;
+ td.ln {
+ text-align: right;
+ }
+}
+
+li {
+ font: {
+ family: serif;
+ weight: bold;
+ size: 1.2em;
+ }
+}
+
+@mixin left($dist) {
+ float: left;
+ margin-left: $dist;
+}
+
+#data {
+ @include left(10px);
+ @include table-base;
+}
+
+.source {
+ @include flow-into(target);
+ border: 10px solid green;
+ margin: 20px;
+ width: 200px; }
+
+.new-container {
+ @include flow-from(target);
+ border: 10px solid red;
+ margin: 20px;
+ width: 200px; }
+
+body {
+ margin: 0;
+ padding: 3em 6em;
+ font-family: tahoma, arial, sans-serif;
+ color: #000;
+}
+
+@mixin yellow() {
+ background: yellow;
+}
+
+.big {
+ font-size: 14px;
+}
+
+.nested {
+ @include border-radius(3px);
+ @extend .big;
+ p {
+ background: whitesmoke;
+ a {
+ color: red;
+ }
+ }
+}
+
+#navigation a {
+ font-weight: bold;
+ text-decoration: none !important;
+}
+
+h1 {
+ font-size: 2.5em;
+}
+
+h2 {
+ font-size: 1.7em;
+}
+
+h1:before, h2:before {
+ content: "::";
+}
+
+code {
+ font-family: courier, monospace;
+ font-size: 80%;
+ color: #418A8A;
+}
+
+
+
+ The SCSS mode is a sub-mode of the CSS mode (defined in css.js
).
+
+ Parsing/Highlighting Tests: normal , verbose .
+
+
diff --git a/theme/plugins/codemirror/mode/css/scss_test.js b/theme/plugins/codemirror/mode/css/scss_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..785921b39c4a9397b953e07dbc0f551636472772
--- /dev/null
+++ b/theme/plugins/codemirror/mode/css/scss_test.js
@@ -0,0 +1,110 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function() {
+ var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-scss");
+ function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "scss"); }
+
+ MT('url_with_quotation',
+ "[tag foo] { [property background]:[atom url]([string test.jpg]) }");
+
+ MT('url_with_double_quotes',
+ "[tag foo] { [property background]:[atom url]([string \"test.jpg\"]) }");
+
+ MT('url_with_single_quotes',
+ "[tag foo] { [property background]:[atom url]([string \'test.jpg\']) }");
+
+ MT('string',
+ "[def @import] [string \"compass/css3\"]");
+
+ MT('important_keyword',
+ "[tag foo] { [property background]:[atom url]([string \'test.jpg\']) [keyword !important] }");
+
+ MT('variable',
+ "[variable-2 $blue]:[atom #333]");
+
+ MT('variable_as_attribute',
+ "[tag foo] { [property color]:[variable-2 $blue] }");
+
+ MT('numbers',
+ "[tag foo] { [property padding]:[number 10px] [number 10] [number 10em] [number 8in] }");
+
+ MT('number_percentage',
+ "[tag foo] { [property width]:[number 80%] }");
+
+ MT('selector',
+ "[builtin #hello][qualifier .world]{}");
+
+ MT('singleline_comment',
+ "[comment // this is a comment]");
+
+ MT('multiline_comment',
+ "[comment /*foobar*/]");
+
+ MT('attribute_with_hyphen',
+ "[tag foo] { [property font-size]:[number 10px] }");
+
+ MT('string_after_attribute',
+ "[tag foo] { [property content]:[string \"::\"] }");
+
+ MT('directives',
+ "[def @include] [qualifier .mixin]");
+
+ MT('basic_structure',
+ "[tag p] { [property background]:[keyword red]; }");
+
+ MT('nested_structure',
+ "[tag p] { [tag a] { [property color]:[keyword red]; } }");
+
+ MT('mixin',
+ "[def @mixin] [tag table-base] {}");
+
+ MT('number_without_semicolon',
+ "[tag p] {[property width]:[number 12]}",
+ "[tag a] {[property color]:[keyword red];}");
+
+ MT('atom_in_nested_block',
+ "[tag p] { [tag a] { [property color]:[atom #000]; } }");
+
+ MT('interpolation_in_property',
+ "[tag foo] { #{[variable-2 $hello]}:[number 2]; }");
+
+ MT('interpolation_in_selector',
+ "[tag foo]#{[variable-2 $hello]} { [property color]:[atom #000]; }");
+
+ MT('interpolation_error',
+ "[tag foo]#{[variable foo]} { [property color]:[atom #000]; }");
+
+ MT("divide_operator",
+ "[tag foo] { [property width]:[number 4] [operator /] [number 2] }");
+
+ MT('nested_structure_with_id_selector',
+ "[tag p] { [builtin #hello] { [property color]:[keyword red]; } }");
+
+ MT('indent_mixin',
+ "[def @mixin] [tag container] (",
+ " [variable-2 $a]: [number 10],",
+ " [variable-2 $b]: [number 10])",
+ "{}");
+
+ MT('indent_nested',
+ "[tag foo] {",
+ " [tag bar] {",
+ " }",
+ "}");
+
+ MT('indent_parentheses',
+ "[tag foo] {",
+ " [property color]: [atom darken]([variable-2 $blue],",
+ " [number 9%]);",
+ "}");
+
+ MT('indent_vardef',
+ "[variable-2 $name]:",
+ " [string 'val'];",
+ "[tag tag] {",
+ " [tag inner] {",
+ " [property margin]: [number 3px];",
+ " }",
+ "}");
+})();
diff --git a/theme/plugins/codemirror/mode/css/test.js b/theme/plugins/codemirror/mode/css/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..e5c55d39992d6c9463393f3bf1dee193864a1512
--- /dev/null
+++ b/theme/plugins/codemirror/mode/css/test.js
@@ -0,0 +1,209 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function() {
+ var mode = CodeMirror.getMode({indentUnit: 2}, "css");
+ function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+ // Error, because "foobarhello" is neither a known type or property, but
+ // property was expected (after "and"), and it should be in parentheses.
+ MT("atMediaUnknownType",
+ "[def @media] [attribute screen] [keyword and] [error foobarhello] { }");
+
+ // Soft error, because "foobarhello" is not a known property or type.
+ MT("atMediaUnknownProperty",
+ "[def @media] [attribute screen] [keyword and] ([error foobarhello]) { }");
+
+ // Make sure nesting works with media queries
+ MT("atMediaMaxWidthNested",
+ "[def @media] [attribute screen] [keyword and] ([property max-width]: [number 25px]) { [tag foo] { } }");
+
+ MT("atMediaFeatureValueKeyword",
+ "[def @media] ([property orientation]: [keyword landscape]) { }");
+
+ MT("atMediaUnknownFeatureValueKeyword",
+ "[def @media] ([property orientation]: [error upsidedown]) { }");
+
+ MT("atMediaUppercase",
+ "[def @MEDIA] ([property orienTAtion]: [keyword landScape]) { }");
+
+ MT("tagSelector",
+ "[tag foo] { }");
+
+ MT("classSelector",
+ "[qualifier .foo-bar_hello] { }");
+
+ MT("idSelector",
+ "[builtin #foo] { [error #foo] }");
+
+ MT("tagSelectorUnclosed",
+ "[tag foo] { [property margin]: [number 0] } [tag bar] { }");
+
+ MT("tagStringNoQuotes",
+ "[tag foo] { [property font-family]: [variable hello] [variable world]; }");
+
+ MT("tagStringDouble",
+ "[tag foo] { [property font-family]: [string \"hello world\"]; }");
+
+ MT("tagStringSingle",
+ "[tag foo] { [property font-family]: [string 'hello world']; }");
+
+ MT("tagColorKeyword",
+ "[tag foo] {",
+ " [property color]: [keyword black];",
+ " [property color]: [keyword navy];",
+ " [property color]: [keyword yellow];",
+ "}");
+
+ MT("tagColorHex3",
+ "[tag foo] { [property background]: [atom #fff]; }");
+
+ MT("tagColorHex4",
+ "[tag foo] { [property background]: [atom #ffff]; }");
+
+ MT("tagColorHex6",
+ "[tag foo] { [property background]: [atom #ffffff]; }");
+
+ MT("tagColorHex8",
+ "[tag foo] { [property background]: [atom #ffffffff]; }");
+
+ MT("tagColorHex5Invalid",
+ "[tag foo] { [property background]: [atom&error #fffff]; }");
+
+ MT("tagColorHexInvalid",
+ "[tag foo] { [property background]: [atom&error #ffg]; }");
+
+ MT("tagNegativeNumber",
+ "[tag foo] { [property margin]: [number -5px]; }");
+
+ MT("tagPositiveNumber",
+ "[tag foo] { [property padding]: [number 5px]; }");
+
+ MT("tagVendor",
+ "[tag foo] { [meta -foo-][property box-sizing]: [meta -foo-][atom border-box]; }");
+
+ MT("tagBogusProperty",
+ "[tag foo] { [property&error barhelloworld]: [number 0]; }");
+
+ MT("tagTwoProperties",
+ "[tag foo] { [property margin]: [number 0]; [property padding]: [number 0]; }");
+
+ MT("tagTwoPropertiesURL",
+ "[tag foo] { [property background]: [atom url]([string //example.com/foo.png]); [property padding]: [number 0]; }");
+
+ MT("indent_tagSelector",
+ "[tag strong], [tag em] {",
+ " [property background]: [atom rgba](",
+ " [number 255], [number 255], [number 0], [number .2]",
+ " );",
+ "}");
+
+ MT("indent_atMedia",
+ "[def @media] {",
+ " [tag foo] {",
+ " [property color]:",
+ " [keyword yellow];",
+ " }",
+ "}");
+
+ MT("indent_comma",
+ "[tag foo] {",
+ " [property font-family]: [variable verdana],",
+ " [atom sans-serif];",
+ "}");
+
+ MT("indent_parentheses",
+ "[tag foo]:[variable-3 before] {",
+ " [property background]: [atom url](",
+ "[string blahblah]",
+ "[string etc]",
+ "[string ]) [keyword !important];",
+ "}");
+
+ MT("font_face",
+ "[def @font-face] {",
+ " [property font-family]: [string 'myfont'];",
+ " [error nonsense]: [string 'abc'];",
+ " [property src]: [atom url]([string http://blah]),",
+ " [atom url]([string http://foo]);",
+ "}");
+
+ MT("empty_url",
+ "[def @import] [atom url]() [attribute screen];");
+
+ MT("parens",
+ "[qualifier .foo] {",
+ " [property background-image]: [variable fade]([atom #000], [number 20%]);",
+ " [property border-image]: [atom linear-gradient](",
+ " [atom to] [atom bottom],",
+ " [variable fade]([atom #000], [number 20%]) [number 0%],",
+ " [variable fade]([atom #000], [number 20%]) [number 100%]",
+ " );",
+ "}");
+
+ MT("css_variable",
+ ":[variable-3 root] {",
+ " [variable-2 --main-color]: [atom #06c];",
+ "}",
+ "[tag h1][builtin #foo] {",
+ " [property color]: [atom var]([variable-2 --main-color]);",
+ "}");
+
+ MT("supports",
+ "[def @supports] ([keyword not] (([property text-align-last]: [atom justify]) [keyword or] ([meta -moz-][property text-align-last]: [atom justify])) {",
+ " [property text-align-last]: [atom justify];",
+ "}");
+
+ MT("document",
+ "[def @document] [tag url]([string http://blah]),",
+ " [tag url-prefix]([string https://]),",
+ " [tag domain]([string blah.com]),",
+ " [tag regexp]([string \".*blah.+\"]) {",
+ " [builtin #id] {",
+ " [property background-color]: [keyword white];",
+ " }",
+ " [tag foo] {",
+ " [property font-family]: [variable Verdana], [atom sans-serif];",
+ " }",
+ "}");
+
+ MT("document_url",
+ "[def @document] [tag url]([string http://blah]) { [qualifier .class] { } }");
+
+ MT("document_urlPrefix",
+ "[def @document] [tag url-prefix]([string https://]) { [builtin #id] { } }");
+
+ MT("document_domain",
+ "[def @document] [tag domain]([string blah.com]) { [tag foo] { } }");
+
+ MT("document_regexp",
+ "[def @document] [tag regexp]([string \".*blah.+\"]) { [builtin #id] { } }");
+
+ MT("counter-style",
+ "[def @counter-style] [variable binary] {",
+ " [property system]: [atom numeric];",
+ " [property symbols]: [number 0] [number 1];",
+ " [property suffix]: [string \".\"];",
+ " [property range]: [atom infinite];",
+ " [property speak-as]: [atom numeric];",
+ "}");
+
+ MT("counter-style-additive-symbols",
+ "[def @counter-style] [variable simple-roman] {",
+ " [property system]: [atom additive];",
+ " [property additive-symbols]: [number 10] [variable X], [number 5] [variable V], [number 1] [variable I];",
+ " [property range]: [number 1] [number 49];",
+ "}");
+
+ MT("counter-style-use",
+ "[tag ol][qualifier .roman] { [property list-style]: [variable simple-roman]; }");
+
+ MT("counter-style-symbols",
+ "[tag ol] { [property list-style]: [atom symbols]([atom cyclic] [string \"*\"] [string \"\\2020\"] [string \"\\2021\"] [string \"\\A7\"]); }");
+
+ MT("comment-does-not-disrupt",
+ "[def @font-face] [comment /* foo */] {",
+ " [property src]: [atom url]([string x]);",
+ " [property font-family]: [variable One];",
+ "}")
+})();
diff --git a/theme/plugins/codemirror/mode/cypher/cypher.js b/theme/plugins/codemirror/mode/cypher/cypher.js
new file mode 100644
index 0000000000000000000000000000000000000000..9b2490014c580035eaec4ebf971315a7e3b08abe
--- /dev/null
+++ b/theme/plugins/codemirror/mode/cypher/cypher.js
@@ -0,0 +1,150 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+// By the Neo4j Team and contributors.
+// https://github.com/neo4j-contrib/CodeMirror
+
+(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 wordRegexp = function(words) {
+ return new RegExp("^(?:" + words.join("|") + ")$", "i");
+ };
+
+ CodeMirror.defineMode("cypher", function(config) {
+ var tokenBase = function(stream/*, state*/) {
+ var ch = stream.next();
+ if (ch ==='"') {
+ stream.match(/.*?"/);
+ return "string";
+ }
+ if (ch === "'") {
+ stream.match(/.*?'/);
+ return "string";
+ }
+ if (/[{}\(\),\.;\[\]]/.test(ch)) {
+ curPunc = ch;
+ return "node";
+ } else if (ch === "/" && stream.eat("/")) {
+ stream.skipToEnd();
+ return "comment";
+ } else if (operatorChars.test(ch)) {
+ stream.eatWhile(operatorChars);
+ return null;
+ } else {
+ stream.eatWhile(/[_\w\d]/);
+ if (stream.eat(":")) {
+ stream.eatWhile(/[\w\d_\-]/);
+ return "atom";
+ }
+ var word = stream.current();
+ if (funcs.test(word)) return "builtin";
+ if (preds.test(word)) return "def";
+ if (keywords.test(word)) return "keyword";
+ return "variable";
+ }
+ };
+ var pushContext = function(state, type, col) {
+ return state.context = {
+ prev: state.context,
+ indent: state.indent,
+ col: col,
+ type: type
+ };
+ };
+ var popContext = function(state) {
+ state.indent = state.context.indent;
+ return state.context = state.context.prev;
+ };
+ var indentUnit = config.indentUnit;
+ var curPunc;
+ var funcs = wordRegexp(["abs", "acos", "allShortestPaths", "asin", "atan", "atan2", "avg", "ceil", "coalesce", "collect", "cos", "cot", "count", "degrees", "e", "endnode", "exp", "extract", "filter", "floor", "haversin", "head", "id", "keys", "labels", "last", "left", "length", "log", "log10", "lower", "ltrim", "max", "min", "node", "nodes", "percentileCont", "percentileDisc", "pi", "radians", "rand", "range", "reduce", "rel", "relationship", "relationships", "replace", "reverse", "right", "round", "rtrim", "shortestPath", "sign", "sin", "size", "split", "sqrt", "startnode", "stdev", "stdevp", "str", "substring", "sum", "tail", "tan", "timestamp", "toFloat", "toInt", "toString", "trim", "type", "upper"]);
+ var preds = wordRegexp(["all", "and", "any", "contains", "exists", "has", "in", "none", "not", "or", "single", "xor"]);
+ var keywords = wordRegexp(["as", "asc", "ascending", "assert", "by", "case", "commit", "constraint", "create", "csv", "cypher", "delete", "desc", "descending", "detach", "distinct", "drop", "else", "end", "ends", "explain", "false", "fieldterminator", "foreach", "from", "headers", "in", "index", "is", "join", "limit", "load", "match", "merge", "null", "on", "optional", "order", "periodic", "profile", "remove", "return", "scan", "set", "skip", "start", "starts", "then", "true", "union", "unique", "unwind", "using", "when", "where", "with", "call", "yield"]);
+ var operatorChars = /[*+\-<>=&|~%^]/;
+
+ return {
+ startState: function(/*base*/) {
+ 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;
+ if (context.type === "keywords") return CodeMirror.commands.newlineAndIndent;
+ if (context.align) return context.col + (closing ? 0 : 1);
+ return context.indent + (closing ? 0 : indentUnit);
+ }
+ };
+ });
+
+ CodeMirror.modeExtensions["cypher"] = {
+ autoFormatLineBreaks: function(text) {
+ var i, lines, reProcessedPortion;
+ var lines = text.split("\n");
+ var reProcessedPortion = /\s+\b(return|where|order by|match|with|skip|limit|create|delete|set)\b\s/g;
+ for (var i = 0; i < lines.length; i++)
+ lines[i] = lines[i].replace(reProcessedPortion, " \n$1 ").trim();
+ return lines.join("\n");
+ }
+ };
+
+ CodeMirror.defineMIME("application/x-cypher-query", "cypher");
+
+});
diff --git a/theme/plugins/codemirror/mode/cypher/index.html b/theme/plugins/codemirror/mode/cypher/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..b8bd75c8b340b8655d0cfe11777f47d14de6f70c
--- /dev/null
+++ b/theme/plugins/codemirror/mode/cypher/index.html
@@ -0,0 +1,63 @@
+
+
+CodeMirror: Cypher Mode for CodeMirror
+
+
+
+
+
+
+
+
+
+
+
+Cypher Mode for CodeMirror
+
+ // Cypher Mode for CodeMirror, using the neo theme
+MATCH (joe { name: 'Joe' })-[:knows*2..2]-(friend_of_friend)
+WHERE NOT (joe)-[:knows]-(friend_of_friend)
+RETURN friend_of_friend.name, COUNT(*)
+ORDER BY COUNT(*) DESC , friend_of_friend.name
+
+
+ MIME types defined:
+ application/x-cypher-query
+
+
+
+
diff --git a/theme/plugins/codemirror/mode/cypher/test.js b/theme/plugins/codemirror/mode/cypher/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..76d0d082969cebe54e68d620fb0c16a4b6d56c3d
--- /dev/null
+++ b/theme/plugins/codemirror/mode/cypher/test.js
@@ -0,0 +1,37 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function() {
+ var mode = CodeMirror.getMode({tabSize: 4, indentUnit: 2}, "cypher");
+ function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+ MT("unbalancedDoubledQuotedString",
+ "[string \"a'b\"][variable c]");
+
+ MT("unbalancedSingleQuotedString",
+ "[string 'a\"b'][variable c]");
+
+ MT("doubleQuotedString",
+ "[string \"a\"][variable b]");
+
+ MT("singleQuotedString",
+ "[string 'a'][variable b]");
+
+ MT("single attribute (with content)",
+ "[node {][atom a:][string 'a'][node }]");
+
+ MT("multiple attribute, singleQuotedString (with content)",
+ "[node {][atom a:][string 'a'][node ,][atom b:][string 'b'][node }]");
+
+ MT("multiple attribute, doubleQuotedString (with content)",
+ "[node {][atom a:][string \"a\"][node ,][atom b:][string \"b\"][node }]");
+
+ MT("single attribute (without content)",
+ "[node {][atom a:][string 'a'][node }]");
+
+ MT("multiple attribute, singleQuotedString (without content)",
+ "[node {][atom a:][string ''][node ,][atom b:][string ''][node }]");
+
+ MT("multiple attribute, doubleQuotedString (without content)",
+ "[node {][atom a:][string \"\"][node ,][atom b:][string \"\"][node }]");
+ })();
diff --git a/theme/plugins/codemirror/mode/d/d.js b/theme/plugins/codemirror/mode/d/d.js
new file mode 100644
index 0000000000000000000000000000000000000000..77b09c224e552aa313d1d120f844261becb65eb4
--- /dev/null
+++ b/theme/plugins/codemirror/mode/d/d.js
@@ -0,0 +1,218 @@
+// 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("d", function(config, parserConfig) {
+ var indentUnit = config.indentUnit,
+ statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
+ keywords = parserConfig.keywords || {},
+ builtin = parserConfig.builtin || {},
+ blockKeywords = parserConfig.blockKeywords || {},
+ atoms = parserConfig.atoms || {},
+ hooks = parserConfig.hooks || {},
+ multiLineStrings = parserConfig.multiLineStrings;
+ var isOperatorChar = /[+\-*&%=<>!?|\/]/;
+
+ var curPunc;
+
+ function tokenBase(stream, state) {
+ var ch = stream.next();
+ if (hooks[ch]) {
+ var result = hooks[ch](stream, state);
+ if (result !== false) return result;
+ }
+ if (ch == '"' || ch == "'" || ch == "`") {
+ state.tokenize = tokenString(ch);
+ return state.tokenize(stream, state);
+ }
+ if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
+ curPunc = ch;
+ return null;
+ }
+ if (/\d/.test(ch)) {
+ stream.eatWhile(/[\w\.]/);
+ return "number";
+ }
+ if (ch == "/") {
+ if (stream.eat("+")) {
+ state.tokenize = tokenNestedComment;
+ return tokenNestedComment(stream, state);
+ }
+ if (stream.eat("*")) {
+ state.tokenize = tokenComment;
+ return tokenComment(stream, state);
+ }
+ if (stream.eat("/")) {
+ stream.skipToEnd();
+ return "comment";
+ }
+ }
+ if (isOperatorChar.test(ch)) {
+ stream.eatWhile(isOperatorChar);
+ return "operator";
+ }
+ stream.eatWhile(/[\w\$_\xa1-\uffff]/);
+ var cur = stream.current();
+ if (keywords.propertyIsEnumerable(cur)) {
+ if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
+ return "keyword";
+ }
+ if (builtin.propertyIsEnumerable(cur)) {
+ if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
+ return "builtin";
+ }
+ if (atoms.propertyIsEnumerable(cur)) return "atom";
+ return "variable";
+ }
+
+ 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 = 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 tokenNestedComment(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" || style == "meta") 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 (((ctx.type == "}" || ctx.type == "top") && curPunc != ';') || (ctx.type == "statement" && curPunc == "newstatement"))
+ pushContext(state, stream.column(), "statement");
+ state.startOfLine = false;
+ return style;
+ },
+
+ indent: function(state, textAfter) {
+ if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass;
+ var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
+ if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
+ var closing = firstChar == ctx.type;
+ if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
+ else if (ctx.align) return ctx.column + (closing ? 0 : 1);
+ else return ctx.indented + (closing ? 0 : indentUnit);
+ },
+
+ electricChars: "{}"
+ };
+});
+
+ function words(str) {
+ var obj = {}, words = str.split(" ");
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+ return obj;
+ }
+
+ var blockKeywords = "body catch class do else enum for foreach foreach_reverse if in interface mixin " +
+ "out scope struct switch try union unittest version while with";
+
+ CodeMirror.defineMIME("text/x-d", {
+ name: "d",
+ keywords: words("abstract alias align asm assert auto break case cast cdouble cent cfloat const continue " +
+ "debug default delegate delete deprecated export extern final finally function goto immutable " +
+ "import inout invariant is lazy macro module new nothrow override package pragma private " +
+ "protected public pure ref return shared short static super synchronized template this " +
+ "throw typedef typeid typeof volatile __FILE__ __LINE__ __gshared __traits __vector __parameters " +
+ blockKeywords),
+ blockKeywords: words(blockKeywords),
+ builtin: words("bool byte char creal dchar double float idouble ifloat int ireal long real short ubyte " +
+ "ucent uint ulong ushort wchar wstring void size_t sizediff_t"),
+ atoms: words("exit failure success true false null"),
+ hooks: {
+ "@": function(stream, _state) {
+ stream.eatWhile(/[\w\$_]/);
+ return "meta";
+ }
+ }
+ });
+
+});
diff --git a/theme/plugins/codemirror/mode/d/index.html b/theme/plugins/codemirror/mode/d/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..08cabd8a2e2c269ae5e694636b56f565c2fbc16c
--- /dev/null
+++ b/theme/plugins/codemirror/mode/d/index.html
@@ -0,0 +1,273 @@
+
+
+CodeMirror: D mode
+
+
+
+
+
+
+
+
+
+
+
+D mode
+
+/* D demo code // copied from phobos/sd/metastrings.d */
+// Written in the D programming language.
+
+/**
+Templates with which to do compile-time manipulation of strings.
+
+Macros:
+ WIKI = Phobos/StdMetastrings
+
+Copyright: Copyright Digital Mars 2007 - 2009.
+License: Boost License 1.0 .
+Authors: $(WEB digitalmars.com, Walter Bright),
+ Don Clugston
+Source: $(PHOBOSSRC std/_metastrings.d)
+*/
+/*
+ Copyright Digital Mars 2007 - 2009.
+Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+ */
+module std.metastrings;
+
+/**
+Formats constants into a string at compile time. Analogous to $(XREF
+string,format).
+
+Parameters:
+
+A = tuple of constants, which can be strings, characters, or integral
+ values.
+
+Formats:
+ * The formats supported are %s for strings, and %%
+ * for the % character.
+Example:
+---
+import std.metastrings;
+import std.stdio;
+
+void main()
+{
+ string s = Format!("Arg %s = %s", "foo", 27);
+ writefln(s); // "Arg foo = 27"
+}
+ * ---
+ */
+
+template Format(A...)
+{
+ static if (A.length == 0)
+ enum Format = "";
+ else static if (is(typeof(A[0]) : const(char)[]))
+ enum Format = FormatString!(A[0], A[1..$]);
+ else
+ enum Format = toStringNow!(A[0]) ~ Format!(A[1..$]);
+}
+
+template FormatString(const(char)[] F, A...)
+{
+ static if (F.length == 0)
+ enum FormatString = Format!(A);
+ else static if (F.length == 1)
+ enum FormatString = F[0] ~ Format!(A);
+ else static if (F[0..2] == "%s")
+ enum FormatString
+ = toStringNow!(A[0]) ~ FormatString!(F[2..$],A[1..$]);
+ else static if (F[0..2] == "%%")
+ enum FormatString = "%" ~ FormatString!(F[2..$],A);
+ else
+ {
+ static assert(F[0] != '%', "unrecognized format %" ~ F[1]);
+ enum FormatString = F[0] ~ FormatString!(F[1..$],A);
+ }
+}
+
+unittest
+{
+ auto s = Format!("hel%slo", "world", -138, 'c', true);
+ assert(s == "helworldlo-138ctrue", "[" ~ s ~ "]");
+}
+
+/**
+ * Convert constant argument to a string.
+ */
+
+template toStringNow(ulong v)
+{
+ static if (v < 10)
+ enum toStringNow = "" ~ cast(char)(v + '0');
+ else
+ enum toStringNow = toStringNow!(v / 10) ~ toStringNow!(v % 10);
+}
+
+unittest
+{
+ static assert(toStringNow!(1uL << 62) == "4611686018427387904");
+}
+
+/// ditto
+template toStringNow(long v)
+{
+ static if (v < 0)
+ enum toStringNow = "-" ~ toStringNow!(cast(ulong) -v);
+ else
+ enum toStringNow = toStringNow!(cast(ulong) v);
+}
+
+unittest
+{
+ static assert(toStringNow!(0x100000000) == "4294967296");
+ static assert(toStringNow!(-138L) == "-138");
+}
+
+/// ditto
+template toStringNow(uint U)
+{
+ enum toStringNow = toStringNow!(cast(ulong)U);
+}
+
+/// ditto
+template toStringNow(int I)
+{
+ enum toStringNow = toStringNow!(cast(long)I);
+}
+
+/// ditto
+template toStringNow(bool B)
+{
+ enum toStringNow = B ? "true" : "false";
+}
+
+/// ditto
+template toStringNow(string S)
+{
+ enum toStringNow = S;
+}
+
+/// ditto
+template toStringNow(char C)
+{
+ enum toStringNow = "" ~ C;
+}
+
+
+/********
+ * Parse unsigned integer literal from the start of string s.
+ * returns:
+ * .value = the integer literal as a string,
+ * .rest = the string following the integer literal
+ * Otherwise:
+ * .value = null,
+ * .rest = s
+ */
+
+template parseUinteger(const(char)[] s)
+{
+ static if (s.length == 0)
+ {
+ enum value = "";
+ enum rest = "";
+ }
+ else static if (s[0] >= '0' && s[0] <= '9')
+ {
+ enum value = s[0] ~ parseUinteger!(s[1..$]).value;
+ enum rest = parseUinteger!(s[1..$]).rest;
+ }
+ else
+ {
+ enum value = "";
+ enum rest = s;
+ }
+}
+
+/********
+Parse integer literal optionally preceded by $(D '-') from the start
+of string $(D s).
+
+Returns:
+ .value = the integer literal as a string,
+ .rest = the string following the integer literal
+
+Otherwise:
+ .value = null,
+ .rest = s
+*/
+
+template parseInteger(const(char)[] s)
+{
+ static if (s.length == 0)
+ {
+ enum value = "";
+ enum rest = "";
+ }
+ else static if (s[0] >= '0' && s[0] <= '9')
+ {
+ enum value = s[0] ~ parseUinteger!(s[1..$]).value;
+ enum rest = parseUinteger!(s[1..$]).rest;
+ }
+ else static if (s.length >= 2 &&
+ s[0] == '-' && s[1] >= '0' && s[1] <= '9')
+ {
+ enum value = s[0..2] ~ parseUinteger!(s[2..$]).value;
+ enum rest = parseUinteger!(s[2..$]).rest;
+ }
+ else
+ {
+ enum value = "";
+ enum rest = s;
+ }
+}
+
+unittest
+{
+ assert(parseUinteger!("1234abc").value == "1234");
+ assert(parseUinteger!("1234abc").rest == "abc");
+ assert(parseInteger!("-1234abc").value == "-1234");
+ assert(parseInteger!("-1234abc").rest == "abc");
+}
+
+/**
+Deprecated aliases held for backward compatibility.
+*/
+deprecated alias toStringNow ToString;
+/// Ditto
+deprecated alias parseUinteger ParseUinteger;
+/// Ditto
+deprecated alias parseUinteger ParseInteger;
+
+
+
+
+
+ Simple mode that handle D-Syntax (DLang Homepage ).
+
+ MIME types defined: text/x-d
+ .
+
diff --git a/theme/plugins/codemirror/mode/d/test.js b/theme/plugins/codemirror/mode/d/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..d8de4ad35f864903e754f48689111e0e74e93dee
--- /dev/null
+++ b/theme/plugins/codemirror/mode/d/test.js
@@ -0,0 +1,11 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function() {
+ var mode = CodeMirror.getMode({indentUnit: 2}, "d");
+ function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+ MT("nested_comments",
+ "[comment /+]","[comment comment]","[comment +/]","[variable void] [variable main](){}");
+
+})();
diff --git a/theme/plugins/codemirror/mode/dart/dart.js b/theme/plugins/codemirror/mode/dart/dart.js
new file mode 100644
index 0000000000000000000000000000000000000000..4db0d37159a166bd0dedd86d210f58d6492df713
--- /dev/null
+++ b/theme/plugins/codemirror/mode/dart/dart.js
@@ -0,0 +1,157 @@
+// 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("../clike/clike"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror", "../clike/clike"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+ "use strict";
+
+ var keywords = ("this super static final const abstract class extends external factory " +
+ "implements get native set typedef with enum throw rethrow " +
+ "assert break case continue default in return new deferred async await covariant " +
+ "try catch finally do else for if switch while import library export " +
+ "part of show hide is as").split(" ");
+ var blockKeywords = "try catch finally do else for if switch while".split(" ");
+ var atoms = "true false null".split(" ");
+ var builtins = "void bool num int double dynamic var String".split(" ");
+
+ function set(words) {
+ var obj = {};
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+ 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),
+ blockKeywords: set(blockKeywords),
+ builtin: set(builtins),
+ atoms: set(atoms),
+ hooks: {
+ "@": function(stream) {
+ 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(stream, state) {
+ if (!stream.eat("*")) return false
+ state.tokenize = tokenNestedComment(1)
+ return state.tokenize(stream, state)
+ }
+ }
+ });
+
+ 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";
+ }
+
+ function tokenNestedComment(depth) {
+ return function (stream, state) {
+ var ch
+ while (ch = stream.next()) {
+ if (ch == "*" && stream.eat("/")) {
+ if (depth == 1) {
+ state.tokenize = null
+ break
+ } else {
+ state.tokenize = tokenNestedComment(depth - 1)
+ return state.tokenize(stream, state)
+ }
+ } else if (ch == "/" && stream.eat("*")) {
+ state.tokenize = tokenNestedComment(depth + 1)
+ return state.tokenize(stream, state)
+ }
+ }
+ return "comment"
+ }
+ }
+
+ CodeMirror.registerHelper("hintWords", "application/dart", keywords.concat(atoms).concat(builtins));
+
+ // This is needed to make loading through meta.js work.
+ CodeMirror.defineMode("dart", function(conf) {
+ return CodeMirror.getMode(conf, "application/dart");
+ }, "clike");
+});
diff --git a/theme/plugins/codemirror/mode/dart/index.html b/theme/plugins/codemirror/mode/dart/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..e79da5a8b0ea462616a9c070c73140332f57473b
--- /dev/null
+++ b/theme/plugins/codemirror/mode/dart/index.html
@@ -0,0 +1,71 @@
+
+
+CodeMirror: Dart mode
+
+
+
+
+
+
+
+
+
+
+Dart mode
+
+
+import 'dart:math' show Random;
+
+void main() {
+ print(new Die(n: 12).roll());
+}
+
+// Define a class.
+class Die {
+ // Define a class variable.
+ static Random shaker = new Random();
+
+ // Define instance variables.
+ int sides, value;
+
+ // Define a method using shorthand syntax.
+ String toString() => '$value';
+
+ // Define a constructor.
+ Die({int n: 6}) {
+ if (4 <= n && n <= 20) {
+ sides = n;
+ } else {
+ // Support for errors and exceptions.
+ throw new ArgumentError(/* */);
+ }
+ }
+
+ // Define an instance method.
+ int roll() {
+ return value = shaker.nextInt(sides) + 1;
+ }
+}
+
+
+
+
+
+
diff --git a/theme/plugins/codemirror/mode/diff/diff.js b/theme/plugins/codemirror/mode/diff/diff.js
new file mode 100644
index 0000000000000000000000000000000000000000..fe0305e7b6501fc403f86e8131af9f55fd13a20b
--- /dev/null
+++ b/theme/plugins/codemirror/mode/diff/diff.js
@@ -0,0 +1,47 @@
+// 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("diff", function() {
+
+ var TOKEN_NAMES = {
+ '+': 'positive',
+ '-': 'negative',
+ '@': 'meta'
+ };
+
+ return {
+ token: function(stream) {
+ var tw_pos = stream.string.search(/[\t ]+?$/);
+
+ if (!stream.sol() || tw_pos === 0) {
+ stream.skipToEnd();
+ return ("error " + (
+ TOKEN_NAMES[stream.string.charAt(0)] || '')).replace(/ $/, '');
+ }
+
+ var token_name = TOKEN_NAMES[stream.peek()] || stream.skipToEnd();
+
+ if (tw_pos === -1) {
+ stream.skipToEnd();
+ } else {
+ stream.pos = tw_pos;
+ }
+
+ return token_name;
+ }
+ };
+});
+
+CodeMirror.defineMIME("text/x-diff", "diff");
+
+});
diff --git a/theme/plugins/codemirror/mode/diff/index.html b/theme/plugins/codemirror/mode/diff/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..0af611fa483bd425c00fcde87be835177fe460c1
--- /dev/null
+++ b/theme/plugins/codemirror/mode/diff/index.html
@@ -0,0 +1,117 @@
+
+
+CodeMirror: Diff mode
+
+
+
+
+
+
+
+
+
+
+Diff mode
+
+diff --git a/index.html b/index.html
+index c1d9156..7764744 100644
+--- a/index.html
++++ b/index.html
+@@ -95,7 +95,8 @@ StringStream.prototype = {
+
+
+diff --git a/lib/codemirror.js b/lib/codemirror.js
+index 04646a9..9a39cc7 100644
+--- a/lib/codemirror.js
++++ b/lib/codemirror.js
+@@ -399,10 +399,16 @@ var CodeMirror = (function() {
+ }
+
+ function onMouseDown(e) {
+- var start = posFromMouse(e), last = start;
++ var start = posFromMouse(e), last = start, target = e.target();
+ if (!start) return;
+ setCursor(start.line, start.ch, false);
+ if (e.button() != 1) return;
++ if (target.parentNode == gutter) {
++ if (options.onGutterClick)
++ options.onGutterClick(indexOf(gutter.childNodes, target) + showingFrom);
++ return;
++ }
++
+ if (!focused) onFocus();
+
+ e.stop();
+@@ -808,7 +814,7 @@ var CodeMirror = (function() {
+ for (var i = showingFrom; i < showingTo; ++i) {
+ var marker = lines[i].gutterMarker;
+ if (marker) html.push('' + htmlEscape(marker.text) + '
');
+- else html.push("" + (options.lineNumbers ? i + 1 : "\u00a0") + "
");
++ else html.push("" + (options.lineNumbers ? i + options.firstLineNumber : "\u00a0") + "
");
+ }
+ gutter.style.display = "none"; // TODO test whether this actually helps
+ gutter.innerHTML = html.join("");
+@@ -1371,10 +1377,8 @@ var CodeMirror = (function() {
+ if (option == "parser") setParser(value);
+ else if (option === "lineNumbers") setLineNumbers(value);
+ else if (option === "gutter") setGutter(value);
+- else if (option === "readOnly") options.readOnly = value;
+- else if (option === "indentUnit") {options.indentUnit = indentUnit = value; setParser(options.parser);}
+- else if (/^(?:enterMode|tabMode|indentWithTabs|readOnly|autoMatchBrackets|undoDepth)$/.test(option)) options[option] = value;
+- else throw new Error("Can't set option " + option);
++ else if (option === "indentUnit") {options.indentUnit = value; setParser(options.parser);}
++ else options[option] = value;
+ },
+ cursorCoords: cursorCoords,
+ undo: operation(undo),
+@@ -1402,7 +1406,8 @@ var CodeMirror = (function() {
+ replaceRange: operation(replaceRange),
+
+ operation: function(f){return operation(f)();},
+- refresh: function(){updateDisplay([{from: 0, to: lines.length}]);}
++ refresh: function(){updateDisplay([{from: 0, to: lines.length}]);},
++ getInputField: function(){return input;}
+ };
+ return instance;
+ }
+@@ -1420,6 +1425,7 @@ var CodeMirror = (function() {
+ readOnly: false,
+ onChange: null,
+ onCursorActivity: null,
++ onGutterClick: null,
+ autoMatchBrackets: false,
+ workTime: 200,
+ workDelay: 300,
+
+
+
+ MIME types defined: text/x-diff
.
+
+
diff --git a/theme/plugins/codemirror/mode/django/django.js b/theme/plugins/codemirror/mode/django/django.js
new file mode 100644
index 0000000000000000000000000000000000000000..7b4ef3b566e11bd41527208e9e20b2debf9191c5
--- /dev/null
+++ b/theme/plugins/codemirror/mode/django/django.js
@@ -0,0 +1,356 @@
+// 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("django:inner", function() {
+ 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",
+ "filesizeformat", "first", "floatformat", "force_escape",
+ "get_digit", "iriencode", "join", "last", "length",
+ "length_is", "linebreaks", "linebreaksbr", "linenumbers",
+ "ljust", "lower", "make_list", "phone2numeric", "pluralize",
+ "pprint", "random", "removetags", "rjust", "safe",
+ "safeseq", "slice", "slugify", "stringformat", "striptags",
+ "time", "timesince", "timeuntil", "title", "truncatechars",
+ "truncatechars_html", "truncatewords", "truncatewords_html",
+ "unordered_list", "upper", "urlencode", "urlize",
+ "urlizetrunc", "wordcount", "wordwrap", "yesno"],
+ 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
+ // element attributes
+ function tokenBase (stream, state) {
+ // Attempt to identify a variable, template or comment tag respectively
+ if (stream.match("{{")) {
+ state.tokenize = inVariable;
+ return "tag";
+ } else if (stream.match("{%")) {
+ state.tokenize = inTag;
+ return "tag";
+ } else if (stream.match("{#")) {
+ state.tokenize = inComment;
+ return "comment";
+ }
+
+ // Ignore completely any stream series that do not match the
+ // Django template opening tags.
+ while (stream.next() != null && !stream.match(/\{[{%#]/, false)) {}
+ return null;
+ }
+
+ // A string can be included in either single or double quotes (this is
+ // the delimiter). Mark everything as a string until the start delimiter
+ // occurs again.
+ function inString (delimiter, previousTokenizer) {
+ return function (stream, state) {
+ if (!state.escapeNext && stream.eat(delimiter)) {
+ state.tokenize = previousTokenizer;
+ } else {
+ if (state.escapeNext) {
+ state.escapeNext = false;
+ }
+
+ var ch = stream.next();
+
+ // Take into account the backslash for escaping characters, such as
+ // the string delimiter.
+ if (ch == "\\") {
+ state.escapeNext = true;
+ }
+ }
+
+ return "string";
+ };
+ }
+
+ // Apply Django template variable syntax highlighting
+ function inVariable (stream, state) {
+ // Attempt to match a dot that precedes a property
+ if (state.waitDot) {
+ state.waitDot = false;
+
+ if (stream.peek() != ".") {
+ return "null";
+ }
+
+ // Dot followed by a non-word character should be considered an error.
+ if (stream.match(/\.\W+/)) {
+ return "error";
+ } else if (stream.eat(".")) {
+ state.waitProperty = true;
+ return "null";
+ } else {
+ throw Error ("Unexpected error while waiting for property.");
+ }
+ }
+
+ // Attempt to match a pipe that precedes a filter
+ if (state.waitPipe) {
+ state.waitPipe = false;
+
+ if (stream.peek() != "|") {
+ return "null";
+ }
+
+ // Pipe followed by a non-word character should be considered an error.
+ if (stream.match(/\.\W+/)) {
+ return "error";
+ } else if (stream.eat("|")) {
+ state.waitFilter = true;
+ return "null";
+ } else {
+ throw Error ("Unexpected error while waiting for filter.");
+ }
+ }
+
+ // Highlight properties
+ if (state.waitProperty) {
+ state.waitProperty = false;
+ if (stream.match(/\b(\w+)\b/)) {
+ state.waitDot = true; // A property can be followed by another property
+ state.waitPipe = true; // A property can be followed by a filter
+ return "property";
+ }
+ }
+
+ // Highlight filters
+ if (state.waitFilter) {
+ state.waitFilter = false;
+ if (stream.match(filters)) {
+ return "variable-2";
+ }
+ }
+
+ // Ignore all white spaces
+ if (stream.eatSpace()) {
+ state.waitProperty = false;
+ return "null";
+ }
+
+ // Identify numbers
+ if (stream.match(/\b\d+(\.\d+)?\b/)) {
+ return "number";
+ }
+
+ // Identify strings
+ if (stream.match("'")) {
+ state.tokenize = inString("'", state.tokenize);
+ return "string";
+ } else if (stream.match('"')) {
+ state.tokenize = inString('"', state.tokenize);
+ return "string";
+ }
+
+ // Attempt to find the variable
+ if (stream.match(/\b(\w+)\b/) && !state.foundVariable) {
+ state.waitDot = true;
+ state.waitPipe = true; // A property can be followed by a filter
+ return "variable";
+ }
+
+ // If found closing tag reset
+ if (stream.match("}}")) {
+ state.waitProperty = null;
+ state.waitFilter = null;
+ state.waitDot = null;
+ state.waitPipe = null;
+ state.tokenize = tokenBase;
+ return "tag";
+ }
+
+ // If nothing was found, advance to the next character
+ stream.next();
+ return "null";
+ }
+
+ function inTag (stream, state) {
+ // Attempt to match a dot that precedes a property
+ if (state.waitDot) {
+ state.waitDot = false;
+
+ if (stream.peek() != ".") {
+ return "null";
+ }
+
+ // Dot followed by a non-word character should be considered an error.
+ if (stream.match(/\.\W+/)) {
+ return "error";
+ } else if (stream.eat(".")) {
+ state.waitProperty = true;
+ return "null";
+ } else {
+ throw Error ("Unexpected error while waiting for property.");
+ }
+ }
+
+ // Attempt to match a pipe that precedes a filter
+ if (state.waitPipe) {
+ state.waitPipe = false;
+
+ if (stream.peek() != "|") {
+ return "null";
+ }
+
+ // Pipe followed by a non-word character should be considered an error.
+ if (stream.match(/\.\W+/)) {
+ return "error";
+ } else if (stream.eat("|")) {
+ state.waitFilter = true;
+ return "null";
+ } else {
+ throw Error ("Unexpected error while waiting for filter.");
+ }
+ }
+
+ // Highlight properties
+ if (state.waitProperty) {
+ state.waitProperty = false;
+ if (stream.match(/\b(\w+)\b/)) {
+ state.waitDot = true; // A property can be followed by another property
+ state.waitPipe = true; // A property can be followed by a filter
+ return "property";
+ }
+ }
+
+ // Highlight filters
+ if (state.waitFilter) {
+ state.waitFilter = false;
+ if (stream.match(filters)) {
+ return "variable-2";
+ }
+ }
+
+ // Ignore all white spaces
+ if (stream.eatSpace()) {
+ state.waitProperty = false;
+ return "null";
+ }
+
+ // Identify numbers
+ if (stream.match(/\b\d+(\.\d+)?\b/)) {
+ return "number";
+ }
+
+ // Identify strings
+ if (stream.match("'")) {
+ state.tokenize = inString("'", state.tokenize);
+ return "string";
+ } else if (stream.match('"')) {
+ state.tokenize = inString('"', state.tokenize);
+ return "string";
+ }
+
+ // Attempt to match an operator
+ if (stream.match(operators)) {
+ 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) {
+ if (keywordMatch[0] == "comment") {
+ state.blockCommentTag = true;
+ }
+ return "keyword";
+ }
+
+ // Attempt to match a variable
+ if (stream.match(/\b(\w+)\b/)) {
+ state.waitDot = true;
+ state.waitPipe = true; // A property can be followed by a filter
+ return "variable";
+ }
+
+ // If found closing tag reset
+ if (stream.match("%}")) {
+ state.waitProperty = null;
+ state.waitFilter = null;
+ state.waitDot = null;
+ state.waitPipe = null;
+ // If the tag that closes is a block comment tag, we want to mark the
+ // following code as comment, until the tag closes.
+ if (state.blockCommentTag) {
+ state.blockCommentTag = false; // Release the "lock"
+ state.tokenize = inBlockComment;
+ } else {
+ state.tokenize = tokenBase;
+ }
+ return "tag";
+ }
+
+ // If nothing was found, advance to the next character
+ stream.next();
+ return "null";
+ }
+
+ // Mark everything as comment inside the tag and the tag itself.
+ function inComment (stream, state) {
+ if (stream.match(/^.*?#\}/)) state.tokenize = tokenBase
+ else stream.skipToEnd()
+ return "comment";
+ }
+
+ // Mark everything as a comment until the `blockcomment` tag closes.
+ function inBlockComment (stream, state) {
+ if (stream.match(/\{%\s*endcomment\s*%\}/, false)) {
+ state.tokenize = inTag;
+ stream.match("{%");
+ return "tag";
+ } else {
+ stream.next();
+ return "comment";
+ }
+ }
+
+ return {
+ startState: function () {
+ return {tokenize: tokenBase};
+ },
+ token: function (stream, state) {
+ return state.tokenize(stream, state);
+ },
+ blockCommentStart: "{% comment %}",
+ blockCommentEnd: "{% endcomment %}"
+ };
+ });
+
+ CodeMirror.defineMode("django", function(config) {
+ var htmlBase = CodeMirror.getMode(config, "text/html");
+ var djangoInner = CodeMirror.getMode(config, "django:inner");
+ return CodeMirror.overlayMode(htmlBase, djangoInner);
+ });
+
+ CodeMirror.defineMIME("text/x-django", "django");
+});
diff --git a/theme/plugins/codemirror/mode/django/index.html b/theme/plugins/codemirror/mode/django/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..41ea07c91b283079ab7ec7c1e82ac8e92c6d37b0
--- /dev/null
+++ b/theme/plugins/codemirror/mode/django/index.html
@@ -0,0 +1,73 @@
+
+
+CodeMirror: Django template mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Django template mode
+
+
+
+
+ My Django web application
+
+
+
+ {{ page.title|capfirst }}
+
+
+ {# traverse a list of items and produce links to their views. #}
+ {% for item in items %}
+
+
+ {{ item.name }}
+
+
+ {% empty %}
+ You have no items in your list.
+ {% endfor %}
+
+ {% comment "this is a forgotten footer" %}
+
+ {% endcomment %}
+
+
+
+
+
+
+ Mode for HTML with embedded Django template markup.
+
+ MIME types defined: text/x-django
+
diff --git a/theme/plugins/codemirror/mode/dockerfile/dockerfile.js b/theme/plugins/codemirror/mode/dockerfile/dockerfile.js
new file mode 100644
index 0000000000000000000000000000000000000000..769e787e4a869b56b649656815137db0452cd5e3
--- /dev/null
+++ b/theme/plugins/codemirror/mode/dockerfile/dockerfile.js
@@ -0,0 +1,211 @@
+// 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";
+
+ var from = "from";
+ var fromRegex = new RegExp("^(\\s*)\\b(" + from + ")\\b", "i");
+
+ var shells = ["run", "cmd", "entrypoint", "shell"];
+ var shellsAsArrayRegex = new RegExp("^(\\s*)(" + shells.join('|') + ")(\\s+\\[)", "i");
+
+ var expose = "expose";
+ var exposeRegex = new RegExp("^(\\s*)(" + expose + ")(\\s+)", "i");
+
+ var others = [
+ "arg", "from", "maintainer", "label", "env",
+ "add", "copy", "volume", "user",
+ "workdir", "onbuild", "stopsignal", "healthcheck", "shell"
+ ];
+
+ // Collect all Dockerfile directives
+ var instructions = [from, expose].concat(shells).concat(others),
+ instructionRegex = "(" + instructions.join('|') + ")",
+ instructionOnlyLine = new RegExp("^(\\s*)" + instructionRegex + "(\\s*)(#.*)?$", "i"),
+ instructionWithArguments = new RegExp("^(\\s*)" + instructionRegex + "(\\s+)", "i");
+
+ CodeMirror.defineSimpleMode("dockerfile", {
+ start: [
+ // Block comment: This is a line starting with a comment
+ {
+ regex: /^\s*#.*$/,
+ sol: true,
+ token: "comment"
+ },
+ {
+ regex: fromRegex,
+ token: [null, "keyword"],
+ sol: true,
+ next: "from"
+ },
+ // Highlight an instruction without any arguments (for convenience)
+ {
+ regex: instructionOnlyLine,
+ token: [null, "keyword", null, "error"],
+ sol: true
+ },
+ {
+ regex: shellsAsArrayRegex,
+ token: [null, "keyword", null],
+ sol: true,
+ next: "array"
+ },
+ {
+ regex: exposeRegex,
+ token: [null, "keyword", null],
+ sol: true,
+ next: "expose"
+ },
+ // Highlight an instruction followed by arguments
+ {
+ regex: instructionWithArguments,
+ token: [null, "keyword", null],
+ sol: true,
+ next: "arguments"
+ },
+ {
+ regex: /./,
+ token: null
+ }
+ ],
+ from: [
+ {
+ regex: /\s*$/,
+ token: null,
+ next: "start"
+ },
+ {
+ // Line comment without instruction arguments is an error
+ regex: /(\s*)(#.*)$/,
+ token: [null, "error"],
+ next: "start"
+ },
+ {
+ regex: /(\s*\S+\s+)(as)/i,
+ token: [null, "keyword"],
+ next: "start"
+ },
+ // Fail safe return to start
+ {
+ token: null,
+ next: "start"
+ }
+ ],
+ single: [
+ {
+ regex: /(?:[^\\']|\\.)/,
+ token: "string"
+ },
+ {
+ regex: /'/,
+ token: "string",
+ pop: true
+ }
+ ],
+ double: [
+ {
+ regex: /(?:[^\\"]|\\.)/,
+ token: "string"
+ },
+ {
+ regex: /"/,
+ token: "string",
+ pop: true
+ }
+ ],
+ array: [
+ {
+ regex: /\]/,
+ token: null,
+ next: "start"
+ },
+ {
+ regex: /"(?:[^\\"]|\\.)*"?/,
+ token: "string"
+ }
+ ],
+ expose: [
+ {
+ regex: /\d+$/,
+ token: "number",
+ next: "start"
+ },
+ {
+ regex: /[^\d]+$/,
+ token: null,
+ next: "start"
+ },
+ {
+ regex: /\d+/,
+ token: "number"
+ },
+ {
+ regex: /[^\d]+/,
+ token: null
+ },
+ // Fail safe return to start
+ {
+ token: null,
+ next: "start"
+ }
+ ],
+ arguments: [
+ {
+ regex: /^\s*#.*$/,
+ sol: true,
+ token: "comment"
+ },
+ {
+ regex: /"(?:[^\\"]|\\.)*"?$/,
+ token: "string",
+ next: "start"
+ },
+ {
+ regex: /"/,
+ token: "string",
+ push: "double"
+ },
+ {
+ regex: /'(?:[^\\']|\\.)*'?$/,
+ token: "string",
+ next: "start"
+ },
+ {
+ regex: /'/,
+ token: "string",
+ push: "single"
+ },
+ {
+ regex: /[^#"']+[\\`]$/,
+ token: null
+ },
+ {
+ regex: /[^#"']+$/,
+ token: null,
+ next: "start"
+ },
+ {
+ regex: /[^#"']+/,
+ token: null
+ },
+ // Fail safe return to start
+ {
+ token: null,
+ next: "start"
+ }
+ ],
+ meta: {
+ lineComment: "#"
+ }
+ });
+
+ CodeMirror.defineMIME("text/x-dockerfile", "dockerfile");
+});
diff --git a/theme/plugins/codemirror/mode/dockerfile/index.html b/theme/plugins/codemirror/mode/dockerfile/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..a31759bce15f3eb54aaafc0fde28f327a86d00bf
--- /dev/null
+++ b/theme/plugins/codemirror/mode/dockerfile/index.html
@@ -0,0 +1,73 @@
+
+
+CodeMirror: Dockerfile mode
+
+
+
+
+
+
+
+
+
+
+
+Dockerfile mode
+# Install Ghost blogging platform and run development environment
+#
+# VERSION 1.0.0
+
+FROM ubuntu:12.10
+MAINTAINER Amer Grgic "amer@livebyt.es"
+WORKDIR /data/ghost
+
+# Install dependencies for nginx installation
+RUN apt-get update
+RUN apt-get install -y python g++ make software-properties-common --force-yes
+RUN add-apt-repository ppa:chris-lea/node.js
+RUN apt-get update
+# Install unzip
+RUN apt-get install -y unzip
+# Install curl
+RUN apt-get install -y curl
+# Install nodejs & npm
+RUN apt-get install -y rlwrap
+RUN apt-get install -y nodejs
+# Download Ghost v0.4.1
+RUN curl -L https://ghost.org/zip/ghost-latest.zip -o /tmp/ghost.zip
+# Unzip Ghost zip to /data/ghost
+RUN unzip -uo /tmp/ghost.zip -d /data/ghost
+# Add custom config js to /data/ghost
+ADD ./config.example.js /data/ghost/config.js
+# Install Ghost with NPM
+RUN cd /data/ghost/ && npm install --production
+# Expose port 2368
+EXPOSE 2368
+# Run Ghost
+CMD ["npm","start"]
+
+
+
+
+ Dockerfile syntax highlighting for CodeMirror. Depends on
+ the simplemode addon.
+
+ MIME types defined: text/x-dockerfile
+
diff --git a/theme/plugins/codemirror/mode/dockerfile/test.js b/theme/plugins/codemirror/mode/dockerfile/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..9a2b89ad213bd45cfa797448b5abd99b36acec2c
--- /dev/null
+++ b/theme/plugins/codemirror/mode/dockerfile/test.js
@@ -0,0 +1,128 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function() {
+ var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-dockerfile");
+ function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+ MT("simple_nodejs_dockerfile",
+ "[keyword FROM] node:carbon",
+ "[comment # Create app directory]",
+ "[keyword WORKDIR] /usr/src/app",
+ "[comment # Install app dependencies]",
+ "[comment # A wildcard is used to ensure both package.json AND package-lock.json are copied]",
+ "[comment # where available (npm@5+)]",
+ "[keyword COPY] package*.json ./",
+ "[keyword RUN] npm install",
+ "[keyword COPY] . .",
+ "[keyword EXPOSE] [number 8080] [number 3000]",
+ "[keyword ENV] NODE_ENV development",
+ "[keyword CMD] [[ [string \"npm\"], [string \"start\"] ]]");
+
+ // Ideally the last space should not be highlighted.
+ MT("instruction_without_args_1",
+ "[keyword CMD] ");
+
+ MT("instruction_without_args_2",
+ "[comment # An instruction without args...]",
+ "[keyword ARG] [error #...is an error]");
+
+ MT("multiline",
+ "[keyword RUN] apt-get update && apt-get install -y \\",
+ " mercurial \\",
+ " subversion \\",
+ " && apt-get clean \\",
+ " && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*");
+
+ MT("from_comment",
+ " [keyword FROM] debian:stretch # I tend to use stable as that is more stable",
+ " [keyword FROM] debian:stretch [keyword AS] stable # I am even more stable",
+ " [keyword FROM] [error # this is an error]");
+
+ MT("from_as",
+ "[keyword FROM] golang:1.9.2-alpine3.6 [keyword AS] build",
+ "[keyword COPY] --from=build /bin/project /bin/project",
+ "[keyword ENTRYPOINT] [[ [string \"/bin/project\"] ]]",
+ "[keyword CMD] [[ [string \"--help\"] ]]");
+
+ MT("arg",
+ "[keyword ARG] VERSION=latest",
+ "[keyword FROM] busybox:$VERSION",
+ "[keyword ARG] VERSION",
+ "[keyword RUN] echo $VERSION > image_version");
+
+ MT("label",
+ "[keyword LABEL] com.example.label-with-value=[string \"foo\"]");
+
+ MT("label_multiline",
+ "[keyword LABEL] description=[string \"This text illustrates ]\\",
+ "[string that label-values can span multiple lines.\"]");
+
+ MT("maintainer",
+ "[keyword MAINTAINER] Foo Bar [string \"foo@bar.com\"] ",
+ "[keyword MAINTAINER] Bar Baz ");
+
+ MT("env",
+ "[keyword ENV] BUNDLE_PATH=[string \"$GEM_HOME\"] \\",
+ " BUNDLE_APP_CONFIG=[string \"$GEM_HOME\"]");
+
+ MT("verify_keyword",
+ "[keyword RUN] add-apt-repository ppa:chris-lea/node.js");
+
+ MT("scripts",
+ "[comment # Set an entrypoint, to automatically install node modules]",
+ "[keyword ENTRYPOINT] [[ [string \"/bin/bash\"], [string \"-c\"], [string \"if [[ ! -d node_modules ]]; then npm install; fi; exec \\\"${@:0}\\\";\"] ]]",
+ "[keyword CMD] npm start",
+ "[keyword RUN] npm run build && \\",
+ "[comment # a comment between the shell commands]",
+ " npm run test");
+
+ MT("strings_single",
+ "[keyword FROM] buildpack-deps:stretch",
+ "[keyword RUN] { \\",
+ " echo [string 'install: --no-document']; \\",
+ " echo [string 'update: --no-document']; \\",
+ " } >> /usr/local/etc/gemrc");
+
+ MT("strings_single_multiline",
+ "[keyword RUN] set -ex \\",
+ " \\",
+ " && buildDeps=[string ' ]\\",
+ "[string bison ]\\",
+ "[string dpkg-dev ]\\",
+ "[string libgdbm-dev ]\\",
+ "[string ruby ]\\",
+ "[string '] \\",
+ " && apt-get update");
+
+ MT("strings_single_multiline_2",
+ "[keyword RUN] echo [string 'say \\' ]\\",
+ "[string it works'] ");
+
+ MT("strings_double",
+ "[keyword RUN] apt-get install -y --no-install-recommends $buildDeps \\",
+ " \\",
+ " && wget -O ruby.tar.xz [string \"https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz\"] \\",
+ " && echo [string \"$RUBY_DOWNLOAD_SHA256 *ruby.tar.xz\"] | sha256sum -c - ");
+
+ MT("strings_double_multiline",
+ "[keyword RUN] echo [string \"say \\\" ]\\",
+ "[string it works\"] ");
+
+ MT("escape",
+ "[comment # escape=`]",
+ "[keyword FROM] microsoft/windowsservercore",
+ "[keyword RUN] powershell.exe -Command `",
+ " $ErrorActionPreference = [string 'Stop']; `",
+ " wget https://www.python.org/ftp/python/3.5.1/python-3.5.1.exe -OutFile c:\python-3.5.1.exe ; `",
+ " Start-Process c:\python-3.5.1.exe -ArgumentList [string '/quiet InstallAllUsers=1 PrependPath=1'] -Wait ; `",
+ " Remove-Item c:\python-3.5.1.exe -Force)");
+
+ MT("escape_strings",
+ "[comment # escape=`]",
+ "[keyword FROM] python:3.6-windowsservercore [keyword AS] python",
+ "[keyword RUN] $env:PATH = [string 'C:\\Python;C:\\Python\\Scripts;{0}'] -f $env:PATH ; `",
+ // It should not consider \' as escaped.
+ // " Set-ItemProperty -Path [string 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment\\'] -Name Path -Value $env:PATH ;");
+ " Set-ItemProperty -Path [string 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment\\' -Name Path -Value $env:PATH ;]");
+})();
diff --git a/theme/plugins/codemirror/mode/dtd/dtd.js b/theme/plugins/codemirror/mode/dtd/dtd.js
new file mode 100644
index 0000000000000000000000000000000000000000..52d76ee114c2d75a0545743d63be812c07356e2b
--- /dev/null
+++ b/theme/plugins/codemirror/mode/dtd/dtd.js
@@ -0,0 +1,142 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+/*
+ DTD mode
+ Ported to CodeMirror by Peter Kroon
+ Report bugs/issues here: https://github.com/codemirror/CodeMirror/issues
+ GitHub: @peterkroon
+*/
+
+(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("dtd", function(config) {
+ var indentUnit = config.indentUnit, type;
+ function ret(style, tp) {type = tp; return style;}
+
+ function tokenBase(stream, state) {
+ var ch = stream.next();
+
+ if (ch == "<" && stream.eat("!") ) {
+ if (stream.eatWhile(/[\-]/)) {
+ state.tokenize = tokenSGMLComment;
+ return tokenSGMLComment(stream, state);
+ } else if (stream.eatWhile(/[\w]/)) return ret("keyword", "doindent");
+ } else if (ch == "<" && stream.eat("?")) { //xml declaration
+ state.tokenize = inBlock("meta", "?>");
+ return ret("meta", ch);
+ } else if (ch == "#" && stream.eatWhile(/[\w]/)) return ret("atom", "tag");
+ else if (ch == "|") return ret("keyword", "seperator");
+ else if (ch.match(/[\(\)\[\]\-\.,\+\?>]/)) return ret(null, ch);//if(ch === ">") return ret(null, "endtag"); else
+ else if (ch.match(/[\[\]]/)) return ret("rule", ch);
+ else if (ch == "\"" || ch == "'") {
+ state.tokenize = tokenString(ch);
+ return state.tokenize(stream, state);
+ } else if (stream.eatWhile(/[a-zA-Z\?\+\d]/)) {
+ var sc = stream.current();
+ if( sc.substr(sc.length-1,sc.length).match(/\?|\+/) !== null )stream.backUp(1);
+ return ret("tag", "tag");
+ } else if (ch == "%" || ch == "*" ) return ret("number", "number");
+ else {
+ stream.eatWhile(/[\w\\\-_%.{,]/);
+ return ret(null, null);
+ }
+ }
+
+ function tokenSGMLComment(stream, state) {
+ var dashes = 0, ch;
+ while ((ch = stream.next()) != null) {
+ if (dashes >= 2 && ch == ">") {
+ state.tokenize = tokenBase;
+ break;
+ }
+ dashes = (ch == "-") ? dashes + 1 : 0;
+ }
+ return ret("comment", "comment");
+ }
+
+ function tokenString(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 ret("string", "tag");
+ };
+ }
+
+ function inBlock(style, terminator) {
+ return function(stream, state) {
+ while (!stream.eol()) {
+ if (stream.match(terminator)) {
+ state.tokenize = tokenBase;
+ break;
+ }
+ stream.next();
+ }
+ return style;
+ };
+ }
+
+ return {
+ startState: function(base) {
+ return {tokenize: tokenBase,
+ baseIndent: base || 0,
+ stack: []};
+ },
+
+ token: function(stream, state) {
+ if (stream.eatSpace()) return null;
+ var style = state.tokenize(stream, state);
+
+ var context = state.stack[state.stack.length-1];
+ if (stream.current() == "[" || type === "doindent" || type == "[") state.stack.push("rule");
+ else if (type === "endtag") state.stack[state.stack.length-1] = "endtag";
+ else if (stream.current() == "]" || type == "]" || (type == ">" && context == "rule")) state.stack.pop();
+ else if (type == "[") state.stack.push("[");
+ return style;
+ },
+
+ indent: function(state, textAfter) {
+ var n = state.stack.length;
+
+ if( textAfter.match(/\]\s+|\]/) )n=n-1;
+ else if(textAfter.substr(textAfter.length-1, textAfter.length) === ">"){
+ if(textAfter.substr(0,1) === "<") {}
+ else if( type == "doindent" && textAfter.length > 1 ) {}
+ else if( type == "doindent")n--;
+ else if( type == ">" && textAfter.length > 1) {}
+ else if( type == "tag" && textAfter !== ">") {}
+ else if( type == "tag" && state.stack[state.stack.length-1] == "rule")n--;
+ else if( type == "tag")n++;
+ else if( textAfter === ">" && state.stack[state.stack.length-1] == "rule" && type === ">")n--;
+ else if( textAfter === ">" && state.stack[state.stack.length-1] == "rule") {}
+ else if( textAfter.substr(0,1) !== "<" && textAfter.substr(0,1) === ">" )n=n-1;
+ else if( textAfter === ">") {}
+ else n=n-1;
+ //over rule them all
+ if(type == null || type == "]")n--;
+ }
+
+ return state.baseIndent + n * indentUnit;
+ },
+
+ electricChars: "]>"
+ };
+});
+
+CodeMirror.defineMIME("application/xml-dtd", "dtd");
+
+});
diff --git a/theme/plugins/codemirror/mode/dtd/index.html b/theme/plugins/codemirror/mode/dtd/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..e6798a748add00351be1ca564d8f9df0bdd8fe83
--- /dev/null
+++ b/theme/plugins/codemirror/mode/dtd/index.html
@@ -0,0 +1,89 @@
+
+
+CodeMirror: DTD mode
+
+
+
+
+
+
+
+
+
+
+DTD mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ]
+>
+
+
+
+
+
+
+ MIME types defined: application/xml-dtd
.
+
diff --git a/theme/plugins/codemirror/mode/dylan/dylan.js b/theme/plugins/codemirror/mode/dylan/dylan.js
new file mode 100644
index 0000000000000000000000000000000000000000..0acc1a38881a7d3c5449d88c80c1896792b39ea2
--- /dev/null
+++ b/theme/plugins/codemirror/mode/dylan/dylan.js
@@ -0,0 +1,352 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+function forEach(arr, f) {
+ for (var i = 0; i < arr.length; i++) f(arr[i], i)
+}
+function some(arr, f) {
+ for (var i = 0; i < arr.length; i++) if (f(arr[i], i)) return true
+ return false
+}
+
+CodeMirror.defineMode("dylan", function(_config) {
+ // Words
+ var words = {
+ // Words that introduce unnamed definitions like "define interface"
+ unnamedDefinition: ["interface"],
+
+ // Words that introduce simple named definitions like "define library"
+ namedDefinition: ["module", "library", "macro",
+ "C-struct", "C-union",
+ "C-function", "C-callable-wrapper"
+ ],
+
+ // Words that introduce type definitions like "define class".
+ // These are also parameterized like "define method" and are
+ // appended to otherParameterizedDefinitionWords
+ typeParameterizedDefinition: ["class", "C-subtype", "C-mapped-subtype"],
+
+ // Words that introduce trickier definitions like "define method".
+ // These require special definitions to be added to startExpressions
+ otherParameterizedDefinition: ["method", "function",
+ "C-variable", "C-address"
+ ],
+
+ // Words that introduce module constant definitions.
+ // These must also be simple definitions and are
+ // appended to otherSimpleDefinitionWords
+ constantSimpleDefinition: ["constant"],
+
+ // Words that introduce module variable definitions.
+ // These must also be simple definitions and are
+ // appended to otherSimpleDefinitionWords
+ variableSimpleDefinition: ["variable"],
+
+ // Other words that introduce simple definitions
+ // (without implicit bodies).
+ otherSimpleDefinition: ["generic", "domain",
+ "C-pointer-type",
+ "table"
+ ],
+
+ // Words that begin statements with implicit bodies.
+ statement: ["if", "block", "begin", "method", "case",
+ "for", "select", "when", "unless", "until",
+ "while", "iterate", "profiling", "dynamic-bind"
+ ],
+
+ // Patterns that act as separators in compound statements.
+ // This may include any general pattern that must be indented
+ // specially.
+ separator: ["finally", "exception", "cleanup", "else",
+ "elseif", "afterwards"
+ ],
+
+ // Keywords that do not require special indentation handling,
+ // but which should be highlighted
+ other: ["above", "below", "by", "from", "handler", "in",
+ "instance", "let", "local", "otherwise", "slot",
+ "subclass", "then", "to", "keyed-by", "virtual"
+ ],
+
+ // Condition signaling function calls
+ signalingCalls: ["signal", "error", "cerror",
+ "break", "check-type", "abort"
+ ]
+ };
+
+ words["otherDefinition"] =
+ words["unnamedDefinition"]
+ .concat(words["namedDefinition"])
+ .concat(words["otherParameterizedDefinition"]);
+
+ words["definition"] =
+ words["typeParameterizedDefinition"]
+ .concat(words["otherDefinition"]);
+
+ words["parameterizedDefinition"] =
+ words["typeParameterizedDefinition"]
+ .concat(words["otherParameterizedDefinition"]);
+
+ words["simpleDefinition"] =
+ words["constantSimpleDefinition"]
+ .concat(words["variableSimpleDefinition"])
+ .concat(words["otherSimpleDefinition"]);
+
+ words["keyword"] =
+ words["statement"]
+ .concat(words["separator"])
+ .concat(words["other"]);
+
+ // Patterns
+ var symbolPattern = "[-_a-zA-Z?!*@<>$%]+";
+ var symbol = new RegExp("^" + symbolPattern);
+ var patterns = {
+ // Symbols with special syntax
+ symbolKeyword: symbolPattern + ":",
+ symbolClass: "<" + symbolPattern + ">",
+ symbolGlobal: "\\*" + symbolPattern + "\\*",
+ symbolConstant: "\\$" + symbolPattern
+ };
+ var patternStyles = {
+ symbolKeyword: "atom",
+ symbolClass: "tag",
+ symbolGlobal: "variable-2",
+ symbolConstant: "variable-3"
+ };
+
+ // Compile all patterns to regular expressions
+ for (var patternName in patterns)
+ if (patterns.hasOwnProperty(patternName))
+ patterns[patternName] = new RegExp("^" + patterns[patternName]);
+
+ // Names beginning "with-" and "without-" are commonly
+ // used as statement macro
+ patterns["keyword"] = [/^with(?:out)?-[-_a-zA-Z?!*@<>$%]+/];
+
+ var styles = {};
+ styles["keyword"] = "keyword";
+ styles["definition"] = "def";
+ styles["simpleDefinition"] = "def";
+ styles["signalingCalls"] = "builtin";
+
+ // protected words lookup table
+ var wordLookup = {};
+ var styleLookup = {};
+
+ forEach([
+ "keyword",
+ "definition",
+ "simpleDefinition",
+ "signalingCalls"
+ ], function(type) {
+ forEach(words[type], function(word) {
+ wordLookup[word] = type;
+ styleLookup[word] = styles[type];
+ });
+ });
+
+
+ function chain(stream, state, f) {
+ state.tokenize = f;
+ return f(stream, state);
+ }
+
+ function tokenBase(stream, state) {
+ // String
+ var ch = stream.peek();
+ if (ch == "'" || ch == '"') {
+ stream.next();
+ return chain(stream, state, tokenString(ch, "string"));
+ }
+ // Comment
+ else if (ch == "/") {
+ stream.next();
+ if (stream.eat("*")) {
+ return chain(stream, state, tokenComment);
+ } else if (stream.eat("/")) {
+ stream.skipToEnd();
+ return "comment";
+ }
+ stream.backUp(1);
+ }
+ // Decimal
+ else if (/[+\-\d\.]/.test(ch)) {
+ if (stream.match(/^[+-]?[0-9]*\.[0-9]*([esdx][+-]?[0-9]+)?/i) ||
+ stream.match(/^[+-]?[0-9]+([esdx][+-]?[0-9]+)/i) ||
+ stream.match(/^[+-]?\d+/)) {
+ return "number";
+ }
+ }
+ // Hash
+ else if (ch == "#") {
+ stream.next();
+ // Symbol with string syntax
+ ch = stream.peek();
+ if (ch == '"') {
+ stream.next();
+ return chain(stream, state, tokenString('"', "string"));
+ }
+ // Binary number
+ else if (ch == "b") {
+ stream.next();
+ stream.eatWhile(/[01]/);
+ return "number";
+ }
+ // Hex number
+ else if (ch == "x") {
+ stream.next();
+ stream.eatWhile(/[\da-f]/i);
+ return "number";
+ }
+ // Octal number
+ else if (ch == "o") {
+ stream.next();
+ stream.eatWhile(/[0-7]/);
+ return "number";
+ }
+ // Token concatenation in macros
+ else if (ch == '#') {
+ stream.next();
+ return "punctuation";
+ }
+ // Sequence literals
+ else if ((ch == '[') || (ch == '(')) {
+ stream.next();
+ return "bracket";
+ // Hash symbol
+ } else if (stream.match(/f|t|all-keys|include|key|next|rest/i)) {
+ return "atom";
+ } else {
+ stream.eatWhile(/[-a-zA-Z]/);
+ return "error";
+ }
+ } else if (ch == "~") {
+ stream.next();
+ ch = stream.peek();
+ if (ch == "=") {
+ stream.next();
+ ch = stream.peek();
+ if (ch == "=") {
+ stream.next();
+ return "operator";
+ }
+ return "operator";
+ }
+ return "operator";
+ } else if (ch == ":") {
+ stream.next();
+ ch = stream.peek();
+ if (ch == "=") {
+ stream.next();
+ return "operator";
+ } else if (ch == ":") {
+ stream.next();
+ return "punctuation";
+ }
+ } else if ("[](){}".indexOf(ch) != -1) {
+ stream.next();
+ return "bracket";
+ } else if (".,".indexOf(ch) != -1) {
+ stream.next();
+ return "punctuation";
+ } else if (stream.match("end")) {
+ return "keyword";
+ }
+ for (var name in patterns) {
+ if (patterns.hasOwnProperty(name)) {
+ var pattern = patterns[name];
+ if ((pattern instanceof Array && some(pattern, function(p) {
+ return stream.match(p);
+ })) || stream.match(pattern))
+ return patternStyles[name];
+ }
+ }
+ if (/[+\-*\/^=<>&|]/.test(ch)) {
+ stream.next();
+ return "operator";
+ }
+ if (stream.match("define")) {
+ return "def";
+ } else {
+ stream.eatWhile(/[\w\-]/);
+ // Keyword
+ if (wordLookup.hasOwnProperty(stream.current())) {
+ return styleLookup[stream.current()];
+ } else if (stream.current().match(symbol)) {
+ return "variable";
+ } else {
+ stream.next();
+ return "variable-2";
+ }
+ }
+ }
+
+ function tokenComment(stream, state) {
+ var maybeEnd = false, maybeNested = false, nestedCount = 0, ch;
+ while ((ch = stream.next())) {
+ if (ch == "/" && maybeEnd) {
+ if (nestedCount > 0) {
+ nestedCount--;
+ } else {
+ state.tokenize = tokenBase;
+ break;
+ }
+ } else if (ch == "*" && maybeNested) {
+ nestedCount++;
+ }
+ maybeEnd = (ch == "*");
+ maybeNested = (ch == "/");
+ }
+ return "comment";
+ }
+
+ function tokenString(quote, style) {
+ return function(stream, state) {
+ var escaped = false, next, end = false;
+ while ((next = stream.next()) != null) {
+ if (next == quote && !escaped) {
+ end = true;
+ break;
+ }
+ escaped = !escaped && next == "\\";
+ }
+ if (end || !escaped) {
+ state.tokenize = tokenBase;
+ }
+ return style;
+ };
+ }
+
+ // Interface
+ return {
+ startState: function() {
+ return {
+ tokenize: tokenBase,
+ currentIndent: 0
+ };
+ },
+ token: function(stream, state) {
+ if (stream.eatSpace())
+ return null;
+ var style = state.tokenize(stream, state);
+ return style;
+ },
+ blockCommentStart: "/*",
+ blockCommentEnd: "*/"
+ };
+});
+
+CodeMirror.defineMIME("text/x-dylan", "dylan");
+
+});
diff --git a/theme/plugins/codemirror/mode/dylan/index.html b/theme/plugins/codemirror/mode/dylan/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..ddf5ad067dfdc9e760e09cadcaa15f90ec57d929
--- /dev/null
+++ b/theme/plugins/codemirror/mode/dylan/index.html
@@ -0,0 +1,407 @@
+
+
+CodeMirror: Dylan mode
+
+
+
+
+
+
+
+
+
+
+
+
+
+Dylan mode
+
+
+
+Module: locators-internals
+Synopsis: Abstract modeling of locations
+Author: Andy Armstrong
+Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc.
+ All rights reserved.
+License: See License.txt in this distribution for details.
+Warranty: Distributed WITHOUT WARRANTY OF ANY KIND
+
+define open generic locator-server
+ (locator :: ) => (server :: false-or());
+define open generic locator-host
+ (locator :: ) => (host :: false-or());
+define open generic locator-volume
+ (locator :: ) => (volume :: false-or());
+define open generic locator-directory
+ (locator :: ) => (directory :: false-or());
+define open generic locator-relative?
+ (locator ::