ace-rails-ap 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +1 -1
- data/lib/ace/rails/version.rb +1 -1
- data/vendor/assets/javascripts/ace/ace.js +6911 -5290
- data/vendor/assets/javascripts/ace/ext-chromevox.js +537 -0
- data/vendor/assets/javascripts/ace/ext-elastic_tabstops_lite.js +301 -0
- data/vendor/assets/javascripts/ace/ext-emmet.js +1109 -0
- data/vendor/assets/javascripts/ace/ext-keybinding_menu.js +207 -0
- data/vendor/assets/javascripts/ace/ext-language_tools.js +1665 -0
- data/vendor/assets/javascripts/ace/ext-modelist.js +168 -0
- data/vendor/assets/javascripts/ace/ext-old_ie.js +500 -0
- data/vendor/assets/javascripts/ace/ext-options.js +252 -0
- data/vendor/assets/javascripts/ace/ext-searchbox.js +421 -0
- data/vendor/assets/javascripts/ace/ext-settings_menu.js +632 -0
- data/vendor/assets/javascripts/ace/ext-spellcheck.js +68 -0
- data/vendor/assets/javascripts/ace/ext-split.js +271 -0
- data/vendor/assets/javascripts/ace/ext-static_highlight.js +178 -0
- data/vendor/assets/javascripts/ace/ext-statusbar.js +47 -0
- data/vendor/assets/javascripts/ace/ext-textarea.js +478 -0
- data/vendor/assets/javascripts/ace/ext-themelist.js +86 -0
- data/vendor/assets/javascripts/ace/ext-whitespace.js +206 -0
- data/vendor/assets/javascripts/ace/keybinding-emacs.js +822 -131
- data/vendor/assets/javascripts/ace/keybinding-vim.js +382 -258
- data/vendor/assets/javascripts/ace/mode-abap.js +261 -0
- data/vendor/assets/javascripts/ace/mode-actionscript.js +257 -0
- data/vendor/assets/javascripts/ace/mode-ada.js +118 -0
- data/vendor/assets/javascripts/ace/mode-asciidoc.js +373 -0
- data/vendor/assets/javascripts/ace/mode-assembly_x86.js +217 -0
- data/vendor/assets/javascripts/ace/mode-autohotkey.js +225 -0
- data/vendor/assets/javascripts/ace/mode-batchfile.js +213 -0
- data/vendor/assets/javascripts/ace/mode-c9search.js +144 -124
- data/vendor/assets/javascripts/ace/mode-c_cpp.js +296 -254
- data/vendor/assets/javascripts/ace/mode-clojure.js +113 -177
- data/vendor/assets/javascripts/ace/mode-cobol.js +125 -0
- data/vendor/assets/javascripts/ace/mode-coffee.js +152 -235
- data/vendor/assets/javascripts/ace/mode-coldfusion.js +823 -835
- data/vendor/assets/javascripts/ace/mode-csharp.js +325 -187
- data/vendor/assets/javascripts/ace/mode-css.js +583 -297
- data/vendor/assets/javascripts/ace/mode-curly.js +2423 -0
- data/vendor/assets/javascripts/ace/mode-d.js +492 -0
- data/vendor/assets/javascripts/ace/mode-dart.js +993 -0
- data/vendor/assets/javascripts/ace/mode-diff.js +124 -204
- data/vendor/assets/javascripts/ace/mode-django.js +2448 -0
- data/vendor/assets/javascripts/ace/mode-dot.js +361 -0
- data/vendor/assets/javascripts/ace/mode-ejs.js +2817 -0
- data/vendor/assets/javascripts/ace/mode-erlang.js +987 -0
- data/vendor/assets/javascripts/ace/mode-forth.js +280 -0
- data/vendor/assets/javascripts/ace/mode-ftl.js +1061 -0
- data/vendor/assets/javascripts/ace/mode-glsl.js +313 -275
- data/vendor/assets/javascripts/ace/mode-golang.js +268 -275
- data/vendor/assets/javascripts/ace/mode-groovy.js +347 -492
- data/vendor/assets/javascripts/ace/mode-haml.js +498 -0
- data/vendor/assets/javascripts/ace/mode-handlebars.js +2433 -0
- data/vendor/assets/javascripts/ace/mode-haskell.js +362 -0
- data/vendor/assets/javascripts/ace/mode-haxe.js +226 -202
- data/vendor/assets/javascripts/ace/mode-html.js +1099 -802
- data/vendor/assets/javascripts/ace/mode-html_completions.js +309 -0
- data/vendor/assets/javascripts/ace/mode-html_ruby.js +2822 -0
- data/vendor/assets/javascripts/ace/mode-ini.js +185 -0
- data/vendor/assets/javascripts/ace/mode-jack.js +653 -0
- data/vendor/assets/javascripts/ace/mode-jade.js +2081 -0
- data/vendor/assets/javascripts/ace/mode-java.js +339 -488
- data/vendor/assets/javascripts/ace/mode-javascript.js +342 -478
- data/vendor/assets/javascripts/ace/mode-json.js +215 -178
- data/vendor/assets/javascripts/ace/mode-jsoniq.js +2761 -0
- data/vendor/assets/javascripts/ace/mode-jsp.js +1553 -0
- data/vendor/assets/javascripts/ace/mode-jsx.js +325 -289
- data/vendor/assets/javascripts/ace/mode-julia.js +286 -0
- data/vendor/assets/javascripts/ace/mode-latex.js +141 -46
- data/vendor/assets/javascripts/ace/mode-less.js +493 -151
- data/vendor/assets/javascripts/ace/mode-liquid.js +594 -656
- data/vendor/assets/javascripts/ace/mode-lisp.js +137 -0
- data/vendor/assets/javascripts/ace/mode-livescript.js +288 -0
- data/vendor/assets/javascripts/ace/mode-logiql.js +669 -0
- data/vendor/assets/javascripts/ace/mode-lsl.js +890 -0
- data/vendor/assets/javascripts/ace/mode-lua.js +274 -368
- data/vendor/assets/javascripts/ace/mode-luapage.js +1331 -1107
- data/vendor/assets/javascripts/ace/mode-lucene.js +64 -0
- data/vendor/assets/javascripts/ace/mode-makefile.js +332 -0
- data/vendor/assets/javascripts/ace/mode-markdown.js +1303 -948
- data/vendor/assets/javascripts/ace/mode-matlab.js +230 -0
- data/vendor/assets/javascripts/ace/mode-mushcode.js +705 -0
- data/vendor/assets/javascripts/ace/mode-mushcode_high_rules.js +569 -0
- data/vendor/assets/javascripts/ace/mode-mysql.js +185 -0
- data/vendor/assets/javascripts/ace/mode-nix.js +935 -0
- data/vendor/assets/javascripts/ace/mode-objectivec.js +699 -0
- data/vendor/assets/javascripts/ace/mode-ocaml.js +44 -63
- data/vendor/assets/javascripts/ace/mode-pascal.js +233 -0
- data/vendor/assets/javascripts/ace/mode-perl.js +116 -189
- data/vendor/assets/javascripts/ace/mode-pgsql.js +886 -500
- data/vendor/assets/javascripts/ace/mode-php.js +1158 -380
- data/vendor/assets/javascripts/ace/mode-plain_text.js +56 -0
- data/vendor/assets/javascripts/ace/mode-powershell.js +222 -167
- data/vendor/assets/javascripts/ace/mode-prolog.js +354 -0
- data/vendor/assets/javascripts/ace/mode-properties.js +100 -0
- data/vendor/assets/javascripts/ace/mode-protobuf.js +885 -0
- data/vendor/assets/javascripts/ace/mode-python.js +99 -201
- data/vendor/assets/javascripts/ace/mode-r.js +337 -0
- data/vendor/assets/javascripts/ace/mode-rdoc.js +210 -0
- data/vendor/assets/javascripts/ace/mode-rhtml.js +2663 -0
- data/vendor/assets/javascripts/ace/mode-ruby.js +262 -136
- data/vendor/assets/javascripts/ace/mode-rust.js +245 -0
- data/vendor/assets/javascripts/ace/mode-sass.js +443 -0
- data/vendor/assets/javascripts/ace/mode-scad.js +225 -240
- data/vendor/assets/javascripts/ace/mode-scala.js +340 -494
- data/vendor/assets/javascripts/ace/mode-scheme.js +143 -0
- data/vendor/assets/javascripts/ace/mode-scss.js +499 -157
- data/vendor/assets/javascripts/ace/mode-sh.js +180 -110
- data/vendor/assets/javascripts/ace/mode-sjs.js +1154 -0
- data/vendor/assets/javascripts/ace/mode-snippets.js +198 -0
- data/vendor/assets/javascripts/ace/mode-soy_template.js +2707 -0
- data/vendor/assets/javascripts/ace/mode-space.js +160 -0
- data/vendor/assets/javascripts/ace/mode-sql.js +48 -69
- data/vendor/assets/javascripts/ace/mode-stylus.js +447 -0
- data/vendor/assets/javascripts/ace/mode-svg.js +552 -605
- data/vendor/assets/javascripts/ace/mode-tcl.js +139 -98
- data/vendor/assets/javascripts/ace/mode-tex.js +187 -0
- data/vendor/assets/javascripts/ace/mode-textile.js +29 -40
- data/vendor/assets/javascripts/ace/mode-tmsnippet.js +200 -0
- data/vendor/assets/javascripts/ace/mode-toml.js +177 -0
- data/vendor/assets/javascripts/ace/mode-twig.js +2228 -0
- data/vendor/assets/javascripts/ace/mode-typescript.js +1018 -0
- data/vendor/assets/javascripts/ace/mode-vbscript.js +250 -0
- data/vendor/assets/javascripts/ace/mode-velocity.js +1621 -0
- data/vendor/assets/javascripts/ace/mode-verilog.js +127 -0
- data/vendor/assets/javascripts/ace/mode-vhdl.js +139 -0
- data/vendor/assets/javascripts/ace/mode-xml.js +350 -242
- data/vendor/assets/javascripts/ace/mode-xquery.js +2490 -300
- data/vendor/assets/javascripts/ace/mode-yaml.js +146 -45
- data/vendor/assets/javascripts/ace/theme-ambiance.js +202 -0
- data/vendor/assets/javascripts/ace/theme-chaos.js +179 -0
- data/vendor/assets/javascripts/ace/theme-chrome.js +97 -153
- data/vendor/assets/javascripts/ace/theme-clouds.js +78 -119
- data/vendor/assets/javascripts/ace/theme-clouds_midnight.js +79 -120
- data/vendor/assets/javascripts/ace/theme-cobalt.js +89 -140
- data/vendor/assets/javascripts/ace/theme-crimson_editor.js +93 -145
- data/vendor/assets/javascripts/ace/theme-dawn.js +84 -143
- data/vendor/assets/javascripts/ace/theme-dreamweaver.js +99 -162
- data/vendor/assets/javascripts/ace/theme-eclipse.js +78 -111
- data/vendor/assets/javascripts/ace/theme-github.js +70 -121
- data/vendor/assets/javascripts/ace/theme-idle_fingers.js +75 -134
- data/vendor/assets/javascripts/ace/theme-kr.js +135 -0
- data/vendor/assets/javascripts/ace/theme-merbivore.js +80 -143
- data/vendor/assets/javascripts/ace/theme-merbivore_soft.js +81 -149
- data/vendor/assets/javascripts/ace/theme-mono_industrial.js +87 -146
- data/vendor/assets/javascripts/ace/theme-monokai.js +88 -146
- data/vendor/assets/javascripts/ace/theme-pastel_on_dark.js +82 -142
- data/vendor/assets/javascripts/ace/theme-solarized_dark.js +83 -144
- data/vendor/assets/javascripts/ace/theme-solarized_light.js +76 -133
- data/vendor/assets/javascripts/ace/theme-terminal.js +145 -0
- data/vendor/assets/javascripts/ace/theme-textmate.js +101 -158
- data/vendor/assets/javascripts/ace/theme-tomorrow.js +89 -163
- data/vendor/assets/javascripts/ace/theme-tomorrow_night.js +89 -163
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_blue.js +89 -165
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright.js +101 -162
- data/vendor/assets/javascripts/ace/theme-tomorrow_night_eighties.js +90 -160
- data/vendor/assets/javascripts/ace/theme-twilight.js +87 -158
- data/vendor/assets/javascripts/ace/theme-vibrant_ink.js +75 -140
- data/vendor/assets/javascripts/ace/theme-xcode.js +120 -0
- data/vendor/assets/javascripts/ace/worker-coffee.js +3049 -2665
- data/vendor/assets/javascripts/ace/worker-css.js +1779 -4376
- data/vendor/assets/javascripts/ace/worker-javascript.js +8701 -9008
- data/vendor/assets/javascripts/ace/worker-json.js +709 -1340
- data/vendor/assets/javascripts/ace/worker-lua.js +3525 -0
- data/vendor/assets/javascripts/ace/worker-php.js +6893 -0
- data/vendor/assets/javascripts/ace/worker-xquery.js +19924 -64507
- metadata +100 -17
@@ -0,0 +1,137 @@
|
|
1
|
+
/* ***** BEGIN LICENSE BLOCK *****
|
2
|
+
* Distributed under the BSD license:
|
3
|
+
*
|
4
|
+
* Copyright (c) 2012, Ajax.org B.V.
|
5
|
+
* All rights reserved.
|
6
|
+
*
|
7
|
+
* Redistribution and use in source and binary forms, with or without
|
8
|
+
* modification, are permitted provided that the following conditions are met:
|
9
|
+
* * Redistributions of source code must retain the above copyright
|
10
|
+
* notice, this list of conditions and the following disclaimer.
|
11
|
+
* * Redistributions in binary form must reproduce the above copyright
|
12
|
+
* notice, this list of conditions and the following disclaimer in the
|
13
|
+
* documentation and/or other materials provided with the distribution.
|
14
|
+
* * Neither the name of Ajax.org B.V. nor the
|
15
|
+
* names of its contributors may be used to endorse or promote products
|
16
|
+
* derived from this software without specific prior written permission.
|
17
|
+
*
|
18
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
+
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
22
|
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
23
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
24
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
25
|
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
26
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
27
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
28
|
+
*
|
29
|
+
*
|
30
|
+
* ***** END LICENSE BLOCK ***** */
|
31
|
+
|
32
|
+
define('ace/mode/lisp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/lisp_highlight_rules'], function(require, exports, module) {
|
33
|
+
|
34
|
+
|
35
|
+
var oop = require("../lib/oop");
|
36
|
+
var TextMode = require("./text").Mode;
|
37
|
+
var Tokenizer = require("../tokenizer").Tokenizer;
|
38
|
+
var LispHighlightRules = require("./lisp_highlight_rules").LispHighlightRules;
|
39
|
+
|
40
|
+
var Mode = function() {
|
41
|
+
this.HighlightRules = LispHighlightRules;
|
42
|
+
};
|
43
|
+
oop.inherits(Mode, TextMode);
|
44
|
+
|
45
|
+
(function() {
|
46
|
+
|
47
|
+
this.lineCommentStart = ";";
|
48
|
+
|
49
|
+
this.$id = "ace/mode/lisp";
|
50
|
+
}).call(Mode.prototype);
|
51
|
+
|
52
|
+
exports.Mode = Mode;
|
53
|
+
});
|
54
|
+
|
55
|
+
|
56
|
+
define('ace/mode/lisp_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
57
|
+
|
58
|
+
|
59
|
+
var oop = require("../lib/oop");
|
60
|
+
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
61
|
+
|
62
|
+
var LispHighlightRules = function() {
|
63
|
+
var keywordControl = "case|do|let|loop|if|else|when";
|
64
|
+
var keywordOperator = "eq|neq|and|or";
|
65
|
+
var constantLanguage = "null|nil";
|
66
|
+
var supportFunctions = "cons|car|cdr|cond|lambda|format|setq|setf|quote|eval|append|list|listp|memberp|t|load|progn";
|
67
|
+
|
68
|
+
var keywordMapper = this.createKeywordMapper({
|
69
|
+
"keyword.control": keywordControl,
|
70
|
+
"keyword.operator": keywordOperator,
|
71
|
+
"constant.language": constantLanguage,
|
72
|
+
"support.function": supportFunctions
|
73
|
+
}, "identifier", true);
|
74
|
+
|
75
|
+
this.$rules =
|
76
|
+
{
|
77
|
+
"start": [
|
78
|
+
{
|
79
|
+
token : "comment",
|
80
|
+
regex : ";.*$"
|
81
|
+
},
|
82
|
+
{
|
83
|
+
token: ["storage.type.function-type.lisp", "text", "entity.name.function.lisp"],
|
84
|
+
regex: "(?:\\b(?:(defun|defmethod|defmacro))\\b)(\\s+)((?:\\w|\\-|\\!|\\?)*)"
|
85
|
+
},
|
86
|
+
{
|
87
|
+
token: ["punctuation.definition.constant.character.lisp", "constant.character.lisp"],
|
88
|
+
regex: "(#)((?:\\w|[\\\\+-=<>'\"&#])+)"
|
89
|
+
},
|
90
|
+
{
|
91
|
+
token: ["punctuation.definition.variable.lisp", "variable.other.global.lisp", "punctuation.definition.variable.lisp"],
|
92
|
+
regex: "(\\*)(\\S*)(\\*)"
|
93
|
+
},
|
94
|
+
{
|
95
|
+
token : "constant.numeric", // hex
|
96
|
+
regex : "0[xX][0-9a-fA-F]+(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
|
97
|
+
},
|
98
|
+
{
|
99
|
+
token : "constant.numeric", // float
|
100
|
+
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
|
101
|
+
},
|
102
|
+
{
|
103
|
+
token : keywordMapper,
|
104
|
+
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
105
|
+
},
|
106
|
+
{
|
107
|
+
token : "string",
|
108
|
+
regex : '"(?=.)',
|
109
|
+
next : "qqstring"
|
110
|
+
}
|
111
|
+
],
|
112
|
+
"qqstring": [
|
113
|
+
{
|
114
|
+
token: "constant.character.escape.lisp",
|
115
|
+
regex: "\\\\."
|
116
|
+
},
|
117
|
+
{
|
118
|
+
token : "string",
|
119
|
+
regex : '[^"\\\\]+'
|
120
|
+
}, {
|
121
|
+
token : "string",
|
122
|
+
regex : "\\\\$",
|
123
|
+
next : "qqstring"
|
124
|
+
}, {
|
125
|
+
token : "string",
|
126
|
+
regex : '"|$',
|
127
|
+
next : "start"
|
128
|
+
}
|
129
|
+
]
|
130
|
+
}
|
131
|
+
|
132
|
+
};
|
133
|
+
|
134
|
+
oop.inherits(LispHighlightRules, TextHighlightRules);
|
135
|
+
|
136
|
+
exports.LispHighlightRules = LispHighlightRules;
|
137
|
+
});
|
@@ -0,0 +1,288 @@
|
|
1
|
+
define('ace/mode/livescript', ['require', 'exports', 'module' , 'ace/tokenizer', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/text'], function(require, exports, module) {
|
2
|
+
var identifier, LiveScriptMode, keywordend, stringfill;
|
3
|
+
identifier = '(?![\\d\\s])[$\\w\\xAA-\\uFFDC](?:(?!\\s)[$\\w\\xAA-\\uFFDC]|-[A-Za-z])*';
|
4
|
+
exports.Mode = LiveScriptMode = (function(superclass){
|
5
|
+
var indenter, prototype = extend$((import$(LiveScriptMode, superclass).displayName = 'LiveScriptMode', LiveScriptMode), superclass).prototype, constructor = LiveScriptMode;
|
6
|
+
function LiveScriptMode(){
|
7
|
+
var that;
|
8
|
+
this.$tokenizer = new (require('../tokenizer')).Tokenizer(LiveScriptMode.Rules);
|
9
|
+
if (that = require('../mode/matching_brace_outdent')) {
|
10
|
+
this.$outdent = new that.MatchingBraceOutdent;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
indenter = RegExp('(?:[({[=:]|[-~]>|\\b(?:e(?:lse|xport)|d(?:o|efault)|t(?:ry|hen)|finally|import(?:\\s*all)?|const|var|let|new|catch(?:\\s*' + identifier + ')?))\\s*$');
|
14
|
+
prototype.getNextLineIndent = function(state, line, tab){
|
15
|
+
var indent, tokens;
|
16
|
+
indent = this.$getIndent(line);
|
17
|
+
tokens = this.$tokenizer.getLineTokens(line, state).tokens;
|
18
|
+
if (!(tokens.length && tokens[tokens.length - 1].type === 'comment')) {
|
19
|
+
if (state === 'start' && indenter.test(line)) {
|
20
|
+
indent += tab;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
return indent;
|
24
|
+
};
|
25
|
+
prototype.toggleCommentLines = function(state, doc, startRow, endRow){
|
26
|
+
var comment, range, i$, i, out, line;
|
27
|
+
comment = /^(\s*)#/;
|
28
|
+
range = new (require('../range')).Range(0, 0, 0, 0);
|
29
|
+
for (i$ = startRow; i$ <= endRow; ++i$) {
|
30
|
+
i = i$;
|
31
|
+
if (out = comment.test(line = doc.getLine(i))) {
|
32
|
+
line = line.replace(comment, '$1');
|
33
|
+
} else {
|
34
|
+
line = line.replace(/^\s*/, '$&#');
|
35
|
+
}
|
36
|
+
range.end.row = range.start.row = i;
|
37
|
+
range.end.column = line.length + 1;
|
38
|
+
doc.replace(range, line);
|
39
|
+
}
|
40
|
+
return 1 - out * 2;
|
41
|
+
};
|
42
|
+
prototype.checkOutdent = function(state, line, input){
|
43
|
+
var ref$;
|
44
|
+
return (ref$ = this.$outdent) != null ? ref$.checkOutdent(line, input) : void 8;
|
45
|
+
};
|
46
|
+
prototype.autoOutdent = function(state, doc, row){
|
47
|
+
var ref$;
|
48
|
+
return (ref$ = this.$outdent) != null ? ref$.autoOutdent(doc, row) : void 8;
|
49
|
+
};
|
50
|
+
return LiveScriptMode;
|
51
|
+
}(require('../mode/text').Mode));
|
52
|
+
keywordend = '(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))';
|
53
|
+
stringfill = {
|
54
|
+
token: 'string',
|
55
|
+
regex: '.+'
|
56
|
+
};
|
57
|
+
LiveScriptMode.Rules = {
|
58
|
+
start: [
|
59
|
+
{
|
60
|
+
token: 'keyword',
|
61
|
+
regex: '(?:t(?:h(?:is|row|en)|ry|ypeof!?)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:n(?:stanceof)?|mp(?:ort(?:\\s+all)?|lements)|[fs])|d(?:e(?:fault|lete|bugger)|o)|f(?:or(?:\\s+own)?|inally|unction)|s(?:uper|witch)|e(?:lse|x(?:tends|port)|val)|a(?:nd|rguments)|n(?:ew|ot)|un(?:less|til)|w(?:hile|ith)|o[fr]|return|break|let|var|loop)' + keywordend
|
62
|
+
}, {
|
63
|
+
token: 'constant.language',
|
64
|
+
regex: '(?:true|false|yes|no|on|off|null|void|undefined)' + keywordend
|
65
|
+
}, {
|
66
|
+
token: 'invalid.illegal',
|
67
|
+
regex: '(?:p(?:ackage|r(?:ivate|otected)|ublic)|i(?:mplements|nterface)|enum|static|yield)' + keywordend
|
68
|
+
}, {
|
69
|
+
token: 'language.support.class',
|
70
|
+
regex: '(?:R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|Array|Boolean|Date|Function|Number|Object|TypeError|URIError)' + keywordend
|
71
|
+
}, {
|
72
|
+
token: 'language.support.function',
|
73
|
+
regex: '(?:is(?:NaN|Finite)|parse(?:Int|Float)|Math|JSON|(?:en|de)codeURI(?:Component)?)' + keywordend
|
74
|
+
}, {
|
75
|
+
token: 'variable.language',
|
76
|
+
regex: '(?:t(?:hat|il|o)|f(?:rom|allthrough)|it|by|e)' + keywordend
|
77
|
+
}, {
|
78
|
+
token: 'identifier',
|
79
|
+
regex: identifier + '\\s*:(?![:=])'
|
80
|
+
}, {
|
81
|
+
token: 'variable',
|
82
|
+
regex: identifier
|
83
|
+
}, {
|
84
|
+
token: 'keyword.operator',
|
85
|
+
regex: '(?:\\.{3}|\\s+\\?)'
|
86
|
+
}, {
|
87
|
+
token: 'keyword.variable',
|
88
|
+
regex: '(?:@+|::|\\.\\.)',
|
89
|
+
next: 'key'
|
90
|
+
}, {
|
91
|
+
token: 'keyword.operator',
|
92
|
+
regex: '\\.\\s*',
|
93
|
+
next: 'key'
|
94
|
+
}, {
|
95
|
+
token: 'string',
|
96
|
+
regex: '\\\\\\S[^\\s,;)}\\]]*'
|
97
|
+
}, {
|
98
|
+
token: 'string.doc',
|
99
|
+
regex: '\'\'\'',
|
100
|
+
next: 'qdoc'
|
101
|
+
}, {
|
102
|
+
token: 'string.doc',
|
103
|
+
regex: '"""',
|
104
|
+
next: 'qqdoc'
|
105
|
+
}, {
|
106
|
+
token: 'string',
|
107
|
+
regex: '\'',
|
108
|
+
next: 'qstring'
|
109
|
+
}, {
|
110
|
+
token: 'string',
|
111
|
+
regex: '"',
|
112
|
+
next: 'qqstring'
|
113
|
+
}, {
|
114
|
+
token: 'string',
|
115
|
+
regex: '`',
|
116
|
+
next: 'js'
|
117
|
+
}, {
|
118
|
+
token: 'string',
|
119
|
+
regex: '<\\[',
|
120
|
+
next: 'words'
|
121
|
+
}, {
|
122
|
+
token: 'string.regex',
|
123
|
+
regex: '//',
|
124
|
+
next: 'heregex'
|
125
|
+
}, {
|
126
|
+
token: 'comment.doc',
|
127
|
+
regex: '/\\*',
|
128
|
+
next: 'comment'
|
129
|
+
}, {
|
130
|
+
token: 'comment',
|
131
|
+
regex: '#.*'
|
132
|
+
}, {
|
133
|
+
token: 'string.regex',
|
134
|
+
regex: '\\/(?:[^[\\/\\n\\\\]*(?:(?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[\\/\\n\\\\]*)*)\\/[gimy$]{0,4}',
|
135
|
+
next: 'key'
|
136
|
+
}, {
|
137
|
+
token: 'constant.numeric',
|
138
|
+
regex: '(?:0x[\\da-fA-F][\\da-fA-F_]*|(?:[2-9]|[12]\\d|3[0-6])r[\\da-zA-Z][\\da-zA-Z_]*|(?:\\d[\\d_]*(?:\\.\\d[\\d_]*)?|\\.\\d[\\d_]*)(?:e[+-]?\\d[\\d_]*)?[\\w$]*)'
|
139
|
+
}, {
|
140
|
+
token: 'lparen',
|
141
|
+
regex: '[({[]'
|
142
|
+
}, {
|
143
|
+
token: 'rparen',
|
144
|
+
regex: '[)}\\]]',
|
145
|
+
next: 'key'
|
146
|
+
}, {
|
147
|
+
token: 'keyword.operator',
|
148
|
+
regex: '\\S+'
|
149
|
+
}, {
|
150
|
+
token: 'text',
|
151
|
+
regex: '\\s+'
|
152
|
+
}
|
153
|
+
],
|
154
|
+
heregex: [
|
155
|
+
{
|
156
|
+
token: 'string.regex',
|
157
|
+
regex: '.*?//[gimy$?]{0,4}',
|
158
|
+
next: 'start'
|
159
|
+
}, {
|
160
|
+
token: 'string.regex',
|
161
|
+
regex: '\\s*#{'
|
162
|
+
}, {
|
163
|
+
token: 'comment.regex',
|
164
|
+
regex: '\\s+(?:#.*)?'
|
165
|
+
}, {
|
166
|
+
token: 'string.regex',
|
167
|
+
regex: '\\S+'
|
168
|
+
}
|
169
|
+
],
|
170
|
+
key: [
|
171
|
+
{
|
172
|
+
token: 'keyword.operator',
|
173
|
+
regex: '[.?@!]+'
|
174
|
+
}, {
|
175
|
+
token: 'identifier',
|
176
|
+
regex: identifier,
|
177
|
+
next: 'start'
|
178
|
+
}, {
|
179
|
+
token: 'text',
|
180
|
+
regex: '.',
|
181
|
+
next: 'start'
|
182
|
+
}
|
183
|
+
],
|
184
|
+
comment: [
|
185
|
+
{
|
186
|
+
token: 'comment.doc',
|
187
|
+
regex: '.*?\\*/',
|
188
|
+
next: 'start'
|
189
|
+
}, {
|
190
|
+
token: 'comment.doc',
|
191
|
+
regex: '.+'
|
192
|
+
}
|
193
|
+
],
|
194
|
+
qdoc: [
|
195
|
+
{
|
196
|
+
token: 'string',
|
197
|
+
regex: ".*?'''",
|
198
|
+
next: 'key'
|
199
|
+
}, stringfill
|
200
|
+
],
|
201
|
+
qqdoc: [
|
202
|
+
{
|
203
|
+
token: 'string',
|
204
|
+
regex: '.*?"""',
|
205
|
+
next: 'key'
|
206
|
+
}, stringfill
|
207
|
+
],
|
208
|
+
qstring: [
|
209
|
+
{
|
210
|
+
token: 'string',
|
211
|
+
regex: '[^\\\\\']*(?:\\\\.[^\\\\\']*)*\'',
|
212
|
+
next: 'key'
|
213
|
+
}, stringfill
|
214
|
+
],
|
215
|
+
qqstring: [
|
216
|
+
{
|
217
|
+
token: 'string',
|
218
|
+
regex: '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',
|
219
|
+
next: 'key'
|
220
|
+
}, stringfill
|
221
|
+
],
|
222
|
+
js: [
|
223
|
+
{
|
224
|
+
token: 'string',
|
225
|
+
regex: '[^\\\\`]*(?:\\\\.[^\\\\`]*)*`',
|
226
|
+
next: 'key'
|
227
|
+
}, stringfill
|
228
|
+
],
|
229
|
+
words: [
|
230
|
+
{
|
231
|
+
token: 'string',
|
232
|
+
regex: '.*?\\]>',
|
233
|
+
next: 'key'
|
234
|
+
}, stringfill
|
235
|
+
]
|
236
|
+
};
|
237
|
+
function extend$(sub, sup){
|
238
|
+
function fun(){} fun.prototype = (sub.superclass = sup).prototype;
|
239
|
+
(sub.prototype = new fun).constructor = sub;
|
240
|
+
if (typeof sup.extended == 'function') sup.extended(sub);
|
241
|
+
return sub;
|
242
|
+
}
|
243
|
+
function import$(obj, src){
|
244
|
+
var own = {}.hasOwnProperty;
|
245
|
+
for (var key in src) if (own.call(src, key)) obj[key] = src[key];
|
246
|
+
return obj;
|
247
|
+
}
|
248
|
+
});
|
249
|
+
|
250
|
+
define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
251
|
+
|
252
|
+
|
253
|
+
var Range = require("../range").Range;
|
254
|
+
|
255
|
+
var MatchingBraceOutdent = function() {};
|
256
|
+
|
257
|
+
(function() {
|
258
|
+
|
259
|
+
this.checkOutdent = function(line, input) {
|
260
|
+
if (! /^\s+$/.test(line))
|
261
|
+
return false;
|
262
|
+
|
263
|
+
return /^\s*\}/.test(input);
|
264
|
+
};
|
265
|
+
|
266
|
+
this.autoOutdent = function(doc, row) {
|
267
|
+
var line = doc.getLine(row);
|
268
|
+
var match = line.match(/^(\s*\})/);
|
269
|
+
|
270
|
+
if (!match) return 0;
|
271
|
+
|
272
|
+
var column = match[1].length;
|
273
|
+
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
274
|
+
|
275
|
+
if (!openBracePos || openBracePos.row == row) return 0;
|
276
|
+
|
277
|
+
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
278
|
+
doc.replace(new Range(row, 0, row, column-1), indent);
|
279
|
+
};
|
280
|
+
|
281
|
+
this.$getIndent = function(line) {
|
282
|
+
return line.match(/^\s*/)[0];
|
283
|
+
};
|
284
|
+
|
285
|
+
}).call(MatchingBraceOutdent.prototype);
|
286
|
+
|
287
|
+
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
288
|
+
});
|
@@ -0,0 +1,669 @@
|
|
1
|
+
/* ***** BEGIN LICENSE BLOCK *****
|
2
|
+
* Distributed under the BSD license:
|
3
|
+
*
|
4
|
+
* Copyright (c) 2012, Ajax.org B.V.
|
5
|
+
* All rights reserved.
|
6
|
+
*
|
7
|
+
* Redistribution and use in source and binary forms, with or without
|
8
|
+
* modification, are permitted provided that the following conditions are met:
|
9
|
+
* * Redistributions of source code must retain the above copyright
|
10
|
+
* notice, this list of conditions and the following disclaimer.
|
11
|
+
* * Redistributions in binary form must reproduce the above copyright
|
12
|
+
* notice, this list of conditions and the following disclaimer in the
|
13
|
+
* documentation and/or other materials provided with the distribution.
|
14
|
+
* * Neither the name of Ajax.org B.V. nor the
|
15
|
+
* names of its contributors may be used to endorse or promote products
|
16
|
+
* derived from this software without specific prior written permission.
|
17
|
+
*
|
18
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
+
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
|
22
|
+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
23
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
24
|
+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
25
|
+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
26
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
27
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
28
|
+
*
|
29
|
+
* ***** END LICENSE BLOCK ***** */
|
30
|
+
|
31
|
+
define('ace/mode/logiql', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/logiql_highlight_rules', 'ace/mode/folding/coffee', 'ace/token_iterator', 'ace/range', 'ace/mode/behaviour/cstyle', 'ace/mode/matching_brace_outdent'], 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 LogiQLHighlightRules = require("./logiql_highlight_rules").LogiQLHighlightRules;
|
38
|
+
var FoldMode = require("./folding/coffee").FoldMode;
|
39
|
+
var TokenIterator = require("../token_iterator").TokenIterator;
|
40
|
+
var Range = require("../range").Range;
|
41
|
+
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
42
|
+
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
43
|
+
|
44
|
+
var Mode = function() {
|
45
|
+
this.HighlightRules = LogiQLHighlightRules;
|
46
|
+
this.foldingRules = new FoldMode();
|
47
|
+
this.$outdent = new MatchingBraceOutdent();
|
48
|
+
this.$behaviour = new CstyleBehaviour();
|
49
|
+
};
|
50
|
+
oop.inherits(Mode, TextMode);
|
51
|
+
|
52
|
+
(function() {
|
53
|
+
this.lineCommentStart = "//";
|
54
|
+
this.blockComment = {start: "/*", end: "*/"};
|
55
|
+
|
56
|
+
this.getNextLineIndent = function(state, line, tab) {
|
57
|
+
var indent = this.$getIndent(line);
|
58
|
+
|
59
|
+
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
60
|
+
var tokens = tokenizedLine.tokens;
|
61
|
+
var endState = tokenizedLine.state;
|
62
|
+
if (/comment|string/.test(endState))
|
63
|
+
return indent;
|
64
|
+
if (tokens.length && tokens[tokens.length - 1].type == "comment.single")
|
65
|
+
return indent;
|
66
|
+
|
67
|
+
var match = line.match();
|
68
|
+
if (/(-->|<--|<-|->|{)\s*$/.test(line))
|
69
|
+
indent += tab;
|
70
|
+
return indent;
|
71
|
+
};
|
72
|
+
|
73
|
+
this.checkOutdent = function(state, line, input) {
|
74
|
+
if (this.$outdent.checkOutdent(line, input))
|
75
|
+
return true;
|
76
|
+
|
77
|
+
if (input !== "\n" && input !== "\r\n")
|
78
|
+
return false;
|
79
|
+
|
80
|
+
if (!/^\s+/.test(line))
|
81
|
+
return false;
|
82
|
+
|
83
|
+
return true;
|
84
|
+
};
|
85
|
+
|
86
|
+
this.autoOutdent = function(state, doc, row) {
|
87
|
+
if (this.$outdent.autoOutdent(doc, row))
|
88
|
+
return;
|
89
|
+
var prevLine = doc.getLine(row);
|
90
|
+
var match = prevLine.match(/^\s+/);
|
91
|
+
var column = prevLine.lastIndexOf(".") + 1;
|
92
|
+
if (!match || !row || !column) return 0;
|
93
|
+
|
94
|
+
var line = doc.getLine(row + 1);
|
95
|
+
var startRange = this.getMatching(doc, {row: row, column: column});
|
96
|
+
if (!startRange || startRange.start.row == row) return 0;
|
97
|
+
|
98
|
+
column = match[0].length;
|
99
|
+
var indent = this.$getIndent(doc.getLine(startRange.start.row));
|
100
|
+
doc.replace(new Range(row + 1, 0, row + 1, column), indent);
|
101
|
+
};
|
102
|
+
|
103
|
+
this.getMatching = function(session, row, column) {
|
104
|
+
if (row == undefined)
|
105
|
+
row = session.selection.lead
|
106
|
+
if (typeof row == "object") {
|
107
|
+
column = row.column;
|
108
|
+
row = row.row;
|
109
|
+
}
|
110
|
+
|
111
|
+
var startToken = session.getTokenAt(row, column);
|
112
|
+
var KW_START = "keyword.start", KW_END = "keyword.end";
|
113
|
+
var tok;
|
114
|
+
if (!startToken)
|
115
|
+
return;
|
116
|
+
if (startToken.type == KW_START) {
|
117
|
+
var it = new TokenIterator(session, row, column);
|
118
|
+
it.step = it.stepForward;
|
119
|
+
} else if (startToken.type == KW_END) {
|
120
|
+
var it = new TokenIterator(session, row, column);
|
121
|
+
it.step = it.stepBackward;
|
122
|
+
} else
|
123
|
+
return;
|
124
|
+
|
125
|
+
while (tok = it.step()) {
|
126
|
+
if (tok.type == KW_START || tok.type == KW_END)
|
127
|
+
break;
|
128
|
+
}
|
129
|
+
if (!tok || tok.type == startToken.type)
|
130
|
+
return;
|
131
|
+
|
132
|
+
var col = it.getCurrentTokenColumn();
|
133
|
+
var row = it.getCurrentTokenRow();
|
134
|
+
return new Range(row, col, row, col + tok.value.length);
|
135
|
+
};
|
136
|
+
this.$id = "ace/mode/logiql";
|
137
|
+
}).call(Mode.prototype);
|
138
|
+
|
139
|
+
exports.Mode = Mode;
|
140
|
+
});
|
141
|
+
|
142
|
+
define('ace/mode/logiql_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
143
|
+
|
144
|
+
|
145
|
+
var oop = require("../lib/oop");
|
146
|
+
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
147
|
+
|
148
|
+
var LogiQLHighlightRules = function() {
|
149
|
+
|
150
|
+
this.$rules = { start:
|
151
|
+
[ { token: 'comment.block',
|
152
|
+
regex: '/\\*',
|
153
|
+
push:
|
154
|
+
[ { token: 'comment.block', regex: '\\*/', next: 'pop' },
|
155
|
+
{ defaultToken: 'comment.block' } ],
|
156
|
+
},
|
157
|
+
{ token: 'comment.single',
|
158
|
+
regex: '//.*',
|
159
|
+
},
|
160
|
+
{ token: 'constant.numeric',
|
161
|
+
regex: '\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?[fd]?',
|
162
|
+
},
|
163
|
+
{ token: 'string',
|
164
|
+
regex: '"',
|
165
|
+
push:
|
166
|
+
[ { token: 'string', regex: '"', next: 'pop' },
|
167
|
+
{ defaultToken: 'string' } ],
|
168
|
+
},
|
169
|
+
{ token: 'constant.language',
|
170
|
+
regex: '\\b(true|false)\\b',
|
171
|
+
},
|
172
|
+
{ token: 'entity.name.type.logicblox',
|
173
|
+
regex: '`[a-zA-Z_:]+(\\d|\\a)*\\b',
|
174
|
+
},
|
175
|
+
{ token: 'keyword.start', regex: '->', comment: 'Constraint' },
|
176
|
+
{ token: 'keyword.start', regex: '-->', comment: 'Level 1 Constraint'},
|
177
|
+
{ token: 'keyword.start', regex: '<-', comment: 'Rule' },
|
178
|
+
{ token: 'keyword.start', regex: '<--', comment: 'Level 1 Rule' },
|
179
|
+
{ token: 'keyword.end', regex: '\\.', comment: 'Terminator' },
|
180
|
+
{ token: 'keyword.other', regex: '!', comment: 'Negation' },
|
181
|
+
{ token: 'keyword.other', regex: ',', comment: 'Conjunction' },
|
182
|
+
{ token: 'keyword.other', regex: ';', comment: 'Disjunction' },
|
183
|
+
{ token: 'keyword.operator', regex: '<=|>=|!=|<|>', comment: 'Equality'},
|
184
|
+
{ token: 'keyword.other', regex: '@', comment: 'Equality' },
|
185
|
+
{ token: 'keyword.operator', regex: '\\+|-|\\*|/', comment: 'Arithmetic operations'},
|
186
|
+
{ token: 'keyword', regex: '::', comment: 'Colon colon' },
|
187
|
+
{ token: 'support.function',
|
188
|
+
regex: '\\b(agg\\s*<<)',
|
189
|
+
push:
|
190
|
+
[ { include: '$self' },
|
191
|
+
{ token: 'support.function',
|
192
|
+
regex: '>>',
|
193
|
+
next: 'pop' } ],
|
194
|
+
},
|
195
|
+
{ token: 'storage.modifier',
|
196
|
+
regex: '\\b(lang:[\\w:]*)',
|
197
|
+
},
|
198
|
+
{ token: [ 'storage.type', 'text' ],
|
199
|
+
regex: '(export|sealed|clauses|block|alias|alias_all)(\\s*\\()(?=`)',
|
200
|
+
},
|
201
|
+
{ token: 'entity.name',
|
202
|
+
regex: '[a-zA-Z_][a-zA-Z_0-9:]*(@prev|@init|@final)?(?=(\\(|\\[))',
|
203
|
+
},
|
204
|
+
{ token: 'variable.parameter',
|
205
|
+
regex: '([a-zA-Z][a-zA-Z_0-9]*|_)\\s*(?=(,|\\.|<-|->|\\)|\\]|=))',
|
206
|
+
} ] }
|
207
|
+
|
208
|
+
this.normalizeRules();
|
209
|
+
};
|
210
|
+
|
211
|
+
oop.inherits(LogiQLHighlightRules, TextHighlightRules);
|
212
|
+
|
213
|
+
exports.LogiQLHighlightRules = LogiQLHighlightRules;
|
214
|
+
});
|
215
|
+
|
216
|
+
define('ace/mode/folding/coffee', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
|
217
|
+
|
218
|
+
|
219
|
+
var oop = require("../../lib/oop");
|
220
|
+
var BaseFoldMode = require("./fold_mode").FoldMode;
|
221
|
+
var Range = require("../../range").Range;
|
222
|
+
|
223
|
+
var FoldMode = exports.FoldMode = function() {};
|
224
|
+
oop.inherits(FoldMode, BaseFoldMode);
|
225
|
+
|
226
|
+
(function() {
|
227
|
+
|
228
|
+
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
229
|
+
var range = this.indentationBlock(session, row);
|
230
|
+
if (range)
|
231
|
+
return range;
|
232
|
+
|
233
|
+
var re = /\S/;
|
234
|
+
var line = session.getLine(row);
|
235
|
+
var startLevel = line.search(re);
|
236
|
+
if (startLevel == -1 || line[startLevel] != "#")
|
237
|
+
return;
|
238
|
+
|
239
|
+
var startColumn = line.length;
|
240
|
+
var maxRow = session.getLength();
|
241
|
+
var startRow = row;
|
242
|
+
var endRow = row;
|
243
|
+
|
244
|
+
while (++row < maxRow) {
|
245
|
+
line = session.getLine(row);
|
246
|
+
var level = line.search(re);
|
247
|
+
|
248
|
+
if (level == -1)
|
249
|
+
continue;
|
250
|
+
|
251
|
+
if (line[level] != "#")
|
252
|
+
break;
|
253
|
+
|
254
|
+
endRow = row;
|
255
|
+
}
|
256
|
+
|
257
|
+
if (endRow > startRow) {
|
258
|
+
var endColumn = session.getLine(endRow).length;
|
259
|
+
return new Range(startRow, startColumn, endRow, endColumn);
|
260
|
+
}
|
261
|
+
};
|
262
|
+
this.getFoldWidget = function(session, foldStyle, row) {
|
263
|
+
var line = session.getLine(row);
|
264
|
+
var indent = line.search(/\S/);
|
265
|
+
var next = session.getLine(row + 1);
|
266
|
+
var prev = session.getLine(row - 1);
|
267
|
+
var prevIndent = prev.search(/\S/);
|
268
|
+
var nextIndent = next.search(/\S/);
|
269
|
+
|
270
|
+
if (indent == -1) {
|
271
|
+
session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
|
272
|
+
return "";
|
273
|
+
}
|
274
|
+
if (prevIndent == -1) {
|
275
|
+
if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
|
276
|
+
session.foldWidgets[row - 1] = "";
|
277
|
+
session.foldWidgets[row + 1] = "";
|
278
|
+
return "start";
|
279
|
+
}
|
280
|
+
} else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
|
281
|
+
if (session.getLine(row - 2).search(/\S/) == -1) {
|
282
|
+
session.foldWidgets[row - 1] = "start";
|
283
|
+
session.foldWidgets[row + 1] = "";
|
284
|
+
return "";
|
285
|
+
}
|
286
|
+
}
|
287
|
+
|
288
|
+
if (prevIndent!= -1 && prevIndent < indent)
|
289
|
+
session.foldWidgets[row - 1] = "start";
|
290
|
+
else
|
291
|
+
session.foldWidgets[row - 1] = "";
|
292
|
+
|
293
|
+
if (indent < nextIndent)
|
294
|
+
return "start";
|
295
|
+
else
|
296
|
+
return "";
|
297
|
+
};
|
298
|
+
|
299
|
+
}).call(FoldMode.prototype);
|
300
|
+
|
301
|
+
});
|
302
|
+
|
303
|
+
define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
304
|
+
|
305
|
+
|
306
|
+
var oop = require("../../lib/oop");
|
307
|
+
var Behaviour = require("../behaviour").Behaviour;
|
308
|
+
var TokenIterator = require("../../token_iterator").TokenIterator;
|
309
|
+
var lang = require("../../lib/lang");
|
310
|
+
|
311
|
+
var SAFE_INSERT_IN_TOKENS =
|
312
|
+
["text", "paren.rparen", "punctuation.operator"];
|
313
|
+
var SAFE_INSERT_BEFORE_TOKENS =
|
314
|
+
["text", "paren.rparen", "punctuation.operator", "comment"];
|
315
|
+
|
316
|
+
|
317
|
+
var autoInsertedBrackets = 0;
|
318
|
+
var autoInsertedRow = -1;
|
319
|
+
var autoInsertedLineEnd = "";
|
320
|
+
var maybeInsertedBrackets = 0;
|
321
|
+
var maybeInsertedRow = -1;
|
322
|
+
var maybeInsertedLineStart = "";
|
323
|
+
var maybeInsertedLineEnd = "";
|
324
|
+
|
325
|
+
var CstyleBehaviour = function () {
|
326
|
+
|
327
|
+
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
328
|
+
var cursor = editor.getCursorPosition();
|
329
|
+
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
330
|
+
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
331
|
+
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
332
|
+
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
333
|
+
return false;
|
334
|
+
}
|
335
|
+
iterator.stepForward();
|
336
|
+
return iterator.getCurrentTokenRow() !== cursor.row ||
|
337
|
+
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
338
|
+
};
|
339
|
+
|
340
|
+
CstyleBehaviour.$matchTokenType = function(token, types) {
|
341
|
+
return types.indexOf(token.type || token) > -1;
|
342
|
+
};
|
343
|
+
|
344
|
+
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
345
|
+
var cursor = editor.getCursorPosition();
|
346
|
+
var line = session.doc.getLine(cursor.row);
|
347
|
+
if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
|
348
|
+
autoInsertedBrackets = 0;
|
349
|
+
autoInsertedRow = cursor.row;
|
350
|
+
autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
351
|
+
autoInsertedBrackets++;
|
352
|
+
};
|
353
|
+
|
354
|
+
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
355
|
+
var cursor = editor.getCursorPosition();
|
356
|
+
var line = session.doc.getLine(cursor.row);
|
357
|
+
if (!this.isMaybeInsertedClosing(cursor, line))
|
358
|
+
maybeInsertedBrackets = 0;
|
359
|
+
maybeInsertedRow = cursor.row;
|
360
|
+
maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
361
|
+
maybeInsertedLineEnd = line.substr(cursor.column);
|
362
|
+
maybeInsertedBrackets++;
|
363
|
+
};
|
364
|
+
|
365
|
+
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
366
|
+
return autoInsertedBrackets > 0 &&
|
367
|
+
cursor.row === autoInsertedRow &&
|
368
|
+
bracket === autoInsertedLineEnd[0] &&
|
369
|
+
line.substr(cursor.column) === autoInsertedLineEnd;
|
370
|
+
};
|
371
|
+
|
372
|
+
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
373
|
+
return maybeInsertedBrackets > 0 &&
|
374
|
+
cursor.row === maybeInsertedRow &&
|
375
|
+
line.substr(cursor.column) === maybeInsertedLineEnd &&
|
376
|
+
line.substr(0, cursor.column) == maybeInsertedLineStart;
|
377
|
+
};
|
378
|
+
|
379
|
+
CstyleBehaviour.popAutoInsertedClosing = function() {
|
380
|
+
autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
|
381
|
+
autoInsertedBrackets--;
|
382
|
+
};
|
383
|
+
|
384
|
+
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
385
|
+
maybeInsertedBrackets = 0;
|
386
|
+
maybeInsertedRow = -1;
|
387
|
+
};
|
388
|
+
|
389
|
+
this.add("braces", "insertion", function (state, action, editor, session, text) {
|
390
|
+
var cursor = editor.getCursorPosition();
|
391
|
+
var line = session.doc.getLine(cursor.row);
|
392
|
+
if (text == '{') {
|
393
|
+
var selection = editor.getSelectionRange();
|
394
|
+
var selected = session.doc.getTextRange(selection);
|
395
|
+
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
396
|
+
return {
|
397
|
+
text: '{' + selected + '}',
|
398
|
+
selection: false
|
399
|
+
};
|
400
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
401
|
+
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
402
|
+
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
403
|
+
return {
|
404
|
+
text: '{}',
|
405
|
+
selection: [1, 1]
|
406
|
+
};
|
407
|
+
} else {
|
408
|
+
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
409
|
+
return {
|
410
|
+
text: '{',
|
411
|
+
selection: [1, 1]
|
412
|
+
};
|
413
|
+
}
|
414
|
+
}
|
415
|
+
} else if (text == '}') {
|
416
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
417
|
+
if (rightChar == '}') {
|
418
|
+
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
419
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
420
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
421
|
+
return {
|
422
|
+
text: '',
|
423
|
+
selection: [1, 1]
|
424
|
+
};
|
425
|
+
}
|
426
|
+
}
|
427
|
+
} else if (text == "\n" || text == "\r\n") {
|
428
|
+
var closing = "";
|
429
|
+
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
430
|
+
closing = lang.stringRepeat("}", maybeInsertedBrackets);
|
431
|
+
CstyleBehaviour.clearMaybeInsertedClosing();
|
432
|
+
}
|
433
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
434
|
+
if (rightChar === '}') {
|
435
|
+
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
|
436
|
+
if (!openBracePos)
|
437
|
+
return null;
|
438
|
+
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
439
|
+
} else if (closing) {
|
440
|
+
var next_indent = this.$getIndent(line);
|
441
|
+
} else {
|
442
|
+
return;
|
443
|
+
}
|
444
|
+
var indent = next_indent + session.getTabString();
|
445
|
+
|
446
|
+
return {
|
447
|
+
text: '\n' + indent + '\n' + next_indent + closing,
|
448
|
+
selection: [1, indent.length, 1, indent.length]
|
449
|
+
};
|
450
|
+
} else {
|
451
|
+
CstyleBehaviour.clearMaybeInsertedClosing();
|
452
|
+
}
|
453
|
+
});
|
454
|
+
|
455
|
+
this.add("braces", "deletion", function (state, action, editor, session, range) {
|
456
|
+
var selected = session.doc.getTextRange(range);
|
457
|
+
if (!range.isMultiLine() && selected == '{') {
|
458
|
+
var line = session.doc.getLine(range.start.row);
|
459
|
+
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
460
|
+
if (rightChar == '}') {
|
461
|
+
range.end.column++;
|
462
|
+
return range;
|
463
|
+
} else {
|
464
|
+
maybeInsertedBrackets--;
|
465
|
+
}
|
466
|
+
}
|
467
|
+
});
|
468
|
+
|
469
|
+
this.add("parens", "insertion", function (state, action, editor, session, text) {
|
470
|
+
if (text == '(') {
|
471
|
+
var selection = editor.getSelectionRange();
|
472
|
+
var selected = session.doc.getTextRange(selection);
|
473
|
+
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
474
|
+
return {
|
475
|
+
text: '(' + selected + ')',
|
476
|
+
selection: false
|
477
|
+
};
|
478
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
479
|
+
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
480
|
+
return {
|
481
|
+
text: '()',
|
482
|
+
selection: [1, 1]
|
483
|
+
};
|
484
|
+
}
|
485
|
+
} else if (text == ')') {
|
486
|
+
var cursor = editor.getCursorPosition();
|
487
|
+
var line = session.doc.getLine(cursor.row);
|
488
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
489
|
+
if (rightChar == ')') {
|
490
|
+
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
491
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
492
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
493
|
+
return {
|
494
|
+
text: '',
|
495
|
+
selection: [1, 1]
|
496
|
+
};
|
497
|
+
}
|
498
|
+
}
|
499
|
+
}
|
500
|
+
});
|
501
|
+
|
502
|
+
this.add("parens", "deletion", function (state, action, editor, session, range) {
|
503
|
+
var selected = session.doc.getTextRange(range);
|
504
|
+
if (!range.isMultiLine() && selected == '(') {
|
505
|
+
var line = session.doc.getLine(range.start.row);
|
506
|
+
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
507
|
+
if (rightChar == ')') {
|
508
|
+
range.end.column++;
|
509
|
+
return range;
|
510
|
+
}
|
511
|
+
}
|
512
|
+
});
|
513
|
+
|
514
|
+
this.add("brackets", "insertion", function (state, action, editor, session, text) {
|
515
|
+
if (text == '[') {
|
516
|
+
var selection = editor.getSelectionRange();
|
517
|
+
var selected = session.doc.getTextRange(selection);
|
518
|
+
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
519
|
+
return {
|
520
|
+
text: '[' + selected + ']',
|
521
|
+
selection: false
|
522
|
+
};
|
523
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
524
|
+
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
525
|
+
return {
|
526
|
+
text: '[]',
|
527
|
+
selection: [1, 1]
|
528
|
+
};
|
529
|
+
}
|
530
|
+
} else if (text == ']') {
|
531
|
+
var cursor = editor.getCursorPosition();
|
532
|
+
var line = session.doc.getLine(cursor.row);
|
533
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
534
|
+
if (rightChar == ']') {
|
535
|
+
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
536
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
537
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
538
|
+
return {
|
539
|
+
text: '',
|
540
|
+
selection: [1, 1]
|
541
|
+
};
|
542
|
+
}
|
543
|
+
}
|
544
|
+
}
|
545
|
+
});
|
546
|
+
|
547
|
+
this.add("brackets", "deletion", function (state, action, editor, session, range) {
|
548
|
+
var selected = session.doc.getTextRange(range);
|
549
|
+
if (!range.isMultiLine() && selected == '[') {
|
550
|
+
var line = session.doc.getLine(range.start.row);
|
551
|
+
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
552
|
+
if (rightChar == ']') {
|
553
|
+
range.end.column++;
|
554
|
+
return range;
|
555
|
+
}
|
556
|
+
}
|
557
|
+
});
|
558
|
+
|
559
|
+
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
560
|
+
if (text == '"' || text == "'") {
|
561
|
+
var quote = text;
|
562
|
+
var selection = editor.getSelectionRange();
|
563
|
+
var selected = session.doc.getTextRange(selection);
|
564
|
+
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
565
|
+
return {
|
566
|
+
text: quote + selected + quote,
|
567
|
+
selection: false
|
568
|
+
};
|
569
|
+
} else {
|
570
|
+
var cursor = editor.getCursorPosition();
|
571
|
+
var line = session.doc.getLine(cursor.row);
|
572
|
+
var leftChar = line.substring(cursor.column-1, cursor.column);
|
573
|
+
if (leftChar == '\\') {
|
574
|
+
return null;
|
575
|
+
}
|
576
|
+
var tokens = session.getTokens(selection.start.row);
|
577
|
+
var col = 0, token;
|
578
|
+
var quotepos = -1; // Track whether we're inside an open quote.
|
579
|
+
|
580
|
+
for (var x = 0; x < tokens.length; x++) {
|
581
|
+
token = tokens[x];
|
582
|
+
if (token.type == "string") {
|
583
|
+
quotepos = -1;
|
584
|
+
} else if (quotepos < 0) {
|
585
|
+
quotepos = token.value.indexOf(quote);
|
586
|
+
}
|
587
|
+
if ((token.value.length + col) > selection.start.column) {
|
588
|
+
break;
|
589
|
+
}
|
590
|
+
col += tokens[x].value.length;
|
591
|
+
}
|
592
|
+
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)))) {
|
593
|
+
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
594
|
+
return;
|
595
|
+
return {
|
596
|
+
text: quote + quote,
|
597
|
+
selection: [1,1]
|
598
|
+
};
|
599
|
+
} else if (token && token.type === "string") {
|
600
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
601
|
+
if (rightChar == quote) {
|
602
|
+
return {
|
603
|
+
text: '',
|
604
|
+
selection: [1, 1]
|
605
|
+
};
|
606
|
+
}
|
607
|
+
}
|
608
|
+
}
|
609
|
+
}
|
610
|
+
});
|
611
|
+
|
612
|
+
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
613
|
+
var selected = session.doc.getTextRange(range);
|
614
|
+
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
615
|
+
var line = session.doc.getLine(range.start.row);
|
616
|
+
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
617
|
+
if (rightChar == selected) {
|
618
|
+
range.end.column++;
|
619
|
+
return range;
|
620
|
+
}
|
621
|
+
}
|
622
|
+
});
|
623
|
+
|
624
|
+
};
|
625
|
+
|
626
|
+
oop.inherits(CstyleBehaviour, Behaviour);
|
627
|
+
|
628
|
+
exports.CstyleBehaviour = CstyleBehaviour;
|
629
|
+
});
|
630
|
+
|
631
|
+
define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
632
|
+
|
633
|
+
|
634
|
+
var Range = require("../range").Range;
|
635
|
+
|
636
|
+
var MatchingBraceOutdent = function() {};
|
637
|
+
|
638
|
+
(function() {
|
639
|
+
|
640
|
+
this.checkOutdent = function(line, input) {
|
641
|
+
if (! /^\s+$/.test(line))
|
642
|
+
return false;
|
643
|
+
|
644
|
+
return /^\s*\}/.test(input);
|
645
|
+
};
|
646
|
+
|
647
|
+
this.autoOutdent = function(doc, row) {
|
648
|
+
var line = doc.getLine(row);
|
649
|
+
var match = line.match(/^(\s*\})/);
|
650
|
+
|
651
|
+
if (!match) return 0;
|
652
|
+
|
653
|
+
var column = match[1].length;
|
654
|
+
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
655
|
+
|
656
|
+
if (!openBracePos || openBracePos.row == row) return 0;
|
657
|
+
|
658
|
+
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
659
|
+
doc.replace(new Range(row, 0, row, column-1), indent);
|
660
|
+
};
|
661
|
+
|
662
|
+
this.$getIndent = function(line) {
|
663
|
+
return line.match(/^\s*/)[0];
|
664
|
+
};
|
665
|
+
|
666
|
+
}).call(MatchingBraceOutdent.prototype);
|
667
|
+
|
668
|
+
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
669
|
+
});
|