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,832 @@
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/scss', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/scss_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) {
32
+
33
+
34
+ var oop = require("../lib/oop");
35
+ var TextMode = require("./text").Mode;
36
+ var Tokenizer = require("../tokenizer").Tokenizer;
37
+ var ScssHighlightRules = require("./scss_highlight_rules").ScssHighlightRules;
38
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
39
+ var CssBehaviour = require("./behaviour/css").CssBehaviour;
40
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
41
+
42
+ var Mode = function() {
43
+ this.$tokenizer = new Tokenizer(new ScssHighlightRules().getRules());
44
+ this.$outdent = new MatchingBraceOutdent();
45
+ this.$behaviour = new CssBehaviour();
46
+ this.foldingRules = new CStyleFoldMode();
47
+ };
48
+ oop.inherits(Mode, TextMode);
49
+
50
+ (function() {
51
+
52
+ this.lineCommentStart = "//";
53
+ this.blockComment = {start: "/*", end: "*/"};
54
+
55
+ this.getNextLineIndent = function(state, line, tab) {
56
+ var indent = this.$getIndent(line);
57
+ var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
58
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
59
+ return indent;
60
+ }
61
+
62
+ var match = line.match(/^.*\{\s*$/);
63
+ if (match) {
64
+ indent += tab;
65
+ }
66
+
67
+ return indent;
68
+ };
69
+
70
+ this.checkOutdent = function(state, line, input) {
71
+ return this.$outdent.checkOutdent(line, input);
72
+ };
73
+
74
+ this.autoOutdent = function(state, doc, row) {
75
+ this.$outdent.autoOutdent(doc, row);
76
+ };
77
+
78
+ }).call(Mode.prototype);
79
+
80
+ exports.Mode = Mode;
81
+
82
+ });
83
+
84
+ define('ace/mode/scss_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
85
+
86
+
87
+ var oop = require("../lib/oop");
88
+ var lang = require("../lib/lang");
89
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
90
+
91
+ var ScssHighlightRules = function() {
92
+
93
+ var properties = lang.arrayToMap( (function () {
94
+
95
+ var browserPrefix = ("-webkit-|-moz-|-o-|-ms-|-svg-|-pie-|-khtml-").split("|");
96
+
97
+ var prefixProperties = ("appearance|background-clip|background-inline-policy|background-origin|" +
98
+ "background-size|binding|border-bottom-colors|border-left-colors|" +
99
+ "border-right-colors|border-top-colors|border-end|border-end-color|" +
100
+ "border-end-style|border-end-width|border-image|border-start|" +
101
+ "border-start-color|border-start-style|border-start-width|box-align|" +
102
+ "box-direction|box-flex|box-flexgroup|box-ordinal-group|box-orient|" +
103
+ "box-pack|box-sizing|column-count|column-gap|column-width|column-rule|" +
104
+ "column-rule-width|column-rule-style|column-rule-color|float-edge|" +
105
+ "font-feature-settings|font-language-override|force-broken-image-icon|" +
106
+ "image-region|margin-end|margin-start|opacity|outline|outline-color|" +
107
+ "outline-offset|outline-radius|outline-radius-bottomleft|" +
108
+ "outline-radius-bottomright|outline-radius-topleft|outline-radius-topright|" +
109
+ "outline-style|outline-width|padding-end|padding-start|stack-sizing|" +
110
+ "tab-size|text-blink|text-decoration-color|text-decoration-line|" +
111
+ "text-decoration-style|transform|transform-origin|transition|" +
112
+ "transition-delay|transition-duration|transition-property|" +
113
+ "transition-timing-function|user-focus|user-input|user-modify|user-select|" +
114
+ "window-shadow|border-radius").split("|");
115
+
116
+ var properties = ("azimuth|background-attachment|background-color|background-image|" +
117
+ "background-position|background-repeat|background|border-bottom-color|" +
118
+ "border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
119
+ "border-color|border-left-color|border-left-style|border-left-width|" +
120
+ "border-left|border-right-color|border-right-style|border-right-width|" +
121
+ "border-right|border-spacing|border-style|border-top-color|" +
122
+ "border-top-style|border-top-width|border-top|border-width|border|bottom|" +
123
+ "box-shadow|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
124
+ "counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
125
+ "elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
126
+ "font-stretch|font-style|font-variant|font-weight|font|height|left|" +
127
+ "letter-spacing|line-height|list-style-image|list-style-position|" +
128
+ "list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
129
+ "margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
130
+ "min-width|opacity|orphans|outline-color|" +
131
+ "outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
132
+ "padding-left|padding-right|padding-top|padding|page-break-after|" +
133
+ "page-break-before|page-break-inside|page|pause-after|pause-before|" +
134
+ "pause|pitch-range|pitch|play-during|position|quotes|richness|right|" +
135
+ "size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
136
+ "stress|table-layout|text-align|text-decoration|text-indent|" +
137
+ "text-shadow|text-transform|top|unicode-bidi|vertical-align|" +
138
+ "visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
139
+ "z-index").split("|");
140
+ var ret = [];
141
+ for (var i=0, ln=browserPrefix.length; i<ln; i++) {
142
+ Array.prototype.push.apply(
143
+ ret,
144
+ (( browserPrefix[i] + prefixProperties.join("|" + browserPrefix[i]) ).split("|"))
145
+ );
146
+ }
147
+ Array.prototype.push.apply(ret, prefixProperties);
148
+ Array.prototype.push.apply(ret, properties);
149
+
150
+ return ret;
151
+
152
+ })() );
153
+
154
+
155
+
156
+ var functions = lang.arrayToMap(
157
+ ("hsl|hsla|rgb|rgba|url|attr|counter|counters|abs|adjust_color|adjust_hue|" +
158
+ "alpha|join|blue|ceil|change_color|comparable|complement|darken|desaturate|" +
159
+ "floor|grayscale|green|hue|if|invert|join|length|lighten|lightness|mix|" +
160
+ "nth|opacify|opacity|percentage|quote|red|round|saturate|saturation|" +
161
+ "scale_color|transparentize|type_of|unit|unitless|unqoute").split("|")
162
+ );
163
+
164
+ var constants = lang.arrayToMap(
165
+ ("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
166
+ "block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
167
+ "char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
168
+ "decimal-leading-zero|decimal|default|disabled|disc|" +
169
+ "distribute-all-lines|distribute-letter|distribute-space|" +
170
+ "distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
171
+ "hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
172
+ "ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
173
+ "ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
174
+ "inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
175
+ "keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
176
+ "lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
177
+ "medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
178
+ "nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
179
+ "overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
180
+ "ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
181
+ "solid|square|static|strict|super|sw-resize|table-footer-group|" +
182
+ "table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
183
+ "transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
184
+ "vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
185
+ "zero").split("|")
186
+ );
187
+
188
+ var colors = lang.arrayToMap(
189
+ ("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
190
+ "purple|red|silver|teal|white|yellow").split("|")
191
+ );
192
+
193
+ var keywords = lang.arrayToMap(
194
+ ("@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|def|end|declare").split("|")
195
+ )
196
+
197
+ var tags = lang.arrayToMap(
198
+ ("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" +
199
+ "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" +
200
+ "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" +
201
+ "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" +
202
+ "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" +
203
+ "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" +
204
+ "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" +
205
+ "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" +
206
+ "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
207
+ );
208
+
209
+ var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
210
+
211
+ this.$rules = {
212
+ "start" : [
213
+ {
214
+ token : "comment",
215
+ regex : "\\/\\/.*$"
216
+ },
217
+ {
218
+ token : "comment", // multi line comment
219
+ regex : "\\/\\*",
220
+ next : "comment"
221
+ }, {
222
+ token : "string", // single line
223
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
224
+ }, {
225
+ token : "string", // multi line string start
226
+ regex : '["].*\\\\$',
227
+ next : "qqstring"
228
+ }, {
229
+ token : "string", // single line
230
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
231
+ }, {
232
+ token : "string", // multi line string start
233
+ regex : "['].*\\\\$",
234
+ next : "qstring"
235
+ }, {
236
+ token : "constant.numeric",
237
+ regex : numRe + "(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)"
238
+ }, {
239
+ token : "constant.numeric", // hex6 color
240
+ regex : "#[a-f0-9]{6}"
241
+ }, {
242
+ token : "constant.numeric", // hex3 color
243
+ regex : "#[a-f0-9]{3}"
244
+ }, {
245
+ token : "constant.numeric",
246
+ regex : numRe
247
+ }, {
248
+ token : ["support.function", "string", "support.function"],
249
+ regex : "(url\\()(.*)(\\))"
250
+ }, {
251
+ token : function(value) {
252
+ if (properties.hasOwnProperty(value.toLowerCase()))
253
+ return "support.type";
254
+ if (keywords.hasOwnProperty(value))
255
+ return "keyword";
256
+ else if (constants.hasOwnProperty(value))
257
+ return "constant.language";
258
+ else if (functions.hasOwnProperty(value))
259
+ return "support.function";
260
+ else if (colors.hasOwnProperty(value.toLowerCase()))
261
+ return "support.constant.color";
262
+ else if (tags.hasOwnProperty(value.toLowerCase()))
263
+ return "variable.language";
264
+ else
265
+ return "text";
266
+ },
267
+ regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
268
+ }, {
269
+ token : "variable",
270
+ regex : "[a-z_\\-$][a-z0-9_\\-$]*\\b"
271
+ }, {
272
+ token: "variable.language",
273
+ regex: "#[a-z0-9-_]+"
274
+ }, {
275
+ token: "variable.language",
276
+ regex: "\\.[a-z0-9-_]+"
277
+ }, {
278
+ token: "variable.language",
279
+ regex: ":[a-z0-9-_]+"
280
+ }, {
281
+ token: "constant",
282
+ regex: "[a-z0-9-_]+"
283
+ }, {
284
+ token : "keyword.operator",
285
+ regex : "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*"
286
+ }, {
287
+ token : "paren.lparen",
288
+ regex : "[[({]"
289
+ }, {
290
+ token : "paren.rparen",
291
+ regex : "[\\])}]"
292
+ }, {
293
+ token : "text",
294
+ regex : "\\s+"
295
+ }, {
296
+ caseInsensitive: true
297
+ }
298
+ ],
299
+ "comment" : [
300
+ {
301
+ token : "comment", // closing comment
302
+ regex : ".*?\\*\\/",
303
+ next : "start"
304
+ }, {
305
+ token : "comment", // comment spanning whole line
306
+ regex : ".+"
307
+ }
308
+ ],
309
+ "qqstring" : [
310
+ {
311
+ token : "string",
312
+ regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
313
+ next : "start"
314
+ }, {
315
+ token : "string",
316
+ regex : '.+'
317
+ }
318
+ ],
319
+ "qstring" : [
320
+ {
321
+ token : "string",
322
+ regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
323
+ next : "start"
324
+ }, {
325
+ token : "string",
326
+ regex : '.+'
327
+ }
328
+ ]
329
+ };
330
+ };
331
+
332
+ oop.inherits(ScssHighlightRules, TextHighlightRules);
333
+
334
+ exports.ScssHighlightRules = ScssHighlightRules;
335
+
336
+ });
337
+
338
+ define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
339
+
340
+
341
+ var Range = require("../range").Range;
342
+
343
+ var MatchingBraceOutdent = function() {};
344
+
345
+ (function() {
346
+
347
+ this.checkOutdent = function(line, input) {
348
+ if (! /^\s+$/.test(line))
349
+ return false;
350
+
351
+ return /^\s*\}/.test(input);
352
+ };
353
+
354
+ this.autoOutdent = function(doc, row) {
355
+ var line = doc.getLine(row);
356
+ var match = line.match(/^(\s*\})/);
357
+
358
+ if (!match) return 0;
359
+
360
+ var column = match[1].length;
361
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
362
+
363
+ if (!openBracePos || openBracePos.row == row) return 0;
364
+
365
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
366
+ doc.replace(new Range(row, 0, row, column-1), indent);
367
+ };
368
+
369
+ this.$getIndent = function(line) {
370
+ return line.match(/^\s*/)[0];
371
+ };
372
+
373
+ }).call(MatchingBraceOutdent.prototype);
374
+
375
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
376
+ });
377
+
378
+ 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) {
379
+
380
+
381
+ var oop = require("../../lib/oop");
382
+ var Behaviour = require("../behaviour").Behaviour;
383
+ var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
384
+ var TokenIterator = require("../../token_iterator").TokenIterator;
385
+
386
+ var CssBehaviour = function () {
387
+
388
+ this.inherit(CstyleBehaviour);
389
+
390
+ this.add("colon", "insertion", function (state, action, editor, session, text) {
391
+ if (text === ':') {
392
+ var cursor = editor.getCursorPosition();
393
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
394
+ var token = iterator.getCurrentToken();
395
+ if (token && token.value.match(/\s+/)) {
396
+ token = iterator.stepBackward();
397
+ }
398
+ if (token && token.type === 'support.type') {
399
+ var line = session.doc.getLine(cursor.row);
400
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
401
+ if (rightChar === ':') {
402
+ return {
403
+ text: '',
404
+ selection: [1, 1]
405
+ }
406
+ }
407
+ if (!line.substring(cursor.column).match(/^\s*;/)) {
408
+ return {
409
+ text: ':;',
410
+ selection: [1, 1]
411
+ }
412
+ }
413
+ }
414
+ }
415
+ });
416
+
417
+ this.add("colon", "deletion", function (state, action, editor, session, range) {
418
+ var selected = session.doc.getTextRange(range);
419
+ if (!range.isMultiLine() && selected === ':') {
420
+ var cursor = editor.getCursorPosition();
421
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
422
+ var token = iterator.getCurrentToken();
423
+ if (token && token.value.match(/\s+/)) {
424
+ token = iterator.stepBackward();
425
+ }
426
+ if (token && token.type === 'support.type') {
427
+ var line = session.doc.getLine(range.start.row);
428
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
429
+ if (rightChar === ';') {
430
+ range.end.column ++;
431
+ return range;
432
+ }
433
+ }
434
+ }
435
+ });
436
+
437
+ this.add("semicolon", "insertion", function (state, action, editor, session, text) {
438
+ if (text === ';') {
439
+ var cursor = editor.getCursorPosition();
440
+ var line = session.doc.getLine(cursor.row);
441
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
442
+ if (rightChar === ';') {
443
+ return {
444
+ text: '',
445
+ selection: [1, 1]
446
+ }
447
+ }
448
+ }
449
+ });
450
+
451
+ }
452
+ oop.inherits(CssBehaviour, CstyleBehaviour);
453
+
454
+ exports.CssBehaviour = CssBehaviour;
455
+ });
456
+
457
+ define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
458
+
459
+
460
+ var oop = require("../../lib/oop");
461
+ var Behaviour = require("../behaviour").Behaviour;
462
+ var TokenIterator = require("../../token_iterator").TokenIterator;
463
+ var lang = require("../../lib/lang");
464
+
465
+ var SAFE_INSERT_IN_TOKENS =
466
+ ["text", "paren.rparen", "punctuation.operator"];
467
+ var SAFE_INSERT_BEFORE_TOKENS =
468
+ ["text", "paren.rparen", "punctuation.operator", "comment"];
469
+
470
+
471
+ var autoInsertedBrackets = 0;
472
+ var autoInsertedRow = -1;
473
+ var autoInsertedLineEnd = "";
474
+ var maybeInsertedBrackets = 0;
475
+ var maybeInsertedRow = -1;
476
+ var maybeInsertedLineStart = "";
477
+ var maybeInsertedLineEnd = "";
478
+
479
+ var CstyleBehaviour = function () {
480
+
481
+ CstyleBehaviour.isSaneInsertion = function(editor, session) {
482
+ var cursor = editor.getCursorPosition();
483
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
484
+ if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
485
+ var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
486
+ if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
487
+ return false;
488
+ }
489
+ iterator.stepForward();
490
+ return iterator.getCurrentTokenRow() !== cursor.row ||
491
+ this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
492
+ };
493
+
494
+ CstyleBehaviour.$matchTokenType = function(token, types) {
495
+ return types.indexOf(token.type || token) > -1;
496
+ };
497
+
498
+ CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
499
+ var cursor = editor.getCursorPosition();
500
+ var line = session.doc.getLine(cursor.row);
501
+ if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
502
+ autoInsertedBrackets = 0;
503
+ autoInsertedRow = cursor.row;
504
+ autoInsertedLineEnd = bracket + line.substr(cursor.column);
505
+ autoInsertedBrackets++;
506
+ };
507
+
508
+ CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
509
+ var cursor = editor.getCursorPosition();
510
+ var line = session.doc.getLine(cursor.row);
511
+ if (!this.isMaybeInsertedClosing(cursor, line))
512
+ maybeInsertedBrackets = 0;
513
+ maybeInsertedRow = cursor.row;
514
+ maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
515
+ maybeInsertedLineEnd = line.substr(cursor.column);
516
+ maybeInsertedBrackets++;
517
+ };
518
+
519
+ CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
520
+ return autoInsertedBrackets > 0 &&
521
+ cursor.row === autoInsertedRow &&
522
+ bracket === autoInsertedLineEnd[0] &&
523
+ line.substr(cursor.column) === autoInsertedLineEnd;
524
+ };
525
+
526
+ CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
527
+ return maybeInsertedBrackets > 0 &&
528
+ cursor.row === maybeInsertedRow &&
529
+ line.substr(cursor.column) === maybeInsertedLineEnd &&
530
+ line.substr(0, cursor.column) == maybeInsertedLineStart;
531
+ };
532
+
533
+ CstyleBehaviour.popAutoInsertedClosing = function() {
534
+ autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
535
+ autoInsertedBrackets--;
536
+ };
537
+
538
+ CstyleBehaviour.clearMaybeInsertedClosing = function() {
539
+ maybeInsertedBrackets = 0;
540
+ maybeInsertedRow = -1;
541
+ };
542
+
543
+ this.add("braces", "insertion", function (state, action, editor, session, text) {
544
+ var cursor = editor.getCursorPosition();
545
+ var line = session.doc.getLine(cursor.row);
546
+ if (text == '{') {
547
+ var selection = editor.getSelectionRange();
548
+ var selected = session.doc.getTextRange(selection);
549
+ if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
550
+ return {
551
+ text: '{' + selected + '}',
552
+ selection: false
553
+ };
554
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
555
+ if (/[\]\}\)]/.test(line[cursor.column])) {
556
+ CstyleBehaviour.recordAutoInsert(editor, session, "}");
557
+ return {
558
+ text: '{}',
559
+ selection: [1, 1]
560
+ };
561
+ } else {
562
+ CstyleBehaviour.recordMaybeInsert(editor, session, "{");
563
+ return {
564
+ text: '{',
565
+ selection: [1, 1]
566
+ };
567
+ }
568
+ }
569
+ } else if (text == '}') {
570
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
571
+ if (rightChar == '}') {
572
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
573
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
574
+ CstyleBehaviour.popAutoInsertedClosing();
575
+ return {
576
+ text: '',
577
+ selection: [1, 1]
578
+ };
579
+ }
580
+ }
581
+ } else if (text == "\n" || text == "\r\n") {
582
+ var closing = "";
583
+ if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
584
+ closing = lang.stringRepeat("}", maybeInsertedBrackets);
585
+ CstyleBehaviour.clearMaybeInsertedClosing();
586
+ }
587
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
588
+ if (rightChar == '}' || closing !== "") {
589
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
590
+ if (!openBracePos)
591
+ return null;
592
+
593
+ var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
594
+ var next_indent = this.$getIndent(line);
595
+
596
+ return {
597
+ text: '\n' + indent + '\n' + next_indent + closing,
598
+ selection: [1, indent.length, 1, indent.length]
599
+ };
600
+ }
601
+ }
602
+ });
603
+
604
+ this.add("braces", "deletion", function (state, action, editor, session, range) {
605
+ var selected = session.doc.getTextRange(range);
606
+ if (!range.isMultiLine() && selected == '{') {
607
+ var line = session.doc.getLine(range.start.row);
608
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
609
+ if (rightChar == '}') {
610
+ range.end.column++;
611
+ return range;
612
+ } else {
613
+ maybeInsertedBrackets--;
614
+ }
615
+ }
616
+ });
617
+
618
+ this.add("parens", "insertion", function (state, action, editor, session, text) {
619
+ if (text == '(') {
620
+ var selection = editor.getSelectionRange();
621
+ var selected = session.doc.getTextRange(selection);
622
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
623
+ return {
624
+ text: '(' + selected + ')',
625
+ selection: false
626
+ };
627
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
628
+ CstyleBehaviour.recordAutoInsert(editor, session, ")");
629
+ return {
630
+ text: '()',
631
+ selection: [1, 1]
632
+ };
633
+ }
634
+ } else if (text == ')') {
635
+ var cursor = editor.getCursorPosition();
636
+ var line = session.doc.getLine(cursor.row);
637
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
638
+ if (rightChar == ')') {
639
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
640
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
641
+ CstyleBehaviour.popAutoInsertedClosing();
642
+ return {
643
+ text: '',
644
+ selection: [1, 1]
645
+ };
646
+ }
647
+ }
648
+ }
649
+ });
650
+
651
+ this.add("parens", "deletion", function (state, action, editor, session, range) {
652
+ var selected = session.doc.getTextRange(range);
653
+ if (!range.isMultiLine() && selected == '(') {
654
+ var line = session.doc.getLine(range.start.row);
655
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
656
+ if (rightChar == ')') {
657
+ range.end.column++;
658
+ return range;
659
+ }
660
+ }
661
+ });
662
+
663
+ this.add("brackets", "insertion", function (state, action, editor, session, text) {
664
+ if (text == '[') {
665
+ var selection = editor.getSelectionRange();
666
+ var selected = session.doc.getTextRange(selection);
667
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
668
+ return {
669
+ text: '[' + selected + ']',
670
+ selection: false
671
+ };
672
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
673
+ CstyleBehaviour.recordAutoInsert(editor, session, "]");
674
+ return {
675
+ text: '[]',
676
+ selection: [1, 1]
677
+ };
678
+ }
679
+ } else if (text == ']') {
680
+ var cursor = editor.getCursorPosition();
681
+ var line = session.doc.getLine(cursor.row);
682
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
683
+ if (rightChar == ']') {
684
+ var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
685
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
686
+ CstyleBehaviour.popAutoInsertedClosing();
687
+ return {
688
+ text: '',
689
+ selection: [1, 1]
690
+ };
691
+ }
692
+ }
693
+ }
694
+ });
695
+
696
+ this.add("brackets", "deletion", function (state, action, editor, session, range) {
697
+ var selected = session.doc.getTextRange(range);
698
+ if (!range.isMultiLine() && selected == '[') {
699
+ var line = session.doc.getLine(range.start.row);
700
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
701
+ if (rightChar == ']') {
702
+ range.end.column++;
703
+ return range;
704
+ }
705
+ }
706
+ });
707
+
708
+ this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
709
+ if (text == '"' || text == "'") {
710
+ var quote = text;
711
+ var selection = editor.getSelectionRange();
712
+ var selected = session.doc.getTextRange(selection);
713
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
714
+ return {
715
+ text: quote + selected + quote,
716
+ selection: false
717
+ };
718
+ } else {
719
+ var cursor = editor.getCursorPosition();
720
+ var line = session.doc.getLine(cursor.row);
721
+ var leftChar = line.substring(cursor.column-1, cursor.column);
722
+ if (leftChar == '\\') {
723
+ return null;
724
+ }
725
+ var tokens = session.getTokens(selection.start.row);
726
+ var col = 0, token;
727
+ var quotepos = -1; // Track whether we're inside an open quote.
728
+
729
+ for (var x = 0; x < tokens.length; x++) {
730
+ token = tokens[x];
731
+ if (token.type == "string") {
732
+ quotepos = -1;
733
+ } else if (quotepos < 0) {
734
+ quotepos = token.value.indexOf(quote);
735
+ }
736
+ if ((token.value.length + col) > selection.start.column) {
737
+ break;
738
+ }
739
+ col += tokens[x].value.length;
740
+ }
741
+ 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)))) {
742
+ if (!CstyleBehaviour.isSaneInsertion(editor, session))
743
+ return;
744
+ return {
745
+ text: quote + quote,
746
+ selection: [1,1]
747
+ };
748
+ } else if (token && token.type === "string") {
749
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
750
+ if (rightChar == quote) {
751
+ return {
752
+ text: '',
753
+ selection: [1, 1]
754
+ };
755
+ }
756
+ }
757
+ }
758
+ }
759
+ });
760
+
761
+ this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
762
+ var selected = session.doc.getTextRange(range);
763
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
764
+ var line = session.doc.getLine(range.start.row);
765
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
766
+ if (rightChar == selected) {
767
+ range.end.column++;
768
+ return range;
769
+ }
770
+ }
771
+ });
772
+
773
+ };
774
+
775
+ oop.inherits(CstyleBehaviour, Behaviour);
776
+
777
+ exports.CstyleBehaviour = CstyleBehaviour;
778
+ });
779
+
780
+ define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
781
+
782
+
783
+ var oop = require("../../lib/oop");
784
+ var Range = require("../../range").Range;
785
+ var BaseFoldMode = require("./fold_mode").FoldMode;
786
+
787
+ var FoldMode = exports.FoldMode = function(commentRegex) {
788
+ if (commentRegex) {
789
+ this.foldingStartMarker = new RegExp(
790
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
791
+ );
792
+ this.foldingStopMarker = new RegExp(
793
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
794
+ );
795
+ }
796
+ };
797
+ oop.inherits(FoldMode, BaseFoldMode);
798
+
799
+ (function() {
800
+
801
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
802
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
803
+
804
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
805
+ var line = session.getLine(row);
806
+ var match = line.match(this.foldingStartMarker);
807
+ if (match) {
808
+ var i = match.index;
809
+
810
+ if (match[1])
811
+ return this.openingBracketBlock(session, match[1], row, i);
812
+
813
+ return session.getCommentFoldRange(row, i + match[0].length, 1);
814
+ }
815
+
816
+ if (foldStyle !== "markbeginend")
817
+ return;
818
+
819
+ var match = line.match(this.foldingStopMarker);
820
+ if (match) {
821
+ var i = match.index + match[0].length;
822
+
823
+ if (match[1])
824
+ return this.closingBracketBlock(session, match[1], row, i);
825
+
826
+ return session.getCommentFoldRange(row, i, -1);
827
+ }
828
+ };
829
+
830
+ }).call(FoldMode.prototype);
831
+
832
+ });