810c101030cecc8521f8651fbb7d6bce.js 109 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473
  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/velocity_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/html_highlight_rules"], function(require, exports, module){"use strict";
  2194. var oop = require("../lib/oop");
  2195. var lang = require("../lib/lang");
  2196. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  2197. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2198. var VelocityHighlightRules = function () {
  2199. HtmlHighlightRules.call(this);
  2200. var builtinConstants = lang.arrayToMap(('true|false|null').split('|'));
  2201. var builtinFunctions = lang.arrayToMap(("_DateTool|_DisplayTool|_EscapeTool|_FieldTool|_MathTool|_NumberTool|_SerializerTool|_SortTool|_StringTool|_XPathTool").split('|'));
  2202. var builtinVariables = lang.arrayToMap(('$contentRoot|$foreach').split('|'));
  2203. var keywords = lang.arrayToMap(("#set|#macro|#include|#parse|" +
  2204. "#if|#elseif|#else|#foreach|" +
  2205. "#break|#end|#stop").split('|'));
  2206. this.$rules.start.push({
  2207. token: "comment",
  2208. regex: "##.*$"
  2209. }, {
  2210. token: "comment.block",
  2211. regex: "#\\*",
  2212. next: "vm_comment"
  2213. }, {
  2214. token: "string.regexp",
  2215. regex: "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
  2216. }, {
  2217. token: "string",
  2218. regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  2219. }, {
  2220. token: "string",
  2221. regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  2222. }, {
  2223. token: "constant.numeric",
  2224. regex: "0[xX][0-9a-fA-F]+\\b"
  2225. }, {
  2226. token: "constant.numeric",
  2227. regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
  2228. }, {
  2229. token: "constant.language.boolean",
  2230. regex: "(?:true|false)\\b"
  2231. }, {
  2232. token: function (value) {
  2233. if (keywords.hasOwnProperty(value))
  2234. return "keyword";
  2235. else if (builtinConstants.hasOwnProperty(value))
  2236. return "constant.language";
  2237. else if (builtinVariables.hasOwnProperty(value))
  2238. return "variable.language";
  2239. else if (builtinFunctions.hasOwnProperty(value) || builtinFunctions.hasOwnProperty(value.substring(1)))
  2240. return "support.function";
  2241. else if (value == "debugger")
  2242. return "invalid.deprecated";
  2243. else if (value.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*)$/))
  2244. return "variable";
  2245. return "identifier";
  2246. },
  2247. regex: "[a-zA-Z$#][a-zA-Z0-9_]*\\b"
  2248. }, {
  2249. token: "keyword.operator",
  2250. regex: "!|&|\\*|\\-|\\+|=|!=|<=|>=|<|>|&&|\\|\\|"
  2251. }, {
  2252. token: "lparen",
  2253. regex: "[[({]"
  2254. }, {
  2255. token: "rparen",
  2256. regex: "[\\])}]"
  2257. }, {
  2258. token: "text",
  2259. regex: "\\s+"
  2260. });
  2261. this.$rules["vm_comment"] = [
  2262. {
  2263. token: "comment",
  2264. regex: "\\*#|-->",
  2265. next: "start"
  2266. }, {
  2267. defaultToken: "comment"
  2268. }
  2269. ];
  2270. this.$rules["vm_start"] = [
  2271. {
  2272. token: "variable",
  2273. regex: "}",
  2274. next: "pop"
  2275. }, {
  2276. token: "string.regexp",
  2277. regex: "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
  2278. }, {
  2279. token: "string",
  2280. regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  2281. }, {
  2282. token: "string",
  2283. regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  2284. }, {
  2285. token: "constant.numeric",
  2286. regex: "0[xX][0-9a-fA-F]+\\b"
  2287. }, {
  2288. token: "constant.numeric",
  2289. regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
  2290. }, {
  2291. token: "constant.language.boolean",
  2292. regex: "(?:true|false)\\b"
  2293. }, {
  2294. token: function (value) {
  2295. if (keywords.hasOwnProperty(value))
  2296. return "keyword";
  2297. else if (builtinConstants.hasOwnProperty(value))
  2298. return "constant.language";
  2299. else if (builtinVariables.hasOwnProperty(value))
  2300. return "variable.language";
  2301. else if (builtinFunctions.hasOwnProperty(value) || builtinFunctions.hasOwnProperty(value.substring(1)))
  2302. return "support.function";
  2303. else if (value == "debugger")
  2304. return "invalid.deprecated";
  2305. else if (value.match(/^(\$[a-zA-Z_$][a-zA-Z0-9_]*)$/))
  2306. return "variable";
  2307. return "identifier";
  2308. },
  2309. regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  2310. }, {
  2311. token: "keyword.operator",
  2312. regex: "!|&|\\*|\\-|\\+|=|!=|<=|>=|<|>|&&|\\|\\|"
  2313. }, {
  2314. token: "lparen",
  2315. regex: "[[({]"
  2316. }, {
  2317. token: "rparen",
  2318. regex: "[\\])}]"
  2319. }, {
  2320. token: "text",
  2321. regex: "\\s+"
  2322. }
  2323. ];
  2324. for (var i in this.$rules) {
  2325. this.$rules[i].unshift({
  2326. token: "variable",
  2327. regex: "\\${",
  2328. push: "vm_start"
  2329. });
  2330. }
  2331. this.normalizeRules();
  2332. };
  2333. oop.inherits(VelocityHighlightRules, TextHighlightRules);
  2334. exports.VelocityHighlightRules = VelocityHighlightRules;
  2335. });
  2336. ace.define("ace/mode/folding/velocity",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module){"use strict";
  2337. var oop = require("../../lib/oop");
  2338. var BaseFoldMode = require("./fold_mode").FoldMode;
  2339. var Range = require("../../range").Range;
  2340. var FoldMode = exports.FoldMode = function () { };
  2341. oop.inherits(FoldMode, BaseFoldMode);
  2342. (function () {
  2343. this.getFoldWidgetRange = function (session, foldStyle, row) {
  2344. var range = this.indentationBlock(session, row);
  2345. if (range)
  2346. return range;
  2347. var re = /\S/;
  2348. var line = session.getLine(row);
  2349. var startLevel = line.search(re);
  2350. if (startLevel == -1 || line[startLevel] != "##")
  2351. return;
  2352. var startColumn = line.length;
  2353. var maxRow = session.getLength();
  2354. var startRow = row;
  2355. var endRow = row;
  2356. while (++row < maxRow) {
  2357. line = session.getLine(row);
  2358. var level = line.search(re);
  2359. if (level == -1)
  2360. continue;
  2361. if (line[level] != "##")
  2362. break;
  2363. endRow = row;
  2364. }
  2365. if (endRow > startRow) {
  2366. var endColumn = session.getLine(endRow).length;
  2367. return new Range(startRow, startColumn, endRow, endColumn);
  2368. }
  2369. };
  2370. this.getFoldWidget = function (session, foldStyle, row) {
  2371. var line = session.getLine(row);
  2372. var indent = line.search(/\S/);
  2373. var next = session.getLine(row + 1);
  2374. var prev = session.getLine(row - 1);
  2375. var prevIndent = prev.search(/\S/);
  2376. var nextIndent = next.search(/\S/);
  2377. if (indent == -1) {
  2378. session.foldWidgets[row - 1] = prevIndent != -1 && prevIndent < nextIndent ? "start" : "";
  2379. return "";
  2380. }
  2381. if (prevIndent == -1) {
  2382. if (indent == nextIndent && line[indent] == "##" && next[indent] == "##") {
  2383. session.foldWidgets[row - 1] = "";
  2384. session.foldWidgets[row + 1] = "";
  2385. return "start";
  2386. }
  2387. }
  2388. else if (prevIndent == indent && line[indent] == "##" && prev[indent] == "##") {
  2389. if (session.getLine(row - 2).search(/\S/) == -1) {
  2390. session.foldWidgets[row - 1] = "start";
  2391. session.foldWidgets[row + 1] = "";
  2392. return "";
  2393. }
  2394. }
  2395. if (prevIndent != -1 && prevIndent < indent)
  2396. session.foldWidgets[row - 1] = "start";
  2397. else
  2398. session.foldWidgets[row - 1] = "";
  2399. if (indent < nextIndent)
  2400. return "start";
  2401. else
  2402. return "";
  2403. };
  2404. }).call(FoldMode.prototype);
  2405. });
  2406. ace.define("ace/mode/velocity",["require","exports","module","ace/lib/oop","ace/mode/html","ace/mode/velocity_highlight_rules","ace/mode/folding/velocity"], function(require, exports, module){/*
  2407. THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
  2408. */
  2409. "use strict";
  2410. var oop = require("../lib/oop");
  2411. var HtmlMode = require("./html").Mode;
  2412. var VelocityHighlightRules = require("./velocity_highlight_rules").VelocityHighlightRules;
  2413. var FoldMode = require("./folding/velocity").FoldMode;
  2414. var Mode = function () {
  2415. HtmlMode.call(this);
  2416. this.HighlightRules = VelocityHighlightRules;
  2417. this.foldingRules = new FoldMode();
  2418. };
  2419. oop.inherits(Mode, HtmlMode);
  2420. (function () {
  2421. this.lineCommentStart = "##";
  2422. this.blockComment = { start: "#*", end: "*#" };
  2423. this.$id = "ace/mode/velocity";
  2424. this.snippetFileId = "ace/snippets/velocity";
  2425. }).call(Mode.prototype);
  2426. exports.Mode = Mode;
  2427. }); (function() {
  2428. ace.require(["ace/mode/velocity"], function(m) {
  2429. if (typeof module == "object" && typeof exports == "object" && module) {
  2430. module.exports = m;
  2431. }
  2432. });
  2433. })();