30fe7e6ab4db8a6e472422e6037abcf6.js 128 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935
  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/markdown_highlight_rules",["require","exports","module","ace/config","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/html_highlight_rules"], function(require, exports, module){"use strict";
  1083. var modes = require("../config").$modes;
  1084. var oop = require("../lib/oop");
  1085. var lang = require("../lib/lang");
  1086. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  1087. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  1088. var escaped = function (ch) {
  1089. return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*";
  1090. };
  1091. var MarkdownHighlightRules = function () {
  1092. HtmlHighlightRules.call(this);
  1093. var codeBlockStartRule = {
  1094. token: "support.function",
  1095. regex: /^\s*(```+[^`]*|~~~+[^~]*)$/,
  1096. onMatch: function (value, state, stack, line) {
  1097. var m = value.match(/^(\s*)([`~]+)(.*)/);
  1098. var language = /[\w-]+|$/.exec(m[3])[0];
  1099. if (!modes[language])
  1100. language = "";
  1101. stack.unshift("githubblock", [], [m[1], m[2], language], state);
  1102. return this.token;
  1103. },
  1104. next: "githubblock"
  1105. };
  1106. var codeBlockRules = [{
  1107. token: "support.function",
  1108. regex: ".*",
  1109. onMatch: function (value, state, stack, line) {
  1110. var embedState = stack[1];
  1111. var indent = stack[2][0];
  1112. var endMarker = stack[2][1];
  1113. var language = stack[2][2];
  1114. var m = /^(\s*)(`+|~+)\s*$/.exec(value);
  1115. if (m && m[1].length < indent.length + 3
  1116. && m[2].length >= endMarker.length && m[2][0] == endMarker[0]) {
  1117. stack.splice(0, 3);
  1118. this.next = stack.shift();
  1119. return this.token;
  1120. }
  1121. this.next = "";
  1122. if (language && modes[language]) {
  1123. var data = modes[language].getTokenizer().getLineTokens(value, embedState.slice(0));
  1124. stack[1] = data.state;
  1125. return data.tokens;
  1126. }
  1127. return this.token;
  1128. }
  1129. }];
  1130. this.$rules["start"].unshift({
  1131. token: "empty_line",
  1132. regex: '^$',
  1133. next: "allowBlock"
  1134. }, {
  1135. token: "markup.heading.1",
  1136. regex: "^=+(?=\\s*$)"
  1137. }, {
  1138. token: "markup.heading.2",
  1139. regex: "^\\-+(?=\\s*$)"
  1140. }, {
  1141. token: function (value) {
  1142. return "markup.heading." + value.length;
  1143. },
  1144. regex: /^#{1,6}(?=\s|$)/,
  1145. next: "header"
  1146. }, codeBlockStartRule, {
  1147. token: "string.blockquote",
  1148. regex: "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  1149. next: "blockquote"
  1150. }, {
  1151. token: "constant",
  1152. regex: "^ {0,3}(?:(?:\\* ?){3,}|(?:\\- ?){3,}|(?:\\_ ?){3,})\\s*$",
  1153. next: "allowBlock"
  1154. }, {
  1155. token: "markup.list",
  1156. regex: "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  1157. next: "listblock-start"
  1158. }, {
  1159. include: "basic"
  1160. });
  1161. this.addRules({
  1162. "basic": [{
  1163. token: "constant.language.escape",
  1164. regex: /\\[\\`*_{}\[\]()#+\-.!]/
  1165. }, {
  1166. token: "support.function",
  1167. regex: "(`+)(.*?[^`])(\\1)"
  1168. }, {
  1169. token: ["text", "constant", "text", "url", "string", "text"],
  1170. regex: "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
  1171. }, {
  1172. token: ["text", "string", "text", "constant", "text"],
  1173. regex: "(\\[)(" + escaped("]") + ")(\\]\\s*\\[)(" + escaped("]") + ")(\\])"
  1174. }, {
  1175. token: ["text", "string", "text", "markup.underline", "string", "text"],
  1176. regex: "(\\!?\\[)(" + // [
  1177. escaped("]") + // link text or alt text
  1178. ")(\\]\\()" + // ](
  1179. '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + // href or image
  1180. '(\\s*"' + escaped('"') + '"\\s*)?' + // "title"
  1181. "(\\))" // )
  1182. }, {
  1183. token: "string.strong",
  1184. regex: "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)"
  1185. }, {
  1186. token: "string.emphasis",
  1187. regex: "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)"
  1188. }, {
  1189. token: ["text", "url", "text"],
  1190. regex: "(<)(" +
  1191. "(?:https?|ftp|dict):[^'\">\\s]+" +
  1192. "|" +
  1193. "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+" +
  1194. ")(>)"
  1195. }],
  1196. "allowBlock": [
  1197. { token: "support.function", regex: "^ {4}.+", next: "allowBlock" },
  1198. { token: "empty_line", regex: '^$', next: "allowBlock" },
  1199. { token: "empty", regex: "", next: "start" }
  1200. ],
  1201. "header": [{
  1202. regex: "$",
  1203. next: "start"
  1204. }, {
  1205. include: "basic"
  1206. }, {
  1207. defaultToken: "heading"
  1208. }],
  1209. "listblock-start": [{
  1210. token: "support.variable",
  1211. regex: /(?:\[[ x]\])?/,
  1212. next: "listblock"
  1213. }],
  1214. "listblock": [{
  1215. token: "empty_line",
  1216. regex: "^$",
  1217. next: "start"
  1218. }, {
  1219. token: "markup.list",
  1220. regex: "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  1221. next: "listblock-start"
  1222. }, {
  1223. include: "basic", noEscape: true
  1224. },
  1225. codeBlockStartRule,
  1226. {
  1227. defaultToken: "list" //do not use markup.list to allow stling leading `*` differntly
  1228. }],
  1229. "blockquote": [{
  1230. token: "empty_line",
  1231. regex: "^\\s*$",
  1232. next: "start"
  1233. }, {
  1234. token: "string.blockquote",
  1235. regex: "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  1236. next: "blockquote"
  1237. }, {
  1238. include: "basic", noEscape: true
  1239. }, {
  1240. defaultToken: "string.blockquote"
  1241. }],
  1242. "githubblock": codeBlockRules
  1243. });
  1244. this.normalizeRules();
  1245. };
  1246. oop.inherits(MarkdownHighlightRules, TextHighlightRules);
  1247. exports.MarkdownHighlightRules = MarkdownHighlightRules;
  1248. });
  1249. ace.define("ace/mode/folding/markdown",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module){"use strict";
  1250. var oop = require("../../lib/oop");
  1251. var BaseFoldMode = require("./fold_mode").FoldMode;
  1252. var Range = require("../../range").Range;
  1253. var FoldMode = exports.FoldMode = function () { };
  1254. oop.inherits(FoldMode, BaseFoldMode);
  1255. (function () {
  1256. this.foldingStartMarker = /^(?:[=-]+\s*$|#{1,6} |`{3})/;
  1257. this.getFoldWidget = function (session, foldStyle, row) {
  1258. var line = session.getLine(row);
  1259. if (!this.foldingStartMarker.test(line))
  1260. return "";
  1261. if (line[0] == "`") {
  1262. if (session.bgTokenizer.getState(row) == "start")
  1263. return "end";
  1264. return "start";
  1265. }
  1266. return "start";
  1267. };
  1268. this.getFoldWidgetRange = function (session, foldStyle, row) {
  1269. var line = session.getLine(row);
  1270. var startColumn = line.length;
  1271. var maxRow = session.getLength();
  1272. var startRow = row;
  1273. var endRow = row;
  1274. if (!line.match(this.foldingStartMarker))
  1275. return;
  1276. if (line[0] == "`") {
  1277. if (session.bgTokenizer.getState(row) !== "start") {
  1278. while (++row < maxRow) {
  1279. line = session.getLine(row);
  1280. if (line[0] == "`" & line.substring(0, 3) == "```")
  1281. break;
  1282. }
  1283. return new Range(startRow, startColumn, row, 0);
  1284. }
  1285. else {
  1286. while (row-- > 0) {
  1287. line = session.getLine(row);
  1288. if (line[0] == "`" & line.substring(0, 3) == "```")
  1289. break;
  1290. }
  1291. return new Range(row, line.length, startRow, 0);
  1292. }
  1293. }
  1294. var token;
  1295. function isHeading(row) {
  1296. token = session.getTokens(row)[0];
  1297. return token && token.type.lastIndexOf(heading, 0) === 0;
  1298. }
  1299. var heading = "markup.heading";
  1300. function getLevel() {
  1301. var ch = token.value[0];
  1302. if (ch == "=")
  1303. return 6;
  1304. if (ch == "-")
  1305. return 5;
  1306. return 7 - token.value.search(/[^#]|$/);
  1307. }
  1308. if (isHeading(row)) {
  1309. var startHeadingLevel = getLevel();
  1310. while (++row < maxRow) {
  1311. if (!isHeading(row))
  1312. continue;
  1313. var level = getLevel();
  1314. if (level >= startHeadingLevel)
  1315. break;
  1316. }
  1317. endRow = row - (!token || ["=", "-"].indexOf(token.value[0]) == -1 ? 1 : 2);
  1318. if (endRow > startRow) {
  1319. while (endRow > startRow && /^\s*$/.test(session.getLine(endRow)))
  1320. endRow--;
  1321. }
  1322. if (endRow > startRow) {
  1323. var endColumn = session.getLine(endRow).length;
  1324. return new Range(startRow, startColumn, endRow, endColumn);
  1325. }
  1326. }
  1327. };
  1328. }).call(FoldMode.prototype);
  1329. });
  1330. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
  1331. var Range = require("../range").Range;
  1332. var MatchingBraceOutdent = function () { };
  1333. (function () {
  1334. this.checkOutdent = function (line, input) {
  1335. if (!/^\s+$/.test(line))
  1336. return false;
  1337. return /^\s*\}/.test(input);
  1338. };
  1339. this.autoOutdent = function (doc, row) {
  1340. var line = doc.getLine(row);
  1341. var match = line.match(/^(\s*\})/);
  1342. if (!match)
  1343. return 0;
  1344. var column = match[1].length;
  1345. var openBracePos = doc.findMatchingBracket({ row: row, column: column });
  1346. if (!openBracePos || openBracePos.row == row)
  1347. return 0;
  1348. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  1349. doc.replace(new Range(row, 0, row, column - 1), indent);
  1350. };
  1351. this.$getIndent = function (line) {
  1352. return line.match(/^\s*/)[0];
  1353. };
  1354. }).call(MatchingBraceOutdent.prototype);
  1355. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  1356. });
  1357. ace.define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator"], function(require, exports, module){"use strict";
  1358. var oop = require("../../lib/oop");
  1359. var Behaviour = require("../behaviour").Behaviour;
  1360. var TokenIterator = require("../../token_iterator").TokenIterator;
  1361. function is(token, type) {
  1362. return token && token.type.lastIndexOf(type + ".xml") > -1;
  1363. }
  1364. var XmlBehaviour = function () {
  1365. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  1366. if (text == '"' || text == "'") {
  1367. var quote = text;
  1368. var selected = session.doc.getTextRange(editor.getSelectionRange());
  1369. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  1370. return {
  1371. text: quote + selected + quote,
  1372. selection: false
  1373. };
  1374. }
  1375. var cursor = editor.getCursorPosition();
  1376. var line = session.doc.getLine(cursor.row);
  1377. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1378. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1379. var token = iterator.getCurrentToken();
  1380. if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
  1381. return {
  1382. text: "",
  1383. selection: [1, 1]
  1384. };
  1385. }
  1386. if (!token)
  1387. token = iterator.stepBackward();
  1388. if (!token)
  1389. return;
  1390. while (is(token, "tag-whitespace") || is(token, "whitespace")) {
  1391. token = iterator.stepBackward();
  1392. }
  1393. var rightSpace = !rightChar || rightChar.match(/\s/);
  1394. if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
  1395. return {
  1396. text: quote + quote,
  1397. selection: [1, 1]
  1398. };
  1399. }
  1400. }
  1401. });
  1402. this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
  1403. var selected = session.doc.getTextRange(range);
  1404. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  1405. var line = session.doc.getLine(range.start.row);
  1406. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  1407. if (rightChar == selected) {
  1408. range.end.column++;
  1409. return range;
  1410. }
  1411. }
  1412. });
  1413. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  1414. if (text == '>') {
  1415. var position = editor.getSelectionRange().start;
  1416. var iterator = new TokenIterator(session, position.row, position.column);
  1417. var token = iterator.getCurrentToken() || iterator.stepBackward();
  1418. if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
  1419. return;
  1420. if (is(token, "reference.attribute-value"))
  1421. return;
  1422. if (is(token, "attribute-value")) {
  1423. var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length;
  1424. if (position.column < tokenEndColumn)
  1425. return;
  1426. if (position.column == tokenEndColumn) {
  1427. var nextToken = iterator.stepForward();
  1428. if (nextToken && is(nextToken, "attribute-value"))
  1429. return;
  1430. iterator.stepBackward();
  1431. }
  1432. }
  1433. if (/^\s*>/.test(session.getLine(position.row).slice(position.column)))
  1434. return;
  1435. while (!is(token, "tag-name")) {
  1436. token = iterator.stepBackward();
  1437. if (token.value == "<") {
  1438. token = iterator.stepForward();
  1439. break;
  1440. }
  1441. }
  1442. var tokenRow = iterator.getCurrentTokenRow();
  1443. var tokenColumn = iterator.getCurrentTokenColumn();
  1444. if (is(iterator.stepBackward(), "end-tag-open"))
  1445. return;
  1446. var element = token.value;
  1447. if (tokenRow == position.row)
  1448. element = element.substring(0, position.column - tokenColumn);
  1449. if (this.voidElements && this.voidElements.hasOwnProperty(element.toLowerCase()))
  1450. return;
  1451. return {
  1452. text: ">" + "</" + element + ">",
  1453. selection: [1, 1]
  1454. };
  1455. }
  1456. });
  1457. this.add("autoindent", "insertion", function (state, action, editor, session, text) {
  1458. if (text == "\n") {
  1459. var cursor = editor.getCursorPosition();
  1460. var line = session.getLine(cursor.row);
  1461. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1462. var token = iterator.getCurrentToken();
  1463. if (is(token, "") && token.type.indexOf("tag-close") !== -1) {
  1464. if (token.value == "/>")
  1465. return;
  1466. while (token && token.type.indexOf("tag-name") === -1) {
  1467. token = iterator.stepBackward();
  1468. }
  1469. if (!token) {
  1470. return;
  1471. }
  1472. var tag = token.value;
  1473. var row = iterator.getCurrentTokenRow();
  1474. token = iterator.stepBackward();
  1475. if (!token || token.type.indexOf("end-tag") !== -1) {
  1476. return;
  1477. }
  1478. if (this.voidElements && !this.voidElements[tag] || !this.voidElements) {
  1479. var nextToken = session.getTokenAt(cursor.row, cursor.column + 1);
  1480. var line = session.getLine(row);
  1481. var nextIndent = this.$getIndent(line);
  1482. var indent = nextIndent + session.getTabString();
  1483. if (nextToken && nextToken.value === "</") {
  1484. return {
  1485. text: "\n" + indent + "\n" + nextIndent,
  1486. selection: [1, indent.length, 1, indent.length]
  1487. };
  1488. }
  1489. else {
  1490. return {
  1491. text: "\n" + indent
  1492. };
  1493. }
  1494. }
  1495. }
  1496. }
  1497. });
  1498. };
  1499. oop.inherits(XmlBehaviour, Behaviour);
  1500. exports.XmlBehaviour = XmlBehaviour;
  1501. });
  1502. 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";
  1503. var oop = require("../../lib/oop");
  1504. var TokenIterator = require("../../token_iterator").TokenIterator;
  1505. var CstyleBehaviour = require("../behaviour/cstyle").CstyleBehaviour;
  1506. var XmlBehaviour = require("../behaviour/xml").XmlBehaviour;
  1507. var JavaScriptBehaviour = function () {
  1508. var xmlBehaviours = new XmlBehaviour({ closeCurlyBraces: true }).getBehaviours();
  1509. this.addBehaviours(xmlBehaviours);
  1510. this.inherit(CstyleBehaviour);
  1511. this.add("autoclosing-fragment", "insertion", function (state, action, editor, session, text) {
  1512. if (text == '>') {
  1513. var position = editor.getSelectionRange().start;
  1514. var iterator = new TokenIterator(session, position.row, position.column);
  1515. var token = iterator.getCurrentToken() || iterator.stepBackward();
  1516. if (!token)
  1517. return;
  1518. if (token.value == '<') {
  1519. return {
  1520. text: "></>",
  1521. selection: [1, 1]
  1522. };
  1523. }
  1524. }
  1525. });
  1526. };
  1527. oop.inherits(JavaScriptBehaviour, CstyleBehaviour);
  1528. exports.JavaScriptBehaviour = JavaScriptBehaviour;
  1529. });
  1530. 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";
  1531. var oop = require("../../lib/oop");
  1532. var Range = require("../../range").Range;
  1533. var BaseFoldMode = require("./fold_mode").FoldMode;
  1534. var FoldMode = exports.FoldMode = function (voidElements, optionalEndTags) {
  1535. BaseFoldMode.call(this);
  1536. this.voidElements = voidElements || {};
  1537. this.optionalEndTags = oop.mixin({}, this.voidElements);
  1538. if (optionalEndTags)
  1539. oop.mixin(this.optionalEndTags, optionalEndTags);
  1540. };
  1541. oop.inherits(FoldMode, BaseFoldMode);
  1542. var Tag = function () {
  1543. this.tagName = "";
  1544. this.closing = false;
  1545. this.selfClosing = false;
  1546. this.start = { row: 0, column: 0 };
  1547. this.end = { row: 0, column: 0 };
  1548. };
  1549. function is(token, type) {
  1550. return token && token.type && token.type.lastIndexOf(type + ".xml") > -1;
  1551. }
  1552. (function () {
  1553. this.getFoldWidget = function (session, foldStyle, row) {
  1554. var tag = this._getFirstTagInLine(session, row);
  1555. if (!tag)
  1556. return this.getCommentFoldWidget(session, row);
  1557. if (tag.closing || (!tag.tagName && tag.selfClosing))
  1558. return foldStyle === "markbeginend" ? "end" : "";
  1559. if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
  1560. return "";
  1561. if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
  1562. return "";
  1563. return "start";
  1564. };
  1565. this.getCommentFoldWidget = function (session, row) {
  1566. if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
  1567. return "start";
  1568. return "";
  1569. };
  1570. this._getFirstTagInLine = function (session, row) {
  1571. var tokens = session.getTokens(row);
  1572. var tag = new Tag();
  1573. for (var i = 0; i < tokens.length; i++) {
  1574. var token = tokens[i];
  1575. if (is(token, "tag-open")) {
  1576. tag.end.column = tag.start.column + token.value.length;
  1577. tag.closing = is(token, "end-tag-open");
  1578. token = tokens[++i];
  1579. if (!token)
  1580. return null;
  1581. tag.tagName = token.value;
  1582. if (token.value === "") { //skip empty tag name token for fragment
  1583. token = tokens[++i];
  1584. if (!token)
  1585. return null;
  1586. tag.tagName = token.value;
  1587. }
  1588. tag.end.column += token.value.length;
  1589. for (i++; i < tokens.length; i++) {
  1590. token = tokens[i];
  1591. tag.end.column += token.value.length;
  1592. if (is(token, "tag-close")) {
  1593. tag.selfClosing = token.value == '/>';
  1594. break;
  1595. }
  1596. }
  1597. return tag;
  1598. }
  1599. else if (is(token, "tag-close")) {
  1600. tag.selfClosing = token.value == '/>';
  1601. return tag;
  1602. }
  1603. tag.start.column += token.value.length;
  1604. }
  1605. return null;
  1606. };
  1607. this._findEndTagInLine = function (session, row, tagName, startColumn) {
  1608. var tokens = session.getTokens(row);
  1609. var column = 0;
  1610. for (var i = 0; i < tokens.length; i++) {
  1611. var token = tokens[i];
  1612. column += token.value.length;
  1613. if (column < startColumn - 1)
  1614. continue;
  1615. if (is(token, "end-tag-open")) {
  1616. token = tokens[i + 1];
  1617. if (is(token, "tag-name") && token.value === "") {
  1618. token = tokens[i + 2];
  1619. }
  1620. if (token && token.value == tagName)
  1621. return true;
  1622. }
  1623. }
  1624. return false;
  1625. };
  1626. this.getFoldWidgetRange = function (session, foldStyle, row) {
  1627. var firstTag = this._getFirstTagInLine(session, row);
  1628. if (!firstTag) {
  1629. return this.getCommentFoldWidget(session, row) && session.getCommentFoldRange(row, session.getLine(row).length);
  1630. }
  1631. var tags = session.getMatchingTags({ row: row, column: 0 });
  1632. if (tags) {
  1633. return new Range(tags.openTag.end.row, tags.openTag.end.column, tags.closeTag.start.row, tags.closeTag.start.column);
  1634. }
  1635. };
  1636. }).call(FoldMode.prototype);
  1637. });
  1638. 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";
  1639. var oop = require("../../lib/oop");
  1640. var Range = require("../../range").Range;
  1641. var BaseFoldMode = require("./fold_mode").FoldMode;
  1642. var FoldMode = exports.FoldMode = function (commentRegex) {
  1643. if (commentRegex) {
  1644. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  1645. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  1646. }
  1647. };
  1648. oop.inherits(FoldMode, BaseFoldMode);
  1649. (function () {
  1650. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  1651. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  1652. this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
  1653. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  1654. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  1655. this._getFoldWidgetBase = this.getFoldWidget;
  1656. this.getFoldWidget = function (session, foldStyle, row) {
  1657. var line = session.getLine(row);
  1658. if (this.singleLineBlockCommentRe.test(line)) {
  1659. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  1660. return "";
  1661. }
  1662. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  1663. if (!fw && this.startRegionRe.test(line))
  1664. return "start"; // lineCommentRegionStart
  1665. return fw;
  1666. };
  1667. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  1668. var line = session.getLine(row);
  1669. if (this.startRegionRe.test(line))
  1670. return this.getCommentRegionBlock(session, line, row);
  1671. var match = line.match(this.foldingStartMarker);
  1672. if (match) {
  1673. var i = match.index;
  1674. if (match[1])
  1675. return this.openingBracketBlock(session, match[1], row, i);
  1676. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  1677. if (range && !range.isMultiLine()) {
  1678. if (forceMultiline) {
  1679. range = this.getSectionRange(session, row);
  1680. }
  1681. else if (foldStyle != "all")
  1682. range = null;
  1683. }
  1684. return range;
  1685. }
  1686. if (foldStyle === "markbegin")
  1687. return;
  1688. var match = line.match(this.foldingStopMarker);
  1689. if (match) {
  1690. var i = match.index + match[0].length;
  1691. if (match[1])
  1692. return this.closingBracketBlock(session, match[1], row, i);
  1693. return session.getCommentFoldRange(row, i, -1);
  1694. }
  1695. };
  1696. this.getSectionRange = function (session, row) {
  1697. var line = session.getLine(row);
  1698. var startIndent = line.search(/\S/);
  1699. var startRow = row;
  1700. var startColumn = line.length;
  1701. row = row + 1;
  1702. var endRow = row;
  1703. var maxRow = session.getLength();
  1704. while (++row < maxRow) {
  1705. line = session.getLine(row);
  1706. var indent = line.search(/\S/);
  1707. if (indent === -1)
  1708. continue;
  1709. if (startIndent > indent)
  1710. break;
  1711. var subRange = this.getFoldWidgetRange(session, "all", row);
  1712. if (subRange) {
  1713. if (subRange.start.row <= startRow) {
  1714. break;
  1715. }
  1716. else if (subRange.isMultiLine()) {
  1717. row = subRange.end.row;
  1718. }
  1719. else if (startIndent == indent) {
  1720. break;
  1721. }
  1722. }
  1723. endRow = row;
  1724. }
  1725. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  1726. };
  1727. this.getCommentRegionBlock = function (session, line, row) {
  1728. var startColumn = line.search(/\s*$/);
  1729. var maxRow = session.getLength();
  1730. var startRow = row;
  1731. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  1732. var depth = 1;
  1733. while (++row < maxRow) {
  1734. line = session.getLine(row);
  1735. var m = re.exec(line);
  1736. if (!m)
  1737. continue;
  1738. if (m[1])
  1739. depth--;
  1740. else
  1741. depth++;
  1742. if (!depth)
  1743. break;
  1744. }
  1745. var endRow = row;
  1746. if (endRow > startRow) {
  1747. return new Range(startRow, startColumn, endRow, line.length);
  1748. }
  1749. };
  1750. }).call(FoldMode.prototype);
  1751. });
  1752. 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";
  1753. var oop = require("../../lib/oop");
  1754. var XmlFoldMode = require("./xml").FoldMode;
  1755. var CFoldMode = require("./cstyle").FoldMode;
  1756. var FoldMode = exports.FoldMode = function (commentRegex) {
  1757. if (commentRegex) {
  1758. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  1759. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  1760. }
  1761. this.xmlFoldMode = new XmlFoldMode();
  1762. };
  1763. oop.inherits(FoldMode, CFoldMode);
  1764. (function () {
  1765. this.getFoldWidgetRangeBase = this.getFoldWidgetRange;
  1766. this.getFoldWidgetBase = this.getFoldWidget;
  1767. this.getFoldWidget = function (session, foldStyle, row) {
  1768. var fw = this.getFoldWidgetBase(session, foldStyle, row);
  1769. if (!fw) {
  1770. return this.xmlFoldMode.getFoldWidget(session, foldStyle, row);
  1771. }
  1772. return fw;
  1773. };
  1774. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  1775. var range = this.getFoldWidgetRangeBase(session, foldStyle, row, forceMultiline);
  1776. if (range)
  1777. return range;
  1778. return this.xmlFoldMode.getFoldWidgetRange(session, foldStyle, row);
  1779. };
  1780. }).call(FoldMode.prototype);
  1781. });
  1782. 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";
  1783. var oop = require("../lib/oop");
  1784. var TextMode = require("./text").Mode;
  1785. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1786. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1787. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1788. var JavaScriptBehaviour = require("./behaviour/javascript").JavaScriptBehaviour;
  1789. var JavaScriptFoldMode = require("./folding/javascript").FoldMode;
  1790. var Mode = function () {
  1791. this.HighlightRules = JavaScriptHighlightRules;
  1792. this.$outdent = new MatchingBraceOutdent();
  1793. this.$behaviour = new JavaScriptBehaviour();
  1794. this.foldingRules = new JavaScriptFoldMode();
  1795. };
  1796. oop.inherits(Mode, TextMode);
  1797. (function () {
  1798. this.lineCommentStart = "//";
  1799. this.blockComment = { start: "/*", end: "*/" };
  1800. this.$quotes = { '"': '"', "'": "'", "`": "`" };
  1801. this.$pairQuotesAfter = {
  1802. "`": /\w/
  1803. };
  1804. this.getNextLineIndent = function (state, line, tab) {
  1805. var indent = this.$getIndent(line);
  1806. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  1807. var tokens = tokenizedLine.tokens;
  1808. var endState = tokenizedLine.state;
  1809. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  1810. return indent;
  1811. }
  1812. if (state == "start" || state == "no_regex") {
  1813. var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
  1814. if (match) {
  1815. indent += tab;
  1816. }
  1817. }
  1818. else if (state == "doc-start") {
  1819. if (endState == "start" || endState == "no_regex") {
  1820. return "";
  1821. }
  1822. }
  1823. return indent;
  1824. };
  1825. this.checkOutdent = function (state, line, input) {
  1826. return this.$outdent.checkOutdent(line, input);
  1827. };
  1828. this.autoOutdent = function (state, doc, row) {
  1829. this.$outdent.autoOutdent(doc, row);
  1830. };
  1831. this.createWorker = function (session) {
  1832. var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
  1833. worker.attachToDocument(session.getDocument());
  1834. worker.on("annotate", function (results) {
  1835. session.setAnnotations(results.data);
  1836. });
  1837. worker.on("terminate", function () {
  1838. session.clearAnnotations();
  1839. });
  1840. return worker;
  1841. };
  1842. this.$id = "ace/mode/javascript";
  1843. this.snippetFileId = "ace/snippets/javascript";
  1844. }).call(Mode.prototype);
  1845. exports.Mode = Mode;
  1846. });
  1847. ace.define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module){"use strict";
  1848. var propertyMap = {
  1849. "background": { "#$0": 1 },
  1850. "background-color": { "#$0": 1, "transparent": 1, "fixed": 1 },
  1851. "background-image": { "url('/$0')": 1 },
  1852. "background-repeat": { "repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1 },
  1853. "background-position": { "bottom": 2, "center": 2, "left": 2, "right": 2, "top": 2, "inherit": 2 },
  1854. "background-attachment": { "scroll": 1, "fixed": 1 },
  1855. "background-size": { "cover": 1, "contain": 1 },
  1856. "background-clip": { "border-box": 1, "padding-box": 1, "content-box": 1 },
  1857. "background-origin": { "border-box": 1, "padding-box": 1, "content-box": 1 },
  1858. "border": { "solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1 },
  1859. "border-color": { "#$0": 1 },
  1860. "border-style": { "solid": 2, "dashed": 2, "dotted": 2, "double": 2, "groove": 2, "hidden": 2, "inherit": 2, "inset": 2, "none": 2, "outset": 2, "ridged": 2 },
  1861. "border-collapse": { "collapse": 1, "separate": 1 },
  1862. "bottom": { "px": 1, "em": 1, "%": 1 },
  1863. "clear": { "left": 1, "right": 1, "both": 1, "none": 1 },
  1864. "color": { "#$0": 1, "rgb(#$00,0,0)": 1 },
  1865. "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 },
  1866. "display": { "none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1 },
  1867. "empty-cells": { "show": 1, "hide": 1 },
  1868. "float": { "left": 1, "right": 1, "none": 1 },
  1869. "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 },
  1870. "font-size": { "px": 1, "em": 1, "%": 1 },
  1871. "font-weight": { "bold": 1, "normal": 1 },
  1872. "font-style": { "italic": 1, "normal": 1 },
  1873. "font-variant": { "normal": 1, "small-caps": 1 },
  1874. "height": { "px": 1, "em": 1, "%": 1 },
  1875. "left": { "px": 1, "em": 1, "%": 1 },
  1876. "letter-spacing": { "normal": 1 },
  1877. "line-height": { "normal": 1 },
  1878. "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 },
  1879. "margin": { "px": 1, "em": 1, "%": 1 },
  1880. "margin-right": { "px": 1, "em": 1, "%": 1 },
  1881. "margin-left": { "px": 1, "em": 1, "%": 1 },
  1882. "margin-top": { "px": 1, "em": 1, "%": 1 },
  1883. "margin-bottom": { "px": 1, "em": 1, "%": 1 },
  1884. "max-height": { "px": 1, "em": 1, "%": 1 },
  1885. "max-width": { "px": 1, "em": 1, "%": 1 },
  1886. "min-height": { "px": 1, "em": 1, "%": 1 },
  1887. "min-width": { "px": 1, "em": 1, "%": 1 },
  1888. "overflow": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
  1889. "overflow-x": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
  1890. "overflow-y": { "hidden": 1, "visible": 1, "auto": 1, "scroll": 1 },
  1891. "padding": { "px": 1, "em": 1, "%": 1 },
  1892. "padding-top": { "px": 1, "em": 1, "%": 1 },
  1893. "padding-right": { "px": 1, "em": 1, "%": 1 },
  1894. "padding-bottom": { "px": 1, "em": 1, "%": 1 },
  1895. "padding-left": { "px": 1, "em": 1, "%": 1 },
  1896. "page-break-after": { "auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1 },
  1897. "page-break-before": { "auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1 },
  1898. "position": { "absolute": 1, "relative": 1, "fixed": 1, "static": 1 },
  1899. "right": { "px": 1, "em": 1, "%": 1 },
  1900. "table-layout": { "fixed": 1, "auto": 1 },
  1901. "text-decoration": { "none": 1, "underline": 1, "line-through": 1, "blink": 1 },
  1902. "text-align": { "left": 1, "right": 1, "center": 1, "justify": 1 },
  1903. "text-transform": { "capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1 },
  1904. "top": { "px": 1, "em": 1, "%": 1 },
  1905. "vertical-align": { "top": 1, "bottom": 1 },
  1906. "visibility": { "hidden": 1, "visible": 1 },
  1907. "white-space": { "nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1 },
  1908. "width": { "px": 1, "em": 1, "%": 1 },
  1909. "word-spacing": { "normal": 1 },
  1910. "filter": { "alpha(opacity=$0100)": 1 },
  1911. "text-shadow": { "$02px 2px 2px #777": 1 },
  1912. "text-overflow": { "ellipsis-word": 1, "clip": 1, "ellipsis": 1 },
  1913. "-moz-border-radius": 1,
  1914. "-moz-border-radius-topright": 1,
  1915. "-moz-border-radius-bottomright": 1,
  1916. "-moz-border-radius-topleft": 1,
  1917. "-moz-border-radius-bottomleft": 1,
  1918. "-webkit-border-radius": 1,
  1919. "-webkit-border-top-right-radius": 1,
  1920. "-webkit-border-top-left-radius": 1,
  1921. "-webkit-border-bottom-right-radius": 1,
  1922. "-webkit-border-bottom-left-radius": 1,
  1923. "-moz-box-shadow": 1,
  1924. "-webkit-box-shadow": 1,
  1925. "transform": { "rotate($00deg)": 1, "skew($00deg)": 1 },
  1926. "-moz-transform": { "rotate($00deg)": 1, "skew($00deg)": 1 },
  1927. "-webkit-transform": { "rotate($00deg)": 1, "skew($00deg)": 1 }
  1928. };
  1929. var CssCompletions = function () {
  1930. };
  1931. (function () {
  1932. this.completionsDefined = false;
  1933. this.defineCompletions = function () {
  1934. if (document) {
  1935. var style = document.createElement('c').style;
  1936. for (var i in style) {
  1937. if (typeof style[i] !== 'string')
  1938. continue;
  1939. var name = i.replace(/[A-Z]/g, function (x) {
  1940. return '-' + x.toLowerCase();
  1941. });
  1942. if (!propertyMap.hasOwnProperty(name))
  1943. propertyMap[name] = 1;
  1944. }
  1945. }
  1946. this.completionsDefined = true;
  1947. };
  1948. this.getCompletions = function (state, session, pos, prefix) {
  1949. if (!this.completionsDefined) {
  1950. this.defineCompletions();
  1951. }
  1952. if (state === 'ruleset' || session.$mode.$id == "ace/mode/scss") {
  1953. var line = session.getLine(pos.row).substr(0, pos.column);
  1954. var inParens = /\([^)]*$/.test(line);
  1955. if (inParens) {
  1956. line = line.substr(line.lastIndexOf('(') + 1);
  1957. }
  1958. if (/:[^;]+$/.test(line)) {
  1959. /([\w\-]+):[^:]*$/.test(line);
  1960. return this.getPropertyValueCompletions(state, session, pos, prefix);
  1961. }
  1962. else {
  1963. return this.getPropertyCompletions(state, session, pos, prefix, inParens);
  1964. }
  1965. }
  1966. return [];
  1967. };
  1968. this.getPropertyCompletions = function (state, session, pos, prefix, skipSemicolon) {
  1969. skipSemicolon = skipSemicolon || false;
  1970. var properties = Object.keys(propertyMap);
  1971. return properties.map(function (property) {
  1972. return {
  1973. caption: property,
  1974. snippet: property + ': $0' + (skipSemicolon ? '' : ';'),
  1975. meta: "property",
  1976. score: 1000000
  1977. };
  1978. });
  1979. };
  1980. this.getPropertyValueCompletions = function (state, session, pos, prefix) {
  1981. var line = session.getLine(pos.row).substr(0, pos.column);
  1982. var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
  1983. if (!property)
  1984. return [];
  1985. var values = [];
  1986. if (property in propertyMap && typeof propertyMap[property] === "object") {
  1987. values = Object.keys(propertyMap[property]);
  1988. }
  1989. return values.map(function (value) {
  1990. return {
  1991. caption: value,
  1992. snippet: value,
  1993. meta: "property value",
  1994. score: 1000000
  1995. };
  1996. });
  1997. };
  1998. }).call(CssCompletions.prototype);
  1999. exports.CssCompletions = CssCompletions;
  2000. });
  2001. 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";
  2002. var oop = require("../../lib/oop");
  2003. var Behaviour = require("../behaviour").Behaviour;
  2004. var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
  2005. var TokenIterator = require("../../token_iterator").TokenIterator;
  2006. var CssBehaviour = function () {
  2007. this.inherit(CstyleBehaviour);
  2008. this.add("colon", "insertion", function (state, action, editor, session, text) {
  2009. if (text === ':' && editor.selection.isEmpty()) {
  2010. var cursor = editor.getCursorPosition();
  2011. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  2012. var token = iterator.getCurrentToken();
  2013. if (token && token.value.match(/\s+/)) {
  2014. token = iterator.stepBackward();
  2015. }
  2016. if (token && token.type === 'support.type') {
  2017. var line = session.doc.getLine(cursor.row);
  2018. var rightChar = line.substring(cursor.column, cursor.column + 1);
  2019. if (rightChar === ':') {
  2020. return {
  2021. text: '',
  2022. selection: [1, 1]
  2023. };
  2024. }
  2025. if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
  2026. return {
  2027. text: ':;',
  2028. selection: [1, 1]
  2029. };
  2030. }
  2031. }
  2032. }
  2033. });
  2034. this.add("colon", "deletion", function (state, action, editor, session, range) {
  2035. var selected = session.doc.getTextRange(range);
  2036. if (!range.isMultiLine() && selected === ':') {
  2037. var cursor = editor.getCursorPosition();
  2038. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  2039. var token = iterator.getCurrentToken();
  2040. if (token && token.value.match(/\s+/)) {
  2041. token = iterator.stepBackward();
  2042. }
  2043. if (token && token.type === 'support.type') {
  2044. var line = session.doc.getLine(range.start.row);
  2045. var rightChar = line.substring(range.end.column, range.end.column + 1);
  2046. if (rightChar === ';') {
  2047. range.end.column++;
  2048. return range;
  2049. }
  2050. }
  2051. }
  2052. });
  2053. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  2054. if (text === ';' && editor.selection.isEmpty()) {
  2055. var cursor = editor.getCursorPosition();
  2056. var line = session.doc.getLine(cursor.row);
  2057. var rightChar = line.substring(cursor.column, cursor.column + 1);
  2058. if (rightChar === ';') {
  2059. return {
  2060. text: '',
  2061. selection: [1, 1]
  2062. };
  2063. }
  2064. }
  2065. });
  2066. this.add("!important", "insertion", function (state, action, editor, session, text) {
  2067. if (text === '!' && editor.selection.isEmpty()) {
  2068. var cursor = editor.getCursorPosition();
  2069. var line = session.doc.getLine(cursor.row);
  2070. if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
  2071. return {
  2072. text: '!important',
  2073. selection: [10, 10]
  2074. };
  2075. }
  2076. }
  2077. });
  2078. };
  2079. oop.inherits(CssBehaviour, CstyleBehaviour);
  2080. exports.CssBehaviour = CssBehaviour;
  2081. });
  2082. 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";
  2083. var oop = require("../lib/oop");
  2084. var TextMode = require("./text").Mode;
  2085. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  2086. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  2087. var WorkerClient = require("../worker/worker_client").WorkerClient;
  2088. var CssCompletions = require("./css_completions").CssCompletions;
  2089. var CssBehaviour = require("./behaviour/css").CssBehaviour;
  2090. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  2091. var Mode = function () {
  2092. this.HighlightRules = CssHighlightRules;
  2093. this.$outdent = new MatchingBraceOutdent();
  2094. this.$behaviour = new CssBehaviour();
  2095. this.$completer = new CssCompletions();
  2096. this.foldingRules = new CStyleFoldMode();
  2097. };
  2098. oop.inherits(Mode, TextMode);
  2099. (function () {
  2100. this.foldingRules = "cStyle";
  2101. this.blockComment = { start: "/*", end: "*/" };
  2102. this.getNextLineIndent = function (state, line, tab) {
  2103. var indent = this.$getIndent(line);
  2104. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  2105. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  2106. return indent;
  2107. }
  2108. var match = line.match(/^.*\{\s*$/);
  2109. if (match) {
  2110. indent += tab;
  2111. }
  2112. return indent;
  2113. };
  2114. this.checkOutdent = function (state, line, input) {
  2115. return this.$outdent.checkOutdent(line, input);
  2116. };
  2117. this.autoOutdent = function (state, doc, row) {
  2118. this.$outdent.autoOutdent(doc, row);
  2119. };
  2120. this.getCompletions = function (state, session, pos, prefix) {
  2121. return this.$completer.getCompletions(state, session, pos, prefix);
  2122. };
  2123. this.createWorker = function (session) {
  2124. var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
  2125. worker.attachToDocument(session.getDocument());
  2126. worker.on("annotate", function (e) {
  2127. session.setAnnotations(e.data);
  2128. });
  2129. worker.on("terminate", function () {
  2130. session.clearAnnotations();
  2131. });
  2132. return worker;
  2133. };
  2134. this.$id = "ace/mode/css";
  2135. this.snippetFileId = "ace/snippets/css";
  2136. }).call(Mode.prototype);
  2137. exports.Mode = Mode;
  2138. });
  2139. ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
  2140. var oop = require("../../lib/oop");
  2141. var BaseFoldMode = require("./fold_mode").FoldMode;
  2142. var FoldMode = exports.FoldMode = function (defaultMode, subModes) {
  2143. this.defaultMode = defaultMode;
  2144. this.subModes = subModes;
  2145. };
  2146. oop.inherits(FoldMode, BaseFoldMode);
  2147. (function () {
  2148. this.$getMode = function (state) {
  2149. if (typeof state != "string")
  2150. state = state[0];
  2151. for (var key in this.subModes) {
  2152. if (state.indexOf(key) === 0)
  2153. return this.subModes[key];
  2154. }
  2155. return null;
  2156. };
  2157. this.$tryMode = function (state, session, foldStyle, row) {
  2158. var mode = this.$getMode(state);
  2159. return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
  2160. };
  2161. this.getFoldWidget = function (session, foldStyle, row) {
  2162. return (this.$tryMode(session.getState(row - 1), session, foldStyle, row) ||
  2163. this.$tryMode(session.getState(row), session, foldStyle, row) ||
  2164. this.defaultMode.getFoldWidget(session, foldStyle, row));
  2165. };
  2166. this.getFoldWidgetRange = function (session, foldStyle, row) {
  2167. var mode = this.$getMode(session.getState(row - 1));
  2168. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  2169. mode = this.$getMode(session.getState(row));
  2170. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  2171. mode = this.defaultMode;
  2172. return mode.getFoldWidgetRange(session, foldStyle, row);
  2173. };
  2174. }).call(FoldMode.prototype);
  2175. });
  2176. 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";
  2177. var oop = require("../../lib/oop");
  2178. var MixedFoldMode = require("./mixed").FoldMode;
  2179. var XmlFoldMode = require("./xml").FoldMode;
  2180. var CStyleFoldMode = require("./cstyle").FoldMode;
  2181. var FoldMode = exports.FoldMode = function (voidElements, optionalTags) {
  2182. MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
  2183. "js-": new CStyleFoldMode(),
  2184. "css-": new CStyleFoldMode()
  2185. });
  2186. };
  2187. oop.inherits(FoldMode, MixedFoldMode);
  2188. });
  2189. ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module){"use strict";
  2190. var TokenIterator = require("../token_iterator").TokenIterator;
  2191. var commonAttributes = [
  2192. "accesskey",
  2193. "class",
  2194. "contenteditable",
  2195. "contextmenu",
  2196. "dir",
  2197. "draggable",
  2198. "dropzone",
  2199. "hidden",
  2200. "id",
  2201. "inert",
  2202. "itemid",
  2203. "itemprop",
  2204. "itemref",
  2205. "itemscope",
  2206. "itemtype",
  2207. "lang",
  2208. "spellcheck",
  2209. "style",
  2210. "tabindex",
  2211. "title",
  2212. "translate"
  2213. ];
  2214. var eventAttributes = [
  2215. "onabort",
  2216. "onblur",
  2217. "oncancel",
  2218. "oncanplay",
  2219. "oncanplaythrough",
  2220. "onchange",
  2221. "onclick",
  2222. "onclose",
  2223. "oncontextmenu",
  2224. "oncuechange",
  2225. "ondblclick",
  2226. "ondrag",
  2227. "ondragend",
  2228. "ondragenter",
  2229. "ondragleave",
  2230. "ondragover",
  2231. "ondragstart",
  2232. "ondrop",
  2233. "ondurationchange",
  2234. "onemptied",
  2235. "onended",
  2236. "onerror",
  2237. "onfocus",
  2238. "oninput",
  2239. "oninvalid",
  2240. "onkeydown",
  2241. "onkeypress",
  2242. "onkeyup",
  2243. "onload",
  2244. "onloadeddata",
  2245. "onloadedmetadata",
  2246. "onloadstart",
  2247. "onmousedown",
  2248. "onmousemove",
  2249. "onmouseout",
  2250. "onmouseover",
  2251. "onmouseup",
  2252. "onmousewheel",
  2253. "onpause",
  2254. "onplay",
  2255. "onplaying",
  2256. "onprogress",
  2257. "onratechange",
  2258. "onreset",
  2259. "onscroll",
  2260. "onseeked",
  2261. "onseeking",
  2262. "onselect",
  2263. "onshow",
  2264. "onstalled",
  2265. "onsubmit",
  2266. "onsuspend",
  2267. "ontimeupdate",
  2268. "onvolumechange",
  2269. "onwaiting"
  2270. ];
  2271. var globalAttributes = commonAttributes.concat(eventAttributes);
  2272. var attributeMap = {
  2273. "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 },
  2274. "abbr": {},
  2275. "address": {},
  2276. "area": { "shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1 },
  2277. "article": { "pubdate": 1 },
  2278. "aside": {},
  2279. "audio": { "src": 1, "autobuffer": 1, "autoplay": { "autoplay": 1 }, "loop": { "loop": 1 }, "controls": { "controls": 1 }, "muted": { "muted": 1 }, "preload": { "auto": 1, "metadata": 1, "none": 1 } },
  2280. "b": {},
  2281. "base": { "href": 1, "target": 1 },
  2282. "bdi": {},
  2283. "bdo": {},
  2284. "blockquote": { "cite": 1 },
  2285. "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 },
  2286. "br": {},
  2287. "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 } },
  2288. "canvas": { "width": 1, "height": 1 },
  2289. "caption": {},
  2290. "cite": {},
  2291. "code": {},
  2292. "col": { "span": 1 },
  2293. "colgroup": { "span": 1 },
  2294. "command": { "type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1 },
  2295. "data": {},
  2296. "datalist": {},
  2297. "dd": {},
  2298. "del": { "cite": 1, "datetime": 1 },
  2299. "details": { "open": 1 },
  2300. "dfn": {},
  2301. "dialog": { "open": 1 },
  2302. "div": {},
  2303. "dl": {},
  2304. "dt": {},
  2305. "em": {},
  2306. "embed": { "src": 1, "height": 1, "width": 1, "type": 1 },
  2307. "fieldset": { "disabled": 1, "form": 1, "name": 1 },
  2308. "figcaption": {},
  2309. "figure": {},
  2310. "footer": {},
  2311. "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 } },
  2312. "h1": {},
  2313. "h2": {},
  2314. "h3": {},
  2315. "h4": {},
  2316. "h5": {},
  2317. "h6": {},
  2318. "head": {},
  2319. "header": {},
  2320. "hr": {},
  2321. "html": { "manifest": 1 },
  2322. "i": {},
  2323. "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 } },
  2324. "img": { "alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1 },
  2325. "input": {
  2326. "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 },
  2327. "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
  2328. },
  2329. "ins": { "cite": 1, "datetime": 1 },
  2330. "kbd": {},
  2331. "keygen": { "autofocus": 1, "challenge": { "challenge": 1 }, "disabled": { "disabled": 1 }, "form": 1, "keytype": { "rsa": 1, "dsa": 1, "ec": 1 }, "name": 1 },
  2332. "label": { "form": 1, "for": 1 },
  2333. "legend": {},
  2334. "li": { "value": 1 },
  2335. "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 },
  2336. "main": {},
  2337. "map": { "name": 1 },
  2338. "mark": {},
  2339. "math": {},
  2340. "menu": { "type": 1, "label": 1 },
  2341. "meta": { "http-equiv": { "content-type": 1 }, "name": { "description": 1, "keywords": 1 }, "content": { "text/html; charset=UTF-8": 1 }, "charset": 1 },
  2342. "meter": { "value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1 },
  2343. "nav": {},
  2344. "noscript": { "href": 1 },
  2345. "object": { "param": 1, "data": 1, "type": 1, "height": 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1 },
  2346. "ol": { "start": 1, "reversed": 1 },
  2347. "optgroup": { "disabled": 1, "label": 1 },
  2348. "option": { "disabled": 1, "selected": 1, "label": 1, "value": 1 },
  2349. "output": { "for": 1, "form": 1, "name": 1 },
  2350. "p": {},
  2351. "param": { "name": 1, "value": 1 },
  2352. "pre": {},
  2353. "progress": { "value": 1, "max": 1 },
  2354. "q": { "cite": 1 },
  2355. "rp": {},
  2356. "rt": {},
  2357. "ruby": {},
  2358. "s": {},
  2359. "samp": {},
  2360. "script": { "charset": 1, "type": { "text/javascript": 1 }, "src": 1, "defer": 1, "async": 1 },
  2361. "select": { "autofocus": 1, "disabled": 1, "form": 1, "multiple": { "multiple": 1 }, "name": 1, "size": 1, "readonly": { "readonly": 1 } },
  2362. "small": {},
  2363. "source": { "src": 1, "type": 1, "media": 1 },
  2364. "span": {},
  2365. "strong": {},
  2366. "style": { "type": 1, "media": { "all": 1, "screen": 1, "print": 1 }, "scoped": 1 },
  2367. "sub": {},
  2368. "sup": {},
  2369. "svg": {},
  2370. "table": { "summary": 1 },
  2371. "tbody": {},
  2372. "td": { "headers": 1, "rowspan": 1, "colspan": 1 },
  2373. "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 } },
  2374. "tfoot": {},
  2375. "th": { "headers": 1, "rowspan": 1, "colspan": 1, "scope": 1 },
  2376. "thead": {},
  2377. "time": { "datetime": 1 },
  2378. "title": {},
  2379. "tr": {},
  2380. "track": { "kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1 },
  2381. "section": {},
  2382. "summary": {},
  2383. "u": {},
  2384. "ul": {},
  2385. "var": {},
  2386. "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 } },
  2387. "wbr": {}
  2388. };
  2389. var elements = Object.keys(attributeMap);
  2390. function is(token, type) {
  2391. return token.type.lastIndexOf(type + ".xml") > -1;
  2392. }
  2393. function findTagName(session, pos) {
  2394. var iterator = new TokenIterator(session, pos.row, pos.column);
  2395. var token = iterator.getCurrentToken();
  2396. while (token && !is(token, "tag-name")) {
  2397. token = iterator.stepBackward();
  2398. }
  2399. if (token)
  2400. return token.value;
  2401. }
  2402. function findAttributeName(session, pos) {
  2403. var iterator = new TokenIterator(session, pos.row, pos.column);
  2404. var token = iterator.getCurrentToken();
  2405. while (token && !is(token, "attribute-name")) {
  2406. token = iterator.stepBackward();
  2407. }
  2408. if (token)
  2409. return token.value;
  2410. }
  2411. var HtmlCompletions = function () {
  2412. };
  2413. (function () {
  2414. this.getCompletions = function (state, session, pos, prefix) {
  2415. var token = session.getTokenAt(pos.row, pos.column);
  2416. if (!token)
  2417. return [];
  2418. if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
  2419. return this.getTagCompletions(state, session, pos, prefix);
  2420. if (is(token, "tag-whitespace") || is(token, "attribute-name"))
  2421. return this.getAttributeCompletions(state, session, pos, prefix);
  2422. if (is(token, "attribute-value"))
  2423. return this.getAttributeValueCompletions(state, session, pos, prefix);
  2424. var line = session.getLine(pos.row).substr(0, pos.column);
  2425. if (/&[a-z]*$/i.test(line))
  2426. return this.getHTMLEntityCompletions(state, session, pos, prefix);
  2427. return [];
  2428. };
  2429. this.getTagCompletions = function (state, session, pos, prefix) {
  2430. return elements.map(function (element) {
  2431. return {
  2432. value: element,
  2433. meta: "tag",
  2434. score: 1000000
  2435. };
  2436. });
  2437. };
  2438. this.getAttributeCompletions = function (state, session, pos, prefix) {
  2439. var tagName = findTagName(session, pos);
  2440. if (!tagName)
  2441. return [];
  2442. var attributes = globalAttributes;
  2443. if (tagName in attributeMap) {
  2444. attributes = attributes.concat(Object.keys(attributeMap[tagName]));
  2445. }
  2446. return attributes.map(function (attribute) {
  2447. return {
  2448. caption: attribute,
  2449. snippet: attribute + '="$0"',
  2450. meta: "attribute",
  2451. score: 1000000
  2452. };
  2453. });
  2454. };
  2455. this.getAttributeValueCompletions = function (state, session, pos, prefix) {
  2456. var tagName = findTagName(session, pos);
  2457. var attributeName = findAttributeName(session, pos);
  2458. if (!tagName)
  2459. return [];
  2460. var values = [];
  2461. if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
  2462. values = Object.keys(attributeMap[tagName][attributeName]);
  2463. }
  2464. return values.map(function (value) {
  2465. return {
  2466. caption: value,
  2467. snippet: value,
  2468. meta: "attribute value",
  2469. score: 1000000
  2470. };
  2471. });
  2472. };
  2473. this.getHTMLEntityCompletions = function (state, session, pos, prefix) {
  2474. 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;'];
  2475. return values.map(function (value) {
  2476. return {
  2477. caption: value,
  2478. snippet: value,
  2479. meta: "html entity",
  2480. score: 1000000
  2481. };
  2482. });
  2483. };
  2484. }).call(HtmlCompletions.prototype);
  2485. exports.HtmlCompletions = HtmlCompletions;
  2486. });
  2487. 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";
  2488. var oop = require("../lib/oop");
  2489. var lang = require("../lib/lang");
  2490. var TextMode = require("./text").Mode;
  2491. var JavaScriptMode = require("./javascript").Mode;
  2492. var CssMode = require("./css").Mode;
  2493. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2494. var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
  2495. var HtmlFoldMode = require("./folding/html").FoldMode;
  2496. var HtmlCompletions = require("./html_completions").HtmlCompletions;
  2497. var WorkerClient = require("../worker/worker_client").WorkerClient;
  2498. var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
  2499. var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
  2500. var Mode = function (options) {
  2501. this.fragmentContext = options && options.fragmentContext;
  2502. this.HighlightRules = HtmlHighlightRules;
  2503. this.$behaviour = new XmlBehaviour();
  2504. this.$completer = new HtmlCompletions();
  2505. this.createModeDelegates({
  2506. "js-": JavaScriptMode,
  2507. "css-": CssMode
  2508. });
  2509. this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
  2510. };
  2511. oop.inherits(Mode, TextMode);
  2512. (function () {
  2513. this.blockComment = { start: "<!--", end: "-->" };
  2514. this.voidElements = lang.arrayToMap(voidElements);
  2515. this.getNextLineIndent = function (state, line, tab) {
  2516. return this.$getIndent(line);
  2517. };
  2518. this.checkOutdent = function (state, line, input) {
  2519. return false;
  2520. };
  2521. this.getCompletions = function (state, session, pos, prefix) {
  2522. return this.$completer.getCompletions(state, session, pos, prefix);
  2523. };
  2524. this.createWorker = function (session) {
  2525. if (this.constructor != Mode)
  2526. return;
  2527. var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
  2528. worker.attachToDocument(session.getDocument());
  2529. if (this.fragmentContext)
  2530. worker.call("setOptions", [{ context: this.fragmentContext }]);
  2531. worker.on("error", function (e) {
  2532. session.setAnnotations(e.data);
  2533. });
  2534. worker.on("terminate", function () {
  2535. session.clearAnnotations();
  2536. });
  2537. return worker;
  2538. };
  2539. this.$id = "ace/mode/html";
  2540. this.snippetFileId = "ace/snippets/html";
  2541. }).call(Mode.prototype);
  2542. exports.Mode = Mode;
  2543. });
  2544. ace.define("ace/mode/sh_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  2545. var oop = require("../lib/oop");
  2546. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  2547. var reservedKeywords = exports.reservedKeywords = ('!|{|}|case|do|done|elif|else|' +
  2548. 'esac|fi|for|if|in|then|until|while|' +
  2549. '&|;|export|local|read|typeset|unset|' +
  2550. 'elif|select|set|function|declare|readonly');
  2551. var languageConstructs = exports.languageConstructs = ('[|]|alias|bg|bind|break|builtin|' +
  2552. 'cd|command|compgen|complete|continue|' +
  2553. 'dirs|disown|echo|enable|eval|exec|' +
  2554. 'exit|fc|fg|getopts|hash|help|history|' +
  2555. 'jobs|kill|let|logout|popd|printf|pushd|' +
  2556. 'pwd|return|set|shift|shopt|source|' +
  2557. 'suspend|test|times|trap|type|ulimit|' +
  2558. 'umask|unalias|wait');
  2559. var ShHighlightRules = function () {
  2560. var keywordMapper = this.createKeywordMapper({
  2561. "keyword": reservedKeywords,
  2562. "support.function.builtin": languageConstructs,
  2563. "invalid.deprecated": "debugger"
  2564. }, "identifier");
  2565. var integer = "(?:(?:[1-9]\\d*)|(?:0))";
  2566. var fraction = "(?:\\.\\d+)";
  2567. var intPart = "(?:\\d+)";
  2568. var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
  2569. var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + ")";
  2570. var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
  2571. var fileDescriptor = "(?:&" + intPart + ")";
  2572. var variableName = "[a-zA-Z_][a-zA-Z0-9_]*";
  2573. var variable = "(?:" + variableName + "(?==))";
  2574. var builtinVariable = "(?:\\$(?:SHLVL|\\$|\\!|\\?))";
  2575. var func = "(?:" + variableName + "\\s*\\(\\))";
  2576. this.$rules = {
  2577. "start": [{
  2578. token: "constant",
  2579. regex: /\\./
  2580. }, {
  2581. token: ["text", "comment"],
  2582. regex: /(^|\s)(#.*)$/
  2583. }, {
  2584. token: "string.start",
  2585. regex: '"',
  2586. push: [{
  2587. token: "constant.language.escape",
  2588. regex: /\\(?:[$`"\\]|$)/
  2589. }, {
  2590. include: "variables"
  2591. }, {
  2592. token: "keyword.operator",
  2593. regex: /`/ // TODO highlight `
  2594. }, {
  2595. token: "string.end",
  2596. regex: '"',
  2597. next: "pop"
  2598. }, {
  2599. defaultToken: "string"
  2600. }]
  2601. }, {
  2602. token: "string",
  2603. regex: "\\$'",
  2604. push: [{
  2605. token: "constant.language.escape",
  2606. regex: /\\(?:[abeEfnrtv\\'"]|x[a-fA-F\d]{1,2}|u[a-fA-F\d]{4}([a-fA-F\d]{4})?|c.|\d{1,3})/
  2607. }, {
  2608. token: "string",
  2609. regex: "'",
  2610. next: "pop"
  2611. }, {
  2612. defaultToken: "string"
  2613. }]
  2614. }, {
  2615. regex: "<<<",
  2616. token: "keyword.operator"
  2617. }, {
  2618. stateName: "heredoc",
  2619. regex: "(<<-?)(\\s*)(['\"`]?)([\\w\\-]+)(['\"`]?)",
  2620. onMatch: function (value, currentState, stack) {
  2621. var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
  2622. var tokens = value.split(this.splitRegex);
  2623. stack.push(next, tokens[4]);
  2624. return [
  2625. { type: "constant", value: tokens[1] },
  2626. { type: "text", value: tokens[2] },
  2627. { type: "string", value: tokens[3] },
  2628. { type: "support.class", value: tokens[4] },
  2629. { type: "string", value: tokens[5] }
  2630. ];
  2631. },
  2632. rules: {
  2633. heredoc: [{
  2634. onMatch: function (value, currentState, stack) {
  2635. if (value === stack[1]) {
  2636. stack.shift();
  2637. stack.shift();
  2638. this.next = stack[0] || "start";
  2639. return "support.class";
  2640. }
  2641. this.next = "";
  2642. return "string";
  2643. },
  2644. regex: ".*$",
  2645. next: "start"
  2646. }],
  2647. indentedHeredoc: [{
  2648. token: "string",
  2649. regex: "^\t+"
  2650. }, {
  2651. onMatch: function (value, currentState, stack) {
  2652. if (value === stack[1]) {
  2653. stack.shift();
  2654. stack.shift();
  2655. this.next = stack[0] || "start";
  2656. return "support.class";
  2657. }
  2658. this.next = "";
  2659. return "string";
  2660. },
  2661. regex: ".*$",
  2662. next: "start"
  2663. }]
  2664. }
  2665. }, {
  2666. regex: "$",
  2667. token: "empty",
  2668. next: function (currentState, stack) {
  2669. if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
  2670. return stack[0];
  2671. return currentState;
  2672. }
  2673. }, {
  2674. token: ["keyword", "text", "text", "text", "variable"],
  2675. regex: /(declare|local|readonly)(\s+)(?:(-[fixar]+)(\s+))?([a-zA-Z_][a-zA-Z0-9_]*\b)/
  2676. }, {
  2677. token: "variable.language",
  2678. regex: builtinVariable
  2679. }, {
  2680. token: "variable",
  2681. regex: variable
  2682. }, {
  2683. include: "variables"
  2684. }, {
  2685. token: "support.function",
  2686. regex: func
  2687. }, {
  2688. token: "support.function",
  2689. regex: fileDescriptor
  2690. }, {
  2691. token: "string", // ' string
  2692. start: "'", end: "'"
  2693. }, {
  2694. token: "constant.numeric", // float
  2695. regex: floatNumber
  2696. }, {
  2697. token: "constant.numeric", // integer
  2698. regex: integer + "\\b"
  2699. }, {
  2700. token: keywordMapper,
  2701. regex: "[a-zA-Z_][a-zA-Z0-9_]*\\b"
  2702. }, {
  2703. token: "keyword.operator",
  2704. regex: "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!=|[%&|`]"
  2705. }, {
  2706. token: "punctuation.operator",
  2707. regex: ";"
  2708. }, {
  2709. token: "paren.lparen",
  2710. regex: "[\\[\\(\\{]"
  2711. }, {
  2712. token: "paren.rparen",
  2713. regex: "[\\]]"
  2714. }, {
  2715. token: "paren.rparen",
  2716. regex: "[\\)\\}]",
  2717. next: "pop"
  2718. }],
  2719. variables: [{
  2720. token: "variable",
  2721. regex: /(\$)(\w+)/
  2722. }, {
  2723. token: ["variable", "paren.lparen"],
  2724. regex: /(\$)(\()/,
  2725. push: "start"
  2726. }, {
  2727. token: ["variable", "paren.lparen", "keyword.operator", "variable", "keyword.operator"],
  2728. regex: /(\$)(\{)([#!]?)(\w+|[*@#?\-$!0_])(:[?+\-=]?|##?|%%?|,,?\/|\^\^?)?/,
  2729. push: "start"
  2730. }, {
  2731. token: "variable",
  2732. regex: /\$[*@#?\-$!0_]/
  2733. }, {
  2734. token: ["variable", "paren.lparen"],
  2735. regex: /(\$)(\{)/,
  2736. push: "start"
  2737. }]
  2738. };
  2739. this.normalizeRules();
  2740. };
  2741. oop.inherits(ShHighlightRules, TextHighlightRules);
  2742. exports.ShHighlightRules = ShHighlightRules;
  2743. });
  2744. ace.define("ace/mode/sh",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/sh_highlight_rules","ace/range","ace/mode/folding/cstyle"], function(require, exports, module){"use strict";
  2745. var oop = require("../lib/oop");
  2746. var TextMode = require("./text").Mode;
  2747. var ShHighlightRules = require("./sh_highlight_rules").ShHighlightRules;
  2748. var Range = require("../range").Range;
  2749. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  2750. var Mode = function () {
  2751. this.HighlightRules = ShHighlightRules;
  2752. this.foldingRules = new CStyleFoldMode();
  2753. this.$behaviour = this.$defaultBehaviour;
  2754. };
  2755. oop.inherits(Mode, TextMode);
  2756. (function () {
  2757. this.lineCommentStart = "#";
  2758. this.getNextLineIndent = function (state, line, tab) {
  2759. var indent = this.$getIndent(line);
  2760. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  2761. var tokens = tokenizedLine.tokens;
  2762. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  2763. return indent;
  2764. }
  2765. if (state == "start") {
  2766. var match = line.match(/^.*[\{\(\[:]\s*$/);
  2767. if (match) {
  2768. indent += tab;
  2769. }
  2770. }
  2771. return indent;
  2772. };
  2773. var outdents = {
  2774. "pass": 1,
  2775. "return": 1,
  2776. "raise": 1,
  2777. "break": 1,
  2778. "continue": 1
  2779. };
  2780. this.checkOutdent = function (state, line, input) {
  2781. if (input !== "\r\n" && input !== "\r" && input !== "\n")
  2782. return false;
  2783. var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
  2784. if (!tokens)
  2785. return false;
  2786. do {
  2787. var last = tokens.pop();
  2788. } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
  2789. if (!last)
  2790. return false;
  2791. return (last.type == "keyword" && outdents[last.value]);
  2792. };
  2793. this.autoOutdent = function (state, doc, row) {
  2794. row += 1;
  2795. var indent = this.$getIndent(doc.getLine(row));
  2796. var tab = doc.getTabString();
  2797. if (indent.slice(-tab.length) == tab)
  2798. doc.remove(new Range(row, indent.length - tab.length, row, indent.length));
  2799. };
  2800. this.$id = "ace/mode/sh";
  2801. this.snippetFileId = "ace/snippets/sh";
  2802. }).call(Mode.prototype);
  2803. exports.Mode = Mode;
  2804. });
  2805. ace.define("ace/mode/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/xml_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/xml","ace/worker/worker_client"], function(require, exports, module){"use strict";
  2806. var oop = require("../lib/oop");
  2807. var lang = require("../lib/lang");
  2808. var TextMode = require("./text").Mode;
  2809. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  2810. var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
  2811. var XmlFoldMode = require("./folding/xml").FoldMode;
  2812. var WorkerClient = require("../worker/worker_client").WorkerClient;
  2813. var Mode = function () {
  2814. this.HighlightRules = XmlHighlightRules;
  2815. this.$behaviour = new XmlBehaviour();
  2816. this.foldingRules = new XmlFoldMode();
  2817. };
  2818. oop.inherits(Mode, TextMode);
  2819. (function () {
  2820. this.voidElements = lang.arrayToMap([]);
  2821. this.blockComment = { start: "<!--", end: "-->" };
  2822. this.createWorker = function (session) {
  2823. var worker = new WorkerClient(["ace"], "ace/mode/xml_worker", "Worker");
  2824. worker.attachToDocument(session.getDocument());
  2825. worker.on("error", function (e) {
  2826. session.setAnnotations(e.data);
  2827. });
  2828. worker.on("terminate", function () {
  2829. session.clearAnnotations();
  2830. });
  2831. return worker;
  2832. };
  2833. this.$id = "ace/mode/xml";
  2834. }).call(Mode.prototype);
  2835. exports.Mode = Mode;
  2836. });
  2837. ace.define("ace/mode/markdown",["require","exports","module","ace/lib/oop","ace/mode/behaviour/cstyle","ace/mode/text","ace/mode/markdown_highlight_rules","ace/mode/folding/markdown","ace/mode/javascript","ace/mode/html","ace/mode/sh","ace/mode/sh","ace/mode/xml","ace/mode/css"], function(require, exports, module){"use strict";
  2838. var oop = require("../lib/oop");
  2839. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  2840. var TextMode = require("./text").Mode;
  2841. var MarkdownHighlightRules = require("./markdown_highlight_rules").MarkdownHighlightRules;
  2842. var MarkdownFoldMode = require("./folding/markdown").FoldMode;
  2843. var Mode = function () {
  2844. this.HighlightRules = MarkdownHighlightRules;
  2845. this.createModeDelegates({
  2846. javascript: require("./javascript").Mode,
  2847. html: require("./html").Mode,
  2848. bash: require("./sh").Mode,
  2849. sh: require("./sh").Mode,
  2850. xml: require("./xml").Mode,
  2851. css: require("./css").Mode
  2852. });
  2853. this.foldingRules = new MarkdownFoldMode();
  2854. this.$behaviour = new CstyleBehaviour({ braces: true });
  2855. };
  2856. oop.inherits(Mode, TextMode);
  2857. (function () {
  2858. this.type = "text";
  2859. this.blockComment = { start: "<!--", end: "-->" };
  2860. this.$quotes = { '"': '"', "`": "`" };
  2861. this.getNextLineIndent = function (state, line, tab) {
  2862. if (state == "listblock") {
  2863. var match = /^(\s*)(?:([-+*])|(\d+)\.)(\s+)/.exec(line);
  2864. if (!match)
  2865. return "";
  2866. var marker = match[2];
  2867. if (!marker)
  2868. marker = parseInt(match[3], 10) + 1 + ".";
  2869. return match[1] + marker + match[4];
  2870. }
  2871. else {
  2872. return this.$getIndent(line);
  2873. }
  2874. };
  2875. this.$id = "ace/mode/markdown";
  2876. this.snippetFileId = "ace/snippets/markdown";
  2877. }).call(Mode.prototype);
  2878. exports.Mode = Mode;
  2879. }); (function() {
  2880. ace.require(["ace/mode/markdown"], function(m) {
  2881. if (typeof module == "object" && typeof exports == "object" && module) {
  2882. module.exports = m;
  2883. }
  2884. });
  2885. })();