mode-handlebars.js 102 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620
  1. define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  5. var DocCommentHighlightRules = function() {
  6. this.$rules = {
  7. "start" : [ {
  8. token : "comment.doc.tag",
  9. regex : "@[\\w\\d_]+" // TODO: fix email addresses
  10. },
  11. DocCommentHighlightRules.getTagRule(),
  12. {
  13. defaultToken : "comment.doc",
  14. caseInsensitive: true
  15. }]
  16. };
  17. };
  18. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  19. DocCommentHighlightRules.getTagRule = function(start) {
  20. return {
  21. token : "comment.doc.tag.storage.type",
  22. regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  23. };
  24. };
  25. DocCommentHighlightRules.getStartRule = function(start) {
  26. return {
  27. token : "comment.doc", // doc comment
  28. regex : "\\/\\*(?=\\*)",
  29. next : start
  30. };
  31. };
  32. DocCommentHighlightRules.getEndRule = function (start) {
  33. return {
  34. token : "comment.doc", // closing comment
  35. regex : "\\*\\/",
  36. next : start
  37. };
  38. };
  39. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  40. });
  41. 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) {
  42. "use strict";
  43. var oop = require("../lib/oop");
  44. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  45. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  46. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
  47. var JavaScriptHighlightRules = function(options) {
  48. var keywordMapper = this.createKeywordMapper({
  49. "variable.language":
  50. "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
  51. "Namespace|QName|XML|XMLList|" + // E4X
  52. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  53. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  54. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
  55. "SyntaxError|TypeError|URIError|" +
  56. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
  57. "isNaN|parseFloat|parseInt|" +
  58. "JSON|Math|" + // Other
  59. "this|arguments|prototype|window|document" , // Pseudo
  60. "keyword":
  61. "const|yield|import|get|set|async|await|" +
  62. "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  63. "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  64. "__parent__|__count__|escape|unescape|with|__proto__|" +
  65. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
  66. "storage.type":
  67. "const|let|var|function",
  68. "constant.language":
  69. "null|Infinity|NaN|undefined",
  70. "support.function":
  71. "alert",
  72. "constant.language.boolean": "true|false"
  73. }, "identifier");
  74. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
  75. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  76. "u[0-9a-fA-F]{4}|" + // unicode
  77. "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
  78. "[0-2][0-7]{0,2}|" + // oct
  79. "3[0-7][0-7]?|" + // oct
  80. "[4-7][0-7]?|" + //oct
  81. ".)";
  82. this.$rules = {
  83. "no_regex" : [
  84. DocCommentHighlightRules.getStartRule("doc-start"),
  85. comments("no_regex"),
  86. {
  87. token : "string",
  88. regex : "'(?=.)",
  89. next : "qstring"
  90. }, {
  91. token : "string",
  92. regex : '"(?=.)',
  93. next : "qqstring"
  94. }, {
  95. token : "constant.numeric", // hexadecimal, octal and binary
  96. regex : /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
  97. }, {
  98. token : "constant.numeric", // decimal integers and floats
  99. regex : /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
  100. }, {
  101. token : [
  102. "storage.type", "punctuation.operator", "support.function",
  103. "punctuation.operator", "entity.name.function", "text","keyword.operator"
  104. ],
  105. regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
  106. next: "function_arguments"
  107. }, {
  108. token : [
  109. "storage.type", "punctuation.operator", "entity.name.function", "text",
  110. "keyword.operator", "text", "storage.type", "text", "paren.lparen"
  111. ],
  112. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  113. next: "function_arguments"
  114. }, {
  115. token : [
  116. "entity.name.function", "text", "keyword.operator", "text", "storage.type",
  117. "text", "paren.lparen"
  118. ],
  119. regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  120. next: "function_arguments"
  121. }, {
  122. token : [
  123. "storage.type", "punctuation.operator", "entity.name.function", "text",
  124. "keyword.operator", "text",
  125. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  126. ],
  127. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
  128. next: "function_arguments"
  129. }, {
  130. token : [
  131. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  132. ],
  133. regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
  134. next: "function_arguments"
  135. }, {
  136. token : [
  137. "entity.name.function", "text", "punctuation.operator",
  138. "text", "storage.type", "text", "paren.lparen"
  139. ],
  140. regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
  141. next: "function_arguments"
  142. }, {
  143. token : [
  144. "text", "text", "storage.type", "text", "paren.lparen"
  145. ],
  146. regex : "(:)(\\s*)(function)(\\s*)(\\()",
  147. next: "function_arguments"
  148. }, {
  149. token : "keyword",
  150. regex : "from(?=\\s*('|\"))"
  151. }, {
  152. token : "keyword",
  153. regex : "(?:" + kwBeforeRe + ")\\b",
  154. next : "start"
  155. }, {
  156. token : ["support.constant"],
  157. regex : /that\b/
  158. }, {
  159. token : ["storage.type", "punctuation.operator", "support.function.firebug"],
  160. regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
  161. }, {
  162. token : keywordMapper,
  163. regex : identifierRe
  164. }, {
  165. token : "punctuation.operator",
  166. regex : /[.](?![.])/,
  167. next : "property"
  168. }, {
  169. token : "storage.type",
  170. regex : /=>/,
  171. next : "start"
  172. }, {
  173. token : "keyword.operator",
  174. regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
  175. next : "start"
  176. }, {
  177. token : "punctuation.operator",
  178. regex : /[?:,;.]/,
  179. next : "start"
  180. }, {
  181. token : "paren.lparen",
  182. regex : /[\[({]/,
  183. next : "start"
  184. }, {
  185. token : "paren.rparen",
  186. regex : /[\])}]/
  187. }, {
  188. token: "comment",
  189. regex: /^#!.*$/
  190. }
  191. ],
  192. property: [{
  193. token : "text",
  194. regex : "\\s+"
  195. }, {
  196. token : [
  197. "storage.type", "punctuation.operator", "entity.name.function", "text",
  198. "keyword.operator", "text",
  199. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  200. ],
  201. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
  202. next: "function_arguments"
  203. }, {
  204. token : "punctuation.operator",
  205. regex : /[.](?![.])/
  206. }, {
  207. token : "support.function",
  208. 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(?=\()/
  209. }, {
  210. token : "support.function.dom",
  211. 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(?=\()/
  212. }, {
  213. token : "support.constant",
  214. 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/
  215. }, {
  216. token : "identifier",
  217. regex : identifierRe
  218. }, {
  219. regex: "",
  220. token: "empty",
  221. next: "no_regex"
  222. }
  223. ],
  224. "start": [
  225. DocCommentHighlightRules.getStartRule("doc-start"),
  226. comments("start"),
  227. {
  228. token: "string.regexp",
  229. regex: "\\/",
  230. next: "regex"
  231. }, {
  232. token : "text",
  233. regex : "\\s+|^$",
  234. next : "start"
  235. }, {
  236. token: "empty",
  237. regex: "",
  238. next: "no_regex"
  239. }
  240. ],
  241. "regex": [
  242. {
  243. token: "regexp.keyword.operator",
  244. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  245. }, {
  246. token: "string.regexp",
  247. regex: "/[sxngimy]*",
  248. next: "no_regex"
  249. }, {
  250. token : "invalid",
  251. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  252. }, {
  253. token : "constant.language.escape",
  254. regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  255. }, {
  256. token : "constant.language.delimiter",
  257. regex: /\|/
  258. }, {
  259. token: "constant.language.escape",
  260. regex: /\[\^?/,
  261. next: "regex_character_class"
  262. }, {
  263. token: "empty",
  264. regex: "$",
  265. next: "no_regex"
  266. }, {
  267. defaultToken: "string.regexp"
  268. }
  269. ],
  270. "regex_character_class": [
  271. {
  272. token: "regexp.charclass.keyword.operator",
  273. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  274. }, {
  275. token: "constant.language.escape",
  276. regex: "]",
  277. next: "regex"
  278. }, {
  279. token: "constant.language.escape",
  280. regex: "-"
  281. }, {
  282. token: "empty",
  283. regex: "$",
  284. next: "no_regex"
  285. }, {
  286. defaultToken: "string.regexp.charachterclass"
  287. }
  288. ],
  289. "function_arguments": [
  290. {
  291. token: "variable.parameter",
  292. regex: identifierRe
  293. }, {
  294. token: "punctuation.operator",
  295. regex: "[, ]+"
  296. }, {
  297. token: "punctuation.operator",
  298. regex: "$"
  299. }, {
  300. token: "empty",
  301. regex: "",
  302. next: "no_regex"
  303. }
  304. ],
  305. "qqstring" : [
  306. {
  307. token : "constant.language.escape",
  308. regex : escapedRe
  309. }, {
  310. token : "string",
  311. regex : "\\\\$",
  312. consumeLineEnd : true
  313. }, {
  314. token : "string",
  315. regex : '"|$',
  316. next : "no_regex"
  317. }, {
  318. defaultToken: "string"
  319. }
  320. ],
  321. "qstring" : [
  322. {
  323. token : "constant.language.escape",
  324. regex : escapedRe
  325. }, {
  326. token : "string",
  327. regex : "\\\\$",
  328. consumeLineEnd : true
  329. }, {
  330. token : "string",
  331. regex : "'|$",
  332. next : "no_regex"
  333. }, {
  334. defaultToken: "string"
  335. }
  336. ]
  337. };
  338. if (!options || !options.noES6) {
  339. this.$rules.no_regex.unshift({
  340. regex: "[{}]", onMatch: function(val, state, stack) {
  341. this.next = val == "{" ? this.nextState : "";
  342. if (val == "{" && stack.length) {
  343. stack.unshift("start", state);
  344. }
  345. else if (val == "}" && stack.length) {
  346. stack.shift();
  347. this.next = stack.shift();
  348. if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
  349. return "paren.quasi.end";
  350. }
  351. return val == "{" ? "paren.lparen" : "paren.rparen";
  352. },
  353. nextState: "start"
  354. }, {
  355. token : "string.quasi.start",
  356. regex : /`/,
  357. push : [{
  358. token : "constant.language.escape",
  359. regex : escapedRe
  360. }, {
  361. token : "paren.quasi.start",
  362. regex : /\${/,
  363. push : "start"
  364. }, {
  365. token : "string.quasi.end",
  366. regex : /`/,
  367. next : "pop"
  368. }, {
  369. defaultToken: "string.quasi"
  370. }]
  371. });
  372. if (!options || options.jsx != false)
  373. JSX.call(this);
  374. }
  375. this.embedRules(DocCommentHighlightRules, "doc-",
  376. [ DocCommentHighlightRules.getEndRule("no_regex") ]);
  377. this.normalizeRules();
  378. };
  379. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  380. function JSX() {
  381. var tagRegex = identifierRe.replace("\\d", "\\d\\-");
  382. var jsxTag = {
  383. onMatch : function(val, state, stack) {
  384. var offset = val.charAt(1) == "/" ? 2 : 1;
  385. if (offset == 1) {
  386. if (state != this.nextState)
  387. stack.unshift(this.next, this.nextState, 0);
  388. else
  389. stack.unshift(this.next);
  390. stack[2]++;
  391. } else if (offset == 2) {
  392. if (state == this.nextState) {
  393. stack[1]--;
  394. if (!stack[1] || stack[1] < 0) {
  395. stack.shift();
  396. stack.shift();
  397. }
  398. }
  399. }
  400. return [{
  401. type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
  402. value: val.slice(0, offset)
  403. }, {
  404. type: "meta.tag.tag-name.xml",
  405. value: val.substr(offset)
  406. }];
  407. },
  408. regex : "</?" + tagRegex + "",
  409. next: "jsxAttributes",
  410. nextState: "jsx"
  411. };
  412. this.$rules.start.unshift(jsxTag);
  413. var jsxJsRule = {
  414. regex: "{",
  415. token: "paren.quasi.start",
  416. push: "start"
  417. };
  418. this.$rules.jsx = [
  419. jsxJsRule,
  420. jsxTag,
  421. {include : "reference"},
  422. {defaultToken: "string"}
  423. ];
  424. this.$rules.jsxAttributes = [{
  425. token : "meta.tag.punctuation.tag-close.xml",
  426. regex : "/?>",
  427. onMatch : function(value, currentState, stack) {
  428. if (currentState == stack[0])
  429. stack.shift();
  430. if (value.length == 2) {
  431. if (stack[0] == this.nextState)
  432. stack[1]--;
  433. if (!stack[1] || stack[1] < 0) {
  434. stack.splice(0, 2);
  435. }
  436. }
  437. this.next = stack[0] || "start";
  438. return [{type: this.token, value: value}];
  439. },
  440. nextState: "jsx"
  441. },
  442. jsxJsRule,
  443. comments("jsxAttributes"),
  444. {
  445. token : "entity.other.attribute-name.xml",
  446. regex : tagRegex
  447. }, {
  448. token : "keyword.operator.attribute-equals.xml",
  449. regex : "="
  450. }, {
  451. token : "text.tag-whitespace.xml",
  452. regex : "\\s+"
  453. }, {
  454. token : "string.attribute-value.xml",
  455. regex : "'",
  456. stateName : "jsx_attr_q",
  457. push : [
  458. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  459. {include : "reference"},
  460. {defaultToken : "string.attribute-value.xml"}
  461. ]
  462. }, {
  463. token : "string.attribute-value.xml",
  464. regex : '"',
  465. stateName : "jsx_attr_qq",
  466. push : [
  467. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  468. {include : "reference"},
  469. {defaultToken : "string.attribute-value.xml"}
  470. ]
  471. },
  472. jsxTag
  473. ];
  474. this.$rules.reference = [{
  475. token : "constant.language.escape.reference.xml",
  476. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  477. }];
  478. }
  479. function comments(next) {
  480. return [
  481. {
  482. token : "comment", // multi line comment
  483. regex : /\/\*/,
  484. next: [
  485. DocCommentHighlightRules.getTagRule(),
  486. {token : "comment", regex : "\\*\\/", next : next || "pop"},
  487. {defaultToken : "comment", caseInsensitive: true}
  488. ]
  489. }, {
  490. token : "comment",
  491. regex : "\\/\\/",
  492. next: [
  493. DocCommentHighlightRules.getTagRule(),
  494. {token : "comment", regex : "$|^", next : next || "pop"},
  495. {defaultToken : "comment", caseInsensitive: true}
  496. ]
  497. }
  498. ];
  499. }
  500. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  501. });
  502. define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
  503. "use strict";
  504. var Range = require("../range").Range;
  505. var MatchingBraceOutdent = function() {};
  506. (function() {
  507. this.checkOutdent = function(line, input) {
  508. if (! /^\s+$/.test(line))
  509. return false;
  510. return /^\s*\}/.test(input);
  511. };
  512. this.autoOutdent = function(doc, row) {
  513. var line = doc.getLine(row);
  514. var match = line.match(/^(\s*\})/);
  515. if (!match) return 0;
  516. var column = match[1].length;
  517. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  518. if (!openBracePos || openBracePos.row == row) return 0;
  519. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  520. doc.replace(new Range(row, 0, row, column-1), indent);
  521. };
  522. this.$getIndent = function(line) {
  523. return line.match(/^\s*/)[0];
  524. };
  525. }).call(MatchingBraceOutdent.prototype);
  526. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  527. });
  528. define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
  529. "use strict";
  530. var oop = require("../../lib/oop");
  531. var Range = require("../../range").Range;
  532. var BaseFoldMode = require("./fold_mode").FoldMode;
  533. var FoldMode = exports.FoldMode = function(commentRegex) {
  534. if (commentRegex) {
  535. this.foldingStartMarker = new RegExp(
  536. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  537. );
  538. this.foldingStopMarker = new RegExp(
  539. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  540. );
  541. }
  542. };
  543. oop.inherits(FoldMode, BaseFoldMode);
  544. (function() {
  545. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  546. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  547. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  548. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  549. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  550. this._getFoldWidgetBase = this.getFoldWidget;
  551. this.getFoldWidget = function(session, foldStyle, row) {
  552. var line = session.getLine(row);
  553. if (this.singleLineBlockCommentRe.test(line)) {
  554. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  555. return "";
  556. }
  557. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  558. if (!fw && this.startRegionRe.test(line))
  559. return "start"; // lineCommentRegionStart
  560. return fw;
  561. };
  562. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  563. var line = session.getLine(row);
  564. if (this.startRegionRe.test(line))
  565. return this.getCommentRegionBlock(session, line, row);
  566. var match = line.match(this.foldingStartMarker);
  567. if (match) {
  568. var i = match.index;
  569. if (match[1])
  570. return this.openingBracketBlock(session, match[1], row, i);
  571. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  572. if (range && !range.isMultiLine()) {
  573. if (forceMultiline) {
  574. range = this.getSectionRange(session, row);
  575. } else if (foldStyle != "all")
  576. range = null;
  577. }
  578. return range;
  579. }
  580. if (foldStyle === "markbegin")
  581. return;
  582. var match = line.match(this.foldingStopMarker);
  583. if (match) {
  584. var i = match.index + match[0].length;
  585. if (match[1])
  586. return this.closingBracketBlock(session, match[1], row, i);
  587. return session.getCommentFoldRange(row, i, -1);
  588. }
  589. };
  590. this.getSectionRange = function(session, row) {
  591. var line = session.getLine(row);
  592. var startIndent = line.search(/\S/);
  593. var startRow = row;
  594. var startColumn = line.length;
  595. row = row + 1;
  596. var endRow = row;
  597. var maxRow = session.getLength();
  598. while (++row < maxRow) {
  599. line = session.getLine(row);
  600. var indent = line.search(/\S/);
  601. if (indent === -1)
  602. continue;
  603. if (startIndent > indent)
  604. break;
  605. var subRange = this.getFoldWidgetRange(session, "all", row);
  606. if (subRange) {
  607. if (subRange.start.row <= startRow) {
  608. break;
  609. } else if (subRange.isMultiLine()) {
  610. row = subRange.end.row;
  611. } else if (startIndent == indent) {
  612. break;
  613. }
  614. }
  615. endRow = row;
  616. }
  617. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  618. };
  619. this.getCommentRegionBlock = function(session, line, row) {
  620. var startColumn = line.search(/\s*$/);
  621. var maxRow = session.getLength();
  622. var startRow = row;
  623. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  624. var depth = 1;
  625. while (++row < maxRow) {
  626. line = session.getLine(row);
  627. var m = re.exec(line);
  628. if (!m) continue;
  629. if (m[1]) depth--;
  630. else depth++;
  631. if (!depth) break;
  632. }
  633. var endRow = row;
  634. if (endRow > startRow) {
  635. return new Range(startRow, startColumn, endRow, line.length);
  636. }
  637. };
  638. }).call(FoldMode.prototype);
  639. });
  640. 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) {
  641. "use strict";
  642. var oop = require("../lib/oop");
  643. var TextMode = require("./text").Mode;
  644. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  645. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  646. var WorkerClient = require("../worker/worker_client").WorkerClient;
  647. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  648. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  649. var Mode = function() {
  650. this.HighlightRules = JavaScriptHighlightRules;
  651. this.$outdent = new MatchingBraceOutdent();
  652. this.$behaviour = new CstyleBehaviour();
  653. this.foldingRules = new CStyleFoldMode();
  654. };
  655. oop.inherits(Mode, TextMode);
  656. (function() {
  657. this.lineCommentStart = "//";
  658. this.blockComment = {start: "/*", end: "*/"};
  659. this.$quotes = {'"': '"', "'": "'", "`": "`"};
  660. this.getNextLineIndent = function(state, line, tab) {
  661. var indent = this.$getIndent(line);
  662. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  663. var tokens = tokenizedLine.tokens;
  664. var endState = tokenizedLine.state;
  665. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  666. return indent;
  667. }
  668. if (state == "start" || state == "no_regex") {
  669. var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
  670. if (match) {
  671. indent += tab;
  672. }
  673. } else if (state == "doc-start") {
  674. if (endState == "start" || endState == "no_regex") {
  675. return "";
  676. }
  677. var match = line.match(/^\s*(\/?)\*/);
  678. if (match) {
  679. if (match[1]) {
  680. indent += " ";
  681. }
  682. indent += "* ";
  683. }
  684. }
  685. return indent;
  686. };
  687. this.checkOutdent = function(state, line, input) {
  688. return this.$outdent.checkOutdent(line, input);
  689. };
  690. this.autoOutdent = function(state, doc, row) {
  691. this.$outdent.autoOutdent(doc, row);
  692. };
  693. this.createWorker = function(session) {
  694. var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
  695. worker.attachToDocument(session.getDocument());
  696. worker.on("annotate", function(results) {
  697. session.setAnnotations(results.data);
  698. });
  699. worker.on("terminate", function() {
  700. session.clearAnnotations();
  701. });
  702. return worker;
  703. };
  704. this.$id = "ace/mode/javascript";
  705. }).call(Mode.prototype);
  706. exports.Mode = Mode;
  707. });
  708. define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) {
  709. "use strict";
  710. var oop = require("../lib/oop");
  711. var lang = require("../lib/lang");
  712. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  713. 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";
  714. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  715. 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";
  716. 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";
  717. 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";
  718. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
  719. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  720. 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";
  721. var CssHighlightRules = function() {
  722. var keywordMapper = this.createKeywordMapper({
  723. "support.function": supportFunction,
  724. "support.constant": supportConstant,
  725. "support.type": supportType,
  726. "support.constant.color": supportConstantColor,
  727. "support.constant.fonts": supportConstantFonts
  728. }, "text", true);
  729. this.$rules = {
  730. "start" : [{
  731. include : ["strings", "url", "comments"]
  732. }, {
  733. token: "paren.lparen",
  734. regex: "\\{",
  735. next: "ruleset"
  736. }, {
  737. token: "paren.rparen",
  738. regex: "\\}"
  739. }, {
  740. token: "string",
  741. regex: "@(?!viewport)",
  742. next: "media"
  743. }, {
  744. token: "keyword",
  745. regex: "#[a-z0-9-_]+"
  746. }, {
  747. token: "keyword",
  748. regex: "%"
  749. }, {
  750. token: "variable",
  751. regex: "\\.[a-z0-9-_]+"
  752. }, {
  753. token: "string",
  754. regex: ":[a-z0-9-_]+"
  755. }, {
  756. token : "constant.numeric",
  757. regex : numRe
  758. }, {
  759. token: "constant",
  760. regex: "[a-z0-9-_]+"
  761. }, {
  762. caseInsensitive: true
  763. }],
  764. "media": [{
  765. include : ["strings", "url", "comments"]
  766. }, {
  767. token: "paren.lparen",
  768. regex: "\\{",
  769. next: "start"
  770. }, {
  771. token: "paren.rparen",
  772. regex: "\\}",
  773. next: "start"
  774. }, {
  775. token: "string",
  776. regex: ";",
  777. next: "start"
  778. }, {
  779. token: "keyword",
  780. regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
  781. + "|page|font|keyframes|viewport|counter-style|font-feature-values"
  782. + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
  783. }],
  784. "comments" : [{
  785. token: "comment", // multi line comment
  786. regex: "\\/\\*",
  787. push: [{
  788. token : "comment",
  789. regex : "\\*\\/",
  790. next : "pop"
  791. }, {
  792. defaultToken : "comment"
  793. }]
  794. }],
  795. "ruleset" : [{
  796. regex : "-(webkit|ms|moz|o)-",
  797. token : "text"
  798. }, {
  799. token : "punctuation.operator",
  800. regex : "[:;]"
  801. }, {
  802. token : "paren.rparen",
  803. regex : "\\}",
  804. next : "start"
  805. }, {
  806. include : ["strings", "url", "comments"]
  807. }, {
  808. token : ["constant.numeric", "keyword"],
  809. 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|%)"
  810. }, {
  811. token : "constant.numeric",
  812. regex : numRe
  813. }, {
  814. token : "constant.numeric", // hex6 color
  815. regex : "#[a-f0-9]{6}"
  816. }, {
  817. token : "constant.numeric", // hex3 color
  818. regex : "#[a-f0-9]{3}"
  819. }, {
  820. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  821. regex : pseudoElements
  822. }, {
  823. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  824. regex : pseudoClasses
  825. }, {
  826. include: "url"
  827. }, {
  828. token : keywordMapper,
  829. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  830. }, {
  831. caseInsensitive: true
  832. }],
  833. url: [{
  834. token : "support.function",
  835. regex : "(?:url(:?-prefix)?|domain|regexp)\\(",
  836. push: [{
  837. token : "support.function",
  838. regex : "\\)",
  839. next : "pop"
  840. }, {
  841. defaultToken: "string"
  842. }]
  843. }],
  844. strings: [{
  845. token : "string.start",
  846. regex : "'",
  847. push : [{
  848. token : "string.end",
  849. regex : "'|$",
  850. next: "pop"
  851. }, {
  852. include : "escapes"
  853. }, {
  854. token : "constant.language.escape",
  855. regex : /\\$/,
  856. consumeLineEnd: true
  857. }, {
  858. defaultToken: "string"
  859. }]
  860. }, {
  861. token : "string.start",
  862. regex : '"',
  863. push : [{
  864. token : "string.end",
  865. regex : '"|$',
  866. next: "pop"
  867. }, {
  868. include : "escapes"
  869. }, {
  870. token : "constant.language.escape",
  871. regex : /\\$/,
  872. consumeLineEnd: true
  873. }, {
  874. defaultToken: "string"
  875. }]
  876. }],
  877. escapes: [{
  878. token : "constant.language.escape",
  879. regex : /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
  880. }]
  881. };
  882. this.normalizeRules();
  883. };
  884. oop.inherits(CssHighlightRules, TextHighlightRules);
  885. exports.CssHighlightRules = CssHighlightRules;
  886. });
  887. define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module) {
  888. "use strict";
  889. var propertyMap = {
  890. "background": {"#$0": 1},
  891. "background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
  892. "background-image": {"url('/$0')": 1},
  893. "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
  894. "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2},
  895. "background-attachment": {"scroll": 1, "fixed": 1},
  896. "background-size": {"cover": 1, "contain": 1},
  897. "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
  898. "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
  899. "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
  900. "border-color": {"#$0": 1},
  901. "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2},
  902. "border-collapse": {"collapse": 1, "separate": 1},
  903. "bottom": {"px": 1, "em": 1, "%": 1},
  904. "clear": {"left": 1, "right": 1, "both": 1, "none": 1},
  905. "color": {"#$0": 1, "rgb(#$00,0,0)": 1},
  906. "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},
  907. "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
  908. "empty-cells": {"show": 1, "hide": 1},
  909. "float": {"left": 1, "right": 1, "none": 1},
  910. "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},
  911. "font-size": {"px": 1, "em": 1, "%": 1},
  912. "font-weight": {"bold": 1, "normal": 1},
  913. "font-style": {"italic": 1, "normal": 1},
  914. "font-variant": {"normal": 1, "small-caps": 1},
  915. "height": {"px": 1, "em": 1, "%": 1},
  916. "left": {"px": 1, "em": 1, "%": 1},
  917. "letter-spacing": {"normal": 1},
  918. "line-height": {"normal": 1},
  919. "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},
  920. "margin": {"px": 1, "em": 1, "%": 1},
  921. "margin-right": {"px": 1, "em": 1, "%": 1},
  922. "margin-left": {"px": 1, "em": 1, "%": 1},
  923. "margin-top": {"px": 1, "em": 1, "%": 1},
  924. "margin-bottom": {"px": 1, "em": 1, "%": 1},
  925. "max-height": {"px": 1, "em": 1, "%": 1},
  926. "max-width": {"px": 1, "em": 1, "%": 1},
  927. "min-height": {"px": 1, "em": 1, "%": 1},
  928. "min-width": {"px": 1, "em": 1, "%": 1},
  929. "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  930. "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  931. "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  932. "padding": {"px": 1, "em": 1, "%": 1},
  933. "padding-top": {"px": 1, "em": 1, "%": 1},
  934. "padding-right": {"px": 1, "em": 1, "%": 1},
  935. "padding-bottom": {"px": 1, "em": 1, "%": 1},
  936. "padding-left": {"px": 1, "em": 1, "%": 1},
  937. "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  938. "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  939. "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
  940. "right": {"px": 1, "em": 1, "%": 1},
  941. "table-layout": {"fixed": 1, "auto": 1},
  942. "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
  943. "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
  944. "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
  945. "top": {"px": 1, "em": 1, "%": 1},
  946. "vertical-align": {"top": 1, "bottom": 1},
  947. "visibility": {"hidden": 1, "visible": 1},
  948. "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
  949. "width": {"px": 1, "em": 1, "%": 1},
  950. "word-spacing": {"normal": 1},
  951. "filter": {"alpha(opacity=$0100)": 1},
  952. "text-shadow": {"$02px 2px 2px #777": 1},
  953. "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
  954. "-moz-border-radius": 1,
  955. "-moz-border-radius-topright": 1,
  956. "-moz-border-radius-bottomright": 1,
  957. "-moz-border-radius-topleft": 1,
  958. "-moz-border-radius-bottomleft": 1,
  959. "-webkit-border-radius": 1,
  960. "-webkit-border-top-right-radius": 1,
  961. "-webkit-border-top-left-radius": 1,
  962. "-webkit-border-bottom-right-radius": 1,
  963. "-webkit-border-bottom-left-radius": 1,
  964. "-moz-box-shadow": 1,
  965. "-webkit-box-shadow": 1,
  966. "transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  967. "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  968. "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
  969. };
  970. var CssCompletions = function() {
  971. };
  972. (function() {
  973. this.completionsDefined = false;
  974. this.defineCompletions = function() {
  975. if (document) {
  976. var style = document.createElement('c').style;
  977. for (var i in style) {
  978. if (typeof style[i] !== 'string')
  979. continue;
  980. var name = i.replace(/[A-Z]/g, function(x) {
  981. return '-' + x.toLowerCase();
  982. });
  983. if (!propertyMap.hasOwnProperty(name))
  984. propertyMap[name] = 1;
  985. }
  986. }
  987. this.completionsDefined = true;
  988. };
  989. this.getCompletions = function(state, session, pos, prefix) {
  990. if (!this.completionsDefined) {
  991. this.defineCompletions();
  992. }
  993. if (state==='ruleset' || session.$mode.$id == "ace/mode/scss") {
  994. var line = session.getLine(pos.row).substr(0, pos.column);
  995. if (/:[^;]+$/.test(line)) {
  996. /([\w\-]+):[^:]*$/.test(line);
  997. return this.getPropertyValueCompletions(state, session, pos, prefix);
  998. } else {
  999. return this.getPropertyCompletions(state, session, pos, prefix);
  1000. }
  1001. }
  1002. return [];
  1003. };
  1004. this.getPropertyCompletions = function(state, session, pos, prefix) {
  1005. var properties = Object.keys(propertyMap);
  1006. return properties.map(function(property){
  1007. return {
  1008. caption: property,
  1009. snippet: property + ': $0;',
  1010. meta: "property",
  1011. score: 1000000
  1012. };
  1013. });
  1014. };
  1015. this.getPropertyValueCompletions = function(state, session, pos, prefix) {
  1016. var line = session.getLine(pos.row).substr(0, pos.column);
  1017. var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
  1018. if (!property)
  1019. return [];
  1020. var values = [];
  1021. if (property in propertyMap && typeof propertyMap[property] === "object") {
  1022. values = Object.keys(propertyMap[property]);
  1023. }
  1024. return values.map(function(value){
  1025. return {
  1026. caption: value,
  1027. snippet: value,
  1028. meta: "property value",
  1029. score: 1000000
  1030. };
  1031. });
  1032. };
  1033. }).call(CssCompletions.prototype);
  1034. exports.CssCompletions = CssCompletions;
  1035. });
  1036. 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) {
  1037. "use strict";
  1038. var oop = require("../../lib/oop");
  1039. var Behaviour = require("../behaviour").Behaviour;
  1040. var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
  1041. var TokenIterator = require("../../token_iterator").TokenIterator;
  1042. var CssBehaviour = function () {
  1043. this.inherit(CstyleBehaviour);
  1044. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1045. if (text === ':' && editor.selection.isEmpty()) {
  1046. var cursor = editor.getCursorPosition();
  1047. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1048. var token = iterator.getCurrentToken();
  1049. if (token && token.value.match(/\s+/)) {
  1050. token = iterator.stepBackward();
  1051. }
  1052. if (token && token.type === 'support.type') {
  1053. var line = session.doc.getLine(cursor.row);
  1054. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1055. if (rightChar === ':') {
  1056. return {
  1057. text: '',
  1058. selection: [1, 1]
  1059. };
  1060. }
  1061. if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
  1062. return {
  1063. text: ':;',
  1064. selection: [1, 1]
  1065. };
  1066. }
  1067. }
  1068. }
  1069. });
  1070. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1071. var selected = session.doc.getTextRange(range);
  1072. if (!range.isMultiLine() && selected === ':') {
  1073. var cursor = editor.getCursorPosition();
  1074. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1075. var token = iterator.getCurrentToken();
  1076. if (token && token.value.match(/\s+/)) {
  1077. token = iterator.stepBackward();
  1078. }
  1079. if (token && token.type === 'support.type') {
  1080. var line = session.doc.getLine(range.start.row);
  1081. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1082. if (rightChar === ';') {
  1083. range.end.column ++;
  1084. return range;
  1085. }
  1086. }
  1087. }
  1088. });
  1089. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1090. if (text === ';' && editor.selection.isEmpty()) {
  1091. var cursor = editor.getCursorPosition();
  1092. var line = session.doc.getLine(cursor.row);
  1093. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1094. if (rightChar === ';') {
  1095. return {
  1096. text: '',
  1097. selection: [1, 1]
  1098. };
  1099. }
  1100. }
  1101. });
  1102. this.add("!important", "insertion", function (state, action, editor, session, text) {
  1103. if (text === '!' && editor.selection.isEmpty()) {
  1104. var cursor = editor.getCursorPosition();
  1105. var line = session.doc.getLine(cursor.row);
  1106. if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
  1107. return {
  1108. text: '!important',
  1109. selection: [10, 10]
  1110. };
  1111. }
  1112. }
  1113. });
  1114. };
  1115. oop.inherits(CssBehaviour, CstyleBehaviour);
  1116. exports.CssBehaviour = CssBehaviour;
  1117. });
  1118. 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) {
  1119. "use strict";
  1120. var oop = require("../lib/oop");
  1121. var TextMode = require("./text").Mode;
  1122. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1123. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1124. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1125. var CssCompletions = require("./css_completions").CssCompletions;
  1126. var CssBehaviour = require("./behaviour/css").CssBehaviour;
  1127. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1128. var Mode = function() {
  1129. this.HighlightRules = CssHighlightRules;
  1130. this.$outdent = new MatchingBraceOutdent();
  1131. this.$behaviour = new CssBehaviour();
  1132. this.$completer = new CssCompletions();
  1133. this.foldingRules = new CStyleFoldMode();
  1134. };
  1135. oop.inherits(Mode, TextMode);
  1136. (function() {
  1137. this.foldingRules = "cStyle";
  1138. this.blockComment = {start: "/*", end: "*/"};
  1139. this.getNextLineIndent = function(state, line, tab) {
  1140. var indent = this.$getIndent(line);
  1141. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1142. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1143. return indent;
  1144. }
  1145. var match = line.match(/^.*\{\s*$/);
  1146. if (match) {
  1147. indent += tab;
  1148. }
  1149. return indent;
  1150. };
  1151. this.checkOutdent = function(state, line, input) {
  1152. return this.$outdent.checkOutdent(line, input);
  1153. };
  1154. this.autoOutdent = function(state, doc, row) {
  1155. this.$outdent.autoOutdent(doc, row);
  1156. };
  1157. this.getCompletions = function(state, session, pos, prefix) {
  1158. return this.$completer.getCompletions(state, session, pos, prefix);
  1159. };
  1160. this.createWorker = function(session) {
  1161. var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
  1162. worker.attachToDocument(session.getDocument());
  1163. worker.on("annotate", function(e) {
  1164. session.setAnnotations(e.data);
  1165. });
  1166. worker.on("terminate", function() {
  1167. session.clearAnnotations();
  1168. });
  1169. return worker;
  1170. };
  1171. this.$id = "ace/mode/css";
  1172. }).call(Mode.prototype);
  1173. exports.Mode = Mode;
  1174. });
  1175. define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  1176. "use strict";
  1177. var oop = require("../lib/oop");
  1178. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  1179. var XmlHighlightRules = function(normalize) {
  1180. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  1181. this.$rules = {
  1182. start : [
  1183. {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
  1184. {
  1185. token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
  1186. regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction"
  1187. },
  1188. {token : "comment.start.xml", regex : "<\\!--", next : "comment"},
  1189. {
  1190. token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  1191. regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
  1192. },
  1193. {include : "tag"},
  1194. {token : "text.end-tag-open.xml", regex: "</"},
  1195. {token : "text.tag-open.xml", regex: "<"},
  1196. {include : "reference"},
  1197. {defaultToken : "text.xml"}
  1198. ],
  1199. processing_instruction : [{
  1200. token : "entity.other.attribute-name.decl-attribute-name.xml",
  1201. regex : tagRegex
  1202. }, {
  1203. token : "keyword.operator.decl-attribute-equals.xml",
  1204. regex : "="
  1205. }, {
  1206. include: "whitespace"
  1207. }, {
  1208. include: "string"
  1209. }, {
  1210. token : "punctuation.xml-decl.xml",
  1211. regex : "\\?>",
  1212. next : "start"
  1213. }],
  1214. doctype : [
  1215. {include : "whitespace"},
  1216. {include : "string"},
  1217. {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
  1218. {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
  1219. {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
  1220. ],
  1221. int_subset : [{
  1222. token : "text.xml",
  1223. regex : "\\s+"
  1224. }, {
  1225. token: "punctuation.int-subset.xml",
  1226. regex: "]",
  1227. next: "pop"
  1228. }, {
  1229. token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  1230. regex : "(<\\!)(" + tagRegex + ")",
  1231. push : [{
  1232. token : "text",
  1233. regex : "\\s+"
  1234. },
  1235. {
  1236. token : "punctuation.markup-decl.xml",
  1237. regex : ">",
  1238. next : "pop"
  1239. },
  1240. {include : "string"}]
  1241. }],
  1242. cdata : [
  1243. {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
  1244. {token : "text.xml", regex : "\\s+"},
  1245. {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
  1246. ],
  1247. comment : [
  1248. {token : "comment.end.xml", regex : "-->", next : "start"},
  1249. {defaultToken : "comment.xml"}
  1250. ],
  1251. reference : [{
  1252. token : "constant.language.escape.reference.xml",
  1253. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  1254. }],
  1255. attr_reference : [{
  1256. token : "constant.language.escape.reference.attribute-value.xml",
  1257. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  1258. }],
  1259. tag : [{
  1260. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  1261. regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  1262. next: [
  1263. {include : "attributes"},
  1264. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  1265. ]
  1266. }],
  1267. tag_whitespace : [
  1268. {token : "text.tag-whitespace.xml", regex : "\\s+"}
  1269. ],
  1270. whitespace : [
  1271. {token : "text.whitespace.xml", regex : "\\s+"}
  1272. ],
  1273. string: [{
  1274. token : "string.xml",
  1275. regex : "'",
  1276. push : [
  1277. {token : "string.xml", regex: "'", next: "pop"},
  1278. {defaultToken : "string.xml"}
  1279. ]
  1280. }, {
  1281. token : "string.xml",
  1282. regex : '"',
  1283. push : [
  1284. {token : "string.xml", regex: '"', next: "pop"},
  1285. {defaultToken : "string.xml"}
  1286. ]
  1287. }],
  1288. attributes: [{
  1289. token : "entity.other.attribute-name.xml",
  1290. regex : tagRegex
  1291. }, {
  1292. token : "keyword.operator.attribute-equals.xml",
  1293. regex : "="
  1294. }, {
  1295. include: "tag_whitespace"
  1296. }, {
  1297. include: "attribute_value"
  1298. }],
  1299. attribute_value: [{
  1300. token : "string.attribute-value.xml",
  1301. regex : "'",
  1302. push : [
  1303. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  1304. {include : "attr_reference"},
  1305. {defaultToken : "string.attribute-value.xml"}
  1306. ]
  1307. }, {
  1308. token : "string.attribute-value.xml",
  1309. regex : '"',
  1310. push : [
  1311. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  1312. {include : "attr_reference"},
  1313. {defaultToken : "string.attribute-value.xml"}
  1314. ]
  1315. }]
  1316. };
  1317. if (this.constructor === XmlHighlightRules)
  1318. this.normalizeRules();
  1319. };
  1320. (function() {
  1321. this.embedTagRules = function(HighlightRules, prefix, tag){
  1322. this.$rules.tag.unshift({
  1323. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  1324. regex : "(<)(" + tag + "(?=\\s|>|$))",
  1325. next: [
  1326. {include : "attributes"},
  1327. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
  1328. ]
  1329. });
  1330. this.$rules[tag + "-end"] = [
  1331. {include : "attributes"},
  1332. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
  1333. onMatch : function(value, currentState, stack) {
  1334. stack.splice(0);
  1335. return this.token;
  1336. }}
  1337. ];
  1338. this.embedRules(HighlightRules, prefix, [{
  1339. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  1340. regex : "(</)(" + tag + "(?=\\s|>|$))",
  1341. next: tag + "-end"
  1342. }, {
  1343. token: "string.cdata.xml",
  1344. regex : "<\\!\\[CDATA\\["
  1345. }, {
  1346. token: "string.cdata.xml",
  1347. regex : "\\]\\]>"
  1348. }]);
  1349. };
  1350. }).call(TextHighlightRules.prototype);
  1351. oop.inherits(XmlHighlightRules, TextHighlightRules);
  1352. exports.XmlHighlightRules = XmlHighlightRules;
  1353. });
  1354. 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) {
  1355. "use strict";
  1356. var oop = require("../lib/oop");
  1357. var lang = require("../lib/lang");
  1358. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1359. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1360. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  1361. var tagMap = lang.createMap({
  1362. a : 'anchor',
  1363. button : 'form',
  1364. form : 'form',
  1365. img : 'image',
  1366. input : 'form',
  1367. label : 'form',
  1368. option : 'form',
  1369. script : 'script',
  1370. select : 'form',
  1371. textarea : 'form',
  1372. style : 'style',
  1373. table : 'table',
  1374. tbody : 'table',
  1375. td : 'table',
  1376. tfoot : 'table',
  1377. th : 'table',
  1378. tr : 'table'
  1379. });
  1380. var HtmlHighlightRules = function() {
  1381. XmlHighlightRules.call(this);
  1382. this.addRules({
  1383. attributes: [{
  1384. include : "tag_whitespace"
  1385. }, {
  1386. token : "entity.other.attribute-name.xml",
  1387. regex : "[-_a-zA-Z0-9:.]+"
  1388. }, {
  1389. token : "keyword.operator.attribute-equals.xml",
  1390. regex : "=",
  1391. push : [{
  1392. include: "tag_whitespace"
  1393. }, {
  1394. token : "string.unquoted.attribute-value.html",
  1395. regex : "[^<>='\"`\\s]+",
  1396. next : "pop"
  1397. }, {
  1398. token : "empty",
  1399. regex : "",
  1400. next : "pop"
  1401. }]
  1402. }, {
  1403. include : "attribute_value"
  1404. }],
  1405. tag: [{
  1406. token : function(start, tag) {
  1407. var group = tagMap[tag];
  1408. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  1409. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  1410. },
  1411. regex : "(</?)([-_a-zA-Z0-9:.]+)",
  1412. next: "tag_stuff"
  1413. }],
  1414. tag_stuff: [
  1415. {include : "attributes"},
  1416. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  1417. ]
  1418. });
  1419. this.embedTagRules(CssHighlightRules, "css-", "style");
  1420. this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "js-", "script");
  1421. if (this.constructor === HtmlHighlightRules)
  1422. this.normalizeRules();
  1423. };
  1424. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  1425. exports.HtmlHighlightRules = HtmlHighlightRules;
  1426. });
  1427. define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
  1428. "use strict";
  1429. var oop = require("../../lib/oop");
  1430. var Behaviour = require("../behaviour").Behaviour;
  1431. var TokenIterator = require("../../token_iterator").TokenIterator;
  1432. var lang = require("../../lib/lang");
  1433. function is(token, type) {
  1434. return token && token.type.lastIndexOf(type + ".xml") > -1;
  1435. }
  1436. var XmlBehaviour = function () {
  1437. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  1438. if (text == '"' || text == "'") {
  1439. var quote = text;
  1440. var selected = session.doc.getTextRange(editor.getSelectionRange());
  1441. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  1442. return {
  1443. text: quote + selected + quote,
  1444. selection: false
  1445. };
  1446. }
  1447. var cursor = editor.getCursorPosition();
  1448. var line = session.doc.getLine(cursor.row);
  1449. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1450. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1451. var token = iterator.getCurrentToken();
  1452. if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
  1453. return {
  1454. text: "",
  1455. selection: [1, 1]
  1456. };
  1457. }
  1458. if (!token)
  1459. token = iterator.stepBackward();
  1460. if (!token)
  1461. return;
  1462. while (is(token, "tag-whitespace") || is(token, "whitespace")) {
  1463. token = iterator.stepBackward();
  1464. }
  1465. var rightSpace = !rightChar || rightChar.match(/\s/);
  1466. if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
  1467. return {
  1468. text: quote + quote,
  1469. selection: [1, 1]
  1470. };
  1471. }
  1472. }
  1473. });
  1474. this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
  1475. var selected = session.doc.getTextRange(range);
  1476. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  1477. var line = session.doc.getLine(range.start.row);
  1478. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  1479. if (rightChar == selected) {
  1480. range.end.column++;
  1481. return range;
  1482. }
  1483. }
  1484. });
  1485. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  1486. if (text == '>') {
  1487. var position = editor.getSelectionRange().start;
  1488. var iterator = new TokenIterator(session, position.row, position.column);
  1489. var token = iterator.getCurrentToken() || iterator.stepBackward();
  1490. if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
  1491. return;
  1492. if (is(token, "reference.attribute-value"))
  1493. return;
  1494. if (is(token, "attribute-value")) {
  1495. var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length;
  1496. if (position.column < tokenEndColumn)
  1497. return;
  1498. if (position.column == tokenEndColumn) {
  1499. var nextToken = iterator.stepForward();
  1500. if (nextToken && is(nextToken, "attribute-value"))
  1501. return;
  1502. iterator.stepBackward();
  1503. }
  1504. }
  1505. if (/^\s*>/.test(session.getLine(position.row).slice(position.column)))
  1506. return;
  1507. while (!is(token, "tag-name")) {
  1508. token = iterator.stepBackward();
  1509. if (token.value == "<") {
  1510. token = iterator.stepForward();
  1511. break;
  1512. }
  1513. }
  1514. var tokenRow = iterator.getCurrentTokenRow();
  1515. var tokenColumn = iterator.getCurrentTokenColumn();
  1516. if (is(iterator.stepBackward(), "end-tag-open"))
  1517. return;
  1518. var element = token.value;
  1519. if (tokenRow == position.row)
  1520. element = element.substring(0, position.column - tokenColumn);
  1521. if (this.voidElements.hasOwnProperty(element.toLowerCase()))
  1522. return;
  1523. return {
  1524. text: ">" + "</" + element + ">",
  1525. selection: [1, 1]
  1526. };
  1527. }
  1528. });
  1529. this.add("autoindent", "insertion", function (state, action, editor, session, text) {
  1530. if (text == "\n") {
  1531. var cursor = editor.getCursorPosition();
  1532. var line = session.getLine(cursor.row);
  1533. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1534. var token = iterator.getCurrentToken();
  1535. if (token && token.type.indexOf("tag-close") !== -1) {
  1536. if (token.value == "/>")
  1537. return;
  1538. while (token && token.type.indexOf("tag-name") === -1) {
  1539. token = iterator.stepBackward();
  1540. }
  1541. if (!token) {
  1542. return;
  1543. }
  1544. var tag = token.value;
  1545. var row = iterator.getCurrentTokenRow();
  1546. token = iterator.stepBackward();
  1547. if (!token || token.type.indexOf("end-tag") !== -1) {
  1548. return;
  1549. }
  1550. if (this.voidElements && !this.voidElements[tag]) {
  1551. var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
  1552. var line = session.getLine(row);
  1553. var nextIndent = this.$getIndent(line);
  1554. var indent = nextIndent + session.getTabString();
  1555. if (nextToken && nextToken.value === "</") {
  1556. return {
  1557. text: "\n" + indent + "\n" + nextIndent,
  1558. selection: [1, indent.length, 1, indent.length]
  1559. };
  1560. } else {
  1561. return {
  1562. text: "\n" + indent
  1563. };
  1564. }
  1565. }
  1566. }
  1567. }
  1568. });
  1569. };
  1570. oop.inherits(XmlBehaviour, Behaviour);
  1571. exports.XmlBehaviour = XmlBehaviour;
  1572. });
  1573. define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module) {
  1574. "use strict";
  1575. var oop = require("../../lib/oop");
  1576. var BaseFoldMode = require("./fold_mode").FoldMode;
  1577. var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
  1578. this.defaultMode = defaultMode;
  1579. this.subModes = subModes;
  1580. };
  1581. oop.inherits(FoldMode, BaseFoldMode);
  1582. (function() {
  1583. this.$getMode = function(state) {
  1584. if (typeof state != "string")
  1585. state = state[0];
  1586. for (var key in this.subModes) {
  1587. if (state.indexOf(key) === 0)
  1588. return this.subModes[key];
  1589. }
  1590. return null;
  1591. };
  1592. this.$tryMode = function(state, session, foldStyle, row) {
  1593. var mode = this.$getMode(state);
  1594. return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
  1595. };
  1596. this.getFoldWidget = function(session, foldStyle, row) {
  1597. return (
  1598. this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
  1599. this.$tryMode(session.getState(row), session, foldStyle, row) ||
  1600. this.defaultMode.getFoldWidget(session, foldStyle, row)
  1601. );
  1602. };
  1603. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1604. var mode = this.$getMode(session.getState(row-1));
  1605. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1606. mode = this.$getMode(session.getState(row));
  1607. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1608. mode = this.defaultMode;
  1609. return mode.getFoldWidgetRange(session, foldStyle, row);
  1610. };
  1611. }).call(FoldMode.prototype);
  1612. });
  1613. 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) {
  1614. "use strict";
  1615. var oop = require("../../lib/oop");
  1616. var lang = require("../../lib/lang");
  1617. var Range = require("../../range").Range;
  1618. var BaseFoldMode = require("./fold_mode").FoldMode;
  1619. var TokenIterator = require("../../token_iterator").TokenIterator;
  1620. var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
  1621. BaseFoldMode.call(this);
  1622. this.voidElements = voidElements || {};
  1623. this.optionalEndTags = oop.mixin({}, this.voidElements);
  1624. if (optionalEndTags)
  1625. oop.mixin(this.optionalEndTags, optionalEndTags);
  1626. };
  1627. oop.inherits(FoldMode, BaseFoldMode);
  1628. var Tag = function() {
  1629. this.tagName = "";
  1630. this.closing = false;
  1631. this.selfClosing = false;
  1632. this.start = {row: 0, column: 0};
  1633. this.end = {row: 0, column: 0};
  1634. };
  1635. function is(token, type) {
  1636. return token.type.lastIndexOf(type + ".xml") > -1;
  1637. }
  1638. (function() {
  1639. this.getFoldWidget = function(session, foldStyle, row) {
  1640. var tag = this._getFirstTagInLine(session, row);
  1641. if (!tag)
  1642. return this.getCommentFoldWidget(session, row);
  1643. if (tag.closing || (!tag.tagName && tag.selfClosing))
  1644. return foldStyle == "markbeginend" ? "end" : "";
  1645. if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
  1646. return "";
  1647. if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
  1648. return "";
  1649. return "start";
  1650. };
  1651. this.getCommentFoldWidget = function(session, row) {
  1652. if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
  1653. return "start";
  1654. return "";
  1655. };
  1656. this._getFirstTagInLine = function(session, row) {
  1657. var tokens = session.getTokens(row);
  1658. var tag = new Tag();
  1659. for (var i = 0; i < tokens.length; i++) {
  1660. var token = tokens[i];
  1661. if (is(token, "tag-open")) {
  1662. tag.end.column = tag.start.column + token.value.length;
  1663. tag.closing = is(token, "end-tag-open");
  1664. token = tokens[++i];
  1665. if (!token)
  1666. return null;
  1667. tag.tagName = token.value;
  1668. tag.end.column += token.value.length;
  1669. for (i++; i < tokens.length; i++) {
  1670. token = tokens[i];
  1671. tag.end.column += token.value.length;
  1672. if (is(token, "tag-close")) {
  1673. tag.selfClosing = token.value == '/>';
  1674. break;
  1675. }
  1676. }
  1677. return tag;
  1678. } else if (is(token, "tag-close")) {
  1679. tag.selfClosing = token.value == '/>';
  1680. return tag;
  1681. }
  1682. tag.start.column += token.value.length;
  1683. }
  1684. return null;
  1685. };
  1686. this._findEndTagInLine = function(session, row, tagName, startColumn) {
  1687. var tokens = session.getTokens(row);
  1688. var column = 0;
  1689. for (var i = 0; i < tokens.length; i++) {
  1690. var token = tokens[i];
  1691. column += token.value.length;
  1692. if (column < startColumn)
  1693. continue;
  1694. if (is(token, "end-tag-open")) {
  1695. token = tokens[i + 1];
  1696. if (token && token.value == tagName)
  1697. return true;
  1698. }
  1699. }
  1700. return false;
  1701. };
  1702. this._readTagForward = function(iterator) {
  1703. var token = iterator.getCurrentToken();
  1704. if (!token)
  1705. return null;
  1706. var tag = new Tag();
  1707. do {
  1708. if (is(token, "tag-open")) {
  1709. tag.closing = is(token, "end-tag-open");
  1710. tag.start.row = iterator.getCurrentTokenRow();
  1711. tag.start.column = iterator.getCurrentTokenColumn();
  1712. } else if (is(token, "tag-name")) {
  1713. tag.tagName = token.value;
  1714. } else if (is(token, "tag-close")) {
  1715. tag.selfClosing = token.value == "/>";
  1716. tag.end.row = iterator.getCurrentTokenRow();
  1717. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1718. iterator.stepForward();
  1719. return tag;
  1720. }
  1721. } while(token = iterator.stepForward());
  1722. return null;
  1723. };
  1724. this._readTagBackward = function(iterator) {
  1725. var token = iterator.getCurrentToken();
  1726. if (!token)
  1727. return null;
  1728. var tag = new Tag();
  1729. do {
  1730. if (is(token, "tag-open")) {
  1731. tag.closing = is(token, "end-tag-open");
  1732. tag.start.row = iterator.getCurrentTokenRow();
  1733. tag.start.column = iterator.getCurrentTokenColumn();
  1734. iterator.stepBackward();
  1735. return tag;
  1736. } else if (is(token, "tag-name")) {
  1737. tag.tagName = token.value;
  1738. } else if (is(token, "tag-close")) {
  1739. tag.selfClosing = token.value == "/>";
  1740. tag.end.row = iterator.getCurrentTokenRow();
  1741. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1742. }
  1743. } while(token = iterator.stepBackward());
  1744. return null;
  1745. };
  1746. this._pop = function(stack, tag) {
  1747. while (stack.length) {
  1748. var top = stack[stack.length-1];
  1749. if (!tag || top.tagName == tag.tagName) {
  1750. return stack.pop();
  1751. }
  1752. else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
  1753. stack.pop();
  1754. continue;
  1755. } else {
  1756. return null;
  1757. }
  1758. }
  1759. };
  1760. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1761. var firstTag = this._getFirstTagInLine(session, row);
  1762. if (!firstTag) {
  1763. return this.getCommentFoldWidget(session, row)
  1764. && session.getCommentFoldRange(row, session.getLine(row).length);
  1765. }
  1766. var isBackward = firstTag.closing || firstTag.selfClosing;
  1767. var stack = [];
  1768. var tag;
  1769. if (!isBackward) {
  1770. var iterator = new TokenIterator(session, row, firstTag.start.column);
  1771. var start = {
  1772. row: row,
  1773. column: firstTag.start.column + firstTag.tagName.length + 2
  1774. };
  1775. if (firstTag.start.row == firstTag.end.row)
  1776. start.column = firstTag.end.column;
  1777. while (tag = this._readTagForward(iterator)) {
  1778. if (tag.selfClosing) {
  1779. if (!stack.length) {
  1780. tag.start.column += tag.tagName.length + 2;
  1781. tag.end.column -= 2;
  1782. return Range.fromPoints(tag.start, tag.end);
  1783. } else
  1784. continue;
  1785. }
  1786. if (tag.closing) {
  1787. this._pop(stack, tag);
  1788. if (stack.length == 0)
  1789. return Range.fromPoints(start, tag.start);
  1790. }
  1791. else {
  1792. stack.push(tag);
  1793. }
  1794. }
  1795. }
  1796. else {
  1797. var iterator = new TokenIterator(session, row, firstTag.end.column);
  1798. var end = {
  1799. row: row,
  1800. column: firstTag.start.column
  1801. };
  1802. while (tag = this._readTagBackward(iterator)) {
  1803. if (tag.selfClosing) {
  1804. if (!stack.length) {
  1805. tag.start.column += tag.tagName.length + 2;
  1806. tag.end.column -= 2;
  1807. return Range.fromPoints(tag.start, tag.end);
  1808. } else
  1809. continue;
  1810. }
  1811. if (!tag.closing) {
  1812. this._pop(stack, tag);
  1813. if (stack.length == 0) {
  1814. tag.start.column += tag.tagName.length + 2;
  1815. if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
  1816. tag.start.column = tag.end.column;
  1817. return Range.fromPoints(tag.start, end);
  1818. }
  1819. }
  1820. else {
  1821. stack.push(tag);
  1822. }
  1823. }
  1824. }
  1825. };
  1826. }).call(FoldMode.prototype);
  1827. });
  1828. 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) {
  1829. "use strict";
  1830. var oop = require("../../lib/oop");
  1831. var MixedFoldMode = require("./mixed").FoldMode;
  1832. var XmlFoldMode = require("./xml").FoldMode;
  1833. var CStyleFoldMode = require("./cstyle").FoldMode;
  1834. var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
  1835. MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
  1836. "js-": new CStyleFoldMode(),
  1837. "css-": new CStyleFoldMode()
  1838. });
  1839. };
  1840. oop.inherits(FoldMode, MixedFoldMode);
  1841. });
  1842. define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module) {
  1843. "use strict";
  1844. var TokenIterator = require("../token_iterator").TokenIterator;
  1845. var commonAttributes = [
  1846. "accesskey",
  1847. "class",
  1848. "contenteditable",
  1849. "contextmenu",
  1850. "dir",
  1851. "draggable",
  1852. "dropzone",
  1853. "hidden",
  1854. "id",
  1855. "inert",
  1856. "itemid",
  1857. "itemprop",
  1858. "itemref",
  1859. "itemscope",
  1860. "itemtype",
  1861. "lang",
  1862. "spellcheck",
  1863. "style",
  1864. "tabindex",
  1865. "title",
  1866. "translate"
  1867. ];
  1868. var eventAttributes = [
  1869. "onabort",
  1870. "onblur",
  1871. "oncancel",
  1872. "oncanplay",
  1873. "oncanplaythrough",
  1874. "onchange",
  1875. "onclick",
  1876. "onclose",
  1877. "oncontextmenu",
  1878. "oncuechange",
  1879. "ondblclick",
  1880. "ondrag",
  1881. "ondragend",
  1882. "ondragenter",
  1883. "ondragleave",
  1884. "ondragover",
  1885. "ondragstart",
  1886. "ondrop",
  1887. "ondurationchange",
  1888. "onemptied",
  1889. "onended",
  1890. "onerror",
  1891. "onfocus",
  1892. "oninput",
  1893. "oninvalid",
  1894. "onkeydown",
  1895. "onkeypress",
  1896. "onkeyup",
  1897. "onload",
  1898. "onloadeddata",
  1899. "onloadedmetadata",
  1900. "onloadstart",
  1901. "onmousedown",
  1902. "onmousemove",
  1903. "onmouseout",
  1904. "onmouseover",
  1905. "onmouseup",
  1906. "onmousewheel",
  1907. "onpause",
  1908. "onplay",
  1909. "onplaying",
  1910. "onprogress",
  1911. "onratechange",
  1912. "onreset",
  1913. "onscroll",
  1914. "onseeked",
  1915. "onseeking",
  1916. "onselect",
  1917. "onshow",
  1918. "onstalled",
  1919. "onsubmit",
  1920. "onsuspend",
  1921. "ontimeupdate",
  1922. "onvolumechange",
  1923. "onwaiting"
  1924. ];
  1925. var globalAttributes = commonAttributes.concat(eventAttributes);
  1926. var attributeMap = {
  1927. "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},
  1928. "abbr": {},
  1929. "address": {},
  1930. "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1},
  1931. "article": {"pubdate": 1},
  1932. "aside": {},
  1933. "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }},
  1934. "b": {},
  1935. "base": {"href": 1, "target": 1},
  1936. "bdi": {},
  1937. "bdo": {},
  1938. "blockquote": {"cite": 1},
  1939. "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},
  1940. "br": {},
  1941. "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}},
  1942. "canvas": {"width": 1, "height": 1},
  1943. "caption": {},
  1944. "cite": {},
  1945. "code": {},
  1946. "col": {"span": 1},
  1947. "colgroup": {"span": 1},
  1948. "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1},
  1949. "data": {},
  1950. "datalist": {},
  1951. "dd": {},
  1952. "del": {"cite": 1, "datetime": 1},
  1953. "details": {"open": 1},
  1954. "dfn": {},
  1955. "dialog": {"open": 1},
  1956. "div": {},
  1957. "dl": {},
  1958. "dt": {},
  1959. "em": {},
  1960. "embed": {"src": 1, "height": 1, "width": 1, "type": 1},
  1961. "fieldset": {"disabled": 1, "form": 1, "name": 1},
  1962. "figcaption": {},
  1963. "figure": {},
  1964. "footer": {},
  1965. "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}},
  1966. "h1": {},
  1967. "h2": {},
  1968. "h3": {},
  1969. "h4": {},
  1970. "h5": {},
  1971. "h6": {},
  1972. "head": {},
  1973. "header": {},
  1974. "hr": {},
  1975. "html": {"manifest": 1},
  1976. "i": {},
  1977. "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}},
  1978. "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1},
  1979. "input": {
  1980. "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},
  1981. "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},
  1982. "ins": {"cite": 1, "datetime": 1},
  1983. "kbd": {},
  1984. "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1},
  1985. "label": {"form": 1, "for": 1},
  1986. "legend": {},
  1987. "li": {"value": 1},
  1988. "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},
  1989. "main": {},
  1990. "map": {"name": 1},
  1991. "mark": {},
  1992. "math": {},
  1993. "menu": {"type": 1, "label": 1},
  1994. "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1},
  1995. "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1},
  1996. "nav": {},
  1997. "noscript": {"href": 1},
  1998. "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1},
  1999. "ol": {"start": 1, "reversed": 1},
  2000. "optgroup": {"disabled": 1, "label": 1},
  2001. "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1},
  2002. "output": {"for": 1, "form": 1, "name": 1},
  2003. "p": {},
  2004. "param": {"name": 1, "value": 1},
  2005. "pre": {},
  2006. "progress": {"value": 1, "max": 1},
  2007. "q": {"cite": 1},
  2008. "rp": {},
  2009. "rt": {},
  2010. "ruby": {},
  2011. "s": {},
  2012. "samp": {},
  2013. "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1},
  2014. "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}},
  2015. "small": {},
  2016. "source": {"src": 1, "type": 1, "media": 1},
  2017. "span": {},
  2018. "strong": {},
  2019. "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1},
  2020. "sub": {},
  2021. "sup": {},
  2022. "svg": {},
  2023. "table": {"summary": 1},
  2024. "tbody": {},
  2025. "td": {"headers": 1, "rowspan": 1, "colspan": 1},
  2026. "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}},
  2027. "tfoot": {},
  2028. "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1},
  2029. "thead": {},
  2030. "time": {"datetime": 1},
  2031. "title": {},
  2032. "tr": {},
  2033. "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1},
  2034. "section": {},
  2035. "summary": {},
  2036. "u": {},
  2037. "ul": {},
  2038. "var": {},
  2039. "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}},
  2040. "wbr": {}
  2041. };
  2042. var elements = Object.keys(attributeMap);
  2043. function is(token, type) {
  2044. return token.type.lastIndexOf(type + ".xml") > -1;
  2045. }
  2046. function findTagName(session, pos) {
  2047. var iterator = new TokenIterator(session, pos.row, pos.column);
  2048. var token = iterator.getCurrentToken();
  2049. while (token && !is(token, "tag-name")){
  2050. token = iterator.stepBackward();
  2051. }
  2052. if (token)
  2053. return token.value;
  2054. }
  2055. function findAttributeName(session, pos) {
  2056. var iterator = new TokenIterator(session, pos.row, pos.column);
  2057. var token = iterator.getCurrentToken();
  2058. while (token && !is(token, "attribute-name")){
  2059. token = iterator.stepBackward();
  2060. }
  2061. if (token)
  2062. return token.value;
  2063. }
  2064. var HtmlCompletions = function() {
  2065. };
  2066. (function() {
  2067. this.getCompletions = function(state, session, pos, prefix) {
  2068. var token = session.getTokenAt(pos.row, pos.column);
  2069. if (!token)
  2070. return [];
  2071. if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
  2072. return this.getTagCompletions(state, session, pos, prefix);
  2073. if (is(token, "tag-whitespace") || is(token, "attribute-name"))
  2074. return this.getAttributeCompletions(state, session, pos, prefix);
  2075. if (is(token, "attribute-value"))
  2076. return this.getAttributeValueCompletions(state, session, pos, prefix);
  2077. var line = session.getLine(pos.row).substr(0, pos.column);
  2078. if (/&[a-z]*$/i.test(line))
  2079. return this.getHTMLEntityCompletions(state, session, pos, prefix);
  2080. return [];
  2081. };
  2082. this.getTagCompletions = function(state, session, pos, prefix) {
  2083. return elements.map(function(element){
  2084. return {
  2085. value: element,
  2086. meta: "tag",
  2087. score: 1000000
  2088. };
  2089. });
  2090. };
  2091. this.getAttributeCompletions = function(state, session, pos, prefix) {
  2092. var tagName = findTagName(session, pos);
  2093. if (!tagName)
  2094. return [];
  2095. var attributes = globalAttributes;
  2096. if (tagName in attributeMap) {
  2097. attributes = attributes.concat(Object.keys(attributeMap[tagName]));
  2098. }
  2099. return attributes.map(function(attribute){
  2100. return {
  2101. caption: attribute,
  2102. snippet: attribute + '="$0"',
  2103. meta: "attribute",
  2104. score: 1000000
  2105. };
  2106. });
  2107. };
  2108. this.getAttributeValueCompletions = function(state, session, pos, prefix) {
  2109. var tagName = findTagName(session, pos);
  2110. var attributeName = findAttributeName(session, pos);
  2111. if (!tagName)
  2112. return [];
  2113. var values = [];
  2114. if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
  2115. values = Object.keys(attributeMap[tagName][attributeName]);
  2116. }
  2117. return values.map(function(value){
  2118. return {
  2119. caption: value,
  2120. snippet: value,
  2121. meta: "attribute value",
  2122. score: 1000000
  2123. };
  2124. });
  2125. };
  2126. this.getHTMLEntityCompletions = function(state, session, pos, prefix) {
  2127. 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;'];
  2128. return values.map(function(value){
  2129. return {
  2130. caption: value,
  2131. snippet: value,
  2132. meta: "html entity",
  2133. score: 1000000
  2134. };
  2135. });
  2136. };
  2137. }).call(HtmlCompletions.prototype);
  2138. exports.HtmlCompletions = HtmlCompletions;
  2139. });
  2140. 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) {
  2141. "use strict";
  2142. var oop = require("../lib/oop");
  2143. var lang = require("../lib/lang");
  2144. var TextMode = require("./text").Mode;
  2145. var JavaScriptMode = require("./javascript").Mode;
  2146. var CssMode = require("./css").Mode;
  2147. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2148. var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
  2149. var HtmlFoldMode = require("./folding/html").FoldMode;
  2150. var HtmlCompletions = require("./html_completions").HtmlCompletions;
  2151. var WorkerClient = require("../worker/worker_client").WorkerClient;
  2152. var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
  2153. var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
  2154. var Mode = function(options) {
  2155. this.fragmentContext = options && options.fragmentContext;
  2156. this.HighlightRules = HtmlHighlightRules;
  2157. this.$behaviour = new XmlBehaviour();
  2158. this.$completer = new HtmlCompletions();
  2159. this.createModeDelegates({
  2160. "js-": JavaScriptMode,
  2161. "css-": CssMode
  2162. });
  2163. this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
  2164. };
  2165. oop.inherits(Mode, TextMode);
  2166. (function() {
  2167. this.blockComment = {start: "<!--", end: "-->"};
  2168. this.voidElements = lang.arrayToMap(voidElements);
  2169. this.getNextLineIndent = function(state, line, tab) {
  2170. return this.$getIndent(line);
  2171. };
  2172. this.checkOutdent = function(state, line, input) {
  2173. return false;
  2174. };
  2175. this.getCompletions = function(state, session, pos, prefix) {
  2176. return this.$completer.getCompletions(state, session, pos, prefix);
  2177. };
  2178. this.createWorker = function(session) {
  2179. if (this.constructor != Mode)
  2180. return;
  2181. var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
  2182. worker.attachToDocument(session.getDocument());
  2183. if (this.fragmentContext)
  2184. worker.call("setOptions", [{context: this.fragmentContext}]);
  2185. worker.on("error", function(e) {
  2186. session.setAnnotations(e.data);
  2187. });
  2188. worker.on("terminate", function() {
  2189. session.clearAnnotations();
  2190. });
  2191. return worker;
  2192. };
  2193. this.$id = "ace/mode/html";
  2194. }).call(Mode.prototype);
  2195. exports.Mode = Mode;
  2196. });
  2197. define("ace/mode/handlebars_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/html_highlight_rules"], function(require, exports, module) {
  2198. "use strict";
  2199. var oop = require("../lib/oop");
  2200. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2201. function pop2(currentState, stack) {
  2202. stack.splice(0, 3);
  2203. return stack.shift() || "start";
  2204. }
  2205. var HandlebarsHighlightRules = function() {
  2206. HtmlHighlightRules.call(this);
  2207. var hbs = {
  2208. regex : "(?={{)",
  2209. push : "handlebars"
  2210. };
  2211. for (var key in this.$rules) {
  2212. this.$rules[key].unshift(hbs);
  2213. }
  2214. this.$rules.handlebars = [{
  2215. token : "comment.start",
  2216. regex : "{{!--",
  2217. push : [{
  2218. token : "comment.end",
  2219. regex : "--}}",
  2220. next : pop2
  2221. }, {
  2222. defaultToken : "comment"
  2223. }]
  2224. }, {
  2225. token : "comment.start",
  2226. regex : "{{!",
  2227. push : [{
  2228. token : "comment.end",
  2229. regex : "}}",
  2230. next : pop2
  2231. }, {
  2232. defaultToken : "comment"
  2233. }]
  2234. }, {
  2235. token : "support.function", // unescaped variable
  2236. regex : "{{{",
  2237. push : [{
  2238. token : "support.function",
  2239. regex : "}}}",
  2240. next : pop2
  2241. }, {
  2242. token : "variable.parameter",
  2243. regex : "[a-zA-Z_$][a-zA-Z0-9_$]*"
  2244. }]
  2245. }, {
  2246. token : "storage.type.start", // begin section
  2247. regex : "{{[#\\^/&]?",
  2248. push : [{
  2249. token : "storage.type.end",
  2250. regex : "}}",
  2251. next : pop2
  2252. }, {
  2253. token : "variable.parameter",
  2254. regex : "[a-zA-Z_$][a-zA-Z0-9_$]*"
  2255. }]
  2256. }];
  2257. this.normalizeRules();
  2258. };
  2259. oop.inherits(HandlebarsHighlightRules, HtmlHighlightRules);
  2260. exports.HandlebarsHighlightRules = HandlebarsHighlightRules;
  2261. });
  2262. define("ace/mode/behaviour/html",["require","exports","module","ace/lib/oop","ace/mode/behaviour/xml"], function(require, exports, module) {
  2263. "use strict";
  2264. var oop = require("../../lib/oop");
  2265. var XmlBehaviour = require("../behaviour/xml").XmlBehaviour;
  2266. var HtmlBehaviour = function () {
  2267. XmlBehaviour.call(this);
  2268. };
  2269. oop.inherits(HtmlBehaviour, XmlBehaviour);
  2270. exports.HtmlBehaviour = HtmlBehaviour;
  2271. });
  2272. define("ace/mode/handlebars",["require","exports","module","ace/lib/oop","ace/mode/html","ace/mode/handlebars_highlight_rules","ace/mode/behaviour/html","ace/mode/folding/html"], function(require, exports, module) {
  2273. "use strict";
  2274. var oop = require("../lib/oop");
  2275. var HtmlMode = require("./html").Mode;
  2276. var HandlebarsHighlightRules = require("./handlebars_highlight_rules").HandlebarsHighlightRules;
  2277. var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour;
  2278. var HtmlFoldMode = require("./folding/html").FoldMode;
  2279. var Mode = function() {
  2280. HtmlMode.call(this);
  2281. this.HighlightRules = HandlebarsHighlightRules;
  2282. this.$behaviour = new HtmlBehaviour();
  2283. };
  2284. oop.inherits(Mode, HtmlMode);
  2285. (function() {
  2286. this.blockComment = {start: "{{!--", end: "--}}"};
  2287. this.$id = "ace/mode/handlebars";
  2288. }).call(Mode.prototype);
  2289. exports.Mode = Mode;
  2290. });
  2291. (function() {
  2292. window.require(["ace/mode/handlebars"], function(m) {
  2293. if (typeof module == "object" && typeof exports == "object" && module) {
  2294. module.exports = m;
  2295. }
  2296. });
  2297. })();