From 01685c255fda6e13f1cd2980130d2e388d52125c Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Sat, 4 Jul 2015 11:31:01 +0800 Subject: Updated codemirror to 5.4.0 --- public/vendor/codemirror/mode/apl/apl.js | 3 +- public/vendor/codemirror/mode/asn.1/asn.1.js | 204 +++++++++++++++ public/vendor/codemirror/mode/asn.1/index.html | 78 ++++++ public/vendor/codemirror/mode/asterisk/asterisk.js | 6 +- public/vendor/codemirror/mode/clike/clike.js | 183 +++++++++---- public/vendor/codemirror/mode/clike/test.js | 33 +++ public/vendor/codemirror/mode/css/css.js | 17 +- public/vendor/codemirror/mode/css/test.js | 7 - public/vendor/codemirror/mode/cypher/cypher.js | 2 +- public/vendor/codemirror/mode/dylan/dylan.js | 44 ++-- public/vendor/codemirror/mode/ecl/ecl.js | 3 +- public/vendor/codemirror/mode/eiffel/eiffel.js | 2 - public/vendor/codemirror/mode/elm/elm.js | 205 +++++++++++++++ public/vendor/codemirror/mode/elm/index.html | 61 +++++ public/vendor/codemirror/mode/factor/factor.js | 83 ++++++ public/vendor/codemirror/mode/factor/index.html | 77 ++++++ public/vendor/codemirror/mode/groovy/groovy.js | 13 +- .../vendor/codemirror/mode/htmlmixed/htmlmixed.js | 4 +- public/vendor/codemirror/mode/index.html | 9 + .../codemirror/mode/javascript/javascript.js | 7 +- public/vendor/codemirror/mode/javascript/test.js | 5 + public/vendor/codemirror/mode/julia/julia.js | 2 - public/vendor/codemirror/mode/kotlin/kotlin.js | 7 +- .../codemirror/mode/livescript/livescript.js | 4 +- public/vendor/codemirror/mode/markdown/markdown.js | 60 +++-- public/vendor/codemirror/mode/markdown/test.js | 122 ++++++--- .../vendor/codemirror/mode/mathematica/index.html | 72 ++++++ .../codemirror/mode/mathematica/mathematica.js | 175 +++++++++++++ public/vendor/codemirror/mode/meta.js | 8 + public/vendor/codemirror/mode/php/php.js | 38 +-- public/vendor/codemirror/mode/pig/pig.js | 40 ++- public/vendor/codemirror/mode/python/python.js | 2 +- public/vendor/codemirror/mode/sql/sql.js | 4 +- public/vendor/codemirror/mode/swift/index.html | 88 +++++++ public/vendor/codemirror/mode/swift/swift.js | 203 +++++++++++++++ .../codemirror/mode/tiddlywiki/tiddlywiki.js | 83 +++--- public/vendor/codemirror/mode/tiki/tiki.js | 27 +- public/vendor/codemirror/mode/ttcn-cfg/index.html | 115 +++++++++ public/vendor/codemirror/mode/ttcn-cfg/ttcn-cfg.js | 214 ++++++++++++++++ public/vendor/codemirror/mode/ttcn/index.html | 118 +++++++++ public/vendor/codemirror/mode/ttcn/ttcn.js | 283 +++++++++++++++++++++ public/vendor/codemirror/mode/twig/index.html | 45 ++++ public/vendor/codemirror/mode/twig/twig.js | 132 ++++++++++ public/vendor/codemirror/mode/vb/vb.js | 3 +- public/vendor/codemirror/mode/xquery/xquery.js | 70 +++-- 45 files changed, 2626 insertions(+), 335 deletions(-) create mode 100755 public/vendor/codemirror/mode/asn.1/asn.1.js create mode 100755 public/vendor/codemirror/mode/asn.1/index.html create mode 100755 public/vendor/codemirror/mode/clike/test.js create mode 100755 public/vendor/codemirror/mode/elm/elm.js create mode 100755 public/vendor/codemirror/mode/elm/index.html create mode 100755 public/vendor/codemirror/mode/factor/factor.js create mode 100755 public/vendor/codemirror/mode/factor/index.html create mode 100755 public/vendor/codemirror/mode/mathematica/index.html create mode 100755 public/vendor/codemirror/mode/mathematica/mathematica.js create mode 100755 public/vendor/codemirror/mode/swift/index.html create mode 100755 public/vendor/codemirror/mode/swift/swift.js create mode 100755 public/vendor/codemirror/mode/ttcn-cfg/index.html create mode 100755 public/vendor/codemirror/mode/ttcn-cfg/ttcn-cfg.js create mode 100755 public/vendor/codemirror/mode/ttcn/index.html create mode 100755 public/vendor/codemirror/mode/ttcn/ttcn.js create mode 100755 public/vendor/codemirror/mode/twig/index.html create mode 100755 public/vendor/codemirror/mode/twig/twig.js (limited to 'public/vendor/codemirror/mode') 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 @@ + + +CodeMirror: ASN.1 mode + + + + + + + + +
+

ASN.1 example

+
+ +
+ + +
+

Language: Abstract Syntax Notation One + (ASN.1) +

+

MIME types defined: text/x-ttcn-asn

+ +
+

The development of this mode has been sponsored by Ericsson + .

+

Coded by Asmelash Tsegay Gebretsadkan

+
+ + 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 ]"); - - MT("commentSGML2", - "[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 @@ + + +CodeMirror: Elm mode + + + + + + + + + +
+

Elm mode

+ +
+ + + +

MIME types defined: text/x-elm.

+
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"]}, + // + {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 @@ + + +CodeMirror: Factor mode + + + + + + + + + + + +
+ +

Factor mode

+ +
+
+ + +

+

Simple mode that handles Factor Syntax (Factor on WikiPedia).

+ +

MIME types defined: text/x-factor.

+ +
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.