mode-lucene.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. ace.define("ace/mode/lucene_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",[], 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. });
  61. (function() {
  62. ace.require(["ace/mode/lucene"], function(m) {
  63. if (typeof module == "object" && typeof exports == "object" && module) {
  64. module.exports = m;
  65. }
  66. });
  67. })();