2f5ea84ffbac21b3f98fccc2352300e4.js 127 KB

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