e8b30aff1e922139ce1feffb337fdf58.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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.body",
  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. ace.define("ace/mode/mysql_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module){var oop = require("../lib/oop");
  41. var lang = require("../lib/lang");
  42. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  43. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  44. var MysqlHighlightRules = function () {
  45. var mySqlKeywords = /*sql*/ "alter|and|as|asc|between|count|create|delete|desc|distinct|drop|from|lateral|having|in|insert|into|is|join|like|not|on|or|order|select|set|table|union|intersect|except|update|values|where" + "|accessible|action|add|after|algorithm|all|analyze|asensitive|at|authors|auto_increment|autocommit|avg|avg_row_length|before|binary|binlog|both|btree|cache|call|cascade|cascaded|case|catalog_name|chain|change|changed|character|check|checkpoint|checksum|class_origin|client_statistics|close|code|collate|collation|collations|column|columns|comment|commit|committed|completion|concurrent|condition|connection|consistent|constraint|contains|continue|contributors|convert|cross|current_date|current_time|current_timestamp|current_user|cursor|data|database|databases|day_hour|day_microsecond|day_minute|day_second|deallocate|dec|declare|default|delay_key_write|delayed|delimiter|des_key_file|describe|deterministic|dev_pop|dev_samp|deviance|directory|disable|discard|distinctrow|div|dual|dumpfile|each|elseif|enable|enclosed|end|ends|engine|engines|enum|errors|escape|escaped|even|event|events|every|execute|exists|exit|explain|extended|fast|fetch|field|fields|first|flush|for|force|foreign|found_rows|full|fulltext|function|general|global|grant|grants|group|by|group_concat|handler|hash|help|high_priority|hosts|hour_microsecond|hour_minute|hour_second|if|ignore|ignore_server_ids|import|index|index_statistics|infile|inner|innodb|inout|insensitive|insert_method|install|interval|invoker|isolation|iterate|key|keys|kill|language|last|leading|leave|left|level|limit|linear|lines|list|load|local|localtime|localtimestamp|lock|logs|low_priority|master|master_heartbeat_period|master_ssl_verify_server_cert|masters|match|max|max_rows|maxvalue|message_text|middleint|migrate|min|min_rows|minute_microsecond|minute_second|mod|mode|modifies|modify|mutex|mysql_errno|natural|next|no|no_write_to_binlog|offline|offset|one|online|open|optimize|option|optionally|out|outer|outfile|pack_keys|parser|partition|partitions|password|phase|plugin|plugins|prepare|preserve|prev|primary|privileges|procedure|processlist|profile|profiles|purge|query|quick|range|read|read_write|reads|real|rebuild|recover|references|regexp|relaylog|release|remove|rename|reorganize|repair|repeatable|replace|require|resignal|restrict|resume|return|returns|revoke|right|rlike|rollback|rollup|row|row_format|rtree|savepoint|schedule|schema|schema_name|schemas|second_microsecond|security|sensitive|separator|serializable|server|session|share|show|signal|slave|slow|smallint|snapshot|soname|spatial|specific|sql|sql_big_result|sql_buffer_result|sql_cache|sql_calc_found_rows|sql_no_cache|sql_small_result|sqlexception|sqlstate|sqlwarning|ssl|start|starting|starts|status|std|stddev|stddev_pop|stddev_samp|storage|straight_join|subclass_origin|sum|suspend|table_name|table_statistics|tables|tablespace|temporary|terminated|to|trailing|transaction|trigger|triggers|truncate|uncommitted|undo|uninstall|unique|unlock|upgrade|usage|use|use_frm|user|user_resources|user_statistics|using|utc_date|utc_time|utc_timestamp|value|variables|varying|view|views|warnings|when|while|with|work|write|xa|xor|year_month|zerofill|begin|do|then|else|loop|repeat";
  46. var builtins = "rank|coalesce|ifnull|isnull|nvl";
  47. var variable = "charset|clear|connect|edit|ego|exit|go|help|nopager|notee|nowarning|pager|print|prompt|quit|rehash|source|status|system|tee";
  48. var datetimeFunctions = 'adddate|addtime|convert_tz|curdate|current_date|current_time|current_timestamp|curtime|date|date_add|date_format|date_sub|datediff|day|dayname|dayofmonth|dayofweek|dayofyear|extract|from_days|from_unixtime|get_format|hour|last_day|localtime|localtimestamp|makedate|maketime|microsecond|minute|month|monthname|now|period_add|period_diff|quarter|sec_to_time|second|str_to_date|subdate|subtime|sysdate|time|time_format|time_to_sec|timediff|timestamp|timestampadd|timestampdiff|to_days|to_seconds|unix_timestamp|utc_date|utc_time|utc_timestamp|week|weekday|weekofyear|year|yearweek';
  49. var encryptionFunctions = 'aes_decrypt|aes_encrypt|compress|md|random_bytes|sha|sha|statement_digest|statement_digest_text|uncompress|uncompressed_length|validate_password_strength';
  50. var mathFunctions = 'abs|acos|asin|atan|atan|ceil|ceiling|conv|cos|cot|crc|degrees|div|exp|floor|ln|log|log10|log2|mod|pi|pow|power|radians|rand|round|sign|sin|sqrt|tan|truncate';
  51. var stringFunctions = 'ascii|bin|bit_length|char|char_length|character_length|concat|concat_ws|elt|export_set|field|find_in_set|format|from_base|hex|insert|instr|lcase|left|length|like|load_file|locate|lower|lpad|ltrim|make_set|match|mid|not|not|oct|octet_length|ord|position|quote|regexp|regexp_instr|regexp_like|regexp_replace|regexp_substr|repeat|replace|reverse|right|rlike|rpad|rtrim|soundex|sounds|space|strcmp|substr|substring|substring_index|to_base|trim|ucase|unhex|upper|weight_string';
  52. var dataTypes = ("bool|boolean|bit|blob|decimal|double|enum|float|long|longblob|longtext|medium|mediumblob|mediumint|mediumtext|time|timestamp|tinyblob|tinyint|tinytext|text|" +
  53. "bigint|int|int1|int2|int3|int4|int8|integer|float|float4|float8|double|char|varbinary|varchar|varcharacter|precision|date|datetime|year|unsigned|signed|numeric");
  54. var keywordMapper = this.createKeywordMapper({
  55. "support.function": [builtins, datetimeFunctions, encryptionFunctions, mathFunctions, stringFunctions].join('|'),
  56. "keyword": mySqlKeywords,
  57. "storage.type": dataTypes,
  58. "constant": "false|true|null|unknown|ODBCdotTable|zerolessFloat",
  59. "variable.language": variable
  60. }, "identifier", true);
  61. function string(rule) {
  62. var start = rule.start;
  63. var escapeSeq = rule.escape;
  64. return {
  65. token: "string.start",
  66. regex: start,
  67. next: [
  68. { token: "constant.language.escape", regex: escapeSeq },
  69. { token: "string.end", next: "start", regex: start },
  70. { defaultToken: "string" }
  71. ]
  72. };
  73. }
  74. this.$rules = {
  75. "start": [{
  76. token: "comment", regex: "(?:-- |#).*$"
  77. },
  78. string({ start: '"', escape: /\\[0'"bnrtZ\\%_]?/ }),
  79. string({ start: "'", escape: /\\[0'"bnrtZ\\%_]?/ }),
  80. DocCommentHighlightRules.getStartRule("doc-start"),
  81. {
  82. token: "comment", // multi line comment
  83. regex: /\/\*/,
  84. next: "comment"
  85. }, {
  86. token: "constant.numeric", // hex
  87. regex: /0[xX][0-9a-fA-F]+|[xX]'[0-9a-fA-F]+'|0[bB][01]+|[bB]'[01]+'/
  88. }, {
  89. token: "constant.numeric", // float
  90. regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
  91. }, {
  92. token: keywordMapper,
  93. regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  94. }, {
  95. token: "constant.class",
  96. regex: "@@?[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  97. }, {
  98. token: "constant.buildin",
  99. regex: "`[^`]*`"
  100. }, {
  101. token: "keyword.operator",
  102. regex: "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
  103. }, {
  104. token: "paren.lparen",
  105. regex: "[\\(]"
  106. }, {
  107. token: "paren.rparen",
  108. regex: "[\\)]"
  109. }, {
  110. token: "text",
  111. regex: "\\s+"
  112. }],
  113. "comment": [
  114. { token: "comment", regex: "\\*\\/", next: "start" },
  115. { defaultToken: "comment" }
  116. ]
  117. };
  118. this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("start")]);
  119. this.normalizeRules();
  120. };
  121. oop.inherits(MysqlHighlightRules, TextHighlightRules);
  122. exports.MysqlHighlightRules = MysqlHighlightRules;
  123. });
  124. ace.define("ace/mode/mysql",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/mysql_highlight_rules"], function(require, exports, module){var oop = require("../lib/oop");
  125. var TextMode = require("../mode/text").Mode;
  126. var MysqlHighlightRules = require("./mysql_highlight_rules").MysqlHighlightRules;
  127. var Mode = function () {
  128. this.HighlightRules = MysqlHighlightRules;
  129. this.$behaviour = this.$defaultBehaviour;
  130. };
  131. oop.inherits(Mode, TextMode);
  132. (function () {
  133. this.lineCommentStart = ["--", "#"]; // todo space
  134. this.blockComment = { start: "/*", end: "*/" };
  135. this.$id = "ace/mode/mysql";
  136. }).call(Mode.prototype);
  137. exports.Mode = Mode;
  138. }); (function() {
  139. ace.require(["ace/mode/mysql"], function(m) {
  140. if (typeof module == "object" && typeof exports == "object" && module) {
  141. module.exports = m;
  142. }
  143. });
  144. })();