1
+ return [==[
2
+ define("ace/mode/sql_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
3
+ var oop = require("../lib/oop");
4
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
5
+ var SqlHighlightRules = function () {
6
+ var keywords = ("select|insert|update|delete|from|where|and|or|group|by|order|limit|offset|having|as|case|" +
7
+ "when|then|else|end|type|left|right|join|on|outer|desc|asc|union|create|table|primary|key|if|" +
8
+ "foreign|not|references|default|null|inner|cross|natural|database|drop|grant|distinct|is|in|" +
9
+ "all|alter|any|array|at|authorization|between|both|cast|check|collate|column|commit|constraint|" +
10
+ "cube|current|current_date|current_time|current_timestamp|current_user|describe|escape|except|" +
11
+ "exists|external|extract|fetch|filter|for|full|function|global|grouping|intersect|interval|" +
12
+ "into|leading|like|local|no|of|only|out|overlaps|partition|position|range|revoke|rollback|rollup|" +
13
+ "row|rows|session_user|set|some|start|tablesample|time|to|trailing|truncate|unique|unknown|" +
14
+ "user|using|values|window|with");
15
+ var builtinConstants = ("true|false");
16
+ var builtinFunctions = ("avg|count|first|last|max|min|sum|ucase|lcase|mid|len|round|rank|now|format|" +
17
+ "coalesce|ifnull|isnull|nvl");
18
+ var dataTypes = ("int|numeric|decimal|date|varchar|char|bigint|float|double|bit|binary|text|set|timestamp|" +
19
+ "money|real|number|integer|string");
20
+ var keywordMapper = this.createKeywordMapper({
21
+ "support.function": builtinFunctions,
22
+ "keyword": keywords,
23
+ "constant.language": builtinConstants,
24
+ "storage.type": dataTypes
25
+ }, "identifier", true);
26
+ this.$rules = {
27
+ "start": [{
28
+ token: "comment",
29
+ regex: "--.*$"
30
+ }, {
31
+ token: "comment",
32
+ start: "/\\*",
33
+ end: "\\*/"
34
+ }, {
35
+ token: "string", // " string
36
+ regex: '".*?"'
37
+ }, {
38
+ token: "string", // ' string
39
+ regex: "'.*?'"
40
+ }, {
41
+ token: "string", // ` string (apache drill)
42
+ regex: "`.*?`"
43
+ }, {
44
+ token: "constant.numeric", // float
45
+ regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
46
+ }, {
47
+ token: keywordMapper,
48
+ regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
49
+ }, {
50
+ token: "keyword.operator",
51
+ regex: "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
52
+ }, {
53
+ token: "paren.lparen",
54
+ regex: "[\\(]"
55
+ }, {
56
+ token: "paren.rparen",
57
+ regex: "[\\)]"
58
+ }, {
59
+ token: "text",
60
+ regex: "\\s+"
61
+ }]
62
+ };
63
+ this.normalizeRules();
64
+ };
65
+ oop.inherits(SqlHighlightRules, TextHighlightRules);
66
+ exports.SqlHighlightRules = SqlHighlightRules;
67
+
68
+ });
69
+
70
+ define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
71
+ var oop = require("../../lib/oop");
72
+ var Range = require("../../range").Range;
73
+ var BaseFoldMode = require("./fold_mode").FoldMode;
74
+ var FoldMode = exports.FoldMode = function (commentRegex) {
75
+ if (commentRegex) {
76
+ this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
77
+ this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
78
+ }
79
+ };
80
+ oop.inherits(FoldMode, BaseFoldMode);
81
+ (function () {
82
+ this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
83
+ this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
84
+ this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
85
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
86
+ this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
87
+ this._getFoldWidgetBase = this.getFoldWidget;
88
+ this.getFoldWidget = function (session, foldStyle, row) {
89
+ var line = session.getLine(row);
90
+ if (this.singleLineBlockCommentRe.test(line)) {
91
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
92
+ return "";
93
+ }
94
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
95
+ if (!fw && this.startRegionRe.test(line))
96
+ return "start"; // lineCommentRegionStart
97
+ return fw;
98
+ };
99
+ this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
100
+ var line = session.getLine(row);
101
+ if (this.startRegionRe.test(line))
102
+ return this.getCommentRegionBlock(session, line, row);
103
+ var match = line.match(this.foldingStartMarker);
104
+ if (match) {
105
+ var i = match.index;
106
+ if (match[1])
107
+ return this.openingBracketBlock(session, match[1], row, i);
108
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
109
+ if (range && !range.isMultiLine()) {
110
+ if (forceMultiline) {
111
+ range = this.getSectionRange(session, row);
112
+ }
113
+ else if (foldStyle != "all")
114
+ range = null;
115
+ }
116
+ return range;
117
+ }
118
+ if (foldStyle === "markbegin")
119
+ return;
120
+ var match = line.match(this.foldingStopMarker);
121
+ if (match) {
122
+ var i = match.index + match[0].length;
123
+ if (match[1])
124
+ return this.closingBracketBlock(session, match[1], row, i);
125
+ return session.getCommentFoldRange(row, i, -1);
126
+ }
127
+ };
128
+ this.getSectionRange = function (session, row) {
129
+ var line = session.getLine(row);
130
+ var startIndent = line.search(/\S/);
131
+ var startRow = row;
132
+ var startColumn = line.length;
133
+ row = row + 1;
134
+ var endRow = row;
135
+ var maxRow = session.getLength();
136
+ while (++row < maxRow) {
137
+ line = session.getLine(row);
138
+ var indent = line.search(/\S/);
139
+ if (indent === -1)
140
+ continue;
141
+ if (startIndent > indent)
142
+ break;
143
+ var subRange = this.getFoldWidgetRange(session, "all", row);
144
+ if (subRange) {
145
+ if (subRange.start.row <= startRow) {
146
+ break;
147
+ }
148
+ else if (subRange.isMultiLine()) {
149
+ row = subRange.end.row;
150
+ }
151
+ else if (startIndent == indent) {
152
+ break;
153
+ }
154
+ }
155
+ endRow = row;
156
+ }
157
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
158
+ };
159
+ this.getCommentRegionBlock = function (session, line, row) {
160
+ var startColumn = line.search(/\s*$/);
161
+ var maxRow = session.getLength();
162
+ var startRow = row;
163
+ var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
164
+ var depth = 1;
165
+ while (++row < maxRow) {
166
+ line = session.getLine(row);
167
+ var m = re.exec(line);
168
+ if (!m)
169
+ continue;
170
+ if (m[1])
171
+ depth--;
172
+ else
173
+ depth++;
174
+ if (!depth)
175
+ break;
176
+ }
177
+ var endRow = row;
178
+ if (endRow > startRow) {
179
+ return new Range(startRow, startColumn, endRow, line.length);
180
+ }
181
+ };
182
+ }).call(FoldMode.prototype);
183
+
184
+ });
185
+
186
+ define("ace/mode/folding/sql",["require","exports","module","ace/lib/oop","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
187
+ var oop = require("../../lib/oop");
188
+ var BaseFoldMode = require("./cstyle").FoldMode;
189
+ var FoldMode = exports.FoldMode = function () { };
190
+ oop.inherits(FoldMode, BaseFoldMode);
191
+ (function () {
192
+ }).call(FoldMode.prototype);
193
+
194
+ });
195
+
196
+ define("ace/mode/sql",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/sql_highlight_rules","ace/mode/folding/sql"], function(require, exports, module){"use strict";
197
+ var oop = require("../lib/oop");
198
+ var TextMode = require("./text").Mode;
199
+ var SqlHighlightRules = require("./sql_highlight_rules").SqlHighlightRules;
200
+ var SqlFoldMode = require("./folding/sql").FoldMode;
201
+ var Mode = function () {
202
+ this.HighlightRules = SqlHighlightRules;
203
+ this.foldingRules = new SqlFoldMode();
204
+ this.$behaviour = this.$defaultBehaviour;
205
+ };
206
+ oop.inherits(Mode, TextMode);
207
+ (function () {
208
+ this.lineCommentStart = "--";
209
+ this.blockComment = { start: "/*", end: "*/" };
210
+ this.$id = "ace/mode/sql";
211
+ this.snippetFileId = "ace/snippets/sql";
212
+ }).call(Mode.prototype);
213
+ exports.Mode = Mode;
214
+
215
+ }); (function() {
216
+ window.require(["ace/mode/sql"], function(m) {
217
+ if (typeof module == "object" && typeof exports == "object" && module) {
218
+ module.exports = m;
219
+ }
220
+ });
221
+ })();
222
+
223
+ ]==]
0 commit comments