Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

mode-sql.js 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. ace.define("ace/mode/sql_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  5. var SqlHighlightRules = function() {
  6. var keywords = (
  7. "select|insert|update|delete|from|where|and|or|group|by|order|limit|offset|having|as|case|" +
  8. "when|else|end|type|left|right|join|on|outer|desc|asc|union"
  9. );
  10. var builtinConstants = (
  11. "true|false|null"
  12. );
  13. var builtinFunctions = (
  14. "count|min|max|avg|sum|rank|now|coalesce"
  15. );
  16. var keywordMapper = this.createKeywordMapper({
  17. "support.function": builtinFunctions,
  18. "keyword": keywords,
  19. "constant.language": builtinConstants
  20. }, "identifier", true);
  21. this.$rules = {
  22. "start" : [ {
  23. token : "comment",
  24. regex : "--.*$"
  25. }, {
  26. token : "comment",
  27. start : "/\\*",
  28. end : "\\*/"
  29. }, {
  30. token : "string", // " string
  31. regex : '".*?"'
  32. }, {
  33. token : "string", // ' string
  34. regex : "'.*?'"
  35. }, {
  36. token : "constant.numeric", // float
  37. regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
  38. }, {
  39. token : keywordMapper,
  40. regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  41. }, {
  42. token : "keyword.operator",
  43. regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
  44. }, {
  45. token : "paren.lparen",
  46. regex : "[\\(]"
  47. }, {
  48. token : "paren.rparen",
  49. regex : "[\\)]"
  50. }, {
  51. token : "text",
  52. regex : "\\s+"
  53. } ]
  54. };
  55. this.normalizeRules();
  56. };
  57. oop.inherits(SqlHighlightRules, TextHighlightRules);
  58. exports.SqlHighlightRules = SqlHighlightRules;
  59. });
  60. ace.define("ace/mode/sql",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/sql_highlight_rules","ace/range"], function(require, exports, module) {
  61. "use strict";
  62. var oop = require("../lib/oop");
  63. var TextMode = require("./text").Mode;
  64. var SqlHighlightRules = require("./sql_highlight_rules").SqlHighlightRules;
  65. var Range = require("../range").Range;
  66. var Mode = function() {
  67. this.HighlightRules = SqlHighlightRules;
  68. };
  69. oop.inherits(Mode, TextMode);
  70. (function() {
  71. this.lineCommentStart = "--";
  72. this.$id = "ace/mode/sql";
  73. }).call(Mode.prototype);
  74. exports.Mode = Mode;
  75. });