summaryrefslogtreecommitdiff
path: root/public/vendor/codemirror/mode
diff options
context:
space:
mode:
Diffstat (limited to 'public/vendor/codemirror/mode')
-rwxr-xr-xpublic/vendor/codemirror/mode/apl/apl.js3
-rwxr-xr-xpublic/vendor/codemirror/mode/asn.1/asn.1.js204
-rwxr-xr-xpublic/vendor/codemirror/mode/asn.1/index.html78
-rwxr-xr-xpublic/vendor/codemirror/mode/asterisk/asterisk.js6
-rwxr-xr-xpublic/vendor/codemirror/mode/clike/clike.js183
-rwxr-xr-xpublic/vendor/codemirror/mode/clike/test.js33
-rwxr-xr-xpublic/vendor/codemirror/mode/css/css.js17
-rwxr-xr-xpublic/vendor/codemirror/mode/css/test.js7
-rwxr-xr-xpublic/vendor/codemirror/mode/cypher/cypher.js2
-rwxr-xr-xpublic/vendor/codemirror/mode/dylan/dylan.js44
-rwxr-xr-xpublic/vendor/codemirror/mode/ecl/ecl.js3
-rwxr-xr-xpublic/vendor/codemirror/mode/eiffel/eiffel.js2
-rwxr-xr-xpublic/vendor/codemirror/mode/elm/elm.js205
-rwxr-xr-xpublic/vendor/codemirror/mode/elm/index.html61
-rwxr-xr-xpublic/vendor/codemirror/mode/factor/factor.js83
-rwxr-xr-xpublic/vendor/codemirror/mode/factor/index.html77
-rwxr-xr-xpublic/vendor/codemirror/mode/groovy/groovy.js13
-rwxr-xr-xpublic/vendor/codemirror/mode/htmlmixed/htmlmixed.js4
-rwxr-xr-xpublic/vendor/codemirror/mode/index.html9
-rwxr-xr-xpublic/vendor/codemirror/mode/javascript/javascript.js7
-rwxr-xr-xpublic/vendor/codemirror/mode/javascript/test.js5
-rwxr-xr-xpublic/vendor/codemirror/mode/julia/julia.js2
-rwxr-xr-xpublic/vendor/codemirror/mode/kotlin/kotlin.js7
-rwxr-xr-xpublic/vendor/codemirror/mode/livescript/livescript.js4
-rwxr-xr-xpublic/vendor/codemirror/mode/markdown/markdown.js60
-rwxr-xr-xpublic/vendor/codemirror/mode/markdown/test.js122
-rwxr-xr-xpublic/vendor/codemirror/mode/mathematica/index.html72
-rwxr-xr-xpublic/vendor/codemirror/mode/mathematica/mathematica.js175
-rwxr-xr-xpublic/vendor/codemirror/mode/meta.js8
-rwxr-xr-xpublic/vendor/codemirror/mode/php/php.js38
-rwxr-xr-xpublic/vendor/codemirror/mode/pig/pig.js40
-rwxr-xr-xpublic/vendor/codemirror/mode/python/python.js2
-rwxr-xr-xpublic/vendor/codemirror/mode/sql/sql.js4
-rwxr-xr-xpublic/vendor/codemirror/mode/swift/index.html88
-rwxr-xr-xpublic/vendor/codemirror/mode/swift/swift.js203
-rwxr-xr-xpublic/vendor/codemirror/mode/tiddlywiki/tiddlywiki.js83
-rwxr-xr-xpublic/vendor/codemirror/mode/tiki/tiki.js27
-rwxr-xr-xpublic/vendor/codemirror/mode/ttcn-cfg/index.html115
-rwxr-xr-xpublic/vendor/codemirror/mode/ttcn-cfg/ttcn-cfg.js214
-rwxr-xr-xpublic/vendor/codemirror/mode/ttcn/index.html118
-rwxr-xr-xpublic/vendor/codemirror/mode/ttcn/ttcn.js283
-rwxr-xr-xpublic/vendor/codemirror/mode/twig/index.html45
-rwxr-xr-xpublic/vendor/codemirror/mode/twig/twig.js132
-rwxr-xr-xpublic/vendor/codemirror/mode/vb/vb.js3
-rwxr-xr-xpublic/vendor/codemirror/mode/xquery/xquery.js70
45 files changed, 2626 insertions, 335 deletions
diff --git a/public/vendor/codemirror/mode/apl/apl.js b/public/vendor/codemirror/mode/apl/apl.js
index 4357bed4..caafe4e9 100755
--- a/public/vendor/codemirror/mode/apl/apl.js
+++ b/public/vendor/codemirror/mode/apl/apl.js
@@ -102,7 +102,7 @@ CodeMirror.defineMode("apl", function() {
};
},
token: function(stream, state) {
- var ch, funcName, word;
+ var ch, funcName;
if (stream.eatSpace()) {
return null;
}
@@ -163,7 +163,6 @@ CodeMirror.defineMode("apl", function() {
return "function jot-dot";
}
stream.eatWhile(/[\w\$_]/);
- word = stream.current();
state.prev = true;
return "keyword";
}
diff --git a/public/vendor/codemirror/mode/asn.1/asn.1.js b/public/vendor/codemirror/mode/asn.1/asn.1.js
new file mode 100755
index 00000000..9600247e
--- /dev/null
+++ b/public/vendor/codemirror/mode/asn.1/asn.1.js
@@ -0,0 +1,204 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+ "use strict";
+
+ CodeMirror.defineMode("asn.1", function(config, parserConfig) {
+ var indentUnit = config.indentUnit,
+ keywords = parserConfig.keywords || {},
+ cmipVerbs = parserConfig.cmipVerbs || {},
+ compareTypes = parserConfig.compareTypes || {},
+ status = parserConfig.status || {},
+ tags = parserConfig.tags || {},
+ storage = parserConfig.storage || {},
+ modifier = parserConfig.modifier || {},
+ accessTypes = parserConfig.accessTypes|| {},
+ multiLineStrings = parserConfig.multiLineStrings,
+ indentStatements = parserConfig.indentStatements !== false;
+ var isOperatorChar = /[\|\^]/;
+ var curPunc;
+
+ function tokenBase(stream, state) {
+ var ch = stream.next();
+ if (ch == '"' || ch == "'") {
+ state.tokenize = tokenString(ch);
+ return state.tokenize(stream, state);
+ }
+ if (/[\[\]\(\){}:=,;]/.test(ch)) {
+ curPunc = ch;
+ return "punctuation";
+ }
+ if (ch == "-"){
+ if (stream.eat("-")) {
+ stream.skipToEnd();
+ return "comment";
+ }
+ }
+ if (/\d/.test(ch)) {
+ stream.eatWhile(/[\w\.]/);
+ return "number";
+ }
+ if (isOperatorChar.test(ch)) {
+ stream.eatWhile(isOperatorChar);
+ return "operator";
+ }
+
+ stream.eatWhile(/[\w\-]/);
+ var cur = stream.current();
+ if (keywords.propertyIsEnumerable(cur)) return "keyword";
+ if (cmipVerbs.propertyIsEnumerable(cur)) return "variable cmipVerbs";
+ if (compareTypes.propertyIsEnumerable(cur)) return "atom compareTypes";
+ if (status.propertyIsEnumerable(cur)) return "comment status";
+ if (tags.propertyIsEnumerable(cur)) return "variable-3 tags";
+ if (storage.propertyIsEnumerable(cur)) return "builtin storage";
+ if (modifier.propertyIsEnumerable(cur)) return "string-2 modifier";
+ if (accessTypes.propertyIsEnumerable(cur)) return "atom accessTypes";
+
+ return "variable";
+ }
+
+ function tokenString(quote) {
+ return function(stream, state) {
+ var escaped = false, next, end = false;
+ while ((next = stream.next()) != null) {
+ if (next == quote && !escaped){
+ var afterNext = stream.peek();
+ //look if the character if the quote is like the B in '10100010'B
+ if (afterNext){
+ afterNext = afterNext.toLowerCase();
+ if(afterNext == "b" || afterNext == "h" || afterNext == "o")
+ stream.next();
+ }
+ end = true; break;
+ }
+ escaped = !escaped && next == "\\";
+ }
+ if (end || !(escaped || multiLineStrings))
+ state.tokenize = null;
+ return "string";
+ };
+ }
+
+ function Context(indented, column, type, align, prev) {
+ this.indented = indented;
+ this.column = column;
+ this.type = type;
+ this.align = align;
+ this.prev = prev;
+ }
+ function pushContext(state, col, type) {
+ var indent = state.indented;
+ if (state.context && state.context.type == "statement")
+ indent = state.context.indented;
+ return state.context = new Context(indent, col, type, null, state.context);
+ }
+ function popContext(state) {
+ var t = state.context.type;
+ if (t == ")" || t == "]" || t == "}")
+ state.indented = state.context.indented;
+ return state.context = state.context.prev;
+ }
+
+ //Interface
+ return {
+ startState: function(basecolumn) {
+ return {
+ tokenize: null,
+ context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
+ indented: 0,
+ startOfLine: true
+ };
+ },
+
+ token: function(stream, state) {
+ var ctx = state.context;
+ if (stream.sol()) {
+ if (ctx.align == null) ctx.align = false;
+ state.indented = stream.indentation();
+ state.startOfLine = true;
+ }
+ if (stream.eatSpace()) return null;
+ curPunc = null;
+ var style = (state.tokenize || tokenBase)(stream, state);
+ if (style == "comment") return style;
+ if (ctx.align == null) ctx.align = true;
+
+ if ((curPunc == ";" || curPunc == ":" || curPunc == ",")
+ && ctx.type == "statement"){
+ popContext(state);
+ }
+ else if (curPunc == "{") pushContext(state, stream.column(), "}");
+ else if (curPunc == "[") pushContext(state, stream.column(), "]");
+ else if (curPunc == "(") pushContext(state, stream.column(), ")");
+ else if (curPunc == "}") {
+ while (ctx.type == "statement") ctx = popContext(state);
+ if (ctx.type == "}") ctx = popContext(state);
+ while (ctx.type == "statement") ctx = popContext(state);
+ }
+ else if (curPunc == ctx.type) popContext(state);
+ else if (indentStatements && (((ctx.type == "}" || ctx.type == "top")
+ && curPunc != ';') || (ctx.type == "statement"
+ && curPunc == "newstatement")))
+ pushContext(state, stream.column(), "statement");
+
+ state.startOfLine = false;
+ return style;
+ },
+
+ electricChars: "{}",
+ lineComment: "--",
+ fold: "brace"
+ };
+ });
+
+ function words(str) {
+ var obj = {}, words = str.split(" ");
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+ return obj;
+ }
+
+ CodeMirror.defineMIME("text/x-ttcn-asn", {
+ name: "asn.1",
+ keywords: words("DEFINITIONS OBJECTS IF DERIVED INFORMATION ACTION" +
+ " REPLY ANY NAMED CHARACTERIZED BEHAVIOUR REGISTERED" +
+ " WITH AS IDENTIFIED CONSTRAINED BY PRESENT BEGIN" +
+ " IMPORTS FROM UNITS SYNTAX MIN-ACCESS MAX-ACCESS" +
+ " MINACCESS MAXACCESS REVISION STATUS DESCRIPTION" +
+ " SEQUENCE SET COMPONENTS OF CHOICE DistinguishedName" +
+ " ENUMERATED SIZE MODULE END INDEX AUGMENTS EXTENSIBILITY" +
+ " IMPLIED EXPORTS"),
+ cmipVerbs: words("ACTIONS ADD GET NOTIFICATIONS REPLACE REMOVE"),
+ compareTypes: words("OPTIONAL DEFAULT MANAGED MODULE-TYPE MODULE_IDENTITY" +
+ " MODULE-COMPLIANCE OBJECT-TYPE OBJECT-IDENTITY" +
+ " OBJECT-COMPLIANCE MODE CONFIRMED CONDITIONAL" +
+ " SUBORDINATE SUPERIOR CLASS TRUE FALSE NULL" +
+ " TEXTUAL-CONVENTION"),
+ status: words("current deprecated mandatory obsolete"),
+ tags: words("APPLICATION AUTOMATIC EXPLICIT IMPLICIT PRIVATE TAGS" +
+ " UNIVERSAL"),
+ storage: words("BOOLEAN INTEGER OBJECT IDENTIFIER BIT OCTET STRING" +
+ " UTCTime InterfaceIndex IANAifType CMIP-Attribute" +
+ " REAL PACKAGE PACKAGES IpAddress PhysAddress" +
+ " NetworkAddress BITS BMPString TimeStamp TimeTicks" +
+ " TruthValue RowStatus DisplayString GeneralString" +
+ " GraphicString IA5String NumericString" +
+ " PrintableString SnmpAdminAtring TeletexString" +
+ " UTF8String VideotexString VisibleString StringStore" +
+ " ISO646String T61String UniversalString Unsigned32" +
+ " Integer32 Gauge Gauge32 Counter Counter32 Counter64"),
+ modifier: words("ATTRIBUTE ATTRIBUTES MANDATORY-GROUP MANDATORY-GROUPS" +
+ " GROUP GROUPS ELEMENTS EQUALITY ORDERING SUBSTRINGS" +
+ " DEFINED"),
+ accessTypes: words("not-accessible accessible-for-notify read-only" +
+ " read-create read-write"),
+ multiLineStrings: true
+ });
+});
diff --git a/public/vendor/codemirror/mode/asn.1/index.html b/public/vendor/codemirror/mode/asn.1/index.html
new file mode 100755
index 00000000..8346f8e5
--- /dev/null
+++ b/public/vendor/codemirror/mode/asn.1/index.html
@@ -0,0 +1,78 @@
+<!doctype html>
+
+<title>CodeMirror: ASN.1 mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="asn.1.js"></script>
+<style type="text/css">
+ .CodeMirror {
+ border-top: 1px solid black;
+ border-bottom: 1px solid black;
+ }
+</style>
+<div id=nav>
+ <a href="http://codemirror.net"><h1>CodeMirror</h1>
+ <img id=logo src="../../doc/logo.png">
+ </a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/codemirror/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="http://en.wikipedia.org/wiki/Abstract_Syntax_Notation_One">ASN.1</a>
+ </ul>
+</div>
+<article>
+ <h2>ASN.1 example</h2>
+ <div>
+ <textarea id="ttcn-asn-code">
+ --
+ -- Sample ASN.1 Code
+ --
+ MyModule DEFINITIONS ::=
+ BEGIN
+
+ MyTypes ::= SEQUENCE {
+ myObjectId OBJECT IDENTIFIER,
+ mySeqOf SEQUENCE OF MyInt,
+ myBitString BIT STRING {
+ muxToken(0),
+ modemToken(1)
+ }
+ }
+
+ MyInt ::= INTEGER (0..65535)
+
+ END
+ </textarea>
+ </div>
+
+ <script>
+ var ttcnEditor = CodeMirror.fromTextArea(document.getElementById("ttcn-asn-code"), {
+ lineNumbers: true,
+ matchBrackets: true,
+ mode: "text/x-ttcn-asn"
+ });
+ ttcnEditor.setSize(400, 400);
+ var mac = CodeMirror.keyMap.default == CodeMirror.keyMap.macDefault;
+ CodeMirror.keyMap.default[(mac ? "Cmd" : "Ctrl") + "-Space"] = "autocomplete";
+ </script>
+ <br/>
+ <p><strong>Language:</strong> Abstract Syntax Notation One
+ (<a href="http://www.itu.int/en/ITU-T/asn1/Pages/introduction.aspx">ASN.1</a>)
+ </p>
+ <p><strong>MIME types defined:</strong> <code>text/x-ttcn-asn</code></p>
+
+ <br/>
+ <p>The development of this mode has been sponsored by <a href="http://www.ericsson.com/">Ericsson
+ </a>.</p>
+ <p>Coded by Asmelash Tsegay Gebretsadkan </p>
+ </article>
+</article>
+
diff --git a/public/vendor/codemirror/mode/asterisk/asterisk.js b/public/vendor/codemirror/mode/asterisk/asterisk.js
index a1ead115..b7ebfc5a 100755
--- a/public/vendor/codemirror/mode/asterisk/asterisk.js
+++ b/public/vendor/codemirror/mode/asterisk/asterisk.js
@@ -65,8 +65,7 @@ CodeMirror.defineMode("asterisk", function() {
function basicToken(stream,state){
var cur = '';
- var ch = '';
- ch = stream.next();
+ var ch = stream.next();
// comment
if(ch == ";") {
stream.skipToEnd();
@@ -136,7 +135,6 @@ CodeMirror.defineMode("asterisk", function() {
token: function(stream, state) {
var cur = '';
- var ch = '';
if(stream.eatSpace()) return null;
// extension started
if(state.extenStart){
@@ -170,7 +168,7 @@ CodeMirror.defineMode("asterisk", function() {
} else if(state.extenPriority) {
state.extenPriority = false;
state.extenApplication = true;
- ch = stream.next(); // get comma
+ stream.next(); // get comma
if(state.extenSame) return null;
stream.eatWhile(/[^,]/);
return "number";
diff --git a/public/vendor/codemirror/mode/clike/clike.js b/public/vendor/codemirror/mode/clike/clike.js
index b209910b..f1a7e7a9 100755
--- a/public/vendor/codemirror/mode/clike/clike.js
+++ b/public/vendor/codemirror/mode/clike/clike.js
@@ -16,15 +16,19 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
dontAlignCalls = parserConfig.dontAlignCalls,
keywords = parserConfig.keywords || {},
+ types = parserConfig.types || {},
builtin = parserConfig.builtin || {},
blockKeywords = parserConfig.blockKeywords || {},
+ defKeywords = parserConfig.defKeywords || {},
atoms = parserConfig.atoms || {},
hooks = parserConfig.hooks || {},
multiLineStrings = parserConfig.multiLineStrings,
- indentStatements = parserConfig.indentStatements !== false;
+ indentStatements = parserConfig.indentStatements !== false,
+ indentSwitch = parserConfig.indentSwitch !== false,
+ namespaceSeparator = parserConfig.namespaceSeparator;
var isOperatorChar = /[+\-*&%=<>!?|\/]/;
- var curPunc;
+ var curPunc, isDefKeyword;
function tokenBase(stream, state) {
var ch = stream.next();
@@ -59,11 +63,16 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
return "operator";
}
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
+ if (namespaceSeparator) while (stream.match(namespaceSeparator))
+ stream.eatWhile(/[\w\$_\xa1-\uffff]/);
+
var cur = stream.current();
if (keywords.propertyIsEnumerable(cur)) {
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
+ if (defKeywords.propertyIsEnumerable(cur)) isDefKeyword = true;
return "keyword";
}
+ if (types.propertyIsEnumerable(cur)) return "variable-3";
if (builtin.propertyIsEnumerable(cur)) {
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
return "builtin";
@@ -104,9 +113,12 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
this.align = align;
this.prev = prev;
}
+ function isStatement(type) {
+ return type == "statement" || type == "switchstatement" || type == "namespace";
+ }
function pushContext(state, col, type) {
var indent = state.indented;
- if (state.context && state.context.type == "statement")
+ if (state.context && isStatement(state.context.type) && !isStatement(type))
indent = state.context.indented;
return state.context = new Context(indent, col, type, null, state.context);
}
@@ -117,6 +129,19 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
return state.context = state.context.prev;
}
+ function typeBefore(stream, state) {
+ if (state.prevToken == "variable" || state.prevToken == "variable-3") return true;
+ if (/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(stream.string.slice(0, stream.start))) return true;
+ }
+
+ function isTopScope(context) {
+ for (;;) {
+ if (!context || context.type == "top") return true;
+ if (context.type == "}" && context.prev.type != "namespace") return false;
+ context = context.prev;
+ }
+ }
+
// Interface
return {
@@ -125,7 +150,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
tokenize: null,
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
indented: 0,
- startOfLine: true
+ startOfLine: true,
+ prevToken: null
};
},
@@ -137,41 +163,69 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
state.startOfLine = true;
}
if (stream.eatSpace()) return null;
- curPunc = null;
+ curPunc = isDefKeyword = null;
var style = (state.tokenize || tokenBase)(stream, state);
if (style == "comment" || style == "meta") return style;
if (ctx.align == null) ctx.align = true;
- if ((curPunc == ";" || curPunc == ":" || curPunc == ",") && ctx.type == "statement") popContext(state);
+ if ((curPunc == ";" || curPunc == ":" || curPunc == ","))
+ while (isStatement(state.context.type)) popContext(state);
else if (curPunc == "{") pushContext(state, stream.column(), "}");
else if (curPunc == "[") pushContext(state, stream.column(), "]");
else if (curPunc == "(") pushContext(state, stream.column(), ")");
else if (curPunc == "}") {
- while (ctx.type == "statement") ctx = popContext(state);
+ while (isStatement(ctx.type)) ctx = popContext(state);
if (ctx.type == "}") ctx = popContext(state);
- while (ctx.type == "statement") ctx = popContext(state);
+ while (isStatement(ctx.type)) ctx = popContext(state);
}
else if (curPunc == ctx.type) popContext(state);
else if (indentStatements &&
- (((ctx.type == "}" || ctx.type == "top") && curPunc != ';') ||
- (ctx.type == "statement" && curPunc == "newstatement")))
- pushContext(state, stream.column(), "statement");
+ (((ctx.type == "}" || ctx.type == "top") && curPunc != ";") ||
+ (isStatement(ctx.type) && curPunc == "newstatement"))) {
+ var type = "statement";
+ if (curPunc == "newstatement" && indentSwitch && stream.current() == "switch")
+ type = "switchstatement";
+ else if (style == "keyword" && stream.current() == "namespace")
+ type = "namespace";
+ pushContext(state, stream.column(), type);
+ }
+
+ if (style == "variable" &&
+ ((state.prevToken == "def" ||
+ (parserConfig.typeFirstDefinitions && typeBefore(stream, state) &&
+ isTopScope(state.context) && stream.match(/^\s*\(/, false)))))
+ style = "def";
+
+ if (hooks.token) {
+ var result = hooks.token(stream, state, style);
+ if (result !== undefined) style = result;
+ }
+
+ if (style == "def" && parserConfig.styleDefs === false) style = "variable";
+
state.startOfLine = false;
+ state.prevToken = isDefKeyword ? "def" : style || curPunc;
return style;
},
indent: function(state, textAfter) {
if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass;
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
- if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
+ if (isStatement(ctx.type) && firstChar == "}") ctx = ctx.prev;
var closing = firstChar == ctx.type;
- if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
- else if (ctx.align && (!dontAlignCalls || ctx.type != ")")) return ctx.column + (closing ? 0 : 1);
- else if (ctx.type == ")" && !closing) return ctx.indented + statementIndentUnit;
- else return ctx.indented + (closing ? 0 : indentUnit);
+ var switchBlock = ctx.prev && ctx.prev.type == "switchstatement";
+ if (isStatement(ctx.type))
+ return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
+ if (ctx.align && (!dontAlignCalls || ctx.type != ")"))
+ return ctx.column + (closing ? 0 : 1);
+ if (ctx.type == ")" && !closing)
+ return ctx.indented + statementIndentUnit;
+
+ return ctx.indented + (closing ? 0 : indentUnit) +
+ (!closing && switchBlock && !/^(?:case|default)\b/.test(textAfter) ? indentUnit : 0);
},
- electricChars: "{}",
+ electricInput: indentSwitch ? /^\s*(?:case .*?:|default:|\{\}?|\})$/ : /^\s*[{}]$/,
blockCommentStart: "/*",
blockCommentEnd: "*/",
lineComment: "//",
@@ -184,9 +238,10 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
return obj;
}
- var cKeywords = "auto if break int case long char register continue return default short do sizeof " +
- "double static else struct switch extern typedef float union for unsigned " +
- "goto while enum void const signed volatile";
+ var cKeywords = "auto if break case register continue return default do sizeof " +
+ "static else struct switch extern typedef float union for " +
+ "goto while enum const volatile";
+ var cTypes = "int long char short double float unsigned signed void size_t ptrdiff_t";
function cppHook(stream, state) {
if (!state.startOfLine) return false;
@@ -206,6 +261,11 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
return "meta";
}
+ function pointerHook(_stream, state) {
+ if (state.prevToken == "variable-3") return "variable-3";
+ return false;
+ }
+
function cpp11StringHook(stream, state) {
stream.backUp(1);
// Raw strings.
@@ -230,6 +290,11 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
return false;
}
+ function cppLooksLikeConstructor(word) {
+ var lastTwo = /(\w+)::(\w+)$/.exec(word);
+ return lastTwo && lastTwo[1] == lastTwo[2];
+ }
+
// C#-style strings where "" escapes a quote.
function tokenAtString(stream, state) {
var next;
@@ -263,6 +328,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
words.push(prop);
}
add(mode.keywords);
+ add(mode.types);
add(mode.builtin);
add(mode.atoms);
if (words.length) {
@@ -277,39 +343,60 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
def(["text/x-csrc", "text/x-c", "text/x-chdr"], {
name: "clike",
keywords: words(cKeywords),
+ types: words(cTypes + " bool _Complex _Bool float_t double_t intptr_t intmax_t " +
+ "int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t " +
+ "uint32_t uint64_t"),
blockKeywords: words("case do else for if switch while struct"),
- atoms: words("null"),
- hooks: {"#": cppHook},
+ defKeywords: words("struct"),
+ typeFirstDefinitions: true,
+ atoms: words("null true false"),
+ hooks: {"#": cppHook, "*": pointerHook},
modeProps: {fold: ["brace", "include"]}
});
def(["text/x-c++src", "text/x-c++hdr"], {
name: "clike",
- keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try bool explicit new " +
+ keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try explicit new " +
"static_cast typeid catch operator template typename class friend private " +
"this using const_cast inline public throw virtual delete mutable protected " +
- "wchar_t alignas alignof constexpr decltype nullptr noexcept thread_local final " +
+ "alignas alignof constexpr decltype nullptr noexcept thread_local final " +
"static_assert override"),
+ types: words(cTypes + " bool wchar_t"),
blockKeywords: words("catch class do else finally for if struct switch try while"),
+ defKeywords: words("class namespace struct enum union"),
+ typeFirstDefinitions: true,
atoms: words("true false null"),
hooks: {
"#": cppHook,
+ "*": pointerHook,
"u": cpp11StringHook,
"U": cpp11StringHook,
"L": cpp11StringHook,
- "R": cpp11StringHook
+ "R": cpp11StringHook,
+ token: function(stream, state, style) {
+ if (style == "variable" && stream.peek() == "(" &&
+ (state.prevToken == ";" || state.prevToken == null ||
+ state.prevToken == "}") &&
+ cppLooksLikeConstructor(stream.current()))
+ return "def";
+ }
},
+ namespaceSeparator: "::",
modeProps: {fold: ["brace", "include"]}
});
def("text/x-java", {
name: "clike",
- keywords: words("abstract assert boolean break byte case catch char class const continue default " +
- "do double else enum extends final finally float for goto if implements import " +
- "instanceof int interface long native new package private protected public " +
- "return short static strictfp super switch synchronized this throw throws transient " +
- "try void volatile while"),
+ keywords: words("abstract assert break case catch class const continue default " +
+ "do else enum extends final finally float for goto if implements import " +
+ "instanceof interface native new package private protected public " +
+ "return static strictfp super switch synchronized this throw throws transient " +
+ "try volatile while"),
+ types: words("byte short int long float double boolean char void Boolean Byte Character Double Float " +
+ "Integer Long Number Object Short String StringBuffer StringBuilder Void"),
blockKeywords: words("catch class do else finally for if switch try while"),
+ defKeywords: words("class interface package enum"),
+ typeFirstDefinitions: true,
atoms: words("true false null"),
hooks: {
"@": function(stream) {
@@ -322,18 +409,20 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
def("text/x-csharp", {
name: "clike",
- keywords: words("abstract as base break case catch checked class const continue" +
+ keywords: words("abstract as async await base break case catch checked class const continue" +
" default delegate do else enum event explicit extern finally fixed for" +
" foreach goto if implicit in interface internal is lock namespace new" +
" operator out override params private protected public readonly ref return sealed" +
" sizeof stackalloc static struct switch this throw try typeof unchecked" +
" unsafe using virtual void volatile while add alias ascending descending dynamic from get" +
" global group into join let orderby partial remove select set value var yield"),
+ types: words("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func" +
+ " Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32" +
+ " UInt64 bool byte char decimal double short int long object" +
+ " sbyte float string ushort uint ulong"),
blockKeywords: words("catch class do else finally for foreach if struct switch try while"),
- builtin: words("Boolean Byte Char DateTime DateTimeOffset Decimal Double" +
- " Guid Int16 Int32 Int64 Object SByte Single String TimeSpan UInt16 UInt32" +
- " UInt64 bool byte char decimal double short int long object" +
- " sbyte float string ushort uint ulong"),
+ defKeywords: words("class interface namespace struct var"),
+ typeFirstDefinitions: true,
atoms: words("true false null"),
hooks: {
"@": function(stream, state) {
@@ -366,18 +455,21 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
/* scala */
"abstract case catch class def do else extends false final finally for forSome if " +
"implicit import lazy match new null object override package private protected return " +
- "sealed super this throw trait try trye type val var while with yield _ : = => <- <: " +
+ "sealed super this throw trait try type val var while with yield _ : = => <- <: " +
"<% >: # @ " +
/* package scala */
"assert assume require print println printf readLine readBoolean readByte readShort " +
"readChar readInt readLong readFloat readDouble " +
+ ":: #:: "
+ ),
+ types: words(
"AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " +
"Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable " +
"Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering " +
"Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder " +
- "StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector :: #:: " +
+ "StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector " +
/* package java.lang */
"Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " +
@@ -387,8 +479,10 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
),
multiLineStrings: true,
blockKeywords: words("catch class do else finally for forSome if match switch try while"),
+ defKeywords: words("class def object package trait type val var"),
atoms: words("true false null"),
indentStatements: false,
+ indentSwitch: false,
hooks: {
"@": function(stream) {
stream.eatWhile(/[\w\$_]/);
@@ -409,15 +503,15 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
def(["x-shader/x-vertex", "x-shader/x-fragment"], {
name: "clike",
- keywords: words("float int bool void " +
- "vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 " +
- "mat2 mat3 mat4 " +
- "sampler1D sampler2D sampler3D samplerCube " +
+ keywords: words("sampler1D sampler2D sampler3D samplerCube " +
"sampler1DShadow sampler2DShadow " +
"const attribute uniform varying " +
"break continue discard return " +
"for while do if else struct " +
"in out inout"),
+ types: words("float int bool void " +
+ "vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 " +
+ "mat2 mat3 mat4"),
blockKeywords: words("for while do if else struct"),
builtin: words("radians degrees sin cos tan asin acos atan " +
"pow exp log exp2 sqrt inversesqrt " +
@@ -461,6 +555,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
"gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits " +
"gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits " +
"gl_MaxDrawBuffers"),
+ indentSwitch: false,
hooks: {"#": cppHook},
modeProps: {fold: ["brace", "include"]}
});
@@ -470,8 +565,9 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
keywords: words(cKeywords + "as atomic async call command component components configuration event generic " +
"implementation includes interface module new norace nx_struct nx_union post provides " +
"signal task uses abstract extends"),
+ types: words(cTypes),
blockKeywords: words("case do else for if switch while struct"),
- atoms: words("null"),
+ atoms: words("null true false"),
hooks: {"#": cppHook},
modeProps: {fold: ["brace", "include"]}
});
@@ -480,7 +576,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
name: "clike",
keywords: words(cKeywords + "inline restrict _Bool _Complex _Imaginery BOOL Class bycopy byref id IMP in " +
"inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),
- atoms: words("YES NO NULL NILL ON OFF"),
+ types: words(cTypes),
+ atoms: words("YES NO NULL NILL ON OFF true false"),
hooks: {
"@": function(stream) {
stream.eatWhile(/[\w\$]/);
diff --git a/public/vendor/codemirror/mode/clike/test.js b/public/vendor/codemirror/mode/clike/test.js
new file mode 100755
index 00000000..79b006de
--- /dev/null
+++ b/public/vendor/codemirror/mode/clike/test.js
@@ -0,0 +1,33 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function() {
+ var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-c");
+ function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+ MT("indent",
+ "[variable-3 void] [def foo]([variable-3 void*] [variable a], [variable-3 int] [variable b]) {",
+ " [variable-3 int] [variable c] [operator =] [variable b] [operator +]",
+ " [number 1];",
+ " [keyword return] [operator *][variable a];",
+ "}");
+
+ MT("indent_switch",
+ "[keyword switch] ([variable x]) {",
+ " [keyword case] [number 10]:",
+ " [keyword return] [number 20];",
+ " [keyword default]:",
+ " [variable printf]([string \"foo %c\"], [variable x]);",
+ "}");
+
+ MT("def",
+ "[variable-3 void] [def foo]() {}",
+ "[keyword struct] [def bar]{}",
+ "[variable-3 int] [variable-3 *][def baz]() {}");
+
+ MT("double_block",
+ "[keyword for] (;;)",
+ " [keyword for] (;;)",
+ " [variable x][operator ++];",
+ "[keyword return];");
+})();
diff --git a/public/vendor/codemirror/mode/css/css.js b/public/vendor/codemirror/mode/css/css.js
index 7fc9098f..1e6d2ddb 100755
--- a/public/vendor/codemirror/mode/css/css.js
+++ b/public/vendor/codemirror/mode/css/css.js
@@ -329,7 +329,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
if (type == "}") return popContext(state);
if (type == "{" || type == ";") return popAndPass(type, stream, state);
if (type == "word") override = "variable";
- else if (type != "variable") override = "error";
+ else if (type != "variable" && type != "(" && type != ")") override = "error";
return "interpolation";
};
@@ -653,16 +653,6 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
return ["comment", "comment"];
}
- function tokenSGMLComment(stream, state) {
- if (stream.skipTo("-->")) {
- stream.match("-->");
- state.tokenize = null;
- } else {
- stream.skipToEnd();
- }
- return ["comment", "comment"];
- }
-
CodeMirror.defineMIME("text/css", {
documentTypes: documentTypes,
mediaTypes: mediaTypes,
@@ -674,11 +664,6 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
colorKeywords: colorKeywords,
valueKeywords: valueKeywords,
tokenHooks: {
- "<": function(stream, state) {
- if (!stream.match("!--")) return false;
- state.tokenize = tokenSGMLComment;
- return tokenSGMLComment(stream, state);
- },
"/": function(stream, state) {
if (!stream.eat("*")) return false;
state.tokenize = tokenCComment;
diff --git a/public/vendor/codemirror/mode/css/test.js b/public/vendor/codemirror/mode/css/test.js
index bef71561..55ae676e 100755
--- a/public/vendor/codemirror/mode/css/test.js
+++ b/public/vendor/codemirror/mode/css/test.js
@@ -76,13 +76,6 @@
MT("tagTwoPropertiesURL",
"[tag foo] { [property background]: [atom url]([string //example.com/foo.png]); [property padding]: [number 0]; }");
- MT("commentSGML",
- "[comment <!--comment-->]");
-
- MT("commentSGML2",
- "[comment <!--comment]",
- "[comment -->] [tag div] {}");
-
MT("indent_tagSelector",
"[tag strong], [tag em] {",
" [property background]: [atom rgba](",
diff --git a/public/vendor/codemirror/mode/cypher/cypher.js b/public/vendor/codemirror/mode/cypher/cypher.js
index 9decf307..e218d473 100755
--- a/public/vendor/codemirror/mode/cypher/cypher.js
+++ b/public/vendor/codemirror/mode/cypher/cypher.js
@@ -19,7 +19,7 @@
CodeMirror.defineMode("cypher", function(config) {
var tokenBase = function(stream/*, state*/) {
- var ch = stream.next(), curPunc = null;
+ var ch = stream.next();
if (ch === "\"" || ch === "'") {
stream.match(/.+?["']/);
return "string";
diff --git a/public/vendor/codemirror/mode/dylan/dylan.js b/public/vendor/codemirror/mode/dylan/dylan.js
index be2986ad..85f0166c 100755
--- a/public/vendor/codemirror/mode/dylan/dylan.js
+++ b/public/vendor/codemirror/mode/dylan/dylan.js
@@ -154,20 +154,12 @@ CodeMirror.defineMode("dylan", function(_config) {
return f(stream, state);
}
- var type, content;
-
- function ret(_type, style, _content) {
- type = _type;
- content = _content;
- return style;
- }
-
function tokenBase(stream, state) {
// String
var ch = stream.peek();
if (ch == "'" || ch == '"') {
stream.next();
- return chain(stream, state, tokenString(ch, "string", "string"));
+ return chain(stream, state, tokenString(ch, "string"));
}
// Comment
else if (ch == "/") {
@@ -176,16 +168,16 @@ CodeMirror.defineMode("dylan", function(_config) {
return chain(stream, state, tokenComment);
} else if (stream.eat("/")) {
stream.skipToEnd();
- return ret("comment", "comment");
+ return "comment";
} else {
stream.skipTo(" ");
- return ret("operator", "operator");
+ return "operator";
}
}
// Decimal
else if (/\d/.test(ch)) {
stream.match(/^\d*(?:\.\d*)?(?:e[+\-]?\d+)?/);
- return ret("number", "number");
+ return "number";
}
// Hash
else if (ch == "#") {
@@ -194,33 +186,33 @@ CodeMirror.defineMode("dylan", function(_config) {
ch = stream.peek();
if (ch == '"') {
stream.next();
- return chain(stream, state, tokenString('"', "symbol", "string-2"));
+ return chain(stream, state, tokenString('"', "string-2"));
}
// Binary number
else if (ch == "b") {
stream.next();
stream.eatWhile(/[01]/);
- return ret("number", "number");
+ return "number";
}
// Hex number
else if (ch == "x") {
stream.next();
stream.eatWhile(/[\da-f]/i);
- return ret("number", "number");
+ return "number";
}
// Octal number
else if (ch == "o") {
stream.next();
stream.eatWhile(/[0-7]/);
- return ret("number", "number");
+ return "number";
}
// Hash symbol
else {
stream.eatWhile(/[-a-zA-Z]/);
- return ret("hash", "keyword");
+ return "keyword";
}
} else if (stream.match("end")) {
- return ret("end", "keyword");
+ return "keyword";
}
for (var name in patterns) {
if (patterns.hasOwnProperty(name)) {
@@ -228,21 +220,21 @@ CodeMirror.defineMode("dylan", function(_config) {
if ((pattern instanceof Array && pattern.some(function(p) {
return stream.match(p);
})) || stream.match(pattern))
- return ret(name, patternStyles[name], stream.current());
+ return patternStyles[name];
}
}
if (stream.match("define")) {
- return ret("definition", "def");
+ return "def";
} else {
stream.eatWhile(/[\w\-]/);
// Keyword
if (wordLookup[stream.current()]) {
- return ret(wordLookup[stream.current()], styleLookup[stream.current()], stream.current());
+ return styleLookup[stream.current()];
} else if (stream.current().match(symbol)) {
- return ret("variable", "variable");
+ return "variable";
} else {
stream.next();
- return ret("other", "variable-2");
+ return "variable-2";
}
}
}
@@ -257,10 +249,10 @@ CodeMirror.defineMode("dylan", function(_config) {
}
maybeEnd = (ch == "*");
}
- return ret("comment", "comment");
+ return "comment";
}
- function tokenString(quote, type, style) {
+ function tokenString(quote, style) {
return function(stream, state) {
var next, end = false;
while ((next = stream.next()) != null) {
@@ -271,7 +263,7 @@ CodeMirror.defineMode("dylan", function(_config) {
}
if (end)
state.tokenize = tokenBase;
- return ret(type, style);
+ return style;
};
}
diff --git a/public/vendor/codemirror/mode/ecl/ecl.js b/public/vendor/codemirror/mode/ecl/ecl.js
index 18778f16..8df7ebe4 100755
--- a/public/vendor/codemirror/mode/ecl/ecl.js
+++ b/public/vendor/codemirror/mode/ecl/ecl.js
@@ -34,7 +34,6 @@ CodeMirror.defineMode("ecl", function(config) {
var blockKeywords = words("catch class do else finally for if switch try while");
var atoms = words("true false null");
var hooks = {"#": metaHook};
- var multiLineStrings;
var isOperatorChar = /[+\-*&%=<>!?|\/]/;
var curPunc;
@@ -112,7 +111,7 @@ CodeMirror.defineMode("ecl", function(config) {
if (next == quote && !escaped) {end = true; break;}
escaped = !escaped && next == "\\";
}
- if (end || !(escaped || multiLineStrings))
+ if (end || !escaped)
state.tokenize = tokenBase;
return "string";
};
diff --git a/public/vendor/codemirror/mode/eiffel/eiffel.js b/public/vendor/codemirror/mode/eiffel/eiffel.js
index fcdf295c..b8b70e36 100755
--- a/public/vendor/codemirror/mode/eiffel/eiffel.js
+++ b/public/vendor/codemirror/mode/eiffel/eiffel.js
@@ -84,7 +84,6 @@ CodeMirror.defineMode("eiffel", function() {
'or'
]);
var operators = wordObj([":=", "and then","and", "or","<<",">>"]);
- var curPunc;
function chain(newtok, stream, state) {
state.tokenize.push(newtok);
@@ -92,7 +91,6 @@ CodeMirror.defineMode("eiffel", function() {
}
function tokenBase(stream, state) {
- curPunc = null;
if (stream.eatSpace()) return null;
var ch = stream.next();
if (ch == '"'||ch == "'") {
diff --git a/public/vendor/codemirror/mode/elm/elm.js b/public/vendor/codemirror/mode/elm/elm.js
new file mode 100755
index 00000000..7124c50a
--- /dev/null
+++ b/public/vendor/codemirror/mode/elm/elm.js
@@ -0,0 +1,205 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+ "use strict";
+
+ CodeMirror.defineMode("elm", function() {
+
+ function switchState(source, setState, f) {
+ setState(f);
+ return f(source, setState);
+ }
+
+ // These should all be Unicode extended, as per the Haskell 2010 report
+ var smallRE = /[a-z_]/;
+ var largeRE = /[A-Z]/;
+ var digitRE = /[0-9]/;
+ var hexitRE = /[0-9A-Fa-f]/;
+ var octitRE = /[0-7]/;
+ var idRE = /[a-z_A-Z0-9\']/;
+ var symbolRE = /[-!#$%&*+.\/<=>?@\\^|~:\u03BB\u2192]/;
+ var specialRE = /[(),;[\]`{}]/;
+ var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer
+
+ function normal() {
+ return function (source, setState) {
+ if (source.eatWhile(whiteCharRE)) {
+ return null;
+ }
+
+ var ch = source.next();
+ if (specialRE.test(ch)) {
+ if (ch == '{' && source.eat('-')) {
+ var t = "comment";
+ if (source.eat('#')) t = "meta";
+ return switchState(source, setState, ncomment(t, 1));
+ }
+ return null;
+ }
+
+ if (ch == '\'') {
+ if (source.eat('\\'))
+ source.next(); // should handle other escapes here
+ else
+ source.next();
+
+ if (source.eat('\''))
+ return "string";
+ return "error";
+ }
+
+ if (ch == '"') {
+ return switchState(source, setState, stringLiteral);
+ }
+
+ if (largeRE.test(ch)) {
+ source.eatWhile(idRE);
+ if (source.eat('.'))
+ return "qualifier";
+ return "variable-2";
+ }
+
+ if (smallRE.test(ch)) {
+ var isDef = source.pos === 1;
+ source.eatWhile(idRE);
+ return isDef ? "variable-3" : "variable";
+ }
+
+ if (digitRE.test(ch)) {
+ if (ch == '0') {
+ if (source.eat(/[xX]/)) {
+ source.eatWhile(hexitRE); // should require at least 1
+ return "integer";
+ }
+ if (source.eat(/[oO]/)) {
+ source.eatWhile(octitRE); // should require at least 1
+ return "number";
+ }
+ }
+ source.eatWhile(digitRE);
+ var t = "number";
+ if (source.eat('.')) {
+ t = "number";
+ source.eatWhile(digitRE); // should require at least 1
+ }
+ if (source.eat(/[eE]/)) {
+ t = "number";
+ source.eat(/[-+]/);
+ source.eatWhile(digitRE); // should require at least 1
+ }
+ return t;
+ }
+
+ if (symbolRE.test(ch)) {
+ if (ch == '-' && source.eat(/-/)) {
+ source.eatWhile(/-/);
+ if (!source.eat(symbolRE)) {
+ source.skipToEnd();
+ return "comment";
+ }
+ }
+ source.eatWhile(symbolRE);
+ return "builtin";
+ }
+
+ return "error";
+ }
+ }
+
+ function ncomment(type, nest) {
+ if (nest == 0) {
+ return normal();
+ }
+ return function(source, setState) {
+ var currNest = nest;
+ while (!source.eol()) {
+ var ch = source.next();
+ if (ch == '{' && source.eat('-')) {
+ ++currNest;
+ } else if (ch == '-' && source.eat('}')) {
+ --currNest;
+ if (currNest == 0) {
+ setState(normal());
+ return type;
+ }
+ }
+ }
+ setState(ncomment(type, currNest));
+ return type;
+ }
+ }
+
+ function stringLiteral(source, setState) {
+ while (!source.eol()) {
+ var ch = source.next();
+ if (ch == '"') {
+ setState(normal());
+ return "string";
+ }
+ if (ch == '\\') {
+ if (source.eol() || source.eat(whiteCharRE)) {
+ setState(stringGap);
+ return "string";
+ }
+ if (!source.eat('&')) source.next(); // should handle other escapes here
+ }
+ }
+ setState(normal());
+ return "error";
+ }
+
+ function stringGap(source, setState) {
+ if (source.eat('\\')) {
+ return switchState(source, setState, stringLiteral);
+ }
+ source.next();
+ setState(normal());
+ return "error";
+ }
+
+
+ var wellKnownWords = (function() {
+ var wkw = {};
+
+ var keywords = [
+ "case", "of", "as",
+ "if", "then", "else",
+ "let", "in",
+ "infix", "infixl", "infixr",
+ "type", "alias",
+ "input", "output", "foreign", "loopback",
+ "module", "where", "import", "exposing",
+ "_", "..", "|", ":", "=", "\\", "\"", "->", "<-"
+ ];
+
+ for (var i = keywords.length; i--;)
+ wkw[keywords[i]] = "keyword";
+
+ return wkw;
+ })();
+
+
+
+ return {
+ startState: function () { return { f: normal() }; },
+ copyState: function (s) { return { f: s.f }; },
+
+ token: function(stream, state) {
+ var t = state.f(stream, function(s) { state.f = s; });
+ var w = stream.current();
+ return (wellKnownWords.hasOwnProperty(w)) ? wellKnownWords[w] : t;
+ }
+ };
+
+ });
+
+ CodeMirror.defineMIME("text/x-elm", "elm");
+})();
diff --git a/public/vendor/codemirror/mode/elm/index.html b/public/vendor/codemirror/mode/elm/index.html
new file mode 100755
index 00000000..d5cb16ab
--- /dev/null
+++ b/public/vendor/codemirror/mode/elm/index.html
@@ -0,0 +1,61 @@
+<!doctype html>
+
+<title>CodeMirror: Elm mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="elm.js"></script>
+<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+ <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/codemirror/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">Elm</a>
+ </ul>
+</div>
+
+<article>
+<h2>Elm mode</h2>
+
+<div><textarea id="code" name="code">
+import Color exposing (..)
+import Graphics.Collage exposing (..)
+import Graphics.Element exposing (..)
+import Time exposing (..)
+
+main =
+ Signal.map clock (every second)
+
+clock t =
+ collage 400 400
+ [ filled lightGrey (ngon 12 110)
+ , outlined (solid grey) (ngon 12 110)
+ , hand orange 100 t
+ , hand charcoal 100 (t/60)
+ , hand charcoal 60 (t/720)
+ ]
+
+hand clr len time =
+ let angle = degrees (90 - 6 * inSeconds time)
+ in
+ segment (0,0) (fromPolar (len,angle))
+ |> traced (solid clr)
+</textarea></div>
+
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ lineNumbers: true,
+ mode: "text/x-elm"
+ });
+ </script>
+
+ <p><strong>MIME types defined:</strong> <code>text/x-elm</code>.</p>
+ </article>
diff --git a/public/vendor/codemirror/mode/factor/factor.js b/public/vendor/codemirror/mode/factor/factor.js
new file mode 100755
index 00000000..86d7adf6
--- /dev/null
+++ b/public/vendor/codemirror/mode/factor/factor.js
@@ -0,0 +1,83 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+// Factor syntax highlight - simple mode
+//
+// by Dimage Sapelkin (https://github.com/kerabromsmu)
+
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"), require("../../addon/mode/simple"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror", "../../addon/mode/simple"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+ "use strict";
+
+ CodeMirror.defineSimpleMode("factor", {
+ // The start state contains the rules that are intially used
+ start: [
+ // comments
+ {regex: /#?!.*/, token: "comment"},
+ // strings """, multiline --> state
+ {regex: /"""/, token: "string", next: "string3"},
+ {regex: /"/, token: "string", next: "string"},
+ // numbers: dec, hex, unicode, bin, fractional, complex
+ {regex: /(?:[+-]?)(?:0x[\d,a-f]+)|(?:0o[0-7]+)|(?:0b[0,1]+)|(?:\d+.?\d*)/, token: "number"},
+ //{regex: /[+-]?/} //fractional
+ // definition: defining word, defined word, etc
+ {regex: /(\:)(\s+)(\S+)(\s+)(\()/, token: ["keyword", null, "def", null, "keyword"], next: "stack"},
+ // vocabulary using --> state
+ {regex: /USING\:/, token: "keyword", next: "vocabulary"},
+ // vocabulary definition/use
+ {regex: /(USE\:|IN\:)(\s+)(\S+)/, token: ["keyword", null, "variable-2"]},
+ // <constructors>
+ {regex: /<\S+>/, token: "builtin"},
+ // "keywords", incl. ; t f . [ ] { } defining words
+ {regex: /;|t|f|if|\.|\[|\]|\{|\}|MAIN:/, token: "keyword"},
+ // any id (?)
+ {regex: /\S+/, token: "variable"},
+
+ {
+ regex: /./,
+ token: null
+ }
+ ],
+ vocabulary: [
+ {regex: /;/, token: "keyword", next: "start"},
+ {regex: /\S+/, token: "variable-2"},
+ {
+ regex: /./,
+ token: null
+ }
+ ],
+ string: [
+ {regex: /(?:[^\\]|\\.)*?"/, token: "string", next: "start"},
+ {regex: /.*/, token: "string"}
+ ],
+ string3: [
+ {regex: /(?:[^\\]|\\.)*?"""/, token: "string", next: "start"},
+ {regex: /.*/, token: "string"}
+ ],
+ stack: [
+ {regex: /\)/, token: "meta", next: "start"},
+ {regex: /--/, token: "meta"},
+ {regex: /\S+/, token: "variable-3"},
+ {
+ regex: /./,
+ token: null
+ }
+ ],
+ // The meta property contains global information about the mode. It
+ // can contain properties like lineComment, which are supported by
+ // all modes, and also directives like dontIndentStates, which are
+ // specific to simple modes.
+ meta: {
+ dontIndentStates: ["start", "vocabulary", "string", "string3", "stack"],
+ lineComment: [ "!", "#!" ]
+ }
+ });
+
+ CodeMirror.defineMIME("text/x-factor", "factor");
+});
diff --git a/public/vendor/codemirror/mode/factor/index.html b/public/vendor/codemirror/mode/factor/index.html
new file mode 100755
index 00000000..9f154891
--- /dev/null
+++ b/public/vendor/codemirror/mode/factor/index.html
@@ -0,0 +1,77 @@
+<!doctype html>
+
+<title>CodeMirror: Factor mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link href='http://fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css'>
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/mode/simple.js"></script>
+<script src="factor.js"></script>
+<style>
+.CodeMirror {
+ font-family: 'Droid Sans Mono', monospace;
+ font-size: 14px;
+}
+</style>
+<div id=nav>
+ <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/codemirror/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">Factor</a>
+ </ul>
+</div>
+
+<article>
+
+<h2>Factor mode</h2>
+
+<form><textarea id="code" name="code">
+! Copyright (C) 2008 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+
+! A simple time server
+
+USING: accessors calendar calendar.format io io.encodings.ascii
+io.servers kernel threads ;
+IN: time-server
+
+: handle-time-client ( -- )
+ now timestamp>rfc822 print ;
+
+: <time-server> ( -- threaded-server )
+ ascii <threaded-server>
+ "time-server" >>name
+ 1234 >>insecure
+ [ handle-time-client ] >>handler ;
+
+: start-time-server ( -- )
+ <time-server> start-server drop ;
+
+MAIN: start-time-server
+</textarea>
+ </form>
+
+<script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ lineNumbers: true,
+ lineWrapping: true,
+ indentUnit: 2,
+ tabSize: 2,
+ autofocus: true,
+ mode: "text/x-factor"
+ });
+</script>
+<p/>
+<p>Simple mode that handles Factor Syntax (<a href="http://en.wikipedia.org/wiki/Factor_(programming_language)">Factor on WikiPedia</a>).</p>
+
+<p><strong>MIME types defined:</strong> <code>text/x-factor</code>.</p>
+
+</article>
diff --git a/public/vendor/codemirror/mode/groovy/groovy.js b/public/vendor/codemirror/mode/groovy/groovy.js
index e3a1db86..721933b0 100755
--- a/public/vendor/codemirror/mode/groovy/groovy.js
+++ b/public/vendor/codemirror/mode/groovy/groovy.js
@@ -24,6 +24,7 @@ CodeMirror.defineMode("groovy", function(config) {
"short static strictfp super switch synchronized threadsafe throw throws transient " +
"try void volatile while");
var blockKeywords = words("catch class do else finally for if switch try while enum interface def");
+ var standaloneKeywords = words("return break continue");
var atoms = words("null true false this");
var curPunc;
@@ -50,7 +51,7 @@ CodeMirror.defineMode("groovy", function(config) {
stream.skipToEnd();
return "comment";
}
- if (expectExpression(state.lastToken)) {
+ if (expectExpression(state.lastToken, false)) {
return startString(ch, stream, state);
}
}
@@ -70,6 +71,7 @@ CodeMirror.defineMode("groovy", function(config) {
if (atoms.propertyIsEnumerable(cur)) { return "atom"; }
if (keywords.propertyIsEnumerable(cur)) {
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
+ else if (standaloneKeywords.propertyIsEnumerable(cur)) curPunc = "standalone";
return "keyword";
}
return "variable";
@@ -132,9 +134,10 @@ CodeMirror.defineMode("groovy", function(config) {
return "comment";
}
- function expectExpression(last) {
+ function expectExpression(last, newline) {
return !last || last == "operator" || last == "->" || /[\.\[\{\(,;:]/.test(last) ||
- last == "newstatement" || last == "keyword" || last == "proplabel";
+ last == "newstatement" || last == "keyword" || last == "proplabel" ||
+ (last == "standalone" && !newline);
}
function Context(indented, column, type, align, prev) {
@@ -174,7 +177,7 @@ CodeMirror.defineMode("groovy", function(config) {
state.indented = stream.indentation();
state.startOfLine = true;
// Automatic semicolon insertion
- if (ctx.type == "statement" && !expectExpression(state.lastToken)) {
+ if (ctx.type == "statement" && !expectExpression(state.lastToken, true)) {
popContext(state); ctx = state.context;
}
}
@@ -209,7 +212,7 @@ CodeMirror.defineMode("groovy", function(config) {
indent: function(state, textAfter) {
if (!state.tokenize[state.tokenize.length-1].isBase) return 0;
var firstChar = textAfter && textAfter.charAt(0), ctx = state.context;
- if (ctx.type == "statement" && !expectExpression(state.lastToken)) ctx = ctx.prev;
+ if (ctx.type == "statement" && !expectExpression(state.lastToken, true)) ctx = ctx.prev;
var closing = firstChar == ctx.type;
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : config.indentUnit);
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
diff --git a/public/vendor/codemirror/mode/htmlmixed/htmlmixed.js b/public/vendor/codemirror/mode/htmlmixed/htmlmixed.js
index 1cc438f0..24552e2d 100755
--- a/public/vendor/codemirror/mode/htmlmixed/htmlmixed.js
+++ b/public/vendor/codemirror/mode/htmlmixed/htmlmixed.js
@@ -57,9 +57,9 @@ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
}
function maybeBackup(stream, pat, style) {
var cur = stream.current();
- var close = cur.search(pat), m;
+ var close = cur.search(pat);
if (close > -1) stream.backUp(cur.length - close);
- else if (m = cur.match(/<\/?$/)) {
+ else if (cur.match(/<\/?$/)) {
stream.backUp(cur.length);
if (!stream.match(pat, false)) stream.match(cur);
}
diff --git a/public/vendor/codemirror/mode/index.html b/public/vendor/codemirror/mode/index.html
index 245595de..8c6d0a43 100755
--- a/public/vendor/codemirror/mode/index.html
+++ b/public/vendor/codemirror/mode/index.html
@@ -31,6 +31,7 @@ option.</p>
<div style="-webkit-columns: 100px 2; -moz-columns: 100px 2; columns: 100px 2;">
<ul style="margin-top: 0">
<li><a href="apl/index.html">APL</a></li>
+ <li><a href="asn.1/index.html">ASN.1</a></li>
<li><a href="asterisk/index.html">Asterisk dialplan</a></li>
<li><a href="clike/index.html">C, C++, C#</a></li>
<li><a href="clojure/index.html">Clojure</a></li>
@@ -51,7 +52,9 @@ option.</p>
<li><a href="ebnf/index.html">EBNF</a></li>
<li><a href="ecl/index.html">ECL</a></li>
<li><a href="eiffel/index.html">Eiffel</a></li>
+ <li><a href="elm/index.html">Elm</a></li>
<li><a href="erlang/index.html">Erlang</a></li>
+ <li><a href="factor/index.html">Factor</a></li>
<li><a href="forth/index.html">Forth</a></li>
<li><a href="fortran/index.html">Fortran</a></li>
<li><a href="mllike/index.html">F#</a></li>
@@ -63,6 +66,7 @@ option.</p>
<li><a href="handlebars/index.html">Handlebars</a></li>
<li><a href="haskell/index.html">Haskell</a></li>
<li><a href="haxe/index.html">Haxe</a></li>
+ <li><a href="htmlembedded/index.html">HTML embedded</a> (JSP, ASP.NET)</li>
<li><a href="htmlmixed/index.html">HTML mixed-mode</a></li>
<li><a href="http/index.html">HTTP</a></li>
<li><a href="idl/index.html">IDL</a></li>
@@ -76,6 +80,7 @@ option.</p>
<li><a href="livescript/index.html">LiveScript</a></li>
<li><a href="lua/index.html">Lua</a></li>
<li><a href="markdown/index.html">Markdown</a> (<a href="gfm/index.html">GitHub-flavour</a>)</li>
+ <li><a href="mathematica/index.html">Mathematica</a></li>
<li><a href="mirc/index.html">mIRC</a></li>
<li><a href="modelica/index.html">Modelica</a></li>
<li><a href="mumps/index.html">MUMPS</a></li>
@@ -114,6 +119,7 @@ option.</p>
<li><a href="stylus/index.html">Stylus</a></li>
<li><a href="sql/index.html">SQL</a> (several dialects)</li>
<li><a href="sparql/index.html">SPARQL</a></li>
+ <li><a href="swift/index.html">Swift</a></li>
<li><a href="stex/index.html">sTeX, LaTeX</a></li>
<li><a href="tcl/index.html">Tcl</a></li>
<li><a href="textile/index.html">Textile</a></li>
@@ -122,7 +128,10 @@ option.</p>
<li><a href="toml/index.html">TOML</a></li>
<li><a href="tornado/index.html">Tornado</a> (templating language)</li>
<li><a href="troff/index.html">troff</a> (for manpages)</li>
+ <li><a href="ttcn/index.html">TTCN</a></li>
+ <li><a href="ttcn-cfg/index.html">TTCN Configuration</a></li>
<li><a href="turtle/index.html">Turtle</a></li>
+ <li><a href="twig/index.html">Twig</a></li>
<li><a href="vb/index.html">VB.NET</a></li>
<li><a href="vbscript/index.html">VBScript</a></li>
<li><a href="velocity/index.html">Velocity</a></li>
diff --git a/public/vendor/codemirror/mode/javascript/javascript.js b/public/vendor/codemirror/mode/javascript/javascript.js
index ef018478..c86f49e1 100755
--- a/public/vendor/codemirror/mode/javascript/javascript.js
+++ b/public/vendor/codemirror/mode/javascript/javascript.js
@@ -482,8 +482,11 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
function maybetype(type) {
if (isTS && type == ":") return cont(typedef);
}
+ function maybedefault(_, value) {
+ if (value == "=") return cont(expressionNoComma);
+ }
function typedef(type) {
- if (type == "variable"){cx.marked = "variable-3"; return cont();}
+ if (type == "variable") {cx.marked = "variable-3"; return cont();}
}
function vardef() {
return pass(pattern, maybetype, maybeAssign, vardefCont);
@@ -538,7 +541,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
}
function funarg(type) {
if (type == "spread") return cont(funarg);
- return pass(pattern, maybetype);
+ return pass(pattern, maybetype, maybedefault);
}
function className(type, value) {
if (type == "variable") {register(value); return cont(classNameAfter);}
diff --git a/public/vendor/codemirror/mode/javascript/test.js b/public/vendor/codemirror/mode/javascript/test.js
index 91b0e89a..092d25dc 100755
--- a/public/vendor/codemirror/mode/javascript/test.js
+++ b/public/vendor/codemirror/mode/javascript/test.js
@@ -160,6 +160,11 @@
"]];",
"[number 10];");
+ MT("param_default",
+ "[keyword function] [variable foo]([def x] [operator =] [string-2 `foo${][number 10][string-2 }bar`]) {",
+ " [keyword return] [variable-2 x];",
+ "}");
+
var jsonld_mode = CodeMirror.getMode(
{indentUnit: 2},
{name: "javascript", jsonld: true}
diff --git a/public/vendor/codemirror/mode/julia/julia.js b/public/vendor/codemirror/mode/julia/julia.js
index e854988a..d0a74cef 100755
--- a/public/vendor/codemirror/mode/julia/julia.js
+++ b/public/vendor/codemirror/mode/julia/julia.js
@@ -34,7 +34,6 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
var closers = wordRegexp(blockClosers);
var macro = /^@[_A-Za-z][_A-Za-z0-9]*/;
var symbol = /^:[_A-Za-z][_A-Za-z0-9]*/;
- var indentInfo = null;
function in_array(state) {
var ch = cur_scope(state);
@@ -247,7 +246,6 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) {
}
function tokenLexer(stream, state) {
- indentInfo = null;
var style = state.tokenize(stream, state);
var current = stream.current();
diff --git a/public/vendor/codemirror/mode/kotlin/kotlin.js b/public/vendor/codemirror/mode/kotlin/kotlin.js
index 1efec85d..e9a6a94e 100755
--- a/public/vendor/codemirror/mode/kotlin/kotlin.js
+++ b/public/vendor/codemirror/mode/kotlin/kotlin.js
@@ -21,7 +21,7 @@ CodeMirror.defineMode("kotlin", function (config, parserConfig) {
var multiLineStrings = parserConfig.multiLineStrings;
var keywords = words(
- "package continue return object while break class data trait throw super" +
+ "package continue return object while break class data trait interface throw super" +
" when type this else This try val var fun for is in if do as true false null get set");
var softKeywords = words("import" +
" where by get set abstract enum open annotation override private public internal" +
@@ -272,7 +272,10 @@ CodeMirror.defineMode("kotlin", function (config, parserConfig) {
},
closeBrackets: {triples: "'\""},
- electricChars: "{}"
+ electricChars: "{}",
+ blockCommentStart: "/*",
+ blockCommentEnd: "*/",
+ lineComment: "//"
};
});
diff --git a/public/vendor/codemirror/mode/livescript/livescript.js b/public/vendor/codemirror/mode/livescript/livescript.js
index 55882efc..4b26e046 100755
--- a/public/vendor/codemirror/mode/livescript/livescript.js
+++ b/public/vendor/codemirror/mode/livescript/livescript.js
@@ -24,8 +24,8 @@
var nr = Rules[next_rule];
if (nr.splice) {
for (var i$ = 0; i$ < nr.length; ++i$) {
- var r = nr[i$], m;
- if (r.regex && (m = stream.match(r.regex))) {
+ var r = nr[i$];
+ if (r.regex && stream.match(r.regex)) {
state.next = r.next || state.next;
return r.token;
}
diff --git a/public/vendor/codemirror/mode/markdown/markdown.js b/public/vendor/codemirror/mode/markdown/markdown.js
index bc5314fc..bef37b8a 100755
--- a/public/vendor/codemirror/mode/markdown/markdown.js
+++ b/public/vendor/codemirror/mode/markdown/markdown.js
@@ -68,12 +68,12 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
, strong = 'strong'
, strikethrough = 'strikethrough';
- var hrRE = /^([*\-=_])(?:\s*\1){2,}\s*$/
+ var hrRE = /^([*\-_])(?:\s*\1){2,}\s*$/
, ulRE = /^[*\-+]\s+/
- , olRE = /^[0-9]+\.\s+/
+ , olRE = /^[0-9]+([.)])\s+/
, taskListRE = /^\[(x| )\](?=\s)/ // Must follow ulRE or olRE
- , atxHeaderRE = /^#+ ?/
- , setextHeaderRE = /^(?:\={1,}|-{1,})$/
+ , atxHeaderRE = /^(#+)(?: |$)/
+ , setextHeaderRE = /^ *(?:\={1,}|-{1,})\s*$/
, textRE = /^[^#!\[\]*_\\<>` "'(~]+/;
function switchInline(stream, state, f) {
@@ -100,6 +100,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
state.strikethrough = false;
// Reset state.quote
state.quote = 0;
+ // Reset state.indentedCode
+ state.indentedCode = false;
if (!htmlFound && state.f == htmlBlock) {
state.f = inlineNormal;
state.block = blockNormal;
@@ -116,7 +118,11 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
var sol = stream.sol();
- var prevLineIsList = state.list !== false;
+ var prevLineIsList = state.list !== false,
+ prevLineIsIndentedCode = state.indentedCode;
+
+ state.indentedCode = false;
+
if (prevLineIsList) {
if (state.indentationDiff >= 0) { // Continued list
if (state.indentationDiff < 4) { // Only adjust indentation if *not* a code block
@@ -134,23 +140,27 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
var match = null;
if (state.indentationDiff >= 4) {
- state.indentation -= 4;
stream.skipToEnd();
- return code;
+ if (prevLineIsIndentedCode || !state.prevLineHasContent) {
+ state.indentation -= 4;
+ state.indentedCode = true;
+ return code;
+ } else {
+ return null;
+ }
} else if (stream.eatSpace()) {
return null;
- } else if (match = stream.match(atxHeaderRE)) {
- state.header = Math.min(6, match[0].indexOf(" ") !== -1 ? match[0].length - 1 : match[0].length);
+ } else if ((match = stream.match(atxHeaderRE)) && match[1].length <= 6) {
+ state.header = match[1].length;
if (modeCfg.highlightFormatting) state.formatting = "header";
state.f = state.inline;
return getType(state);
- } else if (state.prevLineHasContent && (match = stream.match(setextHeaderRE))) {
+ } else if (state.prevLineHasContent && !state.quote && !prevLineIsList && !prevLineIsIndentedCode && (match = stream.match(setextHeaderRE))) {
state.header = match[0].charAt(0) == '=' ? 1 : 2;
if (modeCfg.highlightFormatting) state.formatting = "header";
state.f = state.inline;
return getType(state);
} else if (stream.eat('>')) {
- state.indentation++;
state.quote = sol ? 1 : state.quote + 1;
if (modeCfg.highlightFormatting) state.formatting = "quote";
stream.eatSpace();
@@ -158,6 +168,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
} else if (stream.peek() === '[') {
return switchInline(stream, state, footnoteLink);
} else if (stream.match(hrRE, true)) {
+ state.hr = true;
return hr;
} else if ((!state.prevLineHasContent || prevLineIsList) && (stream.match(ulRE, false) || stream.match(olRE, false))) {
var listType = null;
@@ -262,17 +273,16 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
}
if (state.linkHref) {
- styles.push(linkhref);
- return styles.length ? styles.join(' ') : null;
- }
+ styles.push(linkhref, "url");
+ } else { // Only apply inline styles to non-url text
+ if (state.strong) { styles.push(strong); }
+ if (state.em) { styles.push(em); }
+ if (state.strikethrough) { styles.push(strikethrough); }
- if (state.strong) { styles.push(strong); }
- if (state.em) { styles.push(em); }
- if (state.strikethrough) { styles.push(strikethrough); }
+ if (state.linkText) { styles.push(linktext); }
- if (state.linkText) { styles.push(linktext); }
-
- if (state.code) { styles.push(code); }
+ if (state.code) { styles.push(code); }
+ }
if (state.header) { styles.push(header); styles.push(header + "-" + state.header); }
@@ -626,7 +636,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true);
}
state.f = state.inline = inlineNormal;
- return linkhref;
+ return linkhref + " url";
}
var savedInlineRE = [];
@@ -663,6 +673,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
em: false,
strong: false,
header: 0,
+ hr: false,
taskList: false,
list: false,
listDepth: 0,
@@ -695,10 +706,12 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
strong: s.strong,
strikethrough: s.strikethrough,
header: s.header,
+ hr: s.hr,
taskList: s.taskList,
list: s.list,
listDepth: s.listDepth,
quote: s.quote,
+ indentedCode: s.indentedCode,
trailingSpace: s.trailingSpace,
trailingSpaceNewLine: s.trailingSpaceNewLine,
md_inside: s.md_inside
@@ -711,10 +724,11 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
state.formatting = false;
if (stream.sol()) {
- var forceBlankLine = !!state.header;
+ var forceBlankLine = !!state.header || state.hr;
- // Reset state.header
+ // Reset state.header and state.hr
state.header = 0;
+ state.hr = false;
if (stream.match(/^\s*$/, true) || forceBlankLine) {
state.prevLineHasContent = false;
diff --git a/public/vendor/codemirror/mode/markdown/test.js b/public/vendor/codemirror/mode/markdown/test.js
index 7bc687f0..7cd0bf4b 100755
--- a/public/vendor/codemirror/mode/markdown/test.js
+++ b/public/vendor/codemirror/mode/markdown/test.js
@@ -41,11 +41,11 @@
"[variable-2&formatting&formatting-list&formatting-list-ol 1. ][variable-2 foo]");
FT("formatting_link",
- "[link&formatting&formatting-link [][link foo][link&formatting&formatting-link ]]][string&formatting&formatting-link-string (][string http://example.com/][string&formatting&formatting-link-string )]");
+ "[link&formatting&formatting-link [][link foo][link&formatting&formatting-link ]]][string&formatting&formatting-link-string&url (][string&url http://example.com/][string&formatting&formatting-link-string&url )]");
FT("formatting_linkReference",
- "[link&formatting&formatting-link [][link foo][link&formatting&formatting-link ]]][string&formatting&formatting-link-string [][string bar][string&formatting&formatting-link-string ]]]",
- "[link&formatting&formatting-link [][link bar][link&formatting&formatting-link ]]:] [string http://example.com/]");
+ "[link&formatting&formatting-link [][link foo][link&formatting&formatting-link ]]][string&formatting&formatting-link-string&url [][string&url bar][string&formatting&formatting-link-string&url ]]]",
+ "[link&formatting&formatting-link [][link bar][link&formatting&formatting-link ]]:] [string&url http://example.com/]");
FT("formatting_linkWeb",
"[link&formatting&formatting-link <][link http://example.com/][link&formatting&formatting-link >]");
@@ -85,13 +85,6 @@
" [comment foo]",
"bar");
- // Code blocks using 4 spaces with internal indentation
- MT("codeBlocksUsing4SpacesIndentation",
- " foo",
- " [comment bar]",
- " [comment hello]",
- " [comment world]");
-
// Code blocks should end even after extra indented lines
MT("codeBlocksWithTrailingIndentedLine",
" [comment foo]",
@@ -104,6 +97,12 @@
MT("codeBlocksUsing1Tab",
"\t[comment foo]");
+ // No code blocks directly after paragraph
+ // http://spec.commonmark.org/0.19/#example-65
+ MT("noCodeBlocksAfterParagraph",
+ "Foo",
+ " Bar");
+
// Inline code using backticks
MT("inlineCodeUsingBackticks",
"foo [comment `bar`]");
@@ -166,10 +165,13 @@
MT("atxH6",
"[header&header-6 ###### foo]");
- // H6 - 7x '#' should still be H6, per Dingus
- // http://daringfireball.net/projects/markdown/dingus
- MT("atxH6NotH7",
- "[header&header-6 ####### foo]");
+ // http://spec.commonmark.org/0.19/#example-24
+ MT("noAtxH7",
+ "####### foo");
+
+ // http://spec.commonmark.org/0.19/#example-25
+ MT("noAtxH1WithoutSpace",
+ "#5 bolt");
// Inline styles should be parsed inside headers
MT("atxH1inline",
@@ -202,6 +204,25 @@
"foo",
"[header&header-2 ---]");
+ // http://spec.commonmark.org/0.19/#example-45
+ MT("setextH2AllowSpaces",
+ "foo",
+ " [header&header-2 ---- ]");
+
+ // http://spec.commonmark.org/0.19/#example-44
+ MT("noSetextAfterIndentedCodeBlock",
+ " [comment foo]",
+ "[hr ---]");
+
+ // http://spec.commonmark.org/0.19/#example-51
+ MT("noSetextAfterQuote",
+ "[quote&quote-1 > foo]",
+ "[hr ---]");
+
+ MT("noSetextAfterList",
+ "[variable-2 - foo]",
+ "[hr ---]");
+
// Single-line blockquote with trailing space
MT("blockquoteSpace",
"[quote&quote-1 > foo]");
@@ -251,6 +272,13 @@
"",
"hello");
+ // Header with leading space after continued blockquote (#3287, negative indentation)
+ MT("headerAfterContinuedBlockquote",
+ "[quote&quote-1 > foo]",
+ "[quote&quote-1 bar]",
+ "",
+ " [header&header-1 # hello]");
+
// Check list types
MT("listAsterisk",
@@ -287,11 +315,21 @@
"1. bar",
"2. hello");
+ // List after hr
+ MT("listAfterHr",
+ "[hr ---]",
+ "[variable-2 - bar]");
+
// List after header
MT("listAfterHeader",
"[header&header-1 # foo]",
"[variable-2 - bar]");
+ // hr after list
+ MT("hrAfterList",
+ "[variable-2 - foo]",
+ "[hr -----]");
+
// Formatting in lists (*)
MT("listAsteriskFormatting",
"[variable-2 * ][variable-2&em *foo*][variable-2 bar]",
@@ -498,39 +536,39 @@
// Inline link with title
MT("linkTitle",
- "[link [[foo]]][string (http://example.com/ \"bar\")] hello");
+ "[link [[foo]]][string&url (http://example.com/ \"bar\")] hello");
// Inline link without title
MT("linkNoTitle",
- "[link [[foo]]][string (http://example.com/)] bar");
+ "[link [[foo]]][string&url (http://example.com/)] bar");
// Inline link with image
MT("linkImage",
- "[link [[][tag ![[foo]]][string (http://example.com/)][link ]]][string (http://example.com/)] bar");
+ "[link [[][tag ![[foo]]][string&url (http://example.com/)][link ]]][string&url (http://example.com/)] bar");
// Inline link with Em
MT("linkEm",
- "[link [[][link&em *foo*][link ]]][string (http://example.com/)] bar");
+ "[link [[][link&em *foo*][link ]]][string&url (http://example.com/)] bar");
// Inline link with Strong
MT("linkStrong",
- "[link [[][link&strong **foo**][link ]]][string (http://example.com/)] bar");
+ "[link [[][link&strong **foo**][link ]]][string&url (http://example.com/)] bar");
// Inline link with EmStrong
MT("linkEmStrong",
- "[link [[][link&strong **][link&em&strong *foo**][link&em *][link ]]][string (http://example.com/)] bar");
+ "[link [[][link&strong **][link&em&strong *foo**][link&em *][link ]]][string&url (http://example.com/)] bar");
// Image with title
MT("imageTitle",
- "[tag ![[foo]]][string (http://example.com/ \"bar\")] hello");
+ "[tag ![[foo]]][string&url (http://example.com/ \"bar\")] hello");
// Image without title
MT("imageNoTitle",
- "[tag ![[foo]]][string (http://example.com/)] bar");
+ "[tag ![[foo]]][string&url (http://example.com/)] bar");
// Image with asterisks
MT("imageAsterisks",
- "[tag ![[*foo*]]][string (http://example.com/)] bar");
+ "[tag ![[*foo*]]][string&url (http://example.com/)] bar");
// Not a link. Should be normal text due to square brackets being used
// regularly in text, especially in quoted material, and no space is allowed
@@ -540,24 +578,24 @@
// Reference-style links
MT("linkReference",
- "[link [[foo]]][string [[bar]]] hello");
+ "[link [[foo]]][string&url [[bar]]] hello");
// Reference-style links with Em
MT("linkReferenceEm",
- "[link [[][link&em *foo*][link ]]][string [[bar]]] hello");
+ "[link [[][link&em *foo*][link ]]][string&url [[bar]]] hello");
// Reference-style links with Strong
MT("linkReferenceStrong",
- "[link [[][link&strong **foo**][link ]]][string [[bar]]] hello");
+ "[link [[][link&strong **foo**][link ]]][string&url [[bar]]] hello");
// Reference-style links with EmStrong
MT("linkReferenceEmStrong",
- "[link [[][link&strong **][link&em&strong *foo**][link&em *][link ]]][string [[bar]]] hello");
+ "[link [[][link&strong **][link&em&strong *foo**][link&em *][link ]]][string&url [[bar]]] hello");
// Reference-style links with optional space separator (per docuentation)
// "You can optionally use a space to separate the sets of brackets"
MT("linkReferenceSpace",
- "[link [[foo]]] [string [[bar]]] hello");
+ "[link [[foo]]] [string&url [[bar]]] hello");
// Should only allow a single space ("...use *a* space...")
MT("linkReferenceDoubleSpace",
@@ -565,7 +603,7 @@
// Reference-style links with implicit link name
MT("linkImplicit",
- "[link [[foo]]][string [[]]] hello");
+ "[link [[foo]]][string&url [[]]] hello");
// @todo It would be nice if, at some point, the document was actually
// checked to see if the referenced link exists
@@ -573,46 +611,46 @@
// Link label, for reference-style links (taken from documentation)
MT("labelNoTitle",
- "[link [[foo]]:] [string http://example.com/]");
+ "[link [[foo]]:] [string&url http://example.com/]");
MT("labelIndented",
- " [link [[foo]]:] [string http://example.com/]");
+ " [link [[foo]]:] [string&url http://example.com/]");
MT("labelSpaceTitle",
- "[link [[foo bar]]:] [string http://example.com/ \"hello\"]");
+ "[link [[foo bar]]:] [string&url http://example.com/ \"hello\"]");
MT("labelDoubleTitle",
- "[link [[foo bar]]:] [string http://example.com/ \"hello\"] \"world\"");
+ "[link [[foo bar]]:] [string&url http://example.com/ \"hello\"] \"world\"");
MT("labelTitleDoubleQuotes",
- "[link [[foo]]:] [string http://example.com/ \"bar\"]");
+ "[link [[foo]]:] [string&url http://example.com/ \"bar\"]");
MT("labelTitleSingleQuotes",
- "[link [[foo]]:] [string http://example.com/ 'bar']");
+ "[link [[foo]]:] [string&url http://example.com/ 'bar']");
MT("labelTitleParenthese",
- "[link [[foo]]:] [string http://example.com/ (bar)]");
+ "[link [[foo]]:] [string&url http://example.com/ (bar)]");
MT("labelTitleInvalid",
- "[link [[foo]]:] [string http://example.com/] bar");
+ "[link [[foo]]:] [string&url http://example.com/] bar");
MT("labelLinkAngleBrackets",
- "[link [[foo]]:] [string <http://example.com/> \"bar\"]");
+ "[link [[foo]]:] [string&url <http://example.com/> \"bar\"]");
MT("labelTitleNextDoubleQuotes",
- "[link [[foo]]:] [string http://example.com/]",
+ "[link [[foo]]:] [string&url http://example.com/]",
"[string \"bar\"] hello");
MT("labelTitleNextSingleQuotes",
- "[link [[foo]]:] [string http://example.com/]",
+ "[link [[foo]]:] [string&url http://example.com/]",
"[string 'bar'] hello");
MT("labelTitleNextParenthese",
- "[link [[foo]]:] [string http://example.com/]",
+ "[link [[foo]]:] [string&url http://example.com/]",
"[string (bar)] hello");
MT("labelTitleNextMixed",
- "[link [[foo]]:] [string http://example.com/]",
+ "[link [[foo]]:] [string&url http://example.com/]",
"(bar\" hello");
MT("linkWeb",
diff --git a/public/vendor/codemirror/mode/mathematica/index.html b/public/vendor/codemirror/mode/mathematica/index.html
new file mode 100755
index 00000000..57c42985
--- /dev/null
+++ b/public/vendor/codemirror/mode/mathematica/index.html
@@ -0,0 +1,72 @@
+<!doctype html>
+
+<title>CodeMirror: Mathematica mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel=stylesheet href=../../lib/codemirror.css>
+<script src=../../lib/codemirror.js></script>
+<script src=../../addon/edit/matchbrackets.js></script>
+<script src=mathematica.js></script>
+<style type=text/css>
+ .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+</style>
+<div id=nav>
+ <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/codemirror/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">Mathematica</a>
+ </ul>
+</div>
+
+<article>
+<h2>Mathematica mode</h2>
+
+
+<textarea id="mathematicaCode">
+(* example Mathematica code *)
+(* Dualisiert wird anhand einer Polarität an einer
+ Quadrik $x^t Q x = 0$ mit regulärer Matrix $Q$ (also
+ mit $det(Q) \neq 0$), z.B. die Identitätsmatrix.
+ $p$ ist eine Liste von Polynomen - ein Ideal. *)
+dualize::"singular" = "Q must be regular: found Det[Q]==0.";
+dualize[ Q_, p_ ] := Block[
+ { m, n, xv, lv, uv, vars, polys, dual },
+ If[Det[Q] == 0,
+ Message[dualize::"singular"],
+ m = Length[p];
+ n = Length[Q] - 1;
+ xv = Table[Subscript[x, i], {i, 0, n}];
+ lv = Table[Subscript[l, i], {i, 1, m}];
+ uv = Table[Subscript[u, i], {i, 0, n}];
+ (* Konstruiere Ideal polys. *)
+ If[m == 0,
+ polys = Q.uv,
+ polys = Join[p, Q.uv - Transpose[Outer[D, p, xv]].lv]
+ ];
+ (* Eliminiere die ersten n + 1 + m Variablen xv und lv
+ aus dem Ideal polys. *)
+ vars = Join[xv, lv];
+ dual = GroebnerBasis[polys, uv, vars];
+ (* Ersetze u mit x im Ergebnis. *)
+ ReplaceAll[dual, Rule[u, x]]
+ ]
+ ]
+</textarea>
+
+<script>
+ var mathematicaEditor = CodeMirror.fromTextArea(document.getElementById('mathematicaCode'), {
+ mode: 'text/x-mathematica',
+ lineNumbers: true,
+ matchBrackets: true
+ });
+</script>
+
+<p><strong>MIME types defined:</strong> <code>text/x-mathematica</code> (Mathematica).</p>
+</article>
diff --git a/public/vendor/codemirror/mode/mathematica/mathematica.js b/public/vendor/codemirror/mode/mathematica/mathematica.js
new file mode 100755
index 00000000..5ae6f55c
--- /dev/null
+++ b/public/vendor/codemirror/mode/mathematica/mathematica.js
@@ -0,0 +1,175 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+// Mathematica mode copyright (c) 2015 by Calin Barbat
+// Based on code by Patrick Scheibe (halirutan)
+// See: https://github.com/halirutan/Mathematica-Source-Highlighting/tree/master/src/lang-mma.js
+
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+CodeMirror.defineMode('mathematica', function(_config, _parserConfig) {
+
+ // used pattern building blocks
+ var Identifier = '[a-zA-Z\\$][a-zA-Z0-9\\$]*';
+ var pBase = "(?:\\d+)";
+ var pFloat = "(?:\\.\\d+|\\d+\\.\\d*|\\d+)";
+ var pFloatBase = "(?:\\.\\w+|\\w+\\.\\w*|\\w+)";
+ var pPrecision = "(?:`(?:`?"+pFloat+")?)";
+
+ // regular expressions
+ var reBaseForm = new RegExp('(?:'+pBase+'(?:\\^\\^'+pFloatBase+pPrecision+'?(?:\\*\\^[+-]?\\d+)?))');
+ var reFloatForm = new RegExp('(?:' + pFloat + pPrecision + '?(?:\\*\\^[+-]?\\d+)?)');
+ var reIdInContext = new RegExp('(?:`?)(?:' + Identifier + ')(?:`(?:' + Identifier + '))*(?:`?)');
+
+ function tokenBase(stream, state) {
+ var ch;
+
+ // get next character
+ ch = stream.next();
+
+ // string
+ if (ch === '"') {
+ state.tokenize = tokenString;
+ return state.tokenize(stream, state);
+ }
+
+ // comment
+ if (ch === '(') {
+ if (stream.eat('*')) {
+ state.commentLevel++;
+ state.tokenize = tokenComment;
+ return state.tokenize(stream, state);
+ }
+ }
+
+ // go back one character
+ stream.backUp(1);
+
+ // look for numbers
+ // Numbers in a baseform
+ if (stream.match(reBaseForm, true, false)) {
+ return 'number';
+ }
+
+ // Mathematica numbers. Floats (1.2, .2, 1.) can have optionally a precision (`float) or an accuracy definition
+ // (``float). Note: while 1.2` is possible 1.2`` is not. At the end an exponent (float*^+12) can follow.
+ if (stream.match(reFloatForm, true, false)) {
+ return 'number';
+ }
+
+ /* In[23] and Out[34] */
+ if (stream.match(/(?:In|Out)\[[0-9]*\]/, true, false)) {
+ return 'atom';
+ }
+
+ // usage
+ if (stream.match(/([a-zA-Z\$]+(?:`?[a-zA-Z0-9\$])*::usage)/, true, false)) {
+ return 'meta';
+ }
+
+ // message
+ if (stream.match(/([a-zA-Z\$]+(?:`?[a-zA-Z0-9\$])*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/, true, false)) {
+ return 'string-2';
+ }
+
+ // this makes a look-ahead match for something like variable:{_Integer}
+ // the match is then forwarded to the mma-patterns tokenizer.
+ if (stream.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/, true, false)) {
+ return 'variable-2';
+ }
+
+ // catch variables which are used together with Blank (_), BlankSequence (__) or BlankNullSequence (___)
+ // Cannot start with a number, but can have numbers at any other position. Examples
+ // blub__Integer, a1_, b34_Integer32
+ if (stream.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/, true, false)) {
+ return 'variable-2';
+ }
+ if (stream.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/, true, false)) {
+ return 'variable-2';
+ }
+ if (stream.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/, true, false)) {
+ return 'variable-2';
+ }
+
+ // Named characters in Mathematica, like \[Gamma].
+ if (stream.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/, true, false)) {
+ return 'variable-3';
+ }
+
+ // Match all braces separately
+ if (stream.match(/(?:\[|\]|{|}|\(|\))/, true, false)) {
+ return 'bracket';
+ }
+
+ // Catch Slots (#, ##, #3, ##9 and the V10 named slots #name). I have never seen someone using more than one digit after #, so we match
+ // only one.
+ if (stream.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/, true, false)) {
+ return 'variable-2';
+ }
+
+ // Literals like variables, keywords, functions
+ if (stream.match(reIdInContext, true, false)) {
+ return 'keyword';
+ }
+
+ // operators. Note that operators like @@ or /; are matched separately for each symbol.
+ if (stream.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/, true, false)) {
+ return 'operator';
+ }
+
+ // everything else is an error
+ return 'error';
+ }
+
+ function tokenString(stream, state) {
+ var next, end = false, escaped = false;
+ while ((next = stream.next()) != null) {
+ if (next === '"' && !escaped) {
+ end = true;
+ break;
+ }
+ escaped = !escaped && next === '\\';
+ }
+ if (end && !escaped) {
+ state.tokenize = tokenBase;
+ }
+ return 'string';
+ };
+
+ function tokenComment(stream, state) {
+ var prev, next;
+ while(state.commentLevel > 0 && (next = stream.next()) != null) {
+ if (prev === '(' && next === '*') state.commentLevel++;
+ if (prev === '*' && next === ')') state.commentLevel--;
+ prev = next;
+ }
+ if (state.commentLevel <= 0) {
+ state.tokenize = tokenBase;
+ }
+ return 'comment';
+ }
+
+ return {
+ startState: function() {return {tokenize: tokenBase, commentLevel: 0};},
+ token: function(stream, state) {
+ if (stream.eatSpace()) return null;
+ return state.tokenize(stream, state);
+ },
+ blockCommentStart: "(*",
+ blockCommentEnd: "*)"
+ };
+});
+
+CodeMirror.defineMIME('text/x-mathematica', {
+ name: 'mathematica'
+});
+
+});
diff --git a/public/vendor/codemirror/mode/meta.js b/public/vendor/codemirror/mode/meta.js
index 6c988e22..bb30c80f 100755
--- a/public/vendor/codemirror/mode/meta.js
+++ b/public/vendor/codemirror/mode/meta.js
@@ -14,6 +14,7 @@
CodeMirror.modeInfo = [
{name: "APL", mime: "text/apl", mode: "apl", ext: ["dyalog", "apl"]},
{name: "PGP", mimes: ["application/pgp", "application/pgp-keys", "application/pgp-signature"], mode: "asciiarmor", ext: ["pgp"]},
+ {name: "ASN.1", mime: "text/x-ttcn-asn", mode: "asn.1", ext: ["asn, asn1"]},
{name: "Asterisk", mime: "text/x-asterisk", mode: "asterisk", file: /^extensions\.conf$/i},
{name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h"]},
{name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"], alias: ["cpp"]},
@@ -37,9 +38,11 @@
{name: "EBNF", mime: "text/x-ebnf", mode: "ebnf"},
{name: "ECL", mime: "text/x-ecl", mode: "ecl", ext: ["ecl"]},
{name: "Eiffel", mime: "text/x-eiffel", mode: "eiffel", ext: ["e"]},
+ {name: "Elm", mime: "text/x-elm", mode: "elm", ext: ["elm"]},
{name: "Embedded Javascript", mime: "application/x-ejs", mode: "htmlembedded", ext: ["ejs"]},
{name: "Embedded Ruby", mime: "application/x-erb", mode: "htmlembedded", ext: ["erb"]},
{name: "Erlang", mime: "text/x-erlang", mode: "erlang", ext: ["erl"]},
+ {name: "Factor", mime: "text/x-factor", mode: "factor", ext: ["factor"]},
{name: "Forth", mime: "text/x-forth", mode: "forth", ext: ["forth", "fth", "4th"]},
{name: "Fortran", mime: "text/x-fortran", mode: "fortran", ext: ["f", "for", "f77", "f90"]},
{name: "F#", mime: "text/x-fsharp", mode: "mllike", ext: ["fs"], alias: ["fsharp"]},
@@ -72,6 +75,7 @@
{name: "Markdown", mime: "text/x-markdown", mode: "markdown", ext: ["markdown", "md", "mkd"]},
{name: "mIRC", mime: "text/mirc", mode: "mirc"},
{name: "MariaDB SQL", mime: "text/x-mariadb", mode: "sql"},
+ {name: "Mathematica", mime: "text/x-mathematica", mode: "mathematica", ext: ["m", "nb"]},
{name: "Modelica", mime: "text/x-modelica", mode: "modelica", ext: ["mo"]},
{name: "MUMPS", mime: "text/x-mumps", mode: "mumps"},
{name: "MS SQL", mime: "text/x-mssql", mode: "sql"},
@@ -112,6 +116,7 @@
{name: "SPARQL", mime: "application/sparql-query", mode: "sparql", ext: ["rq", "sparql"], alias: ["sparul"]},
{name: "Spreadsheet", mime: "text/x-spreadsheet", mode: "spreadsheet", alias: ["excel", "formula"]},
{name: "SQL", mime: "text/x-sql", mode: "sql", ext: ["sql"]},
+ {name: "Swift", mime: "text/x-swift", mode: "swift", ext: ["swift"]},
{name: "MariaDB", mime: "text/x-mariadb", mode: "sql"},
{name: "sTeX", mime: "text/x-stex", mode: "stex"},
{name: "LaTeX", mime: "text/x-latex", mode: "stex", ext: ["text", "ltx"], alias: ["tex"]},
@@ -123,8 +128,11 @@
{name: "TOML", mime: "text/x-toml", mode: "toml", ext: ["toml"]},
{name: "Tornado", mime: "text/x-tornado", mode: "tornado"},
{name: "troff", mime: "troff", mode: "troff", ext: ["1", "2", "3", "4", "5", "6", "7", "8", "9"]},
+ {name: "TTCN", mime: "text/x-ttcn", mode: "ttcn", ext: ["ttcn", "ttcn3", "ttcnpp"]},
+ {name: "TTCN_CFG", mime: "text/x-ttcn-cfg", mode: "ttcn-cfg", ext: ["cfg"]},
{name: "Turtle", mime: "text/turtle", mode: "turtle", ext: ["ttl"]},
{name: "TypeScript", mime: "application/typescript", mode: "javascript", ext: ["ts"], alias: ["ts"]},
+ {name: "Twig", mime: "text/x-twig", mode: "twig"},
{name: "VB.NET", mime: "text/x-vb", mode: "vb", ext: ["vb"]},
{name: "VBScript", mime: "text/vbscript", mode: "vbscript", ext: ["vbs"]},
{name: "Velocity", mime: "text/velocity", mode: "velocity", ext: ["vtl"]},
diff --git a/public/vendor/codemirror/mode/php/php.js b/public/vendor/codemirror/mode/php/php.js
index e112d911..0c3f21e5 100755
--- a/public/vendor/codemirror/mode/php/php.js
+++ b/public/vendor/codemirror/mode/php/php.js
@@ -17,31 +17,31 @@
return obj;
}
- // Helper for stringWithEscapes
- function matchSequence(list, end) {
- if (list.length == 0) return stringWithEscapes(end);
+ // Helper for phpString
+ function matchSequence(list, end, escapes) {
+ if (list.length == 0) return phpString(end);
return function (stream, state) {
var patterns = list[0];
for (var i = 0; i < patterns.length; i++) if (stream.match(patterns[i][0])) {
state.tokenize = matchSequence(list.slice(1), end);
return patterns[i][1];
}
- state.tokenize = stringWithEscapes(end);
+ state.tokenize = phpString(end, escapes);
return "string";
};
}
- function stringWithEscapes(closing) {
- return function(stream, state) { return stringWithEscapes_(stream, state, closing); };
+ function phpString(closing, escapes) {
+ return function(stream, state) { return phpString_(stream, state, closing, escapes); };
}
- function stringWithEscapes_(stream, state, closing) {
+ function phpString_(stream, state, closing, escapes) {
// "Complex" syntax
- if (stream.match("${", false) || stream.match("{$", false)) {
+ if (escapes !== false && stream.match("${", false) || stream.match("{$", false)) {
state.tokenize = null;
return "string";
}
// Simple syntax
- if (stream.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/)) {
+ if (escapes !== false && stream.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/)) {
// After the variable name there may appear array or object operator.
if (stream.match("[", false)) {
// Match array operator
@@ -51,14 +51,14 @@
[/\$[a-zA-Z_][a-zA-Z0-9_]*/, "variable-2"],
[/[\w\$]+/, "variable"]],
[["]", null]]
- ], closing);
+ ], closing, escapes);
}
if (stream.match(/\-\>\w/, false)) {
// Match object operator
state.tokenize = matchSequence([
[["->", null]],
[[/[\w]+/, "variable"]]
- ], closing);
+ ], closing, escapes);
}
return "variable-2";
}
@@ -66,8 +66,9 @@
var escaped = false;
// Normal string
while (!stream.eol() &&
- (escaped || (!stream.match("{$", false) &&
- !stream.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/, false)))) {
+ (escaped || escapes === false ||
+ (!stream.match("{$", false) &&
+ !stream.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/, false)))) {
if (!escaped && stream.match(closing)) {
state.tokenize = null;
state.tokStack.pop(); state.tokStack.pop();
@@ -94,6 +95,7 @@
helperType: "php",
keywords: keywords(phpKeywords),
blockKeywords: keywords("catch do else elseif for foreach if switch try while finally"),
+ defKeywords: keywords("class function interface namespace trait"),
atoms: keywords(phpAtoms),
builtin: keywords(phpBuiltin),
multiLineStrings: true,
@@ -104,11 +106,13 @@
},
"<": function(stream, state) {
if (stream.match(/<</)) {
+ var nowDoc = stream.eat("'");
stream.eatWhile(/[\w\.]/);
- var delim = stream.current().slice(3);
+ var delim = stream.current().slice(3 + (nowDoc ? 1 : 0));
+ if (nowDoc) stream.eat("'");
if (delim) {
(state.tokStack || (state.tokStack = [])).push(delim, 0);
- state.tokenize = stringWithEscapes(delim);
+ state.tokenize = phpString(delim, nowDoc ? false : true);
return "string";
}
}
@@ -127,7 +131,7 @@
},
'"': function(_stream, state) {
(state.tokStack || (state.tokStack = [])).push('"', 0);
- state.tokenize = stringWithEscapes('"');
+ state.tokenize = phpString('"');
return "string";
},
"{": function(_stream, state) {
@@ -138,7 +142,7 @@
"}": function(_stream, state) {
if (state.tokStack && state.tokStack.length > 0 &&
!--state.tokStack[state.tokStack.length - 1]) {
- state.tokenize = stringWithEscapes(state.tokStack[state.tokStack.length - 2]);
+ state.tokenize = phpString(state.tokStack[state.tokStack.length - 2]);
}
return false;
}
diff --git a/public/vendor/codemirror/mode/pig/pig.js b/public/vendor/codemirror/mode/pig/pig.js
index c74b2cc8..5b567272 100755
--- a/public/vendor/codemirror/mode/pig/pig.js
+++ b/public/vendor/codemirror/mode/pig/pig.js
@@ -30,12 +30,6 @@ CodeMirror.defineMode("pig", function(_config, parserConfig) {
return f(stream, state);
}
- var type;
- function ret(tp, style) {
- type = tp;
- return style;
- }
-
function tokenComment(stream, state) {
var isEnd = false;
var ch;
@@ -46,7 +40,7 @@ CodeMirror.defineMode("pig", function(_config, parserConfig) {
}
isEnd = (ch == "*");
}
- return ret("comment", "comment");
+ return "comment";
}
function tokenString(quote) {
@@ -60,10 +54,11 @@ CodeMirror.defineMode("pig", function(_config, parserConfig) {
}
if (end || !(escaped || multiLineStrings))
state.tokenize = tokenBase;
- return ret("string", "error");
+ return "error";
};
}
+
function tokenBase(stream, state) {
var ch = stream.next();
@@ -72,11 +67,11 @@ CodeMirror.defineMode("pig", function(_config, parserConfig) {
return chain(stream, state, tokenString(ch));
// is it one of the special chars
else if(/[\[\]{}\(\),;\.]/.test(ch))
- return ret(ch);
+ return null;
// is it a number?
else if(/\d/.test(ch)) {
stream.eatWhile(/[\w\.]/);
- return ret("number", "number");
+ return "number";
}
// multi line comment or operator
else if (ch == "/") {
@@ -85,47 +80,42 @@ CodeMirror.defineMode("pig", function(_config, parserConfig) {
}
else {
stream.eatWhile(isOperatorChar);
- return ret("operator", "operator");
+ return "operator";
}
}
// single line comment or operator
else if (ch=="-") {
if(stream.eat("-")){
stream.skipToEnd();
- return ret("comment", "comment");
+ return "comment";
}
else {
stream.eatWhile(isOperatorChar);
- return ret("operator", "operator");
+ return "operator";
}
}
// is it an operator
else if (isOperatorChar.test(ch)) {
stream.eatWhile(isOperatorChar);
- return ret("operator", "operator");
+ return "operator";
}
else {
// get the while word
stream.eatWhile(/[\w\$_]/);
// is it one of the listed keywords?
if (keywords && keywords.propertyIsEnumerable(stream.current().toUpperCase())) {
- if (stream.eat(")") || stream.eat(".")) {
- //keywords can be used as variables like flatten(group), group.$0 etc..
- }
- else {
- return ("keyword", "keyword");
- }
+ //keywords can be used as variables like flatten(group), group.$0 etc..
+ if (!stream.eat(")") && !stream.eat("."))
+ return "keyword";
}
// is it one of the builtin functions?
if (builtins && builtins.propertyIsEnumerable(stream.current().toUpperCase()))
- {
- return ("keyword", "variable-2");
- }
+ return "variable-2";
// is it one of the listed types?
if (types && types.propertyIsEnumerable(stream.current().toUpperCase()))
- return ("keyword", "variable-3");
+ return "variable-3";
// default is a 'variable'
- return ret("variable", "pig-word");
+ return "variable";
}
}
diff --git a/public/vendor/codemirror/mode/python/python.js b/public/vendor/codemirror/mode/python/python.js
index cdb58bbb..e5a09719 100755
--- a/public/vendor/codemirror/mode/python/python.js
+++ b/public/vendor/codemirror/mode/python/python.js
@@ -37,7 +37,7 @@
"unichr", "unicode", "xrange", "False", "True", "None"],
keywords: ["exec", "print"]};
var py3 = {builtins: ["ascii", "bytes", "exec", "print"],
- keywords: ["nonlocal", "False", "True", "None"]};
+ keywords: ["nonlocal", "False", "True", "None", "async", "await"]};
CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins));
diff --git a/public/vendor/codemirror/mode/sql/sql.js b/public/vendor/codemirror/mode/sql/sql.js
index fb1c6cb5..a9082771 100755
--- a/public/vendor/codemirror/mode/sql/sql.js
+++ b/public/vendor/codemirror/mode/sql/sql.js
@@ -257,7 +257,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
}
// these keywords are used by all SQL dialects (however, a mode can still overwrite it)
- var sqlKeywords = "alter and as asc between by count create delete desc distinct drop from having in insert into is join like not on or order select set table union update values where ";
+ var sqlKeywords = "alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where ";
// turn a space-separated list into an array
function set(str) {
@@ -293,7 +293,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
CodeMirror.defineMIME("text/x-mysql", {
name: "sql",
client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),
- keywords: set(sqlKeywords + "accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group groupby_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
+ keywords: set(sqlKeywords + "accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group group_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),
atoms: set("false true null unknown"),
operatorChars: /^[*+\-%<>!=&|^]/,
diff --git a/public/vendor/codemirror/mode/swift/index.html b/public/vendor/codemirror/mode/swift/index.html
new file mode 100755
index 00000000..2649dc37
--- /dev/null
+++ b/public/vendor/codemirror/mode/swift/index.html
@@ -0,0 +1,88 @@
+<!doctype html>
+
+<title>CodeMirror: Swift mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="./swift.js"></script>
+<style>
+ .CodeMirror { border: 2px inset #dee; }
+ </style>
+<div id=nav>
+ <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/codemirror/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">Swift</a>
+ </ul>
+</div>
+
+<article>
+<h2>Swift mode</h2>
+<form><textarea id="code" name="code">
+//
+// TipCalculatorModel.swift
+// TipCalculator
+//
+// Created by Main Account on 12/18/14.
+// Copyright (c) 2014 Razeware LLC. All rights reserved.
+//
+
+import Foundation
+
+class TipCalculatorModel {
+
+ var total: Double
+ var taxPct: Double
+ var subtotal: Double {
+ get {
+ return total / (taxPct + 1)
+ }
+ }
+
+ init(total: Double, taxPct: Double) {
+ self.total = total
+ self.taxPct = taxPct
+ }
+
+ func calcTipWithTipPct(tipPct: Double) -> Double {
+ return subtotal * tipPct
+ }
+
+ func returnPossibleTips() -> [Int: Double] {
+
+ let possibleTipsInferred = [0.15, 0.18, 0.20]
+ let possibleTipsExplicit:[Double] = [0.15, 0.18, 0.20]
+
+ var retval = [Int: Double]()
+ for possibleTip in possibleTipsInferred {
+ let intPct = Int(possibleTip*100)
+ retval[intPct] = calcTipWithTipPct(possibleTip)
+ }
+ return retval
+
+ }
+
+}
+</textarea></form>
+
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ lineNumbers: true,
+ matchBrackets: true,
+ mode: "text/x-swift"
+ });
+ </script>
+
+ <p>A simple mode for Swift</p>
+
+ <p><strong>MIME types defined:</strong> <code>text/x-swift</code> (Swift code)</p>
+ </article>
diff --git a/public/vendor/codemirror/mode/swift/swift.js b/public/vendor/codemirror/mode/swift/swift.js
new file mode 100755
index 00000000..cf784fef
--- /dev/null
+++ b/public/vendor/codemirror/mode/swift/swift.js
@@ -0,0 +1,203 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+// Swift mode created by Michael Kaminsky https://github.com/mkaminsky11
+
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object")
+ mod(require("../../lib/codemirror"))
+ else if (typeof define == "function" && define.amd)
+ define(["../../lib/codemirror"], mod)
+ else
+ mod(CodeMirror)
+})(function(CodeMirror) {
+ "use strict"
+
+ function trim(str) { return /^\s*(.*?)\s*$/.exec(str)[1] }
+
+ var separators = [" ","\\\+","\\\-","\\\(","\\\)","\\\*","/",":","\\\?","\\\<","\\\>"," ","\\\."]
+ var tokens = new RegExp(separators.join("|"),"g")
+
+ function getWord(string, pos) {
+ var index = -1, count = 1
+ var words = string.split(tokens)
+ for (var i = 0; i < words.length; i++) {
+ for(var j = 1; j <= words[i].length; j++) {
+ if (count==pos) index = i
+ count++
+ }
+ count++
+ }
+ var ret = ["", ""]
+ if (pos == 0) {
+ ret[1] = words[0]
+ ret[0] = null
+ } else {
+ ret[1] = words[index]
+ ret[0] = words[index-1]
+ }
+ return ret
+ }
+
+ CodeMirror.defineMode("swift", function() {
+ var keywords=["var","let","class","deinit","enum","extension","func","import","init","let","protocol","static","struct","subscript","typealias","var","as","dynamicType","is","new","super","self","Self","Type","__COLUMN__","__FILE__","__FUNCTION__","__LINE__","break","case","continue","default","do","else","fallthrough","if","in","for","return","switch","where","while","associativity","didSet","get","infix","inout","left","mutating","none","nonmutating","operator","override","postfix","precedence","prefix","right","set","unowned","unowned(safe)","unowned(unsafe)","weak","willSet"]
+ var commonConstants=["Infinity","NaN","undefined","null","true","false","on","off","yes","no","nil","null","this","super"]
+ var types=["String","bool","int","string","double","Double","Int","Float","float","public","private","extension"]
+ var numbers=["0","1","2","3","4","5","6","7","8","9"]
+ var operators=["+","-","/","*","%","=","|","&","<",">"]
+ var punc=[";",",",".","(",")","{","}","[","]"]
+ var delimiters=/^(?:[()\[\]{},:`=;]|\.\.?\.?)/
+ var identifiers=/^[_A-Za-z$][_A-Za-z$0-9]*/
+ var properties=/^(@|this\.)[_A-Za-z$][_A-Za-z$0-9]*/
+ var regexPrefixes=/^(\/{3}|\/)/
+
+ return {
+ startState: function() {
+ return {
+ prev: false,
+ string: false,
+ escape: false,
+ inner: false,
+ comment: false,
+ num_left: 0,
+ num_right: 0,
+ doubleString: false,
+ singleString: false
+ }
+ },
+ token: function(stream, state) {
+ if (stream.eatSpace()) return null
+
+ var ch = stream.next()
+ if (state.string) {
+ if (state.escape) {
+ state.escape = false
+ return "string"
+ } else {
+ if ((ch == "\"" && (state.doubleString && !state.singleString) ||
+ (ch == "'" && (!state.doubleString && state.singleString))) &&
+ !state.escape) {
+ state.string = false
+ state.doubleString = false
+ state.singleString = false
+ return "string"
+ } else if (ch == "\\" && stream.peek() == "(") {
+ state.inner = true
+ state.string = false
+ return "keyword"
+ } else if (ch == "\\" && stream.peek() != "(") {
+ state.escape = true
+ state.string = true
+ return "string"
+ } else {
+ return "string"
+ }
+ }
+ } else if (state.comment) {
+ if (ch == "*" && stream.peek() == "/") {
+ state.prev = "*"
+ return "comment"
+ } else if (ch == "/" && state.prev == "*") {
+ state.prev = false
+ state.comment = false
+ return "comment"
+ }
+ return "comment"
+ } else {
+ if (ch == "/") {
+ if (stream.peek() == "/") {
+ stream.skipToEnd()
+ return "comment"
+ }
+ if (stream.peek() == "*") {
+ state.comment = true
+ return "comment"
+ }
+ }
+ if (ch == "(" && state.inner) {
+ state.num_left++
+ return null
+ }
+ if (ch == ")" && state.inner) {
+ state.num_right++
+ if (state.num_left == state.num_right) {
+ state.inner=false
+ state.string=true
+ }
+ return null
+ }
+
+ var ret = getWord(stream.string, stream.pos)
+ var the_word = ret[1]
+ var prev_word = ret[0]
+
+ if (operators.indexOf(ch + "") > -1) return "operator"
+ if (punc.indexOf(ch) > -1) return "punctuation"
+
+ if (typeof the_word != "undefined") {
+ the_word = trim(the_word)
+ if (typeof prev_word != "undefined") prev_word = trim(prev_word)
+ if (the_word.charAt(0) == "#") return null
+
+ if (types.indexOf(the_word) > -1) return "def"
+ if (commonConstants.indexOf(the_word) > -1) return "atom"
+ if (numbers.indexOf(the_word) > -1) return "number"
+
+ if ((numbers.indexOf(the_word.charAt(0) + "") > -1 ||
+ operators.indexOf(the_word.charAt(0) + "") > -1) &&
+ numbers.indexOf(ch) > -1) {
+ return "number"
+ }
+
+ if (keywords.indexOf(the_word) > -1 ||
+ keywords.indexOf(the_word.split(tokens)[0]) > -1)
+ return "keyword"
+ if (keywords.indexOf(prev_word) > -1) return "def"
+ }
+ if (ch == '"' && !state.doubleString) {
+ state.string = true
+ state.doubleString = true
+ return "string"
+ }
+ if (ch == "'" && !state.singleString) {
+ state.string = true
+ state.singleString = true
+ return "string"
+ }
+ if (ch == "(" && state.inner)
+ state.num_left++
+ if (ch == ")" && state.inner) {
+ state.num_right++
+ if (state.num_left == state.num_right) {
+ state.inner = false
+ state.string = true
+ }
+ return null
+ }
+ if (stream.match(/^-?[0-9\.]/, false)) {
+ if (stream.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i) ||
+ stream.match(/^-?\d+\.\d*/) ||
+ stream.match(/^-?\.\d+/)) {
+ if (stream.peek() == ".") stream.backUp(1)
+ return "number"
+ }
+ if (stream.match(/^-?0x[0-9a-f]+/i) ||
+ stream.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/) ||
+ stream.match(/^-?0(?![\dx])/i))
+ return "number"
+ }
+ if (stream.match(regexPrefixes)) {
+ if (stream.current()!="/" || stream.match(/^.*\//,false)) return "string"
+ else stream.backUp(1)
+ }
+ if (stream.match(delimiters)) return "punctuation"
+ if (stream.match(identifiers)) return "variable"
+ if (stream.match(properties)) return "property"
+ return "variable"
+ }
+ }
+ }
+ })
+
+ CodeMirror.defineMIME("text/x-swift","swift")
+})
diff --git a/public/vendor/codemirror/mode/tiddlywiki/tiddlywiki.js b/public/vendor/codemirror/mode/tiddlywiki/tiddlywiki.js
index 88c9768a..1df01647 100755
--- a/public/vendor/codemirror/mode/tiddlywiki/tiddlywiki.js
+++ b/public/vendor/codemirror/mode/tiddlywiki/tiddlywiki.js
@@ -71,16 +71,6 @@ CodeMirror.defineMode("tiddlywiki", function () {
return f(stream, state);
}
- // Used as scratch variables to communicate multiple values without
- // consing up tons of objects.
- var type, content;
-
- function ret(tp, style, cont) {
- type = tp;
- content = cont;
- return style;
- }
-
function jsTokenBase(stream, state) {
var sol = stream.sol(), ch;
@@ -95,16 +85,16 @@ CodeMirror.defineMode("tiddlywiki", function () {
return chain(stream, state, twTokenCode);
}
if (stream.match(reBlockQuote)) {
- return ret('quote', 'quote');
+ return 'quote';
}
if (stream.match(reWikiCommentStart) || stream.match(reWikiCommentStop)) {
- return ret('code', 'comment');
+ return 'comment';
}
if (stream.match(reJsCodeStart) || stream.match(reJsCodeStop) || stream.match(reXmlCodeStart) || stream.match(reXmlCodeStop)) {
- return ret('code', 'comment');
+ return 'comment';
}
if (stream.match(reHR)) {
- return ret('hr', 'hr');
+ return 'hr';
}
} // sol
ch = stream.next();
@@ -112,30 +102,30 @@ CodeMirror.defineMode("tiddlywiki", function () {
if (sol && /[\/\*!#;:>|]/.test(ch)) {
if (ch == "!") { // tw header
stream.skipToEnd();
- return ret("header", "header");
+ return "header";
}
if (ch == "*") { // tw list
stream.eatWhile('*');
- return ret("list", "comment");
+ return "comment";
}
if (ch == "#") { // tw numbered list
stream.eatWhile('#');
- return ret("list", "comment");
+ return "comment";
}
if (ch == ";") { // definition list, term
stream.eatWhile(';');
- return ret("list", "comment");
+ return "comment";
}
if (ch == ":") { // definition list, description
stream.eatWhile(':');
- return ret("list", "comment");
+ return "comment";
}
if (ch == ">") { // single line quote
stream.eatWhile(">");
- return ret("quote", "quote");
+ return "quote";
}
if (ch == '|') {
- return ret('table', 'header');
+ return 'header';
}
}
@@ -146,29 +136,29 @@ CodeMirror.defineMode("tiddlywiki", function () {
// rudimentary html:// file:// link matching. TW knows much more ...
if (/[hf]/i.test(ch)) {
if (/[ti]/i.test(stream.peek()) && stream.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i)) {
- return ret("link", "link");
+ return "link";
}
}
// just a little string indicator, don't want to have the whole string covered
if (ch == '"') {
- return ret('string', 'string');
+ return 'string';
}
if (ch == '~') { // _no_ CamelCase indicator should be bold
- return ret('text', 'brace');
+ return 'brace';
}
if (/[\[\]]/.test(ch)) { // check for [[..]]
if (stream.peek() == ch) {
stream.next();
- return ret('brace', 'brace');
+ return 'brace';
}
}
if (ch == "@") { // check for space link. TODO fix @@...@@ highlighting
stream.eatWhile(isSpaceName);
- return ret("link", "link");
+ return "link";
}
if (/\d/.test(ch)) { // numbers
stream.eatWhile(/\d/);
- return ret("number", "number");
+ return "number";
}
if (ch == "/") { // tw invisible comment
if (stream.eat("%")) {
@@ -191,7 +181,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
return chain(stream, state, twTokenStrike);
// mdash
if (stream.peek() == ' ')
- return ret('text', 'brace');
+ return 'brace';
}
}
if (ch == "'") { // tw bold
@@ -205,7 +195,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
}
}
else {
- return ret(ch);
+ return null;
}
// core macro handling
@@ -213,8 +203,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
var word = stream.current(),
known = textwords.propertyIsEnumerable(word) && textwords[word];
- return known ? ret(known.type, known.style, word) : ret("text", null, word);
-
+ return known ? known.style : null;
} // jsTokenBase()
// tw invisible comment
@@ -228,7 +217,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
}
maybeEnd = (ch == "%");
}
- return ret("comment", "comment");
+ return "comment";
}
// tw strong / bold
@@ -242,29 +231,29 @@ CodeMirror.defineMode("tiddlywiki", function () {
}
maybeEnd = (ch == "'");
}
- return ret("text", "strong");
+ return "strong";
}
// tw code
function twTokenCode(stream, state) {
- var ch, sb = state.block;
+ var sb = state.block;
if (sb && stream.current()) {
- return ret("code", "comment");
+ return "comment";
}
if (!sb && stream.match(reUntilCodeStop)) {
state.tokenize = jsTokenBase;
- return ret("code", "comment");
+ return "comment";
}
if (sb && stream.sol() && stream.match(reCodeBlockStop)) {
state.tokenize = jsTokenBase;
- return ret("code", "comment");
+ return "comment";
}
- ch = stream.next();
- return (sb) ? ret("code", "comment") : ret("code", "comment");
+ stream.next();
+ return "comment";
}
// tw em / italic
@@ -278,7 +267,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
}
maybeEnd = (ch == "/");
}
- return ret("text", "em");
+ return "em";
}
// tw underlined text
@@ -292,7 +281,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
}
maybeEnd = (ch == "_");
}
- return ret("text", "underlined");
+ return "underlined";
}
// tw strike through text looks ugly
@@ -307,7 +296,7 @@ CodeMirror.defineMode("tiddlywiki", function () {
}
maybeEnd = (ch == "-");
}
- return ret("text", "strikethrough");
+ return "strikethrough";
}
// macro
@@ -315,19 +304,19 @@ CodeMirror.defineMode("tiddlywiki", function () {
var ch, word, known;
if (stream.current() == '<<') {
- return ret('brace', 'macro');
+ return 'macro';
}
ch = stream.next();
if (!ch) {
state.tokenize = jsTokenBase;
- return ret(ch);
+ return null;
}
if (ch == ">") {
if (stream.peek() == '>') {
stream.next();
state.tokenize = jsTokenBase;
- return ret("brace", "macro");
+ return "macro";
}
}
@@ -336,10 +325,10 @@ CodeMirror.defineMode("tiddlywiki", function () {
known = keywords.propertyIsEnumerable(word) && keywords[word];
if (known) {
- return ret(known.type, known.style, word);
+ return known.style, word;
}
else {
- return ret("macro", null, word);
+ return null, word;
}
}
diff --git a/public/vendor/codemirror/mode/tiki/tiki.js b/public/vendor/codemirror/mode/tiki/tiki.js
index c90aac9e..5e05b1ff 100755
--- a/public/vendor/codemirror/mode/tiki/tiki.js
+++ b/public/vendor/codemirror/mode/tiki/tiki.js
@@ -52,35 +52,27 @@ CodeMirror.defineMode('tiki', function(config) {
case "{": //plugin
stream.eat("/");
stream.eatSpace();
- var tagName = "";
- var c;
- while ((c = stream.eat(/[^\s\u00a0=\"\'\/?(}]/))) tagName += c;
+ stream.eatWhile(/[^\s\u00a0=\"\'\/?(}]/);
state.tokenize = inPlugin;
return "tag";
- break;
case "_": //bold
- if (stream.eat("_")) {
+ if (stream.eat("_"))
return chain(inBlock("strong", "__", inText));
- }
break;
case "'": //italics
- if (stream.eat("'")) {
- // Italic text
+ if (stream.eat("'"))
return chain(inBlock("em", "''", inText));
- }
break;
case "(":// Wiki Link
- if (stream.eat("(")) {
+ if (stream.eat("("))
return chain(inBlock("variable-2", "))", inText));
- }
break;
case "[":// Weblink
return chain(inBlock("variable-3", "]", inText));
break;
case "|": //table
- if (stream.eat("|")) {
+ if (stream.eat("|"))
return chain(inBlock("comment", "||"));
- }
break;
case "-":
if (stream.eat("=")) {//titleBar
@@ -90,22 +82,19 @@ CodeMirror.defineMode('tiki', function(config) {
}
break;
case "=": //underline
- if (stream.match("==")) {
+ if (stream.match("=="))
return chain(inBlock("tw-underline", "===", inText));
- }
break;
case ":":
- if (stream.eat(":")) {
+ if (stream.eat(":"))
return chain(inBlock("comment", "::"));
- }
break;
case "^": //box
return chain(inBlock("tw-box", "^"));
break;
case "~": //np
- if (stream.match("np~")) {
+ if (stream.match("np~"))
return chain(inBlock("meta", "~/np~"));
- }
break;
}
diff --git a/public/vendor/codemirror/mode/ttcn-cfg/index.html b/public/vendor/codemirror/mode/ttcn-cfg/index.html
new file mode 100755
index 00000000..4a4cd457
--- /dev/null
+++ b/public/vendor/codemirror/mode/ttcn-cfg/index.html
@@ -0,0 +1,115 @@
+<!doctype html>
+
+<title>CodeMirror: TTCN-CFG mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="ttcn-cfg.js"></script>
+<style type="text/css">
+ .CodeMirror {
+ border-top: 1px solid black;
+ border-bottom: 1px solid black;
+ }
+</style>
+<div id=nav>
+ <a href="http://codemirror.net"><h1>CodeMirror</h1>
+ <img id=logo src="../../doc/logo.png">
+ </a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/codemirror/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="http://en.wikipedia.org/wiki/TTCN">TTCN-CFG</a>
+ </ul>
+</div>
+<article>
+ <h2>TTCN-CFG example</h2>
+ <div>
+ <textarea id="ttcn-cfg-code">
+[MODULE_PARAMETERS]
+# This section shall contain the values of all parameters that are defined in your TTCN-3 modules.
+
+[LOGGING]
+# In this section you can specify the name of the log file and the classes of events
+# you want to log into the file or display on console (standard error).
+
+LogFile := "logs/%e.%h-%r.%s"
+FileMask := LOG_ALL | DEBUG | MATCHING
+ConsoleMask := ERROR | WARNING | TESTCASE | STATISTICS | PORTEVENT
+
+LogSourceInfo := Yes
+AppendFile := No
+TimeStampFormat := DateTime
+LogEventTypes := Yes
+SourceInfoFormat := Single
+LogEntityName := Yes
+
+[TESTPORT_PARAMETERS]
+# In this section you can specify parameters that are passed to Test Ports.
+
+[DEFINE]
+# In this section you can create macro definitions,
+# that can be used in other configuration file sections except [INCLUDE].
+
+[INCLUDE]
+# To use configuration settings given in other configuration files,
+# the configuration files just need to be listed in this section, with their full or relative pathnames.
+
+[EXTERNAL_COMMANDS]
+# This section can define external commands (shell scripts) to be executed by the ETS
+# whenever a control part or test case is started or terminated.
+
+BeginTestCase := ""
+EndTestCase := ""
+BeginControlPart := ""
+EndControlPart := ""
+
+[EXECUTE]
+# In this section you can specify what parts of your test suite you want to execute.
+
+[GROUPS]
+# In this section you can specify groups of hosts. These groups can be used inside the
+# [COMPONENTS] section to restrict the creation of certain PTCs to a given set of hosts.
+
+[COMPONENTS]
+# This section consists of rules restricting the location of created PTCs.
+
+[MAIN_CONTROLLER]
+# The options herein control the behavior of MC.
+
+TCPPort := 0
+KillTimer := 10.0
+NumHCs := 0
+LocalAddress :=
+ </textarea>
+ </div>
+
+ <script>
+ var ttcnEditor = CodeMirror.fromTextArea(document.getElementById("ttcn-cfg-code"), {
+ lineNumbers: true,
+ matchBrackets: true,
+ mode: "text/x-ttcn-cfg"
+ });
+ ttcnEditor.setSize(600, 860);
+ var mac = CodeMirror.keyMap.default == CodeMirror.keyMap.macDefault;
+ CodeMirror.keyMap.default[(mac ? "Cmd" : "Ctrl") + "-Space"] = "autocomplete";
+ </script>
+ <br/>
+ <p><strong>Language:</strong> Testing and Test Control Notation -
+ Configuration files
+ (<a href="http://en.wikipedia.org/wiki/TTCN">TTCN-CFG</a>)
+ </p>
+ <p><strong>MIME types defined:</strong> <code>text/x-ttcn-cfg</code>.</p>
+
+ <br/>
+ <p>The development of this mode has been sponsored by <a href="http://www.ericsson.com/">Ericsson
+ </a>.</p>
+ <p>Coded by Asmelash Tsegay Gebretsadkan </p>
+</article>
+
diff --git a/public/vendor/codemirror/mode/ttcn-cfg/ttcn-cfg.js b/public/vendor/codemirror/mode/ttcn-cfg/ttcn-cfg.js
new file mode 100755
index 00000000..e1080511
--- /dev/null
+++ b/public/vendor/codemirror/mode/ttcn-cfg/ttcn-cfg.js
@@ -0,0 +1,214 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+ "use strict";
+
+ CodeMirror.defineMode("ttcn-cfg", function(config, parserConfig) {
+ var indentUnit = config.indentUnit,
+ keywords = parserConfig.keywords || {},
+ fileNCtrlMaskOptions = parserConfig.fileNCtrlMaskOptions || {},
+ externalCommands = parserConfig.externalCommands || {},
+ multiLineStrings = parserConfig.multiLineStrings,
+ indentStatements = parserConfig.indentStatements !== false;
+ var isOperatorChar = /[\|]/;
+ var curPunc;
+
+ function tokenBase(stream, state) {
+ var ch = stream.next();
+ if (ch == '"' || ch == "'") {
+ state.tokenize = tokenString(ch);
+ return state.tokenize(stream, state);
+ }
+ if (/[:=]/.test(ch)) {
+ curPunc = ch;
+ return "punctuation";
+ }
+ if (ch == "#"){
+ stream.skipToEnd();
+ return "comment";
+ }
+ if (/\d/.test(ch)) {
+ stream.eatWhile(/[\w\.]/);
+ return "number";
+ }
+ if (isOperatorChar.test(ch)) {
+ stream.eatWhile(isOperatorChar);
+ return "operator";
+ }
+ if (ch == "["){
+ stream.eatWhile(/[\w_\]]/);
+ return "number sectionTitle";
+ }
+
+ stream.eatWhile(/[\w\$_]/);
+ var cur = stream.current();
+ if (keywords.propertyIsEnumerable(cur)) return "keyword";
+ if (fileNCtrlMaskOptions.propertyIsEnumerable(cur))
+ return "negative fileNCtrlMaskOptions";
+ if (externalCommands.propertyIsEnumerable(cur)) return "negative externalCommands";
+
+ return "variable";
+ }
+
+ function tokenString(quote) {
+ return function(stream, state) {
+ var escaped = false, next, end = false;
+ while ((next = stream.next()) != null) {
+ if (next == quote && !escaped){
+ var afterNext = stream.peek();
+ //look if the character if the quote is like the B in '10100010'B
+ if (afterNext){
+ afterNext = afterNext.toLowerCase();
+ if(afterNext == "b" || afterNext == "h" || afterNext == "o")
+ stream.next();
+ }
+ end = true; break;
+ }
+ escaped = !escaped && next == "\\";
+ }
+ if (end || !(escaped || multiLineStrings))
+ state.tokenize = null;
+ return "string";
+ };
+ }
+
+ function Context(indented, column, type, align, prev) {
+ this.indented = indented;
+ this.column = column;
+ this.type = type;
+ this.align = align;
+ this.prev = prev;
+ }
+ function pushContext(state, col, type) {
+ var indent = state.indented;
+ if (state.context && state.context.type == "statement")
+ indent = state.context.indented;
+ return state.context = new Context(indent, col, type, null, state.context);
+ }
+ function popContext(state) {
+ var t = state.context.type;
+ if (t == ")" || t == "]" || t == "}")
+ state.indented = state.context.indented;
+ return state.context = state.context.prev;
+ }
+
+ //Interface
+ return {
+ startState: function(basecolumn) {
+ return {
+ tokenize: null,
+ context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
+ indented: 0,
+ startOfLine: true
+ };
+ },
+
+ token: function(stream, state) {
+ var ctx = state.context;
+ if (stream.sol()) {
+ if (ctx.align == null) ctx.align = false;
+ state.indented = stream.indentation();
+ state.startOfLine = true;
+ }
+ if (stream.eatSpace()) return null;
+ curPunc = null;
+ var style = (state.tokenize || tokenBase)(stream, state);
+ if (style == "comment") return style;
+ if (ctx.align == null) ctx.align = true;
+
+ if ((curPunc == ";" || curPunc == ":" || curPunc == ",")
+ && ctx.type == "statement"){
+ popContext(state);
+ }
+ else if (curPunc == "{") pushContext(state, stream.column(), "}");
+ else if (curPunc == "[") pushContext(state, stream.column(), "]");
+ else if (curPunc == "(") pushContext(state, stream.column(), ")");
+ else if (curPunc == "}") {
+ while (ctx.type == "statement") ctx = popContext(state);
+ if (ctx.type == "}") ctx = popContext(state);
+ while (ctx.type == "statement") ctx = popContext(state);
+ }
+ else if (curPunc == ctx.type) popContext(state);
+ else if (indentStatements && (((ctx.type == "}" || ctx.type == "top")
+ && curPunc != ';') || (ctx.type == "statement"
+ && curPunc == "newstatement")))
+ pushContext(state, stream.column(), "statement");
+ state.startOfLine = false;
+ return style;
+ },
+
+ electricChars: "{}",
+ lineComment: "#",
+ fold: "brace"
+ };
+ });
+
+ function words(str) {
+ var obj = {}, words = str.split(" ");
+ for (var i = 0; i < words.length; ++i)
+ obj[words[i]] = true;
+ return obj;
+ }
+
+ CodeMirror.defineMIME("text/x-ttcn-cfg", {
+ name: "ttcn-cfg",
+ keywords: words("Yes No LogFile FileMask ConsoleMask AppendFile" +
+ " TimeStampFormat LogEventTypes SourceInfoFormat" +
+ " LogEntityName LogSourceInfo DiskFullAction" +
+ " LogFileNumber LogFileSize MatchingHints Detailed" +
+ " Compact SubCategories Stack Single None Seconds" +
+ " DateTime Time Stop Error Retry Delete TCPPort KillTimer" +
+ " NumHCs UnixSocketsEnabled LocalAddress"),
+ fileNCtrlMaskOptions: words("TTCN_EXECUTOR TTCN_ERROR TTCN_WARNING" +
+ " TTCN_PORTEVENT TTCN_TIMEROP TTCN_VERDICTOP" +
+ " TTCN_DEFAULTOP TTCN_TESTCASE TTCN_ACTION" +
+ " TTCN_USER TTCN_FUNCTION TTCN_STATISTICS" +
+ " TTCN_PARALLEL TTCN_MATCHING TTCN_DEBUG" +
+ " EXECUTOR ERROR WARNING PORTEVENT TIMEROP" +
+ " VERDICTOP DEFAULTOP TESTCASE ACTION USER" +
+ " FUNCTION STATISTICS PARALLEL MATCHING DEBUG" +
+ " LOG_ALL LOG_NOTHING ACTION_UNQUALIFIED" +
+ " DEBUG_ENCDEC DEBUG_TESTPORT" +
+ " DEBUG_UNQUALIFIED DEFAULTOP_ACTIVATE" +
+ " DEFAULTOP_DEACTIVATE DEFAULTOP_EXIT" +
+ " DEFAULTOP_UNQUALIFIED ERROR_UNQUALIFIED" +
+ " EXECUTOR_COMPONENT EXECUTOR_CONFIGDATA" +
+ " EXECUTOR_EXTCOMMAND EXECUTOR_LOGOPTIONS" +
+ " EXECUTOR_RUNTIME EXECUTOR_UNQUALIFIED" +
+ " FUNCTION_RND FUNCTION_UNQUALIFIED" +
+ " MATCHING_DONE MATCHING_MCSUCCESS" +
+ " MATCHING_MCUNSUCC MATCHING_MMSUCCESS" +
+ " MATCHING_MMUNSUCC MATCHING_PCSUCCESS" +
+ " MATCHING_PCUNSUCC MATCHING_PMSUCCESS" +
+ " MATCHING_PMUNSUCC MATCHING_PROBLEM" +
+ " MATCHING_TIMEOUT MATCHING_UNQUALIFIED" +
+ " PARALLEL_PORTCONN PARALLEL_PORTMAP" +
+ " PARALLEL_PTC PARALLEL_UNQUALIFIED" +
+ " PORTEVENT_DUALRECV PORTEVENT_DUALSEND" +
+ " PORTEVENT_MCRECV PORTEVENT_MCSEND" +
+ " PORTEVENT_MMRECV PORTEVENT_MMSEND" +
+ " PORTEVENT_MQUEUE PORTEVENT_PCIN" +
+ " PORTEVENT_PCOUT PORTEVENT_PMIN" +
+ " PORTEVENT_PMOUT PORTEVENT_PQUEUE" +
+ " PORTEVENT_STATE PORTEVENT_UNQUALIFIED" +
+ " STATISTICS_UNQUALIFIED STATISTICS_VERDICT" +
+ " TESTCASE_FINISH TESTCASE_START" +
+ " TESTCASE_UNQUALIFIED TIMEROP_GUARD" +
+ " TIMEROP_READ TIMEROP_START TIMEROP_STOP" +
+ " TIMEROP_TIMEOUT TIMEROP_UNQUALIFIED" +
+ " USER_UNQUALIFIED VERDICTOP_FINAL" +
+ " VERDICTOP_GETVERDICT VERDICTOP_SETVERDICT" +
+ " VERDICTOP_UNQUALIFIED WARNING_UNQUALIFIED"),
+ externalCommands: words("BeginControlPart EndControlPart BeginTestCase" +
+ " EndTestCase"),
+ multiLineStrings: true
+ });
+}); \ No newline at end of file
diff --git a/public/vendor/codemirror/mode/ttcn/index.html b/public/vendor/codemirror/mode/ttcn/index.html
new file mode 100755
index 00000000..f1ef8113
--- /dev/null
+++ b/public/vendor/codemirror/mode/ttcn/index.html
@@ -0,0 +1,118 @@
+<!doctype html>
+
+<title>CodeMirror: TTCN mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="ttcn.js"></script>
+<style type="text/css">
+ .CodeMirror {
+ border-top: 1px solid black;
+ border-bottom: 1px solid black;
+ }
+</style>
+<div id=nav>
+ <a href="http://codemirror.net"><h1>CodeMirror</h1>
+ <img id=logo src="../../doc/logo.png">
+ </a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/codemirror/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="http://en.wikipedia.org/wiki/TTCN">TTCN</a>
+ </ul>
+</div>
+<article>
+ <h2>TTCN example</h2>
+ <div>
+ <textarea id="ttcn-code">
+module Templates {
+ /* import types from ASN.1 */
+ import from Types language "ASN.1:1997" all;
+
+ /* During the conversion phase from ASN.1 to TTCN-3 */
+ /* - the minus sign (Message-Type) within the identifiers will be replaced by underscore (Message_Type)*/
+ /* - the ASN.1 identifiers matching a TTCN-3 keyword (objid) will be postfixed with an underscore (objid_)*/
+
+ // simple types
+
+ template SenderID localObjid := objid {itu_t(0) identified_organization(4) etsi(0)};
+
+ // complex types
+
+ /* ASN.1 Message-Type mapped to TTCN-3 Message_Type */
+ template Message receiveMsg(template (present) Message_Type p_messageType) := {
+ header := p_messageType,
+ body := ?
+ }
+
+ /* ASN.1 objid mapped to TTCN-3 objid_ */
+ template Message sendInviteMsg := {
+ header := inviteType,
+ body := {
+ /* optional fields may be assigned by omit or may be ignored/skipped */
+ description := "Invite Message",
+ data := 'FF'O,
+ objid_ := localObjid
+ }
+ }
+
+ template Message sendAcceptMsg modifies sendInviteMsg := {
+ header := acceptType,
+ body := {
+ description := "Accept Message"
+ }
+ };
+
+ template Message sendErrorMsg modifies sendInviteMsg := {
+ header := errorType,
+ body := {
+ description := "Error Message"
+ }
+ };
+
+ template Message expectedErrorMsg := {
+ header := errorType,
+ body := ?
+ };
+
+ template Message expectedInviteMsg modifies expectedErrorMsg := {
+ header := inviteType
+ };
+
+ template Message expectedAcceptMsg modifies expectedErrorMsg := {
+ header := acceptType
+ };
+
+} with { encode "BER:1997" }
+ </textarea>
+ </div>
+
+ <script>
+ var ttcnEditor = CodeMirror.fromTextArea(document.getElementById("ttcn-code"), {
+ lineNumbers: true,
+ matchBrackets: true,
+ mode: "text/x-ttcn"
+ });
+ ttcnEditor.setSize(600, 860);
+ var mac = CodeMirror.keyMap.default == CodeMirror.keyMap.macDefault;
+ CodeMirror.keyMap.default[(mac ? "Cmd" : "Ctrl") + "-Space"] = "autocomplete";
+ </script>
+ <br/>
+ <p><strong>Language:</strong> Testing and Test Control Notation
+ (<a href="http://en.wikipedia.org/wiki/TTCN">TTCN</a>)
+ </p>
+ <p><strong>MIME types defined:</strong> <code>text/x-ttcn,
+ text/x-ttcn3, text/x-ttcnpp</code>.</p>
+ <br/>
+ <p>The development of this mode has been sponsored by <a href="http://www.ericsson.com/">Ericsson
+ </a>.</p>
+ <p>Coded by Asmelash Tsegay Gebretsadkan </p>
+</article>
+
diff --git a/public/vendor/codemirror/mode/ttcn/ttcn.js b/public/vendor/codemirror/mode/ttcn/ttcn.js
new file mode 100755
index 00000000..30518517
--- /dev/null
+++ b/public/vendor/codemirror/mode/ttcn/ttcn.js
@@ -0,0 +1,283 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+ "use strict";
+
+ CodeMirror.defineMode("ttcn", function(config, parserConfig) {
+ var indentUnit = config.indentUnit,
+ keywords = parserConfig.keywords || {},
+ builtin = parserConfig.builtin || {},
+ timerOps = parserConfig.timerOps || {},
+ portOps = parserConfig.portOps || {},
+ configOps = parserConfig.configOps || {},
+ verdictOps = parserConfig.verdictOps || {},
+ sutOps = parserConfig.sutOps || {},
+ functionOps = parserConfig.functionOps || {},
+
+ verdictConsts = parserConfig.verdictConsts || {},
+ booleanConsts = parserConfig.booleanConsts || {},
+ otherConsts = parserConfig.otherConsts || {},
+
+ types = parserConfig.types || {},
+ visibilityModifiers = parserConfig.visibilityModifiers || {},
+ templateMatch = parserConfig.templateMatch || {},
+ multiLineStrings = parserConfig.multiLineStrings,
+ indentStatements = parserConfig.indentStatements !== false;
+ var isOperatorChar = /[+\-*&@=<>!\/]/;
+ var curPunc;
+
+ function tokenBase(stream, state) {
+ var ch = stream.next();
+
+ if (ch == '"' || ch == "'") {
+ state.tokenize = tokenString(ch);
+ return state.tokenize(stream, state);
+ }
+ if (/[\[\]{}\(\),;\\:\?\.]/.test(ch)) {
+ curPunc = ch;
+ return "punctuation";
+ }
+ if (ch == "#"){
+ stream.skipToEnd();
+ return "atom preprocessor";
+ }
+ if (ch == "%"){
+ stream.eatWhile(/\b/);
+ return "atom ttcn3Macros";
+ }
+ if (/\d/.test(ch)) {
+ stream.eatWhile(/[\w\.]/);
+ return "number";
+ }
+ if (ch == "/") {
+ if (stream.eat("*")) {
+ state.tokenize = tokenComment;
+ return tokenComment(stream, state);
+ }
+ if (stream.eat("/")) {
+ stream.skipToEnd();
+ return "comment";
+ }
+ }
+ if (isOperatorChar.test(ch)) {
+ if(ch == "@"){
+ if(stream.match("try") || stream.match("catch")
+ || stream.match("lazy")){
+ return "keyword";
+ }
+ }
+ stream.eatWhile(isOperatorChar);
+ return "operator";
+ }
+ stream.eatWhile(/[\w\$_\xa1-\uffff]/);
+ var cur = stream.current();
+
+ if (keywords.propertyIsEnumerable(cur)) return "keyword";
+ if (builtin.propertyIsEnumerable(cur)) return "builtin";
+
+ if (timerOps.propertyIsEnumerable(cur)) return "def timerOps";
+ if (configOps.propertyIsEnumerable(cur)) return "def configOps";
+ if (verdictOps.propertyIsEnumerable(cur)) return "def verdictOps";
+ if (portOps.propertyIsEnumerable(cur)) return "def portOps";
+ if (sutOps.propertyIsEnumerable(cur)) return "def sutOps";
+ if (functionOps.propertyIsEnumerable(cur)) return "def functionOps";
+
+ if (verdictConsts.propertyIsEnumerable(cur)) return "string verdictConsts";
+ if (booleanConsts.propertyIsEnumerable(cur)) return "string booleanConsts";
+ if (otherConsts.propertyIsEnumerable(cur)) return "string otherConsts";
+
+ if (types.propertyIsEnumerable(cur)) return "builtin types";
+ if (visibilityModifiers.propertyIsEnumerable(cur))
+ return "builtin visibilityModifiers";
+ if (templateMatch.propertyIsEnumerable(cur)) return "atom templateMatch";
+
+ return "variable";
+ }
+
+ function tokenString(quote) {
+ return function(stream, state) {
+ var escaped = false, next, end = false;
+ while ((next = stream.next()) != null) {
+ if (next == quote && !escaped){
+ var afterQuote = stream.peek();
+ //look if the character after the quote is like the B in '10100010'B
+ if (afterQuote){
+ afterQuote = afterQuote.toLowerCase();
+ if(afterQuote == "b" || afterQuote == "h" || afterQuote == "o")
+ stream.next();
+ }
+ end = true; break;
+ }
+ escaped = !escaped && next == "\\";
+ }
+ if (end || !(escaped || multiLineStrings))
+ state.tokenize = null;
+ return "string";
+ };
+ }
+
+ function tokenComment(stream, state) {
+ var maybeEnd = false, ch;
+ while (ch = stream.next()) {
+ if (ch == "/" && maybeEnd) {
+ state.tokenize = null;
+ break;
+ }
+ maybeEnd = (ch == "*");
+ }
+ return "comment";
+ }
+
+ function Context(indented, column, type, align, prev) {
+ this.indented = indented;
+ this.column = column;
+ this.type = type;
+ this.align = align;
+ this.prev = prev;
+ }
+
+ function pushContext(state, col, type) {
+ var indent = state.indented;
+ if (state.context && state.context.type == "statement")
+ indent = state.context.indented;
+ return state.context = new Context(indent, col, type, null, state.context);
+ }
+
+ function popContext(state) {
+ var t = state.context.type;
+ if (t == ")" || t == "]" || t == "}")
+ state.indented = state.context.indented;
+ return state.context = state.context.prev;
+ }
+
+ //Interface
+ return {
+ startState: function(basecolumn) {
+ return {
+ tokenize: null,
+ context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
+ indented: 0,
+ startOfLine: true
+ };
+ },
+
+ token: function(stream, state) {
+ var ctx = state.context;
+ if (stream.sol()) {
+ if (ctx.align == null) ctx.align = false;
+ state.indented = stream.indentation();
+ state.startOfLine = true;
+ }
+ if (stream.eatSpace()) return null;
+ curPunc = null;
+ var style = (state.tokenize || tokenBase)(stream, state);
+ if (style == "comment") return style;
+ if (ctx.align == null) ctx.align = true;
+
+ if ((curPunc == ";" || curPunc == ":" || curPunc == ",")
+ && ctx.type == "statement"){
+ popContext(state);
+ }
+ else if (curPunc == "{") pushContext(state, stream.column(), "}");
+ else if (curPunc == "[") pushContext(state, stream.column(), "]");
+ else if (curPunc == "(") pushContext(state, stream.column(), ")");
+ else if (curPunc == "}") {
+ while (ctx.type == "statement") ctx = popContext(state);
+ if (ctx.type == "}") ctx = popContext(state);
+ while (ctx.type == "statement") ctx = popContext(state);
+ }
+ else if (curPunc == ctx.type) popContext(state);
+ else if (indentStatements &&
+ (((ctx.type == "}" || ctx.type == "top") && curPunc != ';') ||
+ (ctx.type == "statement" && curPunc == "newstatement")))
+ pushContext(state, stream.column(), "statement");
+
+ state.startOfLine = false;
+
+ return style;
+ },
+
+ electricChars: "{}",
+ blockCommentStart: "/*",
+ blockCommentEnd: "*/",
+ lineComment: "//",
+ fold: "brace"
+ };
+ });
+
+ function words(str) {
+ var obj = {}, words = str.split(" ");
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+ return obj;
+ }
+
+ function def(mimes, mode) {
+ if (typeof mimes == "string") mimes = [mimes];
+ var words = [];
+ function add(obj) {
+ if (obj) for (var prop in obj) if (obj.hasOwnProperty(prop))
+ words.push(prop);
+ }
+
+ add(mode.keywords);
+ add(mode.builtin);
+ add(mode.timerOps);
+ add(mode.portOps);
+
+ if (words.length) {
+ mode.helperType = mimes[0];
+ CodeMirror.registerHelper("hintWords", mimes[0], words);
+ }
+
+ for (var i = 0; i < mimes.length; ++i)
+ CodeMirror.defineMIME(mimes[i], mode);
+ }
+
+ def(["text/x-ttcn", "text/x-ttcn3", "text/x-ttcnpp"], {
+ name: "ttcn",
+ keywords: words("activate address alive all alt altstep and and4b any" +
+ " break case component const continue control deactivate" +
+ " display do else encode enumerated except exception" +
+ " execute extends extension external for from function" +
+ " goto group if import in infinity inout interleave" +
+ " label language length log match message mixed mod" +
+ " modifies module modulepar mtc noblock not not4b nowait" +
+ " of on optional or or4b out override param pattern port" +
+ " procedure record recursive rem repeat return runs select" +
+ " self sender set signature system template testcase to" +
+ " type union value valueof var variant while with xor xor4b"),
+ builtin: words("bit2hex bit2int bit2oct bit2str char2int char2oct encvalue" +
+ " decomp decvalue float2int float2str hex2bit hex2int" +
+ " hex2oct hex2str int2bit int2char int2float int2hex" +
+ " int2oct int2str int2unichar isbound ischosen ispresent" +
+ " isvalue lengthof log2str oct2bit oct2char oct2hex oct2int" +
+ " oct2str regexp replace rnd sizeof str2bit str2float" +
+ " str2hex str2int str2oct substr unichar2int unichar2char" +
+ " enum2int"),
+ types: words("anytype bitstring boolean char charstring default float" +
+ " hexstring integer objid octetstring universal verdicttype timer"),
+ timerOps: words("read running start stop timeout"),
+ portOps: words("call catch check clear getcall getreply halt raise receive" +
+ " reply send trigger"),
+ configOps: words("create connect disconnect done kill killed map unmap"),
+ verdictOps: words("getverdict setverdict"),
+ sutOps: words("action"),
+ functionOps: words("apply derefers refers"),
+
+ verdictConsts: words("error fail inconc none pass"),
+ booleanConsts: words("true false"),
+ otherConsts: words("null NULL omit"),
+
+ visibilityModifiers: words("private public friend"),
+ templateMatch: words("complement ifpresent subset superset permutation"),
+ multiLineStrings: true
+ });
+});
diff --git a/public/vendor/codemirror/mode/twig/index.html b/public/vendor/codemirror/mode/twig/index.html
new file mode 100755
index 00000000..02493a5c
--- /dev/null
+++ b/public/vendor/codemirror/mode/twig/index.html
@@ -0,0 +1,45 @@
+<!doctype html>
+
+<title>CodeMirror: Twig mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="twig.js"></script>
+<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+ <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/codemirror/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">Twig</a>
+ </ul>
+</div>
+
+<article>
+<h2>Twig mode</h2>
+<form><textarea id="code" name="code">
+{% extends "layout.twig" %}
+{% block title %}CodeMirror: Twig mode{% endblock %}
+{# this is a comment #}
+{% block content %}
+ {% for foo in bar if foo.baz is divisible by(3) %}
+ Hello {{ foo.world }}
+ {% else %}
+ {% set msg = "Result not found" %}
+ {% include "empty.twig" with { message: msg } %}
+ {% endfor %}
+{% endblock %}
+</textarea></form>
+ <script>
+ var editor =
+ CodeMirror.fromTextArea(document.getElementById("code"), {mode:
+ {name: "twig", htmlMode: true}});
+ </script>
+ </article>
diff --git a/public/vendor/codemirror/mode/twig/twig.js b/public/vendor/codemirror/mode/twig/twig.js
new file mode 100755
index 00000000..aa676dc4
--- /dev/null
+++ b/public/vendor/codemirror/mode/twig/twig.js
@@ -0,0 +1,132 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+ "use strict";
+
+ CodeMirror.defineMode("twig", function() {
+ var keywords = ["and", "as", "autoescape", "endautoescape", "block", "do", "endblock", "else", "elseif", "extends", "for", "endfor", "embed", "endembed", "filter", "endfilter", "flush", "from", "if", "endif", "in", "is", "include", "import", "not", "or", "set", "spaceless", "endspaceless", "with", "endwith", "trans", "endtrans", "blocktrans", "endblocktrans", "macro", "endmacro", "use", "verbatim", "endverbatim"],
+ operator = /^[+\-*&%=<>!?|~^]/,
+ sign = /^[:\[\(\{]/,
+ atom = ["true", "false", "null", "empty", "defined", "divisibleby", "divisible by", "even", "odd", "iterable", "sameas", "same as"],
+ number = /^(\d[+\-\*\/])?\d+(\.\d+)?/;
+
+ keywords = new RegExp("((" + keywords.join(")|(") + "))\\b");
+ atom = new RegExp("((" + atom.join(")|(") + "))\\b");
+
+ function tokenBase (stream, state) {
+ var ch = stream.peek();
+
+ //Comment
+ if (state.incomment) {
+ if (!stream.skipTo("#}")) {
+ stream.skipToEnd();
+ } else {
+ stream.eatWhile(/\#|}/);
+ state.incomment = false;
+ }
+ return "comment";
+ //Tag
+ } else if (state.intag) {
+ //After operator
+ if (state.operator) {
+ state.operator = false;
+ if (stream.match(atom)) {
+ return "atom";
+ }
+ if (stream.match(number)) {
+ return "number";
+ }
+ }
+ //After sign
+ if (state.sign) {
+ state.sign = false;
+ if (stream.match(atom)) {
+ return "atom";
+ }
+ if (stream.match(number)) {
+ return "number";
+ }
+ }
+
+ if (state.instring) {
+ if (ch == state.instring) {
+ state.instring = false;
+ }
+ stream.next();
+ return "string";
+ } else if (ch == "'" || ch == '"') {
+ state.instring = ch;
+ stream.next();
+ return "string";
+ } else if (stream.match(state.intag + "}") || stream.eat("-") && stream.match(state.intag + "}")) {
+ state.intag = false;
+ return "tag";
+ } else if (stream.match(operator)) {
+ state.operator = true;
+ return "operator";
+ } else if (stream.match(sign)) {
+ state.sign = true;
+ } else {
+ if (stream.eat(" ") || stream.sol()) {
+ if (stream.match(keywords)) {
+ return "keyword";
+ }
+ if (stream.match(atom)) {
+ return "atom";
+ }
+ if (stream.match(number)) {
+ return "number";
+ }
+ if (stream.sol()) {
+ stream.next();
+ }
+ } else {
+ stream.next();
+ }
+
+ }
+ return "variable";
+ } else if (stream.eat("{")) {
+ if (ch = stream.eat("#")) {
+ state.incomment = true;
+ if (!stream.skipTo("#}")) {
+ stream.skipToEnd();
+ } else {
+ stream.eatWhile(/\#|}/);
+ state.incomment = false;
+ }
+ return "comment";
+ //Open tag
+ } else if (ch = stream.eat(/\{|%/)) {
+ //Cache close tag
+ state.intag = ch;
+ if (ch == "{") {
+ state.intag = "}";
+ }
+ stream.eat("-");
+ return "tag";
+ }
+ }
+ stream.next();
+ };
+
+ return {
+ startState: function () {
+ return {};
+ },
+ token: function (stream, state) {
+ return tokenBase(stream, state);
+ }
+ };
+ });
+
+ CodeMirror.defineMIME("text/x-twig", "twig");
+});
diff --git a/public/vendor/codemirror/mode/vb/vb.js b/public/vendor/codemirror/mode/vb/vb.js
index 665248f4..d78f91f7 100755
--- a/public/vendor/codemirror/mode/vb/vb.js
+++ b/public/vendor/codemirror/mode/vb/vb.js
@@ -264,8 +264,9 @@ CodeMirror.defineMode("vb", function(conf, parserConf) {
if (trueText.match(closing) || trueText.match(doubleClosing) || trueText.match(middle)) return conf.indentUnit*(state.currentIndent-1);
if(state.currentIndent < 0) return 0;
return state.currentIndent * conf.indentUnit;
- }
+ },
+ lineComment: "'"
};
return external;
});
diff --git a/public/vendor/codemirror/mode/xquery/xquery.js b/public/vendor/codemirror/mode/xquery/xquery.js
index c8f3d90a..c642ee58 100755
--- a/public/vendor/codemirror/mode/xquery/xquery.js
+++ b/public/vendor/codemirror/mode/xquery/xquery.js
@@ -68,15 +68,6 @@ CodeMirror.defineMode("xquery", function() {
return kwObj;
}();
- // Used as scratch variables to communicate multiple values without
- // consing up tons of objects.
- var type, content;
-
- function ret(tp, style, cont) {
- type = tp; content = cont;
- return style;
- }
-
function chain(stream, state, f) {
state.tokenize = f;
return f(stream, state);
@@ -95,7 +86,7 @@ CodeMirror.defineMode("xquery", function() {
if(stream.match("![CDATA", false)) {
state.tokenize = tokenCDATA;
- return ret("tag", "tag");
+ return "tag";
}
if(stream.match("?", false)) {
@@ -112,28 +103,28 @@ CodeMirror.defineMode("xquery", function() {
// start code block
else if(ch == "{") {
pushStateStack(state,{ type: "codeblock"});
- return ret("", null);
+ return null;
}
// end code block
else if(ch == "}") {
popStateStack(state);
- return ret("", null);
+ return null;
}
// if we're in an XML block
else if(isInXmlBlock(state)) {
if(ch == ">")
- return ret("tag", "tag");
+ return "tag";
else if(ch == "/" && stream.eat(">")) {
popStateStack(state);
- return ret("tag", "tag");
+ return "tag";
}
else
- return ret("word", "variable");
+ return "variable";
}
// if a number
else if (/\d/.test(ch)) {
stream.match(/^\d*(?:\.\d*)?(?:E[+\-]?\d+)?/);
- return ret("number", "atom");
+ return "atom";
}
// comment start
else if (ch === "(" && stream.eat(":")) {
@@ -149,27 +140,27 @@ CodeMirror.defineMode("xquery", function() {
}
// assignment
else if(ch ===":" && stream.eat("=")) {
- return ret("operator", "keyword");
+ return "keyword";
}
// open paren
else if(ch === "(") {
pushStateStack(state, { type: "paren"});
- return ret("", null);
+ return null;
}
// close paren
else if(ch === ")") {
popStateStack(state);
- return ret("", null);
+ return null;
}
// open paren
else if(ch === "[") {
pushStateStack(state, { type: "bracket"});
- return ret("", null);
+ return null;
}
// close paren
else if(ch === "]") {
popStateStack(state);
- return ret("", null);
+ return null;
}
else {
var known = keywords.propertyIsEnumerable(ch) && keywords[ch];
@@ -204,15 +195,14 @@ CodeMirror.defineMode("xquery", function() {
// if the previous word was element, attribute, axis specifier, this word should be the name of that
if(isInXmlConstructor(state)) {
popStateStack(state);
- return ret("word", "variable", word);
+ return "variable";
}
// as previously checked, if the word is element,attribute, axis specifier, call it an "xmlconstructor" and
// push the stack so we know to look for it on the next word
if(word == "element" || word == "attribute" || known.type == "axis_specifier") pushStateStack(state, {type: "xmlconstructor"});
// if the word is known, return the details of that else just call this a generic 'word'
- return known ? ret(known.type, known.style, word) :
- ret("word", "variable", word);
+ return known ? known.style : "variable";
}
}
@@ -235,7 +225,7 @@ CodeMirror.defineMode("xquery", function() {
maybeNested = (ch == "(");
}
- return ret("comment", "comment");
+ return "comment";
}
// tokenizer for string literals
@@ -247,7 +237,7 @@ CodeMirror.defineMode("xquery", function() {
if(isInString(state) && stream.current() == quote) {
popStateStack(state);
if(f) state.tokenize = f;
- return ret("string", "string");
+ return "string";
}
pushStateStack(state, { type: "string", name: quote, tokenize: tokenString(quote, f) });
@@ -255,7 +245,7 @@ CodeMirror.defineMode("xquery", function() {
// if we're in a string and in an XML block, allow an embedded code block
if(stream.match("{", false) && isInXmlAttributeBlock(state)) {
state.tokenize = tokenBase;
- return ret("string", "string");
+ return "string";
}
@@ -269,13 +259,13 @@ CodeMirror.defineMode("xquery", function() {
// if we're in a string and in an XML block, allow an embedded code block in an attribute
if(stream.match("{", false) && isInXmlAttributeBlock(state)) {
state.tokenize = tokenBase;
- return ret("string", "string");
+ return "string";
}
}
}
- return ret("string", "string");
+ return "string";
};
}
@@ -293,7 +283,7 @@ CodeMirror.defineMode("xquery", function() {
}
stream.eatWhile(isVariableChar);
state.tokenize = tokenBase;
- return ret("variable", "variable");
+ return "variable";
}
// tokenizer for XML tags
@@ -303,19 +293,19 @@ CodeMirror.defineMode("xquery", function() {
if(isclose && stream.eat(">")) {
popStateStack(state);
state.tokenize = tokenBase;
- return ret("tag", "tag");
+ return "tag";
}
// self closing tag without attributes?
if(!stream.eat("/"))
pushStateStack(state, { type: "tag", name: name, tokenize: tokenBase});
if(!stream.eat(">")) {
state.tokenize = tokenAttribute;
- return ret("tag", "tag");
+ return "tag";
}
else {
state.tokenize = tokenBase;
}
- return ret("tag", "tag");
+ return "tag";
};
}
@@ -326,14 +316,14 @@ CodeMirror.defineMode("xquery", function() {
if(ch == "/" && stream.eat(">")) {
if(isInXmlAttributeBlock(state)) popStateStack(state);
if(isInXmlBlock(state)) popStateStack(state);
- return ret("tag", "tag");
+ return "tag";
}
if(ch == ">") {
if(isInXmlAttributeBlock(state)) popStateStack(state);
- return ret("tag", "tag");
+ return "tag";
}
if(ch == "=")
- return ret("", null);
+ return null;
// quoted string
if (ch == '"' || ch == "'")
return chain(stream, state, tokenString(ch, tokenAttribute));
@@ -351,7 +341,7 @@ CodeMirror.defineMode("xquery", function() {
state.tokenize = tokenBase;
}
- return ret("attribute", "attribute");
+ return "attribute";
}
// handle comments, including nested
@@ -360,7 +350,7 @@ CodeMirror.defineMode("xquery", function() {
while (ch = stream.next()) {
if (ch == "-" && stream.match("->", true)) {
state.tokenize = tokenBase;
- return ret("comment", "comment");
+ return "comment";
}
}
}
@@ -372,7 +362,7 @@ CodeMirror.defineMode("xquery", function() {
while (ch = stream.next()) {
if (ch == "]" && stream.match("]", true)) {
state.tokenize = tokenBase;
- return ret("comment", "comment");
+ return "comment";
}
}
}
@@ -383,7 +373,7 @@ CodeMirror.defineMode("xquery", function() {
while (ch = stream.next()) {
if (ch == "?" && stream.match(">", true)) {
state.tokenize = tokenBase;
- return ret("comment", "comment meta");
+ return "comment meta";
}
}
}