/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-luapage.js

  • Committer: galaxyAbstractor
  • Date: 2013-04-10 15:58:59 UTC
  • mfrom: (20.1.1 lenasys)
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: galaxyabstractor@gmail.com-20130410155859-cih60kaz5es8savt
CodeIgniter implementation of basic CMS system

Show diffs side-by-side

added added

removed removed

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