559d9b20c1df6eff138b007e57c157fa.js 145 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277
  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/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
  1083. var Range = require("../range").Range;
  1084. var MatchingBraceOutdent = function () { };
  1085. (function () {
  1086. this.checkOutdent = function (line, input) {
  1087. if (!/^\s+$/.test(line))
  1088. return false;
  1089. return /^\s*\}/.test(input);
  1090. };
  1091. this.autoOutdent = function (doc, row) {
  1092. var line = doc.getLine(row);
  1093. var match = line.match(/^(\s*\})/);
  1094. if (!match)
  1095. return 0;
  1096. var column = match[1].length;
  1097. var openBracePos = doc.findMatchingBracket({ row: row, column: column });
  1098. if (!openBracePos || openBracePos.row == row)
  1099. return 0;
  1100. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  1101. doc.replace(new Range(row, 0, row, column - 1), indent);
  1102. };
  1103. this.$getIndent = function (line) {
  1104. return line.match(/^\s*/)[0];
  1105. };
  1106. }).call(MatchingBraceOutdent.prototype);
  1107. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  1108. });
  1109. ace.define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator"], function(require, exports, module){"use strict";
  1110. var oop = require("../../lib/oop");
  1111. var Behaviour = require("../behaviour").Behaviour;
  1112. var TokenIterator = require("../../token_iterator").TokenIterator;
  1113. function is(token, type) {
  1114. return token && token.type.lastIndexOf(type + ".xml") > -1;
  1115. }
  1116. var XmlBehaviour = function () {
  1117. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  1118. if (text == '"' || text == "'") {
  1119. var quote = text;
  1120. var selected = session.doc.getTextRange(editor.getSelectionRange());
  1121. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  1122. return {
  1123. text: quote + selected + quote,
  1124. selection: false
  1125. };
  1126. }
  1127. var cursor = editor.getCursorPosition();
  1128. var line = session.doc.getLine(cursor.row);
  1129. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1130. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1131. var token = iterator.getCurrentToken();
  1132. if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
  1133. return {
  1134. text: "",
  1135. selection: [1, 1]
  1136. };
  1137. }
  1138. if (!token)
  1139. token = iterator.stepBackward();
  1140. if (!token)
  1141. return;
  1142. while (is(token, "tag-whitespace") || is(token, "whitespace")) {
  1143. token = iterator.stepBackward();
  1144. }
  1145. var rightSpace = !rightChar || rightChar.match(/\s/);
  1146. if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
  1147. return {
  1148. text: quote + quote,
  1149. selection: [1, 1]
  1150. };
  1151. }
  1152. }
  1153. });
  1154. this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
  1155. var selected = session.doc.getTextRange(range);
  1156. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  1157. var line = session.doc.getLine(range.start.row);
  1158. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  1159. if (rightChar == selected) {
  1160. range.end.column++;
  1161. return range;
  1162. }
  1163. }
  1164. });
  1165. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  1166. if (text == '>') {
  1167. var position = editor.getSelectionRange().start;
  1168. var iterator = new TokenIterator(session, position.row, position.column);
  1169. var token = iterator.getCurrentToken() || iterator.stepBackward();
  1170. if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
  1171. return;
  1172. if (is(token, "reference.attribute-value"))
  1173. return;
  1174. if (is(token, "attribute-value")) {
  1175. var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length;
  1176. if (position.column < tokenEndColumn)
  1177. return;
  1178. if (position.column == tokenEndColumn) {
  1179. var nextToken = iterator.stepForward();
  1180. if (nextToken && is(nextToken, "attribute-value"))
  1181. return;
  1182. iterator.stepBackward();
  1183. }
  1184. }
  1185. if (/^\s*>/.test(session.getLine(position.row).slice(position.column)))
  1186. return;
  1187. while (!is(token, "tag-name")) {
  1188. token = iterator.stepBackward();
  1189. if (token.value == "<") {
  1190. token = iterator.stepForward();
  1191. break;
  1192. }
  1193. }
  1194. var tokenRow = iterator.getCurrentTokenRow();
  1195. var tokenColumn = iterator.getCurrentTokenColumn();
  1196. if (is(iterator.stepBackward(), "end-tag-open"))
  1197. return;
  1198. var element = token.value;
  1199. if (tokenRow == position.row)
  1200. element = element.substring(0, position.column - tokenColumn);
  1201. if (this.voidElements && this.voidElements.hasOwnProperty(element.toLowerCase()))
  1202. return;
  1203. return {
  1204. text: ">" + "</" + element + ">",
  1205. selection: [1, 1]
  1206. };
  1207. }
  1208. });
  1209. this.add("autoindent", "insertion", function (state, action, editor, session, text) {
  1210. if (text == "\n") {
  1211. var cursor = editor.getCursorPosition();
  1212. var line = session.getLine(cursor.row);
  1213. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1214. var token = iterator.getCurrentToken();
  1215. if (is(token, "") && token.type.indexOf("tag-close") !== -1) {
  1216. if (token.value == "/>")
  1217. return;
  1218. while (token && token.type.indexOf("tag-name") === -1) {
  1219. token = iterator.stepBackward();
  1220. }
  1221. if (!token) {
  1222. return;
  1223. }
  1224. var tag = token.value;
  1225. var row = iterator.getCurrentTokenRow();
  1226. token = iterator.stepBackward();
  1227. if (!token || token.type.indexOf("end-tag") !== -1) {
  1228. return;
  1229. }
  1230. if (this.voidElements && !this.voidElements[tag] || !this.voidElements) {
  1231. var nextToken = session.getTokenAt(cursor.row, cursor.column + 1);
  1232. var line = session.getLine(row);
  1233. var nextIndent = this.$getIndent(line);
  1234. var indent = nextIndent + session.getTabString();
  1235. if (nextToken && nextToken.value === "</") {
  1236. return {
  1237. text: "\n" + indent + "\n" + nextIndent,
  1238. selection: [1, indent.length, 1, indent.length]
  1239. };
  1240. }
  1241. else {
  1242. return {
  1243. text: "\n" + indent
  1244. };
  1245. }
  1246. }
  1247. }
  1248. }
  1249. });
  1250. };
  1251. oop.inherits(XmlBehaviour, Behaviour);
  1252. exports.XmlBehaviour = XmlBehaviour;
  1253. });
  1254. 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";
  1255. var oop = require("../../lib/oop");
  1256. var TokenIterator = require("../../token_iterator").TokenIterator;
  1257. var CstyleBehaviour = require("../behaviour/cstyle").CstyleBehaviour;
  1258. var XmlBehaviour = require("../behaviour/xml").XmlBehaviour;
  1259. var JavaScriptBehaviour = function () {
  1260. var xmlBehaviours = new XmlBehaviour({ closeCurlyBraces: true }).getBehaviours();
  1261. this.addBehaviours(xmlBehaviours);
  1262. this.inherit(CstyleBehaviour);
  1263. this.add("autoclosing-fragment", "insertion", function (state, action, editor, session, text) {
  1264. if (text == '>') {
  1265. var position = editor.getSelectionRange().start;
  1266. var iterator = new TokenIterator(session, position.row, position.column);
  1267. var token = iterator.getCurrentToken() || iterator.stepBackward();
  1268. if (!token)
  1269. return;
  1270. if (token.value == '<') {
  1271. return {
  1272. text: "></>",
  1273. selection: [1, 1]
  1274. };
  1275. }
  1276. }
  1277. });
  1278. };
  1279. oop.inherits(JavaScriptBehaviour, CstyleBehaviour);
  1280. exports.JavaScriptBehaviour = JavaScriptBehaviour;
  1281. });
  1282. 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";
  1283. var oop = require("../../lib/oop");
  1284. var Range = require("../../range").Range;
  1285. var BaseFoldMode = require("./fold_mode").FoldMode;
  1286. var FoldMode = exports.FoldMode = function (voidElements, optionalEndTags) {
  1287. BaseFoldMode.call(this);
  1288. this.voidElements = voidElements || {};
  1289. this.optionalEndTags = oop.mixin({}, this.voidElements);
  1290. if (optionalEndTags)
  1291. oop.mixin(this.optionalEndTags, optionalEndTags);
  1292. };
  1293. oop.inherits(FoldMode, BaseFoldMode);
  1294. var Tag = function () {
  1295. this.tagName = "";
  1296. this.closing = false;
  1297. this.selfClosing = false;
  1298. this.start = { row: 0, column: 0 };
  1299. this.end = { row: 0, column: 0 };
  1300. };
  1301. function is(token, type) {
  1302. return token && token.type && token.type.lastIndexOf(type + ".xml") > -1;
  1303. }
  1304. (function () {
  1305. this.getFoldWidget = function (session, foldStyle, row) {
  1306. var tag = this._getFirstTagInLine(session, row);
  1307. if (!tag)
  1308. return this.getCommentFoldWidget(session, row);
  1309. if (tag.closing || (!tag.tagName && tag.selfClosing))
  1310. return foldStyle === "markbeginend" ? "end" : "";
  1311. if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
  1312. return "";
  1313. if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
  1314. return "";
  1315. return "start";
  1316. };
  1317. this.getCommentFoldWidget = function (session, row) {
  1318. if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
  1319. return "start";
  1320. return "";
  1321. };
  1322. this._getFirstTagInLine = function (session, row) {
  1323. var tokens = session.getTokens(row);
  1324. var tag = new Tag();
  1325. for (var i = 0; i < tokens.length; i++) {
  1326. var token = tokens[i];
  1327. if (is(token, "tag-open")) {
  1328. tag.end.column = tag.start.column + token.value.length;
  1329. tag.closing = is(token, "end-tag-open");
  1330. token = tokens[++i];
  1331. if (!token)
  1332. return null;
  1333. tag.tagName = token.value;
  1334. if (token.value === "") { //skip empty tag name token for fragment
  1335. token = tokens[++i];
  1336. if (!token)
  1337. return null;
  1338. tag.tagName = token.value;
  1339. }
  1340. tag.end.column += token.value.length;
  1341. for (i++; i < tokens.length; i++) {
  1342. token = tokens[i];
  1343. tag.end.column += token.value.length;
  1344. if (is(token, "tag-close")) {
  1345. tag.selfClosing = token.value == '/>';
  1346. break;
  1347. }
  1348. }
  1349. return tag;
  1350. }
  1351. else if (is(token, "tag-close")) {
  1352. tag.selfClosing = token.value == '/>';
  1353. return tag;
  1354. }
  1355. tag.start.column += token.value.length;
  1356. }
  1357. return null;
  1358. };
  1359. this._findEndTagInLine = function (session, row, tagName, startColumn) {
  1360. var tokens = session.getTokens(row);
  1361. var column = 0;
  1362. for (var i = 0; i < tokens.length; i++) {
  1363. var token = tokens[i];
  1364. column += token.value.length;
  1365. if (column < startColumn - 1)
  1366. continue;
  1367. if (is(token, "end-tag-open")) {
  1368. token = tokens[i + 1];
  1369. if (is(token, "tag-name") && token.value === "") {
  1370. token = tokens[i + 2];
  1371. }
  1372. if (token && token.value == tagName)
  1373. return true;
  1374. }
  1375. }
  1376. return false;
  1377. };
  1378. this.getFoldWidgetRange = function (session, foldStyle, row) {
  1379. var firstTag = this._getFirstTagInLine(session, row);
  1380. if (!firstTag) {
  1381. return this.getCommentFoldWidget(session, row) && session.getCommentFoldRange(row, session.getLine(row).length);
  1382. }
  1383. var tags = session.getMatchingTags({ row: row, column: 0 });
  1384. if (tags) {
  1385. return new Range(tags.openTag.end.row, tags.openTag.end.column, tags.closeTag.start.row, tags.closeTag.start.column);
  1386. }
  1387. };
  1388. }).call(FoldMode.prototype);
  1389. });
  1390. 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";
  1391. var oop = require("../../lib/oop");
  1392. var Range = require("../../range").Range;
  1393. var BaseFoldMode = require("./fold_mode").FoldMode;
  1394. var FoldMode = exports.FoldMode = function (commentRegex) {
  1395. if (commentRegex) {
  1396. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  1397. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  1398. }
  1399. };
  1400. oop.inherits(FoldMode, BaseFoldMode);
  1401. (function () {
  1402. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  1403. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  1404. this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
  1405. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  1406. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  1407. this._getFoldWidgetBase = this.getFoldWidget;
  1408. this.getFoldWidget = function (session, foldStyle, row) {
  1409. var line = session.getLine(row);
  1410. if (this.singleLineBlockCommentRe.test(line)) {
  1411. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  1412. return "";
  1413. }
  1414. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  1415. if (!fw && this.startRegionRe.test(line))
  1416. return "start"; // lineCommentRegionStart
  1417. return fw;
  1418. };
  1419. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  1420. var line = session.getLine(row);
  1421. if (this.startRegionRe.test(line))
  1422. return this.getCommentRegionBlock(session, line, row);
  1423. var match = line.match(this.foldingStartMarker);
  1424. if (match) {
  1425. var i = match.index;
  1426. if (match[1])
  1427. return this.openingBracketBlock(session, match[1], row, i);
  1428. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  1429. if (range && !range.isMultiLine()) {
  1430. if (forceMultiline) {
  1431. range = this.getSectionRange(session, row);
  1432. }
  1433. else if (foldStyle != "all")
  1434. range = null;
  1435. }
  1436. return range;
  1437. }
  1438. if (foldStyle === "markbegin")
  1439. return;
  1440. var match = line.match(this.foldingStopMarker);
  1441. if (match) {
  1442. var i = match.index + match[0].length;
  1443. if (match[1])
  1444. return this.closingBracketBlock(session, match[1], row, i);
  1445. return session.getCommentFoldRange(row, i, -1);
  1446. }
  1447. };
  1448. this.getSectionRange = function (session, row) {
  1449. var line = session.getLine(row);
  1450. var startIndent = line.search(/\S/);
  1451. var startRow = row;
  1452. var startColumn = line.length;
  1453. row = row + 1;
  1454. var endRow = row;
  1455. var maxRow = session.getLength();
  1456. while (++row < maxRow) {
  1457. line = session.getLine(row);
  1458. var indent = line.search(/\S/);
  1459. if (indent === -1)
  1460. continue;
  1461. if (startIndent > indent)
  1462. break;
  1463. var subRange = this.getFoldWidgetRange(session, "all", row);
  1464. if (subRange) {
  1465. if (subRange.start.row <= startRow) {
  1466. break;
  1467. }
  1468. else if (subRange.isMultiLine()) {
  1469. row = subRange.end.row;
  1470. }
  1471. else if (startIndent == indent) {
  1472. break;
  1473. }
  1474. }
  1475. endRow = row;
  1476. }
  1477. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  1478. };
  1479. this.getCommentRegionBlock = function (session, line, row) {
  1480. var startColumn = line.search(/\s*$/);
  1481. var maxRow = session.getLength();
  1482. var startRow = row;
  1483. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  1484. var depth = 1;
  1485. while (++row < maxRow) {
  1486. line = session.getLine(row);
  1487. var m = re.exec(line);
  1488. if (!m)
  1489. continue;
  1490. if (m[1])
  1491. depth--;
  1492. else
  1493. depth++;
  1494. if (!depth)
  1495. break;
  1496. }
  1497. var endRow = row;
  1498. if (endRow > startRow) {
  1499. return new Range(startRow, startColumn, endRow, line.length);
  1500. }
  1501. };
  1502. }).call(FoldMode.prototype);
  1503. });
  1504. 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";
  1505. var oop = require("../../lib/oop");
  1506. var XmlFoldMode = require("./xml").FoldMode;
  1507. var CFoldMode = require("./cstyle").FoldMode;
  1508. var FoldMode = exports.FoldMode = function (commentRegex) {
  1509. if (commentRegex) {
  1510. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  1511. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  1512. }
  1513. this.xmlFoldMode = new XmlFoldMode();
  1514. };
  1515. oop.inherits(FoldMode, CFoldMode);
  1516. (function () {
  1517. this.getFoldWidgetRangeBase = this.getFoldWidgetRange;
  1518. this.getFoldWidgetBase = this.getFoldWidget;
  1519. this.getFoldWidget = function (session, foldStyle, row) {
  1520. var fw = this.getFoldWidgetBase(session, foldStyle, row);
  1521. if (!fw) {
  1522. return this.xmlFoldMode.getFoldWidget(session, foldStyle, row);
  1523. }
  1524. return fw;
  1525. };
  1526. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  1527. var range = this.getFoldWidgetRangeBase(session, foldStyle, row, forceMultiline);
  1528. if (range)
  1529. return range;
  1530. return this.xmlFoldMode.getFoldWidgetRange(session, foldStyle, row);
  1531. };
  1532. }).call(FoldMode.prototype);
  1533. });
  1534. 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";
  1535. var oop = require("../lib/oop");
  1536. var TextMode = require("./text").Mode;
  1537. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1538. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1539. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1540. var JavaScriptBehaviour = require("./behaviour/javascript").JavaScriptBehaviour;
  1541. var JavaScriptFoldMode = require("./folding/javascript").FoldMode;
  1542. var Mode = function () {
  1543. this.HighlightRules = JavaScriptHighlightRules;
  1544. this.$outdent = new MatchingBraceOutdent();
  1545. this.$behaviour = new JavaScriptBehaviour();
  1546. this.foldingRules = new JavaScriptFoldMode();
  1547. };
  1548. oop.inherits(Mode, TextMode);
  1549. (function () {
  1550. this.lineCommentStart = "//";
  1551. this.blockComment = { start: "/*", end: "*/" };
  1552. this.$quotes = { '"': '"', "'": "'", "`": "`" };
  1553. this.$pairQuotesAfter = {
  1554. "`": /\w/
  1555. };
  1556. this.getNextLineIndent = function (state, line, tab) {
  1557. var indent = this.$getIndent(line);
  1558. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  1559. var tokens = tokenizedLine.tokens;
  1560. var endState = tokenizedLine.state;
  1561. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  1562. return indent;
  1563. }
  1564. if (state == "start" || state == "no_regex") {
  1565. var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
  1566. if (match) {
  1567. indent += tab;
  1568. }
  1569. }
  1570. else if (state == "doc-start") {
  1571. if (endState == "start" || endState == "no_regex") {
  1572. return "";
  1573. }
  1574. }
  1575. return indent;
  1576. };
  1577. this.checkOutdent = function (state, line, input) {
  1578. return this.$outdent.checkOutdent(line, input);
  1579. };
  1580. this.autoOutdent = function (state, doc, row) {
  1581. this.$outdent.autoOutdent(doc, row);
  1582. };
  1583. this.createWorker = function (session) {
  1584. var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
  1585. worker.attachToDocument(session.getDocument());
  1586. worker.on("annotate", function (results) {
  1587. session.setAnnotations(results.data);
  1588. });
  1589. worker.on("terminate", function () {
  1590. session.clearAnnotations();
  1591. });
  1592. return worker;
  1593. };
  1594. this.$id = "ace/mode/javascript";
  1595. this.snippetFileId = "ace/snippets/javascript";
  1596. }).call(Mode.prototype);
  1597. exports.Mode = Mode;
  1598. });
  1599. ace.define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module){"use strict";
  1600. var propertyMap = {
  1601. "background": { "#$0": 1 },
  1602. "background-color": { "#$0": 1, "transparent": 1, "fixed": 1 },
  1603. "background-image": { "url('/$0')": 1 },
  1604. "background-repeat": { "repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1 },
  1605. "background-position": { "bottom": 2, "center": 2, "left": 2, "right": 2, "top": 2, "inherit": 2 },
  1606. "background-attachment": { "scroll": 1, "fixed": 1 },
  1607. "background-size": { "cover": 1, "contain": 1 },
  1608. "background-clip": { "border-box": 1, "padding-box": 1, "content-box": 1 },
  1609. "background-origin": { "border-box": 1, "padding-box": 1, "content-box": 1 },
  1610. "border": { "solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1 },
  1611. "border-color": { "#$0": 1 },
  1612. "border-style": { "solid": 2, "dashed": 2, "dotted": 2, "double": 2, "groove": 2, "hidden": 2, "inherit": 2, "inset": 2, "none": 2, "outset": 2, "ridged": 2 },
  1613. "border-collapse": { "collapse": 1, "separate": 1 },
  1614. "bottom": { "px": 1, "em": 1, "%": 1 },
  1615. "clear": { "left": 1, "right": 1, "both": 1, "none": 1 },
  1616. "color": { "#$0": 1, "rgb(#$00,0,0)": 1 },
  1617. "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 },
  1618. "display": { "none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1 },
  1619. "empty-cells": { "show": 1, "hide": 1 },
  1620. "float": { "left": 1, "right": 1, "none": 1 },
  1621. "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 },
  1622. "font-size": { "px": 1, "em": 1, "%": 1 },
  1623. "font-weight": { "bold": 1, "normal": 1 },
  1624. "font-style": { "italic": 1, "normal": 1 },
  1625. "font-variant": { "normal": 1, "small-caps": 1 },
  1626. "height": { "px": 1, "em": 1, "%": 1 },
  1627. "left": { "px": 1, "em": 1, "%": 1 },
  1628. "letter-spacing": { "normal": 1 },
  1629. "line-height": { "normal": 1 },
  1630. "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 },
  1631. "margin": { "px": 1, "em": 1, "%": 1 },
  1632. "margin-right": { "px": 1, "em": 1, "%": 1 },
  1633. "margin-left": { "px": 1, "em": 1, "%": 1 },
  1634. "margin-top": { "px": 1, "em": 1, "%": 1 },
  1635. "margin-bottom": { "px": 1, "em": 1, "%": 1 },
  1636. "max-height": { "px": 1, "em": 1, "%": 1 },
  1637. "max-width": { "px": 1, "em": 1, "%": 1 },
  1638. "min-height": { "px": 1, "em": 1, "%": 1 },
  1639. "min-width": { "px": 1, "em": 1, "%": 1 },
  1640. "overflow": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
  1641. "overflow-x": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
  1642. "overflow-y": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
  1643. "padding": { "px": 1, "em": 1, "%": 1 },
  1644. "padding-top": { "px": 1, "em": 1, "%": 1 },
  1645. "padding-right": { "px": 1, "em": 1, "%": 1 },
  1646. "padding-bottom": { "px": 1, "em": 1, "%": 1 },
  1647. "padding-left": { "px": 1, "em": 1, "%": 1 },
  1648. "page-break-after": { "auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1 },
  1649. "page-break-before": { "auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1 },
  1650. "position": { "absolute": 1, "relative": 1, "fixed": 1, "static": 1 },
  1651. "right": { "px": 1, "em": 1, "%": 1 },
  1652. "table-layout": { "fixed": 1, "auto": 1 },
  1653. "text-decoration": { "none": 1, "underline": 1, "line-through": 1, "blink": 1 },
  1654. "text-align": { "left": 1, "right": 1, "center": 1, "justify": 1 },
  1655. "text-transform": { "capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1 },
  1656. "top": { "px": 1, "em": 1, "%": 1 },
  1657. "vertical-align": { "top": 1, "bottom": 1 },
  1658. "visibility": { "hidden": 1, "visible": 1 },
  1659. "white-space": { "nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1 },
  1660. "width": { "px": 1, "em": 1, "%": 1 },
  1661. "word-spacing": { "normal": 1 },
  1662. "filter": { "alpha(opacity=$0100)": 1 },
  1663. "text-shadow": { "$02px 2px 2px #777": 1 },
  1664. "text-overflow": { "ellipsis-word": 1, "clip": 1, "ellipsis": 1 },
  1665. "-moz-border-radius": 1,
  1666. "-moz-border-radius-topright": 1,
  1667. "-moz-border-radius-bottomright": 1,
  1668. "-moz-border-radius-topleft": 1,
  1669. "-moz-border-radius-bottomleft": 1,
  1670. "-webkit-border-radius": 1,
  1671. "-webkit-border-top-right-radius": 1,
  1672. "-webkit-border-top-left-radius": 1,
  1673. "-webkit-border-bottom-right-radius": 1,
  1674. "-webkit-border-bottom-left-radius": 1,
  1675. "-moz-box-shadow": 1,
  1676. "-webkit-box-shadow": 1,
  1677. "transform": { "rotate($00deg)": 1, "skew($00deg)": 1 },
  1678. "-moz-transform": { "rotate($00deg)": 1, "skew($00deg)": 1 },
  1679. "-webkit-transform": { "rotate($00deg)": 1, "skew($00deg)": 1 }
  1680. };
  1681. var CssCompletions = function () {
  1682. };
  1683. (function () {
  1684. this.completionsDefined = false;
  1685. this.defineCompletions = function () {
  1686. if (document) {
  1687. var style = document.createElement('c').style;
  1688. for (var i in style) {
  1689. if (typeof style[i] !== 'string')
  1690. continue;
  1691. var name = i.replace(/[A-Z]/g, function (x) {
  1692. return '-' + x.toLowerCase();
  1693. });
  1694. if (!propertyMap.hasOwnProperty(name))
  1695. propertyMap[name] = 1;
  1696. }
  1697. }
  1698. this.completionsDefined = true;
  1699. };
  1700. this.getCompletions = function (state, session, pos, prefix) {
  1701. if (!this.completionsDefined) {
  1702. this.defineCompletions();
  1703. }
  1704. if (state === 'ruleset' || session.$mode.$id == "ace/mode/scss") {
  1705. var line = session.getLine(pos.row).substr(0, pos.column);
  1706. var inParens = /\([^)]*$/.test(line);
  1707. if (inParens) {
  1708. line = line.substr(line.lastIndexOf('(') + 1);
  1709. }
  1710. if (/:[^;]+$/.test(line)) {
  1711. /([\w\-]+):[^:]*$/.test(line);
  1712. return this.getPropertyValueCompletions(state, session, pos, prefix);
  1713. }
  1714. else {
  1715. return this.getPropertyCompletions(state, session, pos, prefix, inParens);
  1716. }
  1717. }
  1718. return [];
  1719. };
  1720. this.getPropertyCompletions = function (state, session, pos, prefix, skipSemicolon) {
  1721. skipSemicolon = skipSemicolon || false;
  1722. var properties = Object.keys(propertyMap);
  1723. return properties.map(function (property) {
  1724. return {
  1725. caption: property,
  1726. snippet: property + ': $0' + (skipSemicolon ? '' : ';'),
  1727. meta: "property",
  1728. score: 1000000
  1729. };
  1730. });
  1731. };
  1732. this.getPropertyValueCompletions = function (state, session, pos, prefix) {
  1733. var line = session.getLine(pos.row).substr(0, pos.column);
  1734. var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
  1735. if (!property)
  1736. return [];
  1737. var values = [];
  1738. if (property in propertyMap && typeof propertyMap[property] === "object") {
  1739. values = Object.keys(propertyMap[property]);
  1740. }
  1741. return values.map(function (value) {
  1742. return {
  1743. caption: value,
  1744. snippet: value,
  1745. meta: "property value",
  1746. score: 1000000
  1747. };
  1748. });
  1749. };
  1750. }).call(CssCompletions.prototype);
  1751. exports.CssCompletions = CssCompletions;
  1752. });
  1753. 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";
  1754. var oop = require("../../lib/oop");
  1755. var Behaviour = require("../behaviour").Behaviour;
  1756. var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
  1757. var TokenIterator = require("../../token_iterator").TokenIterator;
  1758. var CssBehaviour = function () {
  1759. this.inherit(CstyleBehaviour);
  1760. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1761. if (text === ':' && editor.selection.isEmpty()) {
  1762. var cursor = editor.getCursorPosition();
  1763. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1764. var token = iterator.getCurrentToken();
  1765. if (token && token.value.match(/\s+/)) {
  1766. token = iterator.stepBackward();
  1767. }
  1768. if (token && token.type === 'support.type') {
  1769. var line = session.doc.getLine(cursor.row);
  1770. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1771. if (rightChar === ':') {
  1772. return {
  1773. text: '',
  1774. selection: [1, 1]
  1775. };
  1776. }
  1777. if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
  1778. return {
  1779. text: ':;',
  1780. selection: [1, 1]
  1781. };
  1782. }
  1783. }
  1784. }
  1785. });
  1786. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1787. var selected = session.doc.getTextRange(range);
  1788. if (!range.isMultiLine() && selected === ':') {
  1789. var cursor = editor.getCursorPosition();
  1790. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1791. var token = iterator.getCurrentToken();
  1792. if (token && token.value.match(/\s+/)) {
  1793. token = iterator.stepBackward();
  1794. }
  1795. if (token && token.type === 'support.type') {
  1796. var line = session.doc.getLine(range.start.row);
  1797. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1798. if (rightChar === ';') {
  1799. range.end.column++;
  1800. return range;
  1801. }
  1802. }
  1803. }
  1804. });
  1805. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1806. if (text === ';' && editor.selection.isEmpty()) {
  1807. var cursor = editor.getCursorPosition();
  1808. var line = session.doc.getLine(cursor.row);
  1809. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1810. if (rightChar === ';') {
  1811. return {
  1812. text: '',
  1813. selection: [1, 1]
  1814. };
  1815. }
  1816. }
  1817. });
  1818. this.add("!important", "insertion", function (state, action, editor, session, text) {
  1819. if (text === '!' && editor.selection.isEmpty()) {
  1820. var cursor = editor.getCursorPosition();
  1821. var line = session.doc.getLine(cursor.row);
  1822. if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
  1823. return {
  1824. text: '!important',
  1825. selection: [10, 10]
  1826. };
  1827. }
  1828. }
  1829. });
  1830. };
  1831. oop.inherits(CssBehaviour, CstyleBehaviour);
  1832. exports.CssBehaviour = CssBehaviour;
  1833. });
  1834. 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";
  1835. var oop = require("../lib/oop");
  1836. var TextMode = require("./text").Mode;
  1837. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1838. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1839. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1840. var CssCompletions = require("./css_completions").CssCompletions;
  1841. var CssBehaviour = require("./behaviour/css").CssBehaviour;
  1842. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1843. var Mode = function () {
  1844. this.HighlightRules = CssHighlightRules;
  1845. this.$outdent = new MatchingBraceOutdent();
  1846. this.$behaviour = new CssBehaviour();
  1847. this.$completer = new CssCompletions();
  1848. this.foldingRules = new CStyleFoldMode();
  1849. };
  1850. oop.inherits(Mode, TextMode);
  1851. (function () {
  1852. this.foldingRules = "cStyle";
  1853. this.blockComment = { start: "/*", end: "*/" };
  1854. this.getNextLineIndent = function (state, line, tab) {
  1855. var indent = this.$getIndent(line);
  1856. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1857. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  1858. return indent;
  1859. }
  1860. var match = line.match(/^.*\{\s*$/);
  1861. if (match) {
  1862. indent += tab;
  1863. }
  1864. return indent;
  1865. };
  1866. this.checkOutdent = function (state, line, input) {
  1867. return this.$outdent.checkOutdent(line, input);
  1868. };
  1869. this.autoOutdent = function (state, doc, row) {
  1870. this.$outdent.autoOutdent(doc, row);
  1871. };
  1872. this.getCompletions = function (state, session, pos, prefix) {
  1873. return this.$completer.getCompletions(state, session, pos, prefix);
  1874. };
  1875. this.createWorker = function (session) {
  1876. var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
  1877. worker.attachToDocument(session.getDocument());
  1878. worker.on("annotate", function (e) {
  1879. session.setAnnotations(e.data);
  1880. });
  1881. worker.on("terminate", function () {
  1882. session.clearAnnotations();
  1883. });
  1884. return worker;
  1885. };
  1886. this.$id = "ace/mode/css";
  1887. this.snippetFileId = "ace/snippets/css";
  1888. }).call(Mode.prototype);
  1889. exports.Mode = Mode;
  1890. });
  1891. ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
  1892. var oop = require("../../lib/oop");
  1893. var BaseFoldMode = require("./fold_mode").FoldMode;
  1894. var FoldMode = exports.FoldMode = function (defaultMode, subModes) {
  1895. this.defaultMode = defaultMode;
  1896. this.subModes = subModes;
  1897. };
  1898. oop.inherits(FoldMode, BaseFoldMode);
  1899. (function () {
  1900. this.$getMode = function (state) {
  1901. if (typeof state != "string")
  1902. state = state[0];
  1903. for (var key in this.subModes) {
  1904. if (state.indexOf(key) === 0)
  1905. return this.subModes[key];
  1906. }
  1907. return null;
  1908. };
  1909. this.$tryMode = function (state, session, foldStyle, row) {
  1910. var mode = this.$getMode(state);
  1911. return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
  1912. };
  1913. this.getFoldWidget = function (session, foldStyle, row) {
  1914. return (this.$tryMode(session.getState(row - 1), session, foldStyle, row) ||
  1915. this.$tryMode(session.getState(row), session, foldStyle, row) ||
  1916. this.defaultMode.getFoldWidget(session, foldStyle, row));
  1917. };
  1918. this.getFoldWidgetRange = function (session, foldStyle, row) {
  1919. var mode = this.$getMode(session.getState(row - 1));
  1920. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1921. mode = this.$getMode(session.getState(row));
  1922. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1923. mode = this.defaultMode;
  1924. return mode.getFoldWidgetRange(session, foldStyle, row);
  1925. };
  1926. }).call(FoldMode.prototype);
  1927. });
  1928. 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";
  1929. var oop = require("../../lib/oop");
  1930. var MixedFoldMode = require("./mixed").FoldMode;
  1931. var XmlFoldMode = require("./xml").FoldMode;
  1932. var CStyleFoldMode = require("./cstyle").FoldMode;
  1933. var FoldMode = exports.FoldMode = function (voidElements, optionalTags) {
  1934. MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
  1935. "js-": new CStyleFoldMode(),
  1936. "css-": new CStyleFoldMode()
  1937. });
  1938. };
  1939. oop.inherits(FoldMode, MixedFoldMode);
  1940. });
  1941. ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module){"use strict";
  1942. var TokenIterator = require("../token_iterator").TokenIterator;
  1943. var commonAttributes = [
  1944. "accesskey",
  1945. "class",
  1946. "contenteditable",
  1947. "contextmenu",
  1948. "dir",
  1949. "draggable",
  1950. "dropzone",
  1951. "hidden",
  1952. "id",
  1953. "inert",
  1954. "itemid",
  1955. "itemprop",
  1956. "itemref",
  1957. "itemscope",
  1958. "itemtype",
  1959. "lang",
  1960. "spellcheck",
  1961. "style",
  1962. "tabindex",
  1963. "title",
  1964. "translate"
  1965. ];
  1966. var eventAttributes = [
  1967. "onabort",
  1968. "onblur",
  1969. "oncancel",
  1970. "oncanplay",
  1971. "oncanplaythrough",
  1972. "onchange",
  1973. "onclick",
  1974. "onclose",
  1975. "oncontextmenu",
  1976. "oncuechange",
  1977. "ondblclick",
  1978. "ondrag",
  1979. "ondragend",
  1980. "ondragenter",
  1981. "ondragleave",
  1982. "ondragover",
  1983. "ondragstart",
  1984. "ondrop",
  1985. "ondurationchange",
  1986. "onemptied",
  1987. "onended",
  1988. "onerror",
  1989. "onfocus",
  1990. "oninput",
  1991. "oninvalid",
  1992. "onkeydown",
  1993. "onkeypress",
  1994. "onkeyup",
  1995. "onload",
  1996. "onloadeddata",
  1997. "onloadedmetadata",
  1998. "onloadstart",
  1999. "onmousedown",
  2000. "onmousemove",
  2001. "onmouseout",
  2002. "onmouseover",
  2003. "onmouseup",
  2004. "onmousewheel",
  2005. "onpause",
  2006. "onplay",
  2007. "onplaying",
  2008. "onprogress",
  2009. "onratechange",
  2010. "onreset",
  2011. "onscroll",
  2012. "onseeked",
  2013. "onseeking",
  2014. "onselect",
  2015. "onshow",
  2016. "onstalled",
  2017. "onsubmit",
  2018. "onsuspend",
  2019. "ontimeupdate",
  2020. "onvolumechange",
  2021. "onwaiting"
  2022. ];
  2023. var globalAttributes = commonAttributes.concat(eventAttributes);
  2024. var attributeMap = {
  2025. "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 },
  2026. "abbr": {},
  2027. "address": {},
  2028. "area": { "shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1 },
  2029. "article": { "pubdate": 1 },
  2030. "aside": {},
  2031. "audio": { "src": 1, "autobuffer": 1, "autoplay": { "autoplay": 1 }, "loop": { "loop": 1 }, "controls": { "controls": 1 }, "muted": { "muted": 1 }, "preload": { "auto": 1, "metadata": 1, "none": 1 } },
  2032. "b": {},
  2033. "base": { "href": 1, "target": 1 },
  2034. "bdi": {},
  2035. "bdo": {},
  2036. "blockquote": { "cite": 1 },
  2037. "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 },
  2038. "br": {},
  2039. "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 } },
  2040. "canvas": { "width": 1, "height": 1 },
  2041. "caption": {},
  2042. "cite": {},
  2043. "code": {},
  2044. "col": { "span": 1 },
  2045. "colgroup": { "span": 1 },
  2046. "command": { "type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1 },
  2047. "data": {},
  2048. "datalist": {},
  2049. "dd": {},
  2050. "del": { "cite": 1, "datetime": 1 },
  2051. "details": { "open": 1 },
  2052. "dfn": {},
  2053. "dialog": { "open": 1 },
  2054. "div": {},
  2055. "dl": {},
  2056. "dt": {},
  2057. "em": {},
  2058. "embed": { "src": 1, "height": 1, "width": 1, "type": 1 },
  2059. "fieldset": { "disabled": 1, "form": 1, "name": 1 },
  2060. "figcaption": {},
  2061. "figure": {},
  2062. "footer": {},
  2063. "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 } },
  2064. "h1": {},
  2065. "h2": {},
  2066. "h3": {},
  2067. "h4": {},
  2068. "h5": {},
  2069. "h6": {},
  2070. "head": {},
  2071. "header": {},
  2072. "hr": {},
  2073. "html": { "manifest": 1 },
  2074. "i": {},
  2075. "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 } },
  2076. "img": { "alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1 },
  2077. "input": {
  2078. "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 },
  2079. "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
  2080. },
  2081. "ins": { "cite": 1, "datetime": 1 },
  2082. "kbd": {},
  2083. "keygen": { "autofocus": 1, "challenge": { "challenge": 1 }, "disabled": { "disabled": 1 }, "form": 1, "keytype": { "rsa": 1, "dsa": 1, "ec": 1 }, "name": 1 },
  2084. "label": { "form": 1, "for": 1 },
  2085. "legend": {},
  2086. "li": { "value": 1 },
  2087. "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 },
  2088. "main": {},
  2089. "map": { "name": 1 },
  2090. "mark": {},
  2091. "math": {},
  2092. "menu": { "type": 1, "label": 1 },
  2093. "meta": { "http-equiv": { "content-type": 1 }, "name": { "description": 1, "keywords": 1 }, "content": { "text/html; charset=UTF-8": 1 }, "charset": 1 },
  2094. "meter": { "value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1 },
  2095. "nav": {},
  2096. "noscript": { "href": 1 },
  2097. "object": { "param": 1, "data": 1, "type": 1, "height": 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1 },
  2098. "ol": { "start": 1, "reversed": 1 },
  2099. "optgroup": { "disabled": 1, "label": 1 },
  2100. "option": { "disabled": 1, "selected": 1, "label": 1, "value": 1 },
  2101. "output": { "for": 1, "form": 1, "name": 1 },
  2102. "p": {},
  2103. "param": { "name": 1, "value": 1 },
  2104. "pre": {},
  2105. "progress": { "value": 1, "max": 1 },
  2106. "q": { "cite": 1 },
  2107. "rp": {},
  2108. "rt": {},
  2109. "ruby": {},
  2110. "s": {},
  2111. "samp": {},
  2112. "script": { "charset": 1, "type": { "text/javascript": 1 }, "src": 1, "defer": 1, "async": 1 },
  2113. "select": { "autofocus": 1, "disabled": 1, "form": 1, "multiple": { "multiple": 1 }, "name": 1, "size": 1, "readonly": { "readonly": 1 } },
  2114. "small": {},
  2115. "source": { "src": 1, "type": 1, "media": 1 },
  2116. "span": {},
  2117. "strong": {},
  2118. "style": { "type": 1, "media": { "all": 1, "screen": 1, "print": 1 }, "scoped": 1 },
  2119. "sub": {},
  2120. "sup": {},
  2121. "svg": {},
  2122. "table": { "summary": 1 },
  2123. "tbody": {},
  2124. "td": { "headers": 1, "rowspan": 1, "colspan": 1 },
  2125. "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 } },
  2126. "tfoot": {},
  2127. "th": { "headers": 1, "rowspan": 1, "colspan": 1, "scope": 1 },
  2128. "thead": {},
  2129. "time": { "datetime": 1 },
  2130. "title": {},
  2131. "tr": {},
  2132. "track": { "kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1 },
  2133. "section": {},
  2134. "summary": {},
  2135. "u": {},
  2136. "ul": {},
  2137. "var": {},
  2138. "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 } },
  2139. "wbr": {}
  2140. };
  2141. var elements = Object.keys(attributeMap);
  2142. function is(token, type) {
  2143. return token.type.lastIndexOf(type + ".xml") > -1;
  2144. }
  2145. function findTagName(session, pos) {
  2146. var iterator = new TokenIterator(session, pos.row, pos.column);
  2147. var token = iterator.getCurrentToken();
  2148. while (token && !is(token, "tag-name")) {
  2149. token = iterator.stepBackward();
  2150. }
  2151. if (token)
  2152. return token.value;
  2153. }
  2154. function findAttributeName(session, pos) {
  2155. var iterator = new TokenIterator(session, pos.row, pos.column);
  2156. var token = iterator.getCurrentToken();
  2157. while (token && !is(token, "attribute-name")) {
  2158. token = iterator.stepBackward();
  2159. }
  2160. if (token)
  2161. return token.value;
  2162. }
  2163. var HtmlCompletions = function () {
  2164. };
  2165. (function () {
  2166. this.getCompletions = function (state, session, pos, prefix) {
  2167. var token = session.getTokenAt(pos.row, pos.column);
  2168. if (!token)
  2169. return [];
  2170. if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
  2171. return this.getTagCompletions(state, session, pos, prefix);
  2172. if (is(token, "tag-whitespace") || is(token, "attribute-name"))
  2173. return this.getAttributeCompletions(state, session, pos, prefix);
  2174. if (is(token, "attribute-value"))
  2175. return this.getAttributeValueCompletions(state, session, pos, prefix);
  2176. var line = session.getLine(pos.row).substr(0, pos.column);
  2177. if (/&[a-z]*$/i.test(line))
  2178. return this.getHTMLEntityCompletions(state, session, pos, prefix);
  2179. return [];
  2180. };
  2181. this.getTagCompletions = function (state, session, pos, prefix) {
  2182. return elements.map(function (element) {
  2183. return {
  2184. value: element,
  2185. meta: "tag",
  2186. score: 1000000
  2187. };
  2188. });
  2189. };
  2190. this.getAttributeCompletions = function (state, session, pos, prefix) {
  2191. var tagName = findTagName(session, pos);
  2192. if (!tagName)
  2193. return [];
  2194. var attributes = globalAttributes;
  2195. if (tagName in attributeMap) {
  2196. attributes = attributes.concat(Object.keys(attributeMap[tagName]));
  2197. }
  2198. return attributes.map(function (attribute) {
  2199. return {
  2200. caption: attribute,
  2201. snippet: attribute + '="$0"',
  2202. meta: "attribute",
  2203. score: 1000000
  2204. };
  2205. });
  2206. };
  2207. this.getAttributeValueCompletions = function (state, session, pos, prefix) {
  2208. var tagName = findTagName(session, pos);
  2209. var attributeName = findAttributeName(session, pos);
  2210. if (!tagName)
  2211. return [];
  2212. var values = [];
  2213. if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
  2214. values = Object.keys(attributeMap[tagName][attributeName]);
  2215. }
  2216. return values.map(function (value) {
  2217. return {
  2218. caption: value,
  2219. snippet: value,
  2220. meta: "attribute value",
  2221. score: 1000000
  2222. };
  2223. });
  2224. };
  2225. this.getHTMLEntityCompletions = function (state, session, pos, prefix) {
  2226. 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;'];
  2227. return values.map(function (value) {
  2228. return {
  2229. caption: value,
  2230. snippet: value,
  2231. meta: "html entity",
  2232. score: 1000000
  2233. };
  2234. });
  2235. };
  2236. }).call(HtmlCompletions.prototype);
  2237. exports.HtmlCompletions = HtmlCompletions;
  2238. });
  2239. 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";
  2240. var oop = require("../lib/oop");
  2241. var lang = require("../lib/lang");
  2242. var TextMode = require("./text").Mode;
  2243. var JavaScriptMode = require("./javascript").Mode;
  2244. var CssMode = require("./css").Mode;
  2245. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2246. var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
  2247. var HtmlFoldMode = require("./folding/html").FoldMode;
  2248. var HtmlCompletions = require("./html_completions").HtmlCompletions;
  2249. var WorkerClient = require("../worker/worker_client").WorkerClient;
  2250. var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
  2251. var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
  2252. var Mode = function (options) {
  2253. this.fragmentContext = options && options.fragmentContext;
  2254. this.HighlightRules = HtmlHighlightRules;
  2255. this.$behaviour = new XmlBehaviour();
  2256. this.$completer = new HtmlCompletions();
  2257. this.createModeDelegates({
  2258. "js-": JavaScriptMode,
  2259. "css-": CssMode
  2260. });
  2261. this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
  2262. };
  2263. oop.inherits(Mode, TextMode);
  2264. (function () {
  2265. this.blockComment = { start: "<!--", end: "-->" };
  2266. this.voidElements = lang.arrayToMap(voidElements);
  2267. this.getNextLineIndent = function (state, line, tab) {
  2268. return this.$getIndent(line);
  2269. };
  2270. this.checkOutdent = function (state, line, input) {
  2271. return false;
  2272. };
  2273. this.getCompletions = function (state, session, pos, prefix) {
  2274. return this.$completer.getCompletions(state, session, pos, prefix);
  2275. };
  2276. this.createWorker = function (session) {
  2277. if (this.constructor != Mode)
  2278. return;
  2279. var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
  2280. worker.attachToDocument(session.getDocument());
  2281. if (this.fragmentContext)
  2282. worker.call("setOptions", [{ context: this.fragmentContext }]);
  2283. worker.on("error", function (e) {
  2284. session.setAnnotations(e.data);
  2285. });
  2286. worker.on("terminate", function () {
  2287. session.clearAnnotations();
  2288. });
  2289. return worker;
  2290. };
  2291. this.$id = "ace/mode/html";
  2292. this.snippetFileId = "ace/snippets/html";
  2293. }).call(Mode.prototype);
  2294. exports.Mode = Mode;
  2295. });
  2296. ace.define("ace/mode/ruby_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  2297. var oop = require("../lib/oop");
  2298. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  2299. var constantOtherSymbol = exports.constantOtherSymbol = {
  2300. token: "constant.other.symbol.ruby", // symbol
  2301. regex: "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"
  2302. };
  2303. exports.qString = {
  2304. token: "string", // single line
  2305. regex: "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  2306. };
  2307. exports.qqString = {
  2308. token: "string", // single line
  2309. regex: '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  2310. };
  2311. exports.tString = {
  2312. token: "string", // backtick string
  2313. regex: "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"
  2314. };
  2315. var constantNumericHex = exports.constantNumericHex = {
  2316. token: "constant.numeric", // hex
  2317. regex: "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b"
  2318. };
  2319. var constantNumericBinary = exports.constantNumericBinary = {
  2320. token: "constant.numeric",
  2321. regex: /\b(0[bB][01](?:[01]|_(?=[01]))*)\b/
  2322. };
  2323. var constantNumericDecimal = exports.constantNumericDecimal = {
  2324. token: "constant.numeric",
  2325. regex: /\b(0[dD](?:[1-9](?:[\d]|_(?=[\d]))*|0))\b/
  2326. };
  2327. var constantNumericOctal = exports.constantNumericOctal = {
  2328. token: "constant.numeric",
  2329. regex: /\b(0[oO]?(?:[1-7](?:[0-7]|_(?=[0-7]))*|0))\b/
  2330. };
  2331. var constantNumericRational = exports.constantNumericRational = {
  2332. token: "constant.numeric", //rational + complex
  2333. regex: /\b([\d]+(?:[./][\d]+)?ri?)\b/
  2334. };
  2335. var constantNumericComplex = exports.constantNumericComplex = {
  2336. token: "constant.numeric", //simple complex numbers
  2337. regex: /\b([\d]i)\b/
  2338. };
  2339. var constantNumericFloat = exports.constantNumericFloat = {
  2340. token: "constant.numeric", // float + complex
  2341. regex: "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?i?\\b"
  2342. };
  2343. var instanceVariable = exports.instanceVariable = {
  2344. token: "variable.instance", // instance variable
  2345. regex: "@{1,2}[a-zA-Z_\\d]+"
  2346. };
  2347. var RubyHighlightRules = function () {
  2348. var builtinFunctions = ("abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
  2349. "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
  2350. "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" +
  2351. "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" +
  2352. "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" +
  2353. "assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" +
  2354. "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" +
  2355. "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" +
  2356. "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" +
  2357. "gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" +
  2358. "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" +
  2359. "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" +
  2360. "raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|" +
  2361. "set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" +
  2362. "throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" +
  2363. "render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" +
  2364. "content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" +
  2365. "fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" +
  2366. "time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" +
  2367. "select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" +
  2368. "file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" +
  2369. "protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" +
  2370. "send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" +
  2371. "validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" +
  2372. "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" +
  2373. "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" +
  2374. "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" +
  2375. "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" +
  2376. "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" +
  2377. "has_many|has_one|belongs_to|has_and_belongs_to_many|p|warn|refine|using|module_function|extend|alias_method|" +
  2378. "private_class_method|remove_method|undef_method");
  2379. var keywords = ("alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" +
  2380. "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" +
  2381. "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield|__ENCODING__|prepend");
  2382. var buildinConstants = ("true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
  2383. "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING|RUBY_PATCHLEVEL|RUBY_REVISION|RUBY_COPYRIGHT|RUBY_ENGINE|RUBY_ENGINE_VERSION|RUBY_DESCRIPTION");
  2384. var builtinVariables = ("$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE|" +
  2385. "$!|root_url|flash|session|cookies|params|request|response|logger|self");
  2386. var keywordMapper = this.$keywords = this.createKeywordMapper({
  2387. "keyword": keywords,
  2388. "constant.language": buildinConstants,
  2389. "variable.language": builtinVariables,
  2390. "support.function": builtinFunctions,
  2391. "invalid.deprecated": "debugger" // TODO is this a remnant from js mode?
  2392. }, "identifier");
  2393. var escapedChars = "\\\\(?:n(?:[1-7][0-7]{0,2}|0)|[nsrtvfbae'\"\\\\]|c(?:\\\\M-)?.|M-(?:\\\\C-|\\\\c)?.|C-(?:\\\\M-)?.|[0-7]{3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|u{[\\da-fA-F]{1,6}(?:\\s[\\da-fA-F]{1,6})*})";
  2394. var closeParen = {
  2395. "(": ")",
  2396. "[": "]",
  2397. "{": "}",
  2398. "<": ">",
  2399. "^": "^",
  2400. "|": "|",
  2401. "%": "%"
  2402. };
  2403. this.$rules = {
  2404. "start": [
  2405. {
  2406. token: "comment",
  2407. regex: "#.*$"
  2408. }, {
  2409. token: "comment.multiline", // multi line comment
  2410. regex: "^=begin(?=$|\\s.*$)",
  2411. next: "comment"
  2412. }, {
  2413. token: "string.regexp",
  2414. regex: /[/](?=.*\/)/,
  2415. next: "regex"
  2416. },
  2417. [{
  2418. token: ["constant.other.symbol.ruby", "string.start"],
  2419. regex: /(:)?(")/,
  2420. push: [{
  2421. token: "constant.language.escape",
  2422. regex: escapedChars
  2423. }, {
  2424. token: "paren.start",
  2425. regex: /#{/,
  2426. push: "start"
  2427. }, {
  2428. token: "string.end",
  2429. regex: /"/,
  2430. next: "pop"
  2431. }, {
  2432. defaultToken: "string"
  2433. }]
  2434. }, {
  2435. token: "string.start",
  2436. regex: /`/,
  2437. push: [{
  2438. token: "constant.language.escape",
  2439. regex: escapedChars
  2440. }, {
  2441. token: "paren.start",
  2442. regex: /#{/,
  2443. push: "start"
  2444. }, {
  2445. token: "string.end",
  2446. regex: /`/,
  2447. next: "pop"
  2448. }, {
  2449. defaultToken: "string"
  2450. }]
  2451. }, {
  2452. token: ["constant.other.symbol.ruby", "string.start"],
  2453. regex: /(:)?(')/,
  2454. push: [{
  2455. token: "constant.language.escape",
  2456. regex: /\\['\\]/
  2457. }, {
  2458. token: "string.end",
  2459. regex: /'/,
  2460. next: "pop"
  2461. }, {
  2462. defaultToken: "string"
  2463. }]
  2464. }, {
  2465. token: "string.start", //doesn't see any differences between strings and array of strings in highlighting
  2466. regex: /%[qwx]([(\[<{^|%])/, onMatch: function (val, state, stack) {
  2467. if (stack.length)
  2468. stack = [];
  2469. var paren = val[val.length - 1];
  2470. stack.unshift(paren, state);
  2471. this.next = "qStateWithoutInterpolation";
  2472. return this.token;
  2473. }
  2474. }, {
  2475. token: "string.start", //doesn't see any differences between strings and array of strings in highlighting
  2476. regex: /%[QWX]?([(\[<{^|%])/, onMatch: function (val, state, stack) {
  2477. if (stack.length)
  2478. stack = [];
  2479. var paren = val[val.length - 1];
  2480. stack.unshift(paren, state);
  2481. this.next = "qStateWithInterpolation";
  2482. return this.token;
  2483. }
  2484. }, {
  2485. token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting
  2486. regex: /%[si]([(\[<{^|%])/, onMatch: function (val, state, stack) {
  2487. if (stack.length)
  2488. stack = [];
  2489. var paren = val[val.length - 1];
  2490. stack.unshift(paren, state);
  2491. this.next = "sStateWithoutInterpolation";
  2492. return this.token;
  2493. }
  2494. }, {
  2495. token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting
  2496. regex: /%[SI]([(\[<{^|%])/, onMatch: function (val, state, stack) {
  2497. if (stack.length)
  2498. stack = [];
  2499. var paren = val[val.length - 1];
  2500. stack.unshift(paren, state);
  2501. this.next = "sStateWithInterpolation";
  2502. return this.token;
  2503. }
  2504. }, {
  2505. token: "string.regexp",
  2506. regex: /%[r]([(\[<{^|%])/, onMatch: function (val, state, stack) {
  2507. if (stack.length)
  2508. stack = [];
  2509. var paren = val[val.length - 1];
  2510. stack.unshift(paren, state);
  2511. this.next = "rState";
  2512. return this.token;
  2513. }
  2514. }],
  2515. {
  2516. token: "punctuation", // namespaces aren't symbols
  2517. regex: "::"
  2518. },
  2519. instanceVariable,
  2520. {
  2521. token: "variable.global", // global variable
  2522. regex: "[$][a-zA-Z_\\d]+"
  2523. }, {
  2524. token: "support.class", // class name
  2525. regex: "[A-Z][a-zA-Z_\\d]*"
  2526. }, {
  2527. token: ["punctuation.operator", "support.function"],
  2528. regex: /(\.)([a-zA-Z_\d]+)(?=\()/
  2529. }, {
  2530. token: ["punctuation.operator", "identifier"],
  2531. regex: /(\.)([a-zA-Z_][a-zA-Z_\d]*)/
  2532. }, {
  2533. token: "string.character",
  2534. regex: "\\B\\?(?:" + escapedChars + "|\\S)"
  2535. }, {
  2536. token: "punctuation.operator",
  2537. regex: /\?(?=.+:)/
  2538. },
  2539. constantNumericRational,
  2540. constantNumericComplex,
  2541. constantOtherSymbol,
  2542. constantNumericHex,
  2543. constantNumericFloat,
  2544. constantNumericBinary,
  2545. constantNumericDecimal,
  2546. constantNumericOctal,
  2547. {
  2548. token: "constant.language.boolean",
  2549. regex: "(?:true|false)\\b"
  2550. }, {
  2551. token: keywordMapper,
  2552. regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  2553. }, {
  2554. token: "punctuation.separator.key-value",
  2555. regex: "=>"
  2556. }, {
  2557. stateName: "heredoc",
  2558. onMatch: function (value, currentState, stack) {
  2559. var next = (value[2] == '-' || value[2] == '~') ? "indentedHeredoc" : "heredoc";
  2560. var tokens = value.split(this.splitRegex);
  2561. stack.push(next, tokens[3]);
  2562. return [
  2563. { type: "constant", value: tokens[1] },
  2564. { type: "string", value: tokens[2] },
  2565. { type: "support.class", value: tokens[3] },
  2566. { type: "string", value: tokens[4] }
  2567. ];
  2568. },
  2569. regex: "(<<[-~]?)(['\"`]?)([\\w]+)(['\"`]?)",
  2570. rules: {
  2571. heredoc: [{
  2572. onMatch: function (value, currentState, stack) {
  2573. if (value === stack[1]) {
  2574. stack.shift();
  2575. stack.shift();
  2576. this.next = stack[0] || "start";
  2577. return "support.class";
  2578. }
  2579. this.next = "";
  2580. return "string";
  2581. },
  2582. regex: ".*$",
  2583. next: "start"
  2584. }],
  2585. indentedHeredoc: [{
  2586. token: "string",
  2587. regex: "^ +"
  2588. }, {
  2589. onMatch: function (value, currentState, stack) {
  2590. if (value === stack[1]) {
  2591. stack.shift();
  2592. stack.shift();
  2593. this.next = stack[0] || "start";
  2594. return "support.class";
  2595. }
  2596. this.next = "";
  2597. return "string";
  2598. },
  2599. regex: ".*$",
  2600. next: "start"
  2601. }]
  2602. }
  2603. }, {
  2604. regex: "$",
  2605. token: "empty",
  2606. next: function (currentState, stack) {
  2607. if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
  2608. return stack[0];
  2609. return currentState;
  2610. }
  2611. }, {
  2612. token: "keyword.operator",
  2613. regex: "!|\\$|%|&|\\*|/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\||\\b(?:in|instanceof|new|delete|typeof|void)"
  2614. }, {
  2615. token: "paren.lparen",
  2616. regex: "[[({]"
  2617. }, {
  2618. token: "paren.rparen",
  2619. regex: "[\\])}]",
  2620. onMatch: function (value, currentState, stack) {
  2621. this.next = '';
  2622. if (value == "}" && stack.length > 1 && stack[1] != "start") {
  2623. stack.shift();
  2624. this.next = stack.shift();
  2625. }
  2626. return this.token;
  2627. }
  2628. }, {
  2629. token: "text",
  2630. regex: "\\s+"
  2631. }, {
  2632. token: "punctuation.operator",
  2633. regex: /[?:,;.]/
  2634. }
  2635. ],
  2636. "comment": [
  2637. {
  2638. token: "comment.multiline", // closing comment
  2639. regex: "^=end(?=$|\\s.*$)",
  2640. next: "start"
  2641. }, {
  2642. token: "comment", // comment spanning whole line
  2643. regex: ".+"
  2644. }
  2645. ],
  2646. "qStateWithInterpolation": [{
  2647. token: "string.start", // excluded nested |^% due to difficulty in realization
  2648. regex: /[(\[<{]/, onMatch: function (val, state, stack) {
  2649. if (stack.length && val === stack[0]) {
  2650. stack.unshift(val, state);
  2651. return this.token;
  2652. }
  2653. return "string";
  2654. }
  2655. }, {
  2656. token: "constant.language.escape",
  2657. regex: escapedChars
  2658. }, {
  2659. token: "constant.language.escape",
  2660. regex: /\\./
  2661. }, {
  2662. token: "paren.start",
  2663. regex: /#{/,
  2664. push: "start"
  2665. }, {
  2666. token: "string.end",
  2667. regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) {
  2668. if (stack.length && val === closeParen[stack[0]]) {
  2669. stack.shift();
  2670. this.next = stack.shift();
  2671. return this.token;
  2672. }
  2673. this.next = '';
  2674. return "string";
  2675. }
  2676. }, {
  2677. defaultToken: "string"
  2678. }],
  2679. "qStateWithoutInterpolation": [{
  2680. token: "string.start", // excluded nested |^% due to difficulty in realization
  2681. regex: /[(\[<{]/, onMatch: function (val, state, stack) {
  2682. if (stack.length && val === stack[0]) {
  2683. stack.unshift(val, state);
  2684. return this.token;
  2685. }
  2686. return "string";
  2687. }
  2688. }, {
  2689. token: "constant.language.escape",
  2690. regex: /\\['\\]/
  2691. }, {
  2692. token: "constant.language.escape",
  2693. regex: /\\./
  2694. }, {
  2695. token: "string.end",
  2696. regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) {
  2697. if (stack.length && val === closeParen[stack[0]]) {
  2698. stack.shift();
  2699. this.next = stack.shift();
  2700. return this.token;
  2701. }
  2702. this.next = '';
  2703. return "string";
  2704. }
  2705. }, {
  2706. defaultToken: "string"
  2707. }],
  2708. "sStateWithoutInterpolation": [{
  2709. token: "constant.other.symbol.ruby", // excluded nested |^% due to difficulty in realization
  2710. regex: /[(\[<{]/, onMatch: function (val, state, stack) {
  2711. if (stack.length && val === stack[0]) {
  2712. stack.unshift(val, state);
  2713. return this.token;
  2714. }
  2715. return "constant.other.symbol.ruby";
  2716. }
  2717. }, {
  2718. token: "constant.other.symbol.ruby",
  2719. regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) {
  2720. if (stack.length && val === closeParen[stack[0]]) {
  2721. stack.shift();
  2722. this.next = stack.shift();
  2723. return this.token;
  2724. }
  2725. this.next = '';
  2726. return "constant.other.symbol.ruby";
  2727. }
  2728. }, {
  2729. defaultToken: "constant.other.symbol.ruby"
  2730. }],
  2731. "sStateWithInterpolation": [{
  2732. token: "constant.other.symbol.ruby", // excluded nested |^% due to difficulty in realization
  2733. regex: /[(\[<{]/, onMatch: function (val, state, stack) {
  2734. if (stack.length && val === stack[0]) {
  2735. stack.unshift(val, state);
  2736. return this.token;
  2737. }
  2738. return "constant.other.symbol.ruby";
  2739. }
  2740. }, {
  2741. token: "constant.language.escape",
  2742. regex: escapedChars
  2743. }, {
  2744. token: "constant.language.escape",
  2745. regex: /\\./
  2746. }, {
  2747. token: "paren.start",
  2748. regex: /#{/,
  2749. push: "start"
  2750. }, {
  2751. token: "constant.other.symbol.ruby",
  2752. regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) {
  2753. if (stack.length && val === closeParen[stack[0]]) {
  2754. stack.shift();
  2755. this.next = stack.shift();
  2756. return this.token;
  2757. }
  2758. this.next = '';
  2759. return "constant.other.symbol.ruby";
  2760. }
  2761. }, {
  2762. defaultToken: "constant.other.symbol.ruby"
  2763. }],
  2764. "rState": [{
  2765. token: "string.regexp", // excluded nested |^% due to difficulty in realization
  2766. regex: /[(\[<{]/, onMatch: function (val, state, stack) {
  2767. if (stack.length && val === stack[0]) {
  2768. stack.unshift(val, state);
  2769. return this.token;
  2770. }
  2771. return "constant.language.escape";
  2772. }
  2773. }, {
  2774. token: "paren.start",
  2775. regex: /#{/,
  2776. push: "start"
  2777. }, {
  2778. token: "string.regexp",
  2779. regex: /\//
  2780. }, {
  2781. token: "string.regexp",
  2782. regex: /[)\]>}^|%][imxouesn]*/, onMatch: function (val, state, stack) {
  2783. if (stack.length && val[0] === closeParen[stack[0]]) {
  2784. stack.shift();
  2785. this.next = stack.shift();
  2786. return this.token;
  2787. }
  2788. this.next = '';
  2789. return "constant.language.escape";
  2790. }
  2791. },
  2792. { include: "regex" },
  2793. {
  2794. defaultToken: "string.regexp"
  2795. }],
  2796. "regex": [
  2797. {
  2798. token: "regexp.keyword",
  2799. regex: /\\[wWdDhHsS]/
  2800. }, {
  2801. token: "constant.language.escape",
  2802. regex: /\\[AGbBzZ]/
  2803. }, {
  2804. token: "constant.language.escape",
  2805. regex: /\\g<[a-zA-Z0-9]*>/
  2806. }, {
  2807. token: ["constant.language.escape", "regexp.keyword", "constant.language.escape"],
  2808. regex: /(\\p{\^?)(Alnum|Alpha|Blank|Cntrl|Digit|Graph|Lower|Print|Punct|Space|Upper|XDigit|Word|ASCII|Any|Assigned|Arabic|Armenian|Balinese|Bengali|Bopomofo|Braille|Buginese|Buhid|Canadian_Aboriginal|Carian|Cham|Cherokee|Common|Coptic|Cuneiform|Cypriot|Cyrillic|Deseret|Devanagari|Ethiopic|Georgian|Glagolitic|Gothic|Greek|Gujarati|Gurmukhi|Han|Hangul|Hanunoo|Hebrew|Hiragana|Inherited|Kannada|Katakana|Kayah_Li|Kharoshthi|Khmer|Lao|Latin|Lepcha|Limbu|Linear_B|Lycian|Lydian|Malayalam|Mongolian|Myanmar|New_Tai_Lue|Nko|Ogham|Ol_Chiki|Old_Italic|Old_Persian|Oriya|Osmanya|Phags_Pa|Phoenician|Rejang|Runic|Saurashtra|Shavian|Sinhala|Sundanese|Syloti_Nagri|Syriac|Tagalog|Tagbanwa|Tai_Le|Tamil|Telugu|Thaana|Thai|Tibetan|Tifinagh|Ugaritic|Vai|Yi|Ll|Lm|Lt|Lu|Lo|Mn|Mc|Me|Nd|Nl|Pc|Pd|Ps|Pe|Pi|Pf|Po|No|Sm|Sc|Sk|So|Zs|Zl|Zp|Cc|Cf|Cn|Co|Cs|N|L|M|P|S|Z|C)(})/
  2809. }, {
  2810. token: ["constant.language.escape", "invalid", "constant.language.escape"],
  2811. regex: /(\\p{\^?)([^/]*)(})/
  2812. }, {
  2813. token: "regexp.keyword.operator",
  2814. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  2815. }, {
  2816. token: "string.regexp",
  2817. regex: /[/][imxouesn]*/,
  2818. next: "start"
  2819. }, {
  2820. token: "invalid",
  2821. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  2822. }, {
  2823. token: "constant.language.escape",
  2824. regex: /\(\?(?:[:=!>]|<'?[a-zA-Z]*'?>|<[=!])|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  2825. }, {
  2826. token: "constant.language.delimiter",
  2827. regex: /\|/
  2828. }, {
  2829. token: "regexp.keyword",
  2830. regex: /\[\[:(?:alnum|alpha|blank|cntrl|digit|graph|lower|print|punct|space|upper|xdigit|word|ascii):\]\]/
  2831. }, {
  2832. token: "constant.language.escape",
  2833. regex: /\[\^?/,
  2834. push: "regex_character_class"
  2835. }, {
  2836. defaultToken: "string.regexp"
  2837. }
  2838. ],
  2839. "regex_character_class": [
  2840. {
  2841. token: "regexp.keyword",
  2842. regex: /\\[wWdDhHsS]/
  2843. }, {
  2844. token: "regexp.charclass.keyword.operator",
  2845. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  2846. }, {
  2847. token: "constant.language.escape",
  2848. regex: /&?&?\[\^?/,
  2849. push: "regex_character_class"
  2850. }, {
  2851. token: "constant.language.escape",
  2852. regex: "]",
  2853. next: "pop"
  2854. }, {
  2855. token: "constant.language.escape",
  2856. regex: "-"
  2857. }, {
  2858. defaultToken: "string.regexp.characterclass"
  2859. }
  2860. ]
  2861. };
  2862. this.normalizeRules();
  2863. };
  2864. oop.inherits(RubyHighlightRules, TextHighlightRules);
  2865. exports.RubyHighlightRules = RubyHighlightRules;
  2866. });
  2867. ace.define("ace/mode/folding/ruby",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range","ace/token_iterator"], function(require, exports, module){"use strict";
  2868. var oop = require("../../lib/oop");
  2869. var BaseFoldMode = require("./fold_mode").FoldMode;
  2870. var Range = require("../../range").Range;
  2871. var TokenIterator = require("../../token_iterator").TokenIterator;
  2872. var FoldMode = exports.FoldMode = function () {
  2873. };
  2874. oop.inherits(FoldMode, BaseFoldMode);
  2875. (function () {
  2876. this.indentKeywords = {
  2877. "class": 1,
  2878. "def": 1,
  2879. "module": 1,
  2880. "do": 1,
  2881. "unless": 1,
  2882. "if": 1,
  2883. "while": 1,
  2884. "for": 1,
  2885. "until": 1,
  2886. "begin": 1,
  2887. "else": 0,
  2888. "elsif": 0,
  2889. "rescue": 0,
  2890. "ensure": 0,
  2891. "when": 0,
  2892. "end": -1,
  2893. "case": 1,
  2894. "=begin": 1,
  2895. "=end": -1
  2896. };
  2897. this.foldingStartMarker = /(?:\s|^)(def|do|while|class|unless|module|if|for|until|begin|else|elsif|case|rescue|ensure|when)\b|({\s*$)|(=begin)/;
  2898. this.foldingStopMarker = /(=end(?=$|\s.*$))|(^\s*})|\b(end)\b/;
  2899. this.getFoldWidget = function (session, foldStyle, row) {
  2900. var line = session.getLine(row);
  2901. var isStart = this.foldingStartMarker.test(line);
  2902. var isEnd = this.foldingStopMarker.test(line);
  2903. if (isStart && !isEnd) {
  2904. var match = line.match(this.foldingStartMarker);
  2905. if (match[1]) {
  2906. if (match[1] == "if" || match[1] == "else" || match[1] == "while" || match[1] == "until" || match[1] == "unless") {
  2907. if (match[1] == "else" && /^\s*else\s*$/.test(line) === false) {
  2908. return;
  2909. }
  2910. if (/^\s*(?:if|else|while|until|unless)\s*/.test(line) === false) {
  2911. return;
  2912. }
  2913. }
  2914. if (match[1] == "when") {
  2915. if (/\sthen\s/.test(line) === true) {
  2916. return;
  2917. }
  2918. }
  2919. if (session.getTokenAt(row, match.index + 2).type === "keyword")
  2920. return "start";
  2921. }
  2922. else if (match[3]) {
  2923. if (session.getTokenAt(row, match.index + 1).type === "comment.multiline")
  2924. return "start";
  2925. }
  2926. else {
  2927. return "start";
  2928. }
  2929. }
  2930. if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd)
  2931. return "";
  2932. var match = line.match(this.foldingStopMarker);
  2933. if (match[3] === "end") {
  2934. if (session.getTokenAt(row, match.index + 1).type === "keyword")
  2935. return "end";
  2936. }
  2937. else if (match[1]) {
  2938. if (session.getTokenAt(row, match.index + 1).type === "comment.multiline")
  2939. return "end";
  2940. }
  2941. else
  2942. return "end";
  2943. };
  2944. this.getFoldWidgetRange = function (session, foldStyle, row) {
  2945. var line = session.doc.getLine(row);
  2946. var match = this.foldingStartMarker.exec(line);
  2947. if (match) {
  2948. if (match[1] || match[3])
  2949. return this.rubyBlock(session, row, match.index + 2);
  2950. return this.openingBracketBlock(session, "{", row, match.index);
  2951. }
  2952. var match = this.foldingStopMarker.exec(line);
  2953. if (match) {
  2954. if (match[3] === "end") {
  2955. if (session.getTokenAt(row, match.index + 1).type === "keyword")
  2956. return this.rubyBlock(session, row, match.index + 1);
  2957. }
  2958. if (match[1] === "=end") {
  2959. if (session.getTokenAt(row, match.index + 1).type === "comment.multiline")
  2960. return this.rubyBlock(session, row, match.index + 1);
  2961. }
  2962. return this.closingBracketBlock(session, "}", row, match.index + match[0].length);
  2963. }
  2964. };
  2965. this.rubyBlock = function (session, row, column, tokenRange) {
  2966. var stream = new TokenIterator(session, row, column);
  2967. var token = stream.getCurrentToken();
  2968. if (!token || (token.type != "keyword" && token.type != "comment.multiline"))
  2969. return;
  2970. var val = token.value;
  2971. var line = session.getLine(row);
  2972. switch (token.value) {
  2973. case "if":
  2974. case "unless":
  2975. case "while":
  2976. case "until":
  2977. var checkToken = new RegExp("^\\s*" + token.value);
  2978. if (!checkToken.test(line)) {
  2979. return;
  2980. }
  2981. var dir = this.indentKeywords[val];
  2982. break;
  2983. case "when":
  2984. if (/\sthen\s/.test(line)) {
  2985. return;
  2986. }
  2987. case "elsif":
  2988. case "rescue":
  2989. case "ensure":
  2990. var dir = 1;
  2991. break;
  2992. case "else":
  2993. var checkToken = new RegExp("^\\s*" + token.value + "\\s*$");
  2994. if (!checkToken.test(line)) {
  2995. return;
  2996. }
  2997. var dir = 1;
  2998. break;
  2999. default:
  3000. var dir = this.indentKeywords[val];
  3001. break;
  3002. }
  3003. var stack = [val];
  3004. if (!dir)
  3005. return;
  3006. var startColumn = dir === -1 ? session.getLine(row - 1).length : session.getLine(row).length;
  3007. var startRow = row;
  3008. var ranges = [];
  3009. ranges.push(stream.getCurrentTokenRange());
  3010. stream.step = dir === -1 ? stream.stepBackward : stream.stepForward;
  3011. if (token.type == "comment.multiline") {
  3012. while (token = stream.step()) {
  3013. if (token.type !== "comment.multiline")
  3014. continue;
  3015. if (dir == 1) {
  3016. startColumn = 6;
  3017. if (token.value == "=end") {
  3018. break;
  3019. }
  3020. }
  3021. else {
  3022. if (token.value == "=begin") {
  3023. break;
  3024. }
  3025. }
  3026. }
  3027. }
  3028. else {
  3029. while (token = stream.step()) {
  3030. var ignore = false;
  3031. if (token.type !== "keyword")
  3032. continue;
  3033. var level = dir * this.indentKeywords[token.value];
  3034. line = session.getLine(stream.getCurrentTokenRow());
  3035. switch (token.value) {
  3036. case "do":
  3037. for (var i = stream.$tokenIndex - 1; i >= 0; i--) {
  3038. var prevToken = stream.$rowTokens[i];
  3039. if (prevToken && (prevToken.value == "while" || prevToken.value == "until" || prevToken.value == "for")) {
  3040. level = 0;
  3041. break;
  3042. }
  3043. }
  3044. break;
  3045. case "else":
  3046. var checkToken = new RegExp("^\\s*" + token.value + "\\s*$");
  3047. if (!checkToken.test(line) || val == "case") {
  3048. level = 0;
  3049. ignore = true;
  3050. }
  3051. break;
  3052. case "if":
  3053. case "unless":
  3054. case "while":
  3055. case "until":
  3056. var checkToken = new RegExp("^\\s*" + token.value);
  3057. if (!checkToken.test(line)) {
  3058. level = 0;
  3059. ignore = true;
  3060. }
  3061. break;
  3062. case "when":
  3063. if (/\sthen\s/.test(line) || val == "case") {
  3064. level = 0;
  3065. ignore = true;
  3066. }
  3067. break;
  3068. }
  3069. if (level > 0) {
  3070. stack.unshift(token.value);
  3071. }
  3072. else if (level <= 0 && ignore === false) {
  3073. stack.shift();
  3074. if (!stack.length) {
  3075. if ((val == "while" || val == "until" || val == "for") && token.value != "do") {
  3076. break;
  3077. }
  3078. if (token.value == "do" && dir == -1 && level != 0)
  3079. break;
  3080. if (token.value != "do")
  3081. break;
  3082. }
  3083. if (level === 0) {
  3084. stack.unshift(token.value);
  3085. }
  3086. }
  3087. }
  3088. }
  3089. if (!token)
  3090. return null;
  3091. if (tokenRange) {
  3092. ranges.push(stream.getCurrentTokenRange());
  3093. return ranges;
  3094. }
  3095. var row = stream.getCurrentTokenRow();
  3096. if (dir === -1) {
  3097. if (token.type === "comment.multiline") {
  3098. var endColumn = 6;
  3099. }
  3100. else {
  3101. var endColumn = session.getLine(row).length;
  3102. }
  3103. return new Range(row, endColumn, startRow - 1, startColumn);
  3104. }
  3105. else
  3106. return new Range(startRow, startColumn, row - 1, session.getLine(row - 1).length);
  3107. };
  3108. }).call(FoldMode.prototype);
  3109. });
  3110. ace.define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/folding/ruby"], function(require, exports, module){"use strict";
  3111. var oop = require("../lib/oop");
  3112. var TextMode = require("./text").Mode;
  3113. var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
  3114. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  3115. var Range = require("../range").Range;
  3116. var FoldMode = require("./folding/ruby").FoldMode;
  3117. var Mode = function () {
  3118. this.HighlightRules = RubyHighlightRules;
  3119. this.$outdent = new MatchingBraceOutdent();
  3120. this.$behaviour = this.$defaultBehaviour;
  3121. this.foldingRules = new FoldMode();
  3122. this.indentKeywords = this.foldingRules.indentKeywords;
  3123. };
  3124. oop.inherits(Mode, TextMode);
  3125. (function () {
  3126. this.lineCommentStart = "#";
  3127. this.getNextLineIndent = function (state, line, tab) {
  3128. var indent = this.$getIndent(line);
  3129. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  3130. var tokens = tokenizedLine.tokens;
  3131. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  3132. return indent;
  3133. }
  3134. if (state == "start") {
  3135. var match = line.match(/^.*[\{\(\[]\s*$/);
  3136. var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/);
  3137. var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/);
  3138. var startingConditional = line.match(/^\s*(if|else|when|elsif|unless|while|for|begin|rescue|ensure)\s*/);
  3139. if (match || startingClassOrMethod || startingDoBlock || startingConditional) {
  3140. indent += tab;
  3141. }
  3142. }
  3143. return indent;
  3144. };
  3145. this.checkOutdent = function (state, line, input) {
  3146. return /^\s+(end|else|rescue|ensure)$/.test(line + input) || this.$outdent.checkOutdent(line, input);
  3147. };
  3148. this.autoOutdent = function (state, session, row) {
  3149. var line = session.getLine(row);
  3150. if (/}/.test(line))
  3151. return this.$outdent.autoOutdent(session, row);
  3152. var indent = this.$getIndent(line);
  3153. var prevLine = session.getLine(row - 1);
  3154. var prevIndent = this.$getIndent(prevLine);
  3155. var tab = session.getTabString();
  3156. if (prevIndent.length <= indent.length) {
  3157. if (indent.slice(-tab.length) == tab)
  3158. session.remove(new Range(row, indent.length - tab.length, row, indent.length));
  3159. }
  3160. };
  3161. this.getMatching = function (session, row, column) {
  3162. if (row == undefined) {
  3163. var pos = session.selection.lead;
  3164. column = pos.column;
  3165. row = pos.row;
  3166. }
  3167. var startToken = session.getTokenAt(row, column);
  3168. if (startToken && startToken.value in this.indentKeywords)
  3169. return this.foldingRules.rubyBlock(session, row, column, true);
  3170. };
  3171. this.$id = "ace/mode/ruby";
  3172. this.snippetFileId = "ace/snippets/ruby";
  3173. }).call(Mode.prototype);
  3174. exports.Mode = Mode;
  3175. });
  3176. ace.define("ace/mode/ejs",["require","exports","module","ace/lib/oop","ace/mode/html_highlight_rules","ace/mode/javascript_highlight_rules","ace/lib/oop","ace/mode/html","ace/mode/javascript","ace/mode/css","ace/mode/ruby"], function(require, exports, module){"use strict";
  3177. var oop = require("../lib/oop");
  3178. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  3179. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  3180. var EjsHighlightRules = function (start, end) {
  3181. HtmlHighlightRules.call(this);
  3182. if (!start)
  3183. start = "(?:<%|<\\?|{{)";
  3184. if (!end)
  3185. end = "(?:%>|\\?>|}})";
  3186. for (var i in this.$rules) {
  3187. this.$rules[i].unshift({
  3188. token: "markup.list.meta.tag",
  3189. regex: start + "(?![>}])[-=]?",
  3190. push: "ejs-start"
  3191. });
  3192. }
  3193. this.embedRules(new JavaScriptHighlightRules({ jsx: false }).getRules(), "ejs-", [{
  3194. token: "markup.list.meta.tag",
  3195. regex: "-?" + end,
  3196. next: "pop"
  3197. }, {
  3198. token: "comment",
  3199. regex: "//.*?" + end,
  3200. next: "pop"
  3201. }]);
  3202. this.normalizeRules();
  3203. };
  3204. oop.inherits(EjsHighlightRules, HtmlHighlightRules);
  3205. exports.EjsHighlightRules = EjsHighlightRules;
  3206. var oop = require("../lib/oop");
  3207. var HtmlMode = require("./html").Mode;
  3208. var JavaScriptMode = require("./javascript").Mode;
  3209. var CssMode = require("./css").Mode;
  3210. var RubyMode = require("./ruby").Mode;
  3211. var Mode = function () {
  3212. HtmlMode.call(this);
  3213. this.HighlightRules = EjsHighlightRules;
  3214. this.createModeDelegates({
  3215. "js-": JavaScriptMode,
  3216. "css-": CssMode,
  3217. "ejs-": JavaScriptMode
  3218. });
  3219. };
  3220. oop.inherits(Mode, HtmlMode);
  3221. (function () {
  3222. this.$id = "ace/mode/ejs";
  3223. }).call(Mode.prototype);
  3224. exports.Mode = Mode;
  3225. }); (function() {
  3226. ace.require(["ace/mode/ejs"], function(m) {
  3227. if (typeof module == "object" && typeof exports == "object" && module) {
  3228. module.exports = m;
  3229. }
  3230. });
  3231. })();