3ddb5ebdc00b5a39bd4aedae80e1e1fb.js 76 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757
  1. ace.define("ace/mode/jsdoc_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 JsDocCommentHighlightRules = function () {
  5. this.$rules = {
  6. "start": [
  7. {
  8. token: ["comment.doc.tag", "comment.doc.text", "lparen.doc"],
  9. regex: "(@(?:param|member|typedef|property|namespace|var|const|callback))(\\s*)({)",
  10. push: [
  11. {
  12. token: "lparen.doc",
  13. regex: "{",
  14. push: [
  15. {
  16. include: "doc-syntax"
  17. }, {
  18. token: "rparen.doc",
  19. regex: "}|(?=$)",
  20. next: "pop"
  21. }
  22. ]
  23. }, {
  24. token: ["rparen.doc", "text.doc", "variable.parameter.doc", "lparen.doc", "variable.parameter.doc", "rparen.doc"],
  25. regex: /(})(\s*)(?:([\w=:\/\.]+)|(?:(\[)([\w=:\/\.\-\'\" ]+)(\])))/,
  26. next: "pop"
  27. }, {
  28. token: "rparen.doc",
  29. regex: "}|(?=$)",
  30. next: "pop"
  31. }, {
  32. include: "doc-syntax"
  33. }, {
  34. defaultToken: "text.doc"
  35. }
  36. ]
  37. }, {
  38. token: ["comment.doc.tag", "text.doc", "lparen.doc"],
  39. regex: "(@(?:returns?|yields|type|this|suppress|public|protected|private|package|modifies|"
  40. + "implements|external|exception|throws|enum|define|extends))(\\s*)({)",
  41. push: [
  42. {
  43. token: "lparen.doc",
  44. regex: "{",
  45. push: [
  46. {
  47. include: "doc-syntax"
  48. }, {
  49. token: "rparen.doc",
  50. regex: "}|(?=$)",
  51. next: "pop"
  52. }
  53. ]
  54. }, {
  55. token: "rparen.doc",
  56. regex: "}|(?=$)",
  57. next: "pop"
  58. }, {
  59. include: "doc-syntax"
  60. }, {
  61. defaultToken: "text.doc"
  62. }
  63. ]
  64. }, {
  65. token: ["comment.doc.tag", "text.doc", "variable.parameter.doc"],
  66. regex: "(@(?:alias|memberof|instance|module|name|lends|namespace|external|this|template|"
  67. + "requires|param|implements|function|extends|typedef|mixes|constructor|var|"
  68. + "memberof\\!|event|listens|exports|class|constructs|interface|emits|fires|"
  69. + "throws|const|callback|borrows|augments))(\\s+)(\\w[\\w#\.:\/~\"\\-]*)?"
  70. }, {
  71. token: ["comment.doc.tag", "text.doc", "variable.parameter.doc"],
  72. regex: "(@method)(\\s+)(\\w[\\w\.\\(\\)]*)"
  73. }, {
  74. token: "comment.doc.tag",
  75. regex: "@access\\s+(?:private|public|protected)"
  76. }, {
  77. token: "comment.doc.tag",
  78. regex: "@kind\\s+(?:class|constant|event|external|file|function|member|mixin|module|namespace|typedef)"
  79. }, {
  80. token: "comment.doc.tag",
  81. regex: "@\\w+(?=\\s|$)"
  82. },
  83. JsDocCommentHighlightRules.getTagRule(),
  84. {
  85. defaultToken: "comment.doc.body",
  86. caseInsensitive: true
  87. }
  88. ],
  89. "doc-syntax": [{
  90. token: "operator.doc",
  91. regex: /[|:]/
  92. }, {
  93. token: "paren.doc",
  94. regex: /[\[\]]/
  95. }]
  96. };
  97. this.normalizeRules();
  98. };
  99. oop.inherits(JsDocCommentHighlightRules, TextHighlightRules);
  100. JsDocCommentHighlightRules.getTagRule = function (start) {
  101. return {
  102. token: "comment.doc.tag.storage.type",
  103. regex: "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  104. };
  105. };
  106. JsDocCommentHighlightRules.getStartRule = function (start) {
  107. return {
  108. token: "comment.doc", // doc comment
  109. regex: /\/\*\*(?!\/)/,
  110. next: start
  111. };
  112. };
  113. JsDocCommentHighlightRules.getEndRule = function (start) {
  114. return {
  115. token: "comment.doc", // closing comment
  116. regex: "\\*\\/",
  117. next: start
  118. };
  119. };
  120. exports.JsDocCommentHighlightRules = JsDocCommentHighlightRules;
  121. });
  122. ace.define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/jsdoc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  123. var oop = require("../lib/oop");
  124. var DocCommentHighlightRules = require("./jsdoc_comment_highlight_rules").JsDocCommentHighlightRules;
  125. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  126. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
  127. var JavaScriptHighlightRules = function (options) {
  128. var keywords = {
  129. "variable.language": "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Symbol|" + // Constructors
  130. "Namespace|QName|XML|XMLList|" + // E4X
  131. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  132. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  133. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
  134. "SyntaxError|TypeError|URIError|" +
  135. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
  136. "isNaN|parseFloat|parseInt|" +
  137. "JSON|Math|" + // Other
  138. "this|arguments|prototype|window|document", // Pseudo
  139. "keyword": "const|yield|import|get|set|async|await|" +
  140. "break|case|catch|continue|default|delete|do|else|finally|for|" +
  141. "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  142. "__parent__|__count__|escape|unescape|with|__proto__|" +
  143. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static|constructor",
  144. "storage.type": "const|let|var|function",
  145. "constant.language": "null|Infinity|NaN|undefined",
  146. "support.function": "alert",
  147. "constant.language.boolean": "true|false"
  148. };
  149. var keywordMapper = this.createKeywordMapper(keywords, "identifier");
  150. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
  151. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  152. "u[0-9a-fA-F]{4}|" + // unicode
  153. "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
  154. "[0-2][0-7]{0,2}|" + // oct
  155. "3[0-7][0-7]?|" + // oct
  156. "[4-7][0-7]?|" + //oct
  157. ".)";
  158. var anonymousFunctionRe = "(function)(\\s*)(\\*?)";
  159. var functionCallStartRule = {
  160. token: ["identifier", "text", "paren.lparen"],
  161. regex: "(\\b(?!" + Object.values(keywords).join("|") + "\\b)" + identifierRe + ")(\\s*)(\\()"
  162. };
  163. this.$rules = {
  164. "no_regex": [
  165. DocCommentHighlightRules.getStartRule("doc-start"),
  166. comments("no_regex"),
  167. functionCallStartRule,
  168. {
  169. token: "string",
  170. regex: "'(?=.)",
  171. next: "qstring"
  172. }, {
  173. token: "string",
  174. regex: '"(?=.)',
  175. next: "qqstring"
  176. }, {
  177. token: "constant.numeric", // hexadecimal, octal and binary
  178. regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
  179. }, {
  180. token: "constant.numeric", // decimal integers and floats
  181. regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
  182. }, {
  183. token: [
  184. "entity.name.function", "text", "keyword.operator", "text", "storage.type",
  185. "text", "storage.type", "text", "paren.lparen"
  186. ],
  187. regex: "(" + identifierRe + ")(\\s*)(=)(\\s*)" + anonymousFunctionRe + "(\\s*)(\\()",
  188. next: "function_arguments"
  189. }, {
  190. token: [
  191. "storage.type", "text", "storage.type", "text", "text", "entity.name.function", "text", "paren.lparen"
  192. ],
  193. regex: "(function)(?:(?:(\\s*)(\\*)(\\s*))|(\\s+))(" + identifierRe + ")(\\s*)(\\()",
  194. next: "function_arguments"
  195. }, {
  196. token: [
  197. "entity.name.function", "text", "punctuation.operator",
  198. "text", "storage.type", "text", "storage.type", "text", "paren.lparen"
  199. ],
  200. regex: "(" + identifierRe + ")(\\s*)(:)(\\s*)" + anonymousFunctionRe + "(\\s*)(\\()",
  201. next: "function_arguments"
  202. }, {
  203. token: [
  204. "text", "text", "storage.type", "text", "storage.type", "text", "paren.lparen"
  205. ],
  206. regex: "(:)(\\s*)" + anonymousFunctionRe + "(\\s*)(\\()",
  207. next: "function_arguments"
  208. }, {
  209. token: "keyword",
  210. regex: "from(?=\\s*('|\"))"
  211. }, {
  212. token: "keyword",
  213. regex: "(?:" + kwBeforeRe + ")\\b",
  214. next: "start"
  215. }, {
  216. token: "support.constant",
  217. regex: /that\b/
  218. }, {
  219. token: ["storage.type", "punctuation.operator", "support.function.firebug"],
  220. regex: /(console)(\.)(warn|info|log|error|debug|time|trace|timeEnd|assert)\b/
  221. }, {
  222. token: keywordMapper,
  223. regex: identifierRe
  224. }, {
  225. token: "punctuation.operator",
  226. regex: /[.](?![.])/,
  227. next: "property"
  228. }, {
  229. token: "storage.type",
  230. regex: /=>/,
  231. next: "start"
  232. }, {
  233. token: "keyword.operator",
  234. regex: /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
  235. next: "start"
  236. }, {
  237. token: "punctuation.operator",
  238. regex: /[?:,;.]/,
  239. next: "start"
  240. }, {
  241. token: "paren.lparen",
  242. regex: /[\[({]/,
  243. next: "start"
  244. }, {
  245. token: "paren.rparen",
  246. regex: /[\])}]/
  247. }, {
  248. token: "comment",
  249. regex: /^#!.*$/
  250. }
  251. ],
  252. property: [{
  253. token: "text",
  254. regex: "\\s+"
  255. }, {
  256. token: "keyword.operator",
  257. regex: /=/
  258. }, {
  259. token: [
  260. "storage.type", "text", "storage.type", "text", "paren.lparen"
  261. ],
  262. regex: anonymousFunctionRe + "(\\s*)(\\()",
  263. next: "function_arguments"
  264. }, {
  265. token: [
  266. "storage.type", "text", "storage.type", "text", "text", "entity.name.function", "text", "paren.lparen"
  267. ],
  268. regex: "(function)(?:(?:(\\s*)(\\*)(\\s*))|(\\s+))(\\w+)(\\s*)(\\()",
  269. next: "function_arguments"
  270. }, {
  271. token: "punctuation.operator",
  272. regex: /[.](?![.])/
  273. }, {
  274. token: "support.function",
  275. regex: "prototype"
  276. }, {
  277. token: "support.function",
  278. 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|lter|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward|rEach)|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(?=\()/
  279. }, {
  280. token: "support.function.dom",
  281. regex: /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
  282. }, {
  283. token: "support.constant",
  284. regex: /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
  285. }, {
  286. token: "identifier",
  287. regex: identifierRe
  288. }, {
  289. regex: "",
  290. token: "empty",
  291. next: "no_regex"
  292. }
  293. ],
  294. "start": [
  295. DocCommentHighlightRules.getStartRule("doc-start"),
  296. comments("start"),
  297. {
  298. token: "string.regexp",
  299. regex: "\\/",
  300. next: "regex"
  301. }, {
  302. token: "text",
  303. regex: "\\s+|^$",
  304. next: "start"
  305. }, {
  306. token: "empty",
  307. regex: "",
  308. next: "no_regex"
  309. }
  310. ],
  311. "regex": [
  312. {
  313. token: "regexp.keyword.operator",
  314. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  315. }, {
  316. token: "string.regexp",
  317. regex: "/[sxngimy]*",
  318. next: "no_regex"
  319. }, {
  320. token: "invalid",
  321. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  322. }, {
  323. token: "constant.language.escape",
  324. regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  325. }, {
  326. token: "constant.language.delimiter",
  327. regex: /\|/
  328. }, {
  329. token: "constant.language.escape",
  330. regex: /\[\^?/,
  331. next: "regex_character_class"
  332. }, {
  333. token: "empty",
  334. regex: "$",
  335. next: "no_regex"
  336. }, {
  337. defaultToken: "string.regexp"
  338. }
  339. ],
  340. "regex_character_class": [
  341. {
  342. token: "regexp.charclass.keyword.operator",
  343. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  344. }, {
  345. token: "constant.language.escape",
  346. regex: "]",
  347. next: "regex"
  348. }, {
  349. token: "constant.language.escape",
  350. regex: "-"
  351. }, {
  352. token: "empty",
  353. regex: "$",
  354. next: "no_regex"
  355. }, {
  356. defaultToken: "string.regexp.charachterclass"
  357. }
  358. ],
  359. "default_parameter": [
  360. {
  361. token: "string",
  362. regex: "'(?=.)",
  363. push: [
  364. {
  365. token: "string",
  366. regex: "'|$",
  367. next: "pop"
  368. }, {
  369. include: "qstring"
  370. }
  371. ]
  372. }, {
  373. token: "string",
  374. regex: '"(?=.)',
  375. push: [
  376. {
  377. token: "string",
  378. regex: '"|$',
  379. next: "pop"
  380. }, {
  381. include: "qqstring"
  382. }
  383. ]
  384. }, {
  385. token: "constant.language",
  386. regex: "null|Infinity|NaN|undefined"
  387. }, {
  388. token: "constant.numeric", // hexadecimal, octal and binary
  389. regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
  390. }, {
  391. token: "constant.numeric", // decimal integers and floats
  392. regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
  393. }, {
  394. token: "punctuation.operator",
  395. regex: ",",
  396. next: "function_arguments"
  397. }, {
  398. token: "text",
  399. regex: "\\s+"
  400. }, {
  401. token: "punctuation.operator",
  402. regex: "$"
  403. }, {
  404. token: "empty",
  405. regex: "",
  406. next: "no_regex"
  407. }
  408. ],
  409. "function_arguments": [
  410. comments("function_arguments"),
  411. {
  412. token: "variable.parameter",
  413. regex: identifierRe
  414. }, {
  415. token: "punctuation.operator",
  416. regex: ","
  417. }, {
  418. token: "text",
  419. regex: "\\s+"
  420. }, {
  421. token: "punctuation.operator",
  422. regex: "$"
  423. }, {
  424. token: "empty",
  425. regex: "",
  426. next: "no_regex"
  427. }
  428. ],
  429. "qqstring": [
  430. {
  431. token: "constant.language.escape",
  432. regex: escapedRe
  433. }, {
  434. token: "string",
  435. regex: "\\\\$",
  436. consumeLineEnd: true
  437. }, {
  438. token: "string",
  439. regex: '"|$',
  440. next: "no_regex"
  441. }, {
  442. defaultToken: "string"
  443. }
  444. ],
  445. "qstring": [
  446. {
  447. token: "constant.language.escape",
  448. regex: escapedRe
  449. }, {
  450. token: "string",
  451. regex: "\\\\$",
  452. consumeLineEnd: true
  453. }, {
  454. token: "string",
  455. regex: "'|$",
  456. next: "no_regex"
  457. }, {
  458. defaultToken: "string"
  459. }
  460. ]
  461. };
  462. if (!options || !options.noES6) {
  463. this.$rules.no_regex.unshift({
  464. regex: "[{}]", onMatch: function (val, state, stack) {
  465. this.next = val == "{" ? this.nextState : "";
  466. if (val == "{" && stack.length) {
  467. stack.unshift("start", state);
  468. }
  469. else if (val == "}" && stack.length) {
  470. stack.shift();
  471. this.next = stack.shift();
  472. if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
  473. return "paren.quasi.end";
  474. }
  475. return val == "{" ? "paren.lparen" : "paren.rparen";
  476. },
  477. nextState: "start"
  478. }, {
  479. token: "string.quasi.start",
  480. regex: /`/,
  481. push: [{
  482. token: "constant.language.escape",
  483. regex: escapedRe
  484. }, {
  485. token: "paren.quasi.start",
  486. regex: /\${/,
  487. push: "start"
  488. }, {
  489. token: "string.quasi.end",
  490. regex: /`/,
  491. next: "pop"
  492. }, {
  493. defaultToken: "string.quasi"
  494. }]
  495. }, {
  496. token: ["variable.parameter", "text"],
  497. regex: "(" + identifierRe + ")(\\s*)(?=\\=>)"
  498. }, {
  499. token: "paren.lparen",
  500. regex: "(\\()(?=[^\\(]+\\s*=>)",
  501. next: "function_arguments"
  502. }, {
  503. token: "variable.language",
  504. regex: "(?:(?:(?:Weak)?(?:Set|Map))|Promise)\\b"
  505. });
  506. this.$rules["function_arguments"].unshift({
  507. token: "keyword.operator",
  508. regex: "=",
  509. next: "default_parameter"
  510. }, {
  511. token: "keyword.operator",
  512. regex: "\\.{3}"
  513. });
  514. this.$rules["property"].unshift({
  515. token: "support.function",
  516. regex: "(findIndex|repeat|startsWith|endsWith|includes|isSafeInteger|trunc|cbrt|log2|log10|sign|then|catch|"
  517. + "finally|resolve|reject|race|any|all|allSettled|keys|entries|isInteger)\\b(?=\\()"
  518. }, {
  519. token: "constant.language",
  520. regex: "(?:MAX_SAFE_INTEGER|MIN_SAFE_INTEGER|EPSILON)\\b"
  521. });
  522. if (!options || options.jsx != false)
  523. JSX.call(this);
  524. }
  525. this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("no_regex")]);
  526. this.normalizeRules();
  527. };
  528. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  529. function JSX() {
  530. var tagRegex = identifierRe.replace("\\d", "\\d\\-");
  531. var jsxTag = {
  532. onMatch: function (val, state, stack) {
  533. var offset = val.charAt(1) == "/" ? 2 : 1;
  534. if (offset == 1) {
  535. if (state != this.nextState)
  536. stack.unshift(this.next, this.nextState, 0);
  537. else
  538. stack.unshift(this.next);
  539. stack[2]++;
  540. }
  541. else if (offset == 2) {
  542. if (state == this.nextState) {
  543. stack[1]--;
  544. if (!stack[1] || stack[1] < 0) {
  545. stack.shift();
  546. stack.shift();
  547. }
  548. }
  549. }
  550. return [{
  551. type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
  552. value: val.slice(0, offset)
  553. }, {
  554. type: "meta.tag.tag-name.xml",
  555. value: val.substr(offset)
  556. }];
  557. },
  558. regex: "</?(?:" + tagRegex + "|(?=>))",
  559. next: "jsxAttributes",
  560. nextState: "jsx"
  561. };
  562. this.$rules.start.unshift(jsxTag);
  563. var jsxJsRule = {
  564. regex: "{",
  565. token: "paren.quasi.start",
  566. push: "start"
  567. };
  568. this.$rules.jsx = [
  569. jsxJsRule,
  570. jsxTag,
  571. { include: "reference" }, { defaultToken: "string.xml" }
  572. ];
  573. this.$rules.jsxAttributes = [{
  574. token: "meta.tag.punctuation.tag-close.xml",
  575. regex: "/?>",
  576. onMatch: function (value, currentState, stack) {
  577. if (currentState == stack[0])
  578. stack.shift();
  579. if (value.length == 2) {
  580. if (stack[0] == this.nextState)
  581. stack[1]--;
  582. if (!stack[1] || stack[1] < 0) {
  583. stack.splice(0, 2);
  584. }
  585. }
  586. this.next = stack[0] || "start";
  587. return [{ type: this.token, value: value }];
  588. },
  589. nextState: "jsx"
  590. },
  591. jsxJsRule,
  592. comments("jsxAttributes"),
  593. {
  594. token: "entity.other.attribute-name.xml",
  595. regex: tagRegex
  596. }, {
  597. token: "keyword.operator.attribute-equals.xml",
  598. regex: "="
  599. }, {
  600. token: "text.tag-whitespace.xml",
  601. regex: "\\s+"
  602. }, {
  603. token: "string.attribute-value.xml",
  604. regex: "'",
  605. stateName: "jsx_attr_q",
  606. push: [
  607. { token: "string.attribute-value.xml", regex: "'", next: "pop" },
  608. { include: "reference" },
  609. { defaultToken: "string.attribute-value.xml" }
  610. ]
  611. }, {
  612. token: "string.attribute-value.xml",
  613. regex: '"',
  614. stateName: "jsx_attr_qq",
  615. push: [
  616. { token: "string.attribute-value.xml", regex: '"', next: "pop" },
  617. { include: "reference" },
  618. { defaultToken: "string.attribute-value.xml" }
  619. ]
  620. },
  621. jsxTag
  622. ];
  623. this.$rules.reference = [{
  624. token: "constant.language.escape.reference.xml",
  625. regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  626. }];
  627. }
  628. function comments(next) {
  629. return [
  630. {
  631. token: "comment", // multi line comment
  632. regex: /\/\*/,
  633. next: [
  634. DocCommentHighlightRules.getTagRule(),
  635. { token: "comment", regex: "\\*\\/", next: next || "pop" },
  636. { defaultToken: "comment", caseInsensitive: true }
  637. ]
  638. }, {
  639. token: "comment",
  640. regex: "\\/\\/",
  641. next: [
  642. DocCommentHighlightRules.getTagRule(),
  643. { token: "comment", regex: "$|^", next: next || "pop" },
  644. { defaultToken: "comment", caseInsensitive: true }
  645. ]
  646. }
  647. ];
  648. }
  649. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  650. });
  651. 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";
  652. var oop = require("../lib/oop");
  653. var lang = require("../lib/lang");
  654. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  655. 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";
  656. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  657. 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|flex-end|flex-start|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";
  658. 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";
  659. 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";
  660. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
  661. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  662. 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";
  663. var CssHighlightRules = function () {
  664. var keywordMapper = this.createKeywordMapper({
  665. "support.function": supportFunction,
  666. "support.constant": supportConstant,
  667. "support.type": supportType,
  668. "support.constant.color": supportConstantColor,
  669. "support.constant.fonts": supportConstantFonts
  670. }, "text", true);
  671. this.$rules = {
  672. "start": [{
  673. include: ["strings", "url", "comments"]
  674. }, {
  675. token: "paren.lparen",
  676. regex: "\\{",
  677. next: "ruleset"
  678. }, {
  679. token: "paren.rparen",
  680. regex: "\\}"
  681. }, {
  682. token: "string",
  683. regex: "@(?!viewport)",
  684. next: "media"
  685. }, {
  686. token: "keyword",
  687. regex: "#[a-z0-9-_]+"
  688. }, {
  689. token: "keyword",
  690. regex: "%"
  691. }, {
  692. token: "variable",
  693. regex: "\\.[a-z0-9-_]+"
  694. }, {
  695. token: "string",
  696. regex: ":[a-z0-9-_]+"
  697. }, {
  698. token: "constant.numeric",
  699. regex: numRe
  700. }, {
  701. token: "constant",
  702. regex: "[a-z0-9-_]+"
  703. }, {
  704. caseInsensitive: true
  705. }],
  706. "media": [{
  707. include: ["strings", "url", "comments"]
  708. }, {
  709. token: "paren.lparen",
  710. regex: "\\{",
  711. next: "start"
  712. }, {
  713. token: "paren.rparen",
  714. regex: "\\}",
  715. next: "start"
  716. }, {
  717. token: "string",
  718. regex: ";",
  719. next: "start"
  720. }, {
  721. token: "keyword",
  722. regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
  723. + "|page|font|keyframes|viewport|counter-style|font-feature-values"
  724. + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
  725. }],
  726. "comments": [{
  727. token: "comment", // multi line comment
  728. regex: "\\/\\*",
  729. push: [{
  730. token: "comment",
  731. regex: "\\*\\/",
  732. next: "pop"
  733. }, {
  734. defaultToken: "comment"
  735. }]
  736. }],
  737. "ruleset": [{
  738. regex: "-(webkit|ms|moz|o)-",
  739. token: "text"
  740. }, {
  741. token: "punctuation.operator",
  742. regex: "[:;]"
  743. }, {
  744. token: "paren.rparen",
  745. regex: "\\}",
  746. next: "start"
  747. }, {
  748. include: ["strings", "url", "comments"]
  749. }, {
  750. token: ["constant.numeric", "keyword"],
  751. 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|%)"
  752. }, {
  753. token: "constant.numeric",
  754. regex: numRe
  755. }, {
  756. token: "constant.numeric", // hex6 color
  757. regex: "#[a-f0-9]{6}"
  758. }, {
  759. token: "constant.numeric", // hex3 color
  760. regex: "#[a-f0-9]{3}"
  761. }, {
  762. token: ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  763. regex: pseudoElements
  764. }, {
  765. token: ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  766. regex: pseudoClasses
  767. }, {
  768. include: "url"
  769. }, {
  770. token: keywordMapper,
  771. regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  772. }, {
  773. token: "paren.lparen",
  774. regex: "\\{"
  775. }, {
  776. caseInsensitive: true
  777. }],
  778. url: [{
  779. token: "support.function",
  780. regex: "(?:url(:?-prefix)?|domain|regexp)\\(",
  781. push: [{
  782. token: "support.function",
  783. regex: "\\)",
  784. next: "pop"
  785. }, {
  786. defaultToken: "string"
  787. }]
  788. }],
  789. strings: [{
  790. token: "string.start",
  791. regex: "'",
  792. push: [{
  793. token: "string.end",
  794. regex: "'|$",
  795. next: "pop"
  796. }, {
  797. include: "escapes"
  798. }, {
  799. token: "constant.language.escape",
  800. regex: /\\$/,
  801. consumeLineEnd: true
  802. }, {
  803. defaultToken: "string"
  804. }]
  805. }, {
  806. token: "string.start",
  807. regex: '"',
  808. push: [{
  809. token: "string.end",
  810. regex: '"|$',
  811. next: "pop"
  812. }, {
  813. include: "escapes"
  814. }, {
  815. token: "constant.language.escape",
  816. regex: /\\$/,
  817. consumeLineEnd: true
  818. }, {
  819. defaultToken: "string"
  820. }]
  821. }],
  822. escapes: [{
  823. token: "constant.language.escape",
  824. regex: /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
  825. }]
  826. };
  827. this.normalizeRules();
  828. };
  829. oop.inherits(CssHighlightRules, TextHighlightRules);
  830. exports.CssHighlightRules = CssHighlightRules;
  831. });
  832. ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  833. var oop = require("../lib/oop");
  834. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  835. var XmlHighlightRules = function (normalize) {
  836. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  837. this.$rules = {
  838. start: [
  839. { token: "string.cdata.xml", regex: "<\\!\\[CDATA\\[", next: "cdata" },
  840. {
  841. token: ["punctuation.instruction.xml", "keyword.instruction.xml"],
  842. regex: "(<\\?)(" + tagRegex + ")", next: "processing_instruction"
  843. },
  844. { token: "comment.start.xml", regex: "<\\!--", next: "comment" },
  845. {
  846. token: ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  847. regex: "(<\\!)(DOCTYPE)(?=[\\s])", next: "doctype", caseInsensitive: true
  848. },
  849. { include: "tag" },
  850. { token: "text.end-tag-open.xml", regex: "</" },
  851. { token: "text.tag-open.xml", regex: "<" },
  852. { include: "reference" },
  853. { defaultToken: "text.xml" }
  854. ],
  855. processing_instruction: [{
  856. token: "entity.other.attribute-name.decl-attribute-name.xml",
  857. regex: tagRegex
  858. }, {
  859. token: "keyword.operator.decl-attribute-equals.xml",
  860. regex: "="
  861. }, {
  862. include: "whitespace"
  863. }, {
  864. include: "string"
  865. }, {
  866. token: "punctuation.xml-decl.xml",
  867. regex: "\\?>",
  868. next: "start"
  869. }],
  870. doctype: [
  871. { include: "whitespace" },
  872. { include: "string" },
  873. { token: "xml-pe.doctype.xml", regex: ">", next: "start" },
  874. { token: "xml-pe.xml", regex: "[-_a-zA-Z0-9:]+" },
  875. { token: "punctuation.int-subset", regex: "\\[", push: "int_subset" }
  876. ],
  877. int_subset: [{
  878. token: "text.xml",
  879. regex: "\\s+"
  880. }, {
  881. token: "punctuation.int-subset.xml",
  882. regex: "]",
  883. next: "pop"
  884. }, {
  885. token: ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  886. regex: "(<\\!)(" + tagRegex + ")",
  887. push: [{
  888. token: "text",
  889. regex: "\\s+"
  890. },
  891. {
  892. token: "punctuation.markup-decl.xml",
  893. regex: ">",
  894. next: "pop"
  895. },
  896. { include: "string" }]
  897. }],
  898. cdata: [
  899. { token: "string.cdata.xml", regex: "\\]\\]>", next: "start" },
  900. { token: "text.xml", regex: "\\s+" },
  901. { token: "text.xml", regex: "(?:[^\\]]|\\](?!\\]>))+" }
  902. ],
  903. comment: [
  904. { token: "comment.end.xml", regex: "-->", next: "start" },
  905. { defaultToken: "comment.xml" }
  906. ],
  907. reference: [{
  908. token: "constant.language.escape.reference.xml",
  909. regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  910. }],
  911. attr_reference: [{
  912. token: "constant.language.escape.reference.attribute-value.xml",
  913. regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  914. }],
  915. tag: [{
  916. token: ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  917. regex: "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  918. next: [
  919. { include: "attributes" },
  920. { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start" }
  921. ]
  922. }],
  923. tag_whitespace: [
  924. { token: "text.tag-whitespace.xml", regex: "\\s+" }
  925. ],
  926. whitespace: [
  927. { token: "text.whitespace.xml", regex: "\\s+" }
  928. ],
  929. string: [{
  930. token: "string.xml",
  931. regex: "'",
  932. push: [
  933. { token: "string.xml", regex: "'", next: "pop" },
  934. { defaultToken: "string.xml" }
  935. ]
  936. }, {
  937. token: "string.xml",
  938. regex: '"',
  939. push: [
  940. { token: "string.xml", regex: '"', next: "pop" },
  941. { defaultToken: "string.xml" }
  942. ]
  943. }],
  944. attributes: [{
  945. token: "entity.other.attribute-name.xml",
  946. regex: tagRegex
  947. }, {
  948. token: "keyword.operator.attribute-equals.xml",
  949. regex: "="
  950. }, {
  951. include: "tag_whitespace"
  952. }, {
  953. include: "attribute_value"
  954. }],
  955. attribute_value: [{
  956. token: "string.attribute-value.xml",
  957. regex: "'",
  958. push: [
  959. { token: "string.attribute-value.xml", regex: "'", next: "pop" },
  960. { include: "attr_reference" },
  961. { defaultToken: "string.attribute-value.xml" }
  962. ]
  963. }, {
  964. token: "string.attribute-value.xml",
  965. regex: '"',
  966. push: [
  967. { token: "string.attribute-value.xml", regex: '"', next: "pop" },
  968. { include: "attr_reference" },
  969. { defaultToken: "string.attribute-value.xml" }
  970. ]
  971. }]
  972. };
  973. if (this.constructor === XmlHighlightRules)
  974. this.normalizeRules();
  975. };
  976. (function () {
  977. this.embedTagRules = function (HighlightRules, prefix, tag) {
  978. this.$rules.tag.unshift({
  979. token: ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  980. regex: "(<)(" + tag + "(?=\\s|>|$))",
  981. next: [
  982. { include: "attributes" },
  983. { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: prefix + "start" }
  984. ]
  985. });
  986. this.$rules[tag + "-end"] = [
  987. { include: "attributes" },
  988. { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start",
  989. onMatch: function (value, currentState, stack) {
  990. stack.splice(0);
  991. return this.token;
  992. } }
  993. ];
  994. this.embedRules(HighlightRules, prefix, [{
  995. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  996. regex: "(</)(" + tag + "(?=\\s|>|$))",
  997. next: tag + "-end"
  998. }, {
  999. token: "string.cdata.xml",
  1000. regex: "<\\!\\[CDATA\\["
  1001. }, {
  1002. token: "string.cdata.xml",
  1003. regex: "\\]\\]>"
  1004. }]);
  1005. };
  1006. }).call(TextHighlightRules.prototype);
  1007. oop.inherits(XmlHighlightRules, TextHighlightRules);
  1008. exports.XmlHighlightRules = XmlHighlightRules;
  1009. });
  1010. 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";
  1011. var oop = require("../lib/oop");
  1012. var lang = require("../lib/lang");
  1013. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1014. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1015. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  1016. var tagMap = lang.createMap({
  1017. a: 'anchor',
  1018. button: 'form',
  1019. form: 'form',
  1020. img: 'image',
  1021. input: 'form',
  1022. label: 'form',
  1023. option: 'form',
  1024. script: 'script',
  1025. select: 'form',
  1026. textarea: 'form',
  1027. style: 'style',
  1028. table: 'table',
  1029. tbody: 'table',
  1030. td: 'table',
  1031. tfoot: 'table',
  1032. th: 'table',
  1033. tr: 'table'
  1034. });
  1035. var HtmlHighlightRules = function () {
  1036. XmlHighlightRules.call(this);
  1037. this.addRules({
  1038. attributes: [{
  1039. include: "tag_whitespace"
  1040. }, {
  1041. token: "entity.other.attribute-name.xml",
  1042. regex: "[-_a-zA-Z0-9:.]+"
  1043. }, {
  1044. token: "keyword.operator.attribute-equals.xml",
  1045. regex: "=",
  1046. push: [{
  1047. include: "tag_whitespace"
  1048. }, {
  1049. token: "string.unquoted.attribute-value.html",
  1050. regex: "[^<>='\"`\\s]+",
  1051. next: "pop"
  1052. }, {
  1053. token: "empty",
  1054. regex: "",
  1055. next: "pop"
  1056. }]
  1057. }, {
  1058. include: "attribute_value"
  1059. }],
  1060. tag: [{
  1061. token: function (start, tag) {
  1062. var group = tagMap[tag];
  1063. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  1064. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  1065. },
  1066. regex: "(</?)([-_a-zA-Z0-9:.]+)",
  1067. next: "tag_stuff"
  1068. }],
  1069. tag_stuff: [
  1070. { include: "attributes" },
  1071. { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start" }
  1072. ]
  1073. });
  1074. this.embedTagRules(CssHighlightRules, "css-", "style");
  1075. this.embedTagRules(new JavaScriptHighlightRules({ jsx: false }).getRules(), "js-", "script");
  1076. if (this.constructor === HtmlHighlightRules)
  1077. this.normalizeRules();
  1078. };
  1079. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  1080. exports.HtmlHighlightRules = HtmlHighlightRules;
  1081. });
  1082. 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";
  1083. var modes = require("../config").$modes;
  1084. var oop = require("../lib/oop");
  1085. var lang = require("../lib/lang");
  1086. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  1087. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  1088. var escaped = function (ch) {
  1089. return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*";
  1090. };
  1091. var MarkdownHighlightRules = function () {
  1092. HtmlHighlightRules.call(this);
  1093. var codeBlockStartRule = {
  1094. token: "support.function",
  1095. regex: /^\s*(```+[^`]*|~~~+[^~]*)$/,
  1096. onMatch: function (value, state, stack, line) {
  1097. var m = value.match(/^(\s*)([`~]+)(.*)/);
  1098. var language = /[\w-]+|$/.exec(m[3])[0];
  1099. if (!modes[language])
  1100. language = "";
  1101. stack.unshift("githubblock", [], [m[1], m[2], language], state);
  1102. return this.token;
  1103. },
  1104. next: "githubblock"
  1105. };
  1106. var codeBlockRules = [{
  1107. token: "support.function",
  1108. regex: ".*",
  1109. onMatch: function (value, state, stack, line) {
  1110. var embedState = stack[1];
  1111. var indent = stack[2][0];
  1112. var endMarker = stack[2][1];
  1113. var language = stack[2][2];
  1114. var m = /^(\s*)(`+|~+)\s*$/.exec(value);
  1115. if (m && m[1].length < indent.length + 3
  1116. && m[2].length >= endMarker.length && m[2][0] == endMarker[0]) {
  1117. stack.splice(0, 3);
  1118. this.next = stack.shift();
  1119. return this.token;
  1120. }
  1121. this.next = "";
  1122. if (language && modes[language]) {
  1123. var data = modes[language].getTokenizer().getLineTokens(value, embedState.slice(0));
  1124. stack[1] = data.state;
  1125. return data.tokens;
  1126. }
  1127. return this.token;
  1128. }
  1129. }];
  1130. this.$rules["start"].unshift({
  1131. token: "empty_line",
  1132. regex: '^$',
  1133. next: "allowBlock"
  1134. }, {
  1135. token: "markup.heading.1",
  1136. regex: "^=+(?=\\s*$)"
  1137. }, {
  1138. token: "markup.heading.2",
  1139. regex: "^\\-+(?=\\s*$)"
  1140. }, {
  1141. token: function (value) {
  1142. return "markup.heading." + value.length;
  1143. },
  1144. regex: /^#{1,6}(?=\s|$)/,
  1145. next: "header"
  1146. }, codeBlockStartRule, {
  1147. token: "string.blockquote",
  1148. regex: "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  1149. next: "blockquote"
  1150. }, {
  1151. token: "constant",
  1152. regex: "^ {0,3}(?:(?:\\* ?){3,}|(?:\\- ?){3,}|(?:\\_ ?){3,})\\s*$",
  1153. next: "allowBlock"
  1154. }, {
  1155. token: "markup.list",
  1156. regex: "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  1157. next: "listblock-start"
  1158. }, {
  1159. include: "basic"
  1160. });
  1161. this.addRules({
  1162. "basic": [{
  1163. token: "constant.language.escape",
  1164. regex: /\\[\\`*_{}\[\]()#+\-.!]/
  1165. }, {
  1166. token: "support.function",
  1167. regex: "(`+)(.*?[^`])(\\1)"
  1168. }, {
  1169. token: ["text", "constant", "text", "url", "string", "text"],
  1170. regex: "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
  1171. }, {
  1172. token: ["text", "string", "text", "constant", "text"],
  1173. regex: "(\\[)(" + escaped("]") + ")(\\]\\s*\\[)(" + escaped("]") + ")(\\])"
  1174. }, {
  1175. token: ["text", "string", "text", "markup.underline", "string", "text"],
  1176. regex: "(\\!?\\[)(" + // [
  1177. escaped("]") + // link text or alt text
  1178. ")(\\]\\()" + // ](
  1179. '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + // href or image
  1180. '(\\s*"' + escaped('"') + '"\\s*)?' + // "title"
  1181. "(\\))" // )
  1182. }, {
  1183. token: "string.strong",
  1184. regex: "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)"
  1185. }, {
  1186. token: "string.emphasis",
  1187. regex: "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)"
  1188. }, {
  1189. token: ["text", "url", "text"],
  1190. regex: "(<)(" +
  1191. "(?:https?|ftp|dict):[^'\">\\s]+" +
  1192. "|" +
  1193. "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+" +
  1194. ")(>)"
  1195. }],
  1196. "allowBlock": [
  1197. { token: "support.function", regex: "^ {4}.+", next: "allowBlock" },
  1198. { token: "empty_line", regex: '^$', next: "allowBlock" },
  1199. { token: "empty", regex: "", next: "start" }
  1200. ],
  1201. "header": [{
  1202. regex: "$",
  1203. next: "start"
  1204. }, {
  1205. include: "basic"
  1206. }, {
  1207. defaultToken: "heading"
  1208. }],
  1209. "listblock-start": [{
  1210. token: "support.variable",
  1211. regex: /(?:\[[ x]\])?/,
  1212. next: "listblock"
  1213. }],
  1214. "listblock": [{
  1215. token: "empty_line",
  1216. regex: "^$",
  1217. next: "start"
  1218. }, {
  1219. token: "markup.list",
  1220. regex: "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  1221. next: "listblock-start"
  1222. }, {
  1223. include: "basic", noEscape: true
  1224. },
  1225. codeBlockStartRule,
  1226. {
  1227. defaultToken: "list" //do not use markup.list to allow stling leading `*` differntly
  1228. }],
  1229. "blockquote": [{
  1230. token: "empty_line",
  1231. regex: "^\\s*$",
  1232. next: "start"
  1233. }, {
  1234. token: "string.blockquote",
  1235. regex: "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  1236. next: "blockquote"
  1237. }, {
  1238. include: "basic", noEscape: true
  1239. }, {
  1240. defaultToken: "string.blockquote"
  1241. }],
  1242. "githubblock": codeBlockRules
  1243. });
  1244. this.normalizeRules();
  1245. };
  1246. oop.inherits(MarkdownHighlightRules, TextHighlightRules);
  1247. exports.MarkdownHighlightRules = MarkdownHighlightRules;
  1248. });
  1249. 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";
  1250. exports.MaskHighlightRules = MaskHighlightRules;
  1251. var oop = require("../lib/oop");
  1252. var lang = require("../lib/lang");
  1253. var TextRules = require("./text_highlight_rules").TextHighlightRules;
  1254. var JSRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1255. var CssRules = require("./css_highlight_rules").CssHighlightRules;
  1256. var MDRules = require("./markdown_highlight_rules").MarkdownHighlightRules;
  1257. var HTMLRules = require("./html_highlight_rules").HtmlHighlightRules;
  1258. 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";
  1259. var const_FUNCTIONS, const_KEYWORDS, const_CONST, const_TAGS;
  1260. (function () {
  1261. const_FUNCTIONS = lang.arrayToMap(("log").split("|"));
  1262. const_CONST = lang.arrayToMap((":dualbind|:bind|:import|slot|event|style|html|markdown|md").split("|"));
  1263. 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("|"));
  1264. const_TAGS = lang.arrayToMap(("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" +
  1265. "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" +
  1266. "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" +
  1267. "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" +
  1268. "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" +
  1269. "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" +
  1270. "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" +
  1271. "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" +
  1272. "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|"));
  1273. }());
  1274. function MaskHighlightRules() {
  1275. this.$rules = {
  1276. "start": [
  1277. Token("comment", "\\/\\/.*$"),
  1278. Token("comment", "\\/\\*", [
  1279. Token("comment", ".*?\\*\\/", "start"),
  1280. Token("comment", ".+")
  1281. ]),
  1282. Blocks.string("'''"),
  1283. Blocks.string('"""'),
  1284. Blocks.string('"'),
  1285. Blocks.string("'"),
  1286. Blocks.syntax(/(markdown|md)\b/, "md-multiline", "multiline"),
  1287. Blocks.syntax(/html\b/, "html-multiline", "multiline"),
  1288. Blocks.syntax(/(slot|event)\b/, "js-block", "block"),
  1289. Blocks.syntax(/style\b/, "css-block", "block"),
  1290. Blocks.syntax(/var\b/, "js-statement", "attr"),
  1291. Blocks.tag(),
  1292. Token(token_LPARE, "[[({>]"),
  1293. Token(token_RPARE, "[\\])};]", "start"),
  1294. {
  1295. caseInsensitive: true
  1296. }
  1297. ]
  1298. };
  1299. var rules = this;
  1300. addJavaScript("interpolation", /\]/, token_RPARE + "." + token_ITALIC);
  1301. addJavaScript("statement", /\)|}|;/);
  1302. addJavaScript("block", /\}/);
  1303. addCss();
  1304. addMarkdown();
  1305. addHtml();
  1306. function addJavaScript(name, escape, closeType) {
  1307. var prfx = "js-" + name + "-", rootTokens = name === "block" ? ["start"] : ["start", "no_regex"];
  1308. add(JSRules, prfx, escape, rootTokens, closeType);
  1309. }
  1310. function addCss() {
  1311. add(CssRules, "css-block-", /\}/);
  1312. }
  1313. function addMarkdown() {
  1314. add(MDRules, "md-multiline-", /("""|''')/, []);
  1315. }
  1316. function addHtml() {
  1317. add(HTMLRules, "html-multiline-", /("""|''')/);
  1318. }
  1319. function add(Rules, strPrfx, rgxEnd, rootTokens, closeType) {
  1320. var next = "pop";
  1321. var tokens = rootTokens || ["start"];
  1322. if (tokens.length === 0) {
  1323. tokens = null;
  1324. }
  1325. if (/block|multiline/.test(strPrfx)) {
  1326. next = strPrfx + "end";
  1327. rules.$rules[next] = [
  1328. Token("empty", "", "start")
  1329. ];
  1330. }
  1331. rules.embedRules(Rules, strPrfx, [Token(closeType || token_RPARE, rgxEnd, next)], tokens, tokens == null ? true : false);
  1332. }
  1333. this.normalizeRules();
  1334. }
  1335. oop.inherits(MaskHighlightRules, TextRules);
  1336. var Blocks = {
  1337. string: function (str, next) {
  1338. var token = Token("string.start", str, [
  1339. Token(token_LPARE + "." + token_ITALIC, /~\[/, Blocks.interpolation()),
  1340. Token("string.end", str, "pop"),
  1341. {
  1342. defaultToken: "string"
  1343. }
  1344. ], next);
  1345. if (str.length === 1) {
  1346. var escaped = Token("string.escape", "\\\\" + str);
  1347. token.push.unshift(escaped);
  1348. }
  1349. return token;
  1350. },
  1351. interpolation: function () {
  1352. return [
  1353. Token(token_UTIL, /\s*\w*\s*:/),
  1354. "js-interpolation-start"
  1355. ];
  1356. },
  1357. tagHead: function (rgx) {
  1358. return Token(token_ATTR, rgx, [
  1359. Token(token_ATTR, /[\w\-_]+/),
  1360. Token(token_LPARE + "." + token_ITALIC, /~\[/, Blocks.interpolation()),
  1361. Blocks.goUp()
  1362. ]);
  1363. },
  1364. tag: function () {
  1365. return {
  1366. token: 'tag',
  1367. onMatch: function (value) {
  1368. if (void 0 !== const_KEYWORDS[value])
  1369. return token_KEYWORD;
  1370. if (void 0 !== const_CONST[value])
  1371. return token_LANG;
  1372. if (void 0 !== const_FUNCTIONS[value])
  1373. return "support.function";
  1374. if (void 0 !== const_TAGS[value.toLowerCase()])
  1375. return token_TAG;
  1376. return token_COMPO;
  1377. },
  1378. regex: /([@\w\-_:+]+)|((^|\s)(?=\s*(\.|#)))/,
  1379. push: [
  1380. Blocks.tagHead(/\./),
  1381. Blocks.tagHead(/#/),
  1382. Blocks.expression(),
  1383. Blocks.attribute(),
  1384. Token(token_LPARE, /[;>{]/, "pop")
  1385. ]
  1386. };
  1387. },
  1388. syntax: function (rgx, next, type) {
  1389. return {
  1390. token: token_LANG,
  1391. regex: rgx,
  1392. push: ({
  1393. "attr": [
  1394. next + "-start",
  1395. Token(token_PUNKT, /;/, "start")
  1396. ],
  1397. "multiline": [
  1398. Blocks.tagHead(/\./),
  1399. Blocks.tagHead(/#/),
  1400. Blocks.attribute(),
  1401. Blocks.expression(),
  1402. Token(token_LPARE, /[>\{]/),
  1403. Token(token_PUNKT, /;/, "start"),
  1404. Token(token_LPARE, /'''|"""/, [next + "-start"])
  1405. ],
  1406. "block": [
  1407. Blocks.tagHead(/\./),
  1408. Blocks.tagHead(/#/),
  1409. Blocks.attribute(),
  1410. Blocks.expression(),
  1411. Token(token_LPARE, /\{/, [next + "-start"])
  1412. ]
  1413. })[type]
  1414. };
  1415. },
  1416. attribute: function () {
  1417. return Token(function (value) {
  1418. return /^x\-/.test(value)
  1419. ? token_ATTR + "." + token_BOLD
  1420. : token_ATTR;
  1421. }, /[\w_-]+/, [
  1422. Token(token_PUNKT, /\s*=\s*/, [
  1423. Blocks.string('"'),
  1424. Blocks.string("'"),
  1425. Blocks.word(),
  1426. Blocks.goUp()
  1427. ]),
  1428. Blocks.goUp()
  1429. ]);
  1430. },
  1431. expression: function () {
  1432. return Token(token_LPARE, /\(/, ["js-statement-start"]);
  1433. },
  1434. word: function () {
  1435. return Token("string", /[\w-_]+/);
  1436. },
  1437. goUp: function () {
  1438. return Token("text", "", "pop");
  1439. },
  1440. goStart: function () {
  1441. return Token("text", "", "start");
  1442. }
  1443. };
  1444. function Token(token, rgx, mix) {
  1445. var push, next, onMatch;
  1446. if (arguments.length === 4) {
  1447. push = mix;
  1448. next = arguments[3];
  1449. }
  1450. else if (typeof mix === "string") {
  1451. next = mix;
  1452. }
  1453. else {
  1454. push = mix;
  1455. }
  1456. if (typeof token === "function") {
  1457. onMatch = token;
  1458. token = "empty";
  1459. }
  1460. return {
  1461. token: token,
  1462. regex: rgx,
  1463. push: push,
  1464. next: next,
  1465. onMatch: onMatch
  1466. };
  1467. }
  1468. });
  1469. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
  1470. var Range = require("../range").Range;
  1471. var MatchingBraceOutdent = function () { };
  1472. (function () {
  1473. this.checkOutdent = function (line, input) {
  1474. if (!/^\s+$/.test(line))
  1475. return false;
  1476. return /^\s*\}/.test(input);
  1477. };
  1478. this.autoOutdent = function (doc, row) {
  1479. var line = doc.getLine(row);
  1480. var match = line.match(/^(\s*\})/);
  1481. if (!match)
  1482. return 0;
  1483. var column = match[1].length;
  1484. var openBracePos = doc.findMatchingBracket({ row: row, column: column });
  1485. if (!openBracePos || openBracePos.row == row)
  1486. return 0;
  1487. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  1488. doc.replace(new Range(row, 0, row, column - 1), indent);
  1489. };
  1490. this.$getIndent = function (line) {
  1491. return line.match(/^\s*/)[0];
  1492. };
  1493. }).call(MatchingBraceOutdent.prototype);
  1494. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  1495. });
  1496. 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";
  1497. var oop = require("../../lib/oop");
  1498. var Behaviour = require("../behaviour").Behaviour;
  1499. var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
  1500. var TokenIterator = require("../../token_iterator").TokenIterator;
  1501. var CssBehaviour = function () {
  1502. this.inherit(CstyleBehaviour);
  1503. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1504. if (text === ':' && editor.selection.isEmpty()) {
  1505. var cursor = editor.getCursorPosition();
  1506. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1507. var token = iterator.getCurrentToken();
  1508. if (token && token.value.match(/\s+/)) {
  1509. token = iterator.stepBackward();
  1510. }
  1511. if (token && token.type === 'support.type') {
  1512. var line = session.doc.getLine(cursor.row);
  1513. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1514. if (rightChar === ':') {
  1515. return {
  1516. text: '',
  1517. selection: [1, 1]
  1518. };
  1519. }
  1520. if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
  1521. return {
  1522. text: ':;',
  1523. selection: [1, 1]
  1524. };
  1525. }
  1526. }
  1527. }
  1528. });
  1529. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1530. var selected = session.doc.getTextRange(range);
  1531. if (!range.isMultiLine() && selected === ':') {
  1532. var cursor = editor.getCursorPosition();
  1533. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1534. var token = iterator.getCurrentToken();
  1535. if (token && token.value.match(/\s+/)) {
  1536. token = iterator.stepBackward();
  1537. }
  1538. if (token && token.type === 'support.type') {
  1539. var line = session.doc.getLine(range.start.row);
  1540. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1541. if (rightChar === ';') {
  1542. range.end.column++;
  1543. return range;
  1544. }
  1545. }
  1546. }
  1547. });
  1548. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1549. if (text === ';' && editor.selection.isEmpty()) {
  1550. var cursor = editor.getCursorPosition();
  1551. var line = session.doc.getLine(cursor.row);
  1552. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1553. if (rightChar === ';') {
  1554. return {
  1555. text: '',
  1556. selection: [1, 1]
  1557. };
  1558. }
  1559. }
  1560. });
  1561. this.add("!important", "insertion", function (state, action, editor, session, text) {
  1562. if (text === '!' && editor.selection.isEmpty()) {
  1563. var cursor = editor.getCursorPosition();
  1564. var line = session.doc.getLine(cursor.row);
  1565. if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
  1566. return {
  1567. text: '!important',
  1568. selection: [10, 10]
  1569. };
  1570. }
  1571. }
  1572. });
  1573. };
  1574. oop.inherits(CssBehaviour, CstyleBehaviour);
  1575. exports.CssBehaviour = CssBehaviour;
  1576. });
  1577. 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";
  1578. var oop = require("../../lib/oop");
  1579. var Range = require("../../range").Range;
  1580. var BaseFoldMode = require("./fold_mode").FoldMode;
  1581. var FoldMode = exports.FoldMode = function (commentRegex) {
  1582. if (commentRegex) {
  1583. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  1584. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  1585. }
  1586. };
  1587. oop.inherits(FoldMode, BaseFoldMode);
  1588. (function () {
  1589. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  1590. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  1591. this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
  1592. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  1593. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  1594. this._getFoldWidgetBase = this.getFoldWidget;
  1595. this.getFoldWidget = function (session, foldStyle, row) {
  1596. var line = session.getLine(row);
  1597. if (this.singleLineBlockCommentRe.test(line)) {
  1598. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  1599. return "";
  1600. }
  1601. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  1602. if (!fw && this.startRegionRe.test(line))
  1603. return "start"; // lineCommentRegionStart
  1604. return fw;
  1605. };
  1606. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  1607. var line = session.getLine(row);
  1608. if (this.startRegionRe.test(line))
  1609. return this.getCommentRegionBlock(session, line, row);
  1610. var match = line.match(this.foldingStartMarker);
  1611. if (match) {
  1612. var i = match.index;
  1613. if (match[1])
  1614. return this.openingBracketBlock(session, match[1], row, i);
  1615. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  1616. if (range && !range.isMultiLine()) {
  1617. if (forceMultiline) {
  1618. range = this.getSectionRange(session, row);
  1619. }
  1620. else if (foldStyle != "all")
  1621. range = null;
  1622. }
  1623. return range;
  1624. }
  1625. if (foldStyle === "markbegin")
  1626. return;
  1627. var match = line.match(this.foldingStopMarker);
  1628. if (match) {
  1629. var i = match.index + match[0].length;
  1630. if (match[1])
  1631. return this.closingBracketBlock(session, match[1], row, i);
  1632. return session.getCommentFoldRange(row, i, -1);
  1633. }
  1634. };
  1635. this.getSectionRange = function (session, row) {
  1636. var line = session.getLine(row);
  1637. var startIndent = line.search(/\S/);
  1638. var startRow = row;
  1639. var startColumn = line.length;
  1640. row = row + 1;
  1641. var endRow = row;
  1642. var maxRow = session.getLength();
  1643. while (++row < maxRow) {
  1644. line = session.getLine(row);
  1645. var indent = line.search(/\S/);
  1646. if (indent === -1)
  1647. continue;
  1648. if (startIndent > indent)
  1649. break;
  1650. var subRange = this.getFoldWidgetRange(session, "all", row);
  1651. if (subRange) {
  1652. if (subRange.start.row <= startRow) {
  1653. break;
  1654. }
  1655. else if (subRange.isMultiLine()) {
  1656. row = subRange.end.row;
  1657. }
  1658. else if (startIndent == indent) {
  1659. break;
  1660. }
  1661. }
  1662. endRow = row;
  1663. }
  1664. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  1665. };
  1666. this.getCommentRegionBlock = function (session, line, row) {
  1667. var startColumn = line.search(/\s*$/);
  1668. var maxRow = session.getLength();
  1669. var startRow = row;
  1670. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  1671. var depth = 1;
  1672. while (++row < maxRow) {
  1673. line = session.getLine(row);
  1674. var m = re.exec(line);
  1675. if (!m)
  1676. continue;
  1677. if (m[1])
  1678. depth--;
  1679. else
  1680. depth++;
  1681. if (!depth)
  1682. break;
  1683. }
  1684. var endRow = row;
  1685. if (endRow > startRow) {
  1686. return new Range(startRow, startColumn, endRow, line.length);
  1687. }
  1688. };
  1689. }).call(FoldMode.prototype);
  1690. });
  1691. 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";
  1692. var oop = require("../lib/oop");
  1693. var TextMode = require("./text").Mode;
  1694. var MaskHighlightRules = require("./mask_highlight_rules").MaskHighlightRules;
  1695. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1696. var CssBehaviour = require("./behaviour/css").CssBehaviour;
  1697. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1698. var Mode = function () {
  1699. this.HighlightRules = MaskHighlightRules;
  1700. this.$outdent = new MatchingBraceOutdent();
  1701. this.$behaviour = new CssBehaviour();
  1702. this.foldingRules = new CStyleFoldMode();
  1703. };
  1704. oop.inherits(Mode, TextMode);
  1705. (function () {
  1706. this.lineCommentStart = "//";
  1707. this.blockComment = { start: "/*", end: "*/" };
  1708. this.getNextLineIndent = function (state, line, tab) {
  1709. var indent = this.$getIndent(line);
  1710. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1711. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  1712. return indent;
  1713. }
  1714. var match = line.match(/^.*\{\s*$/);
  1715. if (match) {
  1716. indent += tab;
  1717. }
  1718. return indent;
  1719. };
  1720. this.checkOutdent = function (state, line, input) {
  1721. return this.$outdent.checkOutdent(line, input);
  1722. };
  1723. this.autoOutdent = function (state, doc, row) {
  1724. this.$outdent.autoOutdent(doc, row);
  1725. };
  1726. this.$id = "ace/mode/mask";
  1727. }).call(Mode.prototype);
  1728. exports.Mode = Mode;
  1729. }); (function() {
  1730. ace.require(["ace/mode/mask"], function(m) {
  1731. if (typeof module == "object" && typeof exports == "object" && module) {
  1732. module.exports = m;
  1733. }
  1734. });
  1735. })();