/lenasys/trunk

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

« back to all changes in this revision

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

  • Committer: Gustav Hatvigsson
  • Date: 2013-04-11 09:20:09 UTC
  • mfrom: (19.1.5 lenasys)
  • Revision ID: gustav.hartvigsson@gmail.com-20130411092009-ylcqzqwcmjdglb17
merged in implemetaion group one's team bransh, it contains code-ignighter
and the new admin-panel.
20130411

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ***** BEGIN LICENSE BLOCK *****
 
2
 * Distributed under the BSD license:
 
3
 *
 
4
 * Copyright (c) 2010, Ajax.org B.V.
 
5
 * All rights reserved.
 
6
 * 
 
7
 * Redistribution and use in source and binary forms, with or without
 
8
 * modification, are permitted provided that the following conditions are met:
 
9
 *     * Redistributions of source code must retain the above copyright
 
10
 *       notice, this list of conditions and the following disclaimer.
 
11
 *     * Redistributions in binary form must reproduce the above copyright
 
12
 *       notice, this list of conditions and the following disclaimer in the
 
13
 *       documentation and/or other materials provided with the distribution.
 
14
 *     * Neither the name of Ajax.org B.V. nor the
 
15
 *       names of its contributors may be used to endorse or promote products
 
16
 *       derived from this software without specific prior written permission.
 
17
 * 
 
18
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 
19
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 
20
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 
21
 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
 
22
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 
23
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
24
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 
25
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 
27
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
28
 *
 
29
 * ***** END LICENSE BLOCK ***** */
 
30
 
 
31
define('ace/mode/liquid', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/liquid_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/range'], function(require, exports, module) {
 
32
 
 
33
var oop = require("../lib/oop");
 
34
var TextMode = require("./text").Mode;
 
35
var Tokenizer = require("../tokenizer").Tokenizer;
 
36
var LiquidHighlightRules = require("./liquid_highlight_rules").LiquidHighlightRules;
 
37
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
 
38
var Range = require("../range").Range;
 
39
 
 
40
var Mode = function() {
 
41
    this.$tokenizer = new Tokenizer(new LiquidHighlightRules().getRules());
 
42
    this.$outdent = new MatchingBraceOutdent();
 
43
};
 
44
oop.inherits(Mode, TextMode);
 
45
 
 
46
(function() {
 
47
 
 
48
    this.blockComment = {start: "<!--", end: "-->"};
 
49
 
 
50
    this.getNextLineIndent = function(state, line, tab) {
 
51
        var indent = this.$getIndent(line);
 
52
 
 
53
        var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
 
54
        var tokens = tokenizedLine.tokens;
 
55
        var endState = tokenizedLine.state;
 
56
 
 
57
        if (tokens.length && tokens[tokens.length-1].type == "comment") {
 
58
            return indent;
 
59
        }
 
60
 
 
61
        if (state == "start") {
 
62
            var match = line.match(/^.*[\{\(\[]\s*$/);
 
63
            if (match) {
 
64
                indent += tab;
 
65
            }
 
66
        }
 
67
 
 
68
        return indent;
 
69
    };
 
70
 
 
71
    this.checkOutdent = function(state, line, input) {
 
72
        return this.$outdent.checkOutdent(line, input);
 
73
    };
 
74
 
 
75
    this.autoOutdent = function(state, doc, row) {
 
76
        this.$outdent.autoOutdent(doc, row);
 
77
    };
 
78
 
 
79
}).call(Mode.prototype);
 
80
 
 
81
exports.Mode = Mode;
 
82
});
 
83
 
 
84
define('ace/mode/liquid_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
 
85
 
 
86
 
 
87
var oop = require("../lib/oop");
 
88
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
 
89
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
 
90
var xmlUtil = require("./xml_util");
 
91
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
 
92
 
 
93
var LiquidHighlightRules = function() {
 
94
    var functions = (
 
95
        "date|capitalize|downcase|upcase|first|last|join|sort|map|size|escape|" +
 
96
         "escape_once|strip_html|strip_newlines|newline_to_br|replace|replace_first|" +
 
97
         "truncate|truncatewords|prepend|append|minus|plus|times|divided_by|split"
 
98
    );
 
99
 
 
100
    var keywords = (
 
101
        "capture|endcapture|case|endcase|when|comment|endcomment|" +
 
102
        "cycle|for|endfor|in|reversed|if|endif|else|elsif|include|endinclude|unless|endunless|" +
 
103
        "style|text|image|widget|plugin|marker|endmarker|tablerow|endtablerow"
 
104
    );
 
105
 
 
106
    var builtinVariables = 'forloop|tablerowloop';
 
107
 
 
108
    var definitions = ("assign");
 
109
 
 
110
    var keywordMapper = this.createKeywordMapper({
 
111
        "variable.language": builtinVariables,
 
112
        "keyword": keywords,
 
113
        "support.function": functions,
 
114
        "keyword.definition": definitions
 
115
    }, "identifier");
 
116
 
 
117
    this.$rules = {
 
118
        start : [{
 
119
            token : "variable",
 
120
            regex : "{%",
 
121
            next : "liquid_start"
 
122
        }, {
 
123
            token : "variable",
 
124
            regex : "{{",
 
125
            next : "liquid_start"
 
126
        }, {
 
127
            token : "meta.tag",
 
128
            regex : "<\\!\\[CDATA\\[",
 
129
            next : "cdata"
 
130
        }, {
 
131
            token : "xml-pe",
 
132
            regex : "<\\?.*?\\?>"
 
133
        }, {
 
134
            token : "comment",
 
135
            regex : "<\\!--",
 
136
            next : "comment"
 
137
        }, {
 
138
            token : "meta.tag",
 
139
            regex : "<(?=\\s*script\\b)",
 
140
            next : "script"
 
141
        }, {
 
142
            token : "meta.tag",
 
143
            regex : "<(?=\\s*style\\b)",
 
144
            next : "style"
 
145
        }, {
 
146
            token : "meta.tag", // opening tag
 
147
            regex : "<\\/?",
 
148
            next : "tag"
 
149
        } ],
 
150
 
 
151
        cdata : [ {
 
152
            token : "text",
 
153
            regex : "\\]\\]>",
 
154
            next : "start"
 
155
        } ],
 
156
 
 
157
        comment : [ {
 
158
            token : "comment",
 
159
            regex : ".*?-->",
 
160
            next : "start"
 
161
        }, {
 
162
            defaultToken : "comment"
 
163
        } ] ,
 
164
 
 
165
        liquid_start : [{
 
166
            token: "variable",
 
167
            regex: "}}",
 
168
            next: "start"
 
169
        }, {
 
170
            token: "variable",
 
171
            regex: "%}",
 
172
            next: "start"
 
173
        }, {
 
174
            token : "string", // single line
 
175
            regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
 
176
        }, {
 
177
            token : "string", // single line
 
178
            regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
 
179
        }, {
 
180
            token : "constant.numeric", // hex
 
181
            regex : "0[xX][0-9a-fA-F]+\\b"
 
182
        }, {
 
183
            token : "constant.numeric", // float
 
184
            regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
 
185
        }, {
 
186
            token : "constant.language.boolean",
 
187
            regex : "(?:true|false)\\b"
 
188
        }, {
 
189
            token : keywordMapper,
 
190
            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
 
191
        }, {
 
192
            token : "keyword.operator",
 
193
            regex : "\/|\\*|\\-|\\+|=|!=|\\?\\:"
 
194
        }, {
 
195
            token : "paren.lparen",
 
196
            regex : /[\[\({]/
 
197
        }, {
 
198
            token : "paren.rparen",
 
199
            regex : /[\])}]/
 
200
        }, {
 
201
            token : "text",
 
202
            regex : "\\s+"
 
203
        }]
 
204
    };
 
205
 
 
206
    xmlUtil.tag(this.$rules, "tag", "start");
 
207
    xmlUtil.tag(this.$rules, "style", "css-start");
 
208
    xmlUtil.tag(this.$rules, "script", "js-start");
 
209
 
 
210
    this.embedRules(JavaScriptHighlightRules, "js-", [{
 
211
        token: "comment",
 
212
        regex: "\\/\\/.*(?=<\\/script>)",
 
213
        next: "tag"
 
214
    }, {
 
215
        token: "meta.tag",
 
216
        regex: "<\\/(?=script)",
 
217
        next: "tag"
 
218
    }]);
 
219
 
 
220
    this.embedRules(CssHighlightRules, "css-", [{
 
221
        token: "meta.tag",
 
222
        regex: "<\\/(?=style)",
 
223
        next: "tag"
 
224
    }]);
 
225
};
 
226
oop.inherits(LiquidHighlightRules, TextHighlightRules);
 
227
 
 
228
exports.LiquidHighlightRules = LiquidHighlightRules;
 
229
});
 
230
 
 
231
define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
 
232
 
 
233
 
 
234
var oop = require("../lib/oop");
 
235
var lang = require("../lib/lang");
 
236
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
 
237
var supportType = exports.supportType = "animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index";
 
238
var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
 
239
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";
 
240
var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
 
241
var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
 
242
 
 
243
var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
 
244
var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
 
245
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";
 
246
 
 
247
var CssHighlightRules = function() {
 
248
 
 
249
    var keywordMapper = this.createKeywordMapper({
 
250
        "support.function": supportFunction,
 
251
        "support.constant": supportConstant,
 
252
        "support.type": supportType,
 
253
        "support.constant.color": supportConstantColor,
 
254
        "support.constant.fonts": supportConstantFonts
 
255
    }, "text", true);
 
256
 
 
257
    var base_ruleset = [
 
258
        {
 
259
            token : "comment", // multi line comment
 
260
            regex : "\\/\\*",
 
261
            next : "ruleset_comment"
 
262
        }, {
 
263
            token : "string", // single line
 
264
            regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
 
265
        }, {
 
266
            token : "string", // single line
 
267
            regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
 
268
        }, {
 
269
            token : ["constant.numeric", "keyword"],
 
270
            regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
 
271
        }, {
 
272
            token : "constant.numeric",
 
273
            regex : numRe
 
274
        }, {
 
275
            token : "constant.numeric",  // hex6 color
 
276
            regex : "#[a-f0-9]{6}"
 
277
        }, {
 
278
            token : "constant.numeric", // hex3 color
 
279
            regex : "#[a-f0-9]{3}"
 
280
        }, {
 
281
            token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
 
282
            regex : pseudoElements
 
283
        }, {
 
284
            token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
 
285
            regex : pseudoClasses
 
286
        }, {
 
287
            token : ["support.function", "string", "support.function"],
 
288
            regex : "(url\\()(.*)(\\))"
 
289
        }, {
 
290
            token : keywordMapper,
 
291
            regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
 
292
        }, {
 
293
            caseInsensitive: true
 
294
        }
 
295
      ];
 
296
 
 
297
    var ruleset = lang.copyArray(base_ruleset);
 
298
    ruleset.unshift({
 
299
        token : "paren.rparen",
 
300
        regex : "\\}",
 
301
        next:   "start"
 
302
    });
 
303
 
 
304
    var media_ruleset = lang.copyArray( base_ruleset );
 
305
    media_ruleset.unshift({
 
306
        token : "paren.rparen",
 
307
        regex : "\\}",
 
308
        next:   "media"
 
309
    });
 
310
 
 
311
    var base_comment = [{
 
312
          token : "comment", // comment spanning whole line
 
313
          regex : ".+"
 
314
    }];
 
315
 
 
316
    var comment = lang.copyArray(base_comment);
 
317
    comment.unshift({
 
318
          token : "comment", // closing comment
 
319
          regex : ".*?\\*\\/",
 
320
          next : "start"
 
321
    });
 
322
 
 
323
    var media_comment = lang.copyArray(base_comment);
 
324
    media_comment.unshift({
 
325
          token : "comment", // closing comment
 
326
          regex : ".*?\\*\\/",
 
327
          next : "media"
 
328
    });
 
329
 
 
330
    var ruleset_comment = lang.copyArray(base_comment);
 
331
    ruleset_comment.unshift({
 
332
          token : "comment", // closing comment
 
333
          regex : ".*?\\*\\/",
 
334
          next : "ruleset"
 
335
    });
 
336
 
 
337
    this.$rules = {
 
338
        "start" : [{
 
339
            token : "comment", // multi line comment
 
340
            regex : "\\/\\*",
 
341
            next : "comment"
 
342
        }, {
 
343
            token: "paren.lparen",
 
344
            regex: "\\{",
 
345
            next:  "ruleset"
 
346
        }, {
 
347
            token: "string",
 
348
            regex: "@.*?{",
 
349
            next:  "media"
 
350
        },{
 
351
            token: "keyword",
 
352
            regex: "#[a-z0-9-_]+"
 
353
        },{
 
354
            token: "variable",
 
355
            regex: "\\.[a-z0-9-_]+"
 
356
        },{
 
357
            token: "string",
 
358
            regex: ":[a-z0-9-_]+"
 
359
        },{
 
360
            token: "constant",
 
361
            regex: "[a-z0-9-_]+"
 
362
        },{
 
363
            caseInsensitive: true
 
364
        }],
 
365
 
 
366
        "media" : [ {
 
367
            token : "comment", // multi line comment
 
368
            regex : "\\/\\*",
 
369
            next : "media_comment"
 
370
        }, {
 
371
            token: "paren.lparen",
 
372
            regex: "\\{",
 
373
            next:  "media_ruleset"
 
374
        },{
 
375
            token: "string",
 
376
            regex: "\\}",
 
377
            next:  "start"
 
378
        },{
 
379
            token: "keyword",
 
380
            regex: "#[a-z0-9-_]+"
 
381
        },{
 
382
            token: "variable",
 
383
            regex: "\\.[a-z0-9-_]+"
 
384
        },{
 
385
            token: "string",
 
386
            regex: ":[a-z0-9-_]+"
 
387
        },{
 
388
            token: "constant",
 
389
            regex: "[a-z0-9-_]+"
 
390
        },{
 
391
            caseInsensitive: true
 
392
        }],
 
393
 
 
394
        "comment" : comment,
 
395
 
 
396
        "ruleset" : ruleset,
 
397
        "ruleset_comment" : ruleset_comment,
 
398
 
 
399
        "media_ruleset" : media_ruleset,
 
400
        "media_comment" : media_comment
 
401
    };
 
402
};
 
403
 
 
404
oop.inherits(CssHighlightRules, TextHighlightRules);
 
405
 
 
406
exports.CssHighlightRules = CssHighlightRules;
 
407
 
 
408
});
 
409
 
 
410
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) {
 
411
 
 
412
 
 
413
var oop = require("../lib/oop");
 
414
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
 
415
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
 
416
 
 
417
var JavaScriptHighlightRules = function() {
 
418
    var keywordMapper = this.createKeywordMapper({
 
419
        "variable.language":
 
420
            "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|"  + // Constructors
 
421
            "Namespace|QName|XML|XMLList|"                                             + // E4X
 
422
            "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|"   +
 
423
            "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|"                    +
 
424
            "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|"   + // Errors
 
425
            "SyntaxError|TypeError|URIError|"                                          +
 
426
            "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
 
427
            "isNaN|parseFloat|parseInt|"                                               +
 
428
            "JSON|Math|"                                                               + // Other
 
429
            "this|arguments|prototype|window|document"                                 , // Pseudo
 
430
        "keyword":
 
431
            "const|yield|import|get|set|" +
 
432
            "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
 
433
            "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
 
434
            "__parent__|__count__|escape|unescape|with|__proto__|" +
 
435
            "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
 
436
        "storage.type":
 
437
            "const|let|var|function",
 
438
        "constant.language":
 
439
            "null|Infinity|NaN|undefined",
 
440
        "support.function":
 
441
            "alert",
 
442
        "constant.language.boolean": "true|false"
 
443
    }, "identifier");
 
444
    var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
 
445
    var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
 
446
 
 
447
    var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
 
448
        "u[0-9a-fA-F]{4}|" + // unicode
 
449
        "[0-2][0-7]{0,2}|" + // oct
 
450
        "3[0-6][0-7]?|" + // oct
 
451
        "37[0-7]?|" + // oct
 
452
        "[4-7][0-7]?|" + //oct
 
453
        ".)";
 
454
 
 
455
    this.$rules = {
 
456
        "no_regex" : [
 
457
            {
 
458
                token : "comment",
 
459
                regex : /\/\/.*$/
 
460
            },
 
461
            DocCommentHighlightRules.getStartRule("doc-start"),
 
462
            {
 
463
                token : "comment", // multi line comment
 
464
                regex : /\/\*/,
 
465
                next : "comment"
 
466
            }, {
 
467
                token : "string",
 
468
                regex : "'(?=.)",
 
469
                next  : "qstring"
 
470
            }, {
 
471
                token : "string",
 
472
                regex : '"(?=.)',
 
473
                next  : "qqstring"
 
474
            }, {
 
475
                token : "constant.numeric", // hex
 
476
                regex : /0[xX][0-9a-fA-F]+\b/
 
477
            }, {
 
478
                token : "constant.numeric", // float
 
479
                regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
 
480
            }, {
 
481
                token : [
 
482
                    "storage.type", "punctuation.operator", "support.function",
 
483
                    "punctuation.operator", "entity.name.function", "text","keyword.operator"
 
484
                ],
 
485
                regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
 
486
                next: "function_arguments"
 
487
            }, {
 
488
                token : [
 
489
                    "storage.type", "punctuation.operator", "entity.name.function", "text",
 
490
                    "keyword.operator", "text", "storage.type", "text", "paren.lparen"
 
491
                ],
 
492
                regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
 
493
                next: "function_arguments"
 
494
            }, {
 
495
                token : [
 
496
                    "entity.name.function", "text", "keyword.operator", "text", "storage.type",
 
497
                    "text", "paren.lparen"
 
498
                ],
 
499
                regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
 
500
                next: "function_arguments"
 
501
            }, {
 
502
                token : [
 
503
                    "storage.type", "punctuation.operator", "entity.name.function", "text",
 
504
                    "keyword.operator", "text",
 
505
                    "storage.type", "text", "entity.name.function", "text", "paren.lparen"
 
506
                ],
 
507
                regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
 
508
                next: "function_arguments"
 
509
            }, {
 
510
                token : [
 
511
                    "storage.type", "text", "entity.name.function", "text", "paren.lparen"
 
512
                ],
 
513
                regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
 
514
                next: "function_arguments"
 
515
            }, {
 
516
                token : [
 
517
                    "entity.name.function", "text", "punctuation.operator",
 
518
                    "text", "storage.type", "text", "paren.lparen"
 
519
                ],
 
520
                regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
 
521
                next: "function_arguments"
 
522
            }, {
 
523
                token : [
 
524
                    "text", "text", "storage.type", "text", "paren.lparen"
 
525
                ],
 
526
                regex : "(:)(\\s*)(function)(\\s*)(\\()",
 
527
                next: "function_arguments"
 
528
            }, {
 
529
                token : "keyword",
 
530
                regex : "(?:" + kwBeforeRe + ")\\b",
 
531
                next : "start"
 
532
            }, {
 
533
                token : ["punctuation.operator", "support.function"],
 
534
                regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
 
535
            }, {
 
536
                token : ["punctuation.operator", "support.function.dom"],
 
537
                regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
 
538
            }, {
 
539
                token : ["punctuation.operator", "support.constant"],
 
540
                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/
 
541
            }, {
 
542
                token : ["storage.type", "punctuation.operator", "support.function.firebug"],
 
543
                regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
 
544
            }, {
 
545
                token : keywordMapper,
 
546
                regex : identifierRe
 
547
            }, {
 
548
                token : "keyword.operator",
 
549
                regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/,
 
550
                next  : "start"
 
551
            }, {
 
552
                token : "punctuation.operator",
 
553
                regex : /\?|\:|\,|\;|\./,
 
554
                next  : "start"
 
555
            }, {
 
556
                token : "paren.lparen",
 
557
                regex : /[\[({]/,
 
558
                next  : "start"
 
559
            }, {
 
560
                token : "paren.rparen",
 
561
                regex : /[\])}]/
 
562
            }, {
 
563
                token : "keyword.operator",
 
564
                regex : /\/=?/,
 
565
                next  : "start"
 
566
            }, {
 
567
                token: "comment",
 
568
                regex: /^#!.*$/
 
569
            }
 
570
        ],
 
571
        "start": [
 
572
            DocCommentHighlightRules.getStartRule("doc-start"),
 
573
            {
 
574
                token : "comment", // multi line comment
 
575
                regex : "\\/\\*",
 
576
                next : "comment_regex_allowed"
 
577
            }, {
 
578
                token : "comment",
 
579
                regex : "\\/\\/.*$",
 
580
                next : "start"
 
581
            }, {
 
582
                token: "string.regexp",
 
583
                regex: "\\/",
 
584
                next: "regex",
 
585
            }, {
 
586
                token : "text",
 
587
                regex : "\\s+|^$",
 
588
                next : "start"
 
589
            }, {
 
590
                token: "empty",
 
591
                regex: "",
 
592
                next: "no_regex"
 
593
            }
 
594
        ],
 
595
        "regex": [
 
596
            {
 
597
                token: "regexp.keyword.operator",
 
598
                regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
 
599
            }, {
 
600
                token: "string.regexp",
 
601
                regex: "/\\w*",
 
602
                next: "no_regex",
 
603
            }, {
 
604
                token : "invalid",
 
605
                regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
 
606
            }, {
 
607
                token : "constant.language.escape",
 
608
                regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/
 
609
            }, {
 
610
                token : "constant.language.delimiter",
 
611
                regex: /\|/
 
612
            }, {
 
613
                token: "constant.language.escape",
 
614
                regex: /\[\^?/,
 
615
                next: "regex_character_class",
 
616
            }, {
 
617
                token: "empty",
 
618
                regex: "$",
 
619
                next: "no_regex"
 
620
            }, {
 
621
                defaultToken: "string.regexp"
 
622
            }
 
623
        ],
 
624
        "regex_character_class": [
 
625
            {
 
626
                token: "regexp.keyword.operator",
 
627
                regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
 
628
            }, {
 
629
                token: "constant.language.escape",
 
630
                regex: "]",
 
631
                next: "regex",
 
632
            }, {
 
633
                token: "constant.language.escape",
 
634
                regex: "-"
 
635
            }, {
 
636
                token: "empty",
 
637
                regex: "$",
 
638
                next: "no_regex"
 
639
            }, {
 
640
                defaultToken: "string.regexp.charachterclass"
 
641
            }
 
642
        ],
 
643
        "function_arguments": [
 
644
            {
 
645
                token: "variable.parameter",
 
646
                regex: identifierRe
 
647
            }, {
 
648
                token: "punctuation.operator",
 
649
                regex: "[, ]+",
 
650
            }, {
 
651
                token: "punctuation.operator",
 
652
                regex: "$",
 
653
            }, {
 
654
                token: "empty",
 
655
                regex: "",
 
656
                next: "no_regex"
 
657
            }
 
658
        ],
 
659
        "comment_regex_allowed" : [
 
660
            {token : "comment", regex : "\\*\\/", next : "start"},
 
661
            {defaultToken : "comment"}
 
662
        ],
 
663
        "comment" : [
 
664
            {token : "comment", regex : "\\*\\/", next : "no_regex"},
 
665
            {defaultToken : "comment"}
 
666
        ],
 
667
        "qqstring" : [
 
668
            {
 
669
                token : "constant.language.escape",
 
670
                regex : escapedRe
 
671
            }, {
 
672
                token : "string",
 
673
                regex : "\\\\$",
 
674
                next  : "qqstring",
 
675
            }, {
 
676
                token : "string",
 
677
                regex : '"|$',
 
678
                next  : "no_regex",
 
679
            }, {
 
680
                defaultToken: "string"
 
681
            }
 
682
        ],
 
683
        "qstring" : [
 
684
            {
 
685
                token : "constant.language.escape",
 
686
                regex : escapedRe
 
687
            }, {
 
688
                token : "string",
 
689
                regex : "\\\\$",
 
690
                next  : "qstring",
 
691
            }, {
 
692
                token : "string",
 
693
                regex : "'|$",
 
694
                next  : "no_regex",
 
695
            }, {
 
696
                defaultToken: "string"
 
697
            }
 
698
        ]
 
699
    };
 
700
 
 
701
    this.embedRules(DocCommentHighlightRules, "doc-",
 
702
        [ DocCommentHighlightRules.getEndRule("no_regex") ]);
 
703
};
 
704
 
 
705
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
 
706
 
 
707
exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
 
708
});
 
709
 
 
710
define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
 
711
 
 
712
 
 
713
var oop = require("../lib/oop");
 
714
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
 
715
 
 
716
var DocCommentHighlightRules = function() {
 
717
 
 
718
    this.$rules = {
 
719
        "start" : [ {
 
720
            token : "comment.doc.tag",
 
721
            regex : "@[\\w\\d_]+" // TODO: fix email addresses
 
722
        }, {
 
723
            token : "comment.doc.tag",
 
724
            regex : "\\bTODO\\b"
 
725
        }, {
 
726
            defaultToken : "comment.doc"
 
727
        }]
 
728
    };
 
729
};
 
730
 
 
731
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
 
732
 
 
733
DocCommentHighlightRules.getStartRule = function(start) {
 
734
    return {
 
735
        token : "comment.doc", // doc comment
 
736
        regex : "\\/\\*(?=\\*)",
 
737
        next  : start
 
738
    };
 
739
};
 
740
 
 
741
DocCommentHighlightRules.getEndRule = function (start) {
 
742
    return {
 
743
        token : "comment.doc", // closing comment
 
744
        regex : "\\*\\/",
 
745
        next  : start
 
746
    };
 
747
};
 
748
 
 
749
 
 
750
exports.DocCommentHighlightRules = DocCommentHighlightRules;
 
751
 
 
752
});
 
753
 
 
754
define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) {
 
755
 
 
756
 
 
757
function string(state) {
 
758
    return [{
 
759
        token : "string",
 
760
        regex : '"',
 
761
        next : state + "_qqstring"
 
762
    }, {
 
763
        token : "string",
 
764
        regex : "'",
 
765
        next : state + "_qstring"
 
766
    }];
 
767
}
 
768
 
 
769
function multiLineString(quote, state) {
 
770
    return [
 
771
        {token : "string", regex : quote, next : state},
 
772
        {
 
773
            token : "constant.language.escape",
 
774
            regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" 
 
775
        },
 
776
        {defaultToken : "string"}
 
777
    ];
 
778
}
 
779
 
 
780
exports.tag = function(states, name, nextState, tagMap) {
 
781
    states[name] = [{
 
782
        token : "text",
 
783
        regex : "\\s+"
 
784
    }, {
 
785
        
 
786
    token : !tagMap ? "meta.tag.tag-name" : function(value) {
 
787
            if (tagMap[value])
 
788
                return "meta.tag.tag-name." + tagMap[value];
 
789
            else
 
790
                return "meta.tag.tag-name";
 
791
        },
 
792
        regex : "[-_a-zA-Z0-9:]+",
 
793
        next : name + "_embed_attribute_list" 
 
794
    }, {
 
795
        token: "empty",
 
796
        regex: "",
 
797
        next : name + "_embed_attribute_list"
 
798
    }];
 
799
 
 
800
    states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
 
801
    states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
 
802
    
 
803
    states[name + "_embed_attribute_list"] = [{
 
804
        token : "meta.tag.r",
 
805
        regex : "/?>",
 
806
        next : nextState
 
807
    }, {
 
808
        token : "keyword.operator",
 
809
        regex : "="
 
810
    }, {
 
811
        token : "entity.other.attribute-name",
 
812
        regex : "[-_a-zA-Z0-9:]+"
 
813
    }, {
 
814
        token : "constant.numeric", // float
 
815
        regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
 
816
    }, {
 
817
        token : "text",
 
818
        regex : "\\s+"
 
819
    }].concat(string(name));
 
820
};
 
821
 
 
822
});
 
823
 
 
824
define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
 
825
 
 
826
 
 
827
var Range = require("../range").Range;
 
828
 
 
829
var MatchingBraceOutdent = function() {};
 
830
 
 
831
(function() {
 
832
 
 
833
    this.checkOutdent = function(line, input) {
 
834
        if (! /^\s+$/.test(line))
 
835
            return false;
 
836
 
 
837
        return /^\s*\}/.test(input);
 
838
    };
 
839
 
 
840
    this.autoOutdent = function(doc, row) {
 
841
        var line = doc.getLine(row);
 
842
        var match = line.match(/^(\s*\})/);
 
843
 
 
844
        if (!match) return 0;
 
845
 
 
846
        var column = match[1].length;
 
847
        var openBracePos = doc.findMatchingBracket({row: row, column: column});
 
848
 
 
849
        if (!openBracePos || openBracePos.row == row) return 0;
 
850
 
 
851
        var indent = this.$getIndent(doc.getLine(openBracePos.row));
 
852
        doc.replace(new Range(row, 0, row, column-1), indent);
 
853
    };
 
854
 
 
855
    this.$getIndent = function(line) {
 
856
        return line.match(/^\s*/)[0];
 
857
    };
 
858
 
 
859
}).call(MatchingBraceOutdent.prototype);
 
860
 
 
861
exports.MatchingBraceOutdent = MatchingBraceOutdent;
 
862
});