summaryrefslogtreecommitdiff
path: root/public/vendor/codemirror/mode/r
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xpublic/vendor/codemirror/mode/r/index.html85
-rwxr-xr-xpublic/vendor/codemirror/mode/r/r.js162
-rwxr-xr-xpublic/vendor/codemirror/mode/rpm/changes/index.html66
-rwxr-xr-xpublic/vendor/codemirror/mode/rpm/index.html149
-rwxr-xr-xpublic/vendor/codemirror/mode/rpm/rpm.js101
-rwxr-xr-xpublic/vendor/codemirror/mode/rst/index.html535
-rwxr-xr-xpublic/vendor/codemirror/mode/rst/rst.js557
-rwxr-xr-xpublic/vendor/codemirror/mode/ruby/index.html183
-rwxr-xr-xpublic/vendor/codemirror/mode/ruby/ruby.js285
-rwxr-xr-xpublic/vendor/codemirror/mode/ruby/test.js14
-rwxr-xr-xpublic/vendor/codemirror/mode/rust/index.html60
-rwxr-xr-xpublic/vendor/codemirror/mode/rust/rust.js451
12 files changed, 2648 insertions, 0 deletions
diff --git a/public/vendor/codemirror/mode/r/index.html b/public/vendor/codemirror/mode/r/index.html
new file mode 100755
index 00000000..6dd96346
--- /dev/null
+++ b/public/vendor/codemirror/mode/r/index.html
@@ -0,0 +1,85 @@
+<!doctype html>
+
+<title>CodeMirror: R mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="r.js"></script>
+<style>
+ .CodeMirror { border-top: 1px solid silver; border-bottom: 1px solid silver; }
+ .cm-s-default span.cm-semi { color: blue; font-weight: bold; }
+ .cm-s-default span.cm-dollar { color: orange; font-weight: bold; }
+ .cm-s-default span.cm-arrow { color: brown; }
+ .cm-s-default span.cm-arg-is { color: brown; }
+ </style>
+<div id=nav>
+ <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/codemirror/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">R</a>
+ </ul>
+</div>
+
+<article>
+<h2>R mode</h2>
+<form><textarea id="code" name="code">
+# Code from http://www.mayin.org/ajayshah/KB/R/
+
+# FIRST LEARN ABOUT LISTS --
+X = list(height=5.4, weight=54)
+print("Use default printing --")
+print(X)
+print("Accessing individual elements --")
+cat("Your height is ", X$height, " and your weight is ", X$weight, "\n")
+
+# FUNCTIONS --
+square <- function(x) {
+ return(x*x)
+}
+cat("The square of 3 is ", square(3), "\n")
+
+ # default value of the arg is set to 5.
+cube <- function(x=5) {
+ return(x*x*x);
+}
+cat("Calling cube with 2 : ", cube(2), "\n") # will give 2^3
+cat("Calling cube : ", cube(), "\n") # will default to 5^3.
+
+# LEARN ABOUT FUNCTIONS THAT RETURN MULTIPLE OBJECTS --
+powers <- function(x) {
+ parcel = list(x2=x*x, x3=x*x*x, x4=x*x*x*x);
+ return(parcel);
+}
+
+X = powers(3);
+print("Showing powers of 3 --"); print(X);
+
+# WRITING THIS COMPACTLY (4 lines instead of 7)
+
+powerful <- function(x) {
+ return(list(x2=x*x, x3=x*x*x, x4=x*x*x*x));
+}
+print("Showing powers of 3 --"); print(powerful(3));
+
+# In R, the last expression in a function is, by default, what is
+# returned. So you could equally just say:
+powerful <- function(x) {list(x2=x*x, x3=x*x*x, x4=x*x*x*x)}
+</textarea></form>
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
+ </script>
+
+ <p><strong>MIME types defined:</strong> <code>text/x-rsrc</code>.</p>
+
+ <p>Development of the CodeMirror R mode was kindly sponsored
+ by <a href="https://twitter.com/ubalo">Ubalo</a>.</p>
+
+ </article>
diff --git a/public/vendor/codemirror/mode/r/r.js b/public/vendor/codemirror/mode/r/r.js
new file mode 100755
index 00000000..1ab4a956
--- /dev/null
+++ b/public/vendor/codemirror/mode/r/r.js
@@ -0,0 +1,162 @@
+// 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("r", function(config) {
+ function wordObj(str) {
+ var words = str.split(" "), res = {};
+ for (var i = 0; i < words.length; ++i) res[words[i]] = true;
+ return res;
+ }
+ var atoms = wordObj("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_");
+ var builtins = wordObj("list quote bquote eval return call parse deparse");
+ var keywords = wordObj("if else repeat while function for in next break");
+ var blockkeywords = wordObj("if else repeat while function for");
+ var opChars = /[+\-*\/^<>=!&|~$:]/;
+ var curPunc;
+
+ function tokenBase(stream, state) {
+ curPunc = null;
+ var ch = stream.next();
+ if (ch == "#") {
+ stream.skipToEnd();
+ return "comment";
+ } else if (ch == "0" && stream.eat("x")) {
+ stream.eatWhile(/[\da-f]/i);
+ return "number";
+ } else if (ch == "." && stream.eat(/\d/)) {
+ stream.match(/\d*(?:e[+\-]?\d+)?/);
+ return "number";
+ } else if (/\d/.test(ch)) {
+ stream.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/);
+ return "number";
+ } else if (ch == "'" || ch == '"') {
+ state.tokenize = tokenString(ch);
+ return "string";
+ } else if (ch == "." && stream.match(/.[.\d]+/)) {
+ return "keyword";
+ } else if (/[\w\.]/.test(ch) && ch != "_") {
+ stream.eatWhile(/[\w\.]/);
+ var word = stream.current();
+ if (atoms.propertyIsEnumerable(word)) return "atom";
+ if (keywords.propertyIsEnumerable(word)) {
+ // Block keywords start new blocks, except 'else if', which only starts
+ // one new block for the 'if', no block for the 'else'.
+ if (blockkeywords.propertyIsEnumerable(word) &&
+ !stream.match(/\s*if(\s+|$)/, false))
+ curPunc = "block";
+ return "keyword";
+ }
+ if (builtins.propertyIsEnumerable(word)) return "builtin";
+ return "variable";
+ } else if (ch == "%") {
+ if (stream.skipTo("%")) stream.next();
+ return "variable-2";
+ } else if (ch == "<" && stream.eat("-")) {
+ return "arrow";
+ } else if (ch == "=" && state.ctx.argList) {
+ return "arg-is";
+ } else if (opChars.test(ch)) {
+ if (ch == "$") return "dollar";
+ stream.eatWhile(opChars);
+ return "operator";
+ } else if (/[\(\){}\[\];]/.test(ch)) {
+ curPunc = ch;
+ if (ch == ";") return "semi";
+ return null;
+ } else {
+ return null;
+ }
+ }
+
+ function tokenString(quote) {
+ return function(stream, state) {
+ if (stream.eat("\\")) {
+ var ch = stream.next();
+ if (ch == "x") stream.match(/^[a-f0-9]{2}/i);
+ else if ((ch == "u" || ch == "U") && stream.eat("{") && stream.skipTo("}")) stream.next();
+ else if (ch == "u") stream.match(/^[a-f0-9]{4}/i);
+ else if (ch == "U") stream.match(/^[a-f0-9]{8}/i);
+ else if (/[0-7]/.test(ch)) stream.match(/^[0-7]{1,2}/);
+ return "string-2";
+ } else {
+ var next;
+ while ((next = stream.next()) != null) {
+ if (next == quote) { state.tokenize = tokenBase; break; }
+ if (next == "\\") { stream.backUp(1); break; }
+ }
+ return "string";
+ }
+ };
+ }
+
+ function push(state, type, stream) {
+ state.ctx = {type: type,
+ indent: state.indent,
+ align: null,
+ column: stream.column(),
+ prev: state.ctx};
+ }
+ function pop(state) {
+ state.indent = state.ctx.indent;
+ state.ctx = state.ctx.prev;
+ }
+
+ return {
+ startState: function() {
+ return {tokenize: tokenBase,
+ ctx: {type: "top",
+ indent: -config.indentUnit,
+ align: false},
+ indent: 0,
+ afterIdent: false};
+ },
+
+ token: function(stream, state) {
+ if (stream.sol()) {
+ if (state.ctx.align == null) state.ctx.align = false;
+ state.indent = stream.indentation();
+ }
+ if (stream.eatSpace()) return null;
+ var style = state.tokenize(stream, state);
+ if (style != "comment" && state.ctx.align == null) state.ctx.align = true;
+
+ var ctype = state.ctx.type;
+ if ((curPunc == ";" || curPunc == "{" || curPunc == "}") && ctype == "block") pop(state);
+ if (curPunc == "{") push(state, "}", stream);
+ else if (curPunc == "(") {
+ push(state, ")", stream);
+ if (state.afterIdent) state.ctx.argList = true;
+ }
+ else if (curPunc == "[") push(state, "]", stream);
+ else if (curPunc == "block") push(state, "block", stream);
+ else if (curPunc == ctype) pop(state);
+ state.afterIdent = style == "variable" || style == "keyword";
+ return style;
+ },
+
+ indent: function(state, textAfter) {
+ if (state.tokenize != tokenBase) return 0;
+ var firstChar = textAfter && textAfter.charAt(0), ctx = state.ctx,
+ closing = firstChar == ctx.type;
+ if (ctx.type == "block") return ctx.indent + (firstChar == "{" ? 0 : config.indentUnit);
+ else if (ctx.align) return ctx.column + (closing ? 0 : 1);
+ else return ctx.indent + (closing ? 0 : config.indentUnit);
+ },
+
+ lineComment: "#"
+ };
+});
+
+CodeMirror.defineMIME("text/x-rsrc", "r");
+
+});
diff --git a/public/vendor/codemirror/mode/rpm/changes/index.html b/public/vendor/codemirror/mode/rpm/changes/index.html
new file mode 100755
index 00000000..6e5031bd
--- /dev/null
+++ b/public/vendor/codemirror/mode/rpm/changes/index.html
@@ -0,0 +1,66 @@
+<!doctype html>
+
+<title>CodeMirror: RPM changes mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+ <link rel="stylesheet" href="../../../lib/codemirror.css">
+ <script src="../../../lib/codemirror.js"></script>
+ <script src="changes.js"></script>
+ <link rel="stylesheet" href="../../../doc/docs.css">
+ <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+
+<div id=nav>
+ <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../../index.html">Home</a>
+ <li><a href="../../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/codemirror/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../../index.html">Language modes</a>
+ <li><a class=active href="#">RPM changes</a>
+ </ul>
+</div>
+
+<article>
+<h2>RPM changes mode</h2>
+
+ <div><textarea id="code" name="code">
+-------------------------------------------------------------------
+Tue Oct 18 13:58:40 UTC 2011 - misterx@example.com
+
+- Update to r60.3
+- Fixes bug in the reflect package
+ * disallow Interface method on Value obtained via unexported name
+
+-------------------------------------------------------------------
+Thu Oct 6 08:14:24 UTC 2011 - misterx@example.com
+
+- Update to r60.2
+- Fixes memory leak in certain map types
+
+-------------------------------------------------------------------
+Wed Oct 5 14:34:10 UTC 2011 - misterx@example.com
+
+- Tweaks for gdb debugging
+- go.spec changes:
+ - move %go_arch definition to %prep section
+ - pass correct location of go specific gdb pretty printer and
+ functions to cpp as HOST_EXTRA_CFLAGS macro
+ - install go gdb functions & printer
+- gdb-printer.patch
+ - patch linker (src/cmd/ld/dwarf.c) to emit correct location of go
+ gdb functions and pretty printer
+</textarea></div>
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ mode: {name: "changes"},
+ lineNumbers: true,
+ indentUnit: 4
+ });
+ </script>
+
+ <p><strong>MIME types defined:</strong> <code>text/x-rpm-changes</code>.</p>
+</article>
diff --git a/public/vendor/codemirror/mode/rpm/index.html b/public/vendor/codemirror/mode/rpm/index.html
new file mode 100755
index 00000000..9a34e6df
--- /dev/null
+++ b/public/vendor/codemirror/mode/rpm/index.html
@@ -0,0 +1,149 @@
+<!doctype html>
+
+<title>CodeMirror: RPM changes mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+ <link rel="stylesheet" href="../../lib/codemirror.css">
+ <script src="../../lib/codemirror.js"></script>
+ <script src="rpm.js"></script>
+ <link rel="stylesheet" href="../../doc/docs.css">
+ <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+
+<div id=nav>
+ <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/codemirror/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">RPM</a>
+ </ul>
+</div>
+
+<article>
+<h2>RPM changes mode</h2>
+
+ <div><textarea id="code" name="code">
+-------------------------------------------------------------------
+Tue Oct 18 13:58:40 UTC 2011 - misterx@example.com
+
+- Update to r60.3
+- Fixes bug in the reflect package
+ * disallow Interface method on Value obtained via unexported name
+
+-------------------------------------------------------------------
+Thu Oct 6 08:14:24 UTC 2011 - misterx@example.com
+
+- Update to r60.2
+- Fixes memory leak in certain map types
+
+-------------------------------------------------------------------
+Wed Oct 5 14:34:10 UTC 2011 - misterx@example.com
+
+- Tweaks for gdb debugging
+- go.spec changes:
+ - move %go_arch definition to %prep section
+ - pass correct location of go specific gdb pretty printer and
+ functions to cpp as HOST_EXTRA_CFLAGS macro
+ - install go gdb functions & printer
+- gdb-printer.patch
+ - patch linker (src/cmd/ld/dwarf.c) to emit correct location of go
+ gdb functions and pretty printer
+</textarea></div>
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ mode: {name: "rpm-changes"},
+ lineNumbers: true,
+ indentUnit: 4
+ });
+ </script>
+
+<h2>RPM spec mode</h2>
+
+ <div><textarea id="code2" name="code2">
+#
+# spec file for package minidlna
+#
+# Copyright (c) 2011, Sascha Peilicke <saschpe@gmx.de>
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+
+Name: libupnp6
+Version: 1.6.13
+Release: 0
+Summary: Portable Universal Plug and Play (UPnP) SDK
+Group: System/Libraries
+License: BSD-3-Clause
+Url: http://sourceforge.net/projects/pupnp/
+Source0: http://downloads.sourceforge.net/pupnp/libupnp-%{version}.tar.bz2
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+
+%description
+The portable Universal Plug and Play (UPnP) SDK provides support for building
+UPnP-compliant control points, devices, and bridges on several operating
+systems.
+
+%package -n libupnp-devel
+Summary: Portable Universal Plug and Play (UPnP) SDK
+Group: Development/Libraries/C and C++
+Provides: pkgconfig(libupnp)
+Requires: %{name} = %{version}
+
+%description -n libupnp-devel
+The portable Universal Plug and Play (UPnP) SDK provides support for building
+UPnP-compliant control points, devices, and bridges on several operating
+systems.
+
+%prep
+%setup -n libupnp-%{version}
+
+%build
+%configure --disable-static
+make %{?_smp_mflags}
+
+%install
+%makeinstall
+find %{buildroot} -type f -name '*.la' -exec rm -f {} ';'
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(-,root,root,-)
+%doc ChangeLog NEWS README TODO
+%{_libdir}/libixml.so.*
+%{_libdir}/libthreadutil.so.*
+%{_libdir}/libupnp.so.*
+
+%files -n libupnp-devel
+%defattr(-,root,root,-)
+%{_libdir}/pkgconfig/libupnp.pc
+%{_libdir}/libixml.so
+%{_libdir}/libthreadutil.so
+%{_libdir}/libupnp.so
+%{_includedir}/upnp/
+
+%changelog</textarea></div>
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code2"), {
+ mode: {name: "rpm-spec"},
+ lineNumbers: true,
+ indentUnit: 4
+ });
+ </script>
+
+ <p><strong>MIME types defined:</strong> <code>text/x-rpm-spec</code>, <code>text/x-rpm-changes</code>.</p>
+</article>
diff --git a/public/vendor/codemirror/mode/rpm/rpm.js b/public/vendor/codemirror/mode/rpm/rpm.js
new file mode 100755
index 00000000..3bb7cd2f
--- /dev/null
+++ b/public/vendor/codemirror/mode/rpm/rpm.js
@@ -0,0 +1,101 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+CodeMirror.defineMode("rpm-changes", function() {
+ var headerSeperator = /^-+$/;
+ var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /;
+ var simpleEmail = /^[\w+.-]+@[\w.-]+/;
+
+ return {
+ token: function(stream) {
+ if (stream.sol()) {
+ if (stream.match(headerSeperator)) { return 'tag'; }
+ if (stream.match(headerLine)) { return 'tag'; }
+ }
+ if (stream.match(simpleEmail)) { return 'string'; }
+ stream.next();
+ return null;
+ }
+ };
+});
+
+CodeMirror.defineMIME("text/x-rpm-changes", "rpm-changes");
+
+// Quick and dirty spec file highlighting
+
+CodeMirror.defineMode("rpm-spec", function() {
+ var arch = /^(i386|i586|i686|x86_64|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/;
+
+ var preamble = /^(Name|Version|Release|License|Summary|Url|Group|Source|BuildArch|BuildRequires|BuildRoot|AutoReqProv|Provides|Requires(\(\w+\))?|Obsoletes|Conflicts|Recommends|Source\d*|Patch\d*|ExclusiveArch|NoSource|Supplements):/;
+ var section = /^%(debug_package|package|description|prep|build|install|files|clean|changelog|preinstall|preun|postinstall|postun|pre|post|triggerin|triggerun|pretrans|posttrans|verifyscript|check|triggerpostun|triggerprein|trigger)/;
+ var control_flow_complex = /^%(ifnarch|ifarch|if)/; // rpm control flow macros
+ var control_flow_simple = /^%(else|endif)/; // rpm control flow macros
+ var operators = /^(\!|\?|\<\=|\<|\>\=|\>|\=\=|\&\&|\|\|)/; // operators in control flow macros
+
+ return {
+ startState: function () {
+ return {
+ controlFlow: false,
+ macroParameters: false,
+ section: false
+ };
+ },
+ token: function (stream, state) {
+ var ch = stream.peek();
+ if (ch == "#") { stream.skipToEnd(); return "comment"; }
+
+ if (stream.sol()) {
+ if (stream.match(preamble)) { return "preamble"; }
+ if (stream.match(section)) { return "section"; }
+ }
+
+ if (stream.match(/^\$\w+/)) { return "def"; } // Variables like '$RPM_BUILD_ROOT'
+ if (stream.match(/^\$\{\w+\}/)) { return "def"; } // Variables like '${RPM_BUILD_ROOT}'
+
+ if (stream.match(control_flow_simple)) { return "keyword"; }
+ if (stream.match(control_flow_complex)) {
+ state.controlFlow = true;
+ return "keyword";
+ }
+ if (state.controlFlow) {
+ if (stream.match(operators)) { return "operator"; }
+ if (stream.match(/^(\d+)/)) { return "number"; }
+ if (stream.eol()) { state.controlFlow = false; }
+ }
+
+ if (stream.match(arch)) { return "number"; }
+
+ // Macros like '%make_install' or '%attr(0775,root,root)'
+ if (stream.match(/^%[\w]+/)) {
+ if (stream.match(/^\(/)) { state.macroParameters = true; }
+ return "macro";
+ }
+ if (state.macroParameters) {
+ if (stream.match(/^\d+/)) { return "number";}
+ if (stream.match(/^\)/)) {
+ state.macroParameters = false;
+ return "macro";
+ }
+ }
+ if (stream.match(/^%\{\??[\w \-]+\}/)) { return "macro"; } // Macros like '%{defined fedora}'
+
+ //TODO: Include bash script sub-parser (CodeMirror supports that)
+ stream.next();
+ return null;
+ }
+ };
+});
+
+CodeMirror.defineMIME("text/x-rpm-spec", "rpm-spec");
+
+});
diff --git a/public/vendor/codemirror/mode/rst/index.html b/public/vendor/codemirror/mode/rst/index.html
new file mode 100755
index 00000000..2902dea2
--- /dev/null
+++ b/public/vendor/codemirror/mode/rst/index.html
@@ -0,0 +1,535 @@
+<!doctype html>
+
+<title>CodeMirror: reStructuredText mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/mode/overlay.js"></script>
+<script src="rst.js"></script>
+<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+ <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/codemirror/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">reStructuredText</a>
+ </ul>
+</div>
+
+<article>
+<h2>reStructuredText mode</h2>
+<form><textarea id="code" name="code">
+.. This is an excerpt from Sphinx documentation: http://sphinx.pocoo.org/_sources/rest.txt
+
+.. highlightlang:: rest
+
+.. _rst-primer:
+
+reStructuredText Primer
+=======================
+
+This section is a brief introduction to reStructuredText (reST) concepts and
+syntax, intended to provide authors with enough information to author documents
+productively. Since reST was designed to be a simple, unobtrusive markup
+language, this will not take too long.
+
+.. seealso::
+
+ The authoritative `reStructuredText User Documentation
+ &lt;http://docutils.sourceforge.net/rst.html&gt;`_. The "ref" links in this
+ document link to the description of the individual constructs in the reST
+ reference.
+
+
+Paragraphs
+----------
+
+The paragraph (:duref:`ref &lt;paragraphs&gt;`) is the most basic block in a reST
+document. Paragraphs are simply chunks of text separated by one or more blank
+lines. As in Python, indentation is significant in reST, so all lines of the
+same paragraph must be left-aligned to the same level of indentation.
+
+
+.. _inlinemarkup:
+
+Inline markup
+-------------
+
+The standard reST inline markup is quite simple: use
+
+* one asterisk: ``*text*`` for emphasis (italics),
+* two asterisks: ``**text**`` for strong emphasis (boldface), and
+* backquotes: ````text```` for code samples.
+
+If asterisks or backquotes appear in running text and could be confused with
+inline markup delimiters, they have to be escaped with a backslash.
+
+Be aware of some restrictions of this markup:
+
+* it may not be nested,
+* content may not start or end with whitespace: ``* text*`` is wrong,
+* it must be separated from surrounding text by non-word characters. Use a
+ backslash escaped space to work around that: ``thisis\ *one*\ word``.
+
+These restrictions may be lifted in future versions of the docutils.
+
+reST also allows for custom "interpreted text roles"', which signify that the
+enclosed text should be interpreted in a specific way. Sphinx uses this to
+provide semantic markup and cross-referencing of identifiers, as described in
+the appropriate section. The general syntax is ``:rolename:`content```.
+
+Standard reST provides the following roles:
+
+* :durole:`emphasis` -- alternate spelling for ``*emphasis*``
+* :durole:`strong` -- alternate spelling for ``**strong**``
+* :durole:`literal` -- alternate spelling for ````literal````
+* :durole:`subscript` -- subscript text
+* :durole:`superscript` -- superscript text
+* :durole:`title-reference` -- for titles of books, periodicals, and other
+ materials
+
+See :ref:`inline-markup` for roles added by Sphinx.
+
+
+Lists and Quote-like blocks
+---------------------------
+
+List markup (:duref:`ref &lt;bullet-lists&gt;`) is natural: just place an asterisk at
+the start of a paragraph and indent properly. The same goes for numbered lists;
+they can also be autonumbered using a ``#`` sign::
+
+ * This is a bulleted list.
+ * It has two items, the second
+ item uses two lines.
+
+ 1. This is a numbered list.
+ 2. It has two items too.
+
+ #. This is a numbered list.
+ #. It has two items too.
+
+
+Nested lists are possible, but be aware that they must be separated from the
+parent list items by blank lines::
+
+ * this is
+ * a list
+
+ * with a nested list
+ * and some subitems
+
+ * and here the parent list continues
+
+Definition lists (:duref:`ref &lt;definition-lists&gt;`) are created as follows::
+
+ term (up to a line of text)
+ Definition of the term, which must be indented
+
+ and can even consist of multiple paragraphs
+
+ next term
+ Description.
+
+Note that the term cannot have more than one line of text.
+
+Quoted paragraphs (:duref:`ref &lt;block-quotes&gt;`) are created by just indenting
+them more than the surrounding paragraphs.
+
+Line blocks (:duref:`ref &lt;line-blocks&gt;`) are a way of preserving line breaks::
+
+ | These lines are
+ | broken exactly like in
+ | the source file.
+
+There are also several more special blocks available:
+
+* field lists (:duref:`ref &lt;field-lists&gt;`)
+* option lists (:duref:`ref &lt;option-lists&gt;`)
+* quoted literal blocks (:duref:`ref &lt;quoted-literal-blocks&gt;`)
+* doctest blocks (:duref:`ref &lt;doctest-blocks&gt;`)
+
+
+Source Code
+-----------
+
+Literal code blocks (:duref:`ref &lt;literal-blocks&gt;`) are introduced by ending a
+paragraph with the special marker ``::``. The literal block must be indented
+(and, like all paragraphs, separated from the surrounding ones by blank lines)::
+
+ This is a normal text paragraph. The next paragraph is a code sample::
+
+ It is not processed in any way, except
+ that the indentation is removed.
+
+ It can span multiple lines.
+
+ This is a normal text paragraph again.
+
+The handling of the ``::`` marker is smart:
+
+* If it occurs as a paragraph of its own, that paragraph is completely left
+ out of the document.
+* If it is preceded by whitespace, the marker is removed.
+* If it is preceded by non-whitespace, the marker is replaced by a single
+ colon.
+
+That way, the second sentence in the above example's first paragraph would be
+rendered as "The next paragraph is a code sample:".
+
+
+.. _rst-tables:
+
+Tables
+------
+
+Two forms of tables are supported. For *grid tables* (:duref:`ref
+&lt;grid-tables&gt;`), you have to "paint" the cell grid yourself. They look like
+this::
+
+ +------------------------+------------+----------+----------+
+ | Header row, column 1 | Header 2 | Header 3 | Header 4 |
+ | (header rows optional) | | | |
+ +========================+============+==========+==========+
+ | body row 1, column 1 | column 2 | column 3 | column 4 |
+ +------------------------+------------+----------+----------+
+ | body row 2 | ... | ... | |
+ +------------------------+------------+----------+----------+
+
+*Simple tables* (:duref:`ref &lt;simple-tables&gt;`) are easier to write, but
+limited: they must contain more than one row, and the first column cannot
+contain multiple lines. They look like this::
+
+ ===== ===== =======
+ A B A and B
+ ===== ===== =======
+ False False False
+ True False False
+ False True False
+ True True True
+ ===== ===== =======
+
+
+Hyperlinks
+----------
+
+External links
+^^^^^^^^^^^^^^
+
+Use ```Link text &lt;http://example.com/&gt;`_`` for inline web links. If the link
+text should be the web address, you don't need special markup at all, the parser
+finds links and mail addresses in ordinary text.
+
+You can also separate the link and the target definition (:duref:`ref
+&lt;hyperlink-targets&gt;`), like this::
+
+ This is a paragraph that contains `a link`_.
+
+ .. _a link: http://example.com/
+
+
+Internal links
+^^^^^^^^^^^^^^
+
+Internal linking is done via a special reST role provided by Sphinx, see the
+section on specific markup, :ref:`ref-role`.
+
+
+Sections
+--------
+
+Section headers (:duref:`ref &lt;sections&gt;`) are created by underlining (and
+optionally overlining) the section title with a punctuation character, at least
+as long as the text::
+
+ =================
+ This is a heading
+ =================
+
+Normally, there are no heading levels assigned to certain characters as the
+structure is determined from the succession of headings. However, for the
+Python documentation, this convention is used which you may follow:
+
+* ``#`` with overline, for parts
+* ``*`` with overline, for chapters
+* ``=``, for sections
+* ``-``, for subsections
+* ``^``, for subsubsections
+* ``"``, for paragraphs
+
+Of course, you are free to use your own marker characters (see the reST
+documentation), and use a deeper nesting level, but keep in mind that most
+target formats (HTML, LaTeX) have a limited supported nesting depth.
+
+
+Explicit Markup
+---------------
+
+"Explicit markup" (:duref:`ref &lt;explicit-markup-blocks&gt;`) is used in reST for
+most constructs that need special handling, such as footnotes,
+specially-highlighted paragraphs, comments, and generic directives.
+
+An explicit markup block begins with a line starting with ``..`` followed by
+whitespace and is terminated by the next paragraph at the same level of
+indentation. (There needs to be a blank line between explicit markup and normal
+paragraphs. This may all sound a bit complicated, but it is intuitive enough
+when you write it.)
+
+
+.. _directives:
+
+Directives
+----------
+
+A directive (:duref:`ref &lt;directives&gt;`) is a generic block of explicit markup.
+Besides roles, it is one of the extension mechanisms of reST, and Sphinx makes
+heavy use of it.
+
+Docutils supports the following directives:
+
+* Admonitions: :dudir:`attention`, :dudir:`caution`, :dudir:`danger`,
+ :dudir:`error`, :dudir:`hint`, :dudir:`important`, :dudir:`note`,
+ :dudir:`tip`, :dudir:`warning` and the generic :dudir:`admonition`.
+ (Most themes style only "note" and "warning" specially.)
+
+* Images:
+
+ - :dudir:`image` (see also Images_ below)
+ - :dudir:`figure` (an image with caption and optional legend)
+
+* Additional body elements:
+
+ - :dudir:`contents` (a local, i.e. for the current file only, table of
+ contents)
+ - :dudir:`container` (a container with a custom class, useful to generate an
+ outer ``&lt;div&gt;`` in HTML)
+ - :dudir:`rubric` (a heading without relation to the document sectioning)
+ - :dudir:`topic`, :dudir:`sidebar` (special highlighted body elements)
+ - :dudir:`parsed-literal` (literal block that supports inline markup)
+ - :dudir:`epigraph` (a block quote with optional attribution line)
+ - :dudir:`highlights`, :dudir:`pull-quote` (block quotes with their own
+ class attribute)
+ - :dudir:`compound` (a compound paragraph)
+
+* Special tables:
+
+ - :dudir:`table` (a table with title)
+ - :dudir:`csv-table` (a table generated from comma-separated values)
+ - :dudir:`list-table` (a table generated from a list of lists)
+
+* Special directives:
+
+ - :dudir:`raw` (include raw target-format markup)
+ - :dudir:`include` (include reStructuredText from another file)
+ -- in Sphinx, when given an absolute include file path, this directive takes
+ it as relative to the source directory
+ - :dudir:`class` (assign a class attribute to the next element) [1]_
+
+* HTML specifics:
+
+ - :dudir:`meta` (generation of HTML ``&lt;meta&gt;`` tags)
+ - :dudir:`title` (override document title)
+
+* Influencing markup:
+
+ - :dudir:`default-role` (set a new default role)
+ - :dudir:`role` (create a new role)
+
+ Since these are only per-file, better use Sphinx' facilities for setting the
+ :confval:`default_role`.
+
+Do *not* use the directives :dudir:`sectnum`, :dudir:`header` and
+:dudir:`footer`.
+
+Directives added by Sphinx are described in :ref:`sphinxmarkup`.
+
+Basically, a directive consists of a name, arguments, options and content. (Keep
+this terminology in mind, it is used in the next chapter describing custom
+directives.) Looking at this example, ::
+
+ .. function:: foo(x)
+ foo(y, z)
+ :module: some.module.name
+
+ Return a line of text input from the user.
+
+``function`` is the directive name. It is given two arguments here, the
+remainder of the first line and the second line, as well as one option
+``module`` (as you can see, options are given in the lines immediately following
+the arguments and indicated by the colons). Options must be indented to the
+same level as the directive content.
+
+The directive content follows after a blank line and is indented relative to the
+directive start.
+
+
+Images
+------
+
+reST supports an image directive (:dudir:`ref &lt;image&gt;`), used like so::
+
+ .. image:: gnu.png
+ (options)
+
+When used within Sphinx, the file name given (here ``gnu.png``) must either be
+relative to the source file, or absolute which means that they are relative to
+the top source directory. For example, the file ``sketch/spam.rst`` could refer
+to the image ``images/spam.png`` as ``../images/spam.png`` or
+``/images/spam.png``.
+
+Sphinx will automatically copy image files over to a subdirectory of the output
+directory on building (e.g. the ``_static`` directory for HTML output.)
+
+Interpretation of image size options (``width`` and ``height``) is as follows:
+if the size has no unit or the unit is pixels, the given size will only be
+respected for output channels that support pixels (i.e. not in LaTeX output).
+Other units (like ``pt`` for points) will be used for HTML and LaTeX output.
+
+Sphinx extends the standard docutils behavior by allowing an asterisk for the
+extension::
+
+ .. image:: gnu.*
+
+Sphinx then searches for all images matching the provided pattern and determines
+their type. Each builder then chooses the best image out of these candidates.
+For instance, if the file name ``gnu.*`` was given and two files :file:`gnu.pdf`
+and :file:`gnu.png` existed in the source tree, the LaTeX builder would choose
+the former, while the HTML builder would prefer the latter.
+
+.. versionchanged:: 0.4
+ Added the support for file names ending in an asterisk.
+
+.. versionchanged:: 0.6
+ Image paths can now be absolute.
+
+
+Footnotes
+---------
+
+For footnotes (:duref:`ref &lt;footnotes&gt;`), use ``[#name]_`` to mark the footnote
+location, and add the footnote body at the bottom of the document after a
+"Footnotes" rubric heading, like so::
+
+ Lorem ipsum [#f1]_ dolor sit amet ... [#f2]_
+
+ .. rubric:: Footnotes
+
+ .. [#f1] Text of the first footnote.
+ .. [#f2] Text of the second footnote.
+
+You can also explicitly number the footnotes (``[1]_``) or use auto-numbered
+footnotes without names (``[#]_``).
+
+
+Citations
+---------
+
+Standard reST citations (:duref:`ref &lt;citations&gt;`) are supported, with the
+additional feature that they are "global", i.e. all citations can be referenced
+from all files. Use them like so::
+
+ Lorem ipsum [Ref]_ dolor sit amet.
+
+ .. [Ref] Book or article reference, URL or whatever.
+
+Citation usage is similar to footnote usage, but with a label that is not
+numeric or begins with ``#``.
+
+
+Substitutions
+-------------
+
+reST supports "substitutions" (:duref:`ref &lt;substitution-definitions&gt;`), which
+are pieces of text and/or markup referred to in the text by ``|name|``. They
+are defined like footnotes with explicit markup blocks, like this::
+
+ .. |name| replace:: replacement *text*
+
+or this::
+
+ .. |caution| image:: warning.png
+ :alt: Warning!
+
+See the :duref:`reST reference for substitutions &lt;substitution-definitions&gt;`
+for details.
+
+If you want to use some substitutions for all documents, put them into
+:confval:`rst_prolog` or put them into a separate file and include it into all
+documents you want to use them in, using the :rst:dir:`include` directive. (Be
+sure to give the include file a file name extension differing from that of other
+source files, to avoid Sphinx finding it as a standalone document.)
+
+Sphinx defines some default substitutions, see :ref:`default-substitutions`.
+
+
+Comments
+--------
+
+Every explicit markup block which isn't a valid markup construct (like the
+footnotes above) is regarded as a comment (:duref:`ref &lt;comments&gt;`). For
+example::
+
+ .. This is a comment.
+
+You can indent text after a comment start to form multiline comments::
+
+ ..
+ This whole indented block
+ is a comment.
+
+ Still in the comment.
+
+
+Source encoding
+---------------
+
+Since the easiest way to include special characters like em dashes or copyright
+signs in reST is to directly write them as Unicode characters, one has to
+specify an encoding. Sphinx assumes source files to be encoded in UTF-8 by
+default; you can change this with the :confval:`source_encoding` config value.
+
+
+Gotchas
+-------
+
+There are some problems one commonly runs into while authoring reST documents:
+
+* **Separation of inline markup:** As said above, inline markup spans must be
+ separated from the surrounding text by non-word characters, you have to use a
+ backslash-escaped space to get around that. See `the reference
+ &lt;http://docutils.sf.net/docs/ref/rst/restructuredtext.html#inline-markup&gt;`_
+ for the details.
+
+* **No nested inline markup:** Something like ``*see :func:`foo`*`` is not
+ possible.
+
+
+.. rubric:: Footnotes
+
+.. [1] When the default domain contains a :rst:dir:`class` directive, this directive
+ will be shadowed. Therefore, Sphinx re-exports it as :rst:dir:`rst-class`.
+</textarea></form>
+
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ lineNumbers: true,
+ });
+ </script>
+ <p>
+ The <code>python</code> mode will be used for highlighting blocks
+ containing Python/IPython terminal sessions: blocks starting with
+ <code>&gt;&gt;&gt;</code> (for Python) or <code>In [num]:</code> (for
+ IPython).
+
+ Further, the <code>stex</code> mode will be used for highlighting
+ blocks containing LaTex code.
+ </p>
+
+ <p><strong>MIME types defined:</strong> <code>text/x-rst</code>.</p>
+ </article>
diff --git a/public/vendor/codemirror/mode/rst/rst.js b/public/vendor/codemirror/mode/rst/rst.js
new file mode 100755
index 00000000..bcf110c1
--- /dev/null
+++ b/public/vendor/codemirror/mode/rst/rst.js
@@ -0,0 +1,557 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"), require("../python/python"), require("../stex/stex"), require("../../addon/mode/overlay"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror", "../python/python", "../stex/stex", "../../addon/mode/overlay"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+CodeMirror.defineMode('rst', function (config, options) {
+
+ var rx_strong = /^\*\*[^\*\s](?:[^\*]*[^\*\s])?\*\*/;
+ var rx_emphasis = /^\*[^\*\s](?:[^\*]*[^\*\s])?\*/;
+ var rx_literal = /^``[^`\s](?:[^`]*[^`\s])``/;
+
+ var rx_number = /^(?:[\d]+(?:[\.,]\d+)*)/;
+ var rx_positive = /^(?:\s\+[\d]+(?:[\.,]\d+)*)/;
+ var rx_negative = /^(?:\s\-[\d]+(?:[\.,]\d+)*)/;
+
+ var rx_uri_protocol = "[Hh][Tt][Tt][Pp][Ss]?://";
+ var rx_uri_domain = "(?:[\\d\\w.-]+)\\.(?:\\w{2,6})";
+ var rx_uri_path = "(?:/[\\d\\w\\#\\%\\&\\-\\.\\,\\/\\:\\=\\?\\~]+)*";
+ var rx_uri = new RegExp("^" + rx_uri_protocol + rx_uri_domain + rx_uri_path);
+
+ var overlay = {
+ token: function (stream) {
+
+ if (stream.match(rx_strong) && stream.match (/\W+|$/, false))
+ return 'strong';
+ if (stream.match(rx_emphasis) && stream.match (/\W+|$/, false))
+ return 'em';
+ if (stream.match(rx_literal) && stream.match (/\W+|$/, false))
+ return 'string-2';
+ if (stream.match(rx_number))
+ return 'number';
+ if (stream.match(rx_positive))
+ return 'positive';
+ if (stream.match(rx_negative))
+ return 'negative';
+ if (stream.match(rx_uri))
+ return 'link';
+
+ while (stream.next() != null) {
+ if (stream.match(rx_strong, false)) break;
+ if (stream.match(rx_emphasis, false)) break;
+ if (stream.match(rx_literal, false)) break;
+ if (stream.match(rx_number, false)) break;
+ if (stream.match(rx_positive, false)) break;
+ if (stream.match(rx_negative, false)) break;
+ if (stream.match(rx_uri, false)) break;
+ }
+
+ return null;
+ }
+ };
+
+ var mode = CodeMirror.getMode(
+ config, options.backdrop || 'rst-base'
+ );
+
+ return CodeMirror.overlayMode(mode, overlay, true); // combine
+}, 'python', 'stex');
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
+CodeMirror.defineMode('rst-base', function (config) {
+
+ ///////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////
+
+ function format(string) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ return string.replace(/{(\d+)}/g, function (match, n) {
+ return typeof args[n] != 'undefined' ? args[n] : match;
+ });
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////
+
+ var mode_python = CodeMirror.getMode(config, 'python');
+ var mode_stex = CodeMirror.getMode(config, 'stex');
+
+ ///////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////
+
+ var SEPA = "\\s+";
+ var TAIL = "(?:\\s*|\\W|$)",
+ rx_TAIL = new RegExp(format('^{0}', TAIL));
+
+ var NAME =
+ "(?:[^\\W\\d_](?:[\\w!\"#$%&'()\\*\\+,\\-\\.\/:;<=>\\?]*[^\\W_])?)",
+ rx_NAME = new RegExp(format('^{0}', NAME));
+ var NAME_WWS =
+ "(?:[^\\W\\d_](?:[\\w\\s!\"#$%&'()\\*\\+,\\-\\.\/:;<=>\\?]*[^\\W_])?)";
+ var REF_NAME = format('(?:{0}|`{1}`)', NAME, NAME_WWS);
+
+ var TEXT1 = "(?:[^\\s\\|](?:[^\\|]*[^\\s\\|])?)";
+ var TEXT2 = "(?:[^\\`]+)",
+ rx_TEXT2 = new RegExp(format('^{0}', TEXT2));
+
+ var rx_section = new RegExp(
+ "^([!'#$%&\"()*+,-./:;<=>?@\\[\\\\\\]^_`{|}~])\\1{3,}\\s*$");
+ var rx_explicit = new RegExp(
+ format('^\\.\\.{0}', SEPA));
+ var rx_link = new RegExp(
+ format('^_{0}:{1}|^__:{1}', REF_NAME, TAIL));
+ var rx_directive = new RegExp(
+ format('^{0}::{1}', REF_NAME, TAIL));
+ var rx_substitution = new RegExp(
+ format('^\\|{0}\\|{1}{2}::{3}', TEXT1, SEPA, REF_NAME, TAIL));
+ var rx_footnote = new RegExp(
+ format('^\\[(?:\\d+|#{0}?|\\*)]{1}', REF_NAME, TAIL));
+ var rx_citation = new RegExp(
+ format('^\\[{0}\\]{1}', REF_NAME, TAIL));
+
+ var rx_substitution_ref = new RegExp(
+ format('^\\|{0}\\|', TEXT1));
+ var rx_footnote_ref = new RegExp(
+ format('^\\[(?:\\d+|#{0}?|\\*)]_', REF_NAME));
+ var rx_citation_ref = new RegExp(
+ format('^\\[{0}\\]_', REF_NAME));
+ var rx_link_ref1 = new RegExp(
+ format('^{0}__?', REF_NAME));
+ var rx_link_ref2 = new RegExp(
+ format('^`{0}`_', TEXT2));
+
+ var rx_role_pre = new RegExp(
+ format('^:{0}:`{1}`{2}', NAME, TEXT2, TAIL));
+ var rx_role_suf = new RegExp(
+ format('^`{1}`:{0}:{2}', NAME, TEXT2, TAIL));
+ var rx_role = new RegExp(
+ format('^:{0}:{1}', NAME, TAIL));
+
+ var rx_directive_name = new RegExp(format('^{0}', REF_NAME));
+ var rx_directive_tail = new RegExp(format('^::{0}', TAIL));
+ var rx_substitution_text = new RegExp(format('^\\|{0}\\|', TEXT1));
+ var rx_substitution_sepa = new RegExp(format('^{0}', SEPA));
+ var rx_substitution_name = new RegExp(format('^{0}', REF_NAME));
+ var rx_substitution_tail = new RegExp(format('^::{0}', TAIL));
+ var rx_link_head = new RegExp("^_");
+ var rx_link_name = new RegExp(format('^{0}|_', REF_NAME));
+ var rx_link_tail = new RegExp(format('^:{0}', TAIL));
+
+ var rx_verbatim = new RegExp('^::\\s*$');
+ var rx_examples = new RegExp('^\\s+(?:>>>|In \\[\\d+\\]:)\\s');
+
+ ///////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////
+
+ function to_normal(stream, state) {
+ var token = null;
+
+ if (stream.sol() && stream.match(rx_examples, false)) {
+ change(state, to_mode, {
+ mode: mode_python, local: CodeMirror.startState(mode_python)
+ });
+ } else if (stream.sol() && stream.match(rx_explicit)) {
+ change(state, to_explicit);
+ token = 'meta';
+ } else if (stream.sol() && stream.match(rx_section)) {
+ change(state, to_normal);
+ token = 'header';
+ } else if (phase(state) == rx_role_pre ||
+ stream.match(rx_role_pre, false)) {
+
+ switch (stage(state)) {
+ case 0:
+ change(state, to_normal, context(rx_role_pre, 1));
+ stream.match(/^:/);
+ token = 'meta';
+ break;
+ case 1:
+ change(state, to_normal, context(rx_role_pre, 2));
+ stream.match(rx_NAME);
+ token = 'keyword';
+
+ if (stream.current().match(/^(?:math|latex)/)) {
+ state.tmp_stex = true;
+ }
+ break;
+ case 2:
+ change(state, to_normal, context(rx_role_pre, 3));
+ stream.match(/^:`/);
+ token = 'meta';
+ break;
+ case 3:
+ if (state.tmp_stex) {
+ state.tmp_stex = undefined; state.tmp = {
+ mode: mode_stex, local: CodeMirror.startState(mode_stex)
+ };
+ }
+
+ if (state.tmp) {
+ if (stream.peek() == '`') {
+ change(state, to_normal, context(rx_role_pre, 4));
+ state.tmp = undefined;
+ break;
+ }
+
+ token = state.tmp.mode.token(stream, state.tmp.local);
+ break;
+ }
+
+ change(state, to_normal, context(rx_role_pre, 4));
+ stream.match(rx_TEXT2);
+ token = 'string';
+ break;
+ case 4:
+ change(state, to_normal, context(rx_role_pre, 5));
+ stream.match(/^`/);
+ token = 'meta';
+ break;
+ case 5:
+ change(state, to_normal, context(rx_role_pre, 6));
+ stream.match(rx_TAIL);
+ break;
+ default:
+ change(state, to_normal);
+ }
+ } else if (phase(state) == rx_role_suf ||
+ stream.match(rx_role_suf, false)) {
+
+ switch (stage(state)) {
+ case 0:
+ change(state, to_normal, context(rx_role_suf, 1));
+ stream.match(/^`/);
+ token = 'meta';
+ break;
+ case 1:
+ change(state, to_normal, context(rx_role_suf, 2));
+ stream.match(rx_TEXT2);
+ token = 'string';
+ break;
+ case 2:
+ change(state, to_normal, context(rx_role_suf, 3));
+ stream.match(/^`:/);
+ token = 'meta';
+ break;
+ case 3:
+ change(state, to_normal, context(rx_role_suf, 4));
+ stream.match(rx_NAME);
+ token = 'keyword';
+ break;
+ case 4:
+ change(state, to_normal, context(rx_role_suf, 5));
+ stream.match(/^:/);
+ token = 'meta';
+ break;
+ case 5:
+ change(state, to_normal, context(rx_role_suf, 6));
+ stream.match(rx_TAIL);
+ break;
+ default:
+ change(state, to_normal);
+ }
+ } else if (phase(state) == rx_role || stream.match(rx_role, false)) {
+
+ switch (stage(state)) {
+ case 0:
+ change(state, to_normal, context(rx_role, 1));
+ stream.match(/^:/);
+ token = 'meta';
+ break;
+ case 1:
+ change(state, to_normal, context(rx_role, 2));
+ stream.match(rx_NAME);
+ token = 'keyword';
+ break;
+ case 2:
+ change(state, to_normal, context(rx_role, 3));
+ stream.match(/^:/);
+ token = 'meta';
+ break;
+ case 3:
+ change(state, to_normal, context(rx_role, 4));
+ stream.match(rx_TAIL);
+ break;
+ default:
+ change(state, to_normal);
+ }
+ } else if (phase(state) == rx_substitution_ref ||
+ stream.match(rx_substitution_ref, false)) {
+
+ switch (stage(state)) {
+ case 0:
+ change(state, to_normal, context(rx_substitution_ref, 1));
+ stream.match(rx_substitution_text);
+ token = 'variable-2';
+ break;
+ case 1:
+ change(state, to_normal, context(rx_substitution_ref, 2));
+ if (stream.match(/^_?_?/)) token = 'link';
+ break;
+ default:
+ change(state, to_normal);
+ }
+ } else if (stream.match(rx_footnote_ref)) {
+ change(state, to_normal);
+ token = 'quote';
+ } else if (stream.match(rx_citation_ref)) {
+ change(state, to_normal);
+ token = 'quote';
+ } else if (stream.match(rx_link_ref1)) {
+ change(state, to_normal);
+ if (!stream.peek() || stream.peek().match(/^\W$/)) {
+ token = 'link';
+ }
+ } else if (phase(state) == rx_link_ref2 ||
+ stream.match(rx_link_ref2, false)) {
+
+ switch (stage(state)) {
+ case 0:
+ if (!stream.peek() || stream.peek().match(/^\W$/)) {
+ change(state, to_normal, context(rx_link_ref2, 1));
+ } else {
+ stream.match(rx_link_ref2);
+ }
+ break;
+ case 1:
+ change(state, to_normal, context(rx_link_ref2, 2));
+ stream.match(/^`/);
+ token = 'link';
+ break;
+ case 2:
+ change(state, to_normal, context(rx_link_ref2, 3));
+ stream.match(rx_TEXT2);
+ break;
+ case 3:
+ change(state, to_normal, context(rx_link_ref2, 4));
+ stream.match(/^`_/);
+ token = 'link';
+ break;
+ default:
+ change(state, to_normal);
+ }
+ } else if (stream.match(rx_verbatim)) {
+ change(state, to_verbatim);
+ }
+
+ else {
+ if (stream.next()) change(state, to_normal);
+ }
+
+ return token;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////
+
+ function to_explicit(stream, state) {
+ var token = null;
+
+ if (phase(state) == rx_substitution ||
+ stream.match(rx_substitution, false)) {
+
+ switch (stage(state)) {
+ case 0:
+ change(state, to_explicit, context(rx_substitution, 1));
+ stream.match(rx_substitution_text);
+ token = 'variable-2';
+ break;
+ case 1:
+ change(state, to_explicit, context(rx_substitution, 2));
+ stream.match(rx_substitution_sepa);
+ break;
+ case 2:
+ change(state, to_explicit, context(rx_substitution, 3));
+ stream.match(rx_substitution_name);
+ token = 'keyword';
+ break;
+ case 3:
+ change(state, to_explicit, context(rx_substitution, 4));
+ stream.match(rx_substitution_tail);
+ token = 'meta';
+ break;
+ default:
+ change(state, to_normal);
+ }
+ } else if (phase(state) == rx_directive ||
+ stream.match(rx_directive, false)) {
+
+ switch (stage(state)) {
+ case 0:
+ change(state, to_explicit, context(rx_directive, 1));
+ stream.match(rx_directive_name);
+ token = 'keyword';
+
+ if (stream.current().match(/^(?:math|latex)/))
+ state.tmp_stex = true;
+ else if (stream.current().match(/^python/))
+ state.tmp_py = true;
+ break;
+ case 1:
+ change(state, to_explicit, context(rx_directive, 2));
+ stream.match(rx_directive_tail);
+ token = 'meta';
+
+ if (stream.match(/^latex\s*$/) || state.tmp_stex) {
+ state.tmp_stex = undefined; change(state, to_mode, {
+ mode: mode_stex, local: CodeMirror.startState(mode_stex)
+ });
+ }
+ break;
+ case 2:
+ change(state, to_explicit, context(rx_directive, 3));
+ if (stream.match(/^python\s*$/) || state.tmp_py) {
+ state.tmp_py = undefined; change(state, to_mode, {
+ mode: mode_python, local: CodeMirror.startState(mode_python)
+ });
+ }
+ break;
+ default:
+ change(state, to_normal);
+ }
+ } else if (phase(state) == rx_link || stream.match(rx_link, false)) {
+
+ switch (stage(state)) {
+ case 0:
+ change(state, to_explicit, context(rx_link, 1));
+ stream.match(rx_link_head);
+ stream.match(rx_link_name);
+ token = 'link';
+ break;
+ case 1:
+ change(state, to_explicit, context(rx_link, 2));
+ stream.match(rx_link_tail);
+ token = 'meta';
+ break;
+ default:
+ change(state, to_normal);
+ }
+ } else if (stream.match(rx_footnote)) {
+ change(state, to_normal);
+ token = 'quote';
+ } else if (stream.match(rx_citation)) {
+ change(state, to_normal);
+ token = 'quote';
+ }
+
+ else {
+ stream.eatSpace();
+ if (stream.eol()) {
+ change(state, to_normal);
+ } else {
+ stream.skipToEnd();
+ change(state, to_comment);
+ token = 'comment';
+ }
+ }
+
+ return token;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////
+
+ function to_comment(stream, state) {
+ return as_block(stream, state, 'comment');
+ }
+
+ function to_verbatim(stream, state) {
+ return as_block(stream, state, 'meta');
+ }
+
+ function as_block(stream, state, token) {
+ if (stream.eol() || stream.eatSpace()) {
+ stream.skipToEnd();
+ return token;
+ } else {
+ change(state, to_normal);
+ return null;
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////
+
+ function to_mode(stream, state) {
+
+ if (state.ctx.mode && state.ctx.local) {
+
+ if (stream.sol()) {
+ if (!stream.eatSpace()) change(state, to_normal);
+ return null;
+ }
+
+ return state.ctx.mode.token(stream, state.ctx.local);
+ }
+
+ change(state, to_normal);
+ return null;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////
+
+ function context(phase, stage, mode, local) {
+ return {phase: phase, stage: stage, mode: mode, local: local};
+ }
+
+ function change(state, tok, ctx) {
+ state.tok = tok;
+ state.ctx = ctx || {};
+ }
+
+ function stage(state) {
+ return state.ctx.stage || 0;
+ }
+
+ function phase(state) {
+ return state.ctx.phase;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////
+
+ return {
+ startState: function () {
+ return {tok: to_normal, ctx: context(undefined, 0)};
+ },
+
+ copyState: function (state) {
+ var ctx = state.ctx, tmp = state.tmp;
+ if (ctx.local)
+ ctx = {mode: ctx.mode, local: CodeMirror.copyState(ctx.mode, ctx.local)};
+ if (tmp)
+ tmp = {mode: tmp.mode, local: CodeMirror.copyState(tmp.mode, tmp.local)};
+ return {tok: state.tok, ctx: ctx, tmp: tmp};
+ },
+
+ innerMode: function (state) {
+ return state.tmp ? {state: state.tmp.local, mode: state.tmp.mode}
+ : state.ctx.mode ? {state: state.ctx.local, mode: state.ctx.mode}
+ : null;
+ },
+
+ token: function (stream, state) {
+ return state.tok(stream, state);
+ }
+ };
+}, 'python', 'stex');
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
+CodeMirror.defineMIME('text/x-rst', 'rst');
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
+});
diff --git a/public/vendor/codemirror/mode/ruby/index.html b/public/vendor/codemirror/mode/ruby/index.html
new file mode 100755
index 00000000..97544bab
--- /dev/null
+++ b/public/vendor/codemirror/mode/ruby/index.html
@@ -0,0 +1,183 @@
+<!doctype html>
+
+<title>CodeMirror: Ruby mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="ruby.js"></script>
+<style>
+ .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+ .cm-s-default span.cm-arrow { color: red; }
+ </style>
+<div id=nav>
+ <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/codemirror/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">Ruby</a>
+ </ul>
+</div>
+
+<article>
+<h2>Ruby mode</h2>
+<form><textarea id="code" name="code">
+# Code from http://sandbox.mc.edu/~bennet/ruby/code/poly_rb.html
+#
+# This program evaluates polynomials. It first asks for the coefficients
+# of a polynomial, which must be entered on one line, highest-order first.
+# It then requests values of x and will compute the value of the poly for
+# each x. It will repeatly ask for x values, unless you the user enters
+# a blank line. It that case, it will ask for another polynomial. If the
+# user types quit for either input, the program immediately exits.
+#
+
+#
+# Function to evaluate a polynomial at x. The polynomial is given
+# as a list of coefficients, from the greatest to the least.
+def polyval(x, coef)
+ sum = 0
+ coef = coef.clone # Don't want to destroy the original
+ while true
+ sum += coef.shift # Add and remove the next coef
+ break if coef.empty? # If no more, done entirely.
+ sum *= x # This happens the right number of times.
+ end
+ return sum
+end
+
+#
+# Function to read a line containing a list of integers and return
+# them as an array of integers. If the string conversion fails, it
+# throws TypeError. If the input line is the word 'quit', then it
+# converts it to an end-of-file exception
+def readints(prompt)
+ # Read a line
+ print prompt
+ line = readline.chomp
+ raise EOFError.new if line == 'quit' # You can also use a real EOF.
+
+ # Go through each item on the line, converting each one and adding it
+ # to retval.
+ retval = [ ]
+ for str in line.split(/\s+/)
+ if str =~ /^\-?\d+$/
+ retval.push(str.to_i)
+ else
+ raise TypeError.new
+ end
+ end
+
+ return retval
+end
+
+#
+# Take a coeff and an exponent and return the string representation, ignoring
+# the sign of the coefficient.
+def term_to_str(coef, exp)
+ ret = ""
+
+ # Show coeff, unless it's 1 or at the right
+ coef = coef.abs
+ ret = coef.to_s unless coef == 1 && exp > 0
+ ret += "x" if exp > 0 # x if exponent not 0
+ ret += "^" + exp.to_s if exp > 1 # ^exponent, if > 1.
+
+ return ret
+end
+
+#
+# Create a string of the polynomial in sort-of-readable form.
+def polystr(p)
+ # Get the exponent of first coefficient, plus 1.
+ exp = p.length
+
+ # Assign exponents to each term, making pairs of coeff and exponent,
+ # Then get rid of the zero terms.
+ p = (p.map { |c| exp -= 1; [ c, exp ] }).select { |p| p[0] != 0 }
+
+ # If there's nothing left, it's a zero
+ return "0" if p.empty?
+
+ # *** Now p is a non-empty list of [ coef, exponent ] pairs. ***
+
+ # Convert the first term, preceded by a "-" if it's negative.
+ result = (if p[0][0] < 0 then "-" else "" end) + term_to_str(*p[0])
+
+ # Convert the rest of the terms, in each case adding the appropriate
+ # + or - separating them.
+ for term in p[1...p.length]
+ # Add the separator then the rep. of the term.
+ result += (if term[0] < 0 then " - " else " + " end) +
+ term_to_str(*term)
+ end
+
+ return result
+end
+
+#
+# Run until some kind of endfile.
+begin
+ # Repeat until an exception or quit gets us out.
+ while true
+ # Read a poly until it works. An EOF will except out of the
+ # program.
+ print "\n"
+ begin
+ poly = readints("Enter a polynomial coefficients: ")
+ rescue TypeError
+ print "Try again.\n"
+ retry
+ end
+ break if poly.empty?
+
+ # Read and evaluate x values until the user types a blank line.
+ # Again, an EOF will except out of the pgm.
+ while true
+ # Request an integer.
+ print "Enter x value or blank line: "
+ x = readline.chomp
+ break if x == ''
+ raise EOFError.new if x == 'quit'
+
+ # If it looks bad, let's try again.
+ if x !~ /^\-?\d+$/
+ print "That doesn't look like an integer. Please try again.\n"
+ next
+ end
+
+ # Convert to an integer and print the result.
+ x = x.to_i
+ print "p(x) = ", polystr(poly), "\n"
+ print "p(", x, ") = ", polyval(x, poly), "\n"
+ end
+ end
+rescue EOFError
+ print "\n=== EOF ===\n"
+rescue Interrupt, SignalException
+ print "\n=== Interrupted ===\n"
+else
+ print "--- Bye ---\n"
+end
+</textarea></form>
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ mode: "text/x-ruby",
+ matchBrackets: true,
+ indentUnit: 4
+ });
+ </script>
+
+ <p><strong>MIME types defined:</strong> <code>text/x-ruby</code>.</p>
+
+ <p>Development of the CodeMirror Ruby mode was kindly sponsored
+ by <a href="http://ubalo.com/">Ubalo</a>.</p>
+
+ </article>
diff --git a/public/vendor/codemirror/mode/ruby/ruby.js b/public/vendor/codemirror/mode/ruby/ruby.js
new file mode 100755
index 00000000..eab9d9da
--- /dev/null
+++ b/public/vendor/codemirror/mode/ruby/ruby.js
@@ -0,0 +1,285 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+CodeMirror.defineMode("ruby", function(config) {
+ function wordObj(words) {
+ var o = {};
+ for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true;
+ return o;
+ }
+ var keywords = wordObj([
+ "alias", "and", "BEGIN", "begin", "break", "case", "class", "def", "defined?", "do", "else",
+ "elsif", "END", "end", "ensure", "false", "for", "if", "in", "module", "next", "not", "or",
+ "redo", "rescue", "retry", "return", "self", "super", "then", "true", "undef", "unless",
+ "until", "when", "while", "yield", "nil", "raise", "throw", "catch", "fail", "loop", "callcc",
+ "caller", "lambda", "proc", "public", "protected", "private", "require", "load",
+ "require_relative", "extend", "autoload", "__END__", "__FILE__", "__LINE__", "__dir__"
+ ]);
+ var indentWords = wordObj(["def", "class", "case", "for", "while", "module", "then",
+ "catch", "loop", "proc", "begin"]);
+ var dedentWords = wordObj(["end", "until"]);
+ var matching = {"[": "]", "{": "}", "(": ")"};
+ var curPunc;
+
+ function chain(newtok, stream, state) {
+ state.tokenize.push(newtok);
+ return newtok(stream, state);
+ }
+
+ function tokenBase(stream, state) {
+ curPunc = null;
+ if (stream.sol() && stream.match("=begin") && stream.eol()) {
+ state.tokenize.push(readBlockComment);
+ return "comment";
+ }
+ if (stream.eatSpace()) return null;
+ var ch = stream.next(), m;
+ if (ch == "`" || ch == "'" || ch == '"') {
+ return chain(readQuoted(ch, "string", ch == '"' || ch == "`"), stream, state);
+ } else if (ch == "/") {
+ var currentIndex = stream.current().length;
+ if (stream.skipTo("/")) {
+ var search_till = stream.current().length;
+ stream.backUp(stream.current().length - currentIndex);
+ var balance = 0; // balance brackets
+ while (stream.current().length < search_till) {
+ var chchr = stream.next();
+ if (chchr == "(") balance += 1;
+ else if (chchr == ")") balance -= 1;
+ if (balance < 0) break;
+ }
+ stream.backUp(stream.current().length - currentIndex);
+ if (balance == 0)
+ return chain(readQuoted(ch, "string-2", true), stream, state);
+ }
+ return "operator";
+ } else if (ch == "%") {
+ var style = "string", embed = true;
+ if (stream.eat("s")) style = "atom";
+ else if (stream.eat(/[WQ]/)) style = "string";
+ else if (stream.eat(/[r]/)) style = "string-2";
+ else if (stream.eat(/[wxq]/)) { style = "string"; embed = false; }
+ var delim = stream.eat(/[^\w\s=]/);
+ if (!delim) return "operator";
+ if (matching.propertyIsEnumerable(delim)) delim = matching[delim];
+ return chain(readQuoted(delim, style, embed, true), stream, state);
+ } else if (ch == "#") {
+ stream.skipToEnd();
+ return "comment";
+ } else if (ch == "<" && (m = stream.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/))) {
+ return chain(readHereDoc(m[1]), stream, state);
+ } else if (ch == "0") {
+ if (stream.eat("x")) stream.eatWhile(/[\da-fA-F]/);
+ else if (stream.eat("b")) stream.eatWhile(/[01]/);
+ else stream.eatWhile(/[0-7]/);
+ return "number";
+ } else if (/\d/.test(ch)) {
+ stream.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/);
+ return "number";
+ } else if (ch == "?") {
+ while (stream.match(/^\\[CM]-/)) {}
+ if (stream.eat("\\")) stream.eatWhile(/\w/);
+ else stream.next();
+ return "string";
+ } else if (ch == ":") {
+ if (stream.eat("'")) return chain(readQuoted("'", "atom", false), stream, state);
+ if (stream.eat('"')) return chain(readQuoted('"', "atom", true), stream, state);
+
+ // :> :>> :< :<< are valid symbols
+ if (stream.eat(/[\<\>]/)) {
+ stream.eat(/[\<\>]/);
+ return "atom";
+ }
+
+ // :+ :- :/ :* :| :& :! are valid symbols
+ if (stream.eat(/[\+\-\*\/\&\|\:\!]/)) {
+ return "atom";
+ }
+
+ // Symbols can't start by a digit
+ if (stream.eat(/[a-zA-Z$@_\xa1-\uffff]/)) {
+ stream.eatWhile(/[\w$\xa1-\uffff]/);
+ // Only one ? ! = is allowed and only as the last character
+ stream.eat(/[\?\!\=]/);
+ return "atom";
+ }
+ return "operator";
+ } else if (ch == "@" && stream.match(/^@?[a-zA-Z_\xa1-\uffff]/)) {
+ stream.eat("@");
+ stream.eatWhile(/[\w\xa1-\uffff]/);
+ return "variable-2";
+ } else if (ch == "$") {
+ if (stream.eat(/[a-zA-Z_]/)) {
+ stream.eatWhile(/[\w]/);
+ } else if (stream.eat(/\d/)) {
+ stream.eat(/\d/);
+ } else {
+ stream.next(); // Must be a special global like $: or $!
+ }
+ return "variable-3";
+ } else if (/[a-zA-Z_\xa1-\uffff]/.test(ch)) {
+ stream.eatWhile(/[\w\xa1-\uffff]/);
+ stream.eat(/[\?\!]/);
+ if (stream.eat(":")) return "atom";
+ return "ident";
+ } else if (ch == "|" && (state.varList || state.lastTok == "{" || state.lastTok == "do")) {
+ curPunc = "|";
+ return null;
+ } else if (/[\(\)\[\]{}\\;]/.test(ch)) {
+ curPunc = ch;
+ return null;
+ } else if (ch == "-" && stream.eat(">")) {
+ return "arrow";
+ } else if (/[=+\-\/*:\.^%<>~|]/.test(ch)) {
+ var more = stream.eatWhile(/[=+\-\/*:\.^%<>~|]/);
+ if (ch == "." && !more) curPunc = ".";
+ return "operator";
+ } else {
+ return null;
+ }
+ }
+
+ function tokenBaseUntilBrace(depth) {
+ if (!depth) depth = 1;
+ return function(stream, state) {
+ if (stream.peek() == "}") {
+ if (depth == 1) {
+ state.tokenize.pop();
+ return state.tokenize[state.tokenize.length-1](stream, state);
+ } else {
+ state.tokenize[state.tokenize.length - 1] = tokenBaseUntilBrace(depth - 1);
+ }
+ } else if (stream.peek() == "{") {
+ state.tokenize[state.tokenize.length - 1] = tokenBaseUntilBrace(depth + 1);
+ }
+ return tokenBase(stream, state);
+ };
+ }
+ function tokenBaseOnce() {
+ var alreadyCalled = false;
+ return function(stream, state) {
+ if (alreadyCalled) {
+ state.tokenize.pop();
+ return state.tokenize[state.tokenize.length-1](stream, state);
+ }
+ alreadyCalled = true;
+ return tokenBase(stream, state);
+ };
+ }
+ function readQuoted(quote, style, embed, unescaped) {
+ return function(stream, state) {
+ var escaped = false, ch;
+
+ if (state.context.type === 'read-quoted-paused') {
+ state.context = state.context.prev;
+ stream.eat("}");
+ }
+
+ while ((ch = stream.next()) != null) {
+ if (ch == quote && (unescaped || !escaped)) {
+ state.tokenize.pop();
+ break;
+ }
+ if (embed && ch == "#" && !escaped) {
+ if (stream.eat("{")) {
+ if (quote == "}") {
+ state.context = {prev: state.context, type: 'read-quoted-paused'};
+ }
+ state.tokenize.push(tokenBaseUntilBrace());
+ break;
+ } else if (/[@\$]/.test(stream.peek())) {
+ state.tokenize.push(tokenBaseOnce());
+ break;
+ }
+ }
+ escaped = !escaped && ch == "\\";
+ }
+ return style;
+ };
+ }
+ function readHereDoc(phrase) {
+ return function(stream, state) {
+ if (stream.match(phrase)) state.tokenize.pop();
+ else stream.skipToEnd();
+ return "string";
+ };
+ }
+ function readBlockComment(stream, state) {
+ if (stream.sol() && stream.match("=end") && stream.eol())
+ state.tokenize.pop();
+ stream.skipToEnd();
+ return "comment";
+ }
+
+ return {
+ startState: function() {
+ return {tokenize: [tokenBase],
+ indented: 0,
+ context: {type: "top", indented: -config.indentUnit},
+ continuedLine: false,
+ lastTok: null,
+ varList: false};
+ },
+
+ token: function(stream, state) {
+ if (stream.sol()) state.indented = stream.indentation();
+ var style = state.tokenize[state.tokenize.length-1](stream, state), kwtype;
+ var thisTok = curPunc;
+ if (style == "ident") {
+ var word = stream.current();
+ style = state.lastTok == "." ? "property"
+ : keywords.propertyIsEnumerable(stream.current()) ? "keyword"
+ : /^[A-Z]/.test(word) ? "tag"
+ : (state.lastTok == "def" || state.lastTok == "class" || state.varList) ? "def"
+ : "variable";
+ if (style == "keyword") {
+ thisTok = word;
+ if (indentWords.propertyIsEnumerable(word)) kwtype = "indent";
+ else if (dedentWords.propertyIsEnumerable(word)) kwtype = "dedent";
+ else if ((word == "if" || word == "unless") && stream.column() == stream.indentation())
+ kwtype = "indent";
+ else if (word == "do" && state.context.indented < state.indented)
+ kwtype = "indent";
+ }
+ }
+ if (curPunc || (style && style != "comment")) state.lastTok = thisTok;
+ if (curPunc == "|") state.varList = !state.varList;
+
+ if (kwtype == "indent" || /[\(\[\{]/.test(curPunc))
+ state.context = {prev: state.context, type: curPunc || style, indented: state.indented};
+ else if ((kwtype == "dedent" || /[\)\]\}]/.test(curPunc)) && state.context.prev)
+ state.context = state.context.prev;
+
+ if (stream.eol())
+ state.continuedLine = (curPunc == "\\" || style == "operator");
+ return style;
+ },
+
+ indent: function(state, textAfter) {
+ if (state.tokenize[state.tokenize.length-1] != tokenBase) return 0;
+ var firstChar = textAfter && textAfter.charAt(0);
+ var ct = state.context;
+ var closing = ct.type == matching[firstChar] ||
+ ct.type == "keyword" && /^(?:end|until|else|elsif|when|rescue)\b/.test(textAfter);
+ return ct.indented + (closing ? 0 : config.indentUnit) +
+ (state.continuedLine ? config.indentUnit : 0);
+ },
+
+ electricChars: "}de", // enD and rescuE
+ lineComment: "#"
+ };
+});
+
+CodeMirror.defineMIME("text/x-ruby", "ruby");
+
+});
diff --git a/public/vendor/codemirror/mode/ruby/test.js b/public/vendor/codemirror/mode/ruby/test.js
new file mode 100755
index 00000000..cade864f
--- /dev/null
+++ b/public/vendor/codemirror/mode/ruby/test.js
@@ -0,0 +1,14 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function() {
+ var mode = CodeMirror.getMode({indentUnit: 2}, "ruby");
+ function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+ MT("divide_equal_operator",
+ "[variable bar] [operator /=] [variable foo]");
+
+ MT("divide_equal_operator_no_spacing",
+ "[variable foo][operator /=][number 42]");
+
+})();
diff --git a/public/vendor/codemirror/mode/rust/index.html b/public/vendor/codemirror/mode/rust/index.html
new file mode 100755
index 00000000..407e84f2
--- /dev/null
+++ b/public/vendor/codemirror/mode/rust/index.html
@@ -0,0 +1,60 @@
+<!doctype html>
+
+<title>CodeMirror: Rust mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="rust.js"></script>
+<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+ <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/codemirror/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">Rust</a>
+ </ul>
+</div>
+
+<article>
+<h2>Rust mode</h2>
+
+
+<div><textarea id="code" name="code">
+// Demo code.
+
+type foo<T> = int;
+enum bar {
+ some(int, foo<float>),
+ none
+}
+
+fn check_crate(x: int) {
+ let v = 10;
+ alt foo {
+ 1 to 3 {
+ print_foo();
+ if x {
+ blah() + 10;
+ }
+ }
+ (x, y) { "bye" }
+ _ { "hi" }
+ }
+}
+</textarea></div>
+
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ lineNumbers: true
+ });
+ </script>
+
+ <p><strong>MIME types defined:</strong> <code>text/x-rustsrc</code>.</p>
+ </article>
diff --git a/public/vendor/codemirror/mode/rust/rust.js b/public/vendor/codemirror/mode/rust/rust.js
new file mode 100755
index 00000000..2bffa9a6
--- /dev/null
+++ b/public/vendor/codemirror/mode/rust/rust.js
@@ -0,0 +1,451 @@
+// 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("rust", function() {
+ var indentUnit = 4, altIndentUnit = 2;
+ var valKeywords = {
+ "if": "if-style", "while": "if-style", "loop": "else-style", "else": "else-style",
+ "do": "else-style", "ret": "else-style", "fail": "else-style",
+ "break": "atom", "cont": "atom", "const": "let", "resource": "fn",
+ "let": "let", "fn": "fn", "for": "for", "alt": "alt", "iface": "iface",
+ "impl": "impl", "type": "type", "enum": "enum", "mod": "mod",
+ "as": "op", "true": "atom", "false": "atom", "assert": "op", "check": "op",
+ "claim": "op", "native": "ignore", "unsafe": "ignore", "import": "else-style",
+ "export": "else-style", "copy": "op", "log": "op", "log_err": "op",
+ "use": "op", "bind": "op", "self": "atom", "struct": "enum"
+ };
+ var typeKeywords = function() {
+ var keywords = {"fn": "fn", "block": "fn", "obj": "obj"};
+ var atoms = "bool uint int i8 i16 i32 i64 u8 u16 u32 u64 float f32 f64 str char".split(" ");
+ for (var i = 0, e = atoms.length; i < e; ++i) keywords[atoms[i]] = "atom";
+ return keywords;
+ }();
+ var operatorChar = /[+\-*&%=<>!?|\.@]/;
+
+ // Tokenizer
+
+ // Used as scratch variable to communicate multiple values without
+ // consing up tons of objects.
+ var tcat, content;
+ function r(tc, style) {
+ tcat = tc;
+ return style;
+ }
+
+ function tokenBase(stream, state) {
+ var ch = stream.next();
+ if (ch == '"') {
+ state.tokenize = tokenString;
+ return state.tokenize(stream, state);
+ }
+ if (ch == "'") {
+ tcat = "atom";
+ if (stream.eat("\\")) {
+ if (stream.skipTo("'")) { stream.next(); return "string"; }
+ else { return "error"; }
+ } else {
+ stream.next();
+ return stream.eat("'") ? "string" : "error";
+ }
+ }
+ if (ch == "/") {
+ if (stream.eat("/")) { stream.skipToEnd(); return "comment"; }
+ if (stream.eat("*")) {
+ state.tokenize = tokenComment(1);
+ return state.tokenize(stream, state);
+ }
+ }
+ if (ch == "#") {
+ if (stream.eat("[")) { tcat = "open-attr"; return null; }
+ stream.eatWhile(/\w/);
+ return r("macro", "meta");
+ }
+ if (ch == ":" && stream.match(":<")) {
+ return r("op", null);
+ }
+ if (ch.match(/\d/) || (ch == "." && stream.eat(/\d/))) {
+ var flp = false;
+ if (!stream.match(/^x[\da-f]+/i) && !stream.match(/^b[01]+/)) {
+ stream.eatWhile(/\d/);
+ if (stream.eat(".")) { flp = true; stream.eatWhile(/\d/); }
+ if (stream.match(/^e[+\-]?\d+/i)) { flp = true; }
+ }
+ if (flp) stream.match(/^f(?:32|64)/);
+ else stream.match(/^[ui](?:8|16|32|64)/);
+ return r("atom", "number");
+ }
+ if (ch.match(/[()\[\]{}:;,]/)) return r(ch, null);
+ if (ch == "-" && stream.eat(">")) return r("->", null);
+ if (ch.match(operatorChar)) {
+ stream.eatWhile(operatorChar);
+ return r("op", null);
+ }
+ stream.eatWhile(/\w/);
+ content = stream.current();
+ if (stream.match(/^::\w/)) {
+ stream.backUp(1);
+ return r("prefix", "variable-2");
+ }
+ if (state.keywords.propertyIsEnumerable(content))
+ return r(state.keywords[content], content.match(/true|false/) ? "atom" : "keyword");
+ return r("name", "variable");
+ }
+
+ function tokenString(stream, state) {
+ var ch, escaped = false;
+ while (ch = stream.next()) {
+ if (ch == '"' && !escaped) {
+ state.tokenize = tokenBase;
+ return r("atom", "string");
+ }
+ escaped = !escaped && ch == "\\";
+ }
+ // Hack to not confuse the parser when a string is split in
+ // pieces.
+ return r("op", "string");
+ }
+
+ function tokenComment(depth) {
+ return function(stream, state) {
+ var lastCh = null, ch;
+ while (ch = stream.next()) {
+ if (ch == "/" && lastCh == "*") {
+ if (depth == 1) {
+ state.tokenize = tokenBase;
+ break;
+ } else {
+ state.tokenize = tokenComment(depth - 1);
+ return state.tokenize(stream, state);
+ }
+ }
+ if (ch == "*" && lastCh == "/") {
+ state.tokenize = tokenComment(depth + 1);
+ return state.tokenize(stream, state);
+ }
+ lastCh = ch;
+ }
+ return "comment";
+ };
+ }
+
+ // Parser
+
+ var cx = {state: null, stream: null, marked: null, cc: null};
+ function pass() {
+ for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
+ }
+ function cont() {
+ pass.apply(null, arguments);
+ return true;
+ }
+
+ function pushlex(type, info) {
+ var result = function() {
+ var state = cx.state;
+ state.lexical = {indented: state.indented, column: cx.stream.column(),
+ type: type, prev: state.lexical, info: info};
+ };
+ result.lex = true;
+ return result;
+ }
+ function poplex() {
+ var state = cx.state;
+ if (state.lexical.prev) {
+ if (state.lexical.type == ")")
+ state.indented = state.lexical.indented;
+ state.lexical = state.lexical.prev;
+ }
+ }
+ function typecx() { cx.state.keywords = typeKeywords; }
+ function valcx() { cx.state.keywords = valKeywords; }
+ poplex.lex = typecx.lex = valcx.lex = true;
+
+ function commasep(comb, end) {
+ function more(type) {
+ if (type == ",") return cont(comb, more);
+ if (type == end) return cont();
+ return cont(more);
+ }
+ return function(type) {
+ if (type == end) return cont();
+ return pass(comb, more);
+ };
+ }
+
+ function stat_of(comb, tag) {
+ return cont(pushlex("stat", tag), comb, poplex, block);
+ }
+ function block(type) {
+ if (type == "}") return cont();
+ if (type == "let") return stat_of(letdef1, "let");
+ if (type == "fn") return stat_of(fndef);
+ if (type == "type") return cont(pushlex("stat"), tydef, endstatement, poplex, block);
+ if (type == "enum") return stat_of(enumdef);
+ if (type == "mod") return stat_of(mod);
+ if (type == "iface") return stat_of(iface);
+ if (type == "impl") return stat_of(impl);
+ if (type == "open-attr") return cont(pushlex("]"), commasep(expression, "]"), poplex);
+ if (type == "ignore" || type.match(/[\]\);,]/)) return cont(block);
+ return pass(pushlex("stat"), expression, poplex, endstatement, block);
+ }
+ function endstatement(type) {
+ if (type == ";") return cont();
+ return pass();
+ }
+ function expression(type) {
+ if (type == "atom" || type == "name") return cont(maybeop);
+ if (type == "{") return cont(pushlex("}"), exprbrace, poplex);
+ if (type.match(/[\[\(]/)) return matchBrackets(type, expression);
+ if (type.match(/[\]\)\};,]/)) return pass();
+ if (type == "if-style") return cont(expression, expression);
+ if (type == "else-style" || type == "op") return cont(expression);
+ if (type == "for") return cont(pattern, maybetype, inop, expression, expression);
+ if (type == "alt") return cont(expression, altbody);
+ if (type == "fn") return cont(fndef);
+ if (type == "macro") return cont(macro);
+ return cont();
+ }
+ function maybeop(type) {
+ if (content == ".") return cont(maybeprop);
+ if (content == "::<"){return cont(typarams, maybeop);}
+ if (type == "op" || content == ":") return cont(expression);
+ if (type == "(" || type == "[") return matchBrackets(type, expression);
+ return pass();
+ }
+ function maybeprop() {
+ if (content.match(/^\w+$/)) {cx.marked = "variable"; return cont(maybeop);}
+ return pass(expression);
+ }
+ function exprbrace(type) {
+ if (type == "op") {
+ if (content == "|") return cont(blockvars, poplex, pushlex("}", "block"), block);
+ if (content == "||") return cont(poplex, pushlex("}", "block"), block);
+ }
+ if (content == "mutable" || (content.match(/^\w+$/) && cx.stream.peek() == ":"
+ && !cx.stream.match("::", false)))
+ return pass(record_of(expression));
+ return pass(block);
+ }
+ function record_of(comb) {
+ function ro(type) {
+ if (content == "mutable" || content == "with") {cx.marked = "keyword"; return cont(ro);}
+ if (content.match(/^\w*$/)) {cx.marked = "variable"; return cont(ro);}
+ if (type == ":") return cont(comb, ro);
+ if (type == "}") return cont();
+ return cont(ro);
+ }
+ return ro;
+ }
+ function blockvars(type) {
+ if (type == "name") {cx.marked = "def"; return cont(blockvars);}
+ if (type == "op" && content == "|") return cont();
+ return cont(blockvars);
+ }
+
+ function letdef1(type) {
+ if (type.match(/[\]\)\};]/)) return cont();
+ if (content == "=") return cont(expression, letdef2);
+ if (type == ",") return cont(letdef1);
+ return pass(pattern, maybetype, letdef1);
+ }
+ function letdef2(type) {
+ if (type.match(/[\]\)\};,]/)) return pass(letdef1);
+ else return pass(expression, letdef2);
+ }
+ function maybetype(type) {
+ if (type == ":") return cont(typecx, rtype, valcx);
+ return pass();
+ }
+ function inop(type) {
+ if (type == "name" && content == "in") {cx.marked = "keyword"; return cont();}
+ return pass();
+ }
+ function fndef(type) {
+ if (content == "@" || content == "~") {cx.marked = "keyword"; return cont(fndef);}
+ if (type == "name") {cx.marked = "def"; return cont(fndef);}
+ if (content == "<") return cont(typarams, fndef);
+ if (type == "{") return pass(expression);
+ if (type == "(") return cont(pushlex(")"), commasep(argdef, ")"), poplex, fndef);
+ if (type == "->") return cont(typecx, rtype, valcx, fndef);
+ if (type == ";") return cont();
+ return cont(fndef);
+ }
+ function tydef(type) {
+ if (type == "name") {cx.marked = "def"; return cont(tydef);}
+ if (content == "<") return cont(typarams, tydef);
+ if (content == "=") return cont(typecx, rtype, valcx);
+ return cont(tydef);
+ }
+ function enumdef(type) {
+ if (type == "name") {cx.marked = "def"; return cont(enumdef);}
+ if (content == "<") return cont(typarams, enumdef);
+ if (content == "=") return cont(typecx, rtype, valcx, endstatement);
+ if (type == "{") return cont(pushlex("}"), typecx, enumblock, valcx, poplex);
+ return cont(enumdef);
+ }
+ function enumblock(type) {
+ if (type == "}") return cont();
+ if (type == "(") return cont(pushlex(")"), commasep(rtype, ")"), poplex, enumblock);
+ if (content.match(/^\w+$/)) cx.marked = "def";
+ return cont(enumblock);
+ }
+ function mod(type) {
+ if (type == "name") {cx.marked = "def"; return cont(mod);}
+ if (type == "{") return cont(pushlex("}"), block, poplex);
+ return pass();
+ }
+ function iface(type) {
+ if (type == "name") {cx.marked = "def"; return cont(iface);}
+ if (content == "<") return cont(typarams, iface);
+ if (type == "{") return cont(pushlex("}"), block, poplex);
+ return pass();
+ }
+ function impl(type) {
+ if (content == "<") return cont(typarams, impl);
+ if (content == "of" || content == "for") {cx.marked = "keyword"; return cont(rtype, impl);}
+ if (type == "name") {cx.marked = "def"; return cont(impl);}
+ if (type == "{") return cont(pushlex("}"), block, poplex);
+ return pass();
+ }
+ function typarams() {
+ if (content == ">") return cont();
+ if (content == ",") return cont(typarams);
+ if (content == ":") return cont(rtype, typarams);
+ return pass(rtype, typarams);
+ }
+ function argdef(type) {
+ if (type == "name") {cx.marked = "def"; return cont(argdef);}
+ if (type == ":") return cont(typecx, rtype, valcx);
+ return pass();
+ }
+ function rtype(type) {
+ if (type == "name") {cx.marked = "variable-3"; return cont(rtypemaybeparam); }
+ if (content == "mutable") {cx.marked = "keyword"; return cont(rtype);}
+ if (type == "atom") return cont(rtypemaybeparam);
+ if (type == "op" || type == "obj") return cont(rtype);
+ if (type == "fn") return cont(fntype);
+ if (type == "{") return cont(pushlex("{"), record_of(rtype), poplex);
+ return matchBrackets(type, rtype);
+ }
+ function rtypemaybeparam() {
+ if (content == "<") return cont(typarams);
+ return pass();
+ }
+ function fntype(type) {
+ if (type == "(") return cont(pushlex("("), commasep(rtype, ")"), poplex, fntype);
+ if (type == "->") return cont(rtype);
+ return pass();
+ }
+ function pattern(type) {
+ if (type == "name") {cx.marked = "def"; return cont(patternmaybeop);}
+ if (type == "atom") return cont(patternmaybeop);
+ if (type == "op") return cont(pattern);
+ if (type.match(/[\]\)\};,]/)) return pass();
+ return matchBrackets(type, pattern);
+ }
+ function patternmaybeop(type) {
+ if (type == "op" && content == ".") return cont();
+ if (content == "to") {cx.marked = "keyword"; return cont(pattern);}
+ else return pass();
+ }
+ function altbody(type) {
+ if (type == "{") return cont(pushlex("}", "alt"), altblock1, poplex);
+ return pass();
+ }
+ function altblock1(type) {
+ if (type == "}") return cont();
+ if (type == "|") return cont(altblock1);
+ if (content == "when") {cx.marked = "keyword"; return cont(expression, altblock2);}
+ if (type.match(/[\]\);,]/)) return cont(altblock1);
+ return pass(pattern, altblock2);
+ }
+ function altblock2(type) {
+ if (type == "{") return cont(pushlex("}", "alt"), block, poplex, altblock1);
+ else return pass(altblock1);
+ }
+
+ function macro(type) {
+ if (type.match(/[\[\(\{]/)) return matchBrackets(type, expression);
+ return pass();
+ }
+ function matchBrackets(type, comb) {
+ if (type == "[") return cont(pushlex("]"), commasep(comb, "]"), poplex);
+ if (type == "(") return cont(pushlex(")"), commasep(comb, ")"), poplex);
+ if (type == "{") return cont(pushlex("}"), commasep(comb, "}"), poplex);
+ return cont();
+ }
+
+ function parse(state, stream, style) {
+ var cc = state.cc;
+ // Communicate our context to the combinators.
+ // (Less wasteful than consing up a hundred closures on every call.)
+ cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
+
+ while (true) {
+ var combinator = cc.length ? cc.pop() : block;
+ if (combinator(tcat)) {
+ while(cc.length && cc[cc.length - 1].lex)
+ cc.pop()();
+ return cx.marked || style;
+ }
+ }
+ }
+
+ return {
+ startState: function() {
+ return {
+ tokenize: tokenBase,
+ cc: [],
+ lexical: {indented: -indentUnit, column: 0, type: "top", align: false},
+ keywords: valKeywords,
+ indented: 0
+ };
+ },
+
+ token: function(stream, state) {
+ if (stream.sol()) {
+ if (!state.lexical.hasOwnProperty("align"))
+ state.lexical.align = false;
+ state.indented = stream.indentation();
+ }
+ if (stream.eatSpace()) return null;
+ tcat = content = null;
+ var style = state.tokenize(stream, state);
+ if (style == "comment") return style;
+ if (!state.lexical.hasOwnProperty("align"))
+ state.lexical.align = true;
+ if (tcat == "prefix") return style;
+ if (!content) content = stream.current();
+ return parse(state, stream, style);
+ },
+
+ indent: function(state, textAfter) {
+ if (state.tokenize != tokenBase) return 0;
+ var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical,
+ type = lexical.type, closing = firstChar == type;
+ if (type == "stat") return lexical.indented + indentUnit;
+ if (lexical.align) return lexical.column + (closing ? 0 : 1);
+ return lexical.indented + (closing ? 0 : (lexical.info == "alt" ? altIndentUnit : indentUnit));
+ },
+
+ electricChars: "{}",
+ blockCommentStart: "/*",
+ blockCommentEnd: "*/",
+ lineComment: "//",
+ fold: "brace"
+ };
+});
+
+CodeMirror.defineMIME("text/x-rustsrc", "rust");
+
+});