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,810 @@
1
+ /* ***** BEGIN LICENSE BLOCK *****
2
+ * Distributed under the BSD license:
3
+ *
4
+ * Copyright (c) 2010, Ajax.org B.V.
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are met:
9
+ * * Redistributions of source code must retain the above copyright
10
+ * notice, this list of conditions and the following disclaimer.
11
+ * * Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following disclaimer in the
13
+ * documentation and/or other materials provided with the distribution.
14
+ * * Neither the name of Ajax.org B.V. nor the
15
+ * names of its contributors may be used to endorse or promote products
16
+ * derived from this software without specific prior written permission.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
22
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ *
29
+ * ***** END LICENSE BLOCK ***** */
30
+
31
+ define('ace/mode/glsl', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/c_cpp', 'ace/tokenizer', 'ace/mode/glsl_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
32
+
33
+
34
+ var oop = require("../lib/oop");
35
+ var CMode = require("./c_cpp").Mode;
36
+ var Tokenizer = require("../tokenizer").Tokenizer;
37
+ var glslHighlightRules = require("./glsl_highlight_rules").glslHighlightRules;
38
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
39
+ var Range = require("../range").Range;
40
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
41
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
42
+
43
+ var Mode = function() {
44
+ this.$tokenizer = new Tokenizer(new glslHighlightRules().getRules());
45
+ this.$outdent = new MatchingBraceOutdent();
46
+ this.$behaviour = new CstyleBehaviour();
47
+ this.foldingRules = new CStyleFoldMode();
48
+ };
49
+ oop.inherits(Mode, CMode);
50
+
51
+ exports.Mode = Mode;
52
+ });
53
+
54
+ define('ace/mode/c_cpp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/c_cpp_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
55
+
56
+
57
+ var oop = require("../lib/oop");
58
+ var TextMode = require("./text").Mode;
59
+ var Tokenizer = require("../tokenizer").Tokenizer;
60
+ var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
61
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
62
+ var Range = require("../range").Range;
63
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
64
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
65
+
66
+ var Mode = function() {
67
+ this.$tokenizer = new Tokenizer(new c_cppHighlightRules().getRules());
68
+ this.$outdent = new MatchingBraceOutdent();
69
+ this.$behaviour = new CstyleBehaviour();
70
+ this.foldingRules = new CStyleFoldMode();
71
+ };
72
+ oop.inherits(Mode, TextMode);
73
+
74
+ (function() {
75
+
76
+ this.lineCommentStart = "//";
77
+ this.blockComment = {start: "/*", end: "*/"};
78
+
79
+ this.getNextLineIndent = function(state, line, tab) {
80
+ var indent = this.$getIndent(line);
81
+
82
+ var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
83
+ var tokens = tokenizedLine.tokens;
84
+ var endState = tokenizedLine.state;
85
+
86
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
87
+ return indent;
88
+ }
89
+
90
+ if (state == "start") {
91
+ var match = line.match(/^.*[\{\(\[]\s*$/);
92
+ if (match) {
93
+ indent += tab;
94
+ }
95
+ } else if (state == "doc-start") {
96
+ if (endState == "start") {
97
+ return "";
98
+ }
99
+ var match = line.match(/^\s*(\/?)\*/);
100
+ if (match) {
101
+ if (match[1]) {
102
+ indent += " ";
103
+ }
104
+ indent += "* ";
105
+ }
106
+ }
107
+
108
+ return indent;
109
+ };
110
+
111
+ this.checkOutdent = function(state, line, input) {
112
+ return this.$outdent.checkOutdent(line, input);
113
+ };
114
+
115
+ this.autoOutdent = function(state, doc, row) {
116
+ this.$outdent.autoOutdent(doc, row);
117
+ };
118
+
119
+ }).call(Mode.prototype);
120
+
121
+ exports.Mode = Mode;
122
+ });
123
+ define('ace/mode/c_cpp_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
124
+
125
+
126
+ var oop = require("../lib/oop");
127
+ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
128
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
129
+ var cFunctions = exports.cFunctions = "\\s*\\bhypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len)))\\b"
130
+
131
+ var c_cppHighlightRules = function() {
132
+
133
+ var keywordControls = (
134
+ "break|case|continue|default|do|else|for|goto|if|_Pragma|" +
135
+ "return|switch|while|catch|operator|try|throw|using"
136
+ );
137
+
138
+ var storageType = (
139
+ "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" +
140
+ "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" +
141
+ "class|wchar_t|template"
142
+ );
143
+
144
+ var storageModifiers = (
145
+ "const|extern|register|restrict|static|volatile|inline|private:|" +
146
+ "protected:|public:|friend|explicit|virtual|export|mutable|typename"
147
+ );
148
+
149
+ var keywordOperators = (
150
+ "and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq" +
151
+ "const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace"
152
+ );
153
+
154
+ var builtinConstants = (
155
+ "NULL|true|false|TRUE|FALSE"
156
+ );
157
+
158
+ var keywordMapper = this.$keywords = this.createKeywordMapper({
159
+ "keyword.control" : keywordControls,
160
+ "storage.type" : storageType,
161
+ "storage.modifier" : storageModifiers,
162
+ "keyword.operator" : keywordOperators,
163
+ "variable.language": "this",
164
+ "constant.language": builtinConstants
165
+ }, "identifier");
166
+
167
+ var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b";
168
+
169
+ this.$rules = {
170
+ "start" : [
171
+ {
172
+ token : "comment",
173
+ regex : "\\/\\/.*$"
174
+ },
175
+ DocCommentHighlightRules.getStartRule("doc-start"),
176
+ {
177
+ token : "comment", // multi line comment
178
+ regex : "\\/\\*",
179
+ next : "comment"
180
+ }, {
181
+ token : "string", // single line
182
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
183
+ }, {
184
+ token : "string", // multi line string start
185
+ regex : '["].*\\\\$',
186
+ next : "qqstring"
187
+ }, {
188
+ token : "string", // single line
189
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
190
+ }, {
191
+ token : "string", // multi line string start
192
+ regex : "['].*\\\\$",
193
+ next : "qstring"
194
+ }, {
195
+ token : "constant.numeric", // hex
196
+ regex : "0[xX][0-9a-fA-F]+\\b"
197
+ }, {
198
+ token : "constant.numeric", // float
199
+ regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
200
+ }, {
201
+ token : "keyword", // pre-compiler directives
202
+ regex : "(?:#include|#import|#pragma|#line|#define|#undef|#if|#ifdef|#else|#elif|#ifndef)\\b",
203
+ next : "directive"
204
+ }, {
205
+ token : "keyword", // special case pre-compiler directive
206
+ regex : "(?:#endif)\\b"
207
+ }, {
208
+ token : "support.function.C99.c",
209
+ regex : cFunctions
210
+ }, {
211
+ token : keywordMapper,
212
+ regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
213
+ }, {
214
+ token : "keyword.operator",
215
+ regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"
216
+ }, {
217
+ token : "punctuation.operator",
218
+ regex : "\\?|\\:|\\,|\\;|\\."
219
+ }, {
220
+ token : "paren.lparen",
221
+ regex : "[[({]"
222
+ }, {
223
+ token : "paren.rparen",
224
+ regex : "[\\])}]"
225
+ }, {
226
+ token : "text",
227
+ regex : "\\s+"
228
+ }
229
+ ],
230
+ "comment" : [
231
+ {
232
+ token : "comment", // closing comment
233
+ regex : ".*?\\*\\/",
234
+ next : "start"
235
+ }, {
236
+ token : "comment", // comment spanning whole line
237
+ regex : ".+"
238
+ }
239
+ ],
240
+ "qqstring" : [
241
+ {
242
+ token : "string",
243
+ regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
244
+ next : "start"
245
+ }, {
246
+ token : "string",
247
+ regex : '.+'
248
+ }
249
+ ],
250
+ "qstring" : [
251
+ {
252
+ token : "string",
253
+ regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
254
+ next : "start"
255
+ }, {
256
+ token : "string",
257
+ regex : '.+'
258
+ }
259
+ ],
260
+ "directive" : [
261
+ {
262
+ token : "constant.other.multiline",
263
+ regex : /\\/
264
+ },
265
+ {
266
+ token : "constant.other.multiline",
267
+ regex : /.*\\/
268
+ },
269
+ {
270
+ token : "constant.other",
271
+ regex : "\\s*<.+?>",
272
+ next : "start"
273
+ },
274
+ {
275
+ token : "constant.other", // single line
276
+ regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]',
277
+ next : "start"
278
+ },
279
+ {
280
+ token : "constant.other", // single line
281
+ regex : "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']",
282
+ next : "start"
283
+ },
284
+ {
285
+ token : "constant.other",
286
+ regex : /[^\\\/]+/,
287
+ next : "start"
288
+ }
289
+ ]
290
+ };
291
+
292
+ this.embedRules(DocCommentHighlightRules, "doc-",
293
+ [ DocCommentHighlightRules.getEndRule("start") ]);
294
+ };
295
+
296
+ oop.inherits(c_cppHighlightRules, TextHighlightRules);
297
+
298
+ exports.c_cppHighlightRules = c_cppHighlightRules;
299
+ });
300
+
301
+ define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
302
+
303
+
304
+ var oop = require("../lib/oop");
305
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
306
+
307
+ var DocCommentHighlightRules = function() {
308
+
309
+ this.$rules = {
310
+ "start" : [ {
311
+ token : "comment.doc.tag",
312
+ regex : "@[\\w\\d_]+" // TODO: fix email addresses
313
+ }, {
314
+ token : "comment.doc.tag",
315
+ regex : "\\bTODO\\b"
316
+ }, {
317
+ defaultToken : "comment.doc"
318
+ }]
319
+ };
320
+ };
321
+
322
+ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
323
+
324
+ DocCommentHighlightRules.getStartRule = function(start) {
325
+ return {
326
+ token : "comment.doc", // doc comment
327
+ regex : "\\/\\*(?=\\*)",
328
+ next : start
329
+ };
330
+ };
331
+
332
+ DocCommentHighlightRules.getEndRule = function (start) {
333
+ return {
334
+ token : "comment.doc", // closing comment
335
+ regex : "\\*\\/",
336
+ next : start
337
+ };
338
+ };
339
+
340
+
341
+ exports.DocCommentHighlightRules = DocCommentHighlightRules;
342
+
343
+ });
344
+
345
+ define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
346
+
347
+
348
+ var Range = require("../range").Range;
349
+
350
+ var MatchingBraceOutdent = function() {};
351
+
352
+ (function() {
353
+
354
+ this.checkOutdent = function(line, input) {
355
+ if (! /^\s+$/.test(line))
356
+ return false;
357
+
358
+ return /^\s*\}/.test(input);
359
+ };
360
+
361
+ this.autoOutdent = function(doc, row) {
362
+ var line = doc.getLine(row);
363
+ var match = line.match(/^(\s*\})/);
364
+
365
+ if (!match) return 0;
366
+
367
+ var column = match[1].length;
368
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
369
+
370
+ if (!openBracePos || openBracePos.row == row) return 0;
371
+
372
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
373
+ doc.replace(new Range(row, 0, row, column-1), indent);
374
+ };
375
+
376
+ this.$getIndent = function(line) {
377
+ return line.match(/^\s*/)[0];
378
+ };
379
+
380
+ }).call(MatchingBraceOutdent.prototype);
381
+
382
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
383
+ });
384
+
385
+ define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
386
+
387
+
388
+ var oop = require("../../lib/oop");
389
+ var Behaviour = require("../behaviour").Behaviour;
390
+ var TokenIterator = require("../../token_iterator").TokenIterator;
391
+ var lang = require("../../lib/lang");
392
+
393
+ var SAFE_INSERT_IN_TOKENS =
394
+ ["text", "paren.rparen", "punctuation.operator"];
395
+ var SAFE_INSERT_BEFORE_TOKENS =
396
+ ["text", "paren.rparen", "punctuation.operator", "comment"];
397
+
398
+
399
+ var autoInsertedBrackets = 0;
400
+ var autoInsertedRow = -1;
401
+ var autoInsertedLineEnd = "";
402
+ var maybeInsertedBrackets = 0;
403
+ var maybeInsertedRow = -1;
404
+ var maybeInsertedLineStart = "";
405
+ var maybeInsertedLineEnd = "";
406
+
407
+ var CstyleBehaviour = function () {
408
+
409
+ CstyleBehaviour.isSaneInsertion = function(editor, session) {
410
+ var cursor = editor.getCursorPosition();
411
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
412
+ if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
413
+ var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
414
+ if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
415
+ return false;
416
+ }
417
+ iterator.stepForward();
418
+ return iterator.getCurrentTokenRow() !== cursor.row ||
419
+ this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
420
+ };
421
+
422
+ CstyleBehaviour.$matchTokenType = function(token, types) {
423
+ return types.indexOf(token.type || token) > -1;
424
+ };
425
+
426
+ CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
427
+ var cursor = editor.getCursorPosition();
428
+ var line = session.doc.getLine(cursor.row);
429
+ if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
430
+ autoInsertedBrackets = 0;
431
+ autoInsertedRow = cursor.row;
432
+ autoInsertedLineEnd = bracket + line.substr(cursor.column);
433
+ autoInsertedBrackets++;
434
+ };
435
+
436
+ CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
437
+ var cursor = editor.getCursorPosition();
438
+ var line = session.doc.getLine(cursor.row);
439
+ if (!this.isMaybeInsertedClosing(cursor, line))
440
+ maybeInsertedBrackets = 0;
441
+ maybeInsertedRow = cursor.row;
442
+ maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
443
+ maybeInsertedLineEnd = line.substr(cursor.column);
444
+ maybeInsertedBrackets++;
445
+ };
446
+
447
+ CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
448
+ return autoInsertedBrackets > 0 &&
449
+ cursor.row === autoInsertedRow &&
450
+ bracket === autoInsertedLineEnd[0] &&
451
+ line.substr(cursor.column) === autoInsertedLineEnd;
452
+ };
453
+
454
+ CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
455
+ return maybeInsertedBrackets > 0 &&
456
+ cursor.row === maybeInsertedRow &&
457
+ line.substr(cursor.column) === maybeInsertedLineEnd &&
458
+ line.substr(0, cursor.column) == maybeInsertedLineStart;
459
+ };
460
+
461
+ CstyleBehaviour.popAutoInsertedClosing = function() {
462
+ autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
463
+ autoInsertedBrackets--;
464
+ };
465
+
466
+ CstyleBehaviour.clearMaybeInsertedClosing = function() {
467
+ maybeInsertedBrackets = 0;
468
+ maybeInsertedRow = -1;
469
+ };
470
+
471
+ this.add("braces", "insertion", function (state, action, editor, session, text) {
472
+ var cursor = editor.getCursorPosition();
473
+ var line = session.doc.getLine(cursor.row);
474
+ if (text == '{') {
475
+ var selection = editor.getSelectionRange();
476
+ var selected = session.doc.getTextRange(selection);
477
+ if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
478
+ return {
479
+ text: '{' + selected + '}',
480
+ selection: false
481
+ };
482
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
483
+ if (/[\]\}\)]/.test(line[cursor.column])) {
484
+ CstyleBehaviour.recordAutoInsert(editor, session, "}");
485
+ return {
486
+ text: '{}',
487
+ selection: [1, 1]
488
+ };
489
+ } else {
490
+ CstyleBehaviour.recordMaybeInsert(editor, session, "{");
491
+ return {
492
+ text: '{',
493
+ selection: [1, 1]
494
+ };
495
+ }
496
+ }
497
+ } else if (text == '}') {
498
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
499
+ if (rightChar == '}') {
500
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
501
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
502
+ CstyleBehaviour.popAutoInsertedClosing();
503
+ return {
504
+ text: '',
505
+ selection: [1, 1]
506
+ };
507
+ }
508
+ }
509
+ } else if (text == "\n" || text == "\r\n") {
510
+ var closing = "";
511
+ if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
512
+ closing = lang.stringRepeat("}", maybeInsertedBrackets);
513
+ CstyleBehaviour.clearMaybeInsertedClosing();
514
+ }
515
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
516
+ if (rightChar == '}' || closing !== "") {
517
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
518
+ if (!openBracePos)
519
+ return null;
520
+
521
+ var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
522
+ var next_indent = this.$getIndent(line);
523
+
524
+ return {
525
+ text: '\n' + indent + '\n' + next_indent + closing,
526
+ selection: [1, indent.length, 1, indent.length]
527
+ };
528
+ }
529
+ }
530
+ });
531
+
532
+ this.add("braces", "deletion", function (state, action, editor, session, range) {
533
+ var selected = session.doc.getTextRange(range);
534
+ if (!range.isMultiLine() && selected == '{') {
535
+ var line = session.doc.getLine(range.start.row);
536
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
537
+ if (rightChar == '}') {
538
+ range.end.column++;
539
+ return range;
540
+ } else {
541
+ maybeInsertedBrackets--;
542
+ }
543
+ }
544
+ });
545
+
546
+ this.add("parens", "insertion", function (state, action, editor, session, text) {
547
+ if (text == '(') {
548
+ var selection = editor.getSelectionRange();
549
+ var selected = session.doc.getTextRange(selection);
550
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
551
+ return {
552
+ text: '(' + selected + ')',
553
+ selection: false
554
+ };
555
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
556
+ CstyleBehaviour.recordAutoInsert(editor, session, ")");
557
+ return {
558
+ text: '()',
559
+ selection: [1, 1]
560
+ };
561
+ }
562
+ } else if (text == ')') {
563
+ var cursor = editor.getCursorPosition();
564
+ var line = session.doc.getLine(cursor.row);
565
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
566
+ if (rightChar == ')') {
567
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
568
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
569
+ CstyleBehaviour.popAutoInsertedClosing();
570
+ return {
571
+ text: '',
572
+ selection: [1, 1]
573
+ };
574
+ }
575
+ }
576
+ }
577
+ });
578
+
579
+ this.add("parens", "deletion", function (state, action, editor, session, range) {
580
+ var selected = session.doc.getTextRange(range);
581
+ if (!range.isMultiLine() && selected == '(') {
582
+ var line = session.doc.getLine(range.start.row);
583
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
584
+ if (rightChar == ')') {
585
+ range.end.column++;
586
+ return range;
587
+ }
588
+ }
589
+ });
590
+
591
+ this.add("brackets", "insertion", function (state, action, editor, session, text) {
592
+ if (text == '[') {
593
+ var selection = editor.getSelectionRange();
594
+ var selected = session.doc.getTextRange(selection);
595
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
596
+ return {
597
+ text: '[' + selected + ']',
598
+ selection: false
599
+ };
600
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
601
+ CstyleBehaviour.recordAutoInsert(editor, session, "]");
602
+ return {
603
+ text: '[]',
604
+ selection: [1, 1]
605
+ };
606
+ }
607
+ } else if (text == ']') {
608
+ var cursor = editor.getCursorPosition();
609
+ var line = session.doc.getLine(cursor.row);
610
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
611
+ if (rightChar == ']') {
612
+ var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
613
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
614
+ CstyleBehaviour.popAutoInsertedClosing();
615
+ return {
616
+ text: '',
617
+ selection: [1, 1]
618
+ };
619
+ }
620
+ }
621
+ }
622
+ });
623
+
624
+ this.add("brackets", "deletion", function (state, action, editor, session, range) {
625
+ var selected = session.doc.getTextRange(range);
626
+ if (!range.isMultiLine() && selected == '[') {
627
+ var line = session.doc.getLine(range.start.row);
628
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
629
+ if (rightChar == ']') {
630
+ range.end.column++;
631
+ return range;
632
+ }
633
+ }
634
+ });
635
+
636
+ this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
637
+ if (text == '"' || text == "'") {
638
+ var quote = text;
639
+ var selection = editor.getSelectionRange();
640
+ var selected = session.doc.getTextRange(selection);
641
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
642
+ return {
643
+ text: quote + selected + quote,
644
+ selection: false
645
+ };
646
+ } else {
647
+ var cursor = editor.getCursorPosition();
648
+ var line = session.doc.getLine(cursor.row);
649
+ var leftChar = line.substring(cursor.column-1, cursor.column);
650
+ if (leftChar == '\\') {
651
+ return null;
652
+ }
653
+ var tokens = session.getTokens(selection.start.row);
654
+ var col = 0, token;
655
+ var quotepos = -1; // Track whether we're inside an open quote.
656
+
657
+ for (var x = 0; x < tokens.length; x++) {
658
+ token = tokens[x];
659
+ if (token.type == "string") {
660
+ quotepos = -1;
661
+ } else if (quotepos < 0) {
662
+ quotepos = token.value.indexOf(quote);
663
+ }
664
+ if ((token.value.length + col) > selection.start.column) {
665
+ break;
666
+ }
667
+ col += tokens[x].value.length;
668
+ }
669
+ 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)))) {
670
+ if (!CstyleBehaviour.isSaneInsertion(editor, session))
671
+ return;
672
+ return {
673
+ text: quote + quote,
674
+ selection: [1,1]
675
+ };
676
+ } else if (token && token.type === "string") {
677
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
678
+ if (rightChar == quote) {
679
+ return {
680
+ text: '',
681
+ selection: [1, 1]
682
+ };
683
+ }
684
+ }
685
+ }
686
+ }
687
+ });
688
+
689
+ this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
690
+ var selected = session.doc.getTextRange(range);
691
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
692
+ var line = session.doc.getLine(range.start.row);
693
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
694
+ if (rightChar == selected) {
695
+ range.end.column++;
696
+ return range;
697
+ }
698
+ }
699
+ });
700
+
701
+ };
702
+
703
+ oop.inherits(CstyleBehaviour, Behaviour);
704
+
705
+ exports.CstyleBehaviour = CstyleBehaviour;
706
+ });
707
+
708
+ define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
709
+
710
+
711
+ var oop = require("../../lib/oop");
712
+ var Range = require("../../range").Range;
713
+ var BaseFoldMode = require("./fold_mode").FoldMode;
714
+
715
+ var FoldMode = exports.FoldMode = function(commentRegex) {
716
+ if (commentRegex) {
717
+ this.foldingStartMarker = new RegExp(
718
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
719
+ );
720
+ this.foldingStopMarker = new RegExp(
721
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
722
+ );
723
+ }
724
+ };
725
+ oop.inherits(FoldMode, BaseFoldMode);
726
+
727
+ (function() {
728
+
729
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
730
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
731
+
732
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
733
+ var line = session.getLine(row);
734
+ var match = line.match(this.foldingStartMarker);
735
+ if (match) {
736
+ var i = match.index;
737
+
738
+ if (match[1])
739
+ return this.openingBracketBlock(session, match[1], row, i);
740
+
741
+ return session.getCommentFoldRange(row, i + match[0].length, 1);
742
+ }
743
+
744
+ if (foldStyle !== "markbeginend")
745
+ return;
746
+
747
+ var match = line.match(this.foldingStopMarker);
748
+ if (match) {
749
+ var i = match.index + match[0].length;
750
+
751
+ if (match[1])
752
+ return this.closingBracketBlock(session, match[1], row, i);
753
+
754
+ return session.getCommentFoldRange(row, i, -1);
755
+ }
756
+ };
757
+
758
+ }).call(FoldMode.prototype);
759
+
760
+ });
761
+
762
+ define('ace/mode/glsl_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/c_cpp_highlight_rules'], function(require, exports, module) {
763
+
764
+
765
+ var oop = require("../lib/oop");
766
+ var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
767
+
768
+ var glslHighlightRules = function() {
769
+
770
+ var keywords = (
771
+ "attribute|const|uniform|varying|break|continue|do|for|while|" +
772
+ "if|else|in|out|inout|float|int|void|bool|true|false|" +
773
+ "lowp|mediump|highp|precision|invariant|discard|return|mat2|mat3|" +
774
+ "mat4|vec2|vec3|vec4|ivec2|ivec3|ivec4|bvec2|bvec3|bvec4|sampler2D|" +
775
+ "samplerCube|struct"
776
+ );
777
+
778
+ var buildinConstants = (
779
+ "radians|degrees|sin|cos|tan|asin|acos|atan|pow|" +
780
+ "exp|log|exp2|log2|sqrt|inversesqrt|abs|sign|floor|ceil|fract|mod|" +
781
+ "min|max|clamp|mix|step|smoothstep|length|distance|dot|cross|" +
782
+ "normalize|faceforward|reflect|refract|matrixCompMult|lessThan|" +
783
+ "lessThanEqual|greaterThan|greaterThanEqual|equal|notEqual|any|all|" +
784
+ "not|dFdx|dFdy|fwidth|texture2D|texture2DProj|texture2DLod|" +
785
+ "texture2DProjLod|textureCube|textureCubeLod|" +
786
+ "gl_MaxVertexAttribs|gl_MaxVertexUniformVectors|gl_MaxVaryingVectors|" +
787
+ "gl_MaxVertexTextureImageUnits|gl_MaxCombinedTextureImageUnits|" +
788
+ "gl_MaxTextureImageUnits|gl_MaxFragmentUniformVectors|gl_MaxDrawBuffers|" +
789
+ "gl_DepthRangeParameters|gl_DepthRange|" +
790
+ "gl_Position|gl_PointSize|" +
791
+ "gl_FragCoord|gl_FrontFacing|gl_PointCoord|gl_FragColor|gl_FragData"
792
+ );
793
+
794
+ var keywordMapper = this.createKeywordMapper({
795
+ "variable.language": "this",
796
+ "keyword": keywords,
797
+ "constant.language": buildinConstants
798
+ }, "identifier");
799
+
800
+ this.$rules = new c_cppHighlightRules().$rules;
801
+ this.$rules.start.forEach(function(rule) {
802
+ if (typeof rule.token == "function")
803
+ rule.token = keywordMapper;
804
+ })
805
+ };
806
+
807
+ oop.inherits(glslHighlightRules, c_cppHighlightRules);
808
+
809
+ exports.glslHighlightRules = glslHighlightRules;
810
+ });