048ff91dafaa6f7895760c219bb772d5.js 124 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836
  1. ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  2. var oop = require("../lib/oop");
  3. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  4. var DocCommentHighlightRules = function () {
  5. this.$rules = {
  6. "start": [{
  7. token: "comment.doc.tag",
  8. regex: "@[\\w\\d_]+" // TODO: fix email addresses
  9. },
  10. DocCommentHighlightRules.getTagRule(),
  11. {
  12. defaultToken: "comment.doc",
  13. caseInsensitive: true
  14. }]
  15. };
  16. };
  17. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  18. DocCommentHighlightRules.getTagRule = function (start) {
  19. return {
  20. token: "comment.doc.tag.storage.type",
  21. regex: "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  22. };
  23. };
  24. DocCommentHighlightRules.getStartRule = function (start) {
  25. return {
  26. token: "comment.doc",
  27. regex: "\\/\\*(?=\\*)",
  28. next: start
  29. };
  30. };
  31. DocCommentHighlightRules.getEndRule = function (start) {
  32. return {
  33. token: "comment.doc",
  34. regex: "\\*\\/",
  35. next: start
  36. };
  37. };
  38. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  39. });
  40. ace.define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  41. var oop = require("../lib/oop");
  42. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  43. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  44. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
  45. var JavaScriptHighlightRules = function (options) {
  46. var keywordMapper = this.createKeywordMapper({
  47. "variable.language": "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
  48. "Namespace|QName|XML|XMLList|" + // E4X
  49. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  50. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  51. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
  52. "SyntaxError|TypeError|URIError|" +
  53. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
  54. "isNaN|parseFloat|parseInt|" +
  55. "JSON|Math|" + // Other
  56. "this|arguments|prototype|window|document",
  57. "keyword": "const|yield|import|get|set|async|await|" +
  58. "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  59. "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  60. "__parent__|__count__|escape|unescape|with|__proto__|" +
  61. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
  62. "storage.type": "const|let|var|function",
  63. "constant.language": "null|Infinity|NaN|undefined",
  64. "support.function": "alert",
  65. "constant.language.boolean": "true|false"
  66. }, "identifier");
  67. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
  68. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  69. "u[0-9a-fA-F]{4}|" + // unicode
  70. "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
  71. "[0-2][0-7]{0,2}|" + // oct
  72. "3[0-7][0-7]?|" + // oct
  73. "[4-7][0-7]?|" + //oct
  74. ".)";
  75. this.$rules = {
  76. "no_regex": [
  77. DocCommentHighlightRules.getStartRule("doc-start"),
  78. comments("no_regex"),
  79. {
  80. token: "string",
  81. regex: "'(?=.)",
  82. next: "qstring"
  83. }, {
  84. token: "string",
  85. regex: '"(?=.)',
  86. next: "qqstring"
  87. }, {
  88. token: "constant.numeric",
  89. regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
  90. }, {
  91. token: "constant.numeric",
  92. regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
  93. }, {
  94. token: [
  95. "storage.type", "punctuation.operator", "support.function",
  96. "punctuation.operator", "entity.name.function", "text", "keyword.operator"
  97. ],
  98. regex: "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe + ")(\\s*)(=)",
  99. next: "function_arguments"
  100. }, {
  101. token: [
  102. "storage.type", "punctuation.operator", "entity.name.function", "text",
  103. "keyword.operator", "text", "storage.type", "text", "paren.lparen"
  104. ],
  105. regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  106. next: "function_arguments"
  107. }, {
  108. token: [
  109. "entity.name.function", "text", "keyword.operator", "text", "storage.type",
  110. "text", "paren.lparen"
  111. ],
  112. regex: "(" + identifierRe + ")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  113. next: "function_arguments"
  114. }, {
  115. token: [
  116. "storage.type", "punctuation.operator", "entity.name.function", "text",
  117. "keyword.operator", "text",
  118. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  119. ],
  120. regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
  121. next: "function_arguments"
  122. }, {
  123. token: [
  124. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  125. ],
  126. regex: "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
  127. next: "function_arguments"
  128. }, {
  129. token: [
  130. "entity.name.function", "text", "punctuation.operator",
  131. "text", "storage.type", "text", "paren.lparen"
  132. ],
  133. regex: "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
  134. next: "function_arguments"
  135. }, {
  136. token: [
  137. "text", "text", "storage.type", "text", "paren.lparen"
  138. ],
  139. regex: "(:)(\\s*)(function)(\\s*)(\\()",
  140. next: "function_arguments"
  141. }, {
  142. token: "keyword",
  143. regex: "from(?=\\s*('|\"))"
  144. }, {
  145. token: "keyword",
  146. regex: "(?:" + kwBeforeRe + ")\\b",
  147. next: "start"
  148. }, {
  149. token: ["support.constant"],
  150. regex: /that\b/
  151. }, {
  152. token: ["storage.type", "punctuation.operator", "support.function.firebug"],
  153. regex: /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
  154. }, {
  155. token: keywordMapper,
  156. regex: identifierRe
  157. }, {
  158. token: "punctuation.operator",
  159. regex: /[.](?![.])/,
  160. next: "property"
  161. }, {
  162. token: "storage.type",
  163. regex: /=>/,
  164. next: "start"
  165. }, {
  166. token: "keyword.operator",
  167. regex: /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
  168. next: "start"
  169. }, {
  170. token: "punctuation.operator",
  171. regex: /[?:,;.]/,
  172. next: "start"
  173. }, {
  174. token: "paren.lparen",
  175. regex: /[\[({]/,
  176. next: "start"
  177. }, {
  178. token: "paren.rparen",
  179. regex: /[\])}]/
  180. }, {
  181. token: "comment",
  182. regex: /^#!.*$/
  183. }
  184. ],
  185. property: [{
  186. token: "text",
  187. regex: "\\s+"
  188. }, {
  189. token: [
  190. "storage.type", "punctuation.operator", "entity.name.function", "text",
  191. "keyword.operator", "text",
  192. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  193. ],
  194. regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
  195. next: "function_arguments"
  196. }, {
  197. token: "punctuation.operator",
  198. regex: /[.](?![.])/
  199. }, {
  200. token: "support.function",
  201. regex: /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
  202. }, {
  203. token: "support.function.dom",
  204. regex: /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
  205. }, {
  206. token: "support.constant",
  207. regex: /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
  208. }, {
  209. token: "identifier",
  210. regex: identifierRe
  211. }, {
  212. regex: "",
  213. token: "empty",
  214. next: "no_regex"
  215. }
  216. ],
  217. "start": [
  218. DocCommentHighlightRules.getStartRule("doc-start"),
  219. comments("start"),
  220. {
  221. token: "string.regexp",
  222. regex: "\\/",
  223. next: "regex"
  224. }, {
  225. token: "text",
  226. regex: "\\s+|^$",
  227. next: "start"
  228. }, {
  229. token: "empty",
  230. regex: "",
  231. next: "no_regex"
  232. }
  233. ],
  234. "regex": [
  235. {
  236. token: "regexp.keyword.operator",
  237. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  238. }, {
  239. token: "string.regexp",
  240. regex: "/[sxngimy]*",
  241. next: "no_regex"
  242. }, {
  243. token: "invalid",
  244. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  245. }, {
  246. token: "constant.language.escape",
  247. regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  248. }, {
  249. token: "constant.language.delimiter",
  250. regex: /\|/
  251. }, {
  252. token: "constant.language.escape",
  253. regex: /\[\^?/,
  254. next: "regex_character_class"
  255. }, {
  256. token: "empty",
  257. regex: "$",
  258. next: "no_regex"
  259. }, {
  260. defaultToken: "string.regexp"
  261. }
  262. ],
  263. "regex_character_class": [
  264. {
  265. token: "regexp.charclass.keyword.operator",
  266. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  267. }, {
  268. token: "constant.language.escape",
  269. regex: "]",
  270. next: "regex"
  271. }, {
  272. token: "constant.language.escape",
  273. regex: "-"
  274. }, {
  275. token: "empty",
  276. regex: "$",
  277. next: "no_regex"
  278. }, {
  279. defaultToken: "string.regexp.charachterclass"
  280. }
  281. ],
  282. "function_arguments": [
  283. {
  284. token: "variable.parameter",
  285. regex: identifierRe
  286. }, {
  287. token: "punctuation.operator",
  288. regex: "[, ]+"
  289. }, {
  290. token: "punctuation.operator",
  291. regex: "$"
  292. }, {
  293. token: "empty",
  294. regex: "",
  295. next: "no_regex"
  296. }
  297. ],
  298. "qqstring": [
  299. {
  300. token: "constant.language.escape",
  301. regex: escapedRe
  302. }, {
  303. token: "string",
  304. regex: "\\\\$",
  305. consumeLineEnd: true
  306. }, {
  307. token: "string",
  308. regex: '"|$',
  309. next: "no_regex"
  310. }, {
  311. defaultToken: "string"
  312. }
  313. ],
  314. "qstring": [
  315. {
  316. token: "constant.language.escape",
  317. regex: escapedRe
  318. }, {
  319. token: "string",
  320. regex: "\\\\$",
  321. consumeLineEnd: true
  322. }, {
  323. token: "string",
  324. regex: "'|$",
  325. next: "no_regex"
  326. }, {
  327. defaultToken: "string"
  328. }
  329. ]
  330. };
  331. if (!options || !options.noES6) {
  332. this.$rules.no_regex.unshift({
  333. regex: "[{}]", onMatch: function (val, state, stack) {
  334. this.next = val == "{" ? this.nextState : "";
  335. if (val == "{" && stack.length) {
  336. stack.unshift("start", state);
  337. }
  338. else if (val == "}" && stack.length) {
  339. stack.shift();
  340. this.next = stack.shift();
  341. if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
  342. return "paren.quasi.end";
  343. }
  344. return val == "{" ? "paren.lparen" : "paren.rparen";
  345. },
  346. nextState: "start"
  347. }, {
  348. token: "string.quasi.start",
  349. regex: /`/,
  350. push: [{
  351. token: "constant.language.escape",
  352. regex: escapedRe
  353. }, {
  354. token: "paren.quasi.start",
  355. regex: /\${/,
  356. push: "start"
  357. }, {
  358. token: "string.quasi.end",
  359. regex: /`/,
  360. next: "pop"
  361. }, {
  362. defaultToken: "string.quasi"
  363. }]
  364. });
  365. if (!options || options.jsx != false)
  366. JSX.call(this);
  367. }
  368. this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("no_regex")]);
  369. this.normalizeRules();
  370. };
  371. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  372. function JSX() {
  373. var tagRegex = identifierRe.replace("\\d", "\\d\\-");
  374. var jsxTag = {
  375. onMatch: function (val, state, stack) {
  376. var offset = val.charAt(1) == "/" ? 2 : 1;
  377. if (offset == 1) {
  378. if (state != this.nextState)
  379. stack.unshift(this.next, this.nextState, 0);
  380. else
  381. stack.unshift(this.next);
  382. stack[2]++;
  383. }
  384. else if (offset == 2) {
  385. if (state == this.nextState) {
  386. stack[1]--;
  387. if (!stack[1] || stack[1] < 0) {
  388. stack.shift();
  389. stack.shift();
  390. }
  391. }
  392. }
  393. return [{
  394. type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
  395. value: val.slice(0, offset)
  396. }, {
  397. type: "meta.tag.tag-name.xml",
  398. value: val.substr(offset)
  399. }];
  400. },
  401. regex: "</?" + tagRegex + "",
  402. next: "jsxAttributes",
  403. nextState: "jsx"
  404. };
  405. this.$rules.start.unshift(jsxTag);
  406. var jsxJsRule = {
  407. regex: "{",
  408. token: "paren.quasi.start",
  409. push: "start"
  410. };
  411. this.$rules.jsx = [
  412. jsxJsRule,
  413. jsxTag,
  414. { include: "reference" },
  415. { defaultToken: "string" }
  416. ];
  417. this.$rules.jsxAttributes = [{
  418. token: "meta.tag.punctuation.tag-close.xml",
  419. regex: "/?>",
  420. onMatch: function (value, currentState, stack) {
  421. if (currentState == stack[0])
  422. stack.shift();
  423. if (value.length == 2) {
  424. if (stack[0] == this.nextState)
  425. stack[1]--;
  426. if (!stack[1] || stack[1] < 0) {
  427. stack.splice(0, 2);
  428. }
  429. }
  430. this.next = stack[0] || "start";
  431. return [{ type: this.token, value: value }];
  432. },
  433. nextState: "jsx"
  434. },
  435. jsxJsRule,
  436. comments("jsxAttributes"),
  437. {
  438. token: "entity.other.attribute-name.xml",
  439. regex: tagRegex
  440. }, {
  441. token: "keyword.operator.attribute-equals.xml",
  442. regex: "="
  443. }, {
  444. token: "text.tag-whitespace.xml",
  445. regex: "\\s+"
  446. }, {
  447. token: "string.attribute-value.xml",
  448. regex: "'",
  449. stateName: "jsx_attr_q",
  450. push: [
  451. { token: "string.attribute-value.xml", regex: "'", next: "pop" },
  452. { include: "reference" },
  453. { defaultToken: "string.attribute-value.xml" }
  454. ]
  455. }, {
  456. token: "string.attribute-value.xml",
  457. regex: '"',
  458. stateName: "jsx_attr_qq",
  459. push: [
  460. { token: "string.attribute-value.xml", regex: '"', next: "pop" },
  461. { include: "reference" },
  462. { defaultToken: "string.attribute-value.xml" }
  463. ]
  464. },
  465. jsxTag
  466. ];
  467. this.$rules.reference = [{
  468. token: "constant.language.escape.reference.xml",
  469. regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  470. }];
  471. }
  472. function comments(next) {
  473. return [
  474. {
  475. token: "comment",
  476. regex: /\/\*/,
  477. next: [
  478. DocCommentHighlightRules.getTagRule(),
  479. { token: "comment", regex: "\\*\\/", next: next || "pop" },
  480. { defaultToken: "comment", caseInsensitive: true }
  481. ]
  482. }, {
  483. token: "comment",
  484. regex: "\\/\\/",
  485. next: [
  486. DocCommentHighlightRules.getTagRule(),
  487. { token: "comment", regex: "$|^", next: next || "pop" },
  488. { defaultToken: "comment", caseInsensitive: true }
  489. ]
  490. }
  491. ];
  492. }
  493. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  494. });
  495. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
  496. var Range = require("../range").Range;
  497. var MatchingBraceOutdent = function () { };
  498. (function () {
  499. this.checkOutdent = function (line, input) {
  500. if (!/^\s+$/.test(line))
  501. return false;
  502. return /^\s*\}/.test(input);
  503. };
  504. this.autoOutdent = function (doc, row) {
  505. var line = doc.getLine(row);
  506. var match = line.match(/^(\s*\})/);
  507. if (!match)
  508. return 0;
  509. var column = match[1].length;
  510. var openBracePos = doc.findMatchingBracket({ row: row, column: column });
  511. if (!openBracePos || openBracePos.row == row)
  512. return 0;
  513. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  514. doc.replace(new Range(row, 0, row, column - 1), indent);
  515. };
  516. this.$getIndent = function (line) {
  517. return line.match(/^\s*/)[0];
  518. };
  519. }).call(MatchingBraceOutdent.prototype);
  520. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  521. });
  522. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
  523. var oop = require("../../lib/oop");
  524. var Range = require("../../range").Range;
  525. var BaseFoldMode = require("./fold_mode").FoldMode;
  526. var FoldMode = exports.FoldMode = function (commentRegex) {
  527. if (commentRegex) {
  528. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  529. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  530. }
  531. };
  532. oop.inherits(FoldMode, BaseFoldMode);
  533. (function () {
  534. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  535. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  536. this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
  537. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  538. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  539. this._getFoldWidgetBase = this.getFoldWidget;
  540. this.getFoldWidget = function (session, foldStyle, row) {
  541. var line = session.getLine(row);
  542. if (this.singleLineBlockCommentRe.test(line)) {
  543. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  544. return "";
  545. }
  546. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  547. if (!fw && this.startRegionRe.test(line))
  548. return "start"; // lineCommentRegionStart
  549. return fw;
  550. };
  551. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  552. var line = session.getLine(row);
  553. if (this.startRegionRe.test(line))
  554. return this.getCommentRegionBlock(session, line, row);
  555. var match = line.match(this.foldingStartMarker);
  556. if (match) {
  557. var i = match.index;
  558. if (match[1])
  559. return this.openingBracketBlock(session, match[1], row, i);
  560. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  561. if (range && !range.isMultiLine()) {
  562. if (forceMultiline) {
  563. range = this.getSectionRange(session, row);
  564. }
  565. else if (foldStyle != "all")
  566. range = null;
  567. }
  568. return range;
  569. }
  570. if (foldStyle === "markbegin")
  571. return;
  572. var match = line.match(this.foldingStopMarker);
  573. if (match) {
  574. var i = match.index + match[0].length;
  575. if (match[1])
  576. return this.closingBracketBlock(session, match[1], row, i);
  577. return session.getCommentFoldRange(row, i, -1);
  578. }
  579. };
  580. this.getSectionRange = function (session, row) {
  581. var line = session.getLine(row);
  582. var startIndent = line.search(/\S/);
  583. var startRow = row;
  584. var startColumn = line.length;
  585. row = row + 1;
  586. var endRow = row;
  587. var maxRow = session.getLength();
  588. while (++row < maxRow) {
  589. line = session.getLine(row);
  590. var indent = line.search(/\S/);
  591. if (indent === -1)
  592. continue;
  593. if (startIndent > indent)
  594. break;
  595. var subRange = this.getFoldWidgetRange(session, "all", row);
  596. if (subRange) {
  597. if (subRange.start.row <= startRow) {
  598. break;
  599. }
  600. else if (subRange.isMultiLine()) {
  601. row = subRange.end.row;
  602. }
  603. else if (startIndent == indent) {
  604. break;
  605. }
  606. }
  607. endRow = row;
  608. }
  609. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  610. };
  611. this.getCommentRegionBlock = function (session, line, row) {
  612. var startColumn = line.search(/\s*$/);
  613. var maxRow = session.getLength();
  614. var startRow = row;
  615. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  616. var depth = 1;
  617. while (++row < maxRow) {
  618. line = session.getLine(row);
  619. var m = re.exec(line);
  620. if (!m)
  621. continue;
  622. if (m[1])
  623. depth--;
  624. else
  625. depth++;
  626. if (!depth)
  627. break;
  628. }
  629. var endRow = row;
  630. if (endRow > startRow) {
  631. return new Range(startRow, startColumn, endRow, line.length);
  632. }
  633. };
  634. }).call(FoldMode.prototype);
  635. });
  636. ace.define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
  637. var oop = require("../lib/oop");
  638. var TextMode = require("./text").Mode;
  639. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  640. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  641. var WorkerClient = require("../worker/worker_client").WorkerClient;
  642. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  643. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  644. var Mode = function () {
  645. this.HighlightRules = JavaScriptHighlightRules;
  646. this.$outdent = new MatchingBraceOutdent();
  647. this.$behaviour = new CstyleBehaviour();
  648. this.foldingRules = new CStyleFoldMode();
  649. };
  650. oop.inherits(Mode, TextMode);
  651. (function () {
  652. this.lineCommentStart = "//";
  653. this.blockComment = { start: "/*", end: "*/" };
  654. this.$quotes = { '"': '"', "'": "'", "`": "`" };
  655. this.getNextLineIndent = function (state, line, tab) {
  656. var indent = this.$getIndent(line);
  657. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  658. var tokens = tokenizedLine.tokens;
  659. var endState = tokenizedLine.state;
  660. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  661. return indent;
  662. }
  663. if (state == "start" || state == "no_regex") {
  664. var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
  665. if (match) {
  666. indent += tab;
  667. }
  668. }
  669. else if (state == "doc-start") {
  670. if (endState == "start" || endState == "no_regex") {
  671. return "";
  672. }
  673. var match = line.match(/^\s*(\/?)\*/);
  674. if (match) {
  675. if (match[1]) {
  676. indent += " ";
  677. }
  678. indent += "* ";
  679. }
  680. }
  681. return indent;
  682. };
  683. this.checkOutdent = function (state, line, input) {
  684. return this.$outdent.checkOutdent(line, input);
  685. };
  686. this.autoOutdent = function (state, doc, row) {
  687. this.$outdent.autoOutdent(doc, row);
  688. };
  689. this.createWorker = function (session) {
  690. var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
  691. worker.attachToDocument(session.getDocument());
  692. worker.on("annotate", function (results) {
  693. session.setAnnotations(results.data);
  694. });
  695. worker.on("terminate", function () {
  696. session.clearAnnotations();
  697. });
  698. return worker;
  699. };
  700. this.$id = "ace/mode/javascript";
  701. this.snippetFileId = "ace/snippets/javascript";
  702. }).call(Mode.prototype);
  703. exports.Mode = Mode;
  704. });
  705. ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  706. var oop = require("../lib/oop");
  707. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  708. var XmlHighlightRules = function (normalize) {
  709. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  710. this.$rules = {
  711. start: [
  712. { token: "string.cdata.xml", regex: "<\\!\\[CDATA\\[", next: "cdata" },
  713. {
  714. token: ["punctuation.instruction.xml", "keyword.instruction.xml"],
  715. regex: "(<\\?)(" + tagRegex + ")", next: "processing_instruction"
  716. },
  717. { token: "comment.start.xml", regex: "<\\!--", next: "comment" },
  718. {
  719. token: ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  720. regex: "(<\\!)(DOCTYPE)(?=[\\s])", next: "doctype", caseInsensitive: true
  721. },
  722. { include: "tag" },
  723. { token: "text.end-tag-open.xml", regex: "</" },
  724. { token: "text.tag-open.xml", regex: "<" },
  725. { include: "reference" },
  726. { defaultToken: "text.xml" }
  727. ],
  728. processing_instruction: [{
  729. token: "entity.other.attribute-name.decl-attribute-name.xml",
  730. regex: tagRegex
  731. }, {
  732. token: "keyword.operator.decl-attribute-equals.xml",
  733. regex: "="
  734. }, {
  735. include: "whitespace"
  736. }, {
  737. include: "string"
  738. }, {
  739. token: "punctuation.xml-decl.xml",
  740. regex: "\\?>",
  741. next: "start"
  742. }],
  743. doctype: [
  744. { include: "whitespace" },
  745. { include: "string" },
  746. { token: "xml-pe.doctype.xml", regex: ">", next: "start" },
  747. { token: "xml-pe.xml", regex: "[-_a-zA-Z0-9:]+" },
  748. { token: "punctuation.int-subset", regex: "\\[", push: "int_subset" }
  749. ],
  750. int_subset: [{
  751. token: "text.xml",
  752. regex: "\\s+"
  753. }, {
  754. token: "punctuation.int-subset.xml",
  755. regex: "]",
  756. next: "pop"
  757. }, {
  758. token: ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  759. regex: "(<\\!)(" + tagRegex + ")",
  760. push: [{
  761. token: "text",
  762. regex: "\\s+"
  763. },
  764. {
  765. token: "punctuation.markup-decl.xml",
  766. regex: ">",
  767. next: "pop"
  768. },
  769. { include: "string" }]
  770. }],
  771. cdata: [
  772. { token: "string.cdata.xml", regex: "\\]\\]>", next: "start" },
  773. { token: "text.xml", regex: "\\s+" },
  774. { token: "text.xml", regex: "(?:[^\\]]|\\](?!\\]>))+" }
  775. ],
  776. comment: [
  777. { token: "comment.end.xml", regex: "-->", next: "start" },
  778. { defaultToken: "comment.xml" }
  779. ],
  780. reference: [{
  781. token: "constant.language.escape.reference.xml",
  782. regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  783. }],
  784. attr_reference: [{
  785. token: "constant.language.escape.reference.attribute-value.xml",
  786. regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  787. }],
  788. tag: [{
  789. token: ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  790. regex: "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  791. next: [
  792. { include: "attributes" },
  793. { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start" }
  794. ]
  795. }],
  796. tag_whitespace: [
  797. { token: "text.tag-whitespace.xml", regex: "\\s+" }
  798. ],
  799. whitespace: [
  800. { token: "text.whitespace.xml", regex: "\\s+" }
  801. ],
  802. string: [{
  803. token: "string.xml",
  804. regex: "'",
  805. push: [
  806. { token: "string.xml", regex: "'", next: "pop" },
  807. { defaultToken: "string.xml" }
  808. ]
  809. }, {
  810. token: "string.xml",
  811. regex: '"',
  812. push: [
  813. { token: "string.xml", regex: '"', next: "pop" },
  814. { defaultToken: "string.xml" }
  815. ]
  816. }],
  817. attributes: [{
  818. token: "entity.other.attribute-name.xml",
  819. regex: tagRegex
  820. }, {
  821. token: "keyword.operator.attribute-equals.xml",
  822. regex: "="
  823. }, {
  824. include: "tag_whitespace"
  825. }, {
  826. include: "attribute_value"
  827. }],
  828. attribute_value: [{
  829. token: "string.attribute-value.xml",
  830. regex: "'",
  831. push: [
  832. { token: "string.attribute-value.xml", regex: "'", next: "pop" },
  833. { include: "attr_reference" },
  834. { defaultToken: "string.attribute-value.xml" }
  835. ]
  836. }, {
  837. token: "string.attribute-value.xml",
  838. regex: '"',
  839. push: [
  840. { token: "string.attribute-value.xml", regex: '"', next: "pop" },
  841. { include: "attr_reference" },
  842. { defaultToken: "string.attribute-value.xml" }
  843. ]
  844. }]
  845. };
  846. if (this.constructor === XmlHighlightRules)
  847. this.normalizeRules();
  848. };
  849. (function () {
  850. this.embedTagRules = function (HighlightRules, prefix, tag) {
  851. this.$rules.tag.unshift({
  852. token: ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  853. regex: "(<)(" + tag + "(?=\\s|>|$))",
  854. next: [
  855. { include: "attributes" },
  856. { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: prefix + "start" }
  857. ]
  858. });
  859. this.$rules[tag + "-end"] = [
  860. { include: "attributes" },
  861. { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start",
  862. onMatch: function (value, currentState, stack) {
  863. stack.splice(0);
  864. return this.token;
  865. } }
  866. ];
  867. this.embedRules(HighlightRules, prefix, [{
  868. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  869. regex: "(</)(" + tag + "(?=\\s|>|$))",
  870. next: tag + "-end"
  871. }, {
  872. token: "string.cdata.xml",
  873. regex: "<\\!\\[CDATA\\["
  874. }, {
  875. token: "string.cdata.xml",
  876. regex: "\\]\\]>"
  877. }]);
  878. };
  879. }).call(TextHighlightRules.prototype);
  880. oop.inherits(XmlHighlightRules, TextHighlightRules);
  881. exports.XmlHighlightRules = XmlHighlightRules;
  882. });
  883. ace.define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module){"use strict";
  884. var oop = require("../../lib/oop");
  885. var Behaviour = require("../behaviour").Behaviour;
  886. var TokenIterator = require("../../token_iterator").TokenIterator;
  887. var lang = require("../../lib/lang");
  888. function is(token, type) {
  889. return token && token.type.lastIndexOf(type + ".xml") > -1;
  890. }
  891. var XmlBehaviour = function () {
  892. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  893. if (text == '"' || text == "'") {
  894. var quote = text;
  895. var selected = session.doc.getTextRange(editor.getSelectionRange());
  896. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  897. return {
  898. text: quote + selected + quote,
  899. selection: false
  900. };
  901. }
  902. var cursor = editor.getCursorPosition();
  903. var line = session.doc.getLine(cursor.row);
  904. var rightChar = line.substring(cursor.column, cursor.column + 1);
  905. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  906. var token = iterator.getCurrentToken();
  907. if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
  908. return {
  909. text: "",
  910. selection: [1, 1]
  911. };
  912. }
  913. if (!token)
  914. token = iterator.stepBackward();
  915. if (!token)
  916. return;
  917. while (is(token, "tag-whitespace") || is(token, "whitespace")) {
  918. token = iterator.stepBackward();
  919. }
  920. var rightSpace = !rightChar || rightChar.match(/\s/);
  921. if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
  922. return {
  923. text: quote + quote,
  924. selection: [1, 1]
  925. };
  926. }
  927. }
  928. });
  929. this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
  930. var selected = session.doc.getTextRange(range);
  931. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  932. var line = session.doc.getLine(range.start.row);
  933. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  934. if (rightChar == selected) {
  935. range.end.column++;
  936. return range;
  937. }
  938. }
  939. });
  940. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  941. if (text == '>') {
  942. var position = editor.getSelectionRange().start;
  943. var iterator = new TokenIterator(session, position.row, position.column);
  944. var token = iterator.getCurrentToken() || iterator.stepBackward();
  945. if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
  946. return;
  947. if (is(token, "reference.attribute-value"))
  948. return;
  949. if (is(token, "attribute-value")) {
  950. var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length;
  951. if (position.column < tokenEndColumn)
  952. return;
  953. if (position.column == tokenEndColumn) {
  954. var nextToken = iterator.stepForward();
  955. if (nextToken && is(nextToken, "attribute-value"))
  956. return;
  957. iterator.stepBackward();
  958. }
  959. }
  960. if (/^\s*>/.test(session.getLine(position.row).slice(position.column)))
  961. return;
  962. while (!is(token, "tag-name")) {
  963. token = iterator.stepBackward();
  964. if (token.value == "<") {
  965. token = iterator.stepForward();
  966. break;
  967. }
  968. }
  969. var tokenRow = iterator.getCurrentTokenRow();
  970. var tokenColumn = iterator.getCurrentTokenColumn();
  971. if (is(iterator.stepBackward(), "end-tag-open"))
  972. return;
  973. var element = token.value;
  974. if (tokenRow == position.row)
  975. element = element.substring(0, position.column - tokenColumn);
  976. if (this.voidElements.hasOwnProperty(element.toLowerCase()))
  977. return;
  978. return {
  979. text: ">" + "</" + element + ">",
  980. selection: [1, 1]
  981. };
  982. }
  983. });
  984. this.add("autoindent", "insertion", function (state, action, editor, session, text) {
  985. if (text == "\n") {
  986. var cursor = editor.getCursorPosition();
  987. var line = session.getLine(cursor.row);
  988. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  989. var token = iterator.getCurrentToken();
  990. if (token && token.type.indexOf("tag-close") !== -1) {
  991. if (token.value == "/>")
  992. return;
  993. while (token && token.type.indexOf("tag-name") === -1) {
  994. token = iterator.stepBackward();
  995. }
  996. if (!token) {
  997. return;
  998. }
  999. var tag = token.value;
  1000. var row = iterator.getCurrentTokenRow();
  1001. token = iterator.stepBackward();
  1002. if (!token || token.type.indexOf("end-tag") !== -1) {
  1003. return;
  1004. }
  1005. if (this.voidElements && !this.voidElements[tag]) {
  1006. var nextToken = session.getTokenAt(cursor.row, cursor.column + 1);
  1007. var line = session.getLine(row);
  1008. var nextIndent = this.$getIndent(line);
  1009. var indent = nextIndent + session.getTabString();
  1010. if (nextToken && nextToken.value === "</") {
  1011. return {
  1012. text: "\n" + indent + "\n" + nextIndent,
  1013. selection: [1, indent.length, 1, indent.length]
  1014. };
  1015. }
  1016. else {
  1017. return {
  1018. text: "\n" + indent
  1019. };
  1020. }
  1021. }
  1022. }
  1023. }
  1024. });
  1025. };
  1026. oop.inherits(XmlBehaviour, Behaviour);
  1027. exports.XmlBehaviour = XmlBehaviour;
  1028. });
  1029. ace.define("ace/mode/folding/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/range","ace/mode/folding/fold_mode","ace/token_iterator"], function(require, exports, module){"use strict";
  1030. var oop = require("../../lib/oop");
  1031. var lang = require("../../lib/lang");
  1032. var Range = require("../../range").Range;
  1033. var BaseFoldMode = require("./fold_mode").FoldMode;
  1034. var TokenIterator = require("../../token_iterator").TokenIterator;
  1035. var FoldMode = exports.FoldMode = function (voidElements, optionalEndTags) {
  1036. BaseFoldMode.call(this);
  1037. this.voidElements = voidElements || {};
  1038. this.optionalEndTags = oop.mixin({}, this.voidElements);
  1039. if (optionalEndTags)
  1040. oop.mixin(this.optionalEndTags, optionalEndTags);
  1041. };
  1042. oop.inherits(FoldMode, BaseFoldMode);
  1043. var Tag = function () {
  1044. this.tagName = "";
  1045. this.closing = false;
  1046. this.selfClosing = false;
  1047. this.start = { row: 0, column: 0 };
  1048. this.end = { row: 0, column: 0 };
  1049. };
  1050. function is(token, type) {
  1051. return token.type.lastIndexOf(type + ".xml") > -1;
  1052. }
  1053. (function () {
  1054. this.getFoldWidget = function (session, foldStyle, row) {
  1055. var tag = this._getFirstTagInLine(session, row);
  1056. if (!tag)
  1057. return this.getCommentFoldWidget(session, row);
  1058. if (tag.closing || (!tag.tagName && tag.selfClosing))
  1059. return foldStyle == "markbeginend" ? "end" : "";
  1060. if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
  1061. return "";
  1062. if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
  1063. return "";
  1064. return "start";
  1065. };
  1066. this.getCommentFoldWidget = function (session, row) {
  1067. if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
  1068. return "start";
  1069. return "";
  1070. };
  1071. this._getFirstTagInLine = function (session, row) {
  1072. var tokens = session.getTokens(row);
  1073. var tag = new Tag();
  1074. for (var i = 0; i < tokens.length; i++) {
  1075. var token = tokens[i];
  1076. if (is(token, "tag-open")) {
  1077. tag.end.column = tag.start.column + token.value.length;
  1078. tag.closing = is(token, "end-tag-open");
  1079. token = tokens[++i];
  1080. if (!token)
  1081. return null;
  1082. tag.tagName = token.value;
  1083. tag.end.column += token.value.length;
  1084. for (i++; i < tokens.length; i++) {
  1085. token = tokens[i];
  1086. tag.end.column += token.value.length;
  1087. if (is(token, "tag-close")) {
  1088. tag.selfClosing = token.value == '/>';
  1089. break;
  1090. }
  1091. }
  1092. return tag;
  1093. }
  1094. else if (is(token, "tag-close")) {
  1095. tag.selfClosing = token.value == '/>';
  1096. return tag;
  1097. }
  1098. tag.start.column += token.value.length;
  1099. }
  1100. return null;
  1101. };
  1102. this._findEndTagInLine = function (session, row, tagName, startColumn) {
  1103. var tokens = session.getTokens(row);
  1104. var column = 0;
  1105. for (var i = 0; i < tokens.length; i++) {
  1106. var token = tokens[i];
  1107. column += token.value.length;
  1108. if (column < startColumn)
  1109. continue;
  1110. if (is(token, "end-tag-open")) {
  1111. token = tokens[i + 1];
  1112. if (token && token.value == tagName)
  1113. return true;
  1114. }
  1115. }
  1116. return false;
  1117. };
  1118. this._readTagForward = function (iterator) {
  1119. var token = iterator.getCurrentToken();
  1120. if (!token)
  1121. return null;
  1122. var tag = new Tag();
  1123. do {
  1124. if (is(token, "tag-open")) {
  1125. tag.closing = is(token, "end-tag-open");
  1126. tag.start.row = iterator.getCurrentTokenRow();
  1127. tag.start.column = iterator.getCurrentTokenColumn();
  1128. }
  1129. else if (is(token, "tag-name")) {
  1130. tag.tagName = token.value;
  1131. }
  1132. else if (is(token, "tag-close")) {
  1133. tag.selfClosing = token.value == "/>";
  1134. tag.end.row = iterator.getCurrentTokenRow();
  1135. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1136. iterator.stepForward();
  1137. return tag;
  1138. }
  1139. } while (token = iterator.stepForward());
  1140. return null;
  1141. };
  1142. this._readTagBackward = function (iterator) {
  1143. var token = iterator.getCurrentToken();
  1144. if (!token)
  1145. return null;
  1146. var tag = new Tag();
  1147. do {
  1148. if (is(token, "tag-open")) {
  1149. tag.closing = is(token, "end-tag-open");
  1150. tag.start.row = iterator.getCurrentTokenRow();
  1151. tag.start.column = iterator.getCurrentTokenColumn();
  1152. iterator.stepBackward();
  1153. return tag;
  1154. }
  1155. else if (is(token, "tag-name")) {
  1156. tag.tagName = token.value;
  1157. }
  1158. else if (is(token, "tag-close")) {
  1159. tag.selfClosing = token.value == "/>";
  1160. tag.end.row = iterator.getCurrentTokenRow();
  1161. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1162. }
  1163. } while (token = iterator.stepBackward());
  1164. return null;
  1165. };
  1166. this._pop = function (stack, tag) {
  1167. while (stack.length) {
  1168. var top = stack[stack.length - 1];
  1169. if (!tag || top.tagName == tag.tagName) {
  1170. return stack.pop();
  1171. }
  1172. else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
  1173. stack.pop();
  1174. continue;
  1175. }
  1176. else {
  1177. return null;
  1178. }
  1179. }
  1180. };
  1181. this.getFoldWidgetRange = function (session, foldStyle, row) {
  1182. var firstTag = this._getFirstTagInLine(session, row);
  1183. if (!firstTag) {
  1184. return this.getCommentFoldWidget(session, row)
  1185. && session.getCommentFoldRange(row, session.getLine(row).length);
  1186. }
  1187. var isBackward = firstTag.closing || firstTag.selfClosing;
  1188. var stack = [];
  1189. var tag;
  1190. if (!isBackward) {
  1191. var iterator = new TokenIterator(session, row, firstTag.start.column);
  1192. var start = {
  1193. row: row,
  1194. column: firstTag.start.column + firstTag.tagName.length + 2
  1195. };
  1196. if (firstTag.start.row == firstTag.end.row)
  1197. start.column = firstTag.end.column;
  1198. while (tag = this._readTagForward(iterator)) {
  1199. if (tag.selfClosing) {
  1200. if (!stack.length) {
  1201. tag.start.column += tag.tagName.length + 2;
  1202. tag.end.column -= 2;
  1203. return Range.fromPoints(tag.start, tag.end);
  1204. }
  1205. else
  1206. continue;
  1207. }
  1208. if (tag.closing) {
  1209. this._pop(stack, tag);
  1210. if (stack.length == 0)
  1211. return Range.fromPoints(start, tag.start);
  1212. }
  1213. else {
  1214. stack.push(tag);
  1215. }
  1216. }
  1217. }
  1218. else {
  1219. var iterator = new TokenIterator(session, row, firstTag.end.column);
  1220. var end = {
  1221. row: row,
  1222. column: firstTag.start.column
  1223. };
  1224. while (tag = this._readTagBackward(iterator)) {
  1225. if (tag.selfClosing) {
  1226. if (!stack.length) {
  1227. tag.start.column += tag.tagName.length + 2;
  1228. tag.end.column -= 2;
  1229. return Range.fromPoints(tag.start, tag.end);
  1230. }
  1231. else
  1232. continue;
  1233. }
  1234. if (!tag.closing) {
  1235. this._pop(stack, tag);
  1236. if (stack.length == 0) {
  1237. tag.start.column += tag.tagName.length + 2;
  1238. if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
  1239. tag.start.column = tag.end.column;
  1240. return Range.fromPoints(tag.start, end);
  1241. }
  1242. }
  1243. else {
  1244. stack.push(tag);
  1245. }
  1246. }
  1247. }
  1248. };
  1249. }).call(FoldMode.prototype);
  1250. });
  1251. ace.define("ace/mode/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/xml_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/xml","ace/worker/worker_client"], function(require, exports, module){"use strict";
  1252. var oop = require("../lib/oop");
  1253. var lang = require("../lib/lang");
  1254. var TextMode = require("./text").Mode;
  1255. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  1256. var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
  1257. var XmlFoldMode = require("./folding/xml").FoldMode;
  1258. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1259. var Mode = function () {
  1260. this.HighlightRules = XmlHighlightRules;
  1261. this.$behaviour = new XmlBehaviour();
  1262. this.foldingRules = new XmlFoldMode();
  1263. };
  1264. oop.inherits(Mode, TextMode);
  1265. (function () {
  1266. this.voidElements = lang.arrayToMap([]);
  1267. this.blockComment = { start: "<!--", end: "-->" };
  1268. this.createWorker = function (session) {
  1269. var worker = new WorkerClient(["ace"], "ace/mode/xml_worker", "Worker");
  1270. worker.attachToDocument(session.getDocument());
  1271. worker.on("error", function (e) {
  1272. session.setAnnotations(e.data);
  1273. });
  1274. worker.on("terminate", function () {
  1275. session.clearAnnotations();
  1276. });
  1277. return worker;
  1278. };
  1279. this.$id = "ace/mode/xml";
  1280. }).call(Mode.prototype);
  1281. exports.Mode = Mode;
  1282. });
  1283. ace.define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  1284. var oop = require("../lib/oop");
  1285. var lang = require("../lib/lang");
  1286. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  1287. 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";
  1288. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  1289. var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|flex-end|flex-start|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero|zoom";
  1290. 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";
  1291. 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";
  1292. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
  1293. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  1294. 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";
  1295. var CssHighlightRules = function () {
  1296. var keywordMapper = this.createKeywordMapper({
  1297. "support.function": supportFunction,
  1298. "support.constant": supportConstant,
  1299. "support.type": supportType,
  1300. "support.constant.color": supportConstantColor,
  1301. "support.constant.fonts": supportConstantFonts
  1302. }, "text", true);
  1303. this.$rules = {
  1304. "start": [{
  1305. include: ["strings", "url", "comments"]
  1306. }, {
  1307. token: "paren.lparen",
  1308. regex: "\\{",
  1309. next: "ruleset"
  1310. }, {
  1311. token: "paren.rparen",
  1312. regex: "\\}"
  1313. }, {
  1314. token: "string",
  1315. regex: "@(?!viewport)",
  1316. next: "media"
  1317. }, {
  1318. token: "keyword",
  1319. regex: "#[a-z0-9-_]+"
  1320. }, {
  1321. token: "keyword",
  1322. regex: "%"
  1323. }, {
  1324. token: "variable",
  1325. regex: "\\.[a-z0-9-_]+"
  1326. }, {
  1327. token: "string",
  1328. regex: ":[a-z0-9-_]+"
  1329. }, {
  1330. token: "constant.numeric",
  1331. regex: numRe
  1332. }, {
  1333. token: "constant",
  1334. regex: "[a-z0-9-_]+"
  1335. }, {
  1336. caseInsensitive: true
  1337. }],
  1338. "media": [{
  1339. include: ["strings", "url", "comments"]
  1340. }, {
  1341. token: "paren.lparen",
  1342. regex: "\\{",
  1343. next: "start"
  1344. }, {
  1345. token: "paren.rparen",
  1346. regex: "\\}",
  1347. next: "start"
  1348. }, {
  1349. token: "string",
  1350. regex: ";",
  1351. next: "start"
  1352. }, {
  1353. token: "keyword",
  1354. regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
  1355. + "|page|font|keyframes|viewport|counter-style|font-feature-values"
  1356. + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
  1357. }],
  1358. "comments": [{
  1359. token: "comment",
  1360. regex: "\\/\\*",
  1361. push: [{
  1362. token: "comment",
  1363. regex: "\\*\\/",
  1364. next: "pop"
  1365. }, {
  1366. defaultToken: "comment"
  1367. }]
  1368. }],
  1369. "ruleset": [{
  1370. regex: "-(webkit|ms|moz|o)-",
  1371. token: "text"
  1372. }, {
  1373. token: "punctuation.operator",
  1374. regex: "[:;]"
  1375. }, {
  1376. token: "paren.rparen",
  1377. regex: "\\}",
  1378. next: "start"
  1379. }, {
  1380. include: ["strings", "url", "comments"]
  1381. }, {
  1382. token: ["constant.numeric", "keyword"],
  1383. 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|%)"
  1384. }, {
  1385. token: "constant.numeric",
  1386. regex: numRe
  1387. }, {
  1388. token: "constant.numeric",
  1389. regex: "#[a-f0-9]{6}"
  1390. }, {
  1391. token: "constant.numeric",
  1392. regex: "#[a-f0-9]{3}"
  1393. }, {
  1394. token: ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  1395. regex: pseudoElements
  1396. }, {
  1397. token: ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  1398. regex: pseudoClasses
  1399. }, {
  1400. include: "url"
  1401. }, {
  1402. token: keywordMapper,
  1403. regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  1404. }, {
  1405. caseInsensitive: true
  1406. }],
  1407. url: [{
  1408. token: "support.function",
  1409. regex: "(?:url(:?-prefix)?|domain|regexp)\\(",
  1410. push: [{
  1411. token: "support.function",
  1412. regex: "\\)",
  1413. next: "pop"
  1414. }, {
  1415. defaultToken: "string"
  1416. }]
  1417. }],
  1418. strings: [{
  1419. token: "string.start",
  1420. regex: "'",
  1421. push: [{
  1422. token: "string.end",
  1423. regex: "'|$",
  1424. next: "pop"
  1425. }, {
  1426. include: "escapes"
  1427. }, {
  1428. token: "constant.language.escape",
  1429. regex: /\\$/,
  1430. consumeLineEnd: true
  1431. }, {
  1432. defaultToken: "string"
  1433. }]
  1434. }, {
  1435. token: "string.start",
  1436. regex: '"',
  1437. push: [{
  1438. token: "string.end",
  1439. regex: '"|$',
  1440. next: "pop"
  1441. }, {
  1442. include: "escapes"
  1443. }, {
  1444. token: "constant.language.escape",
  1445. regex: /\\$/,
  1446. consumeLineEnd: true
  1447. }, {
  1448. defaultToken: "string"
  1449. }]
  1450. }],
  1451. escapes: [{
  1452. token: "constant.language.escape",
  1453. regex: /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
  1454. }]
  1455. };
  1456. this.normalizeRules();
  1457. };
  1458. oop.inherits(CssHighlightRules, TextHighlightRules);
  1459. exports.CssHighlightRules = CssHighlightRules;
  1460. });
  1461. ace.define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module){"use strict";
  1462. var propertyMap = {
  1463. "background": { "#$0": 1 },
  1464. "background-color": { "#$0": 1, "transparent": 1, "fixed": 1 },
  1465. "background-image": { "url('/$0')": 1 },
  1466. "background-repeat": { "repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1 },
  1467. "background-position": { "bottom": 2, "center": 2, "left": 2, "right": 2, "top": 2, "inherit": 2 },
  1468. "background-attachment": { "scroll": 1, "fixed": 1 },
  1469. "background-size": { "cover": 1, "contain": 1 },
  1470. "background-clip": { "border-box": 1, "padding-box": 1, "content-box": 1 },
  1471. "background-origin": { "border-box": 1, "padding-box": 1, "content-box": 1 },
  1472. "border": { "solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1 },
  1473. "border-color": { "#$0": 1 },
  1474. "border-style": { "solid": 2, "dashed": 2, "dotted": 2, "double": 2, "groove": 2, "hidden": 2, "inherit": 2, "inset": 2, "none": 2, "outset": 2, "ridged": 2 },
  1475. "border-collapse": { "collapse": 1, "separate": 1 },
  1476. "bottom": { "px": 1, "em": 1, "%": 1 },
  1477. "clear": { "left": 1, "right": 1, "both": 1, "none": 1 },
  1478. "color": { "#$0": 1, "rgb(#$00,0,0)": 1 },
  1479. "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 },
  1480. "display": { "none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1 },
  1481. "empty-cells": { "show": 1, "hide": 1 },
  1482. "float": { "left": 1, "right": 1, "none": 1 },
  1483. "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 },
  1484. "font-size": { "px": 1, "em": 1, "%": 1 },
  1485. "font-weight": { "bold": 1, "normal": 1 },
  1486. "font-style": { "italic": 1, "normal": 1 },
  1487. "font-variant": { "normal": 1, "small-caps": 1 },
  1488. "height": { "px": 1, "em": 1, "%": 1 },
  1489. "left": { "px": 1, "em": 1, "%": 1 },
  1490. "letter-spacing": { "normal": 1 },
  1491. "line-height": { "normal": 1 },
  1492. "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 },
  1493. "margin": { "px": 1, "em": 1, "%": 1 },
  1494. "margin-right": { "px": 1, "em": 1, "%": 1 },
  1495. "margin-left": { "px": 1, "em": 1, "%": 1 },
  1496. "margin-top": { "px": 1, "em": 1, "%": 1 },
  1497. "margin-bottom": { "px": 1, "em": 1, "%": 1 },
  1498. "max-height": { "px": 1, "em": 1, "%": 1 },
  1499. "max-width": { "px": 1, "em": 1, "%": 1 },
  1500. "min-height": { "px": 1, "em": 1, "%": 1 },
  1501. "min-width": { "px": 1, "em": 1, "%": 1 },
  1502. "overflow": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
  1503. "overflow-x": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
  1504. "overflow-y": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
  1505. "padding": { "px": 1, "em": 1, "%": 1 },
  1506. "padding-top": { "px": 1, "em": 1, "%": 1 },
  1507. "padding-right": { "px": 1, "em": 1, "%": 1 },
  1508. "padding-bottom": { "px": 1, "em": 1, "%": 1 },
  1509. "padding-left": { "px": 1, "em": 1, "%": 1 },
  1510. "page-break-after": { "auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1 },
  1511. "page-break-before": { "auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1 },
  1512. "position": { "absolute": 1, "relative": 1, "fixed": 1, "static": 1 },
  1513. "right": { "px": 1, "em": 1, "%": 1 },
  1514. "table-layout": { "fixed": 1, "auto": 1 },
  1515. "text-decoration": { "none": 1, "underline": 1, "line-through": 1, "blink": 1 },
  1516. "text-align": { "left": 1, "right": 1, "center": 1, "justify": 1 },
  1517. "text-transform": { "capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1 },
  1518. "top": { "px": 1, "em": 1, "%": 1 },
  1519. "vertical-align": { "top": 1, "bottom": 1 },
  1520. "visibility": { "hidden": 1, "visible": 1 },
  1521. "white-space": { "nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1 },
  1522. "width": { "px": 1, "em": 1, "%": 1 },
  1523. "word-spacing": { "normal": 1 },
  1524. "filter": { "alpha(opacity=$0100)": 1 },
  1525. "text-shadow": { "$02px 2px 2px #777": 1 },
  1526. "text-overflow": { "ellipsis-word": 1, "clip": 1, "ellipsis": 1 },
  1527. "-moz-border-radius": 1,
  1528. "-moz-border-radius-topright": 1,
  1529. "-moz-border-radius-bottomright": 1,
  1530. "-moz-border-radius-topleft": 1,
  1531. "-moz-border-radius-bottomleft": 1,
  1532. "-webkit-border-radius": 1,
  1533. "-webkit-border-top-right-radius": 1,
  1534. "-webkit-border-top-left-radius": 1,
  1535. "-webkit-border-bottom-right-radius": 1,
  1536. "-webkit-border-bottom-left-radius": 1,
  1537. "-moz-box-shadow": 1,
  1538. "-webkit-box-shadow": 1,
  1539. "transform": { "rotate($00deg)": 1, "skew($00deg)": 1 },
  1540. "-moz-transform": { "rotate($00deg)": 1, "skew($00deg)": 1 },
  1541. "-webkit-transform": { "rotate($00deg)": 1, "skew($00deg)": 1 }
  1542. };
  1543. var CssCompletions = function () {
  1544. };
  1545. (function () {
  1546. this.completionsDefined = false;
  1547. this.defineCompletions = function () {
  1548. if (document) {
  1549. var style = document.createElement('c').style;
  1550. for (var i in style) {
  1551. if (typeof style[i] !== 'string')
  1552. continue;
  1553. var name = i.replace(/[A-Z]/g, function (x) {
  1554. return '-' + x.toLowerCase();
  1555. });
  1556. if (!propertyMap.hasOwnProperty(name))
  1557. propertyMap[name] = 1;
  1558. }
  1559. }
  1560. this.completionsDefined = true;
  1561. };
  1562. this.getCompletions = function (state, session, pos, prefix) {
  1563. if (!this.completionsDefined) {
  1564. this.defineCompletions();
  1565. }
  1566. if (state === 'ruleset' || session.$mode.$id == "ace/mode/scss") {
  1567. var line = session.getLine(pos.row).substr(0, pos.column);
  1568. var inParens = /\([^)]*$/.test(line);
  1569. if (inParens) {
  1570. line = line.substr(line.lastIndexOf('(') + 1);
  1571. }
  1572. if (/:[^;]+$/.test(line)) {
  1573. /([\w\-]+):[^:]*$/.test(line);
  1574. return this.getPropertyValueCompletions(state, session, pos, prefix);
  1575. }
  1576. else {
  1577. return this.getPropertyCompletions(state, session, pos, prefix, inParens);
  1578. }
  1579. }
  1580. return [];
  1581. };
  1582. this.getPropertyCompletions = function (state, session, pos, prefix, skipSemicolon) {
  1583. skipSemicolon = skipSemicolon || false;
  1584. var properties = Object.keys(propertyMap);
  1585. return properties.map(function (property) {
  1586. return {
  1587. caption: property,
  1588. snippet: property + ': $0' + (skipSemicolon ? '' : ';'),
  1589. meta: "property",
  1590. score: 1000000
  1591. };
  1592. });
  1593. };
  1594. this.getPropertyValueCompletions = function (state, session, pos, prefix) {
  1595. var line = session.getLine(pos.row).substr(0, pos.column);
  1596. var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
  1597. if (!property)
  1598. return [];
  1599. var values = [];
  1600. if (property in propertyMap && typeof propertyMap[property] === "object") {
  1601. values = Object.keys(propertyMap[property]);
  1602. }
  1603. return values.map(function (value) {
  1604. return {
  1605. caption: value,
  1606. snippet: value,
  1607. meta: "property value",
  1608. score: 1000000
  1609. };
  1610. });
  1611. };
  1612. }).call(CssCompletions.prototype);
  1613. exports.CssCompletions = CssCompletions;
  1614. });
  1615. ace.define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(require, exports, module){"use strict";
  1616. var oop = require("../../lib/oop");
  1617. var Behaviour = require("../behaviour").Behaviour;
  1618. var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
  1619. var TokenIterator = require("../../token_iterator").TokenIterator;
  1620. var CssBehaviour = function () {
  1621. this.inherit(CstyleBehaviour);
  1622. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1623. if (text === ':' && editor.selection.isEmpty()) {
  1624. var cursor = editor.getCursorPosition();
  1625. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1626. var token = iterator.getCurrentToken();
  1627. if (token && token.value.match(/\s+/)) {
  1628. token = iterator.stepBackward();
  1629. }
  1630. if (token && token.type === 'support.type') {
  1631. var line = session.doc.getLine(cursor.row);
  1632. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1633. if (rightChar === ':') {
  1634. return {
  1635. text: '',
  1636. selection: [1, 1]
  1637. };
  1638. }
  1639. if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
  1640. return {
  1641. text: ':;',
  1642. selection: [1, 1]
  1643. };
  1644. }
  1645. }
  1646. }
  1647. });
  1648. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1649. var selected = session.doc.getTextRange(range);
  1650. if (!range.isMultiLine() && selected === ':') {
  1651. var cursor = editor.getCursorPosition();
  1652. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1653. var token = iterator.getCurrentToken();
  1654. if (token && token.value.match(/\s+/)) {
  1655. token = iterator.stepBackward();
  1656. }
  1657. if (token && token.type === 'support.type') {
  1658. var line = session.doc.getLine(range.start.row);
  1659. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1660. if (rightChar === ';') {
  1661. range.end.column++;
  1662. return range;
  1663. }
  1664. }
  1665. }
  1666. });
  1667. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1668. if (text === ';' && editor.selection.isEmpty()) {
  1669. var cursor = editor.getCursorPosition();
  1670. var line = session.doc.getLine(cursor.row);
  1671. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1672. if (rightChar === ';') {
  1673. return {
  1674. text: '',
  1675. selection: [1, 1]
  1676. };
  1677. }
  1678. }
  1679. });
  1680. this.add("!important", "insertion", function (state, action, editor, session, text) {
  1681. if (text === '!' && editor.selection.isEmpty()) {
  1682. var cursor = editor.getCursorPosition();
  1683. var line = session.doc.getLine(cursor.row);
  1684. if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
  1685. return {
  1686. text: '!important',
  1687. selection: [10, 10]
  1688. };
  1689. }
  1690. }
  1691. });
  1692. };
  1693. oop.inherits(CssBehaviour, CstyleBehaviour);
  1694. exports.CssBehaviour = CssBehaviour;
  1695. });
  1696. ace.define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/css_completions","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
  1697. var oop = require("../lib/oop");
  1698. var TextMode = require("./text").Mode;
  1699. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1700. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1701. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1702. var CssCompletions = require("./css_completions").CssCompletions;
  1703. var CssBehaviour = require("./behaviour/css").CssBehaviour;
  1704. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1705. var Mode = function () {
  1706. this.HighlightRules = CssHighlightRules;
  1707. this.$outdent = new MatchingBraceOutdent();
  1708. this.$behaviour = new CssBehaviour();
  1709. this.$completer = new CssCompletions();
  1710. this.foldingRules = new CStyleFoldMode();
  1711. };
  1712. oop.inherits(Mode, TextMode);
  1713. (function () {
  1714. this.foldingRules = "cStyle";
  1715. this.blockComment = { start: "/*", end: "*/" };
  1716. this.getNextLineIndent = function (state, line, tab) {
  1717. var indent = this.$getIndent(line);
  1718. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1719. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  1720. return indent;
  1721. }
  1722. var match = line.match(/^.*\{\s*$/);
  1723. if (match) {
  1724. indent += tab;
  1725. }
  1726. return indent;
  1727. };
  1728. this.checkOutdent = function (state, line, input) {
  1729. return this.$outdent.checkOutdent(line, input);
  1730. };
  1731. this.autoOutdent = function (state, doc, row) {
  1732. this.$outdent.autoOutdent(doc, row);
  1733. };
  1734. this.getCompletions = function (state, session, pos, prefix) {
  1735. return this.$completer.getCompletions(state, session, pos, prefix);
  1736. };
  1737. this.createWorker = function (session) {
  1738. var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
  1739. worker.attachToDocument(session.getDocument());
  1740. worker.on("annotate", function (e) {
  1741. session.setAnnotations(e.data);
  1742. });
  1743. worker.on("terminate", function () {
  1744. session.clearAnnotations();
  1745. });
  1746. return worker;
  1747. };
  1748. this.$id = "ace/mode/css";
  1749. this.snippetFileId = "ace/snippets/css";
  1750. }).call(Mode.prototype);
  1751. exports.Mode = Mode;
  1752. });
  1753. ace.define("ace/mode/html_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/css_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"], function(require, exports, module){"use strict";
  1754. var oop = require("../lib/oop");
  1755. var lang = require("../lib/lang");
  1756. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1757. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1758. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  1759. var tagMap = lang.createMap({
  1760. a: 'anchor',
  1761. button: 'form',
  1762. form: 'form',
  1763. img: 'image',
  1764. input: 'form',
  1765. label: 'form',
  1766. option: 'form',
  1767. script: 'script',
  1768. select: 'form',
  1769. textarea: 'form',
  1770. style: 'style',
  1771. table: 'table',
  1772. tbody: 'table',
  1773. td: 'table',
  1774. tfoot: 'table',
  1775. th: 'table',
  1776. tr: 'table'
  1777. });
  1778. var HtmlHighlightRules = function () {
  1779. XmlHighlightRules.call(this);
  1780. this.addRules({
  1781. attributes: [{
  1782. include: "tag_whitespace"
  1783. }, {
  1784. token: "entity.other.attribute-name.xml",
  1785. regex: "[-_a-zA-Z0-9:.]+"
  1786. }, {
  1787. token: "keyword.operator.attribute-equals.xml",
  1788. regex: "=",
  1789. push: [{
  1790. include: "tag_whitespace"
  1791. }, {
  1792. token: "string.unquoted.attribute-value.html",
  1793. regex: "[^<>='\"`\\s]+",
  1794. next: "pop"
  1795. }, {
  1796. token: "empty",
  1797. regex: "",
  1798. next: "pop"
  1799. }]
  1800. }, {
  1801. include: "attribute_value"
  1802. }],
  1803. tag: [{
  1804. token: function (start, tag) {
  1805. var group = tagMap[tag];
  1806. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  1807. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  1808. },
  1809. regex: "(</?)([-_a-zA-Z0-9:.]+)",
  1810. next: "tag_stuff"
  1811. }],
  1812. tag_stuff: [
  1813. { include: "attributes" },
  1814. { token: "meta.tag.punctuation.tag-close.xml", regex: "/?>", next: "start" }
  1815. ]
  1816. });
  1817. this.embedTagRules(CssHighlightRules, "css-", "style");
  1818. this.embedTagRules(new JavaScriptHighlightRules({ jsx: false }).getRules(), "js-", "script");
  1819. if (this.constructor === HtmlHighlightRules)
  1820. this.normalizeRules();
  1821. };
  1822. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  1823. exports.HtmlHighlightRules = HtmlHighlightRules;
  1824. });
  1825. ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
  1826. var oop = require("../../lib/oop");
  1827. var BaseFoldMode = require("./fold_mode").FoldMode;
  1828. var FoldMode = exports.FoldMode = function (defaultMode, subModes) {
  1829. this.defaultMode = defaultMode;
  1830. this.subModes = subModes;
  1831. };
  1832. oop.inherits(FoldMode, BaseFoldMode);
  1833. (function () {
  1834. this.$getMode = function (state) {
  1835. if (typeof state != "string")
  1836. state = state[0];
  1837. for (var key in this.subModes) {
  1838. if (state.indexOf(key) === 0)
  1839. return this.subModes[key];
  1840. }
  1841. return null;
  1842. };
  1843. this.$tryMode = function (state, session, foldStyle, row) {
  1844. var mode = this.$getMode(state);
  1845. return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
  1846. };
  1847. this.getFoldWidget = function (session, foldStyle, row) {
  1848. return (this.$tryMode(session.getState(row - 1), session, foldStyle, row) ||
  1849. this.$tryMode(session.getState(row), session, foldStyle, row) ||
  1850. this.defaultMode.getFoldWidget(session, foldStyle, row));
  1851. };
  1852. this.getFoldWidgetRange = function (session, foldStyle, row) {
  1853. var mode = this.$getMode(session.getState(row - 1));
  1854. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1855. mode = this.$getMode(session.getState(row));
  1856. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1857. mode = this.defaultMode;
  1858. return mode.getFoldWidgetRange(session, foldStyle, row);
  1859. };
  1860. }).call(FoldMode.prototype);
  1861. });
  1862. ace.define("ace/mode/folding/html",["require","exports","module","ace/lib/oop","ace/mode/folding/mixed","ace/mode/folding/xml","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
  1863. var oop = require("../../lib/oop");
  1864. var MixedFoldMode = require("./mixed").FoldMode;
  1865. var XmlFoldMode = require("./xml").FoldMode;
  1866. var CStyleFoldMode = require("./cstyle").FoldMode;
  1867. var FoldMode = exports.FoldMode = function (voidElements, optionalTags) {
  1868. MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
  1869. "js-": new CStyleFoldMode(),
  1870. "css-": new CStyleFoldMode()
  1871. });
  1872. };
  1873. oop.inherits(FoldMode, MixedFoldMode);
  1874. });
  1875. ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module){"use strict";
  1876. var TokenIterator = require("../token_iterator").TokenIterator;
  1877. var commonAttributes = [
  1878. "accesskey",
  1879. "class",
  1880. "contenteditable",
  1881. "contextmenu",
  1882. "dir",
  1883. "draggable",
  1884. "dropzone",
  1885. "hidden",
  1886. "id",
  1887. "inert",
  1888. "itemid",
  1889. "itemprop",
  1890. "itemref",
  1891. "itemscope",
  1892. "itemtype",
  1893. "lang",
  1894. "spellcheck",
  1895. "style",
  1896. "tabindex",
  1897. "title",
  1898. "translate"
  1899. ];
  1900. var eventAttributes = [
  1901. "onabort",
  1902. "onblur",
  1903. "oncancel",
  1904. "oncanplay",
  1905. "oncanplaythrough",
  1906. "onchange",
  1907. "onclick",
  1908. "onclose",
  1909. "oncontextmenu",
  1910. "oncuechange",
  1911. "ondblclick",
  1912. "ondrag",
  1913. "ondragend",
  1914. "ondragenter",
  1915. "ondragleave",
  1916. "ondragover",
  1917. "ondragstart",
  1918. "ondrop",
  1919. "ondurationchange",
  1920. "onemptied",
  1921. "onended",
  1922. "onerror",
  1923. "onfocus",
  1924. "oninput",
  1925. "oninvalid",
  1926. "onkeydown",
  1927. "onkeypress",
  1928. "onkeyup",
  1929. "onload",
  1930. "onloadeddata",
  1931. "onloadedmetadata",
  1932. "onloadstart",
  1933. "onmousedown",
  1934. "onmousemove",
  1935. "onmouseout",
  1936. "onmouseover",
  1937. "onmouseup",
  1938. "onmousewheel",
  1939. "onpause",
  1940. "onplay",
  1941. "onplaying",
  1942. "onprogress",
  1943. "onratechange",
  1944. "onreset",
  1945. "onscroll",
  1946. "onseeked",
  1947. "onseeking",
  1948. "onselect",
  1949. "onshow",
  1950. "onstalled",
  1951. "onsubmit",
  1952. "onsuspend",
  1953. "ontimeupdate",
  1954. "onvolumechange",
  1955. "onwaiting"
  1956. ];
  1957. var globalAttributes = commonAttributes.concat(eventAttributes);
  1958. var attributeMap = {
  1959. "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 },
  1960. "abbr": {},
  1961. "address": {},
  1962. "area": { "shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1 },
  1963. "article": { "pubdate": 1 },
  1964. "aside": {},
  1965. "audio": { "src": 1, "autobuffer": 1, "autoplay": { "autoplay": 1 }, "loop": { "loop": 1 }, "controls": { "controls": 1 }, "muted": { "muted": 1 }, "preload": { "auto": 1, "metadata": 1, "none": 1 } },
  1966. "b": {},
  1967. "base": { "href": 1, "target": 1 },
  1968. "bdi": {},
  1969. "bdo": {},
  1970. "blockquote": { "cite": 1 },
  1971. "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 },
  1972. "br": {},
  1973. "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 } },
  1974. "canvas": { "width": 1, "height": 1 },
  1975. "caption": {},
  1976. "cite": {},
  1977. "code": {},
  1978. "col": { "span": 1 },
  1979. "colgroup": { "span": 1 },
  1980. "command": { "type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1 },
  1981. "data": {},
  1982. "datalist": {},
  1983. "dd": {},
  1984. "del": { "cite": 1, "datetime": 1 },
  1985. "details": { "open": 1 },
  1986. "dfn": {},
  1987. "dialog": { "open": 1 },
  1988. "div": {},
  1989. "dl": {},
  1990. "dt": {},
  1991. "em": {},
  1992. "embed": { "src": 1, "height": 1, "width": 1, "type": 1 },
  1993. "fieldset": { "disabled": 1, "form": 1, "name": 1 },
  1994. "figcaption": {},
  1995. "figure": {},
  1996. "footer": {},
  1997. "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 } },
  1998. "h1": {},
  1999. "h2": {},
  2000. "h3": {},
  2001. "h4": {},
  2002. "h5": {},
  2003. "h6": {},
  2004. "head": {},
  2005. "header": {},
  2006. "hr": {},
  2007. "html": { "manifest": 1 },
  2008. "i": {},
  2009. "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 } },
  2010. "img": { "alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1 },
  2011. "input": {
  2012. "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 },
  2013. "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
  2014. },
  2015. "ins": { "cite": 1, "datetime": 1 },
  2016. "kbd": {},
  2017. "keygen": { "autofocus": 1, "challenge": { "challenge": 1 }, "disabled": { "disabled": 1 }, "form": 1, "keytype": { "rsa": 1, "dsa": 1, "ec": 1 }, "name": 1 },
  2018. "label": { "form": 1, "for": 1 },
  2019. "legend": {},
  2020. "li": { "value": 1 },
  2021. "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 },
  2022. "main": {},
  2023. "map": { "name": 1 },
  2024. "mark": {},
  2025. "math": {},
  2026. "menu": { "type": 1, "label": 1 },
  2027. "meta": { "http-equiv": { "content-type": 1 }, "name": { "description": 1, "keywords": 1 }, "content": { "text/html; charset=UTF-8": 1 }, "charset": 1 },
  2028. "meter": { "value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1 },
  2029. "nav": {},
  2030. "noscript": { "href": 1 },
  2031. "object": { "param": 1, "data": 1, "type": 1, "height": 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1 },
  2032. "ol": { "start": 1, "reversed": 1 },
  2033. "optgroup": { "disabled": 1, "label": 1 },
  2034. "option": { "disabled": 1, "selected": 1, "label": 1, "value": 1 },
  2035. "output": { "for": 1, "form": 1, "name": 1 },
  2036. "p": {},
  2037. "param": { "name": 1, "value": 1 },
  2038. "pre": {},
  2039. "progress": { "value": 1, "max": 1 },
  2040. "q": { "cite": 1 },
  2041. "rp": {},
  2042. "rt": {},
  2043. "ruby": {},
  2044. "s": {},
  2045. "samp": {},
  2046. "script": { "charset": 1, "type": { "text/javascript": 1 }, "src": 1, "defer": 1, "async": 1 },
  2047. "select": { "autofocus": 1, "disabled": 1, "form": 1, "multiple": { "multiple": 1 }, "name": 1, "size": 1, "readonly": { "readonly": 1 } },
  2048. "small": {},
  2049. "source": { "src": 1, "type": 1, "media": 1 },
  2050. "span": {},
  2051. "strong": {},
  2052. "style": { "type": 1, "media": { "all": 1, "screen": 1, "print": 1 }, "scoped": 1 },
  2053. "sub": {},
  2054. "sup": {},
  2055. "svg": {},
  2056. "table": { "summary": 1 },
  2057. "tbody": {},
  2058. "td": { "headers": 1, "rowspan": 1, "colspan": 1 },
  2059. "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 } },
  2060. "tfoot": {},
  2061. "th": { "headers": 1, "rowspan": 1, "colspan": 1, "scope": 1 },
  2062. "thead": {},
  2063. "time": { "datetime": 1 },
  2064. "title": {},
  2065. "tr": {},
  2066. "track": { "kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1 },
  2067. "section": {},
  2068. "summary": {},
  2069. "u": {},
  2070. "ul": {},
  2071. "var": {},
  2072. "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 } },
  2073. "wbr": {}
  2074. };
  2075. var elements = Object.keys(attributeMap);
  2076. function is(token, type) {
  2077. return token.type.lastIndexOf(type + ".xml") > -1;
  2078. }
  2079. function findTagName(session, pos) {
  2080. var iterator = new TokenIterator(session, pos.row, pos.column);
  2081. var token = iterator.getCurrentToken();
  2082. while (token && !is(token, "tag-name")) {
  2083. token = iterator.stepBackward();
  2084. }
  2085. if (token)
  2086. return token.value;
  2087. }
  2088. function findAttributeName(session, pos) {
  2089. var iterator = new TokenIterator(session, pos.row, pos.column);
  2090. var token = iterator.getCurrentToken();
  2091. while (token && !is(token, "attribute-name")) {
  2092. token = iterator.stepBackward();
  2093. }
  2094. if (token)
  2095. return token.value;
  2096. }
  2097. var HtmlCompletions = function () {
  2098. };
  2099. (function () {
  2100. this.getCompletions = function (state, session, pos, prefix) {
  2101. var token = session.getTokenAt(pos.row, pos.column);
  2102. if (!token)
  2103. return [];
  2104. if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
  2105. return this.getTagCompletions(state, session, pos, prefix);
  2106. if (is(token, "tag-whitespace") || is(token, "attribute-name"))
  2107. return this.getAttributeCompletions(state, session, pos, prefix);
  2108. if (is(token, "attribute-value"))
  2109. return this.getAttributeValueCompletions(state, session, pos, prefix);
  2110. var line = session.getLine(pos.row).substr(0, pos.column);
  2111. if (/&[a-z]*$/i.test(line))
  2112. return this.getHTMLEntityCompletions(state, session, pos, prefix);
  2113. return [];
  2114. };
  2115. this.getTagCompletions = function (state, session, pos, prefix) {
  2116. return elements.map(function (element) {
  2117. return {
  2118. value: element,
  2119. meta: "tag",
  2120. score: 1000000
  2121. };
  2122. });
  2123. };
  2124. this.getAttributeCompletions = function (state, session, pos, prefix) {
  2125. var tagName = findTagName(session, pos);
  2126. if (!tagName)
  2127. return [];
  2128. var attributes = globalAttributes;
  2129. if (tagName in attributeMap) {
  2130. attributes = attributes.concat(Object.keys(attributeMap[tagName]));
  2131. }
  2132. return attributes.map(function (attribute) {
  2133. return {
  2134. caption: attribute,
  2135. snippet: attribute + '="$0"',
  2136. meta: "attribute",
  2137. score: 1000000
  2138. };
  2139. });
  2140. };
  2141. this.getAttributeValueCompletions = function (state, session, pos, prefix) {
  2142. var tagName = findTagName(session, pos);
  2143. var attributeName = findAttributeName(session, pos);
  2144. if (!tagName)
  2145. return [];
  2146. var values = [];
  2147. if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
  2148. values = Object.keys(attributeMap[tagName][attributeName]);
  2149. }
  2150. return values.map(function (value) {
  2151. return {
  2152. caption: value,
  2153. snippet: value,
  2154. meta: "attribute value",
  2155. score: 1000000
  2156. };
  2157. });
  2158. };
  2159. this.getHTMLEntityCompletions = function (state, session, pos, prefix) {
  2160. 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;'];
  2161. return values.map(function (value) {
  2162. return {
  2163. caption: value,
  2164. snippet: value,
  2165. meta: "html entity",
  2166. score: 1000000
  2167. };
  2168. });
  2169. };
  2170. }).call(HtmlCompletions.prototype);
  2171. exports.HtmlCompletions = HtmlCompletions;
  2172. });
  2173. ace.define("ace/mode/html",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/javascript","ace/mode/css","ace/mode/html_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/html","ace/mode/html_completions","ace/worker/worker_client"], function(require, exports, module){"use strict";
  2174. var oop = require("../lib/oop");
  2175. var lang = require("../lib/lang");
  2176. var TextMode = require("./text").Mode;
  2177. var JavaScriptMode = require("./javascript").Mode;
  2178. var CssMode = require("./css").Mode;
  2179. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2180. var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
  2181. var HtmlFoldMode = require("./folding/html").FoldMode;
  2182. var HtmlCompletions = require("./html_completions").HtmlCompletions;
  2183. var WorkerClient = require("../worker/worker_client").WorkerClient;
  2184. var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
  2185. var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
  2186. var Mode = function (options) {
  2187. this.fragmentContext = options && options.fragmentContext;
  2188. this.HighlightRules = HtmlHighlightRules;
  2189. this.$behaviour = new XmlBehaviour();
  2190. this.$completer = new HtmlCompletions();
  2191. this.createModeDelegates({
  2192. "js-": JavaScriptMode,
  2193. "css-": CssMode
  2194. });
  2195. this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
  2196. };
  2197. oop.inherits(Mode, TextMode);
  2198. (function () {
  2199. this.blockComment = { start: "<!--", end: "-->" };
  2200. this.voidElements = lang.arrayToMap(voidElements);
  2201. this.getNextLineIndent = function (state, line, tab) {
  2202. return this.$getIndent(line);
  2203. };
  2204. this.checkOutdent = function (state, line, input) {
  2205. return false;
  2206. };
  2207. this.getCompletions = function (state, session, pos, prefix) {
  2208. return this.$completer.getCompletions(state, session, pos, prefix);
  2209. };
  2210. this.createWorker = function (session) {
  2211. if (this.constructor != Mode)
  2212. return;
  2213. var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
  2214. worker.attachToDocument(session.getDocument());
  2215. if (this.fragmentContext)
  2216. worker.call("setOptions", [{ context: this.fragmentContext }]);
  2217. worker.on("error", function (e) {
  2218. session.setAnnotations(e.data);
  2219. });
  2220. worker.on("terminate", function () {
  2221. session.clearAnnotations();
  2222. });
  2223. return worker;
  2224. };
  2225. this.$id = "ace/mode/html";
  2226. this.snippetFileId = "ace/snippets/html";
  2227. }).call(Mode.prototype);
  2228. exports.Mode = Mode;
  2229. });
  2230. ace.define("ace/mode/markdown_highlight_rules",["require","exports","module","ace/config","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/html_highlight_rules"], function(require, exports, module){"use strict";
  2231. var modes = require("../config").$modes;
  2232. var oop = require("../lib/oop");
  2233. var lang = require("../lib/lang");
  2234. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  2235. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2236. var escaped = function (ch) {
  2237. return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*";
  2238. };
  2239. var MarkdownHighlightRules = function () {
  2240. HtmlHighlightRules.call(this);
  2241. var codeBlockStartRule = {
  2242. token: "support.function",
  2243. regex: /^\s*(```+[^`]*|~~~+[^~]*)$/,
  2244. onMatch: function (value, state, stack, line) {
  2245. var m = value.match(/^(\s*)([`~]+)(.*)/);
  2246. var language = /[\w-]+|$/.exec(m[3])[0];
  2247. if (!modes[language])
  2248. language = "";
  2249. stack.unshift("githubblock", [], [m[1], m[2], language], state);
  2250. return this.token;
  2251. },
  2252. next: "githubblock"
  2253. };
  2254. var codeBlockRules = [{
  2255. token: "support.function",
  2256. regex: ".*",
  2257. onMatch: function (value, state, stack, line) {
  2258. var embedState = stack[1];
  2259. var indent = stack[2][0];
  2260. var endMarker = stack[2][1];
  2261. var language = stack[2][2];
  2262. var m = /^(\s*)(`+|~+)\s*$/.exec(value);
  2263. if (m && m[1].length < indent.length + 3
  2264. && m[2].length >= endMarker.length && m[2][0] == endMarker[0]) {
  2265. stack.splice(0, 3);
  2266. this.next = stack.shift();
  2267. return this.token;
  2268. }
  2269. this.next = "";
  2270. if (language && modes[language]) {
  2271. var data = modes[language].getTokenizer().getLineTokens(value, embedState.slice(0));
  2272. stack[1] = data.state;
  2273. return data.tokens;
  2274. }
  2275. return this.token;
  2276. }
  2277. }];
  2278. this.$rules["start"].unshift({
  2279. token: "empty_line",
  2280. regex: '^$',
  2281. next: "allowBlock"
  2282. }, {
  2283. token: "markup.heading.1",
  2284. regex: "^=+(?=\\s*$)"
  2285. }, {
  2286. token: "markup.heading.2",
  2287. regex: "^\\-+(?=\\s*$)"
  2288. }, {
  2289. token: function (value) {
  2290. return "markup.heading." + value.length;
  2291. },
  2292. regex: /^#{1,6}(?=\s|$)/,
  2293. next: "header"
  2294. }, codeBlockStartRule, {
  2295. token: "string.blockquote",
  2296. regex: "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  2297. next: "blockquote"
  2298. }, {
  2299. token: "constant",
  2300. regex: "^ {0,3}(?:(?:\\* ?){3,}|(?:\\- ?){3,}|(?:\\_ ?){3,})\\s*$",
  2301. next: "allowBlock"
  2302. }, {
  2303. token: "markup.list",
  2304. regex: "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  2305. next: "listblock-start"
  2306. }, {
  2307. include: "basic"
  2308. });
  2309. this.addRules({
  2310. "basic": [{
  2311. token: "constant.language.escape",
  2312. regex: /\\[\\`*_{}\[\]()#+\-.!]/
  2313. }, {
  2314. token: "support.function",
  2315. regex: "(`+)(.*?[^`])(\\1)"
  2316. }, {
  2317. token: ["text", "constant", "text", "url", "string", "text"],
  2318. regex: "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
  2319. }, {
  2320. token: ["text", "string", "text", "constant", "text"],
  2321. regex: "(\\[)(" + escaped("]") + ")(\\]\\s*\\[)(" + escaped("]") + ")(\\])"
  2322. }, {
  2323. token: ["text", "string", "text", "markup.underline", "string", "text"],
  2324. regex: "(\\!?\\[)(" + // [
  2325. escaped("]") + // link text or alt text
  2326. ")(\\]\\()" + // ](
  2327. '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + // href or image
  2328. '(\\s*"' + escaped('"') + '"\\s*)?' + // "title"
  2329. "(\\))" // )
  2330. }, {
  2331. token: "string.strong",
  2332. regex: "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)"
  2333. }, {
  2334. token: "string.emphasis",
  2335. regex: "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)"
  2336. }, {
  2337. token: ["text", "url", "text"],
  2338. regex: "(<)(" +
  2339. "(?:https?|ftp|dict):[^'\">\\s]+" +
  2340. "|" +
  2341. "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+" +
  2342. ")(>)"
  2343. }],
  2344. "allowBlock": [
  2345. { token: "support.function", regex: "^ {4}.+", next: "allowBlock" },
  2346. { token: "empty_line", regex: '^$', next: "allowBlock" },
  2347. { token: "empty", regex: "", next: "start" }
  2348. ],
  2349. "header": [{
  2350. regex: "$",
  2351. next: "start"
  2352. }, {
  2353. include: "basic"
  2354. }, {
  2355. defaultToken: "heading"
  2356. }],
  2357. "listblock-start": [{
  2358. token: "support.variable",
  2359. regex: /(?:\[[ x]\])?/,
  2360. next: "listblock"
  2361. }],
  2362. "listblock": [{
  2363. token: "empty_line",
  2364. regex: "^$",
  2365. next: "start"
  2366. }, {
  2367. token: "markup.list",
  2368. regex: "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  2369. next: "listblock-start"
  2370. }, {
  2371. include: "basic", noEscape: true
  2372. },
  2373. codeBlockStartRule,
  2374. {
  2375. defaultToken: "list" //do not use markup.list to allow stling leading `*` differntly
  2376. }],
  2377. "blockquote": [{
  2378. token: "empty_line",
  2379. regex: "^\\s*$",
  2380. next: "start"
  2381. }, {
  2382. token: "string.blockquote",
  2383. regex: "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  2384. next: "blockquote"
  2385. }, {
  2386. include: "basic", noEscape: true
  2387. }, {
  2388. defaultToken: "string.blockquote"
  2389. }],
  2390. "githubblock": codeBlockRules
  2391. });
  2392. this.normalizeRules();
  2393. };
  2394. oop.inherits(MarkdownHighlightRules, TextHighlightRules);
  2395. exports.MarkdownHighlightRules = MarkdownHighlightRules;
  2396. });
  2397. ace.define("ace/mode/folding/markdown",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module){"use strict";
  2398. var oop = require("../../lib/oop");
  2399. var BaseFoldMode = require("./fold_mode").FoldMode;
  2400. var Range = require("../../range").Range;
  2401. var FoldMode = exports.FoldMode = function () { };
  2402. oop.inherits(FoldMode, BaseFoldMode);
  2403. (function () {
  2404. this.foldingStartMarker = /^(?:[=-]+\s*$|#{1,6} |`{3})/;
  2405. this.getFoldWidget = function (session, foldStyle, row) {
  2406. var line = session.getLine(row);
  2407. if (!this.foldingStartMarker.test(line))
  2408. return "";
  2409. if (line[0] == "`") {
  2410. if (session.bgTokenizer.getState(row) == "start")
  2411. return "end";
  2412. return "start";
  2413. }
  2414. return "start";
  2415. };
  2416. this.getFoldWidgetRange = function (session, foldStyle, row) {
  2417. var line = session.getLine(row);
  2418. var startColumn = line.length;
  2419. var maxRow = session.getLength();
  2420. var startRow = row;
  2421. var endRow = row;
  2422. if (!line.match(this.foldingStartMarker))
  2423. return;
  2424. if (line[0] == "`") {
  2425. if (session.bgTokenizer.getState(row) !== "start") {
  2426. while (++row < maxRow) {
  2427. line = session.getLine(row);
  2428. if (line[0] == "`" & line.substring(0, 3) == "```")
  2429. break;
  2430. }
  2431. return new Range(startRow, startColumn, row, 0);
  2432. }
  2433. else {
  2434. while (row-- > 0) {
  2435. line = session.getLine(row);
  2436. if (line[0] == "`" & line.substring(0, 3) == "```")
  2437. break;
  2438. }
  2439. return new Range(row, line.length, startRow, 0);
  2440. }
  2441. }
  2442. var token;
  2443. function isHeading(row) {
  2444. token = session.getTokens(row)[0];
  2445. return token && token.type.lastIndexOf(heading, 0) === 0;
  2446. }
  2447. var heading = "markup.heading";
  2448. function getLevel() {
  2449. var ch = token.value[0];
  2450. if (ch == "=")
  2451. return 6;
  2452. if (ch == "-")
  2453. return 5;
  2454. return 7 - token.value.search(/[^#]|$/);
  2455. }
  2456. if (isHeading(row)) {
  2457. var startHeadingLevel = getLevel();
  2458. while (++row < maxRow) {
  2459. if (!isHeading(row))
  2460. continue;
  2461. var level = getLevel();
  2462. if (level >= startHeadingLevel)
  2463. break;
  2464. }
  2465. endRow = row - (!token || ["=", "-"].indexOf(token.value[0]) == -1 ? 1 : 2);
  2466. if (endRow > startRow) {
  2467. while (endRow > startRow && /^\s*$/.test(session.getLine(endRow)))
  2468. endRow--;
  2469. }
  2470. if (endRow > startRow) {
  2471. var endColumn = session.getLine(endRow).length;
  2472. return new Range(startRow, startColumn, endRow, endColumn);
  2473. }
  2474. }
  2475. };
  2476. }).call(FoldMode.prototype);
  2477. });
  2478. ace.define("ace/mode/sh_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  2479. var oop = require("../lib/oop");
  2480. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  2481. var reservedKeywords = exports.reservedKeywords = ('!|{|}|case|do|done|elif|else|' +
  2482. 'esac|fi|for|if|in|then|until|while|' +
  2483. '&|;|export|local|read|typeset|unset|' +
  2484. 'elif|select|set|function|declare|readonly');
  2485. var languageConstructs = exports.languageConstructs = ('[|]|alias|bg|bind|break|builtin|' +
  2486. 'cd|command|compgen|complete|continue|' +
  2487. 'dirs|disown|echo|enable|eval|exec|' +
  2488. 'exit|fc|fg|getopts|hash|help|history|' +
  2489. 'jobs|kill|let|logout|popd|printf|pushd|' +
  2490. 'pwd|return|set|shift|shopt|source|' +
  2491. 'suspend|test|times|trap|type|ulimit|' +
  2492. 'umask|unalias|wait');
  2493. var ShHighlightRules = function () {
  2494. var keywordMapper = this.createKeywordMapper({
  2495. "keyword": reservedKeywords,
  2496. "support.function.builtin": languageConstructs,
  2497. "invalid.deprecated": "debugger"
  2498. }, "identifier");
  2499. var integer = "(?:(?:[1-9]\\d*)|(?:0))";
  2500. var fraction = "(?:\\.\\d+)";
  2501. var intPart = "(?:\\d+)";
  2502. var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
  2503. var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + ")";
  2504. var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
  2505. var fileDescriptor = "(?:&" + intPart + ")";
  2506. var variableName = "[a-zA-Z_][a-zA-Z0-9_]*";
  2507. var variable = "(?:" + variableName + "(?==))";
  2508. var builtinVariable = "(?:\\$(?:SHLVL|\\$|\\!|\\?))";
  2509. var func = "(?:" + variableName + "\\s*\\(\\))";
  2510. this.$rules = {
  2511. "start": [{
  2512. token: "constant",
  2513. regex: /\\./
  2514. }, {
  2515. token: ["text", "comment"],
  2516. regex: /(^|\s)(#.*)$/
  2517. }, {
  2518. token: "string.start",
  2519. regex: '"',
  2520. push: [{
  2521. token: "constant.language.escape",
  2522. regex: /\\(?:[$`"\\]|$)/
  2523. }, {
  2524. include: "variables"
  2525. }, {
  2526. token: "keyword.operator",
  2527. regex: /`/ // TODO highlight `
  2528. }, {
  2529. token: "string.end",
  2530. regex: '"',
  2531. next: "pop"
  2532. }, {
  2533. defaultToken: "string"
  2534. }]
  2535. }, {
  2536. token: "string",
  2537. regex: "\\$'",
  2538. push: [{
  2539. token: "constant.language.escape",
  2540. regex: /\\(?:[abeEfnrtv\\'"]|x[a-fA-F\d]{1,2}|u[a-fA-F\d]{4}([a-fA-F\d]{4})?|c.|\d{1,3})/
  2541. }, {
  2542. token: "string",
  2543. regex: "'",
  2544. next: "pop"
  2545. }, {
  2546. defaultToken: "string"
  2547. }]
  2548. }, {
  2549. regex: "<<<",
  2550. token: "keyword.operator"
  2551. }, {
  2552. stateName: "heredoc",
  2553. regex: "(<<-?)(\\s*)(['\"`]?)([\\w\\-]+)(['\"`]?)",
  2554. onMatch: function (value, currentState, stack) {
  2555. var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
  2556. var tokens = value.split(this.splitRegex);
  2557. stack.push(next, tokens[4]);
  2558. return [
  2559. { type: "constant", value: tokens[1] },
  2560. { type: "text", value: tokens[2] },
  2561. { type: "string", value: tokens[3] },
  2562. { type: "support.class", value: tokens[4] },
  2563. { type: "string", value: tokens[5] }
  2564. ];
  2565. },
  2566. rules: {
  2567. heredoc: [{
  2568. onMatch: function (value, currentState, stack) {
  2569. if (value === stack[1]) {
  2570. stack.shift();
  2571. stack.shift();
  2572. this.next = stack[0] || "start";
  2573. return "support.class";
  2574. }
  2575. this.next = "";
  2576. return "string";
  2577. },
  2578. regex: ".*$",
  2579. next: "start"
  2580. }],
  2581. indentedHeredoc: [{
  2582. token: "string",
  2583. regex: "^\t+"
  2584. }, {
  2585. onMatch: function (value, currentState, stack) {
  2586. if (value === stack[1]) {
  2587. stack.shift();
  2588. stack.shift();
  2589. this.next = stack[0] || "start";
  2590. return "support.class";
  2591. }
  2592. this.next = "";
  2593. return "string";
  2594. },
  2595. regex: ".*$",
  2596. next: "start"
  2597. }]
  2598. }
  2599. }, {
  2600. regex: "$",
  2601. token: "empty",
  2602. next: function (currentState, stack) {
  2603. if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
  2604. return stack[0];
  2605. return currentState;
  2606. }
  2607. }, {
  2608. token: ["keyword", "text", "text", "text", "variable"],
  2609. regex: /(declare|local|readonly)(\s+)(?:(-[fixar]+)(\s+))?([a-zA-Z_][a-zA-Z0-9_]*\b)/
  2610. }, {
  2611. token: "variable.language",
  2612. regex: builtinVariable
  2613. }, {
  2614. token: "variable",
  2615. regex: variable
  2616. }, {
  2617. include: "variables"
  2618. }, {
  2619. token: "support.function",
  2620. regex: func
  2621. }, {
  2622. token: "support.function",
  2623. regex: fileDescriptor
  2624. }, {
  2625. token: "string",
  2626. start: "'", end: "'"
  2627. }, {
  2628. token: "constant.numeric",
  2629. regex: floatNumber
  2630. }, {
  2631. token: "constant.numeric",
  2632. regex: integer + "\\b"
  2633. }, {
  2634. token: keywordMapper,
  2635. regex: "[a-zA-Z_][a-zA-Z0-9_]*\\b"
  2636. }, {
  2637. token: "keyword.operator",
  2638. regex: "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!=|[%&|`]"
  2639. }, {
  2640. token: "punctuation.operator",
  2641. regex: ";"
  2642. }, {
  2643. token: "paren.lparen",
  2644. regex: "[\\[\\(\\{]"
  2645. }, {
  2646. token: "paren.rparen",
  2647. regex: "[\\]]"
  2648. }, {
  2649. token: "paren.rparen",
  2650. regex: "[\\)\\}]",
  2651. next: "pop"
  2652. }],
  2653. variables: [{
  2654. token: "variable",
  2655. regex: /(\$)(\w+)/
  2656. }, {
  2657. token: ["variable", "paren.lparen"],
  2658. regex: /(\$)(\()/,
  2659. push: "start"
  2660. }, {
  2661. token: ["variable", "paren.lparen", "keyword.operator", "variable", "keyword.operator"],
  2662. regex: /(\$)(\{)([#!]?)(\w+|[*@#?\-$!0_])(:[?+\-=]?|##?|%%?|,,?\/|\^\^?)?/,
  2663. push: "start"
  2664. }, {
  2665. token: "variable",
  2666. regex: /\$[*@#?\-$!0_]/
  2667. }, {
  2668. token: ["variable", "paren.lparen"],
  2669. regex: /(\$)(\{)/,
  2670. push: "start"
  2671. }]
  2672. };
  2673. this.normalizeRules();
  2674. };
  2675. oop.inherits(ShHighlightRules, TextHighlightRules);
  2676. exports.ShHighlightRules = ShHighlightRules;
  2677. });
  2678. ace.define("ace/mode/sh",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/sh_highlight_rules","ace/range","ace/mode/folding/cstyle","ace/mode/behaviour/cstyle"], function(require, exports, module){"use strict";
  2679. var oop = require("../lib/oop");
  2680. var TextMode = require("./text").Mode;
  2681. var ShHighlightRules = require("./sh_highlight_rules").ShHighlightRules;
  2682. var Range = require("../range").Range;
  2683. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  2684. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  2685. var Mode = function () {
  2686. this.HighlightRules = ShHighlightRules;
  2687. this.foldingRules = new CStyleFoldMode();
  2688. this.$behaviour = new CstyleBehaviour();
  2689. };
  2690. oop.inherits(Mode, TextMode);
  2691. (function () {
  2692. this.lineCommentStart = "#";
  2693. this.getNextLineIndent = function (state, line, tab) {
  2694. var indent = this.$getIndent(line);
  2695. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  2696. var tokens = tokenizedLine.tokens;
  2697. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  2698. return indent;
  2699. }
  2700. if (state == "start") {
  2701. var match = line.match(/^.*[\{\(\[:]\s*$/);
  2702. if (match) {
  2703. indent += tab;
  2704. }
  2705. }
  2706. return indent;
  2707. };
  2708. var outdents = {
  2709. "pass": 1,
  2710. "return": 1,
  2711. "raise": 1,
  2712. "break": 1,
  2713. "continue": 1
  2714. };
  2715. this.checkOutdent = function (state, line, input) {
  2716. if (input !== "\r\n" && input !== "\r" && input !== "\n")
  2717. return false;
  2718. var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
  2719. if (!tokens)
  2720. return false;
  2721. do {
  2722. var last = tokens.pop();
  2723. } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
  2724. if (!last)
  2725. return false;
  2726. return (last.type == "keyword" && outdents[last.value]);
  2727. };
  2728. this.autoOutdent = function (state, doc, row) {
  2729. row += 1;
  2730. var indent = this.$getIndent(doc.getLine(row));
  2731. var tab = doc.getTabString();
  2732. if (indent.slice(-tab.length) == tab)
  2733. doc.remove(new Range(row, indent.length - tab.length, row, indent.length));
  2734. };
  2735. this.$id = "ace/mode/sh";
  2736. this.snippetFileId = "ace/snippets/sh";
  2737. }).call(Mode.prototype);
  2738. exports.Mode = Mode;
  2739. });
  2740. ace.define("ace/mode/markdown",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript","ace/mode/xml","ace/mode/html","ace/mode/markdown_highlight_rules","ace/mode/folding/markdown","ace/mode/javascript","ace/mode/html","ace/mode/sh","ace/mode/sh","ace/mode/xml","ace/mode/css"], function(require, exports, module){"use strict";
  2741. var oop = require("../lib/oop");
  2742. var TextMode = require("./text").Mode;
  2743. var JavaScriptMode = require("./javascript").Mode;
  2744. var XmlMode = require("./xml").Mode;
  2745. var HtmlMode = require("./html").Mode;
  2746. var MarkdownHighlightRules = require("./markdown_highlight_rules").MarkdownHighlightRules;
  2747. var MarkdownFoldMode = require("./folding/markdown").FoldMode;
  2748. var Mode = function () {
  2749. this.HighlightRules = MarkdownHighlightRules;
  2750. this.createModeDelegates({
  2751. javascript: require("./javascript").Mode,
  2752. html: require("./html").Mode,
  2753. bash: require("./sh").Mode,
  2754. sh: require("./sh").Mode,
  2755. xml: require("./xml").Mode,
  2756. css: require("./css").Mode
  2757. });
  2758. this.foldingRules = new MarkdownFoldMode();
  2759. this.$behaviour = this.$defaultBehaviour;
  2760. };
  2761. oop.inherits(Mode, TextMode);
  2762. (function () {
  2763. this.type = "text";
  2764. this.blockComment = { start: "<!--", end: "-->" };
  2765. this.$quotes = { '"': '"', "`": "`" };
  2766. this.getNextLineIndent = function (state, line, tab) {
  2767. if (state == "listblock") {
  2768. var match = /^(\s*)(?:([-+*])|(\d+)\.)(\s+)/.exec(line);
  2769. if (!match)
  2770. return "";
  2771. var marker = match[2];
  2772. if (!marker)
  2773. marker = parseInt(match[3], 10) + 1 + ".";
  2774. return match[1] + marker + match[4];
  2775. }
  2776. else {
  2777. return this.$getIndent(line);
  2778. }
  2779. };
  2780. this.$id = "ace/mode/markdown";
  2781. this.snippetFileId = "ace/snippets/markdown";
  2782. }).call(Mode.prototype);
  2783. exports.Mode = Mode;
  2784. }); (function() {
  2785. ace.require(["ace/mode/markdown"], function(m) {
  2786. if (typeof module == "object" && typeof exports == "object" && module) {
  2787. module.exports = m;
  2788. }
  2789. });
  2790. })();