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,1950 @@
1
+ /* ***** BEGIN LICENSE BLOCK *****
2
+ * Distributed under the BSD license:
3
+ *
4
+ * Copyright (c) 2012, 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
+ *
30
+ * Contributor(s):
31
+ *
32
+ * Libo Cannici <libo AT zendesk DOT com>
33
+ *
34
+ *
35
+ *
36
+ * ***** END LICENSE BLOCK ***** */
37
+ define('ace/mode/curly', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/html', 'ace/tokenizer', 'ace/mode/matching_brace_outdent', 'ace/mode/html_highlight_rules', 'ace/mode/folding/html', 'ace/mode/curly_highlight_rules'], function(require, exports, module) {
38
+
39
+
40
+ var oop = require("../lib/oop");
41
+ var HtmlMode = require("./html").Mode;
42
+ var Tokenizer = require("../tokenizer").Tokenizer;
43
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
44
+ var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
45
+ var HtmlFoldMode = require("./folding/html").FoldMode;
46
+ var CurlyHighlightRules = require("./curly_highlight_rules").CurlyHighlightRules;
47
+
48
+ var Mode = function() {
49
+ var highlighter = new CurlyHighlightRules();
50
+ this.$outdent = new MatchingBraceOutdent();
51
+ this.foldingRules = new HtmlFoldMode();
52
+
53
+ this.$tokenizer = new Tokenizer(highlighter.getRules());
54
+ };
55
+ oop.inherits(Mode, HtmlMode);
56
+
57
+ (function() {
58
+ }).call(Mode.prototype);
59
+
60
+ exports.Mode = Mode;
61
+ });
62
+
63
+ define('ace/mode/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/javascript', 'ace/mode/css', 'ace/tokenizer', 'ace/mode/html_highlight_rules', 'ace/mode/behaviour/html', 'ace/mode/folding/html'], function(require, exports, module) {
64
+
65
+
66
+ var oop = require("../lib/oop");
67
+ var TextMode = require("./text").Mode;
68
+ var JavaScriptMode = require("./javascript").Mode;
69
+ var CssMode = require("./css").Mode;
70
+ var Tokenizer = require("../tokenizer").Tokenizer;
71
+ var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
72
+ var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour;
73
+ var HtmlFoldMode = require("./folding/html").FoldMode;
74
+
75
+ var Mode = function() {
76
+ var highlighter = new HtmlHighlightRules();
77
+ this.$tokenizer = new Tokenizer(highlighter.getRules());
78
+ this.$behaviour = new HtmlBehaviour();
79
+
80
+ this.$embeds = highlighter.getEmbeds();
81
+ this.createModeDelegates({
82
+ "js-": JavaScriptMode,
83
+ "css-": CssMode
84
+ });
85
+
86
+ this.foldingRules = new HtmlFoldMode();
87
+ };
88
+ oop.inherits(Mode, TextMode);
89
+
90
+ (function() {
91
+
92
+ this.blockComment = {start: "<!--", end: "-->"};
93
+
94
+ this.getNextLineIndent = function(state, line, tab) {
95
+ return this.$getIndent(line);
96
+ };
97
+
98
+ this.checkOutdent = function(state, line, input) {
99
+ return false;
100
+ };
101
+
102
+ }).call(Mode.prototype);
103
+
104
+ exports.Mode = Mode;
105
+ });
106
+
107
+ 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) {
108
+
109
+
110
+ var oop = require("../lib/oop");
111
+ var TextMode = require("./text").Mode;
112
+ var Tokenizer = require("../tokenizer").Tokenizer;
113
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
114
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
115
+ var Range = require("../range").Range;
116
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
117
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
118
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
119
+
120
+ var Mode = function() {
121
+ this.$tokenizer = new Tokenizer(new JavaScriptHighlightRules().getRules());
122
+ this.$outdent = new MatchingBraceOutdent();
123
+ this.$behaviour = new CstyleBehaviour();
124
+ this.foldingRules = new CStyleFoldMode();
125
+ };
126
+ oop.inherits(Mode, TextMode);
127
+
128
+ (function() {
129
+
130
+ this.lineCommentStart = "//";
131
+ this.blockComment = {start: "/*", end: "*/"};
132
+
133
+ this.getNextLineIndent = function(state, line, tab) {
134
+ var indent = this.$getIndent(line);
135
+
136
+ var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
137
+ var tokens = tokenizedLine.tokens;
138
+ var endState = tokenizedLine.state;
139
+
140
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
141
+ return indent;
142
+ }
143
+
144
+ if (state == "start" || state == "no_regex") {
145
+ var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
146
+ if (match) {
147
+ indent += tab;
148
+ }
149
+ } else if (state == "doc-start") {
150
+ if (endState == "start" || endState == "no_regex") {
151
+ return "";
152
+ }
153
+ var match = line.match(/^\s*(\/?)\*/);
154
+ if (match) {
155
+ if (match[1]) {
156
+ indent += " ";
157
+ }
158
+ indent += "* ";
159
+ }
160
+ }
161
+
162
+ return indent;
163
+ };
164
+
165
+ this.checkOutdent = function(state, line, input) {
166
+ return this.$outdent.checkOutdent(line, input);
167
+ };
168
+
169
+ this.autoOutdent = function(state, doc, row) {
170
+ this.$outdent.autoOutdent(doc, row);
171
+ };
172
+
173
+ this.createWorker = function(session) {
174
+ var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
175
+ worker.attachToDocument(session.getDocument());
176
+
177
+ worker.on("jslint", function(results) {
178
+ session.setAnnotations(results.data);
179
+ });
180
+
181
+ worker.on("terminate", function() {
182
+ session.clearAnnotations();
183
+ });
184
+
185
+ return worker;
186
+ };
187
+
188
+ }).call(Mode.prototype);
189
+
190
+ exports.Mode = Mode;
191
+ });
192
+
193
+ 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) {
194
+
195
+
196
+ var oop = require("../lib/oop");
197
+ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
198
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
199
+
200
+ var JavaScriptHighlightRules = function() {
201
+ var keywordMapper = this.createKeywordMapper({
202
+ "variable.language":
203
+ "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
204
+ "Namespace|QName|XML|XMLList|" + // E4X
205
+ "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
206
+ "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
207
+ "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
208
+ "SyntaxError|TypeError|URIError|" +
209
+ "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
210
+ "isNaN|parseFloat|parseInt|" +
211
+ "JSON|Math|" + // Other
212
+ "this|arguments|prototype|window|document" , // Pseudo
213
+ "keyword":
214
+ "const|yield|import|get|set|" +
215
+ "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
216
+ "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
217
+ "__parent__|__count__|escape|unescape|with|__proto__|" +
218
+ "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
219
+ "storage.type":
220
+ "const|let|var|function",
221
+ "constant.language":
222
+ "null|Infinity|NaN|undefined",
223
+ "support.function":
224
+ "alert",
225
+ "constant.language.boolean": "true|false"
226
+ }, "identifier");
227
+ var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
228
+ var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
229
+
230
+ var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
231
+ "u[0-9a-fA-F]{4}|" + // unicode
232
+ "[0-2][0-7]{0,2}|" + // oct
233
+ "3[0-6][0-7]?|" + // oct
234
+ "37[0-7]?|" + // oct
235
+ "[4-7][0-7]?|" + //oct
236
+ ".)";
237
+
238
+ this.$rules = {
239
+ "no_regex" : [
240
+ {
241
+ token : "comment",
242
+ regex : /\/\/.*$/
243
+ },
244
+ DocCommentHighlightRules.getStartRule("doc-start"),
245
+ {
246
+ token : "comment", // multi line comment
247
+ regex : /\/\*/,
248
+ next : "comment"
249
+ }, {
250
+ token : "string",
251
+ regex : "'(?=.)",
252
+ next : "qstring"
253
+ }, {
254
+ token : "string",
255
+ regex : '"(?=.)',
256
+ next : "qqstring"
257
+ }, {
258
+ token : "constant.numeric", // hex
259
+ regex : /0[xX][0-9a-fA-F]+\b/
260
+ }, {
261
+ token : "constant.numeric", // float
262
+ regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
263
+ }, {
264
+ token : [
265
+ "storage.type", "punctuation.operator", "support.function",
266
+ "punctuation.operator", "entity.name.function", "text","keyword.operator"
267
+ ],
268
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
269
+ next: "function_arguments"
270
+ }, {
271
+ token : [
272
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
273
+ "keyword.operator", "text", "storage.type", "text", "paren.lparen"
274
+ ],
275
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
276
+ next: "function_arguments"
277
+ }, {
278
+ token : [
279
+ "entity.name.function", "text", "keyword.operator", "text", "storage.type",
280
+ "text", "paren.lparen"
281
+ ],
282
+ regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
283
+ next: "function_arguments"
284
+ }, {
285
+ token : [
286
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
287
+ "keyword.operator", "text",
288
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
289
+ ],
290
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
291
+ next: "function_arguments"
292
+ }, {
293
+ token : [
294
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
295
+ ],
296
+ regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
297
+ next: "function_arguments"
298
+ }, {
299
+ token : [
300
+ "entity.name.function", "text", "punctuation.operator",
301
+ "text", "storage.type", "text", "paren.lparen"
302
+ ],
303
+ regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
304
+ next: "function_arguments"
305
+ }, {
306
+ token : [
307
+ "text", "text", "storage.type", "text", "paren.lparen"
308
+ ],
309
+ regex : "(:)(\\s*)(function)(\\s*)(\\()",
310
+ next: "function_arguments"
311
+ }, {
312
+ token : "keyword",
313
+ regex : "(?:" + kwBeforeRe + ")\\b",
314
+ next : "start"
315
+ }, {
316
+ token : ["punctuation.operator", "support.function"],
317
+ 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(?=\()/
318
+ }, {
319
+ token : ["punctuation.operator", "support.function.dom"],
320
+ 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(?=\()/
321
+ }, {
322
+ token : ["punctuation.operator", "support.constant"],
323
+ 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/
324
+ }, {
325
+ token : ["storage.type", "punctuation.operator", "support.function.firebug"],
326
+ regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
327
+ }, {
328
+ token : keywordMapper,
329
+ regex : identifierRe
330
+ }, {
331
+ token : "keyword.operator",
332
+ regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/,
333
+ next : "start"
334
+ }, {
335
+ token : "punctuation.operator",
336
+ regex : /\?|\:|\,|\;|\./,
337
+ next : "start"
338
+ }, {
339
+ token : "paren.lparen",
340
+ regex : /[\[({]/,
341
+ next : "start"
342
+ }, {
343
+ token : "paren.rparen",
344
+ regex : /[\])}]/
345
+ }, {
346
+ token : "keyword.operator",
347
+ regex : /\/=?/,
348
+ next : "start"
349
+ }, {
350
+ token: "comment",
351
+ regex: /^#!.*$/
352
+ }
353
+ ],
354
+ "start": [
355
+ DocCommentHighlightRules.getStartRule("doc-start"),
356
+ {
357
+ token : "comment", // multi line comment
358
+ regex : "\\/\\*",
359
+ next : "comment_regex_allowed"
360
+ }, {
361
+ token : "comment",
362
+ regex : "\\/\\/.*$",
363
+ next : "start"
364
+ }, {
365
+ token: "string.regexp",
366
+ regex: "\\/",
367
+ next: "regex"
368
+ }, {
369
+ token : "text",
370
+ regex : "\\s+|^$",
371
+ next : "start"
372
+ }, {
373
+ token: "empty",
374
+ regex: "",
375
+ next: "no_regex"
376
+ }
377
+ ],
378
+ "regex": [
379
+ {
380
+ token: "regexp.keyword.operator",
381
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
382
+ }, {
383
+ token: "string.regexp",
384
+ regex: "/\\w*",
385
+ next: "no_regex"
386
+ }, {
387
+ token : "invalid",
388
+ regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
389
+ }, {
390
+ token : "constant.language.escape",
391
+ regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/
392
+ }, {
393
+ token : "constant.language.delimiter",
394
+ regex: /\|/
395
+ }, {
396
+ token: "constant.language.escape",
397
+ regex: /\[\^?/,
398
+ next: "regex_character_class"
399
+ }, {
400
+ token: "empty",
401
+ regex: "$",
402
+ next: "no_regex"
403
+ }, {
404
+ defaultToken: "string.regexp"
405
+ }
406
+ ],
407
+ "regex_character_class": [
408
+ {
409
+ token: "regexp.keyword.operator",
410
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
411
+ }, {
412
+ token: "constant.language.escape",
413
+ regex: "]",
414
+ next: "regex"
415
+ }, {
416
+ token: "constant.language.escape",
417
+ regex: "-"
418
+ }, {
419
+ token: "empty",
420
+ regex: "$",
421
+ next: "no_regex"
422
+ }, {
423
+ defaultToken: "string.regexp.charachterclass"
424
+ }
425
+ ],
426
+ "function_arguments": [
427
+ {
428
+ token: "variable.parameter",
429
+ regex: identifierRe
430
+ }, {
431
+ token: "punctuation.operator",
432
+ regex: "[, ]+"
433
+ }, {
434
+ token: "punctuation.operator",
435
+ regex: "$"
436
+ }, {
437
+ token: "empty",
438
+ regex: "",
439
+ next: "no_regex"
440
+ }
441
+ ],
442
+ "comment_regex_allowed" : [
443
+ {token : "comment", regex : "\\*\\/", next : "start"},
444
+ {defaultToken : "comment"}
445
+ ],
446
+ "comment" : [
447
+ {token : "comment", regex : "\\*\\/", next : "no_regex"},
448
+ {defaultToken : "comment"}
449
+ ],
450
+ "qqstring" : [
451
+ {
452
+ token : "constant.language.escape",
453
+ regex : escapedRe
454
+ }, {
455
+ token : "string",
456
+ regex : "\\\\$",
457
+ next : "qqstring"
458
+ }, {
459
+ token : "string",
460
+ regex : '"|$',
461
+ next : "no_regex"
462
+ }, {
463
+ defaultToken: "string"
464
+ }
465
+ ],
466
+ "qstring" : [
467
+ {
468
+ token : "constant.language.escape",
469
+ regex : escapedRe
470
+ }, {
471
+ token : "string",
472
+ regex : "\\\\$",
473
+ next : "qstring"
474
+ }, {
475
+ token : "string",
476
+ regex : "'|$",
477
+ next : "no_regex"
478
+ }, {
479
+ defaultToken: "string"
480
+ }
481
+ ]
482
+ };
483
+
484
+ this.embedRules(DocCommentHighlightRules, "doc-",
485
+ [ DocCommentHighlightRules.getEndRule("no_regex") ]);
486
+ };
487
+
488
+ oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
489
+
490
+ exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
491
+ });
492
+
493
+ define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
494
+
495
+
496
+ var oop = require("../lib/oop");
497
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
498
+
499
+ var DocCommentHighlightRules = function() {
500
+
501
+ this.$rules = {
502
+ "start" : [ {
503
+ token : "comment.doc.tag",
504
+ regex : "@[\\w\\d_]+" // TODO: fix email addresses
505
+ }, {
506
+ token : "comment.doc.tag",
507
+ regex : "\\bTODO\\b"
508
+ }, {
509
+ defaultToken : "comment.doc"
510
+ }]
511
+ };
512
+ };
513
+
514
+ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
515
+
516
+ DocCommentHighlightRules.getStartRule = function(start) {
517
+ return {
518
+ token : "comment.doc", // doc comment
519
+ regex : "\\/\\*(?=\\*)",
520
+ next : start
521
+ };
522
+ };
523
+
524
+ DocCommentHighlightRules.getEndRule = function (start) {
525
+ return {
526
+ token : "comment.doc", // closing comment
527
+ regex : "\\*\\/",
528
+ next : start
529
+ };
530
+ };
531
+
532
+
533
+ exports.DocCommentHighlightRules = DocCommentHighlightRules;
534
+
535
+ });
536
+
537
+ define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
538
+
539
+
540
+ var Range = require("../range").Range;
541
+
542
+ var MatchingBraceOutdent = function() {};
543
+
544
+ (function() {
545
+
546
+ this.checkOutdent = function(line, input) {
547
+ if (! /^\s+$/.test(line))
548
+ return false;
549
+
550
+ return /^\s*\}/.test(input);
551
+ };
552
+
553
+ this.autoOutdent = function(doc, row) {
554
+ var line = doc.getLine(row);
555
+ var match = line.match(/^(\s*\})/);
556
+
557
+ if (!match) return 0;
558
+
559
+ var column = match[1].length;
560
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
561
+
562
+ if (!openBracePos || openBracePos.row == row) return 0;
563
+
564
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
565
+ doc.replace(new Range(row, 0, row, column-1), indent);
566
+ };
567
+
568
+ this.$getIndent = function(line) {
569
+ return line.match(/^\s*/)[0];
570
+ };
571
+
572
+ }).call(MatchingBraceOutdent.prototype);
573
+
574
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
575
+ });
576
+
577
+ define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
578
+
579
+
580
+ var oop = require("../../lib/oop");
581
+ var Behaviour = require("../behaviour").Behaviour;
582
+ var TokenIterator = require("../../token_iterator").TokenIterator;
583
+ var lang = require("../../lib/lang");
584
+
585
+ var SAFE_INSERT_IN_TOKENS =
586
+ ["text", "paren.rparen", "punctuation.operator"];
587
+ var SAFE_INSERT_BEFORE_TOKENS =
588
+ ["text", "paren.rparen", "punctuation.operator", "comment"];
589
+
590
+
591
+ var autoInsertedBrackets = 0;
592
+ var autoInsertedRow = -1;
593
+ var autoInsertedLineEnd = "";
594
+ var maybeInsertedBrackets = 0;
595
+ var maybeInsertedRow = -1;
596
+ var maybeInsertedLineStart = "";
597
+ var maybeInsertedLineEnd = "";
598
+
599
+ var CstyleBehaviour = function () {
600
+
601
+ CstyleBehaviour.isSaneInsertion = function(editor, session) {
602
+ var cursor = editor.getCursorPosition();
603
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
604
+ if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
605
+ var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
606
+ if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
607
+ return false;
608
+ }
609
+ iterator.stepForward();
610
+ return iterator.getCurrentTokenRow() !== cursor.row ||
611
+ this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
612
+ };
613
+
614
+ CstyleBehaviour.$matchTokenType = function(token, types) {
615
+ return types.indexOf(token.type || token) > -1;
616
+ };
617
+
618
+ CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
619
+ var cursor = editor.getCursorPosition();
620
+ var line = session.doc.getLine(cursor.row);
621
+ if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
622
+ autoInsertedBrackets = 0;
623
+ autoInsertedRow = cursor.row;
624
+ autoInsertedLineEnd = bracket + line.substr(cursor.column);
625
+ autoInsertedBrackets++;
626
+ };
627
+
628
+ CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
629
+ var cursor = editor.getCursorPosition();
630
+ var line = session.doc.getLine(cursor.row);
631
+ if (!this.isMaybeInsertedClosing(cursor, line))
632
+ maybeInsertedBrackets = 0;
633
+ maybeInsertedRow = cursor.row;
634
+ maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
635
+ maybeInsertedLineEnd = line.substr(cursor.column);
636
+ maybeInsertedBrackets++;
637
+ };
638
+
639
+ CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
640
+ return autoInsertedBrackets > 0 &&
641
+ cursor.row === autoInsertedRow &&
642
+ bracket === autoInsertedLineEnd[0] &&
643
+ line.substr(cursor.column) === autoInsertedLineEnd;
644
+ };
645
+
646
+ CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
647
+ return maybeInsertedBrackets > 0 &&
648
+ cursor.row === maybeInsertedRow &&
649
+ line.substr(cursor.column) === maybeInsertedLineEnd &&
650
+ line.substr(0, cursor.column) == maybeInsertedLineStart;
651
+ };
652
+
653
+ CstyleBehaviour.popAutoInsertedClosing = function() {
654
+ autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
655
+ autoInsertedBrackets--;
656
+ };
657
+
658
+ CstyleBehaviour.clearMaybeInsertedClosing = function() {
659
+ maybeInsertedBrackets = 0;
660
+ maybeInsertedRow = -1;
661
+ };
662
+
663
+ this.add("braces", "insertion", function (state, action, editor, session, text) {
664
+ var cursor = editor.getCursorPosition();
665
+ var line = session.doc.getLine(cursor.row);
666
+ if (text == '{') {
667
+ var selection = editor.getSelectionRange();
668
+ var selected = session.doc.getTextRange(selection);
669
+ if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
670
+ return {
671
+ text: '{' + selected + '}',
672
+ selection: false
673
+ };
674
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
675
+ if (/[\]\}\)]/.test(line[cursor.column])) {
676
+ CstyleBehaviour.recordAutoInsert(editor, session, "}");
677
+ return {
678
+ text: '{}',
679
+ selection: [1, 1]
680
+ };
681
+ } else {
682
+ CstyleBehaviour.recordMaybeInsert(editor, session, "{");
683
+ return {
684
+ text: '{',
685
+ selection: [1, 1]
686
+ };
687
+ }
688
+ }
689
+ } else if (text == '}') {
690
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
691
+ if (rightChar == '}') {
692
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
693
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
694
+ CstyleBehaviour.popAutoInsertedClosing();
695
+ return {
696
+ text: '',
697
+ selection: [1, 1]
698
+ };
699
+ }
700
+ }
701
+ } else if (text == "\n" || text == "\r\n") {
702
+ var closing = "";
703
+ if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
704
+ closing = lang.stringRepeat("}", maybeInsertedBrackets);
705
+ CstyleBehaviour.clearMaybeInsertedClosing();
706
+ }
707
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
708
+ if (rightChar == '}' || closing !== "") {
709
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
710
+ if (!openBracePos)
711
+ return null;
712
+
713
+ var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
714
+ var next_indent = this.$getIndent(line);
715
+
716
+ return {
717
+ text: '\n' + indent + '\n' + next_indent + closing,
718
+ selection: [1, indent.length, 1, indent.length]
719
+ };
720
+ }
721
+ }
722
+ });
723
+
724
+ this.add("braces", "deletion", function (state, action, editor, session, range) {
725
+ var selected = session.doc.getTextRange(range);
726
+ if (!range.isMultiLine() && selected == '{') {
727
+ var line = session.doc.getLine(range.start.row);
728
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
729
+ if (rightChar == '}') {
730
+ range.end.column++;
731
+ return range;
732
+ } else {
733
+ maybeInsertedBrackets--;
734
+ }
735
+ }
736
+ });
737
+
738
+ this.add("parens", "insertion", function (state, action, editor, session, text) {
739
+ if (text == '(') {
740
+ var selection = editor.getSelectionRange();
741
+ var selected = session.doc.getTextRange(selection);
742
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
743
+ return {
744
+ text: '(' + selected + ')',
745
+ selection: false
746
+ };
747
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
748
+ CstyleBehaviour.recordAutoInsert(editor, session, ")");
749
+ return {
750
+ text: '()',
751
+ selection: [1, 1]
752
+ };
753
+ }
754
+ } else if (text == ')') {
755
+ var cursor = editor.getCursorPosition();
756
+ var line = session.doc.getLine(cursor.row);
757
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
758
+ if (rightChar == ')') {
759
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
760
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
761
+ CstyleBehaviour.popAutoInsertedClosing();
762
+ return {
763
+ text: '',
764
+ selection: [1, 1]
765
+ };
766
+ }
767
+ }
768
+ }
769
+ });
770
+
771
+ this.add("parens", "deletion", function (state, action, editor, session, range) {
772
+ var selected = session.doc.getTextRange(range);
773
+ if (!range.isMultiLine() && selected == '(') {
774
+ var line = session.doc.getLine(range.start.row);
775
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
776
+ if (rightChar == ')') {
777
+ range.end.column++;
778
+ return range;
779
+ }
780
+ }
781
+ });
782
+
783
+ this.add("brackets", "insertion", function (state, action, editor, session, text) {
784
+ if (text == '[') {
785
+ var selection = editor.getSelectionRange();
786
+ var selected = session.doc.getTextRange(selection);
787
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
788
+ return {
789
+ text: '[' + selected + ']',
790
+ selection: false
791
+ };
792
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
793
+ CstyleBehaviour.recordAutoInsert(editor, session, "]");
794
+ return {
795
+ text: '[]',
796
+ selection: [1, 1]
797
+ };
798
+ }
799
+ } else if (text == ']') {
800
+ var cursor = editor.getCursorPosition();
801
+ var line = session.doc.getLine(cursor.row);
802
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
803
+ if (rightChar == ']') {
804
+ var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
805
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
806
+ CstyleBehaviour.popAutoInsertedClosing();
807
+ return {
808
+ text: '',
809
+ selection: [1, 1]
810
+ };
811
+ }
812
+ }
813
+ }
814
+ });
815
+
816
+ this.add("brackets", "deletion", function (state, action, editor, session, range) {
817
+ var selected = session.doc.getTextRange(range);
818
+ if (!range.isMultiLine() && selected == '[') {
819
+ var line = session.doc.getLine(range.start.row);
820
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
821
+ if (rightChar == ']') {
822
+ range.end.column++;
823
+ return range;
824
+ }
825
+ }
826
+ });
827
+
828
+ this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
829
+ if (text == '"' || text == "'") {
830
+ var quote = text;
831
+ var selection = editor.getSelectionRange();
832
+ var selected = session.doc.getTextRange(selection);
833
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
834
+ return {
835
+ text: quote + selected + quote,
836
+ selection: false
837
+ };
838
+ } else {
839
+ var cursor = editor.getCursorPosition();
840
+ var line = session.doc.getLine(cursor.row);
841
+ var leftChar = line.substring(cursor.column-1, cursor.column);
842
+ if (leftChar == '\\') {
843
+ return null;
844
+ }
845
+ var tokens = session.getTokens(selection.start.row);
846
+ var col = 0, token;
847
+ var quotepos = -1; // Track whether we're inside an open quote.
848
+
849
+ for (var x = 0; x < tokens.length; x++) {
850
+ token = tokens[x];
851
+ if (token.type == "string") {
852
+ quotepos = -1;
853
+ } else if (quotepos < 0) {
854
+ quotepos = token.value.indexOf(quote);
855
+ }
856
+ if ((token.value.length + col) > selection.start.column) {
857
+ break;
858
+ }
859
+ col += tokens[x].value.length;
860
+ }
861
+ 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)))) {
862
+ if (!CstyleBehaviour.isSaneInsertion(editor, session))
863
+ return;
864
+ return {
865
+ text: quote + quote,
866
+ selection: [1,1]
867
+ };
868
+ } else if (token && token.type === "string") {
869
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
870
+ if (rightChar == quote) {
871
+ return {
872
+ text: '',
873
+ selection: [1, 1]
874
+ };
875
+ }
876
+ }
877
+ }
878
+ }
879
+ });
880
+
881
+ this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
882
+ var selected = session.doc.getTextRange(range);
883
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
884
+ var line = session.doc.getLine(range.start.row);
885
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
886
+ if (rightChar == selected) {
887
+ range.end.column++;
888
+ return range;
889
+ }
890
+ }
891
+ });
892
+
893
+ };
894
+
895
+ oop.inherits(CstyleBehaviour, Behaviour);
896
+
897
+ exports.CstyleBehaviour = CstyleBehaviour;
898
+ });
899
+
900
+ define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
901
+
902
+
903
+ var oop = require("../../lib/oop");
904
+ var Range = require("../../range").Range;
905
+ var BaseFoldMode = require("./fold_mode").FoldMode;
906
+
907
+ var FoldMode = exports.FoldMode = function(commentRegex) {
908
+ if (commentRegex) {
909
+ this.foldingStartMarker = new RegExp(
910
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
911
+ );
912
+ this.foldingStopMarker = new RegExp(
913
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
914
+ );
915
+ }
916
+ };
917
+ oop.inherits(FoldMode, BaseFoldMode);
918
+
919
+ (function() {
920
+
921
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
922
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
923
+
924
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
925
+ var line = session.getLine(row);
926
+ var match = line.match(this.foldingStartMarker);
927
+ if (match) {
928
+ var i = match.index;
929
+
930
+ if (match[1])
931
+ return this.openingBracketBlock(session, match[1], row, i);
932
+
933
+ return session.getCommentFoldRange(row, i + match[0].length, 1);
934
+ }
935
+
936
+ if (foldStyle !== "markbeginend")
937
+ return;
938
+
939
+ var match = line.match(this.foldingStopMarker);
940
+ if (match) {
941
+ var i = match.index + match[0].length;
942
+
943
+ if (match[1])
944
+ return this.closingBracketBlock(session, match[1], row, i);
945
+
946
+ return session.getCommentFoldRange(row, i, -1);
947
+ }
948
+ };
949
+
950
+ }).call(FoldMode.prototype);
951
+
952
+ });
953
+
954
+ 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) {
955
+
956
+
957
+ var oop = require("../lib/oop");
958
+ var TextMode = require("./text").Mode;
959
+ var Tokenizer = require("../tokenizer").Tokenizer;
960
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
961
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
962
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
963
+ var CssBehaviour = require("./behaviour/css").CssBehaviour;
964
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
965
+
966
+ var Mode = function() {
967
+ this.$tokenizer = new Tokenizer(new CssHighlightRules().getRules());
968
+ this.$outdent = new MatchingBraceOutdent();
969
+ this.$behaviour = new CssBehaviour();
970
+ this.foldingRules = new CStyleFoldMode();
971
+ };
972
+ oop.inherits(Mode, TextMode);
973
+
974
+ (function() {
975
+
976
+ this.foldingRules = "cStyle";
977
+ this.blockComment = {start: "/*", end: "*/"};
978
+
979
+ this.getNextLineIndent = function(state, line, tab) {
980
+ var indent = this.$getIndent(line);
981
+ var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
982
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
983
+ return indent;
984
+ }
985
+
986
+ var match = line.match(/^.*\{\s*$/);
987
+ if (match) {
988
+ indent += tab;
989
+ }
990
+
991
+ return indent;
992
+ };
993
+
994
+ this.checkOutdent = function(state, line, input) {
995
+ return this.$outdent.checkOutdent(line, input);
996
+ };
997
+
998
+ this.autoOutdent = function(state, doc, row) {
999
+ this.$outdent.autoOutdent(doc, row);
1000
+ };
1001
+
1002
+ this.createWorker = function(session) {
1003
+ var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
1004
+ worker.attachToDocument(session.getDocument());
1005
+
1006
+ worker.on("csslint", function(e) {
1007
+ session.setAnnotations(e.data);
1008
+ });
1009
+
1010
+ worker.on("terminate", function() {
1011
+ session.clearAnnotations();
1012
+ });
1013
+
1014
+ return worker;
1015
+ };
1016
+
1017
+ }).call(Mode.prototype);
1018
+
1019
+ exports.Mode = Mode;
1020
+
1021
+ });
1022
+
1023
+ define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1024
+
1025
+
1026
+ var oop = require("../lib/oop");
1027
+ var lang = require("../lib/lang");
1028
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1029
+ 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";
1030
+ var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
1031
+ 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";
1032
+ var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
1033
+ 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";
1034
+
1035
+ var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
1036
+ var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
1037
+ 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";
1038
+
1039
+ var CssHighlightRules = function() {
1040
+
1041
+ var keywordMapper = this.createKeywordMapper({
1042
+ "support.function": supportFunction,
1043
+ "support.constant": supportConstant,
1044
+ "support.type": supportType,
1045
+ "support.constant.color": supportConstantColor,
1046
+ "support.constant.fonts": supportConstantFonts
1047
+ }, "text", true);
1048
+
1049
+ var base_ruleset = [
1050
+ {
1051
+ token : "comment", // multi line comment
1052
+ regex : "\\/\\*",
1053
+ next : "ruleset_comment"
1054
+ }, {
1055
+ token : "string", // single line
1056
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
1057
+ }, {
1058
+ token : "string", // single line
1059
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
1060
+ }, {
1061
+ token : ["constant.numeric", "keyword"],
1062
+ 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|%)"
1063
+ }, {
1064
+ token : "constant.numeric",
1065
+ regex : numRe
1066
+ }, {
1067
+ token : "constant.numeric", // hex6 color
1068
+ regex : "#[a-f0-9]{6}"
1069
+ }, {
1070
+ token : "constant.numeric", // hex3 color
1071
+ regex : "#[a-f0-9]{3}"
1072
+ }, {
1073
+ token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
1074
+ regex : pseudoElements
1075
+ }, {
1076
+ token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
1077
+ regex : pseudoClasses
1078
+ }, {
1079
+ token : ["support.function", "string", "support.function"],
1080
+ regex : "(url\\()(.*)(\\))"
1081
+ }, {
1082
+ token : keywordMapper,
1083
+ regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
1084
+ }, {
1085
+ caseInsensitive: true
1086
+ }
1087
+ ];
1088
+
1089
+ var ruleset = lang.copyArray(base_ruleset);
1090
+ ruleset.unshift({
1091
+ token : "paren.rparen",
1092
+ regex : "\\}",
1093
+ next: "start"
1094
+ });
1095
+
1096
+ var media_ruleset = lang.copyArray( base_ruleset );
1097
+ media_ruleset.unshift({
1098
+ token : "paren.rparen",
1099
+ regex : "\\}",
1100
+ next: "media"
1101
+ });
1102
+
1103
+ var base_comment = [{
1104
+ token : "comment", // comment spanning whole line
1105
+ regex : ".+"
1106
+ }];
1107
+
1108
+ var comment = lang.copyArray(base_comment);
1109
+ comment.unshift({
1110
+ token : "comment", // closing comment
1111
+ regex : ".*?\\*\\/",
1112
+ next : "start"
1113
+ });
1114
+
1115
+ var media_comment = lang.copyArray(base_comment);
1116
+ media_comment.unshift({
1117
+ token : "comment", // closing comment
1118
+ regex : ".*?\\*\\/",
1119
+ next : "media"
1120
+ });
1121
+
1122
+ var ruleset_comment = lang.copyArray(base_comment);
1123
+ ruleset_comment.unshift({
1124
+ token : "comment", // closing comment
1125
+ regex : ".*?\\*\\/",
1126
+ next : "ruleset"
1127
+ });
1128
+
1129
+ this.$rules = {
1130
+ "start" : [{
1131
+ token : "comment", // multi line comment
1132
+ regex : "\\/\\*",
1133
+ next : "comment"
1134
+ }, {
1135
+ token: "paren.lparen",
1136
+ regex: "\\{",
1137
+ next: "ruleset"
1138
+ }, {
1139
+ token: "string",
1140
+ regex: "@.*?{",
1141
+ next: "media"
1142
+ },{
1143
+ token: "keyword",
1144
+ regex: "#[a-z0-9-_]+"
1145
+ },{
1146
+ token: "variable",
1147
+ regex: "\\.[a-z0-9-_]+"
1148
+ },{
1149
+ token: "string",
1150
+ regex: ":[a-z0-9-_]+"
1151
+ },{
1152
+ token: "constant",
1153
+ regex: "[a-z0-9-_]+"
1154
+ },{
1155
+ caseInsensitive: true
1156
+ }],
1157
+
1158
+ "media" : [ {
1159
+ token : "comment", // multi line comment
1160
+ regex : "\\/\\*",
1161
+ next : "media_comment"
1162
+ }, {
1163
+ token: "paren.lparen",
1164
+ regex: "\\{",
1165
+ next: "media_ruleset"
1166
+ },{
1167
+ token: "string",
1168
+ regex: "\\}",
1169
+ next: "start"
1170
+ },{
1171
+ token: "keyword",
1172
+ regex: "#[a-z0-9-_]+"
1173
+ },{
1174
+ token: "variable",
1175
+ regex: "\\.[a-z0-9-_]+"
1176
+ },{
1177
+ token: "string",
1178
+ regex: ":[a-z0-9-_]+"
1179
+ },{
1180
+ token: "constant",
1181
+ regex: "[a-z0-9-_]+"
1182
+ },{
1183
+ caseInsensitive: true
1184
+ }],
1185
+
1186
+ "comment" : comment,
1187
+
1188
+ "ruleset" : ruleset,
1189
+ "ruleset_comment" : ruleset_comment,
1190
+
1191
+ "media_ruleset" : media_ruleset,
1192
+ "media_comment" : media_comment
1193
+ };
1194
+ };
1195
+
1196
+ oop.inherits(CssHighlightRules, TextHighlightRules);
1197
+
1198
+ exports.CssHighlightRules = CssHighlightRules;
1199
+
1200
+ });
1201
+
1202
+ 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) {
1203
+
1204
+
1205
+ var oop = require("../../lib/oop");
1206
+ var Behaviour = require("../behaviour").Behaviour;
1207
+ var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1208
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1209
+
1210
+ var CssBehaviour = function () {
1211
+
1212
+ this.inherit(CstyleBehaviour);
1213
+
1214
+ this.add("colon", "insertion", function (state, action, editor, session, text) {
1215
+ if (text === ':') {
1216
+ var cursor = editor.getCursorPosition();
1217
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1218
+ var token = iterator.getCurrentToken();
1219
+ if (token && token.value.match(/\s+/)) {
1220
+ token = iterator.stepBackward();
1221
+ }
1222
+ if (token && token.type === 'support.type') {
1223
+ var line = session.doc.getLine(cursor.row);
1224
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1225
+ if (rightChar === ':') {
1226
+ return {
1227
+ text: '',
1228
+ selection: [1, 1]
1229
+ }
1230
+ }
1231
+ if (!line.substring(cursor.column).match(/^\s*;/)) {
1232
+ return {
1233
+ text: ':;',
1234
+ selection: [1, 1]
1235
+ }
1236
+ }
1237
+ }
1238
+ }
1239
+ });
1240
+
1241
+ this.add("colon", "deletion", function (state, action, editor, session, range) {
1242
+ var selected = session.doc.getTextRange(range);
1243
+ if (!range.isMultiLine() && selected === ':') {
1244
+ var cursor = editor.getCursorPosition();
1245
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1246
+ var token = iterator.getCurrentToken();
1247
+ if (token && token.value.match(/\s+/)) {
1248
+ token = iterator.stepBackward();
1249
+ }
1250
+ if (token && token.type === 'support.type') {
1251
+ var line = session.doc.getLine(range.start.row);
1252
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
1253
+ if (rightChar === ';') {
1254
+ range.end.column ++;
1255
+ return range;
1256
+ }
1257
+ }
1258
+ }
1259
+ });
1260
+
1261
+ this.add("semicolon", "insertion", function (state, action, editor, session, text) {
1262
+ if (text === ';') {
1263
+ var cursor = editor.getCursorPosition();
1264
+ var line = session.doc.getLine(cursor.row);
1265
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1266
+ if (rightChar === ';') {
1267
+ return {
1268
+ text: '',
1269
+ selection: [1, 1]
1270
+ }
1271
+ }
1272
+ }
1273
+ });
1274
+
1275
+ }
1276
+ oop.inherits(CssBehaviour, CstyleBehaviour);
1277
+
1278
+ exports.CssBehaviour = CssBehaviour;
1279
+ });
1280
+
1281
+ define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1282
+
1283
+
1284
+ var oop = require("../lib/oop");
1285
+ var lang = require("../lib/lang");
1286
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1287
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1288
+ var xmlUtil = require("./xml_util");
1289
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1290
+
1291
+ var tagMap = lang.createMap({
1292
+ a : 'anchor',
1293
+ button : 'form',
1294
+ form : 'form',
1295
+ img : 'image',
1296
+ input : 'form',
1297
+ label : 'form',
1298
+ script : 'script',
1299
+ select : 'form',
1300
+ textarea : 'form',
1301
+ style : 'style',
1302
+ table : 'table',
1303
+ tbody : 'table',
1304
+ td : 'table',
1305
+ tfoot : 'table',
1306
+ th : 'table',
1307
+ tr : 'table'
1308
+ });
1309
+
1310
+ var HtmlHighlightRules = function() {
1311
+ this.$rules = {
1312
+ start : [{
1313
+ token : "text",
1314
+ regex : "<\\!\\[CDATA\\[",
1315
+ next : "cdata"
1316
+ }, {
1317
+ token : "xml-pe",
1318
+ regex : "<\\?.*?\\?>"
1319
+ }, {
1320
+ token : "comment",
1321
+ regex : "<\\!--",
1322
+ next : "comment"
1323
+ }, {
1324
+ token : "xml-pe",
1325
+ regex : "<\\!.*?>"
1326
+ }, {
1327
+ token : "meta.tag",
1328
+ regex : "<(?=script\\b)",
1329
+ next : "script"
1330
+ }, {
1331
+ token : "meta.tag",
1332
+ regex : "<(?=style\\b)",
1333
+ next : "style"
1334
+ }, {
1335
+ token : "meta.tag", // opening tag
1336
+ regex : "<\\/?",
1337
+ next : "tag"
1338
+ }, {
1339
+ token : "text",
1340
+ regex : "\\s+"
1341
+ }, {
1342
+ token : "constant.character.entity",
1343
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1344
+ }],
1345
+
1346
+ cdata : [ {
1347
+ token : "text",
1348
+ regex : "\\]\\]>",
1349
+ next : "start"
1350
+ } ],
1351
+
1352
+ comment : [ {
1353
+ token : "comment",
1354
+ regex : ".*?-->",
1355
+ next : "start"
1356
+ }, {
1357
+ defaultToken : "comment"
1358
+ } ]
1359
+ };
1360
+
1361
+ xmlUtil.tag(this.$rules, "tag", "start", tagMap);
1362
+ xmlUtil.tag(this.$rules, "style", "css-start", tagMap);
1363
+ xmlUtil.tag(this.$rules, "script", "js-start", tagMap);
1364
+
1365
+ this.embedRules(JavaScriptHighlightRules, "js-", [{
1366
+ token: "comment",
1367
+ regex: "\\/\\/.*(?=<\\/script>)",
1368
+ next: "tag"
1369
+ }, {
1370
+ token: "meta.tag",
1371
+ regex: "<\\/(?=script)",
1372
+ next: "tag"
1373
+ }]);
1374
+
1375
+ this.embedRules(CssHighlightRules, "css-", [{
1376
+ token: "meta.tag",
1377
+ regex: "<\\/(?=style)",
1378
+ next: "tag"
1379
+ }]);
1380
+ };
1381
+
1382
+ oop.inherits(HtmlHighlightRules, TextHighlightRules);
1383
+
1384
+ exports.HtmlHighlightRules = HtmlHighlightRules;
1385
+ });
1386
+
1387
+ define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) {
1388
+
1389
+
1390
+ function string(state) {
1391
+ return [{
1392
+ token : "string",
1393
+ regex : '"',
1394
+ next : state + "_qqstring"
1395
+ }, {
1396
+ token : "string",
1397
+ regex : "'",
1398
+ next : state + "_qstring"
1399
+ }];
1400
+ }
1401
+
1402
+ function multiLineString(quote, state) {
1403
+ return [
1404
+ {token : "string", regex : quote, next : state},
1405
+ {
1406
+ token : "constant.language.escape",
1407
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1408
+ },
1409
+ {defaultToken : "string"}
1410
+ ];
1411
+ }
1412
+
1413
+ exports.tag = function(states, name, nextState, tagMap) {
1414
+ states[name] = [{
1415
+ token : "text",
1416
+ regex : "\\s+"
1417
+ }, {
1418
+
1419
+ token : !tagMap ? "meta.tag.tag-name" : function(value) {
1420
+ if (tagMap[value])
1421
+ return "meta.tag.tag-name." + tagMap[value];
1422
+ else
1423
+ return "meta.tag.tag-name";
1424
+ },
1425
+ regex : "[-_a-zA-Z0-9:]+",
1426
+ next : name + "_embed_attribute_list"
1427
+ }, {
1428
+ token: "empty",
1429
+ regex: "",
1430
+ next : name + "_embed_attribute_list"
1431
+ }];
1432
+
1433
+ states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
1434
+ states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
1435
+
1436
+ states[name + "_embed_attribute_list"] = [{
1437
+ token : "meta.tag.r",
1438
+ regex : "/?>",
1439
+ next : nextState
1440
+ }, {
1441
+ token : "keyword.operator",
1442
+ regex : "="
1443
+ }, {
1444
+ token : "entity.other.attribute-name",
1445
+ regex : "[-_a-zA-Z0-9:]+"
1446
+ }, {
1447
+ token : "constant.numeric", // float
1448
+ regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
1449
+ }, {
1450
+ token : "text",
1451
+ regex : "\\s+"
1452
+ }].concat(string(name));
1453
+ };
1454
+
1455
+ });
1456
+
1457
+ define('ace/mode/behaviour/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour/xml', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) {
1458
+
1459
+
1460
+ var oop = require("../../lib/oop");
1461
+ var XmlBehaviour = require("../behaviour/xml").XmlBehaviour;
1462
+ var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1463
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1464
+ var voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
1465
+
1466
+ function hasType(token, type) {
1467
+ var hasType = true;
1468
+ var typeList = token.type.split('.');
1469
+ var needleList = type.split('.');
1470
+ needleList.forEach(function(needle){
1471
+ if (typeList.indexOf(needle) == -1) {
1472
+ hasType = false;
1473
+ return false;
1474
+ }
1475
+ });
1476
+ return hasType;
1477
+ }
1478
+
1479
+ var HtmlBehaviour = function () {
1480
+
1481
+ this.inherit(XmlBehaviour); // Get xml behaviour
1482
+
1483
+ this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
1484
+ if (text == '>') {
1485
+ var position = editor.getCursorPosition();
1486
+ var iterator = new TokenIterator(session, position.row, position.column);
1487
+ var token = iterator.getCurrentToken();
1488
+ var atCursor = false;
1489
+ if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
1490
+ do {
1491
+ token = iterator.stepBackward();
1492
+ } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
1493
+ } else {
1494
+ atCursor = true;
1495
+ }
1496
+ if (!token || !hasType(token, 'meta.tag-name') || iterator.stepBackward().value.match('/')) {
1497
+ return
1498
+ }
1499
+ var element = token.value;
1500
+ if (atCursor){
1501
+ var element = element.substring(0, position.column - token.start);
1502
+ }
1503
+ if (voidElements.indexOf(element) !== -1){
1504
+ return;
1505
+ }
1506
+ return {
1507
+ text: '>' + '</' + element + '>',
1508
+ selection: [1, 1]
1509
+ }
1510
+ }
1511
+ });
1512
+ }
1513
+ oop.inherits(HtmlBehaviour, XmlBehaviour);
1514
+
1515
+ exports.HtmlBehaviour = HtmlBehaviour;
1516
+ });
1517
+
1518
+ 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) {
1519
+
1520
+
1521
+ var oop = require("../../lib/oop");
1522
+ var Behaviour = require("../behaviour").Behaviour;
1523
+ var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1524
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1525
+
1526
+ function hasType(token, type) {
1527
+ var hasType = true;
1528
+ var typeList = token.type.split('.');
1529
+ var needleList = type.split('.');
1530
+ needleList.forEach(function(needle){
1531
+ if (typeList.indexOf(needle) == -1) {
1532
+ hasType = false;
1533
+ return false;
1534
+ }
1535
+ });
1536
+ return hasType;
1537
+ }
1538
+
1539
+ var XmlBehaviour = function () {
1540
+
1541
+ this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour
1542
+
1543
+ this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
1544
+ if (text == '>') {
1545
+ var position = editor.getCursorPosition();
1546
+ var iterator = new TokenIterator(session, position.row, position.column);
1547
+ var token = iterator.getCurrentToken();
1548
+ var atCursor = false;
1549
+ if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
1550
+ do {
1551
+ token = iterator.stepBackward();
1552
+ } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
1553
+ } else {
1554
+ atCursor = true;
1555
+ }
1556
+ if (!token || !hasType(token, 'meta.tag-name') || iterator.stepBackward().value.match('/')) {
1557
+ return
1558
+ }
1559
+ var tag = token.value;
1560
+ if (atCursor){
1561
+ var tag = tag.substring(0, position.column - token.start);
1562
+ }
1563
+
1564
+ return {
1565
+ text: '>' + '</' + tag + '>',
1566
+ selection: [1, 1]
1567
+ }
1568
+ }
1569
+ });
1570
+
1571
+ this.add('autoindent', 'insertion', function (state, action, editor, session, text) {
1572
+ if (text == "\n") {
1573
+ var cursor = editor.getCursorPosition();
1574
+ var line = session.doc.getLine(cursor.row);
1575
+ var rightChars = line.substring(cursor.column, cursor.column + 2);
1576
+ if (rightChars == '</') {
1577
+ var indent = this.$getIndent(session.doc.getLine(cursor.row)) + session.getTabString();
1578
+ var next_indent = this.$getIndent(session.doc.getLine(cursor.row));
1579
+
1580
+ return {
1581
+ text: '\n' + indent + '\n' + next_indent,
1582
+ selection: [1, indent.length, 1, indent.length]
1583
+ }
1584
+ }
1585
+ }
1586
+ });
1587
+
1588
+ }
1589
+ oop.inherits(XmlBehaviour, Behaviour);
1590
+
1591
+ exports.XmlBehaviour = XmlBehaviour;
1592
+ });
1593
+
1594
+ define('ace/mode/folding/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/mixed', 'ace/mode/folding/xml', 'ace/mode/folding/cstyle'], function(require, exports, module) {
1595
+
1596
+
1597
+ var oop = require("../../lib/oop");
1598
+ var MixedFoldMode = require("./mixed").FoldMode;
1599
+ var XmlFoldMode = require("./xml").FoldMode;
1600
+ var CStyleFoldMode = require("./cstyle").FoldMode;
1601
+
1602
+ var FoldMode = exports.FoldMode = function() {
1603
+ MixedFoldMode.call(this, new XmlFoldMode({
1604
+ "area": 1,
1605
+ "base": 1,
1606
+ "br": 1,
1607
+ "col": 1,
1608
+ "command": 1,
1609
+ "embed": 1,
1610
+ "hr": 1,
1611
+ "img": 1,
1612
+ "input": 1,
1613
+ "keygen": 1,
1614
+ "link": 1,
1615
+ "meta": 1,
1616
+ "param": 1,
1617
+ "source": 1,
1618
+ "track": 1,
1619
+ "wbr": 1,
1620
+ "li": 1,
1621
+ "dt": 1,
1622
+ "dd": 1,
1623
+ "p": 1,
1624
+ "rt": 1,
1625
+ "rp": 1,
1626
+ "optgroup": 1,
1627
+ "option": 1,
1628
+ "colgroup": 1,
1629
+ "td": 1,
1630
+ "th": 1
1631
+ }), {
1632
+ "js-": new CStyleFoldMode(),
1633
+ "css-": new CStyleFoldMode()
1634
+ });
1635
+ };
1636
+
1637
+ oop.inherits(FoldMode, MixedFoldMode);
1638
+
1639
+ });
1640
+
1641
+ define('ace/mode/folding/mixed', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
1642
+
1643
+
1644
+ var oop = require("../../lib/oop");
1645
+ var BaseFoldMode = require("./fold_mode").FoldMode;
1646
+
1647
+ var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
1648
+ this.defaultMode = defaultMode;
1649
+ this.subModes = subModes;
1650
+ };
1651
+ oop.inherits(FoldMode, BaseFoldMode);
1652
+
1653
+ (function() {
1654
+
1655
+
1656
+ this.$getMode = function(state) {
1657
+ for (var key in this.subModes) {
1658
+ if (state.indexOf(key) === 0)
1659
+ return this.subModes[key];
1660
+ }
1661
+ return null;
1662
+ };
1663
+
1664
+ this.$tryMode = function(state, session, foldStyle, row) {
1665
+ var mode = this.$getMode(state);
1666
+ return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
1667
+ };
1668
+
1669
+ this.getFoldWidget = function(session, foldStyle, row) {
1670
+ return (
1671
+ this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
1672
+ this.$tryMode(session.getState(row), session, foldStyle, row) ||
1673
+ this.defaultMode.getFoldWidget(session, foldStyle, row)
1674
+ );
1675
+ };
1676
+
1677
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1678
+ var mode = this.$getMode(session.getState(row-1));
1679
+
1680
+ if (!mode || !mode.getFoldWidget(session, foldStyle, row))
1681
+ mode = this.$getMode(session.getState(row));
1682
+
1683
+ if (!mode || !mode.getFoldWidget(session, foldStyle, row))
1684
+ mode = this.defaultMode;
1685
+
1686
+ return mode.getFoldWidgetRange(session, foldStyle, row);
1687
+ };
1688
+
1689
+ }).call(FoldMode.prototype);
1690
+
1691
+ });
1692
+
1693
+ 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) {
1694
+
1695
+
1696
+ var oop = require("../../lib/oop");
1697
+ var lang = require("../../lib/lang");
1698
+ var Range = require("../../range").Range;
1699
+ var BaseFoldMode = require("./fold_mode").FoldMode;
1700
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1701
+
1702
+ var FoldMode = exports.FoldMode = function(voidElements) {
1703
+ BaseFoldMode.call(this);
1704
+ this.voidElements = voidElements || {};
1705
+ };
1706
+ oop.inherits(FoldMode, BaseFoldMode);
1707
+
1708
+ (function() {
1709
+
1710
+ this.getFoldWidget = function(session, foldStyle, row) {
1711
+ var tag = this._getFirstTagInLine(session, row);
1712
+
1713
+ if (tag.closing)
1714
+ return foldStyle == "markbeginend" ? "end" : "";
1715
+
1716
+ if (!tag.tagName || this.voidElements[tag.tagName.toLowerCase()])
1717
+ return "";
1718
+
1719
+ if (tag.selfClosing)
1720
+ return "";
1721
+
1722
+ if (tag.value.indexOf("/" + tag.tagName) !== -1)
1723
+ return "";
1724
+
1725
+ return "start";
1726
+ };
1727
+
1728
+ this._getFirstTagInLine = function(session, row) {
1729
+ var tokens = session.getTokens(row);
1730
+ var value = "";
1731
+ for (var i = 0; i < tokens.length; i++) {
1732
+ var token = tokens[i];
1733
+ if (token.type.indexOf("meta.tag") === 0)
1734
+ value += token.value;
1735
+ else
1736
+ value += lang.stringRepeat(" ", token.value.length);
1737
+ }
1738
+
1739
+ return this._parseTag(value);
1740
+ };
1741
+
1742
+ this.tagRe = /^(\s*)(<?(\/?)([-_a-zA-Z0-9:!]*)\s*(\/?)>?)/;
1743
+ this._parseTag = function(tag) {
1744
+
1745
+ var match = this.tagRe.exec(tag);
1746
+ var column = this.tagRe.lastIndex || 0;
1747
+ this.tagRe.lastIndex = 0;
1748
+
1749
+ return {
1750
+ value: tag,
1751
+ match: match ? match[2] : "",
1752
+ closing: match ? !!match[3] : false,
1753
+ selfClosing: match ? !!match[5] || match[2] == "/>" : false,
1754
+ tagName: match ? match[4] : "",
1755
+ column: match[1] ? column + match[1].length : column
1756
+ };
1757
+ };
1758
+ this._readTagForward = function(iterator) {
1759
+ var token = iterator.getCurrentToken();
1760
+ if (!token)
1761
+ return null;
1762
+
1763
+ var value = "";
1764
+ var start;
1765
+
1766
+ do {
1767
+ if (token.type.indexOf("meta.tag") === 0) {
1768
+ if (!start) {
1769
+ var start = {
1770
+ row: iterator.getCurrentTokenRow(),
1771
+ column: iterator.getCurrentTokenColumn()
1772
+ };
1773
+ }
1774
+ value += token.value;
1775
+ if (value.indexOf(">") !== -1) {
1776
+ var tag = this._parseTag(value);
1777
+ tag.start = start;
1778
+ tag.end = {
1779
+ row: iterator.getCurrentTokenRow(),
1780
+ column: iterator.getCurrentTokenColumn() + token.value.length
1781
+ };
1782
+ iterator.stepForward();
1783
+ return tag;
1784
+ }
1785
+ }
1786
+ } while(token = iterator.stepForward());
1787
+
1788
+ return null;
1789
+ };
1790
+
1791
+ this._readTagBackward = function(iterator) {
1792
+ var token = iterator.getCurrentToken();
1793
+ if (!token)
1794
+ return null;
1795
+
1796
+ var value = "";
1797
+ var end;
1798
+
1799
+ do {
1800
+ if (token.type.indexOf("meta.tag") === 0) {
1801
+ if (!end) {
1802
+ end = {
1803
+ row: iterator.getCurrentTokenRow(),
1804
+ column: iterator.getCurrentTokenColumn() + token.value.length
1805
+ };
1806
+ }
1807
+ value = token.value + value;
1808
+ if (value.indexOf("<") !== -1) {
1809
+ var tag = this._parseTag(value);
1810
+ tag.end = end;
1811
+ tag.start = {
1812
+ row: iterator.getCurrentTokenRow(),
1813
+ column: iterator.getCurrentTokenColumn()
1814
+ };
1815
+ iterator.stepBackward();
1816
+ return tag;
1817
+ }
1818
+ }
1819
+ } while(token = iterator.stepBackward());
1820
+
1821
+ return null;
1822
+ };
1823
+
1824
+ this._pop = function(stack, tag) {
1825
+ while (stack.length) {
1826
+
1827
+ var top = stack[stack.length-1];
1828
+ if (!tag || top.tagName == tag.tagName) {
1829
+ return stack.pop();
1830
+ }
1831
+ else if (this.voidElements[tag.tagName]) {
1832
+ return;
1833
+ }
1834
+ else if (this.voidElements[top.tagName]) {
1835
+ stack.pop();
1836
+ continue;
1837
+ } else {
1838
+ return null;
1839
+ }
1840
+ }
1841
+ };
1842
+
1843
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1844
+ var firstTag = this._getFirstTagInLine(session, row);
1845
+
1846
+ if (!firstTag.match)
1847
+ return null;
1848
+
1849
+ var isBackward = firstTag.closing || firstTag.selfClosing;
1850
+ var stack = [];
1851
+ var tag;
1852
+
1853
+ if (!isBackward) {
1854
+ var iterator = new TokenIterator(session, row, firstTag.column);
1855
+ var start = {
1856
+ row: row,
1857
+ column: firstTag.column + firstTag.tagName.length + 2
1858
+ };
1859
+ while (tag = this._readTagForward(iterator)) {
1860
+ if (tag.selfClosing) {
1861
+ if (!stack.length) {
1862
+ tag.start.column += tag.tagName.length + 2;
1863
+ tag.end.column -= 2;
1864
+ return Range.fromPoints(tag.start, tag.end);
1865
+ } else
1866
+ continue;
1867
+ }
1868
+
1869
+ if (tag.closing) {
1870
+ this._pop(stack, tag);
1871
+ if (stack.length == 0)
1872
+ return Range.fromPoints(start, tag.start);
1873
+ }
1874
+ else {
1875
+ stack.push(tag)
1876
+ }
1877
+ }
1878
+ }
1879
+ else {
1880
+ var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length);
1881
+ var end = {
1882
+ row: row,
1883
+ column: firstTag.column
1884
+ };
1885
+
1886
+ while (tag = this._readTagBackward(iterator)) {
1887
+ if (tag.selfClosing) {
1888
+ if (!stack.length) {
1889
+ tag.start.column += tag.tagName.length + 2;
1890
+ tag.end.column -= 2;
1891
+ return Range.fromPoints(tag.start, tag.end);
1892
+ } else
1893
+ continue;
1894
+ }
1895
+
1896
+ if (!tag.closing) {
1897
+ this._pop(stack, tag);
1898
+ if (stack.length == 0) {
1899
+ tag.start.column += tag.tagName.length + 2;
1900
+ return Range.fromPoints(tag.start, end);
1901
+ }
1902
+ }
1903
+ else {
1904
+ stack.push(tag)
1905
+ }
1906
+ }
1907
+ }
1908
+
1909
+ };
1910
+
1911
+ }).call(FoldMode.prototype);
1912
+
1913
+ });
1914
+ define('ace/mode/curly_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/html_highlight_rules'], function(require, exports, module) {
1915
+
1916
+
1917
+ var oop = require("../lib/oop");
1918
+ var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
1919
+
1920
+
1921
+ var CurlyHighlightRules = function() {
1922
+ var CurlyRules = {
1923
+ "start" : [
1924
+ {
1925
+ token: "variable",
1926
+ regex: "{{",
1927
+ next: "curly_mode"
1928
+ }
1929
+ ],
1930
+
1931
+ "curly_mode" : [
1932
+ {
1933
+ token: "variable",
1934
+ regex: "}}",
1935
+ next: "start"
1936
+ }
1937
+ ]
1938
+ };
1939
+
1940
+ var htmlRules = new HtmlHighlightRules().getRules();
1941
+ htmlRules.start = CurlyRules.start.concat(htmlRules.start);
1942
+ htmlRules.curly_mode = CurlyRules.curly_mode;
1943
+ this.$rules = htmlRules;
1944
+ };
1945
+
1946
+ oop.inherits(CurlyHighlightRules, HtmlHighlightRules);
1947
+
1948
+ exports.CurlyHighlightRules = CurlyHighlightRules;
1949
+
1950
+ });