Projekt

Obecné

Profil

Stáhnout (175 KB) Statistiky
| Větev: | Tag: | Revize:
1
ace.define("ace/mode/slim_highlight_rules",["require","exports","module","ace/config","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
2
"use strict";
3

    
4
var modes = require("../config").$modes;
5

    
6
var oop = require("../lib/oop");
7
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
8
var SlimHighlightRules = function() {
9

    
10
    this.$rules = {
11
        "start": [
12
            {
13
                token: "keyword",
14
                regex: /^(\s*)(\w+):\s*/,
15
                onMatch: function(value, state, stack, line) {
16
                    var indent = /^\s*/.exec(line)[0];
17
                    var m = value.match(/^(\s*)(\w+):/);
18
                    var language = m[2];
19
                    if (!/^(javascript|ruby|coffee|markdown|css|scss|sass|less)$/.test(language))
20
                        language = "";
21
                    stack.unshift("language-embed", [], [indent, language], state);
22
                    return this.token;
23
                },
24
                stateName: "language-embed",
25
                next: [{
26
                    token: "string",
27
                    regex: /^(\s*)/,
28
                    onMatch: function(value, state, stack, line) {
29
                        var indent = stack[2][0];
30
                        if (indent.length >= value.length) {
31
                            stack.splice(0, 3);
32
                            this.next = stack.shift();
33
                            return this.token;
34
                        }
35
                        this.next = "";
36
                        return [{type: "text", value: indent}];
37
                    },
38
                    next: ""
39
                }, {
40
                    token: "string",
41
                    regex: /.+/,
42
                    onMatch: function(value, state, stack, line) {
43
                        var indent = stack[2][0];
44
                        var language = stack[2][1];
45
                        var embedState = stack[1];
46
                        
47
                        if (modes[language]) {
48
                            var data = modes[language].getTokenizer().getLineTokens(line.slice(indent.length), embedState.slice(0));
49
                            stack[1] = data.state;
50
                            return data.tokens;
51
                        }
52
                        return this.token;
53
                    }
54
                }]
55
            },
56
            {
57
                token: 'constant.begin.javascript.filter.slim',
58
                regex: '^(\\s*)():$'
59
            }, {
60
                token: 'constant.begin..filter.slim',
61
                regex: '^(\\s*)(ruby):$'
62
            }, {
63
                token: 'constant.begin.coffeescript.filter.slim',
64
                regex: '^(\\s*)():$'
65
            }, {
66
                token: 'constant.begin..filter.slim',
67
                regex: '^(\\s*)(markdown):$'
68
            }, {
69
                token: 'constant.begin.css.filter.slim',
70
                regex: '^(\\s*)():$'
71
            }, {
72
                token: 'constant.begin.scss.filter.slim',
73
                regex: '^(\\s*)():$'
74
            }, {
75
                token: 'constant.begin..filter.slim',
76
                regex: '^(\\s*)(sass):$'
77
            }, {
78
                token: 'constant.begin..filter.slim',
79
                regex: '^(\\s*)(less):$'
80
            }, {
81
                token: 'constant.begin..filter.slim',
82
                regex: '^(\\s*)(erb):$'
83
            }, {
84
                token: 'keyword.html.tags.slim',
85
                regex: '^(\\s*)((:?\\*(\\w)+)|doctype html|abbr|acronym|address|applet|area|article|aside|audio|base|basefont|bdo|big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|command|datalist|dd|del|details|dialog|dfn|dir|div|dl|dt|embed|fieldset|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|link|li|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|source|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video|xmp|b|u|s|em|a)(?:([.#](\\w|\\.)+)+\\s?)?\\b'
86

    
87
            }, {
88
                token: 'keyword.slim',
89
                regex: '^(\\s*)(?:([.#](\\w|\\.)+)+\\s?)'
90
            }, {
91
                token: "string",
92
                regex: /^(\s*)('|\||\/|(\/!))\s*/,
93
                onMatch: function(val, state, stack, line) {
94
                    var indent = /^\s*/.exec(line)[0];
95
                    if (stack.length < 1) {
96
                        stack.push(this.next);
97
                    }
98
                    else {
99
                        stack[0] = "mlString";
100
                    }
101

    
102
                    if (stack.length < 2) {
103
                        stack.push(indent.length);
104
                    }
105
                    else {
106
                        stack[1] = indent.length;
107
                    }
108
                    return this.token;
109
                },
110
                next: "mlString"
111
            }, {
112
                token: 'keyword.control.slim',
113
                regex: '^(\\s*)(\\-|==|=)',
114
                push: [{
115
                    token: 'control.end.slim',
116
                    regex: '$',
117
                    next: "pop"
118
                }, {
119
                    include: "rubyline"
120
                }, {
121
                    include: "misc"
122
                }]
123

    
124
            }, {
125
                token: 'paren',
126
                regex: '\\(',
127
                push: [{
128
                    token: 'paren',
129
                    regex: '\\)',
130
                    next: "pop"
131
                }, {
132
                    include: "misc"
133
                }]
134

    
135
            }, {
136
                token: 'paren',
137
                regex: '\\[',
138
                push: [{
139
                    token: 'paren',
140
                    regex: '\\]',
141
                    next: "pop"
142
                }, {
143
                    include: "misc"
144
                }]
145
            }, {
146
                include: "misc"
147
            }
148
        ],
149
        "mlString": [{
150
            token: "indent",
151
            regex: /^\s*/,
152
            onMatch: function(val, state, stack) {
153
                var curIndent = stack[1];
154

    
155
                if (curIndent >= val.length) {
156
                    this.next = "start";
157
                    stack.splice(0);
158
                }
159
                else {
160
                    this.next = "mlString";
161
                }
162
                return this.token;
163
            },
164
            next: "start"
165
        }, {
166
            defaultToken: "string"
167
        }],
168
        "rubyline": [{
169
            token: "keyword.operator.ruby.embedded.slim",
170
            regex: "(==|=)(<>|><|<'|'<|<|>)?|-"
171
        }, {
172
            token: "list.ruby.operators.slim",
173
            regex: "(\\b)(for|in|do|if|else|elsif|unless|while|yield|not|and|or)\\b"
174
        }, {
175
            token: "string",
176
            regex: "['](.)*?[']"
177
        }, {
178
            token: "string",
179
            regex: "[\"](.)*?[\"]"
180
        }],
181
        "misc": [{
182
            token: 'class.variable.slim',
183
            regex: '\\@([a-zA-Z_][a-zA-Z0-9_]*)\\b'
184
        }, {
185
            token: "list.meta.slim",
186
            regex: "(\\b)(true|false|nil)(\\b)"
187
        }, {
188
            token: 'keyword.operator.equals.slim',
189
            regex: '='
190
        }, {
191
            token: "string",
192
            regex: "['](.)*?[']"
193
        }, {
194
            token: "string",
195
            regex: "[\"](.)*?[\"]"
196
        }]
197
    };
198
    this.normalizeRules();
199
};
200

    
201

    
202
oop.inherits(SlimHighlightRules, TextHighlightRules);
203

    
204
exports.SlimHighlightRules = SlimHighlightRules;
205
});
206

    
207
ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
208
"use strict";
209

    
210
var oop = require("../lib/oop");
211
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
212

    
213
var DocCommentHighlightRules = function() {
214
    this.$rules = {
215
        "start" : [ {
216
            token : "comment.doc.tag",
217
            regex : "@[\\w\\d_]+" // TODO: fix email addresses
218
        }, 
219
        DocCommentHighlightRules.getTagRule(),
220
        {
221
            defaultToken : "comment.doc",
222
            caseInsensitive: true
223
        }]
224
    };
225
};
226

    
227
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
228

    
229
DocCommentHighlightRules.getTagRule = function(start) {
230
    return {
231
        token : "comment.doc.tag.storage.type",
232
        regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
233
    };
234
};
235

    
236
DocCommentHighlightRules.getStartRule = function(start) {
237
    return {
238
        token : "comment.doc", // doc comment
239
        regex : "\\/\\*(?=\\*)",
240
        next  : start
241
    };
242
};
243

    
244
DocCommentHighlightRules.getEndRule = function (start) {
245
    return {
246
        token : "comment.doc", // closing comment
247
        regex : "\\*\\/",
248
        next  : start
249
    };
250
};
251

    
252

    
253
exports.DocCommentHighlightRules = DocCommentHighlightRules;
254

    
255
});
256

    
257
ace.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) {
258
"use strict";
259

    
260
var oop = require("../lib/oop");
261
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
262
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
263
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
264

    
265
var JavaScriptHighlightRules = function(options) {
266
    var keywordMapper = this.createKeywordMapper({
267
        "variable.language":
268
            "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|"  + // Constructors
269
            "Namespace|QName|XML|XMLList|"                                             + // E4X
270
            "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|"   +
271
            "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|"                    +
272
            "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|"   + // Errors
273
            "SyntaxError|TypeError|URIError|"                                          +
274
            "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
275
            "isNaN|parseFloat|parseInt|"                                               +
276
            "JSON|Math|"                                                               + // Other
277
            "this|arguments|prototype|window|document"                                 , // Pseudo
278
        "keyword":
279
            "const|yield|import|get|set|async|await|" +
280
            "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
281
            "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
282
            "__parent__|__count__|escape|unescape|with|__proto__|" +
283
            "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
284
        "storage.type":
285
            "const|let|var|function",
286
        "constant.language":
287
            "null|Infinity|NaN|undefined",
288
        "support.function":
289
            "alert",
290
        "constant.language.boolean": "true|false"
291
    }, "identifier");
292
    var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
293

    
294
    var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
295
        "u[0-9a-fA-F]{4}|" + // unicode
296
        "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
297
        "[0-2][0-7]{0,2}|" + // oct
298
        "3[0-7][0-7]?|" + // oct
299
        "[4-7][0-7]?|" + //oct
300
        ".)";
301

    
302
    this.$rules = {
303
        "no_regex" : [
304
            DocCommentHighlightRules.getStartRule("doc-start"),
305
            comments("no_regex"),
306
            {
307
                token : "string",
308
                regex : "'(?=.)",
309
                next  : "qstring"
310
            }, {
311
                token : "string",
312
                regex : '"(?=.)',
313
                next  : "qqstring"
314
            }, {
315
                token : "constant.numeric", // hexadecimal, octal and binary
316
                regex : /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
317
            }, {
318
                token : "constant.numeric", // decimal integers and floats
319
                regex : /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
320
            }, {
321
                token : [
322
                    "storage.type", "punctuation.operator", "support.function",
323
                    "punctuation.operator", "entity.name.function", "text","keyword.operator"
324
                ],
325
                regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
326
                next: "function_arguments"
327
            }, {
328
                token : [
329
                    "storage.type", "punctuation.operator", "entity.name.function", "text",
330
                    "keyword.operator", "text", "storage.type", "text", "paren.lparen"
331
                ],
332
                regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
333
                next: "function_arguments"
334
            }, {
335
                token : [
336
                    "entity.name.function", "text", "keyword.operator", "text", "storage.type",
337
                    "text", "paren.lparen"
338
                ],
339
                regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
340
                next: "function_arguments"
341
            }, {
342
                token : [
343
                    "storage.type", "punctuation.operator", "entity.name.function", "text",
344
                    "keyword.operator", "text",
345
                    "storage.type", "text", "entity.name.function", "text", "paren.lparen"
346
                ],
347
                regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
348
                next: "function_arguments"
349
            }, {
350
                token : [
351
                    "storage.type", "text", "entity.name.function", "text", "paren.lparen"
352
                ],
353
                regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
354
                next: "function_arguments"
355
            }, {
356
                token : [
357
                    "entity.name.function", "text", "punctuation.operator",
358
                    "text", "storage.type", "text", "paren.lparen"
359
                ],
360
                regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
361
                next: "function_arguments"
362
            }, {
363
                token : [
364
                    "text", "text", "storage.type", "text", "paren.lparen"
365
                ],
366
                regex : "(:)(\\s*)(function)(\\s*)(\\()",
367
                next: "function_arguments"
368
            }, {
369
                token : "keyword",
370
                regex : "from(?=\\s*('|\"))"
371
            }, {
372
                token : "keyword",
373
                regex : "(?:" + kwBeforeRe + ")\\b",
374
                next : "start"
375
            }, {
376
                token : ["support.constant"],
377
                regex : /that\b/
378
            }, {
379
                token : ["storage.type", "punctuation.operator", "support.function.firebug"],
380
                regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
381
            }, {
382
                token : keywordMapper,
383
                regex : identifierRe
384
            }, {
385
                token : "punctuation.operator",
386
                regex : /[.](?![.])/,
387
                next  : "property"
388
            }, {
389
                token : "storage.type",
390
                regex : /=>/,
391
                next  : "start"
392
            }, {
393
                token : "keyword.operator",
394
                regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
395
                next  : "start"
396
            }, {
397
                token : "punctuation.operator",
398
                regex : /[?:,;.]/,
399
                next  : "start"
400
            }, {
401
                token : "paren.lparen",
402
                regex : /[\[({]/,
403
                next  : "start"
404
            }, {
405
                token : "paren.rparen",
406
                regex : /[\])}]/
407
            }, {
408
                token: "comment",
409
                regex: /^#!.*$/
410
            }
411
        ],
412
        property: [{
413
                token : "text",
414
                regex : "\\s+"
415
            }, {
416
                token : [
417
                    "storage.type", "punctuation.operator", "entity.name.function", "text",
418
                    "keyword.operator", "text",
419
                    "storage.type", "text", "entity.name.function", "text", "paren.lparen"
420
                ],
421
                regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
422
                next: "function_arguments"
423
            }, {
424
                token : "punctuation.operator",
425
                regex : /[.](?![.])/
426
            }, {
427
                token : "support.function",
428
                regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|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(?=\()/
429
            }, {
430
                token : "support.function.dom",
431
                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|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
432
            }, {
433
                token :  "support.constant",
434
                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/
435
            }, {
436
                token : "identifier",
437
                regex : identifierRe
438
            }, {
439
                regex: "",
440
                token: "empty",
441
                next: "no_regex"
442
            }
443
        ],
444
        "start": [
445
            DocCommentHighlightRules.getStartRule("doc-start"),
446
            comments("start"),
447
            {
448
                token: "string.regexp",
449
                regex: "\\/",
450
                next: "regex"
451
            }, {
452
                token : "text",
453
                regex : "\\s+|^$",
454
                next : "start"
455
            }, {
456
                token: "empty",
457
                regex: "",
458
                next: "no_regex"
459
            }
460
        ],
461
        "regex": [
462
            {
463
                token: "regexp.keyword.operator",
464
                regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
465
            }, {
466
                token: "string.regexp",
467
                regex: "/[sxngimy]*",
468
                next: "no_regex"
469
            }, {
470
                token : "invalid",
471
                regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
472
            }, {
473
                token : "constant.language.escape",
474
                regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
475
            }, {
476
                token : "constant.language.delimiter",
477
                regex: /\|/
478
            }, {
479
                token: "constant.language.escape",
480
                regex: /\[\^?/,
481
                next: "regex_character_class"
482
            }, {
483
                token: "empty",
484
                regex: "$",
485
                next: "no_regex"
486
            }, {
487
                defaultToken: "string.regexp"
488
            }
489
        ],
490
        "regex_character_class": [
491
            {
492
                token: "regexp.charclass.keyword.operator",
493
                regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
494
            }, {
495
                token: "constant.language.escape",
496
                regex: "]",
497
                next: "regex"
498
            }, {
499
                token: "constant.language.escape",
500
                regex: "-"
501
            }, {
502
                token: "empty",
503
                regex: "$",
504
                next: "no_regex"
505
            }, {
506
                defaultToken: "string.regexp.charachterclass"
507
            }
508
        ],
509
        "function_arguments": [
510
            {
511
                token: "variable.parameter",
512
                regex: identifierRe
513
            }, {
514
                token: "punctuation.operator",
515
                regex: "[, ]+"
516
            }, {
517
                token: "punctuation.operator",
518
                regex: "$"
519
            }, {
520
                token: "empty",
521
                regex: "",
522
                next: "no_regex"
523
            }
524
        ],
525
        "qqstring" : [
526
            {
527
                token : "constant.language.escape",
528
                regex : escapedRe
529
            }, {
530
                token : "string",
531
                regex : "\\\\$",
532
                consumeLineEnd  : true
533
            }, {
534
                token : "string",
535
                regex : '"|$',
536
                next  : "no_regex"
537
            }, {
538
                defaultToken: "string"
539
            }
540
        ],
541
        "qstring" : [
542
            {
543
                token : "constant.language.escape",
544
                regex : escapedRe
545
            }, {
546
                token : "string",
547
                regex : "\\\\$",
548
                consumeLineEnd  : true
549
            }, {
550
                token : "string",
551
                regex : "'|$",
552
                next  : "no_regex"
553
            }, {
554
                defaultToken: "string"
555
            }
556
        ]
557
    };
558

    
559

    
560
    if (!options || !options.noES6) {
561
        this.$rules.no_regex.unshift({
562
            regex: "[{}]", onMatch: function(val, state, stack) {
563
                this.next = val == "{" ? this.nextState : "";
564
                if (val == "{" && stack.length) {
565
                    stack.unshift("start", state);
566
                }
567
                else if (val == "}" && stack.length) {
568
                    stack.shift();
569
                    this.next = stack.shift();
570
                    if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
571
                        return "paren.quasi.end";
572
                }
573
                return val == "{" ? "paren.lparen" : "paren.rparen";
574
            },
575
            nextState: "start"
576
        }, {
577
            token : "string.quasi.start",
578
            regex : /`/,
579
            push  : [{
580
                token : "constant.language.escape",
581
                regex : escapedRe
582
            }, {
583
                token : "paren.quasi.start",
584
                regex : /\${/,
585
                push  : "start"
586
            }, {
587
                token : "string.quasi.end",
588
                regex : /`/,
589
                next  : "pop"
590
            }, {
591
                defaultToken: "string.quasi"
592
            }]
593
        });
594

    
595
        if (!options || options.jsx != false)
596
            JSX.call(this);
597
    }
598

    
599
    this.embedRules(DocCommentHighlightRules, "doc-",
600
        [ DocCommentHighlightRules.getEndRule("no_regex") ]);
601

    
602
    this.normalizeRules();
603
};
604

    
605
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
606

    
607
function JSX() {
608
    var tagRegex = identifierRe.replace("\\d", "\\d\\-");
609
    var jsxTag = {
610
        onMatch : function(val, state, stack) {
611
            var offset = val.charAt(1) == "/" ? 2 : 1;
612
            if (offset == 1) {
613
                if (state != this.nextState)
614
                    stack.unshift(this.next, this.nextState, 0);
615
                else
616
                    stack.unshift(this.next);
617
                stack[2]++;
618
            } else if (offset == 2) {
619
                if (state == this.nextState) {
620
                    stack[1]--;
621
                    if (!stack[1] || stack[1] < 0) {
622
                        stack.shift();
623
                        stack.shift();
624
                    }
625
                }
626
            }
627
            return [{
628
                type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
629
                value: val.slice(0, offset)
630
            }, {
631
                type: "meta.tag.tag-name.xml",
632
                value: val.substr(offset)
633
            }];
634
        },
635
        regex : "</?" + tagRegex + "",
636
        next: "jsxAttributes",
637
        nextState: "jsx"
638
    };
639
    this.$rules.start.unshift(jsxTag);
640
    var jsxJsRule = {
641
        regex: "{",
642
        token: "paren.quasi.start",
643
        push: "start"
644
    };
645
    this.$rules.jsx = [
646
        jsxJsRule,
647
        jsxTag,
648
        {include : "reference"},
649
        {defaultToken: "string"}
650
    ];
651
    this.$rules.jsxAttributes = [{
652
        token : "meta.tag.punctuation.tag-close.xml",
653
        regex : "/?>",
654
        onMatch : function(value, currentState, stack) {
655
            if (currentState == stack[0])
656
                stack.shift();
657
            if (value.length == 2) {
658
                if (stack[0] == this.nextState)
659
                    stack[1]--;
660
                if (!stack[1] || stack[1] < 0) {
661
                    stack.splice(0, 2);
662
                }
663
            }
664
            this.next = stack[0] || "start";
665
            return [{type: this.token, value: value}];
666
        },
667
        nextState: "jsx"
668
    },
669
    jsxJsRule,
670
    comments("jsxAttributes"),
671
    {
672
        token : "entity.other.attribute-name.xml",
673
        regex : tagRegex
674
    }, {
675
        token : "keyword.operator.attribute-equals.xml",
676
        regex : "="
677
    }, {
678
        token : "text.tag-whitespace.xml",
679
        regex : "\\s+"
680
    }, {
681
        token : "string.attribute-value.xml",
682
        regex : "'",
683
        stateName : "jsx_attr_q",
684
        push : [
685
            {token : "string.attribute-value.xml", regex: "'", next: "pop"},
686
            {include : "reference"},
687
            {defaultToken : "string.attribute-value.xml"}
688
        ]
689
    }, {
690
        token : "string.attribute-value.xml",
691
        regex : '"',
692
        stateName : "jsx_attr_qq",
693
        push : [
694
            {token : "string.attribute-value.xml", regex: '"', next: "pop"},
695
            {include : "reference"},
696
            {defaultToken : "string.attribute-value.xml"}
697
        ]
698
    },
699
    jsxTag
700
    ];
701
    this.$rules.reference = [{
702
        token : "constant.language.escape.reference.xml",
703
        regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
704
    }];
705
}
706

    
707
function comments(next) {
708
    return [
709
        {
710
            token : "comment", // multi line comment
711
            regex : /\/\*/,
712
            next: [
713
                DocCommentHighlightRules.getTagRule(),
714
                {token : "comment", regex : "\\*\\/", next : next || "pop"},
715
                {defaultToken : "comment", caseInsensitive: true}
716
            ]
717
        }, {
718
            token : "comment",
719
            regex : "\\/\\/",
720
            next: [
721
                DocCommentHighlightRules.getTagRule(),
722
                {token : "comment", regex : "$|^", next : next || "pop"},
723
                {defaultToken : "comment", caseInsensitive: true}
724
            ]
725
        }
726
    ];
727
}
728
exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
729
});
730

    
731
ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
732
"use strict";
733

    
734
var Range = require("../range").Range;
735

    
736
var MatchingBraceOutdent = function() {};
737

    
738
(function() {
739

    
740
    this.checkOutdent = function(line, input) {
741
        if (! /^\s+$/.test(line))
742
            return false;
743

    
744
        return /^\s*\}/.test(input);
745
    };
746

    
747
    this.autoOutdent = function(doc, row) {
748
        var line = doc.getLine(row);
749
        var match = line.match(/^(\s*\})/);
750

    
751
        if (!match) return 0;
752

    
753
        var column = match[1].length;
754
        var openBracePos = doc.findMatchingBracket({row: row, column: column});
755

    
756
        if (!openBracePos || openBracePos.row == row) return 0;
757

    
758
        var indent = this.$getIndent(doc.getLine(openBracePos.row));
759
        doc.replace(new Range(row, 0, row, column-1), indent);
760
    };
761

    
762
    this.$getIndent = function(line) {
763
        return line.match(/^\s*/)[0];
764
    };
765

    
766
}).call(MatchingBraceOutdent.prototype);
767

    
768
exports.MatchingBraceOutdent = MatchingBraceOutdent;
769
});
770

    
771
ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
772
"use strict";
773

    
774
var oop = require("../../lib/oop");
775
var Range = require("../../range").Range;
776
var BaseFoldMode = require("./fold_mode").FoldMode;
777

    
778
var FoldMode = exports.FoldMode = function(commentRegex) {
779
    if (commentRegex) {
780
        this.foldingStartMarker = new RegExp(
781
            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
782
        );
783
        this.foldingStopMarker = new RegExp(
784
            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
785
        );
786
    }
787
};
788
oop.inherits(FoldMode, BaseFoldMode);
789

    
790
(function() {
791
    
792
    this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
793
    this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
794
    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
795
    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
796
    this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
797
    this._getFoldWidgetBase = this.getFoldWidget;
798
    this.getFoldWidget = function(session, foldStyle, row) {
799
        var line = session.getLine(row);
800
    
801
        if (this.singleLineBlockCommentRe.test(line)) {
802
            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
803
                return "";
804
        }
805
    
806
        var fw = this._getFoldWidgetBase(session, foldStyle, row);
807
    
808
        if (!fw && this.startRegionRe.test(line))
809
            return "start"; // lineCommentRegionStart
810
    
811
        return fw;
812
    };
813

    
814
    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
815
        var line = session.getLine(row);
816
        
817
        if (this.startRegionRe.test(line))
818
            return this.getCommentRegionBlock(session, line, row);
819
        
820
        var match = line.match(this.foldingStartMarker);
821
        if (match) {
822
            var i = match.index;
823

    
824
            if (match[1])
825
                return this.openingBracketBlock(session, match[1], row, i);
826
                
827
            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
828
            
829
            if (range && !range.isMultiLine()) {
830
                if (forceMultiline) {
831
                    range = this.getSectionRange(session, row);
832
                } else if (foldStyle != "all")
833
                    range = null;
834
            }
835
            
836
            return range;
837
        }
838

    
839
        if (foldStyle === "markbegin")
840
            return;
841

    
842
        var match = line.match(this.foldingStopMarker);
843
        if (match) {
844
            var i = match.index + match[0].length;
845

    
846
            if (match[1])
847
                return this.closingBracketBlock(session, match[1], row, i);
848

    
849
            return session.getCommentFoldRange(row, i, -1);
850
        }
851
    };
852
    
853
    this.getSectionRange = function(session, row) {
854
        var line = session.getLine(row);
855
        var startIndent = line.search(/\S/);
856
        var startRow = row;
857
        var startColumn = line.length;
858
        row = row + 1;
859
        var endRow = row;
860
        var maxRow = session.getLength();
861
        while (++row < maxRow) {
862
            line = session.getLine(row);
863
            var indent = line.search(/\S/);
864
            if (indent === -1)
865
                continue;
866
            if  (startIndent > indent)
867
                break;
868
            var subRange = this.getFoldWidgetRange(session, "all", row);
869
            
870
            if (subRange) {
871
                if (subRange.start.row <= startRow) {
872
                    break;
873
                } else if (subRange.isMultiLine()) {
874
                    row = subRange.end.row;
875
                } else if (startIndent == indent) {
876
                    break;
877
                }
878
            }
879
            endRow = row;
880
        }
881
        
882
        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
883
    };
884
    this.getCommentRegionBlock = function(session, line, row) {
885
        var startColumn = line.search(/\s*$/);
886
        var maxRow = session.getLength();
887
        var startRow = row;
888
        
889
        var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
890
        var depth = 1;
891
        while (++row < maxRow) {
892
            line = session.getLine(row);
893
            var m = re.exec(line);
894
            if (!m) continue;
895
            if (m[1]) depth--;
896
            else depth++;
897

    
898
            if (!depth) break;
899
        }
900

    
901
        var endRow = row;
902
        if (endRow > startRow) {
903
            return new Range(startRow, startColumn, endRow, line.length);
904
        }
905
    };
906

    
907
}).call(FoldMode.prototype);
908

    
909
});
910

    
911
ace.define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
912
"use strict";
913

    
914
var oop = require("../lib/oop");
915
var TextMode = require("./text").Mode;
916
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
917
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
918
var WorkerClient = require("../worker/worker_client").WorkerClient;
919
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
920
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
921

    
922
var Mode = function() {
923
    this.HighlightRules = JavaScriptHighlightRules;
924
    
925
    this.$outdent = new MatchingBraceOutdent();
926
    this.$behaviour = new CstyleBehaviour();
927
    this.foldingRules = new CStyleFoldMode();
928
};
929
oop.inherits(Mode, TextMode);
930

    
931
(function() {
932

    
933
    this.lineCommentStart = "//";
934
    this.blockComment = {start: "/*", end: "*/"};
935
    this.$quotes = {'"': '"', "'": "'", "`": "`"};
936

    
937
    this.getNextLineIndent = function(state, line, tab) {
938
        var indent = this.$getIndent(line);
939

    
940
        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
941
        var tokens = tokenizedLine.tokens;
942
        var endState = tokenizedLine.state;
943

    
944
        if (tokens.length && tokens[tokens.length-1].type == "comment") {
945
            return indent;
946
        }
947

    
948
        if (state == "start" || state == "no_regex") {
949
            var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
950
            if (match) {
951
                indent += tab;
952
            }
953
        } else if (state == "doc-start") {
954
            if (endState == "start" || endState == "no_regex") {
955
                return "";
956
            }
957
            var match = line.match(/^\s*(\/?)\*/);
958
            if (match) {
959
                if (match[1]) {
960
                    indent += " ";
961
                }
962
                indent += "* ";
963
            }
964
        }
965

    
966
        return indent;
967
    };
968

    
969
    this.checkOutdent = function(state, line, input) {
970
        return this.$outdent.checkOutdent(line, input);
971
    };
972

    
973
    this.autoOutdent = function(state, doc, row) {
974
        this.$outdent.autoOutdent(doc, row);
975
    };
976

    
977
    this.createWorker = function(session) {
978
        var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
979
        worker.attachToDocument(session.getDocument());
980

    
981
        worker.on("annotate", function(results) {
982
            session.setAnnotations(results.data);
983
        });
984

    
985
        worker.on("terminate", function() {
986
            session.clearAnnotations();
987
        });
988

    
989
        return worker;
990
    };
991

    
992
    this.$id = "ace/mode/javascript";
993
    this.snippetFileId = "ace/snippets/javascript";
994
}).call(Mode.prototype);
995

    
996
exports.Mode = Mode;
997
});
998

    
999
ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
1000
"use strict";
1001

    
1002
var oop = require("../lib/oop");
1003
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1004

    
1005
var XmlHighlightRules = function(normalize) {
1006
    var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
1007

    
1008
    this.$rules = {
1009
        start : [
1010
            {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
1011
            {
1012
                token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
1013
                regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction"
1014
            },
1015
            {token : "comment.start.xml", regex : "<\\!--", next : "comment"},
1016
            {
1017
                token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
1018
                regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
1019
            },
1020
            {include : "tag"},
1021
            {token : "text.end-tag-open.xml", regex: "</"},
1022
            {token : "text.tag-open.xml", regex: "<"},
1023
            {include : "reference"},
1024
            {defaultToken : "text.xml"}
1025
        ],
1026

    
1027
        processing_instruction : [{
1028
            token : "entity.other.attribute-name.decl-attribute-name.xml",
1029
            regex : tagRegex
1030
        }, {
1031
            token : "keyword.operator.decl-attribute-equals.xml",
1032
            regex : "="
1033
        }, {
1034
            include: "whitespace"
1035
        }, {
1036
            include: "string"
1037
        }, {
1038
            token : "punctuation.xml-decl.xml",
1039
            regex : "\\?>",
1040
            next : "start"
1041
        }],
1042

    
1043
        doctype : [
1044
            {include : "whitespace"},
1045
            {include : "string"},
1046
            {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
1047
            {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
1048
            {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
1049
        ],
1050

    
1051
        int_subset : [{
1052
            token : "text.xml",
1053
            regex : "\\s+"
1054
        }, {
1055
            token: "punctuation.int-subset.xml",
1056
            regex: "]",
1057
            next: "pop"
1058
        }, {
1059
            token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
1060
            regex : "(<\\!)(" + tagRegex + ")",
1061
            push : [{
1062
                token : "text",
1063
                regex : "\\s+"
1064
            },
1065
            {
1066
                token : "punctuation.markup-decl.xml",
1067
                regex : ">",
1068
                next : "pop"
1069
            },
1070
            {include : "string"}]
1071
        }],
1072

    
1073
        cdata : [
1074
            {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
1075
            {token : "text.xml", regex : "\\s+"},
1076
            {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
1077
        ],
1078

    
1079
        comment : [
1080
            {token : "comment.end.xml", regex : "-->", next : "start"},
1081
            {defaultToken : "comment.xml"}
1082
        ],
1083

    
1084
        reference : [{
1085
            token : "constant.language.escape.reference.xml",
1086
            regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1087
        }],
1088

    
1089
        attr_reference : [{
1090
            token : "constant.language.escape.reference.attribute-value.xml",
1091
            regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1092
        }],
1093

    
1094
        tag : [{
1095
            token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
1096
            regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
1097
            next: [
1098
                {include : "attributes"},
1099
                {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
1100
            ]
1101
        }],
1102

    
1103
        tag_whitespace : [
1104
            {token : "text.tag-whitespace.xml", regex : "\\s+"}
1105
        ],
1106
        whitespace : [
1107
            {token : "text.whitespace.xml", regex : "\\s+"}
1108
        ],
1109
        string: [{
1110
            token : "string.xml",
1111
            regex : "'",
1112
            push : [
1113
                {token : "string.xml", regex: "'", next: "pop"},
1114
                {defaultToken : "string.xml"}
1115
            ]
1116
        }, {
1117
            token : "string.xml",
1118
            regex : '"',
1119
            push : [
1120
                {token : "string.xml", regex: '"', next: "pop"},
1121
                {defaultToken : "string.xml"}
1122
            ]
1123
        }],
1124

    
1125
        attributes: [{
1126
            token : "entity.other.attribute-name.xml",
1127
            regex : tagRegex
1128
        }, {
1129
            token : "keyword.operator.attribute-equals.xml",
1130
            regex : "="
1131
        }, {
1132
            include: "tag_whitespace"
1133
        }, {
1134
            include: "attribute_value"
1135
        }],
1136

    
1137
        attribute_value: [{
1138
            token : "string.attribute-value.xml",
1139
            regex : "'",
1140
            push : [
1141
                {token : "string.attribute-value.xml", regex: "'", next: "pop"},
1142
                {include : "attr_reference"},
1143
                {defaultToken : "string.attribute-value.xml"}
1144
            ]
1145
        }, {
1146
            token : "string.attribute-value.xml",
1147
            regex : '"',
1148
            push : [
1149
                {token : "string.attribute-value.xml", regex: '"', next: "pop"},
1150
                {include : "attr_reference"},
1151
                {defaultToken : "string.attribute-value.xml"}
1152
            ]
1153
        }]
1154
    };
1155

    
1156
    if (this.constructor === XmlHighlightRules)
1157
        this.normalizeRules();
1158
};
1159

    
1160

    
1161
(function() {
1162

    
1163
    this.embedTagRules = function(HighlightRules, prefix, tag){
1164
        this.$rules.tag.unshift({
1165
            token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
1166
            regex : "(<)(" + tag + "(?=\\s|>|$))",
1167
            next: [
1168
                {include : "attributes"},
1169
                {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
1170
            ]
1171
        });
1172

    
1173
        this.$rules[tag + "-end"] = [
1174
            {include : "attributes"},
1175
            {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>",  next: "start",
1176
                onMatch : function(value, currentState, stack) {
1177
                    stack.splice(0);
1178
                    return this.token;
1179
            }}
1180
        ];
1181

    
1182
        this.embedRules(HighlightRules, prefix, [{
1183
            token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
1184
            regex : "(</)(" + tag + "(?=\\s|>|$))",
1185
            next: tag + "-end"
1186
        }, {
1187
            token: "string.cdata.xml",
1188
            regex : "<\\!\\[CDATA\\["
1189
        }, {
1190
            token: "string.cdata.xml",
1191
            regex : "\\]\\]>"
1192
        }]);
1193
    };
1194

    
1195
}).call(TextHighlightRules.prototype);
1196

    
1197
oop.inherits(XmlHighlightRules, TextHighlightRules);
1198

    
1199
exports.XmlHighlightRules = XmlHighlightRules;
1200
});
1201

    
1202
ace.define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
1203
"use strict";
1204

    
1205
var oop = require("../../lib/oop");
1206
var Behaviour = require("../behaviour").Behaviour;
1207
var TokenIterator = require("../../token_iterator").TokenIterator;
1208
var lang = require("../../lib/lang");
1209

    
1210
function is(token, type) {
1211
    return token && token.type.lastIndexOf(type + ".xml") > -1;
1212
}
1213

    
1214
var XmlBehaviour = function () {
1215

    
1216
    this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
1217
        if (text == '"' || text == "'") {
1218
            var quote = text;
1219
            var selected = session.doc.getTextRange(editor.getSelectionRange());
1220
            if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
1221
                return {
1222
                    text: quote + selected + quote,
1223
                    selection: false
1224
                };
1225
            }
1226

    
1227
            var cursor = editor.getCursorPosition();
1228
            var line = session.doc.getLine(cursor.row);
1229
            var rightChar = line.substring(cursor.column, cursor.column + 1);
1230
            var iterator = new TokenIterator(session, cursor.row, cursor.column);
1231
            var token = iterator.getCurrentToken();
1232

    
1233
            if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
1234
                return {
1235
                    text: "",
1236
                    selection: [1, 1]
1237
                };
1238
            }
1239

    
1240
            if (!token)
1241
                token = iterator.stepBackward();
1242

    
1243
            if (!token)
1244
                return;
1245

    
1246
            while (is(token, "tag-whitespace") || is(token, "whitespace")) {
1247
                token = iterator.stepBackward();
1248
            }
1249
            var rightSpace = !rightChar || rightChar.match(/\s/);
1250
            if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
1251
                return {
1252
                    text: quote + quote,
1253
                    selection: [1, 1]
1254
                };
1255
            }
1256
        }
1257
    });
1258

    
1259
    this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
1260
        var selected = session.doc.getTextRange(range);
1261
        if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
1262
            var line = session.doc.getLine(range.start.row);
1263
            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
1264
            if (rightChar == selected) {
1265
                range.end.column++;
1266
                return range;
1267
            }
1268
        }
1269
    });
1270

    
1271
    this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
1272
        if (text == '>') {
1273
            var position = editor.getSelectionRange().start;
1274
            var iterator = new TokenIterator(session, position.row, position.column);
1275
            var token = iterator.getCurrentToken() || iterator.stepBackward();
1276
            if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
1277
                return;
1278
            if (is(token, "reference.attribute-value"))
1279
                return;
1280
            if (is(token, "attribute-value")) {
1281
                var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length;
1282
                if (position.column < tokenEndColumn)
1283
                    return;
1284
                if (position.column == tokenEndColumn) {
1285
                    var nextToken = iterator.stepForward();
1286
                    if (nextToken && is(nextToken, "attribute-value"))
1287
                        return;
1288
                    iterator.stepBackward();
1289
                }
1290
            }
1291
            
1292
            if (/^\s*>/.test(session.getLine(position.row).slice(position.column)))
1293
                return;
1294
            while (!is(token, "tag-name")) {
1295
                token = iterator.stepBackward();
1296
                if (token.value == "<") {
1297
                    token = iterator.stepForward();
1298
                    break;
1299
                }
1300
            }
1301

    
1302
            var tokenRow = iterator.getCurrentTokenRow();
1303
            var tokenColumn = iterator.getCurrentTokenColumn();
1304
            if (is(iterator.stepBackward(), "end-tag-open"))
1305
                return;
1306

    
1307
            var element = token.value;
1308
            if (tokenRow == position.row)
1309
                element = element.substring(0, position.column - tokenColumn);
1310

    
1311
            if (this.voidElements.hasOwnProperty(element.toLowerCase()))
1312
                 return;
1313

    
1314
            return {
1315
               text: ">" + "</" + element + ">",
1316
               selection: [1, 1]
1317
            };
1318
        }
1319
    });
1320

    
1321
    this.add("autoindent", "insertion", function (state, action, editor, session, text) {
1322
        if (text == "\n") {
1323
            var cursor = editor.getCursorPosition();
1324
            var line = session.getLine(cursor.row);
1325
            var iterator = new TokenIterator(session, cursor.row, cursor.column);
1326
            var token = iterator.getCurrentToken();
1327

    
1328
            if (token && token.type.indexOf("tag-close") !== -1) {
1329
                if (token.value == "/>")
1330
                    return;
1331
                while (token && token.type.indexOf("tag-name") === -1) {
1332
                    token = iterator.stepBackward();
1333
                }
1334

    
1335
                if (!token) {
1336
                    return;
1337
                }
1338

    
1339
                var tag = token.value;
1340
                var row = iterator.getCurrentTokenRow();
1341
                token = iterator.stepBackward();
1342
                if (!token || token.type.indexOf("end-tag") !== -1) {
1343
                    return;
1344
                }
1345

    
1346
                if (this.voidElements && !this.voidElements[tag]) {
1347
                    var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
1348
                    var line = session.getLine(row);
1349
                    var nextIndent = this.$getIndent(line);
1350
                    var indent = nextIndent + session.getTabString();
1351

    
1352
                    if (nextToken && nextToken.value === "</") {
1353
                        return {
1354
                            text: "\n" + indent + "\n" + nextIndent,
1355
                            selection: [1, indent.length, 1, indent.length]
1356
                        };
1357
                    } else {
1358
                        return {
1359
                            text: "\n" + indent
1360
                        };
1361
                    }
1362
                }
1363
            }
1364
        }
1365
    });
1366

    
1367
};
1368

    
1369
oop.inherits(XmlBehaviour, Behaviour);
1370

    
1371
exports.XmlBehaviour = XmlBehaviour;
1372
});
1373

    
1374
ace.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) {
1375
"use strict";
1376

    
1377
var oop = require("../../lib/oop");
1378
var lang = require("../../lib/lang");
1379
var Range = require("../../range").Range;
1380
var BaseFoldMode = require("./fold_mode").FoldMode;
1381
var TokenIterator = require("../../token_iterator").TokenIterator;
1382

    
1383
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
1384
    BaseFoldMode.call(this);
1385
    this.voidElements = voidElements || {};
1386
    this.optionalEndTags = oop.mixin({}, this.voidElements);
1387
    if (optionalEndTags)
1388
        oop.mixin(this.optionalEndTags, optionalEndTags);
1389
    
1390
};
1391
oop.inherits(FoldMode, BaseFoldMode);
1392

    
1393
var Tag = function() {
1394
    this.tagName = "";
1395
    this.closing = false;
1396
    this.selfClosing = false;
1397
    this.start = {row: 0, column: 0};
1398
    this.end = {row: 0, column: 0};
1399
};
1400

    
1401
function is(token, type) {
1402
    return token.type.lastIndexOf(type + ".xml") > -1;
1403
}
1404

    
1405
(function() {
1406

    
1407
    this.getFoldWidget = function(session, foldStyle, row) {
1408
        var tag = this._getFirstTagInLine(session, row);
1409

    
1410
        if (!tag)
1411
            return this.getCommentFoldWidget(session, row);
1412

    
1413
        if (tag.closing || (!tag.tagName && tag.selfClosing))
1414
            return foldStyle == "markbeginend" ? "end" : "";
1415

    
1416
        if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
1417
            return "";
1418

    
1419
        if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
1420
            return "";
1421

    
1422
        return "start";
1423
    };
1424
    
1425
    this.getCommentFoldWidget = function(session, row) {
1426
        if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
1427
            return "start";
1428
        return "";
1429
    };
1430
    this._getFirstTagInLine = function(session, row) {
1431
        var tokens = session.getTokens(row);
1432
        var tag = new Tag();
1433

    
1434
        for (var i = 0; i < tokens.length; i++) {
1435
            var token = tokens[i];
1436
            if (is(token, "tag-open")) {
1437
                tag.end.column = tag.start.column + token.value.length;
1438
                tag.closing = is(token, "end-tag-open");
1439
                token = tokens[++i];
1440
                if (!token)
1441
                    return null;
1442
                tag.tagName = token.value;
1443
                tag.end.column += token.value.length;
1444
                for (i++; i < tokens.length; i++) {
1445
                    token = tokens[i];
1446
                    tag.end.column += token.value.length;
1447
                    if (is(token, "tag-close")) {
1448
                        tag.selfClosing = token.value == '/>';
1449
                        break;
1450
                    }
1451
                }
1452
                return tag;
1453
            } else if (is(token, "tag-close")) {
1454
                tag.selfClosing = token.value == '/>';
1455
                return tag;
1456
            }
1457
            tag.start.column += token.value.length;
1458
        }
1459

    
1460
        return null;
1461
    };
1462

    
1463
    this._findEndTagInLine = function(session, row, tagName, startColumn) {
1464
        var tokens = session.getTokens(row);
1465
        var column = 0;
1466
        for (var i = 0; i < tokens.length; i++) {
1467
            var token = tokens[i];
1468
            column += token.value.length;
1469
            if (column < startColumn)
1470
                continue;
1471
            if (is(token, "end-tag-open")) {
1472
                token = tokens[i + 1];
1473
                if (token && token.value == tagName)
1474
                    return true;
1475
            }
1476
        }
1477
        return false;
1478
    };
1479
    this._readTagForward = function(iterator) {
1480
        var token = iterator.getCurrentToken();
1481
        if (!token)
1482
            return null;
1483

    
1484
        var tag = new Tag();
1485
        do {
1486
            if (is(token, "tag-open")) {
1487
                tag.closing = is(token, "end-tag-open");
1488
                tag.start.row = iterator.getCurrentTokenRow();
1489
                tag.start.column = iterator.getCurrentTokenColumn();
1490
            } else if (is(token, "tag-name")) {
1491
                tag.tagName = token.value;
1492
            } else if (is(token, "tag-close")) {
1493
                tag.selfClosing = token.value == "/>";
1494
                tag.end.row = iterator.getCurrentTokenRow();
1495
                tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
1496
                iterator.stepForward();
1497
                return tag;
1498
            }
1499
        } while(token = iterator.stepForward());
1500

    
1501
        return null;
1502
    };
1503
    
1504
    this._readTagBackward = function(iterator) {
1505
        var token = iterator.getCurrentToken();
1506
        if (!token)
1507
            return null;
1508

    
1509
        var tag = new Tag();
1510
        do {
1511
            if (is(token, "tag-open")) {
1512
                tag.closing = is(token, "end-tag-open");
1513
                tag.start.row = iterator.getCurrentTokenRow();
1514
                tag.start.column = iterator.getCurrentTokenColumn();
1515
                iterator.stepBackward();
1516
                return tag;
1517
            } else if (is(token, "tag-name")) {
1518
                tag.tagName = token.value;
1519
            } else if (is(token, "tag-close")) {
1520
                tag.selfClosing = token.value == "/>";
1521
                tag.end.row = iterator.getCurrentTokenRow();
1522
                tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
1523
            }
1524
        } while(token = iterator.stepBackward());
1525

    
1526
        return null;
1527
    };
1528
    
1529
    this._pop = function(stack, tag) {
1530
        while (stack.length) {
1531
            
1532
            var top = stack[stack.length-1];
1533
            if (!tag || top.tagName == tag.tagName) {
1534
                return stack.pop();
1535
            }
1536
            else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
1537
                stack.pop();
1538
                continue;
1539
            } else {
1540
                return null;
1541
            }
1542
        }
1543
    };
1544
    
1545
    this.getFoldWidgetRange = function(session, foldStyle, row) {
1546
        var firstTag = this._getFirstTagInLine(session, row);
1547
        
1548
        if (!firstTag) {
1549
            return this.getCommentFoldWidget(session, row)
1550
                && session.getCommentFoldRange(row, session.getLine(row).length);
1551
        }
1552
        
1553
        var isBackward = firstTag.closing || firstTag.selfClosing;
1554
        var stack = [];
1555
        var tag;
1556
        
1557
        if (!isBackward) {
1558
            var iterator = new TokenIterator(session, row, firstTag.start.column);
1559
            var start = {
1560
                row: row,
1561
                column: firstTag.start.column + firstTag.tagName.length + 2
1562
            };
1563
            if (firstTag.start.row == firstTag.end.row)
1564
                start.column = firstTag.end.column;
1565
            while (tag = this._readTagForward(iterator)) {
1566
                if (tag.selfClosing) {
1567
                    if (!stack.length) {
1568
                        tag.start.column += tag.tagName.length + 2;
1569
                        tag.end.column -= 2;
1570
                        return Range.fromPoints(tag.start, tag.end);
1571
                    } else
1572
                        continue;
1573
                }
1574
                
1575
                if (tag.closing) {
1576
                    this._pop(stack, tag);
1577
                    if (stack.length == 0)
1578
                        return Range.fromPoints(start, tag.start);
1579
                }
1580
                else {
1581
                    stack.push(tag);
1582
                }
1583
            }
1584
        }
1585
        else {
1586
            var iterator = new TokenIterator(session, row, firstTag.end.column);
1587
            var end = {
1588
                row: row,
1589
                column: firstTag.start.column
1590
            };
1591
            
1592
            while (tag = this._readTagBackward(iterator)) {
1593
                if (tag.selfClosing) {
1594
                    if (!stack.length) {
1595
                        tag.start.column += tag.tagName.length + 2;
1596
                        tag.end.column -= 2;
1597
                        return Range.fromPoints(tag.start, tag.end);
1598
                    } else
1599
                        continue;
1600
                }
1601
                
1602
                if (!tag.closing) {
1603
                    this._pop(stack, tag);
1604
                    if (stack.length == 0) {
1605
                        tag.start.column += tag.tagName.length + 2;
1606
                        if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
1607
                            tag.start.column = tag.end.column;
1608
                        return Range.fromPoints(tag.start, end);
1609
                    }
1610
                }
1611
                else {
1612
                    stack.push(tag);
1613
                }
1614
            }
1615
        }
1616
        
1617
    };
1618

    
1619
}).call(FoldMode.prototype);
1620

    
1621
});
1622

    
1623
ace.define("ace/mode/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/xml_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/xml","ace/worker/worker_client"], function(require, exports, module) {
1624
"use strict";
1625

    
1626
var oop = require("../lib/oop");
1627
var lang = require("../lib/lang");
1628
var TextMode = require("./text").Mode;
1629
var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
1630
var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
1631
var XmlFoldMode = require("./folding/xml").FoldMode;
1632
var WorkerClient = require("../worker/worker_client").WorkerClient;
1633

    
1634
var Mode = function() {
1635
   this.HighlightRules = XmlHighlightRules;
1636
   this.$behaviour = new XmlBehaviour();
1637
   this.foldingRules = new XmlFoldMode();
1638
};
1639

    
1640
oop.inherits(Mode, TextMode);
1641

    
1642
(function() {
1643

    
1644
    this.voidElements = lang.arrayToMap([]);
1645

    
1646
    this.blockComment = {start: "<!--", end: "-->"};
1647

    
1648
    this.createWorker = function(session) {
1649
        var worker = new WorkerClient(["ace"], "ace/mode/xml_worker", "Worker");
1650
        worker.attachToDocument(session.getDocument());
1651

    
1652
        worker.on("error", function(e) {
1653
            session.setAnnotations(e.data);
1654
        });
1655

    
1656
        worker.on("terminate", function() {
1657
            session.clearAnnotations();
1658
        });
1659

    
1660
        return worker;
1661
    };
1662
    
1663
    this.$id = "ace/mode/xml";
1664
}).call(Mode.prototype);
1665

    
1666
exports.Mode = Mode;
1667
});
1668

    
1669
ace.define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) {
1670
"use strict";
1671

    
1672
var oop = require("../lib/oop");
1673
var lang = require("../lib/lang");
1674
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1675
var supportType = exports.supportType = "align-content|align-items|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|border|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|bottom|box-shadow|box-sizing|caption-side|clear|clip|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|cursor|direction|display|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|font|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|hanging-punctuation|height|justify-content|left|letter-spacing|line-height|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|max-height|max-width|max-zoom|min-height|min-width|min-zoom|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|order|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page-break-after|page-break-before|page-break-inside|perspective|perspective-origin|position|quotes|resize|right|tab-size|table-layout|text-align|text-align-last|text-decoration|text-decoration-color|text-decoration-line|text-decoration-style|text-indent|text-justify|text-overflow|text-shadow|text-transform|top|transform|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|user-select|user-zoom|vertical-align|visibility|white-space|width|word-break|word-spacing|word-wrap|z-index";
1676
var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
1677
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|zoom";
1678
var supportConstantColor = exports.supportConstantColor = "aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen";
1679
var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
1680

    
1681
var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
1682
var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
1683
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";
1684

    
1685
var CssHighlightRules = function() {
1686

    
1687
    var keywordMapper = this.createKeywordMapper({
1688
        "support.function": supportFunction,
1689
        "support.constant": supportConstant,
1690
        "support.type": supportType,
1691
        "support.constant.color": supportConstantColor,
1692
        "support.constant.fonts": supportConstantFonts
1693
    }, "text", true);
1694

    
1695
    this.$rules = {
1696
        "start" : [{
1697
            include : ["strings", "url", "comments"]
1698
        }, {
1699
            token: "paren.lparen",
1700
            regex: "\\{",
1701
            next:  "ruleset"
1702
        }, {
1703
            token: "paren.rparen",
1704
            regex: "\\}"
1705
        }, {
1706
            token: "string",
1707
            regex: "@(?!viewport)",
1708
            next:  "media"
1709
        }, {
1710
            token: "keyword",
1711
            regex: "#[a-z0-9-_]+"
1712
        }, {
1713
            token: "keyword",
1714
            regex: "%"
1715
        }, {
1716
            token: "variable",
1717
            regex: "\\.[a-z0-9-_]+"
1718
        }, {
1719
            token: "string",
1720
            regex: ":[a-z0-9-_]+"
1721
        }, {
1722
            token : "constant.numeric",
1723
            regex : numRe
1724
        }, {
1725
            token: "constant",
1726
            regex: "[a-z0-9-_]+"
1727
        }, {
1728
            caseInsensitive: true
1729
        }],
1730

    
1731
        "media": [{
1732
            include : ["strings", "url", "comments"]
1733
        }, {
1734
            token: "paren.lparen",
1735
            regex: "\\{",
1736
            next:  "start"
1737
        }, {
1738
            token: "paren.rparen",
1739
            regex: "\\}",
1740
            next:  "start"
1741
        }, {
1742
            token: "string",
1743
            regex: ";",
1744
            next:  "start"
1745
        }, {
1746
            token: "keyword",
1747
            regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
1748
                + "|page|font|keyframes|viewport|counter-style|font-feature-values"
1749
                + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
1750
        }],
1751

    
1752
        "comments" : [{
1753
            token: "comment", // multi line comment
1754
            regex: "\\/\\*",
1755
            push: [{
1756
                token : "comment",
1757
                regex : "\\*\\/",
1758
                next : "pop"
1759
            }, {
1760
                defaultToken : "comment"
1761
            }]
1762
        }],
1763

    
1764
        "ruleset" : [{
1765
            regex : "-(webkit|ms|moz|o)-",
1766
            token : "text"
1767
        }, {
1768
            token : "punctuation.operator",
1769
            regex : "[:;]"
1770
        }, {
1771
            token : "paren.rparen",
1772
            regex : "\\}",
1773
            next : "start"
1774
        }, {
1775
            include : ["strings", "url", "comments"]
1776
        }, {
1777
            token : ["constant.numeric", "keyword"],
1778
            regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vmax|vmin|vm|vw|%)"
1779
        }, {
1780
            token : "constant.numeric",
1781
            regex : numRe
1782
        }, {
1783
            token : "constant.numeric",  // hex6 color
1784
            regex : "#[a-f0-9]{6}"
1785
        }, {
1786
            token : "constant.numeric", // hex3 color
1787
            regex : "#[a-f0-9]{3}"
1788
        }, {
1789
            token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
1790
            regex : pseudoElements
1791
        }, {
1792
            token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
1793
            regex : pseudoClasses
1794
        }, {
1795
            include: "url"
1796
        }, {
1797
            token : keywordMapper,
1798
            regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
1799
        }, {
1800
            caseInsensitive: true
1801
        }],
1802

    
1803
        url: [{
1804
            token : "support.function",
1805
            regex : "(?:url(:?-prefix)?|domain|regexp)\\(",
1806
            push: [{
1807
                token : "support.function",
1808
                regex : "\\)",
1809
                next : "pop"
1810
            }, {
1811
                defaultToken: "string"
1812
            }]
1813
        }],
1814

    
1815
        strings: [{
1816
            token : "string.start",
1817
            regex : "'",
1818
            push : [{
1819
                token : "string.end",
1820
                regex : "'|$",
1821
                next: "pop"
1822
            }, {
1823
                include : "escapes"
1824
            }, {
1825
                token : "constant.language.escape",
1826
                regex : /\\$/,
1827
                consumeLineEnd: true
1828
            }, {
1829
                defaultToken: "string"
1830
            }]
1831
        }, {
1832
            token : "string.start",
1833
            regex : '"',
1834
            push : [{
1835
                token : "string.end",
1836
                regex : '"|$',
1837
                next: "pop"
1838
            }, {
1839
                include : "escapes"
1840
            }, {
1841
                token : "constant.language.escape",
1842
                regex : /\\$/,
1843
                consumeLineEnd: true
1844
            }, {
1845
                defaultToken: "string"
1846
            }]
1847
        }],
1848
        escapes: [{
1849
            token : "constant.language.escape",
1850
            regex : /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
1851
        }]
1852

    
1853
    };
1854

    
1855
    this.normalizeRules();
1856
};
1857

    
1858
oop.inherits(CssHighlightRules, TextHighlightRules);
1859

    
1860
exports.CssHighlightRules = CssHighlightRules;
1861

    
1862
});
1863

    
1864
ace.define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module) {
1865
"use strict";
1866

    
1867
var propertyMap = {
1868
    "background": {"#$0": 1},
1869
    "background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
1870
    "background-image": {"url('/$0')": 1},
1871
    "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
1872
    "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2},
1873
    "background-attachment": {"scroll": 1, "fixed": 1},
1874
    "background-size": {"cover": 1, "contain": 1},
1875
    "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
1876
    "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
1877
    "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
1878
    "border-color": {"#$0": 1},
1879
    "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2},
1880
    "border-collapse": {"collapse": 1, "separate": 1},
1881
    "bottom": {"px": 1, "em": 1, "%": 1},
1882
    "clear": {"left": 1, "right": 1, "both": 1, "none": 1},
1883
    "color": {"#$0": 1, "rgb(#$00,0,0)": 1},
1884
    "cursor": {"default": 1, "pointer": 1, "move": 1, "text": 1, "wait": 1, "help": 1, "progress": 1, "n-resize": 1, "ne-resize": 1, "e-resize": 1, "se-resize": 1, "s-resize": 1, "sw-resize": 1, "w-resize": 1, "nw-resize": 1},
1885
    "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
1886
    "empty-cells": {"show": 1, "hide": 1},
1887
    "float": {"left": 1, "right": 1, "none": 1},
1888
    "font-family": {"Arial":2,"Comic Sans MS":2,"Consolas":2,"Courier New":2,"Courier":2,"Georgia":2,"Monospace":2,"Sans-Serif":2, "Segoe UI":2,"Tahoma":2,"Times New Roman":2,"Trebuchet MS":2,"Verdana": 1},
1889
    "font-size": {"px": 1, "em": 1, "%": 1},
1890
    "font-weight": {"bold": 1, "normal": 1},
1891
    "font-style": {"italic": 1, "normal": 1},
1892
    "font-variant": {"normal": 1, "small-caps": 1},
1893
    "height": {"px": 1, "em": 1, "%": 1},
1894
    "left": {"px": 1, "em": 1, "%": 1},
1895
    "letter-spacing": {"normal": 1},
1896
    "line-height": {"normal": 1},
1897
    "list-style-type": {"none": 1, "disc": 1, "circle": 1, "square": 1, "decimal": 1, "decimal-leading-zero": 1, "lower-roman": 1, "upper-roman": 1, "lower-greek": 1, "lower-latin": 1, "upper-latin": 1, "georgian": 1, "lower-alpha": 1, "upper-alpha": 1},
1898
    "margin": {"px": 1, "em": 1, "%": 1},
1899
    "margin-right": {"px": 1, "em": 1, "%": 1},
1900
    "margin-left": {"px": 1, "em": 1, "%": 1},
1901
    "margin-top": {"px": 1, "em": 1, "%": 1},
1902
    "margin-bottom": {"px": 1, "em": 1, "%": 1},
1903
    "max-height": {"px": 1, "em": 1, "%": 1},
1904
    "max-width": {"px": 1, "em": 1, "%": 1},
1905
    "min-height": {"px": 1, "em": 1, "%": 1},
1906
    "min-width": {"px": 1, "em": 1, "%": 1},
1907
    "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
1908
    "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
1909
    "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
1910
    "padding": {"px": 1, "em": 1, "%": 1},
1911
    "padding-top": {"px": 1, "em": 1, "%": 1},
1912
    "padding-right": {"px": 1, "em": 1, "%": 1},
1913
    "padding-bottom": {"px": 1, "em": 1, "%": 1},
1914
    "padding-left": {"px": 1, "em": 1, "%": 1},
1915
    "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
1916
    "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
1917
    "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
1918
    "right": {"px": 1, "em": 1, "%": 1},
1919
    "table-layout": {"fixed": 1, "auto": 1},
1920
    "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
1921
    "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
1922
    "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
1923
    "top": {"px": 1, "em": 1, "%": 1},
1924
    "vertical-align": {"top": 1, "bottom": 1},
1925
    "visibility": {"hidden": 1, "visible": 1},
1926
    "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
1927
    "width": {"px": 1, "em": 1, "%": 1},
1928
    "word-spacing": {"normal": 1},
1929
    "filter": {"alpha(opacity=$0100)": 1},
1930

    
1931
    "text-shadow": {"$02px 2px 2px #777": 1},
1932
    "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
1933
    "-moz-border-radius": 1,
1934
    "-moz-border-radius-topright": 1,
1935
    "-moz-border-radius-bottomright": 1,
1936
    "-moz-border-radius-topleft": 1,
1937
    "-moz-border-radius-bottomleft": 1,
1938
    "-webkit-border-radius": 1,
1939
    "-webkit-border-top-right-radius": 1,
1940
    "-webkit-border-top-left-radius": 1,
1941
    "-webkit-border-bottom-right-radius": 1,
1942
    "-webkit-border-bottom-left-radius": 1,
1943
    "-moz-box-shadow": 1,
1944
    "-webkit-box-shadow": 1,
1945
    "transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
1946
    "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
1947
    "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
1948
};
1949

    
1950
var CssCompletions = function() {
1951

    
1952
};
1953

    
1954
(function() {
1955

    
1956
    this.completionsDefined = false;
1957

    
1958
    this.defineCompletions = function() {
1959
        if (document) {
1960
            var style = document.createElement('c').style;
1961

    
1962
            for (var i in style) {
1963
                if (typeof style[i] !== 'string')
1964
                    continue;
1965

    
1966
                var name = i.replace(/[A-Z]/g, function(x) {
1967
                    return '-' + x.toLowerCase();
1968
                });
1969

    
1970
                if (!propertyMap.hasOwnProperty(name))
1971
                    propertyMap[name] = 1;
1972
            }
1973
        }
1974

    
1975
        this.completionsDefined = true;
1976
    };
1977

    
1978
    this.getCompletions = function(state, session, pos, prefix) {
1979
        if (!this.completionsDefined) {
1980
            this.defineCompletions();
1981
        }
1982

    
1983
        if (state==='ruleset' || session.$mode.$id == "ace/mode/scss") {
1984
            var line = session.getLine(pos.row).substr(0, pos.column);
1985
            if (/:[^;]+$/.test(line)) {
1986
                /([\w\-]+):[^:]*$/.test(line);
1987

    
1988
                return this.getPropertyValueCompletions(state, session, pos, prefix);
1989
            } else {
1990
                return this.getPropertyCompletions(state, session, pos, prefix);
1991
            }
1992
        }
1993

    
1994
        return [];
1995
    };
1996

    
1997
    this.getPropertyCompletions = function(state, session, pos, prefix) {
1998
        var properties = Object.keys(propertyMap);
1999
        return properties.map(function(property){
2000
            return {
2001
                caption: property,
2002
                snippet: property + ': $0;',
2003
                meta: "property",
2004
                score: 1000000
2005
            };
2006
        });
2007
    };
2008

    
2009
    this.getPropertyValueCompletions = function(state, session, pos, prefix) {
2010
        var line = session.getLine(pos.row).substr(0, pos.column);
2011
        var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
2012

    
2013
        if (!property)
2014
            return [];
2015
        var values = [];
2016
        if (property in propertyMap && typeof propertyMap[property] === "object") {
2017
            values = Object.keys(propertyMap[property]);
2018
        }
2019
        return values.map(function(value){
2020
            return {
2021
                caption: value,
2022
                snippet: value,
2023
                meta: "property value",
2024
                score: 1000000
2025
            };
2026
        });
2027
    };
2028

    
2029
}).call(CssCompletions.prototype);
2030

    
2031
exports.CssCompletions = CssCompletions;
2032
});
2033

    
2034
ace.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) {
2035
"use strict";
2036

    
2037
var oop = require("../../lib/oop");
2038
var Behaviour = require("../behaviour").Behaviour;
2039
var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
2040
var TokenIterator = require("../../token_iterator").TokenIterator;
2041

    
2042
var CssBehaviour = function () {
2043

    
2044
    this.inherit(CstyleBehaviour);
2045

    
2046
    this.add("colon", "insertion", function (state, action, editor, session, text) {
2047
        if (text === ':' && editor.selection.isEmpty()) {
2048
            var cursor = editor.getCursorPosition();
2049
            var iterator = new TokenIterator(session, cursor.row, cursor.column);
2050
            var token = iterator.getCurrentToken();
2051
            if (token && token.value.match(/\s+/)) {
2052
                token = iterator.stepBackward();
2053
            }
2054
            if (token && token.type === 'support.type') {
2055
                var line = session.doc.getLine(cursor.row);
2056
                var rightChar = line.substring(cursor.column, cursor.column + 1);
2057
                if (rightChar === ':') {
2058
                    return {
2059
                       text: '',
2060
                       selection: [1, 1]
2061
                    };
2062
                }
2063
                if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
2064
                    return {
2065
                       text: ':;',
2066
                       selection: [1, 1]
2067
                    };
2068
                }
2069
            }
2070
        }
2071
    });
2072

    
2073
    this.add("colon", "deletion", function (state, action, editor, session, range) {
2074
        var selected = session.doc.getTextRange(range);
2075
        if (!range.isMultiLine() && selected === ':') {
2076
            var cursor = editor.getCursorPosition();
2077
            var iterator = new TokenIterator(session, cursor.row, cursor.column);
2078
            var token = iterator.getCurrentToken();
2079
            if (token && token.value.match(/\s+/)) {
2080
                token = iterator.stepBackward();
2081
            }
2082
            if (token && token.type === 'support.type') {
2083
                var line = session.doc.getLine(range.start.row);
2084
                var rightChar = line.substring(range.end.column, range.end.column + 1);
2085
                if (rightChar === ';') {
2086
                    range.end.column ++;
2087
                    return range;
2088
                }
2089
            }
2090
        }
2091
    });
2092

    
2093
    this.add("semicolon", "insertion", function (state, action, editor, session, text) {
2094
        if (text === ';' && editor.selection.isEmpty()) {
2095
            var cursor = editor.getCursorPosition();
2096
            var line = session.doc.getLine(cursor.row);
2097
            var rightChar = line.substring(cursor.column, cursor.column + 1);
2098
            if (rightChar === ';') {
2099
                return {
2100
                   text: '',
2101
                   selection: [1, 1]
2102
                };
2103
            }
2104
        }
2105
    });
2106

    
2107
    this.add("!important", "insertion", function (state, action, editor, session, text) {
2108
        if (text === '!' && editor.selection.isEmpty()) {
2109
            var cursor = editor.getCursorPosition();
2110
            var line = session.doc.getLine(cursor.row);
2111

    
2112
            if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
2113
                return {
2114
                    text: '!important',
2115
                    selection: [10, 10]
2116
                };
2117
            }
2118
        }
2119
    });
2120

    
2121
};
2122
oop.inherits(CssBehaviour, CstyleBehaviour);
2123

    
2124
exports.CssBehaviour = CssBehaviour;
2125
});
2126

    
2127
ace.define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/css_completions","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module) {
2128
"use strict";
2129

    
2130
var oop = require("../lib/oop");
2131
var TextMode = require("./text").Mode;
2132
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
2133
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
2134
var WorkerClient = require("../worker/worker_client").WorkerClient;
2135
var CssCompletions = require("./css_completions").CssCompletions;
2136
var CssBehaviour = require("./behaviour/css").CssBehaviour;
2137
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
2138

    
2139
var Mode = function() {
2140
    this.HighlightRules = CssHighlightRules;
2141
    this.$outdent = new MatchingBraceOutdent();
2142
    this.$behaviour = new CssBehaviour();
2143
    this.$completer = new CssCompletions();
2144
    this.foldingRules = new CStyleFoldMode();
2145
};
2146
oop.inherits(Mode, TextMode);
2147

    
2148
(function() {
2149

    
2150
    this.foldingRules = "cStyle";
2151
    this.blockComment = {start: "/*", end: "*/"};
2152

    
2153
    this.getNextLineIndent = function(state, line, tab) {
2154
        var indent = this.$getIndent(line);
2155
        var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
2156
        if (tokens.length && tokens[tokens.length-1].type == "comment") {
2157
            return indent;
2158
        }
2159

    
2160
        var match = line.match(/^.*\{\s*$/);
2161
        if (match) {
2162
            indent += tab;
2163
        }
2164

    
2165
        return indent;
2166
    };
2167

    
2168
    this.checkOutdent = function(state, line, input) {
2169
        return this.$outdent.checkOutdent(line, input);
2170
    };
2171

    
2172
    this.autoOutdent = function(state, doc, row) {
2173
        this.$outdent.autoOutdent(doc, row);
2174
    };
2175

    
2176
    this.getCompletions = function(state, session, pos, prefix) {
2177
        return this.$completer.getCompletions(state, session, pos, prefix);
2178
    };
2179

    
2180
    this.createWorker = function(session) {
2181
        var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
2182
        worker.attachToDocument(session.getDocument());
2183

    
2184
        worker.on("annotate", function(e) {
2185
            session.setAnnotations(e.data);
2186
        });
2187

    
2188
        worker.on("terminate", function() {
2189
            session.clearAnnotations();
2190
        });
2191

    
2192
        return worker;
2193
    };
2194

    
2195
    this.$id = "ace/mode/css";
2196
    this.snippetFileId = "ace/snippets/css";
2197
}).call(Mode.prototype);
2198

    
2199
exports.Mode = Mode;
2200

    
2201
});
2202

    
2203
ace.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_highlight_rules"], function(require, exports, module) {
2204
"use strict";
2205

    
2206
var oop = require("../lib/oop");
2207
var lang = require("../lib/lang");
2208
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
2209
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
2210
var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
2211

    
2212
var tagMap = lang.createMap({
2213
    a           : 'anchor',
2214
    button 	    : 'form',
2215
    form        : 'form',
2216
    img         : 'image',
2217
    input       : 'form',
2218
    label       : 'form',
2219
    option      : 'form',
2220
    script      : 'script',
2221
    select      : 'form',
2222
    textarea    : 'form',
2223
    style       : 'style',
2224
    table       : 'table',
2225
    tbody       : 'table',
2226
    td          : 'table',
2227
    tfoot       : 'table',
2228
    th          : 'table',
2229
    tr          : 'table'
2230
});
2231

    
2232
var HtmlHighlightRules = function() {
2233
    XmlHighlightRules.call(this);
2234

    
2235
    this.addRules({
2236
        attributes: [{
2237
            include : "tag_whitespace"
2238
        }, {
2239
            token : "entity.other.attribute-name.xml",
2240
            regex : "[-_a-zA-Z0-9:.]+"
2241
        }, {
2242
            token : "keyword.operator.attribute-equals.xml",
2243
            regex : "=",
2244
            push : [{
2245
                include: "tag_whitespace"
2246
            }, {
2247
                token : "string.unquoted.attribute-value.html",
2248
                regex : "[^<>='\"`\\s]+",
2249
                next : "pop"
2250
            }, {
2251
                token : "empty",
2252
                regex : "",
2253
                next : "pop"
2254
            }]
2255
        }, {
2256
            include : "attribute_value"
2257
        }],
2258
        tag: [{
2259
            token : function(start, tag) {
2260
                var group = tagMap[tag];
2261
                return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
2262
                    "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
2263
            },
2264
            regex : "(</?)([-_a-zA-Z0-9:.]+)",
2265
            next: "tag_stuff"
2266
        }],
2267
        tag_stuff: [
2268
            {include : "attributes"},
2269
            {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
2270
        ]
2271
    });
2272

    
2273
    this.embedTagRules(CssHighlightRules, "css-", "style");
2274
    this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "js-", "script");
2275

    
2276
    if (this.constructor === HtmlHighlightRules)
2277
        this.normalizeRules();
2278
};
2279

    
2280
oop.inherits(HtmlHighlightRules, XmlHighlightRules);
2281

    
2282
exports.HtmlHighlightRules = HtmlHighlightRules;
2283
});
2284

    
2285
ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module) {
2286
"use strict";
2287

    
2288
var oop = require("../../lib/oop");
2289
var BaseFoldMode = require("./fold_mode").FoldMode;
2290

    
2291
var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
2292
    this.defaultMode = defaultMode;
2293
    this.subModes = subModes;
2294
};
2295
oop.inherits(FoldMode, BaseFoldMode);
2296

    
2297
(function() {
2298

    
2299

    
2300
    this.$getMode = function(state) {
2301
        if (typeof state != "string") 
2302
            state = state[0];
2303
        for (var key in this.subModes) {
2304
            if (state.indexOf(key) === 0)
2305
                return this.subModes[key];
2306
        }
2307
        return null;
2308
    };
2309
    
2310
    this.$tryMode = function(state, session, foldStyle, row) {
2311
        var mode = this.$getMode(state);
2312
        return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
2313
    };
2314

    
2315
    this.getFoldWidget = function(session, foldStyle, row) {
2316
        return (
2317
            this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
2318
            this.$tryMode(session.getState(row), session, foldStyle, row) ||
2319
            this.defaultMode.getFoldWidget(session, foldStyle, row)
2320
        );
2321
    };
2322

    
2323
    this.getFoldWidgetRange = function(session, foldStyle, row) {
2324
        var mode = this.$getMode(session.getState(row-1));
2325
        
2326
        if (!mode || !mode.getFoldWidget(session, foldStyle, row))
2327
            mode = this.$getMode(session.getState(row));
2328
        
2329
        if (!mode || !mode.getFoldWidget(session, foldStyle, row))
2330
            mode = this.defaultMode;
2331
        
2332
        return mode.getFoldWidgetRange(session, foldStyle, row);
2333
    };
2334

    
2335
}).call(FoldMode.prototype);
2336

    
2337
});
2338

    
2339
ace.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) {
2340
"use strict";
2341

    
2342
var oop = require("../../lib/oop");
2343
var MixedFoldMode = require("./mixed").FoldMode;
2344
var XmlFoldMode = require("./xml").FoldMode;
2345
var CStyleFoldMode = require("./cstyle").FoldMode;
2346

    
2347
var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
2348
    MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
2349
        "js-": new CStyleFoldMode(),
2350
        "css-": new CStyleFoldMode()
2351
    });
2352
};
2353

    
2354
oop.inherits(FoldMode, MixedFoldMode);
2355

    
2356
});
2357

    
2358
ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module) {
2359
"use strict";
2360

    
2361
var TokenIterator = require("../token_iterator").TokenIterator;
2362

    
2363
var commonAttributes = [
2364
    "accesskey",
2365
    "class",
2366
    "contenteditable",
2367
    "contextmenu",
2368
    "dir",
2369
    "draggable",
2370
    "dropzone",
2371
    "hidden",
2372
    "id",
2373
    "inert",
2374
    "itemid",
2375
    "itemprop",
2376
    "itemref",
2377
    "itemscope",
2378
    "itemtype",
2379
    "lang",
2380
    "spellcheck",
2381
    "style",
2382
    "tabindex",
2383
    "title",
2384
    "translate"
2385
];
2386

    
2387
var eventAttributes = [
2388
    "onabort",
2389
    "onblur",
2390
    "oncancel",
2391
    "oncanplay",
2392
    "oncanplaythrough",
2393
    "onchange",
2394
    "onclick",
2395
    "onclose",
2396
    "oncontextmenu",
2397
    "oncuechange",
2398
    "ondblclick",
2399
    "ondrag",
2400
    "ondragend",
2401
    "ondragenter",
2402
    "ondragleave",
2403
    "ondragover",
2404
    "ondragstart",
2405
    "ondrop",
2406
    "ondurationchange",
2407
    "onemptied",
2408
    "onended",
2409
    "onerror",
2410
    "onfocus",
2411
    "oninput",
2412
    "oninvalid",
2413
    "onkeydown",
2414
    "onkeypress",
2415
    "onkeyup",
2416
    "onload",
2417
    "onloadeddata",
2418
    "onloadedmetadata",
2419
    "onloadstart",
2420
    "onmousedown",
2421
    "onmousemove",
2422
    "onmouseout",
2423
    "onmouseover",
2424
    "onmouseup",
2425
    "onmousewheel",
2426
    "onpause",
2427
    "onplay",
2428
    "onplaying",
2429
    "onprogress",
2430
    "onratechange",
2431
    "onreset",
2432
    "onscroll",
2433
    "onseeked",
2434
    "onseeking",
2435
    "onselect",
2436
    "onshow",
2437
    "onstalled",
2438
    "onsubmit",
2439
    "onsuspend",
2440
    "ontimeupdate",
2441
    "onvolumechange",
2442
    "onwaiting"
2443
];
2444

    
2445
var globalAttributes = commonAttributes.concat(eventAttributes);
2446

    
2447
var attributeMap = {
2448
    "a": {"href": 1, "target": {"_blank": 1, "top": 1}, "ping": 1, "rel": {"nofollow": 1, "alternate": 1, "author": 1, "bookmark": 1, "help": 1, "license": 1, "next": 1, "noreferrer": 1, "prefetch": 1, "prev": 1, "search": 1, "tag": 1}, "media": 1, "hreflang": 1, "type": 1},
2449
    "abbr": {},
2450
    "address": {},
2451
    "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1},
2452
    "article": {"pubdate": 1},
2453
    "aside": {},
2454
    "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }},
2455
    "b": {},
2456
    "base": {"href": 1, "target": 1},
2457
    "bdi": {},
2458
    "bdo": {},
2459
    "blockquote": {"cite": 1},
2460
    "body": {"onafterprint": 1, "onbeforeprint": 1, "onbeforeunload": 1, "onhashchange": 1, "onmessage": 1, "onoffline": 1, "onpopstate": 1, "onredo": 1, "onresize": 1, "onstorage": 1, "onundo": 1, "onunload": 1},
2461
    "br": {},
2462
    "button": {"autofocus": 1, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": 1, "formmethod": 1, "formnovalidate": 1, "formtarget": 1, "name": 1, "value": 1, "type": {"button": 1, "submit": 1}},
2463
    "canvas": {"width": 1, "height": 1},
2464
    "caption": {},
2465
    "cite": {},
2466
    "code": {},
2467
    "col": {"span": 1},
2468
    "colgroup": {"span": 1},
2469
    "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1},
2470
    "data": {},
2471
    "datalist": {},
2472
    "dd": {},
2473
    "del": {"cite": 1, "datetime": 1},
2474
    "details": {"open": 1},
2475
    "dfn": {},
2476
    "dialog": {"open": 1},
2477
    "div": {},
2478
    "dl": {},
2479
    "dt": {},
2480
    "em": {},
2481
    "embed": {"src": 1, "height": 1, "width": 1, "type": 1},
2482
    "fieldset": {"disabled": 1, "form": 1, "name": 1},
2483
    "figcaption": {},
2484
    "figure": {},
2485
    "footer": {},
2486
    "form": {"accept-charset": 1, "action": 1, "autocomplete": 1, "enctype": {"multipart/form-data": 1, "application/x-www-form-urlencoded": 1}, "method": {"get": 1, "post": 1}, "name": 1, "novalidate": 1, "target": {"_blank": 1, "top": 1}},
2487
    "h1": {},
2488
    "h2": {},
2489
    "h3": {},
2490
    "h4": {},
2491
    "h5": {},
2492
    "h6": {},
2493
    "head": {},
2494
    "header": {},
2495
    "hr": {},
2496
    "html": {"manifest": 1},
2497
    "i": {},
2498
    "iframe": {"name": 1, "src": 1, "height": 1, "width": 1, "sandbox": {"allow-same-origin": 1, "allow-top-navigation": 1, "allow-forms": 1, "allow-scripts": 1}, "seamless": {"seamless": 1}},
2499
    "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1},
2500
    "input": {
2501
        "type": {"text": 1, "password": 1, "hidden": 1, "checkbox": 1, "submit": 1, "radio": 1, "file": 1, "button": 1, "reset": 1, "image": 31, "color": 1, "date": 1, "datetime": 1, "datetime-local": 1, "email": 1, "month": 1, "number": 1, "range": 1, "search": 1, "tel": 1, "time": 1, "url": 1, "week": 1},
2502
        "accept": 1, "alt": 1, "autocomplete": {"on": 1, "off": 1}, "autofocus": {"autofocus": 1}, "checked": {"checked": 1}, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": {"application/x-www-form-urlencoded": 1, "multipart/form-data": 1, "text/plain": 1}, "formmethod": {"get": 1, "post": 1}, "formnovalidate": {"formnovalidate": 1}, "formtarget": {"_blank": 1, "_self": 1, "_parent": 1, "_top": 1}, "height": 1, "list": 1, "max": 1, "maxlength": 1, "min": 1, "multiple": {"multiple": 1}, "name": 1, "pattern": 1, "placeholder": 1, "readonly": {"readonly": 1}, "required": {"required": 1}, "size": 1, "src": 1, "step": 1, "width": 1, "files": 1, "value": 1},
2503
    "ins": {"cite": 1, "datetime": 1},
2504
    "kbd": {},
2505
    "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1},
2506
    "label": {"form": 1, "for": 1},
2507
    "legend": {},
2508
    "li": {"value": 1},
2509
    "link": {"href": 1, "hreflang": 1, "rel": {"stylesheet": 1, "icon": 1}, "media": {"all": 1, "screen": 1, "print": 1}, "type": {"text/css": 1, "image/png": 1, "image/jpeg": 1, "image/gif": 1}, "sizes": 1},
2510
    "main": {},
2511
    "map": {"name": 1},
2512
    "mark": {},
2513
    "math": {},
2514
    "menu": {"type": 1, "label": 1},
2515
    "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1},
2516
    "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1},
2517
    "nav": {},
2518
    "noscript": {"href": 1},
2519
    "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1},
2520
    "ol": {"start": 1, "reversed": 1},
2521
    "optgroup": {"disabled": 1, "label": 1},
2522
    "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1},
2523
    "output": {"for": 1, "form": 1, "name": 1},
2524
    "p": {},
2525
    "param": {"name": 1, "value": 1},
2526
    "pre": {},
2527
    "progress": {"value": 1, "max": 1},
2528
    "q": {"cite": 1},
2529
    "rp": {},
2530
    "rt": {},
2531
    "ruby": {},
2532
    "s": {},
2533
    "samp": {},
2534
    "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1},
2535
    "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}},
2536
    "small": {},
2537
    "source": {"src": 1, "type": 1, "media": 1},
2538
    "span": {},
2539
    "strong": {},
2540
    "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1},
2541
    "sub": {},
2542
    "sup": {},
2543
    "svg": {},
2544
    "table": {"summary": 1},
2545
    "tbody": {},
2546
    "td": {"headers": 1, "rowspan": 1, "colspan": 1},
2547
    "textarea": {"autofocus": {"autofocus": 1}, "disabled": {"disabled": 1}, "form": 1, "maxlength": 1, "name": 1, "placeholder": 1, "readonly": {"readonly": 1}, "required": {"required": 1}, "rows": 1, "cols": 1, "wrap": {"on": 1, "off": 1, "hard": 1, "soft": 1}},
2548
    "tfoot": {},
2549
    "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1},
2550
    "thead": {},
2551
    "time": {"datetime": 1},
2552
    "title": {},
2553
    "tr": {},
2554
    "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1},
2555
    "section": {},
2556
    "summary": {},
2557
    "u": {},
2558
    "ul": {},
2559
    "var": {},
2560
    "video": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "width": 1, "height": 1, "poster": 1, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1}},
2561
    "wbr": {}
2562
};
2563

    
2564
var elements = Object.keys(attributeMap);
2565

    
2566
function is(token, type) {
2567
    return token.type.lastIndexOf(type + ".xml") > -1;
2568
}
2569

    
2570
function findTagName(session, pos) {
2571
    var iterator = new TokenIterator(session, pos.row, pos.column);
2572
    var token = iterator.getCurrentToken();
2573
    while (token && !is(token, "tag-name")){
2574
        token = iterator.stepBackward();
2575
    }
2576
    if (token)
2577
        return token.value;
2578
}
2579

    
2580
function findAttributeName(session, pos) {
2581
    var iterator = new TokenIterator(session, pos.row, pos.column);
2582
    var token = iterator.getCurrentToken();
2583
    while (token && !is(token, "attribute-name")){
2584
        token = iterator.stepBackward();
2585
    }
2586
    if (token)
2587
        return token.value;
2588
}
2589

    
2590
var HtmlCompletions = function() {
2591

    
2592
};
2593

    
2594
(function() {
2595

    
2596
    this.getCompletions = function(state, session, pos, prefix) {
2597
        var token = session.getTokenAt(pos.row, pos.column);
2598

    
2599
        if (!token)
2600
            return [];
2601
        if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
2602
            return this.getTagCompletions(state, session, pos, prefix);
2603
        if (is(token, "tag-whitespace") || is(token, "attribute-name"))
2604
            return this.getAttributeCompletions(state, session, pos, prefix);
2605
        if (is(token, "attribute-value"))
2606
            return this.getAttributeValueCompletions(state, session, pos, prefix);
2607
        var line = session.getLine(pos.row).substr(0, pos.column);
2608
        if (/&[a-z]*$/i.test(line))
2609
            return this.getHTMLEntityCompletions(state, session, pos, prefix);
2610

    
2611
        return [];
2612
    };
2613

    
2614
    this.getTagCompletions = function(state, session, pos, prefix) {
2615
        return elements.map(function(element){
2616
            return {
2617
                value: element,
2618
                meta: "tag",
2619
                score: 1000000
2620
            };
2621
        });
2622
    };
2623

    
2624
    this.getAttributeCompletions = function(state, session, pos, prefix) {
2625
        var tagName = findTagName(session, pos);
2626
        if (!tagName)
2627
            return [];
2628
        var attributes = globalAttributes;
2629
        if (tagName in attributeMap) {
2630
            attributes = attributes.concat(Object.keys(attributeMap[tagName]));
2631
        }
2632
        return attributes.map(function(attribute){
2633
            return {
2634
                caption: attribute,
2635
                snippet: attribute + '="$0"',
2636
                meta: "attribute",
2637
                score: 1000000
2638
            };
2639
        });
2640
    };
2641

    
2642
    this.getAttributeValueCompletions = function(state, session, pos, prefix) {
2643
        var tagName = findTagName(session, pos);
2644
        var attributeName = findAttributeName(session, pos);
2645
        
2646
        if (!tagName)
2647
            return [];
2648
        var values = [];
2649
        if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
2650
            values = Object.keys(attributeMap[tagName][attributeName]);
2651
        }
2652
        return values.map(function(value){
2653
            return {
2654
                caption: value,
2655
                snippet: value,
2656
                meta: "attribute value",
2657
                score: 1000000
2658
            };
2659
        });
2660
    };
2661

    
2662
    this.getHTMLEntityCompletions = function(state, session, pos, prefix) {
2663
        var values = ['Aacute;', 'aacute;', 'Acirc;', 'acirc;', 'acute;', 'AElig;', 'aelig;', 'Agrave;', 'agrave;', 'alefsym;', 'Alpha;', 'alpha;', 'amp;', 'and;', 'ang;', 'Aring;', 'aring;', 'asymp;', 'Atilde;', 'atilde;', 'Auml;', 'auml;', 'bdquo;', 'Beta;', 'beta;', 'brvbar;', 'bull;', 'cap;', 'Ccedil;', 'ccedil;', 'cedil;', 'cent;', 'Chi;', 'chi;', 'circ;', 'clubs;', 'cong;', 'copy;', 'crarr;', 'cup;', 'curren;', 'Dagger;', 'dagger;', 'dArr;', 'darr;', 'deg;', 'Delta;', 'delta;', 'diams;', 'divide;', 'Eacute;', 'eacute;', 'Ecirc;', 'ecirc;', 'Egrave;', 'egrave;', 'empty;', 'emsp;', 'ensp;', 'Epsilon;', 'epsilon;', 'equiv;', 'Eta;', 'eta;', 'ETH;', 'eth;', 'Euml;', 'euml;', 'euro;', 'exist;', 'fnof;', 'forall;', 'frac12;', 'frac14;', 'frac34;', 'frasl;', 'Gamma;', 'gamma;', 'ge;', 'gt;', 'hArr;', 'harr;', 'hearts;', 'hellip;', 'Iacute;', 'iacute;', 'Icirc;', 'icirc;', 'iexcl;', 'Igrave;', 'igrave;', 'image;', 'infin;', 'int;', 'Iota;', 'iota;', 'iquest;', 'isin;', 'Iuml;', 'iuml;', 'Kappa;', 'kappa;', 'Lambda;', 'lambda;', 'lang;', 'laquo;', 'lArr;', 'larr;', 'lceil;', 'ldquo;', 'le;', 'lfloor;', 'lowast;', 'loz;', 'lrm;', 'lsaquo;', 'lsquo;', 'lt;', 'macr;', 'mdash;', 'micro;', 'middot;', 'minus;', 'Mu;', 'mu;', 'nabla;', 'nbsp;', 'ndash;', 'ne;', 'ni;', 'not;', 'notin;', 'nsub;', 'Ntilde;', 'ntilde;', 'Nu;', 'nu;', 'Oacute;', 'oacute;', 'Ocirc;', 'ocirc;', 'OElig;', 'oelig;', 'Ograve;', 'ograve;', 'oline;', 'Omega;', 'omega;', 'Omicron;', 'omicron;', 'oplus;', 'or;', 'ordf;', 'ordm;', 'Oslash;', 'oslash;', 'Otilde;', 'otilde;', 'otimes;', 'Ouml;', 'ouml;', 'para;', 'part;', 'permil;', 'perp;', 'Phi;', 'phi;', 'Pi;', 'pi;', 'piv;', 'plusmn;', 'pound;', 'Prime;', 'prime;', 'prod;', 'prop;', 'Psi;', 'psi;', 'quot;', 'radic;', 'rang;', 'raquo;', 'rArr;', 'rarr;', 'rceil;', 'rdquo;', 'real;', 'reg;', 'rfloor;', 'Rho;', 'rho;', 'rlm;', 'rsaquo;', 'rsquo;', 'sbquo;', 'Scaron;', 'scaron;', 'sdot;', 'sect;', 'shy;', 'Sigma;', 'sigma;', 'sigmaf;', 'sim;', 'spades;', 'sub;', 'sube;', 'sum;', 'sup;', 'sup1;', 'sup2;', 'sup3;', 'supe;', 'szlig;', 'Tau;', 'tau;', 'there4;', 'Theta;', 'theta;', 'thetasym;', 'thinsp;', 'THORN;', 'thorn;', 'tilde;', 'times;', 'trade;', 'Uacute;', 'uacute;', 'uArr;', 'uarr;', 'Ucirc;', 'ucirc;', 'Ugrave;', 'ugrave;', 'uml;', 'upsih;', 'Upsilon;', 'upsilon;', 'Uuml;', 'uuml;', 'weierp;', 'Xi;', 'xi;', 'Yacute;', 'yacute;', 'yen;', 'Yuml;', 'yuml;', 'Zeta;', 'zeta;', 'zwj;', 'zwnj;'];
2664

    
2665
        return values.map(function(value){
2666
            return {
2667
                caption: value,
2668
                snippet: value,
2669
                meta: "html entity",
2670
                score: 1000000
2671
            };
2672
        });
2673
    };
2674

    
2675
}).call(HtmlCompletions.prototype);
2676

    
2677
exports.HtmlCompletions = HtmlCompletions;
2678
});
2679

    
2680
ace.define("ace/mode/html",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/javascript","ace/mode/css","ace/mode/html_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/html","ace/mode/html_completions","ace/worker/worker_client"], function(require, exports, module) {
2681
"use strict";
2682

    
2683
var oop = require("../lib/oop");
2684
var lang = require("../lib/lang");
2685
var TextMode = require("./text").Mode;
2686
var JavaScriptMode = require("./javascript").Mode;
2687
var CssMode = require("./css").Mode;
2688
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
2689
var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
2690
var HtmlFoldMode = require("./folding/html").FoldMode;
2691
var HtmlCompletions = require("./html_completions").HtmlCompletions;
2692
var WorkerClient = require("../worker/worker_client").WorkerClient;
2693
var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
2694
var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
2695

    
2696
var Mode = function(options) {
2697
    this.fragmentContext = options && options.fragmentContext;
2698
    this.HighlightRules = HtmlHighlightRules;
2699
    this.$behaviour = new XmlBehaviour();
2700
    this.$completer = new HtmlCompletions();
2701
    
2702
    this.createModeDelegates({
2703
        "js-": JavaScriptMode,
2704
        "css-": CssMode
2705
    });
2706
    
2707
    this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
2708
};
2709
oop.inherits(Mode, TextMode);
2710

    
2711
(function() {
2712

    
2713
    this.blockComment = {start: "<!--", end: "-->"};
2714

    
2715
    this.voidElements = lang.arrayToMap(voidElements);
2716

    
2717
    this.getNextLineIndent = function(state, line, tab) {
2718
        return this.$getIndent(line);
2719
    };
2720

    
2721
    this.checkOutdent = function(state, line, input) {
2722
        return false;
2723
    };
2724

    
2725
    this.getCompletions = function(state, session, pos, prefix) {
2726
        return this.$completer.getCompletions(state, session, pos, prefix);
2727
    };
2728

    
2729
    this.createWorker = function(session) {
2730
        if (this.constructor != Mode)
2731
            return;
2732
        var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
2733
        worker.attachToDocument(session.getDocument());
2734

    
2735
        if (this.fragmentContext)
2736
            worker.call("setOptions", [{context: this.fragmentContext}]);
2737

    
2738
        worker.on("error", function(e) {
2739
            session.setAnnotations(e.data);
2740
        });
2741

    
2742
        worker.on("terminate", function() {
2743
            session.clearAnnotations();
2744
        });
2745

    
2746
        return worker;
2747
    };
2748

    
2749
    this.$id = "ace/mode/html";
2750
    this.snippetFileId = "ace/snippets/html";
2751
}).call(Mode.prototype);
2752

    
2753
exports.Mode = Mode;
2754
});
2755

    
2756
ace.define("ace/mode/markdown_highlight_rules",["require","exports","module","ace/config","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/html_highlight_rules"], function(require, exports, module) {
2757
"use strict";
2758

    
2759
var modes = require("../config").$modes;
2760

    
2761
var oop = require("../lib/oop");
2762
var lang = require("../lib/lang");
2763
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
2764
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
2765

    
2766
var escaped = function(ch) {
2767
    return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*";
2768
};
2769

    
2770
var MarkdownHighlightRules = function() {
2771
    HtmlHighlightRules.call(this);
2772
    var codeBlockStartRule = {
2773
        token : "support.function",
2774
        regex : /^\s*(```+[^`]*|~~~+[^~]*)$/,
2775
        onMatch: function(value, state, stack, line) {
2776
            var m = value.match(/^(\s*)([`~]+)(.*)/);
2777
            var language = /[\w-]+|$/.exec(m[3])[0];
2778
            if (!modes[language])
2779
                language = "";
2780
            stack.unshift("githubblock", [], [m[1], m[2], language], state);
2781
            return this.token;
2782
        },
2783
        next  : "githubblock"
2784
    };
2785
    var codeBlockRules = [{
2786
        token : "support.function",
2787
        regex : ".*",
2788
        onMatch: function(value, state, stack, line) {
2789
            var embedState = stack[1];
2790
            var indent = stack[2][0];
2791
            var endMarker = stack[2][1];
2792
            var language = stack[2][2];
2793
            
2794
            var m = /^(\s*)(`+|~+)\s*$/.exec(value);
2795
            if (
2796
                m && m[1].length < indent.length + 3
2797
                && m[2].length >= endMarker.length && m[2][0] == endMarker[0]
2798
            ) {
2799
                stack.splice(0, 3);
2800
                this.next = stack.shift();
2801
                return this.token;
2802
            }
2803
            this.next = "";
2804
            if (language && modes[language]) {
2805
                var data = modes[language].getTokenizer().getLineTokens(value, embedState.slice(0));
2806
                stack[1] = data.state;
2807
                return data.tokens;
2808
            }
2809
            return this.token;
2810
        }
2811
    }];
2812

    
2813
    this.$rules["start"].unshift({
2814
        token : "empty_line",
2815
        regex : '^$',
2816
        next: "allowBlock"
2817
    }, { // h1
2818
        token: "markup.heading.1",
2819
        regex: "^=+(?=\\s*$)"
2820
    }, { // h2
2821
        token: "markup.heading.2",
2822
        regex: "^\\-+(?=\\s*$)"
2823
    }, {
2824
        token : function(value) {
2825
            return "markup.heading." + value.length;
2826
        },
2827
        regex : /^#{1,6}(?=\s|$)/,
2828
        next : "header"
2829
    },
2830
    codeBlockStartRule,
2831
    { // block quote
2832
        token : "string.blockquote",
2833
        regex : "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
2834
        next  : "blockquote"
2835
    }, { // HR * - _
2836
        token : "constant",
2837
        regex : "^ {0,3}(?:(?:\\* ?){3,}|(?:\\- ?){3,}|(?:\\_ ?){3,})\\s*$",
2838
        next: "allowBlock"
2839
    }, { // list
2840
        token : "markup.list",
2841
        regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
2842
        next  : "listblock-start"
2843
    }, {
2844
        include : "basic"
2845
    });
2846

    
2847
    this.addRules({
2848
        "basic" : [{
2849
            token : "constant.language.escape",
2850
            regex : /\\[\\`*_{}\[\]()#+\-.!]/
2851
        }, { // code span `
2852
            token : "support.function",
2853
            regex : "(`+)(.*?[^`])(\\1)"
2854
        }, { // reference
2855
            token : ["text", "constant", "text", "url", "string", "text"],
2856
            regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
2857
        }, { // link by reference
2858
            token : ["text", "string", "text", "constant", "text"],
2859
            regex : "(\\[)(" + escaped("]") + ")(\\]\\s*\\[)("+ escaped("]") + ")(\\])"
2860
        }, { // link by url
2861
            token : ["text", "string", "text", "markup.underline", "string", "text"],
2862
            regex : "(\\!?\\[)(" +                                        // [
2863
                    escaped("]") +                                    // link text or alt text
2864
                    ")(\\]\\()"+                                      // ](
2865
                    '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' +        // href or image
2866
                    '(\\s*"' +  escaped('"') + '"\\s*)?' +            // "title"
2867
                    "(\\))"                                           // )
2868
        }, { // strong ** __
2869
            token : "string.strong",
2870
            regex : "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)"
2871
        }, { // emphasis * _
2872
            token : "string.emphasis",
2873
            regex : "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)"
2874
        }, { //
2875
            token : ["text", "url", "text"],
2876
            regex : "(<)("+
2877
                      "(?:https?|ftp|dict):[^'\">\\s]+"+
2878
                      "|"+
2879
                      "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+"+
2880
                    ")(>)"
2881
        }],
2882
        "allowBlock": [
2883
            {token : "support.function", regex : "^ {4}.+", next : "allowBlock"},
2884
            {token : "empty_line", regex : '^$', next: "allowBlock"},
2885
            {token : "empty", regex : "", next : "start"}
2886
        ],
2887

    
2888
        "header" : [{
2889
            regex: "$",
2890
            next : "start"
2891
        }, {
2892
            include: "basic"
2893
        }, {
2894
            defaultToken : "heading"
2895
        } ],
2896

    
2897
        "listblock-start" : [{
2898
            token : "support.variable",
2899
            regex : /(?:\[[ x]\])?/,
2900
            next  : "listblock"
2901
        }],
2902

    
2903
        "listblock" : [ { // Lists only escape on completely blank lines.
2904
            token : "empty_line",
2905
            regex : "^$",
2906
            next  : "start"
2907
        }, { // list
2908
            token : "markup.list",
2909
            regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
2910
            next  : "listblock-start"
2911
        }, {
2912
            include : "basic", noEscape: true
2913
        },
2914
        codeBlockStartRule,
2915
        {
2916
            defaultToken : "list" //do not use markup.list to allow stling leading `*` differntly
2917
        } ],
2918

    
2919
        "blockquote" : [ { // Blockquotes only escape on blank lines.
2920
            token : "empty_line",
2921
            regex : "^\\s*$",
2922
            next  : "start"
2923
        }, { // block quote
2924
            token : "string.blockquote",
2925
            regex : "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
2926
            next  : "blockquote"
2927
        }, {
2928
            include : "basic", noEscape: true
2929
        }, {
2930
            defaultToken : "string.blockquote"
2931
        } ],
2932

    
2933
        "githubblock" : codeBlockRules
2934
    });
2935

    
2936
    this.normalizeRules();
2937
};
2938
oop.inherits(MarkdownHighlightRules, TextHighlightRules);
2939

    
2940
exports.MarkdownHighlightRules = MarkdownHighlightRules;
2941
});
2942

    
2943
ace.define("ace/mode/folding/markdown",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
2944
"use strict";
2945

    
2946
var oop = require("../../lib/oop");
2947
var BaseFoldMode = require("./fold_mode").FoldMode;
2948
var Range = require("../../range").Range;
2949

    
2950
var FoldMode = exports.FoldMode = function() {};
2951
oop.inherits(FoldMode, BaseFoldMode);
2952

    
2953
(function() {
2954
    this.foldingStartMarker = /^(?:[=-]+\s*$|#{1,6} |`{3})/;
2955

    
2956
    this.getFoldWidget = function(session, foldStyle, row) {
2957
        var line = session.getLine(row);
2958
        if (!this.foldingStartMarker.test(line))
2959
            return "";
2960

    
2961
        if (line[0] == "`") {
2962
            if (session.bgTokenizer.getState(row) == "start")
2963
                return "end";
2964
            return "start";
2965
        }
2966

    
2967
        return "start";
2968
    };
2969

    
2970
    this.getFoldWidgetRange = function(session, foldStyle, row) {
2971
        var line = session.getLine(row);
2972
        var startColumn = line.length;
2973
        var maxRow = session.getLength();
2974
        var startRow = row;
2975
        var endRow = row;
2976
        if (!line.match(this.foldingStartMarker))
2977
            return;
2978

    
2979
        if (line[0] == "`") {
2980
            if (session.bgTokenizer.getState(row) !== "start") {
2981
                while (++row < maxRow) {
2982
                    line = session.getLine(row);
2983
                    if (line[0] == "`" & line.substring(0, 3) == "```")
2984
                        break;
2985
                }
2986
                return new Range(startRow, startColumn, row, 0);
2987
            } else {
2988
                while (row -- > 0) {
2989
                    line = session.getLine(row);
2990
                    if (line[0] == "`" & line.substring(0, 3) == "```")
2991
                        break;
2992
                }
2993
                return new Range(row, line.length, startRow, 0);
2994
            }
2995
        }
2996

    
2997
        var token;
2998
        function isHeading(row) {
2999
            token = session.getTokens(row)[0];
3000
            return token && token.type.lastIndexOf(heading, 0) === 0;
3001
        }
3002

    
3003
        var heading = "markup.heading";
3004
        function getLevel() {
3005
            var ch = token.value[0];
3006
            if (ch == "=") return 6;
3007
            if (ch == "-") return 5;
3008
            return 7 - token.value.search(/[^#]|$/);
3009
        }
3010

    
3011
        if (isHeading(row)) {
3012
            var startHeadingLevel = getLevel();
3013
            while (++row < maxRow) {
3014
                if (!isHeading(row))
3015
                    continue;
3016
                var level = getLevel();
3017
                if (level >= startHeadingLevel)
3018
                    break;
3019
            }
3020

    
3021
            endRow = row - (!token || ["=", "-"].indexOf(token.value[0]) == -1 ? 1 : 2);
3022

    
3023
            if (endRow > startRow) {
3024
                while (endRow > startRow && /^\s*$/.test(session.getLine(endRow)))
3025
                    endRow--;
3026
            }
3027

    
3028
            if (endRow > startRow) {
3029
                var endColumn = session.getLine(endRow).length;
3030
                return new Range(startRow, startColumn, endRow, endColumn);
3031
            }
3032
        }
3033
    };
3034

    
3035
}).call(FoldMode.prototype);
3036

    
3037
});
3038

    
3039
ace.define("ace/mode/sh_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
3040
"use strict";
3041

    
3042
var oop = require("../lib/oop");
3043
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
3044

    
3045
var reservedKeywords = exports.reservedKeywords = (
3046
        '!|{|}|case|do|done|elif|else|'+
3047
        'esac|fi|for|if|in|then|until|while|'+
3048
        '&|;|export|local|read|typeset|unset|'+
3049
        'elif|select|set|function|declare|readonly'
3050
    );
3051

    
3052
var languageConstructs = exports.languageConstructs = (
3053
    '[|]|alias|bg|bind|break|builtin|'+
3054
     'cd|command|compgen|complete|continue|'+
3055
     'dirs|disown|echo|enable|eval|exec|'+
3056
     'exit|fc|fg|getopts|hash|help|history|'+
3057
     'jobs|kill|let|logout|popd|printf|pushd|'+
3058
     'pwd|return|set|shift|shopt|source|'+
3059
     'suspend|test|times|trap|type|ulimit|'+
3060
     'umask|unalias|wait'
3061
);
3062

    
3063
var ShHighlightRules = function() {
3064
    var keywordMapper = this.createKeywordMapper({
3065
        "keyword": reservedKeywords,
3066
        "support.function.builtin": languageConstructs,
3067
        "invalid.deprecated": "debugger"
3068
    }, "identifier");
3069

    
3070
    var integer = "(?:(?:[1-9]\\d*)|(?:0))";
3071

    
3072
    var fraction = "(?:\\.\\d+)";
3073
    var intPart = "(?:\\d+)";
3074
    var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
3075
    var exponentFloat = "(?:(?:" + pointFloat + "|" +  intPart + ")" + ")";
3076
    var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
3077
    var fileDescriptor = "(?:&" + intPart + ")";
3078

    
3079
    var variableName = "[a-zA-Z_][a-zA-Z0-9_]*";
3080
    var variable = "(?:" + variableName + "(?==))";
3081

    
3082
    var builtinVariable = "(?:\\$(?:SHLVL|\\$|\\!|\\?))";
3083

    
3084
    var func = "(?:" + variableName + "\\s*\\(\\))";
3085

    
3086
    this.$rules = {
3087
        "start" : [{
3088
            token : "constant",
3089
            regex : /\\./
3090
        }, {
3091
            token : ["text", "comment"],
3092
            regex : /(^|\s)(#.*)$/
3093
        }, {
3094
            token : "string.start",
3095
            regex : '"',
3096
            push : [{
3097
                token : "constant.language.escape",
3098
                regex : /\\(?:[$`"\\]|$)/
3099
            }, {
3100
                include : "variables"
3101
            }, {
3102
                token : "keyword.operator",
3103
                regex : /`/ // TODO highlight `
3104
            }, {
3105
                token : "string.end",
3106
                regex : '"',
3107
                next: "pop"
3108
            }, {
3109
                defaultToken: "string"
3110
            }]
3111
        }, {
3112
            token : "string",
3113
            regex : "\\$'",
3114
            push : [{
3115
                token : "constant.language.escape",
3116
                regex : /\\(?:[abeEfnrtv\\'"]|x[a-fA-F\d]{1,2}|u[a-fA-F\d]{4}([a-fA-F\d]{4})?|c.|\d{1,3})/
3117
            }, {
3118
                token : "string",
3119
                regex : "'",
3120
                next: "pop"
3121
            }, {
3122
                defaultToken: "string"
3123
            }]
3124
        }, {
3125
            regex : "<<<",
3126
            token : "keyword.operator"
3127
        }, {
3128
            stateName: "heredoc",
3129
            regex : "(<<-?)(\\s*)(['\"`]?)([\\w\\-]+)(['\"`]?)",
3130
            onMatch : function(value, currentState, stack) {
3131
                var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
3132
                var tokens = value.split(this.splitRegex);
3133
                stack.push(next, tokens[4]);
3134
                return [
3135
                    {type:"constant", value: tokens[1]},
3136
                    {type:"text", value: tokens[2]},
3137
                    {type:"string", value: tokens[3]},
3138
                    {type:"support.class", value: tokens[4]},
3139
                    {type:"string", value: tokens[5]}
3140
                ];
3141
            },
3142
            rules: {
3143
                heredoc: [{
3144
                    onMatch:  function(value, currentState, stack) {
3145
                        if (value === stack[1]) {
3146
                            stack.shift();
3147
                            stack.shift();
3148
                            this.next = stack[0] || "start";
3149
                            return "support.class";
3150
                        }
3151
                        this.next = "";
3152
                        return "string";
3153
                    },
3154
                    regex: ".*$",
3155
                    next: "start"
3156
                }],
3157
                indentedHeredoc: [{
3158
                    token: "string",
3159
                    regex: "^\t+"
3160
                }, {
3161
                    onMatch:  function(value, currentState, stack) {
3162
                        if (value === stack[1]) {
3163
                            stack.shift();
3164
                            stack.shift();
3165
                            this.next = stack[0] || "start";
3166
                            return "support.class";
3167
                        }
3168
                        this.next = "";
3169
                        return "string";
3170
                    },
3171
                    regex: ".*$",
3172
                    next: "start"
3173
                }]
3174
            }
3175
        }, {
3176
            regex : "$",
3177
            token : "empty",
3178
            next : function(currentState, stack) {
3179
                if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
3180
                    return stack[0];
3181
                return currentState;
3182
            }
3183
        }, {
3184
            token : ["keyword", "text", "text", "text", "variable"],
3185
            regex : /(declare|local|readonly)(\s+)(?:(-[fixar]+)(\s+))?([a-zA-Z_][a-zA-Z0-9_]*\b)/
3186
        }, {
3187
            token : "variable.language",
3188
            regex : builtinVariable
3189
        }, {
3190
            token : "variable",
3191
            regex : variable
3192
        }, {
3193
            include : "variables"
3194
        }, {
3195
            token : "support.function",
3196
            regex : func
3197
        }, {
3198
            token : "support.function",
3199
            regex : fileDescriptor
3200
        }, {
3201
            token : "string",           // ' string
3202
            start : "'", end : "'"
3203
        }, {
3204
            token : "constant.numeric", // float
3205
            regex : floatNumber
3206
        }, {
3207
            token : "constant.numeric", // integer
3208
            regex : integer + "\\b"
3209
        }, {
3210
            token : keywordMapper,
3211
            regex : "[a-zA-Z_][a-zA-Z0-9_]*\\b"
3212
        }, {
3213
            token : "keyword.operator",
3214
            regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!=|[%&|`]"
3215
        }, {
3216
            token : "punctuation.operator",
3217
            regex : ";"
3218
        }, {
3219
            token : "paren.lparen",
3220
            regex : "[\\[\\(\\{]"
3221
        }, {
3222
            token : "paren.rparen",
3223
            regex : "[\\]]"
3224
        }, {
3225
            token : "paren.rparen",
3226
            regex : "[\\)\\}]",
3227
            next : "pop"
3228
        }],
3229
        variables: [{
3230
            token : "variable",
3231
            regex : /(\$)(\w+)/
3232
        }, {
3233
            token : ["variable", "paren.lparen"],
3234
            regex : /(\$)(\()/,
3235
            push : "start"
3236
        }, {
3237
            token : ["variable", "paren.lparen", "keyword.operator", "variable", "keyword.operator"],
3238
            regex : /(\$)(\{)([#!]?)(\w+|[*@#?\-$!0_])(:[?+\-=]?|##?|%%?|,,?\/|\^\^?)?/,
3239
            push : "start"
3240
        }, {
3241
            token : "variable",
3242
            regex : /\$[*@#?\-$!0_]/
3243
        }, {
3244
            token : ["variable", "paren.lparen"],
3245
            regex : /(\$)(\{)/,
3246
            push : "start"
3247
        }]
3248
    };
3249
    
3250
    this.normalizeRules();
3251
};
3252

    
3253
oop.inherits(ShHighlightRules, TextHighlightRules);
3254

    
3255
exports.ShHighlightRules = ShHighlightRules;
3256
});
3257

    
3258
ace.define("ace/mode/sh",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/sh_highlight_rules","ace/range","ace/mode/folding/cstyle","ace/mode/behaviour/cstyle"], function(require, exports, module) {
3259
"use strict";
3260

    
3261
var oop = require("../lib/oop");
3262
var TextMode = require("./text").Mode;
3263
var ShHighlightRules = require("./sh_highlight_rules").ShHighlightRules;
3264
var Range = require("../range").Range;
3265
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
3266
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
3267

    
3268
var Mode = function() {
3269
    this.HighlightRules = ShHighlightRules;
3270
    this.foldingRules = new CStyleFoldMode();
3271
    this.$behaviour = new CstyleBehaviour();
3272
};
3273
oop.inherits(Mode, TextMode);
3274

    
3275
(function() {
3276

    
3277
   
3278
    this.lineCommentStart = "#";
3279

    
3280
    this.getNextLineIndent = function(state, line, tab) {
3281
        var indent = this.$getIndent(line);
3282

    
3283
        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
3284
        var tokens = tokenizedLine.tokens;
3285

    
3286
        if (tokens.length && tokens[tokens.length-1].type == "comment") {
3287
            return indent;
3288
        }
3289

    
3290
        if (state == "start") {
3291
            var match = line.match(/^.*[\{\(\[:]\s*$/);
3292
            if (match) {
3293
                indent += tab;
3294
            }
3295
        }
3296

    
3297
        return indent;
3298
    };
3299

    
3300
    var outdents = {
3301
        "pass": 1,
3302
        "return": 1,
3303
        "raise": 1,
3304
        "break": 1,
3305
        "continue": 1
3306
    };
3307

    
3308
    this.checkOutdent = function(state, line, input) {
3309
        if (input !== "\r\n" && input !== "\r" && input !== "\n")
3310
            return false;
3311

    
3312
        var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
3313

    
3314
        if (!tokens)
3315
            return false;
3316
        do {
3317
            var last = tokens.pop();
3318
        } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
3319

    
3320
        if (!last)
3321
            return false;
3322

    
3323
        return (last.type == "keyword" && outdents[last.value]);
3324
    };
3325

    
3326
    this.autoOutdent = function(state, doc, row) {
3327

    
3328
        row += 1;
3329
        var indent = this.$getIndent(doc.getLine(row));
3330
        var tab = doc.getTabString();
3331
        if (indent.slice(-tab.length) == tab)
3332
            doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
3333
    };
3334

    
3335
    this.$id = "ace/mode/sh";
3336
    this.snippetFileId = "ace/snippets/sh";
3337
}).call(Mode.prototype);
3338

    
3339
exports.Mode = Mode;
3340
});
3341

    
3342
ace.define("ace/mode/markdown",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript","ace/mode/xml","ace/mode/html","ace/mode/markdown_highlight_rules","ace/mode/folding/markdown","ace/mode/javascript","ace/mode/html","ace/mode/sh","ace/mode/sh","ace/mode/xml","ace/mode/css"], function(require, exports, module) {
3343
"use strict";
3344

    
3345
var oop = require("../lib/oop");
3346
var TextMode = require("./text").Mode;
3347
var JavaScriptMode = require("./javascript").Mode;
3348
var XmlMode = require("./xml").Mode;
3349
var HtmlMode = require("./html").Mode;
3350
var MarkdownHighlightRules = require("./markdown_highlight_rules").MarkdownHighlightRules;
3351
var MarkdownFoldMode = require("./folding/markdown").FoldMode;
3352

    
3353
var Mode = function() {
3354
    this.HighlightRules = MarkdownHighlightRules;
3355

    
3356
    this.createModeDelegates({
3357
        javascript: require("./javascript").Mode,
3358
        html: require("./html").Mode,
3359
        bash: require("./sh").Mode,
3360
        sh: require("./sh").Mode,
3361
        xml: require("./xml").Mode,
3362
        css: require("./css").Mode
3363
    });
3364

    
3365
    this.foldingRules = new MarkdownFoldMode();
3366
    this.$behaviour = this.$defaultBehaviour;
3367
};
3368
oop.inherits(Mode, TextMode);
3369

    
3370
(function() {
3371
    this.type = "text";
3372
    this.blockComment = {start: "<!--", end: "-->"};
3373
    this.$quotes = {'"': '"', "`": "`"};
3374

    
3375
    this.getNextLineIndent = function(state, line, tab) {
3376
        if (state == "listblock") {
3377
            var match = /^(\s*)(?:([-+*])|(\d+)\.)(\s+)/.exec(line);
3378
            if (!match)
3379
                return "";
3380
            var marker = match[2];
3381
            if (!marker)
3382
                marker = parseInt(match[3], 10) + 1 + ".";
3383
            return match[1] + marker + match[4];
3384
        } else {
3385
            return this.$getIndent(line);
3386
        }
3387
    };
3388
    this.$id = "ace/mode/markdown";
3389
    this.snippetFileId = "ace/snippets/markdown";
3390
}).call(Mode.prototype);
3391

    
3392
exports.Mode = Mode;
3393
});
3394

    
3395
ace.define("ace/mode/coffee_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
3396
"use strict";
3397

    
3398
    var oop = require("../lib/oop");
3399
    var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
3400

    
3401
    oop.inherits(CoffeeHighlightRules, TextHighlightRules);
3402

    
3403
    function CoffeeHighlightRules() {
3404
        var identifier = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*";
3405

    
3406
        var keywords = (
3407
            "this|throw|then|try|typeof|super|switch|return|break|by|continue|" +
3408
            "catch|class|in|instanceof|is|isnt|if|else|extends|for|own|" +
3409
            "finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|" +
3410
            "or|on|unless|until|and|yes|yield|export|import|default"
3411
        );
3412

    
3413
        var langConstant = (
3414
            "true|false|null|undefined|NaN|Infinity"
3415
        );
3416

    
3417
        var illegal = (
3418
            "case|const|function|var|void|with|enum|implements|" +
3419
            "interface|let|package|private|protected|public|static"
3420
        );
3421

    
3422
        var supportClass = (
3423
            "Array|Boolean|Date|Function|Number|Object|RegExp|ReferenceError|String|" +
3424
            "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" +
3425
            "SyntaxError|TypeError|URIError|"  +
3426
            "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
3427
            "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray"
3428
        );
3429

    
3430
        var supportFunction = (
3431
            "Math|JSON|isNaN|isFinite|parseInt|parseFloat|encodeURI|" +
3432
            "encodeURIComponent|decodeURI|decodeURIComponent|String|"
3433
        );
3434

    
3435
        var variableLanguage = (
3436
            "window|arguments|prototype|document"
3437
        );
3438

    
3439
        var keywordMapper = this.createKeywordMapper({
3440
            "keyword": keywords,
3441
            "constant.language": langConstant,
3442
            "invalid.illegal": illegal,
3443
            "language.support.class": supportClass,
3444
            "language.support.function": supportFunction,
3445
            "variable.language": variableLanguage
3446
        }, "identifier");
3447

    
3448
        var functionRule = {
3449
            token: ["paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"],
3450
            regex: /(?:(\()((?:"[^")]*?"|'[^')]*?'|\/[^\/)]*?\/|[^()"'\/])*?)(\))(\s*))?([\-=]>)/.source
3451
        };
3452

    
3453
        var stringEscape = /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)/;
3454

    
3455
        this.$rules = {
3456
            start : [
3457
                {
3458
                    token : "constant.numeric",
3459
                    regex : "(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)"
3460
                }, {
3461
                    stateName: "qdoc",
3462
                    token : "string", regex : "'''", next : [
3463
                        {token : "string", regex : "'''", next : "start"},
3464
                        {token : "constant.language.escape", regex : stringEscape},
3465
                        {defaultToken: "string"}
3466
                    ]
3467
                }, {
3468
                    stateName: "qqdoc",
3469
                    token : "string",
3470
                    regex : '"""',
3471
                    next : [
3472
                        {token : "string", regex : '"""', next : "start"},
3473
                        {token : "paren.string", regex : '#{', push : "start"},
3474
                        {token : "constant.language.escape", regex : stringEscape},
3475
                        {defaultToken: "string"}
3476
                    ]
3477
                }, {
3478
                    stateName: "qstring",
3479
                    token : "string", regex : "'", next : [
3480
                        {token : "string", regex : "'", next : "start"},
3481
                        {token : "constant.language.escape", regex : stringEscape},
3482
                        {defaultToken: "string"}
3483
                    ]
3484
                }, {
3485
                    stateName: "qqstring",
3486
                    token : "string.start", regex : '"', next : [
3487
                        {token : "string.end", regex : '"', next : "start"},
3488
                        {token : "paren.string", regex : '#{', push : "start"},
3489
                        {token : "constant.language.escape", regex : stringEscape},
3490
                        {defaultToken: "string"}
3491
                    ]
3492
                }, {
3493
                    stateName: "js",
3494
                    token : "string", regex : "`", next : [
3495
                        {token : "string", regex : "`", next : "start"},
3496
                        {token : "constant.language.escape", regex : stringEscape},
3497
                        {defaultToken: "string"}
3498
                    ]
3499
                }, {
3500
                    regex: "[{}]", onMatch: function(val, state, stack) {
3501
                        this.next = "";
3502
                        if (val == "{" && stack.length) {
3503
                            stack.unshift("start", state);
3504
                            return "paren";
3505
                        }
3506
                        if (val == "}" && stack.length) {
3507
                            stack.shift();
3508
                            this.next = stack.shift() || "";
3509
                            if (this.next.indexOf("string") != -1)
3510
                                return "paren.string";
3511
                        }
3512
                        return "paren";
3513
                    }
3514
                }, {
3515
                    token : "string.regex",
3516
                    regex : "///",
3517
                    next : "heregex"
3518
                }, {
3519
                    token : "string.regex",
3520
                    regex : /(?:\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)(?:[imgy]{0,4})(?!\w)/
3521
                }, {
3522
                    token : "comment",
3523
                    regex : "###(?!#)",
3524
                    next : "comment"
3525
                }, {
3526
                    token : "comment",
3527
                    regex : "#.*"
3528
                }, {
3529
                    token : ["punctuation.operator", "text", "identifier"],
3530
                    regex : "(\\.)(\\s*)(" + illegal + ")"
3531
                }, {
3532
                    token : "punctuation.operator",
3533
                    regex : "\\.{1,3}"
3534
                }, {
3535
                    token : ["keyword", "text", "language.support.class",
3536
                     "text", "keyword", "text", "language.support.class"],
3537
                    regex : "(class)(\\s+)(" + identifier + ")(?:(\\s+)(extends)(\\s+)(" + identifier + "))?"
3538
                }, {
3539
                    token : ["entity.name.function", "text", "keyword.operator", "text"].concat(functionRule.token),
3540
                    regex : "(" + identifier + ")(\\s*)([=:])(\\s*)" + functionRule.regex
3541
                }, 
3542
                functionRule, 
3543
                {
3544
                    token : "variable",
3545
                    regex : "@(?:" + identifier + ")?"
3546
                }, {
3547
                    token: keywordMapper,
3548
                    regex : identifier
3549
                }, {
3550
                    token : "punctuation.operator",
3551
                    regex : "\\,|\\."
3552
                }, {
3553
                    token : "storage.type",
3554
                    regex : "[\\-=]>"
3555
                }, {
3556
                    token : "keyword.operator",
3557
                    regex : "(?:[-+*/%<>&|^!?=]=|>>>=?|\\-\\-|\\+\\+|::|&&=|\\|\\|=|<<=|>>=|\\?\\.|\\.{2,3}|[!*+-=><])"
3558
                }, {
3559
                    token : "paren.lparen",
3560
                    regex : "[({[]"
3561
                }, {
3562
                    token : "paren.rparen",
3563
                    regex : "[\\]})]"
3564
                }, {
3565
                    token : "text",
3566
                    regex : "\\s+"
3567
                }],
3568

    
3569

    
3570
            heregex : [{
3571
                token : "string.regex",
3572
                regex : '.*?///[imgy]{0,4}',
3573
                next : "start"
3574
            }, {
3575
                token : "comment.regex",
3576
                regex : "\\s+(?:#.*)?"
3577
            }, {
3578
                token : "string.regex",
3579
                regex : "\\S+"
3580
            }],
3581

    
3582
            comment : [{
3583
                token : "comment",
3584
                regex : '###',
3585
                next : "start"
3586
            }, {
3587
                defaultToken : "comment"
3588
            }]
3589
        };
3590
        this.normalizeRules();
3591
    }
3592

    
3593
    exports.CoffeeHighlightRules = CoffeeHighlightRules;
3594
});
3595

    
3596
ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
3597
"use strict";
3598

    
3599
var oop = require("../../lib/oop");
3600
var BaseFoldMode = require("./fold_mode").FoldMode;
3601
var Range = require("../../range").Range;
3602

    
3603
var FoldMode = exports.FoldMode = function() {};
3604
oop.inherits(FoldMode, BaseFoldMode);
3605

    
3606
(function() {
3607

    
3608
    this.getFoldWidgetRange = function(session, foldStyle, row) {
3609
        var range = this.indentationBlock(session, row);
3610
        if (range)
3611
            return range;
3612

    
3613
        var re = /\S/;
3614
        var line = session.getLine(row);
3615
        var startLevel = line.search(re);
3616
        if (startLevel == -1 || line[startLevel] != "#")
3617
            return;
3618

    
3619
        var startColumn = line.length;
3620
        var maxRow = session.getLength();
3621
        var startRow = row;
3622
        var endRow = row;
3623

    
3624
        while (++row < maxRow) {
3625
            line = session.getLine(row);
3626
            var level = line.search(re);
3627

    
3628
            if (level == -1)
3629
                continue;
3630

    
3631
            if (line[level] != "#")
3632
                break;
3633

    
3634
            endRow = row;
3635
        }
3636

    
3637
        if (endRow > startRow) {
3638
            var endColumn = session.getLine(endRow).length;
3639
            return new Range(startRow, startColumn, endRow, endColumn);
3640
        }
3641
    };
3642
    this.getFoldWidget = function(session, foldStyle, row) {
3643
        var line = session.getLine(row);
3644
        var indent = line.search(/\S/);
3645
        var next = session.getLine(row + 1);
3646
        var prev = session.getLine(row - 1);
3647
        var prevIndent = prev.search(/\S/);
3648
        var nextIndent = next.search(/\S/);
3649

    
3650
        if (indent == -1) {
3651
            session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
3652
            return "";
3653
        }
3654
        if (prevIndent == -1) {
3655
            if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
3656
                session.foldWidgets[row - 1] = "";
3657
                session.foldWidgets[row + 1] = "";
3658
                return "start";
3659
            }
3660
        } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
3661
            if (session.getLine(row - 2).search(/\S/) == -1) {
3662
                session.foldWidgets[row - 1] = "start";
3663
                session.foldWidgets[row + 1] = "";
3664
                return "";
3665
            }
3666
        }
3667

    
3668
        if (prevIndent!= -1 && prevIndent < indent)
3669
            session.foldWidgets[row - 1] = "start";
3670
        else
3671
            session.foldWidgets[row - 1] = "";
3672

    
3673
        if (indent < nextIndent)
3674
            return "start";
3675
        else
3676
            return "";
3677
    };
3678

    
3679
}).call(FoldMode.prototype);
3680

    
3681
});
3682

    
3683
ace.define("ace/mode/coffee",["require","exports","module","ace/mode/coffee_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/coffee","ace/range","ace/mode/text","ace/worker/worker_client","ace/lib/oop"], function(require, exports, module) {
3684
"use strict";
3685

    
3686
var Rules = require("./coffee_highlight_rules").CoffeeHighlightRules;
3687
var Outdent = require("./matching_brace_outdent").MatchingBraceOutdent;
3688
var FoldMode = require("./folding/coffee").FoldMode;
3689
var Range = require("../range").Range;
3690
var TextMode = require("./text").Mode;
3691
var WorkerClient = require("../worker/worker_client").WorkerClient;
3692
var oop = require("../lib/oop");
3693

    
3694
function Mode() {
3695
    this.HighlightRules = Rules;
3696
    this.$outdent = new Outdent();
3697
    this.foldingRules = new FoldMode();
3698
}
3699

    
3700
oop.inherits(Mode, TextMode);
3701

    
3702
(function() {
3703
    var indenter = /(?:[({[=:]|[-=]>|\b(?:else|try|(?:swi|ca)tch(?:\s+[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$|^\s*(else\b\s*)?(?:if|for|while|loop)\b(?!.*\bthen\b)/;
3704
    
3705
    this.lineCommentStart = "#";
3706
    this.blockComment = {start: "###", end: "###"};
3707
    
3708
    this.getNextLineIndent = function(state, line, tab) {
3709
        var indent = this.$getIndent(line);
3710
        var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
3711
    
3712
        if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
3713
            state === 'start' && indenter.test(line))
3714
            indent += tab;
3715
        return indent;
3716
    };
3717
    
3718
    this.checkOutdent = function(state, line, input) {
3719
        return this.$outdent.checkOutdent(line, input);
3720
    };
3721
    
3722
    this.autoOutdent = function(state, doc, row) {
3723
        this.$outdent.autoOutdent(doc, row);
3724
    };
3725
    
3726
    this.createWorker = function(session) {
3727
        var worker = new WorkerClient(["ace"], "ace/mode/coffee_worker", "Worker");
3728
        worker.attachToDocument(session.getDocument());
3729
        
3730
        worker.on("annotate", function(e) {
3731
            session.setAnnotations(e.data);
3732
        });
3733
        
3734
        worker.on("terminate", function() {
3735
            session.clearAnnotations();
3736
        });
3737
        
3738
        return worker;
3739
    };
3740

    
3741
    this.$id = "ace/mode/coffee";
3742
    this.snippetFileId = "ace/snippets/coffee";
3743
}).call(Mode.prototype);
3744

    
3745
exports.Mode = Mode;
3746

    
3747
});
3748

    
3749
ace.define("ace/mode/scss_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/css_highlight_rules"], function(require, exports, module) {
3750
"use strict";
3751

    
3752
var oop = require("../lib/oop");
3753
var lang = require("../lib/lang");
3754
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
3755
var CssHighlightRules = require("./css_highlight_rules");
3756

    
3757
var ScssHighlightRules = function() {
3758
    
3759
    var properties = lang.arrayToMap(CssHighlightRules.supportType.split("|"));
3760

    
3761
    var functions = lang.arrayToMap(
3762
        ("hsl|hsla|rgb|rgba|url|attr|counter|counters|abs|adjust_color|adjust_hue|" +
3763
         "alpha|join|blue|ceil|change_color|comparable|complement|darken|desaturate|" + 
3764
         "floor|grayscale|green|hue|if|invert|join|length|lighten|lightness|mix|" + 
3765
         "nth|opacify|opacity|percentage|quote|red|round|saturate|saturation|" +
3766
         "scale_color|transparentize|type_of|unit|unitless|unquote").split("|")
3767
    );
3768

    
3769
    var constants = lang.arrayToMap(CssHighlightRules.supportConstant.split("|"));
3770

    
3771
    var colors = lang.arrayToMap(CssHighlightRules.supportConstantColor.split("|"));
3772
    
3773
    var keywords = lang.arrayToMap(
3774
        ("@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|def|end|declare").split("|")
3775
    );
3776
    
3777
    var tags = lang.arrayToMap(
3778
        ("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" + 
3779
         "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" + 
3780
         "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" + 
3781
         "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" + 
3782
         "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" + 
3783
         "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" + 
3784
         "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" + 
3785
         "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" + 
3786
         "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
3787
    );
3788

    
3789
    var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
3790

    
3791
    this.$rules = {
3792
        "start" : [
3793
            {
3794
                token : "comment",
3795
                regex : "\\/\\/.*$"
3796
            },
3797
            {
3798
                token : "comment", // multi line comment
3799
                regex : "\\/\\*",
3800
                next : "comment"
3801
            }, {
3802
                token : "string", // single line
3803
                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
3804
            }, {
3805
                token : "string", // multi line string start
3806
                regex : '["].*\\\\$',
3807
                next : "qqstring"
3808
            }, {
3809
                token : "string", // single line
3810
                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
3811
            }, {
3812
                token : "string", // multi line string start
3813
                regex : "['].*\\\\$",
3814
                next : "qstring"
3815
            }, {
3816
                token : "constant.numeric",
3817
                regex : numRe + "(?:ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vmax|vmin|vm|vw|%)"
3818
            }, {
3819
                token : "constant.numeric", // hex6 color
3820
                regex : "#[a-f0-9]{6}"
3821
            }, {
3822
                token : "constant.numeric", // hex3 color
3823
                regex : "#[a-f0-9]{3}"
3824
            }, {
3825
                token : "constant.numeric",
3826
                regex : numRe
3827
            }, {
3828
                token : ["support.function", "string", "support.function"],
3829
                regex : "(url\\()(.*)(\\))"
3830
            }, {
3831
                token : function(value) {
3832
                    if (properties.hasOwnProperty(value.toLowerCase()))
3833
                        return "support.type";
3834
                    if (keywords.hasOwnProperty(value))
3835
                        return "keyword";
3836
                    else if (constants.hasOwnProperty(value))
3837
                        return "constant.language";
3838
                    else if (functions.hasOwnProperty(value))
3839
                        return "support.function";
3840
                    else if (colors.hasOwnProperty(value.toLowerCase()))
3841
                        return "support.constant.color";
3842
                    else if (tags.hasOwnProperty(value.toLowerCase()))
3843
                        return "variable.language";
3844
                    else
3845
                        return "text";
3846
                },
3847
                regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
3848
            }, {
3849
                token : "variable",
3850
                regex : "[a-z_\\-$][a-z0-9_\\-$]*\\b"
3851
            }, {
3852
                token: "variable.language",
3853
                regex: "#[a-z0-9-_]+"
3854
            }, {
3855
                token: "variable.language",
3856
                regex: "\\.[a-z0-9-_]+"
3857
            }, {
3858
                token: "variable.language",
3859
                regex: ":[a-z0-9-_]+"
3860
            }, {
3861
                token: "constant",
3862
                regex: "[a-z0-9-_]+"
3863
            }, {
3864
                token : "keyword.operator",
3865
                regex : "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*"
3866
            }, {
3867
                token : "paren.lparen",
3868
                regex : "[[({]"
3869
            }, {
3870
                token : "paren.rparen",
3871
                regex : "[\\])}]"
3872
            }, {
3873
                token : "text",
3874
                regex : "\\s+"
3875
            }, {
3876
                caseInsensitive: true
3877
            }
3878
        ],
3879
        "comment" : [
3880
            {
3881
                token : "comment", // closing comment
3882
                regex : "\\*\\/",
3883
                next : "start"
3884
            }, {
3885
                defaultToken : "comment"
3886
            }
3887
        ],
3888
        "qqstring" : [
3889
            {
3890
                token : "string",
3891
                regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
3892
                next : "start"
3893
            }, {
3894
                token : "string",
3895
                regex : '.+'
3896
            }
3897
        ],
3898
        "qstring" : [
3899
            {
3900
                token : "string",
3901
                regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
3902
                next : "start"
3903
            }, {
3904
                token : "string",
3905
                regex : '.+'
3906
            }
3907
        ]
3908
    };
3909
};
3910

    
3911
oop.inherits(ScssHighlightRules, TextHighlightRules);
3912

    
3913
exports.ScssHighlightRules = ScssHighlightRules;
3914

    
3915
});
3916

    
3917
ace.define("ace/mode/scss",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/scss_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/css","ace/mode/folding/cstyle","ace/mode/css_completions"], function(require, exports, module) {
3918
"use strict";
3919

    
3920
var oop = require("../lib/oop");
3921
var TextMode = require("./text").Mode;
3922
var ScssHighlightRules = require("./scss_highlight_rules").ScssHighlightRules;
3923
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
3924
var CssBehaviour = require("./behaviour/css").CssBehaviour;
3925
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
3926
var CssCompletions = require("./css_completions").CssCompletions;
3927

    
3928

    
3929
var Mode = function() {
3930
    this.HighlightRules = ScssHighlightRules;
3931
    this.$outdent = new MatchingBraceOutdent();
3932
    this.$behaviour = new CssBehaviour();
3933
    this.$completer = new CssCompletions();
3934
    this.foldingRules = new CStyleFoldMode();
3935
};
3936
oop.inherits(Mode, TextMode);
3937

    
3938
(function() {
3939
   
3940
    this.lineCommentStart = "//";
3941
    this.blockComment = {start: "/*", end: "*/"};
3942

    
3943
    this.getNextLineIndent = function(state, line, tab) {
3944
        var indent = this.$getIndent(line);
3945
        var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
3946
        if (tokens.length && tokens[tokens.length-1].type == "comment") {
3947
            return indent;
3948
        }
3949

    
3950
        var match = line.match(/^.*\{\s*$/);
3951
        if (match) {
3952
            indent += tab;
3953
        }
3954

    
3955
        return indent;
3956
    };
3957

    
3958
    this.checkOutdent = function(state, line, input) {
3959
        return this.$outdent.checkOutdent(line, input);
3960
    };
3961

    
3962
    this.autoOutdent = function(state, doc, row) {
3963
        this.$outdent.autoOutdent(doc, row);
3964
    };
3965
    
3966
    this.getCompletions = function(state, session, pos, prefix) {
3967
        return this.$completer.getCompletions(state, session, pos, prefix);
3968
    };
3969

    
3970

    
3971
    this.$id = "ace/mode/scss";
3972
}).call(Mode.prototype);
3973

    
3974
exports.Mode = Mode;
3975

    
3976
});
3977

    
3978
ace.define("ace/mode/sass_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/scss_highlight_rules"], function(require, exports, module) {
3979
"use strict";
3980

    
3981
var oop = require("../lib/oop");
3982
var lang = require("../lib/lang");
3983
var ScssHighlightRules = require("./scss_highlight_rules").ScssHighlightRules;
3984

    
3985
var SassHighlightRules = function() {
3986
    ScssHighlightRules.call(this);
3987
    var start = this.$rules.start;
3988
    if (start[1].token == "comment") {
3989
        start.splice(1, 1, {
3990
            onMatch: function(value, currentState, stack) {
3991
                stack.unshift(this.next, -1, value.length - 2, currentState);
3992
                return "comment";
3993
            },
3994
            regex: /^\s*\/\*/,
3995
            next: "comment"
3996
        }, {
3997
            token: "error.invalid",
3998
            regex: "/\\*|[{;}]"
3999
        }, {
4000
            token: "support.type",
4001
            regex: /^\s*:[\w\-]+\s/
4002
        });
4003
        
4004
        this.$rules.comment = [
4005
            {regex: /^\s*/, onMatch: function(value, currentState, stack) {
4006
                if (stack[1] === -1)
4007
                    stack[1] = Math.max(stack[2], value.length - 1);
4008
                if (value.length <= stack[1]) {stack.shift();stack.shift();stack.shift();
4009
                    this.next = stack.shift();
4010
                    return "text";
4011
                } else {
4012
                    this.next = "";
4013
                    return "comment";
4014
                }
4015
            }, next: "start"},
4016
            {defaultToken: "comment"}
4017
        ];
4018
    }
4019
};
4020

    
4021
oop.inherits(SassHighlightRules, ScssHighlightRules);
4022

    
4023
exports.SassHighlightRules = SassHighlightRules;
4024

    
4025
});
4026

    
4027
ace.define("ace/mode/sass",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/sass_highlight_rules","ace/mode/folding/coffee"], function(require, exports, module) {
4028
"use strict";
4029

    
4030
var oop = require("../lib/oop");
4031
var TextMode = require("./text").Mode;
4032
var SassHighlightRules = require("./sass_highlight_rules").SassHighlightRules;
4033
var FoldMode = require("./folding/coffee").FoldMode;
4034

    
4035
var Mode = function() {
4036
    this.HighlightRules = SassHighlightRules;
4037
    this.foldingRules = new FoldMode();
4038
    this.$behaviour = this.$defaultBehaviour;
4039
};
4040
oop.inherits(Mode, TextMode);
4041

    
4042
(function() {   
4043
    this.lineCommentStart = "//";
4044
    this.$id = "ace/mode/sass";
4045
}).call(Mode.prototype);
4046

    
4047
exports.Mode = Mode;
4048

    
4049
});
4050

    
4051
ace.define("ace/mode/less_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules","ace/mode/css_highlight_rules"], function(require, exports, module) {
4052
"use strict";
4053

    
4054
var oop = require("../lib/oop");
4055
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
4056
var CssHighlightRules = require('./css_highlight_rules');
4057

    
4058
var LessHighlightRules = function() {
4059

    
4060

    
4061
    var keywordList = "@import|@media|@font-face|@keyframes|@-webkit-keyframes|@supports|" + 
4062
        "@charset|@plugin|@namespace|@document|@page|@viewport|@-ms-viewport|" +
4063
        "or|and|when|not";
4064

    
4065
    var keywords = keywordList.split('|');
4066

    
4067
    var properties = CssHighlightRules.supportType.split('|');
4068

    
4069
    var keywordMapper = this.createKeywordMapper({
4070
        "support.constant": CssHighlightRules.supportConstant,
4071
        "keyword": keywordList,
4072
        "support.constant.color": CssHighlightRules.supportConstantColor,
4073
        "support.constant.fonts": CssHighlightRules.supportConstantFonts
4074
    }, "identifier", true);   
4075

    
4076
    var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
4077

    
4078
    this.$rules = {
4079
        "start" : [
4080
            {
4081
                token : "comment",
4082
                regex : "\\/\\/.*$"
4083
            },
4084
            {
4085
                token : "comment", // multi line comment
4086
                regex : "\\/\\*",
4087
                next : "comment"
4088
            }, {
4089
                token : "string", // single line
4090
                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
4091
            }, {
4092
                token : "string", // single line
4093
                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
4094
            }, {
4095
                token : ["constant.numeric", "keyword"],
4096
                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|%)"
4097
            }, {
4098
                token : "constant.numeric", // hex6 color
4099
                regex : "#[a-f0-9]{6}"
4100
            }, {
4101
                token : "constant.numeric", // hex3 color
4102
                regex : "#[a-f0-9]{3}"
4103
            }, {
4104
                token : "constant.numeric",
4105
                regex : numRe
4106
            }, {
4107
                token : ["support.function", "paren.lparen", "string", "paren.rparen"],
4108
                regex : "(url)(\\()(.*)(\\))"
4109
            }, {
4110
                token : ["support.function", "paren.lparen"],
4111
                regex : "(:extend|[a-z0-9_\\-]+)(\\()"
4112
            }, {
4113
                token : function(value) {
4114
                    if (keywords.indexOf(value.toLowerCase()) > -1)
4115
                        return "keyword";
4116
                    else
4117
                        return "variable";
4118
                },
4119
                regex : "[@\\$][a-z0-9_\\-@\\$]*\\b"
4120
            }, {
4121
                token : "variable",
4122
                regex : "[@\\$]\\{[a-z0-9_\\-@\\$]*\\}"
4123
            }, {
4124
                token : function(first, second) {
4125
                    if(properties.indexOf(first.toLowerCase()) > -1) {
4126
                        return ["support.type.property", "text"];
4127
                    }
4128
                    else {
4129
                        return ["support.type.unknownProperty", "text"];
4130
                    }
4131
                },
4132
                regex : "([a-z0-9-_]+)(\\s*:)"
4133
            }, {
4134
                token : "keyword",
4135
                regex : "&"   // special case - always treat as keyword
4136
            }, {
4137
                token : keywordMapper,
4138
                regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
4139
            }, {
4140
                token: "variable.language",
4141
                regex: "#[a-z0-9-_]+"
4142
            }, {
4143
                token: "variable.language",
4144
                regex: "\\.[a-z0-9-_]+"
4145
            }, {
4146
                token: "variable.language",
4147
                regex: ":[a-z_][a-z0-9-_]*"
4148
            }, {
4149
                token: "constant",
4150
                regex: "[a-z0-9-_]+"
4151
            }, {
4152
                token : "keyword.operator",
4153
                regex : "<|>|<=|>=|=|!=|-|%|\\+|\\*"
4154
            }, {
4155
                token : "paren.lparen",
4156
                regex : "[[({]"
4157
            }, {
4158
                token : "paren.rparen",
4159
                regex : "[\\])}]"
4160
            }, {
4161
                token : "text",
4162
                regex : "\\s+"
4163
            }, {
4164
                caseInsensitive: true
4165
            }
4166
        ],
4167
        "comment" : [
4168
            {
4169
                token : "comment", // closing comment
4170
                regex : "\\*\\/",
4171
                next : "start"
4172
            }, {
4173
                defaultToken : "comment"
4174
            }
4175
        ]
4176
    };
4177
    this.normalizeRules();
4178
};
4179

    
4180
oop.inherits(LessHighlightRules, TextHighlightRules);
4181

    
4182
exports.LessHighlightRules = LessHighlightRules;
4183

    
4184
});
4185

    
4186
ace.define("ace/mode/less",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/less_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/css","ace/mode/css_completions","ace/mode/folding/cstyle"], function(require, exports, module) {
4187
"use strict";
4188

    
4189
var oop = require("../lib/oop");
4190
var TextMode = require("./text").Mode;
4191
var LessHighlightRules = require("./less_highlight_rules").LessHighlightRules;
4192
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
4193
var CssBehaviour = require("./behaviour/css").CssBehaviour;
4194
var CssCompletions = require("./css_completions").CssCompletions;
4195

    
4196
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
4197

    
4198
var Mode = function() {
4199
    this.HighlightRules = LessHighlightRules;
4200
    this.$outdent = new MatchingBraceOutdent();
4201
    this.$behaviour = new CssBehaviour();
4202
    this.$completer = new CssCompletions();
4203
    this.foldingRules = new CStyleFoldMode();
4204
};
4205
oop.inherits(Mode, TextMode);
4206

    
4207
(function() {
4208

    
4209
    this.lineCommentStart = "//";
4210
    this.blockComment = {start: "/*", end: "*/"};
4211
    
4212
    this.getNextLineIndent = function(state, line, tab) {
4213
        var indent = this.$getIndent(line);
4214
        var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
4215
        if (tokens.length && tokens[tokens.length-1].type == "comment") {
4216
            return indent;
4217
        }
4218

    
4219
        var match = line.match(/^.*\{\s*$/);
4220
        if (match) {
4221
            indent += tab;
4222
        }
4223

    
4224
        return indent;
4225
    };
4226

    
4227
    this.checkOutdent = function(state, line, input) {
4228
        return this.$outdent.checkOutdent(line, input);
4229
    };
4230

    
4231
    this.autoOutdent = function(state, doc, row) {
4232
        this.$outdent.autoOutdent(doc, row);
4233
    };
4234

    
4235
    this.getCompletions = function(state, session, pos, prefix) {
4236
        return this.$completer.getCompletions("ruleset", session, pos, prefix);
4237
    };
4238

    
4239
    this.$id = "ace/mode/less";
4240
}).call(Mode.prototype);
4241

    
4242
exports.Mode = Mode;
4243

    
4244
});
4245

    
4246
ace.define("ace/mode/ruby_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
4247
"use strict";
4248

    
4249
var oop = require("../lib/oop");
4250
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
4251
var constantOtherSymbol = exports.constantOtherSymbol = {
4252
    token : "constant.other.symbol.ruby", // symbol
4253
    regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"
4254
};
4255

    
4256
var qString = exports.qString = {
4257
    token : "string", // single line
4258
    regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
4259
};
4260

    
4261
var qqString = exports.qqString = {
4262
    token : "string", // single line
4263
    regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
4264
};
4265

    
4266
var tString = exports.tString = {
4267
    token : "string", // backtick string
4268
    regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"
4269
};
4270

    
4271
var constantNumericHex = exports.constantNumericHex = {
4272
    token : "constant.numeric", // hex
4273
    regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b"
4274
};
4275

    
4276
var constantNumericFloat = exports.constantNumericFloat = {
4277
    token : "constant.numeric", // float
4278
    regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b"
4279
};
4280

    
4281
var instanceVariable = exports.instanceVariable = {
4282
    token : "variable.instance", // instance variable
4283
    regex : "@{1,2}[a-zA-Z_\\d]+"
4284
};
4285

    
4286
var RubyHighlightRules = function() {
4287

    
4288
    var builtinFunctions = (
4289
        "abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
4290
        "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
4291
        "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" +
4292
        "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" +
4293
        "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" +
4294
        "assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" +
4295
        "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" +
4296
        "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" +
4297
        "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" +
4298
        "gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" +
4299
        "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" +
4300
        "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" +
4301
        "raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|" +
4302
        "set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" +
4303
        "throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" +
4304
        "render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" +
4305
        "content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" +
4306
        "fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" +
4307
        "time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" +
4308
        "select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" +
4309
        "file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" +
4310
        "protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" +
4311
        "send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" +
4312
        "validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" +
4313
        "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" +
4314
        "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" +
4315
        "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" +
4316
        "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" +
4317
        "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" +
4318
        "has_many|has_one|belongs_to|has_and_belongs_to_many"
4319
    );
4320

    
4321
    var keywords = (
4322
        "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" +
4323
        "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" +
4324
        "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield"
4325
    );
4326

    
4327
    var buildinConstants = (
4328
        "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
4329
        "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING"
4330
    );
4331

    
4332
    var builtinVariables = (
4333
        "$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE|" +
4334
        "$!|root_url|flash|session|cookies|params|request|response|logger|self"
4335
    );
4336

    
4337
    var keywordMapper = this.$keywords = this.createKeywordMapper({
4338
        "keyword": keywords,
4339
        "constant.language": buildinConstants,
4340
        "variable.language": builtinVariables,
4341
        "support.function": builtinFunctions,
4342
        "invalid.deprecated": "debugger" // TODO is this a remnant from js mode?
4343
    }, "identifier");
4344

    
4345
    this.$rules = {
4346
        "start" : [
4347
            {
4348
                token : "comment",
4349
                regex : "#.*$"
4350
            }, {
4351
                token : "comment", // multi line comment
4352
                regex : "^=begin(?:$|\\s.*$)",
4353
                next : "comment"
4354
            }, {
4355
                token : "string.regexp",
4356
                regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
4357
            },
4358

    
4359
            [{
4360
                regex: "[{}]", onMatch: function(val, state, stack) {
4361
                    this.next = val == "{" ? this.nextState : "";
4362
                    if (val == "{" && stack.length) {
4363
                        stack.unshift("start", state);
4364
                        return "paren.lparen";
4365
                    }
4366
                    if (val == "}" && stack.length) {
4367
                        stack.shift();
4368
                        this.next = stack.shift();
4369
                        if (this.next.indexOf("string") != -1)
4370
                            return "paren.end";
4371
                    }
4372
                    return val == "{" ? "paren.lparen" : "paren.rparen";
4373
                },
4374
                nextState: "start"
4375
            }, {
4376
                token : "string.start",
4377
                regex : /"/,
4378
                push  : [{
4379
                    token : "constant.language.escape",
4380
                    regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
4381
                }, {
4382
                    token : "paren.start",
4383
                    regex : /#{/,
4384
                    push  : "start"
4385
                }, {
4386
                    token : "string.end",
4387
                    regex : /"/,
4388
                    next  : "pop"
4389
                }, {
4390
                    defaultToken: "string"
4391
                }]
4392
            }, {
4393
                token : "string.start",
4394
                regex : /`/,
4395
                push  : [{
4396
                    token : "constant.language.escape",
4397
                    regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
4398
                }, {
4399
                    token : "paren.start",
4400
                    regex : /#{/,
4401
                    push  : "start"
4402
                }, {
4403
                    token : "string.end",
4404
                    regex : /`/,
4405
                    next  : "pop"
4406
                }, {
4407
                    defaultToken: "string"
4408
                }]
4409
            }, {
4410
                token : "string.start",
4411
                regex : /'/,
4412
                push  : [{
4413
                    token : "constant.language.escape",
4414
                    regex : /\\['\\]/
4415
                },  {
4416
                    token : "string.end",
4417
                    regex : /'/,
4418
                    next  : "pop"
4419
                }, {
4420
                    defaultToken: "string"
4421
                }]
4422
            }],
4423

    
4424
            {
4425
                token : "text", // namespaces aren't symbols
4426
                regex : "::"
4427
            }, {
4428
                token : "variable.instance", // instance variable
4429
                regex : "@{1,2}[a-zA-Z_\\d]+"
4430
            }, {
4431
                token : "support.class", // class name
4432
                regex : "[A-Z][a-zA-Z_\\d]+"
4433
            },
4434

    
4435
            constantOtherSymbol,
4436
            constantNumericHex,
4437
            constantNumericFloat,
4438

    
4439
            {
4440
                token : "constant.language.boolean",
4441
                regex : "(?:true|false)\\b"
4442
            }, {
4443
                token : keywordMapper,
4444
                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
4445
            }, {
4446
                token : "punctuation.separator.key-value",
4447
                regex : "=>"
4448
            }, {
4449
                stateName: "heredoc",
4450
                onMatch : function(value, currentState, stack) {
4451
                    var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
4452
                    var tokens = value.split(this.splitRegex);
4453
                    stack.push(next, tokens[3]);
4454
                    return [
4455
                        {type:"constant", value: tokens[1]},
4456
                        {type:"string", value: tokens[2]},
4457
                        {type:"support.class", value: tokens[3]},
4458
                        {type:"string", value: tokens[4]}
4459
                    ];
4460
                },
4461
                regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)",
4462
                rules: {
4463
                    heredoc: [{
4464
                        onMatch:  function(value, currentState, stack) {
4465
                            if (value === stack[1]) {
4466
                                stack.shift();
4467
                                stack.shift();
4468
                                this.next = stack[0] || "start";
4469
                                return "support.class";
4470
                            }
4471
                            this.next = "";
4472
                            return "string";
4473
                        },
4474
                        regex: ".*$",
4475
                        next: "start"
4476
                    }],
4477
                    indentedHeredoc: [{
4478
                        token: "string",
4479
                        regex: "^ +"
4480
                    }, {
4481
                        onMatch:  function(value, currentState, stack) {
4482
                            if (value === stack[1]) {
4483
                                stack.shift();
4484
                                stack.shift();
4485
                                this.next = stack[0] || "start";
4486
                                return "support.class";
4487
                            }
4488
                            this.next = "";
4489
                            return "string";
4490
                        },
4491
                        regex: ".*$",
4492
                        next: "start"
4493
                    }]
4494
                }
4495
            }, {
4496
                regex : "$",
4497
                token : "empty",
4498
                next : function(currentState, stack) {
4499
                    if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
4500
                        return stack[0];
4501
                    return currentState;
4502
                }
4503
            }, {
4504
               token : "string.character",
4505
               regex : "\\B\\?."
4506
            }, {
4507
                token : "keyword.operator",
4508
                regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
4509
            }, {
4510
                token : "paren.lparen",
4511
                regex : "[[({]"
4512
            }, {
4513
                token : "paren.rparen",
4514
                regex : "[\\])}]"
4515
            }, {
4516
                token : "text",
4517
                regex : "\\s+"
4518
            }
4519
        ],
4520
        "comment" : [
4521
            {
4522
                token : "comment", // closing comment
4523
                regex : "^=end(?:$|\\s.*$)",
4524
                next : "start"
4525
            }, {
4526
                token : "comment", // comment spanning whole line
4527
                regex : ".+"
4528
            }
4529
        ]
4530
    };
4531

    
4532
    this.normalizeRules();
4533
};
4534

    
4535
oop.inherits(RubyHighlightRules, TextHighlightRules);
4536

    
4537
exports.RubyHighlightRules = RubyHighlightRules;
4538
});
4539

    
4540
ace.define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/coffee"], function(require, exports, module) {
4541
"use strict";
4542

    
4543
var oop = require("../lib/oop");
4544
var TextMode = require("./text").Mode;
4545
var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
4546
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
4547
var Range = require("../range").Range;
4548
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
4549
var FoldMode = require("./folding/coffee").FoldMode;
4550

    
4551
var Mode = function() {
4552
    this.HighlightRules = RubyHighlightRules;
4553
    this.$outdent = new MatchingBraceOutdent();
4554
    this.$behaviour = new CstyleBehaviour();
4555
    this.foldingRules = new FoldMode();
4556
};
4557
oop.inherits(Mode, TextMode);
4558

    
4559
(function() {
4560

    
4561

    
4562
    this.lineCommentStart = "#";
4563

    
4564
    this.getNextLineIndent = function(state, line, tab) {
4565
        var indent = this.$getIndent(line);
4566

    
4567
        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
4568
        var tokens = tokenizedLine.tokens;
4569

    
4570
        if (tokens.length && tokens[tokens.length-1].type == "comment") {
4571
            return indent;
4572
        }
4573

    
4574
        if (state == "start") {
4575
            var match = line.match(/^.*[\{\(\[]\s*$/);
4576
            var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/);
4577
            var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/);
4578
            var startingConditional = line.match(/^\s*(if|else|when)\s*/);
4579
            if (match || startingClassOrMethod || startingDoBlock || startingConditional) {
4580
                indent += tab;
4581
            }
4582
        }
4583

    
4584
        return indent;
4585
    };
4586

    
4587
    this.checkOutdent = function(state, line, input) {
4588
        return /^\s+(end|else)$/.test(line + input) || this.$outdent.checkOutdent(line, input);
4589
    };
4590

    
4591
    this.autoOutdent = function(state, session, row) {
4592
        var line = session.getLine(row);
4593
        if (/}/.test(line))
4594
            return this.$outdent.autoOutdent(session, row);
4595
        var indent = this.$getIndent(line);
4596
        var prevLine = session.getLine(row - 1);
4597
        var prevIndent = this.$getIndent(prevLine);
4598
        var tab = session.getTabString();
4599
        if (prevIndent.length <= indent.length) {
4600
            if (indent.slice(-tab.length) == tab)
4601
                session.remove(new Range(row, indent.length-tab.length, row, indent.length));
4602
        }
4603
    };
4604

    
4605
    this.$id = "ace/mode/ruby";
4606
    this.snippetFileId = "ace/snippets/ruby";
4607
}).call(Mode.prototype);
4608

    
4609
exports.Mode = Mode;
4610
});
4611

    
4612
ace.define("ace/mode/slim",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/slim_highlight_rules","ace/mode/javascript","ace/mode/markdown","ace/mode/coffee","ace/mode/scss","ace/mode/sass","ace/mode/less","ace/mode/ruby","ace/mode/css"], function(require, exports, module) {
4613
"use strict";
4614

    
4615
var oop = require("../lib/oop");
4616
var TextMode = require("./text").Mode;
4617
var SlimHighlightRules = require("./slim_highlight_rules").SlimHighlightRules;
4618

    
4619
var Mode = function() {
4620
    TextMode.call(this);
4621
    this.HighlightRules = SlimHighlightRules;
4622
    this.createModeDelegates({
4623
        javascript: require("./javascript").Mode,
4624
        markdown: require("./markdown").Mode,
4625
        coffee: require("./coffee").Mode,
4626
        scss: require("./scss").Mode,
4627
        sass: require("./sass").Mode,
4628
        less: require("./less").Mode,
4629
        ruby: require("./ruby").Mode,
4630
        css: require("./css").Mode
4631
    });
4632
};
4633

    
4634
oop.inherits(Mode, TextMode);
4635

    
4636
(function() {
4637

    
4638
    this.$id = "ace/mode/slim";
4639
}).call(Mode.prototype);
4640

    
4641
exports.Mode = Mode;
4642
});                (function() {
4643
                    ace.require(["ace/mode/slim"], function(m) {
4644
                        if (typeof module == "object" && typeof exports == "object" && module) {
4645
                            module.exports = m;
4646
                        }
4647
                    });
4648
                })();
4649
            
(166-166/244)