Update ACE Editor to version 1.32.6
This commit is contained in:

committed by
Sebastian Serth

parent
0a473c7fd3
commit
b00d45521b
257
vendor/assets/javascripts/ace/mode-clojure.js
vendored
257
vendor/assets/javascripts/ace/mode-clojure.js
vendored
@ -1,15 +1,8 @@
|
||||
define("ace/mode/clojure_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
define("ace/mode/clojure_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
|
||||
|
||||
var ClojureHighlightRules = function() {
|
||||
|
||||
var builtinFunctions = (
|
||||
'* *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* ' +
|
||||
var ClojureHighlightRules = function () {
|
||||
var builtinFunctions = ('* *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* ' +
|
||||
'*command-line-args* *compile-files* *compile-path* *e *err* *file* ' +
|
||||
'*flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* ' +
|
||||
'*print-dup* *print-length* *print-level* *print-meta* *print-readably* ' +
|
||||
@ -76,172 +69,183 @@ var ClojureHighlightRules = function() {
|
||||
'var? vary-meta vec vector vector? when when-first when-let when-not ' +
|
||||
'while with-bindings with-bindings* with-in-str with-loading-context ' +
|
||||
'with-local-vars with-meta with-open with-out-str with-precision xml-seq ' +
|
||||
'zero? zipmap'
|
||||
);
|
||||
|
||||
'zero? zipmap');
|
||||
var keywords = ('throw try var ' +
|
||||
'def do fn if let loop monitor-enter monitor-exit new quote recur set!'
|
||||
);
|
||||
|
||||
'def do fn if let loop monitor-enter monitor-exit new quote recur set!');
|
||||
var buildinConstants = ("true false nil");
|
||||
|
||||
var keywordMapper = this.createKeywordMapper({
|
||||
"keyword": keywords,
|
||||
"constant.language": buildinConstants,
|
||||
"support.function": builtinFunctions
|
||||
}, "identifier", false, " ");
|
||||
|
||||
this.$rules = {
|
||||
"start" : [
|
||||
"start": [
|
||||
{
|
||||
token : "comment",
|
||||
regex : ";.*$"
|
||||
token: "comment",
|
||||
regex: ";.*$"
|
||||
}, {
|
||||
token : "keyword", //parens
|
||||
regex : "[\\(|\\)]"
|
||||
token: "keyword", //parens
|
||||
regex: "[\\(|\\)]"
|
||||
}, {
|
||||
token : "keyword", //lists
|
||||
regex : "[\\'\\(]"
|
||||
token: "keyword", //lists
|
||||
regex: "[\\'\\(]"
|
||||
}, {
|
||||
token : "keyword", //vectors
|
||||
regex : "[\\[|\\]]"
|
||||
token: "keyword", //vectors
|
||||
regex: "[\\[|\\]]"
|
||||
}, {
|
||||
token : "keyword", //sets and maps
|
||||
regex : "[\\{|\\}|\\#\\{|\\#\\}]"
|
||||
token: "string.regexp", //Regular Expressions
|
||||
regex: '#"',
|
||||
next: "regex"
|
||||
}, {
|
||||
token : "keyword", // ampersands
|
||||
regex : '[\\&]'
|
||||
token: "keyword", //sets and maps
|
||||
regex: "[\\{|\\}|\\#\\{|\\#\\}]"
|
||||
}, {
|
||||
token : "keyword", // metadata
|
||||
regex : '[\\#\\^\\{]'
|
||||
token: "keyword", // ampersands
|
||||
regex: '[\\&]'
|
||||
}, {
|
||||
token : "keyword", // anonymous fn syntactic sugar
|
||||
regex : '[\\%]'
|
||||
token: "keyword", // metadata
|
||||
regex: '[\\#\\^\\{]'
|
||||
}, {
|
||||
token : "keyword", // deref reader macro
|
||||
regex : '[@]'
|
||||
token: "keyword", // anonymous fn syntactic sugar
|
||||
regex: '[\\%]'
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
||||
token: "keyword", // deref reader macro
|
||||
regex: '[@]'
|
||||
}, {
|
||||
token : "constant.numeric", // float
|
||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||
token: "constant.numeric", // hex
|
||||
regex: "0[xX][0-9a-fA-F]+\\b"
|
||||
}, {
|
||||
token : "constant.language",
|
||||
regex : '[!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+||=|!=|<=|>=|<>|<|>|!|&&]'
|
||||
token: "constant.numeric", // float
|
||||
regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||
}, {
|
||||
token : keywordMapper,
|
||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$\\-]*\\b"
|
||||
token: "constant.language",
|
||||
regex: '[!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+||=|!=|<=|>=|<>|<|>|!|&&]'
|
||||
}, {
|
||||
token : "string", // single line
|
||||
regex : '"',
|
||||
token: keywordMapper,
|
||||
regex: "[a-zA-Z_$][a-zA-Z0-9_$\\-]*\\b"
|
||||
}, {
|
||||
token: "string", // single line
|
||||
regex: '"',
|
||||
next: "string"
|
||||
}, {
|
||||
token : "constant", // symbol
|
||||
regex : /:[^()\[\]{}'"\^%`,;\s]+/
|
||||
}, {
|
||||
token : "string.regexp", //Regular Expressions
|
||||
regex : '/#"(?:\\.|(?:\\")|[^""\n])*"/g'
|
||||
token: "constant", // symbol
|
||||
regex: /:[^()\[\]{}'"\^%`,;\s]+/
|
||||
}
|
||||
|
||||
],
|
||||
"string" : [
|
||||
"string": [
|
||||
{
|
||||
token : "constant.language.escape",
|
||||
regex : "\\\\.|\\\\$"
|
||||
token: "constant.language.escape",
|
||||
regex: "\\\\.|\\\\$"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '[^"\\\\]+'
|
||||
token: "string",
|
||||
regex: '"',
|
||||
next: "start"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
defaultToken: "string"
|
||||
}
|
||||
],
|
||||
"regex": [
|
||||
{
|
||||
token: "regexp.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "string.regexp",
|
||||
regex: '"',
|
||||
next: "start"
|
||||
}, {
|
||||
token: "constant.language.escape",
|
||||
regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
|
||||
}, {
|
||||
token: "constant.language.delimiter",
|
||||
regex: /\|/
|
||||
}, {
|
||||
token: "constant.language.escape",
|
||||
regex: /\[\^?/,
|
||||
next: "regex_character_class"
|
||||
}, {
|
||||
defaultToken: "string.regexp"
|
||||
}
|
||||
],
|
||||
"regex_character_class": [
|
||||
{
|
||||
token: "regexp.charclass.keyword.operator",
|
||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||
}, {
|
||||
token: "constant.language.escape",
|
||||
regex: "]",
|
||||
next: "regex"
|
||||
}, {
|
||||
token: "constant.language.escape",
|
||||
regex: "-"
|
||||
}, {
|
||||
defaultToken: "string.regexp.charachterclass"
|
||||
}
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
oop.inherits(ClojureHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.ClojureHighlightRules = ClojureHighlightRules;
|
||||
|
||||
});
|
||||
|
||||
define("ace/mode/matching_parens_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
define("ace/mode/matching_parens_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var MatchingParensOutdent = function() {};
|
||||
|
||||
(function() {
|
||||
|
||||
this.checkOutdent = function(line, input) {
|
||||
if (! /^\s+$/.test(line))
|
||||
var MatchingParensOutdent = function () { };
|
||||
(function () {
|
||||
this.checkOutdent = function (line, input) {
|
||||
if (!/^\s+$/.test(line))
|
||||
return false;
|
||||
|
||||
return /^\s*\)/.test(input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(doc, row) {
|
||||
this.autoOutdent = function (doc, row) {
|
||||
var line = doc.getLine(row);
|
||||
var match = line.match(/^(\s*\))/);
|
||||
|
||||
if (!match) return 0;
|
||||
|
||||
if (!match)
|
||||
return 0;
|
||||
var column = match[1].length;
|
||||
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||
|
||||
if (!openBracePos || openBracePos.row == row) return 0;
|
||||
|
||||
var openBracePos = doc.findMatchingBracket({ row: row, column: column });
|
||||
if (!openBracePos || openBracePos.row == row)
|
||||
return 0;
|
||||
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||
doc.replace(new Range(row, 0, row, column - 1), indent);
|
||||
};
|
||||
|
||||
this.$getIndent = function(line) {
|
||||
this.$getIndent = function (line) {
|
||||
var match = line.match(/^(\s+)/);
|
||||
if (match) {
|
||||
return match[1];
|
||||
}
|
||||
|
||||
return "";
|
||||
};
|
||||
|
||||
}).call(MatchingParensOutdent.prototype);
|
||||
|
||||
exports.MatchingParensOutdent = MatchingParensOutdent;
|
||||
|
||||
});
|
||||
|
||||
define("ace/mode/clojure",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/clojure_highlight_rules","ace/mode/matching_parens_outdent"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
define("ace/mode/clojure",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/clojure_highlight_rules","ace/mode/matching_parens_outdent"], function(require, exports, module){"use strict";
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var ClojureHighlightRules = require("./clojure_highlight_rules").ClojureHighlightRules;
|
||||
var MatchingParensOutdent = require("./matching_parens_outdent").MatchingParensOutdent;
|
||||
|
||||
var Mode = function() {
|
||||
var Mode = function () {
|
||||
this.HighlightRules = ClojureHighlightRules;
|
||||
this.$outdent = new MatchingParensOutdent();
|
||||
this.$behaviour = this.$defaultBehaviour;
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
|
||||
(function () {
|
||||
this.lineCommentStart = ";";
|
||||
this.minorIndentFunctions = ["defn", "defn-", "defmacro", "def", "deftest", "testing"];
|
||||
|
||||
this.$toIndent = function(str) {
|
||||
return str.split('').map(function(ch) {
|
||||
this.$toIndent = function (str) {
|
||||
return str.split('').map(function (ch) {
|
||||
if (/\s/.exec(ch)) {
|
||||
return ch;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return ' ';
|
||||
}
|
||||
}).join('');
|
||||
};
|
||||
|
||||
this.$calculateIndent = function(line, tab) {
|
||||
this.$calculateIndent = function (line, tab) {
|
||||
var baseIndent = this.$getIndent(line);
|
||||
var delta = 0;
|
||||
var isParen, ch;
|
||||
@ -250,10 +254,12 @@ oop.inherits(Mode, TextMode);
|
||||
if (ch === '(') {
|
||||
delta--;
|
||||
isParen = true;
|
||||
} else if (ch === '(' || ch === '[' || ch === '{') {
|
||||
}
|
||||
else if (ch === '(' || ch === '[' || ch === '{') {
|
||||
delta--;
|
||||
isParen = false;
|
||||
} else if (ch === ')' || ch === ']' || ch === '}') {
|
||||
}
|
||||
else if (ch === ')' || ch === ']' || ch === '}') {
|
||||
delta++;
|
||||
}
|
||||
if (delta < 0) {
|
||||
@ -267,41 +273,50 @@ oop.inherits(Mode, TextMode);
|
||||
while (true) {
|
||||
ch = line[i];
|
||||
if (ch === ' ' || ch === '\t') {
|
||||
if(this.minorIndentFunctions.indexOf(fn) !== -1) {
|
||||
if (this.minorIndentFunctions.indexOf(fn) !== -1) {
|
||||
return this.$toIndent(line.substring(0, iBefore - 1) + tab);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return this.$toIndent(line.substring(0, i + 1));
|
||||
}
|
||||
} else if (ch === undefined) {
|
||||
}
|
||||
else if (ch === undefined) {
|
||||
return this.$toIndent(line.substring(0, iBefore - 1) + tab);
|
||||
}
|
||||
fn += line[i];
|
||||
i++;
|
||||
}
|
||||
} else if(delta < 0 && !isParen) {
|
||||
return this.$toIndent(line.substring(0, i+1));
|
||||
} else if(delta > 0) {
|
||||
}
|
||||
else if (delta < 0 && !isParen) {
|
||||
return this.$toIndent(line.substring(0, i + 1));
|
||||
}
|
||||
else if (delta > 0) {
|
||||
baseIndent = baseIndent.substring(0, baseIndent.length - tab.length);
|
||||
return baseIndent;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return baseIndent;
|
||||
}
|
||||
};
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
this.getNextLineIndent = function (state, line, tab) {
|
||||
return this.$calculateIndent(line, tab);
|
||||
};
|
||||
|
||||
this.checkOutdent = function(state, line, input) {
|
||||
this.checkOutdent = function (state, line, input) {
|
||||
return this.$outdent.checkOutdent(line, input);
|
||||
};
|
||||
|
||||
this.autoOutdent = function(state, doc, row) {
|
||||
this.autoOutdent = function (state, doc, row) {
|
||||
this.$outdent.autoOutdent(doc, row);
|
||||
};
|
||||
|
||||
this.$id = "ace/mode/clojure";
|
||||
this.snippetFileId = "ace/snippets/clojure";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
|
||||
}); (function() {
|
||||
window.require(["ace/mode/clojure"], function(m) {
|
||||
if (typeof module == "object" && typeof exports == "object" && module) {
|
||||
module.exports = m;
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
Reference in New Issue
Block a user