Projekt

Obecné

Profil

Stáhnout (119 KB) Statistiky
| Větev: | Tag: | Revize:
1
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) {
2
"use strict";
3

    
4
var oop = require("../lib/oop");
5
var lang = require("../lib/lang");
6
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
7
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";
8
var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
9
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";
10
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";
11
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";
12

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

    
17
var CssHighlightRules = function() {
18

    
19
    var keywordMapper = this.createKeywordMapper({
20
        "support.function": supportFunction,
21
        "support.constant": supportConstant,
22
        "support.type": supportType,
23
        "support.constant.color": supportConstantColor,
24
        "support.constant.fonts": supportConstantFonts
25
    }, "text", true);
26

    
27
    this.$rules = {
28
        "start" : [{
29
            include : ["strings", "url", "comments"]
30
        }, {
31
            token: "paren.lparen",
32
            regex: "\\{",
33
            next:  "ruleset"
34
        }, {
35
            token: "paren.rparen",
36
            regex: "\\}"
37
        }, {
38
            token: "string",
39
            regex: "@(?!viewport)",
40
            next:  "media"
41
        }, {
42
            token: "keyword",
43
            regex: "#[a-z0-9-_]+"
44
        }, {
45
            token: "keyword",
46
            regex: "%"
47
        }, {
48
            token: "variable",
49
            regex: "\\.[a-z0-9-_]+"
50
        }, {
51
            token: "string",
52
            regex: ":[a-z0-9-_]+"
53
        }, {
54
            token : "constant.numeric",
55
            regex : numRe
56
        }, {
57
            token: "constant",
58
            regex: "[a-z0-9-_]+"
59
        }, {
60
            caseInsensitive: true
61
        }],
62

    
63
        "media": [{
64
            include : ["strings", "url", "comments"]
65
        }, {
66
            token: "paren.lparen",
67
            regex: "\\{",
68
            next:  "start"
69
        }, {
70
            token: "paren.rparen",
71
            regex: "\\}",
72
            next:  "start"
73
        }, {
74
            token: "string",
75
            regex: ";",
76
            next:  "start"
77
        }, {
78
            token: "keyword",
79
            regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
80
                + "|page|font|keyframes|viewport|counter-style|font-feature-values"
81
                + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
82
        }],
83

    
84
        "comments" : [{
85
            token: "comment", // multi line comment
86
            regex: "\\/\\*",
87
            push: [{
88
                token : "comment",
89
                regex : "\\*\\/",
90
                next : "pop"
91
            }, {
92
                defaultToken : "comment"
93
            }]
94
        }],
95

    
96
        "ruleset" : [{
97
            regex : "-(webkit|ms|moz|o)-",
98
            token : "text"
99
        }, {
100
            token : "punctuation.operator",
101
            regex : "[:;]"
102
        }, {
103
            token : "paren.rparen",
104
            regex : "\\}",
105
            next : "start"
106
        }, {
107
            include : ["strings", "url", "comments"]
108
        }, {
109
            token : ["constant.numeric", "keyword"],
110
            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|%)"
111
        }, {
112
            token : "constant.numeric",
113
            regex : numRe
114
        }, {
115
            token : "constant.numeric",  // hex6 color
116
            regex : "#[a-f0-9]{6}"
117
        }, {
118
            token : "constant.numeric", // hex3 color
119
            regex : "#[a-f0-9]{3}"
120
        }, {
121
            token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
122
            regex : pseudoElements
123
        }, {
124
            token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
125
            regex : pseudoClasses
126
        }, {
127
            include: "url"
128
        }, {
129
            token : keywordMapper,
130
            regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
131
        }, {
132
            caseInsensitive: true
133
        }],
134

    
135
        url: [{
136
            token : "support.function",
137
            regex : "(?:url(:?-prefix)?|domain|regexp)\\(",
138
            push: [{
139
                token : "support.function",
140
                regex : "\\)",
141
                next : "pop"
142
            }, {
143
                defaultToken: "string"
144
            }]
145
        }],
146

    
147
        strings: [{
148
            token : "string.start",
149
            regex : "'",
150
            push : [{
151
                token : "string.end",
152
                regex : "'|$",
153
                next: "pop"
154
            }, {
155
                include : "escapes"
156
            }, {
157
                token : "constant.language.escape",
158
                regex : /\\$/,
159
                consumeLineEnd: true
160
            }, {
161
                defaultToken: "string"
162
            }]
163
        }, {
164
            token : "string.start",
165
            regex : '"',
166
            push : [{
167
                token : "string.end",
168
                regex : '"|$',
169
                next: "pop"
170
            }, {
171
                include : "escapes"
172
            }, {
173
                token : "constant.language.escape",
174
                regex : /\\$/,
175
                consumeLineEnd: true
176
            }, {
177
                defaultToken: "string"
178
            }]
179
        }],
180
        escapes: [{
181
            token : "constant.language.escape",
182
            regex : /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
183
        }]
184

    
185
    };
186

    
187
    this.normalizeRules();
188
};
189

    
190
oop.inherits(CssHighlightRules, TextHighlightRules);
191

    
192
exports.CssHighlightRules = CssHighlightRules;
193

    
194
});
195

    
196
ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
197
"use strict";
198

    
199
var oop = require("../lib/oop");
200
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
201

    
202
var DocCommentHighlightRules = function() {
203
    this.$rules = {
204
        "start" : [ {
205
            token : "comment.doc.tag",
206
            regex : "@[\\w\\d_]+" // TODO: fix email addresses
207
        }, 
208
        DocCommentHighlightRules.getTagRule(),
209
        {
210
            defaultToken : "comment.doc",
211
            caseInsensitive: true
212
        }]
213
    };
214
};
215

    
216
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
217

    
218
DocCommentHighlightRules.getTagRule = function(start) {
219
    return {
220
        token : "comment.doc.tag.storage.type",
221
        regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
222
    };
223
};
224

    
225
DocCommentHighlightRules.getStartRule = function(start) {
226
    return {
227
        token : "comment.doc", // doc comment
228
        regex : "\\/\\*(?=\\*)",
229
        next  : start
230
    };
231
};
232

    
233
DocCommentHighlightRules.getEndRule = function (start) {
234
    return {
235
        token : "comment.doc", // closing comment
236
        regex : "\\*\\/",
237
        next  : start
238
    };
239
};
240

    
241

    
242
exports.DocCommentHighlightRules = DocCommentHighlightRules;
243

    
244
});
245

    
246
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) {
247
"use strict";
248

    
249
var oop = require("../lib/oop");
250
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
251
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
252
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
253

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

    
283
    var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
284
        "u[0-9a-fA-F]{4}|" + // unicode
285
        "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
286
        "[0-2][0-7]{0,2}|" + // oct
287
        "3[0-7][0-7]?|" + // oct
288
        "[4-7][0-7]?|" + //oct
289
        ".)";
290

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

    
548

    
549
    if (!options || !options.noES6) {
550
        this.$rules.no_regex.unshift({
551
            regex: "[{}]", onMatch: function(val, state, stack) {
552
                this.next = val == "{" ? this.nextState : "";
553
                if (val == "{" && stack.length) {
554
                    stack.unshift("start", state);
555
                }
556
                else if (val == "}" && stack.length) {
557
                    stack.shift();
558
                    this.next = stack.shift();
559
                    if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
560
                        return "paren.quasi.end";
561
                }
562
                return val == "{" ? "paren.lparen" : "paren.rparen";
563
            },
564
            nextState: "start"
565
        }, {
566
            token : "string.quasi.start",
567
            regex : /`/,
568
            push  : [{
569
                token : "constant.language.escape",
570
                regex : escapedRe
571
            }, {
572
                token : "paren.quasi.start",
573
                regex : /\${/,
574
                push  : "start"
575
            }, {
576
                token : "string.quasi.end",
577
                regex : /`/,
578
                next  : "pop"
579
            }, {
580
                defaultToken: "string.quasi"
581
            }]
582
        });
583

    
584
        if (!options || options.jsx != false)
585
            JSX.call(this);
586
    }
587

    
588
    this.embedRules(DocCommentHighlightRules, "doc-",
589
        [ DocCommentHighlightRules.getEndRule("no_regex") ]);
590

    
591
    this.normalizeRules();
592
};
593

    
594
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
595

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

    
696
function comments(next) {
697
    return [
698
        {
699
            token : "comment", // multi line comment
700
            regex : /\/\*/,
701
            next: [
702
                DocCommentHighlightRules.getTagRule(),
703
                {token : "comment", regex : "\\*\\/", next : next || "pop"},
704
                {defaultToken : "comment", caseInsensitive: true}
705
            ]
706
        }, {
707
            token : "comment",
708
            regex : "\\/\\/",
709
            next: [
710
                DocCommentHighlightRules.getTagRule(),
711
                {token : "comment", regex : "$|^", next : next || "pop"},
712
                {defaultToken : "comment", caseInsensitive: true}
713
            ]
714
        }
715
    ];
716
}
717
exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
718
});
719

    
720
ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
721
"use strict";
722

    
723
var oop = require("../lib/oop");
724
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
725

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

    
729
    this.$rules = {
730
        start : [
731
            {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
732
            {
733
                token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
734
                regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction"
735
            },
736
            {token : "comment.start.xml", regex : "<\\!--", next : "comment"},
737
            {
738
                token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
739
                regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
740
            },
741
            {include : "tag"},
742
            {token : "text.end-tag-open.xml", regex: "</"},
743
            {token : "text.tag-open.xml", regex: "<"},
744
            {include : "reference"},
745
            {defaultToken : "text.xml"}
746
        ],
747

    
748
        processing_instruction : [{
749
            token : "entity.other.attribute-name.decl-attribute-name.xml",
750
            regex : tagRegex
751
        }, {
752
            token : "keyword.operator.decl-attribute-equals.xml",
753
            regex : "="
754
        }, {
755
            include: "whitespace"
756
        }, {
757
            include: "string"
758
        }, {
759
            token : "punctuation.xml-decl.xml",
760
            regex : "\\?>",
761
            next : "start"
762
        }],
763

    
764
        doctype : [
765
            {include : "whitespace"},
766
            {include : "string"},
767
            {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
768
            {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
769
            {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
770
        ],
771

    
772
        int_subset : [{
773
            token : "text.xml",
774
            regex : "\\s+"
775
        }, {
776
            token: "punctuation.int-subset.xml",
777
            regex: "]",
778
            next: "pop"
779
        }, {
780
            token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
781
            regex : "(<\\!)(" + tagRegex + ")",
782
            push : [{
783
                token : "text",
784
                regex : "\\s+"
785
            },
786
            {
787
                token : "punctuation.markup-decl.xml",
788
                regex : ">",
789
                next : "pop"
790
            },
791
            {include : "string"}]
792
        }],
793

    
794
        cdata : [
795
            {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
796
            {token : "text.xml", regex : "\\s+"},
797
            {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
798
        ],
799

    
800
        comment : [
801
            {token : "comment.end.xml", regex : "-->", next : "start"},
802
            {defaultToken : "comment.xml"}
803
        ],
804

    
805
        reference : [{
806
            token : "constant.language.escape.reference.xml",
807
            regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
808
        }],
809

    
810
        attr_reference : [{
811
            token : "constant.language.escape.reference.attribute-value.xml",
812
            regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
813
        }],
814

    
815
        tag : [{
816
            token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
817
            regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
818
            next: [
819
                {include : "attributes"},
820
                {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
821
            ]
822
        }],
823

    
824
        tag_whitespace : [
825
            {token : "text.tag-whitespace.xml", regex : "\\s+"}
826
        ],
827
        whitespace : [
828
            {token : "text.whitespace.xml", regex : "\\s+"}
829
        ],
830
        string: [{
831
            token : "string.xml",
832
            regex : "'",
833
            push : [
834
                {token : "string.xml", regex: "'", next: "pop"},
835
                {defaultToken : "string.xml"}
836
            ]
837
        }, {
838
            token : "string.xml",
839
            regex : '"',
840
            push : [
841
                {token : "string.xml", regex: '"', next: "pop"},
842
                {defaultToken : "string.xml"}
843
            ]
844
        }],
845

    
846
        attributes: [{
847
            token : "entity.other.attribute-name.xml",
848
            regex : tagRegex
849
        }, {
850
            token : "keyword.operator.attribute-equals.xml",
851
            regex : "="
852
        }, {
853
            include: "tag_whitespace"
854
        }, {
855
            include: "attribute_value"
856
        }],
857

    
858
        attribute_value: [{
859
            token : "string.attribute-value.xml",
860
            regex : "'",
861
            push : [
862
                {token : "string.attribute-value.xml", regex: "'", next: "pop"},
863
                {include : "attr_reference"},
864
                {defaultToken : "string.attribute-value.xml"}
865
            ]
866
        }, {
867
            token : "string.attribute-value.xml",
868
            regex : '"',
869
            push : [
870
                {token : "string.attribute-value.xml", regex: '"', next: "pop"},
871
                {include : "attr_reference"},
872
                {defaultToken : "string.attribute-value.xml"}
873
            ]
874
        }]
875
    };
876

    
877
    if (this.constructor === XmlHighlightRules)
878
        this.normalizeRules();
879
};
880

    
881

    
882
(function() {
883

    
884
    this.embedTagRules = function(HighlightRules, prefix, tag){
885
        this.$rules.tag.unshift({
886
            token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
887
            regex : "(<)(" + tag + "(?=\\s|>|$))",
888
            next: [
889
                {include : "attributes"},
890
                {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
891
            ]
892
        });
893

    
894
        this.$rules[tag + "-end"] = [
895
            {include : "attributes"},
896
            {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>",  next: "start",
897
                onMatch : function(value, currentState, stack) {
898
                    stack.splice(0);
899
                    return this.token;
900
            }}
901
        ];
902

    
903
        this.embedRules(HighlightRules, prefix, [{
904
            token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
905
            regex : "(</)(" + tag + "(?=\\s|>|$))",
906
            next: tag + "-end"
907
        }, {
908
            token: "string.cdata.xml",
909
            regex : "<\\!\\[CDATA\\["
910
        }, {
911
            token: "string.cdata.xml",
912
            regex : "\\]\\]>"
913
        }]);
914
    };
915

    
916
}).call(TextHighlightRules.prototype);
917

    
918
oop.inherits(XmlHighlightRules, TextHighlightRules);
919

    
920
exports.XmlHighlightRules = XmlHighlightRules;
921
});
922

    
923
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) {
924
"use strict";
925

    
926
var oop = require("../lib/oop");
927
var lang = require("../lib/lang");
928
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
929
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
930
var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
931

    
932
var tagMap = lang.createMap({
933
    a           : 'anchor',
934
    button 	    : 'form',
935
    form        : 'form',
936
    img         : 'image',
937
    input       : 'form',
938
    label       : 'form',
939
    option      : 'form',
940
    script      : 'script',
941
    select      : 'form',
942
    textarea    : 'form',
943
    style       : 'style',
944
    table       : 'table',
945
    tbody       : 'table',
946
    td          : 'table',
947
    tfoot       : 'table',
948
    th          : 'table',
949
    tr          : 'table'
950
});
951

    
952
var HtmlHighlightRules = function() {
953
    XmlHighlightRules.call(this);
954

    
955
    this.addRules({
956
        attributes: [{
957
            include : "tag_whitespace"
958
        }, {
959
            token : "entity.other.attribute-name.xml",
960
            regex : "[-_a-zA-Z0-9:.]+"
961
        }, {
962
            token : "keyword.operator.attribute-equals.xml",
963
            regex : "=",
964
            push : [{
965
                include: "tag_whitespace"
966
            }, {
967
                token : "string.unquoted.attribute-value.html",
968
                regex : "[^<>='\"`\\s]+",
969
                next : "pop"
970
            }, {
971
                token : "empty",
972
                regex : "",
973
                next : "pop"
974
            }]
975
        }, {
976
            include : "attribute_value"
977
        }],
978
        tag: [{
979
            token : function(start, tag) {
980
                var group = tagMap[tag];
981
                return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
982
                    "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
983
            },
984
            regex : "(</?)([-_a-zA-Z0-9:.]+)",
985
            next: "tag_stuff"
986
        }],
987
        tag_stuff: [
988
            {include : "attributes"},
989
            {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
990
        ]
991
    });
992

    
993
    this.embedTagRules(CssHighlightRules, "css-", "style");
994
    this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "js-", "script");
995

    
996
    if (this.constructor === HtmlHighlightRules)
997
        this.normalizeRules();
998
};
999

    
1000
oop.inherits(HtmlHighlightRules, XmlHighlightRules);
1001

    
1002
exports.HtmlHighlightRules = HtmlHighlightRules;
1003
});
1004

    
1005
ace.define("ace/mode/ruby_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
1006
"use strict";
1007

    
1008
var oop = require("../lib/oop");
1009
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1010
var constantOtherSymbol = exports.constantOtherSymbol = {
1011
    token : "constant.other.symbol.ruby", // symbol
1012
    regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"
1013
};
1014

    
1015
var qString = exports.qString = {
1016
    token : "string", // single line
1017
    regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
1018
};
1019

    
1020
var qqString = exports.qqString = {
1021
    token : "string", // single line
1022
    regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
1023
};
1024

    
1025
var tString = exports.tString = {
1026
    token : "string", // backtick string
1027
    regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"
1028
};
1029

    
1030
var constantNumericHex = exports.constantNumericHex = {
1031
    token : "constant.numeric", // hex
1032
    regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b"
1033
};
1034

    
1035
var constantNumericFloat = exports.constantNumericFloat = {
1036
    token : "constant.numeric", // float
1037
    regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b"
1038
};
1039

    
1040
var instanceVariable = exports.instanceVariable = {
1041
    token : "variable.instance", // instance variable
1042
    regex : "@{1,2}[a-zA-Z_\\d]+"
1043
};
1044

    
1045
var RubyHighlightRules = function() {
1046

    
1047
    var builtinFunctions = (
1048
        "abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
1049
        "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
1050
        "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" +
1051
        "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" +
1052
        "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" +
1053
        "assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" +
1054
        "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" +
1055
        "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" +
1056
        "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" +
1057
        "gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" +
1058
        "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" +
1059
        "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" +
1060
        "raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|" +
1061
        "set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" +
1062
        "throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" +
1063
        "render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" +
1064
        "content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" +
1065
        "fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" +
1066
        "time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" +
1067
        "select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" +
1068
        "file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" +
1069
        "protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" +
1070
        "send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" +
1071
        "validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" +
1072
        "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" +
1073
        "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" +
1074
        "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" +
1075
        "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" +
1076
        "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" +
1077
        "has_many|has_one|belongs_to|has_and_belongs_to_many"
1078
    );
1079

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

    
1086
    var buildinConstants = (
1087
        "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
1088
        "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING"
1089
    );
1090

    
1091
    var builtinVariables = (
1092
        "$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE|" +
1093
        "$!|root_url|flash|session|cookies|params|request|response|logger|self"
1094
    );
1095

    
1096
    var keywordMapper = this.$keywords = this.createKeywordMapper({
1097
        "keyword": keywords,
1098
        "constant.language": buildinConstants,
1099
        "variable.language": builtinVariables,
1100
        "support.function": builtinFunctions,
1101
        "invalid.deprecated": "debugger" // TODO is this a remnant from js mode?
1102
    }, "identifier");
1103

    
1104
    this.$rules = {
1105
        "start" : [
1106
            {
1107
                token : "comment",
1108
                regex : "#.*$"
1109
            }, {
1110
                token : "comment", // multi line comment
1111
                regex : "^=begin(?:$|\\s.*$)",
1112
                next : "comment"
1113
            }, {
1114
                token : "string.regexp",
1115
                regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
1116
            },
1117

    
1118
            [{
1119
                regex: "[{}]", onMatch: function(val, state, stack) {
1120
                    this.next = val == "{" ? this.nextState : "";
1121
                    if (val == "{" && stack.length) {
1122
                        stack.unshift("start", state);
1123
                        return "paren.lparen";
1124
                    }
1125
                    if (val == "}" && stack.length) {
1126
                        stack.shift();
1127
                        this.next = stack.shift();
1128
                        if (this.next.indexOf("string") != -1)
1129
                            return "paren.end";
1130
                    }
1131
                    return val == "{" ? "paren.lparen" : "paren.rparen";
1132
                },
1133
                nextState: "start"
1134
            }, {
1135
                token : "string.start",
1136
                regex : /"/,
1137
                push  : [{
1138
                    token : "constant.language.escape",
1139
                    regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
1140
                }, {
1141
                    token : "paren.start",
1142
                    regex : /#{/,
1143
                    push  : "start"
1144
                }, {
1145
                    token : "string.end",
1146
                    regex : /"/,
1147
                    next  : "pop"
1148
                }, {
1149
                    defaultToken: "string"
1150
                }]
1151
            }, {
1152
                token : "string.start",
1153
                regex : /`/,
1154
                push  : [{
1155
                    token : "constant.language.escape",
1156
                    regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
1157
                }, {
1158
                    token : "paren.start",
1159
                    regex : /#{/,
1160
                    push  : "start"
1161
                }, {
1162
                    token : "string.end",
1163
                    regex : /`/,
1164
                    next  : "pop"
1165
                }, {
1166
                    defaultToken: "string"
1167
                }]
1168
            }, {
1169
                token : "string.start",
1170
                regex : /'/,
1171
                push  : [{
1172
                    token : "constant.language.escape",
1173
                    regex : /\\['\\]/
1174
                },  {
1175
                    token : "string.end",
1176
                    regex : /'/,
1177
                    next  : "pop"
1178
                }, {
1179
                    defaultToken: "string"
1180
                }]
1181
            }],
1182

    
1183
            {
1184
                token : "text", // namespaces aren't symbols
1185
                regex : "::"
1186
            }, {
1187
                token : "variable.instance", // instance variable
1188
                regex : "@{1,2}[a-zA-Z_\\d]+"
1189
            }, {
1190
                token : "support.class", // class name
1191
                regex : "[A-Z][a-zA-Z_\\d]+"
1192
            },
1193

    
1194
            constantOtherSymbol,
1195
            constantNumericHex,
1196
            constantNumericFloat,
1197

    
1198
            {
1199
                token : "constant.language.boolean",
1200
                regex : "(?:true|false)\\b"
1201
            }, {
1202
                token : keywordMapper,
1203
                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
1204
            }, {
1205
                token : "punctuation.separator.key-value",
1206
                regex : "=>"
1207
            }, {
1208
                stateName: "heredoc",
1209
                onMatch : function(value, currentState, stack) {
1210
                    var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
1211
                    var tokens = value.split(this.splitRegex);
1212
                    stack.push(next, tokens[3]);
1213
                    return [
1214
                        {type:"constant", value: tokens[1]},
1215
                        {type:"string", value: tokens[2]},
1216
                        {type:"support.class", value: tokens[3]},
1217
                        {type:"string", value: tokens[4]}
1218
                    ];
1219
                },
1220
                regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)",
1221
                rules: {
1222
                    heredoc: [{
1223
                        onMatch:  function(value, currentState, stack) {
1224
                            if (value === stack[1]) {
1225
                                stack.shift();
1226
                                stack.shift();
1227
                                this.next = stack[0] || "start";
1228
                                return "support.class";
1229
                            }
1230
                            this.next = "";
1231
                            return "string";
1232
                        },
1233
                        regex: ".*$",
1234
                        next: "start"
1235
                    }],
1236
                    indentedHeredoc: [{
1237
                        token: "string",
1238
                        regex: "^ +"
1239
                    }, {
1240
                        onMatch:  function(value, currentState, stack) {
1241
                            if (value === stack[1]) {
1242
                                stack.shift();
1243
                                stack.shift();
1244
                                this.next = stack[0] || "start";
1245
                                return "support.class";
1246
                            }
1247
                            this.next = "";
1248
                            return "string";
1249
                        },
1250
                        regex: ".*$",
1251
                        next: "start"
1252
                    }]
1253
                }
1254
            }, {
1255
                regex : "$",
1256
                token : "empty",
1257
                next : function(currentState, stack) {
1258
                    if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
1259
                        return stack[0];
1260
                    return currentState;
1261
                }
1262
            }, {
1263
               token : "string.character",
1264
               regex : "\\B\\?."
1265
            }, {
1266
                token : "keyword.operator",
1267
                regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
1268
            }, {
1269
                token : "paren.lparen",
1270
                regex : "[[({]"
1271
            }, {
1272
                token : "paren.rparen",
1273
                regex : "[\\])}]"
1274
            }, {
1275
                token : "text",
1276
                regex : "\\s+"
1277
            }
1278
        ],
1279
        "comment" : [
1280
            {
1281
                token : "comment", // closing comment
1282
                regex : "^=end(?:$|\\s.*$)",
1283
                next : "start"
1284
            }, {
1285
                token : "comment", // comment spanning whole line
1286
                regex : ".+"
1287
            }
1288
        ]
1289
    };
1290

    
1291
    this.normalizeRules();
1292
};
1293

    
1294
oop.inherits(RubyHighlightRules, TextHighlightRules);
1295

    
1296
exports.RubyHighlightRules = RubyHighlightRules;
1297
});
1298

    
1299
ace.define("ace/mode/html_ruby_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/html_highlight_rules","ace/mode/ruby_highlight_rules"], function(require, exports, module) {
1300
    "use strict";
1301

    
1302
    var oop = require("../lib/oop");
1303
    var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
1304
    var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
1305

    
1306
    var HtmlRubyHighlightRules = function() {
1307
        HtmlHighlightRules.call(this);
1308

    
1309
        var startRules = [
1310
            {
1311
                regex: "<%%|%%>",
1312
                token: "constant.language.escape"
1313
            }, {
1314
                token : "comment.start.erb",
1315
                regex : "<%#",
1316
                push  : [{
1317
                    token : "comment.end.erb",
1318
                    regex: "%>",
1319
                    next: "pop",
1320
                    defaultToken:"comment"
1321
                }]
1322
            }, {
1323
                token : "support.ruby_tag",
1324
                regex : "<%+(?!>)[-=]?",
1325
                push  : "ruby-start"
1326
            }
1327
        ];
1328

    
1329
        var endRules = [
1330
            {
1331
                token : "support.ruby_tag",
1332
                regex : "%>",
1333
                next  : "pop"
1334
            }, {
1335
                token: "comment",
1336
                regex: "#(?:[^%]|%[^>])*"
1337
            }
1338
        ];
1339

    
1340
        for (var key in this.$rules)
1341
            this.$rules[key].unshift.apply(this.$rules[key], startRules);
1342

    
1343
        this.embedRules(RubyHighlightRules, "ruby-", endRules, ["start"]);
1344

    
1345
        this.normalizeRules();
1346
    };
1347

    
1348

    
1349
    oop.inherits(HtmlRubyHighlightRules, HtmlHighlightRules);
1350

    
1351
    exports.HtmlRubyHighlightRules = HtmlRubyHighlightRules;
1352
});
1353

    
1354
ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
1355
"use strict";
1356

    
1357
var Range = require("../range").Range;
1358

    
1359
var MatchingBraceOutdent = function() {};
1360

    
1361
(function() {
1362

    
1363
    this.checkOutdent = function(line, input) {
1364
        if (! /^\s+$/.test(line))
1365
            return false;
1366

    
1367
        return /^\s*\}/.test(input);
1368
    };
1369

    
1370
    this.autoOutdent = function(doc, row) {
1371
        var line = doc.getLine(row);
1372
        var match = line.match(/^(\s*\})/);
1373

    
1374
        if (!match) return 0;
1375

    
1376
        var column = match[1].length;
1377
        var openBracePos = doc.findMatchingBracket({row: row, column: column});
1378

    
1379
        if (!openBracePos || openBracePos.row == row) return 0;
1380

    
1381
        var indent = this.$getIndent(doc.getLine(openBracePos.row));
1382
        doc.replace(new Range(row, 0, row, column-1), indent);
1383
    };
1384

    
1385
    this.$getIndent = function(line) {
1386
        return line.match(/^\s*/)[0];
1387
    };
1388

    
1389
}).call(MatchingBraceOutdent.prototype);
1390

    
1391
exports.MatchingBraceOutdent = MatchingBraceOutdent;
1392
});
1393

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

    
1397
var oop = require("../../lib/oop");
1398
var Range = require("../../range").Range;
1399
var BaseFoldMode = require("./fold_mode").FoldMode;
1400

    
1401
var FoldMode = exports.FoldMode = function(commentRegex) {
1402
    if (commentRegex) {
1403
        this.foldingStartMarker = new RegExp(
1404
            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
1405
        );
1406
        this.foldingStopMarker = new RegExp(
1407
            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
1408
        );
1409
    }
1410
};
1411
oop.inherits(FoldMode, BaseFoldMode);
1412

    
1413
(function() {
1414
    
1415
    this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
1416
    this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
1417
    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
1418
    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
1419
    this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
1420
    this._getFoldWidgetBase = this.getFoldWidget;
1421
    this.getFoldWidget = function(session, foldStyle, row) {
1422
        var line = session.getLine(row);
1423
    
1424
        if (this.singleLineBlockCommentRe.test(line)) {
1425
            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
1426
                return "";
1427
        }
1428
    
1429
        var fw = this._getFoldWidgetBase(session, foldStyle, row);
1430
    
1431
        if (!fw && this.startRegionRe.test(line))
1432
            return "start"; // lineCommentRegionStart
1433
    
1434
        return fw;
1435
    };
1436

    
1437
    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
1438
        var line = session.getLine(row);
1439
        
1440
        if (this.startRegionRe.test(line))
1441
            return this.getCommentRegionBlock(session, line, row);
1442
        
1443
        var match = line.match(this.foldingStartMarker);
1444
        if (match) {
1445
            var i = match.index;
1446

    
1447
            if (match[1])
1448
                return this.openingBracketBlock(session, match[1], row, i);
1449
                
1450
            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
1451
            
1452
            if (range && !range.isMultiLine()) {
1453
                if (forceMultiline) {
1454
                    range = this.getSectionRange(session, row);
1455
                } else if (foldStyle != "all")
1456
                    range = null;
1457
            }
1458
            
1459
            return range;
1460
        }
1461

    
1462
        if (foldStyle === "markbegin")
1463
            return;
1464

    
1465
        var match = line.match(this.foldingStopMarker);
1466
        if (match) {
1467
            var i = match.index + match[0].length;
1468

    
1469
            if (match[1])
1470
                return this.closingBracketBlock(session, match[1], row, i);
1471

    
1472
            return session.getCommentFoldRange(row, i, -1);
1473
        }
1474
    };
1475
    
1476
    this.getSectionRange = function(session, row) {
1477
        var line = session.getLine(row);
1478
        var startIndent = line.search(/\S/);
1479
        var startRow = row;
1480
        var startColumn = line.length;
1481
        row = row + 1;
1482
        var endRow = row;
1483
        var maxRow = session.getLength();
1484
        while (++row < maxRow) {
1485
            line = session.getLine(row);
1486
            var indent = line.search(/\S/);
1487
            if (indent === -1)
1488
                continue;
1489
            if  (startIndent > indent)
1490
                break;
1491
            var subRange = this.getFoldWidgetRange(session, "all", row);
1492
            
1493
            if (subRange) {
1494
                if (subRange.start.row <= startRow) {
1495
                    break;
1496
                } else if (subRange.isMultiLine()) {
1497
                    row = subRange.end.row;
1498
                } else if (startIndent == indent) {
1499
                    break;
1500
                }
1501
            }
1502
            endRow = row;
1503
        }
1504
        
1505
        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
1506
    };
1507
    this.getCommentRegionBlock = function(session, line, row) {
1508
        var startColumn = line.search(/\s*$/);
1509
        var maxRow = session.getLength();
1510
        var startRow = row;
1511
        
1512
        var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
1513
        var depth = 1;
1514
        while (++row < maxRow) {
1515
            line = session.getLine(row);
1516
            var m = re.exec(line);
1517
            if (!m) continue;
1518
            if (m[1]) depth--;
1519
            else depth++;
1520

    
1521
            if (!depth) break;
1522
        }
1523

    
1524
        var endRow = row;
1525
        if (endRow > startRow) {
1526
            return new Range(startRow, startColumn, endRow, line.length);
1527
        }
1528
    };
1529

    
1530
}).call(FoldMode.prototype);
1531

    
1532
});
1533

    
1534
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) {
1535
"use strict";
1536

    
1537
var oop = require("../lib/oop");
1538
var TextMode = require("./text").Mode;
1539
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1540
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1541
var WorkerClient = require("../worker/worker_client").WorkerClient;
1542
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
1543
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1544

    
1545
var Mode = function() {
1546
    this.HighlightRules = JavaScriptHighlightRules;
1547
    
1548
    this.$outdent = new MatchingBraceOutdent();
1549
    this.$behaviour = new CstyleBehaviour();
1550
    this.foldingRules = new CStyleFoldMode();
1551
};
1552
oop.inherits(Mode, TextMode);
1553

    
1554
(function() {
1555

    
1556
    this.lineCommentStart = "//";
1557
    this.blockComment = {start: "/*", end: "*/"};
1558
    this.$quotes = {'"': '"', "'": "'", "`": "`"};
1559

    
1560
    this.getNextLineIndent = function(state, line, tab) {
1561
        var indent = this.$getIndent(line);
1562

    
1563
        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
1564
        var tokens = tokenizedLine.tokens;
1565
        var endState = tokenizedLine.state;
1566

    
1567
        if (tokens.length && tokens[tokens.length-1].type == "comment") {
1568
            return indent;
1569
        }
1570

    
1571
        if (state == "start" || state == "no_regex") {
1572
            var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
1573
            if (match) {
1574
                indent += tab;
1575
            }
1576
        } else if (state == "doc-start") {
1577
            if (endState == "start" || endState == "no_regex") {
1578
                return "";
1579
            }
1580
            var match = line.match(/^\s*(\/?)\*/);
1581
            if (match) {
1582
                if (match[1]) {
1583
                    indent += " ";
1584
                }
1585
                indent += "* ";
1586
            }
1587
        }
1588

    
1589
        return indent;
1590
    };
1591

    
1592
    this.checkOutdent = function(state, line, input) {
1593
        return this.$outdent.checkOutdent(line, input);
1594
    };
1595

    
1596
    this.autoOutdent = function(state, doc, row) {
1597
        this.$outdent.autoOutdent(doc, row);
1598
    };
1599

    
1600
    this.createWorker = function(session) {
1601
        var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
1602
        worker.attachToDocument(session.getDocument());
1603

    
1604
        worker.on("annotate", function(results) {
1605
            session.setAnnotations(results.data);
1606
        });
1607

    
1608
        worker.on("terminate", function() {
1609
            session.clearAnnotations();
1610
        });
1611

    
1612
        return worker;
1613
    };
1614

    
1615
    this.$id = "ace/mode/javascript";
1616
    this.snippetFileId = "ace/snippets/javascript";
1617
}).call(Mode.prototype);
1618

    
1619
exports.Mode = Mode;
1620
});
1621

    
1622
ace.define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module) {
1623
"use strict";
1624

    
1625
var propertyMap = {
1626
    "background": {"#$0": 1},
1627
    "background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
1628
    "background-image": {"url('/$0')": 1},
1629
    "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
1630
    "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2},
1631
    "background-attachment": {"scroll": 1, "fixed": 1},
1632
    "background-size": {"cover": 1, "contain": 1},
1633
    "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
1634
    "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
1635
    "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
1636
    "border-color": {"#$0": 1},
1637
    "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2},
1638
    "border-collapse": {"collapse": 1, "separate": 1},
1639
    "bottom": {"px": 1, "em": 1, "%": 1},
1640
    "clear": {"left": 1, "right": 1, "both": 1, "none": 1},
1641
    "color": {"#$0": 1, "rgb(#$00,0,0)": 1},
1642
    "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},
1643
    "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
1644
    "empty-cells": {"show": 1, "hide": 1},
1645
    "float": {"left": 1, "right": 1, "none": 1},
1646
    "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},
1647
    "font-size": {"px": 1, "em": 1, "%": 1},
1648
    "font-weight": {"bold": 1, "normal": 1},
1649
    "font-style": {"italic": 1, "normal": 1},
1650
    "font-variant": {"normal": 1, "small-caps": 1},
1651
    "height": {"px": 1, "em": 1, "%": 1},
1652
    "left": {"px": 1, "em": 1, "%": 1},
1653
    "letter-spacing": {"normal": 1},
1654
    "line-height": {"normal": 1},
1655
    "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},
1656
    "margin": {"px": 1, "em": 1, "%": 1},
1657
    "margin-right": {"px": 1, "em": 1, "%": 1},
1658
    "margin-left": {"px": 1, "em": 1, "%": 1},
1659
    "margin-top": {"px": 1, "em": 1, "%": 1},
1660
    "margin-bottom": {"px": 1, "em": 1, "%": 1},
1661
    "max-height": {"px": 1, "em": 1, "%": 1},
1662
    "max-width": {"px": 1, "em": 1, "%": 1},
1663
    "min-height": {"px": 1, "em": 1, "%": 1},
1664
    "min-width": {"px": 1, "em": 1, "%": 1},
1665
    "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
1666
    "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
1667
    "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
1668
    "padding": {"px": 1, "em": 1, "%": 1},
1669
    "padding-top": {"px": 1, "em": 1, "%": 1},
1670
    "padding-right": {"px": 1, "em": 1, "%": 1},
1671
    "padding-bottom": {"px": 1, "em": 1, "%": 1},
1672
    "padding-left": {"px": 1, "em": 1, "%": 1},
1673
    "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
1674
    "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
1675
    "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
1676
    "right": {"px": 1, "em": 1, "%": 1},
1677
    "table-layout": {"fixed": 1, "auto": 1},
1678
    "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
1679
    "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
1680
    "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
1681
    "top": {"px": 1, "em": 1, "%": 1},
1682
    "vertical-align": {"top": 1, "bottom": 1},
1683
    "visibility": {"hidden": 1, "visible": 1},
1684
    "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
1685
    "width": {"px": 1, "em": 1, "%": 1},
1686
    "word-spacing": {"normal": 1},
1687
    "filter": {"alpha(opacity=$0100)": 1},
1688

    
1689
    "text-shadow": {"$02px 2px 2px #777": 1},
1690
    "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
1691
    "-moz-border-radius": 1,
1692
    "-moz-border-radius-topright": 1,
1693
    "-moz-border-radius-bottomright": 1,
1694
    "-moz-border-radius-topleft": 1,
1695
    "-moz-border-radius-bottomleft": 1,
1696
    "-webkit-border-radius": 1,
1697
    "-webkit-border-top-right-radius": 1,
1698
    "-webkit-border-top-left-radius": 1,
1699
    "-webkit-border-bottom-right-radius": 1,
1700
    "-webkit-border-bottom-left-radius": 1,
1701
    "-moz-box-shadow": 1,
1702
    "-webkit-box-shadow": 1,
1703
    "transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
1704
    "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
1705
    "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
1706
};
1707

    
1708
var CssCompletions = function() {
1709

    
1710
};
1711

    
1712
(function() {
1713

    
1714
    this.completionsDefined = false;
1715

    
1716
    this.defineCompletions = function() {
1717
        if (document) {
1718
            var style = document.createElement('c').style;
1719

    
1720
            for (var i in style) {
1721
                if (typeof style[i] !== 'string')
1722
                    continue;
1723

    
1724
                var name = i.replace(/[A-Z]/g, function(x) {
1725
                    return '-' + x.toLowerCase();
1726
                });
1727

    
1728
                if (!propertyMap.hasOwnProperty(name))
1729
                    propertyMap[name] = 1;
1730
            }
1731
        }
1732

    
1733
        this.completionsDefined = true;
1734
    };
1735

    
1736
    this.getCompletions = function(state, session, pos, prefix) {
1737
        if (!this.completionsDefined) {
1738
            this.defineCompletions();
1739
        }
1740

    
1741
        if (state==='ruleset' || session.$mode.$id == "ace/mode/scss") {
1742
            var line = session.getLine(pos.row).substr(0, pos.column);
1743
            if (/:[^;]+$/.test(line)) {
1744
                /([\w\-]+):[^:]*$/.test(line);
1745

    
1746
                return this.getPropertyValueCompletions(state, session, pos, prefix);
1747
            } else {
1748
                return this.getPropertyCompletions(state, session, pos, prefix);
1749
            }
1750
        }
1751

    
1752
        return [];
1753
    };
1754

    
1755
    this.getPropertyCompletions = function(state, session, pos, prefix) {
1756
        var properties = Object.keys(propertyMap);
1757
        return properties.map(function(property){
1758
            return {
1759
                caption: property,
1760
                snippet: property + ': $0;',
1761
                meta: "property",
1762
                score: 1000000
1763
            };
1764
        });
1765
    };
1766

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

    
1771
        if (!property)
1772
            return [];
1773
        var values = [];
1774
        if (property in propertyMap && typeof propertyMap[property] === "object") {
1775
            values = Object.keys(propertyMap[property]);
1776
        }
1777
        return values.map(function(value){
1778
            return {
1779
                caption: value,
1780
                snippet: value,
1781
                meta: "property value",
1782
                score: 1000000
1783
            };
1784
        });
1785
    };
1786

    
1787
}).call(CssCompletions.prototype);
1788

    
1789
exports.CssCompletions = CssCompletions;
1790
});
1791

    
1792
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) {
1793
"use strict";
1794

    
1795
var oop = require("../../lib/oop");
1796
var Behaviour = require("../behaviour").Behaviour;
1797
var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1798
var TokenIterator = require("../../token_iterator").TokenIterator;
1799

    
1800
var CssBehaviour = function () {
1801

    
1802
    this.inherit(CstyleBehaviour);
1803

    
1804
    this.add("colon", "insertion", function (state, action, editor, session, text) {
1805
        if (text === ':' && editor.selection.isEmpty()) {
1806
            var cursor = editor.getCursorPosition();
1807
            var iterator = new TokenIterator(session, cursor.row, cursor.column);
1808
            var token = iterator.getCurrentToken();
1809
            if (token && token.value.match(/\s+/)) {
1810
                token = iterator.stepBackward();
1811
            }
1812
            if (token && token.type === 'support.type') {
1813
                var line = session.doc.getLine(cursor.row);
1814
                var rightChar = line.substring(cursor.column, cursor.column + 1);
1815
                if (rightChar === ':') {
1816
                    return {
1817
                       text: '',
1818
                       selection: [1, 1]
1819
                    };
1820
                }
1821
                if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
1822
                    return {
1823
                       text: ':;',
1824
                       selection: [1, 1]
1825
                    };
1826
                }
1827
            }
1828
        }
1829
    });
1830

    
1831
    this.add("colon", "deletion", function (state, action, editor, session, range) {
1832
        var selected = session.doc.getTextRange(range);
1833
        if (!range.isMultiLine() && selected === ':') {
1834
            var cursor = editor.getCursorPosition();
1835
            var iterator = new TokenIterator(session, cursor.row, cursor.column);
1836
            var token = iterator.getCurrentToken();
1837
            if (token && token.value.match(/\s+/)) {
1838
                token = iterator.stepBackward();
1839
            }
1840
            if (token && token.type === 'support.type') {
1841
                var line = session.doc.getLine(range.start.row);
1842
                var rightChar = line.substring(range.end.column, range.end.column + 1);
1843
                if (rightChar === ';') {
1844
                    range.end.column ++;
1845
                    return range;
1846
                }
1847
            }
1848
        }
1849
    });
1850

    
1851
    this.add("semicolon", "insertion", function (state, action, editor, session, text) {
1852
        if (text === ';' && editor.selection.isEmpty()) {
1853
            var cursor = editor.getCursorPosition();
1854
            var line = session.doc.getLine(cursor.row);
1855
            var rightChar = line.substring(cursor.column, cursor.column + 1);
1856
            if (rightChar === ';') {
1857
                return {
1858
                   text: '',
1859
                   selection: [1, 1]
1860
                };
1861
            }
1862
        }
1863
    });
1864

    
1865
    this.add("!important", "insertion", function (state, action, editor, session, text) {
1866
        if (text === '!' && editor.selection.isEmpty()) {
1867
            var cursor = editor.getCursorPosition();
1868
            var line = session.doc.getLine(cursor.row);
1869

    
1870
            if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
1871
                return {
1872
                    text: '!important',
1873
                    selection: [10, 10]
1874
                };
1875
            }
1876
        }
1877
    });
1878

    
1879
};
1880
oop.inherits(CssBehaviour, CstyleBehaviour);
1881

    
1882
exports.CssBehaviour = CssBehaviour;
1883
});
1884

    
1885
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) {
1886
"use strict";
1887

    
1888
var oop = require("../lib/oop");
1889
var TextMode = require("./text").Mode;
1890
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1891
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1892
var WorkerClient = require("../worker/worker_client").WorkerClient;
1893
var CssCompletions = require("./css_completions").CssCompletions;
1894
var CssBehaviour = require("./behaviour/css").CssBehaviour;
1895
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1896

    
1897
var Mode = function() {
1898
    this.HighlightRules = CssHighlightRules;
1899
    this.$outdent = new MatchingBraceOutdent();
1900
    this.$behaviour = new CssBehaviour();
1901
    this.$completer = new CssCompletions();
1902
    this.foldingRules = new CStyleFoldMode();
1903
};
1904
oop.inherits(Mode, TextMode);
1905

    
1906
(function() {
1907

    
1908
    this.foldingRules = "cStyle";
1909
    this.blockComment = {start: "/*", end: "*/"};
1910

    
1911
    this.getNextLineIndent = function(state, line, tab) {
1912
        var indent = this.$getIndent(line);
1913
        var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
1914
        if (tokens.length && tokens[tokens.length-1].type == "comment") {
1915
            return indent;
1916
        }
1917

    
1918
        var match = line.match(/^.*\{\s*$/);
1919
        if (match) {
1920
            indent += tab;
1921
        }
1922

    
1923
        return indent;
1924
    };
1925

    
1926
    this.checkOutdent = function(state, line, input) {
1927
        return this.$outdent.checkOutdent(line, input);
1928
    };
1929

    
1930
    this.autoOutdent = function(state, doc, row) {
1931
        this.$outdent.autoOutdent(doc, row);
1932
    };
1933

    
1934
    this.getCompletions = function(state, session, pos, prefix) {
1935
        return this.$completer.getCompletions(state, session, pos, prefix);
1936
    };
1937

    
1938
    this.createWorker = function(session) {
1939
        var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
1940
        worker.attachToDocument(session.getDocument());
1941

    
1942
        worker.on("annotate", function(e) {
1943
            session.setAnnotations(e.data);
1944
        });
1945

    
1946
        worker.on("terminate", function() {
1947
            session.clearAnnotations();
1948
        });
1949

    
1950
        return worker;
1951
    };
1952

    
1953
    this.$id = "ace/mode/css";
1954
    this.snippetFileId = "ace/snippets/css";
1955
}).call(Mode.prototype);
1956

    
1957
exports.Mode = Mode;
1958

    
1959
});
1960

    
1961
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) {
1962
"use strict";
1963

    
1964
var oop = require("../../lib/oop");
1965
var Behaviour = require("../behaviour").Behaviour;
1966
var TokenIterator = require("../../token_iterator").TokenIterator;
1967
var lang = require("../../lib/lang");
1968

    
1969
function is(token, type) {
1970
    return token && token.type.lastIndexOf(type + ".xml") > -1;
1971
}
1972

    
1973
var XmlBehaviour = function () {
1974

    
1975
    this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
1976
        if (text == '"' || text == "'") {
1977
            var quote = text;
1978
            var selected = session.doc.getTextRange(editor.getSelectionRange());
1979
            if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
1980
                return {
1981
                    text: quote + selected + quote,
1982
                    selection: false
1983
                };
1984
            }
1985

    
1986
            var cursor = editor.getCursorPosition();
1987
            var line = session.doc.getLine(cursor.row);
1988
            var rightChar = line.substring(cursor.column, cursor.column + 1);
1989
            var iterator = new TokenIterator(session, cursor.row, cursor.column);
1990
            var token = iterator.getCurrentToken();
1991

    
1992
            if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
1993
                return {
1994
                    text: "",
1995
                    selection: [1, 1]
1996
                };
1997
            }
1998

    
1999
            if (!token)
2000
                token = iterator.stepBackward();
2001

    
2002
            if (!token)
2003
                return;
2004

    
2005
            while (is(token, "tag-whitespace") || is(token, "whitespace")) {
2006
                token = iterator.stepBackward();
2007
            }
2008
            var rightSpace = !rightChar || rightChar.match(/\s/);
2009
            if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
2010
                return {
2011
                    text: quote + quote,
2012
                    selection: [1, 1]
2013
                };
2014
            }
2015
        }
2016
    });
2017

    
2018
    this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
2019
        var selected = session.doc.getTextRange(range);
2020
        if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
2021
            var line = session.doc.getLine(range.start.row);
2022
            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
2023
            if (rightChar == selected) {
2024
                range.end.column++;
2025
                return range;
2026
            }
2027
        }
2028
    });
2029

    
2030
    this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
2031
        if (text == '>') {
2032
            var position = editor.getSelectionRange().start;
2033
            var iterator = new TokenIterator(session, position.row, position.column);
2034
            var token = iterator.getCurrentToken() || iterator.stepBackward();
2035
            if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
2036
                return;
2037
            if (is(token, "reference.attribute-value"))
2038
                return;
2039
            if (is(token, "attribute-value")) {
2040
                var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length;
2041
                if (position.column < tokenEndColumn)
2042
                    return;
2043
                if (position.column == tokenEndColumn) {
2044
                    var nextToken = iterator.stepForward();
2045
                    if (nextToken && is(nextToken, "attribute-value"))
2046
                        return;
2047
                    iterator.stepBackward();
2048
                }
2049
            }
2050
            
2051
            if (/^\s*>/.test(session.getLine(position.row).slice(position.column)))
2052
                return;
2053
            while (!is(token, "tag-name")) {
2054
                token = iterator.stepBackward();
2055
                if (token.value == "<") {
2056
                    token = iterator.stepForward();
2057
                    break;
2058
                }
2059
            }
2060

    
2061
            var tokenRow = iterator.getCurrentTokenRow();
2062
            var tokenColumn = iterator.getCurrentTokenColumn();
2063
            if (is(iterator.stepBackward(), "end-tag-open"))
2064
                return;
2065

    
2066
            var element = token.value;
2067
            if (tokenRow == position.row)
2068
                element = element.substring(0, position.column - tokenColumn);
2069

    
2070
            if (this.voidElements.hasOwnProperty(element.toLowerCase()))
2071
                 return;
2072

    
2073
            return {
2074
               text: ">" + "</" + element + ">",
2075
               selection: [1, 1]
2076
            };
2077
        }
2078
    });
2079

    
2080
    this.add("autoindent", "insertion", function (state, action, editor, session, text) {
2081
        if (text == "\n") {
2082
            var cursor = editor.getCursorPosition();
2083
            var line = session.getLine(cursor.row);
2084
            var iterator = new TokenIterator(session, cursor.row, cursor.column);
2085
            var token = iterator.getCurrentToken();
2086

    
2087
            if (token && token.type.indexOf("tag-close") !== -1) {
2088
                if (token.value == "/>")
2089
                    return;
2090
                while (token && token.type.indexOf("tag-name") === -1) {
2091
                    token = iterator.stepBackward();
2092
                }
2093

    
2094
                if (!token) {
2095
                    return;
2096
                }
2097

    
2098
                var tag = token.value;
2099
                var row = iterator.getCurrentTokenRow();
2100
                token = iterator.stepBackward();
2101
                if (!token || token.type.indexOf("end-tag") !== -1) {
2102
                    return;
2103
                }
2104

    
2105
                if (this.voidElements && !this.voidElements[tag]) {
2106
                    var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
2107
                    var line = session.getLine(row);
2108
                    var nextIndent = this.$getIndent(line);
2109
                    var indent = nextIndent + session.getTabString();
2110

    
2111
                    if (nextToken && nextToken.value === "</") {
2112
                        return {
2113
                            text: "\n" + indent + "\n" + nextIndent,
2114
                            selection: [1, indent.length, 1, indent.length]
2115
                        };
2116
                    } else {
2117
                        return {
2118
                            text: "\n" + indent
2119
                        };
2120
                    }
2121
                }
2122
            }
2123
        }
2124
    });
2125

    
2126
};
2127

    
2128
oop.inherits(XmlBehaviour, Behaviour);
2129

    
2130
exports.XmlBehaviour = XmlBehaviour;
2131
});
2132

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

    
2136
var oop = require("../../lib/oop");
2137
var BaseFoldMode = require("./fold_mode").FoldMode;
2138

    
2139
var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
2140
    this.defaultMode = defaultMode;
2141
    this.subModes = subModes;
2142
};
2143
oop.inherits(FoldMode, BaseFoldMode);
2144

    
2145
(function() {
2146

    
2147

    
2148
    this.$getMode = function(state) {
2149
        if (typeof state != "string") 
2150
            state = state[0];
2151
        for (var key in this.subModes) {
2152
            if (state.indexOf(key) === 0)
2153
                return this.subModes[key];
2154
        }
2155
        return null;
2156
    };
2157
    
2158
    this.$tryMode = function(state, session, foldStyle, row) {
2159
        var mode = this.$getMode(state);
2160
        return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
2161
    };
2162

    
2163
    this.getFoldWidget = function(session, foldStyle, row) {
2164
        return (
2165
            this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
2166
            this.$tryMode(session.getState(row), session, foldStyle, row) ||
2167
            this.defaultMode.getFoldWidget(session, foldStyle, row)
2168
        );
2169
    };
2170

    
2171
    this.getFoldWidgetRange = function(session, foldStyle, row) {
2172
        var mode = this.$getMode(session.getState(row-1));
2173
        
2174
        if (!mode || !mode.getFoldWidget(session, foldStyle, row))
2175
            mode = this.$getMode(session.getState(row));
2176
        
2177
        if (!mode || !mode.getFoldWidget(session, foldStyle, row))
2178
            mode = this.defaultMode;
2179
        
2180
        return mode.getFoldWidgetRange(session, foldStyle, row);
2181
    };
2182

    
2183
}).call(FoldMode.prototype);
2184

    
2185
});
2186

    
2187
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) {
2188
"use strict";
2189

    
2190
var oop = require("../../lib/oop");
2191
var lang = require("../../lib/lang");
2192
var Range = require("../../range").Range;
2193
var BaseFoldMode = require("./fold_mode").FoldMode;
2194
var TokenIterator = require("../../token_iterator").TokenIterator;
2195

    
2196
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
2197
    BaseFoldMode.call(this);
2198
    this.voidElements = voidElements || {};
2199
    this.optionalEndTags = oop.mixin({}, this.voidElements);
2200
    if (optionalEndTags)
2201
        oop.mixin(this.optionalEndTags, optionalEndTags);
2202
    
2203
};
2204
oop.inherits(FoldMode, BaseFoldMode);
2205

    
2206
var Tag = function() {
2207
    this.tagName = "";
2208
    this.closing = false;
2209
    this.selfClosing = false;
2210
    this.start = {row: 0, column: 0};
2211
    this.end = {row: 0, column: 0};
2212
};
2213

    
2214
function is(token, type) {
2215
    return token.type.lastIndexOf(type + ".xml") > -1;
2216
}
2217

    
2218
(function() {
2219

    
2220
    this.getFoldWidget = function(session, foldStyle, row) {
2221
        var tag = this._getFirstTagInLine(session, row);
2222

    
2223
        if (!tag)
2224
            return this.getCommentFoldWidget(session, row);
2225

    
2226
        if (tag.closing || (!tag.tagName && tag.selfClosing))
2227
            return foldStyle == "markbeginend" ? "end" : "";
2228

    
2229
        if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
2230
            return "";
2231

    
2232
        if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
2233
            return "";
2234

    
2235
        return "start";
2236
    };
2237
    
2238
    this.getCommentFoldWidget = function(session, row) {
2239
        if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
2240
            return "start";
2241
        return "";
2242
    };
2243
    this._getFirstTagInLine = function(session, row) {
2244
        var tokens = session.getTokens(row);
2245
        var tag = new Tag();
2246

    
2247
        for (var i = 0; i < tokens.length; i++) {
2248
            var token = tokens[i];
2249
            if (is(token, "tag-open")) {
2250
                tag.end.column = tag.start.column + token.value.length;
2251
                tag.closing = is(token, "end-tag-open");
2252
                token = tokens[++i];
2253
                if (!token)
2254
                    return null;
2255
                tag.tagName = token.value;
2256
                tag.end.column += token.value.length;
2257
                for (i++; i < tokens.length; i++) {
2258
                    token = tokens[i];
2259
                    tag.end.column += token.value.length;
2260
                    if (is(token, "tag-close")) {
2261
                        tag.selfClosing = token.value == '/>';
2262
                        break;
2263
                    }
2264
                }
2265
                return tag;
2266
            } else if (is(token, "tag-close")) {
2267
                tag.selfClosing = token.value == '/>';
2268
                return tag;
2269
            }
2270
            tag.start.column += token.value.length;
2271
        }
2272

    
2273
        return null;
2274
    };
2275

    
2276
    this._findEndTagInLine = function(session, row, tagName, startColumn) {
2277
        var tokens = session.getTokens(row);
2278
        var column = 0;
2279
        for (var i = 0; i < tokens.length; i++) {
2280
            var token = tokens[i];
2281
            column += token.value.length;
2282
            if (column < startColumn)
2283
                continue;
2284
            if (is(token, "end-tag-open")) {
2285
                token = tokens[i + 1];
2286
                if (token && token.value == tagName)
2287
                    return true;
2288
            }
2289
        }
2290
        return false;
2291
    };
2292
    this._readTagForward = function(iterator) {
2293
        var token = iterator.getCurrentToken();
2294
        if (!token)
2295
            return null;
2296

    
2297
        var tag = new Tag();
2298
        do {
2299
            if (is(token, "tag-open")) {
2300
                tag.closing = is(token, "end-tag-open");
2301
                tag.start.row = iterator.getCurrentTokenRow();
2302
                tag.start.column = iterator.getCurrentTokenColumn();
2303
            } else if (is(token, "tag-name")) {
2304
                tag.tagName = token.value;
2305
            } else if (is(token, "tag-close")) {
2306
                tag.selfClosing = token.value == "/>";
2307
                tag.end.row = iterator.getCurrentTokenRow();
2308
                tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
2309
                iterator.stepForward();
2310
                return tag;
2311
            }
2312
        } while(token = iterator.stepForward());
2313

    
2314
        return null;
2315
    };
2316
    
2317
    this._readTagBackward = function(iterator) {
2318
        var token = iterator.getCurrentToken();
2319
        if (!token)
2320
            return null;
2321

    
2322
        var tag = new Tag();
2323
        do {
2324
            if (is(token, "tag-open")) {
2325
                tag.closing = is(token, "end-tag-open");
2326
                tag.start.row = iterator.getCurrentTokenRow();
2327
                tag.start.column = iterator.getCurrentTokenColumn();
2328
                iterator.stepBackward();
2329
                return tag;
2330
            } else if (is(token, "tag-name")) {
2331
                tag.tagName = token.value;
2332
            } else if (is(token, "tag-close")) {
2333
                tag.selfClosing = token.value == "/>";
2334
                tag.end.row = iterator.getCurrentTokenRow();
2335
                tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
2336
            }
2337
        } while(token = iterator.stepBackward());
2338

    
2339
        return null;
2340
    };
2341
    
2342
    this._pop = function(stack, tag) {
2343
        while (stack.length) {
2344
            
2345
            var top = stack[stack.length-1];
2346
            if (!tag || top.tagName == tag.tagName) {
2347
                return stack.pop();
2348
            }
2349
            else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
2350
                stack.pop();
2351
                continue;
2352
            } else {
2353
                return null;
2354
            }
2355
        }
2356
    };
2357
    
2358
    this.getFoldWidgetRange = function(session, foldStyle, row) {
2359
        var firstTag = this._getFirstTagInLine(session, row);
2360
        
2361
        if (!firstTag) {
2362
            return this.getCommentFoldWidget(session, row)
2363
                && session.getCommentFoldRange(row, session.getLine(row).length);
2364
        }
2365
        
2366
        var isBackward = firstTag.closing || firstTag.selfClosing;
2367
        var stack = [];
2368
        var tag;
2369
        
2370
        if (!isBackward) {
2371
            var iterator = new TokenIterator(session, row, firstTag.start.column);
2372
            var start = {
2373
                row: row,
2374
                column: firstTag.start.column + firstTag.tagName.length + 2
2375
            };
2376
            if (firstTag.start.row == firstTag.end.row)
2377
                start.column = firstTag.end.column;
2378
            while (tag = this._readTagForward(iterator)) {
2379
                if (tag.selfClosing) {
2380
                    if (!stack.length) {
2381
                        tag.start.column += tag.tagName.length + 2;
2382
                        tag.end.column -= 2;
2383
                        return Range.fromPoints(tag.start, tag.end);
2384
                    } else
2385
                        continue;
2386
                }
2387
                
2388
                if (tag.closing) {
2389
                    this._pop(stack, tag);
2390
                    if (stack.length == 0)
2391
                        return Range.fromPoints(start, tag.start);
2392
                }
2393
                else {
2394
                    stack.push(tag);
2395
                }
2396
            }
2397
        }
2398
        else {
2399
            var iterator = new TokenIterator(session, row, firstTag.end.column);
2400
            var end = {
2401
                row: row,
2402
                column: firstTag.start.column
2403
            };
2404
            
2405
            while (tag = this._readTagBackward(iterator)) {
2406
                if (tag.selfClosing) {
2407
                    if (!stack.length) {
2408
                        tag.start.column += tag.tagName.length + 2;
2409
                        tag.end.column -= 2;
2410
                        return Range.fromPoints(tag.start, tag.end);
2411
                    } else
2412
                        continue;
2413
                }
2414
                
2415
                if (!tag.closing) {
2416
                    this._pop(stack, tag);
2417
                    if (stack.length == 0) {
2418
                        tag.start.column += tag.tagName.length + 2;
2419
                        if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
2420
                            tag.start.column = tag.end.column;
2421
                        return Range.fromPoints(tag.start, end);
2422
                    }
2423
                }
2424
                else {
2425
                    stack.push(tag);
2426
                }
2427
            }
2428
        }
2429
        
2430
    };
2431

    
2432
}).call(FoldMode.prototype);
2433

    
2434
});
2435

    
2436
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) {
2437
"use strict";
2438

    
2439
var oop = require("../../lib/oop");
2440
var MixedFoldMode = require("./mixed").FoldMode;
2441
var XmlFoldMode = require("./xml").FoldMode;
2442
var CStyleFoldMode = require("./cstyle").FoldMode;
2443

    
2444
var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
2445
    MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
2446
        "js-": new CStyleFoldMode(),
2447
        "css-": new CStyleFoldMode()
2448
    });
2449
};
2450

    
2451
oop.inherits(FoldMode, MixedFoldMode);
2452

    
2453
});
2454

    
2455
ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module) {
2456
"use strict";
2457

    
2458
var TokenIterator = require("../token_iterator").TokenIterator;
2459

    
2460
var commonAttributes = [
2461
    "accesskey",
2462
    "class",
2463
    "contenteditable",
2464
    "contextmenu",
2465
    "dir",
2466
    "draggable",
2467
    "dropzone",
2468
    "hidden",
2469
    "id",
2470
    "inert",
2471
    "itemid",
2472
    "itemprop",
2473
    "itemref",
2474
    "itemscope",
2475
    "itemtype",
2476
    "lang",
2477
    "spellcheck",
2478
    "style",
2479
    "tabindex",
2480
    "title",
2481
    "translate"
2482
];
2483

    
2484
var eventAttributes = [
2485
    "onabort",
2486
    "onblur",
2487
    "oncancel",
2488
    "oncanplay",
2489
    "oncanplaythrough",
2490
    "onchange",
2491
    "onclick",
2492
    "onclose",
2493
    "oncontextmenu",
2494
    "oncuechange",
2495
    "ondblclick",
2496
    "ondrag",
2497
    "ondragend",
2498
    "ondragenter",
2499
    "ondragleave",
2500
    "ondragover",
2501
    "ondragstart",
2502
    "ondrop",
2503
    "ondurationchange",
2504
    "onemptied",
2505
    "onended",
2506
    "onerror",
2507
    "onfocus",
2508
    "oninput",
2509
    "oninvalid",
2510
    "onkeydown",
2511
    "onkeypress",
2512
    "onkeyup",
2513
    "onload",
2514
    "onloadeddata",
2515
    "onloadedmetadata",
2516
    "onloadstart",
2517
    "onmousedown",
2518
    "onmousemove",
2519
    "onmouseout",
2520
    "onmouseover",
2521
    "onmouseup",
2522
    "onmousewheel",
2523
    "onpause",
2524
    "onplay",
2525
    "onplaying",
2526
    "onprogress",
2527
    "onratechange",
2528
    "onreset",
2529
    "onscroll",
2530
    "onseeked",
2531
    "onseeking",
2532
    "onselect",
2533
    "onshow",
2534
    "onstalled",
2535
    "onsubmit",
2536
    "onsuspend",
2537
    "ontimeupdate",
2538
    "onvolumechange",
2539
    "onwaiting"
2540
];
2541

    
2542
var globalAttributes = commonAttributes.concat(eventAttributes);
2543

    
2544
var attributeMap = {
2545
    "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},
2546
    "abbr": {},
2547
    "address": {},
2548
    "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1},
2549
    "article": {"pubdate": 1},
2550
    "aside": {},
2551
    "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }},
2552
    "b": {},
2553
    "base": {"href": 1, "target": 1},
2554
    "bdi": {},
2555
    "bdo": {},
2556
    "blockquote": {"cite": 1},
2557
    "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},
2558
    "br": {},
2559
    "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}},
2560
    "canvas": {"width": 1, "height": 1},
2561
    "caption": {},
2562
    "cite": {},
2563
    "code": {},
2564
    "col": {"span": 1},
2565
    "colgroup": {"span": 1},
2566
    "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1},
2567
    "data": {},
2568
    "datalist": {},
2569
    "dd": {},
2570
    "del": {"cite": 1, "datetime": 1},
2571
    "details": {"open": 1},
2572
    "dfn": {},
2573
    "dialog": {"open": 1},
2574
    "div": {},
2575
    "dl": {},
2576
    "dt": {},
2577
    "em": {},
2578
    "embed": {"src": 1, "height": 1, "width": 1, "type": 1},
2579
    "fieldset": {"disabled": 1, "form": 1, "name": 1},
2580
    "figcaption": {},
2581
    "figure": {},
2582
    "footer": {},
2583
    "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}},
2584
    "h1": {},
2585
    "h2": {},
2586
    "h3": {},
2587
    "h4": {},
2588
    "h5": {},
2589
    "h6": {},
2590
    "head": {},
2591
    "header": {},
2592
    "hr": {},
2593
    "html": {"manifest": 1},
2594
    "i": {},
2595
    "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}},
2596
    "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1},
2597
    "input": {
2598
        "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},
2599
        "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},
2600
    "ins": {"cite": 1, "datetime": 1},
2601
    "kbd": {},
2602
    "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1},
2603
    "label": {"form": 1, "for": 1},
2604
    "legend": {},
2605
    "li": {"value": 1},
2606
    "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},
2607
    "main": {},
2608
    "map": {"name": 1},
2609
    "mark": {},
2610
    "math": {},
2611
    "menu": {"type": 1, "label": 1},
2612
    "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1},
2613
    "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1},
2614
    "nav": {},
2615
    "noscript": {"href": 1},
2616
    "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1},
2617
    "ol": {"start": 1, "reversed": 1},
2618
    "optgroup": {"disabled": 1, "label": 1},
2619
    "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1},
2620
    "output": {"for": 1, "form": 1, "name": 1},
2621
    "p": {},
2622
    "param": {"name": 1, "value": 1},
2623
    "pre": {},
2624
    "progress": {"value": 1, "max": 1},
2625
    "q": {"cite": 1},
2626
    "rp": {},
2627
    "rt": {},
2628
    "ruby": {},
2629
    "s": {},
2630
    "samp": {},
2631
    "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1},
2632
    "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}},
2633
    "small": {},
2634
    "source": {"src": 1, "type": 1, "media": 1},
2635
    "span": {},
2636
    "strong": {},
2637
    "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1},
2638
    "sub": {},
2639
    "sup": {},
2640
    "svg": {},
2641
    "table": {"summary": 1},
2642
    "tbody": {},
2643
    "td": {"headers": 1, "rowspan": 1, "colspan": 1},
2644
    "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}},
2645
    "tfoot": {},
2646
    "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1},
2647
    "thead": {},
2648
    "time": {"datetime": 1},
2649
    "title": {},
2650
    "tr": {},
2651
    "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1},
2652
    "section": {},
2653
    "summary": {},
2654
    "u": {},
2655
    "ul": {},
2656
    "var": {},
2657
    "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}},
2658
    "wbr": {}
2659
};
2660

    
2661
var elements = Object.keys(attributeMap);
2662

    
2663
function is(token, type) {
2664
    return token.type.lastIndexOf(type + ".xml") > -1;
2665
}
2666

    
2667
function findTagName(session, pos) {
2668
    var iterator = new TokenIterator(session, pos.row, pos.column);
2669
    var token = iterator.getCurrentToken();
2670
    while (token && !is(token, "tag-name")){
2671
        token = iterator.stepBackward();
2672
    }
2673
    if (token)
2674
        return token.value;
2675
}
2676

    
2677
function findAttributeName(session, pos) {
2678
    var iterator = new TokenIterator(session, pos.row, pos.column);
2679
    var token = iterator.getCurrentToken();
2680
    while (token && !is(token, "attribute-name")){
2681
        token = iterator.stepBackward();
2682
    }
2683
    if (token)
2684
        return token.value;
2685
}
2686

    
2687
var HtmlCompletions = function() {
2688

    
2689
};
2690

    
2691
(function() {
2692

    
2693
    this.getCompletions = function(state, session, pos, prefix) {
2694
        var token = session.getTokenAt(pos.row, pos.column);
2695

    
2696
        if (!token)
2697
            return [];
2698
        if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
2699
            return this.getTagCompletions(state, session, pos, prefix);
2700
        if (is(token, "tag-whitespace") || is(token, "attribute-name"))
2701
            return this.getAttributeCompletions(state, session, pos, prefix);
2702
        if (is(token, "attribute-value"))
2703
            return this.getAttributeValueCompletions(state, session, pos, prefix);
2704
        var line = session.getLine(pos.row).substr(0, pos.column);
2705
        if (/&[a-z]*$/i.test(line))
2706
            return this.getHTMLEntityCompletions(state, session, pos, prefix);
2707

    
2708
        return [];
2709
    };
2710

    
2711
    this.getTagCompletions = function(state, session, pos, prefix) {
2712
        return elements.map(function(element){
2713
            return {
2714
                value: element,
2715
                meta: "tag",
2716
                score: 1000000
2717
            };
2718
        });
2719
    };
2720

    
2721
    this.getAttributeCompletions = function(state, session, pos, prefix) {
2722
        var tagName = findTagName(session, pos);
2723
        if (!tagName)
2724
            return [];
2725
        var attributes = globalAttributes;
2726
        if (tagName in attributeMap) {
2727
            attributes = attributes.concat(Object.keys(attributeMap[tagName]));
2728
        }
2729
        return attributes.map(function(attribute){
2730
            return {
2731
                caption: attribute,
2732
                snippet: attribute + '="$0"',
2733
                meta: "attribute",
2734
                score: 1000000
2735
            };
2736
        });
2737
    };
2738

    
2739
    this.getAttributeValueCompletions = function(state, session, pos, prefix) {
2740
        var tagName = findTagName(session, pos);
2741
        var attributeName = findAttributeName(session, pos);
2742
        
2743
        if (!tagName)
2744
            return [];
2745
        var values = [];
2746
        if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
2747
            values = Object.keys(attributeMap[tagName][attributeName]);
2748
        }
2749
        return values.map(function(value){
2750
            return {
2751
                caption: value,
2752
                snippet: value,
2753
                meta: "attribute value",
2754
                score: 1000000
2755
            };
2756
        });
2757
    };
2758

    
2759
    this.getHTMLEntityCompletions = function(state, session, pos, prefix) {
2760
        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;'];
2761

    
2762
        return values.map(function(value){
2763
            return {
2764
                caption: value,
2765
                snippet: value,
2766
                meta: "html entity",
2767
                score: 1000000
2768
            };
2769
        });
2770
    };
2771

    
2772
}).call(HtmlCompletions.prototype);
2773

    
2774
exports.HtmlCompletions = HtmlCompletions;
2775
});
2776

    
2777
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) {
2778
"use strict";
2779

    
2780
var oop = require("../lib/oop");
2781
var lang = require("../lib/lang");
2782
var TextMode = require("./text").Mode;
2783
var JavaScriptMode = require("./javascript").Mode;
2784
var CssMode = require("./css").Mode;
2785
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
2786
var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
2787
var HtmlFoldMode = require("./folding/html").FoldMode;
2788
var HtmlCompletions = require("./html_completions").HtmlCompletions;
2789
var WorkerClient = require("../worker/worker_client").WorkerClient;
2790
var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
2791
var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
2792

    
2793
var Mode = function(options) {
2794
    this.fragmentContext = options && options.fragmentContext;
2795
    this.HighlightRules = HtmlHighlightRules;
2796
    this.$behaviour = new XmlBehaviour();
2797
    this.$completer = new HtmlCompletions();
2798
    
2799
    this.createModeDelegates({
2800
        "js-": JavaScriptMode,
2801
        "css-": CssMode
2802
    });
2803
    
2804
    this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
2805
};
2806
oop.inherits(Mode, TextMode);
2807

    
2808
(function() {
2809

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

    
2812
    this.voidElements = lang.arrayToMap(voidElements);
2813

    
2814
    this.getNextLineIndent = function(state, line, tab) {
2815
        return this.$getIndent(line);
2816
    };
2817

    
2818
    this.checkOutdent = function(state, line, input) {
2819
        return false;
2820
    };
2821

    
2822
    this.getCompletions = function(state, session, pos, prefix) {
2823
        return this.$completer.getCompletions(state, session, pos, prefix);
2824
    };
2825

    
2826
    this.createWorker = function(session) {
2827
        if (this.constructor != Mode)
2828
            return;
2829
        var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
2830
        worker.attachToDocument(session.getDocument());
2831

    
2832
        if (this.fragmentContext)
2833
            worker.call("setOptions", [{context: this.fragmentContext}]);
2834

    
2835
        worker.on("error", function(e) {
2836
            session.setAnnotations(e.data);
2837
        });
2838

    
2839
        worker.on("terminate", function() {
2840
            session.clearAnnotations();
2841
        });
2842

    
2843
        return worker;
2844
    };
2845

    
2846
    this.$id = "ace/mode/html";
2847
    this.snippetFileId = "ace/snippets/html";
2848
}).call(Mode.prototype);
2849

    
2850
exports.Mode = Mode;
2851
});
2852

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

    
2856
var oop = require("../../lib/oop");
2857
var BaseFoldMode = require("./fold_mode").FoldMode;
2858
var Range = require("../../range").Range;
2859

    
2860
var FoldMode = exports.FoldMode = function() {};
2861
oop.inherits(FoldMode, BaseFoldMode);
2862

    
2863
(function() {
2864

    
2865
    this.getFoldWidgetRange = function(session, foldStyle, row) {
2866
        var range = this.indentationBlock(session, row);
2867
        if (range)
2868
            return range;
2869

    
2870
        var re = /\S/;
2871
        var line = session.getLine(row);
2872
        var startLevel = line.search(re);
2873
        if (startLevel == -1 || line[startLevel] != "#")
2874
            return;
2875

    
2876
        var startColumn = line.length;
2877
        var maxRow = session.getLength();
2878
        var startRow = row;
2879
        var endRow = row;
2880

    
2881
        while (++row < maxRow) {
2882
            line = session.getLine(row);
2883
            var level = line.search(re);
2884

    
2885
            if (level == -1)
2886
                continue;
2887

    
2888
            if (line[level] != "#")
2889
                break;
2890

    
2891
            endRow = row;
2892
        }
2893

    
2894
        if (endRow > startRow) {
2895
            var endColumn = session.getLine(endRow).length;
2896
            return new Range(startRow, startColumn, endRow, endColumn);
2897
        }
2898
    };
2899
    this.getFoldWidget = function(session, foldStyle, row) {
2900
        var line = session.getLine(row);
2901
        var indent = line.search(/\S/);
2902
        var next = session.getLine(row + 1);
2903
        var prev = session.getLine(row - 1);
2904
        var prevIndent = prev.search(/\S/);
2905
        var nextIndent = next.search(/\S/);
2906

    
2907
        if (indent == -1) {
2908
            session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
2909
            return "";
2910
        }
2911
        if (prevIndent == -1) {
2912
            if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
2913
                session.foldWidgets[row - 1] = "";
2914
                session.foldWidgets[row + 1] = "";
2915
                return "start";
2916
            }
2917
        } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
2918
            if (session.getLine(row - 2).search(/\S/) == -1) {
2919
                session.foldWidgets[row - 1] = "start";
2920
                session.foldWidgets[row + 1] = "";
2921
                return "";
2922
            }
2923
        }
2924

    
2925
        if (prevIndent!= -1 && prevIndent < indent)
2926
            session.foldWidgets[row - 1] = "start";
2927
        else
2928
            session.foldWidgets[row - 1] = "";
2929

    
2930
        if (indent < nextIndent)
2931
            return "start";
2932
        else
2933
            return "";
2934
    };
2935

    
2936
}).call(FoldMode.prototype);
2937

    
2938
});
2939

    
2940
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) {
2941
"use strict";
2942

    
2943
var oop = require("../lib/oop");
2944
var TextMode = require("./text").Mode;
2945
var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
2946
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
2947
var Range = require("../range").Range;
2948
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
2949
var FoldMode = require("./folding/coffee").FoldMode;
2950

    
2951
var Mode = function() {
2952
    this.HighlightRules = RubyHighlightRules;
2953
    this.$outdent = new MatchingBraceOutdent();
2954
    this.$behaviour = new CstyleBehaviour();
2955
    this.foldingRules = new FoldMode();
2956
};
2957
oop.inherits(Mode, TextMode);
2958

    
2959
(function() {
2960

    
2961

    
2962
    this.lineCommentStart = "#";
2963

    
2964
    this.getNextLineIndent = function(state, line, tab) {
2965
        var indent = this.$getIndent(line);
2966

    
2967
        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
2968
        var tokens = tokenizedLine.tokens;
2969

    
2970
        if (tokens.length && tokens[tokens.length-1].type == "comment") {
2971
            return indent;
2972
        }
2973

    
2974
        if (state == "start") {
2975
            var match = line.match(/^.*[\{\(\[]\s*$/);
2976
            var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/);
2977
            var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/);
2978
            var startingConditional = line.match(/^\s*(if|else|when)\s*/);
2979
            if (match || startingClassOrMethod || startingDoBlock || startingConditional) {
2980
                indent += tab;
2981
            }
2982
        }
2983

    
2984
        return indent;
2985
    };
2986

    
2987
    this.checkOutdent = function(state, line, input) {
2988
        return /^\s+(end|else)$/.test(line + input) || this.$outdent.checkOutdent(line, input);
2989
    };
2990

    
2991
    this.autoOutdent = function(state, session, row) {
2992
        var line = session.getLine(row);
2993
        if (/}/.test(line))
2994
            return this.$outdent.autoOutdent(session, row);
2995
        var indent = this.$getIndent(line);
2996
        var prevLine = session.getLine(row - 1);
2997
        var prevIndent = this.$getIndent(prevLine);
2998
        var tab = session.getTabString();
2999
        if (prevIndent.length <= indent.length) {
3000
            if (indent.slice(-tab.length) == tab)
3001
                session.remove(new Range(row, indent.length-tab.length, row, indent.length));
3002
        }
3003
    };
3004

    
3005
    this.$id = "ace/mode/ruby";
3006
    this.snippetFileId = "ace/snippets/ruby";
3007
}).call(Mode.prototype);
3008

    
3009
exports.Mode = Mode;
3010
});
3011

    
3012
ace.define("ace/mode/html_ruby",["require","exports","module","ace/lib/oop","ace/mode/html_ruby_highlight_rules","ace/mode/html","ace/mode/javascript","ace/mode/css","ace/mode/ruby"], function(require, exports, module) {
3013
"use strict";
3014

    
3015
var oop = require("../lib/oop");
3016
var HtmlRubyHighlightRules = require("./html_ruby_highlight_rules").HtmlRubyHighlightRules;
3017
var HtmlMode = require("./html").Mode;
3018
var JavaScriptMode = require("./javascript").Mode;
3019
var CssMode = require("./css").Mode;
3020
var RubyMode = require("./ruby").Mode;
3021

    
3022
var Mode = function() {
3023
    HtmlMode.call(this);   
3024
    this.HighlightRules = HtmlRubyHighlightRules;    
3025
    this.createModeDelegates({
3026
        "js-": JavaScriptMode,
3027
        "css-": CssMode,
3028
        "ruby-": RubyMode
3029
    });
3030
};
3031
oop.inherits(Mode, HtmlMode);
3032

    
3033
(function() {
3034

    
3035
    this.$id = "ace/mode/html_ruby";
3036
}).call(Mode.prototype);
3037

    
3038
exports.Mode = Mode;
3039
});                (function() {
3040
                    ace.require(["ace/mode/html_ruby"], function(m) {
3041
                        if (typeof module == "object" && typeof exports == "object" && module) {
3042
                            module.exports = m;
3043
                        }
3044
                    });
3045
                })();
3046
            
(90-90/244)