mode-html_elixir.js 122 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086
  1. ace.define("ace/mode/css_highlight_rules",[], function(require, exports, module) {
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var lang = require("../lib/lang");
  5. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  6. var supportType = exports.supportType = "align-content|align-items|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|border|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|bottom|box-shadow|box-sizing|caption-side|clear|clip|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|cursor|direction|display|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|font|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|hanging-punctuation|height|justify-content|left|letter-spacing|line-height|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|max-height|max-width|max-zoom|min-height|min-width|min-zoom|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|order|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page-break-after|page-break-before|page-break-inside|perspective|perspective-origin|position|quotes|resize|right|tab-size|table-layout|text-align|text-align-last|text-decoration|text-decoration-color|text-decoration-line|text-decoration-style|text-indent|text-justify|text-overflow|text-shadow|text-transform|top|transform|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|user-select|user-zoom|vertical-align|visibility|white-space|width|word-break|word-spacing|word-wrap|z-index";
  7. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  8. var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero|zoom";
  9. var supportConstantColor = exports.supportConstantColor = "aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen";
  10. var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
  11. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
  12. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  13. 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";
  14. var CssHighlightRules = function() {
  15. var keywordMapper = this.createKeywordMapper({
  16. "support.function": supportFunction,
  17. "support.constant": supportConstant,
  18. "support.type": supportType,
  19. "support.constant.color": supportConstantColor,
  20. "support.constant.fonts": supportConstantFonts
  21. }, "text", true);
  22. this.$rules = {
  23. "start" : [{
  24. include : ["strings", "url", "comments"]
  25. }, {
  26. token: "paren.lparen",
  27. regex: "\\{",
  28. next: "ruleset"
  29. }, {
  30. token: "paren.rparen",
  31. regex: "\\}"
  32. }, {
  33. token: "string",
  34. regex: "@(?!viewport)",
  35. next: "media"
  36. }, {
  37. token: "keyword",
  38. regex: "#[a-z0-9-_]+"
  39. }, {
  40. token: "keyword",
  41. regex: "%"
  42. }, {
  43. token: "variable",
  44. regex: "\\.[a-z0-9-_]+"
  45. }, {
  46. token: "string",
  47. regex: ":[a-z0-9-_]+"
  48. }, {
  49. token : "constant.numeric",
  50. regex : numRe
  51. }, {
  52. token: "constant",
  53. regex: "[a-z0-9-_]+"
  54. }, {
  55. caseInsensitive: true
  56. }],
  57. "media": [{
  58. include : ["strings", "url", "comments"]
  59. }, {
  60. token: "paren.lparen",
  61. regex: "\\{",
  62. next: "start"
  63. }, {
  64. token: "paren.rparen",
  65. regex: "\\}",
  66. next: "start"
  67. }, {
  68. token: "string",
  69. regex: ";",
  70. next: "start"
  71. }, {
  72. token: "keyword",
  73. regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
  74. + "|page|font|keyframes|viewport|counter-style|font-feature-values"
  75. + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
  76. }],
  77. "comments" : [{
  78. token: "comment", // multi line comment
  79. regex: "\\/\\*",
  80. push: [{
  81. token : "comment",
  82. regex : "\\*\\/",
  83. next : "pop"
  84. }, {
  85. defaultToken : "comment"
  86. }]
  87. }],
  88. "ruleset" : [{
  89. regex : "-(webkit|ms|moz|o)-",
  90. token : "text"
  91. }, {
  92. token : "punctuation.operator",
  93. regex : "[:;]"
  94. }, {
  95. token : "paren.rparen",
  96. regex : "\\}",
  97. next : "start"
  98. }, {
  99. include : ["strings", "url", "comments"]
  100. }, {
  101. token : ["constant.numeric", "keyword"],
  102. regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vmax|vmin|vm|vw|%)"
  103. }, {
  104. token : "constant.numeric",
  105. regex : numRe
  106. }, {
  107. token : "constant.numeric", // hex6 color
  108. regex : "#[a-f0-9]{6}"
  109. }, {
  110. token : "constant.numeric", // hex3 color
  111. regex : "#[a-f0-9]{3}"
  112. }, {
  113. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  114. regex : pseudoElements
  115. }, {
  116. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  117. regex : pseudoClasses
  118. }, {
  119. include: "url"
  120. }, {
  121. token : keywordMapper,
  122. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  123. }, {
  124. caseInsensitive: true
  125. }],
  126. url: [{
  127. token : "support.function",
  128. regex : "(?:url(:?-prefix)?|domain|regexp)\\(",
  129. push: [{
  130. token : "support.function",
  131. regex : "\\)",
  132. next : "pop"
  133. }, {
  134. defaultToken: "string"
  135. }]
  136. }],
  137. strings: [{
  138. token : "string.start",
  139. regex : "'",
  140. push : [{
  141. token : "string.end",
  142. regex : "'|$",
  143. next: "pop"
  144. }, {
  145. include : "escapes"
  146. }, {
  147. token : "constant.language.escape",
  148. regex : /\\$/,
  149. consumeLineEnd: true
  150. }, {
  151. defaultToken: "string"
  152. }]
  153. }, {
  154. token : "string.start",
  155. regex : '"',
  156. push : [{
  157. token : "string.end",
  158. regex : '"|$',
  159. next: "pop"
  160. }, {
  161. include : "escapes"
  162. }, {
  163. token : "constant.language.escape",
  164. regex : /\\$/,
  165. consumeLineEnd: true
  166. }, {
  167. defaultToken: "string"
  168. }]
  169. }],
  170. escapes: [{
  171. token : "constant.language.escape",
  172. regex : /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
  173. }]
  174. };
  175. this.normalizeRules();
  176. };
  177. oop.inherits(CssHighlightRules, TextHighlightRules);
  178. exports.CssHighlightRules = CssHighlightRules;
  179. });
  180. ace.define("ace/mode/doc_comment_highlight_rules",[], function(require, exports, module) {
  181. "use strict";
  182. var oop = require("../lib/oop");
  183. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  184. var DocCommentHighlightRules = function() {
  185. this.$rules = {
  186. "start" : [ {
  187. token : "comment.doc.tag",
  188. regex : "@[\\w\\d_]+" // TODO: fix email addresses
  189. },
  190. DocCommentHighlightRules.getTagRule(),
  191. {
  192. defaultToken : "comment.doc",
  193. caseInsensitive: true
  194. }]
  195. };
  196. };
  197. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  198. DocCommentHighlightRules.getTagRule = function(start) {
  199. return {
  200. token : "comment.doc.tag.storage.type",
  201. regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  202. };
  203. };
  204. DocCommentHighlightRules.getStartRule = function(start) {
  205. return {
  206. token : "comment.doc", // doc comment
  207. regex : "\\/\\*(?=\\*)",
  208. next : start
  209. };
  210. };
  211. DocCommentHighlightRules.getEndRule = function (start) {
  212. return {
  213. token : "comment.doc", // closing comment
  214. regex : "\\*\\/",
  215. next : start
  216. };
  217. };
  218. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  219. });
  220. ace.define("ace/mode/javascript_highlight_rules",[], function(require, exports, module) {
  221. "use strict";
  222. var oop = require("../lib/oop");
  223. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  224. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  225. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
  226. var JavaScriptHighlightRules = function(options) {
  227. var keywordMapper = this.createKeywordMapper({
  228. "variable.language":
  229. "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
  230. "Namespace|QName|XML|XMLList|" + // E4X
  231. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  232. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  233. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
  234. "SyntaxError|TypeError|URIError|" +
  235. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
  236. "isNaN|parseFloat|parseInt|" +
  237. "JSON|Math|" + // Other
  238. "this|arguments|prototype|window|document" , // Pseudo
  239. "keyword":
  240. "const|yield|import|get|set|async|await|" +
  241. "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  242. "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  243. "__parent__|__count__|escape|unescape|with|__proto__|" +
  244. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
  245. "storage.type":
  246. "const|let|var|function",
  247. "constant.language":
  248. "null|Infinity|NaN|undefined",
  249. "support.function":
  250. "alert",
  251. "constant.language.boolean": "true|false"
  252. }, "identifier");
  253. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
  254. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  255. "u[0-9a-fA-F]{4}|" + // unicode
  256. "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
  257. "[0-2][0-7]{0,2}|" + // oct
  258. "3[0-7][0-7]?|" + // oct
  259. "[4-7][0-7]?|" + //oct
  260. ".)";
  261. this.$rules = {
  262. "no_regex" : [
  263. DocCommentHighlightRules.getStartRule("doc-start"),
  264. comments("no_regex"),
  265. {
  266. token : "string",
  267. regex : "'(?=.)",
  268. next : "qstring"
  269. }, {
  270. token : "string",
  271. regex : '"(?=.)',
  272. next : "qqstring"
  273. }, {
  274. token : "constant.numeric", // hexadecimal, octal and binary
  275. regex : /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
  276. }, {
  277. token : "constant.numeric", // decimal integers and floats
  278. regex : /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
  279. }, {
  280. token : [
  281. "storage.type", "punctuation.operator", "support.function",
  282. "punctuation.operator", "entity.name.function", "text","keyword.operator"
  283. ],
  284. regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
  285. next: "function_arguments"
  286. }, {
  287. token : [
  288. "storage.type", "punctuation.operator", "entity.name.function", "text",
  289. "keyword.operator", "text", "storage.type", "text", "paren.lparen"
  290. ],
  291. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  292. next: "function_arguments"
  293. }, {
  294. token : [
  295. "entity.name.function", "text", "keyword.operator", "text", "storage.type",
  296. "text", "paren.lparen"
  297. ],
  298. regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  299. next: "function_arguments"
  300. }, {
  301. token : [
  302. "storage.type", "punctuation.operator", "entity.name.function", "text",
  303. "keyword.operator", "text",
  304. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  305. ],
  306. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
  307. next: "function_arguments"
  308. }, {
  309. token : [
  310. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  311. ],
  312. regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
  313. next: "function_arguments"
  314. }, {
  315. token : [
  316. "entity.name.function", "text", "punctuation.operator",
  317. "text", "storage.type", "text", "paren.lparen"
  318. ],
  319. regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
  320. next: "function_arguments"
  321. }, {
  322. token : [
  323. "text", "text", "storage.type", "text", "paren.lparen"
  324. ],
  325. regex : "(:)(\\s*)(function)(\\s*)(\\()",
  326. next: "function_arguments"
  327. }, {
  328. token : "keyword",
  329. regex : "from(?=\\s*('|\"))"
  330. }, {
  331. token : "keyword",
  332. regex : "(?:" + kwBeforeRe + ")\\b",
  333. next : "start"
  334. }, {
  335. token : ["support.constant"],
  336. regex : /that\b/
  337. }, {
  338. token : ["storage.type", "punctuation.operator", "support.function.firebug"],
  339. regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
  340. }, {
  341. token : keywordMapper,
  342. regex : identifierRe
  343. }, {
  344. token : "punctuation.operator",
  345. regex : /[.](?![.])/,
  346. next : "property"
  347. }, {
  348. token : "storage.type",
  349. regex : /=>/
  350. }, {
  351. token : "keyword.operator",
  352. regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
  353. next : "start"
  354. }, {
  355. token : "punctuation.operator",
  356. regex : /[?:,;.]/,
  357. next : "start"
  358. }, {
  359. token : "paren.lparen",
  360. regex : /[\[({]/,
  361. next : "start"
  362. }, {
  363. token : "paren.rparen",
  364. regex : /[\])}]/
  365. }, {
  366. token: "comment",
  367. regex: /^#!.*$/
  368. }
  369. ],
  370. property: [{
  371. token : "text",
  372. regex : "\\s+"
  373. }, {
  374. token : [
  375. "storage.type", "punctuation.operator", "entity.name.function", "text",
  376. "keyword.operator", "text",
  377. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  378. ],
  379. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
  380. next: "function_arguments"
  381. }, {
  382. token : "punctuation.operator",
  383. regex : /[.](?![.])/
  384. }, {
  385. token : "support.function",
  386. 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(?=\()/
  387. }, {
  388. token : "support.function.dom",
  389. regex : /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
  390. }, {
  391. token : "support.constant",
  392. 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/
  393. }, {
  394. token : "identifier",
  395. regex : identifierRe
  396. }, {
  397. regex: "",
  398. token: "empty",
  399. next: "no_regex"
  400. }
  401. ],
  402. "start": [
  403. DocCommentHighlightRules.getStartRule("doc-start"),
  404. comments("start"),
  405. {
  406. token: "string.regexp",
  407. regex: "\\/",
  408. next: "regex"
  409. }, {
  410. token : "text",
  411. regex : "\\s+|^$",
  412. next : "start"
  413. }, {
  414. token: "empty",
  415. regex: "",
  416. next: "no_regex"
  417. }
  418. ],
  419. "regex": [
  420. {
  421. token: "regexp.keyword.operator",
  422. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  423. }, {
  424. token: "string.regexp",
  425. regex: "/[sxngimy]*",
  426. next: "no_regex"
  427. }, {
  428. token : "invalid",
  429. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  430. }, {
  431. token : "constant.language.escape",
  432. regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  433. }, {
  434. token : "constant.language.delimiter",
  435. regex: /\|/
  436. }, {
  437. token: "constant.language.escape",
  438. regex: /\[\^?/,
  439. next: "regex_character_class"
  440. }, {
  441. token: "empty",
  442. regex: "$",
  443. next: "no_regex"
  444. }, {
  445. defaultToken: "string.regexp"
  446. }
  447. ],
  448. "regex_character_class": [
  449. {
  450. token: "regexp.charclass.keyword.operator",
  451. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  452. }, {
  453. token: "constant.language.escape",
  454. regex: "]",
  455. next: "regex"
  456. }, {
  457. token: "constant.language.escape",
  458. regex: "-"
  459. }, {
  460. token: "empty",
  461. regex: "$",
  462. next: "no_regex"
  463. }, {
  464. defaultToken: "string.regexp.charachterclass"
  465. }
  466. ],
  467. "function_arguments": [
  468. {
  469. token: "variable.parameter",
  470. regex: identifierRe
  471. }, {
  472. token: "punctuation.operator",
  473. regex: "[, ]+"
  474. }, {
  475. token: "punctuation.operator",
  476. regex: "$"
  477. }, {
  478. token: "empty",
  479. regex: "",
  480. next: "no_regex"
  481. }
  482. ],
  483. "qqstring" : [
  484. {
  485. token : "constant.language.escape",
  486. regex : escapedRe
  487. }, {
  488. token : "string",
  489. regex : "\\\\$",
  490. consumeLineEnd : true
  491. }, {
  492. token : "string",
  493. regex : '"|$',
  494. next : "no_regex"
  495. }, {
  496. defaultToken: "string"
  497. }
  498. ],
  499. "qstring" : [
  500. {
  501. token : "constant.language.escape",
  502. regex : escapedRe
  503. }, {
  504. token : "string",
  505. regex : "\\\\$",
  506. consumeLineEnd : true
  507. }, {
  508. token : "string",
  509. regex : "'|$",
  510. next : "no_regex"
  511. }, {
  512. defaultToken: "string"
  513. }
  514. ]
  515. };
  516. if (!options || !options.noES6) {
  517. this.$rules.no_regex.unshift({
  518. regex: "[{}]", onMatch: function(val, state, stack) {
  519. this.next = val == "{" ? this.nextState : "";
  520. if (val == "{" && stack.length) {
  521. stack.unshift("start", state);
  522. }
  523. else if (val == "}" && stack.length) {
  524. stack.shift();
  525. this.next = stack.shift();
  526. if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
  527. return "paren.quasi.end";
  528. }
  529. return val == "{" ? "paren.lparen" : "paren.rparen";
  530. },
  531. nextState: "start"
  532. }, {
  533. token : "string.quasi.start",
  534. regex : /`/,
  535. push : [{
  536. token : "constant.language.escape",
  537. regex : escapedRe
  538. }, {
  539. token : "paren.quasi.start",
  540. regex : /\${/,
  541. push : "start"
  542. }, {
  543. token : "string.quasi.end",
  544. regex : /`/,
  545. next : "pop"
  546. }, {
  547. defaultToken: "string.quasi"
  548. }]
  549. });
  550. if (!options || options.jsx != false)
  551. JSX.call(this);
  552. }
  553. this.embedRules(DocCommentHighlightRules, "doc-",
  554. [ DocCommentHighlightRules.getEndRule("no_regex") ]);
  555. this.normalizeRules();
  556. };
  557. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  558. function JSX() {
  559. var tagRegex = identifierRe.replace("\\d", "\\d\\-");
  560. var jsxTag = {
  561. onMatch : function(val, state, stack) {
  562. var offset = val.charAt(1) == "/" ? 2 : 1;
  563. if (offset == 1) {
  564. if (state != this.nextState)
  565. stack.unshift(this.next, this.nextState, 0);
  566. else
  567. stack.unshift(this.next);
  568. stack[2]++;
  569. } else if (offset == 2) {
  570. if (state == this.nextState) {
  571. stack[1]--;
  572. if (!stack[1] || stack[1] < 0) {
  573. stack.shift();
  574. stack.shift();
  575. }
  576. }
  577. }
  578. return [{
  579. type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
  580. value: val.slice(0, offset)
  581. }, {
  582. type: "meta.tag.tag-name.xml",
  583. value: val.substr(offset)
  584. }];
  585. },
  586. regex : "</?" + tagRegex + "",
  587. next: "jsxAttributes",
  588. nextState: "jsx"
  589. };
  590. this.$rules.start.unshift(jsxTag);
  591. var jsxJsRule = {
  592. regex: "{",
  593. token: "paren.quasi.start",
  594. push: "start"
  595. };
  596. this.$rules.jsx = [
  597. jsxJsRule,
  598. jsxTag,
  599. {include : "reference"},
  600. {defaultToken: "string"}
  601. ];
  602. this.$rules.jsxAttributes = [{
  603. token : "meta.tag.punctuation.tag-close.xml",
  604. regex : "/?>",
  605. onMatch : function(value, currentState, stack) {
  606. if (currentState == stack[0])
  607. stack.shift();
  608. if (value.length == 2) {
  609. if (stack[0] == this.nextState)
  610. stack[1]--;
  611. if (!stack[1] || stack[1] < 0) {
  612. stack.splice(0, 2);
  613. }
  614. }
  615. this.next = stack[0] || "start";
  616. return [{type: this.token, value: value}];
  617. },
  618. nextState: "jsx"
  619. },
  620. jsxJsRule,
  621. comments("jsxAttributes"),
  622. {
  623. token : "entity.other.attribute-name.xml",
  624. regex : tagRegex
  625. }, {
  626. token : "keyword.operator.attribute-equals.xml",
  627. regex : "="
  628. }, {
  629. token : "text.tag-whitespace.xml",
  630. regex : "\\s+"
  631. }, {
  632. token : "string.attribute-value.xml",
  633. regex : "'",
  634. stateName : "jsx_attr_q",
  635. push : [
  636. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  637. {include : "reference"},
  638. {defaultToken : "string.attribute-value.xml"}
  639. ]
  640. }, {
  641. token : "string.attribute-value.xml",
  642. regex : '"',
  643. stateName : "jsx_attr_qq",
  644. push : [
  645. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  646. {include : "reference"},
  647. {defaultToken : "string.attribute-value.xml"}
  648. ]
  649. },
  650. jsxTag
  651. ];
  652. this.$rules.reference = [{
  653. token : "constant.language.escape.reference.xml",
  654. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  655. }];
  656. }
  657. function comments(next) {
  658. return [
  659. {
  660. token : "comment", // multi line comment
  661. regex : /\/\*/,
  662. next: [
  663. DocCommentHighlightRules.getTagRule(),
  664. {token : "comment", regex : "\\*\\/", next : next || "pop"},
  665. {defaultToken : "comment", caseInsensitive: true}
  666. ]
  667. }, {
  668. token : "comment",
  669. regex : "\\/\\/",
  670. next: [
  671. DocCommentHighlightRules.getTagRule(),
  672. {token : "comment", regex : "$|^", next : next || "pop"},
  673. {defaultToken : "comment", caseInsensitive: true}
  674. ]
  675. }
  676. ];
  677. }
  678. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  679. });
  680. ace.define("ace/mode/xml_highlight_rules",[], function(require, exports, module) {
  681. "use strict";
  682. var oop = require("../lib/oop");
  683. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  684. var XmlHighlightRules = function(normalize) {
  685. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  686. this.$rules = {
  687. start : [
  688. {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
  689. {
  690. token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
  691. regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction"
  692. },
  693. {token : "comment.start.xml", regex : "<\\!--", next : "comment"},
  694. {
  695. token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  696. regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
  697. },
  698. {include : "tag"},
  699. {token : "text.end-tag-open.xml", regex: "</"},
  700. {token : "text.tag-open.xml", regex: "<"},
  701. {include : "reference"},
  702. {defaultToken : "text.xml"}
  703. ],
  704. processing_instruction : [{
  705. token : "entity.other.attribute-name.decl-attribute-name.xml",
  706. regex : tagRegex
  707. }, {
  708. token : "keyword.operator.decl-attribute-equals.xml",
  709. regex : "="
  710. }, {
  711. include: "whitespace"
  712. }, {
  713. include: "string"
  714. }, {
  715. token : "punctuation.xml-decl.xml",
  716. regex : "\\?>",
  717. next : "start"
  718. }],
  719. doctype : [
  720. {include : "whitespace"},
  721. {include : "string"},
  722. {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
  723. {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
  724. {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
  725. ],
  726. int_subset : [{
  727. token : "text.xml",
  728. regex : "\\s+"
  729. }, {
  730. token: "punctuation.int-subset.xml",
  731. regex: "]",
  732. next: "pop"
  733. }, {
  734. token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  735. regex : "(<\\!)(" + tagRegex + ")",
  736. push : [{
  737. token : "text",
  738. regex : "\\s+"
  739. },
  740. {
  741. token : "punctuation.markup-decl.xml",
  742. regex : ">",
  743. next : "pop"
  744. },
  745. {include : "string"}]
  746. }],
  747. cdata : [
  748. {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
  749. {token : "text.xml", regex : "\\s+"},
  750. {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
  751. ],
  752. comment : [
  753. {token : "comment.end.xml", regex : "-->", next : "start"},
  754. {defaultToken : "comment.xml"}
  755. ],
  756. reference : [{
  757. token : "constant.language.escape.reference.xml",
  758. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  759. }],
  760. attr_reference : [{
  761. token : "constant.language.escape.reference.attribute-value.xml",
  762. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  763. }],
  764. tag : [{
  765. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  766. regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  767. next: [
  768. {include : "attributes"},
  769. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  770. ]
  771. }],
  772. tag_whitespace : [
  773. {token : "text.tag-whitespace.xml", regex : "\\s+"}
  774. ],
  775. whitespace : [
  776. {token : "text.whitespace.xml", regex : "\\s+"}
  777. ],
  778. string: [{
  779. token : "string.xml",
  780. regex : "'",
  781. push : [
  782. {token : "string.xml", regex: "'", next: "pop"},
  783. {defaultToken : "string.xml"}
  784. ]
  785. }, {
  786. token : "string.xml",
  787. regex : '"',
  788. push : [
  789. {token : "string.xml", regex: '"', next: "pop"},
  790. {defaultToken : "string.xml"}
  791. ]
  792. }],
  793. attributes: [{
  794. token : "entity.other.attribute-name.xml",
  795. regex : tagRegex
  796. }, {
  797. token : "keyword.operator.attribute-equals.xml",
  798. regex : "="
  799. }, {
  800. include: "tag_whitespace"
  801. }, {
  802. include: "attribute_value"
  803. }],
  804. attribute_value: [{
  805. token : "string.attribute-value.xml",
  806. regex : "'",
  807. push : [
  808. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  809. {include : "attr_reference"},
  810. {defaultToken : "string.attribute-value.xml"}
  811. ]
  812. }, {
  813. token : "string.attribute-value.xml",
  814. regex : '"',
  815. push : [
  816. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  817. {include : "attr_reference"},
  818. {defaultToken : "string.attribute-value.xml"}
  819. ]
  820. }]
  821. };
  822. if (this.constructor === XmlHighlightRules)
  823. this.normalizeRules();
  824. };
  825. (function() {
  826. this.embedTagRules = function(HighlightRules, prefix, tag){
  827. this.$rules.tag.unshift({
  828. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  829. regex : "(<)(" + tag + "(?=\\s|>|$))",
  830. next: [
  831. {include : "attributes"},
  832. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
  833. ]
  834. });
  835. this.$rules[tag + "-end"] = [
  836. {include : "attributes"},
  837. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
  838. onMatch : function(value, currentState, stack) {
  839. stack.splice(0);
  840. return this.token;
  841. }}
  842. ];
  843. this.embedRules(HighlightRules, prefix, [{
  844. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  845. regex : "(</)(" + tag + "(?=\\s|>|$))",
  846. next: tag + "-end"
  847. }, {
  848. token: "string.cdata.xml",
  849. regex : "<\\!\\[CDATA\\["
  850. }, {
  851. token: "string.cdata.xml",
  852. regex : "\\]\\]>"
  853. }]);
  854. };
  855. }).call(TextHighlightRules.prototype);
  856. oop.inherits(XmlHighlightRules, TextHighlightRules);
  857. exports.XmlHighlightRules = XmlHighlightRules;
  858. });
  859. ace.define("ace/mode/html_highlight_rules",[], function(require, exports, module) {
  860. "use strict";
  861. var oop = require("../lib/oop");
  862. var lang = require("../lib/lang");
  863. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  864. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  865. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  866. var tagMap = lang.createMap({
  867. a : 'anchor',
  868. button : 'form',
  869. form : 'form',
  870. img : 'image',
  871. input : 'form',
  872. label : 'form',
  873. option : 'form',
  874. script : 'script',
  875. select : 'form',
  876. textarea : 'form',
  877. style : 'style',
  878. table : 'table',
  879. tbody : 'table',
  880. td : 'table',
  881. tfoot : 'table',
  882. th : 'table',
  883. tr : 'table'
  884. });
  885. var HtmlHighlightRules = function() {
  886. XmlHighlightRules.call(this);
  887. this.addRules({
  888. attributes: [{
  889. include : "tag_whitespace"
  890. }, {
  891. token : "entity.other.attribute-name.xml",
  892. regex : "[-_a-zA-Z0-9:.]+"
  893. }, {
  894. token : "keyword.operator.attribute-equals.xml",
  895. regex : "=",
  896. push : [{
  897. include: "tag_whitespace"
  898. }, {
  899. token : "string.unquoted.attribute-value.html",
  900. regex : "[^<>='\"`\\s]+",
  901. next : "pop"
  902. }, {
  903. token : "empty",
  904. regex : "",
  905. next : "pop"
  906. }]
  907. }, {
  908. include : "attribute_value"
  909. }],
  910. tag: [{
  911. token : function(start, tag) {
  912. var group = tagMap[tag];
  913. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  914. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  915. },
  916. regex : "(</?)([-_a-zA-Z0-9:.]+)",
  917. next: "tag_stuff"
  918. }],
  919. tag_stuff: [
  920. {include : "attributes"},
  921. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  922. ]
  923. });
  924. this.embedTagRules(CssHighlightRules, "css-", "style");
  925. this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "js-", "script");
  926. if (this.constructor === HtmlHighlightRules)
  927. this.normalizeRules();
  928. };
  929. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  930. exports.HtmlHighlightRules = HtmlHighlightRules;
  931. });
  932. ace.define("ace/mode/elixir_highlight_rules",[], function(require, exports, module) {
  933. "use strict";
  934. var oop = require("../lib/oop");
  935. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  936. var ElixirHighlightRules = function() {
  937. this.$rules = { start:
  938. [ { token:
  939. [ 'meta.module.elixir',
  940. 'keyword.control.module.elixir',
  941. 'meta.module.elixir',
  942. 'entity.name.type.module.elixir' ],
  943. regex: '^(\\s*)(defmodule)(\\s+)((?:[A-Z]\\w*\\s*\\.\\s*)*[A-Z]\\w*)' },
  944. { token: 'comment.documentation.heredoc',
  945. regex: '@(?:module|type)?doc (?:~[a-z])?"""',
  946. push:
  947. [ { token: 'comment.documentation.heredoc',
  948. regex: '\\s*"""',
  949. next: 'pop' },
  950. { include: '#interpolated_elixir' },
  951. { include: '#escaped_char' },
  952. { defaultToken: 'comment.documentation.heredoc' } ],
  953. comment: '@doc with heredocs is treated as documentation' },
  954. { token: 'comment.documentation.heredoc',
  955. regex: '@(?:module|type)?doc ~[A-Z]"""',
  956. push:
  957. [ { token: 'comment.documentation.heredoc',
  958. regex: '\\s*"""',
  959. next: 'pop' },
  960. { defaultToken: 'comment.documentation.heredoc' } ],
  961. comment: '@doc with heredocs is treated as documentation' },
  962. { token: 'comment.documentation.heredoc',
  963. regex: '@(?:module|type)?doc (?:~[a-z])?\'\'\'',
  964. push:
  965. [ { token: 'comment.documentation.heredoc',
  966. regex: '\\s*\'\'\'',
  967. next: 'pop' },
  968. { include: '#interpolated_elixir' },
  969. { include: '#escaped_char' },
  970. { defaultToken: 'comment.documentation.heredoc' } ],
  971. comment: '@doc with heredocs is treated as documentation' },
  972. { token: 'comment.documentation.heredoc',
  973. regex: '@(?:module|type)?doc ~[A-Z]\'\'\'',
  974. push:
  975. [ { token: 'comment.documentation.heredoc',
  976. regex: '\\s*\'\'\'',
  977. next: 'pop' },
  978. { defaultToken: 'comment.documentation.heredoc' } ],
  979. comment: '@doc with heredocs is treated as documentation' },
  980. { token: 'comment.documentation.false',
  981. regex: '@(?:module|type)?doc false',
  982. comment: '@doc false is treated as documentation' },
  983. { token: 'comment.documentation.string',
  984. regex: '@(?:module|type)?doc "',
  985. push:
  986. [ { token: 'comment.documentation.string',
  987. regex: '"',
  988. next: 'pop' },
  989. { include: '#interpolated_elixir' },
  990. { include: '#escaped_char' },
  991. { defaultToken: 'comment.documentation.string' } ],
  992. comment: '@doc with string is treated as documentation' },
  993. { token: 'keyword.control.elixir',
  994. regex: '\\b(?:do|end|case|bc|lc|for|if|cond|unless|try|receive|fn|defmodule|defp?|defprotocol|defimpl|defrecord|defstruct|defmacrop?|defdelegate|defcallback|defmacrocallback|defexception|defoverridable|exit|after|rescue|catch|else|raise|throw|import|require|alias|use|quote|unquote|super)\\b(?![?!])',
  995. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  996. originalRegex: '(?<!\\.)\\b(do|end|case|bc|lc|for|if|cond|unless|try|receive|fn|defmodule|defp?|defprotocol|defimpl|defrecord|defstruct|defmacrop?|defdelegate|defcallback|defmacrocallback|defexception|defoverridable|exit|after|rescue|catch|else|raise|throw|import|require|alias|use|quote|unquote|super)\\b(?![?!])' },
  997. { token: 'keyword.operator.elixir',
  998. regex: '\\b(?:and|not|or|when|xor|in|inlist|inbits)\\b',
  999. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  1000. originalRegex: '(?<!\\.)\\b(and|not|or|when|xor|in|inlist|inbits)\\b',
  1001. comment: ' as above, just doesn\'t need a \'end\' and does a logic operation' },
  1002. { token: 'constant.language.elixir',
  1003. regex: '\\b(?:nil|true|false)\\b(?![?!])' },
  1004. { token: 'variable.language.elixir',
  1005. regex: '\\b__(?:CALLER|ENV|MODULE|DIR)__\\b(?![?!])' },
  1006. { token:
  1007. [ 'punctuation.definition.variable.elixir',
  1008. 'variable.other.readwrite.module.elixir' ],
  1009. regex: '(@)([a-zA-Z_]\\w*)' },
  1010. { token:
  1011. [ 'punctuation.definition.variable.elixir',
  1012. 'variable.other.anonymous.elixir' ],
  1013. regex: '(&)(\\d*)' },
  1014. { token: 'variable.other.constant.elixir',
  1015. regex: '\\b[A-Z]\\w*\\b' },
  1016. { token: 'constant.numeric.elixir',
  1017. regex: '\\b(?:0x[\\da-fA-F](?:_?[\\da-fA-F])*|\\d(?:_?\\d)*(?:\\.(?![^[:space:][:digit:]])(?:_?\\d)*)?(?:[eE][-+]?\\d(?:_?\\d)*)?|0b[01]+|0o[0-7]+)\\b',
  1018. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  1019. originalRegex: '\\b(0x\\h(?>_?\\h)*|\\d(?>_?\\d)*(\\.(?![^[:space:][:digit:]])(?>_?\\d)*)?([eE][-+]?\\d(?>_?\\d)*)?|0b[01]+|0o[0-7]+)\\b' },
  1020. { token: 'punctuation.definition.constant.elixir',
  1021. regex: ':\'',
  1022. push:
  1023. [ { token: 'punctuation.definition.constant.elixir',
  1024. regex: '\'',
  1025. next: 'pop' },
  1026. { include: '#interpolated_elixir' },
  1027. { include: '#escaped_char' },
  1028. { defaultToken: 'constant.other.symbol.single-quoted.elixir' } ] },
  1029. { token: 'punctuation.definition.constant.elixir',
  1030. regex: ':"',
  1031. push:
  1032. [ { token: 'punctuation.definition.constant.elixir',
  1033. regex: '"',
  1034. next: 'pop' },
  1035. { include: '#interpolated_elixir' },
  1036. { include: '#escaped_char' },
  1037. { defaultToken: 'constant.other.symbol.double-quoted.elixir' } ] },
  1038. { token: 'punctuation.definition.string.begin.elixir',
  1039. regex: '(?:\'\'\')',
  1040. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  1041. originalRegex: '(?>\'\'\')',
  1042. push:
  1043. [ { token: 'punctuation.definition.string.end.elixir',
  1044. regex: '^\\s*\'\'\'',
  1045. next: 'pop' },
  1046. { include: '#interpolated_elixir' },
  1047. { include: '#escaped_char' },
  1048. { defaultToken: 'support.function.variable.quoted.single.heredoc.elixir' } ],
  1049. comment: 'Single-quoted heredocs' },
  1050. { token: 'punctuation.definition.string.begin.elixir',
  1051. regex: '\'',
  1052. push:
  1053. [ { token: 'punctuation.definition.string.end.elixir',
  1054. regex: '\'',
  1055. next: 'pop' },
  1056. { include: '#interpolated_elixir' },
  1057. { include: '#escaped_char' },
  1058. { defaultToken: 'support.function.variable.quoted.single.elixir' } ],
  1059. comment: 'single quoted string (allows for interpolation)' },
  1060. { token: 'punctuation.definition.string.begin.elixir',
  1061. regex: '(?:""")',
  1062. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  1063. originalRegex: '(?>""")',
  1064. push:
  1065. [ { token: 'punctuation.definition.string.end.elixir',
  1066. regex: '^\\s*"""',
  1067. next: 'pop' },
  1068. { include: '#interpolated_elixir' },
  1069. { include: '#escaped_char' },
  1070. { defaultToken: 'string.quoted.double.heredoc.elixir' } ],
  1071. comment: 'Double-quoted heredocs' },
  1072. { token: 'punctuation.definition.string.begin.elixir',
  1073. regex: '"',
  1074. push:
  1075. [ { token: 'punctuation.definition.string.end.elixir',
  1076. regex: '"',
  1077. next: 'pop' },
  1078. { include: '#interpolated_elixir' },
  1079. { include: '#escaped_char' },
  1080. { defaultToken: 'string.quoted.double.elixir' } ],
  1081. comment: 'double quoted string (allows for interpolation)' },
  1082. { token: 'punctuation.definition.string.begin.elixir',
  1083. regex: '~[a-z](?:""")',
  1084. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  1085. originalRegex: '~[a-z](?>""")',
  1086. push:
  1087. [ { token: 'punctuation.definition.string.end.elixir',
  1088. regex: '^\\s*"""',
  1089. next: 'pop' },
  1090. { include: '#interpolated_elixir' },
  1091. { include: '#escaped_char' },
  1092. { defaultToken: 'string.quoted.double.heredoc.elixir' } ],
  1093. comment: 'Double-quoted heredocs sigils' },
  1094. { token: 'punctuation.definition.string.begin.elixir',
  1095. regex: '~[a-z]\\{',
  1096. push:
  1097. [ { token: 'punctuation.definition.string.end.elixir',
  1098. regex: '\\}[a-z]*',
  1099. next: 'pop' },
  1100. { include: '#interpolated_elixir' },
  1101. { include: '#escaped_char' },
  1102. { defaultToken: 'string.interpolated.elixir' } ],
  1103. comment: 'sigil (allow for interpolation)' },
  1104. { token: 'punctuation.definition.string.begin.elixir',
  1105. regex: '~[a-z]\\[',
  1106. push:
  1107. [ { token: 'punctuation.definition.string.end.elixir',
  1108. regex: '\\][a-z]*',
  1109. next: 'pop' },
  1110. { include: '#interpolated_elixir' },
  1111. { include: '#escaped_char' },
  1112. { defaultToken: 'string.interpolated.elixir' } ],
  1113. comment: 'sigil (allow for interpolation)' },
  1114. { token: 'punctuation.definition.string.begin.elixir',
  1115. regex: '~[a-z]\\<',
  1116. push:
  1117. [ { token: 'punctuation.definition.string.end.elixir',
  1118. regex: '\\>[a-z]*',
  1119. next: 'pop' },
  1120. { include: '#interpolated_elixir' },
  1121. { include: '#escaped_char' },
  1122. { defaultToken: 'string.interpolated.elixir' } ],
  1123. comment: 'sigil (allow for interpolation)' },
  1124. { token: 'punctuation.definition.string.begin.elixir',
  1125. regex: '~[a-z]\\(',
  1126. push:
  1127. [ { token: 'punctuation.definition.string.end.elixir',
  1128. regex: '\\)[a-z]*',
  1129. next: 'pop' },
  1130. { include: '#interpolated_elixir' },
  1131. { include: '#escaped_char' },
  1132. { defaultToken: 'string.interpolated.elixir' } ],
  1133. comment: 'sigil (allow for interpolation)' },
  1134. { token: 'punctuation.definition.string.begin.elixir',
  1135. regex: '~[a-z][^\\w]',
  1136. push:
  1137. [ { token: 'punctuation.definition.string.end.elixir',
  1138. regex: '[^\\w][a-z]*',
  1139. next: 'pop' },
  1140. { include: '#interpolated_elixir' },
  1141. { include: '#escaped_char' },
  1142. { include: '#escaped_char' },
  1143. { defaultToken: 'string.interpolated.elixir' } ],
  1144. comment: 'sigil (allow for interpolation)' },
  1145. { token: 'punctuation.definition.string.begin.elixir',
  1146. regex: '~[A-Z](?:""")',
  1147. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  1148. originalRegex: '~[A-Z](?>""")',
  1149. push:
  1150. [ { token: 'punctuation.definition.string.end.elixir',
  1151. regex: '^\\s*"""',
  1152. next: 'pop' },
  1153. { defaultToken: 'string.quoted.other.literal.upper.elixir' } ],
  1154. comment: 'Double-quoted heredocs sigils' },
  1155. { token: 'punctuation.definition.string.begin.elixir',
  1156. regex: '~[A-Z]\\{',
  1157. push:
  1158. [ { token: 'punctuation.definition.string.end.elixir',
  1159. regex: '\\}[a-z]*',
  1160. next: 'pop' },
  1161. { defaultToken: 'string.quoted.other.literal.upper.elixir' } ],
  1162. comment: 'sigil (without interpolation)' },
  1163. { token: 'punctuation.definition.string.begin.elixir',
  1164. regex: '~[A-Z]\\[',
  1165. push:
  1166. [ { token: 'punctuation.definition.string.end.elixir',
  1167. regex: '\\][a-z]*',
  1168. next: 'pop' },
  1169. { defaultToken: 'string.quoted.other.literal.upper.elixir' } ],
  1170. comment: 'sigil (without interpolation)' },
  1171. { token: 'punctuation.definition.string.begin.elixir',
  1172. regex: '~[A-Z]\\<',
  1173. push:
  1174. [ { token: 'punctuation.definition.string.end.elixir',
  1175. regex: '\\>[a-z]*',
  1176. next: 'pop' },
  1177. { defaultToken: 'string.quoted.other.literal.upper.elixir' } ],
  1178. comment: 'sigil (without interpolation)' },
  1179. { token: 'punctuation.definition.string.begin.elixir',
  1180. regex: '~[A-Z]\\(',
  1181. push:
  1182. [ { token: 'punctuation.definition.string.end.elixir',
  1183. regex: '\\)[a-z]*',
  1184. next: 'pop' },
  1185. { defaultToken: 'string.quoted.other.literal.upper.elixir' } ],
  1186. comment: 'sigil (without interpolation)' },
  1187. { token: 'punctuation.definition.string.begin.elixir',
  1188. regex: '~[A-Z][^\\w]',
  1189. push:
  1190. [ { token: 'punctuation.definition.string.end.elixir',
  1191. regex: '[^\\w][a-z]*',
  1192. next: 'pop' },
  1193. { defaultToken: 'string.quoted.other.literal.upper.elixir' } ],
  1194. comment: 'sigil (without interpolation)' },
  1195. { token: ['punctuation.definition.constant.elixir', 'constant.other.symbol.elixir'],
  1196. regex: '(:)([a-zA-Z_][\\w@]*(?:[?!]|=(?![>=]))?|\\<\\>|===?|!==?|<<>>|<<<|>>>|~~~|::|<\\-|\\|>|=>|~|~=|=|/|\\\\\\\\|\\*\\*?|\\.\\.?\\.?|>=?|<=?|&&?&?|\\+\\+?|\\-\\-?|\\|\\|?\\|?|\\!|@|\\%?\\{\\}|%|\\[\\]|\\^(?:\\^\\^)?)',
  1197. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  1198. originalRegex: '(?<!:)(:)(?>[a-zA-Z_][\\w@]*(?>[?!]|=(?![>=]))?|\\<\\>|===?|!==?|<<>>|<<<|>>>|~~~|::|<\\-|\\|>|=>|~|~=|=|/|\\\\\\\\|\\*\\*?|\\.\\.?\\.?|>=?|<=?|&&?&?|\\+\\+?|\\-\\-?|\\|\\|?\\|?|\\!|@|\\%?\\{\\}|%|\\[\\]|\\^(\\^\\^)?)',
  1199. comment: 'symbols' },
  1200. { token: 'punctuation.definition.constant.elixir',
  1201. regex: '(?:[a-zA-Z_][\\w@]*(?:[?!])?):(?!:)',
  1202. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  1203. originalRegex: '(?>[a-zA-Z_][\\w@]*(?>[?!])?)(:)(?!:)',
  1204. comment: 'symbols' },
  1205. { token:
  1206. [ 'punctuation.definition.comment.elixir',
  1207. 'comment.line.number-sign.elixir' ],
  1208. regex: '(#)(.*)' },
  1209. { token: 'constant.numeric.elixir',
  1210. regex: '\\?(?:\\\\(?:x[\\da-fA-F]{1,2}(?![\\da-fA-F])\\b|[^xMC])|[^\\s\\\\])',
  1211. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  1212. originalRegex: '(?<!\\w)\\?(\\\\(x\\h{1,2}(?!\\h)\\b|[^xMC])|[^\\s\\\\])',
  1213. comment: '\n\t\t\tmatches questionmark-letters.\n\n\t\t\texamples (1st alternation = hex):\n\t\t\t?\\x1 ?\\x61\n\n\t\t\texamples (2rd alternation = escaped):\n\t\t\t?\\n ?\\b\n\n\t\t\texamples (3rd alternation = normal):\n\t\t\t?a ?A ?0 \n\t\t\t?* ?" ?( \n\t\t\t?. ?#\n\t\t\t\n\t\t\tthe negative lookbehind prevents against matching\n\t\t\tp(42.tainted?)\n\t\t\t' },
  1214. { token: 'keyword.operator.assignment.augmented.elixir',
  1215. regex: '\\+=|\\-=|\\|\\|=|~=|&&=' },
  1216. { token: 'keyword.operator.comparison.elixir',
  1217. regex: '===?|!==?|<=?|>=?' },
  1218. { token: 'keyword.operator.bitwise.elixir',
  1219. regex: '\\|{3}|&{3}|\\^{3}|<{3}|>{3}|~{3}' },
  1220. { token: 'keyword.operator.logical.elixir',
  1221. regex: '!+|\\bnot\\b|&&|\\band\\b|\\|\\||\\bor\\b|\\bxor\\b',
  1222. originalRegex: '(?<=[ \\t])!+|\\bnot\\b|&&|\\band\\b|\\|\\||\\bor\\b|\\bxor\\b' },
  1223. { token: 'keyword.operator.arithmetic.elixir',
  1224. regex: '\\*|\\+|\\-|/' },
  1225. { token: 'keyword.operator.other.elixir',
  1226. regex: '\\||\\+\\+|\\-\\-|\\*\\*|\\\\\\\\|\\<\\-|\\<\\>|\\<\\<|\\>\\>|\\:\\:|\\.\\.|\\|>|~|=>' },
  1227. { token: 'keyword.operator.assignment.elixir', regex: '=' },
  1228. { token: 'punctuation.separator.other.elixir', regex: ':' },
  1229. { token: 'punctuation.separator.statement.elixir',
  1230. regex: '\\;' },
  1231. { token: 'punctuation.separator.object.elixir', regex: ',' },
  1232. { token: 'punctuation.separator.method.elixir', regex: '\\.' },
  1233. { token: 'punctuation.section.scope.elixir', regex: '\\{|\\}' },
  1234. { token: 'punctuation.section.array.elixir', regex: '\\[|\\]' },
  1235. { token: 'punctuation.section.function.elixir',
  1236. regex: '\\(|\\)' } ],
  1237. '#escaped_char':
  1238. [ { token: 'constant.character.escape.elixir',
  1239. regex: '\\\\(?:x[\\da-fA-F]{1,2}|.)' } ],
  1240. '#interpolated_elixir':
  1241. [ { token:
  1242. [ 'source.elixir.embedded.source',
  1243. 'source.elixir.embedded.source.empty' ],
  1244. regex: '(#\\{)(\\})' },
  1245. { todo:
  1246. { token: 'punctuation.section.embedded.elixir',
  1247. regex: '#\\{',
  1248. push:
  1249. [ { token: 'punctuation.section.embedded.elixir',
  1250. regex: '\\}',
  1251. next: 'pop' },
  1252. { include: '#nest_curly_and_self' },
  1253. { include: '$self' },
  1254. { defaultToken: 'source.elixir.embedded.source' } ] } } ],
  1255. '#nest_curly_and_self':
  1256. [ { token: 'punctuation.section.scope.elixir',
  1257. regex: '\\{',
  1258. push:
  1259. [ { token: 'punctuation.section.scope.elixir',
  1260. regex: '\\}',
  1261. next: 'pop' },
  1262. { include: '#nest_curly_and_self' } ] },
  1263. { include: '$self' } ],
  1264. '#regex_sub':
  1265. [ { include: '#interpolated_elixir' },
  1266. { include: '#escaped_char' },
  1267. { token:
  1268. [ 'punctuation.definition.arbitrary-repitition.elixir',
  1269. 'string.regexp.arbitrary-repitition.elixir',
  1270. 'string.regexp.arbitrary-repitition.elixir',
  1271. 'punctuation.definition.arbitrary-repitition.elixir' ],
  1272. regex: '(\\{)(\\d+)((?:,\\d+)?)(\\})' },
  1273. { token: 'punctuation.definition.character-class.elixir',
  1274. regex: '\\[(?:\\^?\\])?',
  1275. push:
  1276. [ { token: 'punctuation.definition.character-class.elixir',
  1277. regex: '\\]',
  1278. next: 'pop' },
  1279. { include: '#escaped_char' },
  1280. { defaultToken: 'string.regexp.character-class.elixir' } ] },
  1281. { token: 'punctuation.definition.group.elixir',
  1282. regex: '\\(',
  1283. push:
  1284. [ { token: 'punctuation.definition.group.elixir',
  1285. regex: '\\)',
  1286. next: 'pop' },
  1287. { include: '#regex_sub' },
  1288. { defaultToken: 'string.regexp.group.elixir' } ] },
  1289. { token:
  1290. [ 'punctuation.definition.comment.elixir',
  1291. 'comment.line.number-sign.elixir' ],
  1292. regex: '(?:^|\\s)(#)(\\s[[a-zA-Z0-9,. \\t?!-][^\\x00-\\x7F]]*$)',
  1293. originalRegex: '(?<=^|\\s)(#)\\s[[a-zA-Z0-9,. \\t?!-][^\\x{00}-\\x{7F}]]*$',
  1294. comment: 'We are restrictive in what we allow to go after the comment character to avoid false positives, since the availability of comments depend on regexp flags.' } ] };
  1295. this.normalizeRules();
  1296. };
  1297. ElixirHighlightRules.metaData = { comment: 'Textmate bundle for Elixir Programming Language.',
  1298. fileTypes: [ 'ex', 'exs' ],
  1299. firstLineMatch: '^#!/.*\\belixir',
  1300. foldingStartMarker: '(after|else|catch|rescue|\\-\\>|\\{|\\[|do)\\s*$',
  1301. foldingStopMarker: '^\\s*((\\}|\\]|after|else|catch|rescue)\\s*$|end\\b)',
  1302. keyEquivalent: '^~E',
  1303. name: 'Elixir',
  1304. scopeName: 'source.elixir' };
  1305. oop.inherits(ElixirHighlightRules, TextHighlightRules);
  1306. exports.ElixirHighlightRules = ElixirHighlightRules;
  1307. });
  1308. ace.define("ace/mode/html_elixir_highlight_rules",[], function(require, exports, module) {
  1309. "use strict";
  1310. var oop = require("../lib/oop");
  1311. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  1312. var ElixirHighlightRules = require("./elixir_highlight_rules").ElixirHighlightRules;
  1313. var HtmlElixirHighlightRules = function() {
  1314. HtmlHighlightRules.call(this);
  1315. var startRules = [
  1316. {
  1317. regex: "<%%|%%>",
  1318. token: "constant.language.escape"
  1319. }, {
  1320. token : "comment.start.eex",
  1321. regex : "<%#",
  1322. push : [{
  1323. token : "comment.end.eex",
  1324. regex: "%>",
  1325. next: "pop",
  1326. defaultToken:"comment"
  1327. }]
  1328. }, {
  1329. token : "support.elixir_tag",
  1330. regex : "<%+(?!>)[-=]?",
  1331. push : "elixir-start"
  1332. }
  1333. ];
  1334. var endRules = [
  1335. {
  1336. token : "support.elixir_tag",
  1337. regex : "%>",
  1338. next : "pop"
  1339. }, {
  1340. token: "comment",
  1341. regex: "#(?:[^%]|%[^>])*"
  1342. }
  1343. ];
  1344. for (var key in this.$rules)
  1345. this.$rules[key].unshift.apply(this.$rules[key], startRules);
  1346. this.embedRules(ElixirHighlightRules, "elixir-", endRules, ["start"]);
  1347. this.normalizeRules();
  1348. };
  1349. oop.inherits(HtmlElixirHighlightRules, HtmlHighlightRules);
  1350. exports.HtmlElixirHighlightRules = HtmlElixirHighlightRules;
  1351. });
  1352. ace.define("ace/mode/matching_brace_outdent",[], function(require, exports, module) {
  1353. "use strict";
  1354. var Range = require("../range").Range;
  1355. var MatchingBraceOutdent = function() {};
  1356. (function() {
  1357. this.checkOutdent = function(line, input) {
  1358. if (! /^\s+$/.test(line))
  1359. return false;
  1360. return /^\s*\}/.test(input);
  1361. };
  1362. this.autoOutdent = function(doc, row) {
  1363. var line = doc.getLine(row);
  1364. var match = line.match(/^(\s*\})/);
  1365. if (!match) return 0;
  1366. var column = match[1].length;
  1367. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  1368. if (!openBracePos || openBracePos.row == row) return 0;
  1369. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  1370. doc.replace(new Range(row, 0, row, column-1), indent);
  1371. };
  1372. this.$getIndent = function(line) {
  1373. return line.match(/^\s*/)[0];
  1374. };
  1375. }).call(MatchingBraceOutdent.prototype);
  1376. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  1377. });
  1378. ace.define("ace/mode/folding/cstyle",[], function(require, exports, module) {
  1379. "use strict";
  1380. var oop = require("../../lib/oop");
  1381. var Range = require("../../range").Range;
  1382. var BaseFoldMode = require("./fold_mode").FoldMode;
  1383. var FoldMode = exports.FoldMode = function(commentRegex) {
  1384. if (commentRegex) {
  1385. this.foldingStartMarker = new RegExp(
  1386. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  1387. );
  1388. this.foldingStopMarker = new RegExp(
  1389. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  1390. );
  1391. }
  1392. };
  1393. oop.inherits(FoldMode, BaseFoldMode);
  1394. (function() {
  1395. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  1396. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  1397. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  1398. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  1399. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  1400. this._getFoldWidgetBase = this.getFoldWidget;
  1401. this.getFoldWidget = function(session, foldStyle, row) {
  1402. var line = session.getLine(row);
  1403. if (this.singleLineBlockCommentRe.test(line)) {
  1404. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  1405. return "";
  1406. }
  1407. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  1408. if (!fw && this.startRegionRe.test(line))
  1409. return "start"; // lineCommentRegionStart
  1410. return fw;
  1411. };
  1412. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  1413. var line = session.getLine(row);
  1414. if (this.startRegionRe.test(line))
  1415. return this.getCommentRegionBlock(session, line, row);
  1416. var match = line.match(this.foldingStartMarker);
  1417. if (match) {
  1418. var i = match.index;
  1419. if (match[1])
  1420. return this.openingBracketBlock(session, match[1], row, i);
  1421. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  1422. if (range && !range.isMultiLine()) {
  1423. if (forceMultiline) {
  1424. range = this.getSectionRange(session, row);
  1425. } else if (foldStyle != "all")
  1426. range = null;
  1427. }
  1428. return range;
  1429. }
  1430. if (foldStyle === "markbegin")
  1431. return;
  1432. var match = line.match(this.foldingStopMarker);
  1433. if (match) {
  1434. var i = match.index + match[0].length;
  1435. if (match[1])
  1436. return this.closingBracketBlock(session, match[1], row, i);
  1437. return session.getCommentFoldRange(row, i, -1);
  1438. }
  1439. };
  1440. this.getSectionRange = function(session, row) {
  1441. var line = session.getLine(row);
  1442. var startIndent = line.search(/\S/);
  1443. var startRow = row;
  1444. var startColumn = line.length;
  1445. row = row + 1;
  1446. var endRow = row;
  1447. var maxRow = session.getLength();
  1448. while (++row < maxRow) {
  1449. line = session.getLine(row);
  1450. var indent = line.search(/\S/);
  1451. if (indent === -1)
  1452. continue;
  1453. if (startIndent > indent)
  1454. break;
  1455. var subRange = this.getFoldWidgetRange(session, "all", row);
  1456. if (subRange) {
  1457. if (subRange.start.row <= startRow) {
  1458. break;
  1459. } else if (subRange.isMultiLine()) {
  1460. row = subRange.end.row;
  1461. } else if (startIndent == indent) {
  1462. break;
  1463. }
  1464. }
  1465. endRow = row;
  1466. }
  1467. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  1468. };
  1469. this.getCommentRegionBlock = function(session, line, row) {
  1470. var startColumn = line.search(/\s*$/);
  1471. var maxRow = session.getLength();
  1472. var startRow = row;
  1473. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  1474. var depth = 1;
  1475. while (++row < maxRow) {
  1476. line = session.getLine(row);
  1477. var m = re.exec(line);
  1478. if (!m) continue;
  1479. if (m[1]) depth--;
  1480. else depth++;
  1481. if (!depth) break;
  1482. }
  1483. var endRow = row;
  1484. if (endRow > startRow) {
  1485. return new Range(startRow, startColumn, endRow, line.length);
  1486. }
  1487. };
  1488. }).call(FoldMode.prototype);
  1489. });
  1490. ace.define("ace/mode/javascript",[], function(require, exports, module) {
  1491. "use strict";
  1492. var oop = require("../lib/oop");
  1493. var TextMode = require("./text").Mode;
  1494. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1495. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1496. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1497. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  1498. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1499. var Mode = function() {
  1500. this.HighlightRules = JavaScriptHighlightRules;
  1501. this.$outdent = new MatchingBraceOutdent();
  1502. this.$behaviour = new CstyleBehaviour();
  1503. this.foldingRules = new CStyleFoldMode();
  1504. };
  1505. oop.inherits(Mode, TextMode);
  1506. (function() {
  1507. this.lineCommentStart = "//";
  1508. this.blockComment = {start: "/*", end: "*/"};
  1509. this.$quotes = {'"': '"', "'": "'", "`": "`"};
  1510. this.getNextLineIndent = function(state, line, tab) {
  1511. var indent = this.$getIndent(line);
  1512. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  1513. var tokens = tokenizedLine.tokens;
  1514. var endState = tokenizedLine.state;
  1515. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1516. return indent;
  1517. }
  1518. if (state == "start" || state == "no_regex") {
  1519. var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
  1520. if (match) {
  1521. indent += tab;
  1522. }
  1523. } else if (state == "doc-start") {
  1524. if (endState == "start" || endState == "no_regex") {
  1525. return "";
  1526. }
  1527. var match = line.match(/^\s*(\/?)\*/);
  1528. if (match) {
  1529. if (match[1]) {
  1530. indent += " ";
  1531. }
  1532. indent += "* ";
  1533. }
  1534. }
  1535. return indent;
  1536. };
  1537. this.checkOutdent = function(state, line, input) {
  1538. return this.$outdent.checkOutdent(line, input);
  1539. };
  1540. this.autoOutdent = function(state, doc, row) {
  1541. this.$outdent.autoOutdent(doc, row);
  1542. };
  1543. this.createWorker = function(session) {
  1544. var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
  1545. worker.attachToDocument(session.getDocument());
  1546. worker.on("annotate", function(results) {
  1547. session.setAnnotations(results.data);
  1548. });
  1549. worker.on("terminate", function() {
  1550. session.clearAnnotations();
  1551. });
  1552. return worker;
  1553. };
  1554. this.$id = "ace/mode/javascript";
  1555. }).call(Mode.prototype);
  1556. exports.Mode = Mode;
  1557. });
  1558. ace.define("ace/mode/css_completions",[], function(require, exports, module) {
  1559. "use strict";
  1560. var propertyMap = {
  1561. "background": {"#$0": 1},
  1562. "background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
  1563. "background-image": {"url('/$0')": 1},
  1564. "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
  1565. "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2},
  1566. "background-attachment": {"scroll": 1, "fixed": 1},
  1567. "background-size": {"cover": 1, "contain": 1},
  1568. "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
  1569. "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
  1570. "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
  1571. "border-color": {"#$0": 1},
  1572. "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2},
  1573. "border-collapse": {"collapse": 1, "separate": 1},
  1574. "bottom": {"px": 1, "em": 1, "%": 1},
  1575. "clear": {"left": 1, "right": 1, "both": 1, "none": 1},
  1576. "color": {"#$0": 1, "rgb(#$00,0,0)": 1},
  1577. "cursor": {"default": 1, "pointer": 1, "move": 1, "text": 1, "wait": 1, "help": 1, "progress": 1, "n-resize": 1, "ne-resize": 1, "e-resize": 1, "se-resize": 1, "s-resize": 1, "sw-resize": 1, "w-resize": 1, "nw-resize": 1},
  1578. "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
  1579. "empty-cells": {"show": 1, "hide": 1},
  1580. "float": {"left": 1, "right": 1, "none": 1},
  1581. "font-family": {"Arial":2,"Comic Sans MS":2,"Consolas":2,"Courier New":2,"Courier":2,"Georgia":2,"Monospace":2,"Sans-Serif":2, "Segoe UI":2,"Tahoma":2,"Times New Roman":2,"Trebuchet MS":2,"Verdana": 1},
  1582. "font-size": {"px": 1, "em": 1, "%": 1},
  1583. "font-weight": {"bold": 1, "normal": 1},
  1584. "font-style": {"italic": 1, "normal": 1},
  1585. "font-variant": {"normal": 1, "small-caps": 1},
  1586. "height": {"px": 1, "em": 1, "%": 1},
  1587. "left": {"px": 1, "em": 1, "%": 1},
  1588. "letter-spacing": {"normal": 1},
  1589. "line-height": {"normal": 1},
  1590. "list-style-type": {"none": 1, "disc": 1, "circle": 1, "square": 1, "decimal": 1, "decimal-leading-zero": 1, "lower-roman": 1, "upper-roman": 1, "lower-greek": 1, "lower-latin": 1, "upper-latin": 1, "georgian": 1, "lower-alpha": 1, "upper-alpha": 1},
  1591. "margin": {"px": 1, "em": 1, "%": 1},
  1592. "margin-right": {"px": 1, "em": 1, "%": 1},
  1593. "margin-left": {"px": 1, "em": 1, "%": 1},
  1594. "margin-top": {"px": 1, "em": 1, "%": 1},
  1595. "margin-bottom": {"px": 1, "em": 1, "%": 1},
  1596. "max-height": {"px": 1, "em": 1, "%": 1},
  1597. "max-width": {"px": 1, "em": 1, "%": 1},
  1598. "min-height": {"px": 1, "em": 1, "%": 1},
  1599. "min-width": {"px": 1, "em": 1, "%": 1},
  1600. "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1601. "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1602. "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1603. "padding": {"px": 1, "em": 1, "%": 1},
  1604. "padding-top": {"px": 1, "em": 1, "%": 1},
  1605. "padding-right": {"px": 1, "em": 1, "%": 1},
  1606. "padding-bottom": {"px": 1, "em": 1, "%": 1},
  1607. "padding-left": {"px": 1, "em": 1, "%": 1},
  1608. "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  1609. "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  1610. "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
  1611. "right": {"px": 1, "em": 1, "%": 1},
  1612. "table-layout": {"fixed": 1, "auto": 1},
  1613. "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
  1614. "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
  1615. "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
  1616. "top": {"px": 1, "em": 1, "%": 1},
  1617. "vertical-align": {"top": 1, "bottom": 1},
  1618. "visibility": {"hidden": 1, "visible": 1},
  1619. "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
  1620. "width": {"px": 1, "em": 1, "%": 1},
  1621. "word-spacing": {"normal": 1},
  1622. "filter": {"alpha(opacity=$0100)": 1},
  1623. "text-shadow": {"$02px 2px 2px #777": 1},
  1624. "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
  1625. "-moz-border-radius": 1,
  1626. "-moz-border-radius-topright": 1,
  1627. "-moz-border-radius-bottomright": 1,
  1628. "-moz-border-radius-topleft": 1,
  1629. "-moz-border-radius-bottomleft": 1,
  1630. "-webkit-border-radius": 1,
  1631. "-webkit-border-top-right-radius": 1,
  1632. "-webkit-border-top-left-radius": 1,
  1633. "-webkit-border-bottom-right-radius": 1,
  1634. "-webkit-border-bottom-left-radius": 1,
  1635. "-moz-box-shadow": 1,
  1636. "-webkit-box-shadow": 1,
  1637. "transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  1638. "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  1639. "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
  1640. };
  1641. var CssCompletions = function() {
  1642. };
  1643. (function() {
  1644. this.completionsDefined = false;
  1645. this.defineCompletions = function() {
  1646. if (document) {
  1647. var style = document.createElement('c').style;
  1648. for (var i in style) {
  1649. if (typeof style[i] !== 'string')
  1650. continue;
  1651. var name = i.replace(/[A-Z]/g, function(x) {
  1652. return '-' + x.toLowerCase();
  1653. });
  1654. if (!propertyMap.hasOwnProperty(name))
  1655. propertyMap[name] = 1;
  1656. }
  1657. }
  1658. this.completionsDefined = true;
  1659. };
  1660. this.getCompletions = function(state, session, pos, prefix) {
  1661. if (!this.completionsDefined) {
  1662. this.defineCompletions();
  1663. }
  1664. var token = session.getTokenAt(pos.row, pos.column);
  1665. if (!token)
  1666. return [];
  1667. if (state==='ruleset'){
  1668. var line = session.getLine(pos.row).substr(0, pos.column);
  1669. if (/:[^;]+$/.test(line)) {
  1670. /([\w\-]+):[^:]*$/.test(line);
  1671. return this.getPropertyValueCompletions(state, session, pos, prefix);
  1672. } else {
  1673. return this.getPropertyCompletions(state, session, pos, prefix);
  1674. }
  1675. }
  1676. return [];
  1677. };
  1678. this.getPropertyCompletions = function(state, session, pos, prefix) {
  1679. var properties = Object.keys(propertyMap);
  1680. return properties.map(function(property){
  1681. return {
  1682. caption: property,
  1683. snippet: property + ': $0;',
  1684. meta: "property",
  1685. score: Number.MAX_VALUE
  1686. };
  1687. });
  1688. };
  1689. this.getPropertyValueCompletions = function(state, session, pos, prefix) {
  1690. var line = session.getLine(pos.row).substr(0, pos.column);
  1691. var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
  1692. if (!property)
  1693. return [];
  1694. var values = [];
  1695. if (property in propertyMap && typeof propertyMap[property] === "object") {
  1696. values = Object.keys(propertyMap[property]);
  1697. }
  1698. return values.map(function(value){
  1699. return {
  1700. caption: value,
  1701. snippet: value,
  1702. meta: "property value",
  1703. score: Number.MAX_VALUE
  1704. };
  1705. });
  1706. };
  1707. }).call(CssCompletions.prototype);
  1708. exports.CssCompletions = CssCompletions;
  1709. });
  1710. ace.define("ace/mode/behaviour/css",[], function(require, exports, module) {
  1711. "use strict";
  1712. var oop = require("../../lib/oop");
  1713. var Behaviour = require("../behaviour").Behaviour;
  1714. var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
  1715. var TokenIterator = require("../../token_iterator").TokenIterator;
  1716. var CssBehaviour = function () {
  1717. this.inherit(CstyleBehaviour);
  1718. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1719. if (text === ':' && editor.selection.isEmpty()) {
  1720. var cursor = editor.getCursorPosition();
  1721. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1722. var token = iterator.getCurrentToken();
  1723. if (token && token.value.match(/\s+/)) {
  1724. token = iterator.stepBackward();
  1725. }
  1726. if (token && token.type === 'support.type') {
  1727. var line = session.doc.getLine(cursor.row);
  1728. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1729. if (rightChar === ':') {
  1730. return {
  1731. text: '',
  1732. selection: [1, 1]
  1733. };
  1734. }
  1735. if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
  1736. return {
  1737. text: ':;',
  1738. selection: [1, 1]
  1739. };
  1740. }
  1741. }
  1742. }
  1743. });
  1744. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1745. var selected = session.doc.getTextRange(range);
  1746. if (!range.isMultiLine() && selected === ':') {
  1747. var cursor = editor.getCursorPosition();
  1748. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1749. var token = iterator.getCurrentToken();
  1750. if (token && token.value.match(/\s+/)) {
  1751. token = iterator.stepBackward();
  1752. }
  1753. if (token && token.type === 'support.type') {
  1754. var line = session.doc.getLine(range.start.row);
  1755. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1756. if (rightChar === ';') {
  1757. range.end.column ++;
  1758. return range;
  1759. }
  1760. }
  1761. }
  1762. });
  1763. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1764. if (text === ';' && editor.selection.isEmpty()) {
  1765. var cursor = editor.getCursorPosition();
  1766. var line = session.doc.getLine(cursor.row);
  1767. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1768. if (rightChar === ';') {
  1769. return {
  1770. text: '',
  1771. selection: [1, 1]
  1772. };
  1773. }
  1774. }
  1775. });
  1776. this.add("!important", "insertion", function (state, action, editor, session, text) {
  1777. if (text === '!' && editor.selection.isEmpty()) {
  1778. var cursor = editor.getCursorPosition();
  1779. var line = session.doc.getLine(cursor.row);
  1780. if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
  1781. return {
  1782. text: '!important',
  1783. selection: [10, 10]
  1784. };
  1785. }
  1786. }
  1787. });
  1788. };
  1789. oop.inherits(CssBehaviour, CstyleBehaviour);
  1790. exports.CssBehaviour = CssBehaviour;
  1791. });
  1792. ace.define("ace/mode/css",[], function(require, exports, module) {
  1793. "use strict";
  1794. var oop = require("../lib/oop");
  1795. var TextMode = require("./text").Mode;
  1796. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1797. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1798. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1799. var CssCompletions = require("./css_completions").CssCompletions;
  1800. var CssBehaviour = require("./behaviour/css").CssBehaviour;
  1801. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1802. var Mode = function() {
  1803. this.HighlightRules = CssHighlightRules;
  1804. this.$outdent = new MatchingBraceOutdent();
  1805. this.$behaviour = new CssBehaviour();
  1806. this.$completer = new CssCompletions();
  1807. this.foldingRules = new CStyleFoldMode();
  1808. };
  1809. oop.inherits(Mode, TextMode);
  1810. (function() {
  1811. this.foldingRules = "cStyle";
  1812. this.blockComment = {start: "/*", end: "*/"};
  1813. this.getNextLineIndent = function(state, line, tab) {
  1814. var indent = this.$getIndent(line);
  1815. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1816. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1817. return indent;
  1818. }
  1819. var match = line.match(/^.*\{\s*$/);
  1820. if (match) {
  1821. indent += tab;
  1822. }
  1823. return indent;
  1824. };
  1825. this.checkOutdent = function(state, line, input) {
  1826. return this.$outdent.checkOutdent(line, input);
  1827. };
  1828. this.autoOutdent = function(state, doc, row) {
  1829. this.$outdent.autoOutdent(doc, row);
  1830. };
  1831. this.getCompletions = function(state, session, pos, prefix) {
  1832. return this.$completer.getCompletions(state, session, pos, prefix);
  1833. };
  1834. this.createWorker = function(session) {
  1835. var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
  1836. worker.attachToDocument(session.getDocument());
  1837. worker.on("annotate", function(e) {
  1838. session.setAnnotations(e.data);
  1839. });
  1840. worker.on("terminate", function() {
  1841. session.clearAnnotations();
  1842. });
  1843. return worker;
  1844. };
  1845. this.$id = "ace/mode/css";
  1846. }).call(Mode.prototype);
  1847. exports.Mode = Mode;
  1848. });
  1849. ace.define("ace/mode/behaviour/xml",[], function(require, exports, module) {
  1850. "use strict";
  1851. var oop = require("../../lib/oop");
  1852. var Behaviour = require("../behaviour").Behaviour;
  1853. var TokenIterator = require("../../token_iterator").TokenIterator;
  1854. var lang = require("../../lib/lang");
  1855. function is(token, type) {
  1856. return token && token.type.lastIndexOf(type + ".xml") > -1;
  1857. }
  1858. var XmlBehaviour = function () {
  1859. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  1860. if (text == '"' || text == "'") {
  1861. var quote = text;
  1862. var selected = session.doc.getTextRange(editor.getSelectionRange());
  1863. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  1864. return {
  1865. text: quote + selected + quote,
  1866. selection: false
  1867. };
  1868. }
  1869. var cursor = editor.getCursorPosition();
  1870. var line = session.doc.getLine(cursor.row);
  1871. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1872. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1873. var token = iterator.getCurrentToken();
  1874. if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
  1875. return {
  1876. text: "",
  1877. selection: [1, 1]
  1878. };
  1879. }
  1880. if (!token)
  1881. token = iterator.stepBackward();
  1882. if (!token)
  1883. return;
  1884. while (is(token, "tag-whitespace") || is(token, "whitespace")) {
  1885. token = iterator.stepBackward();
  1886. }
  1887. var rightSpace = !rightChar || rightChar.match(/\s/);
  1888. if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
  1889. return {
  1890. text: quote + quote,
  1891. selection: [1, 1]
  1892. };
  1893. }
  1894. }
  1895. });
  1896. this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
  1897. var selected = session.doc.getTextRange(range);
  1898. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  1899. var line = session.doc.getLine(range.start.row);
  1900. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  1901. if (rightChar == selected) {
  1902. range.end.column++;
  1903. return range;
  1904. }
  1905. }
  1906. });
  1907. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  1908. if (text == '>') {
  1909. var position = editor.getSelectionRange().start;
  1910. var iterator = new TokenIterator(session, position.row, position.column);
  1911. var token = iterator.getCurrentToken() || iterator.stepBackward();
  1912. if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
  1913. return;
  1914. if (is(token, "reference.attribute-value"))
  1915. return;
  1916. if (is(token, "attribute-value")) {
  1917. var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length;
  1918. if (position.column < tokenEndColumn)
  1919. return;
  1920. if (position.column == tokenEndColumn) {
  1921. var nextToken = iterator.stepForward();
  1922. if (nextToken && is(nextToken, "attribute-value"))
  1923. return;
  1924. iterator.stepBackward();
  1925. }
  1926. }
  1927. if (/^\s*>/.test(session.getLine(position.row).slice(position.column)))
  1928. return;
  1929. while (!is(token, "tag-name")) {
  1930. token = iterator.stepBackward();
  1931. if (token.value == "<") {
  1932. token = iterator.stepForward();
  1933. break;
  1934. }
  1935. }
  1936. var tokenRow = iterator.getCurrentTokenRow();
  1937. var tokenColumn = iterator.getCurrentTokenColumn();
  1938. if (is(iterator.stepBackward(), "end-tag-open"))
  1939. return;
  1940. var element = token.value;
  1941. if (tokenRow == position.row)
  1942. element = element.substring(0, position.column - tokenColumn);
  1943. if (this.voidElements.hasOwnProperty(element.toLowerCase()))
  1944. return;
  1945. return {
  1946. text: ">" + "</" + element + ">",
  1947. selection: [1, 1]
  1948. };
  1949. }
  1950. });
  1951. this.add("autoindent", "insertion", function (state, action, editor, session, text) {
  1952. if (text == "\n") {
  1953. var cursor = editor.getCursorPosition();
  1954. var line = session.getLine(cursor.row);
  1955. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1956. var token = iterator.getCurrentToken();
  1957. if (token && token.type.indexOf("tag-close") !== -1) {
  1958. if (token.value == "/>")
  1959. return;
  1960. while (token && token.type.indexOf("tag-name") === -1) {
  1961. token = iterator.stepBackward();
  1962. }
  1963. if (!token) {
  1964. return;
  1965. }
  1966. var tag = token.value;
  1967. var row = iterator.getCurrentTokenRow();
  1968. token = iterator.stepBackward();
  1969. if (!token || token.type.indexOf("end-tag") !== -1) {
  1970. return;
  1971. }
  1972. if (this.voidElements && !this.voidElements[tag]) {
  1973. var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
  1974. var line = session.getLine(row);
  1975. var nextIndent = this.$getIndent(line);
  1976. var indent = nextIndent + session.getTabString();
  1977. if (nextToken && nextToken.value === "</") {
  1978. return {
  1979. text: "\n" + indent + "\n" + nextIndent,
  1980. selection: [1, indent.length, 1, indent.length]
  1981. };
  1982. } else {
  1983. return {
  1984. text: "\n" + indent
  1985. };
  1986. }
  1987. }
  1988. }
  1989. }
  1990. });
  1991. };
  1992. oop.inherits(XmlBehaviour, Behaviour);
  1993. exports.XmlBehaviour = XmlBehaviour;
  1994. });
  1995. ace.define("ace/mode/folding/mixed",[], function(require, exports, module) {
  1996. "use strict";
  1997. var oop = require("../../lib/oop");
  1998. var BaseFoldMode = require("./fold_mode").FoldMode;
  1999. var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
  2000. this.defaultMode = defaultMode;
  2001. this.subModes = subModes;
  2002. };
  2003. oop.inherits(FoldMode, BaseFoldMode);
  2004. (function() {
  2005. this.$getMode = function(state) {
  2006. if (typeof state != "string")
  2007. state = state[0];
  2008. for (var key in this.subModes) {
  2009. if (state.indexOf(key) === 0)
  2010. return this.subModes[key];
  2011. }
  2012. return null;
  2013. };
  2014. this.$tryMode = function(state, session, foldStyle, row) {
  2015. var mode = this.$getMode(state);
  2016. return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
  2017. };
  2018. this.getFoldWidget = function(session, foldStyle, row) {
  2019. return (
  2020. this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
  2021. this.$tryMode(session.getState(row), session, foldStyle, row) ||
  2022. this.defaultMode.getFoldWidget(session, foldStyle, row)
  2023. );
  2024. };
  2025. this.getFoldWidgetRange = function(session, foldStyle, row) {
  2026. var mode = this.$getMode(session.getState(row-1));
  2027. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  2028. mode = this.$getMode(session.getState(row));
  2029. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  2030. mode = this.defaultMode;
  2031. return mode.getFoldWidgetRange(session, foldStyle, row);
  2032. };
  2033. }).call(FoldMode.prototype);
  2034. });
  2035. ace.define("ace/mode/folding/xml",[], function(require, exports, module) {
  2036. "use strict";
  2037. var oop = require("../../lib/oop");
  2038. var lang = require("../../lib/lang");
  2039. var Range = require("../../range").Range;
  2040. var BaseFoldMode = require("./fold_mode").FoldMode;
  2041. var TokenIterator = require("../../token_iterator").TokenIterator;
  2042. var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
  2043. BaseFoldMode.call(this);
  2044. this.voidElements = voidElements || {};
  2045. this.optionalEndTags = oop.mixin({}, this.voidElements);
  2046. if (optionalEndTags)
  2047. oop.mixin(this.optionalEndTags, optionalEndTags);
  2048. };
  2049. oop.inherits(FoldMode, BaseFoldMode);
  2050. var Tag = function() {
  2051. this.tagName = "";
  2052. this.closing = false;
  2053. this.selfClosing = false;
  2054. this.start = {row: 0, column: 0};
  2055. this.end = {row: 0, column: 0};
  2056. };
  2057. function is(token, type) {
  2058. return token.type.lastIndexOf(type + ".xml") > -1;
  2059. }
  2060. (function() {
  2061. this.getFoldWidget = function(session, foldStyle, row) {
  2062. var tag = this._getFirstTagInLine(session, row);
  2063. if (!tag)
  2064. return this.getCommentFoldWidget(session, row);
  2065. if (tag.closing || (!tag.tagName && tag.selfClosing))
  2066. return foldStyle == "markbeginend" ? "end" : "";
  2067. if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
  2068. return "";
  2069. if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
  2070. return "";
  2071. return "start";
  2072. };
  2073. this.getCommentFoldWidget = function(session, row) {
  2074. if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
  2075. return "start";
  2076. return "";
  2077. };
  2078. this._getFirstTagInLine = function(session, row) {
  2079. var tokens = session.getTokens(row);
  2080. var tag = new Tag();
  2081. for (var i = 0; i < tokens.length; i++) {
  2082. var token = tokens[i];
  2083. if (is(token, "tag-open")) {
  2084. tag.end.column = tag.start.column + token.value.length;
  2085. tag.closing = is(token, "end-tag-open");
  2086. token = tokens[++i];
  2087. if (!token)
  2088. return null;
  2089. tag.tagName = token.value;
  2090. tag.end.column += token.value.length;
  2091. for (i++; i < tokens.length; i++) {
  2092. token = tokens[i];
  2093. tag.end.column += token.value.length;
  2094. if (is(token, "tag-close")) {
  2095. tag.selfClosing = token.value == '/>';
  2096. break;
  2097. }
  2098. }
  2099. return tag;
  2100. } else if (is(token, "tag-close")) {
  2101. tag.selfClosing = token.value == '/>';
  2102. return tag;
  2103. }
  2104. tag.start.column += token.value.length;
  2105. }
  2106. return null;
  2107. };
  2108. this._findEndTagInLine = function(session, row, tagName, startColumn) {
  2109. var tokens = session.getTokens(row);
  2110. var column = 0;
  2111. for (var i = 0; i < tokens.length; i++) {
  2112. var token = tokens[i];
  2113. column += token.value.length;
  2114. if (column < startColumn)
  2115. continue;
  2116. if (is(token, "end-tag-open")) {
  2117. token = tokens[i + 1];
  2118. if (token && token.value == tagName)
  2119. return true;
  2120. }
  2121. }
  2122. return false;
  2123. };
  2124. this._readTagForward = function(iterator) {
  2125. var token = iterator.getCurrentToken();
  2126. if (!token)
  2127. return null;
  2128. var tag = new Tag();
  2129. do {
  2130. if (is(token, "tag-open")) {
  2131. tag.closing = is(token, "end-tag-open");
  2132. tag.start.row = iterator.getCurrentTokenRow();
  2133. tag.start.column = iterator.getCurrentTokenColumn();
  2134. } else if (is(token, "tag-name")) {
  2135. tag.tagName = token.value;
  2136. } else if (is(token, "tag-close")) {
  2137. tag.selfClosing = token.value == "/>";
  2138. tag.end.row = iterator.getCurrentTokenRow();
  2139. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  2140. iterator.stepForward();
  2141. return tag;
  2142. }
  2143. } while(token = iterator.stepForward());
  2144. return null;
  2145. };
  2146. this._readTagBackward = function(iterator) {
  2147. var token = iterator.getCurrentToken();
  2148. if (!token)
  2149. return null;
  2150. var tag = new Tag();
  2151. do {
  2152. if (is(token, "tag-open")) {
  2153. tag.closing = is(token, "end-tag-open");
  2154. tag.start.row = iterator.getCurrentTokenRow();
  2155. tag.start.column = iterator.getCurrentTokenColumn();
  2156. iterator.stepBackward();
  2157. return tag;
  2158. } else if (is(token, "tag-name")) {
  2159. tag.tagName = token.value;
  2160. } else if (is(token, "tag-close")) {
  2161. tag.selfClosing = token.value == "/>";
  2162. tag.end.row = iterator.getCurrentTokenRow();
  2163. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  2164. }
  2165. } while(token = iterator.stepBackward());
  2166. return null;
  2167. };
  2168. this._pop = function(stack, tag) {
  2169. while (stack.length) {
  2170. var top = stack[stack.length-1];
  2171. if (!tag || top.tagName == tag.tagName) {
  2172. return stack.pop();
  2173. }
  2174. else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
  2175. stack.pop();
  2176. continue;
  2177. } else {
  2178. return null;
  2179. }
  2180. }
  2181. };
  2182. this.getFoldWidgetRange = function(session, foldStyle, row) {
  2183. var firstTag = this._getFirstTagInLine(session, row);
  2184. if (!firstTag) {
  2185. return this.getCommentFoldWidget(session, row)
  2186. && session.getCommentFoldRange(row, session.getLine(row).length);
  2187. }
  2188. var isBackward = firstTag.closing || firstTag.selfClosing;
  2189. var stack = [];
  2190. var tag;
  2191. if (!isBackward) {
  2192. var iterator = new TokenIterator(session, row, firstTag.start.column);
  2193. var start = {
  2194. row: row,
  2195. column: firstTag.start.column + firstTag.tagName.length + 2
  2196. };
  2197. if (firstTag.start.row == firstTag.end.row)
  2198. start.column = firstTag.end.column;
  2199. while (tag = this._readTagForward(iterator)) {
  2200. if (tag.selfClosing) {
  2201. if (!stack.length) {
  2202. tag.start.column += tag.tagName.length + 2;
  2203. tag.end.column -= 2;
  2204. return Range.fromPoints(tag.start, tag.end);
  2205. } else
  2206. continue;
  2207. }
  2208. if (tag.closing) {
  2209. this._pop(stack, tag);
  2210. if (stack.length == 0)
  2211. return Range.fromPoints(start, tag.start);
  2212. }
  2213. else {
  2214. stack.push(tag);
  2215. }
  2216. }
  2217. }
  2218. else {
  2219. var iterator = new TokenIterator(session, row, firstTag.end.column);
  2220. var end = {
  2221. row: row,
  2222. column: firstTag.start.column
  2223. };
  2224. while (tag = this._readTagBackward(iterator)) {
  2225. if (tag.selfClosing) {
  2226. if (!stack.length) {
  2227. tag.start.column += tag.tagName.length + 2;
  2228. tag.end.column -= 2;
  2229. return Range.fromPoints(tag.start, tag.end);
  2230. } else
  2231. continue;
  2232. }
  2233. if (!tag.closing) {
  2234. this._pop(stack, tag);
  2235. if (stack.length == 0) {
  2236. tag.start.column += tag.tagName.length + 2;
  2237. if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
  2238. tag.start.column = tag.end.column;
  2239. return Range.fromPoints(tag.start, end);
  2240. }
  2241. }
  2242. else {
  2243. stack.push(tag);
  2244. }
  2245. }
  2246. }
  2247. };
  2248. }).call(FoldMode.prototype);
  2249. });
  2250. ace.define("ace/mode/folding/html",[], function(require, exports, module) {
  2251. "use strict";
  2252. var oop = require("../../lib/oop");
  2253. var MixedFoldMode = require("./mixed").FoldMode;
  2254. var XmlFoldMode = require("./xml").FoldMode;
  2255. var CStyleFoldMode = require("./cstyle").FoldMode;
  2256. var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
  2257. MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
  2258. "js-": new CStyleFoldMode(),
  2259. "css-": new CStyleFoldMode()
  2260. });
  2261. };
  2262. oop.inherits(FoldMode, MixedFoldMode);
  2263. });
  2264. ace.define("ace/mode/html_completions",[], function(require, exports, module) {
  2265. "use strict";
  2266. var TokenIterator = require("../token_iterator").TokenIterator;
  2267. var commonAttributes = [
  2268. "accesskey",
  2269. "class",
  2270. "contenteditable",
  2271. "contextmenu",
  2272. "dir",
  2273. "draggable",
  2274. "dropzone",
  2275. "hidden",
  2276. "id",
  2277. "inert",
  2278. "itemid",
  2279. "itemprop",
  2280. "itemref",
  2281. "itemscope",
  2282. "itemtype",
  2283. "lang",
  2284. "spellcheck",
  2285. "style",
  2286. "tabindex",
  2287. "title",
  2288. "translate"
  2289. ];
  2290. var eventAttributes = [
  2291. "onabort",
  2292. "onblur",
  2293. "oncancel",
  2294. "oncanplay",
  2295. "oncanplaythrough",
  2296. "onchange",
  2297. "onclick",
  2298. "onclose",
  2299. "oncontextmenu",
  2300. "oncuechange",
  2301. "ondblclick",
  2302. "ondrag",
  2303. "ondragend",
  2304. "ondragenter",
  2305. "ondragleave",
  2306. "ondragover",
  2307. "ondragstart",
  2308. "ondrop",
  2309. "ondurationchange",
  2310. "onemptied",
  2311. "onended",
  2312. "onerror",
  2313. "onfocus",
  2314. "oninput",
  2315. "oninvalid",
  2316. "onkeydown",
  2317. "onkeypress",
  2318. "onkeyup",
  2319. "onload",
  2320. "onloadeddata",
  2321. "onloadedmetadata",
  2322. "onloadstart",
  2323. "onmousedown",
  2324. "onmousemove",
  2325. "onmouseout",
  2326. "onmouseover",
  2327. "onmouseup",
  2328. "onmousewheel",
  2329. "onpause",
  2330. "onplay",
  2331. "onplaying",
  2332. "onprogress",
  2333. "onratechange",
  2334. "onreset",
  2335. "onscroll",
  2336. "onseeked",
  2337. "onseeking",
  2338. "onselect",
  2339. "onshow",
  2340. "onstalled",
  2341. "onsubmit",
  2342. "onsuspend",
  2343. "ontimeupdate",
  2344. "onvolumechange",
  2345. "onwaiting"
  2346. ];
  2347. var globalAttributes = commonAttributes.concat(eventAttributes);
  2348. var attributeMap = {
  2349. "a": {"href": 1, "target": {"_blank": 1, "top": 1}, "ping": 1, "rel": {"nofollow": 1, "alternate": 1, "author": 1, "bookmark": 1, "help": 1, "license": 1, "next": 1, "noreferrer": 1, "prefetch": 1, "prev": 1, "search": 1, "tag": 1}, "media": 1, "hreflang": 1, "type": 1},
  2350. "abbr": {},
  2351. "address": {},
  2352. "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1},
  2353. "article": {"pubdate": 1},
  2354. "aside": {},
  2355. "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }},
  2356. "b": {},
  2357. "base": {"href": 1, "target": 1},
  2358. "bdi": {},
  2359. "bdo": {},
  2360. "blockquote": {"cite": 1},
  2361. "body": {"onafterprint": 1, "onbeforeprint": 1, "onbeforeunload": 1, "onhashchange": 1, "onmessage": 1, "onoffline": 1, "onpopstate": 1, "onredo": 1, "onresize": 1, "onstorage": 1, "onundo": 1, "onunload": 1},
  2362. "br": {},
  2363. "button": {"autofocus": 1, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": 1, "formmethod": 1, "formnovalidate": 1, "formtarget": 1, "name": 1, "value": 1, "type": {"button": 1, "submit": 1}},
  2364. "canvas": {"width": 1, "height": 1},
  2365. "caption": {},
  2366. "cite": {},
  2367. "code": {},
  2368. "col": {"span": 1},
  2369. "colgroup": {"span": 1},
  2370. "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1},
  2371. "data": {},
  2372. "datalist": {},
  2373. "dd": {},
  2374. "del": {"cite": 1, "datetime": 1},
  2375. "details": {"open": 1},
  2376. "dfn": {},
  2377. "dialog": {"open": 1},
  2378. "div": {},
  2379. "dl": {},
  2380. "dt": {},
  2381. "em": {},
  2382. "embed": {"src": 1, "height": 1, "width": 1, "type": 1},
  2383. "fieldset": {"disabled": 1, "form": 1, "name": 1},
  2384. "figcaption": {},
  2385. "figure": {},
  2386. "footer": {},
  2387. "form": {"accept-charset": 1, "action": 1, "autocomplete": 1, "enctype": {"multipart/form-data": 1, "application/x-www-form-urlencoded": 1}, "method": {"get": 1, "post": 1}, "name": 1, "novalidate": 1, "target": {"_blank": 1, "top": 1}},
  2388. "h1": {},
  2389. "h2": {},
  2390. "h3": {},
  2391. "h4": {},
  2392. "h5": {},
  2393. "h6": {},
  2394. "head": {},
  2395. "header": {},
  2396. "hr": {},
  2397. "html": {"manifest": 1},
  2398. "i": {},
  2399. "iframe": {"name": 1, "src": 1, "height": 1, "width": 1, "sandbox": {"allow-same-origin": 1, "allow-top-navigation": 1, "allow-forms": 1, "allow-scripts": 1}, "seamless": {"seamless": 1}},
  2400. "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1},
  2401. "input": {
  2402. "type": {"text": 1, "password": 1, "hidden": 1, "checkbox": 1, "submit": 1, "radio": 1, "file": 1, "button": 1, "reset": 1, "image": 31, "color": 1, "date": 1, "datetime": 1, "datetime-local": 1, "email": 1, "month": 1, "number": 1, "range": 1, "search": 1, "tel": 1, "time": 1, "url": 1, "week": 1},
  2403. "accept": 1, "alt": 1, "autocomplete": {"on": 1, "off": 1}, "autofocus": {"autofocus": 1}, "checked": {"checked": 1}, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": {"application/x-www-form-urlencoded": 1, "multipart/form-data": 1, "text/plain": 1}, "formmethod": {"get": 1, "post": 1}, "formnovalidate": {"formnovalidate": 1}, "formtarget": {"_blank": 1, "_self": 1, "_parent": 1, "_top": 1}, "height": 1, "list": 1, "max": 1, "maxlength": 1, "min": 1, "multiple": {"multiple": 1}, "name": 1, "pattern": 1, "placeholder": 1, "readonly": {"readonly": 1}, "required": {"required": 1}, "size": 1, "src": 1, "step": 1, "width": 1, "files": 1, "value": 1},
  2404. "ins": {"cite": 1, "datetime": 1},
  2405. "kbd": {},
  2406. "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1},
  2407. "label": {"form": 1, "for": 1},
  2408. "legend": {},
  2409. "li": {"value": 1},
  2410. "link": {"href": 1, "hreflang": 1, "rel": {"stylesheet": 1, "icon": 1}, "media": {"all": 1, "screen": 1, "print": 1}, "type": {"text/css": 1, "image/png": 1, "image/jpeg": 1, "image/gif": 1}, "sizes": 1},
  2411. "main": {},
  2412. "map": {"name": 1},
  2413. "mark": {},
  2414. "math": {},
  2415. "menu": {"type": 1, "label": 1},
  2416. "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1},
  2417. "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1},
  2418. "nav": {},
  2419. "noscript": {"href": 1},
  2420. "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1},
  2421. "ol": {"start": 1, "reversed": 1},
  2422. "optgroup": {"disabled": 1, "label": 1},
  2423. "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1},
  2424. "output": {"for": 1, "form": 1, "name": 1},
  2425. "p": {},
  2426. "param": {"name": 1, "value": 1},
  2427. "pre": {},
  2428. "progress": {"value": 1, "max": 1},
  2429. "q": {"cite": 1},
  2430. "rp": {},
  2431. "rt": {},
  2432. "ruby": {},
  2433. "s": {},
  2434. "samp": {},
  2435. "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1},
  2436. "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}},
  2437. "small": {},
  2438. "source": {"src": 1, "type": 1, "media": 1},
  2439. "span": {},
  2440. "strong": {},
  2441. "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1},
  2442. "sub": {},
  2443. "sup": {},
  2444. "svg": {},
  2445. "table": {"summary": 1},
  2446. "tbody": {},
  2447. "td": {"headers": 1, "rowspan": 1, "colspan": 1},
  2448. "textarea": {"autofocus": {"autofocus": 1}, "disabled": {"disabled": 1}, "form": 1, "maxlength": 1, "name": 1, "placeholder": 1, "readonly": {"readonly": 1}, "required": {"required": 1}, "rows": 1, "cols": 1, "wrap": {"on": 1, "off": 1, "hard": 1, "soft": 1}},
  2449. "tfoot": {},
  2450. "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1},
  2451. "thead": {},
  2452. "time": {"datetime": 1},
  2453. "title": {},
  2454. "tr": {},
  2455. "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1},
  2456. "section": {},
  2457. "summary": {},
  2458. "u": {},
  2459. "ul": {},
  2460. "var": {},
  2461. "video": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "width": 1, "height": 1, "poster": 1, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1}},
  2462. "wbr": {}
  2463. };
  2464. var elements = Object.keys(attributeMap);
  2465. function is(token, type) {
  2466. return token.type.lastIndexOf(type + ".xml") > -1;
  2467. }
  2468. function findTagName(session, pos) {
  2469. var iterator = new TokenIterator(session, pos.row, pos.column);
  2470. var token = iterator.getCurrentToken();
  2471. while (token && !is(token, "tag-name")){
  2472. token = iterator.stepBackward();
  2473. }
  2474. if (token)
  2475. return token.value;
  2476. }
  2477. function findAttributeName(session, pos) {
  2478. var iterator = new TokenIterator(session, pos.row, pos.column);
  2479. var token = iterator.getCurrentToken();
  2480. while (token && !is(token, "attribute-name")){
  2481. token = iterator.stepBackward();
  2482. }
  2483. if (token)
  2484. return token.value;
  2485. }
  2486. var HtmlCompletions = function() {
  2487. };
  2488. (function() {
  2489. this.getCompletions = function(state, session, pos, prefix) {
  2490. var token = session.getTokenAt(pos.row, pos.column);
  2491. if (!token)
  2492. return [];
  2493. if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
  2494. return this.getTagCompletions(state, session, pos, prefix);
  2495. if (is(token, "tag-whitespace") || is(token, "attribute-name"))
  2496. return this.getAttributeCompletions(state, session, pos, prefix);
  2497. if (is(token, "attribute-value"))
  2498. return this.getAttributeValueCompletions(state, session, pos, prefix);
  2499. var line = session.getLine(pos.row).substr(0, pos.column);
  2500. if (/&[a-z]*$/i.test(line))
  2501. return this.getHTMLEntityCompletions(state, session, pos, prefix);
  2502. return [];
  2503. };
  2504. this.getTagCompletions = function(state, session, pos, prefix) {
  2505. return elements.map(function(element){
  2506. return {
  2507. value: element,
  2508. meta: "tag",
  2509. score: Number.MAX_VALUE
  2510. };
  2511. });
  2512. };
  2513. this.getAttributeCompletions = function(state, session, pos, prefix) {
  2514. var tagName = findTagName(session, pos);
  2515. if (!tagName)
  2516. return [];
  2517. var attributes = globalAttributes;
  2518. if (tagName in attributeMap) {
  2519. attributes = attributes.concat(Object.keys(attributeMap[tagName]));
  2520. }
  2521. return attributes.map(function(attribute){
  2522. return {
  2523. caption: attribute,
  2524. snippet: attribute + '="$0"',
  2525. meta: "attribute",
  2526. score: Number.MAX_VALUE
  2527. };
  2528. });
  2529. };
  2530. this.getAttributeValueCompletions = function(state, session, pos, prefix) {
  2531. var tagName = findTagName(session, pos);
  2532. var attributeName = findAttributeName(session, pos);
  2533. if (!tagName)
  2534. return [];
  2535. var values = [];
  2536. if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
  2537. values = Object.keys(attributeMap[tagName][attributeName]);
  2538. }
  2539. return values.map(function(value){
  2540. return {
  2541. caption: value,
  2542. snippet: value,
  2543. meta: "attribute value",
  2544. score: Number.MAX_VALUE
  2545. };
  2546. });
  2547. };
  2548. this.getHTMLEntityCompletions = function(state, session, pos, prefix) {
  2549. var values = ['Aacute;', 'aacute;', 'Acirc;', 'acirc;', 'acute;', 'AElig;', 'aelig;', 'Agrave;', 'agrave;', 'alefsym;', 'Alpha;', 'alpha;', 'amp;', 'and;', 'ang;', 'Aring;', 'aring;', 'asymp;', 'Atilde;', 'atilde;', 'Auml;', 'auml;', 'bdquo;', 'Beta;', 'beta;', 'brvbar;', 'bull;', 'cap;', 'Ccedil;', 'ccedil;', 'cedil;', 'cent;', 'Chi;', 'chi;', 'circ;', 'clubs;', 'cong;', 'copy;', 'crarr;', 'cup;', 'curren;', 'Dagger;', 'dagger;', 'dArr;', 'darr;', 'deg;', 'Delta;', 'delta;', 'diams;', 'divide;', 'Eacute;', 'eacute;', 'Ecirc;', 'ecirc;', 'Egrave;', 'egrave;', 'empty;', 'emsp;', 'ensp;', 'Epsilon;', 'epsilon;', 'equiv;', 'Eta;', 'eta;', 'ETH;', 'eth;', 'Euml;', 'euml;', 'euro;', 'exist;', 'fnof;', 'forall;', 'frac12;', 'frac14;', 'frac34;', 'frasl;', 'Gamma;', 'gamma;', 'ge;', 'gt;', 'hArr;', 'harr;', 'hearts;', 'hellip;', 'Iacute;', 'iacute;', 'Icirc;', 'icirc;', 'iexcl;', 'Igrave;', 'igrave;', 'image;', 'infin;', 'int;', 'Iota;', 'iota;', 'iquest;', 'isin;', 'Iuml;', 'iuml;', 'Kappa;', 'kappa;', 'Lambda;', 'lambda;', 'lang;', 'laquo;', 'lArr;', 'larr;', 'lceil;', 'ldquo;', 'le;', 'lfloor;', 'lowast;', 'loz;', 'lrm;', 'lsaquo;', 'lsquo;', 'lt;', 'macr;', 'mdash;', 'micro;', 'middot;', 'minus;', 'Mu;', 'mu;', 'nabla;', 'nbsp;', 'ndash;', 'ne;', 'ni;', 'not;', 'notin;', 'nsub;', 'Ntilde;', 'ntilde;', 'Nu;', 'nu;', 'Oacute;', 'oacute;', 'Ocirc;', 'ocirc;', 'OElig;', 'oelig;', 'Ograve;', 'ograve;', 'oline;', 'Omega;', 'omega;', 'Omicron;', 'omicron;', 'oplus;', 'or;', 'ordf;', 'ordm;', 'Oslash;', 'oslash;', 'Otilde;', 'otilde;', 'otimes;', 'Ouml;', 'ouml;', 'para;', 'part;', 'permil;', 'perp;', 'Phi;', 'phi;', 'Pi;', 'pi;', 'piv;', 'plusmn;', 'pound;', 'Prime;', 'prime;', 'prod;', 'prop;', 'Psi;', 'psi;', 'quot;', 'radic;', 'rang;', 'raquo;', 'rArr;', 'rarr;', 'rceil;', 'rdquo;', 'real;', 'reg;', 'rfloor;', 'Rho;', 'rho;', 'rlm;', 'rsaquo;', 'rsquo;', 'sbquo;', 'Scaron;', 'scaron;', 'sdot;', 'sect;', 'shy;', 'Sigma;', 'sigma;', 'sigmaf;', 'sim;', 'spades;', 'sub;', 'sube;', 'sum;', 'sup;', 'sup1;', 'sup2;', 'sup3;', 'supe;', 'szlig;', 'Tau;', 'tau;', 'there4;', 'Theta;', 'theta;', 'thetasym;', 'thinsp;', 'THORN;', 'thorn;', 'tilde;', 'times;', 'trade;', 'Uacute;', 'uacute;', 'uArr;', 'uarr;', 'Ucirc;', 'ucirc;', 'Ugrave;', 'ugrave;', 'uml;', 'upsih;', 'Upsilon;', 'upsilon;', 'Uuml;', 'uuml;', 'weierp;', 'Xi;', 'xi;', 'Yacute;', 'yacute;', 'yen;', 'Yuml;', 'yuml;', 'Zeta;', 'zeta;', 'zwj;', 'zwnj;'];
  2550. return values.map(function(value){
  2551. return {
  2552. caption: value,
  2553. snippet: value,
  2554. meta: "html entity",
  2555. score: Number.MAX_VALUE
  2556. };
  2557. });
  2558. };
  2559. }).call(HtmlCompletions.prototype);
  2560. exports.HtmlCompletions = HtmlCompletions;
  2561. });
  2562. ace.define("ace/mode/html",[], function(require, exports, module) {
  2563. "use strict";
  2564. var oop = require("../lib/oop");
  2565. var lang = require("../lib/lang");
  2566. var TextMode = require("./text").Mode;
  2567. var JavaScriptMode = require("./javascript").Mode;
  2568. var CssMode = require("./css").Mode;
  2569. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2570. var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
  2571. var HtmlFoldMode = require("./folding/html").FoldMode;
  2572. var HtmlCompletions = require("./html_completions").HtmlCompletions;
  2573. var WorkerClient = require("../worker/worker_client").WorkerClient;
  2574. var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
  2575. var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
  2576. var Mode = function(options) {
  2577. this.fragmentContext = options && options.fragmentContext;
  2578. this.HighlightRules = HtmlHighlightRules;
  2579. this.$behaviour = new XmlBehaviour();
  2580. this.$completer = new HtmlCompletions();
  2581. this.createModeDelegates({
  2582. "js-": JavaScriptMode,
  2583. "css-": CssMode
  2584. });
  2585. this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
  2586. };
  2587. oop.inherits(Mode, TextMode);
  2588. (function() {
  2589. this.blockComment = {start: "<!--", end: "-->"};
  2590. this.voidElements = lang.arrayToMap(voidElements);
  2591. this.getNextLineIndent = function(state, line, tab) {
  2592. return this.$getIndent(line);
  2593. };
  2594. this.checkOutdent = function(state, line, input) {
  2595. return false;
  2596. };
  2597. this.getCompletions = function(state, session, pos, prefix) {
  2598. return this.$completer.getCompletions(state, session, pos, prefix);
  2599. };
  2600. this.createWorker = function(session) {
  2601. if (this.constructor != Mode)
  2602. return;
  2603. var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
  2604. worker.attachToDocument(session.getDocument());
  2605. if (this.fragmentContext)
  2606. worker.call("setOptions", [{context: this.fragmentContext}]);
  2607. worker.on("error", function(e) {
  2608. session.setAnnotations(e.data);
  2609. });
  2610. worker.on("terminate", function() {
  2611. session.clearAnnotations();
  2612. });
  2613. return worker;
  2614. };
  2615. this.$id = "ace/mode/html";
  2616. }).call(Mode.prototype);
  2617. exports.Mode = Mode;
  2618. });
  2619. ace.define("ace/mode/folding/coffee",[], function(require, exports, module) {
  2620. "use strict";
  2621. var oop = require("../../lib/oop");
  2622. var BaseFoldMode = require("./fold_mode").FoldMode;
  2623. var Range = require("../../range").Range;
  2624. var FoldMode = exports.FoldMode = function() {};
  2625. oop.inherits(FoldMode, BaseFoldMode);
  2626. (function() {
  2627. this.getFoldWidgetRange = function(session, foldStyle, row) {
  2628. var range = this.indentationBlock(session, row);
  2629. if (range)
  2630. return range;
  2631. var re = /\S/;
  2632. var line = session.getLine(row);
  2633. var startLevel = line.search(re);
  2634. if (startLevel == -1 || line[startLevel] != "#")
  2635. return;
  2636. var startColumn = line.length;
  2637. var maxRow = session.getLength();
  2638. var startRow = row;
  2639. var endRow = row;
  2640. while (++row < maxRow) {
  2641. line = session.getLine(row);
  2642. var level = line.search(re);
  2643. if (level == -1)
  2644. continue;
  2645. if (line[level] != "#")
  2646. break;
  2647. endRow = row;
  2648. }
  2649. if (endRow > startRow) {
  2650. var endColumn = session.getLine(endRow).length;
  2651. return new Range(startRow, startColumn, endRow, endColumn);
  2652. }
  2653. };
  2654. this.getFoldWidget = function(session, foldStyle, row) {
  2655. var line = session.getLine(row);
  2656. var indent = line.search(/\S/);
  2657. var next = session.getLine(row + 1);
  2658. var prev = session.getLine(row - 1);
  2659. var prevIndent = prev.search(/\S/);
  2660. var nextIndent = next.search(/\S/);
  2661. if (indent == -1) {
  2662. session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
  2663. return "";
  2664. }
  2665. if (prevIndent == -1) {
  2666. if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
  2667. session.foldWidgets[row - 1] = "";
  2668. session.foldWidgets[row + 1] = "";
  2669. return "start";
  2670. }
  2671. } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
  2672. if (session.getLine(row - 2).search(/\S/) == -1) {
  2673. session.foldWidgets[row - 1] = "start";
  2674. session.foldWidgets[row + 1] = "";
  2675. return "";
  2676. }
  2677. }
  2678. if (prevIndent!= -1 && prevIndent < indent)
  2679. session.foldWidgets[row - 1] = "start";
  2680. else
  2681. session.foldWidgets[row - 1] = "";
  2682. if (indent < nextIndent)
  2683. return "start";
  2684. else
  2685. return "";
  2686. };
  2687. }).call(FoldMode.prototype);
  2688. });
  2689. ace.define("ace/mode/elixir",[], function(require, exports, module) {
  2690. "use strict";
  2691. var oop = require("../lib/oop");
  2692. var TextMode = require("./text").Mode;
  2693. var ElixirHighlightRules = require("./elixir_highlight_rules").ElixirHighlightRules;
  2694. var FoldMode = require("./folding/coffee").FoldMode;
  2695. var Mode = function() {
  2696. this.HighlightRules = ElixirHighlightRules;
  2697. this.foldingRules = new FoldMode();
  2698. this.$behaviour = this.$defaultBehaviour;
  2699. };
  2700. oop.inherits(Mode, TextMode);
  2701. (function() {
  2702. this.lineCommentStart = "#";
  2703. this.$id = "ace/mode/elixir";
  2704. }).call(Mode.prototype);
  2705. exports.Mode = Mode;
  2706. });
  2707. ace.define("ace/mode/html_elixir",[], function(require, exports, module) {
  2708. "use strict";
  2709. var oop = require("../lib/oop");
  2710. var HtmlElixirHighlightRules = require("./html_elixir_highlight_rules").HtmlElixirHighlightRules;
  2711. var HtmlMode = require("./html").Mode;
  2712. var JavaScriptMode = require("./javascript").Mode;
  2713. var CssMode = require("./css").Mode;
  2714. var ElixirMode = require("./elixir").Mode;
  2715. var Mode = function() {
  2716. HtmlMode.call(this);
  2717. this.HighlightRules = HtmlElixirHighlightRules;
  2718. this.createModeDelegates({
  2719. "js-": JavaScriptMode,
  2720. "css-": CssMode,
  2721. "elixir-": ElixirMode
  2722. });
  2723. };
  2724. oop.inherits(Mode, HtmlMode);
  2725. (function() {
  2726. this.$id = "ace/mode/html_elixir";
  2727. }).call(Mode.prototype);
  2728. exports.Mode = Mode;
  2729. });
  2730. (function() {
  2731. ace.require(["ace/mode/html_elixir"], function(m) {
  2732. if (typeof module == "object" && typeof exports == "object" && module) {
  2733. module.exports = m;
  2734. }
  2735. });
  2736. })();