mode-lucene.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. ace.define("ace/mode/lucene_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) {
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var lang = require("../lib/lang");
  5. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  6. var LuceneHighlightRules = function() {
  7. this.$rules = {
  8. "start" : [
  9. {
  10. token : "constant.character.negation",
  11. regex : "[\\-]"
  12. }, {
  13. token : "constant.character.interro",
  14. regex : "[\\?]"
  15. }, {
  16. token : "constant.character.asterisk",
  17. regex : "[\\*]"
  18. }, {
  19. token: 'constant.character.proximity',
  20. regex: '~[0-9]+\\b'
  21. }, {
  22. token : 'keyword.operator',
  23. regex: '(?:AND|OR|NOT)\\b'
  24. }, {
  25. token : "paren.lparen",
  26. regex : "[\\(]"
  27. }, {
  28. token : "paren.rparen",
  29. regex : "[\\)]"
  30. }, {
  31. token : "keyword",
  32. regex : "[\\S]+:"
  33. }, {
  34. token : "string", // " string
  35. regex : '".*?"'
  36. }, {
  37. token : "text",
  38. regex : "\\s+"
  39. }
  40. ]
  41. };
  42. };
  43. oop.inherits(LuceneHighlightRules, TextHighlightRules);
  44. exports.LuceneHighlightRules = LuceneHighlightRules;
  45. });
  46. ace.define("ace/mode/lucene",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/lucene_highlight_rules"], function(require, exports, module) {
  47. 'use strict';
  48. var oop = require("../lib/oop");
  49. var TextMode = require("./text").Mode;
  50. var LuceneHighlightRules = require("./lucene_highlight_rules").LuceneHighlightRules;
  51. var Mode = function() {
  52. this.HighlightRules = LuceneHighlightRules;
  53. this.$behaviour = this.$defaultBehaviour;
  54. };
  55. oop.inherits(Mode, TextMode);
  56. (function() {
  57. this.$id = "ace/mode/lucene";
  58. }).call(Mode.prototype);
  59. exports.Mode = Mode;
  60. });