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,8 +8,7 @@ var JavaHighlightRules = require("./java_highlight_rules").JavaHighlightRules;
|
|
8
8
|
|
9
9
|
var Mode = function() {
|
10
10
|
JavaScriptMode.call(this);
|
11
|
-
|
12
|
-
this.$tokenizer = new Tokenizer(new JavaHighlightRules().getRules());
|
11
|
+
this.HighlightRules = JavaHighlightRules;
|
13
12
|
};
|
14
13
|
oop.inherits(Mode, JavaScriptMode);
|
15
14
|
|
@@ -19,6 +18,7 @@ oop.inherits(Mode, JavaScriptMode);
|
|
19
18
|
return null;
|
20
19
|
};
|
21
20
|
|
21
|
+
this.$id = "ace/mode/java";
|
22
22
|
}).call(Mode.prototype);
|
23
23
|
|
24
24
|
exports.Mode = Mode;
|
@@ -38,7 +38,8 @@ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
|
38
38
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
39
39
|
|
40
40
|
var Mode = function() {
|
41
|
-
this
|
41
|
+
this.HighlightRules = JavaScriptHighlightRules;
|
42
|
+
|
42
43
|
this.$outdent = new MatchingBraceOutdent();
|
43
44
|
this.$behaviour = new CstyleBehaviour();
|
44
45
|
this.foldingRules = new CStyleFoldMode();
|
@@ -47,53 +48,27 @@ oop.inherits(Mode, TextMode);
|
|
47
48
|
|
48
49
|
(function() {
|
49
50
|
|
50
|
-
|
51
|
-
this.
|
52
|
-
var outdent = true;
|
53
|
-
var re = /^(\s*)\/\//;
|
54
|
-
|
55
|
-
for (var i=startRow; i<= endRow; i++) {
|
56
|
-
if (!re.test(doc.getLine(i))) {
|
57
|
-
outdent = false;
|
58
|
-
break;
|
59
|
-
}
|
60
|
-
}
|
61
|
-
|
62
|
-
if (outdent) {
|
63
|
-
var deleteRange = new Range(0, 0, 0, 0);
|
64
|
-
for (var i=startRow; i<= endRow; i++)
|
65
|
-
{
|
66
|
-
var line = doc.getLine(i);
|
67
|
-
var m = line.match(re);
|
68
|
-
deleteRange.start.row = i;
|
69
|
-
deleteRange.end.row = i;
|
70
|
-
deleteRange.end.column = m[0].length;
|
71
|
-
doc.replace(deleteRange, m[1]);
|
72
|
-
}
|
73
|
-
}
|
74
|
-
else {
|
75
|
-
doc.indentRows(startRow, endRow, "//");
|
76
|
-
}
|
77
|
-
};
|
51
|
+
this.lineCommentStart = "//";
|
52
|
+
this.blockComment = {start: "/*", end: "*/"};
|
78
53
|
|
79
54
|
this.getNextLineIndent = function(state, line, tab) {
|
80
55
|
var indent = this.$getIndent(line);
|
81
56
|
|
82
|
-
var tokenizedLine = this
|
57
|
+
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
83
58
|
var tokens = tokenizedLine.tokens;
|
84
59
|
var endState = tokenizedLine.state;
|
85
60
|
|
86
61
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
87
62
|
return indent;
|
88
63
|
}
|
89
|
-
|
90
|
-
if (state == "start" || state == "
|
64
|
+
|
65
|
+
if (state == "start" || state == "no_regex") {
|
91
66
|
var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
|
92
67
|
if (match) {
|
93
68
|
indent += tab;
|
94
69
|
}
|
95
70
|
} else if (state == "doc-start") {
|
96
|
-
if (endState == "start" ||
|
71
|
+
if (endState == "start" || endState == "no_regex") {
|
97
72
|
return "";
|
98
73
|
}
|
99
74
|
var match = line.match(/^\s*(\/?)\*/);
|
@@ -115,105 +90,64 @@ oop.inherits(Mode, TextMode);
|
|
115
90
|
this.autoOutdent = function(state, doc, row) {
|
116
91
|
this.$outdent.autoOutdent(doc, row);
|
117
92
|
};
|
118
|
-
|
93
|
+
|
119
94
|
this.createWorker = function(session) {
|
120
95
|
var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
|
121
96
|
worker.attachToDocument(session.getDocument());
|
122
|
-
|
97
|
+
|
123
98
|
worker.on("jslint", function(results) {
|
124
|
-
|
125
|
-
for (var i=0; i<results.data.length; i++) {
|
126
|
-
var error = results.data[i];
|
127
|
-
if (error)
|
128
|
-
errors.push({
|
129
|
-
row: error.line-1,
|
130
|
-
column: error.character-1,
|
131
|
-
text: error.reason,
|
132
|
-
type: "warning",
|
133
|
-
lint: error
|
134
|
-
});
|
135
|
-
}
|
136
|
-
session.setAnnotations(errors);
|
99
|
+
session.setAnnotations(results.data);
|
137
100
|
});
|
138
|
-
|
139
|
-
worker.on("narcissus", function(e) {
|
140
|
-
session.setAnnotations([e.data]);
|
141
|
-
});
|
142
|
-
|
101
|
+
|
143
102
|
worker.on("terminate", function() {
|
144
103
|
session.clearAnnotations();
|
145
104
|
});
|
146
|
-
|
105
|
+
|
147
106
|
return worker;
|
148
107
|
};
|
149
108
|
|
109
|
+
this.$id = "ace/mode/javascript";
|
150
110
|
}).call(Mode.prototype);
|
151
111
|
|
152
112
|
exports.Mode = Mode;
|
153
113
|
});
|
154
114
|
|
155
|
-
define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/
|
115
|
+
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) {
|
156
116
|
|
157
117
|
|
158
118
|
var oop = require("../lib/oop");
|
159
|
-
var lang = require("../lib/lang");
|
160
|
-
var unicode = require("../unicode");
|
161
119
|
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
162
120
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
163
121
|
|
164
122
|
var JavaScriptHighlightRules = function() {
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
"
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
"
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
// keywords which can be followed by regular expressions
|
194
|
-
var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield";
|
195
|
-
|
196
|
-
var deprecated = lang.arrayToMap(
|
197
|
-
("__parent__|__count__|escape|unescape|with|__proto__").split("|")
|
198
|
-
);
|
199
|
-
|
200
|
-
var definitions = lang.arrayToMap(("const|let|var|function").split("|"));
|
201
|
-
|
202
|
-
var buildinConstants = lang.arrayToMap(
|
203
|
-
("null|Infinity|NaN|undefined").split("|")
|
204
|
-
);
|
205
|
-
|
206
|
-
var futureReserved = lang.arrayToMap(
|
207
|
-
("class|enum|extends|super|export|implements|private|" +
|
208
|
-
"public|interface|package|protected|static").split("|")
|
209
|
-
);
|
210
|
-
|
211
|
-
// TODO: Unicode escape sequences
|
212
|
-
var identifierRe = "[" + unicode.packages.L + "\\$_]["
|
213
|
-
+ unicode.packages.L
|
214
|
-
+ unicode.packages.Mn + unicode.packages.Mc
|
215
|
-
+ unicode.packages.Nd
|
216
|
-
+ unicode.packages.Pc + "\\$_]*\\b";
|
123
|
+
var keywordMapper = this.createKeywordMapper({
|
124
|
+
"variable.language":
|
125
|
+
"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
|
126
|
+
"Namespace|QName|XML|XMLList|" + // E4X
|
127
|
+
"ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
|
128
|
+
"Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
|
129
|
+
"Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
|
130
|
+
"SyntaxError|TypeError|URIError|" +
|
131
|
+
"decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
|
132
|
+
"isNaN|parseFloat|parseInt|" +
|
133
|
+
"JSON|Math|" + // Other
|
134
|
+
"this|arguments|prototype|window|document" , // Pseudo
|
135
|
+
"keyword":
|
136
|
+
"const|yield|import|get|set|" +
|
137
|
+
"break|case|catch|continue|default|delete|do|else|finally|for|function|" +
|
138
|
+
"if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
|
139
|
+
"__parent__|__count__|escape|unescape|with|__proto__|" +
|
140
|
+
"class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
|
141
|
+
"storage.type":
|
142
|
+
"const|let|var|function",
|
143
|
+
"constant.language":
|
144
|
+
"null|Infinity|NaN|undefined",
|
145
|
+
"support.function":
|
146
|
+
"alert",
|
147
|
+
"constant.language.boolean": "true|false"
|
148
|
+
}, "identifier");
|
149
|
+
var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
|
150
|
+
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
|
217
151
|
|
218
152
|
var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
|
219
153
|
"u[0-9a-fA-F]{4}|" + // unicode
|
@@ -223,19 +157,16 @@ var JavaScriptHighlightRules = function() {
|
|
223
157
|
"[4-7][0-7]?|" + //oct
|
224
158
|
".)";
|
225
159
|
|
226
|
-
// regexp must not have capturing parentheses. Use (?:) instead.
|
227
|
-
// regexps are ordered -> the first match is used
|
228
|
-
|
229
160
|
this.$rules = {
|
230
|
-
"
|
161
|
+
"no_regex" : [
|
231
162
|
{
|
232
163
|
token : "comment",
|
233
|
-
regex :
|
164
|
+
regex : "\\/\\/",
|
165
|
+
next : "line_comment"
|
234
166
|
},
|
235
167
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
236
168
|
{
|
237
169
|
token : "comment", // multi line comment
|
238
|
-
merge : true,
|
239
170
|
regex : /\/\*/,
|
240
171
|
next : "comment"
|
241
172
|
}, {
|
@@ -252,119 +183,61 @@ var JavaScriptHighlightRules = function() {
|
|
252
183
|
}, {
|
253
184
|
token : "constant.numeric", // float
|
254
185
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
255
|
-
}, {
|
256
|
-
token : [
|
257
|
-
"storage.type",
|
258
|
-
"punctuation.operator",
|
259
|
-
"support.function",
|
260
|
-
"punctuation.operator",
|
261
|
-
"entity.name.function",
|
262
|
-
"text",
|
263
|
-
"keyword.operator",
|
264
|
-
"text",
|
265
|
-
"storage.type",
|
266
|
-
"text",
|
267
|
-
"paren.lparen"
|
268
|
-
],
|
269
|
-
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
270
|
-
next: "function_arguments"
|
271
|
-
}, { // match stuff like: Sound.prototype.play = myfunc
|
186
|
+
}, {
|
272
187
|
token : [
|
273
|
-
"storage.type",
|
274
|
-
"punctuation.operator",
|
275
|
-
"support.function",
|
276
|
-
"punctuation.operator",
|
277
|
-
"entity.name.function",
|
278
|
-
"text",
|
279
|
-
"keyword.operator",
|
280
|
-
"text"
|
188
|
+
"storage.type", "punctuation.operator", "support.function",
|
189
|
+
"punctuation.operator", "entity.name.function", "text","keyword.operator"
|
281
190
|
],
|
282
|
-
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)
|
191
|
+
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
|
283
192
|
next: "function_arguments"
|
284
|
-
}, {
|
193
|
+
}, {
|
285
194
|
token : [
|
286
|
-
"storage.type",
|
287
|
-
"
|
288
|
-
"entity.name.function",
|
289
|
-
"text",
|
290
|
-
"keyword.operator",
|
291
|
-
"text",
|
292
|
-
"storage.type",
|
293
|
-
"text",
|
294
|
-
"paren.lparen"
|
195
|
+
"storage.type", "punctuation.operator", "entity.name.function", "text",
|
196
|
+
"keyword.operator", "text", "storage.type", "text", "paren.lparen"
|
295
197
|
],
|
296
198
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
297
199
|
next: "function_arguments"
|
298
|
-
}, {
|
200
|
+
}, {
|
299
201
|
token : [
|
300
|
-
"entity.name.function",
|
301
|
-
"text",
|
302
|
-
"keyword.operator",
|
303
|
-
"text",
|
304
|
-
"storage.type",
|
305
|
-
"text",
|
306
|
-
"paren.lparen"
|
202
|
+
"entity.name.function", "text", "keyword.operator", "text", "storage.type",
|
203
|
+
"text", "paren.lparen"
|
307
204
|
],
|
308
205
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
|
309
206
|
next: "function_arguments"
|
310
|
-
}, {
|
207
|
+
}, {
|
311
208
|
token : [
|
312
|
-
"storage.type",
|
313
|
-
"
|
314
|
-
"entity.name.function",
|
315
|
-
"text",
|
316
|
-
"keyword.operator",
|
317
|
-
"text",
|
318
|
-
"storage.type",
|
319
|
-
"text",
|
320
|
-
"entity.name.function",
|
321
|
-
"text",
|
322
|
-
"paren.lparen"
|
209
|
+
"storage.type", "punctuation.operator", "entity.name.function", "text",
|
210
|
+
"keyword.operator", "text",
|
211
|
+
"storage.type", "text", "entity.name.function", "text", "paren.lparen"
|
323
212
|
],
|
324
213
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
|
325
214
|
next: "function_arguments"
|
326
|
-
}, {
|
215
|
+
}, {
|
327
216
|
token : [
|
328
|
-
"storage.type",
|
329
|
-
"text",
|
330
|
-
"entity.name.function",
|
331
|
-
"text",
|
332
|
-
"paren.lparen"
|
217
|
+
"storage.type", "text", "entity.name.function", "text", "paren.lparen"
|
333
218
|
],
|
334
219
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
|
335
220
|
next: "function_arguments"
|
336
|
-
}, {
|
221
|
+
}, {
|
337
222
|
token : [
|
338
|
-
"entity.name.function",
|
339
|
-
"text",
|
340
|
-
"punctuation.operator",
|
341
|
-
"text",
|
342
|
-
"storage.type",
|
343
|
-
"text",
|
344
|
-
"paren.lparen"
|
223
|
+
"entity.name.function", "text", "punctuation.operator",
|
224
|
+
"text", "storage.type", "text", "paren.lparen"
|
345
225
|
],
|
346
226
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
|
347
227
|
next: "function_arguments"
|
348
|
-
}, {
|
228
|
+
}, {
|
349
229
|
token : [
|
350
|
-
"text",
|
351
|
-
"text",
|
352
|
-
"storage.type",
|
353
|
-
"text",
|
354
|
-
"paren.lparen"
|
230
|
+
"text", "text", "storage.type", "text", "paren.lparen"
|
355
231
|
],
|
356
232
|
regex : "(:)(\\s*)(function)(\\s*)(\\()",
|
357
233
|
next: "function_arguments"
|
358
|
-
}, {
|
359
|
-
token : "constant.language.boolean",
|
360
|
-
regex : /(?:true|false)\b/
|
361
234
|
}, {
|
362
235
|
token : "keyword",
|
363
236
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
364
|
-
next : "
|
237
|
+
next : "start"
|
365
238
|
}, {
|
366
239
|
token : ["punctuation.operator", "support.function"],
|
367
|
-
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:
|
240
|
+
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(?=\()/
|
368
241
|
}, {
|
369
242
|
token : ["punctuation.operator", "support.function.dom"],
|
370
243
|
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(?=\()/
|
@@ -375,78 +248,54 @@ var JavaScriptHighlightRules = function() {
|
|
375
248
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
376
249
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
377
250
|
}, {
|
378
|
-
token :
|
379
|
-
if (globals.hasOwnProperty(value))
|
380
|
-
return "variable.language";
|
381
|
-
else if (deprecated.hasOwnProperty(value))
|
382
|
-
return "invalid.deprecated";
|
383
|
-
else if (definitions.hasOwnProperty(value))
|
384
|
-
return "storage.type";
|
385
|
-
else if (keywords.hasOwnProperty(value))
|
386
|
-
return "keyword";
|
387
|
-
else if (buildinConstants.hasOwnProperty(value))
|
388
|
-
return "constant.language";
|
389
|
-
else if (futureReserved.hasOwnProperty(value))
|
390
|
-
return "invalid.illegal";
|
391
|
-
else if (value == "debugger")
|
392
|
-
return "invalid.deprecated";
|
393
|
-
else
|
394
|
-
return "identifier";
|
395
|
-
},
|
251
|
+
token : keywordMapper,
|
396
252
|
regex : identifierRe
|
397
253
|
}, {
|
398
254
|
token : "keyword.operator",
|
399
|
-
regex :
|
400
|
-
next : "
|
255
|
+
regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/,
|
256
|
+
next : "start"
|
401
257
|
}, {
|
402
258
|
token : "punctuation.operator",
|
403
259
|
regex : /\?|\:|\,|\;|\./,
|
404
|
-
next : "
|
260
|
+
next : "start"
|
405
261
|
}, {
|
406
262
|
token : "paren.lparen",
|
407
263
|
regex : /[\[({]/,
|
408
|
-
next : "
|
264
|
+
next : "start"
|
409
265
|
}, {
|
410
266
|
token : "paren.rparen",
|
411
267
|
regex : /[\])}]/
|
412
268
|
}, {
|
413
269
|
token : "keyword.operator",
|
414
270
|
regex : /\/=?/,
|
415
|
-
next : "
|
271
|
+
next : "start"
|
416
272
|
}, {
|
417
273
|
token: "comment",
|
418
274
|
regex: /^#!.*$/
|
419
|
-
}, {
|
420
|
-
token : "text",
|
421
|
-
regex : /\s+/
|
422
275
|
}
|
423
276
|
],
|
424
|
-
|
425
|
-
// makes sure we don't mix up regexps with the divison operator
|
426
|
-
"regex_allowed": [
|
277
|
+
"start": [
|
427
278
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
428
279
|
{
|
429
280
|
token : "comment", // multi line comment
|
430
|
-
merge : true,
|
431
281
|
regex : "\\/\\*",
|
432
282
|
next : "comment_regex_allowed"
|
433
283
|
}, {
|
434
284
|
token : "comment",
|
435
|
-
regex : "
|
285
|
+
regex : "\\/\\/",
|
286
|
+
next : "line_comment_regex_allowed"
|
436
287
|
}, {
|
437
288
|
token: "string.regexp",
|
438
289
|
regex: "\\/",
|
439
|
-
next: "regex"
|
440
|
-
merge: true
|
290
|
+
next: "regex"
|
441
291
|
}, {
|
442
292
|
token : "text",
|
443
|
-
regex : "\\s
|
293
|
+
regex : "\\s+|^$",
|
294
|
+
next : "start"
|
444
295
|
}, {
|
445
|
-
// immediately return to the start mode without matching
|
446
|
-
// anything
|
447
296
|
token: "empty",
|
448
297
|
regex: "",
|
449
|
-
next: "
|
298
|
+
next: "no_regex"
|
450
299
|
}
|
451
300
|
],
|
452
301
|
"regex": [
|
@@ -454,24 +303,28 @@ var JavaScriptHighlightRules = function() {
|
|
454
303
|
token: "regexp.keyword.operator",
|
455
304
|
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
456
305
|
}, {
|
457
|
-
// flag
|
458
306
|
token: "string.regexp",
|
459
|
-
regex: "
|
460
|
-
next: "
|
461
|
-
merge: true
|
307
|
+
regex: "/[sxngimy]*",
|
308
|
+
next: "no_regex"
|
462
309
|
}, {
|
463
|
-
token: "
|
464
|
-
regex:
|
465
|
-
|
310
|
+
token : "invalid",
|
311
|
+
regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
|
312
|
+
}, {
|
313
|
+
token : "constant.language.escape",
|
314
|
+
regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
|
315
|
+
}, {
|
316
|
+
token : "constant.language.delimiter",
|
317
|
+
regex: /\|/
|
466
318
|
}, {
|
467
|
-
token: "
|
468
|
-
regex:
|
469
|
-
next: "regex_character_class"
|
470
|
-
merge: true
|
319
|
+
token: "constant.language.escape",
|
320
|
+
regex: /\[\^?/,
|
321
|
+
next: "regex_character_class"
|
471
322
|
}, {
|
472
323
|
token: "empty",
|
473
|
-
regex: "",
|
474
|
-
next: "
|
324
|
+
regex: "$",
|
325
|
+
next: "no_regex"
|
326
|
+
}, {
|
327
|
+
defaultToken: "string.regexp"
|
475
328
|
}
|
476
329
|
],
|
477
330
|
"regex_character_class": [
|
@@ -479,18 +332,18 @@ var JavaScriptHighlightRules = function() {
|
|
479
332
|
token: "regexp.keyword.operator",
|
480
333
|
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
481
334
|
}, {
|
482
|
-
token: "
|
335
|
+
token: "constant.language.escape",
|
483
336
|
regex: "]",
|
484
|
-
next: "regex"
|
485
|
-
merge: true
|
337
|
+
next: "regex"
|
486
338
|
}, {
|
487
|
-
token: "
|
488
|
-
regex: "
|
489
|
-
merge: true
|
339
|
+
token: "constant.language.escape",
|
340
|
+
regex: "-"
|
490
341
|
}, {
|
491
342
|
token: "empty",
|
492
|
-
regex: "",
|
493
|
-
next: "
|
343
|
+
regex: "$",
|
344
|
+
next: "no_regex"
|
345
|
+
}, {
|
346
|
+
defaultToken: "string.regexp.charachterclass"
|
494
347
|
}
|
495
348
|
],
|
496
349
|
"function_arguments": [
|
@@ -499,86 +352,68 @@ var JavaScriptHighlightRules = function() {
|
|
499
352
|
regex: identifierRe
|
500
353
|
}, {
|
501
354
|
token: "punctuation.operator",
|
502
|
-
regex: "[, ]+"
|
503
|
-
merge: true
|
355
|
+
regex: "[, ]+"
|
504
356
|
}, {
|
505
357
|
token: "punctuation.operator",
|
506
|
-
regex: "$"
|
507
|
-
merge: true
|
358
|
+
regex: "$"
|
508
359
|
}, {
|
509
360
|
token: "empty",
|
510
361
|
regex: "",
|
511
|
-
next: "
|
362
|
+
next: "no_regex"
|
512
363
|
}
|
513
364
|
],
|
514
365
|
"comment_regex_allowed" : [
|
515
|
-
{
|
516
|
-
|
517
|
-
regex : ".*?\\*\\/",
|
518
|
-
merge : true,
|
519
|
-
next : "regex_allowed"
|
520
|
-
}, {
|
521
|
-
token : "comment", // comment spanning whole line
|
522
|
-
merge : true,
|
523
|
-
regex : ".+"
|
524
|
-
}
|
366
|
+
{token : "comment", regex : "\\*\\/", next : "start"},
|
367
|
+
{defaultToken : "comment"}
|
525
368
|
],
|
526
369
|
"comment" : [
|
527
|
-
{
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
}
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
}
|
370
|
+
{token : "comment", regex : "\\*\\/", next : "no_regex"},
|
371
|
+
{defaultToken : "comment"}
|
372
|
+
],
|
373
|
+
"line_comment_regex_allowed" : [
|
374
|
+
{token : "comment", regex : "$|^", next : "start"},
|
375
|
+
{defaultToken : "comment"}
|
376
|
+
],
|
377
|
+
"line_comment" : [
|
378
|
+
{token : "comment", regex : "$|^", next : "no_regex"},
|
379
|
+
{defaultToken : "comment"}
|
537
380
|
],
|
538
381
|
"qqstring" : [
|
539
382
|
{
|
540
383
|
token : "constant.language.escape",
|
541
384
|
regex : escapedRe
|
542
|
-
}, {
|
543
|
-
token : "string",
|
544
|
-
regex : '[^"\\\\]+',
|
545
|
-
merge : true
|
546
385
|
}, {
|
547
386
|
token : "string",
|
548
387
|
regex : "\\\\$",
|
549
|
-
next : "qqstring"
|
550
|
-
merge : true
|
388
|
+
next : "qqstring"
|
551
389
|
}, {
|
552
390
|
token : "string",
|
553
391
|
regex : '"|$',
|
554
|
-
next : "
|
555
|
-
|
392
|
+
next : "no_regex"
|
393
|
+
}, {
|
394
|
+
defaultToken: "string"
|
556
395
|
}
|
557
396
|
],
|
558
397
|
"qstring" : [
|
559
398
|
{
|
560
399
|
token : "constant.language.escape",
|
561
400
|
regex : escapedRe
|
562
|
-
}, {
|
563
|
-
token : "string",
|
564
|
-
regex : "[^'\\\\]+",
|
565
|
-
merge : true
|
566
401
|
}, {
|
567
402
|
token : "string",
|
568
403
|
regex : "\\\\$",
|
569
|
-
next : "qstring"
|
570
|
-
merge : true
|
404
|
+
next : "qstring"
|
571
405
|
}, {
|
572
406
|
token : "string",
|
573
407
|
regex : "'|$",
|
574
|
-
next : "
|
575
|
-
|
408
|
+
next : "no_regex"
|
409
|
+
}, {
|
410
|
+
defaultToken: "string"
|
576
411
|
}
|
577
412
|
]
|
578
413
|
};
|
579
414
|
|
580
415
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
581
|
-
[ DocCommentHighlightRules.getEndRule("
|
416
|
+
[ DocCommentHighlightRules.getEndRule("no_regex") ]);
|
582
417
|
};
|
583
418
|
|
584
419
|
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
|
@@ -599,21 +434,10 @@ var DocCommentHighlightRules = function() {
|
|
599
434
|
token : "comment.doc.tag",
|
600
435
|
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
601
436
|
}, {
|
602
|
-
token : "comment.doc",
|
603
|
-
|
604
|
-
regex : "\\s+"
|
605
|
-
}, {
|
606
|
-
token : "comment.doc",
|
607
|
-
merge : true,
|
608
|
-
regex : "TODO"
|
609
|
-
}, {
|
610
|
-
token : "comment.doc",
|
611
|
-
merge : true,
|
612
|
-
regex : "[^@\\*]+"
|
437
|
+
token : "comment.doc.tag",
|
438
|
+
regex : "\\bTODO\\b"
|
613
439
|
}, {
|
614
|
-
|
615
|
-
merge : true,
|
616
|
-
regex : "."
|
440
|
+
defaultToken : "comment.doc"
|
617
441
|
}]
|
618
442
|
};
|
619
443
|
};
|
@@ -623,7 +447,6 @@ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
|
623
447
|
DocCommentHighlightRules.getStartRule = function(start) {
|
624
448
|
return {
|
625
449
|
token : "comment.doc", // doc comment
|
626
|
-
merge : true,
|
627
450
|
regex : "\\/\\*(?=\\*)",
|
628
451
|
next : start
|
629
452
|
};
|
@@ -632,7 +455,6 @@ DocCommentHighlightRules.getStartRule = function(start) {
|
|
632
455
|
DocCommentHighlightRules.getEndRule = function (start) {
|
633
456
|
return {
|
634
457
|
token : "comment.doc", // closing comment
|
635
|
-
merge : true,
|
636
458
|
regex : "\\*\\/",
|
637
459
|
next : start
|
638
460
|
};
|
@@ -675,12 +497,7 @@ var MatchingBraceOutdent = function() {};
|
|
675
497
|
};
|
676
498
|
|
677
499
|
this.$getIndent = function(line) {
|
678
|
-
|
679
|
-
if (match) {
|
680
|
-
return match[1];
|
681
|
-
}
|
682
|
-
|
683
|
-
return "";
|
500
|
+
return line.match(/^\s*/)[0];
|
684
501
|
};
|
685
502
|
|
686
503
|
}).call(MatchingBraceOutdent.prototype);
|
@@ -688,59 +505,155 @@ var MatchingBraceOutdent = function() {};
|
|
688
505
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
689
506
|
});
|
690
507
|
|
691
|
-
define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour'], function(require, exports, module) {
|
508
|
+
define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
692
509
|
|
693
510
|
|
694
511
|
var oop = require("../../lib/oop");
|
695
512
|
var Behaviour = require("../behaviour").Behaviour;
|
513
|
+
var TokenIterator = require("../../token_iterator").TokenIterator;
|
514
|
+
var lang = require("../../lib/lang");
|
515
|
+
|
516
|
+
var SAFE_INSERT_IN_TOKENS =
|
517
|
+
["text", "paren.rparen", "punctuation.operator"];
|
518
|
+
var SAFE_INSERT_BEFORE_TOKENS =
|
519
|
+
["text", "paren.rparen", "punctuation.operator", "comment"];
|
520
|
+
|
521
|
+
|
522
|
+
var autoInsertedBrackets = 0;
|
523
|
+
var autoInsertedRow = -1;
|
524
|
+
var autoInsertedLineEnd = "";
|
525
|
+
var maybeInsertedBrackets = 0;
|
526
|
+
var maybeInsertedRow = -1;
|
527
|
+
var maybeInsertedLineStart = "";
|
528
|
+
var maybeInsertedLineEnd = "";
|
696
529
|
|
697
530
|
var CstyleBehaviour = function () {
|
531
|
+
|
532
|
+
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
533
|
+
var cursor = editor.getCursorPosition();
|
534
|
+
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
535
|
+
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
536
|
+
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
537
|
+
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
538
|
+
return false;
|
539
|
+
}
|
540
|
+
iterator.stepForward();
|
541
|
+
return iterator.getCurrentTokenRow() !== cursor.row ||
|
542
|
+
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
543
|
+
};
|
544
|
+
|
545
|
+
CstyleBehaviour.$matchTokenType = function(token, types) {
|
546
|
+
return types.indexOf(token.type || token) > -1;
|
547
|
+
};
|
548
|
+
|
549
|
+
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
550
|
+
var cursor = editor.getCursorPosition();
|
551
|
+
var line = session.doc.getLine(cursor.row);
|
552
|
+
if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
|
553
|
+
autoInsertedBrackets = 0;
|
554
|
+
autoInsertedRow = cursor.row;
|
555
|
+
autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
556
|
+
autoInsertedBrackets++;
|
557
|
+
};
|
558
|
+
|
559
|
+
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
560
|
+
var cursor = editor.getCursorPosition();
|
561
|
+
var line = session.doc.getLine(cursor.row);
|
562
|
+
if (!this.isMaybeInsertedClosing(cursor, line))
|
563
|
+
maybeInsertedBrackets = 0;
|
564
|
+
maybeInsertedRow = cursor.row;
|
565
|
+
maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
566
|
+
maybeInsertedLineEnd = line.substr(cursor.column);
|
567
|
+
maybeInsertedBrackets++;
|
568
|
+
};
|
569
|
+
|
570
|
+
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
571
|
+
return autoInsertedBrackets > 0 &&
|
572
|
+
cursor.row === autoInsertedRow &&
|
573
|
+
bracket === autoInsertedLineEnd[0] &&
|
574
|
+
line.substr(cursor.column) === autoInsertedLineEnd;
|
575
|
+
};
|
576
|
+
|
577
|
+
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
578
|
+
return maybeInsertedBrackets > 0 &&
|
579
|
+
cursor.row === maybeInsertedRow &&
|
580
|
+
line.substr(cursor.column) === maybeInsertedLineEnd &&
|
581
|
+
line.substr(0, cursor.column) == maybeInsertedLineStart;
|
582
|
+
};
|
583
|
+
|
584
|
+
CstyleBehaviour.popAutoInsertedClosing = function() {
|
585
|
+
autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
|
586
|
+
autoInsertedBrackets--;
|
587
|
+
};
|
588
|
+
|
589
|
+
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
590
|
+
maybeInsertedBrackets = 0;
|
591
|
+
maybeInsertedRow = -1;
|
592
|
+
};
|
698
593
|
|
699
594
|
this.add("braces", "insertion", function (state, action, editor, session, text) {
|
595
|
+
var cursor = editor.getCursorPosition();
|
596
|
+
var line = session.doc.getLine(cursor.row);
|
700
597
|
if (text == '{') {
|
701
598
|
var selection = editor.getSelectionRange();
|
702
599
|
var selected = session.doc.getTextRange(selection);
|
703
|
-
if (selected !== "") {
|
600
|
+
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
704
601
|
return {
|
705
602
|
text: '{' + selected + '}',
|
706
603
|
selection: false
|
707
604
|
};
|
708
|
-
} else {
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
605
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
606
|
+
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
607
|
+
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
608
|
+
return {
|
609
|
+
text: '{}',
|
610
|
+
selection: [1, 1]
|
611
|
+
};
|
612
|
+
} else {
|
613
|
+
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
614
|
+
return {
|
615
|
+
text: '{',
|
616
|
+
selection: [1, 1]
|
617
|
+
};
|
618
|
+
}
|
713
619
|
}
|
714
620
|
} else if (text == '}') {
|
715
|
-
var cursor = editor.getCursorPosition();
|
716
|
-
var line = session.doc.getLine(cursor.row);
|
717
621
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
718
622
|
if (rightChar == '}') {
|
719
623
|
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
720
|
-
if (matching !== null) {
|
624
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
625
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
721
626
|
return {
|
722
627
|
text: '',
|
723
628
|
selection: [1, 1]
|
724
629
|
};
|
725
630
|
}
|
726
631
|
}
|
727
|
-
} else if (text == "\n") {
|
728
|
-
var
|
729
|
-
|
632
|
+
} else if (text == "\n" || text == "\r\n") {
|
633
|
+
var closing = "";
|
634
|
+
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
635
|
+
closing = lang.stringRepeat("}", maybeInsertedBrackets);
|
636
|
+
CstyleBehaviour.clearMaybeInsertedClosing();
|
637
|
+
}
|
730
638
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
731
|
-
if (rightChar
|
732
|
-
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column
|
639
|
+
if (rightChar === '}') {
|
640
|
+
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
|
733
641
|
if (!openBracePos)
|
734
642
|
return null;
|
735
|
-
|
736
|
-
|
737
|
-
var next_indent = this.$getIndent(
|
738
|
-
|
739
|
-
return
|
740
|
-
text: '\n' + indent + '\n' + next_indent,
|
741
|
-
selection: [1, indent.length, 1, indent.length]
|
742
|
-
};
|
643
|
+
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
644
|
+
} else if (closing) {
|
645
|
+
var next_indent = this.$getIndent(line);
|
646
|
+
} else {
|
647
|
+
return;
|
743
648
|
}
|
649
|
+
var indent = next_indent + session.getTabString();
|
650
|
+
|
651
|
+
return {
|
652
|
+
text: '\n' + indent + '\n' + next_indent + closing,
|
653
|
+
selection: [1, indent.length, 1, indent.length]
|
654
|
+
};
|
655
|
+
} else {
|
656
|
+
CstyleBehaviour.clearMaybeInsertedClosing();
|
744
657
|
}
|
745
658
|
});
|
746
659
|
|
@@ -752,6 +665,8 @@ var CstyleBehaviour = function () {
|
|
752
665
|
if (rightChar == '}') {
|
753
666
|
range.end.column++;
|
754
667
|
return range;
|
668
|
+
} else {
|
669
|
+
maybeInsertedBrackets--;
|
755
670
|
}
|
756
671
|
}
|
757
672
|
});
|
@@ -760,12 +675,13 @@ var CstyleBehaviour = function () {
|
|
760
675
|
if (text == '(') {
|
761
676
|
var selection = editor.getSelectionRange();
|
762
677
|
var selected = session.doc.getTextRange(selection);
|
763
|
-
if (selected !== "") {
|
678
|
+
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
764
679
|
return {
|
765
680
|
text: '(' + selected + ')',
|
766
681
|
selection: false
|
767
682
|
};
|
768
|
-
} else {
|
683
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
684
|
+
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
769
685
|
return {
|
770
686
|
text: '()',
|
771
687
|
selection: [1, 1]
|
@@ -777,7 +693,8 @@ var CstyleBehaviour = function () {
|
|
777
693
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
778
694
|
if (rightChar == ')') {
|
779
695
|
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
780
|
-
if (matching !== null) {
|
696
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
697
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
781
698
|
return {
|
782
699
|
text: '',
|
783
700
|
selection: [1, 1]
|
@@ -803,12 +720,13 @@ var CstyleBehaviour = function () {
|
|
803
720
|
if (text == '[') {
|
804
721
|
var selection = editor.getSelectionRange();
|
805
722
|
var selected = session.doc.getTextRange(selection);
|
806
|
-
if (selected !== "") {
|
723
|
+
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
807
724
|
return {
|
808
725
|
text: '[' + selected + ']',
|
809
726
|
selection: false
|
810
727
|
};
|
811
|
-
} else {
|
728
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
729
|
+
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
812
730
|
return {
|
813
731
|
text: '[]',
|
814
732
|
selection: [1, 1]
|
@@ -820,7 +738,8 @@ var CstyleBehaviour = function () {
|
|
820
738
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
821
739
|
if (rightChar == ']') {
|
822
740
|
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
823
|
-
if (matching !== null) {
|
741
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
742
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
824
743
|
return {
|
825
744
|
text: '',
|
826
745
|
selection: [1, 1]
|
@@ -847,7 +766,7 @@ var CstyleBehaviour = function () {
|
|
847
766
|
var quote = text;
|
848
767
|
var selection = editor.getSelectionRange();
|
849
768
|
var selected = session.doc.getTextRange(selection);
|
850
|
-
if (selected !== "") {
|
769
|
+
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
851
770
|
return {
|
852
771
|
text: quote + selected + quote,
|
853
772
|
selection: false
|
@@ -856,13 +775,9 @@ var CstyleBehaviour = function () {
|
|
856
775
|
var cursor = editor.getCursorPosition();
|
857
776
|
var line = session.doc.getLine(cursor.row);
|
858
777
|
var leftChar = line.substring(cursor.column-1, cursor.column);
|
859
|
-
|
860
|
-
// We're escaped.
|
861
778
|
if (leftChar == '\\') {
|
862
779
|
return null;
|
863
780
|
}
|
864
|
-
|
865
|
-
// Find what token we're inside.
|
866
781
|
var tokens = session.getTokens(selection.start.row);
|
867
782
|
var col = 0, token;
|
868
783
|
var quotepos = -1; // Track whether we're inside an open quote.
|
@@ -879,15 +794,14 @@ var CstyleBehaviour = function () {
|
|
879
794
|
}
|
880
795
|
col += tokens[x].value.length;
|
881
796
|
}
|
882
|
-
|
883
|
-
// Try and be smart about when we auto insert.
|
884
797
|
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)))) {
|
798
|
+
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
799
|
+
return;
|
885
800
|
return {
|
886
801
|
text: quote + quote,
|
887
802
|
selection: [1,1]
|
888
803
|
};
|
889
804
|
} else if (token && token.type === "string") {
|
890
|
-
// Ignore input and move right one if we're typing over the closing quote.
|
891
805
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
892
806
|
if (rightChar == quote) {
|
893
807
|
return {
|
@@ -905,7 +819,7 @@ var CstyleBehaviour = function () {
|
|
905
819
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
906
820
|
var line = session.doc.getLine(range.start.row);
|
907
821
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
908
|
-
if (rightChar ==
|
822
|
+
if (rightChar == selected) {
|
909
823
|
range.end.column++;
|
910
824
|
return range;
|
911
825
|
}
|
@@ -926,15 +840,24 @@ var oop = require("../../lib/oop");
|
|
926
840
|
var Range = require("../../range").Range;
|
927
841
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
928
842
|
|
929
|
-
var FoldMode = exports.FoldMode = function() {
|
843
|
+
var FoldMode = exports.FoldMode = function(commentRegex) {
|
844
|
+
if (commentRegex) {
|
845
|
+
this.foldingStartMarker = new RegExp(
|
846
|
+
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
847
|
+
);
|
848
|
+
this.foldingStopMarker = new RegExp(
|
849
|
+
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
850
|
+
);
|
851
|
+
}
|
852
|
+
};
|
930
853
|
oop.inherits(FoldMode, BaseFoldMode);
|
931
854
|
|
932
855
|
(function() {
|
933
856
|
|
934
857
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
935
858
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
936
|
-
|
937
|
-
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
859
|
+
|
860
|
+
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
938
861
|
var line = session.getLine(row);
|
939
862
|
var match = line.match(this.foldingStartMarker);
|
940
863
|
if (match) {
|
@@ -942,133 +865,78 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|
942
865
|
|
943
866
|
if (match[1])
|
944
867
|
return this.openingBracketBlock(session, match[1], row, i);
|
945
|
-
|
946
|
-
var range = session.getCommentFoldRange(row, i + match[0].length);
|
947
|
-
|
868
|
+
|
869
|
+
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
870
|
+
|
871
|
+
if (range && !range.isMultiLine()) {
|
872
|
+
if (forceMultiline) {
|
873
|
+
range = this.getSectionRange(session, row);
|
874
|
+
} else if (foldStyle != "all")
|
875
|
+
range = null;
|
876
|
+
}
|
877
|
+
|
948
878
|
return range;
|
949
879
|
}
|
950
880
|
|
951
|
-
if (foldStyle
|
881
|
+
if (foldStyle === "markbegin")
|
952
882
|
return;
|
953
|
-
|
883
|
+
|
954
884
|
var match = line.match(this.foldingStopMarker);
|
955
885
|
if (match) {
|
956
886
|
var i = match.index + match[0].length;
|
957
887
|
|
958
|
-
if (match[
|
959
|
-
|
960
|
-
range.end.column -= 2;
|
961
|
-
return range;
|
962
|
-
}
|
963
|
-
|
964
|
-
var end = {row: row, column: i};
|
965
|
-
var start = session.$findOpeningBracket(match[1], end);
|
966
|
-
|
967
|
-
if (!start)
|
968
|
-
return;
|
969
|
-
|
970
|
-
start.column++;
|
971
|
-
end.column--;
|
888
|
+
if (match[1])
|
889
|
+
return this.closingBracketBlock(session, match[1], row, i);
|
972
890
|
|
973
|
-
return
|
891
|
+
return session.getCommentFoldRange(row, i, -1);
|
974
892
|
}
|
975
893
|
};
|
976
894
|
|
977
|
-
|
978
|
-
|
979
|
-
});
|
980
|
-
|
981
|
-
define('ace/mode/folding/fold_mode', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
982
|
-
|
983
|
-
|
984
|
-
var Range = require("../../range").Range;
|
985
|
-
|
986
|
-
var FoldMode = exports.FoldMode = function() {};
|
987
|
-
|
988
|
-
(function() {
|
989
|
-
|
990
|
-
this.foldingStartMarker = null;
|
991
|
-
this.foldingStopMarker = null;
|
992
|
-
|
993
|
-
// must return "" if there's no fold, to enable caching
|
994
|
-
this.getFoldWidget = function(session, foldStyle, row) {
|
895
|
+
this.getSectionRange = function(session, row) {
|
995
896
|
var line = session.getLine(row);
|
996
|
-
|
997
|
-
return "start";
|
998
|
-
if (foldStyle == "markbeginend"
|
999
|
-
&& this.foldingStopMarker
|
1000
|
-
&& this.foldingStopMarker.test(line))
|
1001
|
-
return "end";
|
1002
|
-
return "";
|
1003
|
-
};
|
1004
|
-
|
1005
|
-
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
1006
|
-
return null;
|
1007
|
-
};
|
1008
|
-
|
1009
|
-
this.indentationBlock = function(session, row, column) {
|
1010
|
-
var re = /\S/;
|
1011
|
-
var line = session.getLine(row);
|
1012
|
-
var startLevel = line.search(re);
|
1013
|
-
if (startLevel == -1)
|
1014
|
-
return;
|
1015
|
-
|
1016
|
-
var startColumn = column || line.length;
|
1017
|
-
var maxRow = session.getLength();
|
897
|
+
var startIndent = line.search(/\S/);
|
1018
898
|
var startRow = row;
|
899
|
+
var startColumn = line.length;
|
900
|
+
row = row + 1;
|
1019
901
|
var endRow = row;
|
1020
|
-
|
902
|
+
var maxRow = session.getLength();
|
1021
903
|
while (++row < maxRow) {
|
1022
|
-
|
1023
|
-
|
1024
|
-
if (
|
904
|
+
line = session.getLine(row);
|
905
|
+
var indent = line.search(/\S/);
|
906
|
+
if (indent === -1)
|
1025
907
|
continue;
|
1026
|
-
|
1027
|
-
if (level <= startLevel)
|
908
|
+
if (startIndent > indent)
|
1028
909
|
break;
|
1029
|
-
|
910
|
+
var subRange = this.getFoldWidgetRange(session, "all", row);
|
911
|
+
|
912
|
+
if (subRange) {
|
913
|
+
if (subRange.start.row <= startRow) {
|
914
|
+
break;
|
915
|
+
} else if (subRange.isMultiLine()) {
|
916
|
+
row = subRange.end.row;
|
917
|
+
} else if (startIndent == indent) {
|
918
|
+
break;
|
919
|
+
}
|
920
|
+
}
|
1030
921
|
endRow = row;
|
1031
922
|
}
|
1032
|
-
|
1033
|
-
|
1034
|
-
var endColumn = session.getLine(endRow).length;
|
1035
|
-
return new Range(startRow, startColumn, endRow, endColumn);
|
1036
|
-
}
|
1037
|
-
};
|
1038
|
-
|
1039
|
-
this.openingBracketBlock = function(session, bracket, row, column, typeRe) {
|
1040
|
-
var start = {row: row, column: column + 1};
|
1041
|
-
var end = session.$findClosingBracket(bracket, start, typeRe);
|
1042
|
-
if (!end)
|
1043
|
-
return;
|
1044
|
-
|
1045
|
-
var fw = session.foldWidgets[end.row];
|
1046
|
-
if (fw == null)
|
1047
|
-
fw = this.getFoldWidget(session, end.row);
|
1048
|
-
|
1049
|
-
if (fw == "start" && end.row > start.row) {
|
1050
|
-
end.row --;
|
1051
|
-
end.column = session.getLine(end.row).length;
|
1052
|
-
}
|
1053
|
-
return Range.fromPoints(start, end);
|
923
|
+
|
924
|
+
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
1054
925
|
};
|
1055
926
|
|
1056
927
|
}).call(FoldMode.prototype);
|
1057
928
|
|
1058
929
|
});
|
1059
|
-
define('ace/mode/java_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/
|
930
|
+
define('ace/mode/java_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
1060
931
|
|
1061
932
|
|
1062
933
|
var oop = require("../lib/oop");
|
1063
|
-
var lang = require("../lib/lang");
|
1064
934
|
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
1065
935
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
1066
936
|
|
1067
937
|
var JavaHighlightRules = function() {
|
1068
|
-
|
1069
|
-
|
1070
|
-
var keywords = lang.arrayToMap(
|
1071
|
-
("abstract|continue|for|new|switch|" +
|
938
|
+
var keywords = (
|
939
|
+
"abstract|continue|for|new|switch|" +
|
1072
940
|
"assert|default|goto|package|synchronized|" +
|
1073
941
|
"boolean|do|if|private|this|" +
|
1074
942
|
"break|double|implements|protected|throw|" +
|
@@ -1077,15 +945,14 @@ var JavaHighlightRules = function() {
|
|
1077
945
|
"catch|extends|int|short|try|" +
|
1078
946
|
"char|final|interface|static|void|" +
|
1079
947
|
"class|finally|long|strictfp|volatile|" +
|
1080
|
-
"const|float|native|super|while"
|
948
|
+
"const|float|native|super|while"
|
1081
949
|
);
|
1082
950
|
|
1083
|
-
var buildinConstants =
|
1084
|
-
("null|Infinity|NaN|undefined").split("|")
|
1085
|
-
);
|
951
|
+
var buildinConstants = ("null|Infinity|NaN|undefined");
|
1086
952
|
|
1087
|
-
|
1088
|
-
|
953
|
+
|
954
|
+
var langClasses = (
|
955
|
+
"AbstractMethodError|AssertionError|ClassCircularityError|"+
|
1089
956
|
"ClassFormatError|Deprecated|EnumConstantNotPresentException|"+
|
1090
957
|
"ExceptionInInitializerError|IllegalAccessError|"+
|
1091
958
|
"IllegalThreadStateException|InstantiationError|InternalError|"+
|
@@ -1108,14 +975,15 @@ var JavaHighlightRules = function() {
|
|
1108
975
|
"ArrayStoreException|ClassCastException|LinkageError|"+
|
1109
976
|
"NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+
|
1110
977
|
"Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+
|
1111
|
-
"Cloneable|Class|CharSequence|Comparable|String|Object"
|
1112
|
-
);
|
1113
|
-
|
1114
|
-
var importClasses = lang.arrayToMap(
|
1115
|
-
("").split("|")
|
978
|
+
"Cloneable|Class|CharSequence|Comparable|String|Object"
|
1116
979
|
);
|
1117
|
-
|
1118
|
-
|
980
|
+
|
981
|
+
var keywordMapper = this.createKeywordMapper({
|
982
|
+
"variable.language": "this",
|
983
|
+
"keyword": keywords,
|
984
|
+
"constant.language": buildinConstants,
|
985
|
+
"support.function": langClasses
|
986
|
+
}, "identifier");
|
1119
987
|
|
1120
988
|
this.$rules = {
|
1121
989
|
"start" : [
|
@@ -1126,7 +994,6 @@ var JavaHighlightRules = function() {
|
|
1126
994
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
1127
995
|
{
|
1128
996
|
token : "comment", // multi line comment
|
1129
|
-
merge : true,
|
1130
997
|
regex : "\\/\\*",
|
1131
998
|
next : "comment"
|
1132
999
|
}, {
|
@@ -1148,22 +1015,7 @@ var JavaHighlightRules = function() {
|
|
1148
1015
|
token : "constant.language.boolean",
|
1149
1016
|
regex : "(?:true|false)\\b"
|
1150
1017
|
}, {
|
1151
|
-
token :
|
1152
|
-
if (value == "this")
|
1153
|
-
return "variable.language";
|
1154
|
-
else if (keywords.hasOwnProperty(value))
|
1155
|
-
return "keyword";
|
1156
|
-
else if (langClasses.hasOwnProperty(value))
|
1157
|
-
return "support.function";
|
1158
|
-
else if (importClasses.hasOwnProperty(value))
|
1159
|
-
return "support.function";
|
1160
|
-
else if (buildinConstants.hasOwnProperty(value))
|
1161
|
-
return "constant.language";
|
1162
|
-
else
|
1163
|
-
return "identifier";
|
1164
|
-
},
|
1165
|
-
// TODO: Unicode escape sequences
|
1166
|
-
// TODO: Unicode identifiers
|
1018
|
+
token : keywordMapper,
|
1167
1019
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
1168
1020
|
}, {
|
1169
1021
|
token : "keyword.operator",
|
@@ -1186,12 +1038,11 @@ var JavaHighlightRules = function() {
|
|
1186
1038
|
next : "start"
|
1187
1039
|
}, {
|
1188
1040
|
token : "comment", // comment spanning whole line
|
1189
|
-
merge : true,
|
1190
1041
|
regex : ".+"
|
1191
1042
|
}
|
1192
1043
|
]
|
1193
1044
|
};
|
1194
|
-
|
1045
|
+
|
1195
1046
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
1196
1047
|
[ DocCommentHighlightRules.getEndRule("start") ]);
|
1197
1048
|
};
|