a23a26b839d61e809c75d652296d814a.js 106 KB

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