accd1391b6d74a4f4ef8b1ca97d4c57f.js 13 KB

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