Projekt

Obecné

Profil

Stáhnout (4.79 KB) Statistiky
| Větev: | Tag: | Revize:
1
ace.define("ace/mode/lucene_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
2
"use strict";
3

    
4
var oop = require("../lib/oop");
5
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
6

    
7
var LuceneHighlightRules = function() {
8
    this.$rules = {
9
        "start" : [
10
            {
11
                token: "constant.language.escape",
12
                regex: /\\[\-+&|!(){}\[\]^"~*?:\\]/
13
            }, {
14
                token: "constant.character.negation",
15
                regex: "\\-"
16
            }, {
17
                token: "constant.character.interro",
18
                regex: "\\?"
19
            }, {
20
                token: "constant.character.required",
21
                regex: "\\+"
22
            }, {
23
                token: "constant.character.asterisk",
24
                regex: "\\*"
25
            }, {
26
                token: 'constant.character.proximity',
27
                regex: '~(?:0\\.[0-9]+|[0-9]+)?'
28
            }, {
29
                token: 'keyword.operator',
30
                regex: '(AND|OR|NOT|TO)\\b'
31
            }, {
32
                token: "paren.lparen",
33
                regex: "[\\(\\{\\[]"
34
            }, {
35
                token: "paren.rparen",
36
                regex: "[\\)\\}\\]]"
37
            }, {
38
                token: "keyword.operator",
39
                regex: /[><=^]/
40
            }, {
41
                token: "constant.numeric",
42
                regex: /\d[\d.-]*/
43
            }, {
44
                token: "string",
45
                regex: /"(?:\\"|[^"])*"/
46
            }, {
47
                token: "keyword",
48
                regex: /(?:\\.|[^\s\-+&|!(){}\[\]^"~*?:\\])+:/,
49
                next: "maybeRegex"
50
            }, {
51
                token: "term",
52
                regex: /\w+/
53
            }, {
54
                token: "text",
55
                regex: /\s+/
56
            }
57
        ],
58
        "maybeRegex": [{
59
            token: "text",
60
            regex: /\s+/
61
        }, {
62
            token: "string.regexp.start",
63
            regex: "/",
64
            next: "regex"
65
        }, {
66
            regex: "",
67
            next: "start"
68
        }],
69
        "regex": [
70
            {
71
                token: "regexp.keyword.operator",
72
                regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
73
            }, {
74
                token: "string.regexp.end",
75
                regex: "/[sxngimy]*",
76
                next: "no_regex"
77
            }, {
78
                token : "invalid",
79
                regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
80
            }, {
81
                token : "constant.language.escape",
82
                regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
83
            }, {
84
                token: "constant.language.escape",
85
                regex: "<\d+-\d+>|[~&@]"
86
            }, {
87
                token : "constant.language.delimiter",
88
                regex: /\|/
89
            }, {
90
                token: "constant.language.escape",
91
                regex: /\[\^?/,
92
                next: "regex_character_class"
93
            }, {
94
                token: "empty",
95
                regex: "$",
96
                next: "no_regex"
97
            }, {
98
                defaultToken: "string.regexp"
99
            }
100
        ],
101
        "regex_character_class": [
102
            {
103
                token: "regexp.charclass.keyword.operator",
104
                regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
105
            }, {
106
                token: "constant.language.escape",
107
                regex: "]",
108
                next: "regex"
109
            }, {
110
                token: "constant.language.escape",
111
                regex: "-"
112
            }, {
113
                token: "empty",
114
                regex: "$",
115
                next: "no_regex"
116
            }, {
117
                defaultToken: "string.regexp.charachterclass"
118
            }
119
        ]
120
    };
121
};
122

    
123
oop.inherits(LuceneHighlightRules, TextHighlightRules);
124

    
125
exports.LuceneHighlightRules = LuceneHighlightRules;
126
});
127

    
128
ace.define("ace/mode/lucene",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/lucene_highlight_rules"], function(require, exports, module) {
129
'use strict';
130

    
131
var oop = require("../lib/oop");
132
var TextMode = require("./text").Mode;
133
var LuceneHighlightRules = require("./lucene_highlight_rules").LuceneHighlightRules;
134

    
135
var Mode = function() {
136
    this.HighlightRules = LuceneHighlightRules;
137
    this.$behaviour = this.$defaultBehaviour;
138
};
139

    
140
oop.inherits(Mode, TextMode);
141

    
142
(function() {
143
    this.$id = "ace/mode/lucene";
144
}).call(Mode.prototype);
145

    
146
exports.Mode = Mode;
147
});                (function() {
148
                    ace.require(["ace/mode/lucene"], function(m) {
149
                        if (typeof module == "object" && typeof exports == "object" && module) {
150
                            module.exports = m;
151
                        }
152
                    });
153
                })();
154
            
(115-115/244)