Debian Codegraph @

extensions/CodeEditor/modules/lib/ace/mode-redshift.js

raw symbols SCIP
1 ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
2 var oop = require("../lib/oop");
3 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
4 var DocCommentHighlightRules = function () {
5 this.$rules = {
6 "start": [
7 {
8 token: "comment.doc.tag",
9 regex: "@\\w+(?=\\s|$)"
10 }, DocCommentHighlightRules.getTagRule(), {
11 defaultToken: "comment.doc",
12 caseInsensitive: true
13 }
14 ]
15 };
16 };
17 oop.inherits(DocCommentHighlightRules, TextHighlightRules);
18 DocCommentHighlightRules.getTagRule = function (start) {
19 return {
20 token: "comment.doc.tag.storage.type",
21 regex: "\\b(?:TODO|FIXME|XXX|HACK)\\b"
22 };
23 };
24 DocCommentHighlightRules.getStartRule = function (start) {
25 return {
26 token: "comment.doc", // doc comment
27 regex: "\\/\\*(?=\\*)",
28 next: start
29 };
30 };
31 DocCommentHighlightRules.getEndRule = function (start) {
32 return {
33 token: "comment.doc", // closing comment
34 regex: "\\*\\/",
35 next: start
36 };
37 };
38 exports.DocCommentHighlightRules = DocCommentHighlightRules;
39
40 });
41
42 ace.define("ace/mode/json_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
43 var oop = require("../lib/oop");
44 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
45 var JsonHighlightRules = function () {
46 this.$rules = {
47 "start": [
48 {
49 token: "variable", // single line
50 regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'
51 }, {
52 token: "string", // single line
53 regex: '"',
54 next: "string"
55 }, {
56 token: "constant.numeric", // hex
57 regex: "0[xX][0-9a-fA-F]+\\b"
58 }, {
59 token: "constant.numeric", // float
60 regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
61 }, {
62 token: "constant.language.boolean",
63 regex: "(?:true|false)\\b"
64 }, {
65 token: "text", // single quoted strings are not allowed
66 regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
67 }, {
68 token: "comment", // comments are not allowed, but who cares?
69 regex: "\\/\\/.*$"
70 }, {
71 token: "comment.start", // comments are not allowed, but who cares?
72 regex: "\\/\\*",
73 next: "comment"
74 }, {
75 token: "paren.lparen",
76 regex: "[[({]"
77 }, {
78 token: "paren.rparen",
79 regex: "[\\])}]"
80 }, {
81 token: "punctuation.operator",
82 regex: /[,]/
83 }, {
84 token: "text",
85 regex: "\\s+"
86 }
87 ],
88 "string": [
89 {
90 token: "constant.language.escape",
91 regex: /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/
92 }, {
93 token: "string",
94 regex: '"|$',
95 next: "start"
96 }, {
97 defaultToken: "string"
98 }
99 ],
100 "comment": [
101 {
102 token: "comment.end", // comments are not allowed, but who cares?
103 regex: "\\*\\/",
104 next: "start"
105 }, {
106 defaultToken: "comment"
107 }
108 ]
109 };
110 };
111 oop.inherits(JsonHighlightRules, TextHighlightRules);
112 exports.JsonHighlightRules = JsonHighlightRules;
113
114 });
115
116 ace.define("ace/mode/redshift_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules","ace/mode/json_highlight_rules"], function(require, exports, module){var oop = require("../lib/oop");
117 var lang = require("../lib/lang");
118 var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
119 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
120 var JsonHighlightRules = require("./json_highlight_rules").JsonHighlightRules;
121 var RedshiftHighlightRules = function () {
122 var keywords = ("aes128|aes256|all|allowoverwrite|analyse|analyze|and|any|array|as|asc|authorization|backup|" +
123 "between|binary|blanksasnull|both|bytedict|bzip2|case|cast|check|collate|column|constraint|create|credentials|" +
124 "cross|current_date|current_time|current_timestamp|current_user|current_user_id|default|deferrable|deflate|defrag|delta|" +
125 "delta32k|desc|disable|distinct|do|else|emptyasnull|enable|encode|encrypt|encryption|end|except|explicit|false|for|foreign|" +
126 "freeze|from|full|globaldict256|globaldict64k|grant|group|gzip|having|identity|ignore|ilike|in|initially|inner|intersect|into|is|" +
127 "isnull|join|leading|left|like|limit|localtime|localtimestamp|lun|luns|lzo|lzop|minus|mostly13|mostly32|mostly8|natural|new|not|notnull|" +
128 "null|nulls|off|offline|offset|old|on|only|open|or|order|outer|overlaps|parallel|partition|percent|permissions|placing|primary|raw|readratio|" +
129 "recover|references|rejectlog|resort|restore|right|select|session_user|similar|some|sysdate|system|table|tag|tdes|text255|text32k|then|timestamp|" +
130 "to|top|trailing|true|truncatecolumns|union|unique|user|using|verbose|wallet|when|where|with|without");
131 var builtinFunctions = ("current_schema|current_schemas|has_database_privilege|has_schema_privilege|has_table_privilege|age|current_time|current_timestamp|localtime|" +
132 "isfinite|now|ascii|get_bit|get_byte|octet_length|set_bit|set_byte|to_ascii|avg|count|listagg|max|min|stddev_samp|stddev_pop|sum|var_samp|var_pop|" +
133 "bit_and|bit_or|bool_and|bool_or|avg|count|cume_dist|dense_rank|first_value|last_value|lag|lead|listagg|max|median|min|nth_value|ntile|percent_rank|" +
134 "percentile_cont|percentile_disc|rank|ratio_to_report|row_number|case|coalesce|decode|greatest|least|nvl|nvl2|nullif|add_months|age|convert_timezone|" +
135 "current_date|timeofday|current_time|current_timestamp|date_cmp|date_cmp_timestamp|date_part_year|dateadd|datediff|date_part|date_trunc|extract|getdate|" +
136 "interval_cmp|isfinite|last_day|localtime|localtimestamp|months_between|next_day|now|sysdate|timestamp_cmp|timestamp_cmp_date|trunc|abs|acos|asin|atan|" +
137 "atan2|cbrt|ceiling|ceil|checksum|cos|cot|degrees|dexp|dlog1|dlog10|exp|floor|ln|log|mod|pi|power|radians|random|round|sin|sign|sqrt|tan|trunc|ascii|" +
138 "bpcharcmp|btrim|bttext_pattern_cmp|char_length|character_length|charindex|chr|concat|crc32|func_sha1|get_bit|get_byte|initcap|left|right|len|length|" +
139 "lower|lpad|rpad|ltrim|md5|octet_length|position|quote_ident|quote_literal|regexp_count|regexp_instr|regexp_replace|regexp_substr|repeat|replace|replicate|" +
140 "reverse|rtrim|set_bit|set_byte|split_part|strpos|strtol|substring|textlen|to_ascii|to_hex|translate|trim|upper|json_array_length|json_extract_array_element_text|" +
141 "json_extract_path_text|cast|convert|to_char|to_date|to_number|current_database|current_schema|current_schemas|current_user|current_user_id|has_database_privilege|" +
142 "has_schema_privilege|has_table_privilege|pg_backend_pid|pg_last_copy_count|pg_last_copy_id|pg_last_query_id|pg_last_unload_count|session_user|slice_num|user|version");
143 var keywordMapper = this.createKeywordMapper({
144 "support.function": builtinFunctions,
145 "keyword": keywords
146 }, "identifier", true);
147 var sqlRules = [{
148 token: "string", // single line string -- assume dollar strings if multi-line for now
149 regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
150 }, {
151 token: "variable.language", // pg identifier
152 regex: '".*?"'
153 }, {
154 token: "constant.numeric", // float
155 regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
156 }, {
157 token: keywordMapper,
158 regex: "[a-zA-Z_][a-zA-Z0-9_$]*\\b" // TODO - Unicode in identifiers
159 }, {
160 token: "keyword.operator",
161 regex: "!|!!|!~|!~\\*|!~~|!~~\\*|#|##|#<|#<=|#<>|#=|#>|#>=|%|\\&|\\&\\&|\\&<|\\&<\\||\\&>|\\*|\\+|" +
162 "\\-|/|<|<#>|<\\->|<<|<<=|<<\\||<=|<>|<\\?>|<@|<\\^|=|>|>=|>>|>>=|>\\^|\\?#|\\?\\-|\\?\\-\\||" +
163 "\\?\\||\\?\\|\\||@|@\\-@|@>|@@|@@@|\\^|\\||\\|\\&>|\\|/|\\|>>|\\|\\||\\|\\|/|~|~\\*|~<=~|~<~|" +
164 "~=|~>=~|~>~|~~|~~\\*"
165 }, {
166 token: "paren.lparen",
167 regex: "[\\(]"
168 }, {
169 token: "paren.rparen",
170 regex: "[\\)]"
171 }, {
172 token: "text",
173 regex: "\\s+"
174 }
175 ];
176 this.$rules = {
177 "start": [{
178 token: "comment",
179 regex: "--.*$"
180 },
181 DocCommentHighlightRules.getStartRule("doc-start"),
182 {
183 token: "comment", // multi-line comment
184 regex: "\\/\\*",
185 next: "comment"
186 }, {
187 token: "keyword.statementBegin",
188 regex: "^[a-zA-Z]+", // Could enumerate starting keywords but this allows things to work when new statements are added.
189 next: "statement"
190 }, {
191 token: "support.buildin", // psql directive
192 regex: "^\\\\[\\S]+.*$"
193 }
194 ],
195 "statement": [{
196 token: "comment",
197 regex: "--.*$"
198 }, {
199 token: "comment", // multi-line comment
200 regex: "\\/\\*",
201 next: "commentStatement"
202 }, {
203 token: "statementEnd",
204 regex: ";",
205 next: "start"
206 }, {
207 token: "string",
208 regex: "\\$json\\$",
209 next: "json-start"
210 }, {
211 token: "string",
212 regex: "\\$[\\w_0-9]*\\$$", // dollar quote at the end of a line
213 next: "dollarSql"
214 }, {
215 token: "string",
216 regex: "\\$[\\w_0-9]*\\$",
217 next: "dollarStatementString"
218 }
219 ].concat(sqlRules),
220 "dollarSql": [{
221 token: "comment",
222 regex: "--.*$"
223 }, {
224 token: "comment", // multi-line comment
225 regex: "\\/\\*",
226 next: "commentDollarSql"
227 }, {
228 token: "string", // end quoting with dollar at the start of a line
229 regex: "^\\$[\\w_0-9]*\\$",
230 next: "statement"
231 }, {
232 token: "string",
233 regex: "\\$[\\w_0-9]*\\$",
234 next: "dollarSqlString"
235 }
236 ].concat(sqlRules),
237 "comment": [{
238 token: "comment", // closing comment
239 regex: ".*?\\*\\/",
240 next: "start"
241 }, {
242 token: "comment", // comment spanning whole line
243 regex: ".+"
244 }
245 ],
246 "commentStatement": [{
247 token: "comment", // closing comment
248 regex: ".*?\\*\\/",
249 next: "statement"
250 }, {
251 token: "comment", // comment spanning whole line
252 regex: ".+"
253 }
254 ],
255 "commentDollarSql": [{
256 token: "comment", // closing comment
257 regex: ".*?\\*\\/",
258 next: "dollarSql"
259 }, {
260 token: "comment", // comment spanning whole line
261 regex: ".+"
262 }
263 ],
264 "dollarStatementString": [{
265 token: "string", // closing dollarstring
266 regex: ".*?\\$[\\w_0-9]*\\$",
267 next: "statement"
268 }, {
269 token: "string", // dollarstring spanning whole line
270 regex: ".+"
271 }
272 ],
273 "dollarSqlString": [{
274 token: "string", // closing dollarstring
275 regex: ".*?\\$[\\w_0-9]*\\$",
276 next: "dollarSql"
277 }, {
278 token: "string", // dollarstring spanning whole line
279 regex: ".+"
280 }
281 ]
282 };
283 this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("start")]);
284 this.embedRules(JsonHighlightRules, "json-", [{ token: "string", regex: "\\$json\\$", next: "statement" }]);
285 };
286 oop.inherits(RedshiftHighlightRules, TextHighlightRules);
287 exports.RedshiftHighlightRules = RedshiftHighlightRules;
288
289 });
290
291 ace.define("ace/mode/redshift",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/redshift_highlight_rules"], function(require, exports, module){var oop = require("../lib/oop");
292 var TextMode = require("../mode/text").Mode;
293 var RedshiftHighlightRules = require("./redshift_highlight_rules").RedshiftHighlightRules;
294 var Mode = function () {
295 this.HighlightRules = RedshiftHighlightRules;
296 this.$behaviour = this.$defaultBehaviour;
297 };
298 oop.inherits(Mode, TextMode);
299 (function () {
300 this.lineCommentStart = "--";
301 this.blockComment = { start: "/*", end: "*/" };
302 this.getNextLineIndent = function (state, line, tab) {
303 if (state == "start" || state == "keyword.statementEnd") {
304 return "";
305 }
306 else {
307 return this.$getIndent(line); // Keep whatever indent the previous line has
308 }
309 };
310 this.$id = "ace/mode/redshift";
311 }).call(Mode.prototype);
312 exports.Mode = Mode;
313
314 }); (function() {
315 ace.require(["ace/mode/redshift"], function(m) {
316 if (typeof module == "object" && typeof exports == "object" && module) {
317 module.exports = m;
318 }
319 });
320 })();
321