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,885 @@
|
|
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
|
+
* Contributor(s):
|
31
|
+
*
|
32
|
+
* Zef Hemel
|
33
|
+
*
|
34
|
+
* ***** END LICENSE BLOCK ***** */
|
35
|
+
|
36
|
+
define('ace/mode/protobuf', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/c_cpp', 'ace/tokenizer', 'ace/mode/protobuf_highlight_rules', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
37
|
+
|
38
|
+
|
39
|
+
var oop = require("../lib/oop");
|
40
|
+
var CMode = require("./c_cpp").Mode;
|
41
|
+
var Tokenizer = require("../tokenizer").Tokenizer;
|
42
|
+
var ProtobufHighlightRules = require("./protobuf_highlight_rules").ProtobufHighlightRules;
|
43
|
+
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
44
|
+
|
45
|
+
var Mode = function() {
|
46
|
+
CMode.call(this);
|
47
|
+
var highlighter = new ProtobufHighlightRules();
|
48
|
+
this.foldingRules = new CStyleFoldMode();
|
49
|
+
|
50
|
+
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
51
|
+
this.$keywordList = highlighter.$keywordList;
|
52
|
+
};
|
53
|
+
oop.inherits(Mode, CMode);
|
54
|
+
|
55
|
+
(function() {
|
56
|
+
this.lineCommentStart = "//";
|
57
|
+
this.blockComment = {start: "/*", end: "*/"};
|
58
|
+
this.$id = "ace/mode/protobuf";
|
59
|
+
}).call(Mode.prototype);
|
60
|
+
|
61
|
+
exports.Mode = Mode;
|
62
|
+
});
|
63
|
+
|
64
|
+
define('ace/mode/c_cpp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/c_cpp_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
65
|
+
|
66
|
+
|
67
|
+
var oop = require("../lib/oop");
|
68
|
+
var TextMode = require("./text").Mode;
|
69
|
+
var Tokenizer = require("../tokenizer").Tokenizer;
|
70
|
+
var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
|
71
|
+
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
72
|
+
var Range = require("../range").Range;
|
73
|
+
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
74
|
+
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
75
|
+
|
76
|
+
var Mode = function() {
|
77
|
+
this.HighlightRules = c_cppHighlightRules;
|
78
|
+
|
79
|
+
this.$outdent = new MatchingBraceOutdent();
|
80
|
+
this.$behaviour = new CstyleBehaviour();
|
81
|
+
|
82
|
+
this.foldingRules = new CStyleFoldMode();
|
83
|
+
};
|
84
|
+
oop.inherits(Mode, TextMode);
|
85
|
+
|
86
|
+
(function() {
|
87
|
+
|
88
|
+
this.lineCommentStart = "//";
|
89
|
+
this.blockComment = {start: "/*", end: "*/"};
|
90
|
+
|
91
|
+
this.getNextLineIndent = function(state, line, tab) {
|
92
|
+
var indent = this.$getIndent(line);
|
93
|
+
|
94
|
+
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
95
|
+
var tokens = tokenizedLine.tokens;
|
96
|
+
var endState = tokenizedLine.state;
|
97
|
+
|
98
|
+
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
99
|
+
return indent;
|
100
|
+
}
|
101
|
+
|
102
|
+
if (state == "start") {
|
103
|
+
var match = line.match(/^.*[\{\(\[]\s*$/);
|
104
|
+
if (match) {
|
105
|
+
indent += tab;
|
106
|
+
}
|
107
|
+
} else if (state == "doc-start") {
|
108
|
+
if (endState == "start") {
|
109
|
+
return "";
|
110
|
+
}
|
111
|
+
var match = line.match(/^\s*(\/?)\*/);
|
112
|
+
if (match) {
|
113
|
+
if (match[1]) {
|
114
|
+
indent += " ";
|
115
|
+
}
|
116
|
+
indent += "* ";
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
return indent;
|
121
|
+
};
|
122
|
+
|
123
|
+
this.checkOutdent = function(state, line, input) {
|
124
|
+
return this.$outdent.checkOutdent(line, input);
|
125
|
+
};
|
126
|
+
|
127
|
+
this.autoOutdent = function(state, doc, row) {
|
128
|
+
this.$outdent.autoOutdent(doc, row);
|
129
|
+
};
|
130
|
+
|
131
|
+
this.$id = "ace/mode/c_cpp";
|
132
|
+
}).call(Mode.prototype);
|
133
|
+
|
134
|
+
exports.Mode = Mode;
|
135
|
+
});
|
136
|
+
define('ace/mode/c_cpp_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
137
|
+
|
138
|
+
|
139
|
+
var oop = require("../lib/oop");
|
140
|
+
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
141
|
+
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
142
|
+
var cFunctions = exports.cFunctions = "\\s*\\bhypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len)))\\b"
|
143
|
+
|
144
|
+
var c_cppHighlightRules = function() {
|
145
|
+
|
146
|
+
var keywordControls = (
|
147
|
+
"break|case|continue|default|do|else|for|goto|if|_Pragma|" +
|
148
|
+
"return|switch|while|catch|operator|try|throw|using"
|
149
|
+
);
|
150
|
+
|
151
|
+
var storageType = (
|
152
|
+
"asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" +
|
153
|
+
"_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" +
|
154
|
+
"class|wchar_t|template"
|
155
|
+
);
|
156
|
+
|
157
|
+
var storageModifiers = (
|
158
|
+
"const|extern|register|restrict|static|volatile|inline|private:|" +
|
159
|
+
"protected:|public:|friend|explicit|virtual|export|mutable|typename"
|
160
|
+
);
|
161
|
+
|
162
|
+
var keywordOperators = (
|
163
|
+
"and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq" +
|
164
|
+
"const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace"
|
165
|
+
);
|
166
|
+
|
167
|
+
var builtinConstants = (
|
168
|
+
"NULL|true|false|TRUE|FALSE"
|
169
|
+
);
|
170
|
+
|
171
|
+
var keywordMapper = this.$keywords = this.createKeywordMapper({
|
172
|
+
"keyword.control" : keywordControls,
|
173
|
+
"storage.type" : storageType,
|
174
|
+
"storage.modifier" : storageModifiers,
|
175
|
+
"keyword.operator" : keywordOperators,
|
176
|
+
"variable.language": "this",
|
177
|
+
"constant.language": builtinConstants
|
178
|
+
}, "identifier");
|
179
|
+
|
180
|
+
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b";
|
181
|
+
|
182
|
+
this.$rules = {
|
183
|
+
"start" : [
|
184
|
+
{
|
185
|
+
token : "comment",
|
186
|
+
regex : "\\/\\/.*$"
|
187
|
+
},
|
188
|
+
DocCommentHighlightRules.getStartRule("doc-start"),
|
189
|
+
{
|
190
|
+
token : "comment", // multi line comment
|
191
|
+
regex : "\\/\\*",
|
192
|
+
next : "comment"
|
193
|
+
}, {
|
194
|
+
token : "string", // single line
|
195
|
+
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
196
|
+
}, {
|
197
|
+
token : "string", // multi line string start
|
198
|
+
regex : '["].*\\\\$',
|
199
|
+
next : "qqstring"
|
200
|
+
}, {
|
201
|
+
token : "string", // single line
|
202
|
+
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
203
|
+
}, {
|
204
|
+
token : "string", // multi line string start
|
205
|
+
regex : "['].*\\\\$",
|
206
|
+
next : "qstring"
|
207
|
+
}, {
|
208
|
+
token : "constant.numeric", // hex
|
209
|
+
regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
|
210
|
+
}, {
|
211
|
+
token : "constant.numeric", // float
|
212
|
+
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
|
213
|
+
}, {
|
214
|
+
token : "keyword", // pre-compiler directives
|
215
|
+
regex : "#\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\b",
|
216
|
+
next : "directive"
|
217
|
+
}, {
|
218
|
+
token : "keyword", // special case pre-compiler directive
|
219
|
+
regex : "(?:#\\s*endif)\\b"
|
220
|
+
}, {
|
221
|
+
token : "support.function.C99.c",
|
222
|
+
regex : cFunctions
|
223
|
+
}, {
|
224
|
+
token : keywordMapper,
|
225
|
+
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
226
|
+
}, {
|
227
|
+
token : "keyword.operator",
|
228
|
+
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"
|
229
|
+
}, {
|
230
|
+
token : "punctuation.operator",
|
231
|
+
regex : "\\?|\\:|\\,|\\;|\\."
|
232
|
+
}, {
|
233
|
+
token : "paren.lparen",
|
234
|
+
regex : "[[({]"
|
235
|
+
}, {
|
236
|
+
token : "paren.rparen",
|
237
|
+
regex : "[\\])}]"
|
238
|
+
}, {
|
239
|
+
token : "text",
|
240
|
+
regex : "\\s+"
|
241
|
+
}
|
242
|
+
],
|
243
|
+
"comment" : [
|
244
|
+
{
|
245
|
+
token : "comment", // closing comment
|
246
|
+
regex : ".*?\\*\\/",
|
247
|
+
next : "start"
|
248
|
+
}, {
|
249
|
+
token : "comment", // comment spanning whole line
|
250
|
+
regex : ".+"
|
251
|
+
}
|
252
|
+
],
|
253
|
+
"qqstring" : [
|
254
|
+
{
|
255
|
+
token : "string",
|
256
|
+
regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
|
257
|
+
next : "start"
|
258
|
+
}, {
|
259
|
+
token : "string",
|
260
|
+
regex : '.+'
|
261
|
+
}
|
262
|
+
],
|
263
|
+
"qstring" : [
|
264
|
+
{
|
265
|
+
token : "string",
|
266
|
+
regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
|
267
|
+
next : "start"
|
268
|
+
}, {
|
269
|
+
token : "string",
|
270
|
+
regex : '.+'
|
271
|
+
}
|
272
|
+
],
|
273
|
+
"directive" : [
|
274
|
+
{
|
275
|
+
token : "constant.other.multiline",
|
276
|
+
regex : /\\/
|
277
|
+
},
|
278
|
+
{
|
279
|
+
token : "constant.other.multiline",
|
280
|
+
regex : /.*\\/
|
281
|
+
},
|
282
|
+
{
|
283
|
+
token : "constant.other",
|
284
|
+
regex : "\\s*<.+?>",
|
285
|
+
next : "start"
|
286
|
+
},
|
287
|
+
{
|
288
|
+
token : "constant.other", // single line
|
289
|
+
regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]',
|
290
|
+
next : "start"
|
291
|
+
},
|
292
|
+
{
|
293
|
+
token : "constant.other", // single line
|
294
|
+
regex : "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']",
|
295
|
+
next : "start"
|
296
|
+
},
|
297
|
+
{
|
298
|
+
token : "constant.other",
|
299
|
+
regex : /[^\\\/]+/,
|
300
|
+
next : "start"
|
301
|
+
}
|
302
|
+
]
|
303
|
+
};
|
304
|
+
|
305
|
+
this.embedRules(DocCommentHighlightRules, "doc-",
|
306
|
+
[ DocCommentHighlightRules.getEndRule("start") ]);
|
307
|
+
};
|
308
|
+
|
309
|
+
oop.inherits(c_cppHighlightRules, TextHighlightRules);
|
310
|
+
|
311
|
+
exports.c_cppHighlightRules = c_cppHighlightRules;
|
312
|
+
});
|
313
|
+
|
314
|
+
define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
315
|
+
|
316
|
+
|
317
|
+
var oop = require("../lib/oop");
|
318
|
+
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
319
|
+
|
320
|
+
var DocCommentHighlightRules = function() {
|
321
|
+
|
322
|
+
this.$rules = {
|
323
|
+
"start" : [ {
|
324
|
+
token : "comment.doc.tag",
|
325
|
+
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
326
|
+
}, {
|
327
|
+
token : "comment.doc.tag",
|
328
|
+
regex : "\\bTODO\\b"
|
329
|
+
}, {
|
330
|
+
defaultToken : "comment.doc"
|
331
|
+
}]
|
332
|
+
};
|
333
|
+
};
|
334
|
+
|
335
|
+
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
336
|
+
|
337
|
+
DocCommentHighlightRules.getStartRule = function(start) {
|
338
|
+
return {
|
339
|
+
token : "comment.doc", // doc comment
|
340
|
+
regex : "\\/\\*(?=\\*)",
|
341
|
+
next : start
|
342
|
+
};
|
343
|
+
};
|
344
|
+
|
345
|
+
DocCommentHighlightRules.getEndRule = function (start) {
|
346
|
+
return {
|
347
|
+
token : "comment.doc", // closing comment
|
348
|
+
regex : "\\*\\/",
|
349
|
+
next : start
|
350
|
+
};
|
351
|
+
};
|
352
|
+
|
353
|
+
|
354
|
+
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
355
|
+
|
356
|
+
});
|
357
|
+
|
358
|
+
define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
359
|
+
|
360
|
+
|
361
|
+
var Range = require("../range").Range;
|
362
|
+
|
363
|
+
var MatchingBraceOutdent = function() {};
|
364
|
+
|
365
|
+
(function() {
|
366
|
+
|
367
|
+
this.checkOutdent = function(line, input) {
|
368
|
+
if (! /^\s+$/.test(line))
|
369
|
+
return false;
|
370
|
+
|
371
|
+
return /^\s*\}/.test(input);
|
372
|
+
};
|
373
|
+
|
374
|
+
this.autoOutdent = function(doc, row) {
|
375
|
+
var line = doc.getLine(row);
|
376
|
+
var match = line.match(/^(\s*\})/);
|
377
|
+
|
378
|
+
if (!match) return 0;
|
379
|
+
|
380
|
+
var column = match[1].length;
|
381
|
+
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
382
|
+
|
383
|
+
if (!openBracePos || openBracePos.row == row) return 0;
|
384
|
+
|
385
|
+
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
386
|
+
doc.replace(new Range(row, 0, row, column-1), indent);
|
387
|
+
};
|
388
|
+
|
389
|
+
this.$getIndent = function(line) {
|
390
|
+
return line.match(/^\s*/)[0];
|
391
|
+
};
|
392
|
+
|
393
|
+
}).call(MatchingBraceOutdent.prototype);
|
394
|
+
|
395
|
+
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
396
|
+
});
|
397
|
+
|
398
|
+
define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
|
399
|
+
|
400
|
+
|
401
|
+
var oop = require("../../lib/oop");
|
402
|
+
var Behaviour = require("../behaviour").Behaviour;
|
403
|
+
var TokenIterator = require("../../token_iterator").TokenIterator;
|
404
|
+
var lang = require("../../lib/lang");
|
405
|
+
|
406
|
+
var SAFE_INSERT_IN_TOKENS =
|
407
|
+
["text", "paren.rparen", "punctuation.operator"];
|
408
|
+
var SAFE_INSERT_BEFORE_TOKENS =
|
409
|
+
["text", "paren.rparen", "punctuation.operator", "comment"];
|
410
|
+
|
411
|
+
|
412
|
+
var autoInsertedBrackets = 0;
|
413
|
+
var autoInsertedRow = -1;
|
414
|
+
var autoInsertedLineEnd = "";
|
415
|
+
var maybeInsertedBrackets = 0;
|
416
|
+
var maybeInsertedRow = -1;
|
417
|
+
var maybeInsertedLineStart = "";
|
418
|
+
var maybeInsertedLineEnd = "";
|
419
|
+
|
420
|
+
var CstyleBehaviour = function () {
|
421
|
+
|
422
|
+
CstyleBehaviour.isSaneInsertion = function(editor, session) {
|
423
|
+
var cursor = editor.getCursorPosition();
|
424
|
+
var iterator = new TokenIterator(session, cursor.row, cursor.column);
|
425
|
+
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
|
426
|
+
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
|
427
|
+
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
|
428
|
+
return false;
|
429
|
+
}
|
430
|
+
iterator.stepForward();
|
431
|
+
return iterator.getCurrentTokenRow() !== cursor.row ||
|
432
|
+
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
|
433
|
+
};
|
434
|
+
|
435
|
+
CstyleBehaviour.$matchTokenType = function(token, types) {
|
436
|
+
return types.indexOf(token.type || token) > -1;
|
437
|
+
};
|
438
|
+
|
439
|
+
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
|
440
|
+
var cursor = editor.getCursorPosition();
|
441
|
+
var line = session.doc.getLine(cursor.row);
|
442
|
+
if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
|
443
|
+
autoInsertedBrackets = 0;
|
444
|
+
autoInsertedRow = cursor.row;
|
445
|
+
autoInsertedLineEnd = bracket + line.substr(cursor.column);
|
446
|
+
autoInsertedBrackets++;
|
447
|
+
};
|
448
|
+
|
449
|
+
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
|
450
|
+
var cursor = editor.getCursorPosition();
|
451
|
+
var line = session.doc.getLine(cursor.row);
|
452
|
+
if (!this.isMaybeInsertedClosing(cursor, line))
|
453
|
+
maybeInsertedBrackets = 0;
|
454
|
+
maybeInsertedRow = cursor.row;
|
455
|
+
maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
|
456
|
+
maybeInsertedLineEnd = line.substr(cursor.column);
|
457
|
+
maybeInsertedBrackets++;
|
458
|
+
};
|
459
|
+
|
460
|
+
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
|
461
|
+
return autoInsertedBrackets > 0 &&
|
462
|
+
cursor.row === autoInsertedRow &&
|
463
|
+
bracket === autoInsertedLineEnd[0] &&
|
464
|
+
line.substr(cursor.column) === autoInsertedLineEnd;
|
465
|
+
};
|
466
|
+
|
467
|
+
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
|
468
|
+
return maybeInsertedBrackets > 0 &&
|
469
|
+
cursor.row === maybeInsertedRow &&
|
470
|
+
line.substr(cursor.column) === maybeInsertedLineEnd &&
|
471
|
+
line.substr(0, cursor.column) == maybeInsertedLineStart;
|
472
|
+
};
|
473
|
+
|
474
|
+
CstyleBehaviour.popAutoInsertedClosing = function() {
|
475
|
+
autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
|
476
|
+
autoInsertedBrackets--;
|
477
|
+
};
|
478
|
+
|
479
|
+
CstyleBehaviour.clearMaybeInsertedClosing = function() {
|
480
|
+
maybeInsertedBrackets = 0;
|
481
|
+
maybeInsertedRow = -1;
|
482
|
+
};
|
483
|
+
|
484
|
+
this.add("braces", "insertion", function (state, action, editor, session, text) {
|
485
|
+
var cursor = editor.getCursorPosition();
|
486
|
+
var line = session.doc.getLine(cursor.row);
|
487
|
+
if (text == '{') {
|
488
|
+
var selection = editor.getSelectionRange();
|
489
|
+
var selected = session.doc.getTextRange(selection);
|
490
|
+
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
|
491
|
+
return {
|
492
|
+
text: '{' + selected + '}',
|
493
|
+
selection: false
|
494
|
+
};
|
495
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
496
|
+
if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
|
497
|
+
CstyleBehaviour.recordAutoInsert(editor, session, "}");
|
498
|
+
return {
|
499
|
+
text: '{}',
|
500
|
+
selection: [1, 1]
|
501
|
+
};
|
502
|
+
} else {
|
503
|
+
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
|
504
|
+
return {
|
505
|
+
text: '{',
|
506
|
+
selection: [1, 1]
|
507
|
+
};
|
508
|
+
}
|
509
|
+
}
|
510
|
+
} else if (text == '}') {
|
511
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
512
|
+
if (rightChar == '}') {
|
513
|
+
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
|
514
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
515
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
516
|
+
return {
|
517
|
+
text: '',
|
518
|
+
selection: [1, 1]
|
519
|
+
};
|
520
|
+
}
|
521
|
+
}
|
522
|
+
} else if (text == "\n" || text == "\r\n") {
|
523
|
+
var closing = "";
|
524
|
+
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
|
525
|
+
closing = lang.stringRepeat("}", maybeInsertedBrackets);
|
526
|
+
CstyleBehaviour.clearMaybeInsertedClosing();
|
527
|
+
}
|
528
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
529
|
+
if (rightChar === '}') {
|
530
|
+
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
|
531
|
+
if (!openBracePos)
|
532
|
+
return null;
|
533
|
+
var next_indent = this.$getIndent(session.getLine(openBracePos.row));
|
534
|
+
} else if (closing) {
|
535
|
+
var next_indent = this.$getIndent(line);
|
536
|
+
} else {
|
537
|
+
return;
|
538
|
+
}
|
539
|
+
var indent = next_indent + session.getTabString();
|
540
|
+
|
541
|
+
return {
|
542
|
+
text: '\n' + indent + '\n' + next_indent + closing,
|
543
|
+
selection: [1, indent.length, 1, indent.length]
|
544
|
+
};
|
545
|
+
} else {
|
546
|
+
CstyleBehaviour.clearMaybeInsertedClosing();
|
547
|
+
}
|
548
|
+
});
|
549
|
+
|
550
|
+
this.add("braces", "deletion", function (state, action, editor, session, range) {
|
551
|
+
var selected = session.doc.getTextRange(range);
|
552
|
+
if (!range.isMultiLine() && selected == '{') {
|
553
|
+
var line = session.doc.getLine(range.start.row);
|
554
|
+
var rightChar = line.substring(range.end.column, range.end.column + 1);
|
555
|
+
if (rightChar == '}') {
|
556
|
+
range.end.column++;
|
557
|
+
return range;
|
558
|
+
} else {
|
559
|
+
maybeInsertedBrackets--;
|
560
|
+
}
|
561
|
+
}
|
562
|
+
});
|
563
|
+
|
564
|
+
this.add("parens", "insertion", function (state, action, editor, session, text) {
|
565
|
+
if (text == '(') {
|
566
|
+
var selection = editor.getSelectionRange();
|
567
|
+
var selected = session.doc.getTextRange(selection);
|
568
|
+
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
569
|
+
return {
|
570
|
+
text: '(' + selected + ')',
|
571
|
+
selection: false
|
572
|
+
};
|
573
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
574
|
+
CstyleBehaviour.recordAutoInsert(editor, session, ")");
|
575
|
+
return {
|
576
|
+
text: '()',
|
577
|
+
selection: [1, 1]
|
578
|
+
};
|
579
|
+
}
|
580
|
+
} else if (text == ')') {
|
581
|
+
var cursor = editor.getCursorPosition();
|
582
|
+
var line = session.doc.getLine(cursor.row);
|
583
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
584
|
+
if (rightChar == ')') {
|
585
|
+
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
|
586
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
587
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
588
|
+
return {
|
589
|
+
text: '',
|
590
|
+
selection: [1, 1]
|
591
|
+
};
|
592
|
+
}
|
593
|
+
}
|
594
|
+
}
|
595
|
+
});
|
596
|
+
|
597
|
+
this.add("parens", "deletion", function (state, action, editor, session, range) {
|
598
|
+
var selected = session.doc.getTextRange(range);
|
599
|
+
if (!range.isMultiLine() && selected == '(') {
|
600
|
+
var line = session.doc.getLine(range.start.row);
|
601
|
+
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
602
|
+
if (rightChar == ')') {
|
603
|
+
range.end.column++;
|
604
|
+
return range;
|
605
|
+
}
|
606
|
+
}
|
607
|
+
});
|
608
|
+
|
609
|
+
this.add("brackets", "insertion", function (state, action, editor, session, text) {
|
610
|
+
if (text == '[') {
|
611
|
+
var selection = editor.getSelectionRange();
|
612
|
+
var selected = session.doc.getTextRange(selection);
|
613
|
+
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
|
614
|
+
return {
|
615
|
+
text: '[' + selected + ']',
|
616
|
+
selection: false
|
617
|
+
};
|
618
|
+
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
|
619
|
+
CstyleBehaviour.recordAutoInsert(editor, session, "]");
|
620
|
+
return {
|
621
|
+
text: '[]',
|
622
|
+
selection: [1, 1]
|
623
|
+
};
|
624
|
+
}
|
625
|
+
} else if (text == ']') {
|
626
|
+
var cursor = editor.getCursorPosition();
|
627
|
+
var line = session.doc.getLine(cursor.row);
|
628
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
629
|
+
if (rightChar == ']') {
|
630
|
+
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
|
631
|
+
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
|
632
|
+
CstyleBehaviour.popAutoInsertedClosing();
|
633
|
+
return {
|
634
|
+
text: '',
|
635
|
+
selection: [1, 1]
|
636
|
+
};
|
637
|
+
}
|
638
|
+
}
|
639
|
+
}
|
640
|
+
});
|
641
|
+
|
642
|
+
this.add("brackets", "deletion", function (state, action, editor, session, range) {
|
643
|
+
var selected = session.doc.getTextRange(range);
|
644
|
+
if (!range.isMultiLine() && selected == '[') {
|
645
|
+
var line = session.doc.getLine(range.start.row);
|
646
|
+
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
647
|
+
if (rightChar == ']') {
|
648
|
+
range.end.column++;
|
649
|
+
return range;
|
650
|
+
}
|
651
|
+
}
|
652
|
+
});
|
653
|
+
|
654
|
+
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
655
|
+
if (text == '"' || text == "'") {
|
656
|
+
var quote = text;
|
657
|
+
var selection = editor.getSelectionRange();
|
658
|
+
var selected = session.doc.getTextRange(selection);
|
659
|
+
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
|
660
|
+
return {
|
661
|
+
text: quote + selected + quote,
|
662
|
+
selection: false
|
663
|
+
};
|
664
|
+
} else {
|
665
|
+
var cursor = editor.getCursorPosition();
|
666
|
+
var line = session.doc.getLine(cursor.row);
|
667
|
+
var leftChar = line.substring(cursor.column-1, cursor.column);
|
668
|
+
if (leftChar == '\\') {
|
669
|
+
return null;
|
670
|
+
}
|
671
|
+
var tokens = session.getTokens(selection.start.row);
|
672
|
+
var col = 0, token;
|
673
|
+
var quotepos = -1; // Track whether we're inside an open quote.
|
674
|
+
|
675
|
+
for (var x = 0; x < tokens.length; x++) {
|
676
|
+
token = tokens[x];
|
677
|
+
if (token.type == "string") {
|
678
|
+
quotepos = -1;
|
679
|
+
} else if (quotepos < 0) {
|
680
|
+
quotepos = token.value.indexOf(quote);
|
681
|
+
}
|
682
|
+
if ((token.value.length + col) > selection.start.column) {
|
683
|
+
break;
|
684
|
+
}
|
685
|
+
col += tokens[x].value.length;
|
686
|
+
}
|
687
|
+
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)))) {
|
688
|
+
if (!CstyleBehaviour.isSaneInsertion(editor, session))
|
689
|
+
return;
|
690
|
+
return {
|
691
|
+
text: quote + quote,
|
692
|
+
selection: [1,1]
|
693
|
+
};
|
694
|
+
} else if (token && token.type === "string") {
|
695
|
+
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
696
|
+
if (rightChar == quote) {
|
697
|
+
return {
|
698
|
+
text: '',
|
699
|
+
selection: [1, 1]
|
700
|
+
};
|
701
|
+
}
|
702
|
+
}
|
703
|
+
}
|
704
|
+
}
|
705
|
+
});
|
706
|
+
|
707
|
+
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
708
|
+
var selected = session.doc.getTextRange(range);
|
709
|
+
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
710
|
+
var line = session.doc.getLine(range.start.row);
|
711
|
+
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
712
|
+
if (rightChar == selected) {
|
713
|
+
range.end.column++;
|
714
|
+
return range;
|
715
|
+
}
|
716
|
+
}
|
717
|
+
});
|
718
|
+
|
719
|
+
};
|
720
|
+
|
721
|
+
oop.inherits(CstyleBehaviour, Behaviour);
|
722
|
+
|
723
|
+
exports.CstyleBehaviour = CstyleBehaviour;
|
724
|
+
});
|
725
|
+
|
726
|
+
define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
727
|
+
|
728
|
+
|
729
|
+
var oop = require("../../lib/oop");
|
730
|
+
var Range = require("../../range").Range;
|
731
|
+
var BaseFoldMode = require("./fold_mode").FoldMode;
|
732
|
+
|
733
|
+
var FoldMode = exports.FoldMode = function(commentRegex) {
|
734
|
+
if (commentRegex) {
|
735
|
+
this.foldingStartMarker = new RegExp(
|
736
|
+
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
|
737
|
+
);
|
738
|
+
this.foldingStopMarker = new RegExp(
|
739
|
+
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
|
740
|
+
);
|
741
|
+
}
|
742
|
+
};
|
743
|
+
oop.inherits(FoldMode, BaseFoldMode);
|
744
|
+
|
745
|
+
(function() {
|
746
|
+
|
747
|
+
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
748
|
+
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
749
|
+
|
750
|
+
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
|
751
|
+
var line = session.getLine(row);
|
752
|
+
var match = line.match(this.foldingStartMarker);
|
753
|
+
if (match) {
|
754
|
+
var i = match.index;
|
755
|
+
|
756
|
+
if (match[1])
|
757
|
+
return this.openingBracketBlock(session, match[1], row, i);
|
758
|
+
|
759
|
+
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
760
|
+
|
761
|
+
if (range && !range.isMultiLine()) {
|
762
|
+
if (forceMultiline) {
|
763
|
+
range = this.getSectionRange(session, row);
|
764
|
+
} else if (foldStyle != "all")
|
765
|
+
range = null;
|
766
|
+
}
|
767
|
+
|
768
|
+
return range;
|
769
|
+
}
|
770
|
+
|
771
|
+
if (foldStyle === "markbegin")
|
772
|
+
return;
|
773
|
+
|
774
|
+
var match = line.match(this.foldingStopMarker);
|
775
|
+
if (match) {
|
776
|
+
var i = match.index + match[0].length;
|
777
|
+
|
778
|
+
if (match[1])
|
779
|
+
return this.closingBracketBlock(session, match[1], row, i);
|
780
|
+
|
781
|
+
return session.getCommentFoldRange(row, i, -1);
|
782
|
+
}
|
783
|
+
};
|
784
|
+
|
785
|
+
this.getSectionRange = function(session, row) {
|
786
|
+
var line = session.getLine(row);
|
787
|
+
var startIndent = line.search(/\S/);
|
788
|
+
var startRow = row;
|
789
|
+
var startColumn = line.length;
|
790
|
+
row = row + 1;
|
791
|
+
var endRow = row;
|
792
|
+
var maxRow = session.getLength();
|
793
|
+
while (++row < maxRow) {
|
794
|
+
line = session.getLine(row);
|
795
|
+
var indent = line.search(/\S/);
|
796
|
+
if (indent === -1)
|
797
|
+
continue;
|
798
|
+
if (startIndent > indent)
|
799
|
+
break;
|
800
|
+
var subRange = this.getFoldWidgetRange(session, "all", row);
|
801
|
+
|
802
|
+
if (subRange) {
|
803
|
+
if (subRange.start.row <= startRow) {
|
804
|
+
break;
|
805
|
+
} else if (subRange.isMultiLine()) {
|
806
|
+
row = subRange.end.row;
|
807
|
+
} else if (startIndent == indent) {
|
808
|
+
break;
|
809
|
+
}
|
810
|
+
}
|
811
|
+
endRow = row;
|
812
|
+
}
|
813
|
+
|
814
|
+
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
|
815
|
+
};
|
816
|
+
|
817
|
+
}).call(FoldMode.prototype);
|
818
|
+
|
819
|
+
});
|
820
|
+
define('ace/mode/protobuf_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
821
|
+
|
822
|
+
|
823
|
+
var oop = require("../lib/oop");
|
824
|
+
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
825
|
+
|
826
|
+
var ProtobufHighlightRules = function() {
|
827
|
+
|
828
|
+
var builtinTypes = "double|float|int32|int64|uint32|uint64|sint32|" +
|
829
|
+
"sint64|fixed32|fixed64|sfixed32|sfixed64|bool|" +
|
830
|
+
"string|bytes";
|
831
|
+
var keywordDeclaration = "message|required|optional|repeated|package|" +
|
832
|
+
"import|option|enum";
|
833
|
+
|
834
|
+
var keywordMapper = this.createKeywordMapper({
|
835
|
+
"keyword.declaration.protobuf": keywordDeclaration,
|
836
|
+
"support.type": builtinTypes
|
837
|
+
}, "identifier");
|
838
|
+
|
839
|
+
this.$rules = {
|
840
|
+
"start": [{
|
841
|
+
token: "comment",
|
842
|
+
regex: /\/\/.*$/
|
843
|
+
}, {
|
844
|
+
token: "comment",
|
845
|
+
regex: /\/\*/,
|
846
|
+
next: "comment"
|
847
|
+
}, {
|
848
|
+
token: "constant",
|
849
|
+
regex: "<[^>]+>"
|
850
|
+
}, {
|
851
|
+
regex: "=",
|
852
|
+
token: "keyword.operator.assignment.protobuf"
|
853
|
+
}, {
|
854
|
+
token : "string", // single line
|
855
|
+
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
856
|
+
}, {
|
857
|
+
token : "string", // single line
|
858
|
+
regex : '[\'](?:(?:\\\\.)|(?:[^\'\\\\]))*?[\']'
|
859
|
+
}, {
|
860
|
+
token: "constant.numeric", // hex
|
861
|
+
regex: "0[xX][0-9a-fA-F]+\\b"
|
862
|
+
}, {
|
863
|
+
token: "constant.numeric", // float
|
864
|
+
regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
865
|
+
}, {
|
866
|
+
token: keywordMapper,
|
867
|
+
regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
868
|
+
}],
|
869
|
+
"comment": [{
|
870
|
+
token: "comment", // closing comment
|
871
|
+
regex: ".*?\\*\\/",
|
872
|
+
next: "start"
|
873
|
+
}, {
|
874
|
+
token: "comment", // comment spanning whole line
|
875
|
+
regex: ".+"
|
876
|
+
}]
|
877
|
+
};
|
878
|
+
|
879
|
+
this.normalizeRules();
|
880
|
+
};
|
881
|
+
|
882
|
+
oop.inherits(ProtobufHighlightRules, TextHighlightRules);
|
883
|
+
|
884
|
+
exports.ProtobufHighlightRules = ProtobufHighlightRules;
|
885
|
+
});
|