restore syntax highlight
This commit is contained in:
parent
467b7f0aa4
commit
9035bbb0ab
|
@ -7,13 +7,15 @@
|
||||||
|
|
||||||
Mime::Type.register "text/plain", 'diff'
|
Mime::Type.register "text/plain", 'diff'
|
||||||
Mime::Type.register "text/plain", 'patch'
|
Mime::Type.register "text/plain", 'patch'
|
||||||
|
#Mime::Type.register "text/x-markdown", 'md'
|
||||||
|
|
||||||
# add rpm spec as mime type for *.spec files
|
# add rpm spec as mime type for *.spec files
|
||||||
[["text/x-python", ['py'], '8bit'],
|
[["text/x-python", ['py'], '8bit'],
|
||||||
["text/x-rpm-spec", ['spec'], '8bit'],
|
["text/x-rpm-spec", ['spec'], '8bit'],
|
||||||
["text/x-csrc", ['h', 'c'], '8bit'],
|
["text/x-csrc", ['h', 'c'], '8bit'],
|
||||||
["text/x-c++src", ['cpp'], '8bit'],
|
["text/x-c++src", ['cpp'], '8bit'],
|
||||||
["text/x-diff", ['diff'], '8bit']
|
["text/x-diff", ['diff'], '8bit'],
|
||||||
|
["text/x-markdown", ['md'], '8bit']
|
||||||
].each do |type|
|
].each do |type|
|
||||||
MIME::Types.add MIME::Type.from_array(type)
|
MIME::Types.add MIME::Type.from_array(type)
|
||||||
end
|
end
|
||||||
|
|
|
@ -176,14 +176,14 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
||||||
return "string";
|
return "string";
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-csrc", {
|
CodeMirror.defineMIME("application/x-csrc", {
|
||||||
name: "clike",
|
name: "clike",
|
||||||
keywords: words(cKeywords),
|
keywords: words(cKeywords),
|
||||||
blockKeywords: words("case do else for if switch while struct"),
|
blockKeywords: words("case do else for if switch while struct"),
|
||||||
atoms: words("null"),
|
atoms: words("null"),
|
||||||
hooks: {"#": cppHook}
|
hooks: {"#": cppHook}
|
||||||
});
|
});
|
||||||
CodeMirror.defineMIME("text/x-c++src", {
|
CodeMirror.defineMIME("application/x-c++src", {
|
||||||
name: "clike",
|
name: "clike",
|
||||||
keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try bool explicit new " +
|
keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try bool explicit new " +
|
||||||
"static_cast typeid catch operator template typename class friend private " +
|
"static_cast typeid catch operator template typename class friend private " +
|
||||||
|
@ -193,7 +193,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
||||||
atoms: words("true false null"),
|
atoms: words("true false null"),
|
||||||
hooks: {"#": cppHook}
|
hooks: {"#": cppHook}
|
||||||
});
|
});
|
||||||
CodeMirror.defineMIME("text/x-java", {
|
CodeMirror.defineMIME("application/x-java", {
|
||||||
name: "clike",
|
name: "clike",
|
||||||
keywords: words("abstract assert boolean break byte case catch char class const continue default " +
|
keywords: words("abstract assert boolean break byte case catch char class const continue default " +
|
||||||
"do double else enum extends final finally float for goto if implements import " +
|
"do double else enum extends final finally float for goto if implements import " +
|
||||||
|
@ -209,7 +209,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
CodeMirror.defineMIME("text/x-csharp", {
|
CodeMirror.defineMIME("application/x-csharp", {
|
||||||
name: "clike",
|
name: "clike",
|
||||||
keywords: words("abstract as base bool break byte case catch char checked class const continue decimal" +
|
keywords: words("abstract as base bool break byte case catch char checked class const continue decimal" +
|
||||||
" default delegate do double else enum event explicit extern finally fixed float for" +
|
" default delegate do double else enum event explicit extern finally fixed float for" +
|
||||||
|
|
|
@ -205,3 +205,4 @@ CodeMirror.defineMode("clojure", function (config, mode) {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-clojure", "clojure");
|
CodeMirror.defineMIME("text/x-clojure", "clojure");
|
||||||
|
CodeMirror.defineMIME("application/x-clojure", "clojure");
|
||||||
|
|
|
@ -339,3 +339,4 @@ CodeMirror.defineMode('coffeescript', function(conf) {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME('text/x-coffeescript', 'coffeescript');
|
CodeMirror.defineMIME('text/x-coffeescript', 'coffeescript');
|
||||||
|
CodeMirror.defineMIME('application/x-coffeescript', 'coffeescript');
|
||||||
|
|
|
@ -122,3 +122,4 @@ CodeMirror.defineMode("css", function(config) {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/css", "css");
|
CodeMirror.defineMIME("text/css", "css");
|
||||||
|
CodeMirror.defineMIME('application/x-coffeescript', 'css');
|
|
@ -11,3 +11,4 @@ CodeMirror.defineMode("diff", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-diff", "diff");
|
CodeMirror.defineMIME("text/x-diff", "diff");
|
||||||
|
CodeMirror.defineMIME("application/x-diff", "diff");
|
||||||
|
|
|
@ -170,3 +170,4 @@ CodeMirror.defineMode("go", function(config, parserConfig) {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-go", "go");
|
CodeMirror.defineMIME("text/x-go", "go");
|
||||||
|
CodeMirror.defineMIME("application/x-go", "go");
|
||||||
|
|
|
@ -208,3 +208,4 @@ CodeMirror.defineMode("groovy", function(config, parserConfig) {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-groovy", "groovy");
|
CodeMirror.defineMIME("text/x-groovy", "groovy");
|
||||||
|
CodeMirror.defineMIME("application/x-groovy", "groovy");
|
||||||
|
|
|
@ -4,7 +4,7 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
|
||||||
setState(f);
|
setState(f);
|
||||||
return f(source, setState);
|
return f(source, setState);
|
||||||
}
|
}
|
||||||
|
|
||||||
// These should all be Unicode extended, as per the Haskell 2010 report
|
// These should all be Unicode extended, as per the Haskell 2010 report
|
||||||
var smallRE = /[a-z_]/;
|
var smallRE = /[a-z_]/;
|
||||||
var largeRE = /[A-Z]/;
|
var largeRE = /[A-Z]/;
|
||||||
|
@ -15,12 +15,12 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
|
||||||
var symbolRE = /[-!#$%&*+.\/<=>?@\\^|~:]/;
|
var symbolRE = /[-!#$%&*+.\/<=>?@\\^|~:]/;
|
||||||
var specialRE = /[(),;[\]`{}]/;
|
var specialRE = /[(),;[\]`{}]/;
|
||||||
var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer
|
var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer
|
||||||
|
|
||||||
function normal(source, setState) {
|
function normal(source, setState) {
|
||||||
if (source.eatWhile(whiteCharRE)) {
|
if (source.eatWhile(whiteCharRE)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var ch = source.next();
|
var ch = source.next();
|
||||||
if (specialRE.test(ch)) {
|
if (specialRE.test(ch)) {
|
||||||
if (ch == '{' && source.eat('-')) {
|
if (ch == '{' && source.eat('-')) {
|
||||||
|
@ -32,7 +32,7 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ch == '\'') {
|
if (ch == '\'') {
|
||||||
if (source.eat('\\')) {
|
if (source.eat('\\')) {
|
||||||
source.next(); // should handle other escapes here
|
source.next(); // should handle other escapes here
|
||||||
|
@ -45,11 +45,11 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
|
||||||
}
|
}
|
||||||
return "error";
|
return "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ch == '"') {
|
if (ch == '"') {
|
||||||
return switchState(source, setState, stringLiteral);
|
return switchState(source, setState, stringLiteral);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (largeRE.test(ch)) {
|
if (largeRE.test(ch)) {
|
||||||
source.eatWhile(idRE);
|
source.eatWhile(idRE);
|
||||||
if (source.eat('.')) {
|
if (source.eat('.')) {
|
||||||
|
@ -57,12 +57,12 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
|
||||||
}
|
}
|
||||||
return "variable-2";
|
return "variable-2";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smallRE.test(ch)) {
|
if (smallRE.test(ch)) {
|
||||||
source.eatWhile(idRE);
|
source.eatWhile(idRE);
|
||||||
return "variable";
|
return "variable";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (digitRE.test(ch)) {
|
if (digitRE.test(ch)) {
|
||||||
if (ch == '0') {
|
if (ch == '0') {
|
||||||
if (source.eat(/[xX]/)) {
|
if (source.eat(/[xX]/)) {
|
||||||
|
@ -87,7 +87,7 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (symbolRE.test(ch)) {
|
if (symbolRE.test(ch)) {
|
||||||
if (ch == '-' && source.eat(/-/)) {
|
if (ch == '-' && source.eat(/-/)) {
|
||||||
source.eatWhile(/-/);
|
source.eatWhile(/-/);
|
||||||
|
@ -101,12 +101,12 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
|
||||||
t = "variable-2";
|
t = "variable-2";
|
||||||
}
|
}
|
||||||
source.eatWhile(symbolRE);
|
source.eatWhile(symbolRE);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "error";
|
return "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
function ncomment(type, nest) {
|
function ncomment(type, nest) {
|
||||||
if (nest == 0) {
|
if (nest == 0) {
|
||||||
return normal;
|
return normal;
|
||||||
|
@ -130,7 +130,7 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function stringLiteral(source, setState) {
|
function stringLiteral(source, setState) {
|
||||||
while (!source.eol()) {
|
while (!source.eol()) {
|
||||||
var ch = source.next();
|
var ch = source.next();
|
||||||
|
@ -153,7 +153,7 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
|
||||||
setState(normal);
|
setState(normal);
|
||||||
return "error";
|
return "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
function stringGap(source, setState) {
|
function stringGap(source, setState) {
|
||||||
if (source.eat('\\')) {
|
if (source.eat('\\')) {
|
||||||
return switchState(source, setState, stringLiteral);
|
return switchState(source, setState, stringLiteral);
|
||||||
|
@ -162,8 +162,8 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
|
||||||
setState(normal);
|
setState(normal);
|
||||||
return "error";
|
return "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var wellKnownWords = (function() {
|
var wellKnownWords = (function() {
|
||||||
var wkw = {};
|
var wkw = {};
|
||||||
function setType(t) {
|
function setType(t) {
|
||||||
|
@ -172,19 +172,19 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
|
||||||
wkw[arguments[i]] = t;
|
wkw[arguments[i]] = t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setType("keyword")(
|
setType("keyword")(
|
||||||
"case", "class", "data", "default", "deriving", "do", "else", "foreign",
|
"case", "class", "data", "default", "deriving", "do", "else", "foreign",
|
||||||
"if", "import", "in", "infix", "infixl", "infixr", "instance", "let",
|
"if", "import", "in", "infix", "infixl", "infixr", "instance", "let",
|
||||||
"module", "newtype", "of", "then", "type", "where", "_");
|
"module", "newtype", "of", "then", "type", "where", "_");
|
||||||
|
|
||||||
setType("keyword")(
|
setType("keyword")(
|
||||||
"\.\.", ":", "::", "=", "\\", "\"", "<-", "->", "@", "~", "=>");
|
"\.\.", ":", "::", "=", "\\", "\"", "<-", "->", "@", "~", "=>");
|
||||||
|
|
||||||
setType("builtin")(
|
setType("builtin")(
|
||||||
"!!", "$!", "$", "&&", "+", "++", "-", ".", "/", "/=", "<", "<=", "=<<",
|
"!!", "$!", "$", "&&", "+", "++", "-", ".", "/", "/=", "<", "<=", "=<<",
|
||||||
"==", ">", ">=", ">>", ">>=", "^", "^^", "||", "*", "**");
|
"==", ">", ">=", ">>", ">>=", "^", "^^", "||", "*", "**");
|
||||||
|
|
||||||
setType("builtin")(
|
setType("builtin")(
|
||||||
"Bool", "Bounded", "Char", "Double", "EQ", "Either", "Enum", "Eq",
|
"Bool", "Bounded", "Char", "Double", "EQ", "Either", "Enum", "Eq",
|
||||||
"False", "FilePath", "Float", "Floating", "Fractional", "Functor", "GT",
|
"False", "FilePath", "Float", "Floating", "Fractional", "Functor", "GT",
|
||||||
|
@ -192,7 +192,7 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
|
||||||
"Maybe", "Monad", "Nothing", "Num", "Ord", "Ordering", "Rational", "Read",
|
"Maybe", "Monad", "Nothing", "Num", "Ord", "Ordering", "Rational", "Read",
|
||||||
"ReadS", "Real", "RealFloat", "RealFrac", "Right", "Show", "ShowS",
|
"ReadS", "Real", "RealFloat", "RealFrac", "Right", "Show", "ShowS",
|
||||||
"String", "True");
|
"String", "True");
|
||||||
|
|
||||||
setType("builtin")(
|
setType("builtin")(
|
||||||
"abs", "acos", "acosh", "all", "and", "any", "appendFile", "asTypeOf",
|
"abs", "acos", "acosh", "all", "and", "any", "appendFile", "asTypeOf",
|
||||||
"asin", "asinh", "atan", "atan2", "atanh", "break", "catch", "ceiling",
|
"asin", "asinh", "atan", "atan2", "atanh", "break", "catch", "ceiling",
|
||||||
|
@ -220,16 +220,16 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
|
||||||
"toRational", "truncate", "uncurry", "undefined", "unlines", "until",
|
"toRational", "truncate", "uncurry", "undefined", "unlines", "until",
|
||||||
"unwords", "unzip", "unzip3", "userError", "words", "writeFile", "zip",
|
"unwords", "unzip", "unzip3", "userError", "words", "writeFile", "zip",
|
||||||
"zip3", "zipWith", "zipWith3");
|
"zip3", "zipWith", "zipWith3");
|
||||||
|
|
||||||
return wkw;
|
return wkw;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
startState: function () { return { f: normal }; },
|
startState: function () { return { f: normal }; },
|
||||||
copyState: function (s) { return { f: s.f }; },
|
copyState: function (s) { return { f: s.f }; },
|
||||||
|
|
||||||
token: function(stream, state) {
|
token: function(stream, state) {
|
||||||
var t = state.f(stream, function(s) { state.f = s; });
|
var t = state.f(stream, function(s) { state.f = s; });
|
||||||
var w = stream.current();
|
var w = stream.current();
|
||||||
|
@ -240,3 +240,4 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-haskell", "haskell");
|
CodeMirror.defineMIME("text/x-haskell", "haskell");
|
||||||
|
CodeMirror.defineMIME("application/x-haskell", "haskell");
|
||||||
|
|
|
@ -81,3 +81,4 @@ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/html", "htmlmixed");
|
CodeMirror.defineMIME("text/html", "htmlmixed");
|
||||||
|
CodeMirror.defineMIME("application/html", "htmlmixed");
|
||||||
|
|
|
@ -53,7 +53,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||||
else if (ch == "0" && stream.eat(/x/i)) {
|
else if (ch == "0" && stream.eat(/x/i)) {
|
||||||
stream.eatWhile(/[\da-f]/i);
|
stream.eatWhile(/[\da-f]/i);
|
||||||
return ret("number", "number");
|
return ret("number", "number");
|
||||||
}
|
}
|
||||||
else if (/\d/.test(ch)) {
|
else if (/\d/.test(ch)) {
|
||||||
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
|
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
|
||||||
return ret("number", "number");
|
return ret("number", "number");
|
||||||
|
@ -135,7 +135,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||||
// Communicate our context to the combinators.
|
// Communicate our context to the combinators.
|
||||||
// (Less wasteful than consing up a hundred closures on every call.)
|
// (Less wasteful than consing up a hundred closures on every call.)
|
||||||
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
|
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
|
||||||
|
|
||||||
if (!state.lexical.hasOwnProperty("align"))
|
if (!state.lexical.hasOwnProperty("align"))
|
||||||
state.lexical.align = true;
|
state.lexical.align = true;
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||||
if (type.match(/[;\}\)\],]/)) return pass();
|
if (type.match(/[;\}\)\],]/)) return pass();
|
||||||
return pass(expression);
|
return pass(expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
function maybeoperator(type, value) {
|
function maybeoperator(type, value) {
|
||||||
if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator);
|
if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator);
|
||||||
if (type == "operator") return cont(expression);
|
if (type == "operator") return cont(expression);
|
||||||
|
@ -357,4 +357,5 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/javascript", "javascript");
|
CodeMirror.defineMIME("text/javascript", "javascript");
|
||||||
|
CodeMirror.defineMIME("application/javascript", "javascript");
|
||||||
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
|
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// LUA mode. Ported to CodeMirror 2 from Franciszek Wawrzak's
|
// LUA mode. Ported to CodeMirror 2 from Franciszek Wawrzak's
|
||||||
// CodeMirror 1 mode.
|
// CodeMirror 1 mode.
|
||||||
// highlights keywords, strings, comments (no leveling supported! ("[==[")), tokens, basic indenting
|
// highlights keywords, strings, comments (no leveling supported! ("[==[")), tokens, basic indenting
|
||||||
|
|
||||||
CodeMirror.defineMode("lua", function(config, parserConfig) {
|
CodeMirror.defineMode("lua", function(config, parserConfig) {
|
||||||
var indentUnit = config.indentUnit;
|
var indentUnit = config.indentUnit;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ CodeMirror.defineMode("lua", function(config, parserConfig) {
|
||||||
return new RegExp("^(?:" + words.join("|") + ")$", "i");
|
return new RegExp("^(?:" + words.join("|") + ")$", "i");
|
||||||
}
|
}
|
||||||
var specials = wordRE(parserConfig.specials || []);
|
var specials = wordRE(parserConfig.specials || []);
|
||||||
|
|
||||||
// long list of standard functions from lua manual
|
// long list of standard functions from lua manual
|
||||||
var builtins = wordRE([
|
var builtins = wordRE([
|
||||||
"_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load",
|
"_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load",
|
||||||
|
@ -47,7 +47,7 @@ CodeMirror.defineMode("lua", function(config, parserConfig) {
|
||||||
"table.concat","table.insert","table.maxn","table.remove","table.sort"
|
"table.concat","table.insert","table.maxn","table.remove","table.sort"
|
||||||
]);
|
]);
|
||||||
var keywords = wordRE(["and","break","elseif","false","nil","not","or","return",
|
var keywords = wordRE(["and","break","elseif","false","nil","not","or","return",
|
||||||
"true","function", "end", "if", "then", "else", "do",
|
"true","function", "end", "if", "then", "else", "do",
|
||||||
"while", "repeat", "until", "for", "in", "local" ]);
|
"while", "repeat", "until", "for", "in", "local" ]);
|
||||||
|
|
||||||
var indentTokens = wordRE(["function", "if","repeat","do", "\\(", "{"]);
|
var indentTokens = wordRE(["function", "if","repeat","do", "\\(", "{"]);
|
||||||
|
@ -68,7 +68,7 @@ CodeMirror.defineMode("lua", function(config, parserConfig) {
|
||||||
return (state.cur = bracketed(readBracket(stream), "comment"))(stream, state);
|
return (state.cur = bracketed(readBracket(stream), "comment"))(stream, state);
|
||||||
stream.skipToEnd();
|
stream.skipToEnd();
|
||||||
return "comment";
|
return "comment";
|
||||||
}
|
}
|
||||||
if (ch == "\"" || ch == "'")
|
if (ch == "\"" || ch == "'")
|
||||||
return (state.cur = string(ch))(stream, state);
|
return (state.cur = string(ch))(stream, state);
|
||||||
if (ch == "[" && /[\[=]/.test(stream.peek()))
|
if (ch == "[" && /[\[=]/.test(stream.peek()))
|
||||||
|
@ -108,7 +108,7 @@ CodeMirror.defineMode("lua", function(config, parserConfig) {
|
||||||
return "string";
|
return "string";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
startState: function(basecol) {
|
startState: function(basecol) {
|
||||||
return {basecol: basecol || 0, indentDepth: 0, cur: normal};
|
return {basecol: basecol || 0, indentDepth: 0, cur: normal};
|
||||||
|
@ -138,3 +138,4 @@ CodeMirror.defineMode("lua", function(config, parserConfig) {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-lua", "lua");
|
CodeMirror.defineMIME("text/x-lua", "lua");
|
||||||
|
CodeMirror.defineMIME("application/x-lua", "lua");
|
||||||
|
|
|
@ -38,11 +38,11 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||||
stream.skipToEnd();
|
stream.skipToEnd();
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream.eatSpace()) {
|
if (stream.eatSpace()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream.peek() === '#' || stream.match(headerRE)) {
|
if (stream.peek() === '#' || stream.match(headerRE)) {
|
||||||
stream.skipToEnd();
|
stream.skipToEnd();
|
||||||
return header;
|
return header;
|
||||||
|
@ -60,13 +60,13 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var match;
|
var match;
|
||||||
if (match = stream.match(ulRE, true) || stream.match(olRE, true)) {
|
if (match = stream.match(ulRE, true) || stream.match(olRE, true)) {
|
||||||
state.indentation += match[0].length;
|
state.indentation += match[0].length;
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
return switchInline(stream, state, state.inline);
|
return switchInline(stream, state, state.inline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,16 +90,16 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||||
if (stream.match(textRE, true)) {
|
if (stream.match(textRE, true)) {
|
||||||
return getType(state);
|
return getType(state);
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
function inlineNormal(stream, state) {
|
function inlineNormal(stream, state) {
|
||||||
var style = state.text(stream, state)
|
var style = state.text(stream, state)
|
||||||
if (typeof style !== 'undefined')
|
if (typeof style !== 'undefined')
|
||||||
return style;
|
return style;
|
||||||
|
|
||||||
var ch = stream.next();
|
var ch = stream.next();
|
||||||
|
|
||||||
if (ch === '\\') {
|
if (ch === '\\') {
|
||||||
stream.next();
|
stream.next();
|
||||||
return getType(state);
|
return getType(state);
|
||||||
|
@ -122,7 +122,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||||
}
|
}
|
||||||
return (state.em = !state.em) ? getType(state) : t;
|
return (state.em = !state.em) ? getType(state) : t;
|
||||||
}
|
}
|
||||||
|
|
||||||
return getType(state);
|
return getType(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,11 +184,11 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||||
startState: function() {
|
startState: function() {
|
||||||
return {
|
return {
|
||||||
f: blockNormal,
|
f: blockNormal,
|
||||||
|
|
||||||
block: blockNormal,
|
block: blockNormal,
|
||||||
htmlState: htmlMode.startState(),
|
htmlState: htmlMode.startState(),
|
||||||
indentation: 0,
|
indentation: 0,
|
||||||
|
|
||||||
inline: inlineNormal,
|
inline: inlineNormal,
|
||||||
text: handleText,
|
text: handleText,
|
||||||
em: false,
|
em: false,
|
||||||
|
@ -199,11 +199,11 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||||
copyState: function(s) {
|
copyState: function(s) {
|
||||||
return {
|
return {
|
||||||
f: s.f,
|
f: s.f,
|
||||||
|
|
||||||
block: s.block,
|
block: s.block,
|
||||||
htmlState: CodeMirror.copyState(htmlMode, s.htmlState),
|
htmlState: CodeMirror.copyState(htmlMode, s.htmlState),
|
||||||
indentation: s.indentation,
|
indentation: s.indentation,
|
||||||
|
|
||||||
inline: s.inline,
|
inline: s.inline,
|
||||||
text: s.text,
|
text: s.text,
|
||||||
em: s.em,
|
em: s.em,
|
||||||
|
@ -228,7 +228,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
state.indentation = currentIndentation;
|
state.indentation = currentIndentation;
|
||||||
|
|
||||||
if (currentIndentation > 0) return null;
|
if (currentIndentation > 0) return null;
|
||||||
}
|
}
|
||||||
return state.f(stream, state);
|
return state.f(stream, state);
|
||||||
|
@ -240,3 +240,4 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-markdown", "markdown");
|
CodeMirror.defineMIME("text/x-markdown", "markdown");
|
||||||
|
CodeMirror.defineMIME("application/x-markdown", "markdown");
|
||||||
|
|
|
@ -186,3 +186,4 @@ CodeMirror.defineMode("mysql", function(config) {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-mysql", "mysql");
|
CodeMirror.defineMIME("text/x-mysql", "mysql");
|
||||||
|
CodeMirror.defineMIME("application/x-mysql", "mysql");
|
||||||
|
|
|
@ -136,3 +136,4 @@ CodeMirror.defineMode("pascal", function(config) {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-pascal", "pascal");
|
CodeMirror.defineMIME("text/x-pascal", "pascal");
|
||||||
|
CodeMirror.defineMIME("application/x-pascal", "pascal");
|
||||||
|
|
|
@ -778,6 +778,7 @@ CodeMirror.defineMode("perl",function(config,parserConfig){
|
||||||
electricChars:"{}"}});
|
electricChars:"{}"}});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-perl", "perl");
|
CodeMirror.defineMIME("text/x-perl", "perl");
|
||||||
|
CodeMirror.defineMIME("application/x-perl", "perl");
|
||||||
|
|
||||||
// it's like "peek", but need for look-ahead or look-behind if index < 0
|
// it's like "peek", but need for look-ahead or look-behind if index < 0
|
||||||
CodeMirror.StringStream.prototype.look=function(c){
|
CodeMirror.StringStream.prototype.look=function(c){
|
||||||
|
|
|
@ -118,4 +118,5 @@
|
||||||
CodeMirror.defineMIME("application/x-httpd-php", "php");
|
CodeMirror.defineMIME("application/x-httpd-php", "php");
|
||||||
CodeMirror.defineMIME("application/x-httpd-php-open", {name: "php", startOpen: true});
|
CodeMirror.defineMIME("application/x-httpd-php-open", {name: "php", startOpen: true});
|
||||||
CodeMirror.defineMIME("text/x-php", phpConfig);
|
CodeMirror.defineMIME("text/x-php", phpConfig);
|
||||||
|
CodeMirror.defineMIME("application/x-php", phpConfig);
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -207,7 +207,7 @@ CodeMirror.defineMode("plsql", function(config, parserConfig) {
|
||||||
"verify version " +
|
"verify version " +
|
||||||
"wrap";
|
"wrap";
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-plsql", {
|
CodeMirror.defineMIME("application/x-plsql", {
|
||||||
name: "plsql",
|
name: "plsql",
|
||||||
keywords: keywords(cKeywords),
|
keywords: keywords(cKeywords),
|
||||||
functions: keywords(cFunctions),
|
functions: keywords(cFunctions),
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
CodeMirror.defineMode("python", function(conf, parserConf) {
|
CodeMirror.defineMode("python", function(conf, parserConf) {
|
||||||
var ERRORCLASS = 'error';
|
var ERRORCLASS = 'error';
|
||||||
|
|
||||||
function wordRegexp(words) {
|
function wordRegexp(words) {
|
||||||
return new RegExp("^((" + words.join(")|(") + "))\\b");
|
return new RegExp("^((" + words.join(")|(") + "))\\b");
|
||||||
}
|
}
|
||||||
|
|
||||||
var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!]");
|
var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!]");
|
||||||
var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
|
var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
|
||||||
var doubleOperators = new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))");
|
var doubleOperators = new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))");
|
||||||
|
@ -72,15 +72,15 @@ CodeMirror.defineMode("python", function(conf, parserConf) {
|
||||||
if (stream.eatSpace()) {
|
if (stream.eatSpace()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var ch = stream.peek();
|
var ch = stream.peek();
|
||||||
|
|
||||||
// Handle Comments
|
// Handle Comments
|
||||||
if (ch === '#') {
|
if (ch === '#') {
|
||||||
stream.skipToEnd();
|
stream.skipToEnd();
|
||||||
return 'comment';
|
return 'comment';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle Number Literals
|
// Handle Number Literals
|
||||||
if (stream.match(/^[0-9\.]/, false)) {
|
if (stream.match(/^[0-9\.]/, false)) {
|
||||||
var floatLiteral = false;
|
var floatLiteral = false;
|
||||||
|
@ -116,13 +116,13 @@ CodeMirror.defineMode("python", function(conf, parserConf) {
|
||||||
return 'number';
|
return 'number';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle Strings
|
// Handle Strings
|
||||||
if (stream.match(stringPrefixes)) {
|
if (stream.match(stringPrefixes)) {
|
||||||
state.tokenize = tokenStringFactory(stream.current());
|
state.tokenize = tokenStringFactory(stream.current());
|
||||||
return state.tokenize(stream, state);
|
return state.tokenize(stream, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle operators and Delimiters
|
// Handle operators and Delimiters
|
||||||
if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
|
if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -135,31 +135,31 @@ CodeMirror.defineMode("python", function(conf, parserConf) {
|
||||||
if (stream.match(singleDelimiters)) {
|
if (stream.match(singleDelimiters)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream.match(keywords)) {
|
if (stream.match(keywords)) {
|
||||||
return 'keyword';
|
return 'keyword';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream.match(builtins)) {
|
if (stream.match(builtins)) {
|
||||||
return 'builtin';
|
return 'builtin';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream.match(identifiers)) {
|
if (stream.match(identifiers)) {
|
||||||
return 'variable';
|
return 'variable';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle non-detected items
|
// Handle non-detected items
|
||||||
stream.next();
|
stream.next();
|
||||||
return ERRORCLASS;
|
return ERRORCLASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
function tokenStringFactory(delimiter) {
|
function tokenStringFactory(delimiter) {
|
||||||
while ('rub'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) {
|
while ('rub'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) {
|
||||||
delimiter = delimiter.substr(1);
|
delimiter = delimiter.substr(1);
|
||||||
}
|
}
|
||||||
var singleline = delimiter.length == 1;
|
var singleline = delimiter.length == 1;
|
||||||
var OUTCLASS = 'string';
|
var OUTCLASS = 'string';
|
||||||
|
|
||||||
return function tokenString(stream, state) {
|
return function tokenString(stream, state) {
|
||||||
while (!stream.eol()) {
|
while (!stream.eol()) {
|
||||||
stream.eatWhile(/[^'"\\]/);
|
stream.eatWhile(/[^'"\\]/);
|
||||||
|
@ -185,7 +185,7 @@ CodeMirror.defineMode("python", function(conf, parserConf) {
|
||||||
return OUTCLASS;
|
return OUTCLASS;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function indent(stream, state, type) {
|
function indent(stream, state, type) {
|
||||||
type = type || 'py';
|
type = type || 'py';
|
||||||
var indentUnit = 0;
|
var indentUnit = 0;
|
||||||
|
@ -208,7 +208,7 @@ CodeMirror.defineMode("python", function(conf, parserConf) {
|
||||||
type: type
|
type: type
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function dedent(stream, state, type) {
|
function dedent(stream, state, type) {
|
||||||
type = type || 'py';
|
type = type || 'py';
|
||||||
if (state.scopes.length == 1) return;
|
if (state.scopes.length == 1) return;
|
||||||
|
@ -257,7 +257,7 @@ CodeMirror.defineMode("python", function(conf, parserConf) {
|
||||||
return ERRORCLASS;
|
return ERRORCLASS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle decorators
|
// Handle decorators
|
||||||
if (current === '@') {
|
if (current === '@') {
|
||||||
style = state.tokenize(stream, state);
|
style = state.tokenize(stream, state);
|
||||||
|
@ -270,7 +270,7 @@ CodeMirror.defineMode("python", function(conf, parserConf) {
|
||||||
return ERRORCLASS;
|
return ERRORCLASS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle scope changes.
|
// Handle scope changes.
|
||||||
if (current === 'pass' || current === 'return') {
|
if (current === 'pass' || current === 'return') {
|
||||||
state.dedent += 1;
|
state.dedent += 1;
|
||||||
|
@ -298,7 +298,7 @@ CodeMirror.defineMode("python", function(conf, parserConf) {
|
||||||
if (state.scopes.length > 1) state.scopes.shift();
|
if (state.scopes.length > 1) state.scopes.shift();
|
||||||
state.dedent -= 1;
|
state.dedent -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,29 +312,30 @@ CodeMirror.defineMode("python", function(conf, parserConf) {
|
||||||
dedent: 0
|
dedent: 0
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
token: function(stream, state) {
|
token: function(stream, state) {
|
||||||
var style = tokenLexer(stream, state);
|
var style = tokenLexer(stream, state);
|
||||||
|
|
||||||
state.lastToken = {style:style, content: stream.current()};
|
state.lastToken = {style:style, content: stream.current()};
|
||||||
|
|
||||||
if (stream.eol() && stream.lambda) {
|
if (stream.eol() && stream.lambda) {
|
||||||
state.lambda = false;
|
state.lambda = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return style;
|
return style;
|
||||||
},
|
},
|
||||||
|
|
||||||
indent: function(state, textAfter) {
|
indent: function(state, textAfter) {
|
||||||
if (state.tokenize != tokenBase) {
|
if (state.tokenize != tokenBase) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return state.scopes[0].offset;
|
return state.scopes[0].offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
return external;
|
return external;
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-python", "python");
|
CodeMirror.defineMIME("text/x-python", "python");
|
||||||
|
CodeMirror.defineMIME("application/x-python", "python");
|
||||||
|
|
|
@ -139,3 +139,4 @@ CodeMirror.defineMode("r", function(config) {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-rsrc", "r");
|
CodeMirror.defineMIME("text/x-rsrc", "r");
|
||||||
|
CodeMirror.defineMIME("application/x-rsrc", "r");
|
||||||
|
|
|
@ -17,3 +17,4 @@ CodeMirror.defineMode("changes", function(config, modeConfig) {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-rpm-changes", "changes");
|
CodeMirror.defineMIME("text/x-rpm-changes", "changes");
|
||||||
|
CodeMirror.defineMIME("application/x-rpm-changes", "changes");
|
||||||
|
|
|
@ -64,3 +64,4 @@ CodeMirror.defineMode("spec", function(config, modeConfig) {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-rpm-spec", "spec");
|
CodeMirror.defineMIME("text/x-rpm-spec", "spec");
|
||||||
|
CodeMirror.defineMIME("application/x-rpm-spec", "spec");
|
||||||
|
|
|
@ -324,3 +324,4 @@ CodeMirror.defineMode('rst', function(config, options) {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-rst", "rst");
|
CodeMirror.defineMIME("text/x-rst", "rst");
|
||||||
|
CodeMirror.defineMIME("application/x-rst", "rst");
|
||||||
|
|
|
@ -197,4 +197,5 @@ CodeMirror.defineMode("ruby", function(config, parserConfig) {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-ruby", "ruby");
|
CodeMirror.defineMIME("text/x-ruby", "ruby");
|
||||||
|
CodeMirror.defineMIME("application/x-ruby", "ruby");
|
||||||
|
|
||||||
|
|
|
@ -430,3 +430,4 @@ CodeMirror.defineMode("rust", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-rustsrc", "rust");
|
CodeMirror.defineMIME("text/x-rustsrc", "rust");
|
||||||
|
CodeMirror.defineMIME("application/x-rustsrc", "rust");
|
||||||
|
|
|
@ -5,7 +5,7 @@ CodeMirror.defineMode("scheme", function (config, mode) {
|
||||||
var BUILTIN = "builtin", COMMENT = "comment", STRING = "string",
|
var BUILTIN = "builtin", COMMENT = "comment", STRING = "string",
|
||||||
ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD="keyword";
|
ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD="keyword";
|
||||||
var INDENT_WORD_SKIP = 2, KEYWORDS_SKIP = 1;
|
var INDENT_WORD_SKIP = 2, KEYWORDS_SKIP = 1;
|
||||||
|
|
||||||
function makeKeywords(str) {
|
function makeKeywords(str) {
|
||||||
var obj = {}, words = str.split(" ");
|
var obj = {}, words = str.split(" ");
|
||||||
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
|
||||||
|
@ -14,7 +14,7 @@ CodeMirror.defineMode("scheme", function (config, mode) {
|
||||||
|
|
||||||
var keywords = makeKeywords("λ case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci<? char-ci=? char-ci>=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char<? char=? char>=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci<? string-ci=? string-ci>=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string<? string=? string>=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?");
|
var keywords = makeKeywords("λ case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci<? char-ci=? char-ci>=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char<? char=? char>=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci<? string-ci=? string-ci>=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string<? string=? string>=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?");
|
||||||
var indentKeys = makeKeywords("define let letrec let* lambda");
|
var indentKeys = makeKeywords("define let letrec let* lambda");
|
||||||
|
|
||||||
|
|
||||||
function stateStack(indent, type, prev) { // represents a state stack object
|
function stateStack(indent, type, prev) { // represents a state stack object
|
||||||
this.indent = indent;
|
this.indent = indent;
|
||||||
|
@ -29,14 +29,14 @@ CodeMirror.defineMode("scheme", function (config, mode) {
|
||||||
function popStack(state) {
|
function popStack(state) {
|
||||||
state.indentStack = state.indentStack.prev;
|
state.indentStack = state.indentStack.prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scheme numbers are complicated unfortunately.
|
* Scheme numbers are complicated unfortunately.
|
||||||
* Checks if we're looking at a number, which might be possibly a fraction.
|
* Checks if we're looking at a number, which might be possibly a fraction.
|
||||||
* Also checks that it is not part of a longer identifier. Returns true/false accordingly.
|
* Also checks that it is not part of a longer identifier. Returns true/false accordingly.
|
||||||
*/
|
*/
|
||||||
function isNumber(ch, stream){
|
function isNumber(ch, stream){
|
||||||
if(/[0-9]/.exec(ch) != null){
|
if(/[0-9]/.exec(ch) != null){
|
||||||
stream.eatWhile(/[0-9]/);
|
stream.eatWhile(/[0-9]/);
|
||||||
stream.eat(/\//);
|
stream.eat(/\//);
|
||||||
stream.eatWhile(/[0-9]/);
|
stream.eatWhile(/[0-9]/);
|
||||||
|
@ -67,13 +67,13 @@ CodeMirror.defineMode("scheme", function (config, mode) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var returnType = null;
|
var returnType = null;
|
||||||
|
|
||||||
switch(state.mode){
|
switch(state.mode){
|
||||||
case "string": // multi-line string parsing mode
|
case "string": // multi-line string parsing mode
|
||||||
var next, escaped = false;
|
var next, escaped = false;
|
||||||
while ((next = stream.next()) != null) {
|
while ((next = stream.next()) != null) {
|
||||||
if (next == "\"" && !escaped) {
|
if (next == "\"" && !escaped) {
|
||||||
|
|
||||||
state.mode = false;
|
state.mode = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ CodeMirror.defineMode("scheme", function (config, mode) {
|
||||||
var next, maybeEnd = false;
|
var next, maybeEnd = false;
|
||||||
while ((next = stream.next()) != null) {
|
while ((next = stream.next()) != null) {
|
||||||
if (next == "#" && maybeEnd) {
|
if (next == "#" && maybeEnd) {
|
||||||
|
|
||||||
state.mode = false;
|
state.mode = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -106,11 +106,11 @@ CodeMirror.defineMode("scheme", function (config, mode) {
|
||||||
}
|
}
|
||||||
default: // default parsing mode
|
default: // default parsing mode
|
||||||
var ch = stream.next();
|
var ch = stream.next();
|
||||||
|
|
||||||
if (ch == "\"") {
|
if (ch == "\"") {
|
||||||
state.mode = "string";
|
state.mode = "string";
|
||||||
returnType = STRING;
|
returnType = STRING;
|
||||||
|
|
||||||
} else if (ch == "'") {
|
} else if (ch == "'") {
|
||||||
returnType = ATOM;
|
returnType = ATOM;
|
||||||
} else if (ch == '#') {
|
} else if (ch == '#') {
|
||||||
|
@ -123,16 +123,16 @@ CodeMirror.defineMode("scheme", function (config, mode) {
|
||||||
state.mode = "s-expr-comment";
|
state.mode = "s-expr-comment";
|
||||||
returnType = COMMENT;
|
returnType = COMMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (ch == ";") { // comment
|
} else if (ch == ";") { // comment
|
||||||
stream.skipToEnd(); // rest of the line is a comment
|
stream.skipToEnd(); // rest of the line is a comment
|
||||||
returnType = COMMENT;
|
returnType = COMMENT;
|
||||||
} else if (ch == "-"){
|
} else if (ch == "-"){
|
||||||
|
|
||||||
if(!isNaN(parseInt(stream.peek()))){
|
if(!isNaN(parseInt(stream.peek()))){
|
||||||
stream.eatWhile(/[\/0-9]/);
|
stream.eatWhile(/[\/0-9]/);
|
||||||
returnType = NUMBER;
|
returnType = NUMBER;
|
||||||
}else{
|
}else{
|
||||||
returnType = null;
|
returnType = null;
|
||||||
}
|
}
|
||||||
} else if (isNumber(ch,stream)){
|
} else if (isNumber(ch,stream)){
|
||||||
|
@ -140,18 +140,18 @@ CodeMirror.defineMode("scheme", function (config, mode) {
|
||||||
} else if (ch == "(" || ch == "[") {
|
} else if (ch == "(" || ch == "[") {
|
||||||
var keyWord = ''; var indentTemp = stream.column();
|
var keyWord = ''; var indentTemp = stream.column();
|
||||||
/**
|
/**
|
||||||
Either
|
Either
|
||||||
(indent-word ..
|
(indent-word ..
|
||||||
(non-indent-word ..
|
(non-indent-word ..
|
||||||
(;something else, bracket, etc.
|
(;something else, bracket, etc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
while ((letter = stream.eat(/[^\s\(\[\;\)\]]/)) != null) {
|
while ((letter = stream.eat(/[^\s\(\[\;\)\]]/)) != null) {
|
||||||
keyWord += letter;
|
keyWord += letter;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keyWord.length > 0 && indentKeys.propertyIsEnumerable(keyWord)) { // indent-word
|
if (keyWord.length > 0 && indentKeys.propertyIsEnumerable(keyWord)) { // indent-word
|
||||||
|
|
||||||
pushStack(state, indentTemp + INDENT_WORD_SKIP, ch);
|
pushStack(state, indentTemp + INDENT_WORD_SKIP, ch);
|
||||||
} else { // non-indent word
|
} else { // non-indent word
|
||||||
// we continue eating the spaces
|
// we continue eating the spaces
|
||||||
|
@ -165,15 +165,15 @@ CodeMirror.defineMode("scheme", function (config, mode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stream.backUp(stream.current().length - 1); // undo all the eating
|
stream.backUp(stream.current().length - 1); // undo all the eating
|
||||||
|
|
||||||
if(typeof state.sExprComment == "number") state.sExprComment++;
|
if(typeof state.sExprComment == "number") state.sExprComment++;
|
||||||
|
|
||||||
returnType = BRACKET;
|
returnType = BRACKET;
|
||||||
} else if (ch == ")" || ch == "]") {
|
} else if (ch == ")" || ch == "]") {
|
||||||
returnType = BRACKET;
|
returnType = BRACKET;
|
||||||
if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : "[")) {
|
if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : "[")) {
|
||||||
popStack(state);
|
popStack(state);
|
||||||
|
|
||||||
if(typeof state.sExprComment == "number"){
|
if(typeof state.sExprComment == "number"){
|
||||||
if(--state.sExprComment == 0){
|
if(--state.sExprComment == 0){
|
||||||
returnType = COMMENT; // final closing bracket
|
returnType = COMMENT; // final closing bracket
|
||||||
|
@ -183,7 +183,7 @@ CodeMirror.defineMode("scheme", function (config, mode) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
stream.eatWhile(/[\w\$_\-]/);
|
stream.eatWhile(/[\w\$_\-]/);
|
||||||
|
|
||||||
if (keywords && keywords.propertyIsEnumerable(stream.current())) {
|
if (keywords && keywords.propertyIsEnumerable(stream.current())) {
|
||||||
returnType = BUILTIN;
|
returnType = BUILTIN;
|
||||||
}else returnType = null;
|
}else returnType = null;
|
||||||
|
@ -199,4 +199,5 @@ CodeMirror.defineMode("scheme", function (config, mode) {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-scheme", "scheme");
|
CodeMirror.defineMIME("text/x-scheme", "scheme");
|
||||||
|
CodeMirror.defineMIME("application/x-scheme", "scheme");
|
||||||
|
|
|
@ -0,0 +1,119 @@
|
||||||
|
CodeMirror.defineMode('shell', function(config) {
|
||||||
|
|
||||||
|
var words = {};
|
||||||
|
function define(style, string) {
|
||||||
|
var split = string.split(' ');
|
||||||
|
for(var i = 0; i < split.length; i++) {
|
||||||
|
words[split[i]] = style;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Atoms
|
||||||
|
define('atom', 'true false');
|
||||||
|
|
||||||
|
// Keywords
|
||||||
|
define('keyword', 'if then do else elif while until for in esac fi fin ' +
|
||||||
|
'fil done exit set unset export function');
|
||||||
|
|
||||||
|
// Commands
|
||||||
|
define('builtin', 'ab awk bash beep cat cc cd chown chmod chroot clear cp ' +
|
||||||
|
'curl cut diff echo find gawk gcc get git grep kill killall ln ls make ' +
|
||||||
|
'mkdir openssl mv nc node npm ping ps restart rm rmdir sed service sh ' +
|
||||||
|
'shopt shred source sort sleep ssh start stop su sudo tee telnet top ' +
|
||||||
|
'touch vi vim wall wc wget who write yes zsh');
|
||||||
|
|
||||||
|
function tokenBase(stream, state) {
|
||||||
|
|
||||||
|
var sol = stream.sol();
|
||||||
|
var ch = stream.next();
|
||||||
|
|
||||||
|
if (ch === '\'' || ch === '"' || ch === '`') {
|
||||||
|
state.tokens.unshift(tokenString(ch));
|
||||||
|
return tokenize(stream, state);
|
||||||
|
}
|
||||||
|
if (ch === '#') {
|
||||||
|
if (sol && stream.eat('!')) {
|
||||||
|
stream.skipToEnd();
|
||||||
|
return 'meta'; // 'comment'?
|
||||||
|
}
|
||||||
|
stream.skipToEnd();
|
||||||
|
return 'comment';
|
||||||
|
}
|
||||||
|
if (ch === '$') {
|
||||||
|
state.tokens.unshift(tokenDollar);
|
||||||
|
return tokenize(stream, state);
|
||||||
|
}
|
||||||
|
if (ch === '+' || ch === '=') {
|
||||||
|
return 'operator';
|
||||||
|
}
|
||||||
|
if (ch === '-') {
|
||||||
|
stream.eat('-');
|
||||||
|
stream.eatWhile(/\w/);
|
||||||
|
return 'attribute';
|
||||||
|
}
|
||||||
|
if (/\d/.test(ch)) {
|
||||||
|
stream.eatWhile(/\d/);
|
||||||
|
if(!/\w/.test(stream.peek())) {
|
||||||
|
return 'number';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stream.eatWhile(/\w/);
|
||||||
|
var cur = stream.current();
|
||||||
|
if (stream.peek() === '=' && /\w+/.test(cur)) return 'def';
|
||||||
|
return words.hasOwnProperty(cur) ? words[cur] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function tokenString(quote) {
|
||||||
|
return function(stream, state) {
|
||||||
|
var next, end = false, escaped = false;
|
||||||
|
while ((next = stream.next()) != null) {
|
||||||
|
if (next === quote && !escaped) {
|
||||||
|
end = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (next === '$' && !escaped && quote !== '\'') {
|
||||||
|
escaped = true;
|
||||||
|
stream.backUp(1);
|
||||||
|
state.tokens.unshift(tokenDollar);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
escaped = !escaped && next === '\\';
|
||||||
|
}
|
||||||
|
if (end || !escaped) {
|
||||||
|
state.tokens.shift();
|
||||||
|
}
|
||||||
|
return (quote === '`' || quote === ')' ? 'quote' : 'string');
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var tokenDollar = function(stream, state) {
|
||||||
|
if (state.tokens.length > 1) stream.eat('$');
|
||||||
|
var ch = stream.next(), hungry = /\w/;
|
||||||
|
if (ch === '{') hungry = /[^}]/;
|
||||||
|
if (ch === '(') {
|
||||||
|
state.tokens[0] = tokenString(')');
|
||||||
|
return tokenize(stream, state);
|
||||||
|
}
|
||||||
|
if (!/\d/.test(ch)) {
|
||||||
|
stream.eatWhile(hungry);
|
||||||
|
stream.eat('}');
|
||||||
|
}
|
||||||
|
state.tokens.shift();
|
||||||
|
return 'def';
|
||||||
|
};
|
||||||
|
|
||||||
|
function tokenize(stream, state) {
|
||||||
|
return (state.tokens[0] || tokenBase) (stream, state);
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
startState: function() {return {tokens:[]};},
|
||||||
|
token: function(stream, state) {
|
||||||
|
if (stream.eatSpace()) return null;
|
||||||
|
return tokenize(stream, state);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
CodeMirror.defineMIME('text/x-sh', 'shell');
|
||||||
|
CodeMirror.defineMIME('application/x-sh', 'shell');
|
|
@ -136,4 +136,5 @@ CodeMirror.defineMode('smalltalk', function(config, modeConfig) {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME('text/x-stsrc', {name: 'smalltalk'});
|
CodeMirror.defineMIME('text/x-stsrc', {name: 'smalltalk'});
|
||||||
|
CodeMirror.defineMIME('application/x-stsrc', {name: 'smalltalk'});
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
* Licence: MIT
|
* Licence: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
|
CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
|
||||||
{
|
{
|
||||||
function pushCommand(state, command) {
|
function pushCommand(state, command) {
|
||||||
state.cmdState.push(command);
|
state.cmdState.push(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
function peekCommand(state) {
|
function peekCommand(state) {
|
||||||
if (state.cmdState.length>0)
|
if (state.cmdState.length>0)
|
||||||
return state.cmdState[state.cmdState.length-1];
|
return state.cmdState[state.cmdState.length-1];
|
||||||
else
|
else
|
||||||
|
@ -20,7 +20,7 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
|
||||||
if (state.cmdState.length>0) {
|
if (state.cmdState.length>0) {
|
||||||
var plug = state.cmdState.pop();
|
var plug = state.cmdState.pop();
|
||||||
plug.closeBracket();
|
plug.closeBracket();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyMostPowerful(state) {
|
function applyMostPowerful(state) {
|
||||||
|
@ -58,7 +58,7 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
var plugins = new Array();
|
var plugins = new Array();
|
||||||
|
|
||||||
plugins["importmodule"] = addPluginPattern("importmodule", "tag", "{[", ["string", "builtin"]);
|
plugins["importmodule"] = addPluginPattern("importmodule", "tag", "{[", ["string", "builtin"]);
|
||||||
plugins["documentclass"] = addPluginPattern("documentclass", "tag", "{[", ["", "atom"]);
|
plugins["documentclass"] = addPluginPattern("documentclass", "tag", "{[", ["", "atom"]);
|
||||||
plugins["usepackage"] = addPluginPattern("documentclass", "tag", "[", ["atom"]);
|
plugins["usepackage"] = addPluginPattern("documentclass", "tag", "[", ["atom"]);
|
||||||
|
@ -99,7 +99,7 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
|
||||||
if (ch == "%") {
|
if (ch == "%") {
|
||||||
setState(state, inCComment);
|
setState(state, inCComment);
|
||||||
return "comment";
|
return "comment";
|
||||||
}
|
}
|
||||||
else if (ch=='}' || ch==']') {
|
else if (ch=='}' || ch==']') {
|
||||||
plug = peekCommand(state);
|
plug = peekCommand(state);
|
||||||
if (plug) {
|
if (plug) {
|
||||||
|
@ -109,10 +109,10 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
|
||||||
return "error";
|
return "error";
|
||||||
return "bracket";
|
return "bracket";
|
||||||
} else if (ch=='{' || ch=='[') {
|
} else if (ch=='{' || ch=='[') {
|
||||||
plug = plugins["DEFAULT"];
|
plug = plugins["DEFAULT"];
|
||||||
plug = new plug();
|
plug = new plug();
|
||||||
pushCommand(state, plug);
|
pushCommand(state, plug);
|
||||||
return "bracket";
|
return "bracket";
|
||||||
}
|
}
|
||||||
else if (/\d/.test(ch)) {
|
else if (/\d/.test(ch)) {
|
||||||
source.eatWhile(/[\w.%]/);
|
source.eatWhile(/[\w.%]/);
|
||||||
|
@ -154,7 +154,7 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
|
||||||
return {
|
return {
|
||||||
startState: function() { return { f:normal, cmdState:[] }; },
|
startState: function() { return { f:normal, cmdState:[] }; },
|
||||||
copyState: function(s) { return { f: s.f, cmdState: s.cmdState.slice(0, s.cmdState.length) }; },
|
copyState: function(s) { return { f: s.f, cmdState: s.cmdState.slice(0, s.cmdState.length) }; },
|
||||||
|
|
||||||
token: function(stream, state) {
|
token: function(stream, state) {
|
||||||
var t = state.f(stream, state);
|
var t = state.f(stream, state);
|
||||||
var w = stream.current();
|
var w = stream.current();
|
||||||
|
@ -165,3 +165,4 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
|
||||||
|
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-stex", "stex");
|
CodeMirror.defineMIME("text/x-stex", "stex");
|
||||||
|
CodeMirror.defineMIME("application/x-stex", "stex");
|
||||||
|
|
|
@ -90,14 +90,14 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function jsTokenBase(stream, state) {
|
function jsTokenBase(stream, state) {
|
||||||
var sol = stream.sol(),
|
var sol = stream.sol(),
|
||||||
ch, tch;
|
ch, tch;
|
||||||
|
|
||||||
state.block = false; // indicates the start of a code block.
|
state.block = false; // indicates the start of a code block.
|
||||||
|
|
||||||
ch = stream.peek(); // don't eat, to make match simpler
|
ch = stream.peek(); // don't eat, to make match simpler
|
||||||
|
|
||||||
// check start of blocks
|
// check start of blocks
|
||||||
if (sol && /[<\/\*{}\-]/.test(ch)) {
|
if (sol && /[<\/\*{}\-]/.test(ch)) {
|
||||||
if (stream.match(reCodeBlockStart)) {
|
if (stream.match(reCodeBlockStart)) {
|
||||||
state.block = true;
|
state.block = true;
|
||||||
|
@ -180,7 +180,7 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) {
|
||||||
if (stream.eat("%")) {
|
if (stream.eat("%")) {
|
||||||
return chain(stream, state, twTokenComment);
|
return chain(stream, state, twTokenComment);
|
||||||
}
|
}
|
||||||
else if (stream.eat("/")) { //
|
else if (stream.eat("/")) { //
|
||||||
return chain(stream, state, twTokenEm);
|
return chain(stream, state, twTokenEm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -254,7 +254,7 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) {
|
||||||
// tw code
|
// tw code
|
||||||
function twTokenCode(stream, state) {
|
function twTokenCode(stream, state) {
|
||||||
var ch, sb = state.block;
|
var ch, sb = state.block;
|
||||||
|
|
||||||
if (sb && stream.current()) {
|
if (sb && stream.current()) {
|
||||||
return ret("code", "code");
|
return ret("code", "code");
|
||||||
}
|
}
|
||||||
|
@ -301,12 +301,12 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) {
|
||||||
return ret("text", "underlined");
|
return ret("text", "underlined");
|
||||||
}
|
}
|
||||||
|
|
||||||
// tw strike through text looks ugly
|
// tw strike through text looks ugly
|
||||||
// TODO just strike through the first and last 2 chars if possible.
|
// TODO just strike through the first and last 2 chars if possible.
|
||||||
function twTokenStrike(stream, state) {
|
function twTokenStrike(stream, state) {
|
||||||
var maybeEnd = false,
|
var maybeEnd = false,
|
||||||
ch, nr;
|
ch, nr;
|
||||||
|
|
||||||
while (ch = stream.next()) {
|
while (ch = stream.next()) {
|
||||||
if (ch == "-" && maybeEnd) {
|
if (ch == "-" && maybeEnd) {
|
||||||
state.tokenize = jsTokenBase;
|
state.tokenize = jsTokenBase;
|
||||||
|
@ -371,4 +371,5 @@ CodeMirror.defineMode("tiddlywiki", function (config, parserConfig) {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-tiddlywiki", "tiddlywiki");
|
CodeMirror.defineMIME("text/x-tiddlywiki", "tiddlywiki");
|
||||||
|
CodeMirror.defineMIME("application/x-tiddlywiki", "tiddlywiki");
|
||||||
//}}}
|
//}}}
|
||||||
|
|
|
@ -144,3 +144,4 @@ CodeMirror.defineMode("velocity", function(config) {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/velocity", "velocity");
|
CodeMirror.defineMIME("text/velocity", "velocity");
|
||||||
|
CodeMirror.defineMIME("application/velocity", "velocity");
|
||||||
|
|
|
@ -184,7 +184,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
|
||||||
return "string";
|
return "string";
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-verilog", {
|
CodeMirror.defineMIME("application/x-verilog", {
|
||||||
name: "verilog",
|
name: "verilog",
|
||||||
keywords: words(verilogKeywords),
|
keywords: words(verilogKeywords),
|
||||||
blockKeywords: words(verilogBlockKeywords),
|
blockKeywords: words(verilogBlockKeywords),
|
||||||
|
|
|
@ -50,7 +50,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
|
||||||
var ok;
|
var ok;
|
||||||
if (stream.eat("#")) {
|
if (stream.eat("#")) {
|
||||||
if (stream.eat("x")) {
|
if (stream.eat("x")) {
|
||||||
ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
|
ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
|
||||||
} else {
|
} else {
|
||||||
ok = stream.eatWhile(/[\d]/) && stream.eat(";");
|
ok = stream.eatWhile(/[\d]/) && stream.eat(";");
|
||||||
}
|
}
|
||||||
|
@ -256,5 +256,6 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("application/xml", "xml");
|
//CodeMirror.defineMIME("application/xml", "xml");
|
||||||
CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
|
CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
|
||||||
|
CodeMirror.defineMIME("application/html", {name: "xml", htmlMode: true});
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
CodeMirror.defineMode("yaml", function() {
|
CodeMirror.defineMode("yaml", function() {
|
||||||
|
|
||||||
var cons = ['true', 'false', 'on', 'off', 'yes', 'no'];
|
var cons = ['true', 'false', 'on', 'off', 'yes', 'no'];
|
||||||
var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i');
|
var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
token: function(stream, state) {
|
token: function(stream, state) {
|
||||||
var ch = stream.peek();
|
var ch = stream.peek();
|
||||||
|
@ -31,7 +31,7 @@ CodeMirror.defineMode("yaml", function() {
|
||||||
return "atom";
|
return "atom";
|
||||||
}
|
}
|
||||||
if (state.pair && stream.match(/^:\s*/)) { state.pairStart = true; return 'meta'; }
|
if (state.pair && stream.match(/^:\s*/)) { state.pairStart = true; return 'meta'; }
|
||||||
|
|
||||||
/* inline pairs/lists */
|
/* inline pairs/lists */
|
||||||
if (stream.match(/^(\{|\}|\[|\])/)) {
|
if (stream.match(/^(\{|\}|\[|\])/)) {
|
||||||
if (ch == '{')
|
if (ch == '{')
|
||||||
|
@ -44,7 +44,7 @@ CodeMirror.defineMode("yaml", function() {
|
||||||
state.inlineList--;
|
state.inlineList--;
|
||||||
return 'meta';
|
return 'meta';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* list seperator */
|
/* list seperator */
|
||||||
if (state.inlineList > 0 && !esc && ch == ',') {
|
if (state.inlineList > 0 && !esc && ch == ',') {
|
||||||
stream.next();
|
stream.next();
|
||||||
|
@ -58,7 +58,7 @@ CodeMirror.defineMode("yaml", function() {
|
||||||
stream.next();
|
stream.next();
|
||||||
return 'meta';
|
return 'meta';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* start of value of a pair */
|
/* start of value of a pair */
|
||||||
if (state.pairStart) {
|
if (state.pairStart) {
|
||||||
/* block literals */
|
/* block literals */
|
||||||
|
@ -93,3 +93,4 @@ CodeMirror.defineMode("yaml", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-yaml", "yaml");
|
CodeMirror.defineMIME("text/x-yaml", "yaml");
|
||||||
|
CodeMirror.defineMIME("application/x-yaml", "yaml");
|
||||||
|
|
Loading…
Reference in New Issue