datagram 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. data/.env.sample +7 -0
  2. data/.gitignore +20 -0
  3. data/.rbenv-version +1 -0
  4. data/Gemfile +12 -0
  5. data/LICENSE.txt +22 -0
  6. data/Procfile +1 -0
  7. data/README.md +29 -0
  8. data/Rakefile +1 -0
  9. data/config.ru +5 -0
  10. data/datagram.gemspec +23 -0
  11. data/db/migrate/1_create_queries.rb +9 -0
  12. data/db/migrate/2_add_name_to_queries.rb +5 -0
  13. data/lib/datagram/version.rb +3 -0
  14. data/lib/datagram.rb +135 -0
  15. data/lib/views/application.coffee +222 -0
  16. data/lib/views/index.haml +47 -0
  17. data/lib/views/layout.haml +17 -0
  18. data/lib/views/style.sass +179 -0
  19. data/public/ace/ace.js +15209 -0
  20. data/public/ace/ext-elastic_tabstops_lite.js +301 -0
  21. data/public/ace/ext-emmet.js +253 -0
  22. data/public/ace/ext-searchbox.js +441 -0
  23. data/public/ace/ext-spellcheck.js +67 -0
  24. data/public/ace/ext-static_highlight.js +96 -0
  25. data/public/ace/ext-textarea.js +492 -0
  26. data/public/ace/ext-whitespace.js +204 -0
  27. data/public/ace/keybinding-emacs.js +962 -0
  28. data/public/ace/keybinding-vim.js +1704 -0
  29. data/public/ace/mode-abap.js +260 -0
  30. data/public/ace/mode-asciidoc.js +372 -0
  31. data/public/ace/mode-c9search.js +182 -0
  32. data/public/ace/mode-c_cpp.js +737 -0
  33. data/public/ace/mode-clojure.js +299 -0
  34. data/public/ace/mode-coffee.js +426 -0
  35. data/public/ace/mode-coldfusion.js +1753 -0
  36. data/public/ace/mode-csharp.js +612 -0
  37. data/public/ace/mode-css.js +773 -0
  38. data/public/ace/mode-curly.js +1950 -0
  39. data/public/ace/mode-dart.js +945 -0
  40. data/public/ace/mode-diff.js +166 -0
  41. data/public/ace/mode-django.js +1969 -0
  42. data/public/ace/mode-dot.js +320 -0
  43. data/public/ace/mode-ftl.js +907 -0
  44. data/public/ace/mode-glsl.js +810 -0
  45. data/public/ace/mode-golang.js +632 -0
  46. data/public/ace/mode-groovy.js +1037 -0
  47. data/public/ace/mode-haml.js +487 -0
  48. data/public/ace/mode-haxe.js +609 -0
  49. data/public/ace/mode-html.js +1881 -0
  50. data/public/ace/mode-jade.js +1951 -0
  51. data/public/ace/mode-java.js +996 -0
  52. data/public/ace/mode-javascript.js +876 -0
  53. data/public/ace/mode-json.js +578 -0
  54. data/public/ace/mode-jsp.js +1351 -0
  55. data/public/ace/mode-jsx.js +635 -0
  56. data/public/ace/mode-latex.js +189 -0
  57. data/public/ace/mode-less.js +807 -0
  58. data/public/ace/mode-liquid.js +862 -0
  59. data/public/ace/mode-lisp.js +138 -0
  60. data/public/ace/mode-livescript.js +288 -0
  61. data/public/ace/mode-logiql.js +664 -0
  62. data/public/ace/mode-lsl.js +828 -0
  63. data/public/ace/mode-lua.js +455 -0
  64. data/public/ace/mode-luapage.js +2340 -0
  65. data/public/ace/mode-lucene.js +64 -0
  66. data/public/ace/mode-makefile.js +313 -0
  67. data/public/ace/mode-markdown.js +2280 -0
  68. data/public/ace/mode-mushcode.js +704 -0
  69. data/public/ace/mode-mushcode_high_rules.js +569 -0
  70. data/public/ace/mode-objectivec.js +659 -0
  71. data/public/ace/mode-ocaml.js +443 -0
  72. data/public/ace/mode-pascal.js +233 -0
  73. data/public/ace/mode-perl.js +316 -0
  74. data/public/ace/mode-pgsql.js +908 -0
  75. data/public/ace/mode-php.js +2291 -0
  76. data/public/ace/mode-powershell.js +618 -0
  77. data/public/ace/mode-python.js +264 -0
  78. data/public/ace/mode-r.js +404 -0
  79. data/public/ace/mode-rdoc.js +184 -0
  80. data/public/ace/mode-rhtml.js +2168 -0
  81. data/public/ace/mode-ruby.js +431 -0
  82. data/public/ace/mode-sass.js +442 -0
  83. data/public/ace/mode-scad.js +670 -0
  84. data/public/ace/mode-scala.js +1025 -0
  85. data/public/ace/mode-scheme.js +144 -0
  86. data/public/ace/mode-scss.js +832 -0
  87. data/public/ace/mode-sh.js +204 -0
  88. data/public/ace/mode-sql.js +118 -0
  89. data/public/ace/mode-stylus.js +483 -0
  90. data/public/ace/mode-svg.js +1442 -0
  91. data/public/ace/mode-tcl.js +319 -0
  92. data/public/ace/mode-tex.js +166 -0
  93. data/public/ace/mode-text.js +0 -0
  94. data/public/ace/mode-textile.js +170 -0
  95. data/public/ace/mode-tmsnippet.js +200 -0
  96. data/public/ace/mode-toml.js +180 -0
  97. data/public/ace/mode-typescript.js +961 -0
  98. data/public/ace/mode-vbscript.js +281 -0
  99. data/public/ace/mode-velocity.js +962 -0
  100. data/public/ace/mode-xml.js +789 -0
  101. data/public/ace/mode-xquery.js +2750 -0
  102. data/public/ace/mode-yaml.js +289 -0
  103. data/public/ace/theme-ambiance.js +202 -0
  104. data/public/ace/theme-chaos.js +182 -0
  105. data/public/ace/theme-chrome.js +161 -0
  106. data/public/ace/theme-clouds.js +135 -0
  107. data/public/ace/theme-clouds_midnight.js +136 -0
  108. data/public/ace/theme-cobalt.js +150 -0
  109. data/public/ace/theme-crimson_editor.js +154 -0
  110. data/public/ace/theme-dawn.js +146 -0
  111. data/public/ace/theme-dreamweaver.js +173 -0
  112. data/public/ace/theme-eclipse.js +122 -0
  113. data/public/ace/theme-github.js +136 -0
  114. data/public/ace/theme-idle_fingers.js +136 -0
  115. data/public/ace/theme-kr.js +143 -0
  116. data/public/ace/theme-merbivore.js +135 -0
  117. data/public/ace/theme-merbivore_soft.js +136 -0
  118. data/public/ace/theme-mono_industrial.js +148 -0
  119. data/public/ace/theme-monokai.js +140 -0
  120. data/public/ace/theme-pastel_on_dark.js +148 -0
  121. data/public/ace/theme-solarized_dark.js +128 -0
  122. data/public/ace/theme-solarized_light.js +131 -0
  123. data/public/ace/theme-terminal.js +154 -0
  124. data/public/ace/theme-textmate.js +0 -0
  125. data/public/ace/theme-tomorrow.js +147 -0
  126. data/public/ace/theme-tomorrow_night.js +147 -0
  127. data/public/ace/theme-tomorrow_night_blue.js +145 -0
  128. data/public/ace/theme-tomorrow_night_bright.js +147 -0
  129. data/public/ace/theme-tomorrow_night_eighties.js +144 -0
  130. data/public/ace/theme-twilight.js +147 -0
  131. data/public/ace/theme-vibrant_ink.js +131 -0
  132. data/public/ace/theme-xcode.js +125 -0
  133. data/public/ace/worker-coffee.js +7091 -0
  134. data/public/ace/worker-css.js +8289 -0
  135. data/public/ace/worker-javascript.js +6496 -0
  136. data/public/ace/worker-json.js +2305 -0
  137. data/public/ace/worker-lua.js +3313 -0
  138. data/public/ace/worker-php.js +6743 -0
  139. data/public/ace/worker-xquery.js +21897 -0
  140. data/public/font/FontAwesome.otf +0 -0
  141. data/public/font/fontawesome-webfont.eot +0 -0
  142. data/public/font/fontawesome-webfont.svg +284 -0
  143. data/public/font/fontawesome-webfont.ttf +0 -0
  144. data/public/font/fontawesome-webfont.woff +0 -0
  145. data/public/font-awesome.css +540 -0
  146. data/public/jquery.js +9597 -0
  147. data/script/migrate.sh +2 -0
  148. metadata +242 -0
@@ -0,0 +1,1351 @@
1
+ /* ***** BEGIN LICENSE BLOCK *****
2
+ * Distributed under the BSD license:
3
+ *
4
+ * Copyright (c) 2010, Ajax.org B.V.
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are met:
9
+ * * Redistributions of source code must retain the above copyright
10
+ * notice, this list of conditions and the following disclaimer.
11
+ * * Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following disclaimer in the
13
+ * documentation and/or other materials provided with the distribution.
14
+ * * Neither the name of Ajax.org B.V. nor the
15
+ * names of its contributors may be used to endorse or promote products
16
+ * derived from this software without specific prior written permission.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
22
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ *
29
+ * ***** END LICENSE BLOCK ***** */
30
+
31
+ define('ace/mode/jsp', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/jsp_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
32
+
33
+
34
+ var oop = require("../lib/oop");
35
+ var TextMode = require("./text").Mode;
36
+ var Tokenizer = require("../tokenizer").Tokenizer;
37
+ var JspHighlightRules = require("./jsp_highlight_rules").JspHighlightRules;
38
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
39
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
40
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
41
+
42
+ var Mode = function() {
43
+ var highlighter = new JspHighlightRules();
44
+ this.$tokenizer = new Tokenizer(highlighter.getRules());
45
+ this.$outdent = new MatchingBraceOutdent();
46
+ this.$behaviour = new CstyleBehaviour();
47
+ this.foldingRules = new CStyleFoldMode();
48
+ };
49
+ oop.inherits(Mode, TextMode);
50
+
51
+ (function() {
52
+
53
+ }).call(Mode.prototype);
54
+
55
+ exports.Mode = Mode;
56
+ });
57
+
58
+ define('ace/mode/jsp_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/html_highlight_rules', 'ace/mode/java_highlight_rules'], function(require, exports, module) {
59
+
60
+
61
+ var oop = require("../lib/oop");
62
+ var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
63
+ var JavaHighlightRules = require("./java_highlight_rules").JavaHighlightRules;
64
+
65
+ var JspHighlightRules = function() {
66
+ HtmlHighlightRules.call(this);
67
+ for (var i in this.$rules) {
68
+ this.$rules[i].unshift({
69
+ token : "meta.tag", // jsp open tag
70
+ regex : "<%@?|<%=?|<jsp:[^>]+>",
71
+ next : "jsp-start"
72
+ });
73
+ }
74
+
75
+ var builtinVariables = 'request|response|out|session|' +
76
+ 'application|config|pageContext|page|Exception';
77
+
78
+ var keywords = 'page|include|taglib';
79
+
80
+ this.embedRules(JavaHighlightRules, "jsp-");
81
+
82
+ this.$rules["start"].unshift({
83
+ token : "comment",
84
+ regex : "<%--",
85
+ next : "comment"
86
+ });
87
+
88
+ this.$rules["jsp-start"].unshift({
89
+ token : "meta.tag", // jsp close tag
90
+ regex : "%>|<\\/jsp:[^>]+>",
91
+ next : "start"
92
+ },
93
+ {
94
+ token: "variable.language",
95
+ regex : builtinVariables
96
+ }, {
97
+ token: "keyword",
98
+ regex : keywords
99
+ });
100
+
101
+ this.$rules.comment.unshift({
102
+ token : "comment",
103
+ regex : ".*?--%>",
104
+ next : "start"
105
+ });
106
+ };
107
+
108
+ oop.inherits(JspHighlightRules, HtmlHighlightRules);
109
+
110
+ exports.JspHighlightRules = JspHighlightRules;
111
+ });
112
+
113
+ define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
114
+
115
+
116
+ var oop = require("../lib/oop");
117
+ var lang = require("../lib/lang");
118
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
119
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
120
+ var xmlUtil = require("./xml_util");
121
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
122
+
123
+ var tagMap = lang.createMap({
124
+ a : 'anchor',
125
+ button : 'form',
126
+ form : 'form',
127
+ img : 'image',
128
+ input : 'form',
129
+ label : 'form',
130
+ script : 'script',
131
+ select : 'form',
132
+ textarea : 'form',
133
+ style : 'style',
134
+ table : 'table',
135
+ tbody : 'table',
136
+ td : 'table',
137
+ tfoot : 'table',
138
+ th : 'table',
139
+ tr : 'table'
140
+ });
141
+
142
+ var HtmlHighlightRules = function() {
143
+ this.$rules = {
144
+ start : [{
145
+ token : "text",
146
+ regex : "<\\!\\[CDATA\\[",
147
+ next : "cdata"
148
+ }, {
149
+ token : "xml-pe",
150
+ regex : "<\\?.*?\\?>"
151
+ }, {
152
+ token : "comment",
153
+ regex : "<\\!--",
154
+ next : "comment"
155
+ }, {
156
+ token : "xml-pe",
157
+ regex : "<\\!.*?>"
158
+ }, {
159
+ token : "meta.tag",
160
+ regex : "<(?=script\\b)",
161
+ next : "script"
162
+ }, {
163
+ token : "meta.tag",
164
+ regex : "<(?=style\\b)",
165
+ next : "style"
166
+ }, {
167
+ token : "meta.tag", // opening tag
168
+ regex : "<\\/?",
169
+ next : "tag"
170
+ }, {
171
+ token : "text",
172
+ regex : "\\s+"
173
+ }, {
174
+ token : "constant.character.entity",
175
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
176
+ }],
177
+
178
+ cdata : [ {
179
+ token : "text",
180
+ regex : "\\]\\]>",
181
+ next : "start"
182
+ } ],
183
+
184
+ comment : [ {
185
+ token : "comment",
186
+ regex : ".*?-->",
187
+ next : "start"
188
+ }, {
189
+ defaultToken : "comment"
190
+ } ]
191
+ };
192
+
193
+ xmlUtil.tag(this.$rules, "tag", "start", tagMap);
194
+ xmlUtil.tag(this.$rules, "style", "css-start", tagMap);
195
+ xmlUtil.tag(this.$rules, "script", "js-start", tagMap);
196
+
197
+ this.embedRules(JavaScriptHighlightRules, "js-", [{
198
+ token: "comment",
199
+ regex: "\\/\\/.*(?=<\\/script>)",
200
+ next: "tag"
201
+ }, {
202
+ token: "meta.tag",
203
+ regex: "<\\/(?=script)",
204
+ next: "tag"
205
+ }]);
206
+
207
+ this.embedRules(CssHighlightRules, "css-", [{
208
+ token: "meta.tag",
209
+ regex: "<\\/(?=style)",
210
+ next: "tag"
211
+ }]);
212
+ };
213
+
214
+ oop.inherits(HtmlHighlightRules, TextHighlightRules);
215
+
216
+ exports.HtmlHighlightRules = HtmlHighlightRules;
217
+ });
218
+
219
+ define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
220
+
221
+
222
+ var oop = require("../lib/oop");
223
+ var lang = require("../lib/lang");
224
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
225
+ var supportType = exports.supportType = "animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index";
226
+ var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
227
+ var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero";
228
+ var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
229
+ var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
230
+
231
+ var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
232
+ var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
233
+ var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
234
+
235
+ var CssHighlightRules = function() {
236
+
237
+ var keywordMapper = this.createKeywordMapper({
238
+ "support.function": supportFunction,
239
+ "support.constant": supportConstant,
240
+ "support.type": supportType,
241
+ "support.constant.color": supportConstantColor,
242
+ "support.constant.fonts": supportConstantFonts
243
+ }, "text", true);
244
+
245
+ var base_ruleset = [
246
+ {
247
+ token : "comment", // multi line comment
248
+ regex : "\\/\\*",
249
+ next : "ruleset_comment"
250
+ }, {
251
+ token : "string", // single line
252
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
253
+ }, {
254
+ token : "string", // single line
255
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
256
+ }, {
257
+ token : ["constant.numeric", "keyword"],
258
+ regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
259
+ }, {
260
+ token : "constant.numeric",
261
+ regex : numRe
262
+ }, {
263
+ token : "constant.numeric", // hex6 color
264
+ regex : "#[a-f0-9]{6}"
265
+ }, {
266
+ token : "constant.numeric", // hex3 color
267
+ regex : "#[a-f0-9]{3}"
268
+ }, {
269
+ token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
270
+ regex : pseudoElements
271
+ }, {
272
+ token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
273
+ regex : pseudoClasses
274
+ }, {
275
+ token : ["support.function", "string", "support.function"],
276
+ regex : "(url\\()(.*)(\\))"
277
+ }, {
278
+ token : keywordMapper,
279
+ regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
280
+ }, {
281
+ caseInsensitive: true
282
+ }
283
+ ];
284
+
285
+ var ruleset = lang.copyArray(base_ruleset);
286
+ ruleset.unshift({
287
+ token : "paren.rparen",
288
+ regex : "\\}",
289
+ next: "start"
290
+ });
291
+
292
+ var media_ruleset = lang.copyArray( base_ruleset );
293
+ media_ruleset.unshift({
294
+ token : "paren.rparen",
295
+ regex : "\\}",
296
+ next: "media"
297
+ });
298
+
299
+ var base_comment = [{
300
+ token : "comment", // comment spanning whole line
301
+ regex : ".+"
302
+ }];
303
+
304
+ var comment = lang.copyArray(base_comment);
305
+ comment.unshift({
306
+ token : "comment", // closing comment
307
+ regex : ".*?\\*\\/",
308
+ next : "start"
309
+ });
310
+
311
+ var media_comment = lang.copyArray(base_comment);
312
+ media_comment.unshift({
313
+ token : "comment", // closing comment
314
+ regex : ".*?\\*\\/",
315
+ next : "media"
316
+ });
317
+
318
+ var ruleset_comment = lang.copyArray(base_comment);
319
+ ruleset_comment.unshift({
320
+ token : "comment", // closing comment
321
+ regex : ".*?\\*\\/",
322
+ next : "ruleset"
323
+ });
324
+
325
+ this.$rules = {
326
+ "start" : [{
327
+ token : "comment", // multi line comment
328
+ regex : "\\/\\*",
329
+ next : "comment"
330
+ }, {
331
+ token: "paren.lparen",
332
+ regex: "\\{",
333
+ next: "ruleset"
334
+ }, {
335
+ token: "string",
336
+ regex: "@.*?{",
337
+ next: "media"
338
+ },{
339
+ token: "keyword",
340
+ regex: "#[a-z0-9-_]+"
341
+ },{
342
+ token: "variable",
343
+ regex: "\\.[a-z0-9-_]+"
344
+ },{
345
+ token: "string",
346
+ regex: ":[a-z0-9-_]+"
347
+ },{
348
+ token: "constant",
349
+ regex: "[a-z0-9-_]+"
350
+ },{
351
+ caseInsensitive: true
352
+ }],
353
+
354
+ "media" : [ {
355
+ token : "comment", // multi line comment
356
+ regex : "\\/\\*",
357
+ next : "media_comment"
358
+ }, {
359
+ token: "paren.lparen",
360
+ regex: "\\{",
361
+ next: "media_ruleset"
362
+ },{
363
+ token: "string",
364
+ regex: "\\}",
365
+ next: "start"
366
+ },{
367
+ token: "keyword",
368
+ regex: "#[a-z0-9-_]+"
369
+ },{
370
+ token: "variable",
371
+ regex: "\\.[a-z0-9-_]+"
372
+ },{
373
+ token: "string",
374
+ regex: ":[a-z0-9-_]+"
375
+ },{
376
+ token: "constant",
377
+ regex: "[a-z0-9-_]+"
378
+ },{
379
+ caseInsensitive: true
380
+ }],
381
+
382
+ "comment" : comment,
383
+
384
+ "ruleset" : ruleset,
385
+ "ruleset_comment" : ruleset_comment,
386
+
387
+ "media_ruleset" : media_ruleset,
388
+ "media_comment" : media_comment
389
+ };
390
+ };
391
+
392
+ oop.inherits(CssHighlightRules, TextHighlightRules);
393
+
394
+ exports.CssHighlightRules = CssHighlightRules;
395
+
396
+ });
397
+
398
+ define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
399
+
400
+
401
+ var oop = require("../lib/oop");
402
+ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
403
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
404
+
405
+ var JavaScriptHighlightRules = function() {
406
+ var keywordMapper = this.createKeywordMapper({
407
+ "variable.language":
408
+ "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
409
+ "Namespace|QName|XML|XMLList|" + // E4X
410
+ "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
411
+ "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
412
+ "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
413
+ "SyntaxError|TypeError|URIError|" +
414
+ "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
415
+ "isNaN|parseFloat|parseInt|" +
416
+ "JSON|Math|" + // Other
417
+ "this|arguments|prototype|window|document" , // Pseudo
418
+ "keyword":
419
+ "const|yield|import|get|set|" +
420
+ "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
421
+ "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
422
+ "__parent__|__count__|escape|unescape|with|__proto__|" +
423
+ "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
424
+ "storage.type":
425
+ "const|let|var|function",
426
+ "constant.language":
427
+ "null|Infinity|NaN|undefined",
428
+ "support.function":
429
+ "alert",
430
+ "constant.language.boolean": "true|false"
431
+ }, "identifier");
432
+ var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
433
+ var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
434
+
435
+ var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
436
+ "u[0-9a-fA-F]{4}|" + // unicode
437
+ "[0-2][0-7]{0,2}|" + // oct
438
+ "3[0-6][0-7]?|" + // oct
439
+ "37[0-7]?|" + // oct
440
+ "[4-7][0-7]?|" + //oct
441
+ ".)";
442
+
443
+ this.$rules = {
444
+ "no_regex" : [
445
+ {
446
+ token : "comment",
447
+ regex : /\/\/.*$/
448
+ },
449
+ DocCommentHighlightRules.getStartRule("doc-start"),
450
+ {
451
+ token : "comment", // multi line comment
452
+ regex : /\/\*/,
453
+ next : "comment"
454
+ }, {
455
+ token : "string",
456
+ regex : "'(?=.)",
457
+ next : "qstring"
458
+ }, {
459
+ token : "string",
460
+ regex : '"(?=.)',
461
+ next : "qqstring"
462
+ }, {
463
+ token : "constant.numeric", // hex
464
+ regex : /0[xX][0-9a-fA-F]+\b/
465
+ }, {
466
+ token : "constant.numeric", // float
467
+ regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
468
+ }, {
469
+ token : [
470
+ "storage.type", "punctuation.operator", "support.function",
471
+ "punctuation.operator", "entity.name.function", "text","keyword.operator"
472
+ ],
473
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
474
+ next: "function_arguments"
475
+ }, {
476
+ token : [
477
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
478
+ "keyword.operator", "text", "storage.type", "text", "paren.lparen"
479
+ ],
480
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
481
+ next: "function_arguments"
482
+ }, {
483
+ token : [
484
+ "entity.name.function", "text", "keyword.operator", "text", "storage.type",
485
+ "text", "paren.lparen"
486
+ ],
487
+ regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
488
+ next: "function_arguments"
489
+ }, {
490
+ token : [
491
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
492
+ "keyword.operator", "text",
493
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
494
+ ],
495
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
496
+ next: "function_arguments"
497
+ }, {
498
+ token : [
499
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
500
+ ],
501
+ regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
502
+ next: "function_arguments"
503
+ }, {
504
+ token : [
505
+ "entity.name.function", "text", "punctuation.operator",
506
+ "text", "storage.type", "text", "paren.lparen"
507
+ ],
508
+ regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
509
+ next: "function_arguments"
510
+ }, {
511
+ token : [
512
+ "text", "text", "storage.type", "text", "paren.lparen"
513
+ ],
514
+ regex : "(:)(\\s*)(function)(\\s*)(\\()",
515
+ next: "function_arguments"
516
+ }, {
517
+ token : "keyword",
518
+ regex : "(?:" + kwBeforeRe + ")\\b",
519
+ next : "start"
520
+ }, {
521
+ token : ["punctuation.operator", "support.function"],
522
+ regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
523
+ }, {
524
+ token : ["punctuation.operator", "support.function.dom"],
525
+ regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
526
+ }, {
527
+ token : ["punctuation.operator", "support.constant"],
528
+ regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
529
+ }, {
530
+ token : ["storage.type", "punctuation.operator", "support.function.firebug"],
531
+ regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
532
+ }, {
533
+ token : keywordMapper,
534
+ regex : identifierRe
535
+ }, {
536
+ token : "keyword.operator",
537
+ regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/,
538
+ next : "start"
539
+ }, {
540
+ token : "punctuation.operator",
541
+ regex : /\?|\:|\,|\;|\./,
542
+ next : "start"
543
+ }, {
544
+ token : "paren.lparen",
545
+ regex : /[\[({]/,
546
+ next : "start"
547
+ }, {
548
+ token : "paren.rparen",
549
+ regex : /[\])}]/
550
+ }, {
551
+ token : "keyword.operator",
552
+ regex : /\/=?/,
553
+ next : "start"
554
+ }, {
555
+ token: "comment",
556
+ regex: /^#!.*$/
557
+ }
558
+ ],
559
+ "start": [
560
+ DocCommentHighlightRules.getStartRule("doc-start"),
561
+ {
562
+ token : "comment", // multi line comment
563
+ regex : "\\/\\*",
564
+ next : "comment_regex_allowed"
565
+ }, {
566
+ token : "comment",
567
+ regex : "\\/\\/.*$",
568
+ next : "start"
569
+ }, {
570
+ token: "string.regexp",
571
+ regex: "\\/",
572
+ next: "regex"
573
+ }, {
574
+ token : "text",
575
+ regex : "\\s+|^$",
576
+ next : "start"
577
+ }, {
578
+ token: "empty",
579
+ regex: "",
580
+ next: "no_regex"
581
+ }
582
+ ],
583
+ "regex": [
584
+ {
585
+ token: "regexp.keyword.operator",
586
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
587
+ }, {
588
+ token: "string.regexp",
589
+ regex: "/\\w*",
590
+ next: "no_regex"
591
+ }, {
592
+ token : "invalid",
593
+ regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
594
+ }, {
595
+ token : "constant.language.escape",
596
+ regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/
597
+ }, {
598
+ token : "constant.language.delimiter",
599
+ regex: /\|/
600
+ }, {
601
+ token: "constant.language.escape",
602
+ regex: /\[\^?/,
603
+ next: "regex_character_class"
604
+ }, {
605
+ token: "empty",
606
+ regex: "$",
607
+ next: "no_regex"
608
+ }, {
609
+ defaultToken: "string.regexp"
610
+ }
611
+ ],
612
+ "regex_character_class": [
613
+ {
614
+ token: "regexp.keyword.operator",
615
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
616
+ }, {
617
+ token: "constant.language.escape",
618
+ regex: "]",
619
+ next: "regex"
620
+ }, {
621
+ token: "constant.language.escape",
622
+ regex: "-"
623
+ }, {
624
+ token: "empty",
625
+ regex: "$",
626
+ next: "no_regex"
627
+ }, {
628
+ defaultToken: "string.regexp.charachterclass"
629
+ }
630
+ ],
631
+ "function_arguments": [
632
+ {
633
+ token: "variable.parameter",
634
+ regex: identifierRe
635
+ }, {
636
+ token: "punctuation.operator",
637
+ regex: "[, ]+"
638
+ }, {
639
+ token: "punctuation.operator",
640
+ regex: "$"
641
+ }, {
642
+ token: "empty",
643
+ regex: "",
644
+ next: "no_regex"
645
+ }
646
+ ],
647
+ "comment_regex_allowed" : [
648
+ {token : "comment", regex : "\\*\\/", next : "start"},
649
+ {defaultToken : "comment"}
650
+ ],
651
+ "comment" : [
652
+ {token : "comment", regex : "\\*\\/", next : "no_regex"},
653
+ {defaultToken : "comment"}
654
+ ],
655
+ "qqstring" : [
656
+ {
657
+ token : "constant.language.escape",
658
+ regex : escapedRe
659
+ }, {
660
+ token : "string",
661
+ regex : "\\\\$",
662
+ next : "qqstring"
663
+ }, {
664
+ token : "string",
665
+ regex : '"|$',
666
+ next : "no_regex"
667
+ }, {
668
+ defaultToken: "string"
669
+ }
670
+ ],
671
+ "qstring" : [
672
+ {
673
+ token : "constant.language.escape",
674
+ regex : escapedRe
675
+ }, {
676
+ token : "string",
677
+ regex : "\\\\$",
678
+ next : "qstring"
679
+ }, {
680
+ token : "string",
681
+ regex : "'|$",
682
+ next : "no_regex"
683
+ }, {
684
+ defaultToken: "string"
685
+ }
686
+ ]
687
+ };
688
+
689
+ this.embedRules(DocCommentHighlightRules, "doc-",
690
+ [ DocCommentHighlightRules.getEndRule("no_regex") ]);
691
+ };
692
+
693
+ oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
694
+
695
+ exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
696
+ });
697
+
698
+ define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
699
+
700
+
701
+ var oop = require("../lib/oop");
702
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
703
+
704
+ var DocCommentHighlightRules = function() {
705
+
706
+ this.$rules = {
707
+ "start" : [ {
708
+ token : "comment.doc.tag",
709
+ regex : "@[\\w\\d_]+" // TODO: fix email addresses
710
+ }, {
711
+ token : "comment.doc.tag",
712
+ regex : "\\bTODO\\b"
713
+ }, {
714
+ defaultToken : "comment.doc"
715
+ }]
716
+ };
717
+ };
718
+
719
+ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
720
+
721
+ DocCommentHighlightRules.getStartRule = function(start) {
722
+ return {
723
+ token : "comment.doc", // doc comment
724
+ regex : "\\/\\*(?=\\*)",
725
+ next : start
726
+ };
727
+ };
728
+
729
+ DocCommentHighlightRules.getEndRule = function (start) {
730
+ return {
731
+ token : "comment.doc", // closing comment
732
+ regex : "\\*\\/",
733
+ next : start
734
+ };
735
+ };
736
+
737
+
738
+ exports.DocCommentHighlightRules = DocCommentHighlightRules;
739
+
740
+ });
741
+
742
+ define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) {
743
+
744
+
745
+ function string(state) {
746
+ return [{
747
+ token : "string",
748
+ regex : '"',
749
+ next : state + "_qqstring"
750
+ }, {
751
+ token : "string",
752
+ regex : "'",
753
+ next : state + "_qstring"
754
+ }];
755
+ }
756
+
757
+ function multiLineString(quote, state) {
758
+ return [
759
+ {token : "string", regex : quote, next : state},
760
+ {
761
+ token : "constant.language.escape",
762
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
763
+ },
764
+ {defaultToken : "string"}
765
+ ];
766
+ }
767
+
768
+ exports.tag = function(states, name, nextState, tagMap) {
769
+ states[name] = [{
770
+ token : "text",
771
+ regex : "\\s+"
772
+ }, {
773
+
774
+ token : !tagMap ? "meta.tag.tag-name" : function(value) {
775
+ if (tagMap[value])
776
+ return "meta.tag.tag-name." + tagMap[value];
777
+ else
778
+ return "meta.tag.tag-name";
779
+ },
780
+ regex : "[-_a-zA-Z0-9:]+",
781
+ next : name + "_embed_attribute_list"
782
+ }, {
783
+ token: "empty",
784
+ regex: "",
785
+ next : name + "_embed_attribute_list"
786
+ }];
787
+
788
+ states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
789
+ states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
790
+
791
+ states[name + "_embed_attribute_list"] = [{
792
+ token : "meta.tag.r",
793
+ regex : "/?>",
794
+ next : nextState
795
+ }, {
796
+ token : "keyword.operator",
797
+ regex : "="
798
+ }, {
799
+ token : "entity.other.attribute-name",
800
+ regex : "[-_a-zA-Z0-9:]+"
801
+ }, {
802
+ token : "constant.numeric", // float
803
+ regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
804
+ }, {
805
+ token : "text",
806
+ regex : "\\s+"
807
+ }].concat(string(name));
808
+ };
809
+
810
+ });
811
+ define('ace/mode/java_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
812
+
813
+
814
+ var oop = require("../lib/oop");
815
+ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
816
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
817
+
818
+ var JavaHighlightRules = function() {
819
+ var keywords = (
820
+ "abstract|continue|for|new|switch|" +
821
+ "assert|default|goto|package|synchronized|" +
822
+ "boolean|do|if|private|this|" +
823
+ "break|double|implements|protected|throw|" +
824
+ "byte|else|import|public|throws|" +
825
+ "case|enum|instanceof|return|transient|" +
826
+ "catch|extends|int|short|try|" +
827
+ "char|final|interface|static|void|" +
828
+ "class|finally|long|strictfp|volatile|" +
829
+ "const|float|native|super|while"
830
+ );
831
+
832
+ var buildinConstants = ("null|Infinity|NaN|undefined");
833
+
834
+
835
+ var langClasses = (
836
+ "AbstractMethodError|AssertionError|ClassCircularityError|"+
837
+ "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+
838
+ "ExceptionInInitializerError|IllegalAccessError|"+
839
+ "IllegalThreadStateException|InstantiationError|InternalError|"+
840
+ "NegativeArraySizeException|NoSuchFieldError|Override|Process|"+
841
+ "ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|"+
842
+ "SuppressWarnings|TypeNotPresentException|UnknownError|"+
843
+ "UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|"+
844
+ "InstantiationException|IndexOutOfBoundsException|"+
845
+ "ArrayIndexOutOfBoundsException|CloneNotSupportedException|"+
846
+ "NoSuchFieldException|IllegalArgumentException|NumberFormatException|"+
847
+ "SecurityException|Void|InheritableThreadLocal|IllegalStateException|"+
848
+ "InterruptedException|NoSuchMethodException|IllegalAccessException|"+
849
+ "UnsupportedOperationException|Enum|StrictMath|Package|Compiler|"+
850
+ "Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|"+
851
+ "NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|"+
852
+ "NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|"+
853
+ "Character|Boolean|StackTraceElement|Appendable|StringBuffer|"+
854
+ "Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|"+
855
+ "StackOverflowError|OutOfMemoryError|VirtualMachineError|"+
856
+ "ArrayStoreException|ClassCastException|LinkageError|"+
857
+ "NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+
858
+ "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+
859
+ "Cloneable|Class|CharSequence|Comparable|String|Object"
860
+ );
861
+
862
+ var keywordMapper = this.createKeywordMapper({
863
+ "variable.language": "this",
864
+ "keyword": keywords,
865
+ "constant.language": buildinConstants,
866
+ "support.function": langClasses
867
+ }, "identifier");
868
+
869
+ this.$rules = {
870
+ "start" : [
871
+ {
872
+ token : "comment",
873
+ regex : "\\/\\/.*$"
874
+ },
875
+ DocCommentHighlightRules.getStartRule("doc-start"),
876
+ {
877
+ token : "comment", // multi line comment
878
+ regex : "\\/\\*",
879
+ next : "comment"
880
+ }, {
881
+ token : "string.regexp",
882
+ regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
883
+ }, {
884
+ token : "string", // single line
885
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
886
+ }, {
887
+ token : "string", // single line
888
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
889
+ }, {
890
+ token : "constant.numeric", // hex
891
+ regex : "0[xX][0-9a-fA-F]+\\b"
892
+ }, {
893
+ token : "constant.numeric", // float
894
+ regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
895
+ }, {
896
+ token : "constant.language.boolean",
897
+ regex : "(?:true|false)\\b"
898
+ }, {
899
+ token : keywordMapper,
900
+ regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
901
+ }, {
902
+ token : "keyword.operator",
903
+ regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
904
+ }, {
905
+ token : "lparen",
906
+ regex : "[[({]"
907
+ }, {
908
+ token : "rparen",
909
+ regex : "[\\])}]"
910
+ }, {
911
+ token : "text",
912
+ regex : "\\s+"
913
+ }
914
+ ],
915
+ "comment" : [
916
+ {
917
+ token : "comment", // closing comment
918
+ regex : ".*?\\*\\/",
919
+ next : "start"
920
+ }, {
921
+ token : "comment", // comment spanning whole line
922
+ regex : ".+"
923
+ }
924
+ ]
925
+ };
926
+
927
+ this.embedRules(DocCommentHighlightRules, "doc-",
928
+ [ DocCommentHighlightRules.getEndRule("start") ]);
929
+ };
930
+
931
+ oop.inherits(JavaHighlightRules, TextHighlightRules);
932
+
933
+ exports.JavaHighlightRules = JavaHighlightRules;
934
+ });
935
+
936
+ define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
937
+
938
+
939
+ var Range = require("../range").Range;
940
+
941
+ var MatchingBraceOutdent = function() {};
942
+
943
+ (function() {
944
+
945
+ this.checkOutdent = function(line, input) {
946
+ if (! /^\s+$/.test(line))
947
+ return false;
948
+
949
+ return /^\s*\}/.test(input);
950
+ };
951
+
952
+ this.autoOutdent = function(doc, row) {
953
+ var line = doc.getLine(row);
954
+ var match = line.match(/^(\s*\})/);
955
+
956
+ if (!match) return 0;
957
+
958
+ var column = match[1].length;
959
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
960
+
961
+ if (!openBracePos || openBracePos.row == row) return 0;
962
+
963
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
964
+ doc.replace(new Range(row, 0, row, column-1), indent);
965
+ };
966
+
967
+ this.$getIndent = function(line) {
968
+ return line.match(/^\s*/)[0];
969
+ };
970
+
971
+ }).call(MatchingBraceOutdent.prototype);
972
+
973
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
974
+ });
975
+
976
+ define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
977
+
978
+
979
+ var oop = require("../../lib/oop");
980
+ var Behaviour = require("../behaviour").Behaviour;
981
+ var TokenIterator = require("../../token_iterator").TokenIterator;
982
+ var lang = require("../../lib/lang");
983
+
984
+ var SAFE_INSERT_IN_TOKENS =
985
+ ["text", "paren.rparen", "punctuation.operator"];
986
+ var SAFE_INSERT_BEFORE_TOKENS =
987
+ ["text", "paren.rparen", "punctuation.operator", "comment"];
988
+
989
+
990
+ var autoInsertedBrackets = 0;
991
+ var autoInsertedRow = -1;
992
+ var autoInsertedLineEnd = "";
993
+ var maybeInsertedBrackets = 0;
994
+ var maybeInsertedRow = -1;
995
+ var maybeInsertedLineStart = "";
996
+ var maybeInsertedLineEnd = "";
997
+
998
+ var CstyleBehaviour = function () {
999
+
1000
+ CstyleBehaviour.isSaneInsertion = function(editor, session) {
1001
+ var cursor = editor.getCursorPosition();
1002
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1003
+ if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
1004
+ var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
1005
+ if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
1006
+ return false;
1007
+ }
1008
+ iterator.stepForward();
1009
+ return iterator.getCurrentTokenRow() !== cursor.row ||
1010
+ this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
1011
+ };
1012
+
1013
+ CstyleBehaviour.$matchTokenType = function(token, types) {
1014
+ return types.indexOf(token.type || token) > -1;
1015
+ };
1016
+
1017
+ CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
1018
+ var cursor = editor.getCursorPosition();
1019
+ var line = session.doc.getLine(cursor.row);
1020
+ if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
1021
+ autoInsertedBrackets = 0;
1022
+ autoInsertedRow = cursor.row;
1023
+ autoInsertedLineEnd = bracket + line.substr(cursor.column);
1024
+ autoInsertedBrackets++;
1025
+ };
1026
+
1027
+ CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
1028
+ var cursor = editor.getCursorPosition();
1029
+ var line = session.doc.getLine(cursor.row);
1030
+ if (!this.isMaybeInsertedClosing(cursor, line))
1031
+ maybeInsertedBrackets = 0;
1032
+ maybeInsertedRow = cursor.row;
1033
+ maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
1034
+ maybeInsertedLineEnd = line.substr(cursor.column);
1035
+ maybeInsertedBrackets++;
1036
+ };
1037
+
1038
+ CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
1039
+ return autoInsertedBrackets > 0 &&
1040
+ cursor.row === autoInsertedRow &&
1041
+ bracket === autoInsertedLineEnd[0] &&
1042
+ line.substr(cursor.column) === autoInsertedLineEnd;
1043
+ };
1044
+
1045
+ CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
1046
+ return maybeInsertedBrackets > 0 &&
1047
+ cursor.row === maybeInsertedRow &&
1048
+ line.substr(cursor.column) === maybeInsertedLineEnd &&
1049
+ line.substr(0, cursor.column) == maybeInsertedLineStart;
1050
+ };
1051
+
1052
+ CstyleBehaviour.popAutoInsertedClosing = function() {
1053
+ autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
1054
+ autoInsertedBrackets--;
1055
+ };
1056
+
1057
+ CstyleBehaviour.clearMaybeInsertedClosing = function() {
1058
+ maybeInsertedBrackets = 0;
1059
+ maybeInsertedRow = -1;
1060
+ };
1061
+
1062
+ this.add("braces", "insertion", function (state, action, editor, session, text) {
1063
+ var cursor = editor.getCursorPosition();
1064
+ var line = session.doc.getLine(cursor.row);
1065
+ if (text == '{') {
1066
+ var selection = editor.getSelectionRange();
1067
+ var selected = session.doc.getTextRange(selection);
1068
+ if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
1069
+ return {
1070
+ text: '{' + selected + '}',
1071
+ selection: false
1072
+ };
1073
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
1074
+ if (/[\]\}\)]/.test(line[cursor.column])) {
1075
+ CstyleBehaviour.recordAutoInsert(editor, session, "}");
1076
+ return {
1077
+ text: '{}',
1078
+ selection: [1, 1]
1079
+ };
1080
+ } else {
1081
+ CstyleBehaviour.recordMaybeInsert(editor, session, "{");
1082
+ return {
1083
+ text: '{',
1084
+ selection: [1, 1]
1085
+ };
1086
+ }
1087
+ }
1088
+ } else if (text == '}') {
1089
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1090
+ if (rightChar == '}') {
1091
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
1092
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
1093
+ CstyleBehaviour.popAutoInsertedClosing();
1094
+ return {
1095
+ text: '',
1096
+ selection: [1, 1]
1097
+ };
1098
+ }
1099
+ }
1100
+ } else if (text == "\n" || text == "\r\n") {
1101
+ var closing = "";
1102
+ if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
1103
+ closing = lang.stringRepeat("}", maybeInsertedBrackets);
1104
+ CstyleBehaviour.clearMaybeInsertedClosing();
1105
+ }
1106
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1107
+ if (rightChar == '}' || closing !== "") {
1108
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
1109
+ if (!openBracePos)
1110
+ return null;
1111
+
1112
+ var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
1113
+ var next_indent = this.$getIndent(line);
1114
+
1115
+ return {
1116
+ text: '\n' + indent + '\n' + next_indent + closing,
1117
+ selection: [1, indent.length, 1, indent.length]
1118
+ };
1119
+ }
1120
+ }
1121
+ });
1122
+
1123
+ this.add("braces", "deletion", function (state, action, editor, session, range) {
1124
+ var selected = session.doc.getTextRange(range);
1125
+ if (!range.isMultiLine() && selected == '{') {
1126
+ var line = session.doc.getLine(range.start.row);
1127
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
1128
+ if (rightChar == '}') {
1129
+ range.end.column++;
1130
+ return range;
1131
+ } else {
1132
+ maybeInsertedBrackets--;
1133
+ }
1134
+ }
1135
+ });
1136
+
1137
+ this.add("parens", "insertion", function (state, action, editor, session, text) {
1138
+ if (text == '(') {
1139
+ var selection = editor.getSelectionRange();
1140
+ var selected = session.doc.getTextRange(selection);
1141
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
1142
+ return {
1143
+ text: '(' + selected + ')',
1144
+ selection: false
1145
+ };
1146
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
1147
+ CstyleBehaviour.recordAutoInsert(editor, session, ")");
1148
+ return {
1149
+ text: '()',
1150
+ selection: [1, 1]
1151
+ };
1152
+ }
1153
+ } else if (text == ')') {
1154
+ var cursor = editor.getCursorPosition();
1155
+ var line = session.doc.getLine(cursor.row);
1156
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1157
+ if (rightChar == ')') {
1158
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
1159
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
1160
+ CstyleBehaviour.popAutoInsertedClosing();
1161
+ return {
1162
+ text: '',
1163
+ selection: [1, 1]
1164
+ };
1165
+ }
1166
+ }
1167
+ }
1168
+ });
1169
+
1170
+ this.add("parens", "deletion", function (state, action, editor, session, range) {
1171
+ var selected = session.doc.getTextRange(range);
1172
+ if (!range.isMultiLine() && selected == '(') {
1173
+ var line = session.doc.getLine(range.start.row);
1174
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
1175
+ if (rightChar == ')') {
1176
+ range.end.column++;
1177
+ return range;
1178
+ }
1179
+ }
1180
+ });
1181
+
1182
+ this.add("brackets", "insertion", function (state, action, editor, session, text) {
1183
+ if (text == '[') {
1184
+ var selection = editor.getSelectionRange();
1185
+ var selected = session.doc.getTextRange(selection);
1186
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
1187
+ return {
1188
+ text: '[' + selected + ']',
1189
+ selection: false
1190
+ };
1191
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
1192
+ CstyleBehaviour.recordAutoInsert(editor, session, "]");
1193
+ return {
1194
+ text: '[]',
1195
+ selection: [1, 1]
1196
+ };
1197
+ }
1198
+ } else if (text == ']') {
1199
+ var cursor = editor.getCursorPosition();
1200
+ var line = session.doc.getLine(cursor.row);
1201
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1202
+ if (rightChar == ']') {
1203
+ var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
1204
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
1205
+ CstyleBehaviour.popAutoInsertedClosing();
1206
+ return {
1207
+ text: '',
1208
+ selection: [1, 1]
1209
+ };
1210
+ }
1211
+ }
1212
+ }
1213
+ });
1214
+
1215
+ this.add("brackets", "deletion", function (state, action, editor, session, range) {
1216
+ var selected = session.doc.getTextRange(range);
1217
+ if (!range.isMultiLine() && selected == '[') {
1218
+ var line = session.doc.getLine(range.start.row);
1219
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
1220
+ if (rightChar == ']') {
1221
+ range.end.column++;
1222
+ return range;
1223
+ }
1224
+ }
1225
+ });
1226
+
1227
+ this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
1228
+ if (text == '"' || text == "'") {
1229
+ var quote = text;
1230
+ var selection = editor.getSelectionRange();
1231
+ var selected = session.doc.getTextRange(selection);
1232
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
1233
+ return {
1234
+ text: quote + selected + quote,
1235
+ selection: false
1236
+ };
1237
+ } else {
1238
+ var cursor = editor.getCursorPosition();
1239
+ var line = session.doc.getLine(cursor.row);
1240
+ var leftChar = line.substring(cursor.column-1, cursor.column);
1241
+ if (leftChar == '\\') {
1242
+ return null;
1243
+ }
1244
+ var tokens = session.getTokens(selection.start.row);
1245
+ var col = 0, token;
1246
+ var quotepos = -1; // Track whether we're inside an open quote.
1247
+
1248
+ for (var x = 0; x < tokens.length; x++) {
1249
+ token = tokens[x];
1250
+ if (token.type == "string") {
1251
+ quotepos = -1;
1252
+ } else if (quotepos < 0) {
1253
+ quotepos = token.value.indexOf(quote);
1254
+ }
1255
+ if ((token.value.length + col) > selection.start.column) {
1256
+ break;
1257
+ }
1258
+ col += tokens[x].value.length;
1259
+ }
1260
+ 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)))) {
1261
+ if (!CstyleBehaviour.isSaneInsertion(editor, session))
1262
+ return;
1263
+ return {
1264
+ text: quote + quote,
1265
+ selection: [1,1]
1266
+ };
1267
+ } else if (token && token.type === "string") {
1268
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1269
+ if (rightChar == quote) {
1270
+ return {
1271
+ text: '',
1272
+ selection: [1, 1]
1273
+ };
1274
+ }
1275
+ }
1276
+ }
1277
+ }
1278
+ });
1279
+
1280
+ this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
1281
+ var selected = session.doc.getTextRange(range);
1282
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
1283
+ var line = session.doc.getLine(range.start.row);
1284
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
1285
+ if (rightChar == selected) {
1286
+ range.end.column++;
1287
+ return range;
1288
+ }
1289
+ }
1290
+ });
1291
+
1292
+ };
1293
+
1294
+ oop.inherits(CstyleBehaviour, Behaviour);
1295
+
1296
+ exports.CstyleBehaviour = CstyleBehaviour;
1297
+ });
1298
+
1299
+ define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
1300
+
1301
+
1302
+ var oop = require("../../lib/oop");
1303
+ var Range = require("../../range").Range;
1304
+ var BaseFoldMode = require("./fold_mode").FoldMode;
1305
+
1306
+ var FoldMode = exports.FoldMode = function(commentRegex) {
1307
+ if (commentRegex) {
1308
+ this.foldingStartMarker = new RegExp(
1309
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
1310
+ );
1311
+ this.foldingStopMarker = new RegExp(
1312
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
1313
+ );
1314
+ }
1315
+ };
1316
+ oop.inherits(FoldMode, BaseFoldMode);
1317
+
1318
+ (function() {
1319
+
1320
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
1321
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
1322
+
1323
+ this.getFoldWidgetRange = function(session, foldStyle, row) {
1324
+ var line = session.getLine(row);
1325
+ var match = line.match(this.foldingStartMarker);
1326
+ if (match) {
1327
+ var i = match.index;
1328
+
1329
+ if (match[1])
1330
+ return this.openingBracketBlock(session, match[1], row, i);
1331
+
1332
+ return session.getCommentFoldRange(row, i + match[0].length, 1);
1333
+ }
1334
+
1335
+ if (foldStyle !== "markbeginend")
1336
+ return;
1337
+
1338
+ var match = line.match(this.foldingStopMarker);
1339
+ if (match) {
1340
+ var i = match.index + match[0].length;
1341
+
1342
+ if (match[1])
1343
+ return this.closingBracketBlock(session, match[1], row, i);
1344
+
1345
+ return session.getCommentFoldRange(row, i, -1);
1346
+ }
1347
+ };
1348
+
1349
+ }).call(FoldMode.prototype);
1350
+
1351
+ });