Upgrade CodeMirror to 5.10.1 and now support fullscreen, jump-to-line in editor

This commit is contained in:
Wu Cheng-Han 2016-01-17 14:28:04 -06:00
parent ce65e58096
commit eaa8ccaccb
381 changed files with 6726 additions and 2636 deletions

0
public/vendor/codemirror/mode/apl/apl.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/apl/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/asciiarmor/asciiarmor.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/asciiarmor/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/asn.1/asn.1.js vendored Executable file → Normal file
View file

3
public/vendor/codemirror/mode/asn.1/index.html vendored Executable file → Normal file
View file

@ -1,4 +1,4 @@
<!doctype html>
<!doctype html>
<title>CodeMirror: ASN.1 mode</title>
<meta charset="utf-8"/>
@ -73,6 +73,5 @@
<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>

0
public/vendor/codemirror/mode/asterisk/asterisk.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/asterisk/index.html vendored Executable file → Normal file
View file

View file

@ -0,0 +1,85 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
// Brainfuck 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"
var reserve = "><+-.,[]".split("");
/*
comments can be either:
placed behind lines
+++ this is a comment
where reserved characters cannot be used
or in a loop
[
this is ok to use [ ] and stuff
]
or preceded by #
*/
CodeMirror.defineMode("brainfuck", function() {
return {
startState: function() {
return {
commentLine: false,
left: 0,
right: 0,
commentLoop: false
}
},
token: function(stream, state) {
if (stream.eatSpace()) return null
if(stream.sol()){
state.commentLine = false;
}
var ch = stream.next().toString();
if(reserve.indexOf(ch) !== -1){
if(state.commentLine === true){
if(stream.eol()){
state.commentLine = false;
}
return "comment";
}
if(ch === "]" || ch === "["){
if(ch === "["){
state.left++;
}
else{
state.right++;
}
return "bracket";
}
else if(ch === "+" || ch === "-"){
return "keyword";
}
else if(ch === "<" || ch === ">"){
return "atom";
}
else if(ch === "." || ch === ","){
return "def";
}
}
else{
state.commentLine = true;
if(stream.eol()){
state.commentLine = false;
}
return "comment";
}
if(stream.eol()){
state.commentLine = false;
}
}
};
});
CodeMirror.defineMIME("text/x-brainfuck","brainfuck")
});

View file

@ -0,0 +1,85 @@
<!doctype html>
<title>CodeMirror: Brainfuck 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="./brainfuck.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="#"></a>
</ul>
</div>
<article>
<h2>Brainfuck mode</h2>
<form><textarea id="code" name="code">
[ This program prints "Hello World!" and a newline to the screen, its
length is 106 active command characters [it is not the shortest.]
This loop is a "comment loop", it's a simple way of adding a comment
to a BF program such that you don't have to worry about any command
characters. Any ".", ",", "+", "-", "&lt;" and "&gt;" characters are simply
ignored, the "[" and "]" characters just have to be balanced.
]
+++++ +++ Set Cell #0 to 8
[
&gt;++++ Add 4 to Cell #1; this will always set Cell #1 to 4
[ as the cell will be cleared by the loop
&gt;++ Add 2 to Cell #2
&gt;+++ Add 3 to Cell #3
&gt;+++ Add 3 to Cell #4
&gt;+ Add 1 to Cell #5
&lt;&lt;&lt;&lt;- Decrement the loop counter in Cell #1
] Loop till Cell #1 is zero; number of iterations is 4
&gt;+ Add 1 to Cell #2
&gt;+ Add 1 to Cell #3
&gt;- Subtract 1 from Cell #4
&gt;&gt;+ Add 1 to Cell #6
[&lt;] Move back to the first zero cell you find; this will
be Cell #1 which was cleared by the previous loop
&lt;- Decrement the loop Counter in Cell #0
] Loop till Cell #0 is zero; number of iterations is 8
The result of this is:
Cell No : 0 1 2 3 4 5 6
Contents: 0 0 72 104 88 32 8
Pointer : ^
&gt;&gt;. Cell #2 has value 72 which is 'H'
&gt;---. Subtract 3 from Cell #3 to get 101 which is 'e'
+++++++..+++. Likewise for 'llo' from Cell #3
&gt;&gt;. Cell #5 is 32 for the space
&lt;-. Subtract 1 from Cell #4 for 87 to give a 'W'
&lt;. Cell #3 was set to 'o' from the end of 'Hello'
+++.------.--------. Cell #3 for 'rl' and 'd'
&gt;&gt;+. Add 1 to Cell #5 gives us an exclamation point
&gt;++. And finally a newline from Cell #6
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true,
mode: "text/x-brainfuck"
});
</script>
<p>A mode for Brainfuck</p>
<p><strong>MIME types defined:</strong> <code>text/x-brainfuck</code></p>
</article>

245
public/vendor/codemirror/mode/clike/clike.js vendored Executable file → Normal file
View file

@ -25,8 +25,12 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
multiLineStrings = parserConfig.multiLineStrings,
indentStatements = parserConfig.indentStatements !== false,
indentSwitch = parserConfig.indentSwitch !== false,
namespaceSeparator = parserConfig.namespaceSeparator;
var isOperatorChar = /[+\-*&%=<>!?|\/]/;
namespaceSeparator = parserConfig.namespaceSeparator,
isPunctuationChar = parserConfig.isPunctuationChar || /[\[\]{}\(\),;\:\.]/,
numberStart = parserConfig.numberStart || /[\d\.]/,
number = parserConfig.number || /^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,
isOperatorChar = parserConfig.isOperatorChar || /[+\-*&%=<>!?|\/]/,
endStatement = parserConfig.endStatement || /^[;:,]$/;
var curPunc, isDefKeyword;
@ -40,13 +44,14 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
state.tokenize = tokenString(ch);
return state.tokenize(stream, state);
}
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
if (isPunctuationChar.test(ch)) {
curPunc = ch;
return null;
}
if (/\d/.test(ch)) {
stream.eatWhile(/[\w\.]/);
return "number";
if (numberStart.test(ch)) {
stream.backUp(1)
if (stream.match(number)) return "number"
stream.next()
}
if (ch == "/") {
if (stream.eat("*")) {
@ -67,17 +72,17 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
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;
if (contains(keywords, cur)) {
if (contains(blockKeywords, cur)) curPunc = "newstatement";
if (contains(defKeywords, cur)) isDefKeyword = true;
return "keyword";
}
if (types.propertyIsEnumerable(cur)) return "variable-3";
if (builtin.propertyIsEnumerable(cur)) {
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
if (contains(types, cur)) return "variable-3";
if (contains(builtin, cur)) {
if (contains(blockKeywords, cur)) curPunc = "newstatement";
return "builtin";
}
if (atoms.propertyIsEnumerable(cur)) return "atom";
if (contains(atoms, cur)) return "atom";
return "variable";
}
@ -168,8 +173,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
if (style == "comment" || style == "meta") return style;
if (ctx.align == null) ctx.align = true;
if ((curPunc == ";" || curPunc == ":" || curPunc == ","))
while (isStatement(state.context.type)) popContext(state);
if (endStatement.test(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(), ")");
@ -212,8 +216,16 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass;
var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
if (isStatement(ctx.type) && firstChar == "}") ctx = ctx.prev;
if (hooks.indent) {
var hook = hooks.indent(state, ctx, textAfter);
if (typeof hook == "number") return hook
}
var closing = firstChar == ctx.type;
var switchBlock = ctx.prev && ctx.prev.type == "switchstatement";
if (parserConfig.allmanIndentation && /[{(]/.test(firstChar)) {
while (ctx.type != "top" && ctx.type != "}") ctx = ctx.prev
return ctx.indented
}
if (isStatement(ctx.type))
return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
if (ctx.align && (!dontAlignCalls || ctx.type != ")"))
@ -238,27 +250,30 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
return obj;
}
function contains(words, word) {
if (typeof words === "function") {
return words(word);
} else {
return words.propertyIsEnumerable(word);
}
}
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";
"static else struct switch extern typedef 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;
for (;;) {
if (stream.skipTo("\\")) {
stream.next();
if (stream.eol()) {
state.tokenize = cppHook;
break;
}
} else {
stream.skipToEnd();
state.tokenize = null;
break;
if (!state.startOfLine) return false
for (var ch, next = null; ch = stream.peek();) {
if (ch == "\\" && stream.match(/^.$/)) {
next = cppHook
break
} else if (ch == "/" && stream.match(/^\/[\/\*]/, false)) {
break
}
stream.next()
}
return "meta";
state.tokenize = next
return "meta"
}
function pointerHook(_stream, state) {
@ -266,6 +281,11 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
return false;
}
function cpp14Literal(stream) {
stream.eatWhile(/[\w\.']/);
return "number";
}
function cpp11StringHook(stream, state) {
stream.backUp(1);
// Raw strings.
@ -373,6 +393,16 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
"U": cpp11StringHook,
"L": cpp11StringHook,
"R": cpp11StringHook,
"0": cpp14Literal,
"1": cpp14Literal,
"2": cpp14Literal,
"3": cpp14Literal,
"4": cpp14Literal,
"5": cpp14Literal,
"6": cpp14Literal,
"7": cpp14Literal,
"8": cpp14Literal,
"9": cpp14Literal,
token: function(stream, state, style) {
if (style == "variable" && stream.peek() == "(" &&
(state.prevToken == ";" || state.prevToken == null ||
@ -398,6 +428,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
defKeywords: words("class interface package enum"),
typeFirstDefinitions: true,
atoms: words("true false null"),
endStatement: /^[;:]$/,
hooks: {
"@": function(stream) {
stream.eatWhile(/[\w\$_]/);
@ -453,7 +484,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
keywords: words(
/* scala */
"abstract case catch class def do else extends false final finally for forSome if " +
"abstract case catch class def do else extends final finally for forSome if " +
"implicit import lazy match new null object override package private protected return " +
"sealed super this throw trait try type val var while with yield _ : = => <- <: " +
"<% >: # @ " +
@ -501,6 +532,59 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
modeProps: {closeBrackets: {triples: '"'}}
});
function tokenKotlinString(tripleString){
return function (stream, state) {
var escaped = false, next, end = false;
while (!stream.eol()) {
if (!tripleString && !escaped && stream.match('"') ) {end = true; break;}
if (tripleString && stream.match('"""')) {end = true; break;}
next = stream.next();
if(!escaped && next == "$" && stream.match('{'))
stream.skipTo("}");
escaped = !escaped && next == "\\" && !tripleString;
}
if (end || !tripleString)
state.tokenize = null;
return "string";
}
}
def("text/x-kotlin", {
name: "clike",
keywords: words(
/*keywords*/
"package as typealias class interface this super val " +
"var fun for is in This throw return " +
"break continue object if else while do try when !in !is as? " +
/*soft keywords*/
"file import where by get set abstract enum open inner override private public internal " +
"protected catch finally out final vararg reified dynamic companion constructor init " +
"sealed field property receiver param sparam lateinit data inline noinline tailrec " +
"external annotation crossinline const operator infix"
),
types: words(
/* package java.lang */
"Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " +
"Compiler Double Exception Float Integer Long Math Number Object Package Pair Process " +
"Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " +
"StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"
),
intendSwitch: false,
indentStatements: false,
multiLineStrings: true,
blockKeywords: words("catch class do else finally for if where try while enum"),
defKeywords: words("class val var object package interface fun"),
atoms: words("true false null this"),
hooks: {
'"': function(stream, state) {
state.tokenize = tokenKotlinString(stream.match('""'));
return state.tokenize(stream, state);
}
},
modeProps: {closeBrackets: {triples: '"'}}
});
def(["x-shader/x-vertex", "x-shader/x-fragment"], {
name: "clike",
keywords: words("sampler1D sampler2D sampler3D samplerCube " +
@ -583,9 +667,106 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
stream.eatWhile(/[\w\$]/);
return "keyword";
},
"#": cppHook
"#": cppHook,
indent: function(_state, ctx, textAfter) {
if (ctx.type == "statement" && /^@\w/.test(textAfter)) return ctx.indented
}
},
modeProps: {fold: "brace"}
});
def("text/x-squirrel", {
name: "clike",
keywords: words("base break clone continue const default delete enum extends function in class" +
" foreach local resume return this throw typeof yield constructor instanceof static"),
types: words(cTypes),
blockKeywords: words("case catch class else for foreach if switch try while"),
defKeywords: words("function local class"),
typeFirstDefinitions: true,
atoms: words("true false null"),
hooks: {"#": cppHook},
modeProps: {fold: ["brace", "include"]}
});
// Ceylon Strings need to deal with interpolation
var stringTokenizer = null;
function tokenCeylonString(type) {
return function(stream, state) {
var escaped = false, next, end = false;
while (!stream.eol()) {
if (!escaped && stream.match('"') &&
(type == "single" || stream.match('""'))) {
end = true;
break;
}
if (!escaped && stream.match('``')) {
stringTokenizer = tokenCeylonString(type);
end = true;
break;
}
next = stream.next();
escaped = type == "single" && !escaped && next == "\\";
}
if (end)
state.tokenize = null;
return "string";
}
}
def("text/x-ceylon", {
name: "clike",
keywords: words("abstracts alias assembly assert assign break case catch class continue dynamic else" +
" exists extends finally for function given if import in interface is let module new" +
" nonempty object of out outer package return satisfies super switch then this throw" +
" try value void while"),
types: function(word) {
// In Ceylon all identifiers that start with an uppercase are types
var first = word.charAt(0);
return (first === first.toUpperCase() && first !== first.toLowerCase());
},
blockKeywords: words("case catch class dynamic else finally for function if interface module new object switch try while"),
defKeywords: words("class dynamic function interface module object package value"),
builtin: words("abstract actual aliased annotation by default deprecated doc final formal late license" +
" native optional sealed see serializable shared suppressWarnings tagged throws variable"),
isPunctuationChar: /[\[\]{}\(\),;\:\.`]/,
isOperatorChar: /[+\-*&%=<>!?|^~:\/]/,
numberStart: /[\d#$]/,
number: /^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,
multiLineStrings: true,
typeFirstDefinitions: true,
atoms: words("true false null larger smaller equal empty finished"),
indentSwitch: false,
styleDefs: false,
hooks: {
"@": function(stream) {
stream.eatWhile(/[\w\$_]/);
return "meta";
},
'"': function(stream, state) {
state.tokenize = tokenCeylonString(stream.match('""') ? "triple" : "single");
return state.tokenize(stream, state);
},
'`': function(stream, state) {
if (!stringTokenizer || !stream.match('`')) return false;
state.tokenize = stringTokenizer;
stringTokenizer = null;
return state.tokenize(stream, state);
},
"'": function(stream) {
stream.eatWhile(/[\w\$_\xa1-\uffff]/);
return "atom";
},
token: function(_stream, state, style) {
if ((style == "variable" || style == "variable-3") &&
state.prevToken == ".") {
return "variable-2";
}
}
},
modeProps: {
fold: ["brace", "import"],
closeBrackets: {triples: '"'}
}
});
});

111
public/vendor/codemirror/mode/clike/index.html vendored Executable file → Normal file
View file

@ -206,6 +206,103 @@ object FilterTest extends App {
}
</textarea></div>
<h2>Kotlin mode</h2>
<div><textarea id="kotlin-code">
package org.wasabi.http
import java.util.concurrent.Executors
import java.net.InetSocketAddress
import org.wasabi.app.AppConfiguration
import io.netty.bootstrap.ServerBootstrap
import io.netty.channel.nio.NioEventLoopGroup
import io.netty.channel.socket.nio.NioServerSocketChannel
import org.wasabi.app.AppServer
public class HttpServer(private val appServer: AppServer) {
val bootstrap: ServerBootstrap
val primaryGroup: NioEventLoopGroup
val workerGroup: NioEventLoopGroup
init {
// Define worker groups
primaryGroup = NioEventLoopGroup()
workerGroup = NioEventLoopGroup()
// Initialize bootstrap of server
bootstrap = ServerBootstrap()
bootstrap.group(primaryGroup, workerGroup)
bootstrap.channel(javaClass<NioServerSocketChannel>())
bootstrap.childHandler(NettyPipelineInitializer(appServer))
}
public fun start(wait: Boolean = true) {
val channel = bootstrap.bind(appServer.configuration.port)?.sync()?.channel()
if (wait) {
channel?.closeFuture()?.sync()
}
}
public fun stop() {
// Shutdown all event loops
primaryGroup.shutdownGracefully()
workerGroup.shutdownGracefully()
// Wait till all threads are terminated
primaryGroup.terminationFuture().sync()
workerGroup.terminationFuture().sync()
}
}
</textarea></div>
<h2>Ceylon mode</h2>
<div><textarea id="ceylon-code">
"Produces the [[stream|Iterable]] that results from repeated
application of the given [[function|next]] to the given
[[first]] element of the stream, until the function first
returns [[finished]]. If the given function never returns
`finished`, the resulting stream is infinite.
For example:
loop(0)(2.plus).takeWhile(10.largerThan)
produces the stream `{ 0, 2, 4, 6, 8 }`."
tagged("Streams")
shared {Element+} loop&lt;Element&gt;(
"The first element of the resulting stream."
Element first)(
"The function that produces the next element of the
stream, given the current element. The function may
return [[finished]] to indicate the end of the
stream."
Element|Finished next(Element element))
=&gt; let (start = first)
object satisfies {Element+} {
first =&gt; start;
empty =&gt; false;
function nextElement(Element element)
=&gt; next(element);
iterator()
=&gt; object satisfies Iterator&lt;Element&gt; {
variable Element|Finished current = start;
shared actual Element|Finished next() {
if (!is Finished result = current) {
current = nextElement(result);
return result;
}
else {
return finished;
}
}
};
};
</textarea></div>
<script>
var cEditor = CodeMirror.fromTextArea(document.getElementById("c-code"), {
lineNumbers: true,
@ -232,6 +329,16 @@ object FilterTest extends App {
matchBrackets: true,
mode: "text/x-scala"
});
var kotlinEditor = CodeMirror.fromTextArea(document.getElementById("kotlin-code"), {
lineNumbers: true,
matchBrackets: true,
mode: "text/x-kotlin"
});
var ceylonEditor = CodeMirror.fromTextArea(document.getElementById("ceylon-code"), {
lineNumbers: true,
matchBrackets: true,
mode: "text/x-ceylon"
});
var mac = CodeMirror.keyMap.default == CodeMirror.keyMap.macDefault;
CodeMirror.keyMap.default[(mac ? "Cmd" : "Ctrl") + "-Space"] = "autocomplete";
</script>
@ -247,5 +354,7 @@ object FilterTest extends App {
(Java), <code>text/x-csharp</code> (C#),
<code>text/x-objectivec</code> (Objective-C),
<code>text/x-scala</code> (Scala), <code>text/x-vertex</code>
and <code>x-shader/x-fragment</code> (shader programs).</p>
<code>x-shader/x-fragment</code> (shader programs),
<code>text/x-squirrel</code> (Squirrel) and
<code>text/x-ceylon</code> (Ceylon)</p>
</article>

0
public/vendor/codemirror/mode/clike/scala.html vendored Executable file → Normal file
View file

18
public/vendor/codemirror/mode/clike/test.js vendored Executable file → Normal file
View file

@ -30,4 +30,22 @@
" [keyword for] (;;)",
" [variable x][operator ++];",
"[keyword return];");
MT("preprocessor",
"[meta #define FOO 3]",
"[variable-3 int] [variable foo];",
"[meta #define BAR\\]",
"[meta 4]",
"[variable-3 unsigned] [variable-3 int] [variable bar] [operator =] [number 8];",
"[meta #include <baz> ][comment // comment]")
var mode_cpp = CodeMirror.getMode({indentUnit: 2}, "text/x-c++src");
function MTCPP(name) { test.mode(name, mode_cpp, Array.prototype.slice.call(arguments, 1)); }
MTCPP("cpp14_literal",
"[number 10'000];",
"[number 0b10'000];",
"[number 0x10'000];",
"[string '100000'];");
})();

3
public/vendor/codemirror/mode/clojure/clojure.js vendored Executable file → Normal file
View file

@ -96,6 +96,9 @@ CodeMirror.defineMode("clojure", function (options) {
if ( '.' == stream.peek() ) {
stream.eat('.');
stream.eatWhile(tests.digit);
} else if ('/' == stream.peek() ) {
stream.eat('/');
stream.eatWhile(tests.digit);
}
if ( stream.eat(tests.exponent) ) {

3
public/vendor/codemirror/mode/clojure/index.html vendored Executable file → Normal file
View file

@ -78,6 +78,9 @@
\tab \return \backspace
\u1000 \uAaAa \u9F9F)
;; Let's play with numbers
(+ 1 -1 1/2 -1/2 -0.5 0.5)
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});

0
public/vendor/codemirror/mode/cmake/cmake.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/cmake/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/cobol/cobol.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/cobol/index.html vendored Executable file → Normal file
View file

40
public/vendor/codemirror/mode/coffeescript/coffeescript.js vendored Executable file → Normal file
View file

@ -25,7 +25,7 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
var operators = /^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/;
var delimiters = /^(?:[()\[\]{},:`=;]|\.\.?\.?)/;
var identifiers = /^[_A-Za-z$][_A-Za-z$0-9]*/;
var properties = /^(@|this\.)[_A-Za-z$][_A-Za-z$0-9]*/;
var atProp = /^@[_A-Za-z$][_A-Za-z$0-9]*/;
var wordOperators = wordRegexp(["and", "or", "not",
"is", "isnt", "in",
@ -145,6 +145,8 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
}
}
// Handle operators and delimiters
if (stream.match(operators) || stream.match(wordOperators)) {
return "operator";
@ -157,6 +159,10 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
return "atom";
}
if (stream.match(atProp) || state.prop && stream.match(identifiers)) {
return "property";
}
if (stream.match(keywords)) {
return "keyword";
}
@ -165,10 +171,6 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
return "variable";
}
if (stream.match(properties)) {
return "property";
}
// Handle non-detected items
stream.next();
return ERRORCLASS;
@ -265,24 +267,11 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
var style = state.tokenize(stream, state);
var current = stream.current();
// Handle "." connected identifiers
if (current === ".") {
style = state.tokenize(stream, state);
current = stream.current();
if (/^\.[\w$]+$/.test(current)) {
return "variable";
} else {
return ERRORCLASS;
}
}
// Handle scope changes.
if (current === "return") {
state.dedent = true;
}
if (((current === "->" || current === "=>") &&
!state.lambda &&
!stream.peek())
if (((current === "->" || current === "=>") && stream.eol())
|| style === "indent") {
indent(stream, state);
}
@ -324,8 +313,7 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
return {
tokenize: tokenBase,
scope: {offset:basecolumn || 0, type:"coffee", prev: null, align: false},
lastToken: null,
lambda: false,
prop: false,
dedent: 0
};
},
@ -335,12 +323,9 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
if (fillAlign && stream.sol()) fillAlign.align = false;
var style = tokenLexer(stream, state);
if (fillAlign && style && style != "comment") fillAlign.align = true;
state.lastToken = {style:style, content: stream.current()};
if (stream.eol() && stream.lambda) {
state.lambda = false;
if (style && style != "comment") {
if (fillAlign) fillAlign.align = true;
state.prop = style == "punctuation" && stream.current() == "."
}
return style;
@ -365,5 +350,6 @@ CodeMirror.defineMode("coffeescript", function(conf, parserConf) {
});
CodeMirror.defineMIME("text/x-coffeescript", "coffeescript");
CodeMirror.defineMIME("text/coffeescript", "coffeescript");
});

0
public/vendor/codemirror/mode/coffeescript/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/commonlisp/commonlisp.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/commonlisp/index.html vendored Executable file → Normal file
View file

View file

@ -0,0 +1,391 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.defineMode("crystal", function(config) {
function wordRegExp(words, end) {
return new RegExp((end ? "" : "^") + "(?:" + words.join("|") + ")" + (end ? "$" : "\\b"));
}
function chain(tokenize, stream, state) {
state.tokenize.push(tokenize);
return tokenize(stream, state);
}
var operators = /^(?:[-+/%|&^]|\*\*?|[<>]{2})/;
var conditionalOperators = /^(?:[=!]~|===|<=>|[<>=!]=?|[|&]{2}|~)/;
var indexingOperators = /^(?:\[\][?=]?)/;
var anotherOperators = /^(?:\.(?:\.{2})?|->|[?:])/;
var idents = /^[a-z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/;
var types = /^[A-Z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/;
var keywords = wordRegExp([
"abstract", "alias", "as", "asm", "begin", "break", "case", "class", "def", "do",
"else", "elsif", "end", "ensure", "enum", "extend", "for", "fun", "if", "ifdef",
"include", "instance_sizeof", "lib", "macro", "module", "next", "of", "out", "pointerof",
"private", "protected", "rescue", "return", "require", "sizeof", "struct",
"super", "then", "type", "typeof", "union", "unless", "until", "when", "while", "with",
"yield", "__DIR__", "__FILE__", "__LINE__"
]);
var atomWords = wordRegExp(["true", "false", "nil", "self"]);
var indentKeywordsArray = [
"def", "fun", "macro",
"class", "module", "struct", "lib", "enum", "union",
"if", "unless", "case", "while", "until", "begin", "then",
"do",
"for", "ifdef"
];
var indentKeywords = wordRegExp(indentKeywordsArray);
var dedentKeywordsArray = [
"end",
"else", "elsif",
"rescue", "ensure"
];
var dedentKeywords = wordRegExp(dedentKeywordsArray);
var dedentPunctualsArray = ["\\)", "\\}", "\\]"];
var dedentPunctuals = new RegExp("^(?:" + dedentPunctualsArray.join("|") + ")$");
var nextTokenizer = {
"def": tokenFollowIdent, "fun": tokenFollowIdent, "macro": tokenMacroDef,
"class": tokenFollowType, "module": tokenFollowType, "struct": tokenFollowType,
"lib": tokenFollowType, "enum": tokenFollowType, "union": tokenFollowType
};
var matching = {"[": "]", "{": "}", "(": ")", "<": ">"};
function tokenBase(stream, state) {
if (stream.eatSpace()) {
return null;
}
// Macros
if (state.lastToken != "\\" && stream.match("{%", false)) {
return chain(tokenMacro("%", "%"), stream, state);
}
if (state.lastToken != "\\" && stream.match("{{", false)) {
return chain(tokenMacro("{", "}"), stream, state);
}
// Comments
if (stream.peek() == "#") {
stream.skipToEnd();
return "comment";
}
// Variables and keywords
var matched;
if (stream.match(idents)) {
stream.eat(/[?!]/);
matched = stream.current();
if (stream.eat(":")) {
return "atom";
} else if (state.lastToken == ".") {
return "property";
} else if (keywords.test(matched)) {
if (state.lastToken != "abstract" && indentKeywords.test(matched)) {
if (!(matched == "fun" && state.blocks.indexOf("lib") >= 0)) {
state.blocks.push(matched);
state.currentIndent += 1;
}
} else if (dedentKeywords.test(matched)) {
state.blocks.pop();
state.currentIndent -= 1;
}
if (nextTokenizer.hasOwnProperty(matched)) {
state.tokenize.push(nextTokenizer[matched]);
}
return "keyword";
} else if (atomWords.test(matched)) {
return "atom";
}
return "variable";
}
// Class variables and instance variables
// or attributes
if (stream.eat("@")) {
if (stream.peek() == "[") {
return chain(tokenNest("[", "]", "meta"), stream, state);
}
stream.eat("@");
stream.match(idents) || stream.match(types);
return "variable-2";
}
// Global variables
if (stream.eat("$")) {
stream.eat(/[0-9]+|\?/) || stream.match(idents) || stream.match(types);
return "variable-3";
}
// Constants and types
if (stream.match(types)) {
return "tag";
}
// Symbols or ':' operator
if (stream.eat(":")) {
if (stream.eat("\"")) {
return chain(tokenQuote("\"", "atom", false), stream, state);
} else if (stream.match(idents) || stream.match(types) ||
stream.match(operators) || stream.match(conditionalOperators) || stream.match(indexingOperators)) {
return "atom";
}
stream.eat(":");
return "operator";
}
// Strings
if (stream.eat("\"")) {
return chain(tokenQuote("\"", "string", true), stream, state);
}
// Strings or regexps or macro variables or '%' operator
if (stream.peek() == "%") {
var style = "string";
var embed = true;
var delim;
if (stream.match("%r")) {
// Regexps
style = "string-2";
delim = stream.next();
} else if (stream.match("%w")) {
embed = false;
delim = stream.next();
} else {
if(delim = stream.match(/^%([^\w\s=])/)) {
delim = delim[1];
} else if (stream.match(/^%[a-zA-Z0-9_\u009F-\uFFFF]*/)) {
// Macro variables
return "meta";
} else {
// '%' operator
return "operator";
}
}
if (matching.hasOwnProperty(delim)) {
delim = matching[delim];
}
return chain(tokenQuote(delim, style, embed), stream, state);
}
// Characters
if (stream.eat("'")) {
stream.match(/^(?:[^']|\\(?:[befnrtv0'"]|[0-7]{3}|u(?:[0-9a-fA-F]{4}|\{[0-9a-fA-F]{1,6}\})))/);
stream.eat("'");
return "atom";
}
// Numbers
if (stream.eat("0")) {
if (stream.eat("x")) {
stream.match(/^[0-9a-fA-F]+/);
} else if (stream.eat("o")) {
stream.match(/^[0-7]+/);
} else if (stream.eat("b")) {
stream.match(/^[01]+/);
}
return "number";
}
if (stream.eat(/\d/)) {
stream.match(/^\d*(?:\.\d+)?(?:[eE][+-]?\d+)?/);
return "number";
}
// Operators
if (stream.match(operators)) {
stream.eat("="); // Operators can follow assigin symbol.
return "operator";
}
if (stream.match(conditionalOperators) || stream.match(anotherOperators)) {
return "operator";
}
// Parens and braces
if (matched = stream.match(/[({[]/, false)) {
matched = matched[0];
return chain(tokenNest(matched, matching[matched], null), stream, state);
}
// Escapes
if (stream.eat("\\")) {
stream.next();
return "meta";
}
stream.next();
return null;
}
function tokenNest(begin, end, style, started) {
return function (stream, state) {
if (!started && stream.match(begin)) {
state.tokenize[state.tokenize.length - 1] = tokenNest(begin, end, style, true);
state.currentIndent += 1;
return style;
}
var nextStyle = tokenBase(stream, state);
if (stream.current() === end) {
state.tokenize.pop();
state.currentIndent -= 1;
nextStyle = style;
}
return nextStyle;
};
}
function tokenMacro(begin, end, started) {
return function (stream, state) {
if (!started && stream.match("{" + begin)) {
state.currentIndent += 1;
state.tokenize[state.tokenize.length - 1] = tokenMacro(begin, end, true);
return "meta";
}
if (stream.match(end + "}")) {
state.currentIndent -= 1;
state.tokenize.pop();
return "meta";
}
return tokenBase(stream, state);
};
}
function tokenMacroDef(stream, state) {
if (stream.eatSpace()) {
return null;
}
var matched;
if (matched = stream.match(idents)) {
if (matched == "def") {
return "keyword";
}
stream.eat(/[?!]/);
}
state.tokenize.pop();
return "def";
}
function tokenFollowIdent(stream, state) {
if (stream.eatSpace()) {
return null;
}
if (stream.match(idents)) {
stream.eat(/[!?]/);
} else {
stream.match(operators) || stream.match(conditionalOperators) || stream.match(indexingOperators);
}
state.tokenize.pop();
return "def";
}
function tokenFollowType(stream, state) {
if (stream.eatSpace()) {
return null;
}
stream.match(types);
state.tokenize.pop();
return "def";
}
function tokenQuote(end, style, embed) {
return function (stream, state) {
var escaped = false;
while (stream.peek()) {
if (!escaped) {
if (stream.match("{%", false)) {
state.tokenize.push(tokenMacro("%", "%"));
return style;
}
if (stream.match("{{", false)) {
state.tokenize.push(tokenMacro("{", "}"));
return style;
}
if (embed && stream.match("#{", false)) {
state.tokenize.push(tokenNest("#{", "}", "meta"));
return style;
}
var ch = stream.next();
if (ch == end) {
state.tokenize.pop();
return style;
}
escaped = ch == "\\";
} else {
stream.next();
escaped = false;
}
}
return style;
};
}
return {
startState: function () {
return {
tokenize: [tokenBase],
currentIndent: 0,
lastToken: null,
blocks: []
};
},
token: function (stream, state) {
var style = state.tokenize[state.tokenize.length - 1](stream, state);
var token = stream.current();
if (style && style != "comment") {
state.lastToken = token;
}
return style;
},
indent: function (state, textAfter) {
textAfter = textAfter.replace(/^\s*(?:\{%)?\s*|\s*(?:%\})?\s*$/g, "");
if (dedentKeywords.test(textAfter) || dedentPunctuals.test(textAfter)) {
return config.indentUnit * (state.currentIndent - 1);
}
return config.indentUnit * state.currentIndent;
},
fold: "indent",
electricInput: wordRegExp(dedentPunctualsArray.concat(dedentKeywordsArray), true),
lineComment: '#'
};
});
CodeMirror.defineMIME("text/x-crystal", "crystal");
});

View file

@ -0,0 +1,119 @@
<!doctype html>
<title>CodeMirror: Crystal 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="crystal.js"></script>
<style>
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
.cm-s-default span.cm-arrow { color: red; }
</style>
<div id=nav>
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
<ul>
<li><a href="../../index.html">Home</a>
<li><a href="../../doc/manual.html">Manual</a>
<li><a href="https://github.com/codemirror/codemirror">Code</a>
</ul>
<ul>
<li><a href="../index.html">Language modes</a>
<li><a class=active href="#">Crystal</a>
</ul>
</div>
<article>
<h2>Crystal mode</h2>
<form><textarea id="code" name="code">
# Features of Crystal
# - Ruby-inspired syntax.
# - Statically type-checked but without having to specify the type of variables or method arguments.
# - Be able to call C code by writing bindings to it in Crystal.
# - Have compile-time evaluation and generation of code, to avoid boilerplate code.
# - Compile to efficient native code.
# A very basic HTTP server
require "http/server"
server = HTTP::Server.new(8080) do |request|
HTTP::Response.ok "text/plain", "Hello world, got #{request.path}!"
end
puts "Listening on http://0.0.0.0:8080"
server.listen
module Foo
def initialize(@foo); end
abstract def abstract_method : String
@[AlwaysInline]
def with_foofoo
with Foo.new(self) yield
end
struct Foo
def initialize(@foo); end
def hello_world
@foo.abstract_method
end
end
end
class Bar
include Foo
@@foobar = 12345
def initialize(@bar)
super(@bar.not_nil! + 100)
end
macro alias_method(name, method)
def {{ name }}(*args)
{{ method }}(*args)
end
end
def a_method
"Hello, World"
end
alias_method abstract_method, a_method
macro def show_instance_vars : Nil
{% for var in @type.instance_vars %}
puts "@{{ var }} = #{ @{{ var }} }"
{% end %}
nil
end
end
class Baz &lt; Bar; end
lib LibC
fun c_puts = "puts"(str : Char*) : Int
end
$baz = Baz.new(100)
$baz.show_instance_vars
$baz.with_foofoo do
LibC.c_puts hello_world
end
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: "text/x-crystal",
matchBrackets: true,
indentUnit: 2
});
</script>
<p><strong>MIME types defined:</strong> <code>text/x-crystal</code>.</p>
</article>

147
public/vendor/codemirror/mode/css/css.js vendored Executable file → Normal file
View file

@ -12,6 +12,7 @@
"use strict";
CodeMirror.defineMode("css", function(config, parserConfig) {
var inline = parserConfig.inline
if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode("text/css");
var indentUnit = config.indentUnit,
@ -19,13 +20,15 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
documentTypes = parserConfig.documentTypes || {},
mediaTypes = parserConfig.mediaTypes || {},
mediaFeatures = parserConfig.mediaFeatures || {},
mediaValueKeywords = parserConfig.mediaValueKeywords || {},
propertyKeywords = parserConfig.propertyKeywords || {},
nonStandardPropertyKeywords = parserConfig.nonStandardPropertyKeywords || {},
fontProperties = parserConfig.fontProperties || {},
counterDescriptors = parserConfig.counterDescriptors || {},
colorKeywords = parserConfig.colorKeywords || {},
valueKeywords = parserConfig.valueKeywords || {},
allowNested = parserConfig.allowNested;
allowNested = parserConfig.allowNested,
supportsAtComponent = parserConfig.supportsAtComponent === true;
var type, override;
function ret(style, tp) { type = tp; return style; }
@ -119,13 +122,14 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
this.prev = prev;
}
function pushContext(state, stream, type) {
state.context = new Context(type, stream.indentation() + indentUnit, state.context);
function pushContext(state, stream, type, indent) {
state.context = new Context(type, stream.indentation() + (indent === false ? 0 : indentUnit), state.context);
return type;
}
function popContext(state) {
state.context = state.context.prev;
if (state.context.prev)
state.context = state.context.prev;
return state.context.type;
}
@ -157,9 +161,13 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
return pushContext(state, stream, "block");
} else if (type == "}" && state.context.prev) {
return popContext(state);
} else if (/@(media|supports|(-moz-)?document)/.test(type)) {
} else if (supportsAtComponent && /@component/.test(type)) {
return pushContext(state, stream, "atComponentBlock");
} else if (/^@(-moz-)?document$/.test(type)) {
return pushContext(state, stream, "documentTypes");
} else if (/^@(media|supports|(-moz-)?document|import)$/.test(type)) {
return pushContext(state, stream, "atBlock");
} else if (/@(font-face|counter-style)/.test(type)) {
} else if (/^@(font-face|counter-style)/.test(type)) {
state.stateArg = type;
return "restricted_atBlock_before";
} else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) {
@ -219,7 +227,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
if (type == "}" || type == "{") return popAndPass(type, stream, state);
if (type == "(") return pushContext(state, stream, "parens");
if (type == "hash" && !/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(stream.current())) {
if (type == "hash" && !/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(stream.current())) {
override += " error";
} else if (type == "word") {
wordAsValue(stream);
@ -252,33 +260,56 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
return pass(type, stream, state);
};
states.documentTypes = function(type, stream, state) {
if (type == "word" && documentTypes.hasOwnProperty(stream.current())) {
override = "tag";
return state.context.type;
} else {
return states.atBlock(type, stream, state);
}
};
states.atBlock = function(type, stream, state) {
if (type == "(") return pushContext(state, stream, "atBlock_parens");
if (type == "}") return popAndPass(type, stream, state);
if (type == "}" || type == ";") return popAndPass(type, stream, state);
if (type == "{") return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top");
if (type == "interpolation") return pushContext(state, stream, "interpolation");
if (type == "word") {
var word = stream.current().toLowerCase();
if (word == "only" || word == "not" || word == "and" || word == "or")
override = "keyword";
else if (documentTypes.hasOwnProperty(word))
override = "tag";
else if (mediaTypes.hasOwnProperty(word))
override = "attribute";
else if (mediaFeatures.hasOwnProperty(word))
override = "property";
else if (mediaValueKeywords.hasOwnProperty(word))
override = "keyword";
else if (propertyKeywords.hasOwnProperty(word))
override = "property";
else if (nonStandardPropertyKeywords.hasOwnProperty(word))
override = "string-2";
else if (valueKeywords.hasOwnProperty(word))
override = "atom";
else if (colorKeywords.hasOwnProperty(word))
override = "keyword";
else
override = "error";
}
return state.context.type;
};
states.atComponentBlock = function(type, stream, state) {
if (type == "}")
return popAndPass(type, stream, state);
if (type == "{")
return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top", false);
if (type == "word")
override = "error";
return state.context.type;
};
states.atBlock_parens = function(type, stream, state) {
if (type == ")") return popContext(state);
if (type == "{" || type == "}") return popAndPass(type, stream, state, 2);
@ -336,9 +367,9 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
return {
startState: function(base) {
return {tokenize: null,
state: "top",
state: inline ? "block" : "top",
stateArg: null,
context: new Context("top", base || 0, null)};
context: new Context(inline ? "block" : "top", base || 0, null)};
},
token: function(stream, state) {
@ -357,12 +388,18 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
var cx = state.context, ch = textAfter && textAfter.charAt(0);
var indent = cx.indent;
if (cx.type == "prop" && (ch == "}" || ch == ")")) cx = cx.prev;
if (cx.prev &&
(ch == "}" && (cx.type == "block" || cx.type == "top" || cx.type == "interpolation" || cx.type == "restricted_atBlock") ||
ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") ||
ch == "{" && (cx.type == "at" || cx.type == "atBlock"))) {
indent = cx.indent - indentUnit;
cx = cx.prev;
if (cx.prev) {
if (ch == "}" && (cx.type == "block" || cx.type == "top" ||
cx.type == "interpolation" || cx.type == "restricted_atBlock")) {
// Resume indentation from parent context.
cx = cx.prev;
indent = cx.indent;
} else if (ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") ||
ch == "{" && (cx.type == "at" || cx.type == "atBlock")) {
// Dedent relative to current context.
indent = Math.max(0, cx.indent - indentUnit);
cx = cx.prev;
}
}
return indent;
},
@ -399,17 +436,24 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"min-device-aspect-ratio", "max-device-aspect-ratio", "color", "min-color",
"max-color", "color-index", "min-color-index", "max-color-index",
"monochrome", "min-monochrome", "max-monochrome", "resolution",
"min-resolution", "max-resolution", "scan", "grid"
"min-resolution", "max-resolution", "scan", "grid", "orientation",
"device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio",
"pointer", "any-pointer", "hover", "any-hover"
], mediaFeatures = keySet(mediaFeatures_);
var mediaValueKeywords_ = [
"landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover",
"interlace", "progressive"
], mediaValueKeywords = keySet(mediaValueKeywords_);
var propertyKeywords_ = [
"align-content", "align-items", "align-self", "alignment-adjust",
"alignment-baseline", "anchor-point", "animation", "animation-delay",
"animation-direction", "animation-duration", "animation-fill-mode",
"animation-iteration-count", "animation-name", "animation-play-state",
"animation-timing-function", "appearance", "azimuth", "backface-visibility",
"background", "background-attachment", "background-clip", "background-color",
"background-image", "background-origin", "background-position",
"background", "background-attachment", "background-blend-mode", "background-clip",
"background-color", "background-image", "background-origin", "background-position",
"background-repeat", "background-size", "baseline-shift", "binding",
"bleed", "bookmark-label", "bookmark-level", "bookmark-state",
"bookmark-target", "border", "border-bottom", "border-bottom-color",
@ -553,11 +597,12 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"capitalize", "caps-lock-indicator", "caption", "captiontext", "caret",
"cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch",
"cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
"col-resize", "collapse", "column", "compact", "condensed", "contain", "content",
"col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse",
"compact", "condensed", "contain", "content",
"content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop",
"cross", "crosshair", "currentcolor", "cursive", "cyclic", "dashed", "decimal",
"cross", "crosshair", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal",
"decimal-leading-zero", "default", "default-button", "destination-atop",
"destination-in", "destination-out", "destination-over", "devanagari",
"destination-in", "destination-out", "destination-over", "devanagari", "difference",
"disc", "discard", "disclosure-closed", "disclosure-open", "document",
"dot-dash", "dot-dot-dash",
"dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out",
@ -568,23 +613,23 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"ethiopic-halehame-gez", "ethiopic-halehame-om-et",
"ethiopic-halehame-sid-et", "ethiopic-halehame-so-et",
"ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig",
"ethiopic-numeric", "ew-resize", "expanded", "extends", "extra-condensed",
"extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "flex", "footnotes",
"ethiopic-numeric", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed",
"extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes",
"forwards", "from", "geometricPrecision", "georgian", "graytext", "groove",
"gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hebrew",
"gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hard-light", "hebrew",
"help", "hidden", "hide", "higher", "highlight", "highlighttext",
"hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore",
"hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "hue", "icon", "ignore",
"inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite",
"infobackground", "infotext", "inherit", "initial", "inline", "inline-axis",
"inline-block", "inline-flex", "inline-table", "inset", "inside", "intrinsic", "invert",
"italic", "japanese-formal", "japanese-informal", "justify", "kannada",
"katakana", "katakana-iroha", "keep-all", "khmer",
"korean-hangul-formal", "korean-hanja-formal", "korean-hanja-informal",
"landscape", "lao", "large", "larger", "left", "level", "lighter",
"landscape", "lao", "large", "larger", "left", "level", "lighter", "lighten",
"line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem",
"local", "logical", "loud", "lower", "lower-alpha", "lower-armenian",
"lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian",
"lower-roman", "lowercase", "ltr", "malayalam", "match", "matrix", "matrix3d",
"lower-roman", "lowercase", "ltr", "luminosity", "malayalam", "match", "matrix", "matrix3d",
"media-controls-background", "media-current-time-display",
"media-fullscreen-button", "media-mute-button", "media-play-button",
"media-return-to-realtime-button", "media-rewind-button",
@ -593,7 +638,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"media-volume-slider-container", "media-volume-sliderthumb", "medium",
"menu", "menulist", "menulist-button", "menulist-text",
"menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic",
"mix", "mongolian", "monospace", "move", "multiple", "myanmar", "n-resize",
"mix", "mongolian", "monospace", "move", "multiple", "multiply", "myanmar", "n-resize",
"narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
"no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
"ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "open-quote",
@ -606,8 +651,8 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"relative", "repeat", "repeating-linear-gradient",
"repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse",
"rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY",
"rotateZ", "round", "row-resize", "rtl", "run-in", "running",
"s-resize", "sans-serif", "scale", "scale3d", "scaleX", "scaleY", "scaleZ",
"rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running",
"s-resize", "sans-serif", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen",
"scroll", "scrollbar", "se-resize", "searchfield",
"searchfield-cancel-button", "searchfield-decoration",
"searchfield-results-button", "searchfield-results-decoration",
@ -615,8 +660,8 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"simp-chinese-formal", "simp-chinese-informal", "single",
"skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal",
"slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
"small", "small-caps", "small-caption", "smaller", "solid", "somali",
"source-atop", "source-in", "source-out", "source-over", "space", "spell-out", "square",
"small", "small-caps", "small-caption", "smaller", "soft-light", "solid", "somali",
"source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "spell-out", "square",
"square-button", "start", "static", "status-bar", "stretch", "stroke", "sub",
"subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "table",
"table-caption", "table-cell", "table-column", "table-column-group",
@ -633,12 +678,13 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url",
"var", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted",
"visibleStroke", "visual", "w-resize", "wait", "wave", "wider",
"window", "windowframe", "windowtext", "words", "x-large", "x-small", "xor",
"window", "windowframe", "windowtext", "words", "wrap", "wrap-reverse", "x-large", "x-small", "xor",
"xx-large", "xx-small"
], valueKeywords = keySet(valueKeywords_);
var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(propertyKeywords_)
.concat(nonStandardPropertyKeywords_).concat(colorKeywords_).concat(valueKeywords_);
var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(mediaValueKeywords_)
.concat(propertyKeywords_).concat(nonStandardPropertyKeywords_).concat(colorKeywords_)
.concat(valueKeywords_);
CodeMirror.registerHelper("hintWords", "css", allWords);
function tokenCComment(stream, state) {
@ -657,6 +703,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
documentTypes: documentTypes,
mediaTypes: mediaTypes,
mediaFeatures: mediaFeatures,
mediaValueKeywords: mediaValueKeywords,
propertyKeywords: propertyKeywords,
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
fontProperties: fontProperties,
@ -676,6 +723,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
CodeMirror.defineMIME("text/x-scss", {
mediaTypes: mediaTypes,
mediaFeatures: mediaFeatures,
mediaValueKeywords: mediaValueKeywords,
propertyKeywords: propertyKeywords,
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
colorKeywords: colorKeywords,
@ -717,6 +765,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
CodeMirror.defineMIME("text/x-less", {
mediaTypes: mediaTypes,
mediaFeatures: mediaFeatures,
mediaValueKeywords: mediaValueKeywords,
propertyKeywords: propertyKeywords,
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
colorKeywords: colorKeywords,
@ -751,4 +800,26 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
helperType: "less"
});
CodeMirror.defineMIME("text/x-gss", {
documentTypes: documentTypes,
mediaTypes: mediaTypes,
mediaFeatures: mediaFeatures,
propertyKeywords: propertyKeywords,
nonStandardPropertyKeywords: nonStandardPropertyKeywords,
fontProperties: fontProperties,
counterDescriptors: counterDescriptors,
colorKeywords: colorKeywords,
valueKeywords: valueKeywords,
supportsAtComponent: true,
tokenHooks: {
"/": function(stream, state) {
if (!stream.eat("*")) return false;
state.tokenize = tokenCComment;
return tokenCComment(stream, state);
}
},
name: "css",
helperType: "gss"
});
});

View file

@ -0,0 +1,103 @@
<!doctype html>
<title>CodeMirror: Closure Stylesheets (GSS) mode</title>
<meta charset="utf-8"/>
<link rel=stylesheet href="../../doc/docs.css">
<link rel="stylesheet" href="../../lib/codemirror.css">
<link rel="stylesheet" href="../../addon/hint/show-hint.css">
<script src="../../lib/codemirror.js"></script>
<script src="css.js"></script>
<script src="../../addon/hint/show-hint.js"></script>
<script src="../../addon/hint/css-hint.js"></script>
<style>.CodeMirror {background: #f8f8f8;}</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="#">Closure Stylesheets (GSS)</a>
</ul>
</div>
<article>
<h2>Closure Stylesheets (GSS) mode</h2>
<form><textarea id="code" name="code">
/* Some example Closure Stylesheets */
@provide 'some.styles';
@require 'other.styles';
@component {
@def FONT_FAMILY "Times New Roman", Georgia, Serif;
@def FONT_SIZE_NORMAL 15px;
@def FONT_NORMAL normal FONT_SIZE_NORMAL FONT_FAMILY;
@def BG_COLOR rgb(235, 239, 249);
@def DIALOG_BORDER_COLOR rgb(107, 144, 218);
@def DIALOG_BG_COLOR BG_COLOR;
@def LEFT_HAND_NAV_WIDTH 180px;
@def LEFT_HAND_NAV_PADDING 3px;
@defmixin size(WIDTH, HEIGHT) {
width: WIDTH;
height: HEIGHT;
}
body {
background-color: BG_COLOR;
margin: 0;
padding: 3em 6em;
font: FONT_NORMAL;
color: #000;
}
#navigation a {
font-weight: bold;
text-decoration: none !important;
}
.dialog {
background-color: DIALOG_BG_COLOR;
border: 1px solid DIALOG_BORDER_COLOR;
}
.content {
position: absolute;
margin-left: add(LEFT_HAND_NAV_PADDING, /* padding left */
LEFT_HAND_NAV_WIDTH,
LEFT_HAND_NAV_PADDING); /* padding right */
}
.logo {
@mixin size(150px, 55px);
background-image: url('http://www.google.com/images/logo_sm.gif');
}
}
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
extraKeys: {"Ctrl-Space": "autocomplete"},
lineNumbers: true,
matchBrackets: "text/x-less",
mode: "text/x-gss"
});
</script>
<p>A mode for <a href="https://github.com/google/closure-stylesheets">Closure Stylesheets</a> (GSS).</p>
<p><strong>MIME type defined:</strong> <code>text/x-gss</code>.</p>
<p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#gss_*">normal</a>, <a href="../../test/index.html#verbose,gss_*">verbose</a>.</p>
</article>

View file

@ -0,0 +1,17 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function() {
"use strict";
var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-gss");
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "gss"); }
MT("atComponent",
"[def @component] {",
"[tag foo] {",
" [property color]: [keyword black];",
"}",
"}");
})();

0
public/vendor/codemirror/mode/css/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/css/less.html vendored Executable file → Normal file
View file

4
public/vendor/codemirror/mode/css/less_test.js vendored Executable file → Normal file
View file

@ -26,10 +26,10 @@
MT("mixin",
"[qualifier .mixin] ([variable dark]; [variable-2 @color]) {",
" [property color]: [variable darken]([variable-2 @color], [number 10%]);",
" [property color]: [atom darken]([variable-2 @color], [number 10%]);",
"}",
"[qualifier .mixin] ([variable light]; [variable-2 @color]) {",
" [property color]: [variable lighten]([variable-2 @color], [number 10%]);",
" [property color]: [atom lighten]([variable-2 @color], [number 10%]);",
"}",
"[qualifier .mixin] ([variable-2 @_]; [variable-2 @color]) {",
" [property display]: [atom block];",

0
public/vendor/codemirror/mode/css/scss.html vendored Executable file → Normal file
View file

2
public/vendor/codemirror/mode/css/scss_test.js vendored Executable file → Normal file
View file

@ -95,7 +95,7 @@
MT('indent_parentheses',
"[tag foo] {",
" [property color]: [variable darken]([variable-2 $blue],",
" [property color]: [atom darken]([variable-2 $blue],",
" [number 9%]);",
"}");

22
public/vendor/codemirror/mode/css/test.js vendored Executable file → Normal file
View file

@ -6,7 +6,7 @@
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
// Error, because "foobarhello" is neither a known type or property, but
// property was expected (after "and"), and it should be in parenthese.
// property was expected (after "and"), and it should be in parentheses.
MT("atMediaUnknownType",
"[def @media] [attribute screen] [keyword and] [error foobarhello] { }");
@ -18,6 +18,12 @@
MT("atMediaMaxWidthNested",
"[def @media] [attribute screen] [keyword and] ([property max-width]: [number 25px]) { [tag foo] { } }");
MT("atMediaFeatureValueKeyword",
"[def @media] ([property orientation]: [keyword landscape]) { }");
MT("atMediaUnknownFeatureValueKeyword",
"[def @media] ([property orientation]: [error upsidedown]) { }");
MT("tagSelector",
"[tag foo] { }");
@ -49,11 +55,17 @@
MT("tagColorHex3",
"[tag foo] { [property background]: [atom #fff]; }");
MT("tagColorHex4",
"[tag foo] { [property background]: [atom #ffff]; }");
MT("tagColorHex6",
"[tag foo] { [property background]: [atom #ffffff]; }");
MT("tagColorHex4",
"[tag foo] { [property background]: [atom&error #ffff]; }");
MT("tagColorHex8",
"[tag foo] { [property background]: [atom #ffffffff]; }");
MT("tagColorHex5Invalid",
"[tag foo] { [property background]: [atom&error #fffff]; }");
MT("tagColorHexInvalid",
"[tag foo] { [property background]: [atom&error #ffg]; }");
@ -114,7 +126,7 @@
"}");
MT("empty_url",
"[def @import] [tag url]() [tag screen];");
"[def @import] [atom url]() [attribute screen];");
MT("parens",
"[qualifier .foo] {",
@ -150,7 +162,7 @@
" [tag foo] {",
" [property font-family]: [variable Verdana], [atom sans-serif];",
" }",
" }");
"}");
MT("document_url",
"[def @document] [tag url]([string http://blah]) { [qualifier .class] { } }");

6
public/vendor/codemirror/mode/cypher/cypher.js vendored Executable file → Normal file
View file

@ -60,9 +60,9 @@
};
var indentUnit = config.indentUnit;
var curPunc;
var funcs = wordRegexp(["abs", "acos", "allShortestPaths", "asin", "atan", "atan2", "avg", "ceil", "coalesce", "collect", "cos", "cot", "count", "degrees", "e", "endnode", "exp", "extract", "filter", "floor", "haversin", "head", "id", "keys", "labels", "last", "left", "length", "log", "log10", "lower", "ltrim", "max", "min", "node", "nodes", "percentileCont", "percentileDisc", "pi", "radians", "rand", "range", "reduce", "rel", "relationship", "relationships", "replace", "right", "round", "rtrim", "shortestPath", "sign", "sin", "split", "sqrt", "startnode", "stdev", "stdevp", "str", "substring", "sum", "tail", "tan", "timestamp", "toFloat", "toInt", "trim", "type", "upper"]);
var preds = wordRegexp(["all", "and", "any", "has", "in", "none", "not", "or", "single", "xor"]);
var keywords = wordRegexp(["as", "asc", "ascending", "assert", "by", "case", "commit", "constraint", "create", "csv", "cypher", "delete", "desc", "descending", "distinct", "drop", "else", "end", "explain", "false", "fieldterminator", "foreach", "from", "headers", "in", "index", "is", "limit", "load", "match", "merge", "null", "on", "optional", "order", "periodic", "profile", "remove", "return", "scan", "set", "skip", "start", "then", "true", "union", "unique", "unwind", "using", "when", "where", "with"]);
var funcs = wordRegexp(["abs", "acos", "allShortestPaths", "asin", "atan", "atan2", "avg", "ceil", "coalesce", "collect", "cos", "cot", "count", "degrees", "e", "endnode", "exp", "extract", "filter", "floor", "haversin", "head", "id", "keys", "labels", "last", "left", "length", "log", "log10", "lower", "ltrim", "max", "min", "node", "nodes", "percentileCont", "percentileDisc", "pi", "radians", "rand", "range", "reduce", "rel", "relationship", "relationships", "replace", "reverse", "right", "round", "rtrim", "shortestPath", "sign", "sin", "size", "split", "sqrt", "startnode", "stdev", "stdevp", "str", "substring", "sum", "tail", "tan", "timestamp", "toFloat", "toInt", "toString", "trim", "type", "upper"]);
var preds = wordRegexp(["all", "and", "any", "contains", "exists", "has", "in", "none", "not", "or", "single", "xor"]);
var keywords = wordRegexp(["as", "asc", "ascending", "assert", "by", "case", "commit", "constraint", "create", "csv", "cypher", "delete", "desc", "descending", "detach", "distinct", "drop", "else", "end", "ends", "explain", "false", "fieldterminator", "foreach", "from", "headers", "in", "index", "is", "join", "limit", "load", "match", "merge", "null", "on", "optional", "order", "periodic", "profile", "remove", "return", "scan", "set", "skip", "start", "starts", "then", "true", "union", "unique", "unwind", "using", "when", "where", "with"]);
var operatorChars = /[*+\-<>=&|~%^]/;
return {

0
public/vendor/codemirror/mode/cypher/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/d/d.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/d/index.html vendored Executable file → Normal file
View file

86
public/vendor/codemirror/mode/dart/dart.js vendored Executable file → Normal file
View file

@ -15,7 +15,7 @@
"implements get native operator set typedef with enum throw rethrow " +
"assert break case continue default in return new deferred async await " +
"try catch finally do else for if switch while import library export " +
"part of show hide is").split(" ");
"part of show hide is as").split(" ");
var blockKeywords = "try catch finally do else for if switch while".split(" ");
var atoms = "true false null".split(" ");
var builtins = "void bool num int double dynamic var String".split(" ");
@ -26,21 +26,101 @@
return obj;
}
function pushInterpolationStack(state) {
(state.interpolationStack || (state.interpolationStack = [])).push(state.tokenize);
}
function popInterpolationStack(state) {
return (state.interpolationStack || (state.interpolationStack = [])).pop();
}
function sizeInterpolationStack(state) {
return state.interpolationStack ? state.interpolationStack.length : 0;
}
CodeMirror.defineMIME("application/dart", {
name: "clike",
keywords: set(keywords),
multiLineStrings: true,
blockKeywords: set(blockKeywords),
builtin: set(builtins),
atoms: set(atoms),
hooks: {
"@": function(stream) {
stream.eatWhile(/[\w\$_]/);
stream.eatWhile(/[\w\$_\.]/);
return "meta";
},
// custom string handling to deal with triple-quoted strings and string interpolation
"'": function(stream, state) {
return tokenString("'", stream, state, false);
},
"\"": function(stream, state) {
return tokenString("\"", stream, state, false);
},
"r": function(stream, state) {
var peek = stream.peek();
if (peek == "'" || peek == "\"") {
return tokenString(stream.next(), stream, state, true);
}
return false;
},
"}": function(_stream, state) {
// "}" is end of interpolation, if interpolation stack is non-empty
if (sizeInterpolationStack(state) > 0) {
state.tokenize = popInterpolationStack(state);
return null;
}
return false;
}
}
});
function tokenString(quote, stream, state, raw) {
var tripleQuoted = false;
if (stream.eat(quote)) {
if (stream.eat(quote)) tripleQuoted = true;
else return "string"; //empty string
}
function tokenStringHelper(stream, state) {
var escaped = false;
while (!stream.eol()) {
if (!raw && !escaped && stream.peek() == "$") {
pushInterpolationStack(state);
state.tokenize = tokenInterpolation;
return "string";
}
var next = stream.next();
if (next == quote && !escaped && (!tripleQuoted || stream.match(quote + quote))) {
state.tokenize = null;
break;
}
escaped = !raw && !escaped && next == "\\";
}
return "string";
}
state.tokenize = tokenStringHelper;
return tokenStringHelper(stream, state);
}
function tokenInterpolation(stream, state) {
stream.eat("$");
if (stream.eat("{")) {
// let clike handle the content of ${...},
// we take over again when "}" appears (see hooks).
state.tokenize = null;
} else {
state.tokenize = tokenInterpolationIdentifier;
}
return null;
}
function tokenInterpolationIdentifier(stream, state) {
stream.eatWhile(/[\w_]/);
state.tokenize = popInterpolationStack(state);
return "variable";
}
CodeMirror.registerHelper("hintWords", "application/dart", keywords.concat(atoms).concat(builtins));
// This is needed to make loading through meta.js work.

0
public/vendor/codemirror/mode/dart/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/diff/diff.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/diff/index.html vendored Executable file → Normal file
View file

25
public/vendor/codemirror/mode/django/django.js vendored Executable file → Normal file
View file

@ -14,14 +14,14 @@
"use strict";
CodeMirror.defineMode("django:inner", function() {
var keywords = ["block", "endblock", "for", "endfor", "true", "false",
"loop", "none", "self", "super", "if", "endif", "as",
"else", "import", "with", "endwith", "without", "context", "ifequal", "endifequal",
"ifnotequal", "endifnotequal", "extends", "include", "load", "comment",
"endcomment", "empty", "url", "static", "trans", "blocktrans", "now", "regroup",
"lorem", "ifchanged", "endifchanged", "firstof", "debug", "cycle", "csrf_token",
"autoescape", "endautoescape", "spaceless", "ssi", "templatetag",
"verbatim", "endverbatim", "widthratio"],
var keywords = ["block", "endblock", "for", "endfor", "true", "false", "filter", "endfilter",
"loop", "none", "self", "super", "if", "elif", "endif", "as", "else", "import",
"with", "endwith", "without", "context", "ifequal", "endifequal", "ifnotequal",
"endifnotequal", "extends", "include", "load", "comment", "endcomment",
"empty", "url", "static", "trans", "blocktrans", "endblocktrans", "now",
"regroup", "lorem", "ifchanged", "endifchanged", "firstof", "debug", "cycle",
"csrf_token", "autoescape", "endautoescape", "spaceless", "endspaceless",
"ssi", "templatetag", "verbatim", "endverbatim", "widthratio"],
filters = ["add", "addslashes", "capfirst", "center", "cut", "date",
"default", "default_if_none", "dictsort",
"dictsortreversed", "divisibleby", "escape", "escapejs",
@ -35,11 +35,13 @@
"truncatechars_html", "truncatewords", "truncatewords_html",
"unordered_list", "upper", "urlencode", "urlize",
"urlizetrunc", "wordcount", "wordwrap", "yesno"],
operators = ["==", "!=", "<", ">", "<=", ">=", "in", "not", "or", "and"];
operators = ["==", "!=", "<", ">", "<=", ">="],
wordOperators = ["in", "not", "or", "and"];
keywords = new RegExp("^\\b(" + keywords.join("|") + ")\\b");
filters = new RegExp("^\\b(" + filters.join("|") + ")\\b");
operators = new RegExp("^\\b(" + operators.join("|") + ")\\b");
wordOperators = new RegExp("^\\b(" + wordOperators.join("|") + ")\\b");
// We have to return "null" instead of null, in order to avoid string
// styling as the default, when using Django templates inside HTML
@ -270,6 +272,11 @@
return "operator";
}
// Attempt to match a word operator
if (stream.match(wordOperators)) {
return "keyword";
}
// Attempt to match a keyword
var keywordMatch = stream.match(keywords);
if (keywordMatch) {

0
public/vendor/codemirror/mode/django/index.html vendored Executable file → Normal file
View file

5
public/vendor/codemirror/mode/dockerfile/dockerfile.js vendored Executable file → Normal file
View file

@ -69,7 +69,10 @@
token: null,
next: "start"
}
]
],
meta: {
lineComment: "#"
}
});
CodeMirror.defineMIME("text/x-dockerfile", "dockerfile");

0
public/vendor/codemirror/mode/dockerfile/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/dtd/dtd.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/dtd/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/dylan/dylan.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/dylan/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/ebnf/ebnf.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/ebnf/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/ecl/ecl.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/ecl/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/eiffel/eiffel.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/eiffel/index.html vendored Executable file → Normal file
View file

2
public/vendor/codemirror/mode/elm/elm.js vendored Executable file → Normal file
View file

@ -202,4 +202,4 @@
});
CodeMirror.defineMIME("text/x-elm", "elm");
})();
});

0
public/vendor/codemirror/mode/elm/index.html vendored Executable file → Normal file
View file

4
public/vendor/codemirror/mode/erlang/erlang.js vendored Executable file → Normal file
View file

@ -220,8 +220,6 @@ CodeMirror.defineMode("erlang", function(cmCfg) {
}else{
return rval(state,stream,"function");
}
}else if (is_member(w,operatorAtomWords)) {
return rval(state,stream,"operator");
}else if (lookahead(stream) == ":") {
if (w == "erlang") {
return rval(state,stream,"builtin");
@ -230,8 +228,6 @@ CodeMirror.defineMode("erlang", function(cmCfg) {
}
}else if (is_member(w,["true","false"])) {
return rval(state,stream,"boolean");
}else if (is_member(w,["true","false"])) {
return rval(state,stream,"boolean");
}else{
return rval(state,stream,"atom");
}

0
public/vendor/codemirror/mode/erlang/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/factor/factor.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/factor/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/forth/forth.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/forth/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/fortran/fortran.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/fortran/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/gas/gas.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/gas/index.html vendored Executable file → Normal file
View file

45
public/vendor/codemirror/mode/gfm/gfm.js vendored Executable file → Normal file
View file

@ -11,6 +11,8 @@
})(function(CodeMirror) {
"use strict";
var urlRE = /^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i
CodeMirror.defineMode("gfm", function(config, modeConfig) {
var codeDepth = 0;
function blankLine(state) {
@ -37,7 +39,7 @@ CodeMirror.defineMode("gfm", function(config, modeConfig) {
// Hack to prevent formatting override inside code blocks (block and inline)
if (state.codeBlock) {
if (stream.match(/^```/)) {
if (stream.match(/^```+/)) {
state.codeBlock = false;
return null;
}
@ -47,7 +49,7 @@ CodeMirror.defineMode("gfm", function(config, modeConfig) {
if (stream.sol()) {
state.code = false;
}
if (stream.sol() && stream.match(/^```/)) {
if (stream.sol() && stream.match(/^```+/)) {
stream.skipToEnd();
state.codeBlock = true;
return null;
@ -78,25 +80,29 @@ CodeMirror.defineMode("gfm", function(config, modeConfig) {
}
if (stream.sol() || state.ateSpace) {
state.ateSpace = false;
if(stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/)) {
// User/Project@SHA
// User@SHA
// SHA
state.combineTokens = true;
return "link";
} else if (stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/)) {
// User/Project#Num
// User#Num
// #Num
state.combineTokens = true;
return "link";
if (modeConfig.gitHubSpice !== false) {
if(stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/)) {
// User/Project@SHA
// User@SHA
// SHA
state.combineTokens = true;
return "link";
} else if (stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/)) {
// User/Project#Num
// User#Num
// #Num
state.combineTokens = true;
return "link";
}
}
}
if (stream.match(/^((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i) &&
stream.string.slice(stream.start - 2, stream.start) != "](") {
if (stream.match(urlRE) &&
stream.string.slice(stream.start - 2, stream.start) != "](" &&
(stream.start == 0 || /\W/.test(stream.string.charAt(stream.start - 1)))) {
// URLs
// Taken from http://daringfireball.net/2010/07/improved_regex_for_matching_urls
// And then (issue #1160) simplified to make it not crash the Chrome Regexp engine
// And then limited url schemes to the CommonMark list, so foo:bar isn't matched as a URL
state.combineTokens = true;
return "link";
}
@ -109,15 +115,16 @@ CodeMirror.defineMode("gfm", function(config, modeConfig) {
var markdownConfig = {
underscoresBreakWords: false,
taskLists: true,
fencedCodeBlocks: true,
fencedCodeBlocks: '```',
strikethrough: true
};
for (var attr in modeConfig) {
markdownConfig[attr] = modeConfig[attr];
}
markdownConfig.name = "markdown";
CodeMirror.defineMIME("gfmBase", markdownConfig);
return CodeMirror.overlayMode(CodeMirror.getMode(config, "gfmBase"), gfmOverlay);
return CodeMirror.overlayMode(CodeMirror.getMode(config, markdownConfig), gfmOverlay);
}, "markdown");
CodeMirror.defineMIME("text/x-gfm", "gfm");
});

0
public/vendor/codemirror/mode/gfm/index.html vendored Executable file → Normal file
View file

21
public/vendor/codemirror/mode/gfm/test.js vendored Executable file → Normal file
View file

@ -51,6 +51,11 @@
"[comment ```]",
"bar");
MT("fencedCodeBlocksNoTildes",
"~~~",
"foo",
"~~~");
MT("taskListAsterisk",
"[variable-2 * []] foo]", // Invalid; must have space or x between []
"[variable-2 * [ ]]bar]", // Invalid; must have space after ]
@ -133,6 +138,15 @@
MT("vanillaLink",
"foo [link http://www.example.com/] bar");
MT("vanillaLinkNoScheme",
"foo [link www.example.com] bar");
MT("vanillaLinkHttps",
"foo [link https://www.example.com/] bar");
MT("vanillaLinkDataSchema",
"foo [link data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==] bar");
MT("vanillaLinkPunctuation",
"foo [link http://www.example.com/]. bar");
@ -142,6 +156,9 @@
MT("vanillaLinkEmphasis",
"foo [em *][em&link http://www.example.com/index.html][em *] bar");
MT("notALink",
"foo asfd:asdf bar");
MT("notALink",
"[comment ```css]",
"[tag foo] {[property color]:[keyword black];}",
@ -152,8 +169,8 @@
MT("notALink",
"[comment `foo]",
"[link http://www.example.com/]",
"[comment `foo]",
"[comment&link http://www.example.com/]",
"[comment `] foo",
"",
"[link http://www.example.com/]");

0
public/vendor/codemirror/mode/gherkin/gherkin.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/gherkin/index.html vendored Executable file → Normal file
View file

2
public/vendor/codemirror/mode/go/go.js vendored Executable file → Normal file
View file

@ -86,7 +86,7 @@ CodeMirror.defineMode("go", function(config) {
var escaped = false, next, end = false;
while ((next = stream.next()) != null) {
if (next == quote && !escaped) {end = true; break;}
escaped = !escaped && next == "\\";
escaped = !escaped && quote != "`" && next == "\\";
}
if (end || !(escaped || quote == "`"))
state.tokenize = tokenBase;

0
public/vendor/codemirror/mode/go/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/groovy/groovy.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/groovy/index.html vendored Executable file → Normal file
View file

6
public/vendor/codemirror/mode/haml/haml.js vendored Executable file → Normal file
View file

@ -85,8 +85,10 @@
state.tokenize = rubyInQuote(")");
return state.tokenize(stream, state);
} else if (ch == "{") {
state.tokenize = rubyInQuote("}");
return state.tokenize(stream, state);
if (!stream.match(/^\{%.*/)) {
state.tokenize = rubyInQuote("}");
return state.tokenize(stream, state);
}
}
}

0
public/vendor/codemirror/mode/haml/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/haml/test.js vendored Executable file → Normal file
View file

19
public/vendor/codemirror/mode/handlebars/handlebars.js vendored Executable file → Normal file
View file

@ -3,15 +3,15 @@
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"), require("../../addon/mode/simple"));
mod(require("../../lib/codemirror"), require("../../addon/mode/simple"), require("../../addon/mode/multiplex"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror", "../../addon/mode/simple"], mod);
define(["../../lib/codemirror", "../../addon/mode/simple", "../../addon/mode/multiplex"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.defineSimpleMode("handlebars", {
CodeMirror.defineSimpleMode("handlebars-tags", {
start: [
{ regex: /\{\{!--/, push: "dash_comment", token: "comment" },
{ regex: /\{\{!/, push: "comment", token: "comment" },
@ -21,8 +21,8 @@
{ regex: /\}\}/, pop: true, token: "tag" },
// Double and single quotes
{ regex: /"(?:[^\\]|\\.)*?"/, token: "string" },
{ regex: /'(?:[^\\]|\\.)*?'/, token: "string" },
{ regex: /"(?:[^\\"]|\\.)*"?/, token: "string" },
{ regex: /'(?:[^\\']|\\.)*'?/, token: "string" },
// Handlebars keywords
{ regex: />|[#\/]([A-Za-z_]\w*)/, token: "keyword" },
@ -49,5 +49,14 @@
]
});
CodeMirror.defineMode("handlebars", function(config, parserConfig) {
var handlebars = CodeMirror.getMode(config, "handlebars-tags");
if (!parserConfig || !parserConfig.base) return handlebars;
return CodeMirror.multiplexingMode(
CodeMirror.getMode(config, parserConfig.base),
{open: "{{", close: "}}", mode: handlebars, parseDelimiters: true}
);
});
CodeMirror.defineMIME("text/x-handlebars-template", "handlebars");
});

15
public/vendor/codemirror/mode/handlebars/index.html vendored Executable file → Normal file
View file

@ -1,4 +1,4 @@
<!doctype html>
<!doctype html>
<title>CodeMirror: Handlebars mode</title>
<meta charset="utf-8"/>
@ -61,22 +61,13 @@
</textarea></form>
<script>
CodeMirror.defineMode("htmlhandlebars", function(config) {
return CodeMirror.multiplexingMode(
CodeMirror.getMode(config, "text/html"),
{open: "{{", close: "}}",
mode: CodeMirror.getMode(config, "handlebars"),
parseDelimiters: true});
});
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
matchBrackets: true,
mode: "htmlhandlebars"
mode: {name: "handlebars", base: "text/html"}
});
</script>
</script>
<p>Handlebars syntax highlighting for CodeMirror.</p>
<p><strong>MIME types defined:</strong> <code>text/x-handlebars-template</code></p>

View file

@ -0,0 +1,43 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function (mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"), require("../haskell/haskell"))
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror", "../haskell/haskell"], mod)
else // Plain browser env
mod(CodeMirror)
})(function (CodeMirror) {
"use strict"
CodeMirror.defineMode("haskell-literate", function (config, parserConfig) {
var baseMode = CodeMirror.getMode(config, (parserConfig && parserConfig.base) || "haskell")
return {
startState: function () {
return {
inCode: false,
baseState: CodeMirror.startState(baseMode)
}
},
token: function (stream, state) {
if (stream.sol()) {
if (state.inCode = stream.eat(">"))
return "meta"
}
if (state.inCode) {
return baseMode.token(stream, state.baseState)
} else {
stream.skipToEnd()
return "comment"
}
},
innerMode: function (state) {
return state.inCode ? {state: state.baseState, mode: baseMode} : null
}
}
}, "haskell")
CodeMirror.defineMIME("text/x-literate-haskell", "haskell-literate")
})

View file

@ -0,0 +1,282 @@
<!doctype html>
<title>CodeMirror: Haskell-literate 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="haskell-literate.js"></script>
<script src="../haskell/haskell.js"></script>
<style>.CodeMirror {
border-top : 1px solid #DDDDDD;
border-bottom : 1px solid #DDDDDD;
}</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="#">Haskell-literate</a>
</ul>
</div>
<article>
<h2>Haskell literate mode</h2>
<form>
<textarea id="code" name="code">
> {-# LANGUAGE OverloadedStrings #-}
> {-# OPTIONS_GHC -fno-warn-unused-do-bind #-}
> import Control.Applicative ((<$>), (<*>))
> import Data.Maybe (isJust)
> import Data.Text (Text)
> import Text.Blaze ((!))
> import qualified Data.Text as T
> import qualified Happstack.Server as Happstack
> import qualified Text.Blaze.Html5 as H
> import qualified Text.Blaze.Html5.Attributes as A
> import Text.Digestive
> import Text.Digestive.Blaze.Html5
> import Text.Digestive.Happstack
> import Text.Digestive.Util
Simple forms and validation
---------------------------
Let's start by creating a very simple datatype to represent a user:
> data User = User
> { userName :: Text
> , userMail :: Text
> } deriving (Show)
And dive in immediately to create a `Form` for a user. The `Form v m a` type
has three parameters:
- `v`: the type for messages and errors (usually a `String`-like type, `Text` in
this case);
- `m`: the monad we are operating in, not specified here;
- `a`: the return type of the `Form`, in this case, this is obviously `User`.
> userForm :: Monad m => Form Text m User
We create forms by using the `Applicative` interface. A few form types are
provided in the `Text.Digestive.Form` module, such as `text`, `string`,
`bool`...
In the `digestive-functors` library, the developer is required to label each
field using the `.:` operator. This might look like a bit of a burden, but it
allows you to do some really useful stuff, like separating the `Form` from the
actual HTML layout.
> userForm = User
> <$> "name" .: text Nothing
> <*> "mail" .: check "Not a valid email address" checkEmail (text Nothing)
The `check` function enables you to validate the result of a form. For example,
we can validate the email address with a really naive `checkEmail` function.
> checkEmail :: Text -> Bool
> checkEmail = isJust . T.find (== '@')
More validation
---------------
For our example, we also want descriptions of Haskell libraries, and in order to
do that, we need package versions...
> type Version = [Int]
We want to let the user input a version number such as `0.1.0.0`. This means we
need to validate if the input `Text` is of this form, and then we need to parse
it to a `Version` type. Fortunately, we can do this in a single function:
`validate` allows conversion between values, which can optionally fail.
`readMaybe :: Read a => String -> Maybe a` is a utility function imported from
`Text.Digestive.Util`.
> validateVersion :: Text -> Result Text Version
> validateVersion = maybe (Error "Cannot parse version") Success .
> mapM (readMaybe . T.unpack) . T.split (== '.')
A quick test in GHCi:
ghci> validateVersion (T.pack "0.3.2.1")
Success [0,3,2,1]
ghci> validateVersion (T.pack "0.oops")
Error "Cannot parse version"
It works! This means we can now easily add a `Package` type and a `Form` for it:
> data Category = Web | Text | Math
> deriving (Bounded, Enum, Eq, Show)
> data Package = Package Text Version Category
> deriving (Show)
> packageForm :: Monad m => Form Text m Package
> packageForm = Package
> <$> "name" .: text Nothing
> <*> "version" .: validate validateVersion (text (Just "0.0.0.1"))
> <*> "category" .: choice categories Nothing
> where
> categories = [(x, T.pack (show x)) | x <- [minBound .. maxBound]]
Composing forms
---------------
A release has an author and a package. Let's use this to illustrate the
composability of the digestive-functors library: we can reuse the forms we have
written earlier on.
> data Release = Release User Package
> deriving (Show)
> releaseForm :: Monad m => Form Text m Release
> releaseForm = Release
> <$> "author" .: userForm
> <*> "package" .: packageForm
Views
-----
As mentioned before, one of the advantages of using digestive-functors is
separation of forms and their actual HTML layout. In order to do this, we have
another type, `View`.
We can get a `View` from a `Form` by supplying input. A `View` contains more
information than a `Form`, it has:
- the original form;
- the input given by the user;
- any errors that have occurred.
It is this view that we convert to HTML. For this tutorial, we use the
[blaze-html] library, and some helpers from the `digestive-functors-blaze`
library.
[blaze-html]: http://jaspervdj.be/blaze/
Let's write a view for the `User` form. As you can see, we here refer to the
different fields in the `userForm`. The `errorList` will generate a list of
errors for the `"mail"` field.
> userView :: View H.Html -> H.Html
> userView view = do
> label "name" view "Name: "
> inputText "name" view
> H.br
>
> errorList "mail" view
> label "mail" view "Email address: "
> inputText "mail" view
> H.br
Like forms, views are also composable: let's illustrate that by adding a view
for the `releaseForm`, in which we reuse `userView`. In order to do this, we
take only the parts relevant to the author from the view by using `subView`. We
can then pass the resulting view to our own `userView`.
We have no special view code for `Package`, so we can just add that to
`releaseView` as well. `childErrorList` will generate a list of errors for each
child of the specified form. In this case, this means a list of errors from
`"package.name"` and `"package.version"`. Note how we use `foo.bar` to refer to
nested forms.
> releaseView :: View H.Html -> H.Html
> releaseView view = do
> H.h2 "Author"
> userView $ subView "author" view
>
> H.h2 "Package"
> childErrorList "package" view
>
> label "package.name" view "Name: "
> inputText "package.name" view
> H.br
>
> label "package.version" view "Version: "
> inputText "package.version" view
> H.br
>
> label "package.category" view "Category: "
> inputSelect "package.category" view
> H.br
The attentive reader might have wondered what the type parameter for `View` is:
it is the `String`-like type used for e.g. error messages.
But wait! We have
releaseForm :: Monad m => Form Text m Release
releaseView :: View H.Html -> H.Html
... doesn't this mean that we need a `View Text` rather than a `View Html`? The
answer is yes -- but having `View Html` allows us to write these views more
easily with the `digestive-functors-blaze` library. Fortunately, we will be able
to fix this using the `Functor` instance of `View`.
fmap :: Monad m => (v -> w) -> View v -> View w
A backend
---------
To finish this tutorial, we need to be able to actually run this code. We need
an HTTP server for that, and we use [Happstack] for this tutorial. The
`digestive-functors-happstack` library gives about everything we need for this.
[Happstack]: http://happstack.com/
> site :: Happstack.ServerPart Happstack.Response
> site = do
> Happstack.decodeBody $ Happstack.defaultBodyPolicy "/tmp" 4096 4096 4096
> r <- runForm "test" releaseForm
> case r of
> (view, Nothing) -> do
> let view' = fmap H.toHtml view
> Happstack.ok $ Happstack.toResponse $
> template $
> form view' "/" $ do
> releaseView view'
> H.br
> inputSubmit "Submit"
> (_, Just release) -> Happstack.ok $ Happstack.toResponse $
> template $ do
> css
> H.h1 "Release received"
> H.p $ H.toHtml $ show release
>
> main :: IO ()
> main = Happstack.simpleHTTP Happstack.nullConf site
Utilities
---------
> template :: H.Html -> H.Html
> template body = H.docTypeHtml $ do
> H.head $ do
> H.title "digestive-functors tutorial"
> css
> H.body body
> css :: H.Html
> css = H.style ! A.type_ "text/css" $ do
> "label {width: 130px; float: left; clear: both}"
> "ul.digestive-functors-error-list {"
> " color: red;"
> " list-style-type: none;"
> " padding-left: 0px;"
> "}"
</textarea>
</form>
<p><strong>MIME types
defined:</strong> <code>text/x-literate-haskell</code>.</p>
<p>Parser configuration parameters recognized: <code>base</code> to
set the base mode (defaults to <code>"haskell"</code>).</p>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: "haskell-literate"});
</script>
</article>

0
public/vendor/codemirror/mode/haskell/haskell.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/haskell/index.html vendored Executable file → Normal file
View file

165
public/vendor/codemirror/mode/haxe/haxe.js vendored Executable file → Normal file
View file

@ -16,23 +16,21 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
// Tokenizer
var keywords = function(){
function kw(type) {return {type: type, style: "keyword"};}
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
var operator = kw("operator"), atom = {type: "atom", style: "atom"}, attribute = {type:"attribute", style: "attribute"};
function kw(type) {return {type: type, style: "keyword"};}
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
var operator = kw("operator"), atom = {type: "atom", style: "atom"}, attribute = {type:"attribute", style: "attribute"};
var type = kw("typedef");
return {
"if": A, "while": A, "else": B, "do": B, "try": B,
"return": C, "break": C, "continue": C, "new": C, "throw": C,
"var": kw("var"), "inline":attribute, "static": attribute, "using":kw("import"),
var keywords = {
"if": A, "while": A, "else": B, "do": B, "try": B,
"return": C, "break": C, "continue": C, "new": C, "throw": C,
"var": kw("var"), "inline":attribute, "static": attribute, "using":kw("import"),
"public": attribute, "private": attribute, "cast": kw("cast"), "import": kw("import"), "macro": kw("macro"),
"function": kw("function"), "catch": kw("catch"), "untyped": kw("untyped"), "callback": kw("cb"),
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
"in": operator, "never": kw("property_access"), "trace":kw("trace"),
"function": kw("function"), "catch": kw("catch"), "untyped": kw("untyped"), "callback": kw("cb"),
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
"in": operator, "never": kw("property_access"), "trace":kw("trace"),
"class": type, "abstract":type, "enum":type, "interface":type, "typedef":type, "extends":type, "implements":type, "dynamic":type,
"true": atom, "false": atom, "null": atom
};
}();
"true": atom, "false": atom, "null": atom
};
var isOperatorChar = /[+\-*&%=<>!?|]/;
@ -41,14 +39,13 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
return f(stream, state);
}
function nextUntilUnescaped(stream, end) {
function toUnescaped(stream, end) {
var escaped = false, next;
while ((next = stream.next()) != null) {
if (next == end && !escaped)
return false;
return true;
escaped = !escaped && next == "\\";
}
return escaped;
}
// Used as scratch variables to communicate multiple values without
@ -61,70 +58,58 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
function haxeTokenBase(stream, state) {
var ch = stream.next();
if (ch == '"' || ch == "'")
if (ch == '"' || ch == "'") {
return chain(stream, state, haxeTokenString(ch));
else if (/[\[\]{}\(\),;\:\.]/.test(ch))
} else if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
return ret(ch);
else if (ch == "0" && stream.eat(/x/i)) {
} else if (ch == "0" && stream.eat(/x/i)) {
stream.eatWhile(/[\da-f]/i);
return ret("number", "number");
}
else if (/\d/.test(ch) || ch == "-" && stream.eat(/\d/)) {
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
} else if (/\d/.test(ch) || ch == "-" && stream.eat(/\d/)) {
stream.match(/^\d*(?:\.\d*(?!\.))?(?:[eE][+\-]?\d+)?/);
return ret("number", "number");
}
else if (state.reAllowed && (ch == "~" && stream.eat(/\//))) {
nextUntilUnescaped(stream, "/");
} else if (state.reAllowed && (ch == "~" && stream.eat(/\//))) {
toUnescaped(stream, "/");
stream.eatWhile(/[gimsu]/);
return ret("regexp", "string-2");
}
else if (ch == "/") {
} else if (ch == "/") {
if (stream.eat("*")) {
return chain(stream, state, haxeTokenComment);
}
else if (stream.eat("/")) {
} else if (stream.eat("/")) {
stream.skipToEnd();
return ret("comment", "comment");
}
else {
} else {
stream.eatWhile(isOperatorChar);
return ret("operator", null, stream.current());
}
}
else if (ch == "#") {
} else if (ch == "#") {
stream.skipToEnd();
return ret("conditional", "meta");
}
else if (ch == "@") {
} else if (ch == "@") {
stream.eat(/:/);
stream.eatWhile(/[\w_]/);
return ret ("metadata", "meta");
}
else if (isOperatorChar.test(ch)) {
} else if (isOperatorChar.test(ch)) {
stream.eatWhile(isOperatorChar);
return ret("operator", null, stream.current());
}
else {
var word;
if(/[A-Z]/.test(ch))
{
stream.eatWhile(/[\w_<>]/);
word = stream.current();
return ret("type", "variable-3", word);
}
else
{
} else {
var word;
if(/[A-Z]/.test(ch)) {
stream.eatWhile(/[\w_<>]/);
word = stream.current();
return ret("type", "variable-3", word);
} else {
stream.eatWhile(/[\w_]/);
var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
return (known && state.kwAllowed) ? ret(known.type, known.style, word) :
ret("variable", "variable", word);
}
}
}
}
function haxeTokenString(quote) {
return function(stream, state) {
if (!nextUntilUnescaped(stream, quote))
if (toUnescaped(stream, quote))
state.tokenize = haxeTokenBase;
return ret("string", "string");
};
@ -176,27 +161,25 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
cc.pop()();
if (cx.marked) return cx.marked;
if (type == "variable" && inScope(state, content)) return "variable-2";
if (type == "variable" && imported(state, content)) return "variable-3";
if (type == "variable" && imported(state, content)) return "variable-3";
return style;
}
}
}
function imported(state, typename)
{
if (/[a-z]/.test(typename.charAt(0)))
return false;
var len = state.importedtypes.length;
for (var i = 0; i<len; i++)
if(state.importedtypes[i]==typename) return true;
function imported(state, typename) {
if (/[a-z]/.test(typename.charAt(0)))
return false;
var len = state.importedtypes.length;
for (var i = 0; i<len; i++)
if(state.importedtypes[i]==typename) return true;
}
function registerimport(importname) {
var state = cx.state;
for (var t = state.importedtypes; t; t = t.next)
if(t.name == importname) return;
state.importedtypes = { name: importname, next: state.importedtypes };
var state = cx.state;
for (var t = state.importedtypes; t; t = t.next)
if(t.name == importname) return;
state.importedtypes = { name: importname, next: state.importedtypes };
}
// Combinator utils
@ -208,13 +191,20 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
pass.apply(null, arguments);
return true;
}
function inList(name, list) {
for (var v = list; v; v = v.next)
if (v.name == name) return true;
return false;
}
function register(varname) {
var state = cx.state;
if (state.context) {
cx.marked = "def";
for (var v = state.localVars; v; v = v.next)
if (v.name == varname) return;
if (inList(varname, state.localVars)) return;
state.localVars = {name: varname, next: state.localVars};
} else if (state.globalVars) {
if (inList(varname, state.globalVars)) return;
state.globalVars = {name: varname, next: state.globalVars};
}
}
@ -229,6 +219,7 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
cx.state.localVars = cx.state.context.vars;
cx.state.context = cx.state.context.prev;
}
popcontext.lex = true;
function pushlex(type, info) {
var result = function() {
var state = cx.state;
@ -252,7 +243,7 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
if (type == wanted) return cont();
else if (wanted == ";") return pass();
else return cont(f);
};
}
return f;
}
@ -266,25 +257,26 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
if (type == "attribute") return cont(maybeattribute);
if (type == "function") return cont(functiondef);
if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"),
poplex, statement, poplex);
poplex, statement, poplex);
if (type == "variable") return cont(pushlex("stat"), maybelabel);
if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
block, poplex, poplex);
block, poplex, poplex);
if (type == "case") return cont(expression, expect(":"));
if (type == "default") return cont(expect(":"));
if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
statement, poplex, popcontext);
statement, poplex, popcontext);
if (type == "import") return cont(importdef, expect(";"));
if (type == "typedef") return cont(typedef);
return pass(pushlex("stat"), expression, expect(";"), poplex);
}
function expression(type) {
if (atomicTypes.hasOwnProperty(type)) return cont(maybeoperator);
if (type == "type" ) return cont(maybeoperator);
if (type == "function") return cont(functiondef);
if (type == "keyword c") return cont(maybeexpression);
if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeoperator);
if (type == "operator") return cont(expression);
if (type == "[") return cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator);
if (type == "[") return cont(pushlex("]"), commasep(maybeexpression, "]"), poplex, maybeoperator);
if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator);
return cont();
}
@ -318,14 +310,14 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
}
function importdef (type, value) {
if(type == "variable" && /[A-Z]/.test(value.charAt(0))) { registerimport(value); return cont(); }
else if(type == "variable" || type == "property" || type == "." || value == "*") return cont(importdef);
if(type == "variable" && /[A-Z]/.test(value.charAt(0))) { registerimport(value); return cont(); }
else if(type == "variable" || type == "property" || type == "." || value == "*") return cont(importdef);
}
function typedef (type, value)
{
if(type == "variable" && /[A-Z]/.test(value.charAt(0))) { registerimport(value); return cont(); }
else if (type == "type" && /[A-Z]/.test(value.charAt(0))) { return cont(); }
if(type == "variable" && /[A-Z]/.test(value.charAt(0))) { registerimport(value); return cont(); }
else if (type == "type" && /[A-Z]/.test(value.charAt(0))) { return cont(); }
}
function maybelabel(type) {
@ -363,16 +355,19 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
if (type == ",") return cont(vardef1);
}
function forspec1(type, value) {
if (type == "variable") {
register(value);
}
return cont(pushlex(")"), pushcontext, forin, expression, poplex, statement, popcontext);
if (type == "variable") {
register(value);
return cont(forin, expression)
} else {
return pass()
}
}
function forin(_type, value) {
if (value == "in") return cont();
}
function functiondef(type, value) {
if (type == "variable") {register(value); return cont(functiondef);}
//function names starting with upper-case letters are recognised as types, so cludging them together here.
if (type == "variable" || type == "type") {register(value); return cont(functiondef);}
if (value == "new") return cont(functiondef);
if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, typeuse, statement, popcontext);
}
@ -392,21 +387,23 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
}
// Interface
return {
startState: function(basecolumn) {
var defaulttypes = ["Int", "Float", "String", "Void", "Std", "Bool", "Dynamic", "Array"];
return {
var defaulttypes = ["Int", "Float", "String", "Void", "Std", "Bool", "Dynamic", "Array"];
var state = {
tokenize: haxeTokenBase,
reAllowed: true,
kwAllowed: true,
cc: [],
lexical: new HaxeLexical((basecolumn || 0) - indentUnit, 0, "block", false),
localVars: parserConfig.localVars,
importedtypes: defaulttypes,
importedtypes: defaulttypes,
context: parserConfig.localVars && {vars: parserConfig.localVars},
indented: 0
};
if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
state.globalVars = parserConfig.globalVars;
return state;
},
token: function(stream, state) {

0
public/vendor/codemirror/mode/haxe/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/htmlembedded/htmlembedded.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/htmlembedded/index.html vendored Executable file → Normal file
View file

217
public/vendor/codemirror/mode/htmlmixed/htmlmixed.js vendored Executable file → Normal file
View file

@ -9,113 +9,142 @@
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
"use strict";
CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
var htmlMode = CodeMirror.getMode(config, {name: "xml",
htmlMode: true,
multilineTagIndentFactor: parserConfig.multilineTagIndentFactor,
multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag});
var cssMode = CodeMirror.getMode(config, "css");
var defaultTags = {
script: [
["lang", /(javascript|babel)/i, "javascript"],
["type", /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i, "javascript"],
["type", /./, "text/plain"],
[null, null, "javascript"]
],
style: [
["lang", /^css$/i, "css"],
["type", /^(text\/)?(x-)?(stylesheet|css)$/i, "css"],
["type", /./, "text/plain"],
[null, null, "css"]
]
};
var scriptTypes = [], scriptTypesConf = parserConfig && parserConfig.scriptTypes;
scriptTypes.push({matches: /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,
mode: CodeMirror.getMode(config, "javascript")});
if (scriptTypesConf) for (var i = 0; i < scriptTypesConf.length; ++i) {
var conf = scriptTypesConf[i];
scriptTypes.push({matches: conf.matches, mode: conf.mode && CodeMirror.getMode(config, conf.mode)});
}
scriptTypes.push({matches: /./,
mode: CodeMirror.getMode(config, "text/plain")});
function html(stream, state) {
var tagName = state.htmlState.tagName;
if (tagName) tagName = tagName.toLowerCase();
var style = htmlMode.token(stream, state.htmlState);
if (tagName == "script" && /\btag\b/.test(style) && stream.current() == ">") {
// Script block: mode to change to depends on type attribute
var scriptType = stream.string.slice(Math.max(0, stream.pos - 100), stream.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);
scriptType = scriptType ? scriptType[1] : "";
if (scriptType && /[\"\']/.test(scriptType.charAt(0))) scriptType = scriptType.slice(1, scriptType.length - 1);
for (var i = 0; i < scriptTypes.length; ++i) {
var tp = scriptTypes[i];
if (typeof tp.matches == "string" ? scriptType == tp.matches : tp.matches.test(scriptType)) {
if (tp.mode) {
state.token = script;
state.localMode = tp.mode;
state.localState = tp.mode.startState && tp.mode.startState(htmlMode.indent(state.htmlState, ""));
}
break;
}
}
} else if (tagName == "style" && /\btag\b/.test(style) && stream.current() == ">") {
state.token = css;
state.localMode = cssMode;
state.localState = cssMode.startState(htmlMode.indent(state.htmlState, ""));
}
return style;
}
function maybeBackup(stream, pat, style) {
var cur = stream.current();
var close = cur.search(pat);
if (close > -1) stream.backUp(cur.length - close);
else if (cur.match(/<\/?$/)) {
var cur = stream.current(), close = cur.search(pat);
if (close > -1) {
stream.backUp(cur.length - close);
} else if (cur.match(/<\/?$/)) {
stream.backUp(cur.length);
if (!stream.match(pat, false)) stream.match(cur);
}
return style;
}
function script(stream, state) {
if (stream.match(/^<\/\s*script\s*>/i, false)) {
state.token = html;
state.localState = state.localMode = null;
return null;
}
return maybeBackup(stream, /<\/\s*script\s*>/,
state.localMode.token(stream, state.localState));
}
function css(stream, state) {
if (stream.match(/^<\/\s*style\s*>/i, false)) {
state.token = html;
state.localState = state.localMode = null;
return null;
}
return maybeBackup(stream, /<\/\s*style\s*>/,
cssMode.token(stream, state.localState));
var attrRegexpCache = {};
function getAttrRegexp(attr) {
var regexp = attrRegexpCache[attr];
if (regexp) return regexp;
return attrRegexpCache[attr] = new RegExp("\\s+" + attr + "\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*");
}
return {
startState: function() {
var state = htmlMode.startState();
return {token: html, localMode: null, localState: null, htmlState: state};
},
function getAttrValue(stream, attr) {
var pos = stream.pos, match;
while (pos >= 0 && stream.string.charAt(pos) !== "<") pos--;
if (pos < 0) return pos;
if (match = stream.string.slice(pos, stream.pos).match(getAttrRegexp(attr)))
return match[2];
return "";
}
copyState: function(state) {
if (state.localState)
var local = CodeMirror.copyState(state.localMode, state.localState);
return {token: state.token, localMode: state.localMode, localState: local,
htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
},
function getTagRegexp(tagName, anchored) {
return new RegExp((anchored ? "^" : "") + "<\/\s*" + tagName + "\s*>", "i");
}
token: function(stream, state) {
return state.token(stream, state);
},
indent: function(state, textAfter) {
if (!state.localMode || /^\s*<\//.test(textAfter))
return htmlMode.indent(state.htmlState, textAfter);
else if (state.localMode.indent)
return state.localMode.indent(state.localState, textAfter);
else
return CodeMirror.Pass;
},
innerMode: function(state) {
return {state: state.localState || state.htmlState, mode: state.localMode || htmlMode};
function addTags(from, to) {
for (var tag in from) {
var dest = to[tag] || (to[tag] = []);
var source = from[tag];
for (var i = source.length - 1; i >= 0; i--)
dest.unshift(source[i])
}
};
}, "xml", "javascript", "css");
}
CodeMirror.defineMIME("text/html", "htmlmixed");
function findMatchingMode(tagInfo, stream) {
for (var i = 0; i < tagInfo.length; i++) {
var spec = tagInfo[i];
if (!spec[0] || spec[1].test(getAttrValue(stream, spec[0]))) return spec[2];
}
}
CodeMirror.defineMode("htmlmixed", function (config, parserConfig) {
var htmlMode = CodeMirror.getMode(config, {
name: "xml",
htmlMode: true,
multilineTagIndentFactor: parserConfig.multilineTagIndentFactor,
multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag
});
var tags = {};
var configTags = parserConfig && parserConfig.tags, configScript = parserConfig && parserConfig.scriptTypes;
addTags(defaultTags, tags);
if (configTags) addTags(configTags, tags);
if (configScript) for (var i = configScript.length - 1; i >= 0; i--)
tags.script.unshift(["type", configScript[i].matches, configScript[i].mode])
function html(stream, state) {
var tagName = state.htmlState.tagName && state.htmlState.tagName.toLowerCase();
var tagInfo = tagName && tags.hasOwnProperty(tagName) && tags[tagName];
var style = htmlMode.token(stream, state.htmlState), modeSpec;
if (tagInfo && /\btag\b/.test(style) && stream.current() === ">" &&
(modeSpec = findMatchingMode(tagInfo, stream))) {
var mode = CodeMirror.getMode(config, modeSpec);
var endTagA = getTagRegexp(tagName, true), endTag = getTagRegexp(tagName, false);
state.token = function (stream, state) {
if (stream.match(endTagA, false)) {
state.token = html;
state.localState = state.localMode = null;
return null;
}
return maybeBackup(stream, endTag, state.localMode.token(stream, state.localState));
};
state.localMode = mode;
state.localState = CodeMirror.startState(mode, htmlMode.indent(state.htmlState, ""));
}
return style;
};
return {
startState: function () {
var state = htmlMode.startState();
return {token: html, localMode: null, localState: null, htmlState: state};
},
copyState: function (state) {
var local;
if (state.localState) {
local = CodeMirror.copyState(state.localMode, state.localState);
}
return {token: state.token, localMode: state.localMode, localState: local,
htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
},
token: function (stream, state) {
return state.token(stream, state);
},
indent: function (state, textAfter) {
if (!state.localMode || /^\s*<\//.test(textAfter))
return htmlMode.indent(state.htmlState, textAfter);
else if (state.localMode.indent)
return state.localMode.indent(state.localState, textAfter);
else
return CodeMirror.Pass;
},
innerMode: function (state) {
return {state: state.localState || state.htmlState, mode: state.localMode || htmlMode};
}
};
}, "xml", "javascript", "css");
CodeMirror.defineMIME("text/html", "htmlmixed");
});

0
public/vendor/codemirror/mode/htmlmixed/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/http/http.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/http/index.html vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/idl/idl.js vendored Executable file → Normal file
View file

0
public/vendor/codemirror/mode/idl/index.html vendored Executable file → Normal file
View file

15
public/vendor/codemirror/mode/index.html vendored Executable file → Normal file
View file

@ -33,12 +33,16 @@ option.</p>
<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="brainfuck/index.html">Brainfuck</a></li>
<li><a href="clike/index.html">C, C++, C#</a></li>
<li><a href="clike/index.html">Ceylon</a></li>
<li><a href="clojure/index.html">Clojure</a></li>
<li><a href="css/gss.html">Closure Stylesheets (GSS)</a></li>
<li><a href="cmake/index.html">CMake</a></li>
<li><a href="cobol/index.html">COBOL</a></li>
<li><a href="coffeescript/index.html">CoffeeScript</a></li>
<li><a href="commonlisp/index.html">Common Lisp</a></li>
<li><a href="crystal/index.html">Crystal</a></li>
<li><a href="css/index.html">CSS</a></li>
<li><a href="cypher/index.html">Cypher</a></li>
<li><a href="python/index.html">Cython</a></li>
@ -64,7 +68,7 @@ option.</p>
<li><a href="groovy/index.html">Groovy</a></li>
<li><a href="haml/index.html">HAML</a></li>
<li><a href="handlebars/index.html">Handlebars</a></li>
<li><a href="haskell/index.html">Haskell</a></li>
<li><a href="haskell/index.html">Haskell</a> (<a href="haskell-literate/index.html">Literate</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>
@ -72,7 +76,7 @@ option.</p>
<li><a href="idl/index.html">IDL</a></li>
<li><a href="clike/index.html">Java</a></li>
<li><a href="jade/index.html">Jade</a></li>
<li><a href="javascript/index.html">JavaScript</a></li>
<li><a href="javascript/index.html">JavaScript</a> (<a href="jsx/index.html">JSX</a>)</li>
<li><a href="jinja2/index.html">Jinja2</a></li>
<li><a href="julia/index.html">Julia</a></li>
<li><a href="kotlin/index.html">Kotlin</a></li>
@ -83,12 +87,15 @@ option.</p>
<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="mscgen/index.html">MscGen</a></li>
<li><a href="mumps/index.html">MUMPS</a></li>
<li><a href="nginx/index.html">Nginx</a></li>
<li><a href="nsis/index.html">NSIS</a></li>
<li><a href="ntriples/index.html">NTriples</a></li>
<li><a href="clike/index.html">Objective C</a></li>
<li><a href="mllike/index.html">OCaml</a></li>
<li><a href="octave/index.html">Octave</a> (MATLAB)</li>
<li><a href="oz/index.html">Oz</a></li>
<li><a href="pascal/index.html">Pascal</a></li>
<li><a href="pegjs/index.html">PEG.js</a></li>
<li><a href="perl/index.html">Perl</a></li>
@ -119,6 +126,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="clike/index.html">Squirrel</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>
@ -136,9 +144,12 @@ option.</p>
<li><a href="vbscript/index.html">VBScript</a></li>
<li><a href="velocity/index.html">Velocity</a></li>
<li><a href="verilog/index.html">Verilog/SystemVerilog</a></li>
<li><a href="vhdl/index.html">VHDL</a></li>
<li><a href="vue/index.html">Vue.js app</a></li>
<li><a href="xml/index.html">XML/HTML</a></li>
<li><a href="xquery/index.html">XQuery</a></li>
<li><a href="yaml/index.html">YAML</a></li>
<li><a href="yaml-frontmatter/index.html">YAML frontmatter</a></li>
<li><a href="z80/index.html">Z80</a></li>
</ul>
</div>

0
public/vendor/codemirror/mode/jade/index.html vendored Executable file → Normal file
View file

6
public/vendor/codemirror/mode/jade/jade.js vendored Executable file → Normal file
View file

@ -74,7 +74,7 @@ CodeMirror.defineMode('jade', function (config) {
res.javaScriptArguments = this.javaScriptArguments;
res.javaScriptArgumentsDepth = this.javaScriptArgumentsDepth;
res.isInterpolating = this.isInterpolating;
res.interpolationNesting = this.intpolationNesting;
res.interpolationNesting = this.interpolationNesting;
res.jsState = CodeMirror.copyState(jsMode, this.jsState);
@ -167,7 +167,7 @@ CodeMirror.defineMode('jade', function (config) {
if (state.interpolationNesting < 0) {
stream.next();
state.isInterpolating = false;
return 'puncutation';
return 'punctuation';
}
} else if (stream.peek() === '{') {
state.interpolationNesting++;
@ -583,7 +583,7 @@ CodeMirror.defineMode('jade', function (config) {
copyState: copyState,
token: nextToken
};
});
}, 'javascript', 'css', 'htmlmixed');
CodeMirror.defineMIME('text/x-jade', 'jade');

Some files were not shown because too many files have changed in this diff Show more