mode-gitignore.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. ace.define("ace/mode/gitignore_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 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",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/gitignore_highlight_rules"], 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. });