a409a938710908cfc835e7197e2ca851.js 132 KB

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