mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeEditor
synced 2024-11-15 11:30:52 +00:00
7254cda535
Updated to
6b88b939c2
Includes fixes for drag delay (bug 60432)
and chrome useragent detection: Github issue
https://github.com/ajaxorg/ace/issues/1950
Bug: T62432
Change-Id: I5ac67a812f09ac43e73475613afc9a3f1ddc9a75
93 lines
2.5 KiB
JavaScript
93 lines
2.5 KiB
JavaScript
define("ace/mode/sql_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 SqlHighlightRules = function() {
|
|
|
|
var keywords = (
|
|
"select|insert|update|delete|from|where|and|or|group|by|order|limit|offset|having|as|case|" +
|
|
"when|else|end|type|left|right|join|on|outer|desc|asc|union"
|
|
);
|
|
|
|
var builtinConstants = (
|
|
"true|false|null"
|
|
);
|
|
|
|
var builtinFunctions = (
|
|
"count|min|max|avg|sum|rank|now|coalesce"
|
|
);
|
|
|
|
var keywordMapper = this.createKeywordMapper({
|
|
"support.function": builtinFunctions,
|
|
"keyword": keywords,
|
|
"constant.language": builtinConstants
|
|
}, "identifier", true);
|
|
|
|
this.$rules = {
|
|
"start" : [ {
|
|
token : "comment",
|
|
regex : "--.*$"
|
|
}, {
|
|
token : "comment",
|
|
start : "/\\*",
|
|
end : "\\*/"
|
|
}, {
|
|
token : "string", // " string
|
|
regex : '".*?"'
|
|
}, {
|
|
token : "string", // ' string
|
|
regex : "'.*?'"
|
|
}, {
|
|
token : "constant.numeric", // float
|
|
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
|
}, {
|
|
token : keywordMapper,
|
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
|
}, {
|
|
token : "keyword.operator",
|
|
regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
|
|
}, {
|
|
token : "paren.lparen",
|
|
regex : "[\\(]"
|
|
}, {
|
|
token : "paren.rparen",
|
|
regex : "[\\)]"
|
|
}, {
|
|
token : "text",
|
|
regex : "\\s+"
|
|
} ]
|
|
};
|
|
this.normalizeRules();
|
|
};
|
|
|
|
oop.inherits(SqlHighlightRules, TextHighlightRules);
|
|
|
|
exports.SqlHighlightRules = SqlHighlightRules;
|
|
});
|
|
|
|
define("ace/mode/sql",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/sql_highlight_rules","ace/range"], function(require, exports, module) {
|
|
"use strict";
|
|
|
|
var oop = require("../lib/oop");
|
|
var TextMode = require("./text").Mode;
|
|
var SqlHighlightRules = require("./sql_highlight_rules").SqlHighlightRules;
|
|
var Range = require("../range").Range;
|
|
|
|
var Mode = function() {
|
|
this.HighlightRules = SqlHighlightRules;
|
|
};
|
|
oop.inherits(Mode, TextMode);
|
|
|
|
(function() {
|
|
|
|
this.lineCommentStart = "--";
|
|
|
|
this.$id = "ace/mode/sql";
|
|
}).call(Mode.prototype);
|
|
|
|
exports.Mode = Mode;
|
|
|
|
});
|