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