Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

mode-velocity.js 102KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709
  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/velocity_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/html_highlight_rules"], function(require, exports, module) {
  2131. "use strict";
  2132. var oop = require("../lib/oop");
  2133. var lang = require("../lib/lang");
  2134. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  2135. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2136. var VelocityHighlightRules = function() {
  2137. HtmlHighlightRules.call(this);
  2138. var builtinConstants = lang.arrayToMap(
  2139. ('true|false|null').split('|')
  2140. );
  2141. var builtinFunctions = lang.arrayToMap(
  2142. ("_DateTool|_DisplayTool|_EscapeTool|_FieldTool|_MathTool|_NumberTool|_SerializerTool|_SortTool|_StringTool|_XPathTool").split('|')
  2143. );
  2144. var builtinVariables = lang.arrayToMap(
  2145. ('$contentRoot|$foreach').split('|')
  2146. );
  2147. var keywords = lang.arrayToMap(
  2148. ("#set|#macro|#include|#parse|" +
  2149. "#if|#elseif|#else|#foreach|" +
  2150. "#break|#end|#stop"
  2151. ).split('|')
  2152. );
  2153. this.$rules.start.push(
  2154. {
  2155. token : "comment",
  2156. regex : "##.*$"
  2157. },{
  2158. token : "comment.block", // multi line comment
  2159. regex : "#\\*",
  2160. next : "vm_comment"
  2161. }, {
  2162. token : "string.regexp",
  2163. regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
  2164. }, {
  2165. token : "string", // single line
  2166. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  2167. }, {
  2168. token : "string", // single line
  2169. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  2170. }, {
  2171. token : "constant.numeric", // hex
  2172. regex : "0[xX][0-9a-fA-F]+\\b"
  2173. }, {
  2174. token : "constant.numeric", // float
  2175. regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
  2176. }, {
  2177. token : "constant.language.boolean",
  2178. regex : "(?:true|false)\\b"
  2179. }, {
  2180. token : function(value) {
  2181. if (keywords.hasOwnProperty(value))
  2182. return "keyword";
  2183. else if (builtinConstants.hasOwnProperty(value))
  2184. return "constant.language";
  2185. else if (builtinVariables.hasOwnProperty(value))
  2186. return "variable.language";
  2187. else if (builtinFunctions.hasOwnProperty(value) || builtinFunctions.hasOwnProperty(value.substring(1)))
  2188. return "support.function";
  2189. else if (value == "debugger")
  2190. return "invalid.deprecated";
  2191. else
  2192. if(value.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*)$/))
  2193. return "variable";
  2194. return "identifier";
  2195. },
  2196. regex : "[a-zA-Z$#][a-zA-Z0-9_]*\\b"
  2197. }, {
  2198. token : "keyword.operator",
  2199. regex : "!|&|\\*|\\-|\\+|=|!=|<=|>=|<|>|&&|\\|\\|"
  2200. }, {
  2201. token : "lparen",
  2202. regex : "[[({]"
  2203. }, {
  2204. token : "rparen",
  2205. regex : "[\\])}]"
  2206. }, {
  2207. token : "text",
  2208. regex : "\\s+"
  2209. }
  2210. );
  2211. this.$rules["vm_comment"] = [
  2212. {
  2213. token : "comment", // closing comment
  2214. regex : "\\*#|-->",
  2215. next : "start"
  2216. }, {
  2217. defaultToken: "comment"
  2218. }
  2219. ];
  2220. this.$rules["vm_start"] = [
  2221. {
  2222. token: "variable",
  2223. regex: "}",
  2224. next: "pop"
  2225. }, {
  2226. token : "string.regexp",
  2227. regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
  2228. }, {
  2229. token : "string", // single line
  2230. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  2231. }, {
  2232. token : "string", // single line
  2233. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  2234. }, {
  2235. token : "constant.numeric", // hex
  2236. regex : "0[xX][0-9a-fA-F]+\\b"
  2237. }, {
  2238. token : "constant.numeric", // float
  2239. regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
  2240. }, {
  2241. token : "constant.language.boolean",
  2242. regex : "(?:true|false)\\b"
  2243. }, {
  2244. token : function(value) {
  2245. if (keywords.hasOwnProperty(value))
  2246. return "keyword";
  2247. else if (builtinConstants.hasOwnProperty(value))
  2248. return "constant.language";
  2249. else if (builtinVariables.hasOwnProperty(value))
  2250. return "variable.language";
  2251. else if (builtinFunctions.hasOwnProperty(value) || builtinFunctions.hasOwnProperty(value.substring(1)))
  2252. return "support.function";
  2253. else if (value == "debugger")
  2254. return "invalid.deprecated";
  2255. else
  2256. if(value.match(/^(\$[a-zA-Z_$][a-zA-Z0-9_]*)$/))
  2257. return "variable";
  2258. return "identifier";
  2259. },
  2260. regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  2261. }, {
  2262. token : "keyword.operator",
  2263. regex : "!|&|\\*|\\-|\\+|=|!=|<=|>=|<|>|&&|\\|\\|"
  2264. }, {
  2265. token : "lparen",
  2266. regex : "[[({]"
  2267. }, {
  2268. token : "rparen",
  2269. regex : "[\\])}]"
  2270. }, {
  2271. token : "text",
  2272. regex : "\\s+"
  2273. }
  2274. ];
  2275. for (var i in this.$rules) {
  2276. this.$rules[i].unshift({
  2277. token: "variable",
  2278. regex: "\\${",
  2279. push: "vm_start"
  2280. });
  2281. }
  2282. this.normalizeRules();
  2283. };
  2284. oop.inherits(VelocityHighlightRules, TextHighlightRules);
  2285. exports.VelocityHighlightRules = VelocityHighlightRules;
  2286. });
  2287. ace.define("ace/mode/folding/velocity",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
  2288. "use strict";
  2289. var oop = require("../../lib/oop");
  2290. var BaseFoldMode = require("./fold_mode").FoldMode;
  2291. var Range = require("../../range").Range;
  2292. var FoldMode = exports.FoldMode = function() {};
  2293. oop.inherits(FoldMode, BaseFoldMode);
  2294. (function() {
  2295. this.getFoldWidgetRange = function(session, foldStyle, row) {
  2296. var range = this.indentationBlock(session, row);
  2297. if (range)
  2298. return range;
  2299. var re = /\S/;
  2300. var line = session.getLine(row);
  2301. var startLevel = line.search(re);
  2302. if (startLevel == -1 || line[startLevel] != "##")
  2303. return;
  2304. var startColumn = line.length;
  2305. var maxRow = session.getLength();
  2306. var startRow = row;
  2307. var endRow = row;
  2308. while (++row < maxRow) {
  2309. line = session.getLine(row);
  2310. var level = line.search(re);
  2311. if (level == -1)
  2312. continue;
  2313. if (line[level] != "##")
  2314. break;
  2315. endRow = row;
  2316. }
  2317. if (endRow > startRow) {
  2318. var endColumn = session.getLine(endRow).length;
  2319. return new Range(startRow, startColumn, endRow, endColumn);
  2320. }
  2321. };
  2322. this.getFoldWidget = function(session, foldStyle, row) {
  2323. var line = session.getLine(row);
  2324. var indent = line.search(/\S/);
  2325. var next = session.getLine(row + 1);
  2326. var prev = session.getLine(row - 1);
  2327. var prevIndent = prev.search(/\S/);
  2328. var nextIndent = next.search(/\S/);
  2329. if (indent == -1) {
  2330. session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
  2331. return "";
  2332. }
  2333. if (prevIndent == -1) {
  2334. if (indent == nextIndent && line[indent] == "##" && next[indent] == "##") {
  2335. session.foldWidgets[row - 1] = "";
  2336. session.foldWidgets[row + 1] = "";
  2337. return "start";
  2338. }
  2339. } else if (prevIndent == indent && line[indent] == "##" && prev[indent] == "##") {
  2340. if (session.getLine(row - 2).search(/\S/) == -1) {
  2341. session.foldWidgets[row - 1] = "start";
  2342. session.foldWidgets[row + 1] = "";
  2343. return "";
  2344. }
  2345. }
  2346. if (prevIndent!= -1 && prevIndent < indent)
  2347. session.foldWidgets[row - 1] = "start";
  2348. else
  2349. session.foldWidgets[row - 1] = "";
  2350. if (indent < nextIndent)
  2351. return "start";
  2352. else
  2353. return "";
  2354. };
  2355. }).call(FoldMode.prototype);
  2356. });
  2357. ace.define("ace/mode/velocity",["require","exports","module","ace/lib/oop","ace/mode/html","ace/mode/velocity_highlight_rules","ace/mode/folding/velocity"], function(require, exports, module) {
  2358. "use strict";
  2359. var oop = require("../lib/oop");
  2360. var HtmlMode = require("./html").Mode;
  2361. var VelocityHighlightRules = require("./velocity_highlight_rules").VelocityHighlightRules;
  2362. var FoldMode = require("./folding/velocity").FoldMode;
  2363. var Mode = function() {
  2364. HtmlMode.call(this);
  2365. this.HighlightRules = VelocityHighlightRules;
  2366. this.foldingRules = new FoldMode();
  2367. };
  2368. oop.inherits(Mode, HtmlMode);
  2369. (function() {
  2370. this.lineCommentStart = "##";
  2371. this.blockComment = {start: "#*", end: "*#"};
  2372. this.$id = "ace/mode/velocity";
  2373. }).call(Mode.prototype);
  2374. exports.Mode = Mode;
  2375. });