datagram 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,961 @@
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
+ * ***** END LICENSE BLOCK ***** */
30
+
31
+ define('ace/mode/typescript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/javascript', 'ace/tokenizer', 'ace/mode/typescript_highlight_rules', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle', 'ace/mode/matching_brace_outdent'], function(require, exports, module) {
32
+
33
+
34
+ var oop = require("../lib/oop");
35
+ var jsMode = require("./javascript").Mode;
36
+ var Tokenizer = require("../tokenizer").Tokenizer;
37
+ var TypeScriptHighlightRules = require("./typescript_highlight_rules").TypeScriptHighlightRules;
38
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
39
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
40
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
41
+
42
+ var Mode = function() {
43
+ var highlighter = new TypeScriptHighlightRules();
44
+
45
+ this.$tokenizer = new Tokenizer(highlighter.getRules());
46
+ this.$outdent = new MatchingBraceOutdent();
47
+ this.$behaviour = new CstyleBehaviour();
48
+ this.foldingRules = new CStyleFoldMode();
49
+ };
50
+ oop.inherits(Mode, jsMode);
51
+
52
+ (function() {
53
+ this.createWorker = function(session) {
54
+ return null;
55
+ };
56
+ }).call(Mode.prototype);
57
+
58
+ exports.Mode = Mode;
59
+ });
60
+
61
+ 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) {
62
+
63
+
64
+ var oop = require("../lib/oop");
65
+ var TextMode = require("./text").Mode;
66
+ var Tokenizer = require("../tokenizer").Tokenizer;
67
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
68
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
69
+ var Range = require("../range").Range;
70
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
71
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
72
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
73
+
74
+ var Mode = function() {
75
+ this.$tokenizer = new Tokenizer(new JavaScriptHighlightRules().getRules());
76
+ this.$outdent = new MatchingBraceOutdent();
77
+ this.$behaviour = new CstyleBehaviour();
78
+ this.foldingRules = new CStyleFoldMode();
79
+ };
80
+ oop.inherits(Mode, TextMode);
81
+
82
+ (function() {
83
+
84
+ this.lineCommentStart = "//";
85
+ this.blockComment = {start: "/*", end: "*/"};
86
+
87
+ this.getNextLineIndent = function(state, line, tab) {
88
+ var indent = this.$getIndent(line);
89
+
90
+ var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
91
+ var tokens = tokenizedLine.tokens;
92
+ var endState = tokenizedLine.state;
93
+
94
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
95
+ return indent;
96
+ }
97
+
98
+ if (state == "start" || state == "no_regex") {
99
+ var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
100
+ if (match) {
101
+ indent += tab;
102
+ }
103
+ } else if (state == "doc-start") {
104
+ if (endState == "start" || endState == "no_regex") {
105
+ return "";
106
+ }
107
+ var match = line.match(/^\s*(\/?)\*/);
108
+ if (match) {
109
+ if (match[1]) {
110
+ indent += " ";
111
+ }
112
+ indent += "* ";
113
+ }
114
+ }
115
+
116
+ return indent;
117
+ };
118
+
119
+ this.checkOutdent = function(state, line, input) {
120
+ return this.$outdent.checkOutdent(line, input);
121
+ };
122
+
123
+ this.autoOutdent = function(state, doc, row) {
124
+ this.$outdent.autoOutdent(doc, row);
125
+ };
126
+
127
+ this.createWorker = function(session) {
128
+ var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
129
+ worker.attachToDocument(session.getDocument());
130
+
131
+ worker.on("jslint", function(results) {
132
+ session.setAnnotations(results.data);
133
+ });
134
+
135
+ worker.on("terminate", function() {
136
+ session.clearAnnotations();
137
+ });
138
+
139
+ return worker;
140
+ };
141
+
142
+ }).call(Mode.prototype);
143
+
144
+ exports.Mode = Mode;
145
+ });
146
+
147
+ 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) {
148
+
149
+
150
+ var oop = require("../lib/oop");
151
+ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
152
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
153
+
154
+ var JavaScriptHighlightRules = function() {
155
+ var keywordMapper = this.createKeywordMapper({
156
+ "variable.language":
157
+ "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
158
+ "Namespace|QName|XML|XMLList|" + // E4X
159
+ "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
160
+ "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
161
+ "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
162
+ "SyntaxError|TypeError|URIError|" +
163
+ "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
164
+ "isNaN|parseFloat|parseInt|" +
165
+ "JSON|Math|" + // Other
166
+ "this|arguments|prototype|window|document" , // Pseudo
167
+ "keyword":
168
+ "const|yield|import|get|set|" +
169
+ "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
170
+ "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
171
+ "__parent__|__count__|escape|unescape|with|__proto__|" +
172
+ "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
173
+ "storage.type":
174
+ "const|let|var|function",
175
+ "constant.language":
176
+ "null|Infinity|NaN|undefined",
177
+ "support.function":
178
+ "alert",
179
+ "constant.language.boolean": "true|false"
180
+ }, "identifier");
181
+ var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
182
+ var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
183
+
184
+ var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
185
+ "u[0-9a-fA-F]{4}|" + // unicode
186
+ "[0-2][0-7]{0,2}|" + // oct
187
+ "3[0-6][0-7]?|" + // oct
188
+ "37[0-7]?|" + // oct
189
+ "[4-7][0-7]?|" + //oct
190
+ ".)";
191
+
192
+ this.$rules = {
193
+ "no_regex" : [
194
+ {
195
+ token : "comment",
196
+ regex : /\/\/.*$/
197
+ },
198
+ DocCommentHighlightRules.getStartRule("doc-start"),
199
+ {
200
+ token : "comment", // multi line comment
201
+ regex : /\/\*/,
202
+ next : "comment"
203
+ }, {
204
+ token : "string",
205
+ regex : "'(?=.)",
206
+ next : "qstring"
207
+ }, {
208
+ token : "string",
209
+ regex : '"(?=.)',
210
+ next : "qqstring"
211
+ }, {
212
+ token : "constant.numeric", // hex
213
+ regex : /0[xX][0-9a-fA-F]+\b/
214
+ }, {
215
+ token : "constant.numeric", // float
216
+ regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
217
+ }, {
218
+ token : [
219
+ "storage.type", "punctuation.operator", "support.function",
220
+ "punctuation.operator", "entity.name.function", "text","keyword.operator"
221
+ ],
222
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
223
+ next: "function_arguments"
224
+ }, {
225
+ token : [
226
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
227
+ "keyword.operator", "text", "storage.type", "text", "paren.lparen"
228
+ ],
229
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
230
+ next: "function_arguments"
231
+ }, {
232
+ token : [
233
+ "entity.name.function", "text", "keyword.operator", "text", "storage.type",
234
+ "text", "paren.lparen"
235
+ ],
236
+ regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
237
+ next: "function_arguments"
238
+ }, {
239
+ token : [
240
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
241
+ "keyword.operator", "text",
242
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
243
+ ],
244
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
245
+ next: "function_arguments"
246
+ }, {
247
+ token : [
248
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
249
+ ],
250
+ regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
251
+ next: "function_arguments"
252
+ }, {
253
+ token : [
254
+ "entity.name.function", "text", "punctuation.operator",
255
+ "text", "storage.type", "text", "paren.lparen"
256
+ ],
257
+ regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
258
+ next: "function_arguments"
259
+ }, {
260
+ token : [
261
+ "text", "text", "storage.type", "text", "paren.lparen"
262
+ ],
263
+ regex : "(:)(\\s*)(function)(\\s*)(\\()",
264
+ next: "function_arguments"
265
+ }, {
266
+ token : "keyword",
267
+ regex : "(?:" + kwBeforeRe + ")\\b",
268
+ next : "start"
269
+ }, {
270
+ token : ["punctuation.operator", "support.function"],
271
+ 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(?=\()/
272
+ }, {
273
+ token : ["punctuation.operator", "support.function.dom"],
274
+ 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(?=\()/
275
+ }, {
276
+ token : ["punctuation.operator", "support.constant"],
277
+ 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/
278
+ }, {
279
+ token : ["storage.type", "punctuation.operator", "support.function.firebug"],
280
+ regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
281
+ }, {
282
+ token : keywordMapper,
283
+ regex : identifierRe
284
+ }, {
285
+ token : "keyword.operator",
286
+ regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/,
287
+ next : "start"
288
+ }, {
289
+ token : "punctuation.operator",
290
+ regex : /\?|\:|\,|\;|\./,
291
+ next : "start"
292
+ }, {
293
+ token : "paren.lparen",
294
+ regex : /[\[({]/,
295
+ next : "start"
296
+ }, {
297
+ token : "paren.rparen",
298
+ regex : /[\])}]/
299
+ }, {
300
+ token : "keyword.operator",
301
+ regex : /\/=?/,
302
+ next : "start"
303
+ }, {
304
+ token: "comment",
305
+ regex: /^#!.*$/
306
+ }
307
+ ],
308
+ "start": [
309
+ DocCommentHighlightRules.getStartRule("doc-start"),
310
+ {
311
+ token : "comment", // multi line comment
312
+ regex : "\\/\\*",
313
+ next : "comment_regex_allowed"
314
+ }, {
315
+ token : "comment",
316
+ regex : "\\/\\/.*$",
317
+ next : "start"
318
+ }, {
319
+ token: "string.regexp",
320
+ regex: "\\/",
321
+ next: "regex"
322
+ }, {
323
+ token : "text",
324
+ regex : "\\s+|^$",
325
+ next : "start"
326
+ }, {
327
+ token: "empty",
328
+ regex: "",
329
+ next: "no_regex"
330
+ }
331
+ ],
332
+ "regex": [
333
+ {
334
+ token: "regexp.keyword.operator",
335
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
336
+ }, {
337
+ token: "string.regexp",
338
+ regex: "/\\w*",
339
+ next: "no_regex"
340
+ }, {
341
+ token : "invalid",
342
+ regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
343
+ }, {
344
+ token : "constant.language.escape",
345
+ regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/
346
+ }, {
347
+ token : "constant.language.delimiter",
348
+ regex: /\|/
349
+ }, {
350
+ token: "constant.language.escape",
351
+ regex: /\[\^?/,
352
+ next: "regex_character_class"
353
+ }, {
354
+ token: "empty",
355
+ regex: "$",
356
+ next: "no_regex"
357
+ }, {
358
+ defaultToken: "string.regexp"
359
+ }
360
+ ],
361
+ "regex_character_class": [
362
+ {
363
+ token: "regexp.keyword.operator",
364
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
365
+ }, {
366
+ token: "constant.language.escape",
367
+ regex: "]",
368
+ next: "regex"
369
+ }, {
370
+ token: "constant.language.escape",
371
+ regex: "-"
372
+ }, {
373
+ token: "empty",
374
+ regex: "$",
375
+ next: "no_regex"
376
+ }, {
377
+ defaultToken: "string.regexp.charachterclass"
378
+ }
379
+ ],
380
+ "function_arguments": [
381
+ {
382
+ token: "variable.parameter",
383
+ regex: identifierRe
384
+ }, {
385
+ token: "punctuation.operator",
386
+ regex: "[, ]+"
387
+ }, {
388
+ token: "punctuation.operator",
389
+ regex: "$"
390
+ }, {
391
+ token: "empty",
392
+ regex: "",
393
+ next: "no_regex"
394
+ }
395
+ ],
396
+ "comment_regex_allowed" : [
397
+ {token : "comment", regex : "\\*\\/", next : "start"},
398
+ {defaultToken : "comment"}
399
+ ],
400
+ "comment" : [
401
+ {token : "comment", regex : "\\*\\/", next : "no_regex"},
402
+ {defaultToken : "comment"}
403
+ ],
404
+ "qqstring" : [
405
+ {
406
+ token : "constant.language.escape",
407
+ regex : escapedRe
408
+ }, {
409
+ token : "string",
410
+ regex : "\\\\$",
411
+ next : "qqstring"
412
+ }, {
413
+ token : "string",
414
+ regex : '"|$',
415
+ next : "no_regex"
416
+ }, {
417
+ defaultToken: "string"
418
+ }
419
+ ],
420
+ "qstring" : [
421
+ {
422
+ token : "constant.language.escape",
423
+ regex : escapedRe
424
+ }, {
425
+ token : "string",
426
+ regex : "\\\\$",
427
+ next : "qstring"
428
+ }, {
429
+ token : "string",
430
+ regex : "'|$",
431
+ next : "no_regex"
432
+ }, {
433
+ defaultToken: "string"
434
+ }
435
+ ]
436
+ };
437
+
438
+ this.embedRules(DocCommentHighlightRules, "doc-",
439
+ [ DocCommentHighlightRules.getEndRule("no_regex") ]);
440
+ };
441
+
442
+ oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
443
+
444
+ exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
445
+ });
446
+
447
+ define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
448
+
449
+
450
+ var oop = require("../lib/oop");
451
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
452
+
453
+ var DocCommentHighlightRules = function() {
454
+
455
+ this.$rules = {
456
+ "start" : [ {
457
+ token : "comment.doc.tag",
458
+ regex : "@[\\w\\d_]+" // TODO: fix email addresses
459
+ }, {
460
+ token : "comment.doc.tag",
461
+ regex : "\\bTODO\\b"
462
+ }, {
463
+ defaultToken : "comment.doc"
464
+ }]
465
+ };
466
+ };
467
+
468
+ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
469
+
470
+ DocCommentHighlightRules.getStartRule = function(start) {
471
+ return {
472
+ token : "comment.doc", // doc comment
473
+ regex : "\\/\\*(?=\\*)",
474
+ next : start
475
+ };
476
+ };
477
+
478
+ DocCommentHighlightRules.getEndRule = function (start) {
479
+ return {
480
+ token : "comment.doc", // closing comment
481
+ regex : "\\*\\/",
482
+ next : start
483
+ };
484
+ };
485
+
486
+
487
+ exports.DocCommentHighlightRules = DocCommentHighlightRules;
488
+
489
+ });
490
+
491
+ define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
492
+
493
+
494
+ var Range = require("../range").Range;
495
+
496
+ var MatchingBraceOutdent = function() {};
497
+
498
+ (function() {
499
+
500
+ this.checkOutdent = function(line, input) {
501
+ if (! /^\s+$/.test(line))
502
+ return false;
503
+
504
+ return /^\s*\}/.test(input);
505
+ };
506
+
507
+ this.autoOutdent = function(doc, row) {
508
+ var line = doc.getLine(row);
509
+ var match = line.match(/^(\s*\})/);
510
+
511
+ if (!match) return 0;
512
+
513
+ var column = match[1].length;
514
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
515
+
516
+ if (!openBracePos || openBracePos.row == row) return 0;
517
+
518
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
519
+ doc.replace(new Range(row, 0, row, column-1), indent);
520
+ };
521
+
522
+ this.$getIndent = function(line) {
523
+ return line.match(/^\s*/)[0];
524
+ };
525
+
526
+ }).call(MatchingBraceOutdent.prototype);
527
+
528
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
529
+ });
530
+
531
+ define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
532
+
533
+
534
+ var oop = require("../../lib/oop");
535
+ var Behaviour = require("../behaviour").Behaviour;
536
+ var TokenIterator = require("../../token_iterator").TokenIterator;
537
+ var lang = require("../../lib/lang");
538
+
539
+ var SAFE_INSERT_IN_TOKENS =
540
+ ["text", "paren.rparen", "punctuation.operator"];
541
+ var SAFE_INSERT_BEFORE_TOKENS =
542
+ ["text", "paren.rparen", "punctuation.operator", "comment"];
543
+
544
+
545
+ var autoInsertedBrackets = 0;
546
+ var autoInsertedRow = -1;
547
+ var autoInsertedLineEnd = "";
548
+ var maybeInsertedBrackets = 0;
549
+ var maybeInsertedRow = -1;
550
+ var maybeInsertedLineStart = "";
551
+ var maybeInsertedLineEnd = "";
552
+
553
+ var CstyleBehaviour = function () {
554
+
555
+ CstyleBehaviour.isSaneInsertion = function(editor, session) {
556
+ var cursor = editor.getCursorPosition();
557
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
558
+ if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
559
+ var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
560
+ if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
561
+ return false;
562
+ }
563
+ iterator.stepForward();
564
+ return iterator.getCurrentTokenRow() !== cursor.row ||
565
+ this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
566
+ };
567
+
568
+ CstyleBehaviour.$matchTokenType = function(token, types) {
569
+ return types.indexOf(token.type || token) > -1;
570
+ };
571
+
572
+ CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
573
+ var cursor = editor.getCursorPosition();
574
+ var line = session.doc.getLine(cursor.row);
575
+ if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
576
+ autoInsertedBrackets = 0;
577
+ autoInsertedRow = cursor.row;
578
+ autoInsertedLineEnd = bracket + line.substr(cursor.column);
579
+ autoInsertedBrackets++;
580
+ };
581
+
582
+ CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
583
+ var cursor = editor.getCursorPosition();
584
+ var line = session.doc.getLine(cursor.row);
585
+ if (!this.isMaybeInsertedClosing(cursor, line))
586
+ maybeInsertedBrackets = 0;
587
+ maybeInsertedRow = cursor.row;
588
+ maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
589
+ maybeInsertedLineEnd = line.substr(cursor.column);
590
+ maybeInsertedBrackets++;
591
+ };
592
+
593
+ CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
594
+ return autoInsertedBrackets > 0 &&
595
+ cursor.row === autoInsertedRow &&
596
+ bracket === autoInsertedLineEnd[0] &&
597
+ line.substr(cursor.column) === autoInsertedLineEnd;
598
+ };
599
+
600
+ CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
601
+ return maybeInsertedBrackets > 0 &&
602
+ cursor.row === maybeInsertedRow &&
603
+ line.substr(cursor.column) === maybeInsertedLineEnd &&
604
+ line.substr(0, cursor.column) == maybeInsertedLineStart;
605
+ };
606
+
607
+ CstyleBehaviour.popAutoInsertedClosing = function() {
608
+ autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
609
+ autoInsertedBrackets--;
610
+ };
611
+
612
+ CstyleBehaviour.clearMaybeInsertedClosing = function() {
613
+ maybeInsertedBrackets = 0;
614
+ maybeInsertedRow = -1;
615
+ };
616
+
617
+ this.add("braces", "insertion", function (state, action, editor, session, text) {
618
+ var cursor = editor.getCursorPosition();
619
+ var line = session.doc.getLine(cursor.row);
620
+ if (text == '{') {
621
+ var selection = editor.getSelectionRange();
622
+ var selected = session.doc.getTextRange(selection);
623
+ if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
624
+ return {
625
+ text: '{' + selected + '}',
626
+ selection: false
627
+ };
628
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
629
+ if (/[\]\}\)]/.test(line[cursor.column])) {
630
+ CstyleBehaviour.recordAutoInsert(editor, session, "}");
631
+ return {
632
+ text: '{}',
633
+ selection: [1, 1]
634
+ };
635
+ } else {
636
+ CstyleBehaviour.recordMaybeInsert(editor, session, "{");
637
+ return {
638
+ text: '{',
639
+ selection: [1, 1]
640
+ };
641
+ }
642
+ }
643
+ } else if (text == '}') {
644
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
645
+ if (rightChar == '}') {
646
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
647
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
648
+ CstyleBehaviour.popAutoInsertedClosing();
649
+ return {
650
+ text: '',
651
+ selection: [1, 1]
652
+ };
653
+ }
654
+ }
655
+ } else if (text == "\n" || text == "\r\n") {
656
+ var closing = "";
657
+ if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
658
+ closing = lang.stringRepeat("}", maybeInsertedBrackets);
659
+ CstyleBehaviour.clearMaybeInsertedClosing();
660
+ }
661
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
662
+ if (rightChar == '}' || closing !== "") {
663
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
664
+ if (!openBracePos)
665
+ return null;
666
+
667
+ var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
668
+ var next_indent = this.$getIndent(line);
669
+
670
+ return {
671
+ text: '\n' + indent + '\n' + next_indent + closing,
672
+ selection: [1, indent.length, 1, indent.length]
673
+ };
674
+ }
675
+ }
676
+ });
677
+
678
+ this.add("braces", "deletion", function (state, action, editor, session, range) {
679
+ var selected = session.doc.getTextRange(range);
680
+ if (!range.isMultiLine() && selected == '{') {
681
+ var line = session.doc.getLine(range.start.row);
682
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
683
+ if (rightChar == '}') {
684
+ range.end.column++;
685
+ return range;
686
+ } else {
687
+ maybeInsertedBrackets--;
688
+ }
689
+ }
690
+ });
691
+
692
+ this.add("parens", "insertion", function (state, action, editor, session, text) {
693
+ if (text == '(') {
694
+ var selection = editor.getSelectionRange();
695
+ var selected = session.doc.getTextRange(selection);
696
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
697
+ return {
698
+ text: '(' + selected + ')',
699
+ selection: false
700
+ };
701
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
702
+ CstyleBehaviour.recordAutoInsert(editor, session, ")");
703
+ return {
704
+ text: '()',
705
+ selection: [1, 1]
706
+ };
707
+ }
708
+ } else if (text == ')') {
709
+ var cursor = editor.getCursorPosition();
710
+ var line = session.doc.getLine(cursor.row);
711
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
712
+ if (rightChar == ')') {
713
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
714
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
715
+ CstyleBehaviour.popAutoInsertedClosing();
716
+ return {
717
+ text: '',
718
+ selection: [1, 1]
719
+ };
720
+ }
721
+ }
722
+ }
723
+ });
724
+
725
+ this.add("parens", "deletion", function (state, action, editor, session, range) {
726
+ var selected = session.doc.getTextRange(range);
727
+ if (!range.isMultiLine() && selected == '(') {
728
+ var line = session.doc.getLine(range.start.row);
729
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
730
+ if (rightChar == ')') {
731
+ range.end.column++;
732
+ return range;
733
+ }
734
+ }
735
+ });
736
+
737
+ this.add("brackets", "insertion", function (state, action, editor, session, text) {
738
+ if (text == '[') {
739
+ var selection = editor.getSelectionRange();
740
+ var selected = session.doc.getTextRange(selection);
741
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
742
+ return {
743
+ text: '[' + selected + ']',
744
+ selection: false
745
+ };
746
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
747
+ CstyleBehaviour.recordAutoInsert(editor, session, "]");
748
+ return {
749
+ text: '[]',
750
+ selection: [1, 1]
751
+ };
752
+ }
753
+ } else if (text == ']') {
754
+ var cursor = editor.getCursorPosition();
755
+ var line = session.doc.getLine(cursor.row);
756
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
757
+ if (rightChar == ']') {
758
+ var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
759
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
760
+ CstyleBehaviour.popAutoInsertedClosing();
761
+ return {
762
+ text: '',
763
+ selection: [1, 1]
764
+ };
765
+ }
766
+ }
767
+ }
768
+ });
769
+
770
+ this.add("brackets", "deletion", function (state, action, editor, session, range) {
771
+ var selected = session.doc.getTextRange(range);
772
+ if (!range.isMultiLine() && selected == '[') {
773
+ var line = session.doc.getLine(range.start.row);
774
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
775
+ if (rightChar == ']') {
776
+ range.end.column++;
777
+ return range;
778
+ }
779
+ }
780
+ });
781
+
782
+ this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
783
+ if (text == '"' || text == "'") {
784
+ var quote = text;
785
+ var selection = editor.getSelectionRange();
786
+ var selected = session.doc.getTextRange(selection);
787
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
788
+ return {
789
+ text: quote + selected + quote,
790
+ selection: false
791
+ };
792
+ } else {
793
+ var cursor = editor.getCursorPosition();
794
+ var line = session.doc.getLine(cursor.row);
795
+ var leftChar = line.substring(cursor.column-1, cursor.column);
796
+ if (leftChar == '\\') {
797
+ return null;
798
+ }
799
+ var tokens = session.getTokens(selection.start.row);
800
+ var col = 0, token;
801
+ var quotepos = -1; // Track whether we're inside an open quote.
802
+
803
+ for (var x = 0; x < tokens.length; x++) {
804
+ token = tokens[x];
805
+ if (token.type == "string") {
806
+ quotepos = -1;
807
+ } else if (quotepos < 0) {
808
+ quotepos = token.value.indexOf(quote);
809
+ }
810
+ if ((token.value.length + col) > selection.start.column) {
811
+ break;
812
+ }
813
+ col += tokens[x].value.length;
814
+ }
815
+ 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)))) {
816
+ if (!CstyleBehaviour.isSaneInsertion(editor, session))
817
+ return;
818
+ return {
819
+ text: quote + quote,
820
+ selection: [1,1]
821
+ };
822
+ } else if (token && token.type === "string") {
823
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
824
+ if (rightChar == quote) {
825
+ return {
826
+ text: '',
827
+ selection: [1, 1]
828
+ };
829
+ }
830
+ }
831
+ }
832
+ }
833
+ });
834
+
835
+ this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
836
+ var selected = session.doc.getTextRange(range);
837
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
838
+ var line = session.doc.getLine(range.start.row);
839
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
840
+ if (rightChar == selected) {
841
+ range.end.column++;
842
+ return range;
843
+ }
844
+ }
845
+ });
846
+
847
+ };
848
+
849
+ oop.inherits(CstyleBehaviour, Behaviour);
850
+
851
+ exports.CstyleBehaviour = CstyleBehaviour;
852
+ });
853
+
854
+ define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
855
+
856
+
857
+ var oop = require("../../lib/oop");
858
+ var Range = require("../../range").Range;
859
+ var BaseFoldMode = require("./fold_mode").FoldMode;
860
+
861
+ var FoldMode = exports.FoldMode = function(commentRegex) {
862
+ if (commentRegex) {
863
+ this.foldingStartMarker = new RegExp(
864
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
865
+ );
866
+ this.foldingStopMarker = new RegExp(
867
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
868
+ );
869
+ }
870
+ };
871
+ oop.inherits(FoldMode, BaseFoldMode);
872
+
873
+ (function() {
874
+
875
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
876
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
877
+
878
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
879
+ var line = session.getLine(row);
880
+ var match = line.match(this.foldingStartMarker);
881
+ if (match) {
882
+ var i = match.index;
883
+
884
+ if (match[1])
885
+ return this.openingBracketBlock(session, match[1], row, i);
886
+
887
+ return session.getCommentFoldRange(row, i + match[0].length, 1);
888
+ }
889
+
890
+ if (foldStyle !== "markbeginend")
891
+ return;
892
+
893
+ var match = line.match(this.foldingStopMarker);
894
+ if (match) {
895
+ var i = match.index + match[0].length;
896
+
897
+ if (match[1])
898
+ return this.closingBracketBlock(session, match[1], row, i);
899
+
900
+ return session.getCommentFoldRange(row, i, -1);
901
+ }
902
+ };
903
+
904
+ }).call(FoldMode.prototype);
905
+
906
+ });
907
+
908
+
909
+ define('ace/mode/typescript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/javascript_highlight_rules'], function(require, exports, module) {
910
+
911
+
912
+ var oop = require("../lib/oop");
913
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
914
+
915
+ var TypeScriptHighlightRules = function() {
916
+
917
+ var tsRules = [
918
+ {
919
+ token: ["keyword.operator.ts", "text", "variable.parameter.function.ts", "text"],
920
+ regex: "\\b(module)(\\s*)([a-zA-Z0-9_?.$][\\w?.$]*)(\\s*\\{)"
921
+ },
922
+ {
923
+ token: ["storage.type.variable.ts", "text", "keyword.other.ts", "text"],
924
+ regex: "(super)(\\s*\\()([a-zA-Z0-9,_?.$\\s]+\\s*)(\\))"
925
+ },
926
+ {
927
+ token: ["entity.name.function.ts","paren.lparen", "paren.rparen"],
928
+ regex: "([a-zA-Z_?.$][\\w?.$]*)(\\()(\\))"
929
+ },
930
+ {
931
+ token: ["variable.parameter.function.ts", "text", "variable.parameter.function.ts"],
932
+ regex: "([a-zA-Z0-9_?.$][\\w?.$]*)(\\s*:\\s*)([a-zA-Z0-9_?.$][\\w?.$]*)"
933
+ },
934
+ {
935
+ token: ["keyword.operator.ts"],
936
+ regex: "(?:\\b(constructor|declare|interface|as|AS|public|private|class|extends|export|super)\\b)"
937
+ },
938
+ {
939
+ token: ["storage.type.variable.ts"],
940
+ regex: "(?:\\b(this\\.|string\\b|bool\\b|number)\\b)"
941
+ },
942
+ {
943
+ token: ["keyword.operator.ts", "storage.type.variable.ts", "keyword.operator.ts", "storage.type.variable.ts"],
944
+ regex: "(class)(\\s+[a-zA-Z0-9_?.$][\\w?.$]*\\s+)(extends)(\\s+[a-zA-Z0-9_?.$][\\w?.$]*\\s+)?"
945
+ },
946
+ {
947
+ token: "keyword",
948
+ regex: "(?:super|export|class|extends|import)\\b"
949
+ }
950
+ ];
951
+
952
+ var JSRules = new JavaScriptHighlightRules().getRules();
953
+
954
+ JSRules.start = tsRules.concat(JSRules.start);
955
+ this.$rules = JSRules;
956
+ };
957
+
958
+ oop.inherits(TypeScriptHighlightRules, JavaScriptHighlightRules);
959
+
960
+ exports.TypeScriptHighlightRules = TypeScriptHighlightRules;
961
+ });