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) {
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;
10
var Mode = function() {
11
var highlighter = new LuaPageHighlightRules();
13
this.$tokenizer = new Tokenizer(new LuaPageHighlightRules().getRules());
14
this.$embeds = highlighter.getEmbeds();
15
this.createModeDelegates({
19
oop.inherits(Mode, HtmlMode);
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) {
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;
36
var Mode = function() {
37
var highlighter = new HtmlHighlightRules();
38
this.$tokenizer = new Tokenizer(highlighter.getRules());
39
this.$behaviour = new HtmlBehaviour();
41
this.$embeds = highlighter.getEmbeds();
42
this.createModeDelegates({
43
"js-": JavaScriptMode,
47
this.foldingRules = new HtmlFoldMode();
49
oop.inherits(Mode, TextMode);
53
this.blockComment = {start: "<!--", end: "-->"};
55
this.getNextLineIndent = function(state, line, tab) {
56
return this.$getIndent(line);
59
this.checkOutdent = function(state, line, input) {
63
}).call(Mode.prototype);
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) {
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;
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();
87
oop.inherits(Mode, TextMode);
91
this.lineCommentStart = "//";
92
this.blockComment = {start: "/*", end: "*/"};
94
this.getNextLineIndent = function(state, line, tab) {
95
var indent = this.$getIndent(line);
97
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
98
var tokens = tokenizedLine.tokens;
99
var endState = tokenizedLine.state;
101
if (tokens.length && tokens[tokens.length-1].type == "comment") {
105
if (state == "start" || state == "no_regex") {
106
var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
110
} else if (state == "doc-start") {
111
if (endState == "start" || endState == "no_regex") {
114
var match = line.match(/^\s*(\/?)\*/);
126
this.checkOutdent = function(state, line, input) {
127
return this.$outdent.checkOutdent(line, input);
130
this.autoOutdent = function(state, doc, row) {
131
this.$outdent.autoOutdent(doc, row);
134
this.createWorker = function(session) {
135
var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
136
worker.attachToDocument(session.getDocument());
138
worker.on("jslint", function(results) {
139
session.setAnnotations(results.data);
142
worker.on("terminate", function() {
143
session.clearAnnotations();
149
}).call(Mode.prototype);
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) {
157
var oop = require("../lib/oop");
158
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
159
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
161
var JavaScriptHighlightRules = function() {
162
var keywordMapper = this.createKeywordMapper({
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
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",
181
"const|let|var|function",
183
"null|Infinity|NaN|undefined",
186
"constant.language.boolean": "true|false"
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";
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
196
"[4-7][0-7]?|" + //oct
205
DocCommentHighlightRules.getStartRule("doc-start"),
207
token : "comment", // multi line comment
219
token : "constant.numeric", // hex
220
regex : /0[xX][0-9a-fA-F]+\b/
222
token : "constant.numeric", // float
223
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
226
"storage.type", "punctuation.operator", "support.function",
227
"punctuation.operator", "entity.name.function", "text","keyword.operator"
229
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
230
next: "function_arguments"
233
"storage.type", "punctuation.operator", "entity.name.function", "text",
234
"keyword.operator", "text", "storage.type", "text", "paren.lparen"
236
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
237
next: "function_arguments"
240
"entity.name.function", "text", "keyword.operator", "text", "storage.type",
241
"text", "paren.lparen"
243
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
244
next: "function_arguments"
247
"storage.type", "punctuation.operator", "entity.name.function", "text",
248
"keyword.operator", "text",
249
"storage.type", "text", "entity.name.function", "text", "paren.lparen"
251
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
252
next: "function_arguments"
255
"storage.type", "text", "entity.name.function", "text", "paren.lparen"
257
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
258
next: "function_arguments"
261
"entity.name.function", "text", "punctuation.operator",
262
"text", "storage.type", "text", "paren.lparen"
264
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
265
next: "function_arguments"
268
"text", "text", "storage.type", "text", "paren.lparen"
270
regex : "(:)(\\s*)(function)(\\s*)(\\()",
271
next: "function_arguments"
274
regex : "(?:" + kwBeforeRe + ")\\b",
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(?=\()/
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(?=\()/
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/
286
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
287
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
289
token : keywordMapper,
292
token : "keyword.operator",
293
regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/,
296
token : "punctuation.operator",
297
regex : /\?|\:|\,|\;|\./,
300
token : "paren.lparen",
304
token : "paren.rparen",
307
token : "keyword.operator",
316
DocCommentHighlightRules.getStartRule("doc-start"),
318
token : "comment", // multi line comment
320
next : "comment_regex_allowed"
326
token: "string.regexp",
341
token: "regexp.keyword.operator",
342
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
344
token: "string.regexp",
349
regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
351
token : "constant.language.escape",
352
regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/
354
token : "constant.language.delimiter",
357
token: "constant.language.escape",
359
next: "regex_character_class",
365
defaultToken: "string.regexp"
368
"regex_character_class": [
370
token: "regexp.keyword.operator",
371
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
373
token: "constant.language.escape",
377
token: "constant.language.escape",
384
defaultToken: "string.regexp.charachterclass"
387
"function_arguments": [
389
token: "variable.parameter",
392
token: "punctuation.operator",
395
token: "punctuation.operator",
403
"comment_regex_allowed" : [
404
{token : "comment", regex : "\\*\\/", next : "start"},
405
{defaultToken : "comment"}
408
{token : "comment", regex : "\\*\\/", next : "no_regex"},
409
{defaultToken : "comment"}
413
token : "constant.language.escape",
424
defaultToken: "string"
429
token : "constant.language.escape",
440
defaultToken: "string"
445
this.embedRules(DocCommentHighlightRules, "doc-",
446
[ DocCommentHighlightRules.getEndRule("no_regex") ]);
449
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
451
exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
454
define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
457
var oop = require("../lib/oop");
458
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
460
var DocCommentHighlightRules = function() {
464
token : "comment.doc.tag",
465
regex : "@[\\w\\d_]+" // TODO: fix email addresses
467
token : "comment.doc.tag",
470
defaultToken : "comment.doc"
475
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
477
DocCommentHighlightRules.getStartRule = function(start) {
479
token : "comment.doc", // doc comment
480
regex : "\\/\\*(?=\\*)",
485
DocCommentHighlightRules.getEndRule = function (start) {
487
token : "comment.doc", // closing comment
494
exports.DocCommentHighlightRules = DocCommentHighlightRules;
498
define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
501
var Range = require("../range").Range;
503
var MatchingBraceOutdent = function() {};
507
this.checkOutdent = function(line, input) {
508
if (! /^\s+$/.test(line))
511
return /^\s*\}/.test(input);
514
this.autoOutdent = function(doc, row) {
515
var line = doc.getLine(row);
516
var match = line.match(/^(\s*\})/);
518
if (!match) return 0;
520
var column = match[1].length;
521
var openBracePos = doc.findMatchingBracket({row: row, column: column});
523
if (!openBracePos || openBracePos.row == row) return 0;
525
var indent = this.$getIndent(doc.getLine(openBracePos.row));
526
doc.replace(new Range(row, 0, row, column-1), indent);
529
this.$getIndent = function(line) {
530
return line.match(/^\s*/)[0];
533
}).call(MatchingBraceOutdent.prototype);
535
exports.MatchingBraceOutdent = MatchingBraceOutdent;
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) {
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");
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"];
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 = "";
560
var CstyleBehaviour = function () {
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))
570
iterator.stepForward();
571
return iterator.getCurrentTokenRow() !== cursor.row ||
572
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
575
CstyleBehaviour.$matchTokenType = function(token, types) {
576
return types.indexOf(token.type || token) > -1;
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++;
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++;
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;
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;
614
CstyleBehaviour.popAutoInsertedClosing = function() {
615
autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
616
autoInsertedBrackets--;
619
CstyleBehaviour.clearMaybeInsertedClosing = function() {
620
maybeInsertedBrackets = 0;
621
maybeInsertedRow = -1;
624
this.add("braces", "insertion", function (state, action, editor, session, text) {
625
var cursor = editor.getCursorPosition();
626
var line = session.doc.getLine(cursor.row);
628
var selection = editor.getSelectionRange();
629
var selected = session.doc.getTextRange(selection);
630
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
632
text: '{' + selected + '}',
635
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
636
if (/[\]\}\)]/.test(line[cursor.column])) {
637
CstyleBehaviour.recordAutoInsert(editor, session, "}");
643
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
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();
662
} else if (text == "\n" || text == "\r\n") {
664
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
665
closing = lang.stringRepeat("}", maybeInsertedBrackets);
666
CstyleBehaviour.clearMaybeInsertedClosing();
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}, '}');
674
var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
675
var next_indent = this.$getIndent(line);
678
text: '\n' + indent + '\n' + next_indent + closing,
679
selection: [1, indent.length, 1, indent.length]
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 == '}') {
694
maybeInsertedBrackets--;
699
this.add("parens", "insertion", function (state, action, editor, session, text) {
701
var selection = editor.getSelectionRange();
702
var selected = session.doc.getTextRange(selection);
703
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
705
text: '(' + selected + ')',
708
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
709
CstyleBehaviour.recordAutoInsert(editor, session, ")");
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();
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 == ')') {
744
this.add("brackets", "insertion", function (state, action, editor, session, text) {
746
var selection = editor.getSelectionRange();
747
var selected = session.doc.getTextRange(selection);
748
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
750
text: '[' + selected + ']',
753
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
754
CstyleBehaviour.recordAutoInsert(editor, session, "]");
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();
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 == ']') {
789
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
790
if (text == '"' || text == "'") {
792
var selection = editor.getSelectionRange();
793
var selected = session.doc.getTextRange(selection);
794
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
796
text: quote + selected + quote,
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 == '\\') {
806
var tokens = session.getTokens(selection.start.row);
808
var quotepos = -1; // Track whether we're inside an open quote.
810
for (var x = 0; x < tokens.length; x++) {
812
if (token.type == "string") {
814
} else if (quotepos < 0) {
815
quotepos = token.value.indexOf(quote);
817
if ((token.value.length + col) > selection.start.column) {
820
col += tokens[x].value.length;
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))
829
} else if (token && token.type === "string") {
830
var rightChar = line.substring(cursor.column, cursor.column + 1);
831
if (rightChar == quote) {
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) {
856
oop.inherits(CstyleBehaviour, Behaviour);
858
exports.CstyleBehaviour = CstyleBehaviour;
861
define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
864
var oop = require("../../lib/oop");
865
var Range = require("../../range").Range;
866
var BaseFoldMode = require("./fold_mode").FoldMode;
868
var FoldMode = exports.FoldMode = function(commentRegex) {
870
this.foldingStartMarker = new RegExp(
871
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
873
this.foldingStopMarker = new RegExp(
874
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
878
oop.inherits(FoldMode, BaseFoldMode);
882
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
883
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
885
this.getFoldWidgetRange = function(session, foldStyle, row) {
886
var line = session.getLine(row);
887
var match = line.match(this.foldingStartMarker);
892
return this.openingBracketBlock(session, match[1], row, i);
894
return session.getCommentFoldRange(row, i + match[0].length, 1);
897
if (foldStyle !== "markbeginend")
900
var match = line.match(this.foldingStopMarker);
902
var i = match.index + match[0].length;
905
return this.closingBracketBlock(session, match[1], row, i);
907
return session.getCommentFoldRange(row, i, -1);
911
}).call(FoldMode.prototype);
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) {
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;
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();
933
oop.inherits(Mode, TextMode);
937
this.foldingRules = "cStyle";
938
this.blockComment = {start: "/*", end: "*/"};
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") {
947
var match = line.match(/^.*\{\s*$/);
955
this.checkOutdent = function(state, line, input) {
956
return this.$outdent.checkOutdent(line, input);
959
this.autoOutdent = function(state, doc, row) {
960
this.$outdent.autoOutdent(doc, row);
963
this.createWorker = function(session) {
964
var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
965
worker.attachToDocument(session.getDocument());
967
worker.on("csslint", function(e) {
968
session.setAnnotations(e.data);
971
worker.on("terminate", function() {
972
session.clearAnnotations();
978
}).call(Mode.prototype);
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) {
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";
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";
1000
var CssHighlightRules = function() {
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
1010
var base_ruleset = [
1012
token : "comment", // multi line comment
1014
next : "ruleset_comment"
1016
token : "string", // single line
1017
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
1019
token : "string", // single line
1020
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
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|%)"
1025
token : "constant.numeric",
1028
token : "constant.numeric", // hex6 color
1029
regex : "#[a-f0-9]{6}"
1031
token : "constant.numeric", // hex3 color
1032
regex : "#[a-f0-9]{3}"
1034
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
1035
regex : pseudoElements
1037
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
1038
regex : pseudoClasses
1040
token : ["support.function", "string", "support.function"],
1041
regex : "(url\\()(.*)(\\))"
1043
token : keywordMapper,
1044
regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
1046
caseInsensitive: true
1050
var ruleset = lang.copyArray(base_ruleset);
1052
token : "paren.rparen",
1057
var media_ruleset = lang.copyArray( base_ruleset );
1058
media_ruleset.unshift({
1059
token : "paren.rparen",
1064
var base_comment = [{
1065
token : "comment", // comment spanning whole line
1069
var comment = lang.copyArray(base_comment);
1071
token : "comment", // closing comment
1072
regex : ".*?\\*\\/",
1076
var media_comment = lang.copyArray(base_comment);
1077
media_comment.unshift({
1078
token : "comment", // closing comment
1079
regex : ".*?\\*\\/",
1083
var ruleset_comment = lang.copyArray(base_comment);
1084
ruleset_comment.unshift({
1085
token : "comment", // closing comment
1086
regex : ".*?\\*\\/",
1092
token : "comment", // multi line comment
1096
token: "paren.lparen",
1105
regex: "#[a-z0-9-_]+"
1108
regex: "\\.[a-z0-9-_]+"
1111
regex: ":[a-z0-9-_]+"
1114
regex: "[a-z0-9-_]+"
1116
caseInsensitive: true
1120
token : "comment", // multi line comment
1122
next : "media_comment"
1124
token: "paren.lparen",
1126
next: "media_ruleset"
1133
regex: "#[a-z0-9-_]+"
1136
regex: "\\.[a-z0-9-_]+"
1139
regex: ":[a-z0-9-_]+"
1142
regex: "[a-z0-9-_]+"
1144
caseInsensitive: true
1147
"comment" : comment,
1149
"ruleset" : ruleset,
1150
"ruleset_comment" : ruleset_comment,
1152
"media_ruleset" : media_ruleset,
1153
"media_comment" : media_comment
1157
oop.inherits(CssHighlightRules, TextHighlightRules);
1159
exports.CssHighlightRules = CssHighlightRules;
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) {
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;
1171
var CssBehaviour = function () {
1173
this.inherit(CstyleBehaviour);
1175
this.add("colon", "insertion", function (state, action, editor, session, 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();
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 === ':') {
1192
if (!line.substring(cursor.column).match(/^\s*;/)) {
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();
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 ++;
1222
this.add("semicolon", "insertion", function (state, action, editor, session, 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 === ';') {
1237
oop.inherits(CssBehaviour, CstyleBehaviour);
1239
exports.CssBehaviour = CssBehaviour;
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) {
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;
1252
var tagMap = lang.createMap({
1271
var HtmlHighlightRules = function() {
1275
regex : "<\\!\\[CDATA\\[",
1279
regex : "<\\?.*?\\?>"
1289
regex : "<(?=script\\b)",
1293
regex : "<(?=style\\b)",
1296
token : "meta.tag", // opening tag
1303
token : "constant.character.entity",
1304
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1318
defaultToken : "comment"
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);
1326
this.embedRules(JavaScriptHighlightRules, "js-", [{
1328
regex: "\\/\\/.*(?=<\\/script>)",
1332
regex: "<\\/(?=script)",
1336
this.embedRules(CssHighlightRules, "css-", [{
1338
regex: "<\\/(?=style)",
1343
oop.inherits(HtmlHighlightRules, TextHighlightRules);
1345
exports.HtmlHighlightRules = HtmlHighlightRules;
1348
define('ace/mode/xml_util', ['require', 'exports', 'module' ], function(require, exports, module) {
1351
function string(state) {
1355
next : state + "_qqstring"
1359
next : state + "_qstring"
1363
function multiLineString(quote, state) {
1365
{token : "string", regex : quote, next : state},
1367
token : "constant.language.escape",
1368
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
1370
{defaultToken : "string"}
1374
exports.tag = function(states, name, nextState, tagMap) {
1380
token : !tagMap ? "meta.tag.tag-name" : function(value) {
1382
return "meta.tag.tag-name." + tagMap[value];
1384
return "meta.tag.tag-name";
1386
regex : "[-_a-zA-Z0-9:]+",
1387
next : name + "_embed_attribute_list"
1391
next : name + "_embed_attribute_list"
1394
states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
1395
states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
1397
states[name + "_embed_attribute_list"] = [{
1398
token : "meta.tag.r",
1402
token : "keyword.operator",
1405
token : "entity.other.attribute-name",
1406
regex : "[-_a-zA-Z0-9:]+"
1408
token : "constant.numeric", // float
1409
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
1413
}].concat(string(name));
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) {
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'];
1427
function hasType(token, type) {
1429
var typeList = token.type.split('.');
1430
var needleList = type.split('.');
1431
needleList.forEach(function(needle){
1432
if (typeList.indexOf(needle) == -1) {
1440
var HtmlBehaviour = function () {
1442
this.inherit(XmlBehaviour); // Get xml behaviour
1444
this.add("autoclosing", "insertion", function (state, action, editor, session, 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('/'))){
1452
token = iterator.stepBackward();
1453
} while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
1457
if (!token || !hasType(token, 'meta.tag-name') || iterator.stepBackward().value.match('/')) {
1460
var element = token.value;
1462
var element = element.substring(0, position.column - token.start);
1464
if (voidElements.indexOf(element) !== -1){
1468
text: '>' + '</' + element + '>',
1474
oop.inherits(HtmlBehaviour, XmlBehaviour);
1476
exports.HtmlBehaviour = HtmlBehaviour;
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) {
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;
1487
function hasType(token, type) {
1489
var typeList = token.type.split('.');
1490
var needleList = type.split('.');
1491
needleList.forEach(function(needle){
1492
if (typeList.indexOf(needle) == -1) {
1500
var XmlBehaviour = function () {
1502
this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour
1504
this.add("autoclosing", "insertion", function (state, action, editor, session, 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('/'))){
1512
token = iterator.stepBackward();
1513
} while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
1517
if (!token || !hasType(token, 'meta.tag-name') || iterator.stepBackward().value.match('/')) {
1520
var tag = token.value;
1522
var tag = tag.substring(0, position.column - token.start);
1526
text: '>' + '</' + tag + '>',
1532
this.add('autoindent', 'insertion', function (state, action, editor, session, text) {
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));
1542
text: '\n' + indent + '\n' + next_indent,
1543
selection: [1, indent.length, 1, indent.length]
1550
oop.inherits(XmlBehaviour, Behaviour);
1552
exports.XmlBehaviour = XmlBehaviour;
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) {
1558
var oop = require("../../lib/oop");
1559
var MixedFoldMode = require("./mixed").FoldMode;
1560
var XmlFoldMode = require("./xml").FoldMode;
1561
var CStyleFoldMode = require("./cstyle").FoldMode;
1563
var FoldMode = exports.FoldMode = function() {
1564
MixedFoldMode.call(this, new XmlFoldMode({
1593
"js-": new CStyleFoldMode(),
1594
"css-": new CStyleFoldMode()
1598
oop.inherits(FoldMode, MixedFoldMode);
1602
define('ace/mode/folding/mixed', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
1605
var oop = require("../../lib/oop");
1606
var BaseFoldMode = require("./fold_mode").FoldMode;
1608
var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
1609
this.defaultMode = defaultMode;
1610
this.subModes = subModes;
1612
oop.inherits(FoldMode, BaseFoldMode);
1617
this.$getMode = function(state) {
1618
for (var key in this.subModes) {
1619
if (state.indexOf(key) === 0)
1620
return this.subModes[key];
1625
this.$tryMode = function(state, session, foldStyle, row) {
1626
var mode = this.$getMode(state);
1627
return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
1630
this.getFoldWidget = function(session, foldStyle, row) {
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)
1638
this.getFoldWidgetRange = function(session, foldStyle, row) {
1639
var mode = this.$getMode(session.getState(row-1));
1641
if (!mode || !mode.getFoldWidget(session, foldStyle, row))
1642
mode = this.$getMode(session.getState(row));
1644
if (!mode || !mode.getFoldWidget(session, foldStyle, row))
1645
mode = this.defaultMode;
1647
return mode.getFoldWidgetRange(session, foldStyle, row);
1650
}).call(FoldMode.prototype);
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) {
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;
1663
var FoldMode = exports.FoldMode = function(voidElements) {
1664
BaseFoldMode.call(this);
1665
this.voidElements = voidElements || {};
1667
oop.inherits(FoldMode, BaseFoldMode);
1671
this.getFoldWidget = function(session, foldStyle, row) {
1672
var tag = this._getFirstTagInLine(session, row);
1675
return foldStyle == "markbeginend" ? "end" : "";
1677
if (!tag.tagName || this.voidElements[tag.tagName.toLowerCase()])
1680
if (tag.selfClosing)
1683
if (tag.value.indexOf("/" + tag.tagName) !== -1)
1689
this._getFirstTagInLine = function(session, row) {
1690
var tokens = session.getTokens(row);
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;
1697
value += lang.stringRepeat(" ", token.value.length);
1700
return this._parseTag(value);
1703
this.tagRe = /^(\s*)(<?(\/?)([-_a-zA-Z0-9:!]*)\s*(\/?)>?)/;
1704
this._parseTag = function(tag) {
1706
var match = this.tagRe.exec(tag);
1707
var column = this.tagRe.lastIndex || 0;
1708
this.tagRe.lastIndex = 0;
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
1719
this._readTagForward = function(iterator) {
1720
var token = iterator.getCurrentToken();
1728
if (token.type.indexOf("meta.tag") === 0) {
1731
row: iterator.getCurrentTokenRow(),
1732
column: iterator.getCurrentTokenColumn()
1735
value += token.value;
1736
if (value.indexOf(">") !== -1) {
1737
var tag = this._parseTag(value);
1740
row: iterator.getCurrentTokenRow(),
1741
column: iterator.getCurrentTokenColumn() + token.value.length
1743
iterator.stepForward();
1747
} while(token = iterator.stepForward());
1752
this._readTagBackward = function(iterator) {
1753
var token = iterator.getCurrentToken();
1761
if (token.type.indexOf("meta.tag") === 0) {
1764
row: iterator.getCurrentTokenRow(),
1765
column: iterator.getCurrentTokenColumn() + token.value.length
1768
value = token.value + value;
1769
if (value.indexOf("<") !== -1) {
1770
var tag = this._parseTag(value);
1773
row: iterator.getCurrentTokenRow(),
1774
column: iterator.getCurrentTokenColumn()
1776
iterator.stepBackward();
1780
} while(token = iterator.stepBackward());
1785
this._pop = function(stack, tag) {
1786
while (stack.length) {
1788
var top = stack[stack.length-1];
1789
if (!tag || top.tagName == tag.tagName) {
1792
else if (this.voidElements[tag.tagName]) {
1795
else if (this.voidElements[top.tagName]) {
1804
this.getFoldWidgetRange = function(session, foldStyle, row) {
1805
var firstTag = this._getFirstTagInLine(session, row);
1807
if (!firstTag.match)
1810
var isBackward = firstTag.closing || firstTag.selfClosing;
1815
var iterator = new TokenIterator(session, row, firstTag.column);
1818
column: firstTag.column + firstTag.tagName.length + 2
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);
1831
this._pop(stack, tag);
1832
if (stack.length == 0)
1833
return Range.fromPoints(start, tag.start);
1841
var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length);
1844
column: firstTag.column
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);
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);
1872
}).call(FoldMode.prototype);
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) {
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;
1886
var Mode = function() {
1887
this.$tokenizer = new Tokenizer(new LuaHighlightRules().getRules());
1888
this.foldingRules = new LuaFoldMode();
1890
oop.inherits(Mode, TextMode);
1894
this.lineCommentStart = "--";
1895
this.blockComment = {start: "--[", end: "]--"};
1897
var indentKeywords = {
1907
var outdentKeywords = [
1914
function getNetIndentLevel(tokens) {
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];
1922
} else if (token.type == "paren.lparen") {
1924
} else if (token.type == "paren.rparen") {
1930
} else if (level > 0) {
1937
this.getNextLineIndent = function(state, line, tab) {
1938
var indent = this.$getIndent(line);
1941
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
1942
var tokens = tokenizedLine.tokens;
1944
if (state == "start") {
1945
level = getNetIndentLevel(tokens);
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);
1957
this.checkOutdent = function(state, line, input) {
1958
if (input != "\n" && input != "\r" && input != "\r\n")
1961
if (line.match(/^\s*[\)\}\]]$/))
1964
var tokens = this.$tokenizer.getLineTokens(line.trim(), state).tokens;
1966
if (!tokens || !tokens.length)
1969
return (tokens[0].type == "keyword" && outdentKeywords.indexOf(tokens[0].value) != -1);
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) {
1982
session.outdentRows(new Range(row, 0, row + 2, 0));
1985
}).call(Mode.prototype);
1987
exports.Mode = Mode;
1990
define('ace/mode/lua_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
1993
var oop = require("../lib/oop");
1994
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1996
var LuaHighlightRules = function() {
1999
"break|do|else|elseif|end|for|function|if|in|local|repeat|"+
2000
"return|then|until|while|or|and|not"
2003
var builtinConstants = ("true|false|nil|_G|_VERSION");
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|"+
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"
2030
var stdLibaries = ("string|package|os|io|math|debug|table|coroutine");
2032
var futureReserved = "";
2034
var deprecatedIn5152 = ("setn|foreach|foreachi|gcinfo|log10|maxn");
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"
2046
var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
2047
var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
2048
var integer = "(?:" + decimalInteger + "|" + hexInteger + ")";
2050
var fraction = "(?:\\.\\d+)";
2051
var intPart = "(?:\\d+)";
2052
var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
2053
var floatNumber = "(?:" + pointFloat + ")";
2057
stateName: "bracketedComment",
2058
onMatch : function(value, currentState, stack){
2059
stack.unshift(this.next, value.length, currentState);
2062
regex : /\-\-\[=*\[/,
2065
onMatch : function(value, currentState, stack) {
2066
if (value.length == stack[1]) {
2069
this.next = stack.shift();
2075
regex : /(?:[^\\]|\\.)*?\]=*\]/,
2078
defaultToken : "comment"
2088
stateName: "bracketedString",
2089
onMatch : function(value, currentState, stack){
2090
stack.unshift(this.next, value.length, currentState);
2096
onMatch : function(value, currentState, stack) {
2097
if (value.length == stack[1]) {
2100
this.next = stack.shift();
2107
regex : /(?:[^\\]|\\.)*?\]=*\]/,
2110
defaultToken : "comment"
2115
token : "string", // " string
2116
regex : '"(?:[^\\\\]|\\\\.)*?"'
2118
token : "string", // ' string
2119
regex : "'(?:[^\\\\]|\\\\.)*?'"
2121
token : "constant.numeric", // float
2124
token : "constant.numeric", // integer
2125
regex : integer + "\\b"
2127
token : keywordMapper,
2128
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
2130
token : "keyword.operator",
2131
regex : "\\+|\\-|\\*|\\/|%|\\#|\\^|~|<|>|<=|=>|==|~=|=|\\:|\\.\\.\\.|\\.\\."
2133
token : "paren.lparen",
2134
regex : "[\\[\\(\\{]"
2136
token : "paren.rparen",
2137
regex : "[\\]\\)\\}]"
2144
this.normalizeRules();
2147
oop.inherits(LuaHighlightRules, TextHighlightRules);
2149
exports.LuaHighlightRules = LuaHighlightRules;
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) {
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;
2161
var FoldMode = exports.FoldMode = function() {};
2163
oop.inherits(FoldMode, BaseFoldMode);
2167
this.foldingStartMarker = /\b(function|then|do|repeat)\b|{\s*$|(\[=*\[)/;
2168
this.foldingStopMarker = /\bend\b|^\s*}|\]=*\]/;
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);
2175
if (isStart && !isEnd) {
2176
var match = line.match(this.foldingStartMarker);
2177
if (match[1] == "then" && /\belseif\b/.test(line))
2180
if (session.getTokenAt(row, match.index + 1).type === "keyword")
2182
} else if (match[2]) {
2183
var type = session.bgTokenizer.getState(row) || "";
2184
if (type[0] == "bracketedComment" || type[0] == "bracketedString")
2190
if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd)
2193
var match = line.match(this.foldingStopMarker);
2194
if (match[0] === "end") {
2195
if (session.getTokenAt(row, match.index + 1).type === "keyword")
2197
} else if (match[0][0] === "]") {
2198
var type = session.bgTokenizer.getState(row - 1) || "";
2199
if (type[0] == "bracketedComment" || type[0] == "bracketedString")
2205
this.getFoldWidgetRange = function(session, foldStyle, row) {
2206
var line = session.doc.getLine(row);
2207
var match = this.foldingStartMarker.exec(line);
2210
return this.luaBlock(session, row, match.index + 1);
2213
return session.getCommentFoldRange(row, match.index + 1);
2215
return this.openingBracketBlock(session, "{", row, match.index);
2218
var match = this.foldingStopMarker.exec(line);
2220
if (match[0] === "end") {
2221
if (session.getTokenAt(row, match.index + 1).type === "keyword")
2222
return this.luaBlock(session, row, match.index + 1);
2225
if (match[0][0] === "]")
2226
return session.getCommentFoldRange(row, match.index + 1);
2228
return this.closingBracketBlock(session, "}", row, match.index + match[0].length);
2232
this.luaBlock = function(session, row, column) {
2233
var stream = new TokenIterator(session, row, column);
2234
var indentKeywords = {
2244
var token = stream.getCurrentToken();
2245
if (!token || token.type != "keyword")
2248
var val = token.value;
2250
var dir = indentKeywords[val];
2255
var startColumn = dir === -1 ? stream.getCurrentTokenColumn() : session.getLine(row).length;
2258
stream.step = dir === -1 ? stream.stepBackward : stream.stepForward;
2259
while(token = stream.step()) {
2260
if (token.type !== "keyword")
2262
var level = dir * indentKeywords[token.value];
2265
stack.unshift(token.value);
2266
} else if (level <= 0) {
2268
if (!stack.length && token.value != "elseif")
2271
stack.unshift(token.value);
2275
var row = stream.getCurrentTokenRow();
2277
return new Range(row, session.getLine(row).length, startRow, startColumn);
2279
return new Range(startRow, startColumn, row, stream.getCurrentTokenColumn());
2282
}).call(FoldMode.prototype);
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) {
2288
var oop = require("../lib/oop");
2289
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
2290
var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules;
2292
var LuaPageHighlightRules = function() {
2293
this.$rules = new HtmlHighlightRules().getRules();
2295
for (var i in this.$rules) {
2296
this.$rules[i].unshift({
2302
regex: "<\\?lua\\=?",
2306
this.embedRules(LuaHighlightRules, "lua-", [
2320
oop.inherits(LuaPageHighlightRules, HtmlHighlightRules);
2322
exports.LuaPageHighlightRules = LuaPageHighlightRules;
b'\\ No newline at end of file'