sql-jarvis 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,8 @@
1
1
  //= require ./ace/ace
2
2
  //= require ./ace/ext-language_tools
3
3
  //= require ./ace/theme-twilight
4
+ //= require ./ace/theme-ambiance
4
5
  //= require ./ace/mode-sql
6
+ //= require ./ace/mode-ruby
5
7
  //= require ./ace/snippets/text
6
8
  //= require ./ace/snippets/sql
@@ -0,0 +1,498 @@
1
+ define("ace/mode/ruby_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
2
+ "use strict";
3
+
4
+ var oop = require("../lib/oop");
5
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
6
+ var constantOtherSymbol = exports.constantOtherSymbol = {
7
+ token : "constant.other.symbol.ruby", // symbol
8
+ regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"
9
+ };
10
+
11
+ var qString = exports.qString = {
12
+ token : "string", // single line
13
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
14
+ };
15
+
16
+ var qqString = exports.qqString = {
17
+ token : "string", // single line
18
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
19
+ };
20
+
21
+ var tString = exports.tString = {
22
+ token : "string", // backtick string
23
+ regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"
24
+ };
25
+
26
+ var constantNumericHex = exports.constantNumericHex = {
27
+ token : "constant.numeric", // hex
28
+ regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b"
29
+ };
30
+
31
+ var constantNumericFloat = exports.constantNumericFloat = {
32
+ token : "constant.numeric", // float
33
+ regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b"
34
+ };
35
+
36
+ var instanceVariable = exports.instanceVariable = {
37
+ token : "variable.instance", // instance variable
38
+ regex : "@{1,2}[a-zA-Z_\\d]+"
39
+ };
40
+
41
+ var RubyHighlightRules = function() {
42
+
43
+ var builtinFunctions = (
44
+ "abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
45
+ "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
46
+ "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" +
47
+ "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" +
48
+ "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" +
49
+ "assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" +
50
+ "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" +
51
+ "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" +
52
+ "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" +
53
+ "gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" +
54
+ "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" +
55
+ "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" +
56
+ "raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|" +
57
+ "set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" +
58
+ "throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" +
59
+ "render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" +
60
+ "content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" +
61
+ "fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" +
62
+ "time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" +
63
+ "select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" +
64
+ "file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" +
65
+ "protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" +
66
+ "send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" +
67
+ "validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" +
68
+ "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" +
69
+ "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" +
70
+ "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" +
71
+ "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" +
72
+ "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" +
73
+ "has_many|has_one|belongs_to|has_and_belongs_to_many"
74
+ );
75
+
76
+ var keywords = (
77
+ "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" +
78
+ "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" +
79
+ "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield"
80
+ );
81
+
82
+ var buildinConstants = (
83
+ "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
84
+ "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING"
85
+ );
86
+
87
+ var builtinVariables = (
88
+ "$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE|" +
89
+ "$!|root_url|flash|session|cookies|params|request|response|logger|self"
90
+ );
91
+
92
+ var keywordMapper = this.$keywords = this.createKeywordMapper({
93
+ "keyword": keywords,
94
+ "constant.language": buildinConstants,
95
+ "variable.language": builtinVariables,
96
+ "support.function": builtinFunctions,
97
+ "invalid.deprecated": "debugger" // TODO is this a remnant from js mode?
98
+ }, "identifier");
99
+
100
+ this.$rules = {
101
+ "start" : [
102
+ {
103
+ token : "comment",
104
+ regex : "#.*$"
105
+ }, {
106
+ token : "comment", // multi line comment
107
+ regex : "^=begin(?:$|\\s.*$)",
108
+ next : "comment"
109
+ }, {
110
+ token : "string.regexp",
111
+ regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
112
+ },
113
+
114
+ [{
115
+ regex: "[{}]", onMatch: function(val, state, stack) {
116
+ this.next = val == "{" ? this.nextState : "";
117
+ if (val == "{" && stack.length) {
118
+ stack.unshift("start", state);
119
+ return "paren.lparen";
120
+ }
121
+ if (val == "}" && stack.length) {
122
+ stack.shift();
123
+ this.next = stack.shift();
124
+ if (this.next.indexOf("string") != -1)
125
+ return "paren.end";
126
+ }
127
+ return val == "{" ? "paren.lparen" : "paren.rparen";
128
+ },
129
+ nextState: "start"
130
+ }, {
131
+ token : "string.start",
132
+ regex : /"/,
133
+ push : [{
134
+ token : "constant.language.escape",
135
+ regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
136
+ }, {
137
+ token : "paren.start",
138
+ regex : /#{/,
139
+ push : "start"
140
+ }, {
141
+ token : "string.end",
142
+ regex : /"/,
143
+ next : "pop"
144
+ }, {
145
+ defaultToken: "string"
146
+ }]
147
+ }, {
148
+ token : "string.start",
149
+ regex : /`/,
150
+ push : [{
151
+ token : "constant.language.escape",
152
+ regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
153
+ }, {
154
+ token : "paren.start",
155
+ regex : /#{/,
156
+ push : "start"
157
+ }, {
158
+ token : "string.end",
159
+ regex : /`/,
160
+ next : "pop"
161
+ }, {
162
+ defaultToken: "string"
163
+ }]
164
+ }, {
165
+ token : "string.start",
166
+ regex : /'/,
167
+ push : [{
168
+ token : "constant.language.escape",
169
+ regex : /\\['\\]/
170
+ }, {
171
+ token : "string.end",
172
+ regex : /'/,
173
+ next : "pop"
174
+ }, {
175
+ defaultToken: "string"
176
+ }]
177
+ }],
178
+
179
+ {
180
+ token : "text", // namespaces aren't symbols
181
+ regex : "::"
182
+ }, {
183
+ token : "variable.instance", // instance variable
184
+ regex : "@{1,2}[a-zA-Z_\\d]+"
185
+ }, {
186
+ token : "support.class", // class name
187
+ regex : "[A-Z][a-zA-Z_\\d]+"
188
+ },
189
+
190
+ constantOtherSymbol,
191
+ constantNumericHex,
192
+ constantNumericFloat,
193
+
194
+ {
195
+ token : "constant.language.boolean",
196
+ regex : "(?:true|false)\\b"
197
+ }, {
198
+ token : keywordMapper,
199
+ regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
200
+ }, {
201
+ token : "punctuation.separator.key-value",
202
+ regex : "=>"
203
+ }, {
204
+ stateName: "heredoc",
205
+ onMatch : function(value, currentState, stack) {
206
+ var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
207
+ var tokens = value.split(this.splitRegex);
208
+ stack.push(next, tokens[3]);
209
+ return [
210
+ {type:"constant", value: tokens[1]},
211
+ {type:"string", value: tokens[2]},
212
+ {type:"support.class", value: tokens[3]},
213
+ {type:"string", value: tokens[4]}
214
+ ];
215
+ },
216
+ regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)",
217
+ rules: {
218
+ heredoc: [{
219
+ onMatch: function(value, currentState, stack) {
220
+ if (value === stack[1]) {
221
+ stack.shift();
222
+ stack.shift();
223
+ this.next = stack[0] || "start";
224
+ return "support.class";
225
+ }
226
+ this.next = "";
227
+ return "string";
228
+ },
229
+ regex: ".*$",
230
+ next: "start"
231
+ }],
232
+ indentedHeredoc: [{
233
+ token: "string",
234
+ regex: "^ +"
235
+ }, {
236
+ onMatch: function(value, currentState, stack) {
237
+ if (value === stack[1]) {
238
+ stack.shift();
239
+ stack.shift();
240
+ this.next = stack[0] || "start";
241
+ return "support.class";
242
+ }
243
+ this.next = "";
244
+ return "string";
245
+ },
246
+ regex: ".*$",
247
+ next: "start"
248
+ }]
249
+ }
250
+ }, {
251
+ regex : "$",
252
+ token : "empty",
253
+ next : function(currentState, stack) {
254
+ if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
255
+ return stack[0];
256
+ return currentState;
257
+ }
258
+ }, {
259
+ token : "string.character",
260
+ regex : "\\B\\?."
261
+ }, {
262
+ token : "keyword.operator",
263
+ regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
264
+ }, {
265
+ token : "paren.lparen",
266
+ regex : "[[({]"
267
+ }, {
268
+ token : "paren.rparen",
269
+ regex : "[\\])}]"
270
+ }, {
271
+ token : "text",
272
+ regex : "\\s+"
273
+ }
274
+ ],
275
+ "comment" : [
276
+ {
277
+ token : "comment", // closing comment
278
+ regex : "^=end(?:$|\\s.*$)",
279
+ next : "start"
280
+ }, {
281
+ token : "comment", // comment spanning whole line
282
+ regex : ".+"
283
+ }
284
+ ]
285
+ };
286
+
287
+ this.normalizeRules();
288
+ };
289
+
290
+ oop.inherits(RubyHighlightRules, TextHighlightRules);
291
+
292
+ exports.RubyHighlightRules = RubyHighlightRules;
293
+ });
294
+
295
+ define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
296
+ "use strict";
297
+
298
+ var Range = require("../range").Range;
299
+
300
+ var MatchingBraceOutdent = function() {};
301
+
302
+ (function() {
303
+
304
+ this.checkOutdent = function(line, input) {
305
+ if (! /^\s+$/.test(line))
306
+ return false;
307
+
308
+ return /^\s*\}/.test(input);
309
+ };
310
+
311
+ this.autoOutdent = function(doc, row) {
312
+ var line = doc.getLine(row);
313
+ var match = line.match(/^(\s*\})/);
314
+
315
+ if (!match) return 0;
316
+
317
+ var column = match[1].length;
318
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
319
+
320
+ if (!openBracePos || openBracePos.row == row) return 0;
321
+
322
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
323
+ doc.replace(new Range(row, 0, row, column-1), indent);
324
+ };
325
+
326
+ this.$getIndent = function(line) {
327
+ return line.match(/^\s*/)[0];
328
+ };
329
+
330
+ }).call(MatchingBraceOutdent.prototype);
331
+
332
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
333
+ });
334
+
335
+ define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
336
+ "use strict";
337
+
338
+ var oop = require("../../lib/oop");
339
+ var BaseFoldMode = require("./fold_mode").FoldMode;
340
+ var Range = require("../../range").Range;
341
+
342
+ var FoldMode = exports.FoldMode = function() {};
343
+ oop.inherits(FoldMode, BaseFoldMode);
344
+
345
+ (function() {
346
+
347
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
348
+ var range = this.indentationBlock(session, row);
349
+ if (range)
350
+ return range;
351
+
352
+ var re = /\S/;
353
+ var line = session.getLine(row);
354
+ var startLevel = line.search(re);
355
+ if (startLevel == -1 || line[startLevel] != "#")
356
+ return;
357
+
358
+ var startColumn = line.length;
359
+ var maxRow = session.getLength();
360
+ var startRow = row;
361
+ var endRow = row;
362
+
363
+ while (++row < maxRow) {
364
+ line = session.getLine(row);
365
+ var level = line.search(re);
366
+
367
+ if (level == -1)
368
+ continue;
369
+
370
+ if (line[level] != "#")
371
+ break;
372
+
373
+ endRow = row;
374
+ }
375
+
376
+ if (endRow > startRow) {
377
+ var endColumn = session.getLine(endRow).length;
378
+ return new Range(startRow, startColumn, endRow, endColumn);
379
+ }
380
+ };
381
+ this.getFoldWidget = function(session, foldStyle, row) {
382
+ var line = session.getLine(row);
383
+ var indent = line.search(/\S/);
384
+ var next = session.getLine(row + 1);
385
+ var prev = session.getLine(row - 1);
386
+ var prevIndent = prev.search(/\S/);
387
+ var nextIndent = next.search(/\S/);
388
+
389
+ if (indent == -1) {
390
+ session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
391
+ return "";
392
+ }
393
+ if (prevIndent == -1) {
394
+ if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
395
+ session.foldWidgets[row - 1] = "";
396
+ session.foldWidgets[row + 1] = "";
397
+ return "start";
398
+ }
399
+ } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
400
+ if (session.getLine(row - 2).search(/\S/) == -1) {
401
+ session.foldWidgets[row - 1] = "start";
402
+ session.foldWidgets[row + 1] = "";
403
+ return "";
404
+ }
405
+ }
406
+
407
+ if (prevIndent!= -1 && prevIndent < indent)
408
+ session.foldWidgets[row - 1] = "start";
409
+ else
410
+ session.foldWidgets[row - 1] = "";
411
+
412
+ if (indent < nextIndent)
413
+ return "start";
414
+ else
415
+ return "";
416
+ };
417
+
418
+ }).call(FoldMode.prototype);
419
+
420
+ });
421
+
422
+ define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/coffee"], function(require, exports, module) {
423
+ "use strict";
424
+
425
+ var oop = require("../lib/oop");
426
+ var TextMode = require("./text").Mode;
427
+ var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
428
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
429
+ var Range = require("../range").Range;
430
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
431
+ var FoldMode = require("./folding/coffee").FoldMode;
432
+
433
+ var Mode = function() {
434
+ this.HighlightRules = RubyHighlightRules;
435
+ this.$outdent = new MatchingBraceOutdent();
436
+ this.$behaviour = new CstyleBehaviour();
437
+ this.foldingRules = new FoldMode();
438
+ };
439
+ oop.inherits(Mode, TextMode);
440
+
441
+ (function() {
442
+
443
+
444
+ this.lineCommentStart = "#";
445
+
446
+ this.getNextLineIndent = function(state, line, tab) {
447
+ var indent = this.$getIndent(line);
448
+
449
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
450
+ var tokens = tokenizedLine.tokens;
451
+
452
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
453
+ return indent;
454
+ }
455
+
456
+ if (state == "start") {
457
+ var match = line.match(/^.*[\{\(\[]\s*$/);
458
+ var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/);
459
+ var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/);
460
+ var startingConditional = line.match(/^\s*(if|else|when)\s*/);
461
+ if (match || startingClassOrMethod || startingDoBlock || startingConditional) {
462
+ indent += tab;
463
+ }
464
+ }
465
+
466
+ return indent;
467
+ };
468
+
469
+ this.checkOutdent = function(state, line, input) {
470
+ return /^\s+(end|else)$/.test(line + input) || this.$outdent.checkOutdent(line, input);
471
+ };
472
+
473
+ this.autoOutdent = function(state, session, row) {
474
+ var line = session.getLine(row);
475
+ if (/}/.test(line))
476
+ return this.$outdent.autoOutdent(session, row);
477
+ var indent = this.$getIndent(line);
478
+ var prevLine = session.getLine(row - 1);
479
+ var prevIndent = this.$getIndent(prevLine);
480
+ var tab = session.getTabString();
481
+ if (prevIndent.length <= indent.length) {
482
+ if (indent.slice(-tab.length) == tab)
483
+ session.remove(new Range(row, indent.length-tab.length, row, indent.length));
484
+ }
485
+ };
486
+
487
+ this.$id = "ace/mode/ruby";
488
+ }).call(Mode.prototype);
489
+
490
+ exports.Mode = Mode;
491
+ }); (function() {
492
+ window.require(["ace/mode/ruby"], function(m) {
493
+ if (typeof module == "object" && typeof exports == "object" && module) {
494
+ module.exports = m;
495
+ }
496
+ });
497
+ })();
498
+