datagram 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.env.sample +7 -0
- data/.gitignore +20 -0
- data/.rbenv-version +1 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +22 -0
- data/Procfile +1 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/config.ru +5 -0
- data/datagram.gemspec +23 -0
- data/db/migrate/1_create_queries.rb +9 -0
- data/db/migrate/2_add_name_to_queries.rb +5 -0
- data/lib/datagram/version.rb +3 -0
- data/lib/datagram.rb +135 -0
- data/lib/views/application.coffee +222 -0
- data/lib/views/index.haml +47 -0
- data/lib/views/layout.haml +17 -0
- data/lib/views/style.sass +179 -0
- data/public/ace/ace.js +15209 -0
- data/public/ace/ext-elastic_tabstops_lite.js +301 -0
- data/public/ace/ext-emmet.js +253 -0
- data/public/ace/ext-searchbox.js +441 -0
- data/public/ace/ext-spellcheck.js +67 -0
- data/public/ace/ext-static_highlight.js +96 -0
- data/public/ace/ext-textarea.js +492 -0
- data/public/ace/ext-whitespace.js +204 -0
- data/public/ace/keybinding-emacs.js +962 -0
- data/public/ace/keybinding-vim.js +1704 -0
- data/public/ace/mode-abap.js +260 -0
- data/public/ace/mode-asciidoc.js +372 -0
- data/public/ace/mode-c9search.js +182 -0
- data/public/ace/mode-c_cpp.js +737 -0
- data/public/ace/mode-clojure.js +299 -0
- data/public/ace/mode-coffee.js +426 -0
- data/public/ace/mode-coldfusion.js +1753 -0
- data/public/ace/mode-csharp.js +612 -0
- data/public/ace/mode-css.js +773 -0
- data/public/ace/mode-curly.js +1950 -0
- data/public/ace/mode-dart.js +945 -0
- data/public/ace/mode-diff.js +166 -0
- data/public/ace/mode-django.js +1969 -0
- data/public/ace/mode-dot.js +320 -0
- data/public/ace/mode-ftl.js +907 -0
- data/public/ace/mode-glsl.js +810 -0
- data/public/ace/mode-golang.js +632 -0
- data/public/ace/mode-groovy.js +1037 -0
- data/public/ace/mode-haml.js +487 -0
- data/public/ace/mode-haxe.js +609 -0
- data/public/ace/mode-html.js +1881 -0
- data/public/ace/mode-jade.js +1951 -0
- data/public/ace/mode-java.js +996 -0
- data/public/ace/mode-javascript.js +876 -0
- data/public/ace/mode-json.js +578 -0
- data/public/ace/mode-jsp.js +1351 -0
- data/public/ace/mode-jsx.js +635 -0
- data/public/ace/mode-latex.js +189 -0
- data/public/ace/mode-less.js +807 -0
- data/public/ace/mode-liquid.js +862 -0
- data/public/ace/mode-lisp.js +138 -0
- data/public/ace/mode-livescript.js +288 -0
- data/public/ace/mode-logiql.js +664 -0
- data/public/ace/mode-lsl.js +828 -0
- data/public/ace/mode-lua.js +455 -0
- data/public/ace/mode-luapage.js +2340 -0
- data/public/ace/mode-lucene.js +64 -0
- data/public/ace/mode-makefile.js +313 -0
- data/public/ace/mode-markdown.js +2280 -0
- data/public/ace/mode-mushcode.js +704 -0
- data/public/ace/mode-mushcode_high_rules.js +569 -0
- data/public/ace/mode-objectivec.js +659 -0
- data/public/ace/mode-ocaml.js +443 -0
- data/public/ace/mode-pascal.js +233 -0
- data/public/ace/mode-perl.js +316 -0
- data/public/ace/mode-pgsql.js +908 -0
- data/public/ace/mode-php.js +2291 -0
- data/public/ace/mode-powershell.js +618 -0
- data/public/ace/mode-python.js +264 -0
- data/public/ace/mode-r.js +404 -0
- data/public/ace/mode-rdoc.js +184 -0
- data/public/ace/mode-rhtml.js +2168 -0
- data/public/ace/mode-ruby.js +431 -0
- data/public/ace/mode-sass.js +442 -0
- data/public/ace/mode-scad.js +670 -0
- data/public/ace/mode-scala.js +1025 -0
- data/public/ace/mode-scheme.js +144 -0
- data/public/ace/mode-scss.js +832 -0
- data/public/ace/mode-sh.js +204 -0
- data/public/ace/mode-sql.js +118 -0
- data/public/ace/mode-stylus.js +483 -0
- data/public/ace/mode-svg.js +1442 -0
- data/public/ace/mode-tcl.js +319 -0
- data/public/ace/mode-tex.js +166 -0
- data/public/ace/mode-text.js +0 -0
- data/public/ace/mode-textile.js +170 -0
- data/public/ace/mode-tmsnippet.js +200 -0
- data/public/ace/mode-toml.js +180 -0
- data/public/ace/mode-typescript.js +961 -0
- data/public/ace/mode-vbscript.js +281 -0
- data/public/ace/mode-velocity.js +962 -0
- data/public/ace/mode-xml.js +789 -0
- data/public/ace/mode-xquery.js +2750 -0
- data/public/ace/mode-yaml.js +289 -0
- data/public/ace/theme-ambiance.js +202 -0
- data/public/ace/theme-chaos.js +182 -0
- data/public/ace/theme-chrome.js +161 -0
- data/public/ace/theme-clouds.js +135 -0
- data/public/ace/theme-clouds_midnight.js +136 -0
- data/public/ace/theme-cobalt.js +150 -0
- data/public/ace/theme-crimson_editor.js +154 -0
- data/public/ace/theme-dawn.js +146 -0
- data/public/ace/theme-dreamweaver.js +173 -0
- data/public/ace/theme-eclipse.js +122 -0
- data/public/ace/theme-github.js +136 -0
- data/public/ace/theme-idle_fingers.js +136 -0
- data/public/ace/theme-kr.js +143 -0
- data/public/ace/theme-merbivore.js +135 -0
- data/public/ace/theme-merbivore_soft.js +136 -0
- data/public/ace/theme-mono_industrial.js +148 -0
- data/public/ace/theme-monokai.js +140 -0
- data/public/ace/theme-pastel_on_dark.js +148 -0
- data/public/ace/theme-solarized_dark.js +128 -0
- data/public/ace/theme-solarized_light.js +131 -0
- data/public/ace/theme-terminal.js +154 -0
- data/public/ace/theme-textmate.js +0 -0
- data/public/ace/theme-tomorrow.js +147 -0
- data/public/ace/theme-tomorrow_night.js +147 -0
- data/public/ace/theme-tomorrow_night_blue.js +145 -0
- data/public/ace/theme-tomorrow_night_bright.js +147 -0
- data/public/ace/theme-tomorrow_night_eighties.js +144 -0
- data/public/ace/theme-twilight.js +147 -0
- data/public/ace/theme-vibrant_ink.js +131 -0
- data/public/ace/theme-xcode.js +125 -0
- data/public/ace/worker-coffee.js +7091 -0
- data/public/ace/worker-css.js +8289 -0
- data/public/ace/worker-javascript.js +6496 -0
- data/public/ace/worker-json.js +2305 -0
- data/public/ace/worker-lua.js +3313 -0
- data/public/ace/worker-php.js +6743 -0
- data/public/ace/worker-xquery.js +21897 -0
- data/public/font/FontAwesome.otf +0 -0
- data/public/font/fontawesome-webfont.eot +0 -0
- data/public/font/fontawesome-webfont.svg +284 -0
- data/public/font/fontawesome-webfont.ttf +0 -0
- data/public/font/fontawesome-webfont.woff +0 -0
- data/public/font-awesome.css +540 -0
- data/public/jquery.js +9597 -0
- data/script/migrate.sh +2 -0
- metadata +242 -0
@@ -0,0 +1,299 @@
|
|
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/clojure', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/clojure_highlight_rules', 'ace/mode/matching_parens_outdent', 'ace/range'], 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 ClojureHighlightRules = require("./clojure_highlight_rules").ClojureHighlightRules;
|
38
|
+
var MatchingParensOutdent = require("./matching_parens_outdent").MatchingParensOutdent;
|
39
|
+
var Range = require("../range").Range;
|
40
|
+
|
41
|
+
var Mode = function() {
|
42
|
+
this.$tokenizer = new Tokenizer(new ClojureHighlightRules().getRules());
|
43
|
+
this.$outdent = new MatchingParensOutdent();
|
44
|
+
};
|
45
|
+
oop.inherits(Mode, TextMode);
|
46
|
+
|
47
|
+
(function() {
|
48
|
+
|
49
|
+
this.lineCommentStart = ";";
|
50
|
+
|
51
|
+
this.getNextLineIndent = function(state, line, tab) {
|
52
|
+
var indent = this.$getIndent(line);
|
53
|
+
|
54
|
+
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
55
|
+
var tokens = tokenizedLine.tokens;
|
56
|
+
|
57
|
+
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
58
|
+
return indent;
|
59
|
+
}
|
60
|
+
|
61
|
+
if (state == "start") {
|
62
|
+
var match = line.match(/[\(\[]/);
|
63
|
+
if (match) {
|
64
|
+
indent += " ";
|
65
|
+
}
|
66
|
+
match = line.match(/[\)]/);
|
67
|
+
if (match) {
|
68
|
+
indent = "";
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
return indent;
|
73
|
+
};
|
74
|
+
|
75
|
+
this.checkOutdent = function(state, line, input) {
|
76
|
+
return this.$outdent.checkOutdent(line, input);
|
77
|
+
};
|
78
|
+
|
79
|
+
this.autoOutdent = function(state, doc, row) {
|
80
|
+
this.$outdent.autoOutdent(doc, row);
|
81
|
+
};
|
82
|
+
|
83
|
+
}).call(Mode.prototype);
|
84
|
+
|
85
|
+
exports.Mode = Mode;
|
86
|
+
});
|
87
|
+
|
88
|
+
define('ace/mode/clojure_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
89
|
+
|
90
|
+
|
91
|
+
var oop = require("../lib/oop");
|
92
|
+
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
var ClojureHighlightRules = function() {
|
97
|
+
|
98
|
+
var builtinFunctions = (
|
99
|
+
'* *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* ' +
|
100
|
+
'*command-line-args* *compile-files* *compile-path* *e *err* *file* ' +
|
101
|
+
'*flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* ' +
|
102
|
+
'*print-dup* *print-length* *print-level* *print-meta* *print-readably* ' +
|
103
|
+
'*read-eval* *source-path* *use-context-classloader* ' +
|
104
|
+
'*warn-on-reflection* + - -> ->> .. / < <= = ' +
|
105
|
+
'== > > >= >= accessor aclone ' +
|
106
|
+
'add-classpath add-watch agent agent-errors aget alength alias all-ns ' +
|
107
|
+
'alter alter-meta! alter-var-root amap ancestors and apply areduce ' +
|
108
|
+
'array-map aset aset-boolean aset-byte aset-char aset-double aset-float ' +
|
109
|
+
'aset-int aset-long aset-short assert assoc assoc! assoc-in associative? ' +
|
110
|
+
'atom await await-for await1 bases bean bigdec bigint binding bit-and ' +
|
111
|
+
'bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left ' +
|
112
|
+
'bit-shift-right bit-test bit-xor boolean boolean-array booleans ' +
|
113
|
+
'bound-fn bound-fn* butlast byte byte-array bytes cast char char-array ' +
|
114
|
+
'char-escape-string char-name-string char? chars chunk chunk-append ' +
|
115
|
+
'chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? ' +
|
116
|
+
'class class? clear-agent-errors clojure-version coll? comment commute ' +
|
117
|
+
'comp comparator compare compare-and-set! compile complement concat cond ' +
|
118
|
+
'condp conj conj! cons constantly construct-proxy contains? count ' +
|
119
|
+
'counted? create-ns create-struct cycle dec decimal? declare definline ' +
|
120
|
+
'defmacro defmethod defmulti defn defn- defonce defstruct delay delay? ' +
|
121
|
+
'deliver deref derive descendants destructure disj disj! dissoc dissoc! ' +
|
122
|
+
'distinct distinct? doall doc dorun doseq dosync dotimes doto double ' +
|
123
|
+
'double-array doubles drop drop-last drop-while empty empty? ensure ' +
|
124
|
+
'enumeration-seq eval even? every? false? ffirst file-seq filter find ' +
|
125
|
+
'find-doc find-ns find-var first float float-array float? floats flush ' +
|
126
|
+
'fn fn? fnext for force format future future-call future-cancel ' +
|
127
|
+
'future-cancelled? future-done? future? gen-class gen-interface gensym ' +
|
128
|
+
'get get-in get-method get-proxy-class get-thread-bindings get-validator ' +
|
129
|
+
'hash hash-map hash-set identical? identity if-let if-not ifn? import ' +
|
130
|
+
'in-ns inc init-proxy instance? int int-array integer? interleave intern ' +
|
131
|
+
'interpose into into-array ints io! isa? iterate iterator-seq juxt key ' +
|
132
|
+
'keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list ' +
|
133
|
+
'list* list? load load-file load-reader load-string loaded-libs locking ' +
|
134
|
+
'long long-array longs loop macroexpand macroexpand-1 make-array ' +
|
135
|
+
'make-hierarchy map map? mapcat max max-key memfn memoize merge ' +
|
136
|
+
'merge-with meta method-sig methods min min-key mod name namespace neg? ' +
|
137
|
+
'newline next nfirst nil? nnext not not-any? not-empty not-every? not= ' +
|
138
|
+
'ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ' +
|
139
|
+
'ns-refers ns-resolve ns-unalias ns-unmap nth nthnext num number? odd? ' +
|
140
|
+
'or parents partial partition pcalls peek persistent! pmap pop pop! ' +
|
141
|
+
'pop-thread-bindings pos? pr pr-str prefer-method prefers ' +
|
142
|
+
'primitives-classnames print print-ctor print-doc print-dup print-method ' +
|
143
|
+
'print-namespace-doc print-simple print-special-doc print-str printf ' +
|
144
|
+
'println println-str prn prn-str promise proxy proxy-call-with-super ' +
|
145
|
+
'proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot ' +
|
146
|
+
'rand rand-int range ratio? rational? rationalize re-find re-groups ' +
|
147
|
+
're-matcher re-matches re-pattern re-seq read read-line read-string ' +
|
148
|
+
'reduce ref ref-history-count ref-max-history ref-min-history ref-set ' +
|
149
|
+
'refer refer-clojure release-pending-sends rem remove remove-method ' +
|
150
|
+
'remove-ns remove-watch repeat repeatedly replace replicate require ' +
|
151
|
+
'reset! reset-meta! resolve rest resultset-seq reverse reversible? rseq ' +
|
152
|
+
'rsubseq second select-keys send send-off seq seq? seque sequence ' +
|
153
|
+
'sequential? set set-validator! set? short short-array shorts ' +
|
154
|
+
'shutdown-agents slurp some sort sort-by sorted-map sorted-map-by ' +
|
155
|
+
'sorted-set sorted-set-by sorted? special-form-anchor special-symbol? ' +
|
156
|
+
'split-at split-with str stream? string? struct struct-map subs subseq ' +
|
157
|
+
'subvec supers swap! symbol symbol? sync syntax-symbol-anchor take ' +
|
158
|
+
'take-last take-nth take-while test the-ns time to-array to-array-2d ' +
|
159
|
+
'trampoline transient tree-seq true? type unchecked-add unchecked-dec ' +
|
160
|
+
'unchecked-divide unchecked-inc unchecked-multiply unchecked-negate ' +
|
161
|
+
'unchecked-remainder unchecked-subtract underive unquote ' +
|
162
|
+
'unquote-splicing update-in update-proxy use val vals var-get var-set ' +
|
163
|
+
'var? vary-meta vec vector vector? when when-first when-let when-not ' +
|
164
|
+
'while with-bindings with-bindings* with-in-str with-loading-context ' +
|
165
|
+
'with-local-vars with-meta with-open with-out-str with-precision xml-seq ' +
|
166
|
+
'zero? zipmap'
|
167
|
+
);
|
168
|
+
|
169
|
+
var keywords = ('throw try var ' +
|
170
|
+
'def do fn if let loop monitor-enter monitor-exit new quote recur set!'
|
171
|
+
);
|
172
|
+
|
173
|
+
var buildinConstants = ("true false nil");
|
174
|
+
|
175
|
+
var keywordMapper = this.createKeywordMapper({
|
176
|
+
"keyword": keywords,
|
177
|
+
"constant.language": buildinConstants,
|
178
|
+
"support.function": builtinFunctions
|
179
|
+
}, "identifier", false, " ");
|
180
|
+
|
181
|
+
this.$rules = {
|
182
|
+
"start" : [
|
183
|
+
{
|
184
|
+
token : "comment",
|
185
|
+
regex : ";.*$"
|
186
|
+
}, {
|
187
|
+
token : "keyword", //parens
|
188
|
+
regex : "[\\(|\\)]"
|
189
|
+
}, {
|
190
|
+
token : "keyword", //lists
|
191
|
+
regex : "[\\'\\(]"
|
192
|
+
}, {
|
193
|
+
token : "keyword", //vectors
|
194
|
+
regex : "[\\[|\\]]"
|
195
|
+
}, {
|
196
|
+
token : "keyword", //sets and maps
|
197
|
+
regex : "[\\{|\\}|\\#\\{|\\#\\}]"
|
198
|
+
}, {
|
199
|
+
token : "keyword", // ampersands
|
200
|
+
regex : '[\\&]'
|
201
|
+
}, {
|
202
|
+
token : "keyword", // metadata
|
203
|
+
regex : '[\\#\\^\\{]'
|
204
|
+
}, {
|
205
|
+
token : "keyword", // anonymous fn syntactic sugar
|
206
|
+
regex : '[\\%]'
|
207
|
+
}, {
|
208
|
+
token : "keyword", // deref reader macro
|
209
|
+
regex : '[@]'
|
210
|
+
}, {
|
211
|
+
token : "constant.numeric", // hex
|
212
|
+
regex : "0[xX][0-9a-fA-F]+\\b"
|
213
|
+
}, {
|
214
|
+
token : "constant.numeric", // float
|
215
|
+
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
216
|
+
}, {
|
217
|
+
token : "constant.language",
|
218
|
+
regex : '[!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+||=|!=|<=|>=|<>|<|>|!|&&]'
|
219
|
+
}, {
|
220
|
+
token : keywordMapper,
|
221
|
+
regex : "[a-zA-Z_$][a-zA-Z0-9_$\\-]*\\b"
|
222
|
+
}, {
|
223
|
+
token : "string", // single line
|
224
|
+
regex : '"',
|
225
|
+
next: "string"
|
226
|
+
}, {
|
227
|
+
token : "string", // symbol
|
228
|
+
regex : /:[\w*+!\-_?:\/]+/
|
229
|
+
}, {
|
230
|
+
token : "string.regexp", //Regular Expressions
|
231
|
+
regex : '/#"(?:\\.|(?:\\\")|[^\""\n])*"/g'
|
232
|
+
}
|
233
|
+
|
234
|
+
],
|
235
|
+
"string" : [
|
236
|
+
{
|
237
|
+
token : "constant.language.escape",
|
238
|
+
regex : "\\\\.|\\\\$"
|
239
|
+
}, {
|
240
|
+
token : "string",
|
241
|
+
regex : '[^"\\\\]+'
|
242
|
+
}, {
|
243
|
+
token : "string",
|
244
|
+
regex : '"',
|
245
|
+
next : "start"
|
246
|
+
}
|
247
|
+
]
|
248
|
+
};
|
249
|
+
};
|
250
|
+
|
251
|
+
oop.inherits(ClojureHighlightRules, TextHighlightRules);
|
252
|
+
|
253
|
+
exports.ClojureHighlightRules = ClojureHighlightRules;
|
254
|
+
});
|
255
|
+
|
256
|
+
define('ace/mode/matching_parens_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
257
|
+
|
258
|
+
|
259
|
+
var Range = require("../range").Range;
|
260
|
+
|
261
|
+
var MatchingParensOutdent = function() {};
|
262
|
+
|
263
|
+
(function() {
|
264
|
+
|
265
|
+
this.checkOutdent = function(line, input) {
|
266
|
+
if (! /^\s+$/.test(line))
|
267
|
+
return false;
|
268
|
+
|
269
|
+
return /^\s*\)/.test(input);
|
270
|
+
};
|
271
|
+
|
272
|
+
this.autoOutdent = function(doc, row) {
|
273
|
+
var line = doc.getLine(row);
|
274
|
+
var match = line.match(/^(\s*\))/);
|
275
|
+
|
276
|
+
if (!match) return 0;
|
277
|
+
|
278
|
+
var column = match[1].length;
|
279
|
+
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
280
|
+
|
281
|
+
if (!openBracePos || openBracePos.row == row) return 0;
|
282
|
+
|
283
|
+
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
284
|
+
doc.replace(new Range(row, 0, row, column-1), indent);
|
285
|
+
};
|
286
|
+
|
287
|
+
this.$getIndent = function(line) {
|
288
|
+
var match = line.match(/^(\s+)/);
|
289
|
+
if (match) {
|
290
|
+
return match[1];
|
291
|
+
}
|
292
|
+
|
293
|
+
return "";
|
294
|
+
};
|
295
|
+
|
296
|
+
}).call(MatchingParensOutdent.prototype);
|
297
|
+
|
298
|
+
exports.MatchingParensOutdent = MatchingParensOutdent;
|
299
|
+
});
|