1
define('ace/mode/groovy', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/javascript', 'ace/tokenizer', 'ace/mode/groovy_highlight_rules'], function(require, exports, module) {
4
var oop = require("../lib/oop");
5
var JavaScriptMode = require("./javascript").Mode;
6
var Tokenizer = require("../tokenizer").Tokenizer;
7
var GroovyHighlightRules = require("./groovy_highlight_rules").GroovyHighlightRules;
9
var Mode = function() {
10
JavaScriptMode.call(this);
11
this.$tokenizer = new Tokenizer(new GroovyHighlightRules().getRules());
13
oop.inherits(Mode, JavaScriptMode);
17
this.createWorker = function(session) {
21
}).call(Mode.prototype);
26
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) {
29
var oop = require("../lib/oop");
30
var TextMode = require("./text").Mode;
31
var Tokenizer = require("../tokenizer").Tokenizer;
32
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
33
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
34
var Range = require("../range").Range;
35
var WorkerClient = require("../worker/worker_client").WorkerClient;
36
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
37
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
39
var Mode = function() {
40
this.$tokenizer = new Tokenizer(new JavaScriptHighlightRules().getRules());
41
this.$outdent = new MatchingBraceOutdent();
42
this.$behaviour = new CstyleBehaviour();
43
this.foldingRules = new CStyleFoldMode();
45
oop.inherits(Mode, TextMode);
49
this.lineCommentStart = "//";
50
this.blockComment = {start: "/*", end: "*/"};
52
this.getNextLineIndent = function(state, line, tab) {
53
var indent = this.$getIndent(line);
55
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
56
var tokens = tokenizedLine.tokens;
57
var endState = tokenizedLine.state;
59
if (tokens.length && tokens[tokens.length-1].type == "comment") {
63
if (state == "start" || state == "no_regex") {
64
var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
68
} else if (state == "doc-start") {
69
if (endState == "start" || endState == "no_regex") {
72
var match = line.match(/^\s*(\/?)\*/);
84
this.checkOutdent = function(state, line, input) {
85
return this.$outdent.checkOutdent(line, input);
88
this.autoOutdent = function(state, doc, row) {
89
this.$outdent.autoOutdent(doc, row);
92
this.createWorker = function(session) {
93
var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
94
worker.attachToDocument(session.getDocument());
96
worker.on("jslint", function(results) {
97
session.setAnnotations(results.data);
100
worker.on("terminate", function() {
101
session.clearAnnotations();
107
}).call(Mode.prototype);
112
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) {
115
var oop = require("../lib/oop");
116
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
117
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
119
var JavaScriptHighlightRules = function() {
120
var keywordMapper = this.createKeywordMapper({
122
"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
123
"Namespace|QName|XML|XMLList|" + // E4X
124
"ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
125
"Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
126
"Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
127
"SyntaxError|TypeError|URIError|" +
128
"decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
129
"isNaN|parseFloat|parseInt|" +
130
"JSON|Math|" + // Other
131
"this|arguments|prototype|window|document" , // Pseudo
133
"const|yield|import|get|set|" +
134
"break|case|catch|continue|default|delete|do|else|finally|for|function|" +
135
"if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
136
"__parent__|__count__|escape|unescape|with|__proto__|" +
137
"class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
139
"const|let|var|function",
141
"null|Infinity|NaN|undefined",
144
"constant.language.boolean": "true|false"
146
var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
147
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
149
var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
150
"u[0-9a-fA-F]{4}|" + // unicode
151
"[0-2][0-7]{0,2}|" + // oct
152
"3[0-6][0-7]?|" + // oct
154
"[4-7][0-7]?|" + //oct
163
DocCommentHighlightRules.getStartRule("doc-start"),
165
token : "comment", // multi line comment
177
token : "constant.numeric", // hex
178
regex : /0[xX][0-9a-fA-F]+\b/
180
token : "constant.numeric", // float
181
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
184
"storage.type", "punctuation.operator", "support.function",
185
"punctuation.operator", "entity.name.function", "text","keyword.operator"
187
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
188
next: "function_arguments"
191
"storage.type", "punctuation.operator", "entity.name.function", "text",
192
"keyword.operator", "text", "storage.type", "text", "paren.lparen"
194
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
195
next: "function_arguments"
198
"entity.name.function", "text", "keyword.operator", "text", "storage.type",
199
"text", "paren.lparen"
201
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
202
next: "function_arguments"
205
"storage.type", "punctuation.operator", "entity.name.function", "text",
206
"keyword.operator", "text",
207
"storage.type", "text", "entity.name.function", "text", "paren.lparen"
209
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
210
next: "function_arguments"
213
"storage.type", "text", "entity.name.function", "text", "paren.lparen"
215
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
216
next: "function_arguments"
219
"entity.name.function", "text", "punctuation.operator",
220
"text", "storage.type", "text", "paren.lparen"
222
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
223
next: "function_arguments"
226
"text", "text", "storage.type", "text", "paren.lparen"
228
regex : "(:)(\\s*)(function)(\\s*)(\\()",
229
next: "function_arguments"
232
regex : "(?:" + kwBeforeRe + ")\\b",
235
token : ["punctuation.operator", "support.function"],
236
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(?=\()/
238
token : ["punctuation.operator", "support.function.dom"],
239
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(?=\()/
241
token : ["punctuation.operator", "support.constant"],
242
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/
244
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
245
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
247
token : keywordMapper,
250
token : "keyword.operator",
251
regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/,
254
token : "punctuation.operator",
255
regex : /\?|\:|\,|\;|\./,
258
token : "paren.lparen",
262
token : "paren.rparen",
265
token : "keyword.operator",
274
DocCommentHighlightRules.getStartRule("doc-start"),
276
token : "comment", // multi line comment
278
next : "comment_regex_allowed"
284
token: "string.regexp",
299
token: "regexp.keyword.operator",
300
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
302
token: "string.regexp",
307
regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
309
token : "constant.language.escape",
310
regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/
312
token : "constant.language.delimiter",
315
token: "constant.language.escape",
317
next: "regex_character_class",
323
defaultToken: "string.regexp"
326
"regex_character_class": [
328
token: "regexp.keyword.operator",
329
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
331
token: "constant.language.escape",
335
token: "constant.language.escape",
342
defaultToken: "string.regexp.charachterclass"
345
"function_arguments": [
347
token: "variable.parameter",
350
token: "punctuation.operator",
353
token: "punctuation.operator",
361
"comment_regex_allowed" : [
362
{token : "comment", regex : "\\*\\/", next : "start"},
363
{defaultToken : "comment"}
366
{token : "comment", regex : "\\*\\/", next : "no_regex"},
367
{defaultToken : "comment"}
371
token : "constant.language.escape",
382
defaultToken: "string"
387
token : "constant.language.escape",
398
defaultToken: "string"
403
this.embedRules(DocCommentHighlightRules, "doc-",
404
[ DocCommentHighlightRules.getEndRule("no_regex") ]);
407
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
409
exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
412
define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
415
var oop = require("../lib/oop");
416
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
418
var DocCommentHighlightRules = function() {
422
token : "comment.doc.tag",
423
regex : "@[\\w\\d_]+" // TODO: fix email addresses
425
token : "comment.doc.tag",
428
defaultToken : "comment.doc"
433
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
435
DocCommentHighlightRules.getStartRule = function(start) {
437
token : "comment.doc", // doc comment
438
regex : "\\/\\*(?=\\*)",
443
DocCommentHighlightRules.getEndRule = function (start) {
445
token : "comment.doc", // closing comment
452
exports.DocCommentHighlightRules = DocCommentHighlightRules;
456
define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
459
var Range = require("../range").Range;
461
var MatchingBraceOutdent = function() {};
465
this.checkOutdent = function(line, input) {
466
if (! /^\s+$/.test(line))
469
return /^\s*\}/.test(input);
472
this.autoOutdent = function(doc, row) {
473
var line = doc.getLine(row);
474
var match = line.match(/^(\s*\})/);
476
if (!match) return 0;
478
var column = match[1].length;
479
var openBracePos = doc.findMatchingBracket({row: row, column: column});
481
if (!openBracePos || openBracePos.row == row) return 0;
483
var indent = this.$getIndent(doc.getLine(openBracePos.row));
484
doc.replace(new Range(row, 0, row, column-1), indent);
487
this.$getIndent = function(line) {
488
return line.match(/^\s*/)[0];
491
}).call(MatchingBraceOutdent.prototype);
493
exports.MatchingBraceOutdent = MatchingBraceOutdent;
496
define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) {
499
var oop = require("../../lib/oop");
500
var Behaviour = require("../behaviour").Behaviour;
501
var TokenIterator = require("../../token_iterator").TokenIterator;
502
var lang = require("../../lib/lang");
504
var SAFE_INSERT_IN_TOKENS =
505
["text", "paren.rparen", "punctuation.operator"];
506
var SAFE_INSERT_BEFORE_TOKENS =
507
["text", "paren.rparen", "punctuation.operator", "comment"];
510
var autoInsertedBrackets = 0;
511
var autoInsertedRow = -1;
512
var autoInsertedLineEnd = "";
513
var maybeInsertedBrackets = 0;
514
var maybeInsertedRow = -1;
515
var maybeInsertedLineStart = "";
516
var maybeInsertedLineEnd = "";
518
var CstyleBehaviour = function () {
520
CstyleBehaviour.isSaneInsertion = function(editor, session) {
521
var cursor = editor.getCursorPosition();
522
var iterator = new TokenIterator(session, cursor.row, cursor.column);
523
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
524
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
525
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
528
iterator.stepForward();
529
return iterator.getCurrentTokenRow() !== cursor.row ||
530
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
533
CstyleBehaviour.$matchTokenType = function(token, types) {
534
return types.indexOf(token.type || token) > -1;
537
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
538
var cursor = editor.getCursorPosition();
539
var line = session.doc.getLine(cursor.row);
540
if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
541
autoInsertedBrackets = 0;
542
autoInsertedRow = cursor.row;
543
autoInsertedLineEnd = bracket + line.substr(cursor.column);
544
autoInsertedBrackets++;
547
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
548
var cursor = editor.getCursorPosition();
549
var line = session.doc.getLine(cursor.row);
550
if (!this.isMaybeInsertedClosing(cursor, line))
551
maybeInsertedBrackets = 0;
552
maybeInsertedRow = cursor.row;
553
maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
554
maybeInsertedLineEnd = line.substr(cursor.column);
555
maybeInsertedBrackets++;
558
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
559
return autoInsertedBrackets > 0 &&
560
cursor.row === autoInsertedRow &&
561
bracket === autoInsertedLineEnd[0] &&
562
line.substr(cursor.column) === autoInsertedLineEnd;
565
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
566
return maybeInsertedBrackets > 0 &&
567
cursor.row === maybeInsertedRow &&
568
line.substr(cursor.column) === maybeInsertedLineEnd &&
569
line.substr(0, cursor.column) == maybeInsertedLineStart;
572
CstyleBehaviour.popAutoInsertedClosing = function() {
573
autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
574
autoInsertedBrackets--;
577
CstyleBehaviour.clearMaybeInsertedClosing = function() {
578
maybeInsertedBrackets = 0;
579
maybeInsertedRow = -1;
582
this.add("braces", "insertion", function (state, action, editor, session, text) {
583
var cursor = editor.getCursorPosition();
584
var line = session.doc.getLine(cursor.row);
586
var selection = editor.getSelectionRange();
587
var selected = session.doc.getTextRange(selection);
588
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
590
text: '{' + selected + '}',
593
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
594
if (/[\]\}\)]/.test(line[cursor.column])) {
595
CstyleBehaviour.recordAutoInsert(editor, session, "}");
601
CstyleBehaviour.recordMaybeInsert(editor, session, "{");
608
} else if (text == '}') {
609
var rightChar = line.substring(cursor.column, cursor.column + 1);
610
if (rightChar == '}') {
611
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
612
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
613
CstyleBehaviour.popAutoInsertedClosing();
620
} else if (text == "\n" || text == "\r\n") {
622
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
623
closing = lang.stringRepeat("}", maybeInsertedBrackets);
624
CstyleBehaviour.clearMaybeInsertedClosing();
626
var rightChar = line.substring(cursor.column, cursor.column + 1);
627
if (rightChar == '}' || closing !== "") {
628
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
632
var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
633
var next_indent = this.$getIndent(line);
636
text: '\n' + indent + '\n' + next_indent + closing,
637
selection: [1, indent.length, 1, indent.length]
643
this.add("braces", "deletion", function (state, action, editor, session, range) {
644
var selected = session.doc.getTextRange(range);
645
if (!range.isMultiLine() && selected == '{') {
646
var line = session.doc.getLine(range.start.row);
647
var rightChar = line.substring(range.end.column, range.end.column + 1);
648
if (rightChar == '}') {
652
maybeInsertedBrackets--;
657
this.add("parens", "insertion", function (state, action, editor, session, text) {
659
var selection = editor.getSelectionRange();
660
var selected = session.doc.getTextRange(selection);
661
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
663
text: '(' + selected + ')',
666
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
667
CstyleBehaviour.recordAutoInsert(editor, session, ")");
673
} else if (text == ')') {
674
var cursor = editor.getCursorPosition();
675
var line = session.doc.getLine(cursor.row);
676
var rightChar = line.substring(cursor.column, cursor.column + 1);
677
if (rightChar == ')') {
678
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
679
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
680
CstyleBehaviour.popAutoInsertedClosing();
690
this.add("parens", "deletion", function (state, action, editor, session, range) {
691
var selected = session.doc.getTextRange(range);
692
if (!range.isMultiLine() && selected == '(') {
693
var line = session.doc.getLine(range.start.row);
694
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
695
if (rightChar == ')') {
702
this.add("brackets", "insertion", function (state, action, editor, session, text) {
704
var selection = editor.getSelectionRange();
705
var selected = session.doc.getTextRange(selection);
706
if (selected !== "" && editor.getWrapBehavioursEnabled()) {
708
text: '[' + selected + ']',
711
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
712
CstyleBehaviour.recordAutoInsert(editor, session, "]");
718
} else if (text == ']') {
719
var cursor = editor.getCursorPosition();
720
var line = session.doc.getLine(cursor.row);
721
var rightChar = line.substring(cursor.column, cursor.column + 1);
722
if (rightChar == ']') {
723
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
724
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
725
CstyleBehaviour.popAutoInsertedClosing();
735
this.add("brackets", "deletion", function (state, action, editor, session, range) {
736
var selected = session.doc.getTextRange(range);
737
if (!range.isMultiLine() && selected == '[') {
738
var line = session.doc.getLine(range.start.row);
739
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
740
if (rightChar == ']') {
747
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
748
if (text == '"' || text == "'") {
750
var selection = editor.getSelectionRange();
751
var selected = session.doc.getTextRange(selection);
752
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
754
text: quote + selected + quote,
758
var cursor = editor.getCursorPosition();
759
var line = session.doc.getLine(cursor.row);
760
var leftChar = line.substring(cursor.column-1, cursor.column);
761
if (leftChar == '\\') {
764
var tokens = session.getTokens(selection.start.row);
766
var quotepos = -1; // Track whether we're inside an open quote.
768
for (var x = 0; x < tokens.length; x++) {
770
if (token.type == "string") {
772
} else if (quotepos < 0) {
773
quotepos = token.value.indexOf(quote);
775
if ((token.value.length + col) > selection.start.column) {
778
col += tokens[x].value.length;
780
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)))) {
781
if (!CstyleBehaviour.isSaneInsertion(editor, session))
787
} else if (token && token.type === "string") {
788
var rightChar = line.substring(cursor.column, cursor.column + 1);
789
if (rightChar == quote) {
800
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
801
var selected = session.doc.getTextRange(range);
802
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
803
var line = session.doc.getLine(range.start.row);
804
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
805
if (rightChar == selected) {
814
oop.inherits(CstyleBehaviour, Behaviour);
816
exports.CstyleBehaviour = CstyleBehaviour;
819
define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
822
var oop = require("../../lib/oop");
823
var Range = require("../../range").Range;
824
var BaseFoldMode = require("./fold_mode").FoldMode;
826
var FoldMode = exports.FoldMode = function(commentRegex) {
828
this.foldingStartMarker = new RegExp(
829
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
831
this.foldingStopMarker = new RegExp(
832
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
836
oop.inherits(FoldMode, BaseFoldMode);
840
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
841
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
843
this.getFoldWidgetRange = function(session, foldStyle, row) {
844
var line = session.getLine(row);
845
var match = line.match(this.foldingStartMarker);
850
return this.openingBracketBlock(session, match[1], row, i);
852
return session.getCommentFoldRange(row, i + match[0].length, 1);
855
if (foldStyle !== "markbeginend")
858
var match = line.match(this.foldingStopMarker);
860
var i = match.index + match[0].length;
863
return this.closingBracketBlock(session, match[1], row, i);
865
return session.getCommentFoldRange(row, i, -1);
869
}).call(FoldMode.prototype);
872
define('ace/mode/groovy_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
875
var oop = require("../lib/oop");
876
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
877
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
879
var GroovyHighlightRules = function() {
882
"assert|with|abstract|continue|for|new|switch|" +
883
"assert|default|goto|package|synchronized|" +
884
"boolean|do|if|private|this|" +
885
"break|double|implements|protected|throw|" +
886
"byte|else|import|public|throws|" +
887
"case|enum|instanceof|return|transient|" +
888
"catch|extends|int|short|try|" +
889
"char|final|interface|static|void|" +
890
"class|finally|long|strictfp|volatile|" +
891
"def|float|native|super|while"
894
var buildinConstants = (
895
"null|Infinity|NaN|undefined"
899
"AbstractMethodError|AssertionError|ClassCircularityError|"+
900
"ClassFormatError|Deprecated|EnumConstantNotPresentException|"+
901
"ExceptionInInitializerError|IllegalAccessError|"+
902
"IllegalThreadStateException|InstantiationError|InternalError|"+
903
"NegativeArraySizeException|NoSuchFieldError|Override|Process|"+
904
"ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|"+
905
"SuppressWarnings|TypeNotPresentException|UnknownError|"+
906
"UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|"+
907
"InstantiationException|IndexOutOfBoundsException|"+
908
"ArrayIndexOutOfBoundsException|CloneNotSupportedException|"+
909
"NoSuchFieldException|IllegalArgumentException|NumberFormatException|"+
910
"SecurityException|Void|InheritableThreadLocal|IllegalStateException|"+
911
"InterruptedException|NoSuchMethodException|IllegalAccessException|"+
912
"UnsupportedOperationException|Enum|StrictMath|Package|Compiler|"+
913
"Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|"+
914
"NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|"+
915
"NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|"+
916
"Character|Boolean|StackTraceElement|Appendable|StringBuffer|"+
917
"Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|"+
918
"StackOverflowError|OutOfMemoryError|VirtualMachineError|"+
919
"ArrayStoreException|ClassCastException|LinkageError|"+
920
"NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+
921
"Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+
922
"Cloneable|Class|CharSequence|Comparable|String|Object"
925
var keywordMapper = this.createKeywordMapper({
926
"variable.language": "this",
928
"support.function": langClasses,
929
"constant.language": buildinConstants
938
DocCommentHighlightRules.getStartRule("doc-start"),
940
token : "comment", // multi line comment
944
token : "string.regexp",
945
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
955
token : "string", // single line
956
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
958
token : "string", // single line
959
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
961
token : "constant.numeric", // hex
962
regex : "0[xX][0-9a-fA-F]+\\b"
964
token : "constant.numeric", // float
965
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
967
token : "constant.language.boolean",
968
regex : "(?:true|false)\\b"
970
token : keywordMapper,
971
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
973
token : "keyword.operator",
974
regex : "\\?:|\\?\\.|\\*\\.|<=>|=~|==~|\\.@|\\*\\.@|\\.&|as|in|is|!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
988
token : "comment", // closing comment
992
token : "comment", // comment spanning whole line
998
token : "constant.language.escape",
999
regex : /\\(?:u[0-9A-Fa-f]{4}|.|$)/
1001
token : "constant.language.escape",
1004
token : "constant.language.escape",
1005
regex : /\$\{[^"\}]+\}?/
1017
token : "constant.language.escape",
1018
regex : /\\(?:u[0-9A-Fa-f]{4}|.|$)/
1030
this.embedRules(DocCommentHighlightRules, "doc-",
1031
[ DocCommentHighlightRules.getEndRule("start") ]);
1034
oop.inherits(GroovyHighlightRules, TextHighlightRules);
1036
exports.GroovyHighlightRules = GroovyHighlightRules;