c12aea7221ccf11ea17f3d71ae7a3b7d.js 107 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411
  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/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
  496. var Range = require("../range").Range;
  497. var MatchingBraceOutdent = function () { };
  498. (function () {
  499. this.checkOutdent = function (line, input) {
  500. if (!/^\s+$/.test(line))
  501. return false;
  502. return /^\s*\}/.test(input);
  503. };
  504. this.autoOutdent = function (doc, row) {
  505. var line = doc.getLine(row);
  506. var match = line.match(/^(\s*\})/);
  507. if (!match)
  508. return 0;
  509. var column = match[1].length;
  510. var openBracePos = doc.findMatchingBracket({ row: row, column: column });
  511. if (!openBracePos || openBracePos.row == row)
  512. return 0;
  513. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  514. doc.replace(new Range(row, 0, row, column - 1), indent);
  515. };
  516. this.$getIndent = function (line) {
  517. return line.match(/^\s*/)[0];
  518. };
  519. }).call(MatchingBraceOutdent.prototype);
  520. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  521. });
  522. 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";
  523. var oop = require("../../lib/oop");
  524. var Range = require("../../range").Range;
  525. var BaseFoldMode = require("./fold_mode").FoldMode;
  526. var FoldMode = exports.FoldMode = function (commentRegex) {
  527. if (commentRegex) {
  528. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  529. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  530. }
  531. };
  532. oop.inherits(FoldMode, BaseFoldMode);
  533. (function () {
  534. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  535. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  536. this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
  537. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  538. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  539. this._getFoldWidgetBase = this.getFoldWidget;
  540. this.getFoldWidget = function (session, foldStyle, row) {
  541. var line = session.getLine(row);
  542. if (this.singleLineBlockCommentRe.test(line)) {
  543. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  544. return "";
  545. }
  546. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  547. if (!fw && this.startRegionRe.test(line))
  548. return "start"; // lineCommentRegionStart
  549. return fw;
  550. };
  551. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  552. var line = session.getLine(row);
  553. if (this.startRegionRe.test(line))
  554. return this.getCommentRegionBlock(session, line, row);
  555. var match = line.match(this.foldingStartMarker);
  556. if (match) {
  557. var i = match.index;
  558. if (match[1])
  559. return this.openingBracketBlock(session, match[1], row, i);
  560. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  561. if (range && !range.isMultiLine()) {
  562. if (forceMultiline) {
  563. range = this.getSectionRange(session, row);
  564. }
  565. else if (foldStyle != "all")
  566. range = null;
  567. }
  568. return range;
  569. }
  570. if (foldStyle === "markbegin")
  571. return;
  572. var match = line.match(this.foldingStopMarker);
  573. if (match) {
  574. var i = match.index + match[0].length;
  575. if (match[1])
  576. return this.closingBracketBlock(session, match[1], row, i);
  577. return session.getCommentFoldRange(row, i, -1);
  578. }
  579. };
  580. this.getSectionRange = function (session, row) {
  581. var line = session.getLine(row);
  582. var startIndent = line.search(/\S/);
  583. var startRow = row;
  584. var startColumn = line.length;
  585. row = row + 1;
  586. var endRow = row;
  587. var maxRow = session.getLength();
  588. while (++row < maxRow) {
  589. line = session.getLine(row);
  590. var indent = line.search(/\S/);
  591. if (indent === -1)
  592. continue;
  593. if (startIndent > indent)
  594. break;
  595. var subRange = this.getFoldWidgetRange(session, "all", row);
  596. if (subRange) {
  597. if (subRange.start.row <= startRow) {
  598. break;
  599. }
  600. else if (subRange.isMultiLine()) {
  601. row = subRange.end.row;
  602. }
  603. else if (startIndent == indent) {
  604. break;
  605. }
  606. }
  607. endRow = row;
  608. }
  609. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  610. };
  611. this.getCommentRegionBlock = function (session, line, row) {
  612. var startColumn = line.search(/\s*$/);
  613. var maxRow = session.getLength();
  614. var startRow = row;
  615. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  616. var depth = 1;
  617. while (++row < maxRow) {
  618. line = session.getLine(row);
  619. var m = re.exec(line);
  620. if (!m)
  621. continue;
  622. if (m[1])
  623. depth--;
  624. else
  625. depth++;
  626. if (!depth)
  627. break;
  628. }
  629. var endRow = row;
  630. if (endRow > startRow) {
  631. return new Range(startRow, startColumn, endRow, line.length);
  632. }
  633. };
  634. }).call(FoldMode.prototype);
  635. });
  636. ace.define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
  637. var oop = require("../lib/oop");
  638. var TextMode = require("./text").Mode;
  639. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  640. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  641. var WorkerClient = require("../worker/worker_client").WorkerClient;
  642. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  643. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  644. var Mode = function () {
  645. this.HighlightRules = JavaScriptHighlightRules;
  646. this.$outdent = new MatchingBraceOutdent();
  647. this.$behaviour = new CstyleBehaviour();
  648. this.foldingRules = new CStyleFoldMode();
  649. };
  650. oop.inherits(Mode, TextMode);
  651. (function () {
  652. this.lineCommentStart = "//";
  653. this.blockComment = { start: "/*", end: "*/" };
  654. this.$quotes = { '"': '"', "'": "'", "`": "`" };
  655. this.getNextLineIndent = function (state, line, tab) {
  656. var indent = this.$getIndent(line);
  657. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  658. var tokens = tokenizedLine.tokens;
  659. var endState = tokenizedLine.state;
  660. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  661. return indent;
  662. }
  663. if (state == "start" || state == "no_regex") {
  664. var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
  665. if (match) {
  666. indent += tab;
  667. }
  668. }
  669. else if (state == "doc-start") {
  670. if (endState == "start" || endState == "no_regex") {
  671. return "";
  672. }
  673. var match = line.match(/^\s*(\/?)\*/);
  674. if (match) {
  675. if (match[1]) {
  676. indent += " ";
  677. }
  678. indent += "* ";
  679. }
  680. }
  681. return indent;
  682. };
  683. this.checkOutdent = function (state, line, input) {
  684. return this.$outdent.checkOutdent(line, input);
  685. };
  686. this.autoOutdent = function (state, doc, row) {
  687. this.$outdent.autoOutdent(doc, row);
  688. };
  689. this.createWorker = function (session) {
  690. var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
  691. worker.attachToDocument(session.getDocument());
  692. worker.on("annotate", function (results) {
  693. session.setAnnotations(results.data);
  694. });
  695. worker.on("terminate", function () {
  696. session.clearAnnotations();
  697. });
  698. return worker;
  699. };
  700. this.$id = "ace/mode/javascript";
  701. this.snippetFileId = "ace/snippets/javascript";
  702. }).call(Mode.prototype);
  703. exports.Mode = Mode;
  704. });
  705. 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";
  706. var oop = require("../lib/oop");
  707. var lang = require("../lib/lang");
  708. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  709. 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";
  710. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  711. 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";
  712. 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";
  713. 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";
  714. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
  715. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  716. 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";
  717. var CssHighlightRules = function () {
  718. var keywordMapper = this.createKeywordMapper({
  719. "support.function": supportFunction,
  720. "support.constant": supportConstant,
  721. "support.type": supportType,
  722. "support.constant.color": supportConstantColor,
  723. "support.constant.fonts": supportConstantFonts
  724. }, "text", true);
  725. this.$rules = {
  726. "start": [{
  727. include: ["strings", "url", "comments"]
  728. }, {
  729. token: "paren.lparen",
  730. regex: "\\{",
  731. next: "ruleset"
  732. }, {
  733. token: "paren.rparen",
  734. regex: "\\}"
  735. }, {
  736. token: "string",
  737. regex: "@(?!viewport)",
  738. next: "media"
  739. }, {
  740. token: "keyword",
  741. regex: "#[a-z0-9-_]+"
  742. }, {
  743. token: "keyword",
  744. regex: "%"
  745. }, {
  746. token: "variable",
  747. regex: "\\.[a-z0-9-_]+"
  748. }, {
  749. token: "string",
  750. regex: ":[a-z0-9-_]+"
  751. }, {
  752. token: "constant.numeric",
  753. regex: numRe
  754. }, {
  755. token: "constant",
  756. regex: "[a-z0-9-_]+"
  757. }, {
  758. caseInsensitive: true
  759. }],
  760. "media": [{
  761. include: ["strings", "url", "comments"]
  762. }, {
  763. token: "paren.lparen",
  764. regex: "\\{",
  765. next: "start"
  766. }, {
  767. token: "paren.rparen",
  768. regex: "\\}",
  769. next: "start"
  770. }, {
  771. token: "string",
  772. regex: ";",
  773. next: "start"
  774. }, {
  775. token: "keyword",
  776. regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
  777. + "|page|font|keyframes|viewport|counter-style|font-feature-values"
  778. + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
  779. }],
  780. "comments": [{
  781. token: "comment",
  782. regex: "\\/\\*",
  783. push: [{
  784. token: "comment",
  785. regex: "\\*\\/",
  786. next: "pop"
  787. }, {
  788. defaultToken: "comment"
  789. }]
  790. }],
  791. "ruleset": [{
  792. regex: "-(webkit|ms|moz|o)-",
  793. token: "text"
  794. }, {
  795. token: "punctuation.operator",
  796. regex: "[:;]"
  797. }, {
  798. token: "paren.rparen",
  799. regex: "\\}",
  800. next: "start"
  801. }, {
  802. include: ["strings", "url", "comments"]
  803. }, {
  804. token: ["constant.numeric", "keyword"],
  805. 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|%)"
  806. }, {
  807. token: "constant.numeric",
  808. regex: numRe
  809. }, {
  810. token: "constant.numeric",
  811. regex: "#[a-f0-9]{6}"
  812. }, {
  813. token: "constant.numeric",
  814. regex: "#[a-f0-9]{3}"
  815. }, {
  816. token: ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  817. regex: pseudoElements
  818. }, {
  819. token: ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  820. regex: pseudoClasses
  821. }, {
  822. include: "url"
  823. }, {
  824. token: keywordMapper,
  825. regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  826. }, {
  827. caseInsensitive: true
  828. }],
  829. url: [{
  830. token: "support.function",
  831. regex: "(?:url(:?-prefix)?|domain|regexp)\\(",
  832. push: [{
  833. token: "support.function",
  834. regex: "\\)",
  835. next: "pop"
  836. }, {
  837. defaultToken: "string"
  838. }]
  839. }],
  840. strings: [{
  841. token: "string.start",
  842. regex: "'",
  843. push: [{
  844. token: "string.end",
  845. regex: "'|$",
  846. next: "pop"
  847. }, {
  848. include: "escapes"
  849. }, {
  850. token: "constant.language.escape",
  851. regex: /\\$/,
  852. consumeLineEnd: true
  853. }, {
  854. defaultToken: "string"
  855. }]
  856. }, {
  857. token: "string.start",
  858. regex: '"',
  859. push: [{
  860. token: "string.end",
  861. regex: '"|$',
  862. next: "pop"
  863. }, {
  864. include: "escapes"
  865. }, {
  866. token: "constant.language.escape",
  867. regex: /\\$/,
  868. consumeLineEnd: true
  869. }, {
  870. defaultToken: "string"
  871. }]
  872. }],
  873. escapes: [{
  874. token: "constant.language.escape",
  875. regex: /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
  876. }]
  877. };
  878. this.normalizeRules();
  879. };
  880. oop.inherits(CssHighlightRules, TextHighlightRules);
  881. exports.CssHighlightRules = CssHighlightRules;
  882. });
  883. ace.define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module){"use strict";
  884. var propertyMap = {
  885. "background": { "#$0": 1 },
  886. "background-color": { "#$0": 1, "transparent": 1, "fixed": 1 },
  887. "background-image": { "url('/$0')": 1 },
  888. "background-repeat": { "repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1 },
  889. "background-position": { "bottom": 2, "center": 2, "left": 2, "right": 2, "top": 2, "inherit": 2 },
  890. "background-attachment": { "scroll": 1, "fixed": 1 },
  891. "background-size": { "cover": 1, "contain": 1 },
  892. "background-clip": { "border-box": 1, "padding-box": 1, "content-box": 1 },
  893. "background-origin": { "border-box": 1, "padding-box": 1, "content-box": 1 },
  894. "border": { "solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1 },
  895. "border-color": { "#$0": 1 },
  896. "border-style": { "solid": 2, "dashed": 2, "dotted": 2, "double": 2, "groove": 2, "hidden": 2, "inherit": 2, "inset": 2, "none": 2, "outset": 2, "ridged": 2 },
  897. "border-collapse": { "collapse": 1, "separate": 1 },
  898. "bottom": { "px": 1, "em": 1, "%": 1 },
  899. "clear": { "left": 1, "right": 1, "both": 1, "none": 1 },
  900. "color": { "#$0": 1, "rgb(#$00,0,0)": 1 },
  901. "cursor": { "default": 1, "pointer": 1, "move": 1, "text": 1, "wait": 1, "help": 1, "progress": 1, "n-resize": 1, "ne-resize": 1, "e-resize": 1, "se-resize": 1, "s-resize": 1, "sw-resize": 1, "w-resize": 1, "nw-resize": 1 },
  902. "display": { "none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1 },
  903. "empty-cells": { "show": 1, "hide": 1 },
  904. "float": { "left": 1, "right": 1, "none": 1 },
  905. "font-family": { "Arial": 2, "Comic Sans MS": 2, "Consolas": 2, "Courier New": 2, "Courier": 2, "Georgia": 2, "Monospace": 2, "Sans-Serif": 2, "Segoe UI": 2, "Tahoma": 2, "Times New Roman": 2, "Trebuchet MS": 2, "Verdana": 1 },
  906. "font-size": { "px": 1, "em": 1, "%": 1 },
  907. "font-weight": { "bold": 1, "normal": 1 },
  908. "font-style": { "italic": 1, "normal": 1 },
  909. "font-variant": { "normal": 1, "small-caps": 1 },
  910. "height": { "px": 1, "em": 1, "%": 1 },
  911. "left": { "px": 1, "em": 1, "%": 1 },
  912. "letter-spacing": { "normal": 1 },
  913. "line-height": { "normal": 1 },
  914. "list-style-type": { "none": 1, "disc": 1, "circle": 1, "square": 1, "decimal": 1, "decimal-leading-zero": 1, "lower-roman": 1, "upper-roman": 1, "lower-greek": 1, "lower-latin": 1, "upper-latin": 1, "georgian": 1, "lower-alpha": 1, "upper-alpha": 1 },
  915. "margin": { "px": 1, "em": 1, "%": 1 },
  916. "margin-right": { "px": 1, "em": 1, "%": 1 },
  917. "margin-left": { "px": 1, "em": 1, "%": 1 },
  918. "margin-top": { "px": 1, "em": 1, "%": 1 },
  919. "margin-bottom": { "px": 1, "em": 1, "%": 1 },
  920. "max-height": { "px": 1, "em": 1, "%": 1 },
  921. "max-width": { "px": 1, "em": 1, "%": 1 },
  922. "min-height": { "px": 1, "em": 1, "%": 1 },
  923. "min-width": { "px": 1, "em": 1, "%": 1 },
  924. "overflow": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
  925. "overflow-x": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
  926. "overflow-y": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
  927. "padding": { "px": 1, "em": 1, "%": 1 },
  928. "padding-top": { "px": 1, "em": 1, "%": 1 },
  929. "padding-right": { "px": 1, "em": 1, "%": 1 },
  930. "padding-bottom": { "px": 1, "em": 1, "%": 1 },
  931. "padding-left": { "px": 1, "em": 1, "%": 1 },
  932. "page-break-after": { "auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1 },
  933. "page-break-before": { "auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1 },
  934. "position": { "absolute": 1, "relative": 1, "fixed": 1, "static": 1 },
  935. "right": { "px": 1, "em": 1, "%": 1 },
  936. "table-layout": { "fixed": 1, "auto": 1 },
  937. "text-decoration": { "none": 1, "underline": 1, "line-through": 1, "blink": 1 },
  938. "text-align": { "left": 1, "right": 1, "center": 1, "justify": 1 },
  939. "text-transform": { "capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1 },
  940. "top": { "px": 1, "em": 1, "%": 1 },
  941. "vertical-align": { "top": 1, "bottom": 1 },
  942. "visibility": { "hidden": 1, "visible": 1 },
  943. "white-space": { "nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1 },
  944. "width": { "px": 1, "em": 1, "%": 1 },
  945. "word-spacing": { "normal": 1 },
  946. "filter": { "alpha(opacity=$0100)": 1 },
  947. "text-shadow": { "$02px 2px 2px #777": 1 },
  948. "text-overflow": { "ellipsis-word": 1, "clip": 1, "ellipsis": 1 },
  949. "-moz-border-radius": 1,
  950. "-moz-border-radius-topright": 1,
  951. "-moz-border-radius-bottomright": 1,
  952. "-moz-border-radius-topleft": 1,
  953. "-moz-border-radius-bottomleft": 1,
  954. "-webkit-border-radius": 1,
  955. "-webkit-border-top-right-radius": 1,
  956. "-webkit-border-top-left-radius": 1,
  957. "-webkit-border-bottom-right-radius": 1,
  958. "-webkit-border-bottom-left-radius": 1,
  959. "-moz-box-shadow": 1,
  960. "-webkit-box-shadow": 1,
  961. "transform": { "rotate($00deg)": 1, "skew($00deg)": 1 },
  962. "-moz-transform": { "rotate($00deg)": 1, "skew($00deg)": 1 },
  963. "-webkit-transform": { "rotate($00deg)": 1, "skew($00deg)": 1 }
  964. };
  965. var CssCompletions = function () {
  966. };
  967. (function () {
  968. this.completionsDefined = false;
  969. this.defineCompletions = function () {
  970. if (document) {
  971. var style = document.createElement('c').style;
  972. for (var i in style) {
  973. if (typeof style[i] !== 'string')
  974. continue;
  975. var name = i.replace(/[A-Z]/g, function (x) {
  976. return '-' + x.toLowerCase();
  977. });
  978. if (!propertyMap.hasOwnProperty(name))
  979. propertyMap[name] = 1;
  980. }
  981. }
  982. this.completionsDefined = true;
  983. };
  984. this.getCompletions = function (state, session, pos, prefix) {
  985. if (!this.completionsDefined) {
  986. this.defineCompletions();
  987. }
  988. if (state === 'ruleset' || session.$mode.$id == "ace/mode/scss") {
  989. var line = session.getLine(pos.row).substr(0, pos.column);
  990. if (/:[^;]+$/.test(line)) {
  991. /([\w\-]+):[^:]*$/.test(line);
  992. return this.getPropertyValueCompletions(state, session, pos, prefix);
  993. }
  994. else {
  995. return this.getPropertyCompletions(state, session, pos, prefix);
  996. }
  997. }
  998. return [];
  999. };
  1000. this.getPropertyCompletions = function (state, session, pos, prefix) {
  1001. var properties = Object.keys(propertyMap);
  1002. return properties.map(function (property) {
  1003. return {
  1004. caption: property,
  1005. snippet: property + ': $0;',
  1006. meta: "property",
  1007. score: 1000000
  1008. };
  1009. });
  1010. };
  1011. this.getPropertyValueCompletions = function (state, session, pos, prefix) {
  1012. var line = session.getLine(pos.row).substr(0, pos.column);
  1013. var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
  1014. if (!property)
  1015. return [];
  1016. var values = [];
  1017. if (property in propertyMap && typeof propertyMap[property] === "object") {
  1018. values = Object.keys(propertyMap[property]);
  1019. }
  1020. return values.map(function (value) {
  1021. return {
  1022. caption: value,
  1023. snippet: value,
  1024. meta: "property value",
  1025. score: 1000000
  1026. };
  1027. });
  1028. };
  1029. }).call(CssCompletions.prototype);
  1030. exports.CssCompletions = CssCompletions;
  1031. });
  1032. 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";
  1033. var oop = require("../../lib/oop");
  1034. var Behaviour = require("../behaviour").Behaviour;
  1035. var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
  1036. var TokenIterator = require("../../token_iterator").TokenIterator;
  1037. var CssBehaviour = function () {
  1038. this.inherit(CstyleBehaviour);
  1039. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1040. if (text === ':' && editor.selection.isEmpty()) {
  1041. var cursor = editor.getCursorPosition();
  1042. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1043. var token = iterator.getCurrentToken();
  1044. if (token && token.value.match(/\s+/)) {
  1045. token = iterator.stepBackward();
  1046. }
  1047. if (token && token.type === 'support.type') {
  1048. var line = session.doc.getLine(cursor.row);
  1049. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1050. if (rightChar === ':') {
  1051. return {
  1052. text: '',
  1053. selection: [1, 1]
  1054. };
  1055. }
  1056. if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
  1057. return {
  1058. text: ':;',
  1059. selection: [1, 1]
  1060. };
  1061. }
  1062. }
  1063. }
  1064. });
  1065. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1066. var selected = session.doc.getTextRange(range);
  1067. if (!range.isMultiLine() && selected === ':') {
  1068. var cursor = editor.getCursorPosition();
  1069. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1070. var token = iterator.getCurrentToken();
  1071. if (token && token.value.match(/\s+/)) {
  1072. token = iterator.stepBackward();
  1073. }
  1074. if (token && token.type === 'support.type') {
  1075. var line = session.doc.getLine(range.start.row);
  1076. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1077. if (rightChar === ';') {
  1078. range.end.column++;
  1079. return range;
  1080. }
  1081. }
  1082. }
  1083. });
  1084. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1085. if (text === ';' && editor.selection.isEmpty()) {
  1086. var cursor = editor.getCursorPosition();
  1087. var line = session.doc.getLine(cursor.row);
  1088. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1089. if (rightChar === ';') {
  1090. return {
  1091. text: '',
  1092. selection: [1, 1]
  1093. };
  1094. }
  1095. }
  1096. });
  1097. this.add("!important", "insertion", function (state, action, editor, session, text) {
  1098. if (text === '!' && editor.selection.isEmpty()) {
  1099. var cursor = editor.getCursorPosition();
  1100. var line = session.doc.getLine(cursor.row);
  1101. if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
  1102. return {
  1103. text: '!important',
  1104. selection: [10, 10]
  1105. };
  1106. }
  1107. }
  1108. });
  1109. };
  1110. oop.inherits(CssBehaviour, CstyleBehaviour);
  1111. exports.CssBehaviour = CssBehaviour;
  1112. });
  1113. ace.define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/css_completions","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
  1114. var oop = require("../lib/oop");
  1115. var TextMode = require("./text").Mode;
  1116. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1117. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1118. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1119. var CssCompletions = require("./css_completions").CssCompletions;
  1120. var CssBehaviour = require("./behaviour/css").CssBehaviour;
  1121. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1122. var Mode = function () {
  1123. this.HighlightRules = CssHighlightRules;
  1124. this.$outdent = new MatchingBraceOutdent();
  1125. this.$behaviour = new CssBehaviour();
  1126. this.$completer = new CssCompletions();
  1127. this.foldingRules = new CStyleFoldMode();
  1128. };
  1129. oop.inherits(Mode, TextMode);
  1130. (function () {
  1131. this.foldingRules = "cStyle";
  1132. this.blockComment = { start: "/*", end: "*/" };
  1133. this.getNextLineIndent = function (state, line, tab) {
  1134. var indent = this.$getIndent(line);
  1135. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1136. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  1137. return indent;
  1138. }
  1139. var match = line.match(/^.*\{\s*$/);
  1140. if (match) {
  1141. indent += tab;
  1142. }
  1143. return indent;
  1144. };
  1145. this.checkOutdent = function (state, line, input) {
  1146. return this.$outdent.checkOutdent(line, input);
  1147. };
  1148. this.autoOutdent = function (state, doc, row) {
  1149. this.$outdent.autoOutdent(doc, row);
  1150. };
  1151. this.getCompletions = function (state, session, pos, prefix) {
  1152. return this.$completer.getCompletions(state, session, pos, prefix);
  1153. };
  1154. this.createWorker = function (session) {
  1155. var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
  1156. worker.attachToDocument(session.getDocument());
  1157. worker.on("annotate", function (e) {
  1158. session.setAnnotations(e.data);
  1159. });
  1160. worker.on("terminate", function () {
  1161. session.clearAnnotations();
  1162. });
  1163. return worker;
  1164. };
  1165. this.$id = "ace/mode/css";
  1166. this.snippetFileId = "ace/snippets/css";
  1167. }).call(Mode.prototype);
  1168. exports.Mode = Mode;
  1169. });
  1170. ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  1171. var oop = require("../lib/oop");
  1172. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  1173. var XmlHighlightRules = function (normalize) {
  1174. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  1175. this.$rules = {
  1176. start: [
  1177. { token: "string.cdata.xml", regex: "<\\!\\[CDATA\\[", next: "cdata" },
  1178. {
  1179. token: ["punctuation.instruction.xml", "keyword.instruction.xml"],
  1180. regex: "(<\\?)(" + tagRegex + ")", next: "processing_instruction"
  1181. },
  1182. { token: "comment.start.xml", regex: "<\\!--", next: "comment" },
  1183. {
  1184. token: ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  1185. regex: "(<\\!)(DOCTYPE)(?=[\\s])", next: "doctype", caseInsensitive: true
  1186. },
  1187. { include: "tag" },
  1188. { token: "text.end-tag-open.xml", regex: "</" },
  1189. { token: "text.tag-open.xml", regex: "<" },
  1190. { include: "reference" },
  1191. { defaultToken: "text.xml" }
  1192. ],
  1193. processing_instruction: [{
  1194. token: "entity.other.attribute-name.decl-attribute-name.xml",
  1195. regex: tagRegex
  1196. }, {
  1197. token: "keyword.operator.decl-attribute-equals.xml",
  1198. regex: "="
  1199. }, {
  1200. include: "whitespace"
  1201. }, {
  1202. include: "string"
  1203. }, {
  1204. token: "punctuation.xml-decl.xml",
  1205. regex: "\\?>",
  1206. next: "start"
  1207. }],
  1208. doctype: [
  1209. { include: "whitespace" },
  1210. { include: "string" },
  1211. { token: "xml-pe.doctype.xml", regex: ">", next: "start" },
  1212. { token: "xml-pe.xml", regex: "[-_a-zA-Z0-9:]+" },
  1213. { token: "punctuation.int-subset", regex: "\\[", push: "int_subset" }
  1214. ],
  1215. int_subset: [{
  1216. token: "text.xml",
  1217. regex: "\\s+"
  1218. }, {
  1219. token: "punctuation.int-subset.xml",
  1220. regex: "]",
  1221. next: "pop"
  1222. }, {
  1223. token: ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  1224. regex: "(<\\!)(" + tagRegex + ")",
  1225. push: [{
  1226. token: "text",
  1227. regex: "\\s+"
  1228. },
  1229. {
  1230. token: "punctuation.markup-decl.xml",
  1231. regex: ">",
  1232. next: "pop"
  1233. },
  1234. { include: "string" }]
  1235. }],
  1236. cdata: [
  1237. { token: "string.cdata.xml", regex: "\\]\\]>", next: "start" },
  1238. { token: "text.xml", regex: "\\s+" },
  1239. { token: "text.xml", regex: "(?:[^\\]]|\\](?!\\]>))+" }
  1240. ],
  1241. comment: [
  1242. { token: "comment.end.xml", regex: "-->", next: "start" },
  1243. { defaultToken: "comment.xml" }
  1244. ],
  1245. reference: [{
  1246. token: "constant.language.escape.reference.xml",
  1247. regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  1248. }],
  1249. attr_reference: [{
  1250. token: "constant.language.escape.reference.attribute-value.xml",
  1251. regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  1252. }],
  1253. tag: [{
  1254. token: ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  1255. regex: "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  1256. next: [
  1257. { include: "attributes" },
  1258. { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start" }
  1259. ]
  1260. }],
  1261. tag_whitespace: [
  1262. { token: "text.tag-whitespace.xml", regex: "\\s+" }
  1263. ],
  1264. whitespace: [
  1265. { token: "text.whitespace.xml", regex: "\\s+" }
  1266. ],
  1267. string: [{
  1268. token: "string.xml",
  1269. regex: "'",
  1270. push: [
  1271. { token: "string.xml", regex: "'", next: "pop" },
  1272. { defaultToken: "string.xml" }
  1273. ]
  1274. }, {
  1275. token: "string.xml",
  1276. regex: '"',
  1277. push: [
  1278. { token: "string.xml", regex: '"', next: "pop" },
  1279. { defaultToken: "string.xml" }
  1280. ]
  1281. }],
  1282. attributes: [{
  1283. token: "entity.other.attribute-name.xml",
  1284. regex: tagRegex
  1285. }, {
  1286. token: "keyword.operator.attribute-equals.xml",
  1287. regex: "="
  1288. }, {
  1289. include: "tag_whitespace"
  1290. }, {
  1291. include: "attribute_value"
  1292. }],
  1293. attribute_value: [{
  1294. token: "string.attribute-value.xml",
  1295. regex: "'",
  1296. push: [
  1297. { token: "string.attribute-value.xml", regex: "'", next: "pop" },
  1298. { include: "attr_reference" },
  1299. { defaultToken: "string.attribute-value.xml" }
  1300. ]
  1301. }, {
  1302. token: "string.attribute-value.xml",
  1303. regex: '"',
  1304. push: [
  1305. { token: "string.attribute-value.xml", regex: '"', next: "pop" },
  1306. { include: "attr_reference" },
  1307. { defaultToken: "string.attribute-value.xml" }
  1308. ]
  1309. }]
  1310. };
  1311. if (this.constructor === XmlHighlightRules)
  1312. this.normalizeRules();
  1313. };
  1314. (function () {
  1315. this.embedTagRules = function (HighlightRules, prefix, tag) {
  1316. this.$rules.tag.unshift({
  1317. token: ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  1318. regex: "(<)(" + tag + "(?=\\s|>|$))",
  1319. next: [
  1320. { include: "attributes" },
  1321. { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: prefix + "start" }
  1322. ]
  1323. });
  1324. this.$rules[tag + "-end"] = [
  1325. { include: "attributes" },
  1326. { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start",
  1327. onMatch: function (value, currentState, stack) {
  1328. stack.splice(0);
  1329. return this.token;
  1330. } }
  1331. ];
  1332. this.embedRules(HighlightRules, prefix, [{
  1333. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  1334. regex: "(</)(" + tag + "(?=\\s|>|$))",
  1335. next: tag + "-end"
  1336. }, {
  1337. token: "string.cdata.xml",
  1338. regex: "<\\!\\[CDATA\\["
  1339. }, {
  1340. token: "string.cdata.xml",
  1341. regex: "\\]\\]>"
  1342. }]);
  1343. };
  1344. }).call(TextHighlightRules.prototype);
  1345. oop.inherits(XmlHighlightRules, TextHighlightRules);
  1346. exports.XmlHighlightRules = XmlHighlightRules;
  1347. });
  1348. 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";
  1349. var oop = require("../lib/oop");
  1350. var lang = require("../lib/lang");
  1351. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1352. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1353. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  1354. var tagMap = lang.createMap({
  1355. a: 'anchor',
  1356. button: 'form',
  1357. form: 'form',
  1358. img: 'image',
  1359. input: 'form',
  1360. label: 'form',
  1361. option: 'form',
  1362. script: 'script',
  1363. select: 'form',
  1364. textarea: 'form',
  1365. style: 'style',
  1366. table: 'table',
  1367. tbody: 'table',
  1368. td: 'table',
  1369. tfoot: 'table',
  1370. th: 'table',
  1371. tr: 'table'
  1372. });
  1373. var HtmlHighlightRules = function () {
  1374. XmlHighlightRules.call(this);
  1375. this.addRules({
  1376. attributes: [{
  1377. include: "tag_whitespace"
  1378. }, {
  1379. token: "entity.other.attribute-name.xml",
  1380. regex: "[-_a-zA-Z0-9:.]+"
  1381. }, {
  1382. token: "keyword.operator.attribute-equals.xml",
  1383. regex: "=",
  1384. push: [{
  1385. include: "tag_whitespace"
  1386. }, {
  1387. token: "string.unquoted.attribute-value.html",
  1388. regex: "[^<>='\"`\\s]+",
  1389. next: "pop"
  1390. }, {
  1391. token: "empty",
  1392. regex: "",
  1393. next: "pop"
  1394. }]
  1395. }, {
  1396. include: "attribute_value"
  1397. }],
  1398. tag: [{
  1399. token: function (start, tag) {
  1400. var group = tagMap[tag];
  1401. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  1402. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  1403. },
  1404. regex: "(</?)([-_a-zA-Z0-9:.]+)",
  1405. next: "tag_stuff"
  1406. }],
  1407. tag_stuff: [
  1408. { include: "attributes" },
  1409. { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start" }
  1410. ]
  1411. });
  1412. this.embedTagRules(CssHighlightRules, "css-", "style");
  1413. this.embedTagRules(new JavaScriptHighlightRules({ jsx: false }).getRules(), "js-", "script");
  1414. if (this.constructor === HtmlHighlightRules)
  1415. this.normalizeRules();
  1416. };
  1417. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  1418. exports.HtmlHighlightRules = HtmlHighlightRules;
  1419. });
  1420. ace.define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module){"use strict";
  1421. var oop = require("../../lib/oop");
  1422. var Behaviour = require("../behaviour").Behaviour;
  1423. var TokenIterator = require("../../token_iterator").TokenIterator;
  1424. var lang = require("../../lib/lang");
  1425. function is(token, type) {
  1426. return token && token.type.lastIndexOf(type + ".xml") > -1;
  1427. }
  1428. var XmlBehaviour = function () {
  1429. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  1430. if (text == '"' || text == "'") {
  1431. var quote = text;
  1432. var selected = session.doc.getTextRange(editor.getSelectionRange());
  1433. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  1434. return {
  1435. text: quote + selected + quote,
  1436. selection: false
  1437. };
  1438. }
  1439. var cursor = editor.getCursorPosition();
  1440. var line = session.doc.getLine(cursor.row);
  1441. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1442. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1443. var token = iterator.getCurrentToken();
  1444. if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
  1445. return {
  1446. text: "",
  1447. selection: [1, 1]
  1448. };
  1449. }
  1450. if (!token)
  1451. token = iterator.stepBackward();
  1452. if (!token)
  1453. return;
  1454. while (is(token, "tag-whitespace") || is(token, "whitespace")) {
  1455. token = iterator.stepBackward();
  1456. }
  1457. var rightSpace = !rightChar || rightChar.match(/\s/);
  1458. if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
  1459. return {
  1460. text: quote + quote,
  1461. selection: [1, 1]
  1462. };
  1463. }
  1464. }
  1465. });
  1466. this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
  1467. var selected = session.doc.getTextRange(range);
  1468. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  1469. var line = session.doc.getLine(range.start.row);
  1470. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  1471. if (rightChar == selected) {
  1472. range.end.column++;
  1473. return range;
  1474. }
  1475. }
  1476. });
  1477. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  1478. if (text == '>') {
  1479. var position = editor.getSelectionRange().start;
  1480. var iterator = new TokenIterator(session, position.row, position.column);
  1481. var token = iterator.getCurrentToken() || iterator.stepBackward();
  1482. if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
  1483. return;
  1484. if (is(token, "reference.attribute-value"))
  1485. return;
  1486. if (is(token, "attribute-value")) {
  1487. var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length;
  1488. if (position.column < tokenEndColumn)
  1489. return;
  1490. if (position.column == tokenEndColumn) {
  1491. var nextToken = iterator.stepForward();
  1492. if (nextToken && is(nextToken, "attribute-value"))
  1493. return;
  1494. iterator.stepBackward();
  1495. }
  1496. }
  1497. if (/^\s*>/.test(session.getLine(position.row).slice(position.column)))
  1498. return;
  1499. while (!is(token, "tag-name")) {
  1500. token = iterator.stepBackward();
  1501. if (token.value == "<") {
  1502. token = iterator.stepForward();
  1503. break;
  1504. }
  1505. }
  1506. var tokenRow = iterator.getCurrentTokenRow();
  1507. var tokenColumn = iterator.getCurrentTokenColumn();
  1508. if (is(iterator.stepBackward(), "end-tag-open"))
  1509. return;
  1510. var element = token.value;
  1511. if (tokenRow == position.row)
  1512. element = element.substring(0, position.column - tokenColumn);
  1513. if (this.voidElements.hasOwnProperty(element.toLowerCase()))
  1514. return;
  1515. return {
  1516. text: ">" + "</" + element + ">",
  1517. selection: [1, 1]
  1518. };
  1519. }
  1520. });
  1521. this.add("autoindent", "insertion", function (state, action, editor, session, text) {
  1522. if (text == "\n") {
  1523. var cursor = editor.getCursorPosition();
  1524. var line = session.getLine(cursor.row);
  1525. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1526. var token = iterator.getCurrentToken();
  1527. if (token && token.type.indexOf("tag-close") !== -1) {
  1528. if (token.value == "/>")
  1529. return;
  1530. while (token && token.type.indexOf("tag-name") === -1) {
  1531. token = iterator.stepBackward();
  1532. }
  1533. if (!token) {
  1534. return;
  1535. }
  1536. var tag = token.value;
  1537. var row = iterator.getCurrentTokenRow();
  1538. token = iterator.stepBackward();
  1539. if (!token || token.type.indexOf("end-tag") !== -1) {
  1540. return;
  1541. }
  1542. if (this.voidElements && !this.voidElements[tag]) {
  1543. var nextToken = session.getTokenAt(cursor.row, cursor.column + 1);
  1544. var line = session.getLine(row);
  1545. var nextIndent = this.$getIndent(line);
  1546. var indent = nextIndent + session.getTabString();
  1547. if (nextToken && nextToken.value === "</") {
  1548. return {
  1549. text: "\n" + indent + "\n" + nextIndent,
  1550. selection: [1, indent.length, 1, indent.length]
  1551. };
  1552. }
  1553. else {
  1554. return {
  1555. text: "\n" + indent
  1556. };
  1557. }
  1558. }
  1559. }
  1560. }
  1561. });
  1562. };
  1563. oop.inherits(XmlBehaviour, Behaviour);
  1564. exports.XmlBehaviour = XmlBehaviour;
  1565. });
  1566. ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
  1567. var oop = require("../../lib/oop");
  1568. var BaseFoldMode = require("./fold_mode").FoldMode;
  1569. var FoldMode = exports.FoldMode = function (defaultMode, subModes) {
  1570. this.defaultMode = defaultMode;
  1571. this.subModes = subModes;
  1572. };
  1573. oop.inherits(FoldMode, BaseFoldMode);
  1574. (function () {
  1575. this.$getMode = function (state) {
  1576. if (typeof state != "string")
  1577. state = state[0];
  1578. for (var key in this.subModes) {
  1579. if (state.indexOf(key) === 0)
  1580. return this.subModes[key];
  1581. }
  1582. return null;
  1583. };
  1584. this.$tryMode = function (state, session, foldStyle, row) {
  1585. var mode = this.$getMode(state);
  1586. return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
  1587. };
  1588. this.getFoldWidget = function (session, foldStyle, row) {
  1589. return (this.$tryMode(session.getState(row - 1), session, foldStyle, row) ||
  1590. this.$tryMode(session.getState(row), session, foldStyle, row) ||
  1591. this.defaultMode.getFoldWidget(session, foldStyle, row));
  1592. };
  1593. this.getFoldWidgetRange = function (session, foldStyle, row) {
  1594. var mode = this.$getMode(session.getState(row - 1));
  1595. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1596. mode = this.$getMode(session.getState(row));
  1597. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1598. mode = this.defaultMode;
  1599. return mode.getFoldWidgetRange(session, foldStyle, row);
  1600. };
  1601. }).call(FoldMode.prototype);
  1602. });
  1603. ace.define("ace/mode/folding/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/range","ace/mode/folding/fold_mode","ace/token_iterator"], function(require, exports, module){"use strict";
  1604. var oop = require("../../lib/oop");
  1605. var lang = require("../../lib/lang");
  1606. var Range = require("../../range").Range;
  1607. var BaseFoldMode = require("./fold_mode").FoldMode;
  1608. var TokenIterator = require("../../token_iterator").TokenIterator;
  1609. var FoldMode = exports.FoldMode = function (voidElements, optionalEndTags) {
  1610. BaseFoldMode.call(this);
  1611. this.voidElements = voidElements || {};
  1612. this.optionalEndTags = oop.mixin({}, this.voidElements);
  1613. if (optionalEndTags)
  1614. oop.mixin(this.optionalEndTags, optionalEndTags);
  1615. };
  1616. oop.inherits(FoldMode, BaseFoldMode);
  1617. var Tag = function () {
  1618. this.tagName = "";
  1619. this.closing = false;
  1620. this.selfClosing = false;
  1621. this.start = { row: 0, column: 0 };
  1622. this.end = { row: 0, column: 0 };
  1623. };
  1624. function is(token, type) {
  1625. return token.type.lastIndexOf(type + ".xml") > -1;
  1626. }
  1627. (function () {
  1628. this.getFoldWidget = function (session, foldStyle, row) {
  1629. var tag = this._getFirstTagInLine(session, row);
  1630. if (!tag)
  1631. return this.getCommentFoldWidget(session, row);
  1632. if (tag.closing || (!tag.tagName && tag.selfClosing))
  1633. return foldStyle == "markbeginend" ? "end" : "";
  1634. if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
  1635. return "";
  1636. if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
  1637. return "";
  1638. return "start";
  1639. };
  1640. this.getCommentFoldWidget = function (session, row) {
  1641. if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
  1642. return "start";
  1643. return "";
  1644. };
  1645. this._getFirstTagInLine = function (session, row) {
  1646. var tokens = session.getTokens(row);
  1647. var tag = new Tag();
  1648. for (var i = 0; i < tokens.length; i++) {
  1649. var token = tokens[i];
  1650. if (is(token, "tag-open")) {
  1651. tag.end.column = tag.start.column + token.value.length;
  1652. tag.closing = is(token, "end-tag-open");
  1653. token = tokens[++i];
  1654. if (!token)
  1655. return null;
  1656. tag.tagName = token.value;
  1657. tag.end.column += token.value.length;
  1658. for (i++; i < tokens.length; i++) {
  1659. token = tokens[i];
  1660. tag.end.column += token.value.length;
  1661. if (is(token, "tag-close")) {
  1662. tag.selfClosing = token.value == '/>';
  1663. break;
  1664. }
  1665. }
  1666. return tag;
  1667. }
  1668. else if (is(token, "tag-close")) {
  1669. tag.selfClosing = token.value == '/>';
  1670. return tag;
  1671. }
  1672. tag.start.column += token.value.length;
  1673. }
  1674. return null;
  1675. };
  1676. this._findEndTagInLine = function (session, row, tagName, startColumn) {
  1677. var tokens = session.getTokens(row);
  1678. var column = 0;
  1679. for (var i = 0; i < tokens.length; i++) {
  1680. var token = tokens[i];
  1681. column += token.value.length;
  1682. if (column < startColumn)
  1683. continue;
  1684. if (is(token, "end-tag-open")) {
  1685. token = tokens[i + 1];
  1686. if (token && token.value == tagName)
  1687. return true;
  1688. }
  1689. }
  1690. return false;
  1691. };
  1692. this._readTagForward = function (iterator) {
  1693. var token = iterator.getCurrentToken();
  1694. if (!token)
  1695. return null;
  1696. var tag = new Tag();
  1697. do {
  1698. if (is(token, "tag-open")) {
  1699. tag.closing = is(token, "end-tag-open");
  1700. tag.start.row = iterator.getCurrentTokenRow();
  1701. tag.start.column = iterator.getCurrentTokenColumn();
  1702. }
  1703. else if (is(token, "tag-name")) {
  1704. tag.tagName = token.value;
  1705. }
  1706. else if (is(token, "tag-close")) {
  1707. tag.selfClosing = token.value == "/>";
  1708. tag.end.row = iterator.getCurrentTokenRow();
  1709. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1710. iterator.stepForward();
  1711. return tag;
  1712. }
  1713. } while (token = iterator.stepForward());
  1714. return null;
  1715. };
  1716. this._readTagBackward = function (iterator) {
  1717. var token = iterator.getCurrentToken();
  1718. if (!token)
  1719. return null;
  1720. var tag = new Tag();
  1721. do {
  1722. if (is(token, "tag-open")) {
  1723. tag.closing = is(token, "end-tag-open");
  1724. tag.start.row = iterator.getCurrentTokenRow();
  1725. tag.start.column = iterator.getCurrentTokenColumn();
  1726. iterator.stepBackward();
  1727. return tag;
  1728. }
  1729. else if (is(token, "tag-name")) {
  1730. tag.tagName = token.value;
  1731. }
  1732. else if (is(token, "tag-close")) {
  1733. tag.selfClosing = token.value == "/>";
  1734. tag.end.row = iterator.getCurrentTokenRow();
  1735. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1736. }
  1737. } while (token = iterator.stepBackward());
  1738. return null;
  1739. };
  1740. this._pop = function (stack, tag) {
  1741. while (stack.length) {
  1742. var top = stack[stack.length - 1];
  1743. if (!tag || top.tagName == tag.tagName) {
  1744. return stack.pop();
  1745. }
  1746. else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
  1747. stack.pop();
  1748. continue;
  1749. }
  1750. else {
  1751. return null;
  1752. }
  1753. }
  1754. };
  1755. this.getFoldWidgetRange = function (session, foldStyle, row) {
  1756. var firstTag = this._getFirstTagInLine(session, row);
  1757. if (!firstTag) {
  1758. return this.getCommentFoldWidget(session, row)
  1759. && session.getCommentFoldRange(row, session.getLine(row).length);
  1760. }
  1761. var isBackward = firstTag.closing || firstTag.selfClosing;
  1762. var stack = [];
  1763. var tag;
  1764. if (!isBackward) {
  1765. var iterator = new TokenIterator(session, row, firstTag.start.column);
  1766. var start = {
  1767. row: row,
  1768. column: firstTag.start.column + firstTag.tagName.length + 2
  1769. };
  1770. if (firstTag.start.row == firstTag.end.row)
  1771. start.column = firstTag.end.column;
  1772. while (tag = this._readTagForward(iterator)) {
  1773. if (tag.selfClosing) {
  1774. if (!stack.length) {
  1775. tag.start.column += tag.tagName.length + 2;
  1776. tag.end.column -= 2;
  1777. return Range.fromPoints(tag.start, tag.end);
  1778. }
  1779. else
  1780. continue;
  1781. }
  1782. if (tag.closing) {
  1783. this._pop(stack, tag);
  1784. if (stack.length == 0)
  1785. return Range.fromPoints(start, tag.start);
  1786. }
  1787. else {
  1788. stack.push(tag);
  1789. }
  1790. }
  1791. }
  1792. else {
  1793. var iterator = new TokenIterator(session, row, firstTag.end.column);
  1794. var end = {
  1795. row: row,
  1796. column: firstTag.start.column
  1797. };
  1798. while (tag = this._readTagBackward(iterator)) {
  1799. if (tag.selfClosing) {
  1800. if (!stack.length) {
  1801. tag.start.column += tag.tagName.length + 2;
  1802. tag.end.column -= 2;
  1803. return Range.fromPoints(tag.start, tag.end);
  1804. }
  1805. else
  1806. continue;
  1807. }
  1808. if (!tag.closing) {
  1809. this._pop(stack, tag);
  1810. if (stack.length == 0) {
  1811. tag.start.column += tag.tagName.length + 2;
  1812. if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
  1813. tag.start.column = tag.end.column;
  1814. return Range.fromPoints(tag.start, end);
  1815. }
  1816. }
  1817. else {
  1818. stack.push(tag);
  1819. }
  1820. }
  1821. }
  1822. };
  1823. }).call(FoldMode.prototype);
  1824. });
  1825. ace.define("ace/mode/folding/html",["require","exports","module","ace/lib/oop","ace/mode/folding/mixed","ace/mode/folding/xml","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
  1826. var oop = require("../../lib/oop");
  1827. var MixedFoldMode = require("./mixed").FoldMode;
  1828. var XmlFoldMode = require("./xml").FoldMode;
  1829. var CStyleFoldMode = require("./cstyle").FoldMode;
  1830. var FoldMode = exports.FoldMode = function (voidElements, optionalTags) {
  1831. MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
  1832. "js-": new CStyleFoldMode(),
  1833. "css-": new CStyleFoldMode()
  1834. });
  1835. };
  1836. oop.inherits(FoldMode, MixedFoldMode);
  1837. });
  1838. ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module){"use strict";
  1839. var TokenIterator = require("../token_iterator").TokenIterator;
  1840. var commonAttributes = [
  1841. "accesskey",
  1842. "class",
  1843. "contenteditable",
  1844. "contextmenu",
  1845. "dir",
  1846. "draggable",
  1847. "dropzone",
  1848. "hidden",
  1849. "id",
  1850. "inert",
  1851. "itemid",
  1852. "itemprop",
  1853. "itemref",
  1854. "itemscope",
  1855. "itemtype",
  1856. "lang",
  1857. "spellcheck",
  1858. "style",
  1859. "tabindex",
  1860. "title",
  1861. "translate"
  1862. ];
  1863. var eventAttributes = [
  1864. "onabort",
  1865. "onblur",
  1866. "oncancel",
  1867. "oncanplay",
  1868. "oncanplaythrough",
  1869. "onchange",
  1870. "onclick",
  1871. "onclose",
  1872. "oncontextmenu",
  1873. "oncuechange",
  1874. "ondblclick",
  1875. "ondrag",
  1876. "ondragend",
  1877. "ondragenter",
  1878. "ondragleave",
  1879. "ondragover",
  1880. "ondragstart",
  1881. "ondrop",
  1882. "ondurationchange",
  1883. "onemptied",
  1884. "onended",
  1885. "onerror",
  1886. "onfocus",
  1887. "oninput",
  1888. "oninvalid",
  1889. "onkeydown",
  1890. "onkeypress",
  1891. "onkeyup",
  1892. "onload",
  1893. "onloadeddata",
  1894. "onloadedmetadata",
  1895. "onloadstart",
  1896. "onmousedown",
  1897. "onmousemove",
  1898. "onmouseout",
  1899. "onmouseover",
  1900. "onmouseup",
  1901. "onmousewheel",
  1902. "onpause",
  1903. "onplay",
  1904. "onplaying",
  1905. "onprogress",
  1906. "onratechange",
  1907. "onreset",
  1908. "onscroll",
  1909. "onseeked",
  1910. "onseeking",
  1911. "onselect",
  1912. "onshow",
  1913. "onstalled",
  1914. "onsubmit",
  1915. "onsuspend",
  1916. "ontimeupdate",
  1917. "onvolumechange",
  1918. "onwaiting"
  1919. ];
  1920. var globalAttributes = commonAttributes.concat(eventAttributes);
  1921. var attributeMap = {
  1922. "a": { "href": 1, "target": { "_blank": 1, "top": 1 }, "ping": 1, "rel": { "nofollow": 1, "alternate": 1, "author": 1, "bookmark": 1, "help": 1, "license": 1, "next": 1, "noreferrer": 1, "prefetch": 1, "prev": 1, "search": 1, "tag": 1 }, "media": 1, "hreflang": 1, "type": 1 },
  1923. "abbr": {},
  1924. "address": {},
  1925. "area": { "shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1 },
  1926. "article": { "pubdate": 1 },
  1927. "aside": {},
  1928. "audio": { "src": 1, "autobuffer": 1, "autoplay": { "autoplay": 1 }, "loop": { "loop": 1 }, "controls": { "controls": 1 }, "muted": { "muted": 1 }, "preload": { "auto": 1, "metadata": 1, "none": 1 } },
  1929. "b": {},
  1930. "base": { "href": 1, "target": 1 },
  1931. "bdi": {},
  1932. "bdo": {},
  1933. "blockquote": { "cite": 1 },
  1934. "body": { "onafterprint": 1, "onbeforeprint": 1, "onbeforeunload": 1, "onhashchange": 1, "onmessage": 1, "onoffline": 1, "onpopstate": 1, "onredo": 1, "onresize": 1, "onstorage": 1, "onundo": 1, "onunload": 1 },
  1935. "br": {},
  1936. "button": { "autofocus": 1, "disabled": { "disabled": 1 }, "form": 1, "formaction": 1, "formenctype": 1, "formmethod": 1, "formnovalidate": 1, "formtarget": 1, "name": 1, "value": 1, "type": { "button": 1, "submit": 1 } },
  1937. "canvas": { "width": 1, "height": 1 },
  1938. "caption": {},
  1939. "cite": {},
  1940. "code": {},
  1941. "col": { "span": 1 },
  1942. "colgroup": { "span": 1 },
  1943. "command": { "type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1 },
  1944. "data": {},
  1945. "datalist": {},
  1946. "dd": {},
  1947. "del": { "cite": 1, "datetime": 1 },
  1948. "details": { "open": 1 },
  1949. "dfn": {},
  1950. "dialog": { "open": 1 },
  1951. "div": {},
  1952. "dl": {},
  1953. "dt": {},
  1954. "em": {},
  1955. "embed": { "src": 1, "height": 1, "width": 1, "type": 1 },
  1956. "fieldset": { "disabled": 1, "form": 1, "name": 1 },
  1957. "figcaption": {},
  1958. "figure": {},
  1959. "footer": {},
  1960. "form": { "accept-charset": 1, "action": 1, "autocomplete": 1, "enctype": { "multipart/form-data": 1, "application/x-www-form-urlencoded": 1 }, "method": { "get": 1, "post": 1 }, "name": 1, "novalidate": 1, "target": { "_blank": 1, "top": 1 } },
  1961. "h1": {},
  1962. "h2": {},
  1963. "h3": {},
  1964. "h4": {},
  1965. "h5": {},
  1966. "h6": {},
  1967. "head": {},
  1968. "header": {},
  1969. "hr": {},
  1970. "html": { "manifest": 1 },
  1971. "i": {},
  1972. "iframe": { "name": 1, "src": 1, "height": 1, "width": 1, "sandbox": { "allow-same-origin": 1, "allow-top-navigation": 1, "allow-forms": 1, "allow-scripts": 1 }, "seamless": { "seamless": 1 } },
  1973. "img": { "alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1 },
  1974. "input": {
  1975. "type": { "text": 1, "password": 1, "hidden": 1, "checkbox": 1, "submit": 1, "radio": 1, "file": 1, "button": 1, "reset": 1, "image": 31, "color": 1, "date": 1, "datetime": 1, "datetime-local": 1, "email": 1, "month": 1, "number": 1, "range": 1, "search": 1, "tel": 1, "time": 1, "url": 1, "week": 1 },
  1976. "accept": 1, "alt": 1, "autocomplete": { "on": 1, "off": 1 }, "autofocus": { "autofocus": 1 }, "checked": { "checked": 1 }, "disabled": { "disabled": 1 }, "form": 1, "formaction": 1, "formenctype": { "application/x-www-form-urlencoded": 1, "multipart/form-data": 1, "text/plain": 1 }, "formmethod": { "get": 1, "post": 1 }, "formnovalidate": { "formnovalidate": 1 }, "formtarget": { "_blank": 1, "_self": 1, "_parent": 1, "_top": 1 }, "height": 1, "list": 1, "max": 1, "maxlength": 1, "min": 1, "multiple": { "multiple": 1 }, "name": 1, "pattern": 1, "placeholder": 1, "readonly": { "readonly": 1 }, "required": { "required": 1 }, "size": 1, "src": 1, "step": 1, "width": 1, "files": 1, "value": 1
  1977. },
  1978. "ins": { "cite": 1, "datetime": 1 },
  1979. "kbd": {},
  1980. "keygen": { "autofocus": 1, "challenge": { "challenge": 1 }, "disabled": { "disabled": 1 }, "form": 1, "keytype": { "rsa": 1, "dsa": 1, "ec": 1 }, "name": 1 },
  1981. "label": { "form": 1, "for": 1 },
  1982. "legend": {},
  1983. "li": { "value": 1 },
  1984. "link": { "href": 1, "hreflang": 1, "rel": { "stylesheet": 1, "icon": 1 }, "media": { "all": 1, "screen": 1, "print": 1 }, "type": { "text/css": 1, "image/png": 1, "image/jpeg": 1, "image/gif": 1 }, "sizes": 1 },
  1985. "main": {},
  1986. "map": { "name": 1 },
  1987. "mark": {},
  1988. "math": {},
  1989. "menu": { "type": 1, "label": 1 },
  1990. "meta": { "http-equiv": { "content-type": 1 }, "name": { "description": 1, "keywords": 1 }, "content": { "text/html; charset=UTF-8": 1 }, "charset": 1 },
  1991. "meter": { "value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1 },
  1992. "nav": {},
  1993. "noscript": { "href": 1 },
  1994. "object": { "param": 1, "data": 1, "type": 1, "height": 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1 },
  1995. "ol": { "start": 1, "reversed": 1 },
  1996. "optgroup": { "disabled": 1, "label": 1 },
  1997. "option": { "disabled": 1, "selected": 1, "label": 1, "value": 1 },
  1998. "output": { "for": 1, "form": 1, "name": 1 },
  1999. "p": {},
  2000. "param": { "name": 1, "value": 1 },
  2001. "pre": {},
  2002. "progress": { "value": 1, "max": 1 },
  2003. "q": { "cite": 1 },
  2004. "rp": {},
  2005. "rt": {},
  2006. "ruby": {},
  2007. "s": {},
  2008. "samp": {},
  2009. "script": { "charset": 1, "type": { "text/javascript": 1 }, "src": 1, "defer": 1, "async": 1 },
  2010. "select": { "autofocus": 1, "disabled": 1, "form": 1, "multiple": { "multiple": 1 }, "name": 1, "size": 1, "readonly": { "readonly": 1 } },
  2011. "small": {},
  2012. "source": { "src": 1, "type": 1, "media": 1 },
  2013. "span": {},
  2014. "strong": {},
  2015. "style": { "type": 1, "media": { "all": 1, "screen": 1, "print": 1 }, "scoped": 1 },
  2016. "sub": {},
  2017. "sup": {},
  2018. "svg": {},
  2019. "table": { "summary": 1 },
  2020. "tbody": {},
  2021. "td": { "headers": 1, "rowspan": 1, "colspan": 1 },
  2022. "textarea": { "autofocus": { "autofocus": 1 }, "disabled": { "disabled": 1 }, "form": 1, "maxlength": 1, "name": 1, "placeholder": 1, "readonly": { "readonly": 1 }, "required": { "required": 1 }, "rows": 1, "cols": 1, "wrap": { "on": 1, "off": 1, "hard": 1, "soft": 1 } },
  2023. "tfoot": {},
  2024. "th": { "headers": 1, "rowspan": 1, "colspan": 1, "scope": 1 },
  2025. "thead": {},
  2026. "time": { "datetime": 1 },
  2027. "title": {},
  2028. "tr": {},
  2029. "track": { "kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1 },
  2030. "section": {},
  2031. "summary": {},
  2032. "u": {},
  2033. "ul": {},
  2034. "var": {},
  2035. "video": { "src": 1, "autobuffer": 1, "autoplay": { "autoplay": 1 }, "loop": { "loop": 1 }, "controls": { "controls": 1 }, "width": 1, "height": 1, "poster": 1, "muted": { "muted": 1 }, "preload": { "auto": 1, "metadata": 1, "none": 1 } },
  2036. "wbr": {}
  2037. };
  2038. var elements = Object.keys(attributeMap);
  2039. function is(token, type) {
  2040. return token.type.lastIndexOf(type + ".xml") > -1;
  2041. }
  2042. function findTagName(session, pos) {
  2043. var iterator = new TokenIterator(session, pos.row, pos.column);
  2044. var token = iterator.getCurrentToken();
  2045. while (token && !is(token, "tag-name")) {
  2046. token = iterator.stepBackward();
  2047. }
  2048. if (token)
  2049. return token.value;
  2050. }
  2051. function findAttributeName(session, pos) {
  2052. var iterator = new TokenIterator(session, pos.row, pos.column);
  2053. var token = iterator.getCurrentToken();
  2054. while (token && !is(token, "attribute-name")) {
  2055. token = iterator.stepBackward();
  2056. }
  2057. if (token)
  2058. return token.value;
  2059. }
  2060. var HtmlCompletions = function () {
  2061. };
  2062. (function () {
  2063. this.getCompletions = function (state, session, pos, prefix) {
  2064. var token = session.getTokenAt(pos.row, pos.column);
  2065. if (!token)
  2066. return [];
  2067. if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
  2068. return this.getTagCompletions(state, session, pos, prefix);
  2069. if (is(token, "tag-whitespace") || is(token, "attribute-name"))
  2070. return this.getAttributeCompletions(state, session, pos, prefix);
  2071. if (is(token, "attribute-value"))
  2072. return this.getAttributeValueCompletions(state, session, pos, prefix);
  2073. var line = session.getLine(pos.row).substr(0, pos.column);
  2074. if (/&[a-z]*$/i.test(line))
  2075. return this.getHTMLEntityCompletions(state, session, pos, prefix);
  2076. return [];
  2077. };
  2078. this.getTagCompletions = function (state, session, pos, prefix) {
  2079. return elements.map(function (element) {
  2080. return {
  2081. value: element,
  2082. meta: "tag",
  2083. score: 1000000
  2084. };
  2085. });
  2086. };
  2087. this.getAttributeCompletions = function (state, session, pos, prefix) {
  2088. var tagName = findTagName(session, pos);
  2089. if (!tagName)
  2090. return [];
  2091. var attributes = globalAttributes;
  2092. if (tagName in attributeMap) {
  2093. attributes = attributes.concat(Object.keys(attributeMap[tagName]));
  2094. }
  2095. return attributes.map(function (attribute) {
  2096. return {
  2097. caption: attribute,
  2098. snippet: attribute + '="$0"',
  2099. meta: "attribute",
  2100. score: 1000000
  2101. };
  2102. });
  2103. };
  2104. this.getAttributeValueCompletions = function (state, session, pos, prefix) {
  2105. var tagName = findTagName(session, pos);
  2106. var attributeName = findAttributeName(session, pos);
  2107. if (!tagName)
  2108. return [];
  2109. var values = [];
  2110. if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
  2111. values = Object.keys(attributeMap[tagName][attributeName]);
  2112. }
  2113. return values.map(function (value) {
  2114. return {
  2115. caption: value,
  2116. snippet: value,
  2117. meta: "attribute value",
  2118. score: 1000000
  2119. };
  2120. });
  2121. };
  2122. this.getHTMLEntityCompletions = function (state, session, pos, prefix) {
  2123. var values = ['Aacute;', 'aacute;', 'Acirc;', 'acirc;', 'acute;', 'AElig;', 'aelig;', 'Agrave;', 'agrave;', 'alefsym;', 'Alpha;', 'alpha;', 'amp;', 'and;', 'ang;', 'Aring;', 'aring;', 'asymp;', 'Atilde;', 'atilde;', 'Auml;', 'auml;', 'bdquo;', 'Beta;', 'beta;', 'brvbar;', 'bull;', 'cap;', 'Ccedil;', 'ccedil;', 'cedil;', 'cent;', 'Chi;', 'chi;', 'circ;', 'clubs;', 'cong;', 'copy;', 'crarr;', 'cup;', 'curren;', 'Dagger;', 'dagger;', 'dArr;', 'darr;', 'deg;', 'Delta;', 'delta;', 'diams;', 'divide;', 'Eacute;', 'eacute;', 'Ecirc;', 'ecirc;', 'Egrave;', 'egrave;', 'empty;', 'emsp;', 'ensp;', 'Epsilon;', 'epsilon;', 'equiv;', 'Eta;', 'eta;', 'ETH;', 'eth;', 'Euml;', 'euml;', 'euro;', 'exist;', 'fnof;', 'forall;', 'frac12;', 'frac14;', 'frac34;', 'frasl;', 'Gamma;', 'gamma;', 'ge;', 'gt;', 'hArr;', 'harr;', 'hearts;', 'hellip;', 'Iacute;', 'iacute;', 'Icirc;', 'icirc;', 'iexcl;', 'Igrave;', 'igrave;', 'image;', 'infin;', 'int;', 'Iota;', 'iota;', 'iquest;', 'isin;', 'Iuml;', 'iuml;', 'Kappa;', 'kappa;', 'Lambda;', 'lambda;', 'lang;', 'laquo;', 'lArr;', 'larr;', 'lceil;', 'ldquo;', 'le;', 'lfloor;', 'lowast;', 'loz;', 'lrm;', 'lsaquo;', 'lsquo;', 'lt;', 'macr;', 'mdash;', 'micro;', 'middot;', 'minus;', 'Mu;', 'mu;', 'nabla;', 'nbsp;', 'ndash;', 'ne;', 'ni;', 'not;', 'notin;', 'nsub;', 'Ntilde;', 'ntilde;', 'Nu;', 'nu;', 'Oacute;', 'oacute;', 'Ocirc;', 'ocirc;', 'OElig;', 'oelig;', 'Ograve;', 'ograve;', 'oline;', 'Omega;', 'omega;', 'Omicron;', 'omicron;', 'oplus;', 'or;', 'ordf;', 'ordm;', 'Oslash;', 'oslash;', 'Otilde;', 'otilde;', 'otimes;', 'Ouml;', 'ouml;', 'para;', 'part;', 'permil;', 'perp;', 'Phi;', 'phi;', 'Pi;', 'pi;', 'piv;', 'plusmn;', 'pound;', 'Prime;', 'prime;', 'prod;', 'prop;', 'Psi;', 'psi;', 'quot;', 'radic;', 'rang;', 'raquo;', 'rArr;', 'rarr;', 'rceil;', 'rdquo;', 'real;', 'reg;', 'rfloor;', 'Rho;', 'rho;', 'rlm;', 'rsaquo;', 'rsquo;', 'sbquo;', 'Scaron;', 'scaron;', 'sdot;', 'sect;', 'shy;', 'Sigma;', 'sigma;', 'sigmaf;', 'sim;', 'spades;', 'sub;', 'sube;', 'sum;', 'sup;', 'sup1;', 'sup2;', 'sup3;', 'supe;', 'szlig;', 'Tau;', 'tau;', 'there4;', 'Theta;', 'theta;', 'thetasym;', 'thinsp;', 'THORN;', 'thorn;', 'tilde;', 'times;', 'trade;', 'Uacute;', 'uacute;', 'uArr;', 'uarr;', 'Ucirc;', 'ucirc;', 'Ugrave;', 'ugrave;', 'uml;', 'upsih;', 'Upsilon;', 'upsilon;', 'Uuml;', 'uuml;', 'weierp;', 'Xi;', 'xi;', 'Yacute;', 'yacute;', 'yen;', 'Yuml;', 'yuml;', 'Zeta;', 'zeta;', 'zwj;', 'zwnj;'];
  2124. return values.map(function (value) {
  2125. return {
  2126. caption: value,
  2127. snippet: value,
  2128. meta: "html entity",
  2129. score: 1000000
  2130. };
  2131. });
  2132. };
  2133. }).call(HtmlCompletions.prototype);
  2134. exports.HtmlCompletions = HtmlCompletions;
  2135. });
  2136. ace.define("ace/mode/html",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/javascript","ace/mode/css","ace/mode/html_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/html","ace/mode/html_completions","ace/worker/worker_client"], function(require, exports, module){"use strict";
  2137. var oop = require("../lib/oop");
  2138. var lang = require("../lib/lang");
  2139. var TextMode = require("./text").Mode;
  2140. var JavaScriptMode = require("./javascript").Mode;
  2141. var CssMode = require("./css").Mode;
  2142. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2143. var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
  2144. var HtmlFoldMode = require("./folding/html").FoldMode;
  2145. var HtmlCompletions = require("./html_completions").HtmlCompletions;
  2146. var WorkerClient = require("../worker/worker_client").WorkerClient;
  2147. var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
  2148. var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
  2149. var Mode = function (options) {
  2150. this.fragmentContext = options && options.fragmentContext;
  2151. this.HighlightRules = HtmlHighlightRules;
  2152. this.$behaviour = new XmlBehaviour();
  2153. this.$completer = new HtmlCompletions();
  2154. this.createModeDelegates({
  2155. "js-": JavaScriptMode,
  2156. "css-": CssMode
  2157. });
  2158. this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
  2159. };
  2160. oop.inherits(Mode, TextMode);
  2161. (function () {
  2162. this.blockComment = { start: "<!--", end: "-->" };
  2163. this.voidElements = lang.arrayToMap(voidElements);
  2164. this.getNextLineIndent = function (state, line, tab) {
  2165. return this.$getIndent(line);
  2166. };
  2167. this.checkOutdent = function (state, line, input) {
  2168. return false;
  2169. };
  2170. this.getCompletions = function (state, session, pos, prefix) {
  2171. return this.$completer.getCompletions(state, session, pos, prefix);
  2172. };
  2173. this.createWorker = function (session) {
  2174. if (this.constructor != Mode)
  2175. return;
  2176. var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
  2177. worker.attachToDocument(session.getDocument());
  2178. if (this.fragmentContext)
  2179. worker.call("setOptions", [{ context: this.fragmentContext }]);
  2180. worker.on("error", function (e) {
  2181. session.setAnnotations(e.data);
  2182. });
  2183. worker.on("terminate", function () {
  2184. session.clearAnnotations();
  2185. });
  2186. return worker;
  2187. };
  2188. this.$id = "ace/mode/html";
  2189. this.snippetFileId = "ace/snippets/html";
  2190. }).call(Mode.prototype);
  2191. exports.Mode = Mode;
  2192. });
  2193. ace.define("ace/mode/nunjucks_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules","ace/mode/html_highlight_rules"], function(require, exports, module){"use strict";
  2194. var oop = require("../lib/oop");
  2195. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  2196. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2197. var NunjucksHighlightRules = function () {
  2198. HtmlHighlightRules.call(this);
  2199. this.$rules["start"].unshift({
  2200. token: "punctuation.begin",
  2201. regex: /{{-?/,
  2202. push: [{
  2203. token: "punctuation.end",
  2204. regex: /-?}}/,
  2205. next: "pop"
  2206. },
  2207. { include: "expression" }
  2208. ]
  2209. }, {
  2210. token: "punctuation.begin",
  2211. regex: /{%-?/,
  2212. push: [{
  2213. token: "punctuation.end",
  2214. regex: /-?%}/,
  2215. next: "pop"
  2216. }, {
  2217. token: "constant.language.escape",
  2218. regex: /\b(r\/.*\/[gimy]?)\b/
  2219. },
  2220. { include: "statement" }
  2221. ]
  2222. }, {
  2223. token: "comment.begin",
  2224. regex: /{#/,
  2225. push: [{
  2226. token: "comment.end",
  2227. regex: /#}/,
  2228. next: "pop"
  2229. },
  2230. { defaultToken: "comment" }
  2231. ]
  2232. });
  2233. this.addRules({
  2234. attribute_value: [{
  2235. token: "string.attribute-value.xml",
  2236. regex: "'",
  2237. push: [
  2238. { token: "string.attribute-value.xml", regex: "'", next: "pop" },
  2239. {
  2240. token: "punctuation.begin",
  2241. regex: /{{-?/,
  2242. push: [{
  2243. token: "punctuation.end",
  2244. regex: /-?}}/,
  2245. next: "pop"
  2246. },
  2247. { include: "expression" }
  2248. ]
  2249. },
  2250. { include: "attr_reference" },
  2251. { defaultToken: "string.attribute-value.xml" }
  2252. ]
  2253. }, {
  2254. token: "string.attribute-value.xml",
  2255. regex: '"',
  2256. push: [
  2257. { token: "string.attribute-value.xml", regex: '"', next: "pop" },
  2258. {
  2259. token: "punctuation.begin",
  2260. regex: /{{-?/,
  2261. push: [{
  2262. token: "punctuation.end",
  2263. regex: /-?}}/,
  2264. next: "pop"
  2265. },
  2266. { include: "expression" }
  2267. ]
  2268. },
  2269. { include: "attr_reference" },
  2270. { defaultToken: "string.attribute-value.xml" }
  2271. ]
  2272. }],
  2273. "statement": [{
  2274. token: "keyword.control",
  2275. regex: /\b(block|endblock|extends|endif|elif|for|endfor|asyncEach|endeach|include|asyncAll|endall|macro|endmacro|set|endset|ignore missing|as|from|raw|verbatim|filter|endfilter)\b/
  2276. },
  2277. { include: "expression" }
  2278. ],
  2279. "expression": [{
  2280. token: "constant.language",
  2281. regex: /\b(true|false|none)\b/
  2282. }, {
  2283. token: "string",
  2284. regex: /"/,
  2285. push: [{
  2286. token: "string",
  2287. regex: /"/,
  2288. next: "pop"
  2289. },
  2290. { include: "escapeStrings" },
  2291. { defaultToken: "string" }
  2292. ]
  2293. }, {
  2294. token: "string",
  2295. regex: /'/,
  2296. push: [{
  2297. token: "string",
  2298. regex: /'/,
  2299. next: "pop"
  2300. },
  2301. { include: "escapeStrings" },
  2302. { defaultToken: "string" }
  2303. ]
  2304. }, {
  2305. token: "constant.numeric",
  2306. regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
  2307. }, {
  2308. token: "constant.numeric",
  2309. regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
  2310. }, {
  2311. token: "keyword.operator",
  2312. regex: /\+|-|\/\/|\/|%|\*\*|\*|===|==|!==|!=|>=|>|<=|</
  2313. }, {
  2314. token: "keyword.control",
  2315. regex: /\b(and|else|if|in|import|not|or)\b/
  2316. }, {
  2317. token: "support.function",
  2318. regex: /[a-zA-Z_]+(?=\()/
  2319. }, {
  2320. token: "paren.lpar",
  2321. regex: /[(\[{]/
  2322. }, {
  2323. token: "paren.rpar",
  2324. regex: /[)\]}]/
  2325. }, {
  2326. token: "punctuation",
  2327. regex: /[,]/
  2328. }, {
  2329. token: ["punctuation", "support.function"],
  2330. regex: /(\.)([a-zA-Z_][a-zA-Z0-9_]*)(?=\()/
  2331. }, {
  2332. token: ["punctuation", "variable.parameter"],
  2333. regex: /(\.)([a-zA-Z_][a-zA-Z0-9_]*)/
  2334. }, {
  2335. token: ["punctuation", "text", "support.other"],
  2336. regex: /(\|)(\s)*([a-zA-Z_][a-zA-Z0-9_]*)/
  2337. }, {
  2338. token: "variable",
  2339. regex: /[a-zA-Z_][a-zA-Z0-9_]*/
  2340. }
  2341. ],
  2342. "escapeStrings": [{
  2343. token: "constant.language.escape",
  2344. regex: /(\\\\n)|(\\\\)|(\\")|(\\')|(\\a)|(\\b)|(\\f)|(\\n)|(\\r)|(\\t)|(\\v)/
  2345. }, {
  2346. token: "constant.language.escape",
  2347. regex: /\\(?:x[0-9A-F]{2}|(?:U[0-9A-Fa-f]{8})|(?:u[0-9A-Fa-f]{4})|(?:N{[a-zA-Z ]+}))/
  2348. }]
  2349. });
  2350. this.normalizeRules();
  2351. };
  2352. oop.inherits(NunjucksHighlightRules, TextHighlightRules);
  2353. exports.NunjucksHighlightRules = NunjucksHighlightRules;
  2354. });
  2355. ace.define("ace/mode/nunjucks",["require","exports","module","ace/lib/oop","ace/mode/html","ace/mode/nunjucks_highlight_rules"], function(require, exports, module){"use strict";
  2356. var oop = require("../lib/oop");
  2357. var HtmlMode = require("./html").Mode;
  2358. var NunjucksHighlightRules = require("./nunjucks_highlight_rules").NunjucksHighlightRules;
  2359. var Mode = function () {
  2360. this.HighlightRules = NunjucksHighlightRules;
  2361. };
  2362. oop.inherits(Mode, HtmlMode);
  2363. (function () {
  2364. this.$id = "ace/mode/nunjucks";
  2365. }).call(Mode.prototype);
  2366. exports.Mode = Mode;
  2367. }); (function() {
  2368. ace.require(["ace/mode/nunjucks"], function(m) {
  2369. if (typeof module == "object" && typeof exports == "object" && module) {
  2370. module.exports = m;
  2371. }
  2372. });
  2373. })();