mode-gitignore.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ace.define("ace/mode/gitignore_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 GitignoreHighlightRules = function() {
  6. this.$rules = {
  7. "start" : [
  8. {
  9. token : "comment",
  10. regex : /^\s*#.*$/
  11. }, {
  12. token : "keyword", // negated patterns
  13. regex : /^\s*!.*$/
  14. }
  15. ]
  16. };
  17. this.normalizeRules();
  18. };
  19. GitignoreHighlightRules.metaData = {
  20. fileTypes: ['gitignore'],
  21. name: 'Gitignore'
  22. };
  23. oop.inherits(GitignoreHighlightRules, TextHighlightRules);
  24. exports.GitignoreHighlightRules = GitignoreHighlightRules;
  25. });
  26. ace.define("ace/mode/gitignore",[], function(require, exports, module) {
  27. "use strict";
  28. var oop = require("../lib/oop");
  29. var TextMode = require("./text").Mode;
  30. var GitignoreHighlightRules = require("./gitignore_highlight_rules").GitignoreHighlightRules;
  31. var Mode = function() {
  32. this.HighlightRules = GitignoreHighlightRules;
  33. this.$behaviour = this.$defaultBehaviour;
  34. };
  35. oop.inherits(Mode, TextMode);
  36. (function() {
  37. this.lineCommentStart = "#";
  38. this.$id = "ace/mode/gitignore";
  39. }).call(Mode.prototype);
  40. exports.Mode = Mode;
  41. });
  42. (function() {
  43. ace.require(["ace/mode/gitignore"], function(m) {
  44. if (typeof module == "object" && typeof exports == "object" && module) {
  45. module.exports = m;
  46. }
  47. });
  48. })();