ace-rails-ap 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +1 -1
- data/lib/ace/rails/version.rb +1 -1
- data/vendor/assets/javascripts/ace/ace.js +6911 -5290
- data/vendor/assets/javascripts/ace/ext-chromevox.js +537 -0
- data/vendor/assets/javascripts/ace/ext-elastic_tabstops_lite.js +301 -0
- data/vendor/assets/javascripts/ace/ext-emmet.js +1109 -0
- data/vendor/assets/javascripts/ace/ext-keybinding_menu.js +207 -0
- data/vendor/assets/javascripts/ace/ext-language_tools.js +1665 -0
- data/vendor/assets/javascripts/ace/ext-modelist.js +168 -0
- data/vendor/assets/javascripts/ace/ext-old_ie.js +500 -0
- data/vendor/assets/javascripts/ace/ext-options.js +252 -0
- data/vendor/assets/javascripts/ace/ext-searchbox.js +421 -0
- data/vendor/assets/javascripts/ace/ext-settings_menu.js +632 -0
- data/vendor/assets/javascripts/ace/ext-spellcheck.js +68 -0
- data/vendor/assets/javascripts/ace/ext-split.js +271 -0
- data/vendor/assets/javascripts/ace/ext-static_highlight.js +178 -0
- data/vendor/assets/javascripts/ace/ext-statusbar.js +47 -0
- data/vendor/assets/javascripts/ace/ext-textarea.js +478 -0
- data/vendor/assets/javascripts/ace/ext-themelist.js +86 -0
- data/vendor/assets/javascripts/ace/ext-whitespace.js +206 -0
- data/vendor/assets/javascripts/ace/keybinding-emacs.js +822 -131
- data/vendor/assets/javascripts/ace/keybinding-vim.js +382 -258
- data/vendor/assets/javascripts/ace/mode-abap.js +261 -0
- data/vendor/assets/javascripts/ace/mode-actionscript.js +257 -0
- data/vendor/assets/javascripts/ace/mode-ada.js +118 -0
- data/vendor/assets/javascripts/ace/mode-asciidoc.js +373 -0
- data/vendor/assets/javascripts/ace/mode-assembly_x86.js +217 -0
- data/vendor/assets/javascripts/ace/mode-autohotkey.js +225 -0
- data/vendor/assets/javascripts/ace/mode-batchfile.js +213 -0
- data/vendor/assets/javascripts/ace/mode-c9search.js +144 -124
- data/vendor/assets/javascripts/ace/mode-c_cpp.js +296 -254
- data/vendor/assets/javascripts/ace/mode-clojure.js +113 -177
- data/vendor/assets/javascripts/ace/mode-cobol.js +125 -0
- data/vendor/assets/javascripts/ace/mode-coffee.js +152 -235
- data/vendor/assets/javascripts/ace/mode-coldfusion.js +823 -835
- data/vendor/assets/javascripts/ace/mode-csharp.js +325 -187
- data/vendor/assets/javascripts/ace/mode-css.js +583 -297
- data/vendor/assets/javascripts/ace/mode-curly.js +2423 -0
- data/vendor/assets/javascripts/ace/mode-d.js +492 -0
- data/vendor/assets/javascripts/ace/mode-dart.js +993 -0
- data/vendor/assets/javascripts/ace/mode-diff.js +124 -204
- data/vendor/assets/javascripts/ace/mode-django.js +2448 -0
- data/vendor/assets/javascripts/ace/mode-dot.js +361 -0
- data/vendor/assets/javascripts/ace/mode-ejs.js +2817 -0
- data/vendor/assets/javascripts/ace/mode-erlang.js +987 -0
- data/vendor/assets/javascripts/ace/mode-forth.js +280 -0
- data/vendor/assets/javascripts/ace/mode-ftl.js +1061 -0
- data/vendor/assets/javascripts/ace/mode-glsl.js +313 -275
- data/vendor/assets/javascripts/ace/mode-golang.js +268 -275
- data/vendor/assets/javascripts/ace/mode-groovy.js +347 -492
- data/vendor/assets/javascripts/ace/mode-haml.js +498 -0
- data/vendor/assets/javascripts/ace/mode-handlebars.js +2433 -0
- data/vendor/assets/javascripts/ace/mode-haskell.js +362 -0
- data/vendor/assets/javascripts/ace/mode-haxe.js +226 -202
- data/vendor/assets/javascripts/ace/mode-html.js +1099 -802
- data/vendor/assets/javascripts/ace/mode-html_completions.js +309 -0
- data/vendor/assets/javascripts/ace/mode-html_ruby.js +2822 -0
- data/vendor/assets/javascripts/ace/mode-ini.js +185 -0
- data/vendor/assets/javascripts/ace/mode-jack.js +653 -0
- data/vendor/assets/javascripts/ace/mode-jade.js +2081 -0
- data/vendor/assets/javascripts/ace/mode-java.js +339 -488
- data/vendor/assets/javascripts/ace/mode-javascript.js +342 -478
- data/vendor/assets/javascripts/ace/mode-json.js +215 -178
- data/vendor/assets/javascripts/ace/mode-jsoniq.js +2761 -0
- data/vendor/assets/javascripts/ace/mode-jsp.js +1553 -0
- data/vendor/assets/javascripts/ace/mode-jsx.js +325 -289
- data/vendor/assets/javascripts/ace/mode-julia.js +286 -0
- data/vendor/assets/javascripts/ace/mode-latex.js +141 -46
- data/vendor/assets/javascripts/ace/mode-less.js +493 -151
- data/vendor/assets/javascripts/ace/mode-liquid.js +594 -656
- data/vendor/assets/javascripts/ace/mode-lisp.js +137 -0
- data/vendor/assets/javascripts/ace/mode-livescript.js +288 -0
- data/vendor/assets/javascripts/ace/mode-logiql.js +669 -0
- data/vendor/assets/javascripts/ace/mode-lsl.js +890 -0
- data/vendor/assets/javascripts/ace/mode-lua.js +274 -368
- data/vendor/assets/javascripts/ace/mode-luapage.js +1331 -1107
- data/vendor/assets/javascripts/ace/mode-lucene.js +64 -0
- data/vendor/assets/javascripts/ace/mode-makefile.js +332 -0
- data/vendor/assets/javascripts/ace/mode-markdown.js +1303 -948
- data/vendor/assets/javascripts/ace/mode-matlab.js +230 -0
- data/vendor/assets/javascripts/ace/mode-mushcode.js +705 -0
- data/vendor/assets/javascripts/ace/mode-mushcode_high_rules.js +569 -0
- data/vendor/assets/javascripts/ace/mode-mysql.js +185 -0
- data/vendor/assets/javascripts/ace/mode-nix.js +935 -0
- data/vendor/assets/javascripts/ace/mode-objectivec.js +699 -0
- data/vendor/assets/javascripts/ace/mode-ocaml.js +44 -63
- data/vendor/assets/javascripts/ace/mode-pascal.js +233 -0
- data/vendor/assets/javascripts/ace/mode-perl.js +116 -189
- data/vendor/assets/javascripts/ace/mode-pgsql.js +886 -500
- data/vendor/assets/javascripts/ace/mode-php.js +1158 -380
- data/vendor/assets/javascripts/ace/mode-plain_text.js +56 -0
- data/vendor/assets/javascripts/ace/mode-powershell.js +222 -167
- data/vendor/assets/javascripts/ace/mode-prolog.js +354 -0
- data/vendor/assets/javascripts/ace/mode-properties.js +100 -0
- data/vendor/assets/javascripts/ace/mode-protobuf.js +885 -0
- data/vendor/assets/javascripts/ace/mode-python.js +99 -201
- data/vendor/assets/javascripts/ace/mode-r.js +337 -0
- data/vendor/assets/javascripts/ace/mode-rdoc.js +210 -0
- data/vendor/assets/javascripts/ace/mode-rhtml.js +2663 -0
- data/vendor/assets/javascripts/ace/mode-ruby.js +262 -136
- data/vendor/assets/javascripts/ace/mode-rust.js +245 -0
- data/vendor/assets/javascripts/ace/mode-sass.js +443 -0
- data/vendor/assets/javascripts/ace/mode-scad.js +225 -240
- data/vendor/assets/javascripts/ace/mode-scala.js +340 -494
- data/vendor/assets/javascripts/ace/mode-scheme.js +143 -0
- data/vendor/assets/javascripts/ace/mode-scss.js +499 -157
- data/vendor/assets/javascripts/ace/mode-sh.js +180 -110
- data/vendor/assets/javascripts/ace/mode-sjs.js +1154 -0
- data/vendor/assets/javascripts/ace/mode-snippets.js +198 -0
- data/vendor/assets/javascripts/ace/mode-soy_template.js +2707 -0
- data/vendor/assets/javascripts/ace/mode-space.js +160 -0
- data/vendor/assets/javascripts/ace/mode-sql.js +48 -69
- data/vendor/assets/javascripts/ace/mode-stylus.js +447 -0
- data/vendor/assets/javascripts/ace/mode-svg.js +552 -605
- data/vendor/assets/javascripts/ace/mode-tcl.js +139 -98
- data/vendor/assets/javascripts/ace/mode-tex.js +187 -0
- data/vendor/assets/javascripts/ace/mode-textile.js +29 -40
- data/vendor/assets/javascripts/ace/mode-tmsnippet.js +200 -0
- data/vendor/assets/javascripts/ace/mode-toml.js +177 -0
- data/vendor/assets/javascripts/ace/mode-twig.js +2228 -0
- data/vendor/assets/javascripts/ace/mode-typescript.js +1018 -0
- data/vendor/assets/javascripts/ace/mode-vbscript.js +250 -0
- data/vendor/assets/javascripts/ace/mode-velocity.js +1621 -0
- data/vendor/assets/javascripts/ace/mode-verilog.js +127 -0
- data/vendor/assets/javascripts/ace/mode-vhdl.js +139 -0
- data/vendor/assets/javascripts/ace/mode-xml.js +350 -242
- data/vendor/assets/javascripts/ace/mode-xquery.js +2490 -300
- data/vendor/assets/javascripts/ace/mode-yaml.js +146 -45
- data/vendor/assets/javascripts/ace/theme-ambiance.js +202 -0
- data/vendor/assets/javascripts/ace/theme-chaos.js +179 -0
- data/vendor/assets/javascripts/ace/theme-chrome.js +97 -153
- data/vendor/assets/javascripts/ace/theme-clouds.js +78 -119
- data/vendor/assets/javascripts/ace/theme-clouds_midnight.js +79 -120
- data/vendor/assets/javascripts/ace/theme-cobalt.js +89 -140
- data/vendor/assets/javascripts/ace/theme-crimson_editor.js +93 -145
- data/vendor/assets/javascripts/ace/theme-dawn.js +84 -143
- data/vendor/assets/javascripts/ace/theme-dreamweaver.js +99 -162
- data/vendor/assets/javascripts/ace/theme-eclipse.js +78 -111
- data/vendor/assets/javascripts/ace/theme-github.js +70 -121
- data/vendor/assets/javascripts/ace/theme-idle_fingers.js +75 -134
- data/vendor/assets/javascripts/ace/theme-kr.js +135 -0
- data/vendor/assets/javascripts/ace/theme-merbivore.js +80 -143
- data/vendor/assets/javascripts/ace/theme-merbivore_soft.js +81 -149
- data/vendor/assets/javascripts/ace/theme-mono_industrial.js +87 -146
- data/vendor/assets/javascripts/ace/theme-monokai.js +88 -146
- data/vendor/assets/javascripts/ace/theme-pastel_on_dark.js +82 -142
- data/vendor/assets/javascripts/ace/theme-solarized_dark.js +83 -144
- data/vendor/assets/javascripts/ace/theme-solarized_light.js +76 -133
- data/vendor/assets/javascripts/ace/theme-terminal.js +145 -0
- data/vendor/assets/javascripts/ace/theme-textmate.js +101 -158
- data/vendor/assets/javascripts/ace/theme-tomorrow.js +89 -163
- data/vendor/assets/javascripts/ace/theme-tomorrow_night.js +89 -163
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_blue.js +89 -165
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright.js +101 -162
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_eighties.js +90 -160
- data/vendor/assets/javascripts/ace/theme-twilight.js +87 -158
- data/vendor/assets/javascripts/ace/theme-vibrant_ink.js +75 -140
- data/vendor/assets/javascripts/ace/theme-xcode.js +120 -0
- data/vendor/assets/javascripts/ace/worker-coffee.js +3049 -2665
- data/vendor/assets/javascripts/ace/worker-css.js +1779 -4376
- data/vendor/assets/javascripts/ace/worker-javascript.js +8701 -9008
- data/vendor/assets/javascripts/ace/worker-json.js +709 -1340
- data/vendor/assets/javascripts/ace/worker-lua.js +3525 -0
- data/vendor/assets/javascripts/ace/worker-php.js +6893 -0
- data/vendor/assets/javascripts/ace/worker-xquery.js +19924 -64507
- metadata +100 -17
@@ -8,10 +8,9 @@ var Tokenizer = require("../tokenizer").Tokenizer;
|
|
8
8
|
var LuaPageHighlightRules = require("./luapage_highlight_rules").LuaPageHighlightRules;
|
9
9
|
|
10
10
|
var Mode = function() {
|
11
|
-
|
11
|
+
this.HighlightRules = LuaPageHighlightRules;
|
12
12
|
|
13
|
-
this
|
14
|
-
this.$embeds = highlighter.getEmbeds();
|
13
|
+
this.HighlightRules = LuaPageHighlightRules;
|
15
14
|
this.createModeDelegates({
|
16
15
|
"lua-": LuaMode
|
17
16
|
});
|
@@ -21,7 +20,7 @@ oop.inherits(Mode, HtmlMode);
|
|
21
20
|
exports.Mode = Mode;
|
22
21
|
});
|
23
22
|
|
24
|
-
define('ace/mode/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/javascript', 'ace/mode/css', 'ace/tokenizer', 'ace/mode/html_highlight_rules', 'ace/mode/behaviour/html', 'ace/mode/folding/html'], function(require, exports, module) {
|
23
|
+
define('ace/mode/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/javascript', 'ace/mode/css', 'ace/tokenizer', 'ace/mode/html_highlight_rules', 'ace/mode/behaviour/html', 'ace/mode/folding/html', 'ace/mode/html_completions'], function(require, exports, module) {
|
25
24
|
|
26
25
|
|
27
26
|
var oop = require("../lib/oop");
|
@@ -32,13 +31,13 @@ var Tokenizer = require("../tokenizer").Tokenizer;
|
|
32
31
|
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
|
33
32
|
var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour;
|
34
33
|
var HtmlFoldMode = require("./folding/html").FoldMode;
|
34
|
+
var HtmlCompletions = require("./html_completions").HtmlCompletions;
|
35
35
|
|
36
36
|
var Mode = function() {
|
37
|
-
|
38
|
-
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
37
|
+
this.HighlightRules = HtmlHighlightRules;
|
39
38
|
this.$behaviour = new HtmlBehaviour();
|
39
|
+
this.$completer = new HtmlCompletions();
|
40
40
|
|
41
|
-
this.$embeds = highlighter.getEmbeds();
|
42
41
|
this.createModeDelegates({
|
43
42
|
"js-": JavaScriptMode,
|
44
43
|
"css-": CssMode
|
@@ -50,10 +49,7 @@ oop.inherits(Mode, TextMode);
|
|
50
49
|
|
51
50
|
(function() {
|
52
51
|
|
53
|
-
|
54
|
-
this.toggleCommentLines = function(state, doc, startRow, endRow) {
|
55
|
-
return 0;
|
56
|
-
};
|
52
|
+
this.blockComment = {start: "<!--", end: "-->"};
|
57
53
|
|
58
54
|
this.getNextLineIndent = function(state, line, tab) {
|
59
55
|
return this.$getIndent(line);
|
@@ -63,6 +59,11 @@ oop.inherits(Mode, TextMode);
|
|
63
59
|
return false;
|
64
60
|
};
|
65
61
|
|
62
|
+
this.getCompletions = function(state, session, pos, prefix) {
|
63
|
+
return this.$completer.getCompletions(state, session, pos, prefix);
|
64
|
+
};
|
65
|
+
|
66
|
+
this.$id = "ace/mode/html";
|
66
67
|
}).call(Mode.prototype);
|
67
68
|
|
68
69
|
exports.Mode = Mode;
|
@@ -82,7 +83,8 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
|
82
83
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
83
84
|
|
84
85
|
var Mode = function() {
|
85
|
-
this
|
86
|
+
this.HighlightRules = JavaScriptHighlightRules;
|
87
|
+
|
86
88
|
this.$outdent = new MatchingBraceOutdent();
|
87
89
|
this.$behaviour = new CstyleBehaviour();
|
88
90
|
this.foldingRules = new CStyleFoldMode();
|
@@ -91,53 +93,27 @@ oop.inherits(Mode, TextMode);
|
|
91
93
|
|
92
94
|
(function() {
|
93
95
|
|
94
|
-
|
95
|
-
this.
|
96
|
-
var outdent = true;
|
97
|
-
var re = /^(\s*)\/\//;
|
98
|
-
|
99
|
-
for (var i=startRow; i<= endRow; i++) {
|
100
|
-
if (!re.test(doc.getLine(i))) {
|
101
|
-
outdent = false;
|
102
|
-
break;
|
103
|
-
}
|
104
|
-
}
|
105
|
-
|
106
|
-
if (outdent) {
|
107
|
-
var deleteRange = new Range(0, 0, 0, 0);
|
108
|
-
for (var i=startRow; i<= endRow; i++)
|
109
|
-
{
|
110
|
-
var line = doc.getLine(i);
|
111
|
-
var m = line.match(re);
|
112
|
-
deleteRange.start.row = i;
|
113
|
-
deleteRange.end.row = i;
|
114
|
-
deleteRange.end.column = m[0].length;
|
115
|
-
doc.replace(deleteRange, m[1]);
|
116
|
-
}
|
117
|
-
}
|
118
|
-
else {
|
119
|
-
doc.indentRows(startRow, endRow, "//");
|
120
|
-
}
|
121
|
-
};
|
96
|
+
this.lineCommentStart = "//";
|
97
|
+
this.blockComment = {start: "/*", end: "*/"};
|
122
98
|
|
123
99
|
this.getNextLineIndent = function(state, line, tab) {
|
124
100
|
var indent = this.$getIndent(line);
|
125
101
|
|
126
|
-
var tokenizedLine = this
|
102
|
+
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
127
103
|
var tokens = tokenizedLine.tokens;
|
128
104
|
var endState = tokenizedLine.state;
|
129
105
|
|
130
106
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
131
107
|
return indent;
|
132
108
|
}
|
133
|
-
|
134
|
-
if (state == "start" || state == "
|
109
|
+
|
110
|
+
if (state == "start" || state == "no_regex") {
|
135
111
|
var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
|
136
112
|
if (match) {
|
137
113
|
indent += tab;
|
138
114
|
}
|
139
115
|
} else if (state == "doc-start") {
|
140
|
-
if (endState == "start" ||
|
116
|
+
if (endState == "start" || endState == "no_regex") {
|
141
117
|
return "";
|
142
118
|
}
|
143
119
|
var match = line.match(/^\s*(\/?)\*/);
|
@@ -159,105 +135,64 @@ oop.inherits(Mode, TextMode);
|
|
159
135
|
this.autoOutdent = function(state, doc, row) {
|
160
136
|
this.$outdent.autoOutdent(doc, row);
|
161
137
|
};
|
162
|
-
|
138
|
+
|
163
139
|
this.createWorker = function(session) {
|
164
140
|
var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
|
165
141
|
worker.attachToDocument(session.getDocument());
|
166
|
-
|
142
|
+
|
167
143
|
worker.on("jslint", function(results) {
|
168
|
-
|
169
|
-
for (var i=0; i<results.data.length; i++) {
|
170
|
-
var error = results.data[i];
|
171
|
-
if (error)
|
172
|
-
errors.push({
|
173
|
-
row: error.line-1,
|
174
|
-
column: error.character-1,
|
175
|
-
text: error.reason,
|
176
|
-
type: "warning",
|
177
|
-
lint: error
|
178
|
-
});
|
179
|
-
}
|
180
|
-
session.setAnnotations(errors);
|
181
|
-
});
|
182
|
-
|
183
|
-
worker.on("narcissus", function(e) {
|
184
|
-
session.setAnnotations([e.data]);
|
144
|
+
session.setAnnotations(results.data);
|
185
145
|
});
|
186
|
-
|
146
|
+
|
187
147
|
worker.on("terminate", function() {
|
188
148
|
session.clearAnnotations();
|
189
149
|
});
|
190
|
-
|
150
|
+
|
191
151
|
return worker;
|
192
152
|
};
|
193
153
|
|
154
|
+
this.$id = "ace/mode/javascript";
|
194
155
|
}).call(Mode.prototype);
|
195
156
|
|
196
157
|
exports.Mode = Mode;
|
197
158
|
});
|
198
159
|
|
199
|
-
define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/
|
160
|
+
define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
200
161
|
|
201
162
|
|
202
163
|
var oop = require("../lib/oop");
|
203
|
-
var lang = require("../lib/lang");
|
204
|
-
var unicode = require("../unicode");
|
205
164
|
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
206
165
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
207
166
|
|
208
167
|
var JavaScriptHighlightRules = function() {
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
"
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
"
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
// keywords which can be followed by regular expressions
|
238
|
-
var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield";
|
239
|
-
|
240
|
-
var deprecated = lang.arrayToMap(
|
241
|
-
("__parent__|__count__|escape|unescape|with|__proto__").split("|")
|
242
|
-
);
|
243
|
-
|
244
|
-
var definitions = lang.arrayToMap(("const|let|var|function").split("|"));
|
245
|
-
|
246
|
-
var buildinConstants = lang.arrayToMap(
|
247
|
-
("null|Infinity|NaN|undefined").split("|")
|
248
|
-
);
|
249
|
-
|
250
|
-
var futureReserved = lang.arrayToMap(
|
251
|
-
("class|enum|extends|super|export|implements|private|" +
|
252
|
-
"public|interface|package|protected|static").split("|")
|
253
|
-
);
|
254
|
-
|
255
|
-
// TODO: Unicode escape sequences
|
256
|
-
var identifierRe = "[" + unicode.packages.L + "\\$_]["
|
257
|
-
+ unicode.packages.L
|
258
|
-
+ unicode.packages.Mn + unicode.packages.Mc
|
259
|
-
+ unicode.packages.Nd
|
260
|
-
+ unicode.packages.Pc + "\\$_]*\\b";
|
168
|
+
var keywordMapper = this.createKeywordMapper({
|
169
|
+
"variable.language":
|
170
|
+
"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
|
171
|
+
"Namespace|QName|XML|XMLList|" + // E4X
|
172
|
+
"ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
|
173
|
+
"Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
|
174
|
+
"Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
|
175
|
+
"SyntaxError|TypeError|URIError|" +
|
176
|
+
"decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
|
177
|
+
"isNaN|parseFloat|parseInt|" +
|
178
|
+
"JSON|Math|" + // Other
|
179
|
+
"this|arguments|prototype|window|document" , // Pseudo
|
180
|
+
"keyword":
|
181
|
+
"const|yield|import|get|set|" +
|
182
|
+
"break|case|catch|continue|default|delete|do|else|finally|for|function|" +
|
183
|
+
"if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
|
184
|
+
"__parent__|__count__|escape|unescape|with|__proto__|" +
|
185
|
+
"class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
|
186
|
+
"storage.type":
|
187
|
+
"const|let|var|function",
|
188
|
+
"constant.language":
|
189
|
+
"null|Infinity|NaN|undefined",
|
190
|
+
"support.function":
|
191
|
+
"alert",
|
192
|
+
"constant.language.boolean": "true|false"
|
193
|
+
}, "identifier");
|
194
|
+
var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
|
195
|
+
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
|
261
196
|
|
262
197
|
var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
|
263
198
|
"u[0-9a-fA-F]{4}|" + // unicode
|
@@ -267,19 +202,16 @@ var JavaScriptHighlightRules = function() {
|
|
267
202
|
"[4-7][0-7]?|" + //oct
|
268
203
|
".)";
|
269
204
|
|
270
|
-
// regexp must not have capturing parentheses. Use (?:) instead.
|
271
|
-
// regexps are ordered -> the first match is used
|
272
|
-
|
273
205
|
this.$rules = {
|
274
|
-
"
|
206
|
+
"no_regex" : [
|
275
207
|
{
|
276
208
|
token : "comment",
|
277
|
-
regex :
|
209
|
+
regex : "\\/\\/",
|
210
|
+
next : "line_comment"
|
278
211
|
},
|
279
212
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
280
213
|
{
|
281
214
|
token : "comment", // multi line comment
|
282
|
-
merge : true,
|
283
215
|
regex : /\/\*/,
|
284
216
|
next : "comment"
|
285
217
|
}, {
|
@@ -296,119 +228,61 @@ var JavaScriptHighlightRules = function() {
|
|
296
228
|
}, {
|
297
229
|
token : "constant.numeric", // float
|
298
230
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
299
|
-
}, {
|
300
|
-
token : [
|
301
|
-
"storage.type",
|
302
|
-
"punctuation.operator",
|
303
|
-
"support.function",
|
304
|
-
"punctuation.operator",
|
305
|
-
"entity.name.function",
|
306
|
-
"text",
|
307
|
-
"keyword.operator",
|
308
|
-
"text",
|
309
|
-
"storage.type",
|
310
|
-
"text",
|
311
|
-
"paren.lparen"
|
312
|
-
],
|
313
|
-
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
314
|
-
next: "function_arguments"
|
315
|
-
}, { // match stuff like: Sound.prototype.play = myfunc
|
231
|
+
}, {
|
316
232
|
token : [
|
317
|
-
"storage.type",
|
318
|
-
"punctuation.operator",
|
319
|
-
"support.function",
|
320
|
-
"punctuation.operator",
|
321
|
-
"entity.name.function",
|
322
|
-
"text",
|
323
|
-
"keyword.operator",
|
324
|
-
"text"
|
233
|
+
"storage.type", "punctuation.operator", "support.function",
|
234
|
+
"punctuation.operator", "entity.name.function", "text","keyword.operator"
|
325
235
|
],
|
326
|
-
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)
|
236
|
+
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
|
327
237
|
next: "function_arguments"
|
328
|
-
}, {
|
238
|
+
}, {
|
329
239
|
token : [
|
330
|
-
"storage.type",
|
331
|
-
"
|
332
|
-
"entity.name.function",
|
333
|
-
"text",
|
334
|
-
"keyword.operator",
|
335
|
-
"text",
|
336
|
-
"storage.type",
|
337
|
-
"text",
|
338
|
-
"paren.lparen"
|
240
|
+
"storage.type", "punctuation.operator", "entity.name.function", "text",
|
241
|
+
"keyword.operator", "text", "storage.type", "text", "paren.lparen"
|
339
242
|
],
|
340
243
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
341
244
|
next: "function_arguments"
|
342
|
-
}, {
|
245
|
+
}, {
|
343
246
|
token : [
|
344
|
-
"entity.name.function",
|
345
|
-
"text",
|
346
|
-
"keyword.operator",
|
347
|
-
"text",
|
348
|
-
"storage.type",
|
349
|
-
"text",
|
350
|
-
"paren.lparen"
|
247
|
+
"entity.name.function", "text", "keyword.operator", "text", "storage.type",
|
248
|
+
"text", "paren.lparen"
|
351
249
|
],
|
352
250
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
353
251
|
next: "function_arguments"
|
354
|
-
}, {
|
252
|
+
}, {
|
355
253
|
token : [
|
356
|
-
"storage.type",
|
357
|
-
"
|
358
|
-
"entity.name.function",
|
359
|
-
"text",
|
360
|
-
"keyword.operator",
|
361
|
-
"text",
|
362
|
-
"storage.type",
|
363
|
-
"text",
|
364
|
-
"entity.name.function",
|
365
|
-
"text",
|
366
|
-
"paren.lparen"
|
254
|
+
"storage.type", "punctuation.operator", "entity.name.function", "text",
|
255
|
+
"keyword.operator", "text",
|
256
|
+
"storage.type", "text", "entity.name.function", "text", "paren.lparen"
|
367
257
|
],
|
368
258
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
|
369
259
|
next: "function_arguments"
|
370
|
-
}, {
|
260
|
+
}, {
|
371
261
|
token : [
|
372
|
-
"storage.type",
|
373
|
-
"text",
|
374
|
-
"entity.name.function",
|
375
|
-
"text",
|
376
|
-
"paren.lparen"
|
262
|
+
"storage.type", "text", "entity.name.function", "text", "paren.lparen"
|
377
263
|
],
|
378
264
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
379
265
|
next: "function_arguments"
|
380
|
-
}, {
|
266
|
+
}, {
|
381
267
|
token : [
|
382
|
-
"entity.name.function",
|
383
|
-
"text",
|
384
|
-
"punctuation.operator",
|
385
|
-
"text",
|
386
|
-
"storage.type",
|
387
|
-
"text",
|
388
|
-
"paren.lparen"
|
268
|
+
"entity.name.function", "text", "punctuation.operator",
|
269
|
+
"text", "storage.type", "text", "paren.lparen"
|
389
270
|
],
|
390
271
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
391
272
|
next: "function_arguments"
|
392
|
-
}, {
|
273
|
+
}, {
|
393
274
|
token : [
|
394
|
-
"text",
|
395
|
-
"text",
|
396
|
-
"storage.type",
|
397
|
-
"text",
|
398
|
-
"paren.lparen"
|
275
|
+
"text", "text", "storage.type", "text", "paren.lparen"
|
399
276
|
],
|
400
277
|
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
401
278
|
next: "function_arguments"
|
402
|
-
}, {
|
403
|
-
token : "constant.language.boolean",
|
404
|
-
regex : /(?:true|false)\b/
|
405
279
|
}, {
|
406
280
|
token : "keyword",
|
407
281
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
408
|
-
next : "
|
282
|
+
next : "start"
|
409
283
|
}, {
|
410
284
|
token : ["punctuation.operator", "support.function"],
|
411
|
-
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:
|
285
|
+
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
412
286
|
}, {
|
413
287
|
token : ["punctuation.operator", "support.function.dom"],
|
414
288
|
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
@@ -419,78 +293,54 @@ var JavaScriptHighlightRules = function() {
|
|
419
293
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
420
294
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
421
295
|
}, {
|
422
|
-
token :
|
423
|
-
if (globals.hasOwnProperty(value))
|
424
|
-
return "variable.language";
|
425
|
-
else if (deprecated.hasOwnProperty(value))
|
426
|
-
return "invalid.deprecated";
|
427
|
-
else if (definitions.hasOwnProperty(value))
|
428
|
-
return "storage.type";
|
429
|
-
else if (keywords.hasOwnProperty(value))
|
430
|
-
return "keyword";
|
431
|
-
else if (buildinConstants.hasOwnProperty(value))
|
432
|
-
return "constant.language";
|
433
|
-
else if (futureReserved.hasOwnProperty(value))
|
434
|
-
return "invalid.illegal";
|
435
|
-
else if (value == "debugger")
|
436
|
-
return "invalid.deprecated";
|
437
|
-
else
|
438
|
-
return "identifier";
|
439
|
-
},
|
296
|
+
token : keywordMapper,
|
440
297
|
regex : identifierRe
|
441
298
|
}, {
|
442
299
|
token : "keyword.operator",
|
443
|
-
regex :
|
444
|
-
next : "
|
300
|
+
regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/,
|
301
|
+
next : "start"
|
445
302
|
}, {
|
446
303
|
token : "punctuation.operator",
|
447
304
|
regex : /\?|\:|\,|\;|\./,
|
448
|
-
next : "
|
305
|
+
next : "start"
|
449
306
|
}, {
|
450
307
|
token : "paren.lparen",
|
451
308
|
regex : /[\[({]/,
|
452
|
-
next : "
|
309
|
+
next : "start"
|
453
310
|
}, {
|
454
311
|
token : "paren.rparen",
|
455
312
|
regex : /[\])}]/
|
456
313
|
}, {
|
457
314
|
token : "keyword.operator",
|
458
315
|
regex : /\/=?/,
|
459
|
-
next : "
|
316
|
+
next : "start"
|
460
317
|
}, {
|
461
318
|
token: "comment",
|
462
319
|
regex: /^#!.*$/
|
463
|
-
}, {
|
464
|
-
token : "text",
|
465
|
-
regex : /\s+/
|
466
320
|
}
|
467
321
|
],
|
468
|
-
|
469
|
-
// makes sure we don't mix up regexps with the divison operator
|
470
|
-
"regex_allowed": [
|
322
|
+
"start": [
|
471
323
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
472
324
|
{
|
473
325
|
token : "comment", // multi line comment
|
474
|
-
merge : true,
|
475
326
|
regex : "\\/\\*",
|
476
327
|
next : "comment_regex_allowed"
|
477
328
|
}, {
|
478
329
|
token : "comment",
|
479
|
-
regex : "
|
330
|
+
regex : "\\/\\/",
|
331
|
+
next : "line_comment_regex_allowed"
|
480
332
|
}, {
|
481
333
|
token: "string.regexp",
|
482
334
|
regex: "\\/",
|
483
|
-
next: "regex"
|
484
|
-
merge: true
|
335
|
+
next: "regex"
|
485
336
|
}, {
|
486
337
|
token : "text",
|
487
|
-
regex : "\\s
|
338
|
+
regex : "\\s+|^$",
|
339
|
+
next : "start"
|
488
340
|
}, {
|
489
|
-
// immediately return to the start mode without matching
|
490
|
-
// anything
|
491
341
|
token: "empty",
|
492
342
|
regex: "",
|
493
|
-
next: "
|
343
|
+
next: "no_regex"
|
494
344
|
}
|
495
345
|
],
|
496
346
|
"regex": [
|
@@ -498,24 +348,28 @@ var JavaScriptHighlightRules = function() {
|
|
498
348
|
token: "regexp.keyword.operator",
|
499
349
|
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
500
350
|
}, {
|
501
|
-
// flag
|
502
351
|
token: "string.regexp",
|
503
|
-
regex: "
|
504
|
-
next: "
|
505
|
-
merge: true
|
352
|
+
regex: "/[sxngimy]*",
|
353
|
+
next: "no_regex"
|
506
354
|
}, {
|
507
|
-
token: "
|
508
|
-
regex:
|
509
|
-
|
355
|
+
token : "invalid",
|
356
|
+
regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
|
357
|
+
}, {
|
358
|
+
token : "constant.language.escape",
|
359
|
+
regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
|
360
|
+
}, {
|
361
|
+
token : "constant.language.delimiter",
|
362
|
+
regex: /\|/
|
510
363
|
}, {
|
511
|
-
token: "
|
512
|
-
regex:
|
513
|
-
next: "regex_character_class"
|
514
|
-
merge: true
|
364
|
+
token: "constant.language.escape",
|
365
|
+
regex: /\[\^?/,
|
366
|
+
next: "regex_character_class"
|
515
367
|
}, {
|
516
368
|
token: "empty",
|
517
|
-
regex: "",
|
518
|
-
next: "
|
369
|
+
regex: "$",
|
370
|
+
next: "no_regex"
|
371
|
+
}, {
|
372
|
+
defaultToken: "string.regexp"
|
519
373
|
}
|
520
374
|
],
|
521
375
|
"regex_character_class": [
|
@@ -523,18 +377,18 @@ var JavaScriptHighlightRules = function() {
|
|
523
377
|
token: "regexp.keyword.operator",
|
524
378
|
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
525
379
|
}, {
|
526
|
-
token: "
|
380
|
+
token: "constant.language.escape",
|
527
381
|
regex: "]",
|
528
|
-
next: "regex"
|
529
|
-
merge: true
|
382
|
+
next: "regex"
|
530
383
|
}, {
|
531
|
-
token: "
|
532
|
-
regex: "
|
533
|
-
merge: true
|
384
|
+
token: "constant.language.escape",
|
385
|
+
regex: "-"
|
534
386
|
}, {
|
535
387
|
token: "empty",
|
536
|
-
regex: "",
|
537
|
-
next: "
|
388
|
+
regex: "$",
|
389
|
+
next: "no_regex"
|
390
|
+
}, {
|
391
|
+
defaultToken: "string.regexp.charachterclass"
|
538
392
|
}
|
539
393
|
],
|
540
394
|
"function_arguments": [
|
@@ -543,86 +397,68 @@ var JavaScriptHighlightRules = function() {
|
|
543
397
|
regex: identifierRe
|
544
398
|
}, {
|
545
399
|
token: "punctuation.operator",
|
546
|
-
regex: "[, ]+"
|
547
|
-
merge: true
|
400
|
+
regex: "[, ]+"
|
548
401
|
}, {
|
549
402
|
token: "punctuation.operator",
|
550
|
-
regex: "$"
|
551
|
-
merge: true
|
403
|
+
regex: "$"
|
552
404
|
}, {
|
553
405
|
token: "empty",
|
554
406
|
regex: "",
|
555
|
-
next: "
|
407
|
+
next: "no_regex"
|
556
408
|
}
|
557
409
|
],
|
558
410
|
"comment_regex_allowed" : [
|
559
|
-
{
|
560
|
-
|
561
|
-
regex : ".*?\\*\\/",
|
562
|
-
merge : true,
|
563
|
-
next : "regex_allowed"
|
564
|
-
}, {
|
565
|
-
token : "comment", // comment spanning whole line
|
566
|
-
merge : true,
|
567
|
-
regex : ".+"
|
568
|
-
}
|
411
|
+
{token : "comment", regex : "\\*\\/", next : "start"},
|
412
|
+
{defaultToken : "comment"}
|
569
413
|
],
|
570
414
|
"comment" : [
|
571
|
-
{
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
}
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
}
|
415
|
+
{token : "comment", regex : "\\*\\/", next : "no_regex"},
|
416
|
+
{defaultToken : "comment"}
|
417
|
+
],
|
418
|
+
"line_comment_regex_allowed" : [
|
419
|
+
{token : "comment", regex : "$|^", next : "start"},
|
420
|
+
{defaultToken : "comment"}
|
421
|
+
],
|
422
|
+
"line_comment" : [
|
423
|
+
{token : "comment", regex : "$|^", next : "no_regex"},
|
424
|
+
{defaultToken : "comment"}
|
581
425
|
],
|
582
426
|
"qqstring" : [
|
583
427
|
{
|
584
428
|
token : "constant.language.escape",
|
585
429
|
regex : escapedRe
|
586
|
-
}, {
|
587
|
-
token : "string",
|
588
|
-
regex : '[^"\\\\]+',
|
589
|
-
merge : true
|
590
430
|
}, {
|
591
431
|
token : "string",
|
592
432
|
regex : "\\\\$",
|
593
|
-
next : "qqstring"
|
594
|
-
merge : true
|
433
|
+
next : "qqstring"
|
595
434
|
}, {
|
596
435
|
token : "string",
|
597
436
|
regex : '"|$',
|
598
|
-
next : "
|
599
|
-
|
437
|
+
next : "no_regex"
|
438
|
+
}, {
|
439
|
+
defaultToken: "string"
|
600
440
|
}
|
601
441
|
],
|
602
442
|
"qstring" : [
|
603
443
|
{
|
604
444
|
token : "constant.language.escape",
|
605
445
|
regex : escapedRe
|
606
|
-
}, {
|
607
|
-
token : "string",
|
608
|
-
regex : "[^'\\\\]+",
|
609
|
-
merge : true
|
610
446
|
}, {
|
611
447
|
token : "string",
|
612
448
|
regex : "\\\\$",
|
613
|
-
next : "qstring"
|
614
|
-
merge : true
|
449
|
+
next : "qstring"
|
615
450
|
}, {
|
616
451
|
token : "string",
|
617
452
|
regex : "'|$",
|
618
|
-
next : "
|
619
|
-
|
453
|
+
next : "no_regex"
|
454
|
+
}, {
|
455
|
+
defaultToken: "string"
|
620
456
|
}
|
621
457
|
]
|
622
458
|
};
|
623
459
|
|
624
460
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
625
|
-
[ DocCommentHighlightRules.getEndRule("
|
461
|
+
[ DocCommentHighlightRules.getEndRule("no_regex") ]);
|
626
462
|
};
|
627
463
|
|
628
464
|
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
@@ -643,21 +479,10 @@ var DocCommentHighlightRules = function() {
|
|
643
479
|
token : "comment.doc.tag",
|
644
480
|
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
645
481
|
}, {
|
646
|
-
token : "comment.doc",
|
647
|
-
|
648
|
-
regex : "\\s+"
|
649
|
-
}, {
|
650
|
-
token : "comment.doc",
|
651
|
-
merge : true,
|
652
|
-
regex : "TODO"
|
653
|
-
}, {
|
654
|
-
token : "comment.doc",
|
655
|
-
merge : true,
|
656
|
-
regex : "[^@\\*]+"
|
482
|
+
token : "comment.doc.tag",
|
483
|
+
regex : "\\bTODO\\b"
|
657
484
|
}, {
|
658
|
-
|
659
|
-
merge : true,
|
660
|
-
regex : "."
|
485
|
+
defaultToken : "comment.doc"
|
661
486
|
}]
|
662
487
|
};
|
663
488
|
};
|
@@ -667,7 +492,6 @@ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
|
667
492
|
DocCommentHighlightRules.getStartRule = function(start) {
|
668
493
|
return {
|
669
494
|
token : "comment.doc", // doc comment
|
670
|
-
merge : true,
|
671
495
|
regex : "\\/\\*(?=\\*)",
|
672
496
|
next : start
|
673
497
|
};
|
@@ -676,7 +500,6 @@ DocCommentHighlightRules.getStartRule = function(start) {
|
|
676
500
|
DocCommentHighlightRules.getEndRule = function (start) {
|
677
501
|
return {
|
678
502
|
token : "comment.doc", // closing comment
|
679
|
-
merge : true,
|
680
503
|
regex : "\\*\\/",
|
681
504
|
next : start
|
682
505
|
};
|
@@ -719,12 +542,7 @@ var MatchingBraceOutdent = function() {};
|
|
719
542
|
};
|
720
543
|
|
721
544
|
this.$getIndent = function(line) {
|
722
|
-
|
723
|
-
if (match) {
|
724
|
-
return match[1];
|
725
|
-
}
|
726
|
-
|
727
|
-
return "";
|
545
|
+
return line.match(/^\s*/)[0];
|
728
546
|
};
|
729
547
|
|
730
548
|
}).call(MatchingBraceOutdent.prototype);
|
@@ -732,59 +550,155 @@ var MatchingBraceOutdent = function() {};
|
|
732
550
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
733
551
|
});
|
734
552
|
|
735
|
-
define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour'], function(require, exports, module) {
|
553
|
+
define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
736
554
|
|
737
555
|
|
738
556
|
var oop = require("../../lib/oop");
|
739
557
|
var Behaviour = require("../behaviour").Behaviour;
|
558
|
+
var TokenIterator = require("../../token_iterator").TokenIterator;
|
559
|
+
var lang = require("../../lib/lang");
|
560
|
+
|
561
|
+
var SAFE_INSERT_IN_TOKENS =
|
562
|
+
["text", "paren.rparen", "punctuation.operator"];
|
563
|
+
var SAFE_INSERT_BEFORE_TOKENS =
|
564
|
+
["text", "paren.rparen", "punctuation.operator", "comment"];
|
565
|
+
|
566
|
+
|
567
|
+
var autoInsertedBrackets = 0;
|
568
|
+
var autoInsertedRow = -1;
|
569
|
+
var autoInsertedLineEnd = "";
|
570
|
+
var maybeInsertedBrackets = 0;
|
571
|
+
var maybeInsertedRow = -1;
|
572
|
+
var maybeInsertedLineStart = "";
|
573
|
+
var maybeInsertedLineEnd = "";
|
740
574
|
|
741
575
|
var CstyleBehaviour = function () {
|
576
|
+
|
577
|
+
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
578
|
+
var cursor = editor.getCursorPosition();
|
579
|
+
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
580
|
+
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
581
|
+
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
582
|
+
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
583
|
+
return false;
|
584
|
+
}
|
585
|
+
iterator.stepForward();
|
586
|
+
return iterator.getCurrentTokenRow() !== cursor.row ||
|
587
|
+
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
588
|
+
};
|
589
|
+
|
590
|
+
CstyleBehaviour.$matchTokenType = function(token, types) {
|
591
|
+
return types.indexOf(token.type || token) > -1;
|
592
|
+
};
|
593
|
+
|
594
|
+
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
595
|
+
var cursor = editor.getCursorPosition();
|
596
|
+
var line = session.doc.getLine(cursor.row);
|
597
|
+
if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
|
598
|
+
autoInsertedBrackets = 0;
|
599
|
+
autoInsertedRow = cursor.row;
|
600
|
+
autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
601
|
+
autoInsertedBrackets++;
|
602
|
+
};
|
603
|
+
|
604
|
+
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
605
|
+
var cursor = editor.getCursorPosition();
|
606
|
+
var line = session.doc.getLine(cursor.row);
|
607
|
+
if (!this.isMaybeInsertedClosing(cursor, line))
|
608
|
+
maybeInsertedBrackets = 0;
|
609
|
+
maybeInsertedRow = cursor.row;
|
610
|
+
maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
611
|
+
maybeInsertedLineEnd = line.substr(cursor.column);
|
612
|
+
maybeInsertedBrackets++;
|
613
|
+
};
|
614
|
+
|
615
|
+
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
616
|
+
return autoInsertedBrackets > 0 &&
|
617
|
+
cursor.row === autoInsertedRow &&
|
618
|
+
bracket === autoInsertedLineEnd[0] &&
|
619
|
+
line.substr(cursor.column) === autoInsertedLineEnd;
|
620
|
+
};
|
621
|
+
|
622
|
+
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
623
|
+
return maybeInsertedBrackets > 0 &&
|
624
|
+
cursor.row === maybeInsertedRow &&
|
625
|
+
line.substr(cursor.column) === maybeInsertedLineEnd &&
|
626
|
+
line.substr(0, cursor.column) == maybeInsertedLineStart;
|
627
|
+
};
|
628
|
+
|
629
|
+
CstyleBehaviour.popAutoInsertedClosing = function() {
|
630
|
+
autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
|
631
|
+
autoInsertedBrackets--;
|
632
|
+
};
|
633
|
+
|
634
|
+
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
635
|
+
maybeInsertedBrackets = 0;
|
636
|
+
maybeInsertedRow = -1;
|
637
|
+
};
|
742
638
|
|
743
639
|
this.add("braces", "insertion", function (state, action, editor, session, text) {
|
640
|
+
var cursor = editor.getCursorPosition();
|
641
|
+
var line = session.doc.getLine(cursor.row);
|
744
642
|
if (text == '{') {
|
745
643
|
var selection = editor.getSelectionRange();
|
746
644
|
var selected = session.doc.getTextRange(selection);
|
747
|
-
if (selected !== "") {
|
645
|
+
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
748
646
|
return {
|
749
647
|
text: '{' + selected + '}',
|
750
648
|
selection: false
|
751
649
|
};
|
752
|
-
} else {
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
650
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
651
|
+
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
652
|
+
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
653
|
+
return {
|
654
|
+
text: '{}',
|
655
|
+
selection: [1, 1]
|
656
|
+
};
|
657
|
+
} else {
|
658
|
+
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
659
|
+
return {
|
660
|
+
text: '{',
|
661
|
+
selection: [1, 1]
|
662
|
+
};
|
663
|
+
}
|
757
664
|
}
|
758
665
|
} else if (text == '}') {
|
759
|
-
var cursor = editor.getCursorPosition();
|
760
|
-
var line = session.doc.getLine(cursor.row);
|
761
666
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
762
667
|
if (rightChar == '}') {
|
763
668
|
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
764
|
-
if (matching !== null) {
|
669
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
670
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
765
671
|
return {
|
766
672
|
text: '',
|
767
673
|
selection: [1, 1]
|
768
674
|
};
|
769
675
|
}
|
770
676
|
}
|
771
|
-
} else if (text == "\n") {
|
772
|
-
var
|
773
|
-
|
677
|
+
} else if (text == "\n" || text == "\r\n") {
|
678
|
+
var closing = "";
|
679
|
+
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
680
|
+
closing = lang.stringRepeat("}", maybeInsertedBrackets);
|
681
|
+
CstyleBehaviour.clearMaybeInsertedClosing();
|
682
|
+
}
|
774
683
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
775
|
-
if (rightChar
|
776
|
-
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column
|
684
|
+
if (rightChar === '}') {
|
685
|
+
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
|
777
686
|
if (!openBracePos)
|
778
687
|
return null;
|
779
|
-
|
780
|
-
|
781
|
-
var next_indent = this.$getIndent(
|
782
|
-
|
783
|
-
return
|
784
|
-
text: '\n' + indent + '\n' + next_indent,
|
785
|
-
selection: [1, indent.length, 1, indent.length]
|
786
|
-
};
|
688
|
+
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
689
|
+
} else if (closing) {
|
690
|
+
var next_indent = this.$getIndent(line);
|
691
|
+
} else {
|
692
|
+
return;
|
787
693
|
}
|
694
|
+
var indent = next_indent + session.getTabString();
|
695
|
+
|
696
|
+
return {
|
697
|
+
text: '\n' + indent + '\n' + next_indent + closing,
|
698
|
+
selection: [1, indent.length, 1, indent.length]
|
699
|
+
};
|
700
|
+
} else {
|
701
|
+
CstyleBehaviour.clearMaybeInsertedClosing();
|
788
702
|
}
|
789
703
|
});
|
790
704
|
|
@@ -796,6 +710,8 @@ var CstyleBehaviour = function () {
|
|
796
710
|
if (rightChar == '}') {
|
797
711
|
range.end.column++;
|
798
712
|
return range;
|
713
|
+
} else {
|
714
|
+
maybeInsertedBrackets--;
|
799
715
|
}
|
800
716
|
}
|
801
717
|
});
|
@@ -804,12 +720,13 @@ var CstyleBehaviour = function () {
|
|
804
720
|
if (text == '(') {
|
805
721
|
var selection = editor.getSelectionRange();
|
806
722
|
var selected = session.doc.getTextRange(selection);
|
807
|
-
if (selected !== "") {
|
723
|
+
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
808
724
|
return {
|
809
725
|
text: '(' + selected + ')',
|
810
726
|
selection: false
|
811
727
|
};
|
812
|
-
} else {
|
728
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
729
|
+
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
813
730
|
return {
|
814
731
|
text: '()',
|
815
732
|
selection: [1, 1]
|
@@ -821,7 +738,8 @@ var CstyleBehaviour = function () {
|
|
821
738
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
822
739
|
if (rightChar == ')') {
|
823
740
|
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
824
|
-
if (matching !== null) {
|
741
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
742
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
825
743
|
return {
|
826
744
|
text: '',
|
827
745
|
selection: [1, 1]
|
@@ -847,12 +765,13 @@ var CstyleBehaviour = function () {
|
|
847
765
|
if (text == '[') {
|
848
766
|
var selection = editor.getSelectionRange();
|
849
767
|
var selected = session.doc.getTextRange(selection);
|
850
|
-
if (selected !== "") {
|
768
|
+
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
851
769
|
return {
|
852
770
|
text: '[' + selected + ']',
|
853
771
|
selection: false
|
854
772
|
};
|
855
|
-
} else {
|
773
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
774
|
+
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
856
775
|
return {
|
857
776
|
text: '[]',
|
858
777
|
selection: [1, 1]
|
@@ -864,7 +783,8 @@ var CstyleBehaviour = function () {
|
|
864
783
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
865
784
|
if (rightChar == ']') {
|
866
785
|
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
867
|
-
if (matching !== null) {
|
786
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
787
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
868
788
|
return {
|
869
789
|
text: '',
|
870
790
|
selection: [1, 1]
|
@@ -891,7 +811,7 @@ var CstyleBehaviour = function () {
|
|
891
811
|
var quote = text;
|
892
812
|
var selection = editor.getSelectionRange();
|
893
813
|
var selected = session.doc.getTextRange(selection);
|
894
|
-
if (selected !== "") {
|
814
|
+
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
895
815
|
return {
|
896
816
|
text: quote + selected + quote,
|
897
817
|
selection: false
|
@@ -900,13 +820,9 @@ var CstyleBehaviour = function () {
|
|
900
820
|
var cursor = editor.getCursorPosition();
|
901
821
|
var line = session.doc.getLine(cursor.row);
|
902
822
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
903
|
-
|
904
|
-
// We're escaped.
|
905
823
|
if (leftChar == '\\') {
|
906
824
|
return null;
|
907
825
|
}
|
908
|
-
|
909
|
-
// Find what token we're inside.
|
910
826
|
var tokens = session.getTokens(selection.start.row);
|
911
827
|
var col = 0, token;
|
912
828
|
var quotepos = -1; // Track whether we're inside an open quote.
|
@@ -923,15 +839,14 @@ var CstyleBehaviour = function () {
|
|
923
839
|
}
|
924
840
|
col += tokens[x].value.length;
|
925
841
|
}
|
926
|
-
|
927
|
-
// Try and be smart about when we auto insert.
|
928
842
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
843
|
+
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
844
|
+
return;
|
929
845
|
return {
|
930
846
|
text: quote + quote,
|
931
847
|
selection: [1,1]
|
932
848
|
};
|
933
849
|
} else if (token && token.type === "string") {
|
934
|
-
// Ignore input and move right one if we're typing over the closing quote.
|
935
850
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
936
851
|
if (rightChar == quote) {
|
937
852
|
return {
|
@@ -949,7 +864,7 @@ var CstyleBehaviour = function () {
|
|
949
864
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
950
865
|
var line = session.doc.getLine(range.start.row);
|
951
866
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
952
|
-
if (rightChar ==
|
867
|
+
if (rightChar == selected) {
|
953
868
|
range.end.column++;
|
954
869
|
return range;
|
955
870
|
}
|
@@ -970,15 +885,24 @@ var oop = require("../../lib/oop");
|
|
970
885
|
var Range = require("../../range").Range;
|
971
886
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
972
887
|
|
973
|
-
var FoldMode = exports.FoldMode = function() {
|
888
|
+
var FoldMode = exports.FoldMode = function(commentRegex) {
|
889
|
+
if (commentRegex) {
|
890
|
+
this.foldingStartMarker = new RegExp(
|
891
|
+
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
892
|
+
);
|
893
|
+
this.foldingStopMarker = new RegExp(
|
894
|
+
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
895
|
+
);
|
896
|
+
}
|
897
|
+
};
|
974
898
|
oop.inherits(FoldMode, BaseFoldMode);
|
975
899
|
|
976
900
|
(function() {
|
977
901
|
|
978
902
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
979
903
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
980
|
-
|
981
|
-
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
904
|
+
|
905
|
+
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
982
906
|
var line = session.getLine(row);
|
983
907
|
var match = line.match(this.foldingStartMarker);
|
984
908
|
if (match) {
|
@@ -986,122 +910,70 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|
986
910
|
|
987
911
|
if (match[1])
|
988
912
|
return this.openingBracketBlock(session, match[1], row, i);
|
989
|
-
|
990
|
-
var range = session.getCommentFoldRange(row, i + match[0].length);
|
991
|
-
|
913
|
+
|
914
|
+
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
915
|
+
|
916
|
+
if (range && !range.isMultiLine()) {
|
917
|
+
if (forceMultiline) {
|
918
|
+
range = this.getSectionRange(session, row);
|
919
|
+
} else if (foldStyle != "all")
|
920
|
+
range = null;
|
921
|
+
}
|
922
|
+
|
992
923
|
return range;
|
993
924
|
}
|
994
925
|
|
995
|
-
if (foldStyle
|
926
|
+
if (foldStyle === "markbegin")
|
996
927
|
return;
|
997
|
-
|
928
|
+
|
998
929
|
var match = line.match(this.foldingStopMarker);
|
999
930
|
if (match) {
|
1000
931
|
var i = match.index + match[0].length;
|
1001
932
|
|
1002
|
-
if (match[
|
1003
|
-
|
1004
|
-
range.end.column -= 2;
|
1005
|
-
return range;
|
1006
|
-
}
|
1007
|
-
|
1008
|
-
var end = {row: row, column: i};
|
1009
|
-
var start = session.$findOpeningBracket(match[1], end);
|
1010
|
-
|
1011
|
-
if (!start)
|
1012
|
-
return;
|
1013
|
-
|
1014
|
-
start.column++;
|
1015
|
-
end.column--;
|
933
|
+
if (match[1])
|
934
|
+
return this.closingBracketBlock(session, match[1], row, i);
|
1016
935
|
|
1017
|
-
return
|
936
|
+
return session.getCommentFoldRange(row, i, -1);
|
1018
937
|
}
|
1019
938
|
};
|
1020
939
|
|
1021
|
-
|
1022
|
-
|
1023
|
-
});
|
1024
|
-
|
1025
|
-
define('ace/mode/folding/fold_mode', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
1026
|
-
|
1027
|
-
|
1028
|
-
var Range = require("../../range").Range;
|
1029
|
-
|
1030
|
-
var FoldMode = exports.FoldMode = function() {};
|
1031
|
-
|
1032
|
-
(function() {
|
1033
|
-
|
1034
|
-
this.foldingStartMarker = null;
|
1035
|
-
this.foldingStopMarker = null;
|
1036
|
-
|
1037
|
-
// must return "" if there's no fold, to enable caching
|
1038
|
-
this.getFoldWidget = function(session, foldStyle, row) {
|
1039
|
-
var line = session.getLine(row);
|
1040
|
-
if (this.foldingStartMarker.test(line))
|
1041
|
-
return "start";
|
1042
|
-
if (foldStyle == "markbeginend"
|
1043
|
-
&& this.foldingStopMarker
|
1044
|
-
&& this.foldingStopMarker.test(line))
|
1045
|
-
return "end";
|
1046
|
-
return "";
|
1047
|
-
};
|
1048
|
-
|
1049
|
-
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
1050
|
-
return null;
|
1051
|
-
};
|
1052
|
-
|
1053
|
-
this.indentationBlock = function(session, row, column) {
|
1054
|
-
var re = /\S/;
|
940
|
+
this.getSectionRange = function(session, row) {
|
1055
941
|
var line = session.getLine(row);
|
1056
|
-
var
|
1057
|
-
if (startLevel == -1)
|
1058
|
-
return;
|
1059
|
-
|
1060
|
-
var startColumn = column || line.length;
|
1061
|
-
var maxRow = session.getLength();
|
942
|
+
var startIndent = line.search(/\S/);
|
1062
943
|
var startRow = row;
|
944
|
+
var startColumn = line.length;
|
945
|
+
row = row + 1;
|
1063
946
|
var endRow = row;
|
1064
|
-
|
947
|
+
var maxRow = session.getLength();
|
1065
948
|
while (++row < maxRow) {
|
1066
|
-
|
1067
|
-
|
1068
|
-
if (
|
949
|
+
line = session.getLine(row);
|
950
|
+
var indent = line.search(/\S/);
|
951
|
+
if (indent === -1)
|
1069
952
|
continue;
|
1070
|
-
|
1071
|
-
if (level <= startLevel)
|
953
|
+
if (startIndent > indent)
|
1072
954
|
break;
|
1073
|
-
|
955
|
+
var subRange = this.getFoldWidgetRange(session, "all", row);
|
956
|
+
|
957
|
+
if (subRange) {
|
958
|
+
if (subRange.start.row <= startRow) {
|
959
|
+
break;
|
960
|
+
} else if (subRange.isMultiLine()) {
|
961
|
+
row = subRange.end.row;
|
962
|
+
} else if (startIndent == indent) {
|
963
|
+
break;
|
964
|
+
}
|
965
|
+
}
|
1074
966
|
endRow = row;
|
1075
967
|
}
|
1076
|
-
|
1077
|
-
|
1078
|
-
var endColumn = session.getLine(endRow).length;
|
1079
|
-
return new Range(startRow, startColumn, endRow, endColumn);
|
1080
|
-
}
|
1081
|
-
};
|
1082
|
-
|
1083
|
-
this.openingBracketBlock = function(session, bracket, row, column, typeRe) {
|
1084
|
-
var start = {row: row, column: column + 1};
|
1085
|
-
var end = session.$findClosingBracket(bracket, start, typeRe);
|
1086
|
-
if (!end)
|
1087
|
-
return;
|
1088
|
-
|
1089
|
-
var fw = session.foldWidgets[end.row];
|
1090
|
-
if (fw == null)
|
1091
|
-
fw = this.getFoldWidget(session, end.row);
|
1092
|
-
|
1093
|
-
if (fw == "start" && end.row > start.row) {
|
1094
|
-
end.row --;
|
1095
|
-
end.column = session.getLine(end.row).length;
|
1096
|
-
}
|
1097
|
-
return Range.fromPoints(start, end);
|
968
|
+
|
969
|
+
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
1098
970
|
};
|
1099
971
|
|
1100
972
|
}).call(FoldMode.prototype);
|
1101
973
|
|
1102
974
|
});
|
1103
975
|
|
1104
|
-
define('ace/mode/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
976
|
+
define('ace/mode/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
1105
977
|
|
1106
978
|
|
1107
979
|
var oop = require("../lib/oop");
|
@@ -1110,11 +982,13 @@ var Tokenizer = require("../tokenizer").Tokenizer;
|
|
1110
982
|
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
|
1111
983
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
1112
984
|
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
985
|
+
var CssBehaviour = require("./behaviour/css").CssBehaviour;
|
1113
986
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
1114
987
|
|
1115
988
|
var Mode = function() {
|
1116
|
-
this
|
989
|
+
this.HighlightRules = CssHighlightRules;
|
1117
990
|
this.$outdent = new MatchingBraceOutdent();
|
991
|
+
this.$behaviour = new CssBehaviour();
|
1118
992
|
this.foldingRules = new CStyleFoldMode();
|
1119
993
|
};
|
1120
994
|
oop.inherits(Mode, TextMode);
|
@@ -1122,12 +996,11 @@ oop.inherits(Mode, TextMode);
|
|
1122
996
|
(function() {
|
1123
997
|
|
1124
998
|
this.foldingRules = "cStyle";
|
999
|
+
this.blockComment = {start: "/*", end: "*/"};
|
1125
1000
|
|
1126
1001
|
this.getNextLineIndent = function(state, line, tab) {
|
1127
1002
|
var indent = this.$getIndent(line);
|
1128
|
-
|
1129
|
-
// ignore braces in comments
|
1130
|
-
var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
|
1003
|
+
var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
|
1131
1004
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
1132
1005
|
return indent;
|
1133
1006
|
}
|
@@ -1147,28 +1020,23 @@ oop.inherits(Mode, TextMode);
|
|
1147
1020
|
this.autoOutdent = function(state, doc, row) {
|
1148
1021
|
this.$outdent.autoOutdent(doc, row);
|
1149
1022
|
};
|
1150
|
-
|
1023
|
+
|
1151
1024
|
this.createWorker = function(session) {
|
1152
1025
|
var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
|
1153
1026
|
worker.attachToDocument(session.getDocument());
|
1154
|
-
|
1027
|
+
|
1155
1028
|
worker.on("csslint", function(e) {
|
1156
|
-
|
1157
|
-
e.data.forEach(function(message) {
|
1158
|
-
errors.push({
|
1159
|
-
row: message.line - 1,
|
1160
|
-
column: message.col - 1,
|
1161
|
-
text: message.message,
|
1162
|
-
type: message.type,
|
1163
|
-
lint: message
|
1164
|
-
});
|
1165
|
-
});
|
1166
|
-
|
1167
|
-
session.setAnnotations(errors);
|
1029
|
+
session.setAnnotations(e.data);
|
1168
1030
|
});
|
1031
|
+
|
1032
|
+
worker.on("terminate", function() {
|
1033
|
+
session.clearAnnotations();
|
1034
|
+
});
|
1035
|
+
|
1169
1036
|
return worker;
|
1170
1037
|
};
|
1171
1038
|
|
1039
|
+
this.$id = "ace/mode/css";
|
1172
1040
|
}).call(Mode.prototype);
|
1173
1041
|
|
1174
1042
|
exports.Mode = Mode;
|
@@ -1181,198 +1049,136 @@ define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/li
|
|
1181
1049
|
var oop = require("../lib/oop");
|
1182
1050
|
var lang = require("../lib/lang");
|
1183
1051
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
1052
|
+
var supportType = exports.supportType = "animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index";
|
1053
|
+
var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
|
1054
|
+
var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero";
|
1055
|
+
var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
|
1056
|
+
var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
|
1184
1057
|
|
1185
|
-
var
|
1186
|
-
|
1187
|
-
|
1188
|
-
("animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index").split("|")
|
1189
|
-
);
|
1190
|
-
|
1191
|
-
var functions = lang.arrayToMap(
|
1192
|
-
("rgb|rgba|url|attr|counter|counters").split("|")
|
1193
|
-
);
|
1194
|
-
|
1195
|
-
var constants = lang.arrayToMap(
|
1196
|
-
("absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|font-size|font|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|")
|
1197
|
-
);
|
1198
|
-
|
1199
|
-
var colors = lang.arrayToMap(
|
1200
|
-
("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
|
1201
|
-
"purple|red|silver|teal|white|yellow").split("|")
|
1202
|
-
);
|
1203
|
-
|
1204
|
-
var fonts = lang.arrayToMap(
|
1205
|
-
("arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|" +
|
1206
|
-
"symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|" +
|
1207
|
-
"serif|monospace").split("|")
|
1208
|
-
);
|
1209
|
-
|
1210
|
-
// regexp must not have capturing parentheses. Use (?:) instead.
|
1211
|
-
// regexps are ordered -> the first match is used
|
1212
|
-
|
1213
|
-
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
1214
|
-
var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
|
1215
|
-
var pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
|
1216
|
-
|
1217
|
-
var base_ruleset = [
|
1218
|
-
{
|
1219
|
-
token : "comment", // multi line comment
|
1220
|
-
merge : true,
|
1221
|
-
regex : "\\/\\*",
|
1222
|
-
next : "ruleset_comment"
|
1223
|
-
}, {
|
1224
|
-
token : "string", // single line
|
1225
|
-
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
1226
|
-
}, {
|
1227
|
-
token : "string", // single line
|
1228
|
-
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
1229
|
-
}, {
|
1230
|
-
token : ["constant.numeric", "keyword"],
|
1231
|
-
regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
|
1232
|
-
}, {
|
1233
|
-
token : ["constant.numeric"],
|
1234
|
-
regex : "([0-9]+)"
|
1235
|
-
}, {
|
1236
|
-
token : "constant.numeric", // hex6 color
|
1237
|
-
regex : "#[a-f0-9]{6}"
|
1238
|
-
}, {
|
1239
|
-
token : "constant.numeric", // hex3 color
|
1240
|
-
regex : "#[a-f0-9]{3}"
|
1241
|
-
}, {
|
1242
|
-
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
|
1243
|
-
regex : pseudoElements
|
1244
|
-
}, {
|
1245
|
-
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
|
1246
|
-
regex : pseudoClasses
|
1247
|
-
}, {
|
1248
|
-
token : function(value) {
|
1249
|
-
if (properties.hasOwnProperty(value.toLowerCase())) {
|
1250
|
-
return "support.type";
|
1251
|
-
}
|
1252
|
-
else if (functions.hasOwnProperty(value.toLowerCase())) {
|
1253
|
-
return "support.function";
|
1254
|
-
}
|
1255
|
-
else if (constants.hasOwnProperty(value.toLowerCase())) {
|
1256
|
-
return "support.constant";
|
1257
|
-
}
|
1258
|
-
else if (colors.hasOwnProperty(value.toLowerCase())) {
|
1259
|
-
return "support.constant.color";
|
1260
|
-
}
|
1261
|
-
else if (fonts.hasOwnProperty(value.toLowerCase())) {
|
1262
|
-
return "support.constant.fonts";
|
1263
|
-
}
|
1264
|
-
else {
|
1265
|
-
return "text";
|
1266
|
-
}
|
1267
|
-
},
|
1268
|
-
regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
|
1269
|
-
}
|
1270
|
-
];
|
1271
|
-
|
1272
|
-
var ruleset = lang.copyArray(base_ruleset);
|
1273
|
-
ruleset.unshift({
|
1274
|
-
token : "paren.rparen",
|
1275
|
-
regex : "\\}",
|
1276
|
-
next: "start"
|
1277
|
-
});
|
1058
|
+
var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
1059
|
+
var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
|
1060
|
+
var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
|
1278
1061
|
|
1279
|
-
|
1280
|
-
media_ruleset.unshift({
|
1281
|
-
token : "paren.rparen",
|
1282
|
-
regex : "\\}",
|
1283
|
-
next: "media"
|
1284
|
-
});
|
1285
|
-
|
1286
|
-
var base_comment = [{
|
1287
|
-
token : "comment", // comment spanning whole line
|
1288
|
-
merge : true,
|
1289
|
-
regex : ".+"
|
1290
|
-
}];
|
1291
|
-
|
1292
|
-
var comment = lang.copyArray(base_comment);
|
1293
|
-
comment.unshift({
|
1294
|
-
token : "comment", // closing comment
|
1295
|
-
regex : ".*?\\*\\/",
|
1296
|
-
next : "start"
|
1297
|
-
});
|
1298
|
-
|
1299
|
-
var media_comment = lang.copyArray(base_comment);
|
1300
|
-
media_comment.unshift({
|
1301
|
-
token : "comment", // closing comment
|
1302
|
-
regex : ".*?\\*\\/",
|
1303
|
-
next : "media"
|
1304
|
-
});
|
1062
|
+
var CssHighlightRules = function() {
|
1305
1063
|
|
1306
|
-
var
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1064
|
+
var keywordMapper = this.createKeywordMapper({
|
1065
|
+
"support.function": supportFunction,
|
1066
|
+
"support.constant": supportConstant,
|
1067
|
+
"support.type": supportType,
|
1068
|
+
"support.constant.color": supportConstantColor,
|
1069
|
+
"support.constant.fonts": supportConstantFonts
|
1070
|
+
}, "text", true);
|
1312
1071
|
|
1313
1072
|
this.$rules = {
|
1314
1073
|
"start" : [{
|
1315
1074
|
token : "comment", // multi line comment
|
1316
|
-
merge : true,
|
1317
1075
|
regex : "\\/\\*",
|
1318
|
-
|
1076
|
+
push : "comment"
|
1319
1077
|
}, {
|
1320
1078
|
token: "paren.lparen",
|
1321
1079
|
regex: "\\{",
|
1322
|
-
|
1080
|
+
push: "ruleset"
|
1323
1081
|
}, {
|
1324
1082
|
token: "string",
|
1325
1083
|
regex: "@.*?{",
|
1326
|
-
|
1327
|
-
},{
|
1084
|
+
push: "media"
|
1085
|
+
}, {
|
1328
1086
|
token: "keyword",
|
1329
1087
|
regex: "#[a-z0-9-_]+"
|
1330
|
-
},{
|
1088
|
+
}, {
|
1331
1089
|
token: "variable",
|
1332
1090
|
regex: "\\.[a-z0-9-_]+"
|
1333
|
-
},{
|
1091
|
+
}, {
|
1334
1092
|
token: "string",
|
1335
1093
|
regex: ":[a-z0-9-_]+"
|
1336
|
-
},{
|
1094
|
+
}, {
|
1337
1095
|
token: "constant",
|
1338
1096
|
regex: "[a-z0-9-_]+"
|
1097
|
+
}, {
|
1098
|
+
caseInsensitive: true
|
1339
1099
|
}],
|
1340
1100
|
|
1341
|
-
"media" : [
|
1101
|
+
"media" : [{
|
1342
1102
|
token : "comment", // multi line comment
|
1343
|
-
merge : true,
|
1344
1103
|
regex : "\\/\\*",
|
1345
|
-
|
1104
|
+
push : "comment"
|
1346
1105
|
}, {
|
1347
1106
|
token: "paren.lparen",
|
1348
1107
|
regex: "\\{",
|
1349
|
-
|
1350
|
-
},{
|
1108
|
+
push: "ruleset"
|
1109
|
+
}, {
|
1351
1110
|
token: "string",
|
1352
1111
|
regex: "\\}",
|
1353
|
-
next: "
|
1354
|
-
},{
|
1112
|
+
next: "pop"
|
1113
|
+
}, {
|
1355
1114
|
token: "keyword",
|
1356
1115
|
regex: "#[a-z0-9-_]+"
|
1357
|
-
},{
|
1116
|
+
}, {
|
1358
1117
|
token: "variable",
|
1359
1118
|
regex: "\\.[a-z0-9-_]+"
|
1360
|
-
},{
|
1119
|
+
}, {
|
1361
1120
|
token: "string",
|
1362
1121
|
regex: ":[a-z0-9-_]+"
|
1363
|
-
},{
|
1122
|
+
}, {
|
1364
1123
|
token: "constant",
|
1365
1124
|
regex: "[a-z0-9-_]+"
|
1125
|
+
}, {
|
1126
|
+
caseInsensitive: true
|
1366
1127
|
}],
|
1367
1128
|
|
1368
|
-
"comment" :
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1129
|
+
"comment" : [{
|
1130
|
+
token : "comment",
|
1131
|
+
regex : "\\*\\/",
|
1132
|
+
next : "pop"
|
1133
|
+
}, {
|
1134
|
+
defaultToken : "comment"
|
1135
|
+
}],
|
1372
1136
|
|
1373
|
-
"
|
1374
|
-
|
1137
|
+
"ruleset" : [
|
1138
|
+
{
|
1139
|
+
token : "paren.rparen",
|
1140
|
+
regex : "\\}",
|
1141
|
+
next: "pop"
|
1142
|
+
}, {
|
1143
|
+
token : "comment", // multi line comment
|
1144
|
+
regex : "\\/\\*",
|
1145
|
+
push : "comment"
|
1146
|
+
}, {
|
1147
|
+
token : "string", // single line
|
1148
|
+
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
1149
|
+
}, {
|
1150
|
+
token : "string", // single line
|
1151
|
+
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
1152
|
+
}, {
|
1153
|
+
token : ["constant.numeric", "keyword"],
|
1154
|
+
regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
|
1155
|
+
}, {
|
1156
|
+
token : "constant.numeric",
|
1157
|
+
regex : numRe
|
1158
|
+
}, {
|
1159
|
+
token : "constant.numeric", // hex6 color
|
1160
|
+
regex : "#[a-f0-9]{6}"
|
1161
|
+
}, {
|
1162
|
+
token : "constant.numeric", // hex3 color
|
1163
|
+
regex : "#[a-f0-9]{3}"
|
1164
|
+
}, {
|
1165
|
+
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
|
1166
|
+
regex : pseudoElements
|
1167
|
+
}, {
|
1168
|
+
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
|
1169
|
+
regex : pseudoClasses
|
1170
|
+
}, {
|
1171
|
+
token : ["support.function", "string", "support.function"],
|
1172
|
+
regex : "(url\\()(.*)(\\))"
|
1173
|
+
}, {
|
1174
|
+
token : keywordMapper,
|
1175
|
+
regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
|
1176
|
+
}, {
|
1177
|
+
caseInsensitive: true
|
1178
|
+
}]
|
1375
1179
|
};
|
1180
|
+
|
1181
|
+
this.normalizeRules();
|
1376
1182
|
};
|
1377
1183
|
|
1378
1184
|
oop.inherits(CssHighlightRules, TextHighlightRules);
|
@@ -1381,15 +1187,93 @@ exports.CssHighlightRules = CssHighlightRules;
|
|
1381
1187
|
|
1382
1188
|
});
|
1383
1189
|
|
1384
|
-
define('ace/mode/
|
1190
|
+
define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) {
|
1191
|
+
|
1192
|
+
|
1193
|
+
var oop = require("../../lib/oop");
|
1194
|
+
var Behaviour = require("../behaviour").Behaviour;
|
1195
|
+
var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
|
1196
|
+
var TokenIterator = require("../../token_iterator").TokenIterator;
|
1197
|
+
|
1198
|
+
var CssBehaviour = function () {
|
1199
|
+
|
1200
|
+
this.inherit(CstyleBehaviour);
|
1201
|
+
|
1202
|
+
this.add("colon", "insertion", function (state, action, editor, session, text) {
|
1203
|
+
if (text === ':') {
|
1204
|
+
var cursor = editor.getCursorPosition();
|
1205
|
+
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
1206
|
+
var token = iterator.getCurrentToken();
|
1207
|
+
if (token && token.value.match(/\s+/)) {
|
1208
|
+
token = iterator.stepBackward();
|
1209
|
+
}
|
1210
|
+
if (token && token.type === 'support.type') {
|
1211
|
+
var line = session.doc.getLine(cursor.row);
|
1212
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
1213
|
+
if (rightChar === ':') {
|
1214
|
+
return {
|
1215
|
+
text: '',
|
1216
|
+
selection: [1, 1]
|
1217
|
+
}
|
1218
|
+
}
|
1219
|
+
if (!line.substring(cursor.column).match(/^\s*;/)) {
|
1220
|
+
return {
|
1221
|
+
text: ':;',
|
1222
|
+
selection: [1, 1]
|
1223
|
+
}
|
1224
|
+
}
|
1225
|
+
}
|
1226
|
+
}
|
1227
|
+
});
|
1228
|
+
|
1229
|
+
this.add("colon", "deletion", function (state, action, editor, session, range) {
|
1230
|
+
var selected = session.doc.getTextRange(range);
|
1231
|
+
if (!range.isMultiLine() && selected === ':') {
|
1232
|
+
var cursor = editor.getCursorPosition();
|
1233
|
+
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
1234
|
+
var token = iterator.getCurrentToken();
|
1235
|
+
if (token && token.value.match(/\s+/)) {
|
1236
|
+
token = iterator.stepBackward();
|
1237
|
+
}
|
1238
|
+
if (token && token.type === 'support.type') {
|
1239
|
+
var line = session.doc.getLine(range.start.row);
|
1240
|
+
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
1241
|
+
if (rightChar === ';') {
|
1242
|
+
range.end.column ++;
|
1243
|
+
return range;
|
1244
|
+
}
|
1245
|
+
}
|
1246
|
+
}
|
1247
|
+
});
|
1248
|
+
|
1249
|
+
this.add("semicolon", "insertion", function (state, action, editor, session, text) {
|
1250
|
+
if (text === ';') {
|
1251
|
+
var cursor = editor.getCursorPosition();
|
1252
|
+
var line = session.doc.getLine(cursor.row);
|
1253
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
1254
|
+
if (rightChar === ';') {
|
1255
|
+
return {
|
1256
|
+
text: '',
|
1257
|
+
selection: [1, 1]
|
1258
|
+
}
|
1259
|
+
}
|
1260
|
+
}
|
1261
|
+
});
|
1262
|
+
|
1263
|
+
}
|
1264
|
+
oop.inherits(CssBehaviour, CstyleBehaviour);
|
1265
|
+
|
1266
|
+
exports.CssBehaviour = CssBehaviour;
|
1267
|
+
});
|
1268
|
+
|
1269
|
+
define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules'], function(require, exports, module) {
|
1385
1270
|
|
1386
1271
|
|
1387
1272
|
var oop = require("../lib/oop");
|
1388
1273
|
var lang = require("../lib/lang");
|
1389
1274
|
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
|
1390
1275
|
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
|
1391
|
-
var
|
1392
|
-
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
1276
|
+
var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
|
1393
1277
|
|
1394
1278
|
var tagMap = lang.createMap({
|
1395
1279
|
a : 'anchor',
|
@@ -1398,6 +1282,7 @@ var tagMap = lang.createMap({
|
|
1398
1282
|
img : 'image',
|
1399
1283
|
input : 'form',
|
1400
1284
|
label : 'form',
|
1285
|
+
option : 'form',
|
1401
1286
|
script : 'script',
|
1402
1287
|
select : 'form',
|
1403
1288
|
textarea : 'form',
|
@@ -1411,98 +1296,255 @@ var tagMap = lang.createMap({
|
|
1411
1296
|
});
|
1412
1297
|
|
1413
1298
|
var HtmlHighlightRules = function() {
|
1299
|
+
XmlHighlightRules.call(this);
|
1414
1300
|
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
start : [{
|
1419
|
-
token : "text",
|
1420
|
-
merge : true,
|
1421
|
-
regex : "<\\!\\[CDATA\\[",
|
1422
|
-
next : "cdata"
|
1301
|
+
this.addRules({
|
1302
|
+
attributes: [{
|
1303
|
+
include : "space"
|
1423
1304
|
}, {
|
1424
|
-
token : "
|
1425
|
-
regex : "
|
1305
|
+
token : "entity.other.attribute-name",
|
1306
|
+
regex : "[-_a-zA-Z0-9:]+"
|
1426
1307
|
}, {
|
1427
|
-
token : "
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
regex : "<(?=\s*style\\b)",
|
1441
|
-
next : "style"
|
1308
|
+
token : "keyword.operator.separator",
|
1309
|
+
regex : "=",
|
1310
|
+
push : [{
|
1311
|
+
include: "space"
|
1312
|
+
}, {
|
1313
|
+
token : "string",
|
1314
|
+
regex : "[^<>='\"`\\s]+",
|
1315
|
+
next : "pop"
|
1316
|
+
}, {
|
1317
|
+
token : "empty",
|
1318
|
+
regex : "",
|
1319
|
+
next : "pop"
|
1320
|
+
}]
|
1442
1321
|
}, {
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1322
|
+
include : "string"
|
1323
|
+
}],
|
1324
|
+
tag: [{
|
1325
|
+
token : function(start, tag) {
|
1326
|
+
var group = tagMap[tag];
|
1327
|
+
return ["meta.tag.punctuation.begin",
|
1328
|
+
"meta.tag.name" + (group ? "." + group : "")];
|
1329
|
+
},
|
1330
|
+
regex : "(<)([-_a-zA-Z0-9:]+)",
|
1331
|
+
next: "start_tag_stuff"
|
1446
1332
|
}, {
|
1333
|
+
token : function(start, tag) {
|
1334
|
+
var group = tagMap[tag];
|
1335
|
+
return ["meta.tag.punctuation.begin",
|
1336
|
+
"meta.tag.name" + (group ? "." + group : "")];
|
1337
|
+
},
|
1338
|
+
regex : "(</)([-_a-zA-Z0-9:]+)",
|
1339
|
+
next: "end_tag_stuff"
|
1340
|
+
}],
|
1341
|
+
start_tag_stuff: [
|
1342
|
+
{include : "attributes"},
|
1343
|
+
{token : "meta.tag.punctuation.end", regex : "/?>", next : "start"}
|
1344
|
+
],
|
1345
|
+
end_tag_stuff: [
|
1346
|
+
{include : "space"},
|
1347
|
+
{token : "meta.tag.punctuation.end", regex : ">", next : "start"}
|
1348
|
+
]
|
1349
|
+
});
|
1350
|
+
|
1351
|
+
this.embedTagRules(CssHighlightRules, "css-", "style");
|
1352
|
+
this.embedTagRules(JavaScriptHighlightRules, "js-", "script");
|
1353
|
+
|
1354
|
+
if (this.constructor === HtmlHighlightRules)
|
1355
|
+
this.normalizeRules();
|
1356
|
+
};
|
1357
|
+
|
1358
|
+
oop.inherits(HtmlHighlightRules, XmlHighlightRules);
|
1359
|
+
|
1360
|
+
exports.HtmlHighlightRules = HtmlHighlightRules;
|
1361
|
+
});
|
1362
|
+
|
1363
|
+
define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
1364
|
+
|
1365
|
+
|
1366
|
+
var oop = require("../lib/oop");
|
1367
|
+
var xmlUtil = require("./xml_util");
|
1368
|
+
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
1369
|
+
|
1370
|
+
var XmlHighlightRules = function(normalize) {
|
1371
|
+
this.$rules = {
|
1372
|
+
start : [
|
1373
|
+
{token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"},
|
1374
|
+
{
|
1375
|
+
token : ["punctuation.instruction.begin", "keyword.instruction"],
|
1376
|
+
regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration"
|
1377
|
+
},
|
1378
|
+
{
|
1379
|
+
token : ["punctuation.instruction.begin", "keyword.instruction"],
|
1380
|
+
regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction"
|
1381
|
+
},
|
1382
|
+
{token : "comment", regex : "<\\!--", next : "comment"},
|
1383
|
+
{
|
1384
|
+
token : ["punctuation.doctype.begin", "meta.tag.doctype"],
|
1385
|
+
regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype"
|
1386
|
+
},
|
1387
|
+
{include : "tag"},
|
1388
|
+
{include : "reference"}
|
1389
|
+
],
|
1390
|
+
|
1391
|
+
xml_declaration : [
|
1392
|
+
{include : "attributes"},
|
1393
|
+
{include : "instruction"}
|
1394
|
+
],
|
1395
|
+
|
1396
|
+
instruction : [
|
1397
|
+
{token : "punctuation.instruction.end", regex : "\\?>", next : "start"}
|
1398
|
+
],
|
1399
|
+
|
1400
|
+
doctype : [
|
1401
|
+
{include : "space"},
|
1402
|
+
{include : "string"},
|
1403
|
+
{token : "punctuation.doctype.end", regex : ">", next : "start"},
|
1404
|
+
{token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"},
|
1405
|
+
{token : "punctuation.begin", regex : "\\[", push : "declarations"}
|
1406
|
+
],
|
1407
|
+
|
1408
|
+
declarations : [{
|
1447
1409
|
token : "text",
|
1448
1410
|
regex : "\\s+"
|
1449
1411
|
}, {
|
1450
|
-
token
|
1451
|
-
regex
|
1412
|
+
token: "punctuation.end",
|
1413
|
+
regex: "]",
|
1414
|
+
next: "pop"
|
1452
1415
|
}, {
|
1453
|
-
token : "
|
1454
|
-
regex : "[
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1416
|
+
token : ["punctuation.begin", "keyword"],
|
1417
|
+
regex : "(<\\!)([-_a-zA-Z0-9]+)",
|
1418
|
+
push : [{
|
1419
|
+
token : "text",
|
1420
|
+
regex : "\\s+"
|
1421
|
+
},
|
1422
|
+
{
|
1423
|
+
token : "punctuation.end",
|
1424
|
+
regex : ">",
|
1425
|
+
next : "pop"
|
1426
|
+
},
|
1427
|
+
{include : "string"}]
|
1428
|
+
}],
|
1429
|
+
|
1430
|
+
cdata : [
|
1431
|
+
{token : "string.end", regex : "\\]\\]>", next : "start"},
|
1432
|
+
{token : "text", regex : "\\s+"},
|
1433
|
+
{token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"}
|
1434
|
+
],
|
1435
|
+
|
1436
|
+
comment : [
|
1437
|
+
{token : "comment", regex : "-->", next : "start"},
|
1438
|
+
{defaultToken : "comment"}
|
1439
|
+
],
|
1440
|
+
|
1441
|
+
tag : [{
|
1442
|
+
token : ["meta.tag.punctuation.begin", "meta.tag.name"],
|
1443
|
+
regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)",
|
1444
|
+
next: [
|
1445
|
+
{include : "attributes"},
|
1446
|
+
{token : "meta.tag.punctuation.end", regex : "/?>", next : "start"}
|
1447
|
+
]
|
1448
|
+
}, {
|
1449
|
+
token : ["meta.tag.punctuation.begin", "meta.tag.name"],
|
1450
|
+
regex : "(</)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)",
|
1451
|
+
next: [
|
1452
|
+
{include : "space"},
|
1453
|
+
{token : "meta.tag.punctuation.end", regex : ">", next : "start"}
|
1454
|
+
]
|
1455
|
+
}],
|
1456
|
+
|
1457
|
+
space : [
|
1458
|
+
{token : "text", regex : "\\s+"}
|
1459
|
+
],
|
1460
|
+
|
1461
|
+
reference : [{
|
1462
|
+
token : "constant.language.escape",
|
1463
|
+
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
|
1461
1464
|
}, {
|
1462
|
-
token : "text",
|
1463
|
-
|
1464
|
-
|
1465
|
+
token : "text", regex : "&"
|
1466
|
+
}],
|
1467
|
+
|
1468
|
+
string: [{
|
1469
|
+
token : "string",
|
1470
|
+
regex : "'",
|
1471
|
+
push : "qstring_inner"
|
1465
1472
|
}, {
|
1466
|
-
token : "
|
1467
|
-
|
1468
|
-
|
1469
|
-
}
|
1473
|
+
token : "string",
|
1474
|
+
regex : '"',
|
1475
|
+
push : "qqstring_inner"
|
1476
|
+
}],
|
1470
1477
|
|
1471
|
-
|
1472
|
-
token : "
|
1473
|
-
|
1474
|
-
|
1478
|
+
qstring_inner: [
|
1479
|
+
{token : "string", regex: "'", next: "pop"},
|
1480
|
+
{include : "reference"},
|
1481
|
+
{defaultToken : "string"}
|
1482
|
+
],
|
1483
|
+
|
1484
|
+
qqstring_inner: [
|
1485
|
+
{token : "string", regex: '"', next: "pop"},
|
1486
|
+
{include : "reference"},
|
1487
|
+
{defaultToken : "string"}
|
1488
|
+
],
|
1489
|
+
|
1490
|
+
attributes: [{
|
1491
|
+
token : "entity.other.attribute-name",
|
1492
|
+
regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+"
|
1475
1493
|
}, {
|
1476
|
-
token : "
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1494
|
+
token : "keyword.operator.separator",
|
1495
|
+
regex : "="
|
1496
|
+
}, {
|
1497
|
+
include : "space"
|
1498
|
+
}, {
|
1499
|
+
include : "string"
|
1500
|
+
}]
|
1480
1501
|
};
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
xmlUtil.tag(this.$rules, "script", "js-start", tagMap);
|
1485
|
-
|
1486
|
-
this.embedRules(JavaScriptHighlightRules, "js-", [{
|
1487
|
-
token: "comment",
|
1488
|
-
regex: "\\/\\/.*(?=<\\/script>)",
|
1489
|
-
next: "tag"
|
1490
|
-
}, {
|
1491
|
-
token: "meta.tag",
|
1492
|
-
regex: "<\\/(?=script)",
|
1493
|
-
next: "tag"
|
1494
|
-
}]);
|
1495
|
-
|
1496
|
-
this.embedRules(CssHighlightRules, "css-", [{
|
1497
|
-
token: "meta.tag",
|
1498
|
-
regex: "<\\/(?=style)",
|
1499
|
-
next: "tag"
|
1500
|
-
}]);
|
1502
|
+
|
1503
|
+
if (this.constructor === XmlHighlightRules)
|
1504
|
+
this.normalizeRules();
|
1501
1505
|
};
|
1502
1506
|
|
1503
|
-
oop.inherits(HtmlHighlightRules, TextHighlightRules);
|
1504
1507
|
|
1505
|
-
|
1508
|
+
(function() {
|
1509
|
+
|
1510
|
+
this.embedTagRules = function(HighlightRules, prefix, tag){
|
1511
|
+
this.$rules.tag.unshift({
|
1512
|
+
token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag],
|
1513
|
+
regex : "(<)(" + tag + ")",
|
1514
|
+
next: [
|
1515
|
+
{include : "space"},
|
1516
|
+
{include : "attributes"},
|
1517
|
+
{token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"}
|
1518
|
+
]
|
1519
|
+
});
|
1520
|
+
|
1521
|
+
this.$rules[tag + "-end"] = [
|
1522
|
+
{include : "space"},
|
1523
|
+
{token : "meta.tag.punctuation.end", regex : ">", next: "start",
|
1524
|
+
onMatch : function(value, currentState, stack) {
|
1525
|
+
stack.splice(0);
|
1526
|
+
return this.token;
|
1527
|
+
}}
|
1528
|
+
]
|
1529
|
+
|
1530
|
+
this.embedRules(HighlightRules, prefix, [{
|
1531
|
+
token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag],
|
1532
|
+
regex : "(</)(" + tag + ")",
|
1533
|
+
next: tag + "-end"
|
1534
|
+
}, {
|
1535
|
+
token: "string.begin",
|
1536
|
+
regex : "<\\!\\[CDATA\\["
|
1537
|
+
}, {
|
1538
|
+
token: "string.end",
|
1539
|
+
regex : "\\]\\]>"
|
1540
|
+
}]);
|
1541
|
+
};
|
1542
|
+
|
1543
|
+
}).call(TextHighlightRules.prototype);
|
1544
|
+
|
1545
|
+
oop.inherits(XmlHighlightRules, TextHighlightRules);
|
1546
|
+
|
1547
|
+
exports.XmlHighlightRules = XmlHighlightRules;
|
1506
1548
|
});
|
1507
1549
|
|
1508
1550
|
define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) {
|
@@ -1511,34 +1553,24 @@ define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require,
|
|
1511
1553
|
function string(state) {
|
1512
1554
|
return [{
|
1513
1555
|
token : "string",
|
1514
|
-
regex : '"
|
1515
|
-
}, {
|
1516
|
-
token : "string", // multi line string start
|
1517
|
-
merge : true,
|
1518
|
-
regex : '["].*',
|
1556
|
+
regex : '"',
|
1519
1557
|
next : state + "_qqstring"
|
1520
1558
|
}, {
|
1521
1559
|
token : "string",
|
1522
|
-
regex : "'
|
1523
|
-
}, {
|
1524
|
-
token : "string", // multi line string start
|
1525
|
-
merge : true,
|
1526
|
-
regex : "['].*",
|
1560
|
+
regex : "'",
|
1527
1561
|
next : state + "_qstring"
|
1528
1562
|
}];
|
1529
1563
|
}
|
1530
1564
|
|
1531
1565
|
function multiLineString(quote, state) {
|
1532
|
-
return [
|
1533
|
-
token : "string",
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
regex : '.+'
|
1541
|
-
}];
|
1566
|
+
return [
|
1567
|
+
{token : "string", regex : quote, next : state},
|
1568
|
+
{
|
1569
|
+
token : "constant.language.escape",
|
1570
|
+
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
|
1571
|
+
},
|
1572
|
+
{defaultToken : "string"}
|
1573
|
+
];
|
1542
1574
|
}
|
1543
1575
|
|
1544
1576
|
exports.tag = function(states, name, nextState, tagMap) {
|
@@ -1546,7 +1578,6 @@ exports.tag = function(states, name, nextState, tagMap) {
|
|
1546
1578
|
token : "text",
|
1547
1579
|
regex : "\\s+"
|
1548
1580
|
}, {
|
1549
|
-
//token : "meta.tag",
|
1550
1581
|
|
1551
1582
|
token : !tagMap ? "meta.tag.tag-name" : function(value) {
|
1552
1583
|
if (tagMap[value])
|
@@ -1554,7 +1585,6 @@ exports.tag = function(states, name, nextState, tagMap) {
|
|
1554
1585
|
else
|
1555
1586
|
return "meta.tag.tag-name";
|
1556
1587
|
},
|
1557
|
-
merge : true,
|
1558
1588
|
regex : "[-_a-zA-Z0-9:]+",
|
1559
1589
|
next : name + "_embed_attribute_list"
|
1560
1590
|
}, {
|
@@ -1567,9 +1597,8 @@ exports.tag = function(states, name, nextState, tagMap) {
|
|
1567
1597
|
states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
|
1568
1598
|
|
1569
1599
|
states[name + "_embed_attribute_list"] = [{
|
1570
|
-
token : "meta.tag",
|
1571
|
-
|
1572
|
-
regex : "\/?>",
|
1600
|
+
token : "meta.tag.r",
|
1601
|
+
regex : "/?>",
|
1573
1602
|
next : nextState
|
1574
1603
|
}, {
|
1575
1604
|
token : "keyword.operator",
|
@@ -1598,14 +1627,9 @@ var TokenIterator = require("../../token_iterator").TokenIterator;
|
|
1598
1627
|
var voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
|
1599
1628
|
|
1600
1629
|
function hasType(token, type) {
|
1601
|
-
var
|
1602
|
-
|
1603
|
-
|
1604
|
-
needleList.forEach(function(needle){
|
1605
|
-
if (typeList.indexOf(needle) == -1) {
|
1606
|
-
hasType = false;
|
1607
|
-
return false;
|
1608
|
-
}
|
1630
|
+
var tokenTypes = token.type.split('.');
|
1631
|
+
return type.split('.').every(function(type){
|
1632
|
+
return (tokenTypes.indexOf(type) !== -1);
|
1609
1633
|
});
|
1610
1634
|
return hasType;
|
1611
1635
|
}
|
@@ -1619,6 +1643,9 @@ var HtmlBehaviour = function () {
|
|
1619
1643
|
var position = editor.getCursorPosition();
|
1620
1644
|
var iterator = new TokenIterator(session, position.row, position.column);
|
1621
1645
|
var token = iterator.getCurrentToken();
|
1646
|
+
|
1647
|
+
if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column)
|
1648
|
+
return;
|
1622
1649
|
var atCursor = false;
|
1623
1650
|
if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
|
1624
1651
|
do {
|
@@ -1627,8 +1654,8 @@ var HtmlBehaviour = function () {
|
|
1627
1654
|
} else {
|
1628
1655
|
atCursor = true;
|
1629
1656
|
}
|
1630
|
-
if (!token || !hasType(token, 'meta.tag
|
1631
|
-
return
|
1657
|
+
if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) {
|
1658
|
+
return;
|
1632
1659
|
}
|
1633
1660
|
var element = token.value;
|
1634
1661
|
if (atCursor){
|
@@ -1658,14 +1685,9 @@ var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
|
|
1658
1685
|
var TokenIterator = require("../../token_iterator").TokenIterator;
|
1659
1686
|
|
1660
1687
|
function hasType(token, type) {
|
1661
|
-
var
|
1662
|
-
|
1663
|
-
|
1664
|
-
needleList.forEach(function(needle){
|
1665
|
-
if (typeList.indexOf(needle) == -1) {
|
1666
|
-
hasType = false;
|
1667
|
-
return false;
|
1668
|
-
}
|
1688
|
+
var tokenTypes = token.type.split('.');
|
1689
|
+
return type.split('.').every(function(type){
|
1690
|
+
return (tokenTypes.indexOf(type) !== -1);
|
1669
1691
|
});
|
1670
1692
|
return hasType;
|
1671
1693
|
}
|
@@ -1679,6 +1701,9 @@ var XmlBehaviour = function () {
|
|
1679
1701
|
var position = editor.getCursorPosition();
|
1680
1702
|
var iterator = new TokenIterator(session, position.row, position.column);
|
1681
1703
|
var token = iterator.getCurrentToken();
|
1704
|
+
|
1705
|
+
if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column)
|
1706
|
+
return;
|
1682
1707
|
var atCursor = false;
|
1683
1708
|
if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
|
1684
1709
|
do {
|
@@ -1687,8 +1712,8 @@ var XmlBehaviour = function () {
|
|
1687
1712
|
} else {
|
1688
1713
|
atCursor = true;
|
1689
1714
|
}
|
1690
|
-
if (!token || !hasType(token, 'meta.tag
|
1691
|
-
return
|
1715
|
+
if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) {
|
1716
|
+
return;
|
1692
1717
|
}
|
1693
1718
|
var tag = token.value;
|
1694
1719
|
if (atCursor){
|
@@ -1705,11 +1730,11 @@ var XmlBehaviour = function () {
|
|
1705
1730
|
this.add('autoindent', 'insertion', function (state, action, editor, session, text) {
|
1706
1731
|
if (text == "\n") {
|
1707
1732
|
var cursor = editor.getCursorPosition();
|
1708
|
-
var line = session.
|
1733
|
+
var line = session.getLine(cursor.row);
|
1709
1734
|
var rightChars = line.substring(cursor.column, cursor.column + 2);
|
1710
1735
|
if (rightChars == '</') {
|
1711
|
-
var
|
1712
|
-
var
|
1736
|
+
var next_indent = this.$getIndent(line);
|
1737
|
+
var indent = next_indent + session.getTabString();
|
1713
1738
|
|
1714
1739
|
return {
|
1715
1740
|
text: '\n' + indent + '\n' + next_indent,
|
@@ -1735,7 +1760,6 @@ var CStyleFoldMode = require("./cstyle").FoldMode;
|
|
1735
1760
|
|
1736
1761
|
var FoldMode = exports.FoldMode = function() {
|
1737
1762
|
MixedFoldMode.call(this, new XmlFoldMode({
|
1738
|
-
// void elements
|
1739
1763
|
"area": 1,
|
1740
1764
|
"base": 1,
|
1741
1765
|
"br": 1,
|
@@ -1752,8 +1776,6 @@ var FoldMode = exports.FoldMode = function() {
|
|
1752
1776
|
"source": 1,
|
1753
1777
|
"track": 1,
|
1754
1778
|
"wbr": 1,
|
1755
|
-
|
1756
|
-
// optional tags
|
1757
1779
|
"li": 1,
|
1758
1780
|
"dt": 1,
|
1759
1781
|
"dd": 1,
|
@@ -1791,6 +1813,8 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|
1791
1813
|
|
1792
1814
|
|
1793
1815
|
this.$getMode = function(state) {
|
1816
|
+
if (typeof state != "string")
|
1817
|
+
state = state[0];
|
1794
1818
|
for (var key in this.subModes) {
|
1795
1819
|
if (state.indexOf(key) === 0)
|
1796
1820
|
return this.subModes[key];
|
@@ -1867,7 +1891,7 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|
1867
1891
|
var value = "";
|
1868
1892
|
for (var i = 0; i < tokens.length; i++) {
|
1869
1893
|
var token = tokens[i];
|
1870
|
-
if (token.type.
|
1894
|
+
if (token.type.lastIndexOf("meta.tag", 0) === 0)
|
1871
1895
|
value += token.value;
|
1872
1896
|
else
|
1873
1897
|
value += lang.stringRepeat(" ", token.value.length);
|
@@ -1879,9 +1903,8 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|
1879
1903
|
this.tagRe = /^(\s*)(<?(\/?)([-_a-zA-Z0-9:!]*)\s*(\/?)>?)/;
|
1880
1904
|
this._parseTag = function(tag) {
|
1881
1905
|
|
1882
|
-
var match = this.tagRe
|
1883
|
-
var column =
|
1884
|
-
this.tagRe.lastIndex = 0;
|
1906
|
+
var match = tag.match(this.tagRe);
|
1907
|
+
var column = 0;
|
1885
1908
|
|
1886
1909
|
return {
|
1887
1910
|
value: tag,
|
@@ -1901,7 +1924,7 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|
1901
1924
|
var start;
|
1902
1925
|
|
1903
1926
|
do {
|
1904
|
-
if (token.type.
|
1927
|
+
if (token.type.lastIndexOf("meta.tag", 0) === 0) {
|
1905
1928
|
if (!start) {
|
1906
1929
|
var start = {
|
1907
1930
|
row: iterator.getCurrentTokenRow(),
|
@@ -1934,7 +1957,7 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|
1934
1957
|
var end;
|
1935
1958
|
|
1936
1959
|
do {
|
1937
|
-
if (token.type.
|
1960
|
+
if (token.type.lastIndexOf("meta.tag", 0) === 0) {
|
1938
1961
|
if (!end) {
|
1939
1962
|
end = {
|
1940
1963
|
row: iterator.getCurrentTokenRow(),
|
@@ -2049,21 +2072,309 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|
2049
2072
|
|
2050
2073
|
});
|
2051
2074
|
|
2052
|
-
define('ace/mode/
|
2075
|
+
define('ace/mode/html_completions', ['require', 'exports', 'module' , 'ace/token_iterator'], function(require, exports, module) {
|
2076
|
+
|
2077
|
+
|
2078
|
+
var TokenIterator = require("../token_iterator").TokenIterator;
|
2079
|
+
|
2080
|
+
var commonAttributes = [
|
2081
|
+
"accesskey",
|
2082
|
+
"class",
|
2083
|
+
"contenteditable",
|
2084
|
+
"contextmenu",
|
2085
|
+
"dir",
|
2086
|
+
"draggable",
|
2087
|
+
"dropzone",
|
2088
|
+
"hidden",
|
2089
|
+
"id",
|
2090
|
+
"lang",
|
2091
|
+
"spellcheck",
|
2092
|
+
"style",
|
2093
|
+
"tabindex",
|
2094
|
+
"title",
|
2095
|
+
"translate"
|
2096
|
+
];
|
2097
|
+
|
2098
|
+
var eventAttributes = [
|
2099
|
+
"onabort",
|
2100
|
+
"onblur",
|
2101
|
+
"oncancel",
|
2102
|
+
"oncanplay",
|
2103
|
+
"oncanplaythrough",
|
2104
|
+
"onchange",
|
2105
|
+
"onclick",
|
2106
|
+
"onclose",
|
2107
|
+
"oncontextmenu",
|
2108
|
+
"oncuechange",
|
2109
|
+
"ondblclick",
|
2110
|
+
"ondrag",
|
2111
|
+
"ondragend",
|
2112
|
+
"ondragenter",
|
2113
|
+
"ondragleave",
|
2114
|
+
"ondragover",
|
2115
|
+
"ondragstart",
|
2116
|
+
"ondrop",
|
2117
|
+
"ondurationchange",
|
2118
|
+
"onemptied",
|
2119
|
+
"onended",
|
2120
|
+
"onerror",
|
2121
|
+
"onfocus",
|
2122
|
+
"oninput",
|
2123
|
+
"oninvalid",
|
2124
|
+
"onkeydown",
|
2125
|
+
"onkeypress",
|
2126
|
+
"onkeyup",
|
2127
|
+
"onload",
|
2128
|
+
"onloadeddata",
|
2129
|
+
"onloadedmetadata",
|
2130
|
+
"onloadstart",
|
2131
|
+
"onmousedown",
|
2132
|
+
"onmousemove",
|
2133
|
+
"onmouseout",
|
2134
|
+
"onmouseover",
|
2135
|
+
"onmouseup",
|
2136
|
+
"onmousewheel",
|
2137
|
+
"onpause",
|
2138
|
+
"onplay",
|
2139
|
+
"onplaying",
|
2140
|
+
"onprogress",
|
2141
|
+
"onratechange",
|
2142
|
+
"onreset",
|
2143
|
+
"onscroll",
|
2144
|
+
"onseeked",
|
2145
|
+
"onseeking",
|
2146
|
+
"onselect",
|
2147
|
+
"onshow",
|
2148
|
+
"onstalled",
|
2149
|
+
"onsubmit",
|
2150
|
+
"onsuspend",
|
2151
|
+
"ontimeupdate",
|
2152
|
+
"onvolumechange",
|
2153
|
+
"onwaiting"
|
2154
|
+
];
|
2155
|
+
|
2156
|
+
var globalAttributes = commonAttributes.concat(eventAttributes);
|
2157
|
+
|
2158
|
+
var attributeMap = {
|
2159
|
+
"html": ["manifest"],
|
2160
|
+
"head": [],
|
2161
|
+
"title": [],
|
2162
|
+
"base": ["href", "target"],
|
2163
|
+
"link": ["href", "hreflang", "rel", "media", "type", "sizes"],
|
2164
|
+
"meta": ["http-equiv", "name", "content", "charset"],
|
2165
|
+
"style": ["type", "media", "scoped"],
|
2166
|
+
"script": ["charset", "type", "src", "defer", "async"],
|
2167
|
+
"noscript": ["href"],
|
2168
|
+
"body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"],
|
2169
|
+
"section": [],
|
2170
|
+
"nav": [],
|
2171
|
+
"article": ["pubdate"],
|
2172
|
+
"aside": [],
|
2173
|
+
"h1": [],
|
2174
|
+
"h2": [],
|
2175
|
+
"h3": [],
|
2176
|
+
"h4": [],
|
2177
|
+
"h5": [],
|
2178
|
+
"h6": [],
|
2179
|
+
"header": [],
|
2180
|
+
"footer": [],
|
2181
|
+
"address": [],
|
2182
|
+
"main": [],
|
2183
|
+
"p": [],
|
2184
|
+
"hr": [],
|
2185
|
+
"pre": [],
|
2186
|
+
"blockquote": ["cite"],
|
2187
|
+
"ol": ["start", "reversed"],
|
2188
|
+
"ul": [],
|
2189
|
+
"li": ["value"],
|
2190
|
+
"dl": [],
|
2191
|
+
"dt": [],
|
2192
|
+
"dd": [],
|
2193
|
+
"figure": [],
|
2194
|
+
"figcaption": [],
|
2195
|
+
"div": [],
|
2196
|
+
"a": ["href", "target", "ping", "rel", "media", "hreflang", "type"],
|
2197
|
+
"em": [],
|
2198
|
+
"strong": [],
|
2199
|
+
"small": [],
|
2200
|
+
"s": [],
|
2201
|
+
"cite": [],
|
2202
|
+
"q": ["cite"],
|
2203
|
+
"dfn": [],
|
2204
|
+
"abbr": [],
|
2205
|
+
"data": [],
|
2206
|
+
"time": ["datetime"],
|
2207
|
+
"code": [],
|
2208
|
+
"var": [],
|
2209
|
+
"samp": [],
|
2210
|
+
"kbd": [],
|
2211
|
+
"sub": [],
|
2212
|
+
"sup": [],
|
2213
|
+
"i": [],
|
2214
|
+
"b": [],
|
2215
|
+
"u": [],
|
2216
|
+
"mark": [],
|
2217
|
+
"ruby": [],
|
2218
|
+
"rt": [],
|
2219
|
+
"rp": [],
|
2220
|
+
"bdi": [],
|
2221
|
+
"bdo": [],
|
2222
|
+
"span": [],
|
2223
|
+
"br": [],
|
2224
|
+
"wbr": [],
|
2225
|
+
"ins": ["cite", "datetime"],
|
2226
|
+
"del": ["cite", "datetime"],
|
2227
|
+
"img": ["alt", "src", "height", "width", "usemap", "ismap"],
|
2228
|
+
"iframe": ["name", "src", "height", "width", "sandbox", "seamless"],
|
2229
|
+
"embed": ["src", "height", "width", "type"],
|
2230
|
+
"object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"],
|
2231
|
+
"param": ["name", "value"],
|
2232
|
+
"video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"],
|
2233
|
+
"audio": ["src", "autobuffer", "autoplay", "loop", "controls"],
|
2234
|
+
"source": ["src", "type", "media"],
|
2235
|
+
"track": ["kind", "src", "srclang", "label", "default"],
|
2236
|
+
"canvas": ["width", "height"],
|
2237
|
+
"map": ["name"],
|
2238
|
+
"area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"],
|
2239
|
+
"svg": [],
|
2240
|
+
"math": [],
|
2241
|
+
"table": ["summary"],
|
2242
|
+
"caption": [],
|
2243
|
+
"colgroup": ["span"],
|
2244
|
+
"col": ["span"],
|
2245
|
+
"tbody": [],
|
2246
|
+
"thead": [],
|
2247
|
+
"tfoot": [],
|
2248
|
+
"tr": [],
|
2249
|
+
"td": ["headers", "rowspan", "colspan"],
|
2250
|
+
"th": ["headers", "rowspan", "colspan", "scope"],
|
2251
|
+
"form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"],
|
2252
|
+
"fieldset": ["disabled", "form", "name"],
|
2253
|
+
"legend": [],
|
2254
|
+
"label": ["form", "for"],
|
2255
|
+
"input": ["type", "accept", "alt", "autocomplete", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "multiple", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "width", "files", "value"],
|
2256
|
+
"button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"],
|
2257
|
+
"select": ["autofocus", "disabled", "form", "multiple", "name", "size"],
|
2258
|
+
"datalist": [],
|
2259
|
+
"optgroup": ["disabled", "label"],
|
2260
|
+
"option": ["disabled", "selected", "label", "value"],
|
2261
|
+
"textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"],
|
2262
|
+
"keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"],
|
2263
|
+
"output": ["for", "form", "name"],
|
2264
|
+
"progress": ["value", "max"],
|
2265
|
+
"meter": ["value", "min", "max", "low", "high", "optimum"],
|
2266
|
+
"details": ["open"],
|
2267
|
+
"summary": [],
|
2268
|
+
"command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"],
|
2269
|
+
"menu": ["type", "label"],
|
2270
|
+
"dialog": ["open"]
|
2271
|
+
};
|
2272
|
+
|
2273
|
+
var allElements = Object.keys(attributeMap);
|
2274
|
+
|
2275
|
+
function hasType(token, type) {
|
2276
|
+
var tokenTypes = token.type.split('.');
|
2277
|
+
return type.split('.').every(function(type){
|
2278
|
+
return (tokenTypes.indexOf(type) !== -1);
|
2279
|
+
});
|
2280
|
+
}
|
2281
|
+
|
2282
|
+
function findTagName(session, pos) {
|
2283
|
+
var iterator = new TokenIterator(session, pos.row, pos.column);
|
2284
|
+
var token = iterator.getCurrentToken();
|
2285
|
+
if (!token || !hasType(token, 'tag') && !(hasType(token, 'text') && token.value.match('/'))){
|
2286
|
+
do {
|
2287
|
+
token = iterator.stepBackward();
|
2288
|
+
} while (token && (hasType(token, 'string') || hasType(token, 'operator') || hasType(token, 'attribute-name') || hasType(token, 'text')));
|
2289
|
+
}
|
2290
|
+
if (token && hasType(token, 'tag-name') && !iterator.stepBackward().value.match('/'))
|
2291
|
+
return token.value;
|
2292
|
+
}
|
2293
|
+
|
2294
|
+
var HtmlCompletions = function() {
|
2295
|
+
|
2296
|
+
};
|
2297
|
+
|
2298
|
+
(function() {
|
2299
|
+
|
2300
|
+
this.getCompletions = function(state, session, pos, prefix) {
|
2301
|
+
var token = session.getTokenAt(pos.row, pos.column);
|
2302
|
+
|
2303
|
+
if (!token)
|
2304
|
+
return [];
|
2305
|
+
if (hasType(token, "tag-name") || (token.value == '<' && hasType(token, "text")))
|
2306
|
+
return this.getTagCompletions(state, session, pos, prefix);
|
2307
|
+
if (hasType(token, 'text') || hasType(token, 'attribute-name'))
|
2308
|
+
return this.getAttributeCompetions(state, session, pos, prefix);
|
2309
|
+
|
2310
|
+
return [];
|
2311
|
+
};
|
2312
|
+
|
2313
|
+
this.getTagCompletions = function(state, session, pos, prefix) {
|
2314
|
+
var elements = allElements;
|
2315
|
+
if (prefix) {
|
2316
|
+
elements = elements.filter(function(element){
|
2317
|
+
return element.indexOf(prefix) === 0;
|
2318
|
+
});
|
2319
|
+
}
|
2320
|
+
return elements.map(function(element){
|
2321
|
+
return {
|
2322
|
+
value: element,
|
2323
|
+
meta: "tag"
|
2324
|
+
};
|
2325
|
+
});
|
2326
|
+
};
|
2327
|
+
|
2328
|
+
this.getAttributeCompetions = function(state, session, pos, prefix) {
|
2329
|
+
var tagName = findTagName(session, pos);
|
2330
|
+
if (!tagName)
|
2331
|
+
return [];
|
2332
|
+
var attributes = globalAttributes;
|
2333
|
+
if (tagName in attributeMap) {
|
2334
|
+
attributes = attributes.concat(attributeMap[tagName]);
|
2335
|
+
}
|
2336
|
+
if (prefix) {
|
2337
|
+
attributes = attributes.filter(function(attribute){
|
2338
|
+
return attribute.indexOf(prefix) === 0;
|
2339
|
+
});
|
2340
|
+
}
|
2341
|
+
return attributes.map(function(attribute){
|
2342
|
+
return {
|
2343
|
+
caption: attribute,
|
2344
|
+
snippet: attribute + '="$0"',
|
2345
|
+
meta: "attribute"
|
2346
|
+
};
|
2347
|
+
});
|
2348
|
+
};
|
2349
|
+
|
2350
|
+
}).call(HtmlCompletions.prototype);
|
2351
|
+
|
2352
|
+
exports.HtmlCompletions = HtmlCompletions;
|
2353
|
+
});
|
2354
|
+
|
2355
|
+
define('ace/mode/lua', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/lua_highlight_rules', 'ace/mode/folding/lua', 'ace/range', 'ace/worker/worker_client'], function(require, exports, module) {
|
2053
2356
|
|
2054
2357
|
|
2055
2358
|
var oop = require("../lib/oop");
|
2056
2359
|
var TextMode = require("./text").Mode;
|
2057
2360
|
var Tokenizer = require("../tokenizer").Tokenizer;
|
2058
2361
|
var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules;
|
2362
|
+
var LuaFoldMode = require("./folding/lua").FoldMode;
|
2059
2363
|
var Range = require("../range").Range;
|
2364
|
+
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
2060
2365
|
|
2061
2366
|
var Mode = function() {
|
2062
|
-
this
|
2367
|
+
this.HighlightRules = LuaHighlightRules;
|
2368
|
+
|
2369
|
+
this.foldingRules = new LuaFoldMode();
|
2063
2370
|
};
|
2064
2371
|
oop.inherits(Mode, TextMode);
|
2065
2372
|
|
2066
2373
|
(function() {
|
2374
|
+
|
2375
|
+
this.lineCommentStart = "--";
|
2376
|
+
this.blockComment = {start: "--[", end: "]--"};
|
2377
|
+
|
2067
2378
|
var indentKeywords = {
|
2068
2379
|
"function": 1,
|
2069
2380
|
"then": 1,
|
@@ -2072,7 +2383,7 @@ oop.inherits(Mode, TextMode);
|
|
2072
2383
|
"elseif": 1,
|
2073
2384
|
"repeat": 1,
|
2074
2385
|
"end": -1,
|
2075
|
-
"until": -1
|
2386
|
+
"until": -1
|
2076
2387
|
};
|
2077
2388
|
var outdentKeywords = [
|
2078
2389
|
"else",
|
@@ -2083,9 +2394,7 @@ oop.inherits(Mode, TextMode);
|
|
2083
2394
|
|
2084
2395
|
function getNetIndentLevel(tokens) {
|
2085
2396
|
var level = 0;
|
2086
|
-
|
2087
|
-
// an ending token is found
|
2088
|
-
for (var i in tokens){
|
2397
|
+
for (var i = 0; i < tokens.length; i++) {
|
2089
2398
|
var token = tokens[i];
|
2090
2399
|
if (token.type == "keyword") {
|
2091
2400
|
if (token.value in indentKeywords) {
|
@@ -2097,8 +2406,6 @@ oop.inherits(Mode, TextMode);
|
|
2097
2406
|
level --;
|
2098
2407
|
}
|
2099
2408
|
}
|
2100
|
-
// Limit the level to +/- 1 since usually users only indent one level
|
2101
|
-
// at a time regardless of the logical nesting level
|
2102
2409
|
if (level < 0) {
|
2103
2410
|
return -1;
|
2104
2411
|
} else if (level > 0) {
|
@@ -2112,7 +2419,7 @@ oop.inherits(Mode, TextMode);
|
|
2112
2419
|
var indent = this.$getIndent(line);
|
2113
2420
|
var level = 0;
|
2114
2421
|
|
2115
|
-
var tokenizedLine = this
|
2422
|
+
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
2116
2423
|
var tokens = tokenizedLine.tokens;
|
2117
2424
|
|
2118
2425
|
if (state == "start") {
|
@@ -2121,7 +2428,6 @@ oop.inherits(Mode, TextMode);
|
|
2121
2428
|
if (level > 0) {
|
2122
2429
|
return indent + tab;
|
2123
2430
|
} else if (level < 0 && indent.substr(indent.length - tab.length) == tab) {
|
2124
|
-
// Don't do a next-line outdent if we're going to do a real outdent of this line
|
2125
2431
|
if (!this.checkOutdent(state, line, "\n")) {
|
2126
2432
|
return indent.substr(0, indent.length - tab.length);
|
2127
2433
|
}
|
@@ -2136,7 +2442,7 @@ oop.inherits(Mode, TextMode);
|
|
2136
2442
|
if (line.match(/^\s*[\)\}\]]$/))
|
2137
2443
|
return true;
|
2138
2444
|
|
2139
|
-
var tokens = this
|
2445
|
+
var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
|
2140
2446
|
|
2141
2447
|
if (!tokens || !tokens.length)
|
2142
2448
|
return false;
|
@@ -2147,42 +2453,54 @@ oop.inherits(Mode, TextMode);
|
|
2147
2453
|
this.autoOutdent = function(state, session, row) {
|
2148
2454
|
var prevLine = session.getLine(row - 1);
|
2149
2455
|
var prevIndent = this.$getIndent(prevLine).length;
|
2150
|
-
var prevTokens = this
|
2456
|
+
var prevTokens = this.getTokenizer().getLineTokens(prevLine, "start").tokens;
|
2151
2457
|
var tabLength = session.getTabString().length;
|
2152
2458
|
var expectedIndent = prevIndent + tabLength * getNetIndentLevel(prevTokens);
|
2153
2459
|
var curIndent = this.$getIndent(session.getLine(row)).length;
|
2154
2460
|
if (curIndent < expectedIndent) {
|
2155
|
-
// User already outdented //
|
2156
2461
|
return;
|
2157
2462
|
}
|
2158
2463
|
session.outdentRows(new Range(row, 0, row + 2, 0));
|
2159
2464
|
};
|
2160
2465
|
|
2466
|
+
this.createWorker = function(session) {
|
2467
|
+
var worker = new WorkerClient(["ace"], "ace/mode/lua_worker", "Worker");
|
2468
|
+
worker.attachToDocument(session.getDocument());
|
2469
|
+
|
2470
|
+
worker.on("error", function(e) {
|
2471
|
+
session.setAnnotations([e.data]);
|
2472
|
+
});
|
2473
|
+
|
2474
|
+
worker.on("ok", function(e) {
|
2475
|
+
session.clearAnnotations();
|
2476
|
+
});
|
2477
|
+
|
2478
|
+
return worker;
|
2479
|
+
};
|
2480
|
+
|
2481
|
+
this.$id = "ace/mode/lua";
|
2161
2482
|
}).call(Mode.prototype);
|
2162
2483
|
|
2163
2484
|
exports.Mode = Mode;
|
2164
2485
|
});
|
2165
2486
|
|
2166
|
-
define('ace/mode/lua_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/
|
2487
|
+
define('ace/mode/lua_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
2167
2488
|
|
2168
2489
|
|
2169
2490
|
var oop = require("../lib/oop");
|
2170
|
-
var lang = require("../lib/lang");
|
2171
2491
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
2172
2492
|
|
2173
2493
|
var LuaHighlightRules = function() {
|
2174
2494
|
|
2175
|
-
var keywords =
|
2176
|
-
|
2177
|
-
"return|then|until|while|or|and|not"
|
2495
|
+
var keywords = (
|
2496
|
+
"break|do|else|elseif|end|for|function|if|in|local|repeat|"+
|
2497
|
+
"return|then|until|while|or|and|not"
|
2178
2498
|
);
|
2179
2499
|
|
2180
|
-
var builtinConstants =
|
2181
|
-
("true|false|nil|_G|_VERSION").split("|")
|
2182
|
-
);
|
2500
|
+
var builtinConstants = ("true|false|nil|_G|_VERSION");
|
2183
2501
|
|
2184
|
-
var
|
2185
|
-
|
2502
|
+
var functions = (
|
2503
|
+
"string|xpcall|package|tostring|print|os|unpack|require|"+
|
2186
2504
|
"getfenv|setmetatable|next|assert|tonumber|io|rawequal|"+
|
2187
2505
|
"collectgarbage|getmetatable|module|rawset|math|debug|"+
|
2188
2506
|
"pcall|table|newproxy|type|coroutine|_G|select|gcinfo|"+
|
@@ -2201,27 +2519,26 @@ var LuaHighlightRules = function() {
|
|
2201
2519
|
"gethook|setmetatable|setlocal|traceback|setfenv|getinfo|"+
|
2202
2520
|
"setupvalue|getlocal|getregistry|getfenv|setn|insert|getn|"+
|
2203
2521
|
"foreachi|maxn|foreach|concat|sort|remove|resume|yield|"+
|
2204
|
-
"status|wrap|create|running
|
2205
|
-
|
2206
|
-
|
2207
|
-
var stdLibaries = lang.arrayToMap(
|
2208
|
-
("string|package|os|io|math|debug|table|coroutine").split("|")
|
2209
|
-
);
|
2210
|
-
|
2211
|
-
var metatableMethods = lang.arrayToMap(
|
2212
|
-
("__add|__sub|__mod|__unm|__concat|__lt|__index|__call|__gc|__metatable|"+
|
2213
|
-
"__mul|__div|__pow|__len|__eq|__le|__newindex|__tostring|__mode|__tonumber").split("|")
|
2522
|
+
"status|wrap|create|running|"+
|
2523
|
+
"__add|__sub|__mod|__unm|__concat|__lt|__index|__call|__gc|__metatable|"+
|
2524
|
+
"__mul|__div|__pow|__len|__eq|__le|__newindex|__tostring|__mode|__tonumber"
|
2214
2525
|
);
|
2215
2526
|
|
2216
|
-
var
|
2217
|
-
|
2218
|
-
|
2219
|
-
|
2220
|
-
var deprecatedIn5152 = lang.arrayToMap(
|
2221
|
-
("setn|foreach|foreachi|gcinfo|log10|maxn").split("|")
|
2222
|
-
);
|
2527
|
+
var stdLibaries = ("string|package|os|io|math|debug|table|coroutine");
|
2528
|
+
|
2529
|
+
var futureReserved = "";
|
2223
2530
|
|
2224
|
-
var
|
2531
|
+
var deprecatedIn5152 = ("setn|foreach|foreachi|gcinfo|log10|maxn");
|
2532
|
+
|
2533
|
+
var keywordMapper = this.createKeywordMapper({
|
2534
|
+
"keyword": keywords,
|
2535
|
+
"support.function": functions,
|
2536
|
+
"invalid.deprecated": deprecatedIn5152,
|
2537
|
+
"constant.library": stdLibaries,
|
2538
|
+
"constant.language": builtinConstants,
|
2539
|
+
"invalid.illegal": futureReserved,
|
2540
|
+
"variable.language": "this"
|
2541
|
+
}, "identifier");
|
2225
2542
|
|
2226
2543
|
var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
|
2227
2544
|
var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
|
@@ -2231,151 +2548,72 @@ var LuaHighlightRules = function() {
|
|
2231
2548
|
var intPart = "(?:\\d+)";
|
2232
2549
|
var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
|
2233
2550
|
var floatNumber = "(?:" + pointFloat + ")";
|
2234
|
-
|
2235
|
-
var comment_stack = [];
|
2236
|
-
|
2237
|
-
this.$rules = {
|
2238
|
-
"start" :
|
2239
2551
|
|
2240
|
-
|
2241
|
-
|
2242
|
-
|
2243
|
-
|
2244
|
-
|
2245
|
-
}, {
|
2246
|
-
token : "comment", // --[=[ comment
|
2247
|
-
regex : strPre + '\\-\\-\\[\\=\\[.*\\]\\=\\]'
|
2248
|
-
}, {
|
2249
|
-
token : "comment", // --[==[ comment
|
2250
|
-
regex : strPre + '\\-\\-\\[\\={2}\\[.*\\]\\={2}\\]'
|
2251
|
-
}, {
|
2252
|
-
token : "comment", // --[===[ comment
|
2253
|
-
regex : strPre + '\\-\\-\\[\\={3}\\[.*\\]\\={3}\\]'
|
2254
|
-
}, {
|
2255
|
-
token : "comment", // --[====[ comment
|
2256
|
-
regex : strPre + '\\-\\-\\[\\={4}\\[.*\\]\\={4}\\]'
|
2257
|
-
}, {
|
2258
|
-
token : "comment", // --[====+[ comment
|
2259
|
-
regex : strPre + '\\-\\-\\[\\={5}\\=*\\[.*\\]\\={5}\\=*\\]'
|
2260
|
-
},
|
2261
|
-
|
2262
|
-
// multiline bracketed comments
|
2263
|
-
{
|
2264
|
-
token : "comment", // --[[ comment
|
2265
|
-
regex : strPre + '\\-\\-\\[\\[.*$',
|
2266
|
-
merge : true,
|
2267
|
-
next : "qcomment"
|
2268
|
-
}, {
|
2269
|
-
token : "comment", // --[=[ comment
|
2270
|
-
regex : strPre + '\\-\\-\\[\\=\\[.*$',
|
2271
|
-
merge : true,
|
2272
|
-
next : "qcomment1"
|
2273
|
-
}, {
|
2274
|
-
token : "comment", // --[==[ comment
|
2275
|
-
regex : strPre + '\\-\\-\\[\\={2}\\[.*$',
|
2276
|
-
merge : true,
|
2277
|
-
next : "qcomment2"
|
2278
|
-
}, {
|
2279
|
-
token : "comment", // --[===[ comment
|
2280
|
-
regex : strPre + '\\-\\-\\[\\={3}\\[.*$',
|
2281
|
-
merge : true,
|
2282
|
-
next : "qcomment3"
|
2283
|
-
}, {
|
2284
|
-
token : "comment", // --[====[ comment
|
2285
|
-
regex : strPre + '\\-\\-\\[\\={4}\\[.*$',
|
2286
|
-
merge : true,
|
2287
|
-
next : "qcomment4"
|
2288
|
-
}, {
|
2289
|
-
token : function(value){ // --[====+[ comment
|
2290
|
-
// WARNING: EXTREMELY SLOW, but this is the only way to circumvent the
|
2291
|
-
// limits imposed by the current automaton.
|
2292
|
-
// I've never personally seen any practical code where 5 or more '='s are
|
2293
|
-
// used for string or commenting, so this will rarely be invoked.
|
2294
|
-
var pattern = /\-\-\[(\=+)\[/, match;
|
2295
|
-
// you can never be too paranoid ;)
|
2296
|
-
if ((match = pattern.exec(value)) != null && (match = match[1]) != undefined)
|
2297
|
-
comment_stack.push(match.length);
|
2298
|
-
|
2552
|
+
this.$rules = {
|
2553
|
+
"start" : [{
|
2554
|
+
stateName: "bracketedComment",
|
2555
|
+
onMatch : function(value, currentState, stack){
|
2556
|
+
stack.unshift(this.next, value.length - 2, currentState);
|
2299
2557
|
return "comment";
|
2300
2558
|
},
|
2301
|
-
regex :
|
2302
|
-
|
2303
|
-
|
2559
|
+
regex : /\-\-\[=*\[/,
|
2560
|
+
next : [
|
2561
|
+
{
|
2562
|
+
onMatch : function(value, currentState, stack) {
|
2563
|
+
if (value.length == stack[1]) {
|
2564
|
+
stack.shift();
|
2565
|
+
stack.shift();
|
2566
|
+
this.next = stack.shift();
|
2567
|
+
} else {
|
2568
|
+
this.next = "";
|
2569
|
+
}
|
2570
|
+
return "comment";
|
2571
|
+
},
|
2572
|
+
regex : /\]=*\]/,
|
2573
|
+
next : "start"
|
2574
|
+
}, {
|
2575
|
+
defaultToken : "comment"
|
2576
|
+
}
|
2577
|
+
]
|
2304
2578
|
},
|
2305
|
-
|
2306
|
-
// single line comments
|
2579
|
+
|
2307
2580
|
{
|
2308
2581
|
token : "comment",
|
2309
2582
|
regex : "\\-\\-.*$"
|
2310
|
-
},
|
2311
|
-
|
2312
|
-
// bracketed strings
|
2313
|
-
{
|
2314
|
-
token : "string", // [[ string
|
2315
|
-
regex : strPre + '\\[\\[.*\\]\\]'
|
2316
|
-
}, {
|
2317
|
-
token : "string", // [=[ string
|
2318
|
-
regex : strPre + '\\[\\=\\[.*\\]\\=\\]'
|
2319
|
-
}, {
|
2320
|
-
token : "string", // [==[ string
|
2321
|
-
regex : strPre + '\\[\\={2}\\[.*\\]\\={2}\\]'
|
2322
|
-
}, {
|
2323
|
-
token : "string", // [===[ string
|
2324
|
-
regex : strPre + '\\[\\={3}\\[.*\\]\\={3}\\]'
|
2325
|
-
}, {
|
2326
|
-
token : "string", // [====[ string
|
2327
|
-
regex : strPre + '\\[\\={4}\\[.*\\]\\={4}\\]'
|
2328
|
-
}, {
|
2329
|
-
token : "string", // [====+[ string
|
2330
|
-
regex : strPre + '\\[\\={5}\\=*\\[.*\\]\\={5}\\=*\\]'
|
2331
2583
|
},
|
2332
|
-
|
2333
|
-
// multiline bracketed strings
|
2334
2584
|
{
|
2335
|
-
|
2336
|
-
|
2337
|
-
|
2338
|
-
|
2339
|
-
}, {
|
2340
|
-
token : "string", // [=[ string
|
2341
|
-
regex : strPre + '\\[\\=\\[.*$',
|
2342
|
-
merge : true,
|
2343
|
-
next : "qstring1"
|
2344
|
-
}, {
|
2345
|
-
token : "string", // [==[ string
|
2346
|
-
regex : strPre + '\\[\\={2}\\[.*$',
|
2347
|
-
merge : true,
|
2348
|
-
next : "qstring2"
|
2349
|
-
}, {
|
2350
|
-
token : "string", // [===[ string
|
2351
|
-
regex : strPre + '\\[\\={3}\\[.*$',
|
2352
|
-
merge : true,
|
2353
|
-
next : "qstring3"
|
2354
|
-
}, {
|
2355
|
-
token : "string", // [====[ string
|
2356
|
-
regex : strPre + '\\[\\={4}\\[.*$',
|
2357
|
-
merge : true,
|
2358
|
-
next : "qstring4"
|
2359
|
-
}, {
|
2360
|
-
token : function(value){ // --[====+[ string
|
2361
|
-
// WARNING: EXTREMELY SLOW, see above.
|
2362
|
-
var pattern = /\[(\=+)\[/, match;
|
2363
|
-
if ((match = pattern.exec(value)) != null && (match = match[1]) != undefined)
|
2364
|
-
comment_stack.push(match.length);
|
2365
|
-
|
2366
|
-
return "string";
|
2585
|
+
stateName: "bracketedString",
|
2586
|
+
onMatch : function(value, currentState, stack){
|
2587
|
+
stack.unshift(this.next, value.length, currentState);
|
2588
|
+
return "comment";
|
2367
2589
|
},
|
2368
|
-
regex :
|
2369
|
-
|
2370
|
-
|
2371
|
-
|
2372
|
-
|
2590
|
+
regex : /\[=*\[/,
|
2591
|
+
next : [
|
2592
|
+
{
|
2593
|
+
onMatch : function(value, currentState, stack) {
|
2594
|
+
if (value.length == stack[1]) {
|
2595
|
+
stack.shift();
|
2596
|
+
stack.shift();
|
2597
|
+
this.next = stack.shift();
|
2598
|
+
} else {
|
2599
|
+
this.next = "";
|
2600
|
+
}
|
2601
|
+
return "comment";
|
2602
|
+
},
|
2603
|
+
|
2604
|
+
regex : /\]=*\]/,
|
2605
|
+
next : "start"
|
2606
|
+
}, {
|
2607
|
+
defaultToken : "comment"
|
2608
|
+
}
|
2609
|
+
]
|
2610
|
+
},
|
2373
2611
|
{
|
2374
2612
|
token : "string", // " string
|
2375
|
-
regex :
|
2613
|
+
regex : '"(?:[^\\\\]|\\\\.)*?"'
|
2376
2614
|
}, {
|
2377
2615
|
token : "string", // ' string
|
2378
|
-
regex :
|
2616
|
+
regex : "'(?:[^\\\\]|\\\\.)*?'"
|
2379
2617
|
}, {
|
2380
2618
|
token : "constant.numeric", // float
|
2381
2619
|
regex : floatNumber
|
@@ -2383,24 +2621,7 @@ var LuaHighlightRules = function() {
|
|
2383
2621
|
token : "constant.numeric", // integer
|
2384
2622
|
regex : integer + "\\b"
|
2385
2623
|
}, {
|
2386
|
-
token :
|
2387
|
-
if (keywords.hasOwnProperty(value))
|
2388
|
-
return "keyword";
|
2389
|
-
else if (builtinConstants.hasOwnProperty(value))
|
2390
|
-
return "constant.language";
|
2391
|
-
else if (futureReserved.hasOwnProperty(value))
|
2392
|
-
return "invalid.illegal";
|
2393
|
-
else if (stdLibaries.hasOwnProperty(value))
|
2394
|
-
return "constant.library";
|
2395
|
-
else if (deprecatedIn5152.hasOwnProperty(value))
|
2396
|
-
return "invalid.deprecated";
|
2397
|
-
else if (builtinFunctions.hasOwnProperty(value))
|
2398
|
-
return "support.function";
|
2399
|
-
else if (metatableMethods.hasOwnProperty(value))
|
2400
|
-
return "support.function";
|
2401
|
-
else
|
2402
|
-
return "identifier";
|
2403
|
-
},
|
2624
|
+
token : keywordMapper,
|
2404
2625
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
2405
2626
|
}, {
|
2406
2627
|
token : "keyword.operator",
|
@@ -2413,155 +2634,151 @@ var LuaHighlightRules = function() {
|
|
2413
2634
|
regex : "[\\]\\)\\}]"
|
2414
2635
|
}, {
|
2415
2636
|
token : "text",
|
2416
|
-
regex : "\\s+"
|
2417
|
-
} ],
|
2418
|
-
|
2419
|
-
"qcomment": [ {
|
2420
|
-
token : "comment",
|
2421
|
-
regex : "(?:[^\\\\]|\\\\.)*?\\]\\]",
|
2422
|
-
next : "start"
|
2423
|
-
}, {
|
2424
|
-
token : "comment",
|
2425
|
-
merge : true,
|
2426
|
-
regex : '.+'
|
2427
|
-
} ],
|
2428
|
-
"qcomment1": [ {
|
2429
|
-
token : "comment",
|
2430
|
-
regex : "(?:[^\\\\]|\\\\.)*?\\]\\=\\]",
|
2431
|
-
next : "start"
|
2432
|
-
}, {
|
2433
|
-
token : "comment",
|
2434
|
-
merge : true,
|
2435
|
-
regex : '.+'
|
2436
|
-
} ],
|
2437
|
-
"qcomment2": [ {
|
2438
|
-
token : "comment",
|
2439
|
-
regex : "(?:[^\\\\]|\\\\.)*?\\]\\={2}\\]",
|
2440
|
-
next : "start"
|
2441
|
-
}, {
|
2442
|
-
token : "comment",
|
2443
|
-
merge : true,
|
2444
|
-
regex : '.+'
|
2445
|
-
} ],
|
2446
|
-
"qcomment3": [ {
|
2447
|
-
token : "comment",
|
2448
|
-
regex : "(?:[^\\\\]|\\\\.)*?\\]\\={3}\\]",
|
2449
|
-
next : "start"
|
2450
|
-
}, {
|
2451
|
-
token : "comment",
|
2452
|
-
merge : true,
|
2453
|
-
regex : '.+'
|
2454
|
-
} ],
|
2455
|
-
"qcomment4": [ {
|
2456
|
-
token : "comment",
|
2457
|
-
regex : "(?:[^\\\\]|\\\\.)*?\\]\\={4}\\]",
|
2458
|
-
next : "start"
|
2459
|
-
}, {
|
2460
|
-
token : "comment",
|
2461
|
-
merge : true,
|
2462
|
-
regex : '.+'
|
2463
|
-
} ],
|
2464
|
-
"qcomment5": [ {
|
2465
|
-
token : function(value){
|
2466
|
-
// very hackish, mutates the qcomment5 field on the fly.
|
2467
|
-
var pattern = /\](\=+)\]/, rule = this.rules.qcomment5[0], match;
|
2468
|
-
rule.next = "start";
|
2469
|
-
if ((match = pattern.exec(value)) != null && (match = match[1]) != undefined){
|
2470
|
-
var found = match.length, expected;
|
2471
|
-
if ((expected = comment_stack.pop()) != found){
|
2472
|
-
comment_stack.push(expected);
|
2473
|
-
rule.next = "qcomment5";
|
2474
|
-
}
|
2475
|
-
}
|
2476
|
-
|
2477
|
-
return "comment";
|
2478
|
-
},
|
2479
|
-
regex : "(?:[^\\\\]|\\\\.)*?\\]\\={5}\\=*\\]",
|
2480
|
-
next : "start"
|
2481
|
-
}, {
|
2482
|
-
token : "comment",
|
2483
|
-
merge : true,
|
2484
|
-
regex : '.+'
|
2485
|
-
} ],
|
2486
|
-
|
2487
|
-
"qstring": [ {
|
2488
|
-
token : "string",
|
2489
|
-
regex : "(?:[^\\\\]|\\\\.)*?\\]\\]",
|
2490
|
-
next : "start"
|
2491
|
-
}, {
|
2492
|
-
token : "string",
|
2493
|
-
merge : true,
|
2494
|
-
regex : '.+'
|
2495
|
-
} ],
|
2496
|
-
"qstring1": [ {
|
2497
|
-
token : "string",
|
2498
|
-
regex : "(?:[^\\\\]|\\\\.)*?\\]\\=\\]",
|
2499
|
-
next : "start"
|
2500
|
-
}, {
|
2501
|
-
token : "string",
|
2502
|
-
merge : true,
|
2503
|
-
regex : '.+'
|
2504
|
-
} ],
|
2505
|
-
"qstring2": [ {
|
2506
|
-
token : "string",
|
2507
|
-
regex : "(?:[^\\\\]|\\\\.)*?\\]\\={2}\\]",
|
2508
|
-
next : "start"
|
2509
|
-
}, {
|
2510
|
-
token : "string",
|
2511
|
-
merge : true,
|
2512
|
-
regex : '.+'
|
2513
|
-
} ],
|
2514
|
-
"qstring3": [ {
|
2515
|
-
token : "string",
|
2516
|
-
regex : "(?:[^\\\\]|\\\\.)*?\\]\\={3}\\]",
|
2517
|
-
next : "start"
|
2518
|
-
}, {
|
2519
|
-
token : "string",
|
2520
|
-
merge : true,
|
2521
|
-
regex : '.+'
|
2522
|
-
} ],
|
2523
|
-
"qstring4": [ {
|
2524
|
-
token : "string",
|
2525
|
-
regex : "(?:[^\\\\]|\\\\.)*?\\]\\={4}\\]",
|
2526
|
-
next : "start"
|
2527
|
-
}, {
|
2528
|
-
token : "string",
|
2529
|
-
merge : true,
|
2530
|
-
regex : '.+'
|
2531
|
-
} ],
|
2532
|
-
"qstring5": [ {
|
2533
|
-
token : function(value){
|
2534
|
-
// very hackish, mutates the qstring5 field on the fly.
|
2535
|
-
var pattern = /\](\=+)\]/, rule = this.rules.qstring5[0], match;
|
2536
|
-
rule.next = "start";
|
2537
|
-
if ((match = pattern.exec(value)) != null && (match = match[1]) != undefined){
|
2538
|
-
var found = match.length, expected;
|
2539
|
-
if ((expected = comment_stack.pop()) != found){
|
2540
|
-
comment_stack.push(expected);
|
2541
|
-
rule.next = "qstring5";
|
2542
|
-
}
|
2543
|
-
}
|
2544
|
-
|
2545
|
-
return "string";
|
2546
|
-
},
|
2547
|
-
regex : "(?:[^\\\\]|\\\\.)*?\\]\\={5}\\=*\\]",
|
2548
|
-
next : "start"
|
2549
|
-
}, {
|
2550
|
-
token : "string",
|
2551
|
-
merge : true,
|
2552
|
-
regex : '.+'
|
2637
|
+
regex : "\\s+|\\w+"
|
2553
2638
|
} ]
|
2554
|
-
|
2555
2639
|
};
|
2556
|
-
|
2640
|
+
|
2641
|
+
this.normalizeRules();
|
2557
2642
|
}
|
2558
2643
|
|
2559
2644
|
oop.inherits(LuaHighlightRules, TextHighlightRules);
|
2560
2645
|
|
2561
2646
|
exports.LuaHighlightRules = LuaHighlightRules;
|
2562
2647
|
});
|
2563
|
-
|
2564
|
-
|
2648
|
+
|
2649
|
+
define('ace/mode/folding/lua', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range', 'ace/token_iterator'], function(require, exports, module) {
|
2650
|
+
|
2651
|
+
|
2652
|
+
var oop = require("../../lib/oop");
|
2653
|
+
var BaseFoldMode = require("./fold_mode").FoldMode;
|
2654
|
+
var Range = require("../../range").Range;
|
2655
|
+
var TokenIterator = require("../../token_iterator").TokenIterator;
|
2656
|
+
|
2657
|
+
|
2658
|
+
var FoldMode = exports.FoldMode = function() {};
|
2659
|
+
|
2660
|
+
oop.inherits(FoldMode, BaseFoldMode);
|
2661
|
+
|
2662
|
+
(function() {
|
2663
|
+
|
2664
|
+
this.foldingStartMarker = /\b(function|then|do|repeat)\b|{\s*$|(\[=*\[)/;
|
2665
|
+
this.foldingStopMarker = /\bend\b|^\s*}|\]=*\]/;
|
2666
|
+
|
2667
|
+
this.getFoldWidget = function(session, foldStyle, row) {
|
2668
|
+
var line = session.getLine(row);
|
2669
|
+
var isStart = this.foldingStartMarker.test(line);
|
2670
|
+
var isEnd = this.foldingStopMarker.test(line);
|
2671
|
+
|
2672
|
+
if (isStart && !isEnd) {
|
2673
|
+
var match = line.match(this.foldingStartMarker);
|
2674
|
+
if (match[1] == "then" && /\belseif\b/.test(line))
|
2675
|
+
return;
|
2676
|
+
if (match[1]) {
|
2677
|
+
if (session.getTokenAt(row, match.index + 1).type === "keyword")
|
2678
|
+
return "start";
|
2679
|
+
} else if (match[2]) {
|
2680
|
+
var type = session.bgTokenizer.getState(row) || "";
|
2681
|
+
if (type[0] == "bracketedComment" || type[0] == "bracketedString")
|
2682
|
+
return "start";
|
2683
|
+
} else {
|
2684
|
+
return "start";
|
2685
|
+
}
|
2686
|
+
}
|
2687
|
+
if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd)
|
2688
|
+
return "";
|
2689
|
+
|
2690
|
+
var match = line.match(this.foldingStopMarker);
|
2691
|
+
if (match[0] === "end") {
|
2692
|
+
if (session.getTokenAt(row, match.index + 1).type === "keyword")
|
2693
|
+
return "end";
|
2694
|
+
} else if (match[0][0] === "]") {
|
2695
|
+
var type = session.bgTokenizer.getState(row - 1) || "";
|
2696
|
+
if (type[0] == "bracketedComment" || type[0] == "bracketedString")
|
2697
|
+
return "end";
|
2698
|
+
} else
|
2699
|
+
return "end";
|
2700
|
+
};
|
2701
|
+
|
2702
|
+
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
2703
|
+
var line = session.doc.getLine(row);
|
2704
|
+
var match = this.foldingStartMarker.exec(line);
|
2705
|
+
if (match) {
|
2706
|
+
if (match[1])
|
2707
|
+
return this.luaBlock(session, row, match.index + 1);
|
2708
|
+
|
2709
|
+
if (match[2])
|
2710
|
+
return session.getCommentFoldRange(row, match.index + 1);
|
2711
|
+
|
2712
|
+
return this.openingBracketBlock(session, "{", row, match.index);
|
2713
|
+
}
|
2714
|
+
|
2715
|
+
var match = this.foldingStopMarker.exec(line);
|
2716
|
+
if (match) {
|
2717
|
+
if (match[0] === "end") {
|
2718
|
+
if (session.getTokenAt(row, match.index + 1).type === "keyword")
|
2719
|
+
return this.luaBlock(session, row, match.index + 1);
|
2720
|
+
}
|
2721
|
+
|
2722
|
+
if (match[0][0] === "]")
|
2723
|
+
return session.getCommentFoldRange(row, match.index + 1);
|
2724
|
+
|
2725
|
+
return this.closingBracketBlock(session, "}", row, match.index + match[0].length);
|
2726
|
+
}
|
2727
|
+
};
|
2728
|
+
|
2729
|
+
this.luaBlock = function(session, row, column) {
|
2730
|
+
var stream = new TokenIterator(session, row, column);
|
2731
|
+
var indentKeywords = {
|
2732
|
+
"function": 1,
|
2733
|
+
"do": 1,
|
2734
|
+
"then": 1,
|
2735
|
+
"elseif": -1,
|
2736
|
+
"end": -1,
|
2737
|
+
"repeat": 1,
|
2738
|
+
"until": -1
|
2739
|
+
};
|
2740
|
+
|
2741
|
+
var token = stream.getCurrentToken();
|
2742
|
+
if (!token || token.type != "keyword")
|
2743
|
+
return;
|
2744
|
+
|
2745
|
+
var val = token.value;
|
2746
|
+
var stack = [val];
|
2747
|
+
var dir = indentKeywords[val];
|
2748
|
+
|
2749
|
+
if (!dir)
|
2750
|
+
return;
|
2751
|
+
|
2752
|
+
var startColumn = dir === -1 ? stream.getCurrentTokenColumn() : session.getLine(row).length;
|
2753
|
+
var startRow = row;
|
2754
|
+
|
2755
|
+
stream.step = dir === -1 ? stream.stepBackward : stream.stepForward;
|
2756
|
+
while(token = stream.step()) {
|
2757
|
+
if (token.type !== "keyword")
|
2758
|
+
continue;
|
2759
|
+
var level = dir * indentKeywords[token.value];
|
2760
|
+
|
2761
|
+
if (level > 0) {
|
2762
|
+
stack.unshift(token.value);
|
2763
|
+
} else if (level <= 0) {
|
2764
|
+
stack.shift();
|
2765
|
+
if (!stack.length && token.value != "elseif")
|
2766
|
+
break;
|
2767
|
+
if (level === 0)
|
2768
|
+
stack.unshift(token.value);
|
2769
|
+
}
|
2770
|
+
}
|
2771
|
+
|
2772
|
+
var row = stream.getCurrentTokenRow();
|
2773
|
+
if (dir === -1)
|
2774
|
+
return new Range(row, session.getLine(row).length, startRow, startColumn);
|
2775
|
+
else
|
2776
|
+
return new Range(startRow, startColumn, row, stream.getCurrentTokenColumn());
|
2777
|
+
};
|
2778
|
+
|
2779
|
+
}).call(FoldMode.prototype);
|
2780
|
+
|
2781
|
+
});
|
2565
2782
|
define('ace/mode/luapage_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/html_highlight_rules', 'ace/mode/lua_highlight_rules'], function(require, exports, module) {
|
2566
2783
|
|
2567
2784
|
|
@@ -2570,31 +2787,38 @@ var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
|
|
2570
2787
|
var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules;
|
2571
2788
|
|
2572
2789
|
var LuaPageHighlightRules = function() {
|
2573
|
-
|
2574
|
-
|
2575
|
-
|
2576
|
-
|
2790
|
+
HtmlHighlightRules.call(this);
|
2791
|
+
|
2792
|
+
var startRules = [
|
2793
|
+
{
|
2577
2794
|
token: "keyword",
|
2578
2795
|
regex: "<\\%\\=?",
|
2579
|
-
|
2796
|
+
push: "lua-start"
|
2580
2797
|
}, {
|
2581
2798
|
token: "keyword",
|
2582
2799
|
regex: "<\\?lua\\=?",
|
2583
|
-
|
2584
|
-
}
|
2585
|
-
|
2586
|
-
|
2800
|
+
push: "lua-start"
|
2801
|
+
}
|
2802
|
+
];
|
2803
|
+
|
2804
|
+
var endRules = [
|
2587
2805
|
{
|
2588
2806
|
token: "keyword",
|
2589
2807
|
regex: "\\%>",
|
2590
|
-
next: "
|
2591
|
-
},
|
2592
|
-
{
|
2808
|
+
next: "pop"
|
2809
|
+
}, {
|
2593
2810
|
token: "keyword",
|
2594
2811
|
regex: "\\?>",
|
2595
|
-
next: "
|
2812
|
+
next: "pop"
|
2596
2813
|
}
|
2597
|
-
]
|
2814
|
+
];
|
2815
|
+
|
2816
|
+
this.embedRules(LuaHighlightRules, "lua-", endRules, ["start"]);
|
2817
|
+
|
2818
|
+
for (var key in this.$rules)
|
2819
|
+
this.$rules[key].unshift.apply(this.$rules[key], startRules);
|
2820
|
+
|
2821
|
+
this.normalizeRules();
|
2598
2822
|
};
|
2599
2823
|
|
2600
2824
|
oop.inherits(LuaPageHighlightRules, HtmlHighlightRules);
|