Sin descripción
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mode-coldfusion.js 95KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477
  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 JavaScriptHighlightRules = function(options) {
  47. var keywordMapper = this.createKeywordMapper({
  48. "variable.language":
  49. "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
  50. "Namespace|QName|XML|XMLList|" + // E4X
  51. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  52. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  53. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
  54. "SyntaxError|TypeError|URIError|" +
  55. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
  56. "isNaN|parseFloat|parseInt|" +
  57. "JSON|Math|" + // Other
  58. "this|arguments|prototype|window|document" , // Pseudo
  59. "keyword":
  60. "const|yield|import|get|set|" +
  61. "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  62. "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  63. "__parent__|__count__|escape|unescape|with|__proto__|" +
  64. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
  65. "storage.type":
  66. "const|let|var|function",
  67. "constant.language":
  68. "null|Infinity|NaN|undefined",
  69. "support.function":
  70. "alert",
  71. "constant.language.boolean": "true|false"
  72. }, "identifier");
  73. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
  74. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
  75. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  76. "u[0-9a-fA-F]{4}|" + // unicode
  77. "[0-2][0-7]{0,2}|" + // oct
  78. "3[0-6][0-7]?|" + // oct
  79. "37[0-7]?|" + // oct
  80. "[4-7][0-7]?|" + //oct
  81. ".)";
  82. this.$rules = {
  83. "no_regex" : [
  84. {
  85. token : "comment",
  86. regex : "\\/\\/",
  87. next : "line_comment"
  88. },
  89. DocCommentHighlightRules.getStartRule("doc-start"),
  90. {
  91. token : "comment", // multi line comment
  92. regex : /\/\*/,
  93. next : "comment"
  94. }, {
  95. token : "string",
  96. regex : "'(?=.)",
  97. next : "qstring"
  98. }, {
  99. token : "string",
  100. regex : '"(?=.)',
  101. next : "qqstring"
  102. }, {
  103. token : "constant.numeric", // hex
  104. regex : /0[xX][0-9a-fA-F]+\b/
  105. }, {
  106. token : "constant.numeric", // float
  107. regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
  108. }, {
  109. token : [
  110. "storage.type", "punctuation.operator", "support.function",
  111. "punctuation.operator", "entity.name.function", "text","keyword.operator"
  112. ],
  113. regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
  114. next: "function_arguments"
  115. }, {
  116. token : [
  117. "storage.type", "punctuation.operator", "entity.name.function", "text",
  118. "keyword.operator", "text", "storage.type", "text", "paren.lparen"
  119. ],
  120. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  121. next: "function_arguments"
  122. }, {
  123. token : [
  124. "entity.name.function", "text", "keyword.operator", "text", "storage.type",
  125. "text", "paren.lparen"
  126. ],
  127. regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  128. next: "function_arguments"
  129. }, {
  130. token : [
  131. "storage.type", "punctuation.operator", "entity.name.function", "text",
  132. "keyword.operator", "text",
  133. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  134. ],
  135. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
  136. next: "function_arguments"
  137. }, {
  138. token : [
  139. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  140. ],
  141. regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
  142. next: "function_arguments"
  143. }, {
  144. token : [
  145. "entity.name.function", "text", "punctuation.operator",
  146. "text", "storage.type", "text", "paren.lparen"
  147. ],
  148. regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
  149. next: "function_arguments"
  150. }, {
  151. token : [
  152. "text", "text", "storage.type", "text", "paren.lparen"
  153. ],
  154. regex : "(:)(\\s*)(function)(\\s*)(\\()",
  155. next: "function_arguments"
  156. }, {
  157. token : "keyword",
  158. regex : "(?:" + kwBeforeRe + ")\\b",
  159. next : "start"
  160. }, {
  161. token : ["punctuation.operator", "support.function"],
  162. 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(?=\()/
  163. }, {
  164. token : ["punctuation.operator", "support.function.dom"],
  165. 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)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
  166. }, {
  167. token : ["punctuation.operator", "support.constant"],
  168. 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/
  169. }, {
  170. token : ["support.constant"],
  171. regex : /that\b/
  172. }, {
  173. token : ["storage.type", "punctuation.operator", "support.function.firebug"],
  174. regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
  175. }, {
  176. token : keywordMapper,
  177. regex : identifierRe
  178. }, {
  179. token : "keyword.operator",
  180. regex : /--|\+\+|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/,
  181. next : "start"
  182. }, {
  183. token : "punctuation.operator",
  184. regex : /[?:,;.]/,
  185. next : "start"
  186. }, {
  187. token : "paren.lparen",
  188. regex : /[\[({]/,
  189. next : "start"
  190. }, {
  191. token : "paren.rparen",
  192. regex : /[\])}]/
  193. }, {
  194. token: "comment",
  195. regex: /^#!.*$/
  196. }
  197. ],
  198. "start": [
  199. DocCommentHighlightRules.getStartRule("doc-start"),
  200. {
  201. token : "comment", // multi line comment
  202. regex : "\\/\\*",
  203. next : "comment_regex_allowed"
  204. }, {
  205. token : "comment",
  206. regex : "\\/\\/",
  207. next : "line_comment_regex_allowed"
  208. }, {
  209. token: "string.regexp",
  210. regex: "\\/",
  211. next: "regex"
  212. }, {
  213. token : "text",
  214. regex : "\\s+|^$",
  215. next : "start"
  216. }, {
  217. token: "empty",
  218. regex: "",
  219. next: "no_regex"
  220. }
  221. ],
  222. "regex": [
  223. {
  224. token: "regexp.keyword.operator",
  225. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  226. }, {
  227. token: "string.regexp",
  228. regex: "/[sxngimy]*",
  229. next: "no_regex"
  230. }, {
  231. token : "invalid",
  232. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  233. }, {
  234. token : "constant.language.escape",
  235. regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  236. }, {
  237. token : "constant.language.delimiter",
  238. regex: /\|/
  239. }, {
  240. token: "constant.language.escape",
  241. regex: /\[\^?/,
  242. next: "regex_character_class"
  243. }, {
  244. token: "empty",
  245. regex: "$",
  246. next: "no_regex"
  247. }, {
  248. defaultToken: "string.regexp"
  249. }
  250. ],
  251. "regex_character_class": [
  252. {
  253. token: "regexp.charclass.keyword.operator",
  254. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  255. }, {
  256. token: "constant.language.escape",
  257. regex: "]",
  258. next: "regex"
  259. }, {
  260. token: "constant.language.escape",
  261. regex: "-"
  262. }, {
  263. token: "empty",
  264. regex: "$",
  265. next: "no_regex"
  266. }, {
  267. defaultToken: "string.regexp.charachterclass"
  268. }
  269. ],
  270. "function_arguments": [
  271. {
  272. token: "variable.parameter",
  273. regex: identifierRe
  274. }, {
  275. token: "punctuation.operator",
  276. regex: "[, ]+"
  277. }, {
  278. token: "punctuation.operator",
  279. regex: "$"
  280. }, {
  281. token: "empty",
  282. regex: "",
  283. next: "no_regex"
  284. }
  285. ],
  286. "comment_regex_allowed" : [
  287. DocCommentHighlightRules.getTagRule(),
  288. {token : "comment", regex : "\\*\\/", next : "start"},
  289. {defaultToken : "comment", caseInsensitive: true}
  290. ],
  291. "comment" : [
  292. DocCommentHighlightRules.getTagRule(),
  293. {token : "comment", regex : "\\*\\/", next : "no_regex"},
  294. {defaultToken : "comment", caseInsensitive: true}
  295. ],
  296. "line_comment_regex_allowed" : [
  297. DocCommentHighlightRules.getTagRule(),
  298. {token : "comment", regex : "$|^", next : "start"},
  299. {defaultToken : "comment", caseInsensitive: true}
  300. ],
  301. "line_comment" : [
  302. DocCommentHighlightRules.getTagRule(),
  303. {token : "comment", regex : "$|^", next : "no_regex"},
  304. {defaultToken : "comment", caseInsensitive: true}
  305. ],
  306. "qqstring" : [
  307. {
  308. token : "constant.language.escape",
  309. regex : escapedRe
  310. }, {
  311. token : "string",
  312. regex : "\\\\$",
  313. next : "qqstring"
  314. }, {
  315. token : "string",
  316. regex : '"|$',
  317. next : "no_regex"
  318. }, {
  319. defaultToken: "string"
  320. }
  321. ],
  322. "qstring" : [
  323. {
  324. token : "constant.language.escape",
  325. regex : escapedRe
  326. }, {
  327. token : "string",
  328. regex : "\\\\$",
  329. next : "qstring"
  330. }, {
  331. token : "string",
  332. regex : "'|$",
  333. next : "no_regex"
  334. }, {
  335. defaultToken: "string"
  336. }
  337. ]
  338. };
  339. if (!options || !options.noES6) {
  340. this.$rules.no_regex.unshift({
  341. regex: "[{}]", onMatch: function(val, state, stack) {
  342. this.next = val == "{" ? this.nextState : "";
  343. if (val == "{" && stack.length) {
  344. stack.unshift("start", state);
  345. return "paren";
  346. }
  347. if (val == "}" && stack.length) {
  348. stack.shift();
  349. this.next = stack.shift();
  350. if (this.next.indexOf("string") != -1)
  351. return "paren.quasi.end";
  352. }
  353. return val == "{" ? "paren.lparen" : "paren.rparen";
  354. },
  355. nextState: "start"
  356. }, {
  357. token : "string.quasi.start",
  358. regex : /`/,
  359. push : [{
  360. token : "constant.language.escape",
  361. regex : escapedRe
  362. }, {
  363. token : "paren.quasi.start",
  364. regex : /\${/,
  365. push : "start"
  366. }, {
  367. token : "string.quasi.end",
  368. regex : /`/,
  369. next : "pop"
  370. }, {
  371. defaultToken: "string.quasi"
  372. }]
  373. });
  374. }
  375. this.embedRules(DocCommentHighlightRules, "doc-",
  376. [ DocCommentHighlightRules.getEndRule("no_regex") ]);
  377. this.normalizeRules();
  378. };
  379. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  380. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  381. });
  382. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
  383. "use strict";
  384. var Range = require("../range").Range;
  385. var MatchingBraceOutdent = function() {};
  386. (function() {
  387. this.checkOutdent = function(line, input) {
  388. if (! /^\s+$/.test(line))
  389. return false;
  390. return /^\s*\}/.test(input);
  391. };
  392. this.autoOutdent = function(doc, row) {
  393. var line = doc.getLine(row);
  394. var match = line.match(/^(\s*\})/);
  395. if (!match) return 0;
  396. var column = match[1].length;
  397. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  398. if (!openBracePos || openBracePos.row == row) return 0;
  399. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  400. doc.replace(new Range(row, 0, row, column-1), indent);
  401. };
  402. this.$getIndent = function(line) {
  403. return line.match(/^\s*/)[0];
  404. };
  405. }).call(MatchingBraceOutdent.prototype);
  406. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  407. });
  408. ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
  409. "use strict";
  410. var oop = require("../../lib/oop");
  411. var Behaviour = require("../behaviour").Behaviour;
  412. var TokenIterator = require("../../token_iterator").TokenIterator;
  413. var lang = require("../../lib/lang");
  414. var SAFE_INSERT_IN_TOKENS =
  415. ["text", "paren.rparen", "punctuation.operator"];
  416. var SAFE_INSERT_BEFORE_TOKENS =
  417. ["text", "paren.rparen", "punctuation.operator", "comment"];
  418. var context;
  419. var contextCache = {};
  420. var initContext = function(editor) {
  421. var id = -1;
  422. if (editor.multiSelect) {
  423. id = editor.selection.index;
  424. if (contextCache.rangeCount != editor.multiSelect.rangeCount)
  425. contextCache = {rangeCount: editor.multiSelect.rangeCount};
  426. }
  427. if (contextCache[id])
  428. return context = contextCache[id];
  429. context = contextCache[id] = {
  430. autoInsertedBrackets: 0,
  431. autoInsertedRow: -1,
  432. autoInsertedLineEnd: "",
  433. maybeInsertedBrackets: 0,
  434. maybeInsertedRow: -1,
  435. maybeInsertedLineStart: "",
  436. maybeInsertedLineEnd: ""
  437. };
  438. };
  439. var CstyleBehaviour = function() {
  440. this.add("braces", "insertion", function(state, action, editor, session, text) {
  441. var cursor = editor.getCursorPosition();
  442. var line = session.doc.getLine(cursor.row);
  443. if (text == '{') {
  444. initContext(editor);
  445. var selection = editor.getSelectionRange();
  446. var selected = session.doc.getTextRange(selection);
  447. if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
  448. return {
  449. text: '{' + selected + '}',
  450. selection: false
  451. };
  452. } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
  453. if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
  454. CstyleBehaviour.recordAutoInsert(editor, session, "}");
  455. return {
  456. text: '{}',
  457. selection: [1, 1]
  458. };
  459. } else {
  460. CstyleBehaviour.recordMaybeInsert(editor, session, "{");
  461. return {
  462. text: '{',
  463. selection: [1, 1]
  464. };
  465. }
  466. }
  467. } else if (text == '}') {
  468. initContext(editor);
  469. var rightChar = line.substring(cursor.column, cursor.column + 1);
  470. if (rightChar == '}') {
  471. var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
  472. if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
  473. CstyleBehaviour.popAutoInsertedClosing();
  474. return {
  475. text: '',
  476. selection: [1, 1]
  477. };
  478. }
  479. }
  480. } else if (text == "\n" || text == "\r\n") {
  481. initContext(editor);
  482. var closing = "";
  483. if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
  484. closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
  485. CstyleBehaviour.clearMaybeInsertedClosing();
  486. }
  487. var rightChar = line.substring(cursor.column, cursor.column + 1);
  488. if (rightChar === '}') {
  489. var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
  490. if (!openBracePos)
  491. return null;
  492. var next_indent = this.$getIndent(session.getLine(openBracePos.row));
  493. } else if (closing) {
  494. var next_indent = this.$getIndent(line);
  495. } else {
  496. CstyleBehaviour.clearMaybeInsertedClosing();
  497. return;
  498. }
  499. var indent = next_indent + session.getTabString();
  500. return {
  501. text: '\n' + indent + '\n' + next_indent + closing,
  502. selection: [1, indent.length, 1, indent.length]
  503. };
  504. } else {
  505. CstyleBehaviour.clearMaybeInsertedClosing();
  506. }
  507. });
  508. this.add("braces", "deletion", function(state, action, editor, session, range) {
  509. var selected = session.doc.getTextRange(range);
  510. if (!range.isMultiLine() && selected == '{') {
  511. initContext(editor);
  512. var line = session.doc.getLine(range.start.row);
  513. var rightChar = line.substring(range.end.column, range.end.column + 1);
  514. if (rightChar == '}') {
  515. range.end.column++;
  516. return range;
  517. } else {
  518. context.maybeInsertedBrackets--;
  519. }
  520. }
  521. });
  522. this.add("parens", "insertion", function(state, action, editor, session, text) {
  523. if (text == '(') {
  524. initContext(editor);
  525. var selection = editor.getSelectionRange();
  526. var selected = session.doc.getTextRange(selection);
  527. if (selected !== "" && editor.getWrapBehavioursEnabled()) {
  528. return {
  529. text: '(' + selected + ')',
  530. selection: false
  531. };
  532. } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
  533. CstyleBehaviour.recordAutoInsert(editor, session, ")");
  534. return {
  535. text: '()',
  536. selection: [1, 1]
  537. };
  538. }
  539. } else if (text == ')') {
  540. initContext(editor);
  541. var cursor = editor.getCursorPosition();
  542. var line = session.doc.getLine(cursor.row);
  543. var rightChar = line.substring(cursor.column, cursor.column + 1);
  544. if (rightChar == ')') {
  545. var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
  546. if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
  547. CstyleBehaviour.popAutoInsertedClosing();
  548. return {
  549. text: '',
  550. selection: [1, 1]
  551. };
  552. }
  553. }
  554. }
  555. });
  556. this.add("parens", "deletion", function(state, action, editor, session, range) {
  557. var selected = session.doc.getTextRange(range);
  558. if (!range.isMultiLine() && selected == '(') {
  559. initContext(editor);
  560. var line = session.doc.getLine(range.start.row);
  561. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  562. if (rightChar == ')') {
  563. range.end.column++;
  564. return range;
  565. }
  566. }
  567. });
  568. this.add("brackets", "insertion", function(state, action, editor, session, text) {
  569. if (text == '[') {
  570. initContext(editor);
  571. var selection = editor.getSelectionRange();
  572. var selected = session.doc.getTextRange(selection);
  573. if (selected !== "" && editor.getWrapBehavioursEnabled()) {
  574. return {
  575. text: '[' + selected + ']',
  576. selection: false
  577. };
  578. } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
  579. CstyleBehaviour.recordAutoInsert(editor, session, "]");
  580. return {
  581. text: '[]',
  582. selection: [1, 1]
  583. };
  584. }
  585. } else if (text == ']') {
  586. initContext(editor);
  587. var cursor = editor.getCursorPosition();
  588. var line = session.doc.getLine(cursor.row);
  589. var rightChar = line.substring(cursor.column, cursor.column + 1);
  590. if (rightChar == ']') {
  591. var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
  592. if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
  593. CstyleBehaviour.popAutoInsertedClosing();
  594. return {
  595. text: '',
  596. selection: [1, 1]
  597. };
  598. }
  599. }
  600. }
  601. });
  602. this.add("brackets", "deletion", function(state, action, editor, session, range) {
  603. var selected = session.doc.getTextRange(range);
  604. if (!range.isMultiLine() && selected == '[') {
  605. initContext(editor);
  606. var line = session.doc.getLine(range.start.row);
  607. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  608. if (rightChar == ']') {
  609. range.end.column++;
  610. return range;
  611. }
  612. }
  613. });
  614. this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
  615. if (text == '"' || text == "'") {
  616. initContext(editor);
  617. var quote = text;
  618. var selection = editor.getSelectionRange();
  619. var selected = session.doc.getTextRange(selection);
  620. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  621. return {
  622. text: quote + selected + quote,
  623. selection: false
  624. };
  625. } else {
  626. var cursor = editor.getCursorPosition();
  627. var line = session.doc.getLine(cursor.row);
  628. var leftChar = line.substring(cursor.column-1, cursor.column);
  629. var rightChar = line.substring(cursor.column, cursor.column + 1);
  630. var token = session.getTokenAt(cursor.row, cursor.column);
  631. var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
  632. if (leftChar == "\\" && token && /escape/.test(token.type))
  633. return null;
  634. var stringBefore = token && /string/.test(token.type);
  635. var stringAfter = !rightToken || /string/.test(rightToken.type);
  636. var pair;
  637. if (rightChar == quote) {
  638. pair = stringBefore !== stringAfter;
  639. } else {
  640. if (stringBefore && !stringAfter)
  641. return null; // wrap string with different quote
  642. if (stringBefore && stringAfter)
  643. return null; // do not pair quotes inside strings
  644. var wordRe = session.$mode.tokenRe;
  645. wordRe.lastIndex = 0;
  646. var isWordBefore = wordRe.test(leftChar);
  647. wordRe.lastIndex = 0;
  648. var isWordAfter = wordRe.test(leftChar);
  649. if (isWordBefore || isWordAfter)
  650. return null; // before or after alphanumeric
  651. if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
  652. return null; // there is rightChar and it isn't closing
  653. pair = true;
  654. }
  655. return {
  656. text: pair ? quote + quote : "",
  657. selection: [1,1]
  658. };
  659. }
  660. }
  661. });
  662. this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
  663. var selected = session.doc.getTextRange(range);
  664. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  665. initContext(editor);
  666. var line = session.doc.getLine(range.start.row);
  667. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  668. if (rightChar == selected) {
  669. range.end.column++;
  670. return range;
  671. }
  672. }
  673. });
  674. };
  675. CstyleBehaviour.isSaneInsertion = function(editor, session) {
  676. var cursor = editor.getCursorPosition();
  677. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  678. if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
  679. var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
  680. if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
  681. return false;
  682. }
  683. iterator.stepForward();
  684. return iterator.getCurrentTokenRow() !== cursor.row ||
  685. this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
  686. };
  687. CstyleBehaviour.$matchTokenType = function(token, types) {
  688. return types.indexOf(token.type || token) > -1;
  689. };
  690. CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
  691. var cursor = editor.getCursorPosition();
  692. var line = session.doc.getLine(cursor.row);
  693. if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
  694. context.autoInsertedBrackets = 0;
  695. context.autoInsertedRow = cursor.row;
  696. context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
  697. context.autoInsertedBrackets++;
  698. };
  699. CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
  700. var cursor = editor.getCursorPosition();
  701. var line = session.doc.getLine(cursor.row);
  702. if (!this.isMaybeInsertedClosing(cursor, line))
  703. context.maybeInsertedBrackets = 0;
  704. context.maybeInsertedRow = cursor.row;
  705. context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
  706. context.maybeInsertedLineEnd = line.substr(cursor.column);
  707. context.maybeInsertedBrackets++;
  708. };
  709. CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
  710. return context.autoInsertedBrackets > 0 &&
  711. cursor.row === context.autoInsertedRow &&
  712. bracket === context.autoInsertedLineEnd[0] &&
  713. line.substr(cursor.column) === context.autoInsertedLineEnd;
  714. };
  715. CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
  716. return context.maybeInsertedBrackets > 0 &&
  717. cursor.row === context.maybeInsertedRow &&
  718. line.substr(cursor.column) === context.maybeInsertedLineEnd &&
  719. line.substr(0, cursor.column) == context.maybeInsertedLineStart;
  720. };
  721. CstyleBehaviour.popAutoInsertedClosing = function() {
  722. context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
  723. context.autoInsertedBrackets--;
  724. };
  725. CstyleBehaviour.clearMaybeInsertedClosing = function() {
  726. if (context) {
  727. context.maybeInsertedBrackets = 0;
  728. context.maybeInsertedRow = -1;
  729. }
  730. };
  731. oop.inherits(CstyleBehaviour, Behaviour);
  732. exports.CstyleBehaviour = CstyleBehaviour;
  733. });
  734. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
  735. "use strict";
  736. var oop = require("../../lib/oop");
  737. var Range = require("../../range").Range;
  738. var BaseFoldMode = require("./fold_mode").FoldMode;
  739. var FoldMode = exports.FoldMode = function(commentRegex) {
  740. if (commentRegex) {
  741. this.foldingStartMarker = new RegExp(
  742. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  743. );
  744. this.foldingStopMarker = new RegExp(
  745. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  746. );
  747. }
  748. };
  749. oop.inherits(FoldMode, BaseFoldMode);
  750. (function() {
  751. this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
  752. this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
  753. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  754. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  755. this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
  756. this._getFoldWidgetBase = this.getFoldWidget;
  757. this.getFoldWidget = function(session, foldStyle, row) {
  758. var line = session.getLine(row);
  759. if (this.singleLineBlockCommentRe.test(line)) {
  760. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  761. return "";
  762. }
  763. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  764. if (!fw && this.startRegionRe.test(line))
  765. return "start"; // lineCommentRegionStart
  766. return fw;
  767. };
  768. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  769. var line = session.getLine(row);
  770. if (this.startRegionRe.test(line))
  771. return this.getCommentRegionBlock(session, line, row);
  772. var match = line.match(this.foldingStartMarker);
  773. if (match) {
  774. var i = match.index;
  775. if (match[1])
  776. return this.openingBracketBlock(session, match[1], row, i);
  777. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  778. if (range && !range.isMultiLine()) {
  779. if (forceMultiline) {
  780. range = this.getSectionRange(session, row);
  781. } else if (foldStyle != "all")
  782. range = null;
  783. }
  784. return range;
  785. }
  786. if (foldStyle === "markbegin")
  787. return;
  788. var match = line.match(this.foldingStopMarker);
  789. if (match) {
  790. var i = match.index + match[0].length;
  791. if (match[1])
  792. return this.closingBracketBlock(session, match[1], row, i);
  793. return session.getCommentFoldRange(row, i, -1);
  794. }
  795. };
  796. this.getSectionRange = function(session, row) {
  797. var line = session.getLine(row);
  798. var startIndent = line.search(/\S/);
  799. var startRow = row;
  800. var startColumn = line.length;
  801. row = row + 1;
  802. var endRow = row;
  803. var maxRow = session.getLength();
  804. while (++row < maxRow) {
  805. line = session.getLine(row);
  806. var indent = line.search(/\S/);
  807. if (indent === -1)
  808. continue;
  809. if (startIndent > indent)
  810. break;
  811. var subRange = this.getFoldWidgetRange(session, "all", row);
  812. if (subRange) {
  813. if (subRange.start.row <= startRow) {
  814. break;
  815. } else if (subRange.isMultiLine()) {
  816. row = subRange.end.row;
  817. } else if (startIndent == indent) {
  818. break;
  819. }
  820. }
  821. endRow = row;
  822. }
  823. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  824. };
  825. this.getCommentRegionBlock = function(session, line, row) {
  826. var startColumn = line.search(/\s*$/);
  827. var maxRow = session.getLength();
  828. var startRow = row;
  829. var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
  830. var depth = 1;
  831. while (++row < maxRow) {
  832. line = session.getLine(row);
  833. var m = re.exec(line);
  834. if (!m) continue;
  835. if (m[1]) depth--;
  836. else depth++;
  837. if (!depth) break;
  838. }
  839. var endRow = row;
  840. if (endRow > startRow) {
  841. return new Range(startRow, startColumn, endRow, line.length);
  842. }
  843. };
  844. }).call(FoldMode.prototype);
  845. });
  846. ace.define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
  847. "use strict";
  848. var oop = require("../lib/oop");
  849. var TextMode = require("./text").Mode;
  850. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  851. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  852. var Range = require("../range").Range;
  853. var WorkerClient = require("../worker/worker_client").WorkerClient;
  854. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  855. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  856. var Mode = function() {
  857. this.HighlightRules = JavaScriptHighlightRules;
  858. this.$outdent = new MatchingBraceOutdent();
  859. this.$behaviour = new CstyleBehaviour();
  860. this.foldingRules = new CStyleFoldMode();
  861. };
  862. oop.inherits(Mode, TextMode);
  863. (function() {
  864. this.lineCommentStart = "//";
  865. this.blockComment = {start: "/*", end: "*/"};
  866. this.getNextLineIndent = function(state, line, tab) {
  867. var indent = this.$getIndent(line);
  868. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  869. var tokens = tokenizedLine.tokens;
  870. var endState = tokenizedLine.state;
  871. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  872. return indent;
  873. }
  874. if (state == "start" || state == "no_regex") {
  875. var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
  876. if (match) {
  877. indent += tab;
  878. }
  879. } else if (state == "doc-start") {
  880. if (endState == "start" || endState == "no_regex") {
  881. return "";
  882. }
  883. var match = line.match(/^\s*(\/?)\*/);
  884. if (match) {
  885. if (match[1]) {
  886. indent += " ";
  887. }
  888. indent += "* ";
  889. }
  890. }
  891. return indent;
  892. };
  893. this.checkOutdent = function(state, line, input) {
  894. return this.$outdent.checkOutdent(line, input);
  895. };
  896. this.autoOutdent = function(state, doc, row) {
  897. this.$outdent.autoOutdent(doc, row);
  898. };
  899. this.createWorker = function(session) {
  900. var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
  901. worker.attachToDocument(session.getDocument());
  902. worker.on("jslint", function(results) {
  903. session.setAnnotations(results.data);
  904. });
  905. worker.on("terminate", function() {
  906. session.clearAnnotations();
  907. });
  908. return worker;
  909. };
  910. this.$id = "ace/mode/javascript";
  911. }).call(Mode.prototype);
  912. exports.Mode = Mode;
  913. });
  914. 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) {
  915. "use strict";
  916. var oop = require("../lib/oop");
  917. var lang = require("../lib/lang");
  918. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  919. var supportType = exports.supportType = "animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|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|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|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|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index";
  920. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  921. 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";
  922. var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
  923. var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
  924. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
  925. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  926. 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";
  927. var CssHighlightRules = function() {
  928. var keywordMapper = this.createKeywordMapper({
  929. "support.function": supportFunction,
  930. "support.constant": supportConstant,
  931. "support.type": supportType,
  932. "support.constant.color": supportConstantColor,
  933. "support.constant.fonts": supportConstantFonts
  934. }, "text", true);
  935. this.$rules = {
  936. "start" : [{
  937. token : "comment", // multi line comment
  938. regex : "\\/\\*",
  939. push : "comment"
  940. }, {
  941. token: "paren.lparen",
  942. regex: "\\{",
  943. push: "ruleset"
  944. }, {
  945. token: "string",
  946. regex: "@.*?{",
  947. push: "media"
  948. }, {
  949. token: "keyword",
  950. regex: "#[a-z0-9-_]+"
  951. }, {
  952. token: "variable",
  953. regex: "\\.[a-z0-9-_]+"
  954. }, {
  955. token: "string",
  956. regex: ":[a-z0-9-_]+"
  957. }, {
  958. token: "constant",
  959. regex: "[a-z0-9-_]+"
  960. }, {
  961. caseInsensitive: true
  962. }],
  963. "media" : [{
  964. token : "comment", // multi line comment
  965. regex : "\\/\\*",
  966. push : "comment"
  967. }, {
  968. token: "paren.lparen",
  969. regex: "\\{",
  970. push: "ruleset"
  971. }, {
  972. token: "string",
  973. regex: "\\}",
  974. next: "pop"
  975. }, {
  976. token: "keyword",
  977. regex: "#[a-z0-9-_]+"
  978. }, {
  979. token: "variable",
  980. regex: "\\.[a-z0-9-_]+"
  981. }, {
  982. token: "string",
  983. regex: ":[a-z0-9-_]+"
  984. }, {
  985. token: "constant",
  986. regex: "[a-z0-9-_]+"
  987. }, {
  988. caseInsensitive: true
  989. }],
  990. "comment" : [{
  991. token : "comment",
  992. regex : "\\*\\/",
  993. next : "pop"
  994. }, {
  995. defaultToken : "comment"
  996. }],
  997. "ruleset" : [
  998. {
  999. token : "paren.rparen",
  1000. regex : "\\}",
  1001. next: "pop"
  1002. }, {
  1003. token : "comment", // multi line comment
  1004. regex : "\\/\\*",
  1005. push : "comment"
  1006. }, {
  1007. token : "string", // single line
  1008. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  1009. }, {
  1010. token : "string", // single line
  1011. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  1012. }, {
  1013. token : ["constant.numeric", "keyword"],
  1014. 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|%)"
  1015. }, {
  1016. token : "constant.numeric",
  1017. regex : numRe
  1018. }, {
  1019. token : "constant.numeric", // hex6 color
  1020. regex : "#[a-f0-9]{6}"
  1021. }, {
  1022. token : "constant.numeric", // hex3 color
  1023. regex : "#[a-f0-9]{3}"
  1024. }, {
  1025. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  1026. regex : pseudoElements
  1027. }, {
  1028. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  1029. regex : pseudoClasses
  1030. }, {
  1031. token : ["support.function", "string", "support.function"],
  1032. regex : "(url\\()(.*)(\\))"
  1033. }, {
  1034. token : keywordMapper,
  1035. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  1036. }, {
  1037. caseInsensitive: true
  1038. }]
  1039. };
  1040. this.normalizeRules();
  1041. };
  1042. oop.inherits(CssHighlightRules, TextHighlightRules);
  1043. exports.CssHighlightRules = CssHighlightRules;
  1044. });
  1045. 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) {
  1046. "use strict";
  1047. var oop = require("../../lib/oop");
  1048. var Behaviour = require("../behaviour").Behaviour;
  1049. var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
  1050. var TokenIterator = require("../../token_iterator").TokenIterator;
  1051. var CssBehaviour = function () {
  1052. this.inherit(CstyleBehaviour);
  1053. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1054. if (text === ':') {
  1055. var cursor = editor.getCursorPosition();
  1056. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1057. var token = iterator.getCurrentToken();
  1058. if (token && token.value.match(/\s+/)) {
  1059. token = iterator.stepBackward();
  1060. }
  1061. if (token && token.type === 'support.type') {
  1062. var line = session.doc.getLine(cursor.row);
  1063. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1064. if (rightChar === ':') {
  1065. return {
  1066. text: '',
  1067. selection: [1, 1]
  1068. }
  1069. }
  1070. if (!line.substring(cursor.column).match(/^\s*;/)) {
  1071. return {
  1072. text: ':;',
  1073. selection: [1, 1]
  1074. }
  1075. }
  1076. }
  1077. }
  1078. });
  1079. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1080. var selected = session.doc.getTextRange(range);
  1081. if (!range.isMultiLine() && selected === ':') {
  1082. var cursor = editor.getCursorPosition();
  1083. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1084. var token = iterator.getCurrentToken();
  1085. if (token && token.value.match(/\s+/)) {
  1086. token = iterator.stepBackward();
  1087. }
  1088. if (token && token.type === 'support.type') {
  1089. var line = session.doc.getLine(range.start.row);
  1090. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1091. if (rightChar === ';') {
  1092. range.end.column ++;
  1093. return range;
  1094. }
  1095. }
  1096. }
  1097. });
  1098. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1099. if (text === ';') {
  1100. var cursor = editor.getCursorPosition();
  1101. var line = session.doc.getLine(cursor.row);
  1102. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1103. if (rightChar === ';') {
  1104. return {
  1105. text: '',
  1106. selection: [1, 1]
  1107. }
  1108. }
  1109. }
  1110. });
  1111. }
  1112. oop.inherits(CssBehaviour, CstyleBehaviour);
  1113. exports.CssBehaviour = CssBehaviour;
  1114. });
  1115. 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/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module) {
  1116. "use strict";
  1117. var oop = require("../lib/oop");
  1118. var TextMode = require("./text").Mode;
  1119. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1120. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1121. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1122. var CssBehaviour = require("./behaviour/css").CssBehaviour;
  1123. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1124. var Mode = function() {
  1125. this.HighlightRules = CssHighlightRules;
  1126. this.$outdent = new MatchingBraceOutdent();
  1127. this.$behaviour = new CssBehaviour();
  1128. this.foldingRules = new CStyleFoldMode();
  1129. };
  1130. oop.inherits(Mode, TextMode);
  1131. (function() {
  1132. this.foldingRules = "cStyle";
  1133. this.blockComment = {start: "/*", end: "*/"};
  1134. this.getNextLineIndent = function(state, line, tab) {
  1135. var indent = this.$getIndent(line);
  1136. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1137. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1138. return indent;
  1139. }
  1140. var match = line.match(/^.*\{\s*$/);
  1141. if (match) {
  1142. indent += tab;
  1143. }
  1144. return indent;
  1145. };
  1146. this.checkOutdent = function(state, line, input) {
  1147. return this.$outdent.checkOutdent(line, input);
  1148. };
  1149. this.autoOutdent = function(state, doc, row) {
  1150. this.$outdent.autoOutdent(doc, row);
  1151. };
  1152. this.createWorker = function(session) {
  1153. var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
  1154. worker.attachToDocument(session.getDocument());
  1155. worker.on("csslint", function(e) {
  1156. session.setAnnotations(e.data);
  1157. });
  1158. worker.on("terminate", function() {
  1159. session.clearAnnotations();
  1160. });
  1161. return worker;
  1162. };
  1163. this.$id = "ace/mode/css";
  1164. }).call(Mode.prototype);
  1165. exports.Mode = Mode;
  1166. });
  1167. ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  1168. "use strict";
  1169. var oop = require("../lib/oop");
  1170. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  1171. var XmlHighlightRules = function(normalize) {
  1172. this.$rules = {
  1173. start : [
  1174. {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
  1175. {
  1176. token : ["punctuation.xml-decl.xml", "keyword.xml-decl.xml"],
  1177. regex : "(<\\?)(xml)(?=[\\s])", next : "xml_decl", caseInsensitive: true
  1178. },
  1179. {
  1180. token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
  1181. regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "processing_instruction",
  1182. },
  1183. {token : "comment.xml", regex : "<\\!--", next : "comment"},
  1184. {
  1185. token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  1186. regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
  1187. },
  1188. {include : "tag"},
  1189. {token : "text.end-tag-open.xml", regex: "</"},
  1190. {token : "text.tag-open.xml", regex: "<"},
  1191. {include : "reference"},
  1192. {defaultToken : "text.xml"}
  1193. ],
  1194. xml_decl : [{
  1195. token : "entity.other.attribute-name.decl-attribute-name.xml",
  1196. regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+"
  1197. }, {
  1198. token : "keyword.operator.decl-attribute-equals.xml",
  1199. regex : "="
  1200. }, {
  1201. include: "whitespace"
  1202. }, {
  1203. include: "string"
  1204. }, {
  1205. token : "punctuation.xml-decl.xml",
  1206. regex : "\\?>",
  1207. next : "start"
  1208. }],
  1209. processing_instruction : [
  1210. {token : "punctuation.instruction.xml", regex : "\\?>", next : "start"},
  1211. {defaultToken : "instruction.xml"}
  1212. ],
  1213. doctype : [
  1214. {include : "whitespace"},
  1215. {include : "string"},
  1216. {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
  1217. {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
  1218. {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
  1219. ],
  1220. int_subset : [{
  1221. token : "text.xml",
  1222. regex : "\\s+"
  1223. }, {
  1224. token: "punctuation.int-subset.xml",
  1225. regex: "]",
  1226. next: "pop"
  1227. }, {
  1228. token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  1229. regex : "(<\\!)([-_a-zA-Z0-9]+)",
  1230. push : [{
  1231. token : "text",
  1232. regex : "\\s+"
  1233. },
  1234. {
  1235. token : "punctuation.markup-decl.xml",
  1236. regex : ">",
  1237. next : "pop"
  1238. },
  1239. {include : "string"}]
  1240. }],
  1241. cdata : [
  1242. {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
  1243. {token : "text.xml", regex : "\\s+"},
  1244. {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
  1245. ],
  1246. comment : [
  1247. {token : "comment.xml", regex : "-->", next : "start"},
  1248. {defaultToken : "comment.xml"}
  1249. ],
  1250. reference : [{
  1251. token : "constant.language.escape.reference.xml",
  1252. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  1253. }],
  1254. attr_reference : [{
  1255. token : "constant.language.escape.reference.attribute-value.xml",
  1256. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  1257. }],
  1258. tag : [{
  1259. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  1260. regex : "(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)",
  1261. next: [
  1262. {include : "attributes"},
  1263. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  1264. ]
  1265. }],
  1266. tag_whitespace : [
  1267. {token : "text.tag-whitespace.xml", regex : "\\s+"}
  1268. ],
  1269. whitespace : [
  1270. {token : "text.whitespace.xml", regex : "\\s+"}
  1271. ],
  1272. string: [{
  1273. token : "string.xml",
  1274. regex : "'",
  1275. push : [
  1276. {token : "string.xml", regex: "'", next: "pop"},
  1277. {defaultToken : "string.xml"}
  1278. ]
  1279. }, {
  1280. token : "string.xml",
  1281. regex : '"',
  1282. push : [
  1283. {token : "string.xml", regex: '"', next: "pop"},
  1284. {defaultToken : "string.xml"}
  1285. ]
  1286. }],
  1287. attributes: [{
  1288. token : "entity.other.attribute-name.xml",
  1289. regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+"
  1290. }, {
  1291. token : "keyword.operator.attribute-equals.xml",
  1292. regex : "="
  1293. }, {
  1294. include: "tag_whitespace"
  1295. }, {
  1296. include: "attribute_value"
  1297. }],
  1298. attribute_value: [{
  1299. token : "string.attribute-value.xml",
  1300. regex : "'",
  1301. push : [
  1302. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  1303. {include : "attr_reference"},
  1304. {defaultToken : "string.attribute-value.xml"}
  1305. ]
  1306. }, {
  1307. token : "string.attribute-value.xml",
  1308. regex : '"',
  1309. push : [
  1310. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  1311. {include : "attr_reference"},
  1312. {defaultToken : "string.attribute-value.xml"}
  1313. ]
  1314. }]
  1315. };
  1316. if (this.constructor === XmlHighlightRules)
  1317. this.normalizeRules();
  1318. };
  1319. (function() {
  1320. this.embedTagRules = function(HighlightRules, prefix, tag){
  1321. this.$rules.tag.unshift({
  1322. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  1323. regex : "(<)(" + tag + "(?=\\s|>|$))",
  1324. next: [
  1325. {include : "attributes"},
  1326. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
  1327. ]
  1328. });
  1329. this.$rules[tag + "-end"] = [
  1330. {include : "attributes"},
  1331. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
  1332. onMatch : function(value, currentState, stack) {
  1333. stack.splice(0);
  1334. return this.token;
  1335. }}
  1336. ]
  1337. this.embedRules(HighlightRules, prefix, [{
  1338. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  1339. regex : "(</)(" + tag + "(?=\\s|>|$))",
  1340. next: tag + "-end"
  1341. }, {
  1342. token: "string.cdata.xml",
  1343. regex : "<\\!\\[CDATA\\["
  1344. }, {
  1345. token: "string.cdata.xml",
  1346. regex : "\\]\\]>"
  1347. }]);
  1348. };
  1349. }).call(TextHighlightRules.prototype);
  1350. oop.inherits(XmlHighlightRules, TextHighlightRules);
  1351. exports.XmlHighlightRules = XmlHighlightRules;
  1352. });
  1353. ace.define("ace/mode/html_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/css_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"], function(require, exports, module) {
  1354. "use strict";
  1355. var oop = require("../lib/oop");
  1356. var lang = require("../lib/lang");
  1357. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1358. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1359. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  1360. var tagMap = lang.createMap({
  1361. a : 'anchor',
  1362. button : 'form',
  1363. form : 'form',
  1364. img : 'image',
  1365. input : 'form',
  1366. label : 'form',
  1367. option : 'form',
  1368. script : 'script',
  1369. select : 'form',
  1370. textarea : 'form',
  1371. style : 'style',
  1372. table : 'table',
  1373. tbody : 'table',
  1374. td : 'table',
  1375. tfoot : 'table',
  1376. th : 'table',
  1377. tr : 'table'
  1378. });
  1379. var HtmlHighlightRules = function() {
  1380. XmlHighlightRules.call(this);
  1381. this.addRules({
  1382. attributes: [{
  1383. include : "tag_whitespace"
  1384. }, {
  1385. token : "entity.other.attribute-name.xml",
  1386. regex : "[-_a-zA-Z0-9:]+"
  1387. }, {
  1388. token : "keyword.operator.attribute-equals.xml",
  1389. regex : "=",
  1390. push : [{
  1391. include: "tag_whitespace"
  1392. }, {
  1393. token : "string.unquoted.attribute-value.html",
  1394. regex : "[^<>='\"`\\s]+",
  1395. next : "pop"
  1396. }, {
  1397. token : "empty",
  1398. regex : "",
  1399. next : "pop"
  1400. }]
  1401. }, {
  1402. include : "attribute_value"
  1403. }],
  1404. tag: [{
  1405. token : function(start, tag) {
  1406. var group = tagMap[tag];
  1407. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  1408. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  1409. },
  1410. regex : "(</?)([-_a-zA-Z0-9:]+)",
  1411. next: "tag_stuff"
  1412. }],
  1413. tag_stuff: [
  1414. {include : "attributes"},
  1415. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  1416. ],
  1417. });
  1418. this.embedTagRules(CssHighlightRules, "css-", "style");
  1419. this.embedTagRules(JavaScriptHighlightRules, "js-", "script");
  1420. if (this.constructor === HtmlHighlightRules)
  1421. this.normalizeRules();
  1422. };
  1423. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  1424. exports.HtmlHighlightRules = HtmlHighlightRules;
  1425. });
  1426. 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) {
  1427. "use strict";
  1428. var oop = require("../../lib/oop");
  1429. var Behaviour = require("../behaviour").Behaviour;
  1430. var TokenIterator = require("../../token_iterator").TokenIterator;
  1431. var lang = require("../../lib/lang");
  1432. function is(token, type) {
  1433. return token.type.lastIndexOf(type + ".xml") > -1;
  1434. }
  1435. var XmlBehaviour = function () {
  1436. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  1437. if (text == '"' || text == "'") {
  1438. var quote = text;
  1439. var selected = session.doc.getTextRange(editor.getSelectionRange());
  1440. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  1441. return {
  1442. text: quote + selected + quote,
  1443. selection: false
  1444. };
  1445. }
  1446. var cursor = editor.getCursorPosition();
  1447. var line = session.doc.getLine(cursor.row);
  1448. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1449. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1450. var token = iterator.getCurrentToken();
  1451. if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
  1452. return {
  1453. text: "",
  1454. selection: [1, 1]
  1455. };
  1456. }
  1457. if (!token)
  1458. token = iterator.stepBackward();
  1459. if (!token)
  1460. return;
  1461. while (is(token, "tag-whitespace") || is(token, "whitespace")) {
  1462. token = iterator.stepBackward();
  1463. }
  1464. var rightSpace = !rightChar || rightChar.match(/\s/);
  1465. if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
  1466. return {
  1467. text: quote + quote,
  1468. selection: [1, 1]
  1469. };
  1470. }
  1471. }
  1472. });
  1473. this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
  1474. var selected = session.doc.getTextRange(range);
  1475. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  1476. var line = session.doc.getLine(range.start.row);
  1477. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  1478. if (rightChar == selected) {
  1479. range.end.column++;
  1480. return range;
  1481. }
  1482. }
  1483. });
  1484. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  1485. if (text == '>') {
  1486. var position = editor.getCursorPosition();
  1487. var iterator = new TokenIterator(session, position.row, position.column);
  1488. var token = iterator.getCurrentToken() || iterator.stepBackward();
  1489. if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
  1490. return;
  1491. if (is(token, "reference.attribute-value"))
  1492. return;
  1493. if (is(token, "attribute-value")) {
  1494. var firstChar = token.value.charAt(0);
  1495. if (firstChar == '"' || firstChar == "'") {
  1496. var lastChar = token.value.charAt(token.value.length - 1);
  1497. var tokenEnd = iterator.getCurrentTokenColumn() + token.value.length;
  1498. if (tokenEnd > position.column || tokenEnd == position.column && firstChar != lastChar)
  1499. return;
  1500. }
  1501. }
  1502. while (!is(token, "tag-name")) {
  1503. token = iterator.stepBackward();
  1504. }
  1505. var tokenRow = iterator.getCurrentTokenRow();
  1506. var tokenColumn = iterator.getCurrentTokenColumn();
  1507. if (is(iterator.stepBackward(), "end-tag-open"))
  1508. return;
  1509. var element = token.value;
  1510. if (tokenRow == position.row)
  1511. element = element.substring(0, position.column - tokenColumn);
  1512. if (this.voidElements.hasOwnProperty(element.toLowerCase()))
  1513. return;
  1514. return {
  1515. text: ">" + "</" + element + ">",
  1516. selection: [1, 1]
  1517. };
  1518. }
  1519. });
  1520. this.add("autoindent", "insertion", function (state, action, editor, session, text) {
  1521. if (text == "\n") {
  1522. var cursor = editor.getCursorPosition();
  1523. var line = session.getLine(cursor.row);
  1524. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1525. var token = iterator.getCurrentToken();
  1526. if (token && token.type.indexOf("tag-close") !== -1) {
  1527. while (token && token.type.indexOf("tag-name") === -1) {
  1528. token = iterator.stepBackward();
  1529. }
  1530. if (!token) {
  1531. return;
  1532. }
  1533. var tag = token.value;
  1534. var row = iterator.getCurrentTokenRow();
  1535. token = iterator.stepBackward();
  1536. if (!token || token.type.indexOf("end-tag") !== -1) {
  1537. return;
  1538. }
  1539. if (this.voidElements && !this.voidElements[tag]) {
  1540. var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
  1541. var line = session.getLine(row);
  1542. var nextIndent = this.$getIndent(line);
  1543. var indent = nextIndent + session.getTabString();
  1544. if (nextToken && nextToken.value === "</") {
  1545. return {
  1546. text: "\n" + indent + "\n" + nextIndent,
  1547. selection: [1, indent.length, 1, indent.length]
  1548. };
  1549. } else {
  1550. return {
  1551. text: "\n" + indent
  1552. };
  1553. }
  1554. }
  1555. }
  1556. }
  1557. });
  1558. };
  1559. oop.inherits(XmlBehaviour, Behaviour);
  1560. exports.XmlBehaviour = XmlBehaviour;
  1561. });
  1562. ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module) {
  1563. "use strict";
  1564. var oop = require("../../lib/oop");
  1565. var BaseFoldMode = require("./fold_mode").FoldMode;
  1566. var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
  1567. this.defaultMode = defaultMode;
  1568. this.subModes = subModes;
  1569. };
  1570. oop.inherits(FoldMode, BaseFoldMode);
  1571. (function() {
  1572. this.$getMode = function(state) {
  1573. if (typeof state != "string")
  1574. state = state[0];
  1575. for (var key in this.subModes) {
  1576. if (state.indexOf(key) === 0)
  1577. return this.subModes[key];
  1578. }
  1579. return null;
  1580. };
  1581. this.$tryMode = function(state, session, foldStyle, row) {
  1582. var mode = this.$getMode(state);
  1583. return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
  1584. };
  1585. this.getFoldWidget = function(session, foldStyle, row) {
  1586. return (
  1587. this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
  1588. this.$tryMode(session.getState(row), session, foldStyle, row) ||
  1589. this.defaultMode.getFoldWidget(session, foldStyle, row)
  1590. );
  1591. };
  1592. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1593. var mode = this.$getMode(session.getState(row-1));
  1594. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1595. mode = this.$getMode(session.getState(row));
  1596. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1597. mode = this.defaultMode;
  1598. return mode.getFoldWidgetRange(session, foldStyle, row);
  1599. };
  1600. }).call(FoldMode.prototype);
  1601. });
  1602. 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) {
  1603. "use strict";
  1604. var oop = require("../../lib/oop");
  1605. var lang = require("../../lib/lang");
  1606. var Range = require("../../range").Range;
  1607. var BaseFoldMode = require("./fold_mode").FoldMode;
  1608. var TokenIterator = require("../../token_iterator").TokenIterator;
  1609. var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
  1610. BaseFoldMode.call(this);
  1611. this.voidElements = voidElements || {};
  1612. this.optionalEndTags = oop.mixin({}, this.voidElements);
  1613. if (optionalEndTags)
  1614. oop.mixin(this.optionalEndTags, optionalEndTags);
  1615. };
  1616. oop.inherits(FoldMode, BaseFoldMode);
  1617. var Tag = function() {
  1618. this.tagName = "";
  1619. this.closing = false;
  1620. this.selfClosing = false;
  1621. this.start = {row: 0, column: 0};
  1622. this.end = {row: 0, column: 0};
  1623. };
  1624. function is(token, type) {
  1625. return token.type.lastIndexOf(type + ".xml") > -1;
  1626. }
  1627. (function() {
  1628. this.getFoldWidget = function(session, foldStyle, row) {
  1629. var tag = this._getFirstTagInLine(session, row);
  1630. if (!tag)
  1631. return "";
  1632. if (tag.closing || (!tag.tagName && tag.selfClosing))
  1633. return foldStyle == "markbeginend" ? "end" : "";
  1634. if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
  1635. return "";
  1636. if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
  1637. return "";
  1638. return "start";
  1639. };
  1640. this._getFirstTagInLine = function(session, row) {
  1641. var tokens = session.getTokens(row);
  1642. var tag = new Tag();
  1643. for (var i = 0; i < tokens.length; i++) {
  1644. var token = tokens[i];
  1645. if (is(token, "tag-open")) {
  1646. tag.end.column = tag.start.column + token.value.length;
  1647. tag.closing = is(token, "end-tag-open");
  1648. token = tokens[++i];
  1649. if (!token)
  1650. return null;
  1651. tag.tagName = token.value;
  1652. tag.end.column += token.value.length;
  1653. for (i++; i < tokens.length; i++) {
  1654. token = tokens[i];
  1655. tag.end.column += token.value.length;
  1656. if (is(token, "tag-close")) {
  1657. tag.selfClosing = token.value == '/>';
  1658. break;
  1659. }
  1660. }
  1661. return tag;
  1662. } else if (is(token, "tag-close")) {
  1663. tag.selfClosing = token.value == '/>';
  1664. return tag;
  1665. }
  1666. tag.start.column += token.value.length;
  1667. }
  1668. return null;
  1669. };
  1670. this._findEndTagInLine = function(session, row, tagName, startColumn) {
  1671. var tokens = session.getTokens(row);
  1672. var column = 0;
  1673. for (var i = 0; i < tokens.length; i++) {
  1674. var token = tokens[i];
  1675. column += token.value.length;
  1676. if (column < startColumn)
  1677. continue;
  1678. if (is(token, "end-tag-open")) {
  1679. token = tokens[i + 1];
  1680. if (token && token.value == tagName)
  1681. return true;
  1682. }
  1683. }
  1684. return false;
  1685. };
  1686. this._readTagForward = function(iterator) {
  1687. var token = iterator.getCurrentToken();
  1688. if (!token)
  1689. return null;
  1690. var tag = new Tag();
  1691. do {
  1692. if (is(token, "tag-open")) {
  1693. tag.closing = is(token, "end-tag-open");
  1694. tag.start.row = iterator.getCurrentTokenRow();
  1695. tag.start.column = iterator.getCurrentTokenColumn();
  1696. } else if (is(token, "tag-name")) {
  1697. tag.tagName = token.value;
  1698. } else if (is(token, "tag-close")) {
  1699. tag.selfClosing = token.value == "/>";
  1700. tag.end.row = iterator.getCurrentTokenRow();
  1701. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1702. iterator.stepForward();
  1703. return tag;
  1704. }
  1705. } while(token = iterator.stepForward());
  1706. return null;
  1707. };
  1708. this._readTagBackward = function(iterator) {
  1709. var token = iterator.getCurrentToken();
  1710. if (!token)
  1711. return null;
  1712. var tag = new Tag();
  1713. do {
  1714. if (is(token, "tag-open")) {
  1715. tag.closing = is(token, "end-tag-open");
  1716. tag.start.row = iterator.getCurrentTokenRow();
  1717. tag.start.column = iterator.getCurrentTokenColumn();
  1718. iterator.stepBackward();
  1719. return tag;
  1720. } else if (is(token, "tag-name")) {
  1721. tag.tagName = token.value;
  1722. } else if (is(token, "tag-close")) {
  1723. tag.selfClosing = token.value == "/>";
  1724. tag.end.row = iterator.getCurrentTokenRow();
  1725. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1726. }
  1727. } while(token = iterator.stepBackward());
  1728. return null;
  1729. };
  1730. this._pop = function(stack, tag) {
  1731. while (stack.length) {
  1732. var top = stack[stack.length-1];
  1733. if (!tag || top.tagName == tag.tagName) {
  1734. return stack.pop();
  1735. }
  1736. else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
  1737. stack.pop();
  1738. continue;
  1739. } else {
  1740. return null;
  1741. }
  1742. }
  1743. };
  1744. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1745. var firstTag = this._getFirstTagInLine(session, row);
  1746. if (!firstTag)
  1747. return null;
  1748. var isBackward = firstTag.closing || firstTag.selfClosing;
  1749. var stack = [];
  1750. var tag;
  1751. if (!isBackward) {
  1752. var iterator = new TokenIterator(session, row, firstTag.start.column);
  1753. var start = {
  1754. row: row,
  1755. column: firstTag.start.column + firstTag.tagName.length + 2
  1756. };
  1757. while (tag = this._readTagForward(iterator)) {
  1758. if (tag.selfClosing) {
  1759. if (!stack.length) {
  1760. tag.start.column += tag.tagName.length + 2;
  1761. tag.end.column -= 2;
  1762. return Range.fromPoints(tag.start, tag.end);
  1763. } else
  1764. continue;
  1765. }
  1766. if (tag.closing) {
  1767. this._pop(stack, tag);
  1768. if (stack.length == 0)
  1769. return Range.fromPoints(start, tag.start);
  1770. }
  1771. else {
  1772. stack.push(tag);
  1773. }
  1774. }
  1775. }
  1776. else {
  1777. var iterator = new TokenIterator(session, row, firstTag.end.column);
  1778. var end = {
  1779. row: row,
  1780. column: firstTag.start.column
  1781. };
  1782. while (tag = this._readTagBackward(iterator)) {
  1783. if (tag.selfClosing) {
  1784. if (!stack.length) {
  1785. tag.start.column += tag.tagName.length + 2;
  1786. tag.end.column -= 2;
  1787. return Range.fromPoints(tag.start, tag.end);
  1788. } else
  1789. continue;
  1790. }
  1791. if (!tag.closing) {
  1792. this._pop(stack, tag);
  1793. if (stack.length == 0) {
  1794. tag.start.column += tag.tagName.length + 2;
  1795. return Range.fromPoints(tag.start, end);
  1796. }
  1797. }
  1798. else {
  1799. stack.push(tag);
  1800. }
  1801. }
  1802. }
  1803. };
  1804. }).call(FoldMode.prototype);
  1805. });
  1806. 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) {
  1807. "use strict";
  1808. var oop = require("../../lib/oop");
  1809. var MixedFoldMode = require("./mixed").FoldMode;
  1810. var XmlFoldMode = require("./xml").FoldMode;
  1811. var CStyleFoldMode = require("./cstyle").FoldMode;
  1812. var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
  1813. MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
  1814. "js-": new CStyleFoldMode(),
  1815. "css-": new CStyleFoldMode()
  1816. });
  1817. };
  1818. oop.inherits(FoldMode, MixedFoldMode);
  1819. });
  1820. ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module) {
  1821. "use strict";
  1822. var TokenIterator = require("../token_iterator").TokenIterator;
  1823. var commonAttributes = [
  1824. "accesskey",
  1825. "class",
  1826. "contenteditable",
  1827. "contextmenu",
  1828. "dir",
  1829. "draggable",
  1830. "dropzone",
  1831. "hidden",
  1832. "id",
  1833. "inert",
  1834. "itemid",
  1835. "itemprop",
  1836. "itemref",
  1837. "itemscope",
  1838. "itemtype",
  1839. "lang",
  1840. "spellcheck",
  1841. "style",
  1842. "tabindex",
  1843. "title",
  1844. "translate"
  1845. ];
  1846. var eventAttributes = [
  1847. "onabort",
  1848. "onblur",
  1849. "oncancel",
  1850. "oncanplay",
  1851. "oncanplaythrough",
  1852. "onchange",
  1853. "onclick",
  1854. "onclose",
  1855. "oncontextmenu",
  1856. "oncuechange",
  1857. "ondblclick",
  1858. "ondrag",
  1859. "ondragend",
  1860. "ondragenter",
  1861. "ondragleave",
  1862. "ondragover",
  1863. "ondragstart",
  1864. "ondrop",
  1865. "ondurationchange",
  1866. "onemptied",
  1867. "onended",
  1868. "onerror",
  1869. "onfocus",
  1870. "oninput",
  1871. "oninvalid",
  1872. "onkeydown",
  1873. "onkeypress",
  1874. "onkeyup",
  1875. "onload",
  1876. "onloadeddata",
  1877. "onloadedmetadata",
  1878. "onloadstart",
  1879. "onmousedown",
  1880. "onmousemove",
  1881. "onmouseout",
  1882. "onmouseover",
  1883. "onmouseup",
  1884. "onmousewheel",
  1885. "onpause",
  1886. "onplay",
  1887. "onplaying",
  1888. "onprogress",
  1889. "onratechange",
  1890. "onreset",
  1891. "onscroll",
  1892. "onseeked",
  1893. "onseeking",
  1894. "onselect",
  1895. "onshow",
  1896. "onstalled",
  1897. "onsubmit",
  1898. "onsuspend",
  1899. "ontimeupdate",
  1900. "onvolumechange",
  1901. "onwaiting"
  1902. ];
  1903. var globalAttributes = commonAttributes.concat(eventAttributes);
  1904. var attributeMap = {
  1905. "html": ["manifest"],
  1906. "head": [],
  1907. "title": [],
  1908. "base": ["href", "target"],
  1909. "link": ["href", "hreflang", "rel", "media", "type", "sizes"],
  1910. "meta": ["http-equiv", "name", "content", "charset"],
  1911. "style": ["type", "media", "scoped"],
  1912. "script": ["charset", "type", "src", "defer", "async"],
  1913. "noscript": ["href"],
  1914. "body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"],
  1915. "section": [],
  1916. "nav": [],
  1917. "article": ["pubdate"],
  1918. "aside": [],
  1919. "h1": [],
  1920. "h2": [],
  1921. "h3": [],
  1922. "h4": [],
  1923. "h5": [],
  1924. "h6": [],
  1925. "header": [],
  1926. "footer": [],
  1927. "address": [],
  1928. "main": [],
  1929. "p": [],
  1930. "hr": [],
  1931. "pre": [],
  1932. "blockquote": ["cite"],
  1933. "ol": ["start", "reversed"],
  1934. "ul": [],
  1935. "li": ["value"],
  1936. "dl": [],
  1937. "dt": [],
  1938. "dd": [],
  1939. "figure": [],
  1940. "figcaption": [],
  1941. "div": [],
  1942. "a": ["href", "target", "ping", "rel", "media", "hreflang", "type"],
  1943. "em": [],
  1944. "strong": [],
  1945. "small": [],
  1946. "s": [],
  1947. "cite": [],
  1948. "q": ["cite"],
  1949. "dfn": [],
  1950. "abbr": [],
  1951. "data": [],
  1952. "time": ["datetime"],
  1953. "code": [],
  1954. "var": [],
  1955. "samp": [],
  1956. "kbd": [],
  1957. "sub": [],
  1958. "sup": [],
  1959. "i": [],
  1960. "b": [],
  1961. "u": [],
  1962. "mark": [],
  1963. "ruby": [],
  1964. "rt": [],
  1965. "rp": [],
  1966. "bdi": [],
  1967. "bdo": [],
  1968. "span": [],
  1969. "br": [],
  1970. "wbr": [],
  1971. "ins": ["cite", "datetime"],
  1972. "del": ["cite", "datetime"],
  1973. "img": ["alt", "src", "height", "width", "usemap", "ismap"],
  1974. "iframe": ["name", "src", "height", "width", "sandbox", "seamless"],
  1975. "embed": ["src", "height", "width", "type"],
  1976. "object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"],
  1977. "param": ["name", "value"],
  1978. "video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"],
  1979. "audio": ["src", "autobuffer", "autoplay", "loop", "controls"],
  1980. "source": ["src", "type", "media"],
  1981. "track": ["kind", "src", "srclang", "label", "default"],
  1982. "canvas": ["width", "height"],
  1983. "map": ["name"],
  1984. "area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"],
  1985. "svg": [],
  1986. "math": [],
  1987. "table": ["summary"],
  1988. "caption": [],
  1989. "colgroup": ["span"],
  1990. "col": ["span"],
  1991. "tbody": [],
  1992. "thead": [],
  1993. "tfoot": [],
  1994. "tr": [],
  1995. "td": ["headers", "rowspan", "colspan"],
  1996. "th": ["headers", "rowspan", "colspan", "scope"],
  1997. "form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"],
  1998. "fieldset": ["disabled", "form", "name"],
  1999. "legend": [],
  2000. "label": ["form", "for"],
  2001. "input": ["type", "accept", "alt", "autocomplete", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "multiple", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "width", "files", "value"],
  2002. "button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"],
  2003. "select": ["autofocus", "disabled", "form", "multiple", "name", "size"],
  2004. "datalist": [],
  2005. "optgroup": ["disabled", "label"],
  2006. "option": ["disabled", "selected", "label", "value"],
  2007. "textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"],
  2008. "keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"],
  2009. "output": ["for", "form", "name"],
  2010. "progress": ["value", "max"],
  2011. "meter": ["value", "min", "max", "low", "high", "optimum"],
  2012. "details": ["open"],
  2013. "summary": [],
  2014. "command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"],
  2015. "menu": ["type", "label"],
  2016. "dialog": ["open"]
  2017. };
  2018. var elements = Object.keys(attributeMap);
  2019. function is(token, type) {
  2020. return token.type.lastIndexOf(type + ".xml") > -1;
  2021. }
  2022. function findTagName(session, pos) {
  2023. var iterator = new TokenIterator(session, pos.row, pos.column);
  2024. var token = iterator.getCurrentToken();
  2025. while (token && !is(token, "tag-name")){
  2026. token = iterator.stepBackward();
  2027. }
  2028. if (token)
  2029. return token.value;
  2030. }
  2031. var HtmlCompletions = function() {
  2032. };
  2033. (function() {
  2034. this.getCompletions = function(state, session, pos, prefix) {
  2035. var token = session.getTokenAt(pos.row, pos.column);
  2036. if (!token)
  2037. return [];
  2038. if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
  2039. return this.getTagCompletions(state, session, pos, prefix);
  2040. if (is(token, "tag-whitespace") || is(token, "attribute-name"))
  2041. return this.getAttributeCompetions(state, session, pos, prefix);
  2042. return [];
  2043. };
  2044. this.getTagCompletions = function(state, session, pos, prefix) {
  2045. return elements.map(function(element){
  2046. return {
  2047. value: element,
  2048. meta: "tag",
  2049. score: Number.MAX_VALUE
  2050. };
  2051. });
  2052. };
  2053. this.getAttributeCompetions = function(state, session, pos, prefix) {
  2054. var tagName = findTagName(session, pos);
  2055. if (!tagName)
  2056. return [];
  2057. var attributes = globalAttributes;
  2058. if (tagName in attributeMap) {
  2059. attributes = attributes.concat(attributeMap[tagName]);
  2060. }
  2061. return attributes.map(function(attribute){
  2062. return {
  2063. caption: attribute,
  2064. snippet: attribute + '="$0"',
  2065. meta: "attribute",
  2066. score: Number.MAX_VALUE
  2067. };
  2068. });
  2069. };
  2070. }).call(HtmlCompletions.prototype);
  2071. exports.HtmlCompletions = HtmlCompletions;
  2072. });
  2073. ace.define("ace/mode/html",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/javascript","ace/mode/css","ace/mode/html_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/html","ace/mode/html_completions","ace/worker/worker_client"], function(require, exports, module) {
  2074. "use strict";
  2075. var oop = require("../lib/oop");
  2076. var lang = require("../lib/lang");
  2077. var TextMode = require("./text").Mode;
  2078. var JavaScriptMode = require("./javascript").Mode;
  2079. var CssMode = require("./css").Mode;
  2080. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2081. var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
  2082. var HtmlFoldMode = require("./folding/html").FoldMode;
  2083. var HtmlCompletions = require("./html_completions").HtmlCompletions;
  2084. var WorkerClient = require("../worker/worker_client").WorkerClient;
  2085. var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
  2086. var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
  2087. var Mode = function(options) {
  2088. this.fragmentContext = options && options.fragmentContext;
  2089. this.HighlightRules = HtmlHighlightRules;
  2090. this.$behaviour = new XmlBehaviour();
  2091. this.$completer = new HtmlCompletions();
  2092. this.createModeDelegates({
  2093. "js-": JavaScriptMode,
  2094. "css-": CssMode
  2095. });
  2096. this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
  2097. };
  2098. oop.inherits(Mode, TextMode);
  2099. (function() {
  2100. this.blockComment = {start: "<!--", end: "-->"};
  2101. this.voidElements = lang.arrayToMap(voidElements);
  2102. this.getNextLineIndent = function(state, line, tab) {
  2103. return this.$getIndent(line);
  2104. };
  2105. this.checkOutdent = function(state, line, input) {
  2106. return false;
  2107. };
  2108. this.getCompletions = function(state, session, pos, prefix) {
  2109. return this.$completer.getCompletions(state, session, pos, prefix);
  2110. };
  2111. this.createWorker = function(session) {
  2112. if (this.constructor != Mode)
  2113. return;
  2114. var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
  2115. worker.attachToDocument(session.getDocument());
  2116. if (this.fragmentContext)
  2117. worker.call("setOptions", [{context: this.fragmentContext}]);
  2118. worker.on("error", function(e) {
  2119. session.setAnnotations(e.data);
  2120. });
  2121. worker.on("terminate", function() {
  2122. session.clearAnnotations();
  2123. });
  2124. return worker;
  2125. };
  2126. this.$id = "ace/mode/html";
  2127. }).call(Mode.prototype);
  2128. exports.Mode = Mode;
  2129. });
  2130. ace.define("ace/mode/coldfusion_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/javascript_highlight_rules","ace/mode/html_highlight_rules"], function(require, exports, module) {
  2131. "use strict";
  2132. var oop = require("../lib/oop");
  2133. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  2134. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2135. var ColdfusionHighlightRules = function() {
  2136. HtmlHighlightRules.call(this);
  2137. this.embedTagRules(JavaScriptHighlightRules, "cfjs-", "cfscript");
  2138. this.normalizeRules();
  2139. };
  2140. oop.inherits(ColdfusionHighlightRules, HtmlHighlightRules);
  2141. exports.ColdfusionHighlightRules = ColdfusionHighlightRules;
  2142. });
  2143. ace.define("ace/mode/coldfusion",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/html","ace/mode/coldfusion_highlight_rules"], function(require, exports, module) {
  2144. "use strict";
  2145. var oop = require("../lib/oop");
  2146. var lang = require("../lib/lang");
  2147. var HtmlMode = require("./html").Mode;
  2148. var ColdfusionHighlightRules = require("./coldfusion_highlight_rules").ColdfusionHighlightRules;
  2149. var voidElements = "cfabort|cfapplication|cfargument|cfassociate|cfbreak|cfcache|cfcollection|cfcookie|cfdbinfo|cfdirectory|cfdump|cfelse|cfelseif|cferror|cfexchangecalendar|cfexchangeconnection|cfexchangecontact|cfexchangefilter|cfexchangetask|cfexit|cffeed|cffile|cfflush|cfftp|cfheader|cfhtmlhead|cfhttpparam|cfimage|cfimport|cfinclude|cfindex|cfinsert|cfinvokeargument|cflocation|cflog|cfmailparam|cfNTauthenticate|cfobject|cfobjectcache|cfparam|cfpdfformparam|cfprint|cfprocparam|cfprocresult|cfproperty|cfqueryparam|cfregistry|cfreportparam|cfrethrow|cfreturn|cfschedule|cfsearch|cfset|cfsetting|cfthrow|cfzipparam)".split("|");
  2150. var Mode = function() {
  2151. HtmlMode.call(this);
  2152. this.HighlightRules = ColdfusionHighlightRules;
  2153. };
  2154. oop.inherits(Mode, HtmlMode);
  2155. (function() {
  2156. this.voidElements = oop.mixin(lang.arrayToMap(voidElements), this.voidElements);
  2157. this.getNextLineIndent = function(state, line, tab) {
  2158. return this.$getIndent(line);
  2159. };
  2160. this.$id = "ace/mode/coldfusion";
  2161. }).call(Mode.prototype);
  2162. exports.Mode = Mode;
  2163. });