a2261070a7d66bcb237f0ea938b6ec5e.js 70 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598
  1. ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  2. var oop = require("../lib/oop");
  3. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  4. var DocCommentHighlightRules = function () {
  5. this.$rules = {
  6. "start": [{
  7. token: "comment.doc.tag",
  8. regex: "@[\\w\\d_]+" // TODO: fix email addresses
  9. },
  10. DocCommentHighlightRules.getTagRule(),
  11. {
  12. defaultToken: "comment.doc",
  13. caseInsensitive: true
  14. }]
  15. };
  16. };
  17. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  18. DocCommentHighlightRules.getTagRule = function (start) {
  19. return {
  20. token: "comment.doc.tag.storage.type",
  21. regex: "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  22. };
  23. };
  24. DocCommentHighlightRules.getStartRule = function (start) {
  25. return {
  26. token: "comment.doc",
  27. regex: "\\/\\*(?=\\*)",
  28. next: start
  29. };
  30. };
  31. DocCommentHighlightRules.getEndRule = function (start) {
  32. return {
  33. token: "comment.doc",
  34. regex: "\\*\\/",
  35. next: start
  36. };
  37. };
  38. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  39. });
  40. ace.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){"use strict";
  41. var oop = require("../lib/oop");
  42. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  43. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  44. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
  45. var JavaScriptHighlightRules = function (options) {
  46. var keywordMapper = this.createKeywordMapper({
  47. "variable.language": "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
  48. "Namespace|QName|XML|XMLList|" + // E4X
  49. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  50. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  51. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
  52. "SyntaxError|TypeError|URIError|" +
  53. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
  54. "isNaN|parseFloat|parseInt|" +
  55. "JSON|Math|" + // Other
  56. "this|arguments|prototype|window|document",
  57. "keyword": "const|yield|import|get|set|async|await|" +
  58. "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  59. "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  60. "__parent__|__count__|escape|unescape|with|__proto__|" +
  61. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
  62. "storage.type": "const|let|var|function",
  63. "constant.language": "null|Infinity|NaN|undefined",
  64. "support.function": "alert",
  65. "constant.language.boolean": "true|false"
  66. }, "identifier");
  67. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
  68. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  69. "u[0-9a-fA-F]{4}|" + // unicode
  70. "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
  71. "[0-2][0-7]{0,2}|" + // oct
  72. "3[0-7][0-7]?|" + // oct
  73. "[4-7][0-7]?|" + //oct
  74. ".)";
  75. this.$rules = {
  76. "no_regex": [
  77. DocCommentHighlightRules.getStartRule("doc-start"),
  78. comments("no_regex"),
  79. {
  80. token: "string",
  81. regex: "'(?=.)",
  82. next: "qstring"
  83. }, {
  84. token: "string",
  85. regex: '"(?=.)',
  86. next: "qqstring"
  87. }, {
  88. token: "constant.numeric",
  89. regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
  90. }, {
  91. token: "constant.numeric",
  92. regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
  93. }, {
  94. token: [
  95. "storage.type", "punctuation.operator", "support.function",
  96. "punctuation.operator", "entity.name.function", "text", "keyword.operator"
  97. ],
  98. regex: "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe + ")(\\s*)(=)",
  99. next: "function_arguments"
  100. }, {
  101. token: [
  102. "storage.type", "punctuation.operator", "entity.name.function", "text",
  103. "keyword.operator", "text", "storage.type", "text", "paren.lparen"
  104. ],
  105. regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  106. next: "function_arguments"
  107. }, {
  108. token: [
  109. "entity.name.function", "text", "keyword.operator", "text", "storage.type",
  110. "text", "paren.lparen"
  111. ],
  112. regex: "(" + identifierRe + ")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  113. next: "function_arguments"
  114. }, {
  115. token: [
  116. "storage.type", "punctuation.operator", "entity.name.function", "text",
  117. "keyword.operator", "text",
  118. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  119. ],
  120. regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
  121. next: "function_arguments"
  122. }, {
  123. token: [
  124. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  125. ],
  126. regex: "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
  127. next: "function_arguments"
  128. }, {
  129. token: [
  130. "entity.name.function", "text", "punctuation.operator",
  131. "text", "storage.type", "text", "paren.lparen"
  132. ],
  133. regex: "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
  134. next: "function_arguments"
  135. }, {
  136. token: [
  137. "text", "text", "storage.type", "text", "paren.lparen"
  138. ],
  139. regex: "(:)(\\s*)(function)(\\s*)(\\()",
  140. next: "function_arguments"
  141. }, {
  142. token: "keyword",
  143. regex: "from(?=\\s*('|\"))"
  144. }, {
  145. token: "keyword",
  146. regex: "(?:" + kwBeforeRe + ")\\b",
  147. next: "start"
  148. }, {
  149. token: ["support.constant"],
  150. regex: /that\b/
  151. }, {
  152. token: ["storage.type", "punctuation.operator", "support.function.firebug"],
  153. regex: /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
  154. }, {
  155. token: keywordMapper,
  156. regex: identifierRe
  157. }, {
  158. token: "punctuation.operator",
  159. regex: /[.](?![.])/,
  160. next: "property"
  161. }, {
  162. token: "storage.type",
  163. regex: /=>/,
  164. next: "start"
  165. }, {
  166. token: "keyword.operator",
  167. regex: /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
  168. next: "start"
  169. }, {
  170. token: "punctuation.operator",
  171. regex: /[?:,;.]/,
  172. next: "start"
  173. }, {
  174. token: "paren.lparen",
  175. regex: /[\[({]/,
  176. next: "start"
  177. }, {
  178. token: "paren.rparen",
  179. regex: /[\])}]/
  180. }, {
  181. token: "comment",
  182. regex: /^#!.*$/
  183. }
  184. ],
  185. property: [{
  186. token: "text",
  187. regex: "\\s+"
  188. }, {
  189. token: [
  190. "storage.type", "punctuation.operator", "entity.name.function", "text",
  191. "keyword.operator", "text",
  192. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  193. ],
  194. regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
  195. next: "function_arguments"
  196. }, {
  197. token: "punctuation.operator",
  198. regex: /[.](?![.])/
  199. }, {
  200. token: "support.function",
  201. regex: /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|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(?=\()/
  202. }, {
  203. token: "support.function.dom",
  204. 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|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
  205. }, {
  206. token: "support.constant",
  207. 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/
  208. }, {
  209. token: "identifier",
  210. regex: identifierRe
  211. }, {
  212. regex: "",
  213. token: "empty",
  214. next: "no_regex"
  215. }
  216. ],
  217. "start": [
  218. DocCommentHighlightRules.getStartRule("doc-start"),
  219. comments("start"),
  220. {
  221. token: "string.regexp",
  222. regex: "\\/",
  223. next: "regex"
  224. }, {
  225. token: "text",
  226. regex: "\\s+|^$",
  227. next: "start"
  228. }, {
  229. token: "empty",
  230. regex: "",
  231. next: "no_regex"
  232. }
  233. ],
  234. "regex": [
  235. {
  236. token: "regexp.keyword.operator",
  237. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  238. }, {
  239. token: "string.regexp",
  240. regex: "/[sxngimy]*",
  241. next: "no_regex"
  242. }, {
  243. token: "invalid",
  244. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  245. }, {
  246. token: "constant.language.escape",
  247. regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  248. }, {
  249. token: "constant.language.delimiter",
  250. regex: /\|/
  251. }, {
  252. token: "constant.language.escape",
  253. regex: /\[\^?/,
  254. next: "regex_character_class"
  255. }, {
  256. token: "empty",
  257. regex: "$",
  258. next: "no_regex"
  259. }, {
  260. defaultToken: "string.regexp"
  261. }
  262. ],
  263. "regex_character_class": [
  264. {
  265. token: "regexp.charclass.keyword.operator",
  266. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  267. }, {
  268. token: "constant.language.escape",
  269. regex: "]",
  270. next: "regex"
  271. }, {
  272. token: "constant.language.escape",
  273. regex: "-"
  274. }, {
  275. token: "empty",
  276. regex: "$",
  277. next: "no_regex"
  278. }, {
  279. defaultToken: "string.regexp.charachterclass"
  280. }
  281. ],
  282. "function_arguments": [
  283. {
  284. token: "variable.parameter",
  285. regex: identifierRe
  286. }, {
  287. token: "punctuation.operator",
  288. regex: "[, ]+"
  289. }, {
  290. token: "punctuation.operator",
  291. regex: "$"
  292. }, {
  293. token: "empty",
  294. regex: "",
  295. next: "no_regex"
  296. }
  297. ],
  298. "qqstring": [
  299. {
  300. token: "constant.language.escape",
  301. regex: escapedRe
  302. }, {
  303. token: "string",
  304. regex: "\\\\$",
  305. consumeLineEnd: true
  306. }, {
  307. token: "string",
  308. regex: '"|$',
  309. next: "no_regex"
  310. }, {
  311. defaultToken: "string"
  312. }
  313. ],
  314. "qstring": [
  315. {
  316. token: "constant.language.escape",
  317. regex: escapedRe
  318. }, {
  319. token: "string",
  320. regex: "\\\\$",
  321. consumeLineEnd: true
  322. }, {
  323. token: "string",
  324. regex: "'|$",
  325. next: "no_regex"
  326. }, {
  327. defaultToken: "string"
  328. }
  329. ]
  330. };
  331. if (!options || !options.noES6) {
  332. this.$rules.no_regex.unshift({
  333. regex: "[{}]", onMatch: function (val, state, stack) {
  334. this.next = val == "{" ? this.nextState : "";
  335. if (val == "{" && stack.length) {
  336. stack.unshift("start", state);
  337. }
  338. else if (val == "}" && stack.length) {
  339. stack.shift();
  340. this.next = stack.shift();
  341. if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
  342. return "paren.quasi.end";
  343. }
  344. return val == "{" ? "paren.lparen" : "paren.rparen";
  345. },
  346. nextState: "start"
  347. }, {
  348. token: "string.quasi.start",
  349. regex: /`/,
  350. push: [{
  351. token: "constant.language.escape",
  352. regex: escapedRe
  353. }, {
  354. token: "paren.quasi.start",
  355. regex: /\${/,
  356. push: "start"
  357. }, {
  358. token: "string.quasi.end",
  359. regex: /`/,
  360. next: "pop"
  361. }, {
  362. defaultToken: "string.quasi"
  363. }]
  364. });
  365. if (!options || options.jsx != false)
  366. JSX.call(this);
  367. }
  368. this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("no_regex")]);
  369. this.normalizeRules();
  370. };
  371. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  372. function JSX() {
  373. var tagRegex = identifierRe.replace("\\d", "\\d\\-");
  374. var jsxTag = {
  375. onMatch: function (val, state, stack) {
  376. var offset = val.charAt(1) == "/" ? 2 : 1;
  377. if (offset == 1) {
  378. if (state != this.nextState)
  379. stack.unshift(this.next, this.nextState, 0);
  380. else
  381. stack.unshift(this.next);
  382. stack[2]++;
  383. }
  384. else if (offset == 2) {
  385. if (state == this.nextState) {
  386. stack[1]--;
  387. if (!stack[1] || stack[1] < 0) {
  388. stack.shift();
  389. stack.shift();
  390. }
  391. }
  392. }
  393. return [{
  394. type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
  395. value: val.slice(0, offset)
  396. }, {
  397. type: "meta.tag.tag-name.xml",
  398. value: val.substr(offset)
  399. }];
  400. },
  401. regex: "</?" + tagRegex + "",
  402. next: "jsxAttributes",
  403. nextState: "jsx"
  404. };
  405. this.$rules.start.unshift(jsxTag);
  406. var jsxJsRule = {
  407. regex: "{",
  408. token: "paren.quasi.start",
  409. push: "start"
  410. };
  411. this.$rules.jsx = [
  412. jsxJsRule,
  413. jsxTag,
  414. { include: "reference" },
  415. { defaultToken: "string" }
  416. ];
  417. this.$rules.jsxAttributes = [{
  418. token: "meta.tag.punctuation.tag-close.xml",
  419. regex: "/?>",
  420. onMatch: function (value, currentState, stack) {
  421. if (currentState == stack[0])
  422. stack.shift();
  423. if (value.length == 2) {
  424. if (stack[0] == this.nextState)
  425. stack[1]--;
  426. if (!stack[1] || stack[1] < 0) {
  427. stack.splice(0, 2);
  428. }
  429. }
  430. this.next = stack[0] || "start";
  431. return [{ type: this.token, value: value }];
  432. },
  433. nextState: "jsx"
  434. },
  435. jsxJsRule,
  436. comments("jsxAttributes"),
  437. {
  438. token: "entity.other.attribute-name.xml",
  439. regex: tagRegex
  440. }, {
  441. token: "keyword.operator.attribute-equals.xml",
  442. regex: "="
  443. }, {
  444. token: "text.tag-whitespace.xml",
  445. regex: "\\s+"
  446. }, {
  447. token: "string.attribute-value.xml",
  448. regex: "'",
  449. stateName: "jsx_attr_q",
  450. push: [
  451. { token: "string.attribute-value.xml", regex: "'", next: "pop" },
  452. { include: "reference" },
  453. { defaultToken: "string.attribute-value.xml" }
  454. ]
  455. }, {
  456. token: "string.attribute-value.xml",
  457. regex: '"',
  458. stateName: "jsx_attr_qq",
  459. push: [
  460. { token: "string.attribute-value.xml", regex: '"', next: "pop" },
  461. { include: "reference" },
  462. { defaultToken: "string.attribute-value.xml" }
  463. ]
  464. },
  465. jsxTag
  466. ];
  467. this.$rules.reference = [{
  468. token: "constant.language.escape.reference.xml",
  469. regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  470. }];
  471. }
  472. function comments(next) {
  473. return [
  474. {
  475. token: "comment",
  476. regex: /\/\*/,
  477. next: [
  478. DocCommentHighlightRules.getTagRule(),
  479. { token: "comment", regex: "\\*\\/", next: next || "pop" },
  480. { defaultToken: "comment", caseInsensitive: true }
  481. ]
  482. }, {
  483. token: "comment",
  484. regex: "\\/\\/",
  485. next: [
  486. DocCommentHighlightRules.getTagRule(),
  487. { token: "comment", regex: "$|^", next: next || "pop" },
  488. { defaultToken: "comment", caseInsensitive: true }
  489. ]
  490. }
  491. ];
  492. }
  493. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  494. });
  495. 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){"use strict";
  496. var oop = require("../lib/oop");
  497. var lang = require("../lib/lang");
  498. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  499. var supportType = exports.supportType = "align-content|align-items|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|border|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|bottom|box-shadow|box-sizing|caption-side|clear|clip|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|cursor|direction|display|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|font|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|hanging-punctuation|height|justify-content|left|letter-spacing|line-height|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|max-height|max-width|max-zoom|min-height|min-width|min-zoom|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|order|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page-break-after|page-break-before|page-break-inside|perspective|perspective-origin|position|quotes|resize|right|tab-size|table-layout|text-align|text-align-last|text-decoration|text-decoration-color|text-decoration-line|text-decoration-style|text-indent|text-justify|text-overflow|text-shadow|text-transform|top|transform|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|user-select|user-zoom|vertical-align|visibility|white-space|width|word-break|word-spacing|word-wrap|z-index";
  500. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  501. var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero|zoom";
  502. var supportConstantColor = exports.supportConstantColor = "aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen";
  503. var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
  504. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
  505. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  506. var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
  507. var CssHighlightRules = function () {
  508. var keywordMapper = this.createKeywordMapper({
  509. "support.function": supportFunction,
  510. "support.constant": supportConstant,
  511. "support.type": supportType,
  512. "support.constant.color": supportConstantColor,
  513. "support.constant.fonts": supportConstantFonts
  514. }, "text", true);
  515. this.$rules = {
  516. "start": [{
  517. include: ["strings", "url", "comments"]
  518. }, {
  519. token: "paren.lparen",
  520. regex: "\\{",
  521. next: "ruleset"
  522. }, {
  523. token: "paren.rparen",
  524. regex: "\\}"
  525. }, {
  526. token: "string",
  527. regex: "@(?!viewport)",
  528. next: "media"
  529. }, {
  530. token: "keyword",
  531. regex: "#[a-z0-9-_]+"
  532. }, {
  533. token: "keyword",
  534. regex: "%"
  535. }, {
  536. token: "variable",
  537. regex: "\\.[a-z0-9-_]+"
  538. }, {
  539. token: "string",
  540. regex: ":[a-z0-9-_]+"
  541. }, {
  542. token: "constant.numeric",
  543. regex: numRe
  544. }, {
  545. token: "constant",
  546. regex: "[a-z0-9-_]+"
  547. }, {
  548. caseInsensitive: true
  549. }],
  550. "media": [{
  551. include: ["strings", "url", "comments"]
  552. }, {
  553. token: "paren.lparen",
  554. regex: "\\{",
  555. next: "start"
  556. }, {
  557. token: "paren.rparen",
  558. regex: "\\}",
  559. next: "start"
  560. }, {
  561. token: "string",
  562. regex: ";",
  563. next: "start"
  564. }, {
  565. token: "keyword",
  566. regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
  567. + "|page|font|keyframes|viewport|counter-style|font-feature-values"
  568. + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
  569. }],
  570. "comments": [{
  571. token: "comment",
  572. regex: "\\/\\*",
  573. push: [{
  574. token: "comment",
  575. regex: "\\*\\/",
  576. next: "pop"
  577. }, {
  578. defaultToken: "comment"
  579. }]
  580. }],
  581. "ruleset": [{
  582. regex: "-(webkit|ms|moz|o)-",
  583. token: "text"
  584. }, {
  585. token: "punctuation.operator",
  586. regex: "[:;]"
  587. }, {
  588. token: "paren.rparen",
  589. regex: "\\}",
  590. next: "start"
  591. }, {
  592. include: ["strings", "url", "comments"]
  593. }, {
  594. token: ["constant.numeric", "keyword"],
  595. regex: "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vmax|vmin|vm|vw|%)"
  596. }, {
  597. token: "constant.numeric",
  598. regex: numRe
  599. }, {
  600. token: "constant.numeric",
  601. regex: "#[a-f0-9]{6}"
  602. }, {
  603. token: "constant.numeric",
  604. regex: "#[a-f0-9]{3}"
  605. }, {
  606. token: ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  607. regex: pseudoElements
  608. }, {
  609. token: ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  610. regex: pseudoClasses
  611. }, {
  612. include: "url"
  613. }, {
  614. token: keywordMapper,
  615. regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  616. }, {
  617. caseInsensitive: true
  618. }],
  619. url: [{
  620. token: "support.function",
  621. regex: "(?:url(:?-prefix)?|domain|regexp)\\(",
  622. push: [{
  623. token: "support.function",
  624. regex: "\\)",
  625. next: "pop"
  626. }, {
  627. defaultToken: "string"
  628. }]
  629. }],
  630. strings: [{
  631. token: "string.start",
  632. regex: "'",
  633. push: [{
  634. token: "string.end",
  635. regex: "'|$",
  636. next: "pop"
  637. }, {
  638. include: "escapes"
  639. }, {
  640. token: "constant.language.escape",
  641. regex: /\\$/,
  642. consumeLineEnd: true
  643. }, {
  644. defaultToken: "string"
  645. }]
  646. }, {
  647. token: "string.start",
  648. regex: '"',
  649. push: [{
  650. token: "string.end",
  651. regex: '"|$',
  652. next: "pop"
  653. }, {
  654. include: "escapes"
  655. }, {
  656. token: "constant.language.escape",
  657. regex: /\\$/,
  658. consumeLineEnd: true
  659. }, {
  660. defaultToken: "string"
  661. }]
  662. }],
  663. escapes: [{
  664. token: "constant.language.escape",
  665. regex: /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
  666. }]
  667. };
  668. this.normalizeRules();
  669. };
  670. oop.inherits(CssHighlightRules, TextHighlightRules);
  671. exports.CssHighlightRules = CssHighlightRules;
  672. });
  673. ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  674. var oop = require("../lib/oop");
  675. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  676. var XmlHighlightRules = function (normalize) {
  677. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  678. this.$rules = {
  679. start: [
  680. { token: "string.cdata.xml", regex: "<\\!\\[CDATA\\[", next: "cdata" },
  681. {
  682. token: ["punctuation.instruction.xml", "keyword.instruction.xml"],
  683. regex: "(<\\?)(" + tagRegex + ")", next: "processing_instruction"
  684. },
  685. { token: "comment.start.xml", regex: "<\\!--", next: "comment" },
  686. {
  687. token: ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  688. regex: "(<\\!)(DOCTYPE)(?=[\\s])", next: "doctype", caseInsensitive: true
  689. },
  690. { include: "tag" },
  691. { token: "text.end-tag-open.xml", regex: "</" },
  692. { token: "text.tag-open.xml", regex: "<" },
  693. { include: "reference" },
  694. { defaultToken: "text.xml" }
  695. ],
  696. processing_instruction: [{
  697. token: "entity.other.attribute-name.decl-attribute-name.xml",
  698. regex: tagRegex
  699. }, {
  700. token: "keyword.operator.decl-attribute-equals.xml",
  701. regex: "="
  702. }, {
  703. include: "whitespace"
  704. }, {
  705. include: "string"
  706. }, {
  707. token: "punctuation.xml-decl.xml",
  708. regex: "\\?>",
  709. next: "start"
  710. }],
  711. doctype: [
  712. { include: "whitespace" },
  713. { include: "string" },
  714. { token: "xml-pe.doctype.xml", regex: ">", next: "start" },
  715. { token: "xml-pe.xml", regex: "[-_a-zA-Z0-9:]+" },
  716. { token: "punctuation.int-subset", regex: "\\[", push: "int_subset" }
  717. ],
  718. int_subset: [{
  719. token: "text.xml",
  720. regex: "\\s+"
  721. }, {
  722. token: "punctuation.int-subset.xml",
  723. regex: "]",
  724. next: "pop"
  725. }, {
  726. token: ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  727. regex: "(<\\!)(" + tagRegex + ")",
  728. push: [{
  729. token: "text",
  730. regex: "\\s+"
  731. },
  732. {
  733. token: "punctuation.markup-decl.xml",
  734. regex: ">",
  735. next: "pop"
  736. },
  737. { include: "string" }]
  738. }],
  739. cdata: [
  740. { token: "string.cdata.xml", regex: "\\]\\]>", next: "start" },
  741. { token: "text.xml", regex: "\\s+" },
  742. { token: "text.xml", regex: "(?:[^\\]]|\\](?!\\]>))+" }
  743. ],
  744. comment: [
  745. { token: "comment.end.xml", regex: "-->", next: "start" },
  746. { defaultToken: "comment.xml" }
  747. ],
  748. reference: [{
  749. token: "constant.language.escape.reference.xml",
  750. regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  751. }],
  752. attr_reference: [{
  753. token: "constant.language.escape.reference.attribute-value.xml",
  754. regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  755. }],
  756. tag: [{
  757. token: ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  758. regex: "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  759. next: [
  760. { include: "attributes" },
  761. { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start" }
  762. ]
  763. }],
  764. tag_whitespace: [
  765. { token: "text.tag-whitespace.xml", regex: "\\s+" }
  766. ],
  767. whitespace: [
  768. { token: "text.whitespace.xml", regex: "\\s+" }
  769. ],
  770. string: [{
  771. token: "string.xml",
  772. regex: "'",
  773. push: [
  774. { token: "string.xml", regex: "'", next: "pop" },
  775. { defaultToken: "string.xml" }
  776. ]
  777. }, {
  778. token: "string.xml",
  779. regex: '"',
  780. push: [
  781. { token: "string.xml", regex: '"', next: "pop" },
  782. { defaultToken: "string.xml" }
  783. ]
  784. }],
  785. attributes: [{
  786. token: "entity.other.attribute-name.xml",
  787. regex: tagRegex
  788. }, {
  789. token: "keyword.operator.attribute-equals.xml",
  790. regex: "="
  791. }, {
  792. include: "tag_whitespace"
  793. }, {
  794. include: "attribute_value"
  795. }],
  796. attribute_value: [{
  797. token: "string.attribute-value.xml",
  798. regex: "'",
  799. push: [
  800. { token: "string.attribute-value.xml", regex: "'", next: "pop" },
  801. { include: "attr_reference" },
  802. { defaultToken: "string.attribute-value.xml" }
  803. ]
  804. }, {
  805. token: "string.attribute-value.xml",
  806. regex: '"',
  807. push: [
  808. { token: "string.attribute-value.xml", regex: '"', next: "pop" },
  809. { include: "attr_reference" },
  810. { defaultToken: "string.attribute-value.xml" }
  811. ]
  812. }]
  813. };
  814. if (this.constructor === XmlHighlightRules)
  815. this.normalizeRules();
  816. };
  817. (function () {
  818. this.embedTagRules = function (HighlightRules, prefix, tag) {
  819. this.$rules.tag.unshift({
  820. token: ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  821. regex: "(<)(" + tag + "(?=\\s|>|$))",
  822. next: [
  823. { include: "attributes" },
  824. { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: prefix + "start" }
  825. ]
  826. });
  827. this.$rules[tag + "-end"] = [
  828. { include: "attributes" },
  829. { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start",
  830. onMatch: function (value, currentState, stack) {
  831. stack.splice(0);
  832. return this.token;
  833. } }
  834. ];
  835. this.embedRules(HighlightRules, prefix, [{
  836. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  837. regex: "(</)(" + tag + "(?=\\s|>|$))",
  838. next: tag + "-end"
  839. }, {
  840. token: "string.cdata.xml",
  841. regex: "<\\!\\[CDATA\\["
  842. }, {
  843. token: "string.cdata.xml",
  844. regex: "\\]\\]>"
  845. }]);
  846. };
  847. }).call(TextHighlightRules.prototype);
  848. oop.inherits(XmlHighlightRules, TextHighlightRules);
  849. exports.XmlHighlightRules = XmlHighlightRules;
  850. });
  851. ace.define("ace/mode/html_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/css_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"], function(require, exports, module){"use strict";
  852. var oop = require("../lib/oop");
  853. var lang = require("../lib/lang");
  854. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  855. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  856. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  857. var tagMap = lang.createMap({
  858. a: 'anchor',
  859. button: 'form',
  860. form: 'form',
  861. img: 'image',
  862. input: 'form',
  863. label: 'form',
  864. option: 'form',
  865. script: 'script',
  866. select: 'form',
  867. textarea: 'form',
  868. style: 'style',
  869. table: 'table',
  870. tbody: 'table',
  871. td: 'table',
  872. tfoot: 'table',
  873. th: 'table',
  874. tr: 'table'
  875. });
  876. var HtmlHighlightRules = function () {
  877. XmlHighlightRules.call(this);
  878. this.addRules({
  879. attributes: [{
  880. include: "tag_whitespace"
  881. }, {
  882. token: "entity.other.attribute-name.xml",
  883. regex: "[-_a-zA-Z0-9:.]+"
  884. }, {
  885. token: "keyword.operator.attribute-equals.xml",
  886. regex: "=",
  887. push: [{
  888. include: "tag_whitespace"
  889. }, {
  890. token: "string.unquoted.attribute-value.html",
  891. regex: "[^<>='\"`\\s]+",
  892. next: "pop"
  893. }, {
  894. token: "empty",
  895. regex: "",
  896. next: "pop"
  897. }]
  898. }, {
  899. include: "attribute_value"
  900. }],
  901. tag: [{
  902. token: function (start, tag) {
  903. var group = tagMap[tag];
  904. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  905. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  906. },
  907. regex: "(</?)([-_a-zA-Z0-9:.]+)",
  908. next: "tag_stuff"
  909. }],
  910. tag_stuff: [
  911. { include: "attributes" },
  912. { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start" }
  913. ]
  914. });
  915. this.embedTagRules(CssHighlightRules, "css-", "style");
  916. this.embedTagRules(new JavaScriptHighlightRules({ jsx: false }).getRules(), "js-", "script");
  917. if (this.constructor === HtmlHighlightRules)
  918. this.normalizeRules();
  919. };
  920. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  921. exports.HtmlHighlightRules = HtmlHighlightRules;
  922. });
  923. ace.define("ace/mode/markdown_highlight_rules",["require","exports","module","ace/config","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/html_highlight_rules"], function(require, exports, module){"use strict";
  924. var modes = require("../config").$modes;
  925. var oop = require("../lib/oop");
  926. var lang = require("../lib/lang");
  927. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  928. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  929. var escaped = function (ch) {
  930. return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*";
  931. };
  932. var MarkdownHighlightRules = function () {
  933. HtmlHighlightRules.call(this);
  934. var codeBlockStartRule = {
  935. token: "support.function",
  936. regex: /^\s*(```+[^`]*|~~~+[^~]*)$/,
  937. onMatch: function (value, state, stack, line) {
  938. var m = value.match(/^(\s*)([`~]+)(.*)/);
  939. var language = /[\w-]+|$/.exec(m[3])[0];
  940. if (!modes[language])
  941. language = "";
  942. stack.unshift("githubblock", [], [m[1], m[2], language], state);
  943. return this.token;
  944. },
  945. next: "githubblock"
  946. };
  947. var codeBlockRules = [{
  948. token: "support.function",
  949. regex: ".*",
  950. onMatch: function (value, state, stack, line) {
  951. var embedState = stack[1];
  952. var indent = stack[2][0];
  953. var endMarker = stack[2][1];
  954. var language = stack[2][2];
  955. var m = /^(\s*)(`+|~+)\s*$/.exec(value);
  956. if (m && m[1].length < indent.length + 3
  957. && m[2].length >= endMarker.length && m[2][0] == endMarker[0]) {
  958. stack.splice(0, 3);
  959. this.next = stack.shift();
  960. return this.token;
  961. }
  962. this.next = "";
  963. if (language && modes[language]) {
  964. var data = modes[language].getTokenizer().getLineTokens(value, embedState.slice(0));
  965. stack[1] = data.state;
  966. return data.tokens;
  967. }
  968. return this.token;
  969. }
  970. }];
  971. this.$rules["start"].unshift({
  972. token: "empty_line",
  973. regex: '^$',
  974. next: "allowBlock"
  975. }, {
  976. token: "markup.heading.1",
  977. regex: "^=+(?=\\s*$)"
  978. }, {
  979. token: "markup.heading.2",
  980. regex: "^\\-+(?=\\s*$)"
  981. }, {
  982. token: function (value) {
  983. return "markup.heading." + value.length;
  984. },
  985. regex: /^#{1,6}(?=\s|$)/,
  986. next: "header"
  987. }, codeBlockStartRule, {
  988. token: "string.blockquote",
  989. regex: "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  990. next: "blockquote"
  991. }, {
  992. token: "constant",
  993. regex: "^ {0,3}(?:(?:\\* ?){3,}|(?:\\- ?){3,}|(?:\\_ ?){3,})\\s*$",
  994. next: "allowBlock"
  995. }, {
  996. token: "markup.list",
  997. regex: "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  998. next: "listblock-start"
  999. }, {
  1000. include: "basic"
  1001. });
  1002. this.addRules({
  1003. "basic": [{
  1004. token: "constant.language.escape",
  1005. regex: /\\[\\`*_{}\[\]()#+\-.!]/
  1006. }, {
  1007. token: "support.function",
  1008. regex: "(`+)(.*?[^`])(\\1)"
  1009. }, {
  1010. token: ["text", "constant", "text", "url", "string", "text"],
  1011. regex: "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
  1012. }, {
  1013. token: ["text", "string", "text", "constant", "text"],
  1014. regex: "(\\[)(" + escaped("]") + ")(\\]\\s*\\[)(" + escaped("]") + ")(\\])"
  1015. }, {
  1016. token: ["text", "string", "text", "markup.underline", "string", "text"],
  1017. regex: "(\\!?\\[)(" + // [
  1018. escaped("]") + // link text or alt text
  1019. ")(\\]\\()" + // ](
  1020. '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + // href or image
  1021. '(\\s*"' + escaped('"') + '"\\s*)?' + // "title"
  1022. "(\\))" // )
  1023. }, {
  1024. token: "string.strong",
  1025. regex: "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)"
  1026. }, {
  1027. token: "string.emphasis",
  1028. regex: "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)"
  1029. }, {
  1030. token: ["text", "url", "text"],
  1031. regex: "(<)(" +
  1032. "(?:https?|ftp|dict):[^'\">\\s]+" +
  1033. "|" +
  1034. "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+" +
  1035. ")(>)"
  1036. }],
  1037. "allowBlock": [
  1038. { token: "support.function", regex: "^ {4}.+", next: "allowBlock" },
  1039. { token: "empty_line", regex: '^$', next: "allowBlock" },
  1040. { token: "empty", regex: "", next: "start" }
  1041. ],
  1042. "header": [{
  1043. regex: "$",
  1044. next: "start"
  1045. }, {
  1046. include: "basic"
  1047. }, {
  1048. defaultToken: "heading"
  1049. }],
  1050. "listblock-start": [{
  1051. token: "support.variable",
  1052. regex: /(?:\[[ x]\])?/,
  1053. next: "listblock"
  1054. }],
  1055. "listblock": [{
  1056. token: "empty_line",
  1057. regex: "^$",
  1058. next: "start"
  1059. }, {
  1060. token: "markup.list",
  1061. regex: "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  1062. next: "listblock-start"
  1063. }, {
  1064. include: "basic", noEscape: true
  1065. },
  1066. codeBlockStartRule,
  1067. {
  1068. defaultToken: "list" //do not use markup.list to allow stling leading `*` differntly
  1069. }],
  1070. "blockquote": [{
  1071. token: "empty_line",
  1072. regex: "^\\s*$",
  1073. next: "start"
  1074. }, {
  1075. token: "string.blockquote",
  1076. regex: "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  1077. next: "blockquote"
  1078. }, {
  1079. include: "basic", noEscape: true
  1080. }, {
  1081. defaultToken: "string.blockquote"
  1082. }],
  1083. "githubblock": codeBlockRules
  1084. });
  1085. this.normalizeRules();
  1086. };
  1087. oop.inherits(MarkdownHighlightRules, TextHighlightRules);
  1088. exports.MarkdownHighlightRules = MarkdownHighlightRules;
  1089. });
  1090. ace.define("ace/mode/mask_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/css_highlight_rules","ace/mode/markdown_highlight_rules","ace/mode/html_highlight_rules"], function(require, exports, module){"use strict";
  1091. exports.MaskHighlightRules = MaskHighlightRules;
  1092. var oop = require("../lib/oop");
  1093. var lang = require("../lib/lang");
  1094. var TextRules = require("./text_highlight_rules").TextHighlightRules;
  1095. var JSRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1096. var CssRules = require("./css_highlight_rules").CssHighlightRules;
  1097. var MDRules = require("./markdown_highlight_rules").MarkdownHighlightRules;
  1098. var HTMLRules = require("./html_highlight_rules").HtmlHighlightRules;
  1099. var token_TAG = "keyword.support.constant.language", token_COMPO = "support.function.markup.bold", token_KEYWORD = "keyword", token_LANG = "constant.language", token_UTIL = "keyword.control.markup.italic", token_ATTR = "support.variable.class", token_PUNKT = "keyword.operator", token_ITALIC = "markup.italic", token_BOLD = "markup.bold", token_LPARE = "paren.lparen", token_RPARE = "paren.rparen";
  1100. var const_FUNCTIONS, const_KEYWORDS, const_CONST, const_TAGS;
  1101. (function () {
  1102. const_FUNCTIONS = lang.arrayToMap(("log").split("|"));
  1103. const_CONST = lang.arrayToMap((":dualbind|:bind|:import|slot|event|style|html|markdown|md").split("|"));
  1104. const_KEYWORDS = lang.arrayToMap(("debugger|define|var|if|each|for|of|else|switch|case|with|visible|+if|+each|+for|+switch|+with|+visible|include|import").split("|"));
  1105. const_TAGS = lang.arrayToMap(("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" +
  1106. "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" +
  1107. "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" +
  1108. "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" +
  1109. "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" +
  1110. "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" +
  1111. "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" +
  1112. "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" +
  1113. "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|"));
  1114. }());
  1115. function MaskHighlightRules() {
  1116. this.$rules = {
  1117. "start": [
  1118. Token("comment", "\\/\\/.*$"),
  1119. Token("comment", "\\/\\*", [
  1120. Token("comment", ".*?\\*\\/", "start"),
  1121. Token("comment", ".+")
  1122. ]),
  1123. Blocks.string("'''"),
  1124. Blocks.string('"""'),
  1125. Blocks.string('"'),
  1126. Blocks.string("'"),
  1127. Blocks.syntax(/(markdown|md)\b/, "md-multiline", "multiline"),
  1128. Blocks.syntax(/html\b/, "html-multiline", "multiline"),
  1129. Blocks.syntax(/(slot|event)\b/, "js-block", "block"),
  1130. Blocks.syntax(/style\b/, "css-block", "block"),
  1131. Blocks.syntax(/var\b/, "js-statement", "attr"),
  1132. Blocks.tag(),
  1133. Token(token_LPARE, "[[({>]"),
  1134. Token(token_RPARE, "[\\])};]", "start"),
  1135. {
  1136. caseInsensitive: true
  1137. }
  1138. ]
  1139. };
  1140. var rules = this;
  1141. addJavaScript("interpolation", /\]/, token_RPARE + "." + token_ITALIC);
  1142. addJavaScript("statement", /\)|}|;/);
  1143. addJavaScript("block", /\}/);
  1144. addCss();
  1145. addMarkdown();
  1146. addHtml();
  1147. function addJavaScript(name, escape, closeType) {
  1148. var prfx = "js-" + name + "-", rootTokens = name === "block" ? ["start"] : ["start", "no_regex"];
  1149. add(JSRules, prfx, escape, rootTokens, closeType);
  1150. }
  1151. function addCss() {
  1152. add(CssRules, "css-block-", /\}/);
  1153. }
  1154. function addMarkdown() {
  1155. add(MDRules, "md-multiline-", /("""|''')/, []);
  1156. }
  1157. function addHtml() {
  1158. add(HTMLRules, "html-multiline-", /("""|''')/);
  1159. }
  1160. function add(Rules, strPrfx, rgxEnd, rootTokens, closeType) {
  1161. var next = "pop";
  1162. var tokens = rootTokens || ["start"];
  1163. if (tokens.length === 0) {
  1164. tokens = null;
  1165. }
  1166. if (/block|multiline/.test(strPrfx)) {
  1167. next = strPrfx + "end";
  1168. rules.$rules[next] = [
  1169. Token("empty", "", "start")
  1170. ];
  1171. }
  1172. rules.embedRules(Rules, strPrfx, [Token(closeType || token_RPARE, rgxEnd, next)], tokens, tokens == null ? true : false);
  1173. }
  1174. this.normalizeRules();
  1175. }
  1176. oop.inherits(MaskHighlightRules, TextRules);
  1177. var Blocks = {
  1178. string: function (str, next) {
  1179. var token = Token("string.start", str, [
  1180. Token(token_LPARE + "." + token_ITALIC, /~\[/, Blocks.interpolation()),
  1181. Token("string.end", str, "pop"),
  1182. {
  1183. defaultToken: "string"
  1184. }
  1185. ], next);
  1186. if (str.length === 1) {
  1187. var escaped = Token("string.escape", "\\\\" + str);
  1188. token.push.unshift(escaped);
  1189. }
  1190. return token;
  1191. },
  1192. interpolation: function () {
  1193. return [
  1194. Token(token_UTIL, /\s*\w*\s*:/),
  1195. "js-interpolation-start"
  1196. ];
  1197. },
  1198. tagHead: function (rgx) {
  1199. return Token(token_ATTR, rgx, [
  1200. Token(token_ATTR, /[\w\-_]+/),
  1201. Token(token_LPARE + "." + token_ITALIC, /~\[/, Blocks.interpolation()),
  1202. Blocks.goUp()
  1203. ]);
  1204. },
  1205. tag: function () {
  1206. return {
  1207. token: 'tag',
  1208. onMatch: function (value) {
  1209. if (void 0 !== const_KEYWORDS[value])
  1210. return token_KEYWORD;
  1211. if (void 0 !== const_CONST[value])
  1212. return token_LANG;
  1213. if (void 0 !== const_FUNCTIONS[value])
  1214. return "support.function";
  1215. if (void 0 !== const_TAGS[value.toLowerCase()])
  1216. return token_TAG;
  1217. return token_COMPO;
  1218. },
  1219. regex: /([@\w\-_:+]+)|((^|\s)(?=\s*(\.|#)))/,
  1220. push: [
  1221. Blocks.tagHead(/\./),
  1222. Blocks.tagHead(/#/),
  1223. Blocks.expression(),
  1224. Blocks.attribute(),
  1225. Token(token_LPARE, /[;>{]/, "pop")
  1226. ]
  1227. };
  1228. },
  1229. syntax: function (rgx, next, type) {
  1230. return {
  1231. token: token_LANG,
  1232. regex: rgx,
  1233. push: ({
  1234. "attr": [
  1235. next + "-start",
  1236. Token(token_PUNKT, /;/, "start")
  1237. ],
  1238. "multiline": [
  1239. Blocks.tagHead(/\./),
  1240. Blocks.tagHead(/#/),
  1241. Blocks.attribute(),
  1242. Blocks.expression(),
  1243. Token(token_LPARE, /[>\{]/),
  1244. Token(token_PUNKT, /;/, "start"),
  1245. Token(token_LPARE, /'''|"""/, [next + "-start"])
  1246. ],
  1247. "block": [
  1248. Blocks.tagHead(/\./),
  1249. Blocks.tagHead(/#/),
  1250. Blocks.attribute(),
  1251. Blocks.expression(),
  1252. Token(token_LPARE, /\{/, [next + "-start"])
  1253. ]
  1254. })[type]
  1255. };
  1256. },
  1257. attribute: function () {
  1258. return Token(function (value) {
  1259. return /^x\-/.test(value)
  1260. ? token_ATTR + "." + token_BOLD
  1261. : token_ATTR;
  1262. }, /[\w_-]+/, [
  1263. Token(token_PUNKT, /\s*=\s*/, [
  1264. Blocks.string('"'),
  1265. Blocks.string("'"),
  1266. Blocks.word(),
  1267. Blocks.goUp()
  1268. ]),
  1269. Blocks.goUp()
  1270. ]);
  1271. },
  1272. expression: function () {
  1273. return Token(token_LPARE, /\(/, ["js-statement-start"]);
  1274. },
  1275. word: function () {
  1276. return Token("string", /[\w-_]+/);
  1277. },
  1278. goUp: function () {
  1279. return Token("text", "", "pop");
  1280. },
  1281. goStart: function () {
  1282. return Token("text", "", "start");
  1283. }
  1284. };
  1285. function Token(token, rgx, mix) {
  1286. var push, next, onMatch;
  1287. if (arguments.length === 4) {
  1288. push = mix;
  1289. next = arguments[3];
  1290. }
  1291. else if (typeof mix === "string") {
  1292. next = mix;
  1293. }
  1294. else {
  1295. push = mix;
  1296. }
  1297. if (typeof token === "function") {
  1298. onMatch = token;
  1299. token = "empty";
  1300. }
  1301. return {
  1302. token: token,
  1303. regex: rgx,
  1304. push: push,
  1305. next: next,
  1306. onMatch: onMatch
  1307. };
  1308. }
  1309. });
  1310. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
  1311. var Range = require("../range").Range;
  1312. var MatchingBraceOutdent = function () { };
  1313. (function () {
  1314. this.checkOutdent = function (line, input) {
  1315. if (!/^\s+$/.test(line))
  1316. return false;
  1317. return /^\s*\}/.test(input);
  1318. };
  1319. this.autoOutdent = function (doc, row) {
  1320. var line = doc.getLine(row);
  1321. var match = line.match(/^(\s*\})/);
  1322. if (!match)
  1323. return 0;
  1324. var column = match[1].length;
  1325. var openBracePos = doc.findMatchingBracket({ row: row, column: column });
  1326. if (!openBracePos || openBracePos.row == row)
  1327. return 0;
  1328. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  1329. doc.replace(new Range(row, 0, row, column - 1), indent);
  1330. };
  1331. this.$getIndent = function (line) {
  1332. return line.match(/^\s*/)[0];
  1333. };
  1334. }).call(MatchingBraceOutdent.prototype);
  1335. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  1336. });
  1337. ace.define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(require, exports, module){"use strict";
  1338. var oop = require("../../lib/oop");
  1339. var Behaviour = require("../behaviour").Behaviour;
  1340. var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
  1341. var TokenIterator = require("../../token_iterator").TokenIterator;
  1342. var CssBehaviour = function () {
  1343. this.inherit(CstyleBehaviour);
  1344. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1345. if (text === ':' && editor.selection.isEmpty()) {
  1346. var cursor = editor.getCursorPosition();
  1347. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1348. var token = iterator.getCurrentToken();
  1349. if (token && token.value.match(/\s+/)) {
  1350. token = iterator.stepBackward();
  1351. }
  1352. if (token && token.type === 'support.type') {
  1353. var line = session.doc.getLine(cursor.row);
  1354. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1355. if (rightChar === ':') {
  1356. return {
  1357. text: '',
  1358. selection: [1, 1]
  1359. };
  1360. }
  1361. if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
  1362. return {
  1363. text: ':;',
  1364. selection: [1, 1]
  1365. };
  1366. }
  1367. }
  1368. }
  1369. });
  1370. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1371. var selected = session.doc.getTextRange(range);
  1372. if (!range.isMultiLine() && selected === ':') {
  1373. var cursor = editor.getCursorPosition();
  1374. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1375. var token = iterator.getCurrentToken();
  1376. if (token && token.value.match(/\s+/)) {
  1377. token = iterator.stepBackward();
  1378. }
  1379. if (token && token.type === 'support.type') {
  1380. var line = session.doc.getLine(range.start.row);
  1381. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1382. if (rightChar === ';') {
  1383. range.end.column++;
  1384. return range;
  1385. }
  1386. }
  1387. }
  1388. });
  1389. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1390. if (text === ';' && editor.selection.isEmpty()) {
  1391. var cursor = editor.getCursorPosition();
  1392. var line = session.doc.getLine(cursor.row);
  1393. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1394. if (rightChar === ';') {
  1395. return {
  1396. text: '',
  1397. selection: [1, 1]
  1398. };
  1399. }
  1400. }
  1401. });
  1402. this.add("!important", "insertion", function (state, action, editor, session, text) {
  1403. if (text === '!' && editor.selection.isEmpty()) {
  1404. var cursor = editor.getCursorPosition();
  1405. var line = session.doc.getLine(cursor.row);
  1406. if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
  1407. return {
  1408. text: '!important',
  1409. selection: [10, 10]
  1410. };
  1411. }
  1412. }
  1413. });
  1414. };
  1415. oop.inherits(CssBehaviour, CstyleBehaviour);
  1416. exports.CssBehaviour = CssBehaviour;
  1417. });
  1418. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
  1419. var oop = require("../../lib/oop");
  1420. var Range = require("../../range").Range;
  1421. var BaseFoldMode = require("./fold_mode").FoldMode;
  1422. var FoldMode = exports.FoldMode = function (commentRegex) {
  1423. if (commentRegex) {
  1424. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  1425. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  1426. }
  1427. };
  1428. oop.inherits(FoldMode, BaseFoldMode);
  1429. (function () {
  1430. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  1431. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  1432. this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
  1433. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  1434. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  1435. this._getFoldWidgetBase = this.getFoldWidget;
  1436. this.getFoldWidget = function (session, foldStyle, row) {
  1437. var line = session.getLine(row);
  1438. if (this.singleLineBlockCommentRe.test(line)) {
  1439. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  1440. return "";
  1441. }
  1442. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  1443. if (!fw && this.startRegionRe.test(line))
  1444. return "start"; // lineCommentRegionStart
  1445. return fw;
  1446. };
  1447. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  1448. var line = session.getLine(row);
  1449. if (this.startRegionRe.test(line))
  1450. return this.getCommentRegionBlock(session, line, row);
  1451. var match = line.match(this.foldingStartMarker);
  1452. if (match) {
  1453. var i = match.index;
  1454. if (match[1])
  1455. return this.openingBracketBlock(session, match[1], row, i);
  1456. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  1457. if (range && !range.isMultiLine()) {
  1458. if (forceMultiline) {
  1459. range = this.getSectionRange(session, row);
  1460. }
  1461. else if (foldStyle != "all")
  1462. range = null;
  1463. }
  1464. return range;
  1465. }
  1466. if (foldStyle === "markbegin")
  1467. return;
  1468. var match = line.match(this.foldingStopMarker);
  1469. if (match) {
  1470. var i = match.index + match[0].length;
  1471. if (match[1])
  1472. return this.closingBracketBlock(session, match[1], row, i);
  1473. return session.getCommentFoldRange(row, i, -1);
  1474. }
  1475. };
  1476. this.getSectionRange = function (session, row) {
  1477. var line = session.getLine(row);
  1478. var startIndent = line.search(/\S/);
  1479. var startRow = row;
  1480. var startColumn = line.length;
  1481. row = row + 1;
  1482. var endRow = row;
  1483. var maxRow = session.getLength();
  1484. while (++row < maxRow) {
  1485. line = session.getLine(row);
  1486. var indent = line.search(/\S/);
  1487. if (indent === -1)
  1488. continue;
  1489. if (startIndent > indent)
  1490. break;
  1491. var subRange = this.getFoldWidgetRange(session, "all", row);
  1492. if (subRange) {
  1493. if (subRange.start.row <= startRow) {
  1494. break;
  1495. }
  1496. else if (subRange.isMultiLine()) {
  1497. row = subRange.end.row;
  1498. }
  1499. else if (startIndent == indent) {
  1500. break;
  1501. }
  1502. }
  1503. endRow = row;
  1504. }
  1505. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  1506. };
  1507. this.getCommentRegionBlock = function (session, line, row) {
  1508. var startColumn = line.search(/\s*$/);
  1509. var maxRow = session.getLength();
  1510. var startRow = row;
  1511. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  1512. var depth = 1;
  1513. while (++row < maxRow) {
  1514. line = session.getLine(row);
  1515. var m = re.exec(line);
  1516. if (!m)
  1517. continue;
  1518. if (m[1])
  1519. depth--;
  1520. else
  1521. depth++;
  1522. if (!depth)
  1523. break;
  1524. }
  1525. var endRow = row;
  1526. if (endRow > startRow) {
  1527. return new Range(startRow, startColumn, endRow, line.length);
  1528. }
  1529. };
  1530. }).call(FoldMode.prototype);
  1531. });
  1532. ace.define("ace/mode/mask",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/mask_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
  1533. var oop = require("../lib/oop");
  1534. var TextMode = require("./text").Mode;
  1535. var MaskHighlightRules = require("./mask_highlight_rules").MaskHighlightRules;
  1536. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1537. var CssBehaviour = require("./behaviour/css").CssBehaviour;
  1538. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1539. var Mode = function () {
  1540. this.HighlightRules = MaskHighlightRules;
  1541. this.$outdent = new MatchingBraceOutdent();
  1542. this.$behaviour = new CssBehaviour();
  1543. this.foldingRules = new CStyleFoldMode();
  1544. };
  1545. oop.inherits(Mode, TextMode);
  1546. (function () {
  1547. this.lineCommentStart = "//";
  1548. this.blockComment = { start: "/*", end: "*/" };
  1549. this.getNextLineIndent = function (state, line, tab) {
  1550. var indent = this.$getIndent(line);
  1551. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1552. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  1553. return indent;
  1554. }
  1555. var match = line.match(/^.*\{\s*$/);
  1556. if (match) {
  1557. indent += tab;
  1558. }
  1559. return indent;
  1560. };
  1561. this.checkOutdent = function (state, line, input) {
  1562. return this.$outdent.checkOutdent(line, input);
  1563. };
  1564. this.autoOutdent = function (state, doc, row) {
  1565. this.$outdent.autoOutdent(doc, row);
  1566. };
  1567. this.$id = "ace/mode/mask";
  1568. }).call(Mode.prototype);
  1569. exports.Mode = Mode;
  1570. }); (function() {
  1571. ace.require(["ace/mode/mask"], function(m) {
  1572. if (typeof module == "object" && typeof exports == "object" && module) {
  1573. module.exports = m;
  1574. }
  1575. });
  1576. })();