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

committed by
Sebastian Serth

parent
0a473c7fd3
commit
b00d45521b
206
vendor/assets/javascripts/ace/mode-ocaml.js
vendored
206
vendor/assets/javascripts/ace/mode-ocaml.js
vendored
@ -1,23 +1,14 @@
|
||||
define("ace/mode/ocaml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
define("ace/mode/ocaml_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 OcamlHighlightRules = function() {
|
||||
|
||||
var keywords = (
|
||||
"and|as|assert|begin|class|constraint|do|done|downto|else|end|" +
|
||||
"exception|external|for|fun|function|functor|if|in|include|" +
|
||||
"inherit|initializer|lazy|let|match|method|module|mutable|new|" +
|
||||
var OcamlHighlightRules = function () {
|
||||
var keywords = ("and|as|assert|begin|class|constraint|do|done|downto|else|end|" +
|
||||
"exception|external|for|fun|function|functor|if|in|include|" +
|
||||
"inherit|initializer|lazy|let|match|method|module|mutable|new|" +
|
||||
"object|of|open|or|private|rec|sig|struct|then|to|try|type|val|" +
|
||||
"virtual|when|while|with"
|
||||
);
|
||||
|
||||
"virtual|when|while|with");
|
||||
var builtinConstants = ("true|false");
|
||||
|
||||
var builtinFunctions = (
|
||||
"abs|abs_big_int|abs_float|abs_num|abstract_tag|accept|access|acos|add|" +
|
||||
var builtinFunctions = ("abs|abs_big_int|abs_float|abs_num|abstract_tag|accept|access|acos|add|" +
|
||||
"add_available_units|add_big_int|add_buffer|add_channel|add_char|" +
|
||||
"add_initializer|add_int_big_int|add_interfaces|add_num|add_string|" +
|
||||
"add_substitute|add_substring|alarm|allocated_bytes|allow_only|" +
|
||||
@ -189,226 +180,199 @@ var OcamlHighlightRules = function() {
|
||||
"wait|wait|wait|wait_next_event|wait_pid|wait_read|wait_signal|" +
|
||||
"wait_timed_read|wait_timed_write|wait_write|waitpid|white|" +
|
||||
"widen|window_id|word_size|wrap|wrap_abort|write|yellow|yield|zero|zero_big_int|" +
|
||||
|
||||
"Arg|Arith_status|Array|Array1|Array2|Array3|ArrayLabels|Big_int|Bigarray|" +
|
||||
"Buffer|Callback|CamlinternalOO|Char|Complex|Condition|Dbm|Digest|Dynlink|" +
|
||||
"Event|Filename|Format|Gc|Genarray|Genlex|Graphics|GraphicsX11|Hashtbl|" +
|
||||
"Int32|Int64|LargeFile|Lazy|Lexing|List|ListLabels|Make|Map|Marshal|" +
|
||||
"MoreLabels|Mutex|Nativeint|Num|Obj|Oo|Parsing|Pervasives|Printexc|" +
|
||||
"Printf|Queue|Random|Scanf|Scanning|Set|Sort|Stack|State|StdLabels|Str|" +
|
||||
"Stream|String|StringLabels|Sys|Thread|ThreadUnix|Tk|Unix|UnixLabels|Weak"
|
||||
);
|
||||
|
||||
"Stream|String|StringLabels|Sys|Thread|ThreadUnix|Tk|Unix|UnixLabels|Weak");
|
||||
var keywordMapper = this.createKeywordMapper({
|
||||
"variable.language": "this",
|
||||
"keyword": keywords,
|
||||
"constant.language": builtinConstants,
|
||||
"support.function": builtinFunctions
|
||||
}, "identifier");
|
||||
|
||||
var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
|
||||
var octInteger = "(?:0[oO]?[0-7]+)";
|
||||
var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
|
||||
var binInteger = "(?:0[bB][01]+)";
|
||||
var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
|
||||
|
||||
var exponent = "(?:[eE][+-]?\\d+)";
|
||||
var fraction = "(?:\\.\\d+)";
|
||||
var intPart = "(?:\\d+)";
|
||||
var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
|
||||
var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")";
|
||||
var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")";
|
||||
var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
|
||||
|
||||
this.$rules = {
|
||||
"start" : [
|
||||
"start": [
|
||||
{
|
||||
token : "comment",
|
||||
regex : '\\(\\*.*?\\*\\)\\s*?$'
|
||||
token: "comment",
|
||||
regex: '\\(\\*.*?\\*\\)\\s*?$'
|
||||
},
|
||||
{
|
||||
token : "comment",
|
||||
regex : '\\(\\*.*',
|
||||
next : "comment"
|
||||
token: "comment",
|
||||
regex: '\\(\\*.*',
|
||||
next: "comment"
|
||||
},
|
||||
{
|
||||
token : "string", // single line
|
||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||
token: "string", // single line
|
||||
regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||
},
|
||||
{
|
||||
token : "string", // single char
|
||||
regex : "'.'"
|
||||
token: "string", // single char
|
||||
regex: "'.'"
|
||||
},
|
||||
{
|
||||
token : "string", // " string
|
||||
regex : '"',
|
||||
next : "qstring"
|
||||
token: "string", // " string
|
||||
regex: '"',
|
||||
next: "qstring"
|
||||
},
|
||||
{
|
||||
token : "constant.numeric", // imaginary
|
||||
regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
|
||||
token: "constant.numeric", // imaginary
|
||||
regex: "(?:" + floatNumber + "|\\d+)[jJ]\\b"
|
||||
},
|
||||
{
|
||||
token : "constant.numeric", // float
|
||||
regex : floatNumber
|
||||
token: "constant.numeric", // float
|
||||
regex: floatNumber
|
||||
},
|
||||
{
|
||||
token : "constant.numeric", // integer
|
||||
regex : integer + "\\b"
|
||||
token: "constant.numeric", // integer
|
||||
regex: integer + "\\b"
|
||||
},
|
||||
{
|
||||
token : keywordMapper,
|
||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
token: keywordMapper,
|
||||
regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
},
|
||||
{
|
||||
token : "keyword.operator",
|
||||
regex : "\\+\\.|\\-\\.|\\*\\.|\\/\\.|#|;;|\\+|\\-|\\*|\\*\\*\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|<-|="
|
||||
token: "keyword.operator",
|
||||
regex: "\\+\\.|\\-\\.|\\*\\.|\\/\\.|#|;;|\\+|\\-|\\*|\\*\\*\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|<-|="
|
||||
},
|
||||
{
|
||||
token : "paren.lparen",
|
||||
regex : "[[({]"
|
||||
token: "paren.lparen",
|
||||
regex: "[[({]"
|
||||
},
|
||||
{
|
||||
token : "paren.rparen",
|
||||
regex : "[\\])}]"
|
||||
token: "paren.rparen",
|
||||
regex: "[\\])}]"
|
||||
},
|
||||
{
|
||||
token : "text",
|
||||
regex : "\\s+"
|
||||
token: "text",
|
||||
regex: "\\s+"
|
||||
}
|
||||
],
|
||||
"comment" : [
|
||||
"comment": [
|
||||
{
|
||||
token : "comment", // closing comment
|
||||
regex : "\\*\\)",
|
||||
next : "start"
|
||||
token: "comment", // closing comment
|
||||
regex: "\\*\\)",
|
||||
next: "start"
|
||||
},
|
||||
{
|
||||
defaultToken : "comment"
|
||||
defaultToken: "comment"
|
||||
}
|
||||
],
|
||||
|
||||
"qstring" : [
|
||||
"qstring": [
|
||||
{
|
||||
token : "string",
|
||||
regex : '"',
|
||||
next : "start"
|
||||
token: "string",
|
||||
regex: '"',
|
||||
next: "start"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : '.+'
|
||||
token: "string",
|
||||
regex: '.+'
|
||||
}
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
oop.inherits(OcamlHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.OcamlHighlightRules = OcamlHighlightRules;
|
||||
|
||||
});
|
||||
|
||||
define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var MatchingBraceOutdent = function() {};
|
||||
|
||||
(function() {
|
||||
|
||||
this.checkOutdent = function(line, input) {
|
||||
if (! /^\s+$/.test(line))
|
||||
var MatchingBraceOutdent = 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) {
|
||||
return line.match(/^\s*/)[0];
|
||||
};
|
||||
|
||||
}).call(MatchingBraceOutdent.prototype);
|
||||
|
||||
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||
|
||||
});
|
||||
|
||||
define("ace/mode/ocaml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ocaml_highlight_rules","ace/mode/matching_brace_outdent","ace/range"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
define("ace/mode/ocaml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ocaml_highlight_rules","ace/mode/matching_brace_outdent","ace/range"], function(require, exports, module){"use strict";
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var OcamlHighlightRules = require("./ocaml_highlight_rules").OcamlHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var Mode = function() {
|
||||
var Mode = function () {
|
||||
this.HighlightRules = OcamlHighlightRules;
|
||||
this.$behaviour = this.$defaultBehaviour;
|
||||
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
var indenter = /(?:[({[=:]|[-=]>|\b(?:else|try|with))\s*$/;
|
||||
|
||||
(function() {
|
||||
|
||||
this.toggleCommentLines = function(state, doc, startRow, endRow) {
|
||||
(function () {
|
||||
this.toggleCommentLines = function (state, doc, startRow, endRow) {
|
||||
var i, line;
|
||||
var outdent = true;
|
||||
var re = /^\s*\(\*(.*)\*\)/;
|
||||
|
||||
for (i=startRow; i<= endRow; i++) {
|
||||
for (i = startRow; i <= endRow; i++) {
|
||||
if (!re.test(doc.getLine(i))) {
|
||||
outdent = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var range = new Range(0, 0, 0, 0);
|
||||
for (i=startRow; i<= endRow; i++) {
|
||||
for (i = startRow; i <= endRow; i++) {
|
||||
line = doc.getLine(i);
|
||||
range.start.row = i;
|
||||
range.end.row = i;
|
||||
range.start.row = i;
|
||||
range.end.row = i;
|
||||
range.end.column = line.length;
|
||||
|
||||
doc.replace(range, outdent ? line.match(re)[1] : "(*" + line + "*)");
|
||||
}
|
||||
};
|
||||
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
this.getNextLineIndent = function (state, line, tab) {
|
||||
var indent = this.$getIndent(line);
|
||||
var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
|
||||
|
||||
if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
|
||||
state === 'start' && indenter.test(line))
|
||||
indent += tab;
|
||||
return indent;
|
||||
};
|
||||
|
||||
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/ocaml";
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
|
||||
}); (function() {
|
||||
window.require(["ace/mode/ocaml"], function(m) {
|
||||
if (typeof module == "object" && typeof exports == "object" && module) {
|
||||
module.exports = m;
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
Reference in New Issue
Block a user