mode-rhtml.js 105 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725
  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|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  64. "__parent__|__count__|escape|unescape|with|__proto__|" +
  65. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
  66. "storage.type":
  67. "const|let|var|function",
  68. "constant.language":
  69. "null|Infinity|NaN|undefined",
  70. "support.function":
  71. "alert",
  72. "constant.language.boolean": "true|false"
  73. }, "identifier");
  74. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
  75. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  76. "u[0-9a-fA-F]{4}|" + // unicode
  77. "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
  78. "[0-2][0-7]{0,2}|" + // oct
  79. "3[0-7][0-7]?|" + // oct
  80. "[4-7][0-7]?|" + //oct
  81. ".)";
  82. this.$rules = {
  83. "no_regex" : [
  84. DocCommentHighlightRules.getStartRule("doc-start"),
  85. comments("no_regex"),
  86. {
  87. token : "string",
  88. regex : "'(?=.)",
  89. next : "qstring"
  90. }, {
  91. token : "string",
  92. regex : '"(?=.)',
  93. next : "qqstring"
  94. }, {
  95. token : "constant.numeric", // 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/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 WorkerClient = require("../worker/worker_client").WorkerClient;
  640. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  641. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  642. var Mode = function() {
  643. this.HighlightRules = JavaScriptHighlightRules;
  644. this.$outdent = new MatchingBraceOutdent();
  645. this.$behaviour = new CstyleBehaviour();
  646. this.foldingRules = new CStyleFoldMode();
  647. };
  648. oop.inherits(Mode, TextMode);
  649. (function() {
  650. this.lineCommentStart = "//";
  651. this.blockComment = {start: "/*", end: "*/"};
  652. this.getNextLineIndent = function(state, line, tab) {
  653. var indent = this.$getIndent(line);
  654. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  655. var tokens = tokenizedLine.tokens;
  656. var endState = tokenizedLine.state;
  657. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  658. return indent;
  659. }
  660. if (state == "start" || state == "no_regex") {
  661. var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
  662. if (match) {
  663. indent += tab;
  664. }
  665. } else if (state == "doc-start") {
  666. if (endState == "start" || endState == "no_regex") {
  667. return "";
  668. }
  669. var match = line.match(/^\s*(\/?)\*/);
  670. if (match) {
  671. if (match[1]) {
  672. indent += " ";
  673. }
  674. indent += "* ";
  675. }
  676. }
  677. return indent;
  678. };
  679. this.checkOutdent = function(state, line, input) {
  680. return this.$outdent.checkOutdent(line, input);
  681. };
  682. this.autoOutdent = function(state, doc, row) {
  683. this.$outdent.autoOutdent(doc, row);
  684. };
  685. this.createWorker = function(session) {
  686. var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
  687. worker.attachToDocument(session.getDocument());
  688. worker.on("annotate", function(results) {
  689. session.setAnnotations(results.data);
  690. });
  691. worker.on("terminate", function() {
  692. session.clearAnnotations();
  693. });
  694. return worker;
  695. };
  696. this.$id = "ace/mode/javascript";
  697. }).call(Mode.prototype);
  698. exports.Mode = Mode;
  699. });
  700. 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) {
  701. "use strict";
  702. var oop = require("../lib/oop");
  703. var lang = require("../lib/lang");
  704. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  705. 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";
  706. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  707. 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";
  708. var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
  709. 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";
  710. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
  711. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  712. 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";
  713. var CssHighlightRules = function() {
  714. var keywordMapper = this.createKeywordMapper({
  715. "support.function": supportFunction,
  716. "support.constant": supportConstant,
  717. "support.type": supportType,
  718. "support.constant.color": supportConstantColor,
  719. "support.constant.fonts": supportConstantFonts
  720. }, "text", true);
  721. this.$rules = {
  722. "start" : [{
  723. token : "comment", // multi line comment
  724. regex : "\\/\\*",
  725. push : "comment"
  726. }, {
  727. token: "paren.lparen",
  728. regex: "\\{",
  729. push: "ruleset"
  730. }, {
  731. token: "string",
  732. regex: "@.*?{",
  733. push: "media"
  734. }, {
  735. token: "keyword",
  736. regex: "#[a-z0-9-_]+"
  737. }, {
  738. token: "variable",
  739. regex: "\\.[a-z0-9-_]+"
  740. }, {
  741. token: "string",
  742. regex: ":[a-z0-9-_]+"
  743. }, {
  744. token: "constant",
  745. regex: "[a-z0-9-_]+"
  746. }, {
  747. caseInsensitive: true
  748. }],
  749. "media" : [{
  750. token : "comment", // multi line comment
  751. regex : "\\/\\*",
  752. push : "comment"
  753. }, {
  754. token: "paren.lparen",
  755. regex: "\\{",
  756. push: "ruleset"
  757. }, {
  758. token: "string",
  759. regex: "\\}",
  760. next: "pop"
  761. }, {
  762. token: "keyword",
  763. regex: "#[a-z0-9-_]+"
  764. }, {
  765. token: "variable",
  766. regex: "\\.[a-z0-9-_]+"
  767. }, {
  768. token: "string",
  769. regex: ":[a-z0-9-_]+"
  770. }, {
  771. token: "constant",
  772. regex: "[a-z0-9-_]+"
  773. }, {
  774. caseInsensitive: true
  775. }],
  776. "comment" : [{
  777. token : "comment",
  778. regex : "\\*\\/",
  779. next : "pop"
  780. }, {
  781. defaultToken : "comment"
  782. }],
  783. "ruleset" : [
  784. {
  785. token : "paren.rparen",
  786. regex : "\\}",
  787. next: "pop"
  788. }, {
  789. token : "comment", // multi line comment
  790. regex : "\\/\\*",
  791. push : "comment"
  792. }, {
  793. token : "string", // single line
  794. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  795. }, {
  796. token : "string", // single line
  797. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  798. }, {
  799. token : ["constant.numeric", "keyword"],
  800. 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|%)"
  801. }, {
  802. token : "constant.numeric",
  803. regex : numRe
  804. }, {
  805. token : "constant.numeric", // hex6 color
  806. regex : "#[a-f0-9]{6}"
  807. }, {
  808. token : "constant.numeric", // hex3 color
  809. regex : "#[a-f0-9]{3}"
  810. }, {
  811. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  812. regex : pseudoElements
  813. }, {
  814. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  815. regex : pseudoClasses
  816. }, {
  817. token : ["support.function", "string", "support.function"],
  818. regex : "(url\\()(.*)(\\))"
  819. }, {
  820. token : keywordMapper,
  821. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  822. }, {
  823. caseInsensitive: true
  824. }]
  825. };
  826. this.normalizeRules();
  827. };
  828. oop.inherits(CssHighlightRules, TextHighlightRules);
  829. exports.CssHighlightRules = CssHighlightRules;
  830. });
  831. ace.define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module) {
  832. "use strict";
  833. var propertyMap = {
  834. "background": {"#$0": 1},
  835. "background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
  836. "background-image": {"url('/$0')": 1},
  837. "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
  838. "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2},
  839. "background-attachment": {"scroll": 1, "fixed": 1},
  840. "background-size": {"cover": 1, "contain": 1},
  841. "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
  842. "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
  843. "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
  844. "border-color": {"#$0": 1},
  845. "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2},
  846. "border-collapse": {"collapse": 1, "separate": 1},
  847. "bottom": {"px": 1, "em": 1, "%": 1},
  848. "clear": {"left": 1, "right": 1, "both": 1, "none": 1},
  849. "color": {"#$0": 1, "rgb(#$00,0,0)": 1},
  850. "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},
  851. "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
  852. "empty-cells": {"show": 1, "hide": 1},
  853. "float": {"left": 1, "right": 1, "none": 1},
  854. "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},
  855. "font-size": {"px": 1, "em": 1, "%": 1},
  856. "font-weight": {"bold": 1, "normal": 1},
  857. "font-style": {"italic": 1, "normal": 1},
  858. "font-variant": {"normal": 1, "small-caps": 1},
  859. "height": {"px": 1, "em": 1, "%": 1},
  860. "left": {"px": 1, "em": 1, "%": 1},
  861. "letter-spacing": {"normal": 1},
  862. "line-height": {"normal": 1},
  863. "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},
  864. "margin": {"px": 1, "em": 1, "%": 1},
  865. "margin-right": {"px": 1, "em": 1, "%": 1},
  866. "margin-left": {"px": 1, "em": 1, "%": 1},
  867. "margin-top": {"px": 1, "em": 1, "%": 1},
  868. "margin-bottom": {"px": 1, "em": 1, "%": 1},
  869. "max-height": {"px": 1, "em": 1, "%": 1},
  870. "max-width": {"px": 1, "em": 1, "%": 1},
  871. "min-height": {"px": 1, "em": 1, "%": 1},
  872. "min-width": {"px": 1, "em": 1, "%": 1},
  873. "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  874. "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  875. "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  876. "padding": {"px": 1, "em": 1, "%": 1},
  877. "padding-top": {"px": 1, "em": 1, "%": 1},
  878. "padding-right": {"px": 1, "em": 1, "%": 1},
  879. "padding-bottom": {"px": 1, "em": 1, "%": 1},
  880. "padding-left": {"px": 1, "em": 1, "%": 1},
  881. "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  882. "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  883. "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
  884. "right": {"px": 1, "em": 1, "%": 1},
  885. "table-layout": {"fixed": 1, "auto": 1},
  886. "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
  887. "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
  888. "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
  889. "top": {"px": 1, "em": 1, "%": 1},
  890. "vertical-align": {"top": 1, "bottom": 1},
  891. "visibility": {"hidden": 1, "visible": 1},
  892. "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
  893. "width": {"px": 1, "em": 1, "%": 1},
  894. "word-spacing": {"normal": 1},
  895. "filter": {"alpha(opacity=$0100)": 1},
  896. "text-shadow": {"$02px 2px 2px #777": 1},
  897. "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
  898. "-moz-border-radius": 1,
  899. "-moz-border-radius-topright": 1,
  900. "-moz-border-radius-bottomright": 1,
  901. "-moz-border-radius-topleft": 1,
  902. "-moz-border-radius-bottomleft": 1,
  903. "-webkit-border-radius": 1,
  904. "-webkit-border-top-right-radius": 1,
  905. "-webkit-border-top-left-radius": 1,
  906. "-webkit-border-bottom-right-radius": 1,
  907. "-webkit-border-bottom-left-radius": 1,
  908. "-moz-box-shadow": 1,
  909. "-webkit-box-shadow": 1,
  910. "transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  911. "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  912. "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
  913. };
  914. var CssCompletions = function() {
  915. };
  916. (function() {
  917. this.completionsDefined = false;
  918. this.defineCompletions = function() {
  919. if (document) {
  920. var style = document.createElement('c').style;
  921. for (var i in style) {
  922. if (typeof style[i] !== 'string')
  923. continue;
  924. var name = i.replace(/[A-Z]/g, function(x) {
  925. return '-' + x.toLowerCase();
  926. });
  927. if (!propertyMap.hasOwnProperty(name))
  928. propertyMap[name] = 1;
  929. }
  930. }
  931. this.completionsDefined = true;
  932. }
  933. this.getCompletions = function(state, session, pos, prefix) {
  934. if (!this.completionsDefined) {
  935. this.defineCompletions();
  936. }
  937. var token = session.getTokenAt(pos.row, pos.column);
  938. if (!token)
  939. return [];
  940. if (state==='ruleset'){
  941. var line = session.getLine(pos.row).substr(0, pos.column);
  942. if (/:[^;]+$/.test(line)) {
  943. /([\w\-]+):[^:]*$/.test(line);
  944. return this.getPropertyValueCompletions(state, session, pos, prefix);
  945. } else {
  946. return this.getPropertyCompletions(state, session, pos, prefix);
  947. }
  948. }
  949. return [];
  950. };
  951. this.getPropertyCompletions = function(state, session, pos, prefix) {
  952. var properties = Object.keys(propertyMap);
  953. return properties.map(function(property){
  954. return {
  955. caption: property,
  956. snippet: property + ': $0',
  957. meta: "property",
  958. score: Number.MAX_VALUE
  959. };
  960. });
  961. };
  962. this.getPropertyValueCompletions = function(state, session, pos, prefix) {
  963. var line = session.getLine(pos.row).substr(0, pos.column);
  964. var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
  965. if (!property)
  966. return [];
  967. var values = [];
  968. if (property in propertyMap && typeof propertyMap[property] === "object") {
  969. values = Object.keys(propertyMap[property]);
  970. }
  971. return values.map(function(value){
  972. return {
  973. caption: value,
  974. snippet: value,
  975. meta: "property value",
  976. score: Number.MAX_VALUE
  977. };
  978. });
  979. };
  980. }).call(CssCompletions.prototype);
  981. exports.CssCompletions = CssCompletions;
  982. });
  983. 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) {
  984. "use strict";
  985. var oop = require("../../lib/oop");
  986. var Behaviour = require("../behaviour").Behaviour;
  987. var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
  988. var TokenIterator = require("../../token_iterator").TokenIterator;
  989. var CssBehaviour = function () {
  990. this.inherit(CstyleBehaviour);
  991. this.add("colon", "insertion", function (state, action, editor, session, text) {
  992. if (text === ':') {
  993. var cursor = editor.getCursorPosition();
  994. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  995. var token = iterator.getCurrentToken();
  996. if (token && token.value.match(/\s+/)) {
  997. token = iterator.stepBackward();
  998. }
  999. if (token && token.type === 'support.type') {
  1000. var line = session.doc.getLine(cursor.row);
  1001. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1002. if (rightChar === ':') {
  1003. return {
  1004. text: '',
  1005. selection: [1, 1]
  1006. }
  1007. }
  1008. if (!line.substring(cursor.column).match(/^\s*;/)) {
  1009. return {
  1010. text: ':;',
  1011. selection: [1, 1]
  1012. }
  1013. }
  1014. }
  1015. }
  1016. });
  1017. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1018. var selected = session.doc.getTextRange(range);
  1019. if (!range.isMultiLine() && selected === ':') {
  1020. var cursor = editor.getCursorPosition();
  1021. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1022. var token = iterator.getCurrentToken();
  1023. if (token && token.value.match(/\s+/)) {
  1024. token = iterator.stepBackward();
  1025. }
  1026. if (token && token.type === 'support.type') {
  1027. var line = session.doc.getLine(range.start.row);
  1028. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1029. if (rightChar === ';') {
  1030. range.end.column ++;
  1031. return range;
  1032. }
  1033. }
  1034. }
  1035. });
  1036. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1037. if (text === ';') {
  1038. var cursor = editor.getCursorPosition();
  1039. var line = session.doc.getLine(cursor.row);
  1040. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1041. if (rightChar === ';') {
  1042. return {
  1043. text: '',
  1044. selection: [1, 1]
  1045. }
  1046. }
  1047. }
  1048. });
  1049. }
  1050. oop.inherits(CssBehaviour, CstyleBehaviour);
  1051. exports.CssBehaviour = CssBehaviour;
  1052. });
  1053. 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) {
  1054. "use strict";
  1055. var oop = require("../lib/oop");
  1056. var TextMode = require("./text").Mode;
  1057. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1058. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1059. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1060. var CssCompletions = require("./css_completions").CssCompletions;
  1061. var CssBehaviour = require("./behaviour/css").CssBehaviour;
  1062. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1063. var Mode = function() {
  1064. this.HighlightRules = CssHighlightRules;
  1065. this.$outdent = new MatchingBraceOutdent();
  1066. this.$behaviour = new CssBehaviour();
  1067. this.$completer = new CssCompletions();
  1068. this.foldingRules = new CStyleFoldMode();
  1069. };
  1070. oop.inherits(Mode, TextMode);
  1071. (function() {
  1072. this.foldingRules = "cStyle";
  1073. this.blockComment = {start: "/*", end: "*/"};
  1074. this.getNextLineIndent = function(state, line, tab) {
  1075. var indent = this.$getIndent(line);
  1076. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1077. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1078. return indent;
  1079. }
  1080. var match = line.match(/^.*\{\s*$/);
  1081. if (match) {
  1082. indent += tab;
  1083. }
  1084. return indent;
  1085. };
  1086. this.checkOutdent = function(state, line, input) {
  1087. return this.$outdent.checkOutdent(line, input);
  1088. };
  1089. this.autoOutdent = function(state, doc, row) {
  1090. this.$outdent.autoOutdent(doc, row);
  1091. };
  1092. this.getCompletions = function(state, session, pos, prefix) {
  1093. return this.$completer.getCompletions(state, session, pos, prefix);
  1094. };
  1095. this.createWorker = function(session) {
  1096. var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
  1097. worker.attachToDocument(session.getDocument());
  1098. worker.on("annotate", function(e) {
  1099. session.setAnnotations(e.data);
  1100. });
  1101. worker.on("terminate", function() {
  1102. session.clearAnnotations();
  1103. });
  1104. return worker;
  1105. };
  1106. this.$id = "ace/mode/css";
  1107. }).call(Mode.prototype);
  1108. exports.Mode = Mode;
  1109. });
  1110. ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  1111. "use strict";
  1112. var oop = require("../lib/oop");
  1113. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  1114. var XmlHighlightRules = function(normalize) {
  1115. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  1116. this.$rules = {
  1117. start : [
  1118. {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
  1119. {
  1120. token : ["punctuation.xml-decl.xml", "keyword.xml-decl.xml"],
  1121. regex : "(<\\?)(xml)(?=[\\s])", next : "xml_decl", caseInsensitive: true
  1122. },
  1123. {
  1124. token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
  1125. regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction"
  1126. },
  1127. {token : "comment.xml", regex : "<\\!--", next : "comment"},
  1128. {
  1129. token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  1130. regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
  1131. },
  1132. {include : "tag"},
  1133. {token : "text.end-tag-open.xml", regex: "</"},
  1134. {token : "text.tag-open.xml", regex: "<"},
  1135. {include : "reference"},
  1136. {defaultToken : "text.xml"}
  1137. ],
  1138. xml_decl : [{
  1139. token : "entity.other.attribute-name.decl-attribute-name.xml",
  1140. regex : "(?:" + tagRegex + ":)?" + tagRegex + ""
  1141. }, {
  1142. token : "keyword.operator.decl-attribute-equals.xml",
  1143. regex : "="
  1144. }, {
  1145. include: "whitespace"
  1146. }, {
  1147. include: "string"
  1148. }, {
  1149. token : "punctuation.xml-decl.xml",
  1150. regex : "\\?>",
  1151. next : "start"
  1152. }],
  1153. processing_instruction : [
  1154. {token : "punctuation.instruction.xml", regex : "\\?>", next : "start"},
  1155. {defaultToken : "instruction.xml"}
  1156. ],
  1157. doctype : [
  1158. {include : "whitespace"},
  1159. {include : "string"},
  1160. {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
  1161. {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
  1162. {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
  1163. ],
  1164. int_subset : [{
  1165. token : "text.xml",
  1166. regex : "\\s+"
  1167. }, {
  1168. token: "punctuation.int-subset.xml",
  1169. regex: "]",
  1170. next: "pop"
  1171. }, {
  1172. token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  1173. regex : "(<\\!)(" + tagRegex + ")",
  1174. push : [{
  1175. token : "text",
  1176. regex : "\\s+"
  1177. },
  1178. {
  1179. token : "punctuation.markup-decl.xml",
  1180. regex : ">",
  1181. next : "pop"
  1182. },
  1183. {include : "string"}]
  1184. }],
  1185. cdata : [
  1186. {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
  1187. {token : "text.xml", regex : "\\s+"},
  1188. {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
  1189. ],
  1190. comment : [
  1191. {token : "comment.xml", regex : "-->", next : "start"},
  1192. {defaultToken : "comment.xml"}
  1193. ],
  1194. reference : [{
  1195. token : "constant.language.escape.reference.xml",
  1196. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  1197. }],
  1198. attr_reference : [{
  1199. token : "constant.language.escape.reference.attribute-value.xml",
  1200. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  1201. }],
  1202. tag : [{
  1203. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  1204. regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  1205. next: [
  1206. {include : "attributes"},
  1207. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  1208. ]
  1209. }],
  1210. tag_whitespace : [
  1211. {token : "text.tag-whitespace.xml", regex : "\\s+"}
  1212. ],
  1213. whitespace : [
  1214. {token : "text.whitespace.xml", regex : "\\s+"}
  1215. ],
  1216. string: [{
  1217. token : "string.xml",
  1218. regex : "'",
  1219. push : [
  1220. {token : "string.xml", regex: "'", next: "pop"},
  1221. {defaultToken : "string.xml"}
  1222. ]
  1223. }, {
  1224. token : "string.xml",
  1225. regex : '"',
  1226. push : [
  1227. {token : "string.xml", regex: '"', next: "pop"},
  1228. {defaultToken : "string.xml"}
  1229. ]
  1230. }],
  1231. attributes: [{
  1232. token : "entity.other.attribute-name.xml",
  1233. regex : "(?:" + tagRegex + ":)?" + tagRegex + ""
  1234. }, {
  1235. token : "keyword.operator.attribute-equals.xml",
  1236. regex : "="
  1237. }, {
  1238. include: "tag_whitespace"
  1239. }, {
  1240. include: "attribute_value"
  1241. }],
  1242. attribute_value: [{
  1243. token : "string.attribute-value.xml",
  1244. regex : "'",
  1245. push : [
  1246. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  1247. {include : "attr_reference"},
  1248. {defaultToken : "string.attribute-value.xml"}
  1249. ]
  1250. }, {
  1251. token : "string.attribute-value.xml",
  1252. regex : '"',
  1253. push : [
  1254. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  1255. {include : "attr_reference"},
  1256. {defaultToken : "string.attribute-value.xml"}
  1257. ]
  1258. }]
  1259. };
  1260. if (this.constructor === XmlHighlightRules)
  1261. this.normalizeRules();
  1262. };
  1263. (function() {
  1264. this.embedTagRules = function(HighlightRules, prefix, tag){
  1265. this.$rules.tag.unshift({
  1266. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  1267. regex : "(<)(" + tag + "(?=\\s|>|$))",
  1268. next: [
  1269. {include : "attributes"},
  1270. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
  1271. ]
  1272. });
  1273. this.$rules[tag + "-end"] = [
  1274. {include : "attributes"},
  1275. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
  1276. onMatch : function(value, currentState, stack) {
  1277. stack.splice(0);
  1278. return this.token;
  1279. }}
  1280. ]
  1281. this.embedRules(HighlightRules, prefix, [{
  1282. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  1283. regex : "(</)(" + tag + "(?=\\s|>|$))",
  1284. next: tag + "-end"
  1285. }, {
  1286. token: "string.cdata.xml",
  1287. regex : "<\\!\\[CDATA\\["
  1288. }, {
  1289. token: "string.cdata.xml",
  1290. regex : "\\]\\]>"
  1291. }]);
  1292. };
  1293. }).call(TextHighlightRules.prototype);
  1294. oop.inherits(XmlHighlightRules, TextHighlightRules);
  1295. exports.XmlHighlightRules = XmlHighlightRules;
  1296. });
  1297. 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) {
  1298. "use strict";
  1299. var oop = require("../lib/oop");
  1300. var lang = require("../lib/lang");
  1301. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1302. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1303. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  1304. var tagMap = lang.createMap({
  1305. a : 'anchor',
  1306. button : 'form',
  1307. form : 'form',
  1308. img : 'image',
  1309. input : 'form',
  1310. label : 'form',
  1311. option : 'form',
  1312. script : 'script',
  1313. select : 'form',
  1314. textarea : 'form',
  1315. style : 'style',
  1316. table : 'table',
  1317. tbody : 'table',
  1318. td : 'table',
  1319. tfoot : 'table',
  1320. th : 'table',
  1321. tr : 'table'
  1322. });
  1323. var HtmlHighlightRules = function() {
  1324. XmlHighlightRules.call(this);
  1325. this.addRules({
  1326. attributes: [{
  1327. include : "tag_whitespace"
  1328. }, {
  1329. token : "entity.other.attribute-name.xml",
  1330. regex : "[-_a-zA-Z0-9:.]+"
  1331. }, {
  1332. token : "keyword.operator.attribute-equals.xml",
  1333. regex : "=",
  1334. push : [{
  1335. include: "tag_whitespace"
  1336. }, {
  1337. token : "string.unquoted.attribute-value.html",
  1338. regex : "[^<>='\"`\\s]+",
  1339. next : "pop"
  1340. }, {
  1341. token : "empty",
  1342. regex : "",
  1343. next : "pop"
  1344. }]
  1345. }, {
  1346. include : "attribute_value"
  1347. }],
  1348. tag: [{
  1349. token : function(start, tag) {
  1350. var group = tagMap[tag];
  1351. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  1352. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  1353. },
  1354. regex : "(</?)([-_a-zA-Z0-9:.]+)",
  1355. next: "tag_stuff"
  1356. }],
  1357. tag_stuff: [
  1358. {include : "attributes"},
  1359. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  1360. ]
  1361. });
  1362. this.embedTagRules(CssHighlightRules, "css-", "style");
  1363. this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "js-", "script");
  1364. if (this.constructor === HtmlHighlightRules)
  1365. this.normalizeRules();
  1366. };
  1367. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  1368. exports.HtmlHighlightRules = HtmlHighlightRules;
  1369. });
  1370. 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) {
  1371. "use strict";
  1372. var oop = require("../../lib/oop");
  1373. var Behaviour = require("../behaviour").Behaviour;
  1374. var TokenIterator = require("../../token_iterator").TokenIterator;
  1375. var lang = require("../../lib/lang");
  1376. function is(token, type) {
  1377. return token.type.lastIndexOf(type + ".xml") > -1;
  1378. }
  1379. var XmlBehaviour = function () {
  1380. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  1381. if (text == '"' || text == "'") {
  1382. var quote = text;
  1383. var selected = session.doc.getTextRange(editor.getSelectionRange());
  1384. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  1385. return {
  1386. text: quote + selected + quote,
  1387. selection: false
  1388. };
  1389. }
  1390. var cursor = editor.getCursorPosition();
  1391. var line = session.doc.getLine(cursor.row);
  1392. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1393. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1394. var token = iterator.getCurrentToken();
  1395. if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
  1396. return {
  1397. text: "",
  1398. selection: [1, 1]
  1399. };
  1400. }
  1401. if (!token)
  1402. token = iterator.stepBackward();
  1403. if (!token)
  1404. return;
  1405. while (is(token, "tag-whitespace") || is(token, "whitespace")) {
  1406. token = iterator.stepBackward();
  1407. }
  1408. var rightSpace = !rightChar || rightChar.match(/\s/);
  1409. if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
  1410. return {
  1411. text: quote + quote,
  1412. selection: [1, 1]
  1413. };
  1414. }
  1415. }
  1416. });
  1417. this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
  1418. var selected = session.doc.getTextRange(range);
  1419. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  1420. var line = session.doc.getLine(range.start.row);
  1421. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  1422. if (rightChar == selected) {
  1423. range.end.column++;
  1424. return range;
  1425. }
  1426. }
  1427. });
  1428. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  1429. if (text == '>') {
  1430. var position = editor.getSelectionRange().start;
  1431. var iterator = new TokenIterator(session, position.row, position.column);
  1432. var token = iterator.getCurrentToken() || iterator.stepBackward();
  1433. if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
  1434. return;
  1435. if (is(token, "reference.attribute-value"))
  1436. return;
  1437. if (is(token, "attribute-value")) {
  1438. var firstChar = token.value.charAt(0);
  1439. if (firstChar == '"' || firstChar == "'") {
  1440. var lastChar = token.value.charAt(token.value.length - 1);
  1441. var tokenEnd = iterator.getCurrentTokenColumn() + token.value.length;
  1442. if (tokenEnd > position.column || tokenEnd == position.column && firstChar != lastChar)
  1443. return;
  1444. }
  1445. }
  1446. while (!is(token, "tag-name")) {
  1447. token = iterator.stepBackward();
  1448. if (token.value == "<") {
  1449. token = iterator.stepForward();
  1450. break;
  1451. }
  1452. }
  1453. var tokenRow = iterator.getCurrentTokenRow();
  1454. var tokenColumn = iterator.getCurrentTokenColumn();
  1455. if (is(iterator.stepBackward(), "end-tag-open"))
  1456. return;
  1457. var element = token.value;
  1458. if (tokenRow == position.row)
  1459. element = element.substring(0, position.column - tokenColumn);
  1460. if (this.voidElements.hasOwnProperty(element.toLowerCase()))
  1461. return;
  1462. return {
  1463. text: ">" + "</" + element + ">",
  1464. selection: [1, 1]
  1465. };
  1466. }
  1467. });
  1468. this.add("autoindent", "insertion", function (state, action, editor, session, text) {
  1469. if (text == "\n") {
  1470. var cursor = editor.getCursorPosition();
  1471. var line = session.getLine(cursor.row);
  1472. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1473. var token = iterator.getCurrentToken();
  1474. if (token && token.type.indexOf("tag-close") !== -1) {
  1475. if (token.value == "/>")
  1476. return;
  1477. while (token && token.type.indexOf("tag-name") === -1) {
  1478. token = iterator.stepBackward();
  1479. }
  1480. if (!token) {
  1481. return;
  1482. }
  1483. var tag = token.value;
  1484. var row = iterator.getCurrentTokenRow();
  1485. token = iterator.stepBackward();
  1486. if (!token || token.type.indexOf("end-tag") !== -1) {
  1487. return;
  1488. }
  1489. if (this.voidElements && !this.voidElements[tag]) {
  1490. var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
  1491. var line = session.getLine(row);
  1492. var nextIndent = this.$getIndent(line);
  1493. var indent = nextIndent + session.getTabString();
  1494. if (nextToken && nextToken.value === "</") {
  1495. return {
  1496. text: "\n" + indent + "\n" + nextIndent,
  1497. selection: [1, indent.length, 1, indent.length]
  1498. };
  1499. } else {
  1500. return {
  1501. text: "\n" + indent
  1502. };
  1503. }
  1504. }
  1505. }
  1506. }
  1507. });
  1508. };
  1509. oop.inherits(XmlBehaviour, Behaviour);
  1510. exports.XmlBehaviour = XmlBehaviour;
  1511. });
  1512. ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module) {
  1513. "use strict";
  1514. var oop = require("../../lib/oop");
  1515. var BaseFoldMode = require("./fold_mode").FoldMode;
  1516. var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
  1517. this.defaultMode = defaultMode;
  1518. this.subModes = subModes;
  1519. };
  1520. oop.inherits(FoldMode, BaseFoldMode);
  1521. (function() {
  1522. this.$getMode = function(state) {
  1523. if (typeof state != "string")
  1524. state = state[0];
  1525. for (var key in this.subModes) {
  1526. if (state.indexOf(key) === 0)
  1527. return this.subModes[key];
  1528. }
  1529. return null;
  1530. };
  1531. this.$tryMode = function(state, session, foldStyle, row) {
  1532. var mode = this.$getMode(state);
  1533. return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
  1534. };
  1535. this.getFoldWidget = function(session, foldStyle, row) {
  1536. return (
  1537. this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
  1538. this.$tryMode(session.getState(row), session, foldStyle, row) ||
  1539. this.defaultMode.getFoldWidget(session, foldStyle, row)
  1540. );
  1541. };
  1542. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1543. var mode = this.$getMode(session.getState(row-1));
  1544. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1545. mode = this.$getMode(session.getState(row));
  1546. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1547. mode = this.defaultMode;
  1548. return mode.getFoldWidgetRange(session, foldStyle, row);
  1549. };
  1550. }).call(FoldMode.prototype);
  1551. });
  1552. 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) {
  1553. "use strict";
  1554. var oop = require("../../lib/oop");
  1555. var lang = require("../../lib/lang");
  1556. var Range = require("../../range").Range;
  1557. var BaseFoldMode = require("./fold_mode").FoldMode;
  1558. var TokenIterator = require("../../token_iterator").TokenIterator;
  1559. var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
  1560. BaseFoldMode.call(this);
  1561. this.voidElements = voidElements || {};
  1562. this.optionalEndTags = oop.mixin({}, this.voidElements);
  1563. if (optionalEndTags)
  1564. oop.mixin(this.optionalEndTags, optionalEndTags);
  1565. };
  1566. oop.inherits(FoldMode, BaseFoldMode);
  1567. var Tag = function() {
  1568. this.tagName = "";
  1569. this.closing = false;
  1570. this.selfClosing = false;
  1571. this.start = {row: 0, column: 0};
  1572. this.end = {row: 0, column: 0};
  1573. };
  1574. function is(token, type) {
  1575. return token.type.lastIndexOf(type + ".xml") > -1;
  1576. }
  1577. (function() {
  1578. this.getFoldWidget = function(session, foldStyle, row) {
  1579. var tag = this._getFirstTagInLine(session, row);
  1580. if (!tag)
  1581. return "";
  1582. if (tag.closing || (!tag.tagName && tag.selfClosing))
  1583. return foldStyle == "markbeginend" ? "end" : "";
  1584. if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
  1585. return "";
  1586. if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
  1587. return "";
  1588. return "start";
  1589. };
  1590. this._getFirstTagInLine = function(session, row) {
  1591. var tokens = session.getTokens(row);
  1592. var tag = new Tag();
  1593. for (var i = 0; i < tokens.length; i++) {
  1594. var token = tokens[i];
  1595. if (is(token, "tag-open")) {
  1596. tag.end.column = tag.start.column + token.value.length;
  1597. tag.closing = is(token, "end-tag-open");
  1598. token = tokens[++i];
  1599. if (!token)
  1600. return null;
  1601. tag.tagName = token.value;
  1602. tag.end.column += token.value.length;
  1603. for (i++; i < tokens.length; i++) {
  1604. token = tokens[i];
  1605. tag.end.column += token.value.length;
  1606. if (is(token, "tag-close")) {
  1607. tag.selfClosing = token.value == '/>';
  1608. break;
  1609. }
  1610. }
  1611. return tag;
  1612. } else if (is(token, "tag-close")) {
  1613. tag.selfClosing = token.value == '/>';
  1614. return tag;
  1615. }
  1616. tag.start.column += token.value.length;
  1617. }
  1618. return null;
  1619. };
  1620. this._findEndTagInLine = function(session, row, tagName, startColumn) {
  1621. var tokens = session.getTokens(row);
  1622. var column = 0;
  1623. for (var i = 0; i < tokens.length; i++) {
  1624. var token = tokens[i];
  1625. column += token.value.length;
  1626. if (column < startColumn)
  1627. continue;
  1628. if (is(token, "end-tag-open")) {
  1629. token = tokens[i + 1];
  1630. if (token && token.value == tagName)
  1631. return true;
  1632. }
  1633. }
  1634. return false;
  1635. };
  1636. this._readTagForward = function(iterator) {
  1637. var token = iterator.getCurrentToken();
  1638. if (!token)
  1639. return null;
  1640. var tag = new Tag();
  1641. do {
  1642. if (is(token, "tag-open")) {
  1643. tag.closing = is(token, "end-tag-open");
  1644. tag.start.row = iterator.getCurrentTokenRow();
  1645. tag.start.column = iterator.getCurrentTokenColumn();
  1646. } else if (is(token, "tag-name")) {
  1647. tag.tagName = token.value;
  1648. } else if (is(token, "tag-close")) {
  1649. tag.selfClosing = token.value == "/>";
  1650. tag.end.row = iterator.getCurrentTokenRow();
  1651. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1652. iterator.stepForward();
  1653. return tag;
  1654. }
  1655. } while(token = iterator.stepForward());
  1656. return null;
  1657. };
  1658. this._readTagBackward = function(iterator) {
  1659. var token = iterator.getCurrentToken();
  1660. if (!token)
  1661. return null;
  1662. var tag = new Tag();
  1663. do {
  1664. if (is(token, "tag-open")) {
  1665. tag.closing = is(token, "end-tag-open");
  1666. tag.start.row = iterator.getCurrentTokenRow();
  1667. tag.start.column = iterator.getCurrentTokenColumn();
  1668. iterator.stepBackward();
  1669. return tag;
  1670. } else if (is(token, "tag-name")) {
  1671. tag.tagName = token.value;
  1672. } else if (is(token, "tag-close")) {
  1673. tag.selfClosing = token.value == "/>";
  1674. tag.end.row = iterator.getCurrentTokenRow();
  1675. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1676. }
  1677. } while(token = iterator.stepBackward());
  1678. return null;
  1679. };
  1680. this._pop = function(stack, tag) {
  1681. while (stack.length) {
  1682. var top = stack[stack.length-1];
  1683. if (!tag || top.tagName == tag.tagName) {
  1684. return stack.pop();
  1685. }
  1686. else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
  1687. stack.pop();
  1688. continue;
  1689. } else {
  1690. return null;
  1691. }
  1692. }
  1693. };
  1694. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1695. var firstTag = this._getFirstTagInLine(session, row);
  1696. if (!firstTag)
  1697. return null;
  1698. var isBackward = firstTag.closing || firstTag.selfClosing;
  1699. var stack = [];
  1700. var tag;
  1701. if (!isBackward) {
  1702. var iterator = new TokenIterator(session, row, firstTag.start.column);
  1703. var start = {
  1704. row: row,
  1705. column: firstTag.start.column + firstTag.tagName.length + 2
  1706. };
  1707. if (firstTag.start.row == firstTag.end.row)
  1708. start.column = firstTag.end.column;
  1709. while (tag = this._readTagForward(iterator)) {
  1710. if (tag.selfClosing) {
  1711. if (!stack.length) {
  1712. tag.start.column += tag.tagName.length + 2;
  1713. tag.end.column -= 2;
  1714. return Range.fromPoints(tag.start, tag.end);
  1715. } else
  1716. continue;
  1717. }
  1718. if (tag.closing) {
  1719. this._pop(stack, tag);
  1720. if (stack.length == 0)
  1721. return Range.fromPoints(start, tag.start);
  1722. }
  1723. else {
  1724. stack.push(tag);
  1725. }
  1726. }
  1727. }
  1728. else {
  1729. var iterator = new TokenIterator(session, row, firstTag.end.column);
  1730. var end = {
  1731. row: row,
  1732. column: firstTag.start.column
  1733. };
  1734. while (tag = this._readTagBackward(iterator)) {
  1735. if (tag.selfClosing) {
  1736. if (!stack.length) {
  1737. tag.start.column += tag.tagName.length + 2;
  1738. tag.end.column -= 2;
  1739. return Range.fromPoints(tag.start, tag.end);
  1740. } else
  1741. continue;
  1742. }
  1743. if (!tag.closing) {
  1744. this._pop(stack, tag);
  1745. if (stack.length == 0) {
  1746. tag.start.column += tag.tagName.length + 2;
  1747. if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
  1748. tag.start.column = tag.end.column;
  1749. return Range.fromPoints(tag.start, end);
  1750. }
  1751. }
  1752. else {
  1753. stack.push(tag);
  1754. }
  1755. }
  1756. }
  1757. };
  1758. }).call(FoldMode.prototype);
  1759. });
  1760. 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) {
  1761. "use strict";
  1762. var oop = require("../../lib/oop");
  1763. var MixedFoldMode = require("./mixed").FoldMode;
  1764. var XmlFoldMode = require("./xml").FoldMode;
  1765. var CStyleFoldMode = require("./cstyle").FoldMode;
  1766. var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
  1767. MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
  1768. "js-": new CStyleFoldMode(),
  1769. "css-": new CStyleFoldMode()
  1770. });
  1771. };
  1772. oop.inherits(FoldMode, MixedFoldMode);
  1773. });
  1774. ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module) {
  1775. "use strict";
  1776. var TokenIterator = require("../token_iterator").TokenIterator;
  1777. var commonAttributes = [
  1778. "accesskey",
  1779. "class",
  1780. "contenteditable",
  1781. "contextmenu",
  1782. "dir",
  1783. "draggable",
  1784. "dropzone",
  1785. "hidden",
  1786. "id",
  1787. "inert",
  1788. "itemid",
  1789. "itemprop",
  1790. "itemref",
  1791. "itemscope",
  1792. "itemtype",
  1793. "lang",
  1794. "spellcheck",
  1795. "style",
  1796. "tabindex",
  1797. "title",
  1798. "translate"
  1799. ];
  1800. var eventAttributes = [
  1801. "onabort",
  1802. "onblur",
  1803. "oncancel",
  1804. "oncanplay",
  1805. "oncanplaythrough",
  1806. "onchange",
  1807. "onclick",
  1808. "onclose",
  1809. "oncontextmenu",
  1810. "oncuechange",
  1811. "ondblclick",
  1812. "ondrag",
  1813. "ondragend",
  1814. "ondragenter",
  1815. "ondragleave",
  1816. "ondragover",
  1817. "ondragstart",
  1818. "ondrop",
  1819. "ondurationchange",
  1820. "onemptied",
  1821. "onended",
  1822. "onerror",
  1823. "onfocus",
  1824. "oninput",
  1825. "oninvalid",
  1826. "onkeydown",
  1827. "onkeypress",
  1828. "onkeyup",
  1829. "onload",
  1830. "onloadeddata",
  1831. "onloadedmetadata",
  1832. "onloadstart",
  1833. "onmousedown",
  1834. "onmousemove",
  1835. "onmouseout",
  1836. "onmouseover",
  1837. "onmouseup",
  1838. "onmousewheel",
  1839. "onpause",
  1840. "onplay",
  1841. "onplaying",
  1842. "onprogress",
  1843. "onratechange",
  1844. "onreset",
  1845. "onscroll",
  1846. "onseeked",
  1847. "onseeking",
  1848. "onselect",
  1849. "onshow",
  1850. "onstalled",
  1851. "onsubmit",
  1852. "onsuspend",
  1853. "ontimeupdate",
  1854. "onvolumechange",
  1855. "onwaiting"
  1856. ];
  1857. var globalAttributes = commonAttributes.concat(eventAttributes);
  1858. var attributeMap = {
  1859. "html": {"manifest": 1},
  1860. "head": {},
  1861. "title": {},
  1862. "base": {"href": 1, "target": 1},
  1863. "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},
  1864. "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1},
  1865. "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1},
  1866. "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1},
  1867. "noscript": {"href": 1},
  1868. "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},
  1869. "section": {},
  1870. "nav": {},
  1871. "article": {"pubdate": 1},
  1872. "aside": {},
  1873. "h1": {},
  1874. "h2": {},
  1875. "h3": {},
  1876. "h4": {},
  1877. "h5": {},
  1878. "h6": {},
  1879. "header": {},
  1880. "footer": {},
  1881. "address": {},
  1882. "main": {},
  1883. "p": {},
  1884. "hr": {},
  1885. "pre": {},
  1886. "blockquote": {"cite": 1},
  1887. "ol": {"start": 1, "reversed": 1},
  1888. "ul": {},
  1889. "li": {"value": 1},
  1890. "dl": {},
  1891. "dt": {},
  1892. "dd": {},
  1893. "figure": {},
  1894. "figcaption": {},
  1895. "div": {},
  1896. "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},
  1897. "em": {},
  1898. "strong": {},
  1899. "small": {},
  1900. "s": {},
  1901. "cite": {},
  1902. "q": {"cite": 1},
  1903. "dfn": {},
  1904. "abbr": {},
  1905. "data": {},
  1906. "time": {"datetime": 1},
  1907. "code": {},
  1908. "var": {},
  1909. "samp": {},
  1910. "kbd": {},
  1911. "sub": {},
  1912. "sup": {},
  1913. "i": {},
  1914. "b": {},
  1915. "u": {},
  1916. "mark": {},
  1917. "ruby": {},
  1918. "rt": {},
  1919. "rp": {},
  1920. "bdi": {},
  1921. "bdo": {},
  1922. "span": {},
  1923. "br": {},
  1924. "wbr": {},
  1925. "ins": {"cite": 1, "datetime": 1},
  1926. "del": {"cite": 1, "datetime": 1},
  1927. "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1},
  1928. "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}},
  1929. "embed": {"src": 1, "height": 1, "width": 1, "type": 1},
  1930. "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1},
  1931. "param": {"name": 1, "value": 1},
  1932. "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}},
  1933. "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }},
  1934. "source": {"src": 1, "type": 1, "media": 1},
  1935. "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1},
  1936. "canvas": {"width": 1, "height": 1},
  1937. "map": {"name": 1},
  1938. "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1},
  1939. "svg": {},
  1940. "math": {},
  1941. "table": {"summary": 1},
  1942. "caption": {},
  1943. "colgroup": {"span": 1},
  1944. "col": {"span": 1},
  1945. "tbody": {},
  1946. "thead": {},
  1947. "tfoot": {},
  1948. "tr": {},
  1949. "td": {"headers": 1, "rowspan": 1, "colspan": 1},
  1950. "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1},
  1951. "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}},
  1952. "fieldset": {"disabled": 1, "form": 1, "name": 1},
  1953. "legend": {},
  1954. "label": {"form": 1, "for": 1},
  1955. "input": {
  1956. "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},
  1957. "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},
  1958. "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}},
  1959. "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}},
  1960. "datalist": {},
  1961. "optgroup": {"disabled": 1, "label": 1},
  1962. "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1},
  1963. "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}},
  1964. "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1},
  1965. "output": {"for": 1, "form": 1, "name": 1},
  1966. "progress": {"value": 1, "max": 1},
  1967. "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1},
  1968. "details": {"open": 1},
  1969. "summary": {},
  1970. "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1},
  1971. "menu": {"type": 1, "label": 1},
  1972. "dialog": {"open": 1}
  1973. };
  1974. var elements = Object.keys(attributeMap);
  1975. function is(token, type) {
  1976. return token.type.lastIndexOf(type + ".xml") > -1;
  1977. }
  1978. function findTagName(session, pos) {
  1979. var iterator = new TokenIterator(session, pos.row, pos.column);
  1980. var token = iterator.getCurrentToken();
  1981. while (token && !is(token, "tag-name")){
  1982. token = iterator.stepBackward();
  1983. }
  1984. if (token)
  1985. return token.value;
  1986. }
  1987. function findAttributeName(session, pos) {
  1988. var iterator = new TokenIterator(session, pos.row, pos.column);
  1989. var token = iterator.getCurrentToken();
  1990. while (token && !is(token, "attribute-name")){
  1991. token = iterator.stepBackward();
  1992. }
  1993. if (token)
  1994. return token.value;
  1995. }
  1996. var HtmlCompletions = function() {
  1997. };
  1998. (function() {
  1999. this.getCompletions = function(state, session, pos, prefix) {
  2000. var token = session.getTokenAt(pos.row, pos.column);
  2001. if (!token)
  2002. return [];
  2003. if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
  2004. return this.getTagCompletions(state, session, pos, prefix);
  2005. if (is(token, "tag-whitespace") || is(token, "attribute-name"))
  2006. return this.getAttributeCompletions(state, session, pos, prefix);
  2007. if (is(token, "attribute-value"))
  2008. return this.getAttributeValueCompletions(state, session, pos, prefix);
  2009. var line = session.getLine(pos.row).substr(0, pos.column);
  2010. if (/&[a-z]*$/i.test(line))
  2011. return this.getHTMLEntityCompletions(state, session, pos, prefix);
  2012. return [];
  2013. };
  2014. this.getTagCompletions = function(state, session, pos, prefix) {
  2015. return elements.map(function(element){
  2016. return {
  2017. value: element,
  2018. meta: "tag",
  2019. score: Number.MAX_VALUE
  2020. };
  2021. });
  2022. };
  2023. this.getAttributeCompletions = function(state, session, pos, prefix) {
  2024. var tagName = findTagName(session, pos);
  2025. if (!tagName)
  2026. return [];
  2027. var attributes = globalAttributes;
  2028. if (tagName in attributeMap) {
  2029. attributes = attributes.concat(Object.keys(attributeMap[tagName]));
  2030. }
  2031. return attributes.map(function(attribute){
  2032. return {
  2033. caption: attribute,
  2034. snippet: attribute + '="$0"',
  2035. meta: "attribute",
  2036. score: Number.MAX_VALUE
  2037. };
  2038. });
  2039. };
  2040. this.getAttributeValueCompletions = function(state, session, pos, prefix) {
  2041. var tagName = findTagName(session, pos);
  2042. var attributeName = findAttributeName(session, pos);
  2043. if (!tagName)
  2044. return [];
  2045. var values = [];
  2046. if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
  2047. values = Object.keys(attributeMap[tagName][attributeName]);
  2048. }
  2049. return values.map(function(value){
  2050. return {
  2051. caption: value,
  2052. snippet: value,
  2053. meta: "attribute value",
  2054. score: Number.MAX_VALUE
  2055. };
  2056. });
  2057. };
  2058. this.getHTMLEntityCompletions = function(state, session, pos, prefix) {
  2059. 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;'];
  2060. return values.map(function(value){
  2061. return {
  2062. caption: value,
  2063. snippet: value,
  2064. meta: "html entity",
  2065. score: Number.MAX_VALUE
  2066. };
  2067. });
  2068. };
  2069. }).call(HtmlCompletions.prototype);
  2070. exports.HtmlCompletions = HtmlCompletions;
  2071. });
  2072. 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) {
  2073. "use strict";
  2074. var oop = require("../lib/oop");
  2075. var lang = require("../lib/lang");
  2076. var TextMode = require("./text").Mode;
  2077. var JavaScriptMode = require("./javascript").Mode;
  2078. var CssMode = require("./css").Mode;
  2079. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2080. var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
  2081. var HtmlFoldMode = require("./folding/html").FoldMode;
  2082. var HtmlCompletions = require("./html_completions").HtmlCompletions;
  2083. var WorkerClient = require("../worker/worker_client").WorkerClient;
  2084. var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
  2085. var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
  2086. var Mode = function(options) {
  2087. this.fragmentContext = options && options.fragmentContext;
  2088. this.HighlightRules = HtmlHighlightRules;
  2089. this.$behaviour = new XmlBehaviour();
  2090. this.$completer = new HtmlCompletions();
  2091. this.createModeDelegates({
  2092. "js-": JavaScriptMode,
  2093. "css-": CssMode
  2094. });
  2095. this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
  2096. };
  2097. oop.inherits(Mode, TextMode);
  2098. (function() {
  2099. this.blockComment = {start: "<!--", end: "-->"};
  2100. this.voidElements = lang.arrayToMap(voidElements);
  2101. this.getNextLineIndent = function(state, line, tab) {
  2102. return this.$getIndent(line);
  2103. };
  2104. this.checkOutdent = function(state, line, input) {
  2105. return false;
  2106. };
  2107. this.getCompletions = function(state, session, pos, prefix) {
  2108. return this.$completer.getCompletions(state, session, pos, prefix);
  2109. };
  2110. this.createWorker = function(session) {
  2111. if (this.constructor != Mode)
  2112. return;
  2113. var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
  2114. worker.attachToDocument(session.getDocument());
  2115. if (this.fragmentContext)
  2116. worker.call("setOptions", [{context: this.fragmentContext}]);
  2117. worker.on("error", function(e) {
  2118. session.setAnnotations(e.data);
  2119. });
  2120. worker.on("terminate", function() {
  2121. session.clearAnnotations();
  2122. });
  2123. return worker;
  2124. };
  2125. this.$id = "ace/mode/html";
  2126. }).call(Mode.prototype);
  2127. exports.Mode = Mode;
  2128. });
  2129. 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) {
  2130. "use strict";
  2131. var oop = require("../lib/oop");
  2132. var lang = require("../lib/lang");
  2133. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  2134. var TexHighlightRules = function(textClass) {
  2135. if (!textClass)
  2136. textClass = "text";
  2137. this.$rules = {
  2138. "start" : [
  2139. {
  2140. token : "comment",
  2141. regex : "%.*$"
  2142. }, {
  2143. token : textClass, // non-command
  2144. regex : "\\\\[$&%#\\{\\}]"
  2145. }, {
  2146. token : "keyword", // command
  2147. 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",
  2148. next : "nospell"
  2149. }, {
  2150. token : "keyword", // command
  2151. regex : "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])"
  2152. }, {
  2153. token : "paren.keyword.operator",
  2154. regex : "[[({]"
  2155. }, {
  2156. token : "paren.keyword.operator",
  2157. regex : "[\\])}]"
  2158. }, {
  2159. token : textClass,
  2160. regex : "\\s+"
  2161. }
  2162. ],
  2163. "nospell" : [
  2164. {
  2165. token : "comment",
  2166. regex : "%.*$",
  2167. next : "start"
  2168. }, {
  2169. token : "nospell." + textClass, // non-command
  2170. regex : "\\\\[$&%#\\{\\}]"
  2171. }, {
  2172. token : "keyword", // command
  2173. 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"
  2174. }, {
  2175. token : "keyword", // command
  2176. regex : "\\\\(?:[a-zA-Z0-9]+|[^a-zA-Z0-9])",
  2177. next : "start"
  2178. }, {
  2179. token : "paren.keyword.operator",
  2180. regex : "[[({]"
  2181. }, {
  2182. token : "paren.keyword.operator",
  2183. regex : "[\\])]"
  2184. }, {
  2185. token : "paren.keyword.operator",
  2186. regex : "}",
  2187. next : "start"
  2188. }, {
  2189. token : "nospell." + textClass,
  2190. regex : "\\s+"
  2191. }, {
  2192. token : "nospell." + textClass,
  2193. regex : "\\w+"
  2194. }
  2195. ]
  2196. };
  2197. };
  2198. oop.inherits(TexHighlightRules, TextHighlightRules);
  2199. exports.TexHighlightRules = TexHighlightRules;
  2200. });
  2201. 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)
  2202. {
  2203. var oop = require("../lib/oop");
  2204. var lang = require("../lib/lang");
  2205. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  2206. var TexHighlightRules = require("./tex_highlight_rules").TexHighlightRules;
  2207. var RHighlightRules = function()
  2208. {
  2209. var keywords = lang.arrayToMap(
  2210. ("function|if|in|break|next|repeat|else|for|return|switch|while|try|tryCatch|stop|warning|require|library|attach|detach|source|setMethod|setGeneric|setGroupGeneric|setClass")
  2211. .split("|")
  2212. );
  2213. var buildinConstants = lang.arrayToMap(
  2214. ("NULL|NA|TRUE|FALSE|T|F|Inf|NaN|NA_integer_|NA_real_|NA_character_|" +
  2215. "NA_complex_").split("|")
  2216. );
  2217. this.$rules = {
  2218. "start" : [
  2219. {
  2220. token : "comment.sectionhead",
  2221. regex : "#+(?!').*(?:----|====|####)\\s*$"
  2222. },
  2223. {
  2224. token : "comment",
  2225. regex : "#+'",
  2226. next : "rd-start"
  2227. },
  2228. {
  2229. token : "comment",
  2230. regex : "#.*$"
  2231. },
  2232. {
  2233. token : "string", // multi line string start
  2234. regex : '["]',
  2235. next : "qqstring"
  2236. },
  2237. {
  2238. token : "string", // multi line string start
  2239. regex : "[']",
  2240. next : "qstring"
  2241. },
  2242. {
  2243. token : "constant.numeric", // hex
  2244. regex : "0[xX][0-9a-fA-F]+[Li]?\\b"
  2245. },
  2246. {
  2247. token : "constant.numeric", // explicit integer
  2248. regex : "\\d+L\\b"
  2249. },
  2250. {
  2251. token : "constant.numeric", // number
  2252. regex : "\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b"
  2253. },
  2254. {
  2255. token : "constant.numeric", // number with leading decimal
  2256. regex : "\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b"
  2257. },
  2258. {
  2259. token : "constant.language.boolean",
  2260. regex : "(?:TRUE|FALSE|T|F)\\b"
  2261. },
  2262. {
  2263. token : "identifier",
  2264. regex : "`.*?`"
  2265. },
  2266. {
  2267. onMatch : function(value) {
  2268. if (keywords[value])
  2269. return "keyword";
  2270. else if (buildinConstants[value])
  2271. return "constant.language";
  2272. else if (value == '...' || value.match(/^\.\.\d+$/))
  2273. return "variable.language";
  2274. else
  2275. return "identifier";
  2276. },
  2277. regex : "[a-zA-Z.][a-zA-Z0-9._]*\\b"
  2278. },
  2279. {
  2280. token : "keyword.operator",
  2281. regex : "%%|>=|<=|==|!=|\\->|<\\-|\\|\\||&&|=|\\+|\\-|\\*|/|\\^|>|<|!|&|\\||~|\\$|:"
  2282. },
  2283. {
  2284. token : "keyword.operator", // infix operators
  2285. regex : "%.*?%"
  2286. },
  2287. {
  2288. token : "paren.keyword.operator",
  2289. regex : "[[({]"
  2290. },
  2291. {
  2292. token : "paren.keyword.operator",
  2293. regex : "[\\])}]"
  2294. },
  2295. {
  2296. token : "text",
  2297. regex : "\\s+"
  2298. }
  2299. ],
  2300. "qqstring" : [
  2301. {
  2302. token : "string",
  2303. regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
  2304. next : "start"
  2305. },
  2306. {
  2307. token : "string",
  2308. regex : '.+'
  2309. }
  2310. ],
  2311. "qstring" : [
  2312. {
  2313. token : "string",
  2314. regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
  2315. next : "start"
  2316. },
  2317. {
  2318. token : "string",
  2319. regex : '.+'
  2320. }
  2321. ]
  2322. };
  2323. var rdRules = new TexHighlightRules("comment").getRules();
  2324. for (var i = 0; i < rdRules["start"].length; i++) {
  2325. rdRules["start"][i].token += ".virtual-comment";
  2326. }
  2327. this.addRules(rdRules, "rd-");
  2328. this.$rules["rd-start"].unshift({
  2329. token: "text",
  2330. regex: "^",
  2331. next: "start"
  2332. });
  2333. this.$rules["rd-start"].unshift({
  2334. token : "keyword",
  2335. regex : "@(?!@)[^ ]*"
  2336. });
  2337. this.$rules["rd-start"].unshift({
  2338. token : "comment",
  2339. regex : "@@"
  2340. });
  2341. this.$rules["rd-start"].push({
  2342. token : "comment",
  2343. regex : "[^%\\\\[({\\])}]+"
  2344. });
  2345. };
  2346. oop.inherits(RHighlightRules, TextHighlightRules);
  2347. exports.RHighlightRules = RHighlightRules;
  2348. });
  2349. 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) {
  2350. "use strict";
  2351. var oop = require("../lib/oop");
  2352. var RHighlightRules = require("./r_highlight_rules").RHighlightRules;
  2353. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2354. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  2355. var RHtmlHighlightRules = function() {
  2356. HtmlHighlightRules.call(this);
  2357. this.$rules["start"].unshift({
  2358. token: "support.function.codebegin",
  2359. regex: "^<" + "!--\\s*begin.rcode\\s*(?:.*)",
  2360. next: "r-start"
  2361. });
  2362. this.embedRules(RHighlightRules, "r-", [{
  2363. token: "support.function.codeend",
  2364. regex: "^\\s*end.rcode\\s*-->",
  2365. next: "start"
  2366. }], ["start"]);
  2367. this.normalizeRules();
  2368. };
  2369. oop.inherits(RHtmlHighlightRules, TextHighlightRules);
  2370. exports.RHtmlHighlightRules = RHtmlHighlightRules;
  2371. });
  2372. ace.define("ace/mode/rhtml",["require","exports","module","ace/lib/oop","ace/mode/html","ace/mode/rhtml_highlight_rules"], function(require, exports, module) {
  2373. "use strict";
  2374. var oop = require("../lib/oop");
  2375. var HtmlMode = require("./html").Mode;
  2376. var RHtmlHighlightRules = require("./rhtml_highlight_rules").RHtmlHighlightRules;
  2377. var Mode = function(doc, session) {
  2378. HtmlMode.call(this);
  2379. this.$session = session;
  2380. this.HighlightRules = RHtmlHighlightRules;
  2381. };
  2382. oop.inherits(Mode, HtmlMode);
  2383. (function() {
  2384. this.insertChunkInfo = {
  2385. value: "<!--begin.rcode\n\nend.rcode-->\n",
  2386. position: {row: 0, column: 15}
  2387. };
  2388. this.getLanguageMode = function(position)
  2389. {
  2390. return this.$session.getState(position.row).match(/^r-/) ? 'R' : 'HTML';
  2391. };
  2392. this.$id = "ace/mode/rhtml";
  2393. }).call(Mode.prototype);
  2394. exports.Mode = Mode;
  2395. });