264ea9c24cd14f94609599449221dd9c.js 127 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733
  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|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. if (/:[^;]+$/.test(line)) {
  1620. /([\w\-]+):[^:]*$/.test(line);
  1621. return this.getPropertyValueCompletions(state, session, pos, prefix);
  1622. }
  1623. else {
  1624. return this.getPropertyCompletions(state, session, pos, prefix);
  1625. }
  1626. }
  1627. return [];
  1628. };
  1629. this.getPropertyCompletions = function (state, session, pos, prefix) {
  1630. var properties = Object.keys(propertyMap);
  1631. return properties.map(function (property) {
  1632. return {
  1633. caption: property,
  1634. snippet: property + ': $0;',
  1635. meta: "property",
  1636. score: 1000000
  1637. };
  1638. });
  1639. };
  1640. this.getPropertyValueCompletions = function (state, session, pos, prefix) {
  1641. var line = session.getLine(pos.row).substr(0, pos.column);
  1642. var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
  1643. if (!property)
  1644. return [];
  1645. var values = [];
  1646. if (property in propertyMap && typeof propertyMap[property] === "object") {
  1647. values = Object.keys(propertyMap[property]);
  1648. }
  1649. return values.map(function (value) {
  1650. return {
  1651. caption: value,
  1652. snippet: value,
  1653. meta: "property value",
  1654. score: 1000000
  1655. };
  1656. });
  1657. };
  1658. }).call(CssCompletions.prototype);
  1659. exports.CssCompletions = CssCompletions;
  1660. });
  1661. 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";
  1662. var oop = require("../../lib/oop");
  1663. var Behaviour = require("../behaviour").Behaviour;
  1664. var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
  1665. var TokenIterator = require("../../token_iterator").TokenIterator;
  1666. var CssBehaviour = function () {
  1667. this.inherit(CstyleBehaviour);
  1668. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1669. if (text === ':' && editor.selection.isEmpty()) {
  1670. var cursor = editor.getCursorPosition();
  1671. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1672. var token = iterator.getCurrentToken();
  1673. if (token && token.value.match(/\s+/)) {
  1674. token = iterator.stepBackward();
  1675. }
  1676. if (token && token.type === 'support.type') {
  1677. var line = session.doc.getLine(cursor.row);
  1678. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1679. if (rightChar === ':') {
  1680. return {
  1681. text: '',
  1682. selection: [1, 1]
  1683. };
  1684. }
  1685. if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
  1686. return {
  1687. text: ':;',
  1688. selection: [1, 1]
  1689. };
  1690. }
  1691. }
  1692. }
  1693. });
  1694. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1695. var selected = session.doc.getTextRange(range);
  1696. if (!range.isMultiLine() && selected === ':') {
  1697. var cursor = editor.getCursorPosition();
  1698. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1699. var token = iterator.getCurrentToken();
  1700. if (token && token.value.match(/\s+/)) {
  1701. token = iterator.stepBackward();
  1702. }
  1703. if (token && token.type === 'support.type') {
  1704. var line = session.doc.getLine(range.start.row);
  1705. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1706. if (rightChar === ';') {
  1707. range.end.column++;
  1708. return range;
  1709. }
  1710. }
  1711. }
  1712. });
  1713. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1714. if (text === ';' && editor.selection.isEmpty()) {
  1715. var cursor = editor.getCursorPosition();
  1716. var line = session.doc.getLine(cursor.row);
  1717. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1718. if (rightChar === ';') {
  1719. return {
  1720. text: '',
  1721. selection: [1, 1]
  1722. };
  1723. }
  1724. }
  1725. });
  1726. this.add("!important", "insertion", function (state, action, editor, session, text) {
  1727. if (text === '!' && editor.selection.isEmpty()) {
  1728. var cursor = editor.getCursorPosition();
  1729. var line = session.doc.getLine(cursor.row);
  1730. if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
  1731. return {
  1732. text: '!important',
  1733. selection: [10, 10]
  1734. };
  1735. }
  1736. }
  1737. });
  1738. };
  1739. oop.inherits(CssBehaviour, CstyleBehaviour);
  1740. exports.CssBehaviour = CssBehaviour;
  1741. });
  1742. 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";
  1743. var oop = require("../lib/oop");
  1744. var TextMode = require("./text").Mode;
  1745. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1746. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1747. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1748. var CssCompletions = require("./css_completions").CssCompletions;
  1749. var CssBehaviour = require("./behaviour/css").CssBehaviour;
  1750. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1751. var Mode = function () {
  1752. this.HighlightRules = CssHighlightRules;
  1753. this.$outdent = new MatchingBraceOutdent();
  1754. this.$behaviour = new CssBehaviour();
  1755. this.$completer = new CssCompletions();
  1756. this.foldingRules = new CStyleFoldMode();
  1757. };
  1758. oop.inherits(Mode, TextMode);
  1759. (function () {
  1760. this.foldingRules = "cStyle";
  1761. this.blockComment = { start: "/*", end: "*/" };
  1762. this.getNextLineIndent = function (state, line, tab) {
  1763. var indent = this.$getIndent(line);
  1764. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1765. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  1766. return indent;
  1767. }
  1768. var match = line.match(/^.*\{\s*$/);
  1769. if (match) {
  1770. indent += tab;
  1771. }
  1772. return indent;
  1773. };
  1774. this.checkOutdent = function (state, line, input) {
  1775. return this.$outdent.checkOutdent(line, input);
  1776. };
  1777. this.autoOutdent = function (state, doc, row) {
  1778. this.$outdent.autoOutdent(doc, row);
  1779. };
  1780. this.getCompletions = function (state, session, pos, prefix) {
  1781. return this.$completer.getCompletions(state, session, pos, prefix);
  1782. };
  1783. this.createWorker = function (session) {
  1784. var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
  1785. worker.attachToDocument(session.getDocument());
  1786. worker.on("annotate", function (e) {
  1787. session.setAnnotations(e.data);
  1788. });
  1789. worker.on("terminate", function () {
  1790. session.clearAnnotations();
  1791. });
  1792. return worker;
  1793. };
  1794. this.$id = "ace/mode/css";
  1795. this.snippetFileId = "ace/snippets/css";
  1796. }).call(Mode.prototype);
  1797. exports.Mode = Mode;
  1798. });
  1799. 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";
  1800. var oop = require("../../lib/oop");
  1801. var Behaviour = require("../behaviour").Behaviour;
  1802. var TokenIterator = require("../../token_iterator").TokenIterator;
  1803. var lang = require("../../lib/lang");
  1804. function is(token, type) {
  1805. return token && token.type.lastIndexOf(type + ".xml") > -1;
  1806. }
  1807. var XmlBehaviour = function () {
  1808. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  1809. if (text == '"' || text == "'") {
  1810. var quote = text;
  1811. var selected = session.doc.getTextRange(editor.getSelectionRange());
  1812. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  1813. return {
  1814. text: quote + selected + quote,
  1815. selection: false
  1816. };
  1817. }
  1818. var cursor = editor.getCursorPosition();
  1819. var line = session.doc.getLine(cursor.row);
  1820. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1821. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1822. var token = iterator.getCurrentToken();
  1823. if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
  1824. return {
  1825. text: "",
  1826. selection: [1, 1]
  1827. };
  1828. }
  1829. if (!token)
  1830. token = iterator.stepBackward();
  1831. if (!token)
  1832. return;
  1833. while (is(token, "tag-whitespace") || is(token, "whitespace")) {
  1834. token = iterator.stepBackward();
  1835. }
  1836. var rightSpace = !rightChar || rightChar.match(/\s/);
  1837. if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
  1838. return {
  1839. text: quote + quote,
  1840. selection: [1, 1]
  1841. };
  1842. }
  1843. }
  1844. });
  1845. this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
  1846. var selected = session.doc.getTextRange(range);
  1847. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  1848. var line = session.doc.getLine(range.start.row);
  1849. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  1850. if (rightChar == selected) {
  1851. range.end.column++;
  1852. return range;
  1853. }
  1854. }
  1855. });
  1856. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  1857. if (text == '>') {
  1858. var position = editor.getSelectionRange().start;
  1859. var iterator = new TokenIterator(session, position.row, position.column);
  1860. var token = iterator.getCurrentToken() || iterator.stepBackward();
  1861. if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
  1862. return;
  1863. if (is(token, "reference.attribute-value"))
  1864. return;
  1865. if (is(token, "attribute-value")) {
  1866. var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length;
  1867. if (position.column < tokenEndColumn)
  1868. return;
  1869. if (position.column == tokenEndColumn) {
  1870. var nextToken = iterator.stepForward();
  1871. if (nextToken && is(nextToken, "attribute-value"))
  1872. return;
  1873. iterator.stepBackward();
  1874. }
  1875. }
  1876. if (/^\s*>/.test(session.getLine(position.row).slice(position.column)))
  1877. return;
  1878. while (!is(token, "tag-name")) {
  1879. token = iterator.stepBackward();
  1880. if (token.value == "<") {
  1881. token = iterator.stepForward();
  1882. break;
  1883. }
  1884. }
  1885. var tokenRow = iterator.getCurrentTokenRow();
  1886. var tokenColumn = iterator.getCurrentTokenColumn();
  1887. if (is(iterator.stepBackward(), "end-tag-open"))
  1888. return;
  1889. var element = token.value;
  1890. if (tokenRow == position.row)
  1891. element = element.substring(0, position.column - tokenColumn);
  1892. if (this.voidElements.hasOwnProperty(element.toLowerCase()))
  1893. return;
  1894. return {
  1895. text: ">" + "</" + element + ">",
  1896. selection: [1, 1]
  1897. };
  1898. }
  1899. });
  1900. this.add("autoindent", "insertion", function (state, action, editor, session, text) {
  1901. if (text == "\n") {
  1902. var cursor = editor.getCursorPosition();
  1903. var line = session.getLine(cursor.row);
  1904. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1905. var token = iterator.getCurrentToken();
  1906. if (token && token.type.indexOf("tag-close") !== -1) {
  1907. if (token.value == "/>")
  1908. return;
  1909. while (token && token.type.indexOf("tag-name") === -1) {
  1910. token = iterator.stepBackward();
  1911. }
  1912. if (!token) {
  1913. return;
  1914. }
  1915. var tag = token.value;
  1916. var row = iterator.getCurrentTokenRow();
  1917. token = iterator.stepBackward();
  1918. if (!token || token.type.indexOf("end-tag") !== -1) {
  1919. return;
  1920. }
  1921. if (this.voidElements && !this.voidElements[tag]) {
  1922. var nextToken = session.getTokenAt(cursor.row, cursor.column + 1);
  1923. var line = session.getLine(row);
  1924. var nextIndent = this.$getIndent(line);
  1925. var indent = nextIndent + session.getTabString();
  1926. if (nextToken && nextToken.value === "</") {
  1927. return {
  1928. text: "\n" + indent + "\n" + nextIndent,
  1929. selection: [1, indent.length, 1, indent.length]
  1930. };
  1931. }
  1932. else {
  1933. return {
  1934. text: "\n" + indent
  1935. };
  1936. }
  1937. }
  1938. }
  1939. }
  1940. });
  1941. };
  1942. oop.inherits(XmlBehaviour, Behaviour);
  1943. exports.XmlBehaviour = XmlBehaviour;
  1944. });
  1945. ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
  1946. var oop = require("../../lib/oop");
  1947. var BaseFoldMode = require("./fold_mode").FoldMode;
  1948. var FoldMode = exports.FoldMode = function (defaultMode, subModes) {
  1949. this.defaultMode = defaultMode;
  1950. this.subModes = subModes;
  1951. };
  1952. oop.inherits(FoldMode, BaseFoldMode);
  1953. (function () {
  1954. this.$getMode = function (state) {
  1955. if (typeof state != "string")
  1956. state = state[0];
  1957. for (var key in this.subModes) {
  1958. if (state.indexOf(key) === 0)
  1959. return this.subModes[key];
  1960. }
  1961. return null;
  1962. };
  1963. this.$tryMode = function (state, session, foldStyle, row) {
  1964. var mode = this.$getMode(state);
  1965. return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
  1966. };
  1967. this.getFoldWidget = function (session, foldStyle, row) {
  1968. return (this.$tryMode(session.getState(row - 1), session, foldStyle, row) ||
  1969. this.$tryMode(session.getState(row), session, foldStyle, row) ||
  1970. this.defaultMode.getFoldWidget(session, foldStyle, row));
  1971. };
  1972. this.getFoldWidgetRange = function (session, foldStyle, row) {
  1973. var mode = this.$getMode(session.getState(row - 1));
  1974. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1975. mode = this.$getMode(session.getState(row));
  1976. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1977. mode = this.defaultMode;
  1978. return mode.getFoldWidgetRange(session, foldStyle, row);
  1979. };
  1980. }).call(FoldMode.prototype);
  1981. });
  1982. 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";
  1983. var oop = require("../../lib/oop");
  1984. var lang = require("../../lib/lang");
  1985. var Range = require("../../range").Range;
  1986. var BaseFoldMode = require("./fold_mode").FoldMode;
  1987. var TokenIterator = require("../../token_iterator").TokenIterator;
  1988. var FoldMode = exports.FoldMode = function (voidElements, optionalEndTags) {
  1989. BaseFoldMode.call(this);
  1990. this.voidElements = voidElements || {};
  1991. this.optionalEndTags = oop.mixin({}, this.voidElements);
  1992. if (optionalEndTags)
  1993. oop.mixin(this.optionalEndTags, optionalEndTags);
  1994. };
  1995. oop.inherits(FoldMode, BaseFoldMode);
  1996. var Tag = function () {
  1997. this.tagName = "";
  1998. this.closing = false;
  1999. this.selfClosing = false;
  2000. this.start = { row: 0, column: 0 };
  2001. this.end = { row: 0, column: 0 };
  2002. };
  2003. function is(token, type) {
  2004. return token.type.lastIndexOf(type + ".xml") > -1;
  2005. }
  2006. (function () {
  2007. this.getFoldWidget = function (session, foldStyle, row) {
  2008. var tag = this._getFirstTagInLine(session, row);
  2009. if (!tag)
  2010. return this.getCommentFoldWidget(session, row);
  2011. if (tag.closing || (!tag.tagName && tag.selfClosing))
  2012. return foldStyle == "markbeginend" ? "end" : "";
  2013. if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
  2014. return "";
  2015. if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
  2016. return "";
  2017. return "start";
  2018. };
  2019. this.getCommentFoldWidget = function (session, row) {
  2020. if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
  2021. return "start";
  2022. return "";
  2023. };
  2024. this._getFirstTagInLine = function (session, row) {
  2025. var tokens = session.getTokens(row);
  2026. var tag = new Tag();
  2027. for (var i = 0; i < tokens.length; i++) {
  2028. var token = tokens[i];
  2029. if (is(token, "tag-open")) {
  2030. tag.end.column = tag.start.column + token.value.length;
  2031. tag.closing = is(token, "end-tag-open");
  2032. token = tokens[++i];
  2033. if (!token)
  2034. return null;
  2035. tag.tagName = token.value;
  2036. tag.end.column += token.value.length;
  2037. for (i++; i < tokens.length; i++) {
  2038. token = tokens[i];
  2039. tag.end.column += token.value.length;
  2040. if (is(token, "tag-close")) {
  2041. tag.selfClosing = token.value == '/>';
  2042. break;
  2043. }
  2044. }
  2045. return tag;
  2046. }
  2047. else if (is(token, "tag-close")) {
  2048. tag.selfClosing = token.value == '/>';
  2049. return tag;
  2050. }
  2051. tag.start.column += token.value.length;
  2052. }
  2053. return null;
  2054. };
  2055. this._findEndTagInLine = function (session, row, tagName, startColumn) {
  2056. var tokens = session.getTokens(row);
  2057. var column = 0;
  2058. for (var i = 0; i < tokens.length; i++) {
  2059. var token = tokens[i];
  2060. column += token.value.length;
  2061. if (column < startColumn)
  2062. continue;
  2063. if (is(token, "end-tag-open")) {
  2064. token = tokens[i + 1];
  2065. if (token && token.value == tagName)
  2066. return true;
  2067. }
  2068. }
  2069. return false;
  2070. };
  2071. this._readTagForward = function (iterator) {
  2072. var token = iterator.getCurrentToken();
  2073. if (!token)
  2074. return null;
  2075. var tag = new Tag();
  2076. do {
  2077. if (is(token, "tag-open")) {
  2078. tag.closing = is(token, "end-tag-open");
  2079. tag.start.row = iterator.getCurrentTokenRow();
  2080. tag.start.column = iterator.getCurrentTokenColumn();
  2081. }
  2082. else if (is(token, "tag-name")) {
  2083. tag.tagName = token.value;
  2084. }
  2085. else if (is(token, "tag-close")) {
  2086. tag.selfClosing = token.value == "/>";
  2087. tag.end.row = iterator.getCurrentTokenRow();
  2088. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  2089. iterator.stepForward();
  2090. return tag;
  2091. }
  2092. } while (token = iterator.stepForward());
  2093. return null;
  2094. };
  2095. this._readTagBackward = function (iterator) {
  2096. var token = iterator.getCurrentToken();
  2097. if (!token)
  2098. return null;
  2099. var tag = new Tag();
  2100. do {
  2101. if (is(token, "tag-open")) {
  2102. tag.closing = is(token, "end-tag-open");
  2103. tag.start.row = iterator.getCurrentTokenRow();
  2104. tag.start.column = iterator.getCurrentTokenColumn();
  2105. iterator.stepBackward();
  2106. return tag;
  2107. }
  2108. else if (is(token, "tag-name")) {
  2109. tag.tagName = token.value;
  2110. }
  2111. else if (is(token, "tag-close")) {
  2112. tag.selfClosing = token.value == "/>";
  2113. tag.end.row = iterator.getCurrentTokenRow();
  2114. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  2115. }
  2116. } while (token = iterator.stepBackward());
  2117. return null;
  2118. };
  2119. this._pop = function (stack, tag) {
  2120. while (stack.length) {
  2121. var top = stack[stack.length - 1];
  2122. if (!tag || top.tagName == tag.tagName) {
  2123. return stack.pop();
  2124. }
  2125. else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
  2126. stack.pop();
  2127. continue;
  2128. }
  2129. else {
  2130. return null;
  2131. }
  2132. }
  2133. };
  2134. this.getFoldWidgetRange = function (session, foldStyle, row) {
  2135. var firstTag = this._getFirstTagInLine(session, row);
  2136. if (!firstTag) {
  2137. return this.getCommentFoldWidget(session, row)
  2138. && session.getCommentFoldRange(row, session.getLine(row).length);
  2139. }
  2140. var isBackward = firstTag.closing || firstTag.selfClosing;
  2141. var stack = [];
  2142. var tag;
  2143. if (!isBackward) {
  2144. var iterator = new TokenIterator(session, row, firstTag.start.column);
  2145. var start = {
  2146. row: row,
  2147. column: firstTag.start.column + firstTag.tagName.length + 2
  2148. };
  2149. if (firstTag.start.row == firstTag.end.row)
  2150. start.column = firstTag.end.column;
  2151. while (tag = this._readTagForward(iterator)) {
  2152. if (tag.selfClosing) {
  2153. if (!stack.length) {
  2154. tag.start.column += tag.tagName.length + 2;
  2155. tag.end.column -= 2;
  2156. return Range.fromPoints(tag.start, tag.end);
  2157. }
  2158. else
  2159. continue;
  2160. }
  2161. if (tag.closing) {
  2162. this._pop(stack, tag);
  2163. if (stack.length == 0)
  2164. return Range.fromPoints(start, tag.start);
  2165. }
  2166. else {
  2167. stack.push(tag);
  2168. }
  2169. }
  2170. }
  2171. else {
  2172. var iterator = new TokenIterator(session, row, firstTag.end.column);
  2173. var end = {
  2174. row: row,
  2175. column: firstTag.start.column
  2176. };
  2177. while (tag = this._readTagBackward(iterator)) {
  2178. if (tag.selfClosing) {
  2179. if (!stack.length) {
  2180. tag.start.column += tag.tagName.length + 2;
  2181. tag.end.column -= 2;
  2182. return Range.fromPoints(tag.start, tag.end);
  2183. }
  2184. else
  2185. continue;
  2186. }
  2187. if (!tag.closing) {
  2188. this._pop(stack, tag);
  2189. if (stack.length == 0) {
  2190. tag.start.column += tag.tagName.length + 2;
  2191. if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
  2192. tag.start.column = tag.end.column;
  2193. return Range.fromPoints(tag.start, end);
  2194. }
  2195. }
  2196. else {
  2197. stack.push(tag);
  2198. }
  2199. }
  2200. }
  2201. };
  2202. }).call(FoldMode.prototype);
  2203. });
  2204. 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";
  2205. var oop = require("../../lib/oop");
  2206. var MixedFoldMode = require("./mixed").FoldMode;
  2207. var XmlFoldMode = require("./xml").FoldMode;
  2208. var CStyleFoldMode = require("./cstyle").FoldMode;
  2209. var FoldMode = exports.FoldMode = function (voidElements, optionalTags) {
  2210. MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
  2211. "js-": new CStyleFoldMode(),
  2212. "css-": new CStyleFoldMode()
  2213. });
  2214. };
  2215. oop.inherits(FoldMode, MixedFoldMode);
  2216. });
  2217. ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module){"use strict";
  2218. var TokenIterator = require("../token_iterator").TokenIterator;
  2219. var commonAttributes = [
  2220. "accesskey",
  2221. "class",
  2222. "contenteditable",
  2223. "contextmenu",
  2224. "dir",
  2225. "draggable",
  2226. "dropzone",
  2227. "hidden",
  2228. "id",
  2229. "inert",
  2230. "itemid",
  2231. "itemprop",
  2232. "itemref",
  2233. "itemscope",
  2234. "itemtype",
  2235. "lang",
  2236. "spellcheck",
  2237. "style",
  2238. "tabindex",
  2239. "title",
  2240. "translate"
  2241. ];
  2242. var eventAttributes = [
  2243. "onabort",
  2244. "onblur",
  2245. "oncancel",
  2246. "oncanplay",
  2247. "oncanplaythrough",
  2248. "onchange",
  2249. "onclick",
  2250. "onclose",
  2251. "oncontextmenu",
  2252. "oncuechange",
  2253. "ondblclick",
  2254. "ondrag",
  2255. "ondragend",
  2256. "ondragenter",
  2257. "ondragleave",
  2258. "ondragover",
  2259. "ondragstart",
  2260. "ondrop",
  2261. "ondurationchange",
  2262. "onemptied",
  2263. "onended",
  2264. "onerror",
  2265. "onfocus",
  2266. "oninput",
  2267. "oninvalid",
  2268. "onkeydown",
  2269. "onkeypress",
  2270. "onkeyup",
  2271. "onload",
  2272. "onloadeddata",
  2273. "onloadedmetadata",
  2274. "onloadstart",
  2275. "onmousedown",
  2276. "onmousemove",
  2277. "onmouseout",
  2278. "onmouseover",
  2279. "onmouseup",
  2280. "onmousewheel",
  2281. "onpause",
  2282. "onplay",
  2283. "onplaying",
  2284. "onprogress",
  2285. "onratechange",
  2286. "onreset",
  2287. "onscroll",
  2288. "onseeked",
  2289. "onseeking",
  2290. "onselect",
  2291. "onshow",
  2292. "onstalled",
  2293. "onsubmit",
  2294. "onsuspend",
  2295. "ontimeupdate",
  2296. "onvolumechange",
  2297. "onwaiting"
  2298. ];
  2299. var globalAttributes = commonAttributes.concat(eventAttributes);
  2300. var attributeMap = {
  2301. "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 },
  2302. "abbr": {},
  2303. "address": {},
  2304. "area": { "shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1 },
  2305. "article": { "pubdate": 1 },
  2306. "aside": {},
  2307. "audio": { "src": 1, "autobuffer": 1, "autoplay": { "autoplay": 1 }, "loop": { "loop": 1 }, "controls": { "controls": 1 }, "muted": { "muted": 1 }, "preload": { "auto": 1, "metadata": 1, "none": 1 } },
  2308. "b": {},
  2309. "base": { "href": 1, "target": 1 },
  2310. "bdi": {},
  2311. "bdo": {},
  2312. "blockquote": { "cite": 1 },
  2313. "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 },
  2314. "br": {},
  2315. "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 } },
  2316. "canvas": { "width": 1, "height": 1 },
  2317. "caption": {},
  2318. "cite": {},
  2319. "code": {},
  2320. "col": { "span": 1 },
  2321. "colgroup": { "span": 1 },
  2322. "command": { "type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1 },
  2323. "data": {},
  2324. "datalist": {},
  2325. "dd": {},
  2326. "del": { "cite": 1, "datetime": 1 },
  2327. "details": { "open": 1 },
  2328. "dfn": {},
  2329. "dialog": { "open": 1 },
  2330. "div": {},
  2331. "dl": {},
  2332. "dt": {},
  2333. "em": {},
  2334. "embed": { "src": 1, "height": 1, "width": 1, "type": 1 },
  2335. "fieldset": { "disabled": 1, "form": 1, "name": 1 },
  2336. "figcaption": {},
  2337. "figure": {},
  2338. "footer": {},
  2339. "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 } },
  2340. "h1": {},
  2341. "h2": {},
  2342. "h3": {},
  2343. "h4": {},
  2344. "h5": {},
  2345. "h6": {},
  2346. "head": {},
  2347. "header": {},
  2348. "hr": {},
  2349. "html": { "manifest": 1 },
  2350. "i": {},
  2351. "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 } },
  2352. "img": { "alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1 },
  2353. "input": {
  2354. "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 },
  2355. "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
  2356. },
  2357. "ins": { "cite": 1, "datetime": 1 },
  2358. "kbd": {},
  2359. "keygen": { "autofocus": 1, "challenge": { "challenge": 1 }, "disabled": { "disabled": 1 }, "form": 1, "keytype": { "rsa": 1, "dsa": 1, "ec": 1 }, "name": 1 },
  2360. "label": { "form": 1, "for": 1 },
  2361. "legend": {},
  2362. "li": { "value": 1 },
  2363. "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 },
  2364. "main": {},
  2365. "map": { "name": 1 },
  2366. "mark": {},
  2367. "math": {},
  2368. "menu": { "type": 1, "label": 1 },
  2369. "meta": { "http-equiv": { "content-type": 1 }, "name": { "description": 1, "keywords": 1 }, "content": { "text/html; charset=UTF-8": 1 }, "charset": 1 },
  2370. "meter": { "value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1 },
  2371. "nav": {},
  2372. "noscript": { "href": 1 },
  2373. "object": { "param": 1, "data": 1, "type": 1, "height": 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1 },
  2374. "ol": { "start": 1, "reversed": 1 },
  2375. "optgroup": { "disabled": 1, "label": 1 },
  2376. "option": { "disabled": 1, "selected": 1, "label": 1, "value": 1 },
  2377. "output": { "for": 1, "form": 1, "name": 1 },
  2378. "p": {},
  2379. "param": { "name": 1, "value": 1 },
  2380. "pre": {},
  2381. "progress": { "value": 1, "max": 1 },
  2382. "q": { "cite": 1 },
  2383. "rp": {},
  2384. "rt": {},
  2385. "ruby": {},
  2386. "s": {},
  2387. "samp": {},
  2388. "script": { "charset": 1, "type": { "text/javascript": 1 }, "src": 1, "defer": 1, "async": 1 },
  2389. "select": { "autofocus": 1, "disabled": 1, "form": 1, "multiple": { "multiple": 1 }, "name": 1, "size": 1, "readonly": { "readonly": 1 } },
  2390. "small": {},
  2391. "source": { "src": 1, "type": 1, "media": 1 },
  2392. "span": {},
  2393. "strong": {},
  2394. "style": { "type": 1, "media": { "all": 1, "screen": 1, "print": 1 }, "scoped": 1 },
  2395. "sub": {},
  2396. "sup": {},
  2397. "svg": {},
  2398. "table": { "summary": 1 },
  2399. "tbody": {},
  2400. "td": { "headers": 1, "rowspan": 1, "colspan": 1 },
  2401. "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 } },
  2402. "tfoot": {},
  2403. "th": { "headers": 1, "rowspan": 1, "colspan": 1, "scope": 1 },
  2404. "thead": {},
  2405. "time": { "datetime": 1 },
  2406. "title": {},
  2407. "tr": {},
  2408. "track": { "kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1 },
  2409. "section": {},
  2410. "summary": {},
  2411. "u": {},
  2412. "ul": {},
  2413. "var": {},
  2414. "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 } },
  2415. "wbr": {}
  2416. };
  2417. var elements = Object.keys(attributeMap);
  2418. function is(token, type) {
  2419. return token.type.lastIndexOf(type + ".xml") > -1;
  2420. }
  2421. function findTagName(session, pos) {
  2422. var iterator = new TokenIterator(session, pos.row, pos.column);
  2423. var token = iterator.getCurrentToken();
  2424. while (token && !is(token, "tag-name")) {
  2425. token = iterator.stepBackward();
  2426. }
  2427. if (token)
  2428. return token.value;
  2429. }
  2430. function findAttributeName(session, pos) {
  2431. var iterator = new TokenIterator(session, pos.row, pos.column);
  2432. var token = iterator.getCurrentToken();
  2433. while (token && !is(token, "attribute-name")) {
  2434. token = iterator.stepBackward();
  2435. }
  2436. if (token)
  2437. return token.value;
  2438. }
  2439. var HtmlCompletions = function () {
  2440. };
  2441. (function () {
  2442. this.getCompletions = function (state, session, pos, prefix) {
  2443. var token = session.getTokenAt(pos.row, pos.column);
  2444. if (!token)
  2445. return [];
  2446. if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
  2447. return this.getTagCompletions(state, session, pos, prefix);
  2448. if (is(token, "tag-whitespace") || is(token, "attribute-name"))
  2449. return this.getAttributeCompletions(state, session, pos, prefix);
  2450. if (is(token, "attribute-value"))
  2451. return this.getAttributeValueCompletions(state, session, pos, prefix);
  2452. var line = session.getLine(pos.row).substr(0, pos.column);
  2453. if (/&[a-z]*$/i.test(line))
  2454. return this.getHTMLEntityCompletions(state, session, pos, prefix);
  2455. return [];
  2456. };
  2457. this.getTagCompletions = function (state, session, pos, prefix) {
  2458. return elements.map(function (element) {
  2459. return {
  2460. value: element,
  2461. meta: "tag",
  2462. score: 1000000
  2463. };
  2464. });
  2465. };
  2466. this.getAttributeCompletions = function (state, session, pos, prefix) {
  2467. var tagName = findTagName(session, pos);
  2468. if (!tagName)
  2469. return [];
  2470. var attributes = globalAttributes;
  2471. if (tagName in attributeMap) {
  2472. attributes = attributes.concat(Object.keys(attributeMap[tagName]));
  2473. }
  2474. return attributes.map(function (attribute) {
  2475. return {
  2476. caption: attribute,
  2477. snippet: attribute + '="$0"',
  2478. meta: "attribute",
  2479. score: 1000000
  2480. };
  2481. });
  2482. };
  2483. this.getAttributeValueCompletions = function (state, session, pos, prefix) {
  2484. var tagName = findTagName(session, pos);
  2485. var attributeName = findAttributeName(session, pos);
  2486. if (!tagName)
  2487. return [];
  2488. var values = [];
  2489. if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
  2490. values = Object.keys(attributeMap[tagName][attributeName]);
  2491. }
  2492. return values.map(function (value) {
  2493. return {
  2494. caption: value,
  2495. snippet: value,
  2496. meta: "attribute value",
  2497. score: 1000000
  2498. };
  2499. });
  2500. };
  2501. this.getHTMLEntityCompletions = function (state, session, pos, prefix) {
  2502. 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;'];
  2503. return values.map(function (value) {
  2504. return {
  2505. caption: value,
  2506. snippet: value,
  2507. meta: "html entity",
  2508. score: 1000000
  2509. };
  2510. });
  2511. };
  2512. }).call(HtmlCompletions.prototype);
  2513. exports.HtmlCompletions = HtmlCompletions;
  2514. });
  2515. 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";
  2516. var oop = require("../lib/oop");
  2517. var lang = require("../lib/lang");
  2518. var TextMode = require("./text").Mode;
  2519. var JavaScriptMode = require("./javascript").Mode;
  2520. var CssMode = require("./css").Mode;
  2521. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2522. var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
  2523. var HtmlFoldMode = require("./folding/html").FoldMode;
  2524. var HtmlCompletions = require("./html_completions").HtmlCompletions;
  2525. var WorkerClient = require("../worker/worker_client").WorkerClient;
  2526. var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
  2527. var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
  2528. var Mode = function (options) {
  2529. this.fragmentContext = options && options.fragmentContext;
  2530. this.HighlightRules = HtmlHighlightRules;
  2531. this.$behaviour = new XmlBehaviour();
  2532. this.$completer = new HtmlCompletions();
  2533. this.createModeDelegates({
  2534. "js-": JavaScriptMode,
  2535. "css-": CssMode
  2536. });
  2537. this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
  2538. };
  2539. oop.inherits(Mode, TextMode);
  2540. (function () {
  2541. this.blockComment = { start: "<!--", end: "-->" };
  2542. this.voidElements = lang.arrayToMap(voidElements);
  2543. this.getNextLineIndent = function (state, line, tab) {
  2544. return this.$getIndent(line);
  2545. };
  2546. this.checkOutdent = function (state, line, input) {
  2547. return false;
  2548. };
  2549. this.getCompletions = function (state, session, pos, prefix) {
  2550. return this.$completer.getCompletions(state, session, pos, prefix);
  2551. };
  2552. this.createWorker = function (session) {
  2553. if (this.constructor != Mode)
  2554. return;
  2555. var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
  2556. worker.attachToDocument(session.getDocument());
  2557. if (this.fragmentContext)
  2558. worker.call("setOptions", [{ context: this.fragmentContext }]);
  2559. worker.on("error", function (e) {
  2560. session.setAnnotations(e.data);
  2561. });
  2562. worker.on("terminate", function () {
  2563. session.clearAnnotations();
  2564. });
  2565. return worker;
  2566. };
  2567. this.$id = "ace/mode/html";
  2568. this.snippetFileId = "ace/snippets/html";
  2569. }).call(Mode.prototype);
  2570. exports.Mode = Mode;
  2571. });
  2572. 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";
  2573. var oop = require("../../lib/oop");
  2574. var BaseFoldMode = require("./fold_mode").FoldMode;
  2575. var Range = require("../../range").Range;
  2576. var FoldMode = exports.FoldMode = function () { };
  2577. oop.inherits(FoldMode, BaseFoldMode);
  2578. (function () {
  2579. this.getFoldWidgetRange = function (session, foldStyle, row) {
  2580. var range = this.indentationBlock(session, row);
  2581. if (range)
  2582. return range;
  2583. var re = /\S/;
  2584. var line = session.getLine(row);
  2585. var startLevel = line.search(re);
  2586. if (startLevel == -1 || line[startLevel] != "#")
  2587. return;
  2588. var startColumn = line.length;
  2589. var maxRow = session.getLength();
  2590. var startRow = row;
  2591. var endRow = row;
  2592. while (++row < maxRow) {
  2593. line = session.getLine(row);
  2594. var level = line.search(re);
  2595. if (level == -1)
  2596. continue;
  2597. if (line[level] != "#")
  2598. break;
  2599. endRow = row;
  2600. }
  2601. if (endRow > startRow) {
  2602. var endColumn = session.getLine(endRow).length;
  2603. return new Range(startRow, startColumn, endRow, endColumn);
  2604. }
  2605. };
  2606. this.getFoldWidget = function (session, foldStyle, row) {
  2607. var line = session.getLine(row);
  2608. var indent = line.search(/\S/);
  2609. var next = session.getLine(row + 1);
  2610. var prev = session.getLine(row - 1);
  2611. var prevIndent = prev.search(/\S/);
  2612. var nextIndent = next.search(/\S/);
  2613. if (indent == -1) {
  2614. session.foldWidgets[row - 1] = prevIndent != -1 && prevIndent < nextIndent ? "start" : "";
  2615. return "";
  2616. }
  2617. if (prevIndent == -1) {
  2618. if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
  2619. session.foldWidgets[row - 1] = "";
  2620. session.foldWidgets[row + 1] = "";
  2621. return "start";
  2622. }
  2623. }
  2624. else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
  2625. if (session.getLine(row - 2).search(/\S/) == -1) {
  2626. session.foldWidgets[row - 1] = "start";
  2627. session.foldWidgets[row + 1] = "";
  2628. return "";
  2629. }
  2630. }
  2631. if (prevIndent != -1 && prevIndent < indent)
  2632. session.foldWidgets[row - 1] = "start";
  2633. else
  2634. session.foldWidgets[row - 1] = "";
  2635. if (indent < nextIndent)
  2636. return "start";
  2637. else
  2638. return "";
  2639. };
  2640. }).call(FoldMode.prototype);
  2641. });
  2642. 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){/*
  2643. THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
  2644. */
  2645. "use strict";
  2646. var oop = require("../lib/oop");
  2647. var TextMode = require("./text").Mode;
  2648. var ElixirHighlightRules = require("./elixir_highlight_rules").ElixirHighlightRules;
  2649. var FoldMode = require("./folding/coffee").FoldMode;
  2650. var Mode = function () {
  2651. this.HighlightRules = ElixirHighlightRules;
  2652. this.foldingRules = new FoldMode();
  2653. this.$behaviour = this.$defaultBehaviour;
  2654. };
  2655. oop.inherits(Mode, TextMode);
  2656. (function () {
  2657. this.lineCommentStart = "#";
  2658. this.$id = "ace/mode/elixir";
  2659. }).call(Mode.prototype);
  2660. exports.Mode = Mode;
  2661. });
  2662. 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";
  2663. var oop = require("../lib/oop");
  2664. var HtmlElixirHighlightRules = require("./html_elixir_highlight_rules").HtmlElixirHighlightRules;
  2665. var HtmlMode = require("./html").Mode;
  2666. var JavaScriptMode = require("./javascript").Mode;
  2667. var CssMode = require("./css").Mode;
  2668. var ElixirMode = require("./elixir").Mode;
  2669. var Mode = function () {
  2670. HtmlMode.call(this);
  2671. this.HighlightRules = HtmlElixirHighlightRules;
  2672. this.createModeDelegates({
  2673. "js-": JavaScriptMode,
  2674. "css-": CssMode,
  2675. "elixir-": ElixirMode
  2676. });
  2677. };
  2678. oop.inherits(Mode, HtmlMode);
  2679. (function () {
  2680. this.$id = "ace/mode/html_elixir";
  2681. }).call(Mode.prototype);
  2682. exports.Mode = Mode;
  2683. }); (function() {
  2684. ace.require(["ace/mode/html_elixir"], function(m) {
  2685. if (typeof module == "object" && typeof exports == "object" && module) {
  2686. module.exports = m;
  2687. }
  2688. });
  2689. })();