mode-rhtml.js 109 KB

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