datagram 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. data/.env.sample +7 -0
  2. data/.gitignore +20 -0
  3. data/.rbenv-version +1 -0
  4. data/Gemfile +12 -0
  5. data/LICENSE.txt +22 -0
  6. data/Procfile +1 -0
  7. data/README.md +29 -0
  8. data/Rakefile +1 -0
  9. data/config.ru +5 -0
  10. data/datagram.gemspec +23 -0
  11. data/db/migrate/1_create_queries.rb +9 -0
  12. data/db/migrate/2_add_name_to_queries.rb +5 -0
  13. data/lib/datagram/version.rb +3 -0
  14. data/lib/datagram.rb +135 -0
  15. data/lib/views/application.coffee +222 -0
  16. data/lib/views/index.haml +47 -0
  17. data/lib/views/layout.haml +17 -0
  18. data/lib/views/style.sass +179 -0
  19. data/public/ace/ace.js +15209 -0
  20. data/public/ace/ext-elastic_tabstops_lite.js +301 -0
  21. data/public/ace/ext-emmet.js +253 -0
  22. data/public/ace/ext-searchbox.js +441 -0
  23. data/public/ace/ext-spellcheck.js +67 -0
  24. data/public/ace/ext-static_highlight.js +96 -0
  25. data/public/ace/ext-textarea.js +492 -0
  26. data/public/ace/ext-whitespace.js +204 -0
  27. data/public/ace/keybinding-emacs.js +962 -0
  28. data/public/ace/keybinding-vim.js +1704 -0
  29. data/public/ace/mode-abap.js +260 -0
  30. data/public/ace/mode-asciidoc.js +372 -0
  31. data/public/ace/mode-c9search.js +182 -0
  32. data/public/ace/mode-c_cpp.js +737 -0
  33. data/public/ace/mode-clojure.js +299 -0
  34. data/public/ace/mode-coffee.js +426 -0
  35. data/public/ace/mode-coldfusion.js +1753 -0
  36. data/public/ace/mode-csharp.js +612 -0
  37. data/public/ace/mode-css.js +773 -0
  38. data/public/ace/mode-curly.js +1950 -0
  39. data/public/ace/mode-dart.js +945 -0
  40. data/public/ace/mode-diff.js +166 -0
  41. data/public/ace/mode-django.js +1969 -0
  42. data/public/ace/mode-dot.js +320 -0
  43. data/public/ace/mode-ftl.js +907 -0
  44. data/public/ace/mode-glsl.js +810 -0
  45. data/public/ace/mode-golang.js +632 -0
  46. data/public/ace/mode-groovy.js +1037 -0
  47. data/public/ace/mode-haml.js +487 -0
  48. data/public/ace/mode-haxe.js +609 -0
  49. data/public/ace/mode-html.js +1881 -0
  50. data/public/ace/mode-jade.js +1951 -0
  51. data/public/ace/mode-java.js +996 -0
  52. data/public/ace/mode-javascript.js +876 -0
  53. data/public/ace/mode-json.js +578 -0
  54. data/public/ace/mode-jsp.js +1351 -0
  55. data/public/ace/mode-jsx.js +635 -0
  56. data/public/ace/mode-latex.js +189 -0
  57. data/public/ace/mode-less.js +807 -0
  58. data/public/ace/mode-liquid.js +862 -0
  59. data/public/ace/mode-lisp.js +138 -0
  60. data/public/ace/mode-livescript.js +288 -0
  61. data/public/ace/mode-logiql.js +664 -0
  62. data/public/ace/mode-lsl.js +828 -0
  63. data/public/ace/mode-lua.js +455 -0
  64. data/public/ace/mode-luapage.js +2340 -0
  65. data/public/ace/mode-lucene.js +64 -0
  66. data/public/ace/mode-makefile.js +313 -0
  67. data/public/ace/mode-markdown.js +2280 -0
  68. data/public/ace/mode-mushcode.js +704 -0
  69. data/public/ace/mode-mushcode_high_rules.js +569 -0
  70. data/public/ace/mode-objectivec.js +659 -0
  71. data/public/ace/mode-ocaml.js +443 -0
  72. data/public/ace/mode-pascal.js +233 -0
  73. data/public/ace/mode-perl.js +316 -0
  74. data/public/ace/mode-pgsql.js +908 -0
  75. data/public/ace/mode-php.js +2291 -0
  76. data/public/ace/mode-powershell.js +618 -0
  77. data/public/ace/mode-python.js +264 -0
  78. data/public/ace/mode-r.js +404 -0
  79. data/public/ace/mode-rdoc.js +184 -0
  80. data/public/ace/mode-rhtml.js +2168 -0
  81. data/public/ace/mode-ruby.js +431 -0
  82. data/public/ace/mode-sass.js +442 -0
  83. data/public/ace/mode-scad.js +670 -0
  84. data/public/ace/mode-scala.js +1025 -0
  85. data/public/ace/mode-scheme.js +144 -0
  86. data/public/ace/mode-scss.js +832 -0
  87. data/public/ace/mode-sh.js +204 -0
  88. data/public/ace/mode-sql.js +118 -0
  89. data/public/ace/mode-stylus.js +483 -0
  90. data/public/ace/mode-svg.js +1442 -0
  91. data/public/ace/mode-tcl.js +319 -0
  92. data/public/ace/mode-tex.js +166 -0
  93. data/public/ace/mode-text.js +0 -0
  94. data/public/ace/mode-textile.js +170 -0
  95. data/public/ace/mode-tmsnippet.js +200 -0
  96. data/public/ace/mode-toml.js +180 -0
  97. data/public/ace/mode-typescript.js +961 -0
  98. data/public/ace/mode-vbscript.js +281 -0
  99. data/public/ace/mode-velocity.js +962 -0
  100. data/public/ace/mode-xml.js +789 -0
  101. data/public/ace/mode-xquery.js +2750 -0
  102. data/public/ace/mode-yaml.js +289 -0
  103. data/public/ace/theme-ambiance.js +202 -0
  104. data/public/ace/theme-chaos.js +182 -0
  105. data/public/ace/theme-chrome.js +161 -0
  106. data/public/ace/theme-clouds.js +135 -0
  107. data/public/ace/theme-clouds_midnight.js +136 -0
  108. data/public/ace/theme-cobalt.js +150 -0
  109. data/public/ace/theme-crimson_editor.js +154 -0
  110. data/public/ace/theme-dawn.js +146 -0
  111. data/public/ace/theme-dreamweaver.js +173 -0
  112. data/public/ace/theme-eclipse.js +122 -0
  113. data/public/ace/theme-github.js +136 -0
  114. data/public/ace/theme-idle_fingers.js +136 -0
  115. data/public/ace/theme-kr.js +143 -0
  116. data/public/ace/theme-merbivore.js +135 -0
  117. data/public/ace/theme-merbivore_soft.js +136 -0
  118. data/public/ace/theme-mono_industrial.js +148 -0
  119. data/public/ace/theme-monokai.js +140 -0
  120. data/public/ace/theme-pastel_on_dark.js +148 -0
  121. data/public/ace/theme-solarized_dark.js +128 -0
  122. data/public/ace/theme-solarized_light.js +131 -0
  123. data/public/ace/theme-terminal.js +154 -0
  124. data/public/ace/theme-textmate.js +0 -0
  125. data/public/ace/theme-tomorrow.js +147 -0
  126. data/public/ace/theme-tomorrow_night.js +147 -0
  127. data/public/ace/theme-tomorrow_night_blue.js +145 -0
  128. data/public/ace/theme-tomorrow_night_bright.js +147 -0
  129. data/public/ace/theme-tomorrow_night_eighties.js +144 -0
  130. data/public/ace/theme-twilight.js +147 -0
  131. data/public/ace/theme-vibrant_ink.js +131 -0
  132. data/public/ace/theme-xcode.js +125 -0
  133. data/public/ace/worker-coffee.js +7091 -0
  134. data/public/ace/worker-css.js +8289 -0
  135. data/public/ace/worker-javascript.js +6496 -0
  136. data/public/ace/worker-json.js +2305 -0
  137. data/public/ace/worker-lua.js +3313 -0
  138. data/public/ace/worker-php.js +6743 -0
  139. data/public/ace/worker-xquery.js +21897 -0
  140. data/public/font/FontAwesome.otf +0 -0
  141. data/public/font/fontawesome-webfont.eot +0 -0
  142. data/public/font/fontawesome-webfont.svg +284 -0
  143. data/public/font/fontawesome-webfont.ttf +0 -0
  144. data/public/font/fontawesome-webfont.woff +0 -0
  145. data/public/font-awesome.css +540 -0
  146. data/public/jquery.js +9597 -0
  147. data/script/migrate.sh +2 -0
  148. metadata +242 -0
@@ -0,0 +1,1753 @@
1
+ /* ***** BEGIN LICENSE BLOCK *****
2
+ * Distributed under the BSD license:
3
+ *
4
+ * Copyright (c) 2010, Ajax.org B.V.
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are met:
9
+ * * Redistributions of source code must retain the above copyright
10
+ * notice, this list of conditions and the following disclaimer.
11
+ * * Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following disclaimer in the
13
+ * documentation and/or other materials provided with the distribution.
14
+ * * Neither the name of Ajax.org B.V. nor the
15
+ * names of its contributors may be used to endorse or promote products
16
+ * derived from this software without specific prior written permission.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
22
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ *
29
+ * ***** END LICENSE BLOCK ***** */
30
+
31
+ define('ace/mode/coldfusion', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml', 'ace/mode/javascript', 'ace/mode/css', 'ace/tokenizer', 'ace/mode/coldfusion_highlight_rules'], function(require, exports, module) {
32
+
33
+
34
+ var oop = require("../lib/oop");
35
+ var XmlMode = require("./xml").Mode;
36
+ var JavaScriptMode = require("./javascript").Mode;
37
+ var CssMode = require("./css").Mode;
38
+ var Tokenizer = require("../tokenizer").Tokenizer;
39
+ var ColdfusionHighlightRules = require("./coldfusion_highlight_rules").ColdfusionHighlightRules;
40
+
41
+ var Mode = function() {
42
+ XmlMode.call(this);
43
+
44
+ var highlighter = new ColdfusionHighlightRules();
45
+ this.$tokenizer = new Tokenizer(highlighter.getRules());
46
+
47
+ this.$embeds = highlighter.getEmbeds();
48
+ this.createModeDelegates({
49
+ "js-": JavaScriptMode,
50
+ "css-": CssMode
51
+ });
52
+ };
53
+ oop.inherits(Mode, XmlMode);
54
+
55
+ (function() {
56
+
57
+ this.getNextLineIndent = function(state, line, tab) {
58
+ return this.$getIndent(line);
59
+ };
60
+
61
+ }).call(Mode.prototype);
62
+
63
+ exports.Mode = Mode;
64
+ });
65
+
66
+ define('ace/mode/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xml_highlight_rules', 'ace/mode/behaviour/xml', 'ace/mode/folding/xml'], function(require, exports, module) {
67
+
68
+
69
+ var oop = require("../lib/oop");
70
+ var TextMode = require("./text").Mode;
71
+ var Tokenizer = require("../tokenizer").Tokenizer;
72
+ var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
73
+ var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
74
+ var XmlFoldMode = require("./folding/xml").FoldMode;
75
+
76
+ var Mode = function() {
77
+ this.$tokenizer = new Tokenizer(new XmlHighlightRules().getRules());
78
+ this.$behaviour = new XmlBehaviour();
79
+ this.foldingRules = new XmlFoldMode();
80
+ };
81
+
82
+ oop.inherits(Mode, TextMode);
83
+
84
+ (function() {
85
+
86
+ this.blockComment = {start: "<!--", end: "-->"};
87
+
88
+ }).call(Mode.prototype);
89
+
90
+ exports.Mode = Mode;
91
+ });
92
+
93
+ define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
94
+
95
+
96
+ var oop = require("../lib/oop");
97
+ var xmlUtil = require("./xml_util");
98
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
99
+
100
+ var XmlHighlightRules = function() {
101
+ this.$rules = {
102
+ start : [
103
+ {token : "text", regex : "<\\!\\[CDATA\\[", next : "cdata"},
104
+ {token : "xml-pe", regex : "<\\?.*?\\?>"},
105
+ {token : "comment", regex : "<\\!--", next : "comment"},
106
+ {token : "xml-pe", regex : "<\\!.*?>"},
107
+ {token : "meta.tag", regex : "<\\/?", next : "tag"},
108
+ {token : "text", regex : "\\s+"},
109
+ {
110
+ token : "constant.character.entity",
111
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
112
+ }
113
+ ],
114
+
115
+ cdata : [
116
+ {token : "text", regex : "\\]\\]>", next : "start"},
117
+ {token : "text", regex : "\\s+"},
118
+ {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"}
119
+ ],
120
+
121
+ comment : [
122
+ {token : "comment", regex : ".*?-->", next : "start"},
123
+ {token : "comment", regex : ".+"}
124
+ ]
125
+ };
126
+
127
+ xmlUtil.tag(this.$rules, "tag", "start");
128
+ };
129
+
130
+ oop.inherits(XmlHighlightRules, TextHighlightRules);
131
+
132
+ exports.XmlHighlightRules = XmlHighlightRules;
133
+ });
134
+
135
+ define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) {
136
+
137
+
138
+ function string(state) {
139
+ return [{
140
+ token : "string",
141
+ regex : '"',
142
+ next : state + "_qqstring"
143
+ }, {
144
+ token : "string",
145
+ regex : "'",
146
+ next : state + "_qstring"
147
+ }];
148
+ }
149
+
150
+ function multiLineString(quote, state) {
151
+ return [
152
+ {token : "string", regex : quote, next : state},
153
+ {
154
+ token : "constant.language.escape",
155
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
156
+ },
157
+ {defaultToken : "string"}
158
+ ];
159
+ }
160
+
161
+ exports.tag = function(states, name, nextState, tagMap) {
162
+ states[name] = [{
163
+ token : "text",
164
+ regex : "\\s+"
165
+ }, {
166
+
167
+ token : !tagMap ? "meta.tag.tag-name" : function(value) {
168
+ if (tagMap[value])
169
+ return "meta.tag.tag-name." + tagMap[value];
170
+ else
171
+ return "meta.tag.tag-name";
172
+ },
173
+ regex : "[-_a-zA-Z0-9:]+",
174
+ next : name + "_embed_attribute_list"
175
+ }, {
176
+ token: "empty",
177
+ regex: "",
178
+ next : name + "_embed_attribute_list"
179
+ }];
180
+
181
+ states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
182
+ states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
183
+
184
+ states[name + "_embed_attribute_list"] = [{
185
+ token : "meta.tag.r",
186
+ regex : "/?>",
187
+ next : nextState
188
+ }, {
189
+ token : "keyword.operator",
190
+ regex : "="
191
+ }, {
192
+ token : "entity.other.attribute-name",
193
+ regex : "[-_a-zA-Z0-9:]+"
194
+ }, {
195
+ token : "constant.numeric", // float
196
+ regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
197
+ }, {
198
+ token : "text",
199
+ regex : "\\s+"
200
+ }].concat(string(name));
201
+ };
202
+
203
+ });
204
+
205
+ define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) {
206
+
207
+
208
+ var oop = require("../../lib/oop");
209
+ var Behaviour = require("../behaviour").Behaviour;
210
+ var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
211
+ var TokenIterator = require("../../token_iterator").TokenIterator;
212
+
213
+ function hasType(token, type) {
214
+ var hasType = true;
215
+ var typeList = token.type.split('.');
216
+ var needleList = type.split('.');
217
+ needleList.forEach(function(needle){
218
+ if (typeList.indexOf(needle) == -1) {
219
+ hasType = false;
220
+ return false;
221
+ }
222
+ });
223
+ return hasType;
224
+ }
225
+
226
+ var XmlBehaviour = function () {
227
+
228
+ this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour
229
+
230
+ this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
231
+ if (text == '>') {
232
+ var position = editor.getCursorPosition();
233
+ var iterator = new TokenIterator(session, position.row, position.column);
234
+ var token = iterator.getCurrentToken();
235
+ var atCursor = false;
236
+ if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
237
+ do {
238
+ token = iterator.stepBackward();
239
+ } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
240
+ } else {
241
+ atCursor = true;
242
+ }
243
+ if (!token || !hasType(token, 'meta.tag-name') || iterator.stepBackward().value.match('/')) {
244
+ return
245
+ }
246
+ var tag = token.value;
247
+ if (atCursor){
248
+ var tag = tag.substring(0, position.column - token.start);
249
+ }
250
+
251
+ return {
252
+ text: '>' + '</' + tag + '>',
253
+ selection: [1, 1]
254
+ }
255
+ }
256
+ });
257
+
258
+ this.add('autoindent', 'insertion', function (state, action, editor, session, text) {
259
+ if (text == "\n") {
260
+ var cursor = editor.getCursorPosition();
261
+ var line = session.doc.getLine(cursor.row);
262
+ var rightChars = line.substring(cursor.column, cursor.column + 2);
263
+ if (rightChars == '</') {
264
+ var indent = this.$getIndent(session.doc.getLine(cursor.row)) + session.getTabString();
265
+ var next_indent = this.$getIndent(session.doc.getLine(cursor.row));
266
+
267
+ return {
268
+ text: '\n' + indent + '\n' + next_indent,
269
+ selection: [1, indent.length, 1, indent.length]
270
+ }
271
+ }
272
+ }
273
+ });
274
+
275
+ }
276
+ oop.inherits(XmlBehaviour, Behaviour);
277
+
278
+ exports.XmlBehaviour = XmlBehaviour;
279
+ });
280
+
281
+ define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
282
+
283
+
284
+ var oop = require("../../lib/oop");
285
+ var Behaviour = require("../behaviour").Behaviour;
286
+ var TokenIterator = require("../../token_iterator").TokenIterator;
287
+ var lang = require("../../lib/lang");
288
+
289
+ var SAFE_INSERT_IN_TOKENS =
290
+ ["text", "paren.rparen", "punctuation.operator"];
291
+ var SAFE_INSERT_BEFORE_TOKENS =
292
+ ["text", "paren.rparen", "punctuation.operator", "comment"];
293
+
294
+
295
+ var autoInsertedBrackets = 0;
296
+ var autoInsertedRow = -1;
297
+ var autoInsertedLineEnd = "";
298
+ var maybeInsertedBrackets = 0;
299
+ var maybeInsertedRow = -1;
300
+ var maybeInsertedLineStart = "";
301
+ var maybeInsertedLineEnd = "";
302
+
303
+ var CstyleBehaviour = function () {
304
+
305
+ CstyleBehaviour.isSaneInsertion = function(editor, session) {
306
+ var cursor = editor.getCursorPosition();
307
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
308
+ if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
309
+ var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
310
+ if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
311
+ return false;
312
+ }
313
+ iterator.stepForward();
314
+ return iterator.getCurrentTokenRow() !== cursor.row ||
315
+ this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
316
+ };
317
+
318
+ CstyleBehaviour.$matchTokenType = function(token, types) {
319
+ return types.indexOf(token.type || token) > -1;
320
+ };
321
+
322
+ CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
323
+ var cursor = editor.getCursorPosition();
324
+ var line = session.doc.getLine(cursor.row);
325
+ if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
326
+ autoInsertedBrackets = 0;
327
+ autoInsertedRow = cursor.row;
328
+ autoInsertedLineEnd = bracket + line.substr(cursor.column);
329
+ autoInsertedBrackets++;
330
+ };
331
+
332
+ CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
333
+ var cursor = editor.getCursorPosition();
334
+ var line = session.doc.getLine(cursor.row);
335
+ if (!this.isMaybeInsertedClosing(cursor, line))
336
+ maybeInsertedBrackets = 0;
337
+ maybeInsertedRow = cursor.row;
338
+ maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
339
+ maybeInsertedLineEnd = line.substr(cursor.column);
340
+ maybeInsertedBrackets++;
341
+ };
342
+
343
+ CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
344
+ return autoInsertedBrackets > 0 &&
345
+ cursor.row === autoInsertedRow &&
346
+ bracket === autoInsertedLineEnd[0] &&
347
+ line.substr(cursor.column) === autoInsertedLineEnd;
348
+ };
349
+
350
+ CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
351
+ return maybeInsertedBrackets > 0 &&
352
+ cursor.row === maybeInsertedRow &&
353
+ line.substr(cursor.column) === maybeInsertedLineEnd &&
354
+ line.substr(0, cursor.column) == maybeInsertedLineStart;
355
+ };
356
+
357
+ CstyleBehaviour.popAutoInsertedClosing = function() {
358
+ autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
359
+ autoInsertedBrackets--;
360
+ };
361
+
362
+ CstyleBehaviour.clearMaybeInsertedClosing = function() {
363
+ maybeInsertedBrackets = 0;
364
+ maybeInsertedRow = -1;
365
+ };
366
+
367
+ this.add("braces", "insertion", function (state, action, editor, session, text) {
368
+ var cursor = editor.getCursorPosition();
369
+ var line = session.doc.getLine(cursor.row);
370
+ if (text == '{') {
371
+ var selection = editor.getSelectionRange();
372
+ var selected = session.doc.getTextRange(selection);
373
+ if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
374
+ return {
375
+ text: '{' + selected + '}',
376
+ selection: false
377
+ };
378
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
379
+ if (/[\]\}\)]/.test(line[cursor.column])) {
380
+ CstyleBehaviour.recordAutoInsert(editor, session, "}");
381
+ return {
382
+ text: '{}',
383
+ selection: [1, 1]
384
+ };
385
+ } else {
386
+ CstyleBehaviour.recordMaybeInsert(editor, session, "{");
387
+ return {
388
+ text: '{',
389
+ selection: [1, 1]
390
+ };
391
+ }
392
+ }
393
+ } else if (text == '}') {
394
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
395
+ if (rightChar == '}') {
396
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
397
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
398
+ CstyleBehaviour.popAutoInsertedClosing();
399
+ return {
400
+ text: '',
401
+ selection: [1, 1]
402
+ };
403
+ }
404
+ }
405
+ } else if (text == "\n" || text == "\r\n") {
406
+ var closing = "";
407
+ if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
408
+ closing = lang.stringRepeat("}", maybeInsertedBrackets);
409
+ CstyleBehaviour.clearMaybeInsertedClosing();
410
+ }
411
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
412
+ if (rightChar == '}' || closing !== "") {
413
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
414
+ if (!openBracePos)
415
+ return null;
416
+
417
+ var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
418
+ var next_indent = this.$getIndent(line);
419
+
420
+ return {
421
+ text: '\n' + indent + '\n' + next_indent + closing,
422
+ selection: [1, indent.length, 1, indent.length]
423
+ };
424
+ }
425
+ }
426
+ });
427
+
428
+ this.add("braces", "deletion", function (state, action, editor, session, range) {
429
+ var selected = session.doc.getTextRange(range);
430
+ if (!range.isMultiLine() && selected == '{') {
431
+ var line = session.doc.getLine(range.start.row);
432
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
433
+ if (rightChar == '}') {
434
+ range.end.column++;
435
+ return range;
436
+ } else {
437
+ maybeInsertedBrackets--;
438
+ }
439
+ }
440
+ });
441
+
442
+ this.add("parens", "insertion", function (state, action, editor, session, text) {
443
+ if (text == '(') {
444
+ var selection = editor.getSelectionRange();
445
+ var selected = session.doc.getTextRange(selection);
446
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
447
+ return {
448
+ text: '(' + selected + ')',
449
+ selection: false
450
+ };
451
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
452
+ CstyleBehaviour.recordAutoInsert(editor, session, ")");
453
+ return {
454
+ text: '()',
455
+ selection: [1, 1]
456
+ };
457
+ }
458
+ } else if (text == ')') {
459
+ var cursor = editor.getCursorPosition();
460
+ var line = session.doc.getLine(cursor.row);
461
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
462
+ if (rightChar == ')') {
463
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
464
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
465
+ CstyleBehaviour.popAutoInsertedClosing();
466
+ return {
467
+ text: '',
468
+ selection: [1, 1]
469
+ };
470
+ }
471
+ }
472
+ }
473
+ });
474
+
475
+ this.add("parens", "deletion", function (state, action, editor, session, range) {
476
+ var selected = session.doc.getTextRange(range);
477
+ if (!range.isMultiLine() && selected == '(') {
478
+ var line = session.doc.getLine(range.start.row);
479
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
480
+ if (rightChar == ')') {
481
+ range.end.column++;
482
+ return range;
483
+ }
484
+ }
485
+ });
486
+
487
+ this.add("brackets", "insertion", function (state, action, editor, session, text) {
488
+ if (text == '[') {
489
+ var selection = editor.getSelectionRange();
490
+ var selected = session.doc.getTextRange(selection);
491
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
492
+ return {
493
+ text: '[' + selected + ']',
494
+ selection: false
495
+ };
496
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
497
+ CstyleBehaviour.recordAutoInsert(editor, session, "]");
498
+ return {
499
+ text: '[]',
500
+ selection: [1, 1]
501
+ };
502
+ }
503
+ } else if (text == ']') {
504
+ var cursor = editor.getCursorPosition();
505
+ var line = session.doc.getLine(cursor.row);
506
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
507
+ if (rightChar == ']') {
508
+ var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
509
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
510
+ CstyleBehaviour.popAutoInsertedClosing();
511
+ return {
512
+ text: '',
513
+ selection: [1, 1]
514
+ };
515
+ }
516
+ }
517
+ }
518
+ });
519
+
520
+ this.add("brackets", "deletion", function (state, action, editor, session, range) {
521
+ var selected = session.doc.getTextRange(range);
522
+ if (!range.isMultiLine() && selected == '[') {
523
+ var line = session.doc.getLine(range.start.row);
524
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
525
+ if (rightChar == ']') {
526
+ range.end.column++;
527
+ return range;
528
+ }
529
+ }
530
+ });
531
+
532
+ this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
533
+ if (text == '"' || text == "'") {
534
+ var quote = text;
535
+ var selection = editor.getSelectionRange();
536
+ var selected = session.doc.getTextRange(selection);
537
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
538
+ return {
539
+ text: quote + selected + quote,
540
+ selection: false
541
+ };
542
+ } else {
543
+ var cursor = editor.getCursorPosition();
544
+ var line = session.doc.getLine(cursor.row);
545
+ var leftChar = line.substring(cursor.column-1, cursor.column);
546
+ if (leftChar == '\\') {
547
+ return null;
548
+ }
549
+ var tokens = session.getTokens(selection.start.row);
550
+ var col = 0, token;
551
+ var quotepos = -1; // Track whether we're inside an open quote.
552
+
553
+ for (var x = 0; x < tokens.length; x++) {
554
+ token = tokens[x];
555
+ if (token.type == "string") {
556
+ quotepos = -1;
557
+ } else if (quotepos < 0) {
558
+ quotepos = token.value.indexOf(quote);
559
+ }
560
+ if ((token.value.length + col) > selection.start.column) {
561
+ break;
562
+ }
563
+ col += tokens[x].value.length;
564
+ }
565
+ 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)))) {
566
+ if (!CstyleBehaviour.isSaneInsertion(editor, session))
567
+ return;
568
+ return {
569
+ text: quote + quote,
570
+ selection: [1,1]
571
+ };
572
+ } else if (token && token.type === "string") {
573
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
574
+ if (rightChar == quote) {
575
+ return {
576
+ text: '',
577
+ selection: [1, 1]
578
+ };
579
+ }
580
+ }
581
+ }
582
+ }
583
+ });
584
+
585
+ this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
586
+ var selected = session.doc.getTextRange(range);
587
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
588
+ var line = session.doc.getLine(range.start.row);
589
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
590
+ if (rightChar == selected) {
591
+ range.end.column++;
592
+ return range;
593
+ }
594
+ }
595
+ });
596
+
597
+ };
598
+
599
+ oop.inherits(CstyleBehaviour, Behaviour);
600
+
601
+ exports.CstyleBehaviour = CstyleBehaviour;
602
+ });
603
+
604
+ define('ace/mode/folding/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/range', 'ace/mode/folding/fold_mode', 'ace/token_iterator'], function(require, exports, module) {
605
+
606
+
607
+ var oop = require("../../lib/oop");
608
+ var lang = require("../../lib/lang");
609
+ var Range = require("../../range").Range;
610
+ var BaseFoldMode = require("./fold_mode").FoldMode;
611
+ var TokenIterator = require("../../token_iterator").TokenIterator;
612
+
613
+ var FoldMode = exports.FoldMode = function(voidElements) {
614
+ BaseFoldMode.call(this);
615
+ this.voidElements = voidElements || {};
616
+ };
617
+ oop.inherits(FoldMode, BaseFoldMode);
618
+
619
+ (function() {
620
+
621
+ this.getFoldWidget = function(session, foldStyle, row) {
622
+ var tag = this._getFirstTagInLine(session, row);
623
+
624
+ if (tag.closing)
625
+ return foldStyle == "markbeginend" ? "end" : "";
626
+
627
+ if (!tag.tagName || this.voidElements[tag.tagName.toLowerCase()])
628
+ return "";
629
+
630
+ if (tag.selfClosing)
631
+ return "";
632
+
633
+ if (tag.value.indexOf("/" + tag.tagName) !== -1)
634
+ return "";
635
+
636
+ return "start";
637
+ };
638
+
639
+ this._getFirstTagInLine = function(session, row) {
640
+ var tokens = session.getTokens(row);
641
+ var value = "";
642
+ for (var i = 0; i < tokens.length; i++) {
643
+ var token = tokens[i];
644
+ if (token.type.indexOf("meta.tag") === 0)
645
+ value += token.value;
646
+ else
647
+ value += lang.stringRepeat(" ", token.value.length);
648
+ }
649
+
650
+ return this._parseTag(value);
651
+ };
652
+
653
+ this.tagRe = /^(\s*)(<?(\/?)([-_a-zA-Z0-9:!]*)\s*(\/?)>?)/;
654
+ this._parseTag = function(tag) {
655
+
656
+ var match = this.tagRe.exec(tag);
657
+ var column = this.tagRe.lastIndex || 0;
658
+ this.tagRe.lastIndex = 0;
659
+
660
+ return {
661
+ value: tag,
662
+ match: match ? match[2] : "",
663
+ closing: match ? !!match[3] : false,
664
+ selfClosing: match ? !!match[5] || match[2] == "/>" : false,
665
+ tagName: match ? match[4] : "",
666
+ column: match[1] ? column + match[1].length : column
667
+ };
668
+ };
669
+ this._readTagForward = function(iterator) {
670
+ var token = iterator.getCurrentToken();
671
+ if (!token)
672
+ return null;
673
+
674
+ var value = "";
675
+ var start;
676
+
677
+ do {
678
+ if (token.type.indexOf("meta.tag") === 0) {
679
+ if (!start) {
680
+ var start = {
681
+ row: iterator.getCurrentTokenRow(),
682
+ column: iterator.getCurrentTokenColumn()
683
+ };
684
+ }
685
+ value += token.value;
686
+ if (value.indexOf(">") !== -1) {
687
+ var tag = this._parseTag(value);
688
+ tag.start = start;
689
+ tag.end = {
690
+ row: iterator.getCurrentTokenRow(),
691
+ column: iterator.getCurrentTokenColumn() + token.value.length
692
+ };
693
+ iterator.stepForward();
694
+ return tag;
695
+ }
696
+ }
697
+ } while(token = iterator.stepForward());
698
+
699
+ return null;
700
+ };
701
+
702
+ this._readTagBackward = function(iterator) {
703
+ var token = iterator.getCurrentToken();
704
+ if (!token)
705
+ return null;
706
+
707
+ var value = "";
708
+ var end;
709
+
710
+ do {
711
+ if (token.type.indexOf("meta.tag") === 0) {
712
+ if (!end) {
713
+ end = {
714
+ row: iterator.getCurrentTokenRow(),
715
+ column: iterator.getCurrentTokenColumn() + token.value.length
716
+ };
717
+ }
718
+ value = token.value + value;
719
+ if (value.indexOf("<") !== -1) {
720
+ var tag = this._parseTag(value);
721
+ tag.end = end;
722
+ tag.start = {
723
+ row: iterator.getCurrentTokenRow(),
724
+ column: iterator.getCurrentTokenColumn()
725
+ };
726
+ iterator.stepBackward();
727
+ return tag;
728
+ }
729
+ }
730
+ } while(token = iterator.stepBackward());
731
+
732
+ return null;
733
+ };
734
+
735
+ this._pop = function(stack, tag) {
736
+ while (stack.length) {
737
+
738
+ var top = stack[stack.length-1];
739
+ if (!tag || top.tagName == tag.tagName) {
740
+ return stack.pop();
741
+ }
742
+ else if (this.voidElements[tag.tagName]) {
743
+ return;
744
+ }
745
+ else if (this.voidElements[top.tagName]) {
746
+ stack.pop();
747
+ continue;
748
+ } else {
749
+ return null;
750
+ }
751
+ }
752
+ };
753
+
754
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
755
+ var firstTag = this._getFirstTagInLine(session, row);
756
+
757
+ if (!firstTag.match)
758
+ return null;
759
+
760
+ var isBackward = firstTag.closing || firstTag.selfClosing;
761
+ var stack = [];
762
+ var tag;
763
+
764
+ if (!isBackward) {
765
+ var iterator = new TokenIterator(session, row, firstTag.column);
766
+ var start = {
767
+ row: row,
768
+ column: firstTag.column + firstTag.tagName.length + 2
769
+ };
770
+ while (tag = this._readTagForward(iterator)) {
771
+ if (tag.selfClosing) {
772
+ if (!stack.length) {
773
+ tag.start.column += tag.tagName.length + 2;
774
+ tag.end.column -= 2;
775
+ return Range.fromPoints(tag.start, tag.end);
776
+ } else
777
+ continue;
778
+ }
779
+
780
+ if (tag.closing) {
781
+ this._pop(stack, tag);
782
+ if (stack.length == 0)
783
+ return Range.fromPoints(start, tag.start);
784
+ }
785
+ else {
786
+ stack.push(tag)
787
+ }
788
+ }
789
+ }
790
+ else {
791
+ var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length);
792
+ var end = {
793
+ row: row,
794
+ column: firstTag.column
795
+ };
796
+
797
+ while (tag = this._readTagBackward(iterator)) {
798
+ if (tag.selfClosing) {
799
+ if (!stack.length) {
800
+ tag.start.column += tag.tagName.length + 2;
801
+ tag.end.column -= 2;
802
+ return Range.fromPoints(tag.start, tag.end);
803
+ } else
804
+ continue;
805
+ }
806
+
807
+ if (!tag.closing) {
808
+ this._pop(stack, tag);
809
+ if (stack.length == 0) {
810
+ tag.start.column += tag.tagName.length + 2;
811
+ return Range.fromPoints(tag.start, end);
812
+ }
813
+ }
814
+ else {
815
+ stack.push(tag)
816
+ }
817
+ }
818
+ }
819
+
820
+ };
821
+
822
+ }).call(FoldMode.prototype);
823
+
824
+ });
825
+
826
+ define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
827
+
828
+
829
+ var oop = require("../lib/oop");
830
+ var TextMode = require("./text").Mode;
831
+ var Tokenizer = require("../tokenizer").Tokenizer;
832
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
833
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
834
+ var Range = require("../range").Range;
835
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
836
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
837
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
838
+
839
+ var Mode = function() {
840
+ this.$tokenizer = new Tokenizer(new JavaScriptHighlightRules().getRules());
841
+ this.$outdent = new MatchingBraceOutdent();
842
+ this.$behaviour = new CstyleBehaviour();
843
+ this.foldingRules = new CStyleFoldMode();
844
+ };
845
+ oop.inherits(Mode, TextMode);
846
+
847
+ (function() {
848
+
849
+ this.lineCommentStart = "//";
850
+ this.blockComment = {start: "/*", end: "*/"};
851
+
852
+ this.getNextLineIndent = function(state, line, tab) {
853
+ var indent = this.$getIndent(line);
854
+
855
+ var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
856
+ var tokens = tokenizedLine.tokens;
857
+ var endState = tokenizedLine.state;
858
+
859
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
860
+ return indent;
861
+ }
862
+
863
+ if (state == "start" || state == "no_regex") {
864
+ var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
865
+ if (match) {
866
+ indent += tab;
867
+ }
868
+ } else if (state == "doc-start") {
869
+ if (endState == "start" || endState == "no_regex") {
870
+ return "";
871
+ }
872
+ var match = line.match(/^\s*(\/?)\*/);
873
+ if (match) {
874
+ if (match[1]) {
875
+ indent += " ";
876
+ }
877
+ indent += "* ";
878
+ }
879
+ }
880
+
881
+ return indent;
882
+ };
883
+
884
+ this.checkOutdent = function(state, line, input) {
885
+ return this.$outdent.checkOutdent(line, input);
886
+ };
887
+
888
+ this.autoOutdent = function(state, doc, row) {
889
+ this.$outdent.autoOutdent(doc, row);
890
+ };
891
+
892
+ this.createWorker = function(session) {
893
+ var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
894
+ worker.attachToDocument(session.getDocument());
895
+
896
+ worker.on("jslint", function(results) {
897
+ session.setAnnotations(results.data);
898
+ });
899
+
900
+ worker.on("terminate", function() {
901
+ session.clearAnnotations();
902
+ });
903
+
904
+ return worker;
905
+ };
906
+
907
+ }).call(Mode.prototype);
908
+
909
+ exports.Mode = Mode;
910
+ });
911
+
912
+ 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) {
913
+
914
+
915
+ var oop = require("../lib/oop");
916
+ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
917
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
918
+
919
+ var JavaScriptHighlightRules = function() {
920
+ var keywordMapper = this.createKeywordMapper({
921
+ "variable.language":
922
+ "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
923
+ "Namespace|QName|XML|XMLList|" + // E4X
924
+ "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
925
+ "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
926
+ "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
927
+ "SyntaxError|TypeError|URIError|" +
928
+ "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
929
+ "isNaN|parseFloat|parseInt|" +
930
+ "JSON|Math|" + // Other
931
+ "this|arguments|prototype|window|document" , // Pseudo
932
+ "keyword":
933
+ "const|yield|import|get|set|" +
934
+ "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
935
+ "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
936
+ "__parent__|__count__|escape|unescape|with|__proto__|" +
937
+ "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
938
+ "storage.type":
939
+ "const|let|var|function",
940
+ "constant.language":
941
+ "null|Infinity|NaN|undefined",
942
+ "support.function":
943
+ "alert",
944
+ "constant.language.boolean": "true|false"
945
+ }, "identifier");
946
+ var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
947
+ var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
948
+
949
+ var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
950
+ "u[0-9a-fA-F]{4}|" + // unicode
951
+ "[0-2][0-7]{0,2}|" + // oct
952
+ "3[0-6][0-7]?|" + // oct
953
+ "37[0-7]?|" + // oct
954
+ "[4-7][0-7]?|" + //oct
955
+ ".)";
956
+
957
+ this.$rules = {
958
+ "no_regex" : [
959
+ {
960
+ token : "comment",
961
+ regex : /\/\/.*$/
962
+ },
963
+ DocCommentHighlightRules.getStartRule("doc-start"),
964
+ {
965
+ token : "comment", // multi line comment
966
+ regex : /\/\*/,
967
+ next : "comment"
968
+ }, {
969
+ token : "string",
970
+ regex : "'(?=.)",
971
+ next : "qstring"
972
+ }, {
973
+ token : "string",
974
+ regex : '"(?=.)',
975
+ next : "qqstring"
976
+ }, {
977
+ token : "constant.numeric", // hex
978
+ regex : /0[xX][0-9a-fA-F]+\b/
979
+ }, {
980
+ token : "constant.numeric", // float
981
+ regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
982
+ }, {
983
+ token : [
984
+ "storage.type", "punctuation.operator", "support.function",
985
+ "punctuation.operator", "entity.name.function", "text","keyword.operator"
986
+ ],
987
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
988
+ next: "function_arguments"
989
+ }, {
990
+ token : [
991
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
992
+ "keyword.operator", "text", "storage.type", "text", "paren.lparen"
993
+ ],
994
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
995
+ next: "function_arguments"
996
+ }, {
997
+ token : [
998
+ "entity.name.function", "text", "keyword.operator", "text", "storage.type",
999
+ "text", "paren.lparen"
1000
+ ],
1001
+ regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
1002
+ next: "function_arguments"
1003
+ }, {
1004
+ token : [
1005
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
1006
+ "keyword.operator", "text",
1007
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
1008
+ ],
1009
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
1010
+ next: "function_arguments"
1011
+ }, {
1012
+ token : [
1013
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
1014
+ ],
1015
+ regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
1016
+ next: "function_arguments"
1017
+ }, {
1018
+ token : [
1019
+ "entity.name.function", "text", "punctuation.operator",
1020
+ "text", "storage.type", "text", "paren.lparen"
1021
+ ],
1022
+ regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
1023
+ next: "function_arguments"
1024
+ }, {
1025
+ token : [
1026
+ "text", "text", "storage.type", "text", "paren.lparen"
1027
+ ],
1028
+ regex : "(:)(\\s*)(function)(\\s*)(\\()",
1029
+ next: "function_arguments"
1030
+ }, {
1031
+ token : "keyword",
1032
+ regex : "(?:" + kwBeforeRe + ")\\b",
1033
+ next : "start"
1034
+ }, {
1035
+ token : ["punctuation.operator", "support.function"],
1036
+ regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|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(?=\()/
1037
+ }, {
1038
+ token : ["punctuation.operator", "support.function.dom"],
1039
+ 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(?=\()/
1040
+ }, {
1041
+ token : ["punctuation.operator", "support.constant"],
1042
+ regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
1043
+ }, {
1044
+ token : ["storage.type", "punctuation.operator", "support.function.firebug"],
1045
+ regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
1046
+ }, {
1047
+ token : keywordMapper,
1048
+ regex : identifierRe
1049
+ }, {
1050
+ token : "keyword.operator",
1051
+ regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/,
1052
+ next : "start"
1053
+ }, {
1054
+ token : "punctuation.operator",
1055
+ regex : /\?|\:|\,|\;|\./,
1056
+ next : "start"
1057
+ }, {
1058
+ token : "paren.lparen",
1059
+ regex : /[\[({]/,
1060
+ next : "start"
1061
+ }, {
1062
+ token : "paren.rparen",
1063
+ regex : /[\])}]/
1064
+ }, {
1065
+ token : "keyword.operator",
1066
+ regex : /\/=?/,
1067
+ next : "start"
1068
+ }, {
1069
+ token: "comment",
1070
+ regex: /^#!.*$/
1071
+ }
1072
+ ],
1073
+ "start": [
1074
+ DocCommentHighlightRules.getStartRule("doc-start"),
1075
+ {
1076
+ token : "comment", // multi line comment
1077
+ regex : "\\/\\*",
1078
+ next : "comment_regex_allowed"
1079
+ }, {
1080
+ token : "comment",
1081
+ regex : "\\/\\/.*$",
1082
+ next : "start"
1083
+ }, {
1084
+ token: "string.regexp",
1085
+ regex: "\\/",
1086
+ next: "regex"
1087
+ }, {
1088
+ token : "text",
1089
+ regex : "\\s+|^$",
1090
+ next : "start"
1091
+ }, {
1092
+ token: "empty",
1093
+ regex: "",
1094
+ next: "no_regex"
1095
+ }
1096
+ ],
1097
+ "regex": [
1098
+ {
1099
+ token: "regexp.keyword.operator",
1100
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
1101
+ }, {
1102
+ token: "string.regexp",
1103
+ regex: "/\\w*",
1104
+ next: "no_regex"
1105
+ }, {
1106
+ token : "invalid",
1107
+ regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
1108
+ }, {
1109
+ token : "constant.language.escape",
1110
+ regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/
1111
+ }, {
1112
+ token : "constant.language.delimiter",
1113
+ regex: /\|/
1114
+ }, {
1115
+ token: "constant.language.escape",
1116
+ regex: /\[\^?/,
1117
+ next: "regex_character_class"
1118
+ }, {
1119
+ token: "empty",
1120
+ regex: "$",
1121
+ next: "no_regex"
1122
+ }, {
1123
+ defaultToken: "string.regexp"
1124
+ }
1125
+ ],
1126
+ "regex_character_class": [
1127
+ {
1128
+ token: "regexp.keyword.operator",
1129
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
1130
+ }, {
1131
+ token: "constant.language.escape",
1132
+ regex: "]",
1133
+ next: "regex"
1134
+ }, {
1135
+ token: "constant.language.escape",
1136
+ regex: "-"
1137
+ }, {
1138
+ token: "empty",
1139
+ regex: "$",
1140
+ next: "no_regex"
1141
+ }, {
1142
+ defaultToken: "string.regexp.charachterclass"
1143
+ }
1144
+ ],
1145
+ "function_arguments": [
1146
+ {
1147
+ token: "variable.parameter",
1148
+ regex: identifierRe
1149
+ }, {
1150
+ token: "punctuation.operator",
1151
+ regex: "[, ]+"
1152
+ }, {
1153
+ token: "punctuation.operator",
1154
+ regex: "$"
1155
+ }, {
1156
+ token: "empty",
1157
+ regex: "",
1158
+ next: "no_regex"
1159
+ }
1160
+ ],
1161
+ "comment_regex_allowed" : [
1162
+ {token : "comment", regex : "\\*\\/", next : "start"},
1163
+ {defaultToken : "comment"}
1164
+ ],
1165
+ "comment" : [
1166
+ {token : "comment", regex : "\\*\\/", next : "no_regex"},
1167
+ {defaultToken : "comment"}
1168
+ ],
1169
+ "qqstring" : [
1170
+ {
1171
+ token : "constant.language.escape",
1172
+ regex : escapedRe
1173
+ }, {
1174
+ token : "string",
1175
+ regex : "\\\\$",
1176
+ next : "qqstring"
1177
+ }, {
1178
+ token : "string",
1179
+ regex : '"|$',
1180
+ next : "no_regex"
1181
+ }, {
1182
+ defaultToken: "string"
1183
+ }
1184
+ ],
1185
+ "qstring" : [
1186
+ {
1187
+ token : "constant.language.escape",
1188
+ regex : escapedRe
1189
+ }, {
1190
+ token : "string",
1191
+ regex : "\\\\$",
1192
+ next : "qstring"
1193
+ }, {
1194
+ token : "string",
1195
+ regex : "'|$",
1196
+ next : "no_regex"
1197
+ }, {
1198
+ defaultToken: "string"
1199
+ }
1200
+ ]
1201
+ };
1202
+
1203
+ this.embedRules(DocCommentHighlightRules, "doc-",
1204
+ [ DocCommentHighlightRules.getEndRule("no_regex") ]);
1205
+ };
1206
+
1207
+ oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
1208
+
1209
+ exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
1210
+ });
1211
+
1212
+ define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1213
+
1214
+
1215
+ var oop = require("../lib/oop");
1216
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1217
+
1218
+ var DocCommentHighlightRules = function() {
1219
+
1220
+ this.$rules = {
1221
+ "start" : [ {
1222
+ token : "comment.doc.tag",
1223
+ regex : "@[\\w\\d_]+" // TODO: fix email addresses
1224
+ }, {
1225
+ token : "comment.doc.tag",
1226
+ regex : "\\bTODO\\b"
1227
+ }, {
1228
+ defaultToken : "comment.doc"
1229
+ }]
1230
+ };
1231
+ };
1232
+
1233
+ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
1234
+
1235
+ DocCommentHighlightRules.getStartRule = function(start) {
1236
+ return {
1237
+ token : "comment.doc", // doc comment
1238
+ regex : "\\/\\*(?=\\*)",
1239
+ next : start
1240
+ };
1241
+ };
1242
+
1243
+ DocCommentHighlightRules.getEndRule = function (start) {
1244
+ return {
1245
+ token : "comment.doc", // closing comment
1246
+ regex : "\\*\\/",
1247
+ next : start
1248
+ };
1249
+ };
1250
+
1251
+
1252
+ exports.DocCommentHighlightRules = DocCommentHighlightRules;
1253
+
1254
+ });
1255
+
1256
+ define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
1257
+
1258
+
1259
+ var Range = require("../range").Range;
1260
+
1261
+ var MatchingBraceOutdent = function() {};
1262
+
1263
+ (function() {
1264
+
1265
+ this.checkOutdent = function(line, input) {
1266
+ if (! /^\s+$/.test(line))
1267
+ return false;
1268
+
1269
+ return /^\s*\}/.test(input);
1270
+ };
1271
+
1272
+ this.autoOutdent = function(doc, row) {
1273
+ var line = doc.getLine(row);
1274
+ var match = line.match(/^(\s*\})/);
1275
+
1276
+ if (!match) return 0;
1277
+
1278
+ var column = match[1].length;
1279
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
1280
+
1281
+ if (!openBracePos || openBracePos.row == row) return 0;
1282
+
1283
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
1284
+ doc.replace(new Range(row, 0, row, column-1), indent);
1285
+ };
1286
+
1287
+ this.$getIndent = function(line) {
1288
+ return line.match(/^\s*/)[0];
1289
+ };
1290
+
1291
+ }).call(MatchingBraceOutdent.prototype);
1292
+
1293
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
1294
+ });
1295
+
1296
+ define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
1297
+
1298
+
1299
+ var oop = require("../../lib/oop");
1300
+ var Range = require("../../range").Range;
1301
+ var BaseFoldMode = require("./fold_mode").FoldMode;
1302
+
1303
+ var FoldMode = exports.FoldMode = function(commentRegex) {
1304
+ if (commentRegex) {
1305
+ this.foldingStartMarker = new RegExp(
1306
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
1307
+ );
1308
+ this.foldingStopMarker = new RegExp(
1309
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
1310
+ );
1311
+ }
1312
+ };
1313
+ oop.inherits(FoldMode, BaseFoldMode);
1314
+
1315
+ (function() {
1316
+
1317
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
1318
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
1319
+
1320
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1321
+ var line = session.getLine(row);
1322
+ var match = line.match(this.foldingStartMarker);
1323
+ if (match) {
1324
+ var i = match.index;
1325
+
1326
+ if (match[1])
1327
+ return this.openingBracketBlock(session, match[1], row, i);
1328
+
1329
+ return session.getCommentFoldRange(row, i + match[0].length, 1);
1330
+ }
1331
+
1332
+ if (foldStyle !== "markbeginend")
1333
+ return;
1334
+
1335
+ var match = line.match(this.foldingStopMarker);
1336
+ if (match) {
1337
+ var i = match.index + match[0].length;
1338
+
1339
+ if (match[1])
1340
+ return this.closingBracketBlock(session, match[1], row, i);
1341
+
1342
+ return session.getCommentFoldRange(row, i, -1);
1343
+ }
1344
+ };
1345
+
1346
+ }).call(FoldMode.prototype);
1347
+
1348
+ });
1349
+
1350
+ define('ace/mode/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) {
1351
+
1352
+
1353
+ var oop = require("../lib/oop");
1354
+ var TextMode = require("./text").Mode;
1355
+ var Tokenizer = require("../tokenizer").Tokenizer;
1356
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1357
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1358
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
1359
+ var CssBehaviour = require("./behaviour/css").CssBehaviour;
1360
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1361
+
1362
+ var Mode = function() {
1363
+ this.$tokenizer = new Tokenizer(new CssHighlightRules().getRules());
1364
+ this.$outdent = new MatchingBraceOutdent();
1365
+ this.$behaviour = new CssBehaviour();
1366
+ this.foldingRules = new CStyleFoldMode();
1367
+ };
1368
+ oop.inherits(Mode, TextMode);
1369
+
1370
+ (function() {
1371
+
1372
+ this.foldingRules = "cStyle";
1373
+ this.blockComment = {start: "/*", end: "*/"};
1374
+
1375
+ this.getNextLineIndent = function(state, line, tab) {
1376
+ var indent = this.$getIndent(line);
1377
+ var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
1378
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
1379
+ return indent;
1380
+ }
1381
+
1382
+ var match = line.match(/^.*\{\s*$/);
1383
+ if (match) {
1384
+ indent += tab;
1385
+ }
1386
+
1387
+ return indent;
1388
+ };
1389
+
1390
+ this.checkOutdent = function(state, line, input) {
1391
+ return this.$outdent.checkOutdent(line, input);
1392
+ };
1393
+
1394
+ this.autoOutdent = function(state, doc, row) {
1395
+ this.$outdent.autoOutdent(doc, row);
1396
+ };
1397
+
1398
+ this.createWorker = function(session) {
1399
+ var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
1400
+ worker.attachToDocument(session.getDocument());
1401
+
1402
+ worker.on("csslint", function(e) {
1403
+ session.setAnnotations(e.data);
1404
+ });
1405
+
1406
+ worker.on("terminate", function() {
1407
+ session.clearAnnotations();
1408
+ });
1409
+
1410
+ return worker;
1411
+ };
1412
+
1413
+ }).call(Mode.prototype);
1414
+
1415
+ exports.Mode = Mode;
1416
+
1417
+ });
1418
+
1419
+ define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1420
+
1421
+
1422
+ var oop = require("../lib/oop");
1423
+ var lang = require("../lib/lang");
1424
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1425
+ var supportType = exports.supportType = "animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index";
1426
+ var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
1427
+ var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero";
1428
+ var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
1429
+ var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
1430
+
1431
+ var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
1432
+ var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
1433
+ var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
1434
+
1435
+ var CssHighlightRules = function() {
1436
+
1437
+ var keywordMapper = this.createKeywordMapper({
1438
+ "support.function": supportFunction,
1439
+ "support.constant": supportConstant,
1440
+ "support.type": supportType,
1441
+ "support.constant.color": supportConstantColor,
1442
+ "support.constant.fonts": supportConstantFonts
1443
+ }, "text", true);
1444
+
1445
+ var base_ruleset = [
1446
+ {
1447
+ token : "comment", // multi line comment
1448
+ regex : "\\/\\*",
1449
+ next : "ruleset_comment"
1450
+ }, {
1451
+ token : "string", // single line
1452
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
1453
+ }, {
1454
+ token : "string", // single line
1455
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
1456
+ }, {
1457
+ token : ["constant.numeric", "keyword"],
1458
+ regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
1459
+ }, {
1460
+ token : "constant.numeric",
1461
+ regex : numRe
1462
+ }, {
1463
+ token : "constant.numeric", // hex6 color
1464
+ regex : "#[a-f0-9]{6}"
1465
+ }, {
1466
+ token : "constant.numeric", // hex3 color
1467
+ regex : "#[a-f0-9]{3}"
1468
+ }, {
1469
+ token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
1470
+ regex : pseudoElements
1471
+ }, {
1472
+ token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
1473
+ regex : pseudoClasses
1474
+ }, {
1475
+ token : ["support.function", "string", "support.function"],
1476
+ regex : "(url\\()(.*)(\\))"
1477
+ }, {
1478
+ token : keywordMapper,
1479
+ regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
1480
+ }, {
1481
+ caseInsensitive: true
1482
+ }
1483
+ ];
1484
+
1485
+ var ruleset = lang.copyArray(base_ruleset);
1486
+ ruleset.unshift({
1487
+ token : "paren.rparen",
1488
+ regex : "\\}",
1489
+ next: "start"
1490
+ });
1491
+
1492
+ var media_ruleset = lang.copyArray( base_ruleset );
1493
+ media_ruleset.unshift({
1494
+ token : "paren.rparen",
1495
+ regex : "\\}",
1496
+ next: "media"
1497
+ });
1498
+
1499
+ var base_comment = [{
1500
+ token : "comment", // comment spanning whole line
1501
+ regex : ".+"
1502
+ }];
1503
+
1504
+ var comment = lang.copyArray(base_comment);
1505
+ comment.unshift({
1506
+ token : "comment", // closing comment
1507
+ regex : ".*?\\*\\/",
1508
+ next : "start"
1509
+ });
1510
+
1511
+ var media_comment = lang.copyArray(base_comment);
1512
+ media_comment.unshift({
1513
+ token : "comment", // closing comment
1514
+ regex : ".*?\\*\\/",
1515
+ next : "media"
1516
+ });
1517
+
1518
+ var ruleset_comment = lang.copyArray(base_comment);
1519
+ ruleset_comment.unshift({
1520
+ token : "comment", // closing comment
1521
+ regex : ".*?\\*\\/",
1522
+ next : "ruleset"
1523
+ });
1524
+
1525
+ this.$rules = {
1526
+ "start" : [{
1527
+ token : "comment", // multi line comment
1528
+ regex : "\\/\\*",
1529
+ next : "comment"
1530
+ }, {
1531
+ token: "paren.lparen",
1532
+ regex: "\\{",
1533
+ next: "ruleset"
1534
+ }, {
1535
+ token: "string",
1536
+ regex: "@.*?{",
1537
+ next: "media"
1538
+ },{
1539
+ token: "keyword",
1540
+ regex: "#[a-z0-9-_]+"
1541
+ },{
1542
+ token: "variable",
1543
+ regex: "\\.[a-z0-9-_]+"
1544
+ },{
1545
+ token: "string",
1546
+ regex: ":[a-z0-9-_]+"
1547
+ },{
1548
+ token: "constant",
1549
+ regex: "[a-z0-9-_]+"
1550
+ },{
1551
+ caseInsensitive: true
1552
+ }],
1553
+
1554
+ "media" : [ {
1555
+ token : "comment", // multi line comment
1556
+ regex : "\\/\\*",
1557
+ next : "media_comment"
1558
+ }, {
1559
+ token: "paren.lparen",
1560
+ regex: "\\{",
1561
+ next: "media_ruleset"
1562
+ },{
1563
+ token: "string",
1564
+ regex: "\\}",
1565
+ next: "start"
1566
+ },{
1567
+ token: "keyword",
1568
+ regex: "#[a-z0-9-_]+"
1569
+ },{
1570
+ token: "variable",
1571
+ regex: "\\.[a-z0-9-_]+"
1572
+ },{
1573
+ token: "string",
1574
+ regex: ":[a-z0-9-_]+"
1575
+ },{
1576
+ token: "constant",
1577
+ regex: "[a-z0-9-_]+"
1578
+ },{
1579
+ caseInsensitive: true
1580
+ }],
1581
+
1582
+ "comment" : comment,
1583
+
1584
+ "ruleset" : ruleset,
1585
+ "ruleset_comment" : ruleset_comment,
1586
+
1587
+ "media_ruleset" : media_ruleset,
1588
+ "media_comment" : media_comment
1589
+ };
1590
+ };
1591
+
1592
+ oop.inherits(CssHighlightRules, TextHighlightRules);
1593
+
1594
+ exports.CssHighlightRules = CssHighlightRules;
1595
+
1596
+ });
1597
+
1598
+ define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) {
1599
+
1600
+
1601
+ var oop = require("../../lib/oop");
1602
+ var Behaviour = require("../behaviour").Behaviour;
1603
+ var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1604
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1605
+
1606
+ var CssBehaviour = function () {
1607
+
1608
+ this.inherit(CstyleBehaviour);
1609
+
1610
+ this.add("colon", "insertion", function (state, action, editor, session, text) {
1611
+ if (text === ':') {
1612
+ var cursor = editor.getCursorPosition();
1613
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1614
+ var token = iterator.getCurrentToken();
1615
+ if (token && token.value.match(/\s+/)) {
1616
+ token = iterator.stepBackward();
1617
+ }
1618
+ if (token && token.type === 'support.type') {
1619
+ var line = session.doc.getLine(cursor.row);
1620
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1621
+ if (rightChar === ':') {
1622
+ return {
1623
+ text: '',
1624
+ selection: [1, 1]
1625
+ }
1626
+ }
1627
+ if (!line.substring(cursor.column).match(/^\s*;/)) {
1628
+ return {
1629
+ text: ':;',
1630
+ selection: [1, 1]
1631
+ }
1632
+ }
1633
+ }
1634
+ }
1635
+ });
1636
+
1637
+ this.add("colon", "deletion", function (state, action, editor, session, range) {
1638
+ var selected = session.doc.getTextRange(range);
1639
+ if (!range.isMultiLine() && selected === ':') {
1640
+ var cursor = editor.getCursorPosition();
1641
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1642
+ var token = iterator.getCurrentToken();
1643
+ if (token && token.value.match(/\s+/)) {
1644
+ token = iterator.stepBackward();
1645
+ }
1646
+ if (token && token.type === 'support.type') {
1647
+ var line = session.doc.getLine(range.start.row);
1648
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
1649
+ if (rightChar === ';') {
1650
+ range.end.column ++;
1651
+ return range;
1652
+ }
1653
+ }
1654
+ }
1655
+ });
1656
+
1657
+ this.add("semicolon", "insertion", function (state, action, editor, session, text) {
1658
+ if (text === ';') {
1659
+ var cursor = editor.getCursorPosition();
1660
+ var line = session.doc.getLine(cursor.row);
1661
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1662
+ if (rightChar === ';') {
1663
+ return {
1664
+ text: '',
1665
+ selection: [1, 1]
1666
+ }
1667
+ }
1668
+ }
1669
+ });
1670
+
1671
+ }
1672
+ oop.inherits(CssBehaviour, CstyleBehaviour);
1673
+
1674
+ exports.CssBehaviour = CssBehaviour;
1675
+ });
1676
+
1677
+ define('ace/mode/coldfusion_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/text_highlight_rules', 'ace/mode/xml_util'], function(require, exports, module) {
1678
+
1679
+
1680
+ var oop = require("../lib/oop");
1681
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1682
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1683
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1684
+ var xml_util = require("./xml_util");
1685
+
1686
+ var ColdfusionHighlightRules = function() {
1687
+
1688
+ this.$rules = {
1689
+ start : [ {
1690
+ token : "text",
1691
+ regex : "<\\!\\[CDATA\\[",
1692
+ next : "cdata"
1693
+ }, {
1694
+ token : "xml-pe",
1695
+ regex : "<\\?.*?\\?>"
1696
+ }, {
1697
+ token : "comment",
1698
+ regex : "<\\!--",
1699
+ next : "comment"
1700
+ }, {
1701
+ token : "meta.tag",
1702
+ regex : "<(?=script)",
1703
+ next : "script"
1704
+ }, {
1705
+ token : "meta.tag",
1706
+ regex : "<(?=style)",
1707
+ next : "style"
1708
+ }, {
1709
+ token : "meta.tag", // opening tag
1710
+ regex : "<\\/?",
1711
+ next : "tag"
1712
+ } ],
1713
+
1714
+ cdata : [ {
1715
+ token : "text",
1716
+ regex : "\\]\\]>",
1717
+ next : "start"
1718
+ } ],
1719
+
1720
+ comment : [ {
1721
+ token : "comment",
1722
+ regex : ".*?-->",
1723
+ next : "start"
1724
+ }, {
1725
+ defaultToken : "comment"
1726
+ } ]
1727
+ };
1728
+
1729
+ xml_util.tag(this.$rules, "tag", "start");
1730
+ xml_util.tag(this.$rules, "style", "css-start");
1731
+ xml_util.tag(this.$rules, "script", "js-start");
1732
+
1733
+ this.embedRules(JavaScriptHighlightRules, "js-", [{
1734
+ token: "comment",
1735
+ regex: "\\/\\/.*(?=<\\/script>)",
1736
+ next: "tag"
1737
+ }, {
1738
+ token: "meta.tag",
1739
+ regex: "<\\/(?=script)",
1740
+ next: "tag"
1741
+ }]);
1742
+
1743
+ this.embedRules(CssHighlightRules, "css-", [{
1744
+ token: "meta.tag",
1745
+ regex: "<\\/(?=style)",
1746
+ next: "tag"
1747
+ }]);
1748
+ };
1749
+
1750
+ oop.inherits(ColdfusionHighlightRules, TextHighlightRules);
1751
+
1752
+ exports.ColdfusionHighlightRules = ColdfusionHighlightRules;
1753
+ });