| 1 |
define('ace/mode/java', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/javascript', 'ace/tokenizer', 'ace/mode/java_highlight_rules'], function(require, exports, module) { |
| 2 |
|
| 3 |
|
| 4 |
var oop = require("../lib/oop"); |
| 5 |
var JavaScriptMode = require("./javascript").Mode; |
| 6 |
var Tokenizer = require("../tokenizer").Tokenizer; |
| 7 |
var JavaHighlightRules = require("./java_highlight_rules").JavaHighlightRules; |
| 8 |
|
| 9 |
var Mode = function() { |
| 10 |
JavaScriptMode.call(this); |
| 11 |
|
| 12 |
this.$tokenizer = new Tokenizer(new JavaHighlightRules().getRules()); |
| 13 |
}; |
| 14 |
oop.inherits(Mode, JavaScriptMode); |
| 15 |
|
| 16 |
(function() { |
| 17 |
|
| 18 |
this.createWorker = function(session) { |
| 19 |
return null; |
| 20 |
}; |
| 21 |
|
| 22 |
}).call(Mode.prototype); |
| 23 |
|
| 24 |
exports.Mode = Mode; |
| 25 |
}); |
| 26 |
|
| 27 |
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) { |
| 28 |
|
| 29 |
|
| 30 |
var oop = require("../lib/oop"); |
| 31 |
var TextMode = require("./text").Mode; |
| 32 |
var Tokenizer = require("../tokenizer").Tokenizer; |
| 33 |
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; |
| 34 |
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; |
| 35 |
var Range = require("../range").Range; |
| 36 |
var WorkerClient = require("../worker/worker_client").WorkerClient; |
| 37 |
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; |
| 38 |
var CStyleFoldMode = require("./folding/cstyle").FoldMode; |
| 39 |
|
| 40 |
var Mode = function() { |
| 41 |
this.$tokenizer = new Tokenizer(new JavaScriptHighlightRules().getRules()); |
| 42 |
this.$outdent = new MatchingBraceOutdent(); |
| 43 |
this.$behaviour = new CstyleBehaviour(); |
| 44 |
this.foldingRules = new CStyleFoldMode(); |
| 45 |
}; |
| 46 |
oop.inherits(Mode, TextMode); |
| 47 |
|
| 48 |
(function() { |
| 49 |
|
| 50 |
|
| 51 |
this.toggleCommentLines = function(state, doc, startRow, endRow) { |
| 52 |
var outdent = true; |
| 53 |
var re = /^(\s*)\/\//; |
| 54 |
|
| 55 |
for (var i=startRow; i<= endRow; i++) { |
| 56 |
if (!re.test(doc.getLine(i))) { |
| 57 |
outdent = false; |
| 58 |
break; |
| 59 |
} |
| 60 |
} |
| 61 |
|
| 62 |
if (outdent) { |
| 63 |
var deleteRange = new Range(0, 0, 0, 0); |
| 64 |
for (var i=startRow; i<= endRow; i++) |
| 65 |
{ |
| 66 |
var line = doc.getLine(i); |
| 67 |
var m = line.match(re); |
| 68 |
deleteRange.start.row = i; |
| 69 |
deleteRange.end.row = i; |
| 70 |
deleteRange.end.column = m[0].length; |
| 71 |
doc.replace(deleteRange, m[1]); |
| 72 |
} |
| 73 |
} |
| 74 |
else { |
| 75 |
doc.indentRows(startRow, endRow, "//"); |
| 76 |
} |
| 77 |
}; |
| 78 |
|
| 79 |
this.getNextLineIndent = function(state, line, tab) { |
| 80 |
var indent = this.$getIndent(line); |
| 81 |
|
| 82 |
var tokenizedLine = this.$tokenizer.getLineTokens(line, state); |
| 83 |
var tokens = tokenizedLine.tokens; |
| 84 |
var endState = tokenizedLine.state; |
| 85 |
|
| 86 |
if (tokens.length && tokens[tokens.length-1].type == "comment") { |
| 87 |
return indent; |
| 88 |
} |
| 89 |
|
| 90 |
if (state == "start" || state == "regex_allowed") { |
| 91 |
var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/); |
| 92 |
if (match) { |
| 93 |
indent += tab; |
| 94 |
} |
| 95 |
} else if (state == "doc-start") { |
| 96 |
if (endState == "start" || state == "regex_allowed") { |
| 97 |
return ""; |
| 98 |
} |
| 99 |
var match = line.match(/^\s*(\/?)\*/); |
| 100 |
if (match) { |
| 101 |
if (match[1]) { |
| 102 |
indent += " "; |
| 103 |
} |
| 104 |
indent += "* "; |
| 105 |
} |
| 106 |
} |
| 107 |
|
| 108 |
return indent; |
| 109 |
}; |
| 110 |
|
| 111 |
this.checkOutdent = function(state, line, input) { |
| 112 |
return this.$outdent.checkOutdent(line, input); |
| 113 |
}; |
| 114 |
|
| 115 |
this.autoOutdent = function(state, doc, row) { |
| 116 |
this.$outdent.autoOutdent(doc, row); |
| 117 |
}; |
| 118 |
|
| 119 |
this.createWorker = function(session) { |
| 120 |
var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker"); |
| 121 |
worker.attachToDocument(session.getDocument()); |
| 122 |
|
| 123 |
worker.on("jslint", function(results) { |
| 124 |
session.setAnnotations(results.data); |
| 125 |
}); |
| 126 |
|
| 127 |
worker.on("terminate", function() { |
| 128 |
session.clearAnnotations(); |
| 129 |
}); |
| 130 |
|
| 131 |
return worker; |
| 132 |
}; |
| 133 |
|
| 134 |
}).call(Mode.prototype); |
| 135 |
|
| 136 |
exports.Mode = Mode; |
| 137 |
}); |
| 138 |
|
| 139 |
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) { |
| 140 |
|
| 141 |
|
| 142 |
var oop = require("../lib/oop"); |
| 143 |
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; |
| 144 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 145 |
|
| 146 |
var JavaScriptHighlightRules = function() { |
| 147 |
var keywordMapper = this.createKeywordMapper({ |
| 148 |
"variable.language": |
| 149 |
"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors |
| 150 |
"Namespace|QName|XML|XMLList|" + // E4X |
| 151 |
"ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + |
| 152 |
"Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" + |
| 153 |
"Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors |
| 154 |
"SyntaxError|TypeError|URIError|" + |
| 155 |
"decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions |
| 156 |
"isNaN|parseFloat|parseInt|" + |
| 157 |
"JSON|Math|" + // Other |
| 158 |
"this|arguments|prototype|window|document" , // Pseudo |
| 159 |
"keyword": |
| 160 |
"const|yield|import|get|set|" + |
| 161 |
"break|case|catch|continue|default|delete|do|else|finally|for|function|" + |
| 162 |
"if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" + |
| 163 |
"__parent__|__count__|escape|unescape|with|__proto__|" + |
| 164 |
"class|enum|extends|super|export|implements|private|public|interface|package|protected|static", |
| 165 |
"storage.type": |
| 166 |
"const|let|var|function", |
| 167 |
"constant.language": |
| 168 |
"null|Infinity|NaN|undefined", |
| 169 |
"support.function": |
| 170 |
"alert" |
| 171 |
}, "identifier"); |
| 172 |
var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield"; |
| 173 |
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b"; |
| 174 |
|
| 175 |
var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex |
| 176 |
"u[0-9a-fA-F]{4}|" + // unicode |
| 177 |
"[0-2][0-7]{0,2}|" + // oct |
| 178 |
"3[0-6][0-7]?|" + // oct |
| 179 |
"37[0-7]?|" + // oct |
| 180 |
"[4-7][0-7]?|" + //oct |
| 181 |
".)"; |
| 182 |
|
| 183 |
this.$rules = { |
| 184 |
"start" : [ |
| 185 |
{ |
| 186 |
token : "comment", |
| 187 |
regex : /\/\/.*$/ |
| 188 |
}, |
| 189 |
DocCommentHighlightRules.getStartRule("doc-start"), |
| 190 |
{ |
| 191 |
token : "comment", // multi line comment |
| 192 |
merge : true, |
| 193 |
regex : /\/\*/, |
| 194 |
next : "comment" |
| 195 |
}, { |
| 196 |
token : "string", |
| 197 |
regex : "'(?=.)", |
| 198 |
next : "qstring" |
| 199 |
}, { |
| 200 |
token : "string", |
| 201 |
regex : '"(?=.)', |
| 202 |
next : "qqstring" |
| 203 |
}, { |
| 204 |
token : "constant.numeric", // hex |
| 205 |
regex : /0[xX][0-9a-fA-F]+\b/ |
| 206 |
}, { |
| 207 |
token : "constant.numeric", // float |
| 208 |
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/ |
| 209 |
}, { |
| 210 |
token : [ |
| 211 |
"storage.type", "punctuation.operator", "support.function", |
| 212 |
"punctuation.operator", "entity.name.function", "text","keyword.operator" |
| 213 |
], |
| 214 |
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)", |
| 215 |
next: "function_arguments" |
| 216 |
}, { |
| 217 |
token : [ |
| 218 |
"storage.type", "punctuation.operator", "entity.name.function", "text", |
| 219 |
"keyword.operator", "text", "storage.type", "text", "paren.lparen" |
| 220 |
], |
| 221 |
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", |
| 222 |
next: "function_arguments" |
| 223 |
}, { |
| 224 |
token : [ |
| 225 |
"entity.name.function", "text", "keyword.operator", "text", "storage.type", |
| 226 |
"text", "paren.lparen" |
| 227 |
], |
| 228 |
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()", |
| 229 |
next: "function_arguments" |
| 230 |
}, { |
| 231 |
token : [ |
| 232 |
"storage.type", "punctuation.operator", "entity.name.function", "text", |
| 233 |
"keyword.operator", "text", |
| 234 |
"storage.type", "text", "entity.name.function", "text", "paren.lparen" |
| 235 |
], |
| 236 |
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()", |
| 237 |
next: "function_arguments" |
| 238 |
}, { |
| 239 |
token : [ |
| 240 |
"storage.type", "text", "entity.name.function", "text", "paren.lparen" |
| 241 |
], |
| 242 |
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()", |
| 243 |
next: "function_arguments" |
| 244 |
}, { |
| 245 |
token : [ |
| 246 |
"entity.name.function", "text", "punctuation.operator", |
| 247 |
"text", "storage.type", "text", "paren.lparen" |
| 248 |
], |
| 249 |
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()", |
| 250 |
next: "function_arguments" |
| 251 |
}, { |
| 252 |
token : [ |
| 253 |
"text", "text", "storage.type", "text", "paren.lparen" |
| 254 |
], |
| 255 |
regex : "(:)(\\s*)(function)(\\s*)(\\()", |
| 256 |
next: "function_arguments" |
| 257 |
}, { |
| 258 |
token : "constant.language.boolean", |
| 259 |
regex : /(?:true|false)\b/ |
| 260 |
}, { |
| 261 |
token : "keyword", |
| 262 |
regex : "(?:" + kwBeforeRe + ")\\b", |
| 263 |
next : "regex_allowed" |
| 264 |
}, { |
| 265 |
token : ["punctuation.operator", "support.function"], |
| 266 |
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(?=\()/ |
| 267 |
}, { |
| 268 |
token : ["punctuation.operator", "support.function.dom"], |
| 269 |
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(?=\()/ |
| 270 |
}, { |
| 271 |
token : ["punctuation.operator", "support.constant"], |
| 272 |
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/ |
| 273 |
}, { |
| 274 |
token : ["storage.type", "punctuation.operator", "support.function.firebug"], |
| 275 |
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/ |
| 276 |
}, { |
| 277 |
token : keywordMapper, |
| 278 |
regex : identifierRe |
| 279 |
}, { |
| 280 |
token : "keyword.operator", |
| 281 |
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/, |
| 282 |
next : "regex_allowed" |
| 283 |
}, { |
| 284 |
token : "punctuation.operator", |
| 285 |
regex : /\?|\:|\,|\;|\./, |
| 286 |
next : "regex_allowed" |
| 287 |
}, { |
| 288 |
token : "paren.lparen", |
| 289 |
regex : /[\[({]/, |
| 290 |
next : "regex_allowed" |
| 291 |
}, { |
| 292 |
token : "paren.rparen", |
| 293 |
regex : /[\])}]/ |
| 294 |
}, { |
| 295 |
token : "keyword.operator", |
| 296 |
regex : /\/=?/, |
| 297 |
next : "regex_allowed" |
| 298 |
}, { |
| 299 |
token: "comment", |
| 300 |
regex: /^#!.*$/ |
| 301 |
}, { |
| 302 |
token : "text", |
| 303 |
regex : /\s+/ |
| 304 |
} |
| 305 |
], |
| 306 |
"regex_allowed": [ |
| 307 |
DocCommentHighlightRules.getStartRule("doc-start"), |
| 308 |
{ |
| 309 |
token : "comment", // multi line comment |
| 310 |
merge : true, |
| 311 |
regex : "\\/\\*", |
| 312 |
next : "comment_regex_allowed" |
| 313 |
}, { |
| 314 |
token : "comment", |
| 315 |
regex : "\\/\\/.*$" |
| 316 |
}, { |
| 317 |
token: "string.regexp", |
| 318 |
regex: "\\/", |
| 319 |
next: "regex", |
| 320 |
merge: true |
| 321 |
}, { |
| 322 |
token : "text", |
| 323 |
regex : "\\s+" |
| 324 |
}, { |
| 325 |
token: "empty", |
| 326 |
regex: "", |
| 327 |
next: "start" |
| 328 |
} |
| 329 |
], |
| 330 |
"regex": [ |
| 331 |
{ |
| 332 |
token: "regexp.keyword.operator", |
| 333 |
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" |
| 334 |
}, { |
| 335 |
token: "string.regexp", |
| 336 |
regex: "/\\w*", |
| 337 |
next: "start", |
| 338 |
merge: true |
| 339 |
}, { |
| 340 |
token : "invalid", |
| 341 |
regex: /\{\d+,?(?:\d+)?}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ |
| 342 |
}, { |
| 343 |
token : "constant.language.escape", |
| 344 |
regex: /\(\?[:=!]|\)|{\d+,?(?:\d+)?}|{,\d+}|[+*]\?|[(|)$^+*?]/ |
| 345 |
}, { |
| 346 |
token: "string.regexp", |
| 347 |
regex: /{|[^{\[\/\\(|)$^+*?]+/, |
| 348 |
merge: true |
| 349 |
}, { |
| 350 |
token: "constant.language.escape", |
| 351 |
regex: /\[\^?/, |
| 352 |
next: "regex_character_class", |
| 353 |
merge: true |
| 354 |
}, { |
| 355 |
token: "empty", |
| 356 |
regex: "", |
| 357 |
next: "start" |
| 358 |
} |
| 359 |
], |
| 360 |
"regex_character_class": [ |
| 361 |
{ |
| 362 |
token: "regexp.keyword.operator", |
| 363 |
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" |
| 364 |
}, { |
| 365 |
token: "constant.language.escape", |
| 366 |
regex: "]", |
| 367 |
next: "regex", |
| 368 |
merge: true |
| 369 |
}, { |
| 370 |
token: "constant.language.escape", |
| 371 |
regex: "-" |
| 372 |
}, { |
| 373 |
token: "string.regexp.charachterclass", |
| 374 |
regex: /[^\]\-\\]+/, |
| 375 |
merge: true |
| 376 |
}, { |
| 377 |
token: "empty", |
| 378 |
regex: "", |
| 379 |
next: "start" |
| 380 |
} |
| 381 |
], |
| 382 |
"function_arguments": [ |
| 383 |
{ |
| 384 |
token: "variable.parameter", |
| 385 |
regex: identifierRe |
| 386 |
}, { |
| 387 |
token: "punctuation.operator", |
| 388 |
regex: "[, ]+", |
| 389 |
merge: true |
| 390 |
}, { |
| 391 |
token: "punctuation.operator", |
| 392 |
regex: "$", |
| 393 |
merge: true |
| 394 |
}, { |
| 395 |
token: "empty", |
| 396 |
regex: "", |
| 397 |
next: "start" |
| 398 |
} |
| 399 |
], |
| 400 |
"comment_regex_allowed" : [ |
| 401 |
{ |
| 402 |
token : "comment", // closing comment |
| 403 |
regex : ".*?\\*\\/", |
| 404 |
merge : true, |
| 405 |
next : "regex_allowed" |
| 406 |
}, { |
| 407 |
token : "comment", // comment spanning whole line |
| 408 |
merge : true, |
| 409 |
regex : ".+" |
| 410 |
} |
| 411 |
], |
| 412 |
"comment" : [ |
| 413 |
{ |
| 414 |
token : "comment", // closing comment |
| 415 |
regex : ".*?\\*\\/", |
| 416 |
merge : true, |
| 417 |
next : "start" |
| 418 |
}, { |
| 419 |
token : "comment", // comment spanning whole line |
| 420 |
merge : true, |
| 421 |
regex : ".+" |
| 422 |
} |
| 423 |
], |
| 424 |
"qqstring" : [ |
| 425 |
{ |
| 426 |
token : "constant.language.escape", |
| 427 |
regex : escapedRe |
| 428 |
}, { |
| 429 |
token : "string", |
| 430 |
regex : '[^"\\\\]+', |
| 431 |
merge : true |
| 432 |
}, { |
| 433 |
token : "string", |
| 434 |
regex : "\\\\$", |
| 435 |
next : "qqstring", |
| 436 |
merge : true |
| 437 |
}, { |
| 438 |
token : "string", |
| 439 |
regex : '"|$', |
| 440 |
next : "start", |
| 441 |
merge : true |
| 442 |
} |
| 443 |
], |
| 444 |
"qstring" : [ |
| 445 |
{ |
| 446 |
token : "constant.language.escape", |
| 447 |
regex : escapedRe |
| 448 |
}, { |
| 449 |
token : "string", |
| 450 |
regex : "[^'\\\\]+", |
| 451 |
merge : true |
| 452 |
}, { |
| 453 |
token : "string", |
| 454 |
regex : "\\\\$", |
| 455 |
next : "qstring", |
| 456 |
merge : true |
| 457 |
}, { |
| 458 |
token : "string", |
| 459 |
regex : "'|$", |
| 460 |
next : "start", |
| 461 |
merge : true |
| 462 |
} |
| 463 |
] |
| 464 |
}; |
| 465 |
|
| 466 |
this.embedRules(DocCommentHighlightRules, "doc-", |
| 467 |
[ DocCommentHighlightRules.getEndRule("start") ]); |
| 468 |
}; |
| 469 |
|
| 470 |
oop.inherits(JavaScriptHighlightRules, TextHighlightRules); |
| 471 |
|
| 472 |
exports.JavaScriptHighlightRules = JavaScriptHighlightRules; |
| 473 |
}); |
| 474 |
|
| 475 |
define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) { |
| 476 |
|
| 477 |
|
| 478 |
var oop = require("../lib/oop"); |
| 479 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 480 |
|
| 481 |
var DocCommentHighlightRules = function() { |
| 482 |
|
| 483 |
this.$rules = { |
| 484 |
"start" : [ { |
| 485 |
token : "comment.doc.tag", |
| 486 |
regex : "@[\\w\\d_]+" // TODO: fix email addresses |
| 487 |
}, { |
| 488 |
token : "comment.doc", |
| 489 |
merge : true, |
| 490 |
regex : "\\s+" |
| 491 |
}, { |
| 492 |
token : "comment.doc", |
| 493 |
merge : true, |
| 494 |
regex : "TODO" |
| 495 |
}, { |
| 496 |
token : "comment.doc", |
| 497 |
merge : true, |
| 498 |
regex : "[^@\\*]+" |
| 499 |
}, { |
| 500 |
token : "comment.doc", |
| 501 |
merge : true, |
| 502 |
regex : "." |
| 503 |
}] |
| 504 |
}; |
| 505 |
}; |
| 506 |
|
| 507 |
oop.inherits(DocCommentHighlightRules, TextHighlightRules); |
| 508 |
|
| 509 |
DocCommentHighlightRules.getStartRule = function(start) { |
| 510 |
return { |
| 511 |
token : "comment.doc", // doc comment |
| 512 |
merge : true, |
| 513 |
regex : "\\/\\*(?=\\*)", |
| 514 |
next : start |
| 515 |
}; |
| 516 |
}; |
| 517 |
|
| 518 |
DocCommentHighlightRules.getEndRule = function (start) { |
| 519 |
return { |
| 520 |
token : "comment.doc", // closing comment |
| 521 |
merge : true, |
| 522 |
regex : "\\*\\/", |
| 523 |
next : start |
| 524 |
}; |
| 525 |
}; |
| 526 |
|
| 527 |
|
| 528 |
exports.DocCommentHighlightRules = DocCommentHighlightRules; |
| 529 |
|
| 530 |
}); |
| 531 |
|
| 532 |
define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) { |
| 533 |
|
| 534 |
|
| 535 |
var Range = require("../range").Range; |
| 536 |
|
| 537 |
var MatchingBraceOutdent = function() {}; |
| 538 |
|
| 539 |
(function() { |
| 540 |
|
| 541 |
this.checkOutdent = function(line, input) { |
| 542 |
if (! /^\s+$/.test(line)) |
| 543 |
return false; |
| 544 |
|
| 545 |
return /^\s*\}/.test(input); |
| 546 |
}; |
| 547 |
|
| 548 |
this.autoOutdent = function(doc, row) { |
| 549 |
var line = doc.getLine(row); |
| 550 |
var match = line.match(/^(\s*\})/); |
| 551 |
|
| 552 |
if (!match) return 0; |
| 553 |
|
| 554 |
var column = match[1].length; |
| 555 |
var openBracePos = doc.findMatchingBracket({row: row, column: column}); |
| 556 |
|
| 557 |
if (!openBracePos || openBracePos.row == row) return 0; |
| 558 |
|
| 559 |
var indent = this.$getIndent(doc.getLine(openBracePos.row)); |
| 560 |
doc.replace(new Range(row, 0, row, column-1), indent); |
| 561 |
}; |
| 562 |
|
| 563 |
this.$getIndent = function(line) { |
| 564 |
var match = line.match(/^(\s+)/); |
| 565 |
if (match) { |
| 566 |
return match[1]; |
| 567 |
} |
| 568 |
|
| 569 |
return ""; |
| 570 |
}; |
| 571 |
|
| 572 |
}).call(MatchingBraceOutdent.prototype); |
| 573 |
|
| 574 |
exports.MatchingBraceOutdent = MatchingBraceOutdent; |
| 575 |
}); |
| 576 |
|
| 577 |
define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/token_iterator', 'ace/lib/lang'], function(require, exports, module) { |
| 578 |
|
| 579 |
|
| 580 |
var oop = require("../../lib/oop"); |
| 581 |
var Behaviour = require("../behaviour").Behaviour; |
| 582 |
var TokenIterator = require("../../token_iterator").TokenIterator; |
| 583 |
var lang = require("../../lib/lang"); |
| 584 |
|
| 585 |
var SAFE_INSERT_IN_TOKENS = |
| 586 |
["text", "paren.rparen", "punctuation.operator"]; |
| 587 |
var SAFE_INSERT_BEFORE_TOKENS = |
| 588 |
["text", "paren.rparen", "punctuation.operator", "comment"]; |
| 589 |
|
| 590 |
|
| 591 |
var autoInsertedBrackets = 0; |
| 592 |
var autoInsertedRow = -1; |
| 593 |
var autoInsertedLineEnd = ""; |
| 594 |
var maybeInsertedBrackets = 0; |
| 595 |
var maybeInsertedRow = -1; |
| 596 |
var maybeInsertedLineStart = ""; |
| 597 |
var maybeInsertedLineEnd = ""; |
| 598 |
|
| 599 |
var CstyleBehaviour = function () { |
| 600 |
|
| 601 |
CstyleBehaviour.isSaneInsertion = function(editor, session) { |
| 602 |
var cursor = editor.getCursorPosition(); |
| 603 |
var iterator = new TokenIterator(session, cursor.row, cursor.column); |
| 604 |
if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { |
| 605 |
var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); |
| 606 |
if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) |
| 607 |
return false; |
| 608 |
} |
| 609 |
iterator.stepForward(); |
| 610 |
return iterator.getCurrentTokenRow() !== cursor.row || |
| 611 |
this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); |
| 612 |
}; |
| 613 |
|
| 614 |
CstyleBehaviour.$matchTokenType = function(token, types) { |
| 615 |
return types.indexOf(token.type || token) > -1; |
| 616 |
}; |
| 617 |
|
| 618 |
CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { |
| 619 |
var cursor = editor.getCursorPosition(); |
| 620 |
var line = session.doc.getLine(cursor.row); |
| 621 |
if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0])) |
| 622 |
autoInsertedBrackets = 0; |
| 623 |
autoInsertedRow = cursor.row; |
| 624 |
autoInsertedLineEnd = bracket + line.substr(cursor.column); |
| 625 |
autoInsertedBrackets++; |
| 626 |
}; |
| 627 |
|
| 628 |
CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { |
| 629 |
var cursor = editor.getCursorPosition(); |
| 630 |
var line = session.doc.getLine(cursor.row); |
| 631 |
if (!this.isMaybeInsertedClosing(cursor, line)) |
| 632 |
maybeInsertedBrackets = 0; |
| 633 |
maybeInsertedRow = cursor.row; |
| 634 |
maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; |
| 635 |
maybeInsertedLineEnd = line.substr(cursor.column); |
| 636 |
maybeInsertedBrackets++; |
| 637 |
}; |
| 638 |
|
| 639 |
CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { |
| 640 |
return autoInsertedBrackets > 0 && |
| 641 |
cursor.row === autoInsertedRow && |
| 642 |
bracket === autoInsertedLineEnd[0] && |
| 643 |
line.substr(cursor.column) === autoInsertedLineEnd; |
| 644 |
}; |
| 645 |
|
| 646 |
CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { |
| 647 |
return maybeInsertedBrackets > 0 && |
| 648 |
cursor.row === maybeInsertedRow && |
| 649 |
line.substr(cursor.column) === maybeInsertedLineEnd && |
| 650 |
line.substr(0, cursor.column) == maybeInsertedLineStart; |
| 651 |
}; |
| 652 |
|
| 653 |
CstyleBehaviour.popAutoInsertedClosing = function() { |
| 654 |
autoInsertedLineEnd = autoInsertedLineEnd.substr(1); |
| 655 |
autoInsertedBrackets--; |
| 656 |
}; |
| 657 |
|
| 658 |
CstyleBehaviour.clearMaybeInsertedClosing = function() { |
| 659 |
maybeInsertedBrackets = 0; |
| 660 |
maybeInsertedRow = -1; |
| 661 |
}; |
| 662 |
|
| 663 |
this.add("braces", "insertion", function (state, action, editor, session, text) { |
| 664 |
var cursor = editor.getCursorPosition(); |
| 665 |
var line = session.doc.getLine(cursor.row); |
| 666 |
if (text == '{') { |
| 667 |
var selection = editor.getSelectionRange(); |
| 668 |
var selected = session.doc.getTextRange(selection); |
| 669 |
if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { |
| 670 |
return { |
| 671 |
text: '{' + selected + '}', |
| 672 |
selection: false |
| 673 |
}; |
| 674 |
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) { |
| 675 |
if (/[\]\}\)]/.test(line[cursor.column])) { |
| 676 |
CstyleBehaviour.recordAutoInsert(editor, session, "}"); |
| 677 |
return { |
| 678 |
text: '{}', |
| 679 |
selection: [1, 1] |
| 680 |
}; |
| 681 |
} else { |
| 682 |
CstyleBehaviour.recordMaybeInsert(editor, session, "{"); |
| 683 |
return { |
| 684 |
text: '{', |
| 685 |
selection: [1, 1] |
| 686 |
}; |
| 687 |
} |
| 688 |
} |
| 689 |
} else if (text == '}') { |
| 690 |
var rightChar = line.substring(cursor.column, cursor.column + 1); |
| 691 |
if (rightChar == '}') { |
| 692 |
var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row}); |
| 693 |
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { |
| 694 |
CstyleBehaviour.popAutoInsertedClosing(); |
| 695 |
return { |
| 696 |
text: '', |
| 697 |
selection: [1, 1] |
| 698 |
}; |
| 699 |
} |
| 700 |
} |
| 701 |
} else if (text == "\n" || text == "\r\n") { |
| 702 |
var closing = ""; |
| 703 |
if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { |
| 704 |
closing = lang.stringRepeat("}", maybeInsertedBrackets); |
| 705 |
CstyleBehaviour.clearMaybeInsertedClosing(); |
| 706 |
} |
| 707 |
var rightChar = line.substring(cursor.column, cursor.column + 1); |
| 708 |
if (rightChar == '}' || closing !== "") { |
| 709 |
var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}'); |
| 710 |
if (!openBracePos) |
| 711 |
return null; |
| 712 |
|
| 713 |
var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString()); |
| 714 |
var next_indent = this.$getIndent(line); |
| 715 |
|
| 716 |
return { |
| 717 |
text: '\n' + indent + '\n' + next_indent + closing, |
| 718 |
selection: [1, indent.length, 1, indent.length] |
| 719 |
}; |
| 720 |
} |
| 721 |
} |
| 722 |
}); |
| 723 |
|
| 724 |
this.add("braces", "deletion", function (state, action, editor, session, range) { |
| 725 |
var selected = session.doc.getTextRange(range); |
| 726 |
if (!range.isMultiLine() && selected == '{') { |
| 727 |
var line = session.doc.getLine(range.start.row); |
| 728 |
var rightChar = line.substring(range.end.column, range.end.column + 1); |
| 729 |
if (rightChar == '}') { |
| 730 |
range.end.column++; |
| 731 |
return range; |
| 732 |
} else { |
| 733 |
maybeInsertedBrackets--; |
| 734 |
} |
| 735 |
} |
| 736 |
}); |
| 737 |
|
| 738 |
this.add("parens", "insertion", function (state, action, editor, session, text) { |
| 739 |
if (text == '(') { |
| 740 |
var selection = editor.getSelectionRange(); |
| 741 |
var selected = session.doc.getTextRange(selection); |
| 742 |
if (selected !== "" && editor.getWrapBehavioursEnabled()) { |
| 743 |
return { |
| 744 |
text: '(' + selected + ')', |
| 745 |
selection: false |
| 746 |
}; |
| 747 |
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) { |
| 748 |
CstyleBehaviour.recordAutoInsert(editor, session, ")"); |
| 749 |
return { |
| 750 |
text: '()', |
| 751 |
selection: [1, 1] |
| 752 |
}; |
| 753 |
} |
| 754 |
} else if (text == ')') { |
| 755 |
var cursor = editor.getCursorPosition(); |
| 756 |
var line = session.doc.getLine(cursor.row); |
| 757 |
var rightChar = line.substring(cursor.column, cursor.column + 1); |
| 758 |
if (rightChar == ')') { |
| 759 |
var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row}); |
| 760 |
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { |
| 761 |
CstyleBehaviour.popAutoInsertedClosing(); |
| 762 |
return { |
| 763 |
text: '', |
| 764 |
selection: [1, 1] |
| 765 |
}; |
| 766 |
} |
| 767 |
} |
| 768 |
} |
| 769 |
}); |
| 770 |
|
| 771 |
this.add("parens", "deletion", function (state, action, editor, session, range) { |
| 772 |
var selected = session.doc.getTextRange(range); |
| 773 |
if (!range.isMultiLine() && selected == '(') { |
| 774 |
var line = session.doc.getLine(range.start.row); |
| 775 |
var rightChar = line.substring(range.start.column + 1, range.start.column + 2); |
| 776 |
if (rightChar == ')') { |
| 777 |
range.end.column++; |
| 778 |
return range; |
| 779 |
} |
| 780 |
} |
| 781 |
}); |
| 782 |
|
| 783 |
this.add("brackets", "insertion", function (state, action, editor, session, text) { |
| 784 |
if (text == '[') { |
| 785 |
var selection = editor.getSelectionRange(); |
| 786 |
var selected = session.doc.getTextRange(selection); |
| 787 |
if (selected !== "" && editor.getWrapBehavioursEnabled()) { |
| 788 |
return { |
| 789 |
text: '[' + selected + ']', |
| 790 |
selection: false |
| 791 |
}; |
| 792 |
} else if (CstyleBehaviour.isSaneInsertion(editor, session)) { |
| 793 |
CstyleBehaviour.recordAutoInsert(editor, session, "]"); |
| 794 |
return { |
| 795 |
text: '[]', |
| 796 |
selection: [1, 1] |
| 797 |
}; |
| 798 |
} |
| 799 |
} else if (text == ']') { |
| 800 |
var cursor = editor.getCursorPosition(); |
| 801 |
var line = session.doc.getLine(cursor.row); |
| 802 |
var rightChar = line.substring(cursor.column, cursor.column + 1); |
| 803 |
if (rightChar == ']') { |
| 804 |
var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row}); |
| 805 |
if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { |
| 806 |
CstyleBehaviour.popAutoInsertedClosing(); |
| 807 |
return { |
| 808 |
text: '', |
| 809 |
selection: [1, 1] |
| 810 |
}; |
| 811 |
} |
| 812 |
} |
| 813 |
} |
| 814 |
}); |
| 815 |
|
| 816 |
this.add("brackets", "deletion", function (state, action, editor, session, range) { |
| 817 |
var selected = session.doc.getTextRange(range); |
| 818 |
if (!range.isMultiLine() && selected == '[') { |
| 819 |
var line = session.doc.getLine(range.start.row); |
| 820 |
var rightChar = line.substring(range.start.column + 1, range.start.column + 2); |
| 821 |
if (rightChar == ']') { |
| 822 |
range.end.column++; |
| 823 |
return range; |
| 824 |
} |
| 825 |
} |
| 826 |
}); |
| 827 |
|
| 828 |
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) { |
| 829 |
if (text == '"' || text == "'") { |
| 830 |
var quote = text; |
| 831 |
var selection = editor.getSelectionRange(); |
| 832 |
var selected = session.doc.getTextRange(selection); |
| 833 |
if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { |
| 834 |
return { |
| 835 |
text: quote + selected + quote, |
| 836 |
selection: false |
| 837 |
}; |
| 838 |
} else { |
| 839 |
var cursor = editor.getCursorPosition(); |
| 840 |
var line = session.doc.getLine(cursor.row); |
| 841 |
var leftChar = line.substring(cursor.column-1, cursor.column); |
| 842 |
if (leftChar == '\\') { |
| 843 |
return null; |
| 844 |
} |
| 845 |
var tokens = session.getTokens(selection.start.row); |
| 846 |
var col = 0, token; |
| 847 |
var quotepos = -1; // Track whether we're inside an open quote. |
| 848 |
|
| 849 |
for (var x = 0; x < tokens.length; x++) { |
| 850 |
token = tokens[x]; |
| 851 |
if (token.type == "string") { |
| 852 |
quotepos = -1; |
| 853 |
} else if (quotepos < 0) { |
| 854 |
quotepos = token.value.indexOf(quote); |
| 855 |
} |
| 856 |
if ((token.value.length + col) > selection.start.column) { |
| 857 |
break; |
| 858 |
} |
| 859 |
col += tokens[x].value.length; |
| 860 |
} |
| 861 |
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)))) { |
| 862 |
if (!CstyleBehaviour.isSaneInsertion(editor, session)) |
| 863 |
return; |
| 864 |
return { |
| 865 |
text: quote + quote, |
| 866 |
selection: [1,1] |
| 867 |
}; |
| 868 |
} else if (token && token.type === "string") { |
| 869 |
var rightChar = line.substring(cursor.column, cursor.column + 1); |
| 870 |
if (rightChar == quote) { |
| 871 |
return { |
| 872 |
text: '', |
| 873 |
selection: [1, 1] |
| 874 |
}; |
| 875 |
} |
| 876 |
} |
| 877 |
} |
| 878 |
} |
| 879 |
}); |
| 880 |
|
| 881 |
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) { |
| 882 |
var selected = session.doc.getTextRange(range); |
| 883 |
if (!range.isMultiLine() && (selected == '"' || selected == "'")) { |
| 884 |
var line = session.doc.getLine(range.start.row); |
| 885 |
var rightChar = line.substring(range.start.column + 1, range.start.column + 2); |
| 886 |
if (rightChar == '"') { |
| 887 |
range.end.column++; |
| 888 |
return range; |
| 889 |
} |
| 890 |
} |
| 891 |
}); |
| 892 |
|
| 893 |
}; |
| 894 |
|
| 895 |
oop.inherits(CstyleBehaviour, Behaviour); |
| 896 |
|
| 897 |
exports.CstyleBehaviour = CstyleBehaviour; |
| 898 |
}); |
| 899 |
|
| 900 |
define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) { |
| 901 |
|
| 902 |
|
| 903 |
var oop = require("../../lib/oop"); |
| 904 |
var Range = require("../../range").Range; |
| 905 |
var BaseFoldMode = require("./fold_mode").FoldMode; |
| 906 |
|
| 907 |
var FoldMode = exports.FoldMode = function() {}; |
| 908 |
oop.inherits(FoldMode, BaseFoldMode); |
| 909 |
|
| 910 |
(function() { |
| 911 |
|
| 912 |
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/; |
| 913 |
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/; |
| 914 |
|
| 915 |
this.getFoldWidgetRange = function(session, foldStyle, row) { |
| 916 |
var line = session.getLine(row); |
| 917 |
var match = line.match(this.foldingStartMarker); |
| 918 |
if (match) { |
| 919 |
var i = match.index; |
| 920 |
|
| 921 |
if (match[1]) |
| 922 |
return this.openingBracketBlock(session, match[1], row, i); |
| 923 |
|
| 924 |
return session.getCommentFoldRange(row, i + match[0].length, 1); |
| 925 |
} |
| 926 |
|
| 927 |
if (foldStyle !== "markbeginend") |
| 928 |
return; |
| 929 |
|
| 930 |
var match = line.match(this.foldingStopMarker); |
| 931 |
if (match) { |
| 932 |
var i = match.index + match[0].length; |
| 933 |
|
| 934 |
if (match[1]) |
| 935 |
return this.closingBracketBlock(session, match[1], row, i); |
| 936 |
|
| 937 |
return session.getCommentFoldRange(row, i, -1); |
| 938 |
} |
| 939 |
}; |
| 940 |
|
| 941 |
}).call(FoldMode.prototype); |
| 942 |
|
| 943 |
}); |
| 944 |
define('ace/mode/java_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) { |
| 945 |
|
| 946 |
|
| 947 |
var oop = require("../lib/oop"); |
| 948 |
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; |
| 949 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 950 |
|
| 951 |
var JavaHighlightRules = function() { |
| 952 |
var keywords = ( |
| 953 |
"abstract|continue|for|new|switch|" + |
| 954 |
"assert|default|goto|package|synchronized|" + |
| 955 |
"boolean|do|if|private|this|" + |
| 956 |
"break|double|implements|protected|throw|" + |
| 957 |
"byte|else|import|public|throws|" + |
| 958 |
"case|enum|instanceof|return|transient|" + |
| 959 |
"catch|extends|int|short|try|" + |
| 960 |
"char|final|interface|static|void|" + |
| 961 |
"class|finally|long|strictfp|volatile|" + |
| 962 |
"const|float|native|super|while" |
| 963 |
); |
| 964 |
|
| 965 |
var buildinConstants = ("null|Infinity|NaN|undefined"); |
| 966 |
|
| 967 |
|
| 968 |
var langClasses = ( |
| 969 |
"AbstractMethodError|AssertionError|ClassCircularityError|"+ |
| 970 |
"ClassFormatError|Deprecated|EnumConstantNotPresentException|"+ |
| 971 |
"ExceptionInInitializerError|IllegalAccessError|"+ |
| 972 |
"IllegalThreadStateException|InstantiationError|InternalError|"+ |
| 973 |
"NegativeArraySizeException|NoSuchFieldError|Override|Process|"+ |
| 974 |
"ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|"+ |
| 975 |
"SuppressWarnings|TypeNotPresentException|UnknownError|"+ |
| 976 |
"UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|"+ |
| 977 |
"InstantiationException|IndexOutOfBoundsException|"+ |
| 978 |
"ArrayIndexOutOfBoundsException|CloneNotSupportedException|"+ |
| 979 |
"NoSuchFieldException|IllegalArgumentException|NumberFormatException|"+ |
| 980 |
"SecurityException|Void|InheritableThreadLocal|IllegalStateException|"+ |
| 981 |
"InterruptedException|NoSuchMethodException|IllegalAccessException|"+ |
| 982 |
"UnsupportedOperationException|Enum|StrictMath|Package|Compiler|"+ |
| 983 |
"Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|"+ |
| 984 |
"NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|"+ |
| 985 |
"NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|"+ |
| 986 |
"Character|Boolean|StackTraceElement|Appendable|StringBuffer|"+ |
| 987 |
"Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|"+ |
| 988 |
"StackOverflowError|OutOfMemoryError|VirtualMachineError|"+ |
| 989 |
"ArrayStoreException|ClassCastException|LinkageError|"+ |
| 990 |
"NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+ |
| 991 |
"Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+ |
| 992 |
"Cloneable|Class|CharSequence|Comparable|String|Object" |
| 993 |
); |
| 994 |
|
| 995 |
var keywordMapper = this.createKeywordMapper({ |
| 996 |
"variable.language": "this", |
| 997 |
"keyword": keywords, |
| 998 |
"constant.language": buildinConstants, |
| 999 |
"support.function": langClasses |
| 1000 |
}, "identifier"); |
| 1001 |
|
| 1002 |
this.$rules = { |
| 1003 |
"start" : [ |
| 1004 |
{ |
| 1005 |
token : "comment", |
| 1006 |
regex : "\\/\\/.*$" |
| 1007 |
}, |
| 1008 |
DocCommentHighlightRules.getStartRule("doc-start"), |
| 1009 |
{ |
| 1010 |
token : "comment", // multi line comment |
| 1011 |
merge : true, |
| 1012 |
regex : "\\/\\*", |
| 1013 |
next : "comment" |
| 1014 |
}, { |
| 1015 |
token : "string.regexp", |
| 1016 |
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" |
| 1017 |
}, { |
| 1018 |
token : "string", // single line |
| 1019 |
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' |
| 1020 |
}, { |
| 1021 |
token : "string", // single line |
| 1022 |
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" |
| 1023 |
}, { |
| 1024 |
token : "constant.numeric", // hex |
| 1025 |
regex : "0[xX][0-9a-fA-F]+\\b" |
| 1026 |
}, { |
| 1027 |
token : "constant.numeric", // float |
| 1028 |
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" |
| 1029 |
}, { |
| 1030 |
token : "constant.language.boolean", |
| 1031 |
regex : "(?:true|false)\\b" |
| 1032 |
}, { |
| 1033 |
token : keywordMapper, |
| 1034 |
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" |
| 1035 |
}, { |
| 1036 |
token : "keyword.operator", |
| 1037 |
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" |
| 1038 |
}, { |
| 1039 |
token : "lparen", |
| 1040 |
regex : "[[({]" |
| 1041 |
}, { |
| 1042 |
token : "rparen", |
| 1043 |
regex : "[\\])}]" |
| 1044 |
}, { |
| 1045 |
token : "text", |
| 1046 |
regex : "\\s+" |
| 1047 |
} |
| 1048 |
], |
| 1049 |
"comment" : [ |
| 1050 |
{ |
| 1051 |
token : "comment", // closing comment |
| 1052 |
regex : ".*?\\*\\/", |
| 1053 |
next : "start" |
| 1054 |
}, { |
| 1055 |
token : "comment", // comment spanning whole line |
| 1056 |
merge : true, |
| 1057 |
regex : ".+" |
| 1058 |
} |
| 1059 |
] |
| 1060 |
}; |
| 1061 |
|
| 1062 |
this.embedRules(DocCommentHighlightRules, "doc-", |
| 1063 |
[ DocCommentHighlightRules.getEndRule("start") ]); |
| 1064 |
}; |
| 1065 |
|
| 1066 |
oop.inherits(JavaHighlightRules, TextHighlightRules); |
| 1067 |
|
| 1068 |
exports.JavaHighlightRules = JavaHighlightRules; |
| 1069 |
}); |
| 1070 |
|