You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mode-markdown.js 82KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249
  1. /* vim:ts=4:sts=4:sw=4:
  2. * ***** BEGIN LICENSE BLOCK *****
  3. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. * http://www.mozilla.org/MPL/
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. *
  15. * The Original Code is Ajax.org Code Editor (ACE).
  16. *
  17. * The Initial Developer of the Original Code is
  18. * Ajax.org B.V.
  19. * Portions created by the Initial Developer are Copyright (C) 2010
  20. * the Initial Developer. All Rights Reserved.
  21. *
  22. * Contributor(s):
  23. * Fabian Jakobs <fabian AT ajax DOT org>
  24. * Mihai Sucan <mihai DOT sucan AT gmail DOT com>
  25. * Chris Spencer <chris.ag.spencer AT googlemail DOT com>
  26. *
  27. * Alternatively, the contents of this file may be used under the terms of
  28. * either the GNU General Public License Version 2 or later (the "GPL"), or
  29. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  30. * in which case the provisions of the GPL or the LGPL are applicable instead
  31. * of those above. If you wish to allow use of your version of this file only
  32. * under the terms of either the GPL or the LGPL, and not to allow others to
  33. * use your version of this file under the terms of the MPL, indicate your
  34. * decision by deleting the provisions above and replace them with the notice
  35. * and other provisions required by the GPL or the LGPL. If you do not delete
  36. * the provisions above, a recipient may use your version of this file under
  37. * the terms of any one of the MPL, the GPL or the LGPL.
  38. *
  39. * ***** END LICENSE BLOCK ***** */
  40. ace.define('ace/mode/markdown', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/mode/javascript', 'ace/mode/xml', 'ace/mode/html', 'ace/tokenizer', 'ace/mode/markdown_highlight_rules'], function(require, exports, module) {
  41. var oop = require("../lib/oop");
  42. var TextMode = require("./text").Mode;
  43. var JavaScriptMode = require("./javascript").Mode;
  44. var XmlMode = require("./xml").Mode;
  45. var HtmlMode = require("./html").Mode;
  46. var Tokenizer = require("../tokenizer").Tokenizer;
  47. var MarkdownHighlightRules = require("./markdown_highlight_rules").MarkdownHighlightRules;
  48. var Mode = function() {
  49. var highlighter = new MarkdownHighlightRules();
  50. this.$tokenizer = new Tokenizer(highlighter.getRules());
  51. this.$embeds = highlighter.getEmbeds();
  52. this.createModeDelegates({
  53. "js-": JavaScriptMode,
  54. "xml-": XmlMode,
  55. "html-": HtmlMode
  56. });
  57. };
  58. oop.inherits(Mode, TextMode);
  59. (function() {
  60. this.getNextLineIndent = function(state, line, tab) {
  61. if (state == "listblock") {
  62. var match = /^((?:.+)?)([-+*][ ]+)/.exec(line);
  63. if (match) {
  64. return new Array(match[1].length + 1).join(" ") + match[2];
  65. } else {
  66. return "";
  67. }
  68. } else {
  69. return this.$getIndent(line);
  70. }
  71. };
  72. }).call(Mode.prototype);
  73. exports.Mode = Mode;
  74. });
  75. ace.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) {
  76. var oop = require("../lib/oop");
  77. var TextMode = require("./text").Mode;
  78. var Tokenizer = require("../tokenizer").Tokenizer;
  79. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  80. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  81. var Range = require("../range").Range;
  82. var WorkerClient = require("../worker/worker_client").WorkerClient;
  83. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  84. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  85. var Mode = function() {
  86. this.$tokenizer = new Tokenizer(new JavaScriptHighlightRules().getRules());
  87. this.$outdent = new MatchingBraceOutdent();
  88. this.$behaviour = new CstyleBehaviour();
  89. this.foldingRules = new CStyleFoldMode();
  90. };
  91. oop.inherits(Mode, TextMode);
  92. (function() {
  93. this.toggleCommentLines = function(state, doc, startRow, endRow) {
  94. var outdent = true;
  95. var re = /^(\s*)\/\//;
  96. for (var i=startRow; i<= endRow; i++) {
  97. if (!re.test(doc.getLine(i))) {
  98. outdent = false;
  99. break;
  100. }
  101. }
  102. if (outdent) {
  103. var deleteRange = new Range(0, 0, 0, 0);
  104. for (var i=startRow; i<= endRow; i++)
  105. {
  106. var line = doc.getLine(i);
  107. var m = line.match(re);
  108. deleteRange.start.row = i;
  109. deleteRange.end.row = i;
  110. deleteRange.end.column = m[0].length;
  111. doc.replace(deleteRange, m[1]);
  112. }
  113. }
  114. else {
  115. doc.indentRows(startRow, endRow, "//");
  116. }
  117. };
  118. this.getNextLineIndent = function(state, line, tab) {
  119. var indent = this.$getIndent(line);
  120. var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
  121. var tokens = tokenizedLine.tokens;
  122. var endState = tokenizedLine.state;
  123. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  124. return indent;
  125. }
  126. if (state == "start" || state == "regex_allowed") {
  127. var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
  128. if (match) {
  129. indent += tab;
  130. }
  131. } else if (state == "doc-start") {
  132. if (endState == "start" || state == "regex_allowed") {
  133. return "";
  134. }
  135. var match = line.match(/^\s*(\/?)\*/);
  136. if (match) {
  137. if (match[1]) {
  138. indent += " ";
  139. }
  140. indent += "* ";
  141. }
  142. }
  143. return indent;
  144. };
  145. this.checkOutdent = function(state, line, input) {
  146. return this.$outdent.checkOutdent(line, input);
  147. };
  148. this.autoOutdent = function(state, doc, row) {
  149. this.$outdent.autoOutdent(doc, row);
  150. };
  151. this.createWorker = function(session) {
  152. var worker = new WorkerClient(["ace"], "worker-javascript.js", "ace/mode/javascript_worker", "JavaScriptWorker");
  153. worker.attachToDocument(session.getDocument());
  154. worker.on("jslint", function(results) {
  155. var errors = [];
  156. for (var i=0; i<results.data.length; i++) {
  157. var error = results.data[i];
  158. if (error)
  159. errors.push({
  160. row: error.line-1,
  161. column: error.character-1,
  162. text: error.reason,
  163. type: "warning",
  164. lint: error
  165. });
  166. }
  167. session.setAnnotations(errors);
  168. });
  169. worker.on("narcissus", function(e) {
  170. session.setAnnotations([e.data]);
  171. });
  172. worker.on("terminate", function() {
  173. session.clearAnnotations();
  174. });
  175. return worker;
  176. };
  177. }).call(Mode.prototype);
  178. exports.Mode = Mode;
  179. });
  180. ace.define('ace/mode/javascript_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/unicode', 'ace/mode/doc_comment_highlight_rules', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
  181. var oop = require("../lib/oop");
  182. var lang = require("../lib/lang");
  183. var unicode = require("../unicode");
  184. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  185. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  186. var JavaScriptHighlightRules = function() {
  187. // see: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects
  188. var globals = lang.arrayToMap(
  189. // Constructors
  190. ("Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" +
  191. // E4X
  192. "Namespace|QName|XML|XMLList|" +
  193. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  194. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  195. // Errors
  196. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" +
  197. "SyntaxError|TypeError|URIError|" +
  198. // Non-constructor functions
  199. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" +
  200. "isNaN|parseFloat|parseInt|" +
  201. // Other
  202. "JSON|Math|" +
  203. // Pseudo
  204. "this|arguments|prototype|window|document"
  205. ).split("|")
  206. );
  207. var keywords = lang.arrayToMap(
  208. ("break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  209. "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|" +
  210. "const|yield|import|get|set").split("|")
  211. );
  212. // keywords which can be followed by regular expressions
  213. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield";
  214. var deprecated = lang.arrayToMap(
  215. ("__parent__|__count__|escape|unescape|with|__proto__").split("|")
  216. );
  217. var definitions = lang.arrayToMap(("const|let|var|function").split("|"));
  218. var buildinConstants = lang.arrayToMap(
  219. ("null|Infinity|NaN|undefined").split("|")
  220. );
  221. var futureReserved = lang.arrayToMap(
  222. ("class|enum|extends|super|export|implements|private|" +
  223. "public|interface|package|protected|static").split("|")
  224. );
  225. // TODO: Unicode escape sequences
  226. var identifierRe = "[" + unicode.packages.L + "\\$_]["
  227. + unicode.packages.L
  228. + unicode.packages.Mn + unicode.packages.Mc
  229. + unicode.packages.Nd
  230. + unicode.packages.Pc + "\\$_]*\\b";
  231. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  232. "u[0-9a-fA-F]{4}|" + // unicode
  233. "[0-2][0-7]{0,2}|" + // oct
  234. "3[0-6][0-7]?|" + // oct
  235. "37[0-7]?|" + // oct
  236. "[4-7][0-7]?|" + //oct
  237. ".)";
  238. // regexp must not have capturing parentheses. Use (?:) instead.
  239. // regexps are ordered -> the first match is used
  240. this.$rules = {
  241. "start" : [
  242. {
  243. token : "comment",
  244. regex : /\/\/.*$/
  245. },
  246. DocCommentHighlightRules.getStartRule("doc-start"),
  247. {
  248. token : "comment", // multi line comment
  249. merge : true,
  250. regex : /\/\*/,
  251. next : "comment"
  252. }, {
  253. token : "string",
  254. regex : "'(?=.)",
  255. next : "qstring"
  256. }, {
  257. token : "string",
  258. regex : '"(?=.)',
  259. next : "qqstring"
  260. }, {
  261. token : "constant.numeric", // hex
  262. regex : /0[xX][0-9a-fA-F]+\b/
  263. }, {
  264. token : "constant.numeric", // float
  265. regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
  266. }, { // match stuff like: Sound.prototype.play = function() { }
  267. token : [
  268. "storage.type",
  269. "punctuation.operator",
  270. "support.function",
  271. "punctuation.operator",
  272. "entity.name.function",
  273. "text",
  274. "keyword.operator",
  275. "text",
  276. "storage.type",
  277. "text",
  278. "paren.lparen"
  279. ],
  280. regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  281. next: "function_arguments"
  282. }, { // match stuff like: Sound.prototype.play = myfunc
  283. token : [
  284. "storage.type",
  285. "punctuation.operator",
  286. "support.function",
  287. "punctuation.operator",
  288. "entity.name.function",
  289. "text",
  290. "keyword.operator",
  291. "text"
  292. ],
  293. regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
  294. next: "function_arguments"
  295. }, { // match stuff like: Sound.play = function() { }
  296. token : [
  297. "storage.type",
  298. "punctuation.operator",
  299. "entity.name.function",
  300. "text",
  301. "keyword.operator",
  302. "text",
  303. "storage.type",
  304. "text",
  305. "paren.lparen"
  306. ],
  307. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  308. next: "function_arguments"
  309. }, { // match stuff like: play = function() { }
  310. token : [
  311. "entity.name.function",
  312. "text",
  313. "keyword.operator",
  314. "text",
  315. "storage.type",
  316. "text",
  317. "paren.lparen"
  318. ],
  319. regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  320. next: "function_arguments"
  321. }, { // match stuff like: Sound.play = function play() { }
  322. token : [
  323. "storage.type",
  324. "punctuation.operator",
  325. "entity.name.function",
  326. "text",
  327. "keyword.operator",
  328. "text",
  329. "storage.type",
  330. "text",
  331. "entity.name.function",
  332. "text",
  333. "paren.lparen"
  334. ],
  335. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
  336. next: "function_arguments"
  337. }, { // match regular function like: function myFunc(arg) { }
  338. token : [
  339. "storage.type",
  340. "text",
  341. "entity.name.function",
  342. "text",
  343. "paren.lparen"
  344. ],
  345. regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
  346. next: "function_arguments"
  347. }, { // match stuff like: foobar: function() { }
  348. token : [
  349. "entity.name.function",
  350. "text",
  351. "punctuation.operator",
  352. "text",
  353. "storage.type",
  354. "text",
  355. "paren.lparen"
  356. ],
  357. regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
  358. next: "function_arguments"
  359. }, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
  360. token : [
  361. "text",
  362. "text",
  363. "storage.type",
  364. "text",
  365. "paren.lparen"
  366. ],
  367. regex : "(:)(\\s*)(function)(\\s*)(\\()",
  368. next: "function_arguments"
  369. }, {
  370. token : "constant.language.boolean",
  371. regex : /(?:true|false)\b/
  372. }, {
  373. token : "keyword",
  374. regex : "(?:" + kwBeforeRe + ")\\b",
  375. next : "regex_allowed"
  376. }, {
  377. token : ["punctuation.operator", "support.function"],
  378. 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(?=\()/
  379. }, {
  380. token : ["punctuation.operator", "support.function.dom"],
  381. 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(?=\()/
  382. }, {
  383. token : ["punctuation.operator", "support.constant"],
  384. 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/
  385. }, {
  386. token : ["storage.type", "punctuation.operator", "support.function.firebug"],
  387. regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
  388. }, {
  389. token : function(value) {
  390. if (globals.hasOwnProperty(value))
  391. return "variable.language";
  392. else if (deprecated.hasOwnProperty(value))
  393. return "invalid.deprecated";
  394. else if (definitions.hasOwnProperty(value))
  395. return "storage.type";
  396. else if (keywords.hasOwnProperty(value))
  397. return "keyword";
  398. else if (buildinConstants.hasOwnProperty(value))
  399. return "constant.language";
  400. else if (futureReserved.hasOwnProperty(value))
  401. return "invalid.illegal";
  402. else if (value == "debugger")
  403. return "invalid.deprecated";
  404. else
  405. return "identifier";
  406. },
  407. regex : identifierRe
  408. }, {
  409. token : "keyword.operator",
  410. regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
  411. next : "regex_allowed"
  412. }, {
  413. token : "punctuation.operator",
  414. regex : /\?|\:|\,|\;|\./,
  415. next : "regex_allowed"
  416. }, {
  417. token : "paren.lparen",
  418. regex : /[\[({]/,
  419. next : "regex_allowed"
  420. }, {
  421. token : "paren.rparen",
  422. regex : /[\])}]/
  423. }, {
  424. token : "keyword.operator",
  425. regex : /\/=?/,
  426. next : "regex_allowed"
  427. }, {
  428. token: "comment",
  429. regex: /^#!.*$/
  430. }, {
  431. token : "text",
  432. regex : /\s+/
  433. }
  434. ],
  435. // regular expressions are only allowed after certain tokens. This
  436. // makes sure we don't mix up regexps with the divison operator
  437. "regex_allowed": [
  438. DocCommentHighlightRules.getStartRule("doc-start"),
  439. {
  440. token : "comment", // multi line comment
  441. merge : true,
  442. regex : "\\/\\*",
  443. next : "comment_regex_allowed"
  444. }, {
  445. token : "comment",
  446. regex : "\\/\\/.*$"
  447. }, {
  448. token: "string.regexp",
  449. regex: "\\/",
  450. next: "regex",
  451. merge: true
  452. }, {
  453. token : "text",
  454. regex : "\\s+"
  455. }, {
  456. // immediately return to the start mode without matching
  457. // anything
  458. token: "empty",
  459. regex: "",
  460. next: "start"
  461. }
  462. ],
  463. "regex": [
  464. {
  465. token: "regexp.keyword.operator",
  466. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  467. }, {
  468. // flag
  469. token: "string.regexp",
  470. regex: "/\\w*",
  471. next: "start",
  472. merge: true
  473. }, {
  474. token: "string.regexp",
  475. regex: "[^\\\\/\\[]+",
  476. merge: true
  477. }, {
  478. token: "string.regexp.charachterclass",
  479. regex: "\\[",
  480. next: "regex_character_class",
  481. merge: true
  482. }, {
  483. token: "empty",
  484. regex: "",
  485. next: "start"
  486. }
  487. ],
  488. "regex_character_class": [
  489. {
  490. token: "regexp.keyword.operator",
  491. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  492. }, {
  493. token: "string.regexp.charachterclass",
  494. regex: "]",
  495. next: "regex",
  496. merge: true
  497. }, {
  498. token: "string.regexp.charachterclass",
  499. regex: "[^\\\\\\]]+",
  500. merge: true
  501. }, {
  502. token: "empty",
  503. regex: "",
  504. next: "start"
  505. }
  506. ],
  507. "function_arguments": [
  508. {
  509. token: "variable.parameter",
  510. regex: identifierRe,
  511. }, {
  512. token: "punctuation.operator",
  513. regex: "[, ]+",
  514. merge: true
  515. }, {
  516. token: "punctuation.operator",
  517. regex: "$",
  518. merge: true
  519. }, {
  520. token: "empty",
  521. regex: "",
  522. next: "start"
  523. }
  524. ],
  525. "comment_regex_allowed" : [
  526. {
  527. token : "comment", // closing comment
  528. regex : ".*?\\*\\/",
  529. merge : true,
  530. next : "regex_allowed"
  531. }, {
  532. token : "comment", // comment spanning whole line
  533. merge : true,
  534. regex : ".+"
  535. }
  536. ],
  537. "comment" : [
  538. {
  539. token : "comment", // closing comment
  540. regex : ".*?\\*\\/",
  541. merge : true,
  542. next : "start"
  543. }, {
  544. token : "comment", // comment spanning whole line
  545. merge : true,
  546. regex : ".+"
  547. }
  548. ],
  549. "qqstring" : [
  550. {
  551. token : "constant.language.escape",
  552. regex : escapedRe
  553. }, {
  554. token : "string",
  555. regex : '[^"\\\\]+',
  556. merge : true
  557. }, {
  558. token : "string",
  559. regex : "\\\\$",
  560. next : "qqstring",
  561. merge : true
  562. }, {
  563. token : "string",
  564. regex : '"|$',
  565. next : "start",
  566. merge : true
  567. }
  568. ],
  569. "qstring" : [
  570. {
  571. token : "constant.language.escape",
  572. regex : escapedRe
  573. }, {
  574. token : "string",
  575. regex : "[^'\\\\]+",
  576. merge : true
  577. }, {
  578. token : "string",
  579. regex : "\\\\$",
  580. next : "qstring",
  581. merge : true
  582. }, {
  583. token : "string",
  584. regex : "'|$",
  585. next : "start",
  586. merge : true
  587. }
  588. ]
  589. };
  590. this.embedRules(DocCommentHighlightRules, "doc-",
  591. [ DocCommentHighlightRules.getEndRule("start") ]);
  592. };
  593. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  594. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  595. });
  596. ace.define('ace/mode/doc_comment_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
  597. var oop = require("../lib/oop");
  598. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  599. var DocCommentHighlightRules = function() {
  600. this.$rules = {
  601. "start" : [ {
  602. token : "comment.doc.tag",
  603. regex : "@[\\w\\d_]+" // TODO: fix email addresses
  604. }, {
  605. token : "comment.doc",
  606. merge : true,
  607. regex : "\\s+"
  608. }, {
  609. token : "comment.doc",
  610. merge : true,
  611. regex : "TODO"
  612. }, {
  613. token : "comment.doc",
  614. merge : true,
  615. regex : "[^@\\*]+"
  616. }, {
  617. token : "comment.doc",
  618. merge : true,
  619. regex : "."
  620. }]
  621. };
  622. };
  623. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  624. DocCommentHighlightRules.getStartRule = function(start) {
  625. return {
  626. token : "comment.doc", // doc comment
  627. merge : true,
  628. regex : "\\/\\*(?=\\*)",
  629. next : start
  630. };
  631. };
  632. DocCommentHighlightRules.getEndRule = function (start) {
  633. return {
  634. token : "comment.doc", // closing comment
  635. merge : true,
  636. regex : "\\*\\/",
  637. next : start
  638. };
  639. };
  640. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  641. });
  642. ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
  643. var Range = require("../range").Range;
  644. var MatchingBraceOutdent = function() {};
  645. (function() {
  646. this.checkOutdent = function(line, input) {
  647. if (! /^\s+$/.test(line))
  648. return false;
  649. return /^\s*\}/.test(input);
  650. };
  651. this.autoOutdent = function(doc, row) {
  652. var line = doc.getLine(row);
  653. var match = line.match(/^(\s*\})/);
  654. if (!match) return 0;
  655. var column = match[1].length;
  656. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  657. if (!openBracePos || openBracePos.row == row) return 0;
  658. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  659. doc.replace(new Range(row, 0, row, column-1), indent);
  660. };
  661. this.$getIndent = function(line) {
  662. var match = line.match(/^(\s+)/);
  663. if (match) {
  664. return match[1];
  665. }
  666. return "";
  667. };
  668. }).call(MatchingBraceOutdent.prototype);
  669. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  670. });
  671. ace.define('ace/mode/behaviour/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour'], function(require, exports, module) {
  672. var oop = require("../../lib/oop");
  673. var Behaviour = require("../behaviour").Behaviour;
  674. var CstyleBehaviour = function () {
  675. this.add("braces", "insertion", function (state, action, editor, session, text) {
  676. if (text == '{') {
  677. var selection = editor.getSelectionRange();
  678. var selected = session.doc.getTextRange(selection);
  679. if (selected !== "") {
  680. return {
  681. text: '{' + selected + '}',
  682. selection: false
  683. };
  684. } else {
  685. return {
  686. text: '{}',
  687. selection: [1, 1]
  688. };
  689. }
  690. } else if (text == '}') {
  691. var cursor = editor.getCursorPosition();
  692. var line = session.doc.getLine(cursor.row);
  693. var rightChar = line.substring(cursor.column, cursor.column + 1);
  694. if (rightChar == '}') {
  695. var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
  696. if (matching !== null) {
  697. return {
  698. text: '',
  699. selection: [1, 1]
  700. };
  701. }
  702. }
  703. } else if (text == "\n") {
  704. var cursor = editor.getCursorPosition();
  705. var line = session.doc.getLine(cursor.row);
  706. var rightChar = line.substring(cursor.column, cursor.column + 1);
  707. if (rightChar == '}') {
  708. var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column + 1});
  709. if (!openBracePos)
  710. return null;
  711. var indent = this.getNextLineIndent(state, line.substring(0, line.length - 1), session.getTabString());
  712. var next_indent = this.$getIndent(session.doc.getLine(openBracePos.row));
  713. return {
  714. text: '\n' + indent + '\n' + next_indent,
  715. selection: [1, indent.length, 1, indent.length]
  716. };
  717. }
  718. }
  719. });
  720. this.add("braces", "deletion", function (state, action, editor, session, range) {
  721. var selected = session.doc.getTextRange(range);
  722. if (!range.isMultiLine() && selected == '{') {
  723. var line = session.doc.getLine(range.start.row);
  724. var rightChar = line.substring(range.end.column, range.end.column + 1);
  725. if (rightChar == '}') {
  726. range.end.column++;
  727. return range;
  728. }
  729. }
  730. });
  731. this.add("parens", "insertion", function (state, action, editor, session, text) {
  732. if (text == '(') {
  733. var selection = editor.getSelectionRange();
  734. var selected = session.doc.getTextRange(selection);
  735. if (selected !== "") {
  736. return {
  737. text: '(' + selected + ')',
  738. selection: false
  739. };
  740. } else {
  741. return {
  742. text: '()',
  743. selection: [1, 1]
  744. };
  745. }
  746. } else if (text == ')') {
  747. var cursor = editor.getCursorPosition();
  748. var line = session.doc.getLine(cursor.row);
  749. var rightChar = line.substring(cursor.column, cursor.column + 1);
  750. if (rightChar == ')') {
  751. var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
  752. if (matching !== null) {
  753. return {
  754. text: '',
  755. selection: [1, 1]
  756. };
  757. }
  758. }
  759. }
  760. });
  761. this.add("parens", "deletion", function (state, action, editor, session, range) {
  762. var selected = session.doc.getTextRange(range);
  763. if (!range.isMultiLine() && selected == '(') {
  764. var line = session.doc.getLine(range.start.row);
  765. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  766. if (rightChar == ')') {
  767. range.end.column++;
  768. return range;
  769. }
  770. }
  771. });
  772. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  773. if (text == '"' || text == "'") {
  774. var quote = text;
  775. var selection = editor.getSelectionRange();
  776. var selected = session.doc.getTextRange(selection);
  777. if (selected !== "") {
  778. return {
  779. text: quote + selected + quote,
  780. selection: false
  781. };
  782. } else {
  783. var cursor = editor.getCursorPosition();
  784. var line = session.doc.getLine(cursor.row);
  785. var leftChar = line.substring(cursor.column-1, cursor.column);
  786. // We're escaped.
  787. if (leftChar == '\\') {
  788. return null;
  789. }
  790. // Find what token we're inside.
  791. var tokens = session.getTokens(selection.start.row);
  792. var col = 0, token;
  793. var quotepos = -1; // Track whether we're inside an open quote.
  794. for (var x = 0; x < tokens.length; x++) {
  795. token = tokens[x];
  796. if (token.type == "string") {
  797. quotepos = -1;
  798. } else if (quotepos < 0) {
  799. quotepos = token.value.indexOf(quote);
  800. }
  801. if ((token.value.length + col) > selection.start.column) {
  802. break;
  803. }
  804. col += tokens[x].value.length;
  805. }
  806. // Try and be smart about when we auto insert.
  807. 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)))) {
  808. return {
  809. text: quote + quote,
  810. selection: [1,1]
  811. };
  812. } else if (token && token.type === "string") {
  813. // Ignore input and move right one if we're typing over the closing quote.
  814. var rightChar = line.substring(cursor.column, cursor.column + 1);
  815. if (rightChar == quote) {
  816. return {
  817. text: '',
  818. selection: [1, 1]
  819. };
  820. }
  821. }
  822. }
  823. }
  824. });
  825. this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
  826. var selected = session.doc.getTextRange(range);
  827. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  828. var line = session.doc.getLine(range.start.row);
  829. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  830. if (rightChar == '"') {
  831. range.end.column++;
  832. return range;
  833. }
  834. }
  835. });
  836. };
  837. oop.inherits(CstyleBehaviour, Behaviour);
  838. exports.CstyleBehaviour = CstyleBehaviour;
  839. });
  840. ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
  841. var oop = require("../../lib/oop");
  842. var Range = require("../../range").Range;
  843. var BaseFoldMode = require("./fold_mode").FoldMode;
  844. var FoldMode = exports.FoldMode = function() {};
  845. oop.inherits(FoldMode, BaseFoldMode);
  846. (function() {
  847. this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
  848. this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
  849. this.getFoldWidgetRange = function(session, foldStyle, row) {
  850. var line = session.getLine(row);
  851. var match = line.match(this.foldingStartMarker);
  852. if (match) {
  853. var i = match.index;
  854. if (match[1])
  855. return this.openingBracketBlock(session, match[1], row, i);
  856. var range = session.getCommentFoldRange(row, i + match[0].length);
  857. range.end.column -= 2;
  858. return range;
  859. }
  860. if (foldStyle !== "markbeginend")
  861. return;
  862. var match = line.match(this.foldingStopMarker);
  863. if (match) {
  864. var i = match.index + match[0].length;
  865. if (match[2]) {
  866. var range = session.getCommentFoldRange(row, i);
  867. range.end.column -= 2;
  868. return range;
  869. }
  870. var end = {row: row, column: i};
  871. var start = session.$findOpeningBracket(match[1], end);
  872. if (!start)
  873. return;
  874. start.column++;
  875. end.column--;
  876. return Range.fromPoints(start, end);
  877. }
  878. };
  879. }).call(FoldMode.prototype);
  880. });
  881. ace.define('ace/mode/folding/fold_mode', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
  882. var Range = require("../../range").Range;
  883. var FoldMode = exports.FoldMode = function() {};
  884. (function() {
  885. this.foldingStartMarker = null;
  886. this.foldingStopMarker = null;
  887. // must return "" if there's no fold, to enable caching
  888. this.getFoldWidget = function(session, foldStyle, row) {
  889. var line = session.getLine(row);
  890. if (this.foldingStartMarker.test(line))
  891. return "start";
  892. if (foldStyle == "markbeginend"
  893. && this.foldingStopMarker
  894. && this.foldingStopMarker.test(line))
  895. return "end";
  896. return "";
  897. };
  898. this.getFoldWidgetRange = function(session, foldStyle, row) {
  899. return null;
  900. };
  901. this.indentationBlock = function(session, row, column) {
  902. var re = /^\s*/;
  903. var startRow = row;
  904. var endRow = row;
  905. var line = session.getLine(row);
  906. var startColumn = column || line.length;
  907. var startLevel = line.match(re)[0].length;
  908. var maxRow = session.getLength()
  909. while (++row < maxRow) {
  910. line = session.getLine(row);
  911. var level = line.match(re)[0].length;
  912. if (level == line.length)
  913. continue;
  914. if (level <= startLevel)
  915. break;
  916. endRow = row;
  917. }
  918. if (endRow > startRow) {
  919. var endColumn = session.getLine(endRow).length;
  920. return new Range(startRow, startColumn, endRow, endColumn);
  921. }
  922. };
  923. this.openingBracketBlock = function(session, bracket, row, column, typeRe, allowBlankLine) {
  924. var start = {row: row, column: column + 1};
  925. var end = session.$findClosingBracket(bracket, start, typeRe, allowBlankLine);
  926. if (!end)
  927. return;
  928. var fw = session.foldWidgets[end.row];
  929. if (fw == null)
  930. fw = this.getFoldWidget(session, end.row);
  931. if (fw == "start") {
  932. end.row --;
  933. end.column = session.getLine(end.row).length;
  934. }
  935. return Range.fromPoints(start, end);
  936. };
  937. }).call(FoldMode.prototype);
  938. });
  939. ace.define('ace/mode/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/xml_highlight_rules', 'ace/mode/behaviour/xml', 'ace/mode/folding/xml'], function(require, exports, module) {
  940. var oop = require("../lib/oop");
  941. var TextMode = require("./text").Mode;
  942. var Tokenizer = require("../tokenizer").Tokenizer;
  943. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  944. var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
  945. var XmlFoldMode = require("./folding/xml").FoldMode;
  946. var Mode = function() {
  947. this.$tokenizer = new Tokenizer(new XmlHighlightRules().getRules());
  948. this.$behaviour = new XmlBehaviour();
  949. this.foldingRules = new XmlFoldMode();
  950. };
  951. oop.inherits(Mode, TextMode);
  952. (function() {
  953. this.getNextLineIndent = function(state, line, tab) {
  954. return this.$getIndent(line);
  955. };
  956. }).call(Mode.prototype);
  957. exports.Mode = Mode;
  958. });
  959. ace.define('ace/mode/xml_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
  960. var oop = require("../lib/oop");
  961. var xmlUtil = require("./xml_util");
  962. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  963. var XmlHighlightRules = function() {
  964. // regexp must not have capturing parentheses
  965. // regexps are ordered -> the first match is used
  966. this.$rules = {
  967. start : [{
  968. token : "text",
  969. regex : "<\\!\\[CDATA\\[",
  970. next : "cdata"
  971. }, {
  972. token : "xml_pe",
  973. regex : "<\\?.*?\\?>"
  974. }, {
  975. token : "comment",
  976. merge : true,
  977. regex : "<\\!--",
  978. next : "comment"
  979. }, {
  980. token : "xml_pe",
  981. regex : "<\\!.*?>"
  982. }, {
  983. token : "meta.tag", // opening tag
  984. regex : "<\\/?",
  985. next : "tag"
  986. }, {
  987. token : "text",
  988. regex : "\\s+"
  989. }, {
  990. token : "constant.character.entity",
  991. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  992. }, {
  993. token : "text",
  994. regex : "[^<]+"
  995. }],
  996. cdata : [{
  997. token : "text",
  998. regex : "\\]\\]>",
  999. next : "start"
  1000. }, {
  1001. token : "text",
  1002. regex : "\\s+"
  1003. }, {
  1004. token : "text",
  1005. regex : "(?:[^\\]]|\\](?!\\]>))+"
  1006. }],
  1007. comment : [{
  1008. token : "comment",
  1009. regex : ".*?-->",
  1010. next : "start"
  1011. }, {
  1012. token : "comment",
  1013. merge : true,
  1014. regex : ".+"
  1015. }]
  1016. };
  1017. xmlUtil.tag(this.$rules, "tag", "start");
  1018. };
  1019. oop.inherits(XmlHighlightRules, TextHighlightRules);
  1020. exports.XmlHighlightRules = XmlHighlightRules;
  1021. });
  1022. ace.define('ace/mode/xml_util', ['require', 'exports', 'module' , 'ace/lib/lang'], function(require, exports, module) {
  1023. var lang = require("../lib/lang");
  1024. var formTags = lang.arrayToMap(
  1025. ("button|form|input|label|select|textarea").split("|")
  1026. );
  1027. var tableTags = lang.arrayToMap(
  1028. ("table|tbody|td|tfoot|th|tr").split("|")
  1029. );
  1030. function string(state) {
  1031. return [{
  1032. token : "string",
  1033. regex : '".*?"'
  1034. }, {
  1035. token : "string", // multi line string start
  1036. merge : true,
  1037. regex : '["].*',
  1038. next : state + "_qqstring"
  1039. }, {
  1040. token : "string",
  1041. regex : "'.*?'"
  1042. }, {
  1043. token : "string", // multi line string start
  1044. merge : true,
  1045. regex : "['].*",
  1046. next : state + "_qstring"
  1047. }];
  1048. }
  1049. function multiLineString(quote, state) {
  1050. return [{
  1051. token : "string",
  1052. merge : true,
  1053. regex : ".*?" + quote,
  1054. next : state
  1055. }, {
  1056. token : "string",
  1057. merge : true,
  1058. regex : '.+'
  1059. }];
  1060. }
  1061. exports.tag = function(states, name, nextState) {
  1062. states[name] = [{
  1063. token : "text",
  1064. regex : "\\s+"
  1065. }, {
  1066. //token : "meta.tag",
  1067. token : function(value) {
  1068. if ( value==='a' ) {
  1069. return "meta.tag.anchor";
  1070. }
  1071. else if ( value==='img' ) {
  1072. return "meta.tag.image";
  1073. }
  1074. else if ( value==='script' ) {
  1075. return "meta.tag.script";
  1076. }
  1077. else if ( value==='style' ) {
  1078. return "meta.tag.style";
  1079. }
  1080. else if (formTags.hasOwnProperty(value.toLowerCase())) {
  1081. return "meta.tag.form";
  1082. }
  1083. else if (tableTags.hasOwnProperty(value.toLowerCase())) {
  1084. return "meta.tag.table";
  1085. }
  1086. else {
  1087. return "meta.tag";
  1088. }
  1089. },
  1090. merge : true,
  1091. regex : "[-_a-zA-Z0-9:]+",
  1092. next : name + "_embed_attribute_list"
  1093. }, {
  1094. token: "empty",
  1095. regex: "",
  1096. next : name + "_embed_attribute_list"
  1097. }];
  1098. states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
  1099. states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
  1100. states[name + "_embed_attribute_list"] = [{
  1101. token : "meta.tag",
  1102. merge : true,
  1103. regex : "\/?>",
  1104. next : nextState
  1105. }, {
  1106. token : "keyword.operator",
  1107. regex : "="
  1108. }, {
  1109. token : "entity.other.attribute-name",
  1110. regex : "[-_a-zA-Z0-9:]+"
  1111. }, {
  1112. token : "constant.numeric", // float
  1113. regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
  1114. }, {
  1115. token : "text",
  1116. regex : "\\s+"
  1117. }].concat(string(name));
  1118. };
  1119. });
  1120. ace.define('ace/mode/behaviour/xml', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/behaviour', 'ace/mode/behaviour/cstyle'], function(require, exports, module) {
  1121. var oop = require("../../lib/oop");
  1122. var Behaviour = require("../behaviour").Behaviour;
  1123. var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
  1124. var XmlBehaviour = function () {
  1125. this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour
  1126. this.add("brackets", "insertion", function (state, action, editor, session, text) {
  1127. if (text == '<') {
  1128. var selection = editor.getSelectionRange();
  1129. var selected = session.doc.getTextRange(selection);
  1130. if (selected !== "") {
  1131. return false;
  1132. } else {
  1133. return {
  1134. text: '<>',
  1135. selection: [1, 1]
  1136. }
  1137. }
  1138. } else if (text == '>') {
  1139. var cursor = editor.getCursorPosition();
  1140. var line = session.doc.getLine(cursor.row);
  1141. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1142. if (rightChar == '>') { // need some kind of matching check here
  1143. return {
  1144. text: '',
  1145. selection: [1, 1]
  1146. }
  1147. }
  1148. } else if (text == "\n") {
  1149. var cursor = editor.getCursorPosition();
  1150. var line = session.doc.getLine(cursor.row);
  1151. var rightChars = line.substring(cursor.column, cursor.column + 2);
  1152. if (rightChars == '</') {
  1153. var indent = this.$getIndent(session.doc.getLine(cursor.row)) + session.getTabString();
  1154. var next_indent = this.$getIndent(session.doc.getLine(cursor.row));
  1155. return {
  1156. text: '\n' + indent + '\n' + next_indent,
  1157. selection: [1, indent.length, 1, indent.length]
  1158. }
  1159. }
  1160. }
  1161. });
  1162. }
  1163. oop.inherits(XmlBehaviour, Behaviour);
  1164. exports.XmlBehaviour = XmlBehaviour;
  1165. });
  1166. ace.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) {
  1167. var oop = require("../../lib/oop");
  1168. var lang = require("../../lib/lang");
  1169. var Range = require("../../range").Range;
  1170. var BaseFoldMode = require("./fold_mode").FoldMode;
  1171. var TokenIterator = require("../../token_iterator").TokenIterator;
  1172. var FoldMode = exports.FoldMode = function(voidElements) {
  1173. BaseFoldMode.call(this);
  1174. this.voidElements = voidElements || {};
  1175. };
  1176. oop.inherits(FoldMode, BaseFoldMode);
  1177. (function() {
  1178. this.getFoldWidget = function(session, foldStyle, row) {
  1179. var tag = this._getFirstTagInLine(session, row);
  1180. if (tag.closing)
  1181. return foldStyle == "markbeginend" ? "end" : "";
  1182. if (!tag.tagName || this.voidElements[tag.tagName.toLowerCase()])
  1183. return "";
  1184. if (tag.selfClosing)
  1185. return "";
  1186. if (tag.value.indexOf("/" + tag.tagName) !== -1)
  1187. return "";
  1188. return "start";
  1189. };
  1190. this._getFirstTagInLine = function(session, row) {
  1191. var tokens = session.getTokens(row);
  1192. var value = "";
  1193. for (var i = 0; i < tokens.length; i++) {
  1194. var token = tokens[i];
  1195. if (token.type.indexOf("meta.tag") === 0)
  1196. value += token.value;
  1197. else
  1198. value += lang.stringRepeat(" ", token.value.length);
  1199. }
  1200. return this._parseTag(value);
  1201. };
  1202. this.tagRe = /^(\s*)(<?(\/?)([-_a-zA-Z0-9:!]*)\s*(\/?)>?)/;
  1203. this._parseTag = function(tag) {
  1204. var match = this.tagRe.exec(tag);
  1205. var column = this.tagRe.lastIndex || 0;
  1206. this.tagRe.lastIndex = 0;
  1207. return {
  1208. value: tag,
  1209. match: match ? match[2] : "",
  1210. closing: match ? !!match[3] : false,
  1211. selfClosing: match ? !!match[5] || match[2] == "/>" : false,
  1212. tagName: match ? match[4] : "",
  1213. column: match[1] ? column + match[1].length : column
  1214. };
  1215. };
  1216. this._readTagForward = function(iterator) {
  1217. var token = iterator.getCurrentToken();
  1218. if (!token)
  1219. return null;
  1220. var value = "";
  1221. var start;
  1222. do {
  1223. if (token.type.indexOf("meta.tag") === 0) {
  1224. if (!start) {
  1225. var start = {
  1226. row: iterator.getCurrentTokenRow(),
  1227. column: iterator.getCurrentTokenColumn()
  1228. };
  1229. }
  1230. value += token.value;
  1231. if (value.indexOf(">") !== -1) {
  1232. var tag = this._parseTag(value);
  1233. tag.start = start;
  1234. tag.end = {
  1235. row: iterator.getCurrentTokenRow(),
  1236. column: iterator.getCurrentTokenColumn() + token.value.length
  1237. };
  1238. iterator.stepForward();
  1239. return tag;
  1240. }
  1241. }
  1242. } while(token = iterator.stepForward());
  1243. return null;
  1244. };
  1245. this._readTagBackward = function(iterator) {
  1246. var token = iterator.getCurrentToken();
  1247. if (!token)
  1248. return null;
  1249. var value = "";
  1250. var end;
  1251. do {
  1252. if (token.type.indexOf("meta.tag") === 0) {
  1253. if (!end) {
  1254. end = {
  1255. row: iterator.getCurrentTokenRow(),
  1256. column: iterator.getCurrentTokenColumn() + token.value.length
  1257. };
  1258. }
  1259. value = token.value + value;
  1260. if (value.indexOf("<") !== -1) {
  1261. var tag = this._parseTag(value);
  1262. tag.end = end;
  1263. tag.start = {
  1264. row: iterator.getCurrentTokenRow(),
  1265. column: iterator.getCurrentTokenColumn()
  1266. };
  1267. iterator.stepBackward();
  1268. return tag;
  1269. }
  1270. }
  1271. } while(token = iterator.stepBackward());
  1272. return null;
  1273. };
  1274. this._pop = function(stack, tag) {
  1275. while (stack.length) {
  1276. var top = stack[stack.length-1];
  1277. if (!tag || top.tagName == tag.tagName) {
  1278. return stack.pop();
  1279. }
  1280. else if (this.voidElements[tag.tagName]) {
  1281. return;
  1282. }
  1283. else if (this.voidElements[top.tagName]) {
  1284. stack.pop();
  1285. continue;
  1286. } else {
  1287. return null;
  1288. }
  1289. }
  1290. };
  1291. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1292. var firstTag = this._getFirstTagInLine(session, row);
  1293. if (!firstTag.match)
  1294. return null;
  1295. var isBackward = firstTag.closing || firstTag.selfClosing;
  1296. var stack = [];
  1297. var tag;
  1298. if (!isBackward) {
  1299. var iterator = new TokenIterator(session, row, firstTag.column);
  1300. var start = {
  1301. row: row,
  1302. column: firstTag.column + firstTag.tagName.length + 2
  1303. };
  1304. while (tag = this._readTagForward(iterator)) {
  1305. if (tag.selfClosing) {
  1306. if (!stack.length) {
  1307. tag.start.column += tag.tagName.length + 2;
  1308. tag.end.column -= 2;
  1309. return Range.fromPoints(tag.start, tag.end);
  1310. } else
  1311. continue;
  1312. }
  1313. if (tag.closing) {
  1314. this._pop(stack, tag);
  1315. if (stack.length == 0)
  1316. return Range.fromPoints(start, tag.start);
  1317. }
  1318. else {
  1319. stack.push(tag)
  1320. }
  1321. }
  1322. }
  1323. else {
  1324. var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length);
  1325. var end = {
  1326. row: row,
  1327. column: firstTag.column
  1328. };
  1329. while (tag = this._readTagBackward(iterator)) {
  1330. if (tag.selfClosing) {
  1331. if (!stack.length) {
  1332. tag.start.column += tag.tagName.length + 2;
  1333. tag.end.column -= 2;
  1334. return Range.fromPoints(tag.start, tag.end);
  1335. } else
  1336. continue;
  1337. }
  1338. if (!tag.closing) {
  1339. this._pop(stack, tag);
  1340. if (stack.length == 0) {
  1341. tag.start.column += tag.tagName.length + 2;
  1342. return Range.fromPoints(tag.start, end);
  1343. }
  1344. }
  1345. else {
  1346. stack.push(tag)
  1347. }
  1348. }
  1349. }
  1350. };
  1351. }).call(FoldMode.prototype);
  1352. });
  1353. ace.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/xml', 'ace/mode/folding/html'], function(require, exports, module) {
  1354. var oop = require("../lib/oop");
  1355. var TextMode = require("./text").Mode;
  1356. var JavaScriptMode = require("./javascript").Mode;
  1357. var CssMode = require("./css").Mode;
  1358. var Tokenizer = require("../tokenizer").Tokenizer;
  1359. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  1360. var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
  1361. var HtmlFoldMode = require("./folding/html").FoldMode;
  1362. var Mode = function() {
  1363. var highlighter = new HtmlHighlightRules();
  1364. this.$tokenizer = new Tokenizer(highlighter.getRules());
  1365. this.$behaviour = new XmlBehaviour();
  1366. this.$embeds = highlighter.getEmbeds();
  1367. this.createModeDelegates({
  1368. "js-": JavaScriptMode,
  1369. "css-": CssMode
  1370. });
  1371. this.foldingRules = new HtmlFoldMode();
  1372. };
  1373. oop.inherits(Mode, TextMode);
  1374. (function() {
  1375. this.toggleCommentLines = function(state, doc, startRow, endRow) {
  1376. return 0;
  1377. };
  1378. this.getNextLineIndent = function(state, line, tab) {
  1379. return this.$getIndent(line);
  1380. };
  1381. this.checkOutdent = function(state, line, input) {
  1382. return false;
  1383. };
  1384. }).call(Mode.prototype);
  1385. exports.Mode = Mode;
  1386. });
  1387. ace.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/folding/cstyle'], function(require, exports, module) {
  1388. var oop = require("../lib/oop");
  1389. var TextMode = require("./text").Mode;
  1390. var Tokenizer = require("../tokenizer").Tokenizer;
  1391. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1392. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1393. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1394. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1395. var Mode = function() {
  1396. this.$tokenizer = new Tokenizer(new CssHighlightRules().getRules(), "i");
  1397. this.$outdent = new MatchingBraceOutdent();
  1398. this.foldingRules = new CStyleFoldMode();
  1399. };
  1400. oop.inherits(Mode, TextMode);
  1401. (function() {
  1402. this.foldingRules = "cStyle";
  1403. this.getNextLineIndent = function(state, line, tab) {
  1404. var indent = this.$getIndent(line);
  1405. // ignore braces in comments
  1406. var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
  1407. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1408. return indent;
  1409. }
  1410. var match = line.match(/^.*\{\s*$/);
  1411. if (match) {
  1412. indent += tab;
  1413. }
  1414. return indent;
  1415. };
  1416. this.checkOutdent = function(state, line, input) {
  1417. return this.$outdent.checkOutdent(line, input);
  1418. };
  1419. this.autoOutdent = function(state, doc, row) {
  1420. this.$outdent.autoOutdent(doc, row);
  1421. };
  1422. this.createWorker = function(session) {
  1423. var worker = new WorkerClient(["ace"], "worker-css.js", "ace/mode/css_worker", "Worker");
  1424. worker.attachToDocument(session.getDocument());
  1425. worker.on("csslint", function(e) {
  1426. var errors = [];
  1427. e.data.forEach(function(message) {
  1428. errors.push({
  1429. row: message.line - 1,
  1430. column: message.col - 1,
  1431. text: message.message,
  1432. type: message.type,
  1433. lint: message
  1434. });
  1435. });
  1436. session.setAnnotations(errors);
  1437. });
  1438. return worker;
  1439. };
  1440. }).call(Mode.prototype);
  1441. exports.Mode = Mode;
  1442. });
  1443. ace.define('ace/mode/css_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
  1444. var oop = require("../lib/oop");
  1445. var lang = require("../lib/lang");
  1446. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  1447. var CssHighlightRules = function() {
  1448. var properties = lang.arrayToMap(
  1449. ("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").split("|")
  1450. );
  1451. var functions = lang.arrayToMap(
  1452. ("rgb|rgba|url|attr|counter|counters").split("|")
  1453. );
  1454. var constants = lang.arrayToMap(
  1455. ("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|font-size|font|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|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|")
  1456. );
  1457. var colors = lang.arrayToMap(
  1458. ("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
  1459. "purple|red|silver|teal|white|yellow").split("|")
  1460. );
  1461. var fonts = lang.arrayToMap(
  1462. ("arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|" +
  1463. "symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|" +
  1464. "serif|monospace").split("|")
  1465. );
  1466. // regexp must not have capturing parentheses. Use (?:) instead.
  1467. // regexps are ordered -> the first match is used
  1468. var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
  1469. var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  1470. var 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";
  1471. var base_ruleset = [
  1472. {
  1473. token : "comment", // multi line comment
  1474. merge : true,
  1475. regex : "\\/\\*",
  1476. next : "ruleset_comment"
  1477. }, {
  1478. token : "string", // single line
  1479. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  1480. }, {
  1481. token : "string", // single line
  1482. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  1483. }, {
  1484. token : ["constant.numeric", "keyword"],
  1485. 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|%)"
  1486. }, {
  1487. token : ["constant.numeric"],
  1488. regex : "([0-9]+)"
  1489. }, {
  1490. token : "constant.numeric", // hex6 color
  1491. regex : "#[a-f0-9]{6}"
  1492. }, {
  1493. token : "constant.numeric", // hex3 color
  1494. regex : "#[a-f0-9]{3}"
  1495. }, {
  1496. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  1497. regex : pseudoElements
  1498. }, {
  1499. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  1500. regex : pseudoClasses
  1501. }, {
  1502. token : function(value) {
  1503. if (properties.hasOwnProperty(value.toLowerCase())) {
  1504. return "support.type";
  1505. }
  1506. else if (functions.hasOwnProperty(value.toLowerCase())) {
  1507. return "support.function";
  1508. }
  1509. else if (constants.hasOwnProperty(value.toLowerCase())) {
  1510. return "support.constant";
  1511. }
  1512. else if (colors.hasOwnProperty(value.toLowerCase())) {
  1513. return "support.constant.color";
  1514. }
  1515. else if (fonts.hasOwnProperty(value.toLowerCase())) {
  1516. return "support.constant.fonts";
  1517. }
  1518. else {
  1519. return "text";
  1520. }
  1521. },
  1522. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  1523. }
  1524. ];
  1525. var ruleset = lang.copyArray(base_ruleset);
  1526. ruleset.unshift({
  1527. token : "paren.rparen",
  1528. regex : "\\}",
  1529. next: "start"
  1530. });
  1531. var media_ruleset = lang.copyArray( base_ruleset );
  1532. media_ruleset.unshift({
  1533. token : "paren.rparen",
  1534. regex : "\\}",
  1535. next: "media"
  1536. });
  1537. var base_comment = [{
  1538. token : "comment", // comment spanning whole line
  1539. merge : true,
  1540. regex : ".+"
  1541. }];
  1542. var comment = lang.copyArray(base_comment);
  1543. comment.unshift({
  1544. token : "comment", // closing comment
  1545. regex : ".*?\\*\\/",
  1546. next : "start"
  1547. });
  1548. var media_comment = lang.copyArray(base_comment);
  1549. media_comment.unshift({
  1550. token : "comment", // closing comment
  1551. regex : ".*?\\*\\/",
  1552. next : "media"
  1553. });
  1554. var ruleset_comment = lang.copyArray(base_comment);
  1555. ruleset_comment.unshift({
  1556. token : "comment", // closing comment
  1557. regex : ".*?\\*\\/",
  1558. next : "ruleset"
  1559. });
  1560. this.$rules = {
  1561. "start" : [{
  1562. token : "comment", // multi line comment
  1563. merge : true,
  1564. regex : "\\/\\*",
  1565. next : "comment"
  1566. }, {
  1567. token: "paren.lparen",
  1568. regex: "\\{",
  1569. next: "ruleset"
  1570. }, {
  1571. token: "string",
  1572. regex: "@.*?{",
  1573. next: "media"
  1574. },{
  1575. token: "keyword",
  1576. regex: "#[a-z0-9-_]+"
  1577. },{
  1578. token: "variable",
  1579. regex: "\\.[a-z0-9-_]+"
  1580. },{
  1581. token: "string",
  1582. regex: ":[a-z0-9-_]+"
  1583. },{
  1584. token: "constant",
  1585. regex: "[a-z0-9-_]+"
  1586. }],
  1587. "media" : [ {
  1588. token : "comment", // multi line comment
  1589. merge : true,
  1590. regex : "\\/\\*",
  1591. next : "media_comment"
  1592. }, {
  1593. token: "paren.lparen",
  1594. regex: "\\{",
  1595. next: "media_ruleset"
  1596. },{
  1597. token: "string",
  1598. regex: "\\}",
  1599. next: "start"
  1600. },{
  1601. token: "keyword",
  1602. regex: "#[a-z0-9-_]+"
  1603. },{
  1604. token: "variable",
  1605. regex: "\\.[a-z0-9-_]+"
  1606. },{
  1607. token: "string",
  1608. regex: ":[a-z0-9-_]+"
  1609. },{
  1610. token: "constant",
  1611. regex: "[a-z0-9-_]+"
  1612. }],
  1613. "comment" : comment,
  1614. "ruleset" : ruleset,
  1615. "ruleset_comment" : ruleset_comment,
  1616. "media_ruleset" : media_ruleset,
  1617. "media_comment" : media_comment
  1618. };
  1619. };
  1620. oop.inherits(CssHighlightRules, TextHighlightRules);
  1621. exports.CssHighlightRules = CssHighlightRules;
  1622. });
  1623. ace.define('ace/mode/html_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/css_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_util', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
  1624. var oop = require("../lib/oop");
  1625. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1626. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1627. var xmlUtil = require("./xml_util");
  1628. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  1629. var HtmlHighlightRules = function() {
  1630. // regexp must not have capturing parentheses
  1631. // regexps are ordered -> the first match is used
  1632. this.$rules = {
  1633. start : [{
  1634. token : "text",
  1635. merge : true,
  1636. regex : "<\\!\\[CDATA\\[",
  1637. next : "cdata"
  1638. }, {
  1639. token : "xml_pe",
  1640. regex : "<\\?.*?\\?>"
  1641. }, {
  1642. token : "comment",
  1643. merge : true,
  1644. regex : "<\\!--",
  1645. next : "comment"
  1646. }, {
  1647. token : "xml_pe",
  1648. regex : "<\\!.*?>"
  1649. }, {
  1650. token : "meta.tag",
  1651. regex : "<(?=\s*script\\b)",
  1652. next : "script"
  1653. }, {
  1654. token : "meta.tag",
  1655. regex : "<(?=\s*style\\b)",
  1656. next : "style"
  1657. }, {
  1658. token : "meta.tag", // opening tag
  1659. regex : "<\\/?",
  1660. next : "tag"
  1661. }, {
  1662. token : "text",
  1663. regex : "\\s+"
  1664. }, {
  1665. token : "constant.character.entity",
  1666. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  1667. }, {
  1668. token : "text",
  1669. regex : "[^<]+"
  1670. } ],
  1671. cdata : [ {
  1672. token : "text",
  1673. regex : "\\]\\]>",
  1674. next : "start"
  1675. }, {
  1676. token : "text",
  1677. merge : true,
  1678. regex : "\\s+"
  1679. }, {
  1680. token : "text",
  1681. merge : true,
  1682. regex : ".+"
  1683. } ],
  1684. comment : [ {
  1685. token : "comment",
  1686. regex : ".*?-->",
  1687. next : "start"
  1688. }, {
  1689. token : "comment",
  1690. merge : true,
  1691. regex : ".+"
  1692. } ]
  1693. };
  1694. xmlUtil.tag(this.$rules, "tag", "start");
  1695. xmlUtil.tag(this.$rules, "style", "css-start");
  1696. xmlUtil.tag(this.$rules, "script", "js-start");
  1697. this.embedRules(JavaScriptHighlightRules, "js-", [{
  1698. token: "comment",
  1699. regex: "\\/\\/.*(?=<\\/script>)",
  1700. next: "tag"
  1701. }, {
  1702. token: "meta.tag",
  1703. regex: "<\\/(?=script)",
  1704. next: "tag"
  1705. }]);
  1706. this.embedRules(CssHighlightRules, "css-", [{
  1707. token: "meta.tag",
  1708. regex: "<\\/(?=style)",
  1709. next: "tag"
  1710. }]);
  1711. };
  1712. oop.inherits(HtmlHighlightRules, TextHighlightRules);
  1713. exports.HtmlHighlightRules = HtmlHighlightRules;
  1714. });
  1715. ace.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) {
  1716. var oop = require("../../lib/oop");
  1717. var MixedFoldMode = require("./mixed").FoldMode;
  1718. var XmlFoldMode = require("./xml").FoldMode;
  1719. var CStyleFoldMode = require("./cstyle").FoldMode;
  1720. var FoldMode = exports.FoldMode = function() {
  1721. MixedFoldMode.call(this, new XmlFoldMode({
  1722. // void elements
  1723. "area": 1,
  1724. "base": 1,
  1725. "br": 1,
  1726. "col": 1,
  1727. "command": 1,
  1728. "embed": 1,
  1729. "hr": 1,
  1730. "img": 1,
  1731. "input": 1,
  1732. "keygen": 1,
  1733. "link": 1,
  1734. "meta": 1,
  1735. "param": 1,
  1736. "source": 1,
  1737. "track": 1,
  1738. "wbr": 1,
  1739. // optional tags
  1740. "li": 1,
  1741. "dt": 1,
  1742. "dd": 1,
  1743. "p": 1,
  1744. "rt": 1,
  1745. "rp": 1,
  1746. "optgroup": 1,
  1747. "option": 1,
  1748. "colgroup": 1,
  1749. "td": 1,
  1750. "th": 1
  1751. }), {
  1752. "js-": new CStyleFoldMode(),
  1753. "css-": new CStyleFoldMode()
  1754. });
  1755. };
  1756. oop.inherits(FoldMode, MixedFoldMode);
  1757. });
  1758. ace.define('ace/mode/folding/mixed', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
  1759. var oop = require("../../lib/oop");
  1760. var BaseFoldMode = require("./fold_mode").FoldMode;
  1761. var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
  1762. this.defaultMode = defaultMode;
  1763. this.subModes = subModes;
  1764. };
  1765. oop.inherits(FoldMode, BaseFoldMode);
  1766. (function() {
  1767. this.$getMode = function(state) {
  1768. for (var key in this.subModes) {
  1769. if (state.indexOf(key) === 0)
  1770. return this.subModes[key];
  1771. }
  1772. return null;
  1773. };
  1774. this.$tryMode = function(state, session, foldStyle, row) {
  1775. var mode = this.$getMode(state);
  1776. return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
  1777. };
  1778. this.getFoldWidget = function(session, foldStyle, row) {
  1779. return (
  1780. this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
  1781. this.$tryMode(session.getState(row), session, foldStyle, row) ||
  1782. this.defaultMode.getFoldWidget(session, foldStyle, row)
  1783. );
  1784. };
  1785. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1786. var mode = this.$getMode(session.getState(row-1));
  1787. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1788. mode = this.$getMode(session.getState(row));
  1789. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1790. mode = this.defaultMode;
  1791. return mode.getFoldWidgetRange(session, foldStyle, row);
  1792. };
  1793. }).call(FoldMode.prototype);
  1794. });
  1795. ace.define('ace/mode/markdown_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules', 'ace/mode/javascript_highlight_rules', 'ace/mode/xml_highlight_rules', 'ace/mode/html_highlight_rules', 'ace/mode/css_highlight_rules'], function(require, exports, module) {
  1796. var oop = require("../lib/oop");
  1797. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  1798. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1799. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  1800. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  1801. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1802. function github_embed(tag, prefix) {
  1803. return { // Github style block
  1804. token : "support.function",
  1805. regex : "^```" + tag + "\\s*$",
  1806. next : prefix + "start"
  1807. };
  1808. }
  1809. var MarkdownHighlightRules = function() {
  1810. // regexp must not have capturing parentheses
  1811. // regexps are ordered -> the first match is used
  1812. this.$rules = {
  1813. "start" : [ {
  1814. token : "empty_line",
  1815. regex : '^$'
  1816. }, { // code span `
  1817. token : ["support.function", "support.function", "support.function"],
  1818. regex : "(`+)([^\\r]*?[^`])(\\1)"
  1819. }, { // code block
  1820. token : "support.function",
  1821. regex : "^[ ]{4}.+"
  1822. }, { // h1
  1823. token: "markup.heading.1",
  1824. regex: "^=+(?=\\s*$)"
  1825. }, { // h2
  1826. token: "markup.heading.1",
  1827. regex: "^\\-+(?=\\s*$)"
  1828. }, { // header
  1829. token : function(value) {
  1830. return "markup.heading." + value.length;
  1831. },
  1832. regex : "^#{1,6}"
  1833. }, github_embed("(?:javascript|js)", "js-"),
  1834. github_embed("xml", "xml-"),
  1835. github_embed("html", "html-"),
  1836. github_embed("css", "css-"),
  1837. { // Github style block
  1838. token : "support.function",
  1839. regex : "^```[a-zA-Z]+\\s*$",
  1840. next : "githubblock"
  1841. }, { // block quote
  1842. token : "string",
  1843. regex : "^>[ ].+$",
  1844. next : "blockquote"
  1845. }, { // reference
  1846. token : ["text", "constant", "text", "url", "string", "text"],
  1847. regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
  1848. }, { // link by reference
  1849. token : ["text", "string", "text", "constant", "text"],
  1850. regex : "(\\[)((?:[[^\\]]*\\]|[^\\[\\]])*)(\\][ ]?(?:\\n[ ]*)?\\[)(.*?)(\\])"
  1851. }, { // link by url
  1852. token : ["text", "string", "text", "markup.underline", "string", "text"],
  1853. regex : "(\\[)"+
  1854. "(\\[[^\\]]*\\]|[^\\[\\]]*)"+
  1855. "(\\]\\([ \\t]*)"+
  1856. "(<?(?:(?:[^\\(]*?\\([^\\)]*?\\)\\S*?)|(?:.*?))>?)"+
  1857. "((?:[ \t]*\"(?:.*?)\"[ \\t]*)?)"+
  1858. "(\\))"
  1859. }, { // HR *
  1860. token : "constant",
  1861. regex : "^[ ]{0,2}(?:[ ]?\\*[ ]?){3,}\\s*$"
  1862. }, { // HR -
  1863. token : "constant",
  1864. regex : "^[ ]{0,2}(?:[ ]?\\-[ ]?){3,}\\s*$"
  1865. }, { // HR _
  1866. token : "constant",
  1867. regex : "^[ ]{0,2}(?:[ ]?\\_[ ]?){3,}\\s*$"
  1868. }, { // list
  1869. token : "markup.list",
  1870. regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  1871. next : "listblock"
  1872. }, { // strong ** __
  1873. token : ["string", "string", "string"],
  1874. regex : "([*]{2}|[_]{2}(?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
  1875. }, { // emphasis * _
  1876. token : ["string", "string", "string"],
  1877. regex : "([*]|[_](?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
  1878. }, { //
  1879. token : ["text", "url", "text"],
  1880. regex : "(<)("+
  1881. "(?:https?|ftp|dict):[^'\">\\s]+"+
  1882. "|"+
  1883. "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+"+
  1884. ")(>)"
  1885. }, {
  1886. token : "text",
  1887. regex : "[^\\*_%$`\\[#<>]+"
  1888. } ],
  1889. "listblock" : [ { // Lists only escape on completely blank lines.
  1890. token : "empty_line",
  1891. regex : "^$",
  1892. next : "start"
  1893. }, {
  1894. token : "markup.list",
  1895. regex : ".+"
  1896. } ],
  1897. "blockquote" : [ { // BLockquotes only escape on blank lines.
  1898. token : "empty_line",
  1899. regex : "^\\s*$",
  1900. next : "start"
  1901. }, {
  1902. token : "string",
  1903. regex : ".+"
  1904. } ],
  1905. "githubblock" : [ {
  1906. token : "support.function",
  1907. regex : "^```",
  1908. next : "start"
  1909. }, {
  1910. token : "support.function",
  1911. regex : ".+"
  1912. } ]
  1913. };
  1914. this.embedRules(JavaScriptHighlightRules, "js-", [{
  1915. token : "support.function",
  1916. regex : "^```",
  1917. next : "start"
  1918. }]);
  1919. this.embedRules(HtmlHighlightRules, "html-", [{
  1920. token : "support.function",
  1921. regex : "^```",
  1922. next : "start"
  1923. }]);
  1924. this.embedRules(CssHighlightRules, "css-", [{
  1925. token : "support.function",
  1926. regex : "^```",
  1927. next : "start"
  1928. }]);
  1929. this.embedRules(XmlHighlightRules, "xml-", [{
  1930. token : "support.function",
  1931. regex : "^```",
  1932. next : "start"
  1933. }]);
  1934. };
  1935. oop.inherits(MarkdownHighlightRules, TextHighlightRules);
  1936. exports.MarkdownHighlightRules = MarkdownHighlightRules;
  1937. });