1
define('ace/mode/tm_snippet', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
4
var oop = require("../lib/oop");
5
var TextMode = require("./text").Mode;
6
var Tokenizer = require("../tokenizer").Tokenizer;
7
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
9
var SnippetHighlightRules = function() {
11
var builtins = "SELECTION|CURRENT_WORD|SELECTED_TEXT|CURRENT_LINE|LINE_INDEX|" +
12
"LINE_NUMBER|SOFT_TABS|TAB_SIZE|FILENAME|FILEPATH|FULLNAME";
16
{token:"constant.language.escape", regex: /\\[\$}`\\]/},
17
{token:"keyword", regex: "\\$(?:TM_)?(?:" + builtins + ")\\b"},
18
{token:"variable", regex: "\\$\\w+"},
19
{token: function(value, state, stack) {
23
stack.unshift("start", 1);
24
return this.tokenName;
25
}, tokenName: "markup.list", regex: "\\${", next: "varDecl"},
26
{token: function(value, state, stack) {
32
return this.tokenName;
33
}, tokenName: "markup.list", regex: "}"},
34
{token: "doc,comment", regex:/^\${2}-{5,}$/}
37
{regex: /\d+\b/, token: "constant.numeric"},
38
{token:"keyword", regex: "(?:TM_)?(?:" + builtins + ")\\b"},
39
{token:"variable", regex: "\\w+"},
40
{regex: /:/, token: "punctuation.operator", next: "start"},
41
{regex: /\//, token: "string.regex", next: "regexp"},
42
{regex: "", next: "start"}
45
{regex: /\\./, token: "escape"},
46
{regex: /\[/, token: "regex.start", next: "charClass"},
47
{regex: "/", token: "string.regex", next: "format"},
48
{"token": "string.regex", regex:"."},
51
{regex: "\\.", token: "escape"},
52
{regex: "\\]", token: "regex.end", next: "regexp"},
53
{"token": "string.regex", regex:"."},
56
{regex: /\\[ulULE]/, token: "keyword"},
57
{regex: /\$\d+/, token: "variable"},
58
{regex: "/[gim]*:?", token: "string.regex", next: "start"},
59
{"token": "string", regex:"."},
64
oop.inherits(SnippetHighlightRules, TextHighlightRules);
66
exports.SnippetHighlightRules = SnippetHighlightRules;
69
var Mode = function() {
70
var highlighter = new SnippetHighlightRules();
72
this.$tokenizer = new Tokenizer(highlighter.getRules());
74
oop.inherits(Mode, TextMode);
77
this.getNextLineIndent = function(state, line, tab) {
78
return this.$getIndent(line);
80
}).call(Mode.prototype);