mode-rhtml.js 105 KB

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