/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk

« back to all changes in this revision

Viewing changes to codeigniter/js/ace/mode-markdown.js

  • Committer: Gustav Hartvigsson
  • Date: 2013-04-05 15:54:35 UTC
  • mfrom: (19.1.4 lenasys)
  • Revision ID: gustav.hartvigsson@gmail.com-20130405155435-lf76rf1vwcacin4p
Merged from implementation group 1's team branch into trunk, 20130405 end of
day.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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/markdown', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/javascript', 'ace/mode/xml', 'ace/mode/html', 'ace/tokenizer', 'ace/mode/markdown_highlight_rules', 'ace/mode/folding/markdown'], function(require, exports, module) {
32
 
 
33
 
 
34
 
var oop = require("../lib/oop");
35
 
var TextMode = require("./text").Mode;
36
 
var JavaScriptMode = require("./javascript").Mode;
37
 
var XmlMode = require("./xml").Mode;
38
 
var HtmlMode = require("./html").Mode;
39
 
var Tokenizer = require("../tokenizer").Tokenizer;
40
 
var MarkdownHighlightRules = require("./markdown_highlight_rules").MarkdownHighlightRules;
41
 
var MarkdownFoldMode = require("./folding/markdown").FoldMode;
42
 
 
43
 
var Mode = function() {
44
 
    var highlighter = new MarkdownHighlightRules();
45
 
    
46
 
    this.$tokenizer = new Tokenizer(highlighter.getRules());
47
 
    this.$embeds = highlighter.getEmbeds();
48
 
    this.createModeDelegates({
49
 
      "js-": JavaScriptMode,
50
 
      "xml-": XmlMode,
51
 
      "html-": HtmlMode
52
 
    });
53
 
    
54
 
    this.foldingRules = new MarkdownFoldMode();
55
 
};
56
 
oop.inherits(Mode, TextMode);
57
 
 
58
 
(function() {
59
 
   
60
 
    this.lineCommentStart = ">";
61
 
    
62
 
    this.getNextLineIndent = function(state, line, tab) {
63
 
        if (state == "listblock") {
64
 
            var match = /^(\s*)(?:([-+*])|(\d+)\.)(\s+)/.exec(line);
65
 
            if (!match)
66
 
                return "";
67
 
            var marker = match[2];
68
 
            if (!marker)
69
 
                marker = parseInt(match[3], 10) + 1 + ".";
70
 
            return match[1] + marker + match[4];
71
 
        } else {
72
 
            return this.$getIndent(line);
73
 
        }
74
 
    };
75
 
}).call(Mode.prototype);
76
 
 
77
 
exports.Mode = Mode;
78
 
});
79
 
 
80
 
define('ace/mode/javascript', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/javascript_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/worker/worker_client', 'ace/mode/behaviour/cstyle', 'ace/mode/folding/cstyle'], function(require, exports, module) {
81
 
 
82
 
 
83
 
var oop = require("../lib/oop");
84
 
var TextMode = require("./text").Mode;
85
 
var Tokenizer = require("../tokenizer").Tokenizer;
86
 
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
87
 
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
88
 
var Range = require("../range").Range;
89
 
var WorkerClient = require("../worker/worker_client").WorkerClient;
90
 
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
91
 
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
92
 
 
93
 
var Mode = function() {
94
 
    this.$tokenizer = new Tokenizer(new JavaScriptHighlightRules().getRules());
95
 
    this.$outdent = new MatchingBraceOutdent();
96
 
    this.$behaviour = new CstyleBehaviour();
97
 
    this.foldingRules = new CStyleFoldMode();
98
 
};
99
 
oop.inherits(Mode, TextMode);
100
 
 
101
 
(function() {
102
 
 
103
 
    this.lineCommentStart = "//";
104
 
    this.blockComment = {start: "/*", end: "*/"};
105
 
 
106
 
    this.getNextLineIndent = function(state, line, tab) {
107
 
        var indent = this.$getIndent(line);
108
 
 
109
 
        var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
110
 
        var tokens = tokenizedLine.tokens;
111
 
        var endState = tokenizedLine.state;
112
 
 
113
 
        if (tokens.length && tokens[tokens.length-1].type == "comment") {
114
 
            return indent;
115
 
        }
116
 
 
117
 
        if (state == "start" || state == "no_regex") {
118
 
            var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
119
 
            if (match) {
120
 
                indent += tab;
121
 
            }
122
 
        } else if (state == "doc-start") {
123
 
            if (endState == "start" || endState == "no_regex") {
124
 
                return "";
125
 
            }
126
 
            var match = line.match(/^\s*(\/?)\*/);
127
 
            if (match) {
128
 
                if (match[1]) {
129
 
                    indent += " ";
130
 
                }
131
 
                indent += "* ";
132
 
            }
133
 
        }
134
 
 
135
 
        return indent;
136
 
    };
137
 
 
138
 
    this.checkOutdent = function(state, line, input) {
139
 
        return this.$outdent.checkOutdent(line, input);
140
 
    };
141
 
 
142
 
    this.autoOutdent = function(state, doc, row) {
143
 
        this.$outdent.autoOutdent(doc, row);
144
 
    };
145
 
 
146
 
    this.createWorker = function(session) {
147
 
        var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
148
 
        worker.attachToDocument(session.getDocument());
149
 
 
150
 
        worker.on("jslint", function(results) {
151
 
            session.setAnnotations(results.data);
152
 
        });
153
 
 
154
 
        worker.on("terminate", function() {
155
 
            session.clearAnnotations();
156
 
        });
157
 
 
158
 
        return worker;
159
 
    };
160
 
 
161
 
}).call(Mode.prototype);
162
 
 
163
 
exports.Mode = Mode;
164
 
});
165
 
 
166
 
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) {
167
 
 
168
 
 
169
 
var oop = require("../lib/oop");
170
 
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
171
 
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
172
 
 
173
 
var JavaScriptHighlightRules = function() {
174
 
    var keywordMapper = this.createKeywordMapper({
175
 
        "variable.language":
176
 
            "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|"  + // Constructors
177
 
            "Namespace|QName|XML|XMLList|"                                             + // E4X
178
 
            "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|"   +
179
 
            "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|"                    +
180
 
            "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|"   + // Errors
181
 
            "SyntaxError|TypeError|URIError|"                                          +
182
 
            "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
183
 
            "isNaN|parseFloat|parseInt|"                                               +
184
 
            "JSON|Math|"                                                               + // Other
185
 
            "this|arguments|prototype|window|document"                                 , // Pseudo
186
 
        "keyword":
187
 
            "const|yield|import|get|set|" +
188
 
            "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
189
 
            "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
190
 
            "__parent__|__count__|escape|unescape|with|__proto__|" +
191
 
            "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
192
 
        "storage.type":
193
 
            "const|let|var|function",
194
 
        "constant.language":
195
 
            "null|Infinity|NaN|undefined",
196
 
        "support.function":
197
 
            "alert",
198
 
        "constant.language.boolean": "true|false"
199
 
    }, "identifier");
200
 
    var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
201
 
    var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
202
 
 
203
 
    var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
204
 
        "u[0-9a-fA-F]{4}|" + // unicode
205
 
        "[0-2][0-7]{0,2}|" + // oct
206
 
        "3[0-6][0-7]?|" + // oct
207
 
        "37[0-7]?|" + // oct
208
 
        "[4-7][0-7]?|" + //oct
209
 
        ".)";
210
 
 
211
 
    this.$rules = {
212
 
        "no_regex" : [
213
 
            {
214
 
                token : "comment",
215
 
                regex : /\/\/.*$/
216
 
            },
217
 
            DocCommentHighlightRules.getStartRule("doc-start"),
218
 
            {
219
 
                token : "comment", // multi line comment
220
 
                regex : /\/\*/,
221
 
                next : "comment"
222
 
            }, {
223
 
                token : "string",
224
 
                regex : "'(?=.)",
225
 
                next  : "qstring"
226
 
            }, {
227
 
                token : "string",
228
 
                regex : '"(?=.)',
229
 
                next  : "qqstring"
230
 
            }, {
231
 
                token : "constant.numeric", // hex
232
 
                regex : /0[xX][0-9a-fA-F]+\b/
233
 
            }, {
234
 
                token : "constant.numeric", // float
235
 
                regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
236
 
            }, {
237
 
                token : [
238
 
                    "storage.type", "punctuation.operator", "support.function",
239
 
                    "punctuation.operator", "entity.name.function", "text","keyword.operator"
240
 
                ],
241
 
                regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
242
 
                next: "function_arguments"
243
 
            }, {
244
 
                token : [
245
 
                    "storage.type", "punctuation.operator", "entity.name.function", "text",
246
 
                    "keyword.operator", "text", "storage.type", "text", "paren.lparen"
247
 
                ],
248
 
                regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
249
 
                next: "function_arguments"
250
 
            }, {
251
 
                token : [
252
 
                    "entity.name.function", "text", "keyword.operator", "text", "storage.type",
253
 
                    "text", "paren.lparen"
254
 
                ],
255
 
                regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
256
 
                next: "function_arguments"
257
 
            }, {
258
 
                token : [
259
 
                    "storage.type", "punctuation.operator", "entity.name.function", "text",
260
 
                    "keyword.operator", "text",
261
 
                    "storage.type", "text", "entity.name.function", "text", "paren.lparen"
262
 
                ],
263
 
                regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
264
 
                next: "function_arguments"
265
 
            }, {
266
 
                token : [
267
 
                    "storage.type", "text", "entity.name.function", "text", "paren.lparen"
268
 
                ],
269
 
                regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
270
 
                next: "function_arguments"
271
 
            }, {
272
 
                token : [
273
 
                    "entity.name.function", "text", "punctuation.operator",
274
 
                    "text", "storage.type", "text", "paren.lparen"
275
 
                ],
276
 
                regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
277
 
                next: "function_arguments"
278
 
            }, {
279
 
                token : [
280
 
                    "text", "text", "storage.type", "text", "paren.lparen"
281
 
                ],
282
 
                regex : "(:)(\\s*)(function)(\\s*)(\\()",
283
 
                next: "function_arguments"
284
 
            }, {
285
 
                token : "keyword",
286
 
                regex : "(?:" + kwBeforeRe + ")\\b",
287
 
                next : "start"
288
 
            }, {
289
 
                token : ["punctuation.operator", "support.function"],
290
 
                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(?=\()/
291
 
            }, {
292
 
                token : ["punctuation.operator", "support.function.dom"],
293
 
                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(?=\()/
294
 
            }, {
295
 
                token : ["punctuation.operator", "support.constant"],
296
 
                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/
297
 
            }, {
298
 
                token : ["storage.type", "punctuation.operator", "support.function.firebug"],
299
 
                regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
300
 
            }, {
301
 
                token : keywordMapper,
302
 
                regex : identifierRe
303
 
            }, {
304
 
                token : "keyword.operator",
305
 
                regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/,
306
 
                next  : "start"
307
 
            }, {
308
 
                token : "punctuation.operator",
309
 
                regex : /\?|\:|\,|\;|\./,
310
 
                next  : "start"
311
 
            }, {
312
 
                token : "paren.lparen",
313
 
                regex : /[\[({]/,
314
 
                next  : "start"
315
 
            }, {
316
 
                token : "paren.rparen",
317
 
                regex : /[\])}]/
318
 
            }, {
319
 
                token : "keyword.operator",
320
 
                regex : /\/=?/,
321
 
                next  : "start"
322
 
            }, {
323
 
                token: "comment",
324
 
                regex: /^#!.*$/
325
 
            }
326
 
        ],
327
 
        "start": [
328
 
            DocCommentHighlightRules.getStartRule("doc-start"),
329
 
            {
330
 
                token : "comment", // multi line comment
331
 
                regex : "\\/\\*",
332
 
                next : "comment_regex_allowed"
333
 
            }, {
334
 
                token : "comment",
335
 
                regex : "\\/\\/.*$",
336
 
                next : "start"
337
 
            }, {
338
 
                token: "string.regexp",
339
 
                regex: "\\/",
340
 
                next: "regex",
341
 
            }, {
342
 
                token : "text",
343
 
                regex : "\\s+|^$",
344
 
                next : "start"
345
 
            }, {
346
 
                token: "empty",
347
 
                regex: "",
348
 
                next: "no_regex"
349
 
            }
350
 
        ],
351
 
        "regex": [
352
 
            {
353
 
                token: "regexp.keyword.operator",
354
 
                regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
355
 
            }, {
356
 
                token: "string.regexp",
357
 
                regex: "/\\w*",
358
 
                next: "no_regex",
359
 
            }, {
360
 
                token : "invalid",
361
 
                regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
362
 
            }, {
363
 
                token : "constant.language.escape",
364
 
                regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/
365
 
            }, {
366
 
                token : "constant.language.delimiter",
367
 
                regex: /\|/
368
 
            }, {
369
 
                token: "constant.language.escape",
370
 
                regex: /\[\^?/,
371
 
                next: "regex_character_class",
372
 
            }, {
373
 
                token: "empty",
374
 
                regex: "$",
375
 
                next: "no_regex"
376
 
            }, {
377
 
                defaultToken: "string.regexp"
378
 
            }
379
 
        ],
380
 
        "regex_character_class": [
381
 
            {
382
 
                token: "regexp.keyword.operator",
383
 
                regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
384
 
            }, {
385
 
                token: "constant.language.escape",
386
 
                regex: "]",
387
 
                next: "regex",
388
 
            }, {
389
 
                token: "constant.language.escape",
390
 
                regex: "-"
391
 
            }, {
392
 
                token: "empty",
393
 
                regex: "$",
394
 
                next: "no_regex"
395
 
            }, {
396
 
                defaultToken: "string.regexp.charachterclass"
397
 
            }
398
 
        ],
399
 
        "function_arguments": [
400
 
            {
401
 
                token: "variable.parameter",
402
 
                regex: identifierRe
403
 
            }, {
404
 
                token: "punctuation.operator",
405
 
                regex: "[, ]+",
406
 
            }, {
407
 
                token: "punctuation.operator",
408
 
                regex: "$",
409
 
            }, {
410
 
                token: "empty",
411
 
                regex: "",
412
 
                next: "no_regex"
413
 
            }
414
 
        ],
415
 
        "comment_regex_allowed" : [
416
 
            {token : "comment", regex : "\\*\\/", next : "start"},
417
 
            {defaultToken : "comment"}
418
 
        ],
419
 
        "comment" : [
420
 
            {token : "comment", regex : "\\*\\/", next : "no_regex"},
421
 
            {defaultToken : "comment"}
422
 
        ],
423
 
        "qqstring" : [
424
 
            {
425
 
                token : "constant.language.escape",
426
 
                regex : escapedRe
427
 
            }, {
428
 
                token : "string",
429
 
                regex : "\\\\$",
430
 
                next  : "qqstring",
431
 
            }, {
432
 
                token : "string",
433
 
                regex : '"|$',
434
 
                next  : "no_regex",
435
 
            }, {
436
 
                defaultToken: "string"
437
 
            }
438
 
        ],
439
 
        "qstring" : [
440
 
            {
441
 
                token : "constant.language.escape",
442
 
                regex : escapedRe
443
 
            }, {
444
 
                token : "string",
445
 
                regex : "\\\\$",
446
 
                next  : "qstring",
447
 
            }, {
448
 
                token : "string",
449
 
                regex : "'|$",
450
 
                next  : "no_regex",
451
 
            }, {
452
 
                defaultToken: "string"
453
 
            }
454
 
        ]
455
 
    };
456
 
 
457
 
    this.embedRules(DocCommentHighlightRules, "doc-",
458
 
        [ DocCommentHighlightRules.getEndRule("no_regex") ]);
459
 
};
460
 
 
461
 
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
462
 
 
463
 
exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
464
 
});
465
 
 
466
 
define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
467
 
 
468
 
 
469
 
var oop = require("../lib/oop");
470
 
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
471
 
 
472
 
var DocCommentHighlightRules = function() {
473
 
 
474
 
    this.$rules = {
475
 
        "start" : [ {
476
 
            token : "comment.doc.tag",
477
 
            regex : "@[\\w\\d_]+" // TODO: fix email addresses
478
 
        }, {
479
 
            token : "comment.doc.tag",
480
 
            regex : "\\bTODO\\b"
481
 
        }, {
482
 
            defaultToken : "comment.doc"
483
 
        }]
484
 
    };
485
 
};
486
 
 
487
 
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
488
 
 
489
 
DocCommentHighlightRules.getStartRule = function(start) {
490
 
    return {
491
 
        token : "comment.doc", // doc comment
492
 
        regex : "\\/\\*(?=\\*)",
493
 
        next  : start
494
 
    };
495
 
};
496
 
 
497
 
DocCommentHighlightRules.getEndRule = function (start) {
498
 
    return {
499
 
        token : "comment.doc", // closing comment
500
 
        regex : "\\*\\/",
501
 
        next  : start
502
 
    };
503
 
};
504
 
 
505
 
 
506
 
exports.DocCommentHighlightRules = DocCommentHighlightRules;
507
 
 
508
 
});
509
 
 
510
 
define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
511
 
 
512
 
 
513
 
var Range = require("../range").Range;
514
 
 
515
 
var MatchingBraceOutdent = function() {};
516
 
 
517
 
(function() {
518
 
 
519
 
    this.checkOutdent = function(line, input) {
520
 
        if (! /^\s+$/.test(line))
521
 
            return false;
522
 
 
523
 
        return /^\s*\}/.test(input);
524
 
    };
525
 
 
526
 
    this.autoOutdent = function(doc, row) {
527
 
        var line = doc.getLine(row);
528
 
        var match = line.match(/^(\s*\})/);
529
 
 
530
 
        if (!match) return 0;
531
 
 
532
 
        var column = match[1].length;
533
 
        var openBracePos = doc.findMatchingBracket({row: row, column: column});
534
 
 
535
 
        if (!openBracePos || openBracePos.row == row) return 0;
536
 
 
537
 
        var indent = this.$getIndent(doc.getLine(openBracePos.row));
538
 
        doc.replace(new Range(row, 0, row, column-1), indent);
539
 
    };
540
 
 
541
 
    this.$getIndent = function(line) {
542
 
        return line.match(/^\s*/)[0];
543
 
    };
544
 
 
545
 
}).call(MatchingBraceOutdent.prototype);
546
 
 
547
 
exports.MatchingBraceOutdent = MatchingBraceOutdent;
548
 
});
549
 
 
550
 
define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
551
 
 
552
 
 
553
 
var oop = require("../../lib/oop");
554
 
var Behaviour = require("../behaviour").Behaviour;
555
 
var TokenIterator = require("../../token_iterator").TokenIterator;
556
 
var lang = require("../../lib/lang");
557
 
 
558
 
var SAFE_INSERT_IN_TOKENS =
559
 
    ["text", "paren.rparen", "punctuation.operator"];
560
 
var SAFE_INSERT_BEFORE_TOKENS =
561
 
    ["text", "paren.rparen", "punctuation.operator", "comment"];
562
 
 
563
 
 
564
 
var autoInsertedBrackets = 0;
565
 
var autoInsertedRow = -1;
566
 
var autoInsertedLineEnd = "";
567
 
var maybeInsertedBrackets = 0;
568
 
var maybeInsertedRow = -1;
569
 
var maybeInsertedLineStart = "";
570
 
var maybeInsertedLineEnd = "";
571
 
 
572
 
var CstyleBehaviour = function () {
573
 
    
574
 
    CstyleBehaviour.isSaneInsertion = function(editor, session) {
575
 
        var cursor = editor.getCursorPosition();
576
 
        var iterator = new TokenIterator(session, cursor.row, cursor.column);
577
 
        if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
578
 
            var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
579
 
            if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
580
 
                return false;
581
 
        }
582
 
        iterator.stepForward();
583
 
        return iterator.getCurrentTokenRow() !== cursor.row ||
584
 
            this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
585
 
    };
586
 
    
587
 
    CstyleBehaviour.$matchTokenType = function(token, types) {
588
 
        return types.indexOf(token.type || token) > -1;
589
 
    };
590
 
    
591
 
    CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
592
 
        var cursor = editor.getCursorPosition();
593
 
        var line = session.doc.getLine(cursor.row);
594
 
        if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
595
 
            autoInsertedBrackets = 0;
596
 
        autoInsertedRow = cursor.row;
597
 
        autoInsertedLineEnd = bracket + line.substr(cursor.column);
598
 
        autoInsertedBrackets++;
599
 
    };
600
 
    
601
 
    CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
602
 
        var cursor = editor.getCursorPosition();
603
 
        var line = session.doc.getLine(cursor.row);
604
 
        if (!this.isMaybeInsertedClosing(cursor, line))
605
 
            maybeInsertedBrackets = 0;
606
 
        maybeInsertedRow = cursor.row;
607
 
        maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
608
 
        maybeInsertedLineEnd = line.substr(cursor.column);
609
 
        maybeInsertedBrackets++;
610
 
    };
611
 
    
612
 
    CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
613
 
        return autoInsertedBrackets > 0 &&
614
 
            cursor.row === autoInsertedRow &&
615
 
            bracket === autoInsertedLineEnd[0] &&
616
 
            line.substr(cursor.column) === autoInsertedLineEnd;
617
 
    };
618
 
    
619
 
    CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
620
 
        return maybeInsertedBrackets > 0 &&
621
 
            cursor.row === maybeInsertedRow &&
622
 
            line.substr(cursor.column) === maybeInsertedLineEnd &&
623
 
            line.substr(0, cursor.column) == maybeInsertedLineStart;
624
 
    };
625
 
    
626
 
    CstyleBehaviour.popAutoInsertedClosing = function() {
627
 
        autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
628
 
        autoInsertedBrackets--;
629
 
    };
630
 
    
631
 
    CstyleBehaviour.clearMaybeInsertedClosing = function() {
632
 
        maybeInsertedBrackets = 0;
633
 
        maybeInsertedRow = -1;
634
 
    };
635
 
 
636
 
    this.add("braces", "insertion", function (state, action, editor, session, text) {
637
 
        var cursor = editor.getCursorPosition();
638
 
        var line = session.doc.getLine(cursor.row);
639
 
        if (text == '{') {
640
 
            var selection = editor.getSelectionRange();
641
 
            var selected = session.doc.getTextRange(selection);
642
 
            if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
643
 
                return {
644
 
                    text: '{' + selected + '}',
645
 
                    selection: false
646
 
                };
647
 
            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
648
 
                if (/[\]\}\)]/.test(line[cursor.column])) {
649
 
                    CstyleBehaviour.recordAutoInsert(editor, session, "}");
650
 
                    return {
651
 
                        text: '{}',
652
 
                        selection: [1, 1]
653
 
                    };
654
 
                } else {
655
 
                    CstyleBehaviour.recordMaybeInsert(editor, session, "{");
656
 
                    return {
657
 
                        text: '{',
658
 
                        selection: [1, 1]
659
 
                    };
660
 
                }
661
 
            }
662
 
        } else if (text == '}') {
663
 
            var rightChar = line.substring(cursor.column, cursor.column + 1);
664
 
            if (rightChar == '}') {
665
 
                var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
666
 
                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
667
 
                    CstyleBehaviour.popAutoInsertedClosing();
668
 
                    return {
669
 
                        text: '',
670
 
                        selection: [1, 1]
671
 
                    };
672
 
                }
673
 
            }
674
 
        } else if (text == "\n" || text == "\r\n") {
675
 
            var closing = "";
676
 
            if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
677
 
                closing = lang.stringRepeat("}", maybeInsertedBrackets);
678
 
                CstyleBehaviour.clearMaybeInsertedClosing();
679
 
            }
680
 
            var rightChar = line.substring(cursor.column, cursor.column + 1);
681
 
            if (rightChar == '}' || closing !== "") {
682
 
                var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
683
 
                if (!openBracePos)
684
 
                     return null;
685
 
 
686
 
                var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
687
 
                var next_indent = this.$getIndent(line);
688
 
 
689
 
                return {
690
 
                    text: '\n' + indent + '\n' + next_indent + closing,
691
 
                    selection: [1, indent.length, 1, indent.length]
692
 
                };
693
 
            }
694
 
        }
695
 
    });
696
 
 
697
 
    this.add("braces", "deletion", function (state, action, editor, session, range) {
698
 
        var selected = session.doc.getTextRange(range);
699
 
        if (!range.isMultiLine() && selected == '{') {
700
 
            var line = session.doc.getLine(range.start.row);
701
 
            var rightChar = line.substring(range.end.column, range.end.column + 1);
702
 
            if (rightChar == '}') {
703
 
                range.end.column++;
704
 
                return range;
705
 
            } else {
706
 
                maybeInsertedBrackets--;
707
 
            }
708
 
        }
709
 
    });
710
 
 
711
 
    this.add("parens", "insertion", function (state, action, editor, session, text) {
712
 
        if (text == '(') {
713
 
            var selection = editor.getSelectionRange();
714
 
            var selected = session.doc.getTextRange(selection);
715
 
            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
716
 
                return {
717
 
                    text: '(' + selected + ')',
718
 
                    selection: false
719
 
                };
720
 
            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
721
 
                CstyleBehaviour.recordAutoInsert(editor, session, ")");
722
 
                return {
723
 
                    text: '()',
724
 
                    selection: [1, 1]
725
 
                };
726
 
            }
727
 
        } else if (text == ')') {
728
 
            var cursor = editor.getCursorPosition();
729
 
            var line = session.doc.getLine(cursor.row);
730
 
            var rightChar = line.substring(cursor.column, cursor.column + 1);
731
 
            if (rightChar == ')') {
732
 
                var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
733
 
                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
734
 
                    CstyleBehaviour.popAutoInsertedClosing();
735
 
                    return {
736
 
                        text: '',
737
 
                        selection: [1, 1]
738
 
                    };
739
 
                }
740
 
            }
741
 
        }
742
 
    });
743
 
 
744
 
    this.add("parens", "deletion", function (state, action, editor, session, range) {
745
 
        var selected = session.doc.getTextRange(range);
746
 
        if (!range.isMultiLine() && selected == '(') {
747
 
            var line = session.doc.getLine(range.start.row);
748
 
            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
749
 
            if (rightChar == ')') {
750
 
                range.end.column++;
751
 
                return range;
752
 
            }
753
 
        }
754
 
    });
755
 
 
756
 
    this.add("brackets", "insertion", function (state, action, editor, session, text) {
757
 
        if (text == '[') {
758
 
            var selection = editor.getSelectionRange();
759
 
            var selected = session.doc.getTextRange(selection);
760
 
            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
761
 
                return {
762
 
                    text: '[' + selected + ']',
763
 
                    selection: false
764
 
                };
765
 
            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
766
 
                CstyleBehaviour.recordAutoInsert(editor, session, "]");
767
 
                return {
768
 
                    text: '[]',
769
 
                    selection: [1, 1]
770
 
                };
771
 
            }
772
 
        } else if (text == ']') {
773
 
            var cursor = editor.getCursorPosition();
774
 
            var line = session.doc.getLine(cursor.row);
775
 
            var rightChar = line.substring(cursor.column, cursor.column + 1);
776
 
            if (rightChar == ']') {
777
 
                var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
778
 
                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
779
 
                    CstyleBehaviour.popAutoInsertedClosing();
780
 
                    return {
781
 
                        text: '',
782
 
                        selection: [1, 1]
783
 
                    };
784
 
                }
785
 
            }
786
 
        }
787
 
    });
788
 
 
789
 
    this.add("brackets", "deletion", function (state, action, editor, session, range) {
790
 
        var selected = session.doc.getTextRange(range);
791
 
        if (!range.isMultiLine() && selected == '[') {
792
 
            var line = session.doc.getLine(range.start.row);
793
 
            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
794
 
            if (rightChar == ']') {
795
 
                range.end.column++;
796
 
                return range;
797
 
            }
798
 
        }
799
 
    });
800
 
 
801
 
    this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
802
 
        if (text == '"' || text == "'") {
803
 
            var quote = text;
804
 
            var selection = editor.getSelectionRange();
805
 
            var selected = session.doc.getTextRange(selection);
806
 
            if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
807
 
                return {
808
 
                    text: quote + selected + quote,
809
 
                    selection: false
810
 
                };
811
 
            } else {
812
 
                var cursor = editor.getCursorPosition();
813
 
                var line = session.doc.getLine(cursor.row);
814
 
                var leftChar = line.substring(cursor.column-1, cursor.column);
815
 
                if (leftChar == '\\') {
816
 
                    return null;
817
 
                }
818
 
                var tokens = session.getTokens(selection.start.row);
819
 
                var col = 0, token;
820
 
                var quotepos = -1; // Track whether we're inside an open quote.
821
 
 
822
 
                for (var x = 0; x < tokens.length; x++) {
823
 
                    token = tokens[x];
824
 
                    if (token.type == "string") {
825
 
                      quotepos = -1;
826
 
                    } else if (quotepos < 0) {
827
 
                      quotepos = token.value.indexOf(quote);
828
 
                    }
829
 
                    if ((token.value.length + col) > selection.start.column) {
830
 
                        break;
831
 
                    }
832
 
                    col += tokens[x].value.length;
833
 
                }
834
 
                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)))) {
835
 
                    if (!CstyleBehaviour.isSaneInsertion(editor, session))
836
 
                        return;
837
 
                    return {
838
 
                        text: quote + quote,
839
 
                        selection: [1,1]
840
 
                    };
841
 
                } else if (token && token.type === "string") {
842
 
                    var rightChar = line.substring(cursor.column, cursor.column + 1);
843
 
                    if (rightChar == quote) {
844
 
                        return {
845
 
                            text: '',
846
 
                            selection: [1, 1]
847
 
                        };
848
 
                    }
849
 
                }
850
 
            }
851
 
        }
852
 
    });
853
 
 
854
 
    this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
855
 
        var selected = session.doc.getTextRange(range);
856
 
        if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
857
 
            var line = session.doc.getLine(range.start.row);
858
 
            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
859
 
            if (rightChar == selected) {
860
 
                range.end.column++;
861
 
                return range;
862
 
            }
863
 
        }
864
 
    });
865
 
 
866
 
};
867
 
 
868
 
oop.inherits(CstyleBehaviour, Behaviour);
869
 
 
870
 
exports.CstyleBehaviour = CstyleBehaviour;
871
 
});
872
 
 
873
 
define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
874
 
 
875
 
 
876
 
var oop = require("../../lib/oop");
877
 
var Range = require("../../range").Range;
878
 
var BaseFoldMode = require("./fold_mode").FoldMode;
879
 
 
880
 
var FoldMode = exports.FoldMode = function(commentRegex) {
881
 
    if (commentRegex) {
882
 
        this.foldingStartMarker = new RegExp(
883
 
            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
884
 
        );
885
 
        this.foldingStopMarker = new RegExp(
886
 
            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
887
 
        );
888
 
    }
889
 
};
890
 
oop.inherits(FoldMode, BaseFoldMode);
891
 
 
892
 
(function() {
893
 
 
894
 
    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
895
 
    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
896
 
 
897
 
    this.getFoldWidgetRange = function(session, foldStyle, row) {
898
 
        var line = session.getLine(row);
899
 
        var match = line.match(this.foldingStartMarker);
900
 
        if (match) {
901
 
            var i = match.index;
902
 
 
903
 
            if (match[1])
904
 
                return this.openingBracketBlock(session, match[1], row, i);
905
 
 
906
 
            return session.getCommentFoldRange(row, i + match[0].length, 1);
907
 
        }
908
 
 
909
 
        if (foldStyle !== "markbeginend")
910
 
            return;
911
 
 
912
 
        var match = line.match(this.foldingStopMarker);
913
 
        if (match) {
914
 
            var i = match.index + match[0].length;
915
 
 
916
 
            if (match[1])
917
 
                return this.closingBracketBlock(session, match[1], row, i);
918
 
 
919
 
            return session.getCommentFoldRange(row, i, -1);
920
 
        }
921
 
    };
922
 
 
923
 
}).call(FoldMode.prototype);
924
 
 
925
 
});
926
 
 
927
 
define('ace/mode/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xml_highlight_rules', 'ace/mode/behaviour/xml', 'ace/mode/folding/xml'], function(require, exports, module) {
928
 
 
929
 
 
930
 
var oop = require("../lib/oop");
931
 
var TextMode = require("./text").Mode;
932
 
var Tokenizer = require("../tokenizer").Tokenizer;
933
 
var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
934
 
var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
935
 
var XmlFoldMode = require("./folding/xml").FoldMode;
936
 
 
937
 
var Mode = function() {
938
 
    this.$tokenizer = new Tokenizer(new XmlHighlightRules().getRules());
939
 
    this.$behaviour = new XmlBehaviour();
940
 
    this.foldingRules = new XmlFoldMode();
941
 
};
942
 
 
943
 
oop.inherits(Mode, TextMode);
944
 
 
945
 
(function() {
946
 
    
947
 
    this.blockComment = {start: "<!--", end: "-->"};
948
 
 
949
 
}).call(Mode.prototype);
950
 
 
951
 
exports.Mode = Mode;
952
 
});
953
 
 
954
 
define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
955
 
 
956
 
 
957
 
var oop = require("../lib/oop");
958
 
var xmlUtil = require("./xml_util");
959
 
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
960
 
 
961
 
var XmlHighlightRules = function() {
962
 
    this.$rules = {
963
 
        start : [
964
 
            {token : "text", regex : "<\\!\\[CDATA\\[", next : "cdata"},
965
 
            {token : "xml-pe", regex : "<\\?.*?\\?>"},
966
 
            {token : "comment", regex : "<\\!--", next : "comment"},
967
 
            {token : "xml-pe", regex : "<\\!.*?>"},
968
 
            {token : "meta.tag", regex : "<\\/?", next : "tag"},
969
 
            {token : "text", regex : "\\s+"},
970
 
            {
971
 
                token : "constant.character.entity", 
972
 
                regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" 
973
 
            }
974
 
        ],
975
 
        
976
 
        cdata : [
977
 
            {token : "text", regex : "\\]\\]>", next : "start"},
978
 
            {token : "text", regex : "\\s+"},
979
 
            {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"}
980
 
        ],
981
 
 
982
 
        comment : [
983
 
            {token : "comment", regex : ".*?-->", next : "start"},
984
 
            {token : "comment", regex : ".+"}
985
 
        ]
986
 
    };
987
 
    
988
 
    xmlUtil.tag(this.$rules, "tag", "start");
989
 
};
990
 
 
991
 
oop.inherits(XmlHighlightRules, TextHighlightRules);
992
 
 
993
 
exports.XmlHighlightRules = XmlHighlightRules;
994
 
});
995
 
 
996
 
define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) {
997
 
 
998
 
 
999
 
function string(state) {
1000
 
    return [{
1001
 
        token : "string",
1002
 
        regex : '"',
1003
 
        next : state + "_qqstring"
1004
 
    }, {
1005
 
        token : "string",
1006
 
        regex : "'",
1007
 
        next : state + "_qstring"
1008
 
    }];
1009
 
}
1010
 
 
1011
 
function multiLineString(quote, state) {
1012
 
    return [
1013
 
        {token : "string", regex : quote, next : state},
1014
 
        {
1015
 
            token : "constant.language.escape",
1016
 
            regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" 
1017
 
        },
1018
 
        {defaultToken : "string"}
1019
 
    ];
1020
 
}
1021
 
 
1022
 
exports.tag = function(states, name, nextState, tagMap) {
1023
 
    states[name] = [{
1024
 
        token : "text",
1025
 
        regex : "\\s+"
1026
 
    }, {
1027
 
        
1028
 
    token : !tagMap ? "meta.tag.tag-name" : function(value) {
1029
 
            if (tagMap[value])
1030
 
                return "meta.tag.tag-name." + tagMap[value];
1031
 
            else
1032
 
                return "meta.tag.tag-name";
1033
 
        },
1034
 
        regex : "[-_a-zA-Z0-9:]+",
1035
 
        next : name + "_embed_attribute_list" 
1036
 
    }, {
1037
 
        token: "empty",
1038
 
        regex: "",
1039
 
        next : name + "_embed_attribute_list"
1040
 
    }];
1041
 
 
1042
 
    states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
1043
 
    states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
1044
 
    
1045
 
    states[name + "_embed_attribute_list"] = [{
1046
 
        token : "meta.tag.r",
1047
 
        regex : "/?>",
1048
 
        next : nextState
1049
 
    }, {
1050
 
        token : "keyword.operator",
1051
 
        regex : "="
1052
 
    }, {
1053
 
        token : "entity.other.attribute-name",
1054
 
        regex : "[-_a-zA-Z0-9:]+"
1055
 
    }, {
1056
 
        token : "constant.numeric", // float
1057
 
        regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
1058
 
    }, {
1059
 
        token : "text",
1060
 
        regex : "\\s+"
1061
 
    }].concat(string(name));
1062
 
};
1063
 
 
1064
 
});
1065
 
 
1066
 
define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) {
1067
 
 
1068
 
 
1069
 
var oop = require("../../lib/oop");
1070
 
var Behaviour = require("../behaviour").Behaviour;
1071
 
var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1072
 
var TokenIterator = require("../../token_iterator").TokenIterator;
1073
 
 
1074
 
function hasType(token, type) {
1075
 
    var hasType = true;
1076
 
    var typeList = token.type.split('.');
1077
 
    var needleList = type.split('.');
1078
 
    needleList.forEach(function(needle){
1079
 
        if (typeList.indexOf(needle) == -1) {
1080
 
            hasType = false;
1081
 
            return false;
1082
 
        }
1083
 
    });
1084
 
    return hasType;
1085
 
}
1086
 
 
1087
 
var XmlBehaviour = function () {
1088
 
    
1089
 
    this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour
1090
 
    
1091
 
    this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
1092
 
        if (text == '>') {
1093
 
            var position = editor.getCursorPosition();
1094
 
            var iterator = new TokenIterator(session, position.row, position.column);
1095
 
            var token = iterator.getCurrentToken();
1096
 
            var atCursor = false;
1097
 
            if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
1098
 
                do {
1099
 
                    token = iterator.stepBackward();
1100
 
                } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
1101
 
            } else {
1102
 
                atCursor = true;
1103
 
            }
1104
 
            if (!token || !hasType(token, 'meta.tag-name') || iterator.stepBackward().value.match('/')) {
1105
 
                return
1106
 
            }
1107
 
            var tag = token.value;
1108
 
            if (atCursor){
1109
 
                var tag = tag.substring(0, position.column - token.start);
1110
 
            }
1111
 
 
1112
 
            return {
1113
 
               text: '>' + '</' + tag + '>',
1114
 
               selection: [1, 1]
1115
 
            }
1116
 
        }
1117
 
    });
1118
 
 
1119
 
    this.add('autoindent', 'insertion', function (state, action, editor, session, text) {
1120
 
        if (text == "\n") {
1121
 
            var cursor = editor.getCursorPosition();
1122
 
            var line = session.doc.getLine(cursor.row);
1123
 
            var rightChars = line.substring(cursor.column, cursor.column + 2);
1124
 
            if (rightChars == '</') {
1125
 
                var indent = this.$getIndent(session.doc.getLine(cursor.row)) + session.getTabString();
1126
 
                var next_indent = this.$getIndent(session.doc.getLine(cursor.row));
1127
 
 
1128
 
                return {
1129
 
                    text: '\n' + indent + '\n' + next_indent,
1130
 
                    selection: [1, indent.length, 1, indent.length]
1131
 
                }
1132
 
            }
1133
 
        }
1134
 
    });
1135
 
    
1136
 
}
1137
 
oop.inherits(XmlBehaviour, Behaviour);
1138
 
 
1139
 
exports.XmlBehaviour = XmlBehaviour;
1140
 
});
1141
 
 
1142
 
define('ace/mode/folding/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/range', 'ace/mode/folding/fold_mode', 'ace/token_iterator'], function(require, exports, module) {
1143
 
 
1144
 
 
1145
 
var oop = require("../../lib/oop");
1146
 
var lang = require("../../lib/lang");
1147
 
var Range = require("../../range").Range;
1148
 
var BaseFoldMode = require("./fold_mode").FoldMode;
1149
 
var TokenIterator = require("../../token_iterator").TokenIterator;
1150
 
 
1151
 
var FoldMode = exports.FoldMode = function(voidElements) {
1152
 
    BaseFoldMode.call(this);
1153
 
    this.voidElements = voidElements || {};
1154
 
};
1155
 
oop.inherits(FoldMode, BaseFoldMode);
1156
 
 
1157
 
(function() {
1158
 
 
1159
 
    this.getFoldWidget = function(session, foldStyle, row) {
1160
 
        var tag = this._getFirstTagInLine(session, row);
1161
 
 
1162
 
        if (tag.closing)
1163
 
            return foldStyle == "markbeginend" ? "end" : "";
1164
 
 
1165
 
        if (!tag.tagName || this.voidElements[tag.tagName.toLowerCase()])
1166
 
            return "";
1167
 
 
1168
 
        if (tag.selfClosing)
1169
 
            return "";
1170
 
 
1171
 
        if (tag.value.indexOf("/" + tag.tagName) !== -1)
1172
 
            return "";
1173
 
 
1174
 
        return "start";
1175
 
    };
1176
 
    
1177
 
    this._getFirstTagInLine = function(session, row) {
1178
 
        var tokens = session.getTokens(row);
1179
 
        var value = "";
1180
 
        for (var i = 0; i < tokens.length; i++) {
1181
 
            var token = tokens[i];
1182
 
            if (token.type.indexOf("meta.tag") === 0)
1183
 
                value += token.value;
1184
 
            else
1185
 
                value += lang.stringRepeat(" ", token.value.length);
1186
 
        }
1187
 
        
1188
 
        return this._parseTag(value);
1189
 
    };
1190
 
 
1191
 
    this.tagRe = /^(\s*)(<?(\/?)([-_a-zA-Z0-9:!]*)\s*(\/?)>?)/;
1192
 
    this._parseTag = function(tag) {
1193
 
        
1194
 
        var match = this.tagRe.exec(tag);
1195
 
        var column = this.tagRe.lastIndex || 0;
1196
 
        this.tagRe.lastIndex = 0;
1197
 
 
1198
 
        return {
1199
 
            value: tag,
1200
 
            match: match ? match[2] : "",
1201
 
            closing: match ? !!match[3] : false,
1202
 
            selfClosing: match ? !!match[5] || match[2] == "/>" : false,
1203
 
            tagName: match ? match[4] : "",
1204
 
            column: match[1] ? column + match[1].length : column
1205
 
        };
1206
 
    };
1207
 
    this._readTagForward = function(iterator) {
1208
 
        var token = iterator.getCurrentToken();
1209
 
        if (!token)
1210
 
            return null;
1211
 
            
1212
 
        var value = "";
1213
 
        var start;
1214
 
        
1215
 
        do {
1216
 
            if (token.type.indexOf("meta.tag") === 0) {
1217
 
                if (!start) {
1218
 
                    var start = {
1219
 
                        row: iterator.getCurrentTokenRow(),
1220
 
                        column: iterator.getCurrentTokenColumn()
1221
 
                    };
1222
 
                }
1223
 
                value += token.value;
1224
 
                if (value.indexOf(">") !== -1) {
1225
 
                    var tag = this._parseTag(value);
1226
 
                    tag.start = start;
1227
 
                    tag.end = {
1228
 
                        row: iterator.getCurrentTokenRow(),
1229
 
                        column: iterator.getCurrentTokenColumn() + token.value.length
1230
 
                    };
1231
 
                    iterator.stepForward();
1232
 
                    return tag;
1233
 
                }
1234
 
            }
1235
 
        } while(token = iterator.stepForward());
1236
 
        
1237
 
        return null;
1238
 
    };
1239
 
    
1240
 
    this._readTagBackward = function(iterator) {
1241
 
        var token = iterator.getCurrentToken();
1242
 
        if (!token)
1243
 
            return null;
1244
 
            
1245
 
        var value = "";
1246
 
        var end;
1247
 
 
1248
 
        do {
1249
 
            if (token.type.indexOf("meta.tag") === 0) {
1250
 
                if (!end) {
1251
 
                    end = {
1252
 
                        row: iterator.getCurrentTokenRow(),
1253
 
                        column: iterator.getCurrentTokenColumn() + token.value.length
1254
 
                    };
1255
 
                }
1256
 
                value = token.value + value;
1257
 
                if (value.indexOf("<") !== -1) {
1258
 
                    var tag = this._parseTag(value);
1259
 
                    tag.end = end;
1260
 
                    tag.start = {
1261
 
                        row: iterator.getCurrentTokenRow(),
1262
 
                        column: iterator.getCurrentTokenColumn()
1263
 
                    };
1264
 
                    iterator.stepBackward();
1265
 
                    return tag;
1266
 
                }
1267
 
            }
1268
 
        } while(token = iterator.stepBackward());
1269
 
        
1270
 
        return null;
1271
 
    };
1272
 
    
1273
 
    this._pop = function(stack, tag) {
1274
 
        while (stack.length) {
1275
 
            
1276
 
            var top = stack[stack.length-1];
1277
 
            if (!tag || top.tagName == tag.tagName) {
1278
 
                return stack.pop();
1279
 
            }
1280
 
            else if (this.voidElements[tag.tagName]) {
1281
 
                return;
1282
 
            }
1283
 
            else if (this.voidElements[top.tagName]) {
1284
 
                stack.pop();
1285
 
                continue;
1286
 
            } else {
1287
 
                return null;
1288
 
            }
1289
 
        }
1290
 
    };
1291
 
    
1292
 
    this.getFoldWidgetRange = function(session, foldStyle, row) {
1293
 
        var firstTag = this._getFirstTagInLine(session, row);
1294
 
        
1295
 
        if (!firstTag.match)
1296
 
            return null;
1297
 
        
1298
 
        var isBackward = firstTag.closing || firstTag.selfClosing;
1299
 
        var stack = [];
1300
 
        var tag;
1301
 
        
1302
 
        if (!isBackward) {
1303
 
            var iterator = new TokenIterator(session, row, firstTag.column);
1304
 
            var start = {
1305
 
                row: row,
1306
 
                column: firstTag.column + firstTag.tagName.length + 2
1307
 
            };
1308
 
            while (tag = this._readTagForward(iterator)) {
1309
 
                if (tag.selfClosing) {
1310
 
                    if (!stack.length) {
1311
 
                        tag.start.column += tag.tagName.length + 2;
1312
 
                        tag.end.column -= 2;
1313
 
                        return Range.fromPoints(tag.start, tag.end);
1314
 
                    } else
1315
 
                        continue;
1316
 
                }
1317
 
                
1318
 
                if (tag.closing) {
1319
 
                    this._pop(stack, tag);
1320
 
                    if (stack.length == 0)
1321
 
                        return Range.fromPoints(start, tag.start);
1322
 
                }
1323
 
                else {
1324
 
                    stack.push(tag)
1325
 
                }
1326
 
            }
1327
 
        }
1328
 
        else {
1329
 
            var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length);
1330
 
            var end = {
1331
 
                row: row,
1332
 
                column: firstTag.column
1333
 
            };
1334
 
            
1335
 
            while (tag = this._readTagBackward(iterator)) {
1336
 
                if (tag.selfClosing) {
1337
 
                    if (!stack.length) {
1338
 
                        tag.start.column += tag.tagName.length + 2;
1339
 
                        tag.end.column -= 2;
1340
 
                        return Range.fromPoints(tag.start, tag.end);
1341
 
                    } else
1342
 
                        continue;
1343
 
                }
1344
 
                
1345
 
                if (!tag.closing) {
1346
 
                    this._pop(stack, tag);
1347
 
                    if (stack.length == 0) {
1348
 
                        tag.start.column += tag.tagName.length + 2;
1349
 
                        return Range.fromPoints(tag.start, end);
1350
 
                    }
1351
 
                }
1352
 
                else {
1353
 
                    stack.push(tag)
1354
 
                }
1355
 
            }
1356
 
        }
1357
 
        
1358
 
    };
1359
 
 
1360
 
}).call(FoldMode.prototype);
1361
 
 
1362
 
});
1363
 
 
1364
 
define('ace/mode/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/javascript', 'ace/mode/css', 'ace/tokenizer', 'ace/mode/html_highlight_rules', 'ace/mode/behaviour/html', 'ace/mode/folding/html'], function(require, exports, module) {
1365
 
 
1366
 
 
1367
 
var oop = require("../lib/oop");
1368
 
var TextMode = require("./text").Mode;
1369
 
var JavaScriptMode = require("./javascript").Mode;
1370
 
var CssMode = require("./css").Mode;
1371
 
var Tokenizer = require("../tokenizer").Tokenizer;
1372
 
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
1373
 
var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour;
1374
 
var HtmlFoldMode = require("./folding/html").FoldMode;
1375
 
 
1376
 
var Mode = function() {
1377
 
    var highlighter = new HtmlHighlightRules();
1378
 
    this.$tokenizer = new Tokenizer(highlighter.getRules());
1379
 
    this.$behaviour = new HtmlBehaviour();
1380
 
    
1381
 
    this.$embeds = highlighter.getEmbeds();
1382
 
    this.createModeDelegates({
1383
 
        "js-": JavaScriptMode,
1384
 
        "css-": CssMode
1385
 
    });
1386
 
    
1387
 
    this.foldingRules = new HtmlFoldMode();
1388
 
};
1389
 
oop.inherits(Mode, TextMode);
1390
 
 
1391
 
(function() {
1392
 
 
1393
 
    this.blockComment = {start: "<!--", end: "-->"};
1394
 
 
1395
 
    this.getNextLineIndent = function(state, line, tab) {
1396
 
        return this.$getIndent(line);
1397
 
    };
1398
 
 
1399
 
    this.checkOutdent = function(state, line, input) {
1400
 
        return false;
1401
 
    };
1402
 
 
1403
 
}).call(Mode.prototype);
1404
 
 
1405
 
exports.Mode = Mode;
1406
 
});
1407
 
 
1408
 
define('ace/mode/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/css_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/worker/worker_client', 'ace/mode/behaviour/css', 'ace/mode/folding/cstyle'], function(require, exports, module) {
1409
 
 
1410
 
 
1411
 
var oop = require("../lib/oop");
1412
 
var TextMode = require("./text").Mode;
1413
 
var Tokenizer = require("../tokenizer").Tokenizer;
1414
 
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1415
 
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1416
 
var WorkerClient = require("../worker/worker_client").WorkerClient;
1417
 
var CssBehaviour = require("./behaviour/css").CssBehaviour;
1418
 
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1419
 
 
1420
 
var Mode = function() {
1421
 
    this.$tokenizer = new Tokenizer(new CssHighlightRules().getRules());
1422
 
    this.$outdent = new MatchingBraceOutdent();
1423
 
    this.$behaviour = new CssBehaviour();
1424
 
    this.foldingRules = new CStyleFoldMode();
1425
 
};
1426
 
oop.inherits(Mode, TextMode);
1427
 
 
1428
 
(function() {
1429
 
 
1430
 
    this.foldingRules = "cStyle";
1431
 
    this.blockComment = {start: "/*", end: "*/"};
1432
 
 
1433
 
    this.getNextLineIndent = function(state, line, tab) {
1434
 
        var indent = this.$getIndent(line);
1435
 
        var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
1436
 
        if (tokens.length && tokens[tokens.length-1].type == "comment") {
1437
 
            return indent;
1438
 
        }
1439
 
 
1440
 
        var match = line.match(/^.*\{\s*$/);
1441
 
        if (match) {
1442
 
            indent += tab;
1443
 
        }
1444
 
 
1445
 
        return indent;
1446
 
    };
1447
 
 
1448
 
    this.checkOutdent = function(state, line, input) {
1449
 
        return this.$outdent.checkOutdent(line, input);
1450
 
    };
1451
 
 
1452
 
    this.autoOutdent = function(state, doc, row) {
1453
 
        this.$outdent.autoOutdent(doc, row);
1454
 
    };
1455
 
 
1456
 
    this.createWorker = function(session) {
1457
 
        var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
1458
 
        worker.attachToDocument(session.getDocument());
1459
 
 
1460
 
        worker.on("csslint", function(e) {
1461
 
            session.setAnnotations(e.data);
1462
 
        });
1463
 
 
1464
 
        worker.on("terminate", function() {
1465
 
            session.clearAnnotations();
1466
 
        });
1467
 
 
1468
 
        return worker;
1469
 
    };
1470
 
 
1471
 
}).call(Mode.prototype);
1472
 
 
1473
 
exports.Mode = Mode;
1474
 
 
1475
 
});
1476
 
 
1477
 
define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1478
 
 
1479
 
 
1480
 
var oop = require("../lib/oop");
1481
 
var lang = require("../lib/lang");
1482
 
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1483
 
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";
1484
 
var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
1485
 
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";
1486
 
var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
1487
 
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";
1488
 
 
1489
 
var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
1490
 
var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
1491
 
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";
1492
 
 
1493
 
var CssHighlightRules = function() {
1494
 
 
1495
 
    var keywordMapper = this.createKeywordMapper({
1496
 
        "support.function": supportFunction,
1497
 
        "support.constant": supportConstant,
1498
 
        "support.type": supportType,
1499
 
        "support.constant.color": supportConstantColor,
1500
 
        "support.constant.fonts": supportConstantFonts
1501
 
    }, "text", true);
1502
 
 
1503
 
    var base_ruleset = [
1504
 
        {
1505
 
            token : "comment", // multi line comment
1506
 
            regex : "\\/\\*",
1507
 
            next : "ruleset_comment"
1508
 
        }, {
1509
 
            token : "string", // single line
1510
 
            regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
1511
 
        }, {
1512
 
            token : "string", // single line
1513
 
            regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
1514
 
        }, {
1515
 
            token : ["constant.numeric", "keyword"],
1516
 
            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|%)"
1517
 
        }, {
1518
 
            token : "constant.numeric",
1519
 
            regex : numRe
1520
 
        }, {
1521
 
            token : "constant.numeric",  // hex6 color
1522
 
            regex : "#[a-f0-9]{6}"
1523
 
        }, {
1524
 
            token : "constant.numeric", // hex3 color
1525
 
            regex : "#[a-f0-9]{3}"
1526
 
        }, {
1527
 
            token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
1528
 
            regex : pseudoElements
1529
 
        }, {
1530
 
            token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
1531
 
            regex : pseudoClasses
1532
 
        }, {
1533
 
            token : ["support.function", "string", "support.function"],
1534
 
            regex : "(url\\()(.*)(\\))"
1535
 
        }, {
1536
 
            token : keywordMapper,
1537
 
            regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
1538
 
        }, {
1539
 
            caseInsensitive: true
1540
 
        }
1541
 
      ];
1542
 
 
1543
 
    var ruleset = lang.copyArray(base_ruleset);
1544
 
    ruleset.unshift({
1545
 
        token : "paren.rparen",
1546
 
        regex : "\\}",
1547
 
        next:   "start"
1548
 
    });
1549
 
 
1550
 
    var media_ruleset = lang.copyArray( base_ruleset );
1551
 
    media_ruleset.unshift({
1552
 
        token : "paren.rparen",
1553
 
        regex : "\\}",
1554
 
        next:   "media"
1555
 
    });
1556
 
 
1557
 
    var base_comment = [{
1558
 
          token : "comment", // comment spanning whole line
1559
 
          regex : ".+"
1560
 
    }];
1561
 
 
1562
 
    var comment = lang.copyArray(base_comment);
1563
 
    comment.unshift({
1564
 
          token : "comment", // closing comment
1565
 
          regex : ".*?\\*\\/",
1566
 
          next : "start"
1567
 
    });
1568
 
 
1569
 
    var media_comment = lang.copyArray(base_comment);
1570
 
    media_comment.unshift({
1571
 
          token : "comment", // closing comment
1572
 
          regex : ".*?\\*\\/",
1573
 
          next : "media"
1574
 
    });
1575
 
 
1576
 
    var ruleset_comment = lang.copyArray(base_comment);
1577
 
    ruleset_comment.unshift({
1578
 
          token : "comment", // closing comment
1579
 
          regex : ".*?\\*\\/",
1580
 
          next : "ruleset"
1581
 
    });
1582
 
 
1583
 
    this.$rules = {
1584
 
        "start" : [{
1585
 
            token : "comment", // multi line comment
1586
 
            regex : "\\/\\*",
1587
 
            next : "comment"
1588
 
        }, {
1589
 
            token: "paren.lparen",
1590
 
            regex: "\\{",
1591
 
            next:  "ruleset"
1592
 
        }, {
1593
 
            token: "string",
1594
 
            regex: "@.*?{",
1595
 
            next:  "media"
1596
 
        },{
1597
 
            token: "keyword",
1598
 
            regex: "#[a-z0-9-_]+"
1599
 
        },{
1600
 
            token: "variable",
1601
 
            regex: "\\.[a-z0-9-_]+"
1602
 
        },{
1603
 
            token: "string",
1604
 
            regex: ":[a-z0-9-_]+"
1605
 
        },{
1606
 
            token: "constant",
1607
 
            regex: "[a-z0-9-_]+"
1608
 
        },{
1609
 
            caseInsensitive: true
1610
 
        }],
1611
 
 
1612
 
        "media" : [ {
1613
 
            token : "comment", // multi line comment
1614
 
            regex : "\\/\\*",
1615
 
            next : "media_comment"
1616
 
        }, {
1617
 
            token: "paren.lparen",
1618
 
            regex: "\\{",
1619
 
            next:  "media_ruleset"
1620
 
        },{
1621
 
            token: "string",
1622
 
            regex: "\\}",
1623
 
            next:  "start"
1624
 
        },{
1625
 
            token: "keyword",
1626
 
            regex: "#[a-z0-9-_]+"
1627
 
        },{
1628
 
            token: "variable",
1629
 
            regex: "\\.[a-z0-9-_]+"
1630
 
        },{
1631
 
            token: "string",
1632
 
            regex: ":[a-z0-9-_]+"
1633
 
        },{
1634
 
            token: "constant",
1635
 
            regex: "[a-z0-9-_]+"
1636
 
        },{
1637
 
            caseInsensitive: true
1638
 
        }],
1639
 
 
1640
 
        "comment" : comment,
1641
 
 
1642
 
        "ruleset" : ruleset,
1643
 
        "ruleset_comment" : ruleset_comment,
1644
 
 
1645
 
        "media_ruleset" : media_ruleset,
1646
 
        "media_comment" : media_comment
1647
 
    };
1648
 
};
1649
 
 
1650
 
oop.inherits(CssHighlightRules, TextHighlightRules);
1651
 
 
1652
 
exports.CssHighlightRules = CssHighlightRules;
1653
 
 
1654
 
});
1655
 
 
1656
 
define('ace/mode/behaviour/css', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) {
1657
 
 
1658
 
 
1659
 
var oop = require("../../lib/oop");
1660
 
var Behaviour = require("../behaviour").Behaviour;
1661
 
var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1662
 
var TokenIterator = require("../../token_iterator").TokenIterator;
1663
 
 
1664
 
var CssBehaviour = function () {
1665
 
 
1666
 
    this.inherit(CstyleBehaviour);
1667
 
 
1668
 
    this.add("colon", "insertion", function (state, action, editor, session, text) {
1669
 
        if (text === ':') {
1670
 
            var cursor = editor.getCursorPosition();
1671
 
            var iterator = new TokenIterator(session, cursor.row, cursor.column);
1672
 
            var token = iterator.getCurrentToken();
1673
 
            if (token && token.value.match(/\s+/)) {
1674
 
                token = iterator.stepBackward();
1675
 
            }
1676
 
            if (token && token.type === 'support.type') {
1677
 
                var line = session.doc.getLine(cursor.row);
1678
 
                var rightChar = line.substring(cursor.column, cursor.column + 1);
1679
 
                if (rightChar === ':') {
1680
 
                    return {
1681
 
                       text: '',
1682
 
                       selection: [1, 1]
1683
 
                    }
1684
 
                }
1685
 
                if (!line.substring(cursor.column).match(/^\s*;/)) {
1686
 
                    return {
1687
 
                       text: ':;',
1688
 
                       selection: [1, 1]
1689
 
                    }
1690
 
                }
1691
 
            }
1692
 
        }
1693
 
    });
1694
 
 
1695
 
    this.add("colon", "deletion", function (state, action, editor, session, range) {
1696
 
        var selected = session.doc.getTextRange(range);
1697
 
        if (!range.isMultiLine() && selected === ':') {
1698
 
            var cursor = editor.getCursorPosition();
1699
 
            var iterator = new TokenIterator(session, cursor.row, cursor.column);
1700
 
            var token = iterator.getCurrentToken();
1701
 
            if (token && token.value.match(/\s+/)) {
1702
 
                token = iterator.stepBackward();
1703
 
            }
1704
 
            if (token && token.type === 'support.type') {
1705
 
                var line = session.doc.getLine(range.start.row);
1706
 
                var rightChar = line.substring(range.end.column, range.end.column + 1);
1707
 
                if (rightChar === ';') {
1708
 
                    range.end.column ++;
1709
 
                    return range;
1710
 
                }
1711
 
            }
1712
 
        }
1713
 
    });
1714
 
 
1715
 
    this.add("semicolon", "insertion", function (state, action, editor, session, text) {
1716
 
        if (text === ';') {
1717
 
            var cursor = editor.getCursorPosition();
1718
 
            var line = session.doc.getLine(cursor.row);
1719
 
            var rightChar = line.substring(cursor.column, cursor.column + 1);
1720
 
            if (rightChar === ';') {
1721
 
                return {
1722
 
                   text: '',
1723
 
                   selection: [1, 1]
1724
 
                }
1725
 
            }
1726
 
        }
1727
 
    });
1728
 
 
1729
 
}
1730
 
oop.inherits(CssBehaviour, CstyleBehaviour);
1731
 
 
1732
 
exports.CssBehaviour = CssBehaviour;
1733
 
});
1734
 
 
1735
 
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) {
1736
 
 
1737
 
 
1738
 
var oop = require("../lib/oop");
1739
 
var lang = require("../lib/lang");
1740
 
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1741
 
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1742
 
var xmlUtil = require("./xml_util");
1743
 
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1744
 
 
1745
 
var tagMap = lang.createMap({
1746
 
    a           : 'anchor',
1747
 
    button          : 'form',
1748
 
    form        : 'form',
1749
 
    img         : 'image',
1750
 
    input       : 'form',
1751
 
    label       : 'form',
1752
 
    script      : 'script',
1753
 
    select      : 'form',
1754
 
    textarea    : 'form',
1755
 
    style       : 'style',
1756
 
    table       : 'table',
1757
 
    tbody       : 'table',
1758
 
    td          : 'table',
1759
 
    tfoot       : 'table',
1760
 
    th          : 'table',
1761
 
    tr          : 'table'
1762
 
});
1763
 
 
1764
 
var HtmlHighlightRules = function() {
1765
 
    this.$rules = {
1766
 
        start : [{
1767
 
            token : "text",
1768
 
            regex : "<\\!\\[CDATA\\[",
1769
 
            next : "cdata"
1770
 
        }, {
1771
 
            token : "xml-pe",
1772
 
            regex : "<\\?.*?\\?>"
1773
 
        }, {
1774
 
            token : "comment",
1775
 
            regex : "<\\!--",
1776
 
            next : "comment"
1777
 
        }, {
1778
 
            token : "xml-pe",
1779
 
            regex : "<\\!.*?>"
1780
 
        }, {
1781
 
            token : "meta.tag",
1782
 
            regex : "<(?=script\\b)",
1783
 
            next : "script"
1784
 
        }, {
1785
 
            token : "meta.tag",
1786
 
            regex : "<(?=style\\b)",
1787
 
            next : "style"
1788
 
        }, {
1789
 
            token : "meta.tag", // opening tag
1790
 
            regex : "<\\/?",
1791
 
            next : "tag"
1792
 
        }, {
1793
 
            token : "text",
1794
 
            regex : "\\s+"
1795
 
        }, {
1796
 
            token : "constant.character.entity",
1797
 
            regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1798
 
        }],
1799
 
    
1800
 
        cdata : [ {
1801
 
            token : "text",
1802
 
            regex : "\\]\\]>",
1803
 
            next : "start"
1804
 
        } ],
1805
 
 
1806
 
        comment : [ {
1807
 
            token : "comment",
1808
 
            regex : ".*?-->",
1809
 
            next : "start"
1810
 
        }, {
1811
 
            defaultToken : "comment"
1812
 
        } ]
1813
 
    };
1814
 
    
1815
 
    xmlUtil.tag(this.$rules, "tag", "start", tagMap);
1816
 
    xmlUtil.tag(this.$rules, "style", "css-start", tagMap);
1817
 
    xmlUtil.tag(this.$rules, "script", "js-start", tagMap);
1818
 
    
1819
 
    this.embedRules(JavaScriptHighlightRules, "js-", [{
1820
 
        token: "comment",
1821
 
        regex: "\\/\\/.*(?=<\\/script>)",
1822
 
        next: "tag"
1823
 
    }, {
1824
 
        token: "meta.tag",
1825
 
        regex: "<\\/(?=script)",
1826
 
        next: "tag"
1827
 
    }]);
1828
 
    
1829
 
    this.embedRules(CssHighlightRules, "css-", [{
1830
 
        token: "meta.tag",
1831
 
        regex: "<\\/(?=style)",
1832
 
        next: "tag"
1833
 
    }]);
1834
 
};
1835
 
 
1836
 
oop.inherits(HtmlHighlightRules, TextHighlightRules);
1837
 
 
1838
 
exports.HtmlHighlightRules = HtmlHighlightRules;
1839
 
});
1840
 
 
1841
 
define('ace/mode/behaviour/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour/xml', 'ace/mode/behaviour/cstyle', 'ace/token_iterator'], function(require, exports, module) {
1842
 
 
1843
 
 
1844
 
var oop = require("../../lib/oop");
1845
 
var XmlBehaviour = require("../behaviour/xml").XmlBehaviour;
1846
 
var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1847
 
var TokenIterator = require("../../token_iterator").TokenIterator;
1848
 
var voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
1849
 
 
1850
 
function hasType(token, type) {
1851
 
    var hasType = true;
1852
 
    var typeList = token.type.split('.');
1853
 
    var needleList = type.split('.');
1854
 
    needleList.forEach(function(needle){
1855
 
        if (typeList.indexOf(needle) == -1) {
1856
 
            hasType = false;
1857
 
            return false;
1858
 
        }
1859
 
    });
1860
 
    return hasType;
1861
 
}
1862
 
 
1863
 
var HtmlBehaviour = function () {
1864
 
 
1865
 
    this.inherit(XmlBehaviour); // Get xml behaviour
1866
 
    
1867
 
    this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
1868
 
        if (text == '>') {
1869
 
            var position = editor.getCursorPosition();
1870
 
            var iterator = new TokenIterator(session, position.row, position.column);
1871
 
            var token = iterator.getCurrentToken();
1872
 
            var atCursor = false;
1873
 
            if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
1874
 
                do {
1875
 
                    token = iterator.stepBackward();
1876
 
                } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
1877
 
            } else {
1878
 
                atCursor = true;
1879
 
            }
1880
 
            if (!token || !hasType(token, 'meta.tag-name') || iterator.stepBackward().value.match('/')) {
1881
 
                return
1882
 
            }
1883
 
            var element = token.value;
1884
 
            if (atCursor){
1885
 
                var element = element.substring(0, position.column - token.start);
1886
 
            }
1887
 
            if (voidElements.indexOf(element) !== -1){
1888
 
                return;
1889
 
            }
1890
 
            return {
1891
 
               text: '>' + '</' + element + '>',
1892
 
               selection: [1, 1]
1893
 
            }
1894
 
        }
1895
 
    });
1896
 
}
1897
 
oop.inherits(HtmlBehaviour, XmlBehaviour);
1898
 
 
1899
 
exports.HtmlBehaviour = HtmlBehaviour;
1900
 
});
1901
 
 
1902
 
define('ace/mode/folding/html', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/mixed', 'ace/mode/folding/xml', 'ace/mode/folding/cstyle'], function(require, exports, module) {
1903
 
 
1904
 
 
1905
 
var oop = require("../../lib/oop");
1906
 
var MixedFoldMode = require("./mixed").FoldMode;
1907
 
var XmlFoldMode = require("./xml").FoldMode;
1908
 
var CStyleFoldMode = require("./cstyle").FoldMode;
1909
 
 
1910
 
var FoldMode = exports.FoldMode = function() {
1911
 
    MixedFoldMode.call(this, new XmlFoldMode({
1912
 
        "area": 1,
1913
 
        "base": 1,
1914
 
        "br": 1,
1915
 
        "col": 1,
1916
 
        "command": 1,
1917
 
        "embed": 1,
1918
 
        "hr": 1,
1919
 
        "img": 1,
1920
 
        "input": 1,
1921
 
        "keygen": 1,
1922
 
        "link": 1,
1923
 
        "meta": 1,
1924
 
        "param": 1,
1925
 
        "source": 1,
1926
 
        "track": 1,
1927
 
        "wbr": 1,
1928
 
        "li": 1,
1929
 
        "dt": 1,
1930
 
        "dd": 1,
1931
 
        "p": 1,
1932
 
        "rt": 1,
1933
 
        "rp": 1,
1934
 
        "optgroup": 1,
1935
 
        "option": 1,
1936
 
        "colgroup": 1,
1937
 
        "td": 1,
1938
 
        "th": 1
1939
 
    }), {
1940
 
        "js-": new CStyleFoldMode(),
1941
 
        "css-": new CStyleFoldMode()
1942
 
    });
1943
 
};
1944
 
 
1945
 
oop.inherits(FoldMode, MixedFoldMode);
1946
 
 
1947
 
});
1948
 
 
1949
 
define('ace/mode/folding/mixed', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
1950
 
 
1951
 
 
1952
 
var oop = require("../../lib/oop");
1953
 
var BaseFoldMode = require("./fold_mode").FoldMode;
1954
 
 
1955
 
var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
1956
 
    this.defaultMode = defaultMode;
1957
 
    this.subModes = subModes;
1958
 
};
1959
 
oop.inherits(FoldMode, BaseFoldMode);
1960
 
 
1961
 
(function() {
1962
 
 
1963
 
 
1964
 
    this.$getMode = function(state) {
1965
 
        for (var key in this.subModes) {
1966
 
            if (state.indexOf(key) === 0)
1967
 
                return this.subModes[key];
1968
 
        }
1969
 
        return null;
1970
 
    };
1971
 
    
1972
 
    this.$tryMode = function(state, session, foldStyle, row) {
1973
 
        var mode = this.$getMode(state);
1974
 
        return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
1975
 
    };
1976
 
 
1977
 
    this.getFoldWidget = function(session, foldStyle, row) {
1978
 
        return (
1979
 
            this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
1980
 
            this.$tryMode(session.getState(row), session, foldStyle, row) ||
1981
 
            this.defaultMode.getFoldWidget(session, foldStyle, row)
1982
 
        );
1983
 
    };
1984
 
 
1985
 
    this.getFoldWidgetRange = function(session, foldStyle, row) {
1986
 
        var mode = this.$getMode(session.getState(row-1));
1987
 
        
1988
 
        if (!mode || !mode.getFoldWidget(session, foldStyle, row))
1989
 
            mode = this.$getMode(session.getState(row));
1990
 
        
1991
 
        if (!mode || !mode.getFoldWidget(session, foldStyle, row))
1992
 
            mode = this.defaultMode;
1993
 
        
1994
 
        return mode.getFoldWidgetRange(session, foldStyle, row);
1995
 
    };
1996
 
 
1997
 
}).call(FoldMode.prototype);
1998
 
 
1999
 
});
2000
 
 
2001
 
define('ace/mode/markdown_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules', 'ace/mode/html_highlight_rules', 'ace/mode/css_highlight_rules'], function(require, exports, module) {
2002
 
 
2003
 
 
2004
 
var oop = require("../lib/oop");
2005
 
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
2006
 
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
2007
 
var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
2008
 
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
2009
 
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
2010
 
 
2011
 
function github_embed(tag, prefix) {
2012
 
    return { // Github style block
2013
 
        token : "support.function",
2014
 
        regex : "^```" + tag + "\\s*$",
2015
 
        next  : prefix + "start"
2016
 
    };
2017
 
}
2018
 
 
2019
 
var MarkdownHighlightRules = function() {
2020
 
 
2021
 
    this.$rules = {
2022
 
        "basic" : [{ // code span `
2023
 
            token : "support.function",
2024
 
            regex : "(`+)(.*?[^`])(\\1)"
2025
 
        }, { // reference
2026
 
            token : ["text", "constant", "text", "url", "string", "text"],
2027
 
            regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
2028
 
        }, { // link by reference
2029
 
            token : ["text", "string", "text", "constant", "text"],
2030
 
            regex : "(\\[)((?:[[^\\]]*\\]|[^\\[\\]])*)(\\][ ]?(?:\\n[ ]*)?\\[)(.*?)(\\])"
2031
 
        }, { // link by url
2032
 
            token : ["text", "string", "text", "markup.underline", "string", "text"],
2033
 
            regex : "(\\[)"+
2034
 
                    "(\\[[^\\]]*\\]|[^\\[\\]]*)"+
2035
 
                    "(\\]\\([ \\t]*)"+
2036
 
                    "(<?(?:(?:[^\\(]*?\\([^\\)]*?\\)\\S*?)|(?:.*?))>?)"+
2037
 
                    "((?:[ \t]*\"(?:.*?)\"[ \\t]*)?)"+
2038
 
                    "(\\))"
2039
 
        }, { // strong ** __
2040
 
            token : "string",
2041
 
            regex : "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)"
2042
 
        }, { // emphasis * _
2043
 
            token : "string",
2044
 
            regex : "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)"
2045
 
        }, { //
2046
 
            token : ["text", "url", "text"],
2047
 
            regex : "(<)("+
2048
 
                      "(?:https?|ftp|dict):[^'\">\\s]+"+
2049
 
                      "|"+
2050
 
                      "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+"+
2051
 
                    ")(>)"
2052
 
        }],
2053
 
        "allowBlock": [
2054
 
            {token : "support.function", regex : "^ {4}.+", next : "allowBlock"},
2055
 
            {token : "empty", regex : "", next : "start"}
2056
 
        ],
2057
 
 
2058
 
        "start" : [{
2059
 
            token : "empty_line",
2060
 
            regex : '^$',
2061
 
            next: "allowBlock"
2062
 
        }, { // h1
2063
 
            token: "markup.heading.1",
2064
 
            regex: "^=+(?=\\s*$)"
2065
 
        }, { // h2
2066
 
            token: "markup.heading.2",
2067
 
            regex: "^\\-+(?=\\s*$)"
2068
 
        }, {
2069
 
            token : function(value) {
2070
 
                return "markup.heading." + value.length;
2071
 
            },
2072
 
            regex : /^#{1,6}(?=\s*[^ #]|\s+#.)/,
2073
 
            next : "header"
2074
 
        },
2075
 
           github_embed("(?:javascript|js)", "js-"),
2076
 
           github_embed("xml", "xml-"),
2077
 
           github_embed("html", "html-"),
2078
 
           github_embed("css", "css-"),
2079
 
        { // Github style block
2080
 
            token : "support.function",
2081
 
            regex : "^```\\s*[a-zA-Z]*(?:{.*?\\})?\\s*$",
2082
 
            next  : "githubblock"
2083
 
        }, { // block quote
2084
 
            token : "string",
2085
 
            regex : "^>[ ].+$",
2086
 
            next  : "blockquote"
2087
 
        }, { // HR * - _
2088
 
            token : "constant",
2089
 
            regex : "^ {0,2}(?:(?: ?\\* ?){3,}|(?: ?\\- ?){3,}|(?: ?\\_ ?){3,})\\s*$",
2090
 
            next: "allowBlock"
2091
 
        }, { // list
2092
 
            token : "markup.list",
2093
 
            regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
2094
 
            next  : "listblock-start"
2095
 
        }, {
2096
 
            include : "basic"
2097
 
        }],
2098
 
        
2099
 
        "header" : [{
2100
 
            regex: "$",
2101
 
            next : "start"
2102
 
        }, {
2103
 
            include: "basic"
2104
 
        }, {
2105
 
            defaultToken : "markup.heading"
2106
 
        } ],
2107
 
 
2108
 
        "listblock-start" : [{
2109
 
            token : "support.variable",
2110
 
            regex : /(?:\[[ x]\])?/,
2111
 
            next  : "listblock"
2112
 
        }],
2113
 
 
2114
 
        "listblock" : [ { // Lists only escape on completely blank lines.
2115
 
            token : "empty_line",
2116
 
            regex : "^$",
2117
 
            next  : "start"
2118
 
        }, { // list
2119
 
            token : "markup.list",
2120
 
            regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
2121
 
            next  : "listblock-start"
2122
 
        }, {
2123
 
            include : "basic", noEscape: true
2124
 
        }, {
2125
 
            defaultToken : "markup.list"
2126
 
        } ],
2127
 
 
2128
 
        "blockquote" : [ { // BLockquotes only escape on blank lines.
2129
 
            token : "empty_line",
2130
 
            regex : "^\\s*$",
2131
 
            next  : "start"
2132
 
        }, {
2133
 
            token : "string",
2134
 
            regex : ".+"
2135
 
        } ],
2136
 
 
2137
 
        "githubblock" : [ {
2138
 
            token : "support.function",
2139
 
            regex : "^```",
2140
 
            next  : "start"
2141
 
        }, {
2142
 
            token : "support.function",
2143
 
            regex : ".+"
2144
 
        } ]
2145
 
    };
2146
 
 
2147
 
    this.embedRules(JavaScriptHighlightRules, "js-", [{
2148
 
       token : "support.function",
2149
 
       regex : "^```",
2150
 
       next  : "start"
2151
 
    }]);
2152
 
 
2153
 
    this.embedRules(HtmlHighlightRules, "html-", [{
2154
 
       token : "support.function",
2155
 
       regex : "^```",
2156
 
       next  : "start"
2157
 
    }]);
2158
 
 
2159
 
    this.embedRules(CssHighlightRules, "css-", [{
2160
 
       token : "support.function",
2161
 
       regex : "^```",
2162
 
       next  : "start"
2163
 
    }]);
2164
 
 
2165
 
    this.embedRules(XmlHighlightRules, "xml-", [{
2166
 
       token : "support.function",
2167
 
       regex : "^```",
2168
 
       next  : "start"
2169
 
    }]);
2170
 
 
2171
 
    var html = new HtmlHighlightRules().getRules();
2172
 
    for (var i in html) {
2173
 
        if (this.$rules[i])
2174
 
            this.$rules[i] = this.$rules[i].concat(html[i]);
2175
 
        else
2176
 
            this.$rules[i] = html[i];
2177
 
    }
2178
 
 
2179
 
    this.normalizeRules();
2180
 
};
2181
 
oop.inherits(MarkdownHighlightRules, TextHighlightRules);
2182
 
 
2183
 
exports.MarkdownHighlightRules = MarkdownHighlightRules;
2184
 
});
2185
 
 
2186
 
define('ace/mode/folding/markdown', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode', 'ace/range'], function(require, exports, module) {
2187
 
 
2188
 
 
2189
 
var oop = require("../../lib/oop");
2190
 
var BaseFoldMode = require("./fold_mode").FoldMode;
2191
 
var Range = require("../../range").Range;
2192
 
 
2193
 
var FoldMode = exports.FoldMode = function() {};
2194
 
oop.inherits(FoldMode, BaseFoldMode);
2195
 
 
2196
 
(function() {
2197
 
    this.foldingStartMarker = /^(?:[=-]+\s*$|#{1,6} |`{3})/;
2198
 
 
2199
 
    this.getFoldWidget = function(session, foldStyle, row) {
2200
 
        var line = session.getLine(row);
2201
 
        if (!this.foldingStartMarker.test(line))
2202
 
            return "";
2203
 
 
2204
 
        if (line[0] == "`") {
2205
 
            if (session.bgTokenizer.getState(row) == "start")
2206
 
                return "end";
2207
 
            return "start";
2208
 
        }
2209
 
 
2210
 
        return "start";
2211
 
    };
2212
 
 
2213
 
    this.getFoldWidgetRange = function(session, foldStyle, row) {
2214
 
        var line = session.getLine(row);
2215
 
        var startColumn = line.length;
2216
 
        var maxRow = session.getLength();
2217
 
        var startRow = row;
2218
 
        var endRow = row;
2219
 
        if (!line.match(this.foldingStartMarker))
2220
 
            return;
2221
 
 
2222
 
        if (line[0] == "`") {
2223
 
            if (session.bgTokenizer.getState(row) !== "start") {
2224
 
                while (++row < maxRow) {
2225
 
                    line = session.getLine(row);
2226
 
                    if (line[0] == "`" & line.substring(0, 3) == "```")
2227
 
                        break;
2228
 
                }
2229
 
                return new Range(startRow, startColumn, row, 0);
2230
 
            } else {
2231
 
                while (row -- > 0) {
2232
 
                    line = session.getLine(row);
2233
 
                    if (line[0] == "`" & line.substring(0, 3) == "```")
2234
 
                        break;
2235
 
                }
2236
 
                return new Range(row, line.length, startRow, 0);
2237
 
            }
2238
 
        }
2239
 
 
2240
 
        var token;
2241
 
        function isHeading(row) {
2242
 
            token = session.getTokens(row)[0];
2243
 
            return token && token.type.lastIndexOf(heading, 0) === 0;
2244
 
        }
2245
 
 
2246
 
        var heading = "markup.heading";
2247
 
        function getLevel() {
2248
 
            var ch = token.value[0];
2249
 
            if (ch == "=") return 6;
2250
 
            if (ch == "-") return 5;
2251
 
            return 7 - token.value.search(/[^#]/);
2252
 
        }
2253
 
 
2254
 
        if (isHeading(row)) {
2255
 
            var startHeadingLevel = getLevel();
2256
 
            while (++row < maxRow) {
2257
 
                if (!isHeading(row))
2258
 
                    continue;
2259
 
                var level = getLevel();
2260
 
                if (level >= startHeadingLevel)
2261
 
                    break;
2262
 
            }
2263
 
 
2264
 
            endRow = row - (!token || ["=", "-"].indexOf(token.value[0]) == -1 ? 1 : 2);
2265
 
 
2266
 
            if (endRow > startRow) {
2267
 
                while (endRow > startRow && /^\s*$/.test(session.getLine(endRow)))
2268
 
                    endRow--;
2269
 
            }
2270
 
 
2271
 
            if (endRow > startRow) {
2272
 
                var endColumn = session.getLine(endRow).length;
2273
 
                return new Range(startRow, startColumn, endRow, endColumn);
2274
 
            }
2275
 
        }
2276
 
    };
2277
 
 
2278
 
}).call(FoldMode.prototype);
2279
 
 
2280
 
});