mode-html_ruby.js 139 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550
  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) {
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var lang = require("../lib/lang");
  5. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  6. 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";
  7. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  8. var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero|zoom";
  9. 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";
  10. 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";
  11. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
  12. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  13. 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";
  14. var CssHighlightRules = function() {
  15. var keywordMapper = this.createKeywordMapper({
  16. "support.function": supportFunction,
  17. "support.constant": supportConstant,
  18. "support.type": supportType,
  19. "support.constant.color": supportConstantColor,
  20. "support.constant.fonts": supportConstantFonts
  21. }, "text", true);
  22. this.$rules = {
  23. "start" : [{
  24. include : ["strings", "url", "comments"]
  25. }, {
  26. token: "paren.lparen",
  27. regex: "\\{",
  28. next: "ruleset"
  29. }, {
  30. token: "paren.rparen",
  31. regex: "\\}"
  32. }, {
  33. token: "string",
  34. regex: "@(?!viewport)",
  35. next: "media"
  36. }, {
  37. token: "keyword",
  38. regex: "#[a-z0-9-_]+"
  39. }, {
  40. token: "keyword",
  41. regex: "%"
  42. }, {
  43. token: "variable",
  44. regex: "\\.[a-z0-9-_]+"
  45. }, {
  46. token: "string",
  47. regex: ":[a-z0-9-_]+"
  48. }, {
  49. token : "constant.numeric",
  50. regex : numRe
  51. }, {
  52. token: "constant",
  53. regex: "[a-z0-9-_]+"
  54. }, {
  55. caseInsensitive: true
  56. }],
  57. "media": [{
  58. include : ["strings", "url", "comments"]
  59. }, {
  60. token: "paren.lparen",
  61. regex: "\\{",
  62. next: "start"
  63. }, {
  64. token: "paren.rparen",
  65. regex: "\\}",
  66. next: "start"
  67. }, {
  68. token: "string",
  69. regex: ";",
  70. next: "start"
  71. }, {
  72. token: "keyword",
  73. regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
  74. + "|page|font|keyframes|viewport|counter-style|font-feature-values"
  75. + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
  76. }],
  77. "comments" : [{
  78. token: "comment", // multi line comment
  79. regex: "\\/\\*",
  80. push: [{
  81. token : "comment",
  82. regex : "\\*\\/",
  83. next : "pop"
  84. }, {
  85. defaultToken : "comment"
  86. }]
  87. }],
  88. "ruleset" : [{
  89. regex : "-(webkit|ms|moz|o)-",
  90. token : "text"
  91. }, {
  92. token : "punctuation.operator",
  93. regex : "[:;]"
  94. }, {
  95. token : "paren.rparen",
  96. regex : "\\}",
  97. next : "start"
  98. }, {
  99. include : ["strings", "url", "comments"]
  100. }, {
  101. token : ["constant.numeric", "keyword"],
  102. 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|%)"
  103. }, {
  104. token : "constant.numeric",
  105. regex : numRe
  106. }, {
  107. token : "constant.numeric", // hex6 color
  108. regex : "#[a-f0-9]{6}"
  109. }, {
  110. token : "constant.numeric", // hex3 color
  111. regex : "#[a-f0-9]{3}"
  112. }, {
  113. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  114. regex : pseudoElements
  115. }, {
  116. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  117. regex : pseudoClasses
  118. }, {
  119. include: "url"
  120. }, {
  121. token : keywordMapper,
  122. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  123. }, {
  124. caseInsensitive: true
  125. }],
  126. url: [{
  127. token : "support.function",
  128. regex : "(?:url(:?-prefix)?|domain|regexp)\\(",
  129. push: [{
  130. token : "support.function",
  131. regex : "\\)",
  132. next : "pop"
  133. }, {
  134. defaultToken: "string"
  135. }]
  136. }],
  137. strings: [{
  138. token : "string.start",
  139. regex : "'",
  140. push : [{
  141. token : "string.end",
  142. regex : "'|$",
  143. next: "pop"
  144. }, {
  145. include : "escapes"
  146. }, {
  147. token : "constant.language.escape",
  148. regex : /\\$/,
  149. consumeLineEnd: true
  150. }, {
  151. defaultToken: "string"
  152. }]
  153. }, {
  154. token : "string.start",
  155. regex : '"',
  156. push : [{
  157. token : "string.end",
  158. regex : '"|$',
  159. next: "pop"
  160. }, {
  161. include : "escapes"
  162. }, {
  163. token : "constant.language.escape",
  164. regex : /\\$/,
  165. consumeLineEnd: true
  166. }, {
  167. defaultToken: "string"
  168. }]
  169. }],
  170. escapes: [{
  171. token : "constant.language.escape",
  172. regex : /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
  173. }]
  174. };
  175. this.normalizeRules();
  176. };
  177. oop.inherits(CssHighlightRules, TextHighlightRules);
  178. exports.CssHighlightRules = CssHighlightRules;
  179. });
  180. ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  181. "use strict";
  182. var oop = require("../lib/oop");
  183. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  184. var DocCommentHighlightRules = function() {
  185. this.$rules = {
  186. "start" : [ {
  187. token : "comment.doc.tag",
  188. regex : "@[\\w\\d_]+" // TODO: fix email addresses
  189. },
  190. DocCommentHighlightRules.getTagRule(),
  191. {
  192. defaultToken : "comment.doc",
  193. caseInsensitive: true
  194. }]
  195. };
  196. };
  197. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  198. DocCommentHighlightRules.getTagRule = function(start) {
  199. return {
  200. token : "comment.doc.tag.storage.type",
  201. regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  202. };
  203. };
  204. DocCommentHighlightRules.getStartRule = function(start) {
  205. return {
  206. token : "comment.doc", // doc comment
  207. regex : "\\/\\*(?=\\*)",
  208. next : start
  209. };
  210. };
  211. DocCommentHighlightRules.getEndRule = function (start) {
  212. return {
  213. token : "comment.doc", // closing comment
  214. regex : "\\*\\/",
  215. next : start
  216. };
  217. };
  218. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  219. });
  220. ace.define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
  221. "use strict";
  222. var oop = require("../lib/oop");
  223. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  224. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  225. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
  226. var JavaScriptHighlightRules = function(options) {
  227. var keywordMapper = this.createKeywordMapper({
  228. "variable.language":
  229. "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
  230. "Namespace|QName|XML|XMLList|" + // E4X
  231. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  232. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  233. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
  234. "SyntaxError|TypeError|URIError|" +
  235. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
  236. "isNaN|parseFloat|parseInt|" +
  237. "JSON|Math|" + // Other
  238. "this|arguments|prototype|window|document" , // Pseudo
  239. "keyword":
  240. "const|yield|import|get|set|async|await|" +
  241. "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  242. "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  243. "__parent__|__count__|escape|unescape|with|__proto__|" +
  244. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
  245. "storage.type":
  246. "const|let|var|function",
  247. "constant.language":
  248. "null|Infinity|NaN|undefined",
  249. "support.function":
  250. "alert",
  251. "constant.language.boolean": "true|false"
  252. }, "identifier");
  253. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
  254. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  255. "u[0-9a-fA-F]{4}|" + // unicode
  256. "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
  257. "[0-2][0-7]{0,2}|" + // oct
  258. "3[0-7][0-7]?|" + // oct
  259. "[4-7][0-7]?|" + //oct
  260. ".)";
  261. this.$rules = {
  262. "no_regex" : [
  263. DocCommentHighlightRules.getStartRule("doc-start"),
  264. comments("no_regex"),
  265. {
  266. token : "string",
  267. regex : "'(?=.)",
  268. next : "qstring"
  269. }, {
  270. token : "string",
  271. regex : '"(?=.)',
  272. next : "qqstring"
  273. }, {
  274. token : "constant.numeric", // hexadecimal, octal and binary
  275. regex : /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
  276. }, {
  277. token : "constant.numeric", // decimal integers and floats
  278. regex : /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
  279. }, {
  280. token : [
  281. "storage.type", "punctuation.operator", "support.function",
  282. "punctuation.operator", "entity.name.function", "text","keyword.operator"
  283. ],
  284. regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
  285. next: "function_arguments"
  286. }, {
  287. token : [
  288. "storage.type", "punctuation.operator", "entity.name.function", "text",
  289. "keyword.operator", "text", "storage.type", "text", "paren.lparen"
  290. ],
  291. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  292. next: "function_arguments"
  293. }, {
  294. token : [
  295. "entity.name.function", "text", "keyword.operator", "text", "storage.type",
  296. "text", "paren.lparen"
  297. ],
  298. regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  299. next: "function_arguments"
  300. }, {
  301. token : [
  302. "storage.type", "punctuation.operator", "entity.name.function", "text",
  303. "keyword.operator", "text",
  304. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  305. ],
  306. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
  307. next: "function_arguments"
  308. }, {
  309. token : [
  310. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  311. ],
  312. regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
  313. next: "function_arguments"
  314. }, {
  315. token : [
  316. "entity.name.function", "text", "punctuation.operator",
  317. "text", "storage.type", "text", "paren.lparen"
  318. ],
  319. regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
  320. next: "function_arguments"
  321. }, {
  322. token : [
  323. "text", "text", "storage.type", "text", "paren.lparen"
  324. ],
  325. regex : "(:)(\\s*)(function)(\\s*)(\\()",
  326. next: "function_arguments"
  327. }, {
  328. token : "keyword",
  329. regex : "from(?=\\s*('|\"))"
  330. }, {
  331. token : "keyword",
  332. regex : "(?:" + kwBeforeRe + ")\\b",
  333. next : "start"
  334. }, {
  335. token : ["support.constant"],
  336. regex : /that\b/
  337. }, {
  338. token : ["storage.type", "punctuation.operator", "support.function.firebug"],
  339. regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
  340. }, {
  341. token : keywordMapper,
  342. regex : identifierRe
  343. }, {
  344. token : "punctuation.operator",
  345. regex : /[.](?![.])/,
  346. next : "property"
  347. }, {
  348. token : "storage.type",
  349. regex : /=>/,
  350. next : "start"
  351. }, {
  352. token : "keyword.operator",
  353. regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
  354. next : "start"
  355. }, {
  356. token : "punctuation.operator",
  357. regex : /[?:,;.]/,
  358. next : "start"
  359. }, {
  360. token : "paren.lparen",
  361. regex : /[\[({]/,
  362. next : "start"
  363. }, {
  364. token : "paren.rparen",
  365. regex : /[\])}]/
  366. }, {
  367. token: "comment",
  368. regex: /^#!.*$/
  369. }
  370. ],
  371. property: [{
  372. token : "text",
  373. regex : "\\s+"
  374. }, {
  375. token : [
  376. "storage.type", "punctuation.operator", "entity.name.function", "text",
  377. "keyword.operator", "text",
  378. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  379. ],
  380. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
  381. next: "function_arguments"
  382. }, {
  383. token : "punctuation.operator",
  384. regex : /[.](?![.])/
  385. }, {
  386. token : "support.function",
  387. regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
  388. }, {
  389. token : "support.function.dom",
  390. 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(?=\()/
  391. }, {
  392. token : "support.constant",
  393. 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/
  394. }, {
  395. token : "identifier",
  396. regex : identifierRe
  397. }, {
  398. regex: "",
  399. token: "empty",
  400. next: "no_regex"
  401. }
  402. ],
  403. "start": [
  404. DocCommentHighlightRules.getStartRule("doc-start"),
  405. comments("start"),
  406. {
  407. token: "string.regexp",
  408. regex: "\\/",
  409. next: "regex"
  410. }, {
  411. token : "text",
  412. regex : "\\s+|^$",
  413. next : "start"
  414. }, {
  415. token: "empty",
  416. regex: "",
  417. next: "no_regex"
  418. }
  419. ],
  420. "regex": [
  421. {
  422. token: "regexp.keyword.operator",
  423. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  424. }, {
  425. token: "string.regexp",
  426. regex: "/[sxngimy]*",
  427. next: "no_regex"
  428. }, {
  429. token : "invalid",
  430. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  431. }, {
  432. token : "constant.language.escape",
  433. regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  434. }, {
  435. token : "constant.language.delimiter",
  436. regex: /\|/
  437. }, {
  438. token: "constant.language.escape",
  439. regex: /\[\^?/,
  440. next: "regex_character_class"
  441. }, {
  442. token: "empty",
  443. regex: "$",
  444. next: "no_regex"
  445. }, {
  446. defaultToken: "string.regexp"
  447. }
  448. ],
  449. "regex_character_class": [
  450. {
  451. token: "regexp.charclass.keyword.operator",
  452. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  453. }, {
  454. token: "constant.language.escape",
  455. regex: "]",
  456. next: "regex"
  457. }, {
  458. token: "constant.language.escape",
  459. regex: "-"
  460. }, {
  461. token: "empty",
  462. regex: "$",
  463. next: "no_regex"
  464. }, {
  465. defaultToken: "string.regexp.charachterclass"
  466. }
  467. ],
  468. "function_arguments": [
  469. {
  470. token: "variable.parameter",
  471. regex: identifierRe
  472. }, {
  473. token: "punctuation.operator",
  474. regex: "[, ]+"
  475. }, {
  476. token: "punctuation.operator",
  477. regex: "$"
  478. }, {
  479. token: "empty",
  480. regex: "",
  481. next: "no_regex"
  482. }
  483. ],
  484. "qqstring" : [
  485. {
  486. token : "constant.language.escape",
  487. regex : escapedRe
  488. }, {
  489. token : "string",
  490. regex : "\\\\$",
  491. consumeLineEnd : true
  492. }, {
  493. token : "string",
  494. regex : '"|$',
  495. next : "no_regex"
  496. }, {
  497. defaultToken: "string"
  498. }
  499. ],
  500. "qstring" : [
  501. {
  502. token : "constant.language.escape",
  503. regex : escapedRe
  504. }, {
  505. token : "string",
  506. regex : "\\\\$",
  507. consumeLineEnd : true
  508. }, {
  509. token : "string",
  510. regex : "'|$",
  511. next : "no_regex"
  512. }, {
  513. defaultToken: "string"
  514. }
  515. ]
  516. };
  517. if (!options || !options.noES6) {
  518. this.$rules.no_regex.unshift({
  519. regex: "[{}]", onMatch: function(val, state, stack) {
  520. this.next = val == "{" ? this.nextState : "";
  521. if (val == "{" && stack.length) {
  522. stack.unshift("start", state);
  523. }
  524. else if (val == "}" && stack.length) {
  525. stack.shift();
  526. this.next = stack.shift();
  527. if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
  528. return "paren.quasi.end";
  529. }
  530. return val == "{" ? "paren.lparen" : "paren.rparen";
  531. },
  532. nextState: "start"
  533. }, {
  534. token : "string.quasi.start",
  535. regex : /`/,
  536. push : [{
  537. token : "constant.language.escape",
  538. regex : escapedRe
  539. }, {
  540. token : "paren.quasi.start",
  541. regex : /\${/,
  542. push : "start"
  543. }, {
  544. token : "string.quasi.end",
  545. regex : /`/,
  546. next : "pop"
  547. }, {
  548. defaultToken: "string.quasi"
  549. }]
  550. });
  551. if (!options || options.jsx != false)
  552. JSX.call(this);
  553. }
  554. this.embedRules(DocCommentHighlightRules, "doc-",
  555. [ DocCommentHighlightRules.getEndRule("no_regex") ]);
  556. this.normalizeRules();
  557. };
  558. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  559. function JSX() {
  560. var tagRegex = identifierRe.replace("\\d", "\\d\\-");
  561. var jsxTag = {
  562. onMatch : function(val, state, stack) {
  563. var offset = val.charAt(1) == "/" ? 2 : 1;
  564. if (offset == 1) {
  565. if (state != this.nextState)
  566. stack.unshift(this.next, this.nextState, 0);
  567. else
  568. stack.unshift(this.next);
  569. stack[2]++;
  570. } else if (offset == 2) {
  571. if (state == this.nextState) {
  572. stack[1]--;
  573. if (!stack[1] || stack[1] < 0) {
  574. stack.shift();
  575. stack.shift();
  576. }
  577. }
  578. }
  579. return [{
  580. type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
  581. value: val.slice(0, offset)
  582. }, {
  583. type: "meta.tag.tag-name.xml",
  584. value: val.substr(offset)
  585. }];
  586. },
  587. regex : "</?" + tagRegex + "",
  588. next: "jsxAttributes",
  589. nextState: "jsx"
  590. };
  591. this.$rules.start.unshift(jsxTag);
  592. var jsxJsRule = {
  593. regex: "{",
  594. token: "paren.quasi.start",
  595. push: "start"
  596. };
  597. this.$rules.jsx = [
  598. jsxJsRule,
  599. jsxTag,
  600. {include : "reference"},
  601. {defaultToken: "string"}
  602. ];
  603. this.$rules.jsxAttributes = [{
  604. token : "meta.tag.punctuation.tag-close.xml",
  605. regex : "/?>",
  606. onMatch : function(value, currentState, stack) {
  607. if (currentState == stack[0])
  608. stack.shift();
  609. if (value.length == 2) {
  610. if (stack[0] == this.nextState)
  611. stack[1]--;
  612. if (!stack[1] || stack[1] < 0) {
  613. stack.splice(0, 2);
  614. }
  615. }
  616. this.next = stack[0] || "start";
  617. return [{type: this.token, value: value}];
  618. },
  619. nextState: "jsx"
  620. },
  621. jsxJsRule,
  622. comments("jsxAttributes"),
  623. {
  624. token : "entity.other.attribute-name.xml",
  625. regex : tagRegex
  626. }, {
  627. token : "keyword.operator.attribute-equals.xml",
  628. regex : "="
  629. }, {
  630. token : "text.tag-whitespace.xml",
  631. regex : "\\s+"
  632. }, {
  633. token : "string.attribute-value.xml",
  634. regex : "'",
  635. stateName : "jsx_attr_q",
  636. push : [
  637. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  638. {include : "reference"},
  639. {defaultToken : "string.attribute-value.xml"}
  640. ]
  641. }, {
  642. token : "string.attribute-value.xml",
  643. regex : '"',
  644. stateName : "jsx_attr_qq",
  645. push : [
  646. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  647. {include : "reference"},
  648. {defaultToken : "string.attribute-value.xml"}
  649. ]
  650. },
  651. jsxTag
  652. ];
  653. this.$rules.reference = [{
  654. token : "constant.language.escape.reference.xml",
  655. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  656. }];
  657. }
  658. function comments(next) {
  659. return [
  660. {
  661. token : "comment", // multi line comment
  662. regex : /\/\*/,
  663. next: [
  664. DocCommentHighlightRules.getTagRule(),
  665. {token : "comment", regex : "\\*\\/", next : next || "pop"},
  666. {defaultToken : "comment", caseInsensitive: true}
  667. ]
  668. }, {
  669. token : "comment",
  670. regex : "\\/\\/",
  671. next: [
  672. DocCommentHighlightRules.getTagRule(),
  673. {token : "comment", regex : "$|^", next : next || "pop"},
  674. {defaultToken : "comment", caseInsensitive: true}
  675. ]
  676. }
  677. ];
  678. }
  679. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  680. });
  681. ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  682. "use strict";
  683. var oop = require("../lib/oop");
  684. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  685. var XmlHighlightRules = function(normalize) {
  686. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  687. this.$rules = {
  688. start : [
  689. {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
  690. {
  691. token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
  692. regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction"
  693. },
  694. {token : "comment.start.xml", regex : "<\\!--", next : "comment"},
  695. {
  696. token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  697. regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
  698. },
  699. {include : "tag"},
  700. {token : "text.end-tag-open.xml", regex: "</"},
  701. {token : "text.tag-open.xml", regex: "<"},
  702. {include : "reference"},
  703. {defaultToken : "text.xml"}
  704. ],
  705. processing_instruction : [{
  706. token : "entity.other.attribute-name.decl-attribute-name.xml",
  707. regex : tagRegex
  708. }, {
  709. token : "keyword.operator.decl-attribute-equals.xml",
  710. regex : "="
  711. }, {
  712. include: "whitespace"
  713. }, {
  714. include: "string"
  715. }, {
  716. token : "punctuation.xml-decl.xml",
  717. regex : "\\?>",
  718. next : "start"
  719. }],
  720. doctype : [
  721. {include : "whitespace"},
  722. {include : "string"},
  723. {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
  724. {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
  725. {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
  726. ],
  727. int_subset : [{
  728. token : "text.xml",
  729. regex : "\\s+"
  730. }, {
  731. token: "punctuation.int-subset.xml",
  732. regex: "]",
  733. next: "pop"
  734. }, {
  735. token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  736. regex : "(<\\!)(" + tagRegex + ")",
  737. push : [{
  738. token : "text",
  739. regex : "\\s+"
  740. },
  741. {
  742. token : "punctuation.markup-decl.xml",
  743. regex : ">",
  744. next : "pop"
  745. },
  746. {include : "string"}]
  747. }],
  748. cdata : [
  749. {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
  750. {token : "text.xml", regex : "\\s+"},
  751. {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
  752. ],
  753. comment : [
  754. {token : "comment.end.xml", regex : "-->", next : "start"},
  755. {defaultToken : "comment.xml"}
  756. ],
  757. reference : [{
  758. token : "constant.language.escape.reference.xml",
  759. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  760. }],
  761. attr_reference : [{
  762. token : "constant.language.escape.reference.attribute-value.xml",
  763. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  764. }],
  765. tag : [{
  766. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  767. regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  768. next: [
  769. {include : "attributes"},
  770. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  771. ]
  772. }],
  773. tag_whitespace : [
  774. {token : "text.tag-whitespace.xml", regex : "\\s+"}
  775. ],
  776. whitespace : [
  777. {token : "text.whitespace.xml", regex : "\\s+"}
  778. ],
  779. string: [{
  780. token : "string.xml",
  781. regex : "'",
  782. push : [
  783. {token : "string.xml", regex: "'", next: "pop"},
  784. {defaultToken : "string.xml"}
  785. ]
  786. }, {
  787. token : "string.xml",
  788. regex : '"',
  789. push : [
  790. {token : "string.xml", regex: '"', next: "pop"},
  791. {defaultToken : "string.xml"}
  792. ]
  793. }],
  794. attributes: [{
  795. token : "entity.other.attribute-name.xml",
  796. regex : tagRegex
  797. }, {
  798. token : "keyword.operator.attribute-equals.xml",
  799. regex : "="
  800. }, {
  801. include: "tag_whitespace"
  802. }, {
  803. include: "attribute_value"
  804. }],
  805. attribute_value: [{
  806. token : "string.attribute-value.xml",
  807. regex : "'",
  808. push : [
  809. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  810. {include : "attr_reference"},
  811. {defaultToken : "string.attribute-value.xml"}
  812. ]
  813. }, {
  814. token : "string.attribute-value.xml",
  815. regex : '"',
  816. push : [
  817. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  818. {include : "attr_reference"},
  819. {defaultToken : "string.attribute-value.xml"}
  820. ]
  821. }]
  822. };
  823. if (this.constructor === XmlHighlightRules)
  824. this.normalizeRules();
  825. };
  826. (function() {
  827. this.embedTagRules = function(HighlightRules, prefix, tag){
  828. this.$rules.tag.unshift({
  829. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  830. regex : "(<)(" + tag + "(?=\\s|>|$))",
  831. next: [
  832. {include : "attributes"},
  833. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
  834. ]
  835. });
  836. this.$rules[tag + "-end"] = [
  837. {include : "attributes"},
  838. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
  839. onMatch : function(value, currentState, stack) {
  840. stack.splice(0);
  841. return this.token;
  842. }}
  843. ];
  844. this.embedRules(HighlightRules, prefix, [{
  845. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  846. regex : "(</)(" + tag + "(?=\\s|>|$))",
  847. next: tag + "-end"
  848. }, {
  849. token: "string.cdata.xml",
  850. regex : "<\\!\\[CDATA\\["
  851. }, {
  852. token: "string.cdata.xml",
  853. regex : "\\]\\]>"
  854. }]);
  855. };
  856. }).call(TextHighlightRules.prototype);
  857. oop.inherits(XmlHighlightRules, TextHighlightRules);
  858. exports.XmlHighlightRules = XmlHighlightRules;
  859. });
  860. 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) {
  861. "use strict";
  862. var oop = require("../lib/oop");
  863. var lang = require("../lib/lang");
  864. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  865. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  866. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  867. var tagMap = lang.createMap({
  868. a : 'anchor',
  869. button : 'form',
  870. form : 'form',
  871. img : 'image',
  872. input : 'form',
  873. label : 'form',
  874. option : 'form',
  875. script : 'script',
  876. select : 'form',
  877. textarea : 'form',
  878. style : 'style',
  879. table : 'table',
  880. tbody : 'table',
  881. td : 'table',
  882. tfoot : 'table',
  883. th : 'table',
  884. tr : 'table'
  885. });
  886. var HtmlHighlightRules = function() {
  887. XmlHighlightRules.call(this);
  888. this.addRules({
  889. attributes: [{
  890. include : "tag_whitespace"
  891. }, {
  892. token : "entity.other.attribute-name.xml",
  893. regex : "[-_a-zA-Z0-9:.]+"
  894. }, {
  895. token : "keyword.operator.attribute-equals.xml",
  896. regex : "=",
  897. push : [{
  898. include: "tag_whitespace"
  899. }, {
  900. token : "string.unquoted.attribute-value.html",
  901. regex : "[^<>='\"`\\s]+",
  902. next : "pop"
  903. }, {
  904. token : "empty",
  905. regex : "",
  906. next : "pop"
  907. }]
  908. }, {
  909. include : "attribute_value"
  910. }],
  911. tag: [{
  912. token : function(start, tag) {
  913. var group = tagMap[tag];
  914. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  915. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  916. },
  917. regex : "(</?)([-_a-zA-Z0-9:.]+)",
  918. next: "tag_stuff"
  919. }],
  920. tag_stuff: [
  921. {include : "attributes"},
  922. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  923. ]
  924. });
  925. this.embedTagRules(CssHighlightRules, "css-", "style");
  926. this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "js-", "script");
  927. if (this.constructor === HtmlHighlightRules)
  928. this.normalizeRules();
  929. };
  930. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  931. exports.HtmlHighlightRules = HtmlHighlightRules;
  932. });
  933. ace.define("ace/mode/ruby_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  934. "use strict";
  935. var oop = require("../lib/oop");
  936. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  937. var constantOtherSymbol = exports.constantOtherSymbol = {
  938. token : "constant.other.symbol.ruby", // symbol
  939. regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"
  940. };
  941. exports.qString = {
  942. token : "string", // single line
  943. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  944. };
  945. exports.qqString = {
  946. token : "string", // single line
  947. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  948. };
  949. exports.tString = {
  950. token : "string", // backtick string
  951. regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"
  952. };
  953. var constantNumericHex = exports.constantNumericHex = {
  954. token : "constant.numeric", // hex
  955. regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b"
  956. };
  957. var constantNumericBinary = exports.constantNumericBinary = {
  958. token: "constant.numeric",
  959. regex: /\b(0[bB][01](?:[01]|_(?=[01]))*)\b/
  960. };
  961. var constantNumericDecimal = exports.constantNumericDecimal = {
  962. token: "constant.numeric",
  963. regex: /\b(0[dD](?:[1-9](?:[\d]|_(?=[\d]))*|0))\b/
  964. };
  965. var constantNumericOctal = exports.constantNumericDecimal = {
  966. token: "constant.numeric",
  967. regex: /\b(0[oO]?(?:[1-7](?:[0-7]|_(?=[0-7]))*|0))\b/
  968. };
  969. var constantNumericRational = exports.constantNumericRational = {
  970. token: "constant.numeric", //rational + complex
  971. regex: /\b([\d]+(?:[./][\d]+)?ri?)\b/
  972. };
  973. var constantNumericComplex = exports.constantNumericComplex = {
  974. token: "constant.numeric", //simple complex numbers
  975. regex: /\b([\d]i)\b/
  976. };
  977. var constantNumericFloat = exports.constantNumericFloat = {
  978. token : "constant.numeric", // float + complex
  979. regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?i?\\b"
  980. };
  981. var instanceVariable = exports.instanceVariable = {
  982. token : "variable.instance", // instance variable
  983. regex : "@{1,2}[a-zA-Z_\\d]+"
  984. };
  985. var RubyHighlightRules = function() {
  986. var builtinFunctions = (
  987. "abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
  988. "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
  989. "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" +
  990. "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" +
  991. "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" +
  992. "assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" +
  993. "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" +
  994. "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" +
  995. "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" +
  996. "gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" +
  997. "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" +
  998. "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" +
  999. "raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|" +
  1000. "set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" +
  1001. "throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" +
  1002. "render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" +
  1003. "content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" +
  1004. "fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" +
  1005. "time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" +
  1006. "select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" +
  1007. "file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" +
  1008. "protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" +
  1009. "send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" +
  1010. "validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" +
  1011. "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" +
  1012. "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" +
  1013. "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" +
  1014. "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" +
  1015. "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" +
  1016. "has_many|has_one|belongs_to|has_and_belongs_to_many|p|warn|refine|using|module_function|extend|alias_method|" +
  1017. "private_class_method|remove_method|undef_method"
  1018. );
  1019. var keywords = (
  1020. "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" +
  1021. "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" +
  1022. "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield|__ENCODING__|prepend"
  1023. );
  1024. var buildinConstants = (
  1025. "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
  1026. "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING|RUBY_PATCHLEVEL|RUBY_REVISION|RUBY_COPYRIGHT|RUBY_ENGINE|RUBY_ENGINE_VERSION|RUBY_DESCRIPTION"
  1027. );
  1028. var builtinVariables = (
  1029. "$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE|" +
  1030. "$!|root_url|flash|session|cookies|params|request|response|logger|self"
  1031. );
  1032. var keywordMapper = this.$keywords = this.createKeywordMapper({
  1033. "keyword": keywords,
  1034. "constant.language": buildinConstants,
  1035. "variable.language": builtinVariables,
  1036. "support.function": builtinFunctions,
  1037. "invalid.deprecated": "debugger" // TODO is this a remnant from js mode?
  1038. }, "identifier");
  1039. var escapedChars = "\\\\(?:n(?:[1-7][0-7]{0,2}|0)|[nsrtvfbae'\"\\\\]|c(?:\\\\M-)?.|M-(?:\\\\C-|\\\\c)?.|C-(?:\\\\M-)?.|[0-7]{3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|u{[\\da-fA-F]{1,6}(?:\\s[\\da-fA-F]{1,6})*})";
  1040. var closeParen = {
  1041. "(": ")",
  1042. "[": "]",
  1043. "{": "}",
  1044. "<": ">",
  1045. "^": "^",
  1046. "|": "|",
  1047. "%": "%"
  1048. };
  1049. this.$rules = {
  1050. "start": [
  1051. {
  1052. token: "comment",
  1053. regex: "#.*$"
  1054. }, {
  1055. token: "comment.multiline", // multi line comment
  1056. regex: "^=begin(?=$|\\s.*$)",
  1057. next: "comment"
  1058. }, {
  1059. token: "string.regexp",
  1060. regex: /[/](?=.*\/)/,
  1061. next: "regex"
  1062. },
  1063. [{
  1064. token: ["constant.other.symbol.ruby", "string.start"],
  1065. regex: /(:)?(")/,
  1066. push: [{
  1067. token: "constant.language.escape",
  1068. regex: escapedChars
  1069. }, {
  1070. token: "paren.start",
  1071. regex: /#{/,
  1072. push: "start"
  1073. }, {
  1074. token: "string.end",
  1075. regex: /"/,
  1076. next: "pop"
  1077. }, {
  1078. defaultToken: "string"
  1079. }]
  1080. }, {
  1081. token: "string.start",
  1082. regex: /`/,
  1083. push: [{
  1084. token: "constant.language.escape",
  1085. regex: escapedChars
  1086. }, {
  1087. token: "paren.start",
  1088. regex: /#{/,
  1089. push: "start"
  1090. }, {
  1091. token: "string.end",
  1092. regex: /`/,
  1093. next: "pop"
  1094. }, {
  1095. defaultToken: "string"
  1096. }]
  1097. }, {
  1098. token: ["constant.other.symbol.ruby", "string.start"],
  1099. regex: /(:)?(')/,
  1100. push: [{
  1101. token: "constant.language.escape",
  1102. regex: /\\['\\]/
  1103. }, {
  1104. token: "string.end",
  1105. regex: /'/,
  1106. next: "pop"
  1107. }, {
  1108. defaultToken: "string"
  1109. }]
  1110. }, {
  1111. token: "string.start",//doesn't see any differences between strings and array of strings in highlighting
  1112. regex: /%[qwx]([(\[<{^|%])/, onMatch: function (val, state, stack) {
  1113. if (stack.length)
  1114. stack = [];
  1115. var paren = val[val.length - 1];
  1116. stack.unshift(paren, state);
  1117. this.next = "qStateWithoutInterpolation";
  1118. return this.token;
  1119. }
  1120. }, {
  1121. token: "string.start", //doesn't see any differences between strings and array of strings in highlighting
  1122. regex: /%[QWX]?([(\[<{^|%])/, onMatch: function (val, state, stack) {
  1123. if (stack.length)
  1124. stack = [];
  1125. var paren = val[val.length - 1];
  1126. stack.unshift(paren, state);
  1127. this.next = "qStateWithInterpolation";
  1128. return this.token;
  1129. }
  1130. }, {
  1131. token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting
  1132. regex: /%[si]([(\[<{^|%])/, onMatch: function (val, state, stack) {
  1133. if (stack.length)
  1134. stack = [];
  1135. var paren = val[val.length - 1];
  1136. stack.unshift(paren, state);
  1137. this.next = "sStateWithoutInterpolation";
  1138. return this.token;
  1139. }
  1140. }, {
  1141. token: "constant.other.symbol.ruby", //doesn't see any differences between symbols and array of symbols in highlighting
  1142. regex: /%[SI]([(\[<{^|%])/, onMatch: function (val, state, stack) {
  1143. if (stack.length)
  1144. stack = [];
  1145. var paren = val[val.length - 1];
  1146. stack.unshift(paren, state);
  1147. this.next = "sStateWithInterpolation";
  1148. return this.token;
  1149. }
  1150. }, {
  1151. token: "string.regexp",
  1152. regex: /%[r]([(\[<{^|%])/, onMatch: function (val, state, stack) {
  1153. if (stack.length)
  1154. stack = [];
  1155. var paren = val[val.length - 1];
  1156. stack.unshift(paren, state);
  1157. this.next = "rState";
  1158. return this.token;
  1159. }
  1160. }],
  1161. {
  1162. token: "punctuation", // namespaces aren't symbols
  1163. regex: "::"
  1164. },
  1165. instanceVariable,
  1166. {
  1167. token: "variable.global", // global variable
  1168. regex: "[$][a-zA-Z_\\d]+"
  1169. }, {
  1170. token: "support.class", // class name
  1171. regex: "[A-Z][a-zA-Z_\\d]*"
  1172. }, {
  1173. token: ["punctuation.operator", "support.function"],
  1174. regex: /(\.)([a-zA-Z_\d]+)(?=\()/
  1175. }, {
  1176. token: ["punctuation.operator", "identifier"],
  1177. regex: /(\.)([a-zA-Z_][a-zA-Z_\d]*)/
  1178. }, {
  1179. token: "string.character",
  1180. regex: "\\B\\?(?:" + escapedChars + "|\\S)"
  1181. }, {
  1182. token: "punctuation.operator",
  1183. regex: /\?(?=.+:)/
  1184. },
  1185. constantNumericRational,
  1186. constantNumericComplex,
  1187. constantOtherSymbol,
  1188. constantNumericHex,
  1189. constantNumericFloat,
  1190. constantNumericBinary,
  1191. constantNumericDecimal,
  1192. constantNumericOctal,
  1193. {
  1194. token: "constant.language.boolean",
  1195. regex: "(?:true|false)\\b"
  1196. }, {
  1197. token: keywordMapper,
  1198. regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  1199. }, {
  1200. token: "punctuation.separator.key-value",
  1201. regex: "=>"
  1202. }, {
  1203. stateName: "heredoc",
  1204. onMatch: function (value, currentState, stack) {
  1205. var next = (value[2] == '-' || value[2] == '~') ? "indentedHeredoc" : "heredoc";
  1206. var tokens = value.split(this.splitRegex);
  1207. stack.push(next, tokens[3]);
  1208. return [
  1209. {type: "constant", value: tokens[1]},
  1210. {type: "string", value: tokens[2]},
  1211. {type: "support.class", value: tokens[3]},
  1212. {type: "string", value: tokens[4]}
  1213. ];
  1214. },
  1215. regex: "(<<[-~]?)(['\"`]?)([\\w]+)(['\"`]?)",
  1216. rules: {
  1217. heredoc: [{
  1218. onMatch: function(value, currentState, stack) {
  1219. if (value === stack[1]) {
  1220. stack.shift();
  1221. stack.shift();
  1222. this.next = stack[0] || "start";
  1223. return "support.class";
  1224. }
  1225. this.next = "";
  1226. return "string";
  1227. },
  1228. regex: ".*$",
  1229. next: "start"
  1230. }],
  1231. indentedHeredoc: [{
  1232. token: "string",
  1233. regex: "^ +"
  1234. }, {
  1235. onMatch: function(value, currentState, stack) {
  1236. if (value === stack[1]) {
  1237. stack.shift();
  1238. stack.shift();
  1239. this.next = stack[0] || "start";
  1240. return "support.class";
  1241. }
  1242. this.next = "";
  1243. return "string";
  1244. },
  1245. regex: ".*$",
  1246. next: "start"
  1247. }]
  1248. }
  1249. }, {
  1250. regex: "$",
  1251. token: "empty",
  1252. next: function(currentState, stack) {
  1253. if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
  1254. return stack[0];
  1255. return currentState;
  1256. }
  1257. }, {
  1258. token: "keyword.operator",
  1259. regex: "!|\\$|%|&|\\*|/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\||\\b(?:in|instanceof|new|delete|typeof|void)"
  1260. }, {
  1261. token: "paren.lparen",
  1262. regex: "[[({]"
  1263. }, {
  1264. token: "paren.rparen",
  1265. regex: "[\\])}]",
  1266. onMatch: function(value, currentState, stack) {
  1267. this.next = '';
  1268. if (value == "}" && stack.length > 1 && stack[1] != "start") {
  1269. stack.shift();
  1270. this.next = stack.shift();
  1271. }
  1272. return this.token;
  1273. }
  1274. }, {
  1275. token: "text",
  1276. regex: "\\s+"
  1277. }, {
  1278. token: "punctuation.operator",
  1279. regex: /[?:,;.]/
  1280. }
  1281. ],
  1282. "comment": [
  1283. {
  1284. token: "comment.multiline", // closing comment
  1285. regex: "^=end(?=$|\\s.*$)",
  1286. next: "start"
  1287. }, {
  1288. token: "comment", // comment spanning whole line
  1289. regex: ".+"
  1290. }
  1291. ],
  1292. "qStateWithInterpolation": [{
  1293. token: "string.start",// excluded nested |^% due to difficulty in realization
  1294. regex: /[(\[<{]/, onMatch: function (val, state, stack) {
  1295. if (stack.length && val === stack[0]) {
  1296. stack.unshift(val, state);
  1297. return this.token;
  1298. }
  1299. return "string";
  1300. }
  1301. }, {
  1302. token: "constant.language.escape",
  1303. regex: escapedChars
  1304. }, {
  1305. token: "constant.language.escape",
  1306. regex: /\\./
  1307. }, {
  1308. token: "paren.start",
  1309. regex: /#{/,
  1310. push: "start"
  1311. }, {
  1312. token: "string.end",
  1313. regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) {
  1314. if (stack.length && val === closeParen[stack[0]]) {
  1315. stack.shift();
  1316. this.next = stack.shift();
  1317. return this.token;
  1318. }
  1319. this.next = '';
  1320. return "string";
  1321. }
  1322. }, {
  1323. defaultToken: "string"
  1324. }],
  1325. "qStateWithoutInterpolation": [{
  1326. token: "string.start",// excluded nested |^% due to difficulty in realization
  1327. regex: /[(\[<{]/, onMatch: function (val, state, stack) {
  1328. if (stack.length && val === stack[0]) {
  1329. stack.unshift(val, state);
  1330. return this.token;
  1331. }
  1332. return "string";
  1333. }
  1334. }, {
  1335. token: "constant.language.escape",
  1336. regex: /\\['\\]/
  1337. }, {
  1338. token: "constant.language.escape",
  1339. regex: /\\./
  1340. }, {
  1341. token: "string.end",
  1342. regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) {
  1343. if (stack.length && val === closeParen[stack[0]]) {
  1344. stack.shift();
  1345. this.next = stack.shift();
  1346. return this.token;
  1347. }
  1348. this.next = '';
  1349. return "string";
  1350. }
  1351. }, {
  1352. defaultToken: "string"
  1353. }],
  1354. "sStateWithoutInterpolation": [{
  1355. token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization
  1356. regex: /[(\[<{]/, onMatch: function (val, state, stack) {
  1357. if (stack.length && val === stack[0]) {
  1358. stack.unshift(val, state);
  1359. return this.token;
  1360. }
  1361. return "constant.other.symbol.ruby";
  1362. }
  1363. }, {
  1364. token: "constant.other.symbol.ruby",
  1365. regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) {
  1366. if (stack.length && val === closeParen[stack[0]]) {
  1367. stack.shift();
  1368. this.next = stack.shift();
  1369. return this.token;
  1370. }
  1371. this.next = '';
  1372. return "constant.other.symbol.ruby";
  1373. }
  1374. }, {
  1375. defaultToken: "constant.other.symbol.ruby"
  1376. }],
  1377. "sStateWithInterpolation": [{
  1378. token: "constant.other.symbol.ruby",// excluded nested |^% due to difficulty in realization
  1379. regex: /[(\[<{]/, onMatch: function (val, state, stack) {
  1380. if (stack.length && val === stack[0]) {
  1381. stack.unshift(val, state);
  1382. return this.token;
  1383. }
  1384. return "constant.other.symbol.ruby";
  1385. }
  1386. }, {
  1387. token: "constant.language.escape",
  1388. regex: escapedChars
  1389. }, {
  1390. token: "constant.language.escape",
  1391. regex: /\\./
  1392. }, {
  1393. token: "paren.start",
  1394. regex: /#{/,
  1395. push: "start"
  1396. }, {
  1397. token: "constant.other.symbol.ruby",
  1398. regex: /[)\]>}^|%]/, onMatch: function (val, state, stack) {
  1399. if (stack.length && val === closeParen[stack[0]]) {
  1400. stack.shift();
  1401. this.next = stack.shift();
  1402. return this.token;
  1403. }
  1404. this.next = '';
  1405. return "constant.other.symbol.ruby";
  1406. }
  1407. }, {
  1408. defaultToken: "constant.other.symbol.ruby"
  1409. }],
  1410. "rState": [{
  1411. token: "string.regexp",// excluded nested |^% due to difficulty in realization
  1412. regex: /[(\[<{]/, onMatch: function (val, state, stack) {
  1413. if (stack.length && val === stack[0]) {
  1414. stack.unshift(val, state);
  1415. return this.token;
  1416. }
  1417. return "constant.language.escape";
  1418. }
  1419. }, {
  1420. token: "paren.start",
  1421. regex: /#{/,
  1422. push: "start"
  1423. }, {
  1424. token: "string.regexp",
  1425. regex: /\//
  1426. }, {
  1427. token: "string.regexp",
  1428. regex: /[)\]>}^|%][imxouesn]*/, onMatch: function (val, state, stack) {
  1429. if (stack.length && val[0] === closeParen[stack[0]]) {
  1430. stack.shift();
  1431. this.next = stack.shift();
  1432. return this.token;
  1433. }
  1434. this.next = '';
  1435. return "constant.language.escape";
  1436. }
  1437. },
  1438. {include: "regex"},
  1439. {
  1440. defaultToken: "string.regexp"
  1441. }],
  1442. "regex": [
  1443. {// character classes
  1444. token: "regexp.keyword",
  1445. regex: /\\[wWdDhHsS]/
  1446. }, {
  1447. token: "constant.language.escape",
  1448. regex: /\\[AGbBzZ]/
  1449. }, {
  1450. token: "constant.language.escape",
  1451. regex: /\\g<[a-zA-Z0-9]*>/
  1452. }, {
  1453. token: ["constant.language.escape", "regexp.keyword", "constant.language.escape"],
  1454. regex: /(\\p{\^?)(Alnum|Alpha|Blank|Cntrl|Digit|Graph|Lower|Print|Punct|Space|Upper|XDigit|Word|ASCII|Any|Assigned|Arabic|Armenian|Balinese|Bengali|Bopomofo|Braille|Buginese|Buhid|Canadian_Aboriginal|Carian|Cham|Cherokee|Common|Coptic|Cuneiform|Cypriot|Cyrillic|Deseret|Devanagari|Ethiopic|Georgian|Glagolitic|Gothic|Greek|Gujarati|Gurmukhi|Han|Hangul|Hanunoo|Hebrew|Hiragana|Inherited|Kannada|Katakana|Kayah_Li|Kharoshthi|Khmer|Lao|Latin|Lepcha|Limbu|Linear_B|Lycian|Lydian|Malayalam|Mongolian|Myanmar|New_Tai_Lue|Nko|Ogham|Ol_Chiki|Old_Italic|Old_Persian|Oriya|Osmanya|Phags_Pa|Phoenician|Rejang|Runic|Saurashtra|Shavian|Sinhala|Sundanese|Syloti_Nagri|Syriac|Tagalog|Tagbanwa|Tai_Le|Tamil|Telugu|Thaana|Thai|Tibetan|Tifinagh|Ugaritic|Vai|Yi|Ll|Lm|Lt|Lu|Lo|Mn|Mc|Me|Nd|Nl|Pc|Pd|Ps|Pe|Pi|Pf|Po|No|Sm|Sc|Sk|So|Zs|Zl|Zp|Cc|Cf|Cn|Co|Cs|N|L|M|P|S|Z|C)(})/
  1455. }, {
  1456. token: ["constant.language.escape", "invalid", "constant.language.escape"],
  1457. regex: /(\\p{\^?)([^/]*)(})/
  1458. }, {// escapes
  1459. token: "regexp.keyword.operator",
  1460. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  1461. }, {// flag
  1462. token: "string.regexp",
  1463. regex: /[/][imxouesn]*/,
  1464. next: "start"
  1465. }, {// invalid operators
  1466. token: "invalid",
  1467. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  1468. }, {// operators
  1469. token: "constant.language.escape",
  1470. regex: /\(\?(?:[:=!>]|<'?[a-zA-Z]*'?>|<[=!])|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  1471. }, {
  1472. token: "constant.language.delimiter",
  1473. regex: /\|/
  1474. }, {
  1475. token: "regexp.keyword",
  1476. regex: /\[\[:(?:alnum|alpha|blank|cntrl|digit|graph|lower|print|punct|space|upper|xdigit|word|ascii):\]\]/
  1477. }, {
  1478. token: "constant.language.escape",
  1479. regex: /\[\^?/,
  1480. push: "regex_character_class"
  1481. }, {
  1482. defaultToken: "string.regexp"
  1483. }
  1484. ],
  1485. "regex_character_class": [
  1486. {
  1487. token: "regexp.keyword",
  1488. regex: /\\[wWdDhHsS]/
  1489. }, {
  1490. token: "regexp.charclass.keyword.operator",
  1491. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  1492. }, {
  1493. token: "constant.language.escape",
  1494. regex: /&?&?\[\^?/,
  1495. push: "regex_character_class"
  1496. }, {
  1497. token: "constant.language.escape",
  1498. regex: "]",
  1499. next: "pop"
  1500. }, {
  1501. token: "constant.language.escape",
  1502. regex: "-"
  1503. }, {
  1504. defaultToken: "string.regexp.characterclass"
  1505. }
  1506. ]
  1507. };
  1508. this.normalizeRules();
  1509. };
  1510. oop.inherits(RubyHighlightRules, TextHighlightRules);
  1511. exports.RubyHighlightRules = RubyHighlightRules;
  1512. });
  1513. ace.define("ace/mode/html_ruby_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/html_highlight_rules","ace/mode/ruby_highlight_rules"], function(require, exports, module) {
  1514. "use strict";
  1515. var oop = require("../lib/oop");
  1516. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  1517. var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
  1518. var HtmlRubyHighlightRules = function() {
  1519. HtmlHighlightRules.call(this);
  1520. var startRules = [
  1521. {
  1522. regex: "<%%|%%>",
  1523. token: "constant.language.escape"
  1524. }, {
  1525. token : "comment.start.erb",
  1526. regex : "<%#",
  1527. push : [{
  1528. token : "comment.end.erb",
  1529. regex: "%>",
  1530. next: "pop",
  1531. defaultToken:"comment"
  1532. }]
  1533. }, {
  1534. token : "support.ruby_tag",
  1535. regex : "<%+(?!>)[-=]?",
  1536. push : "ruby-start"
  1537. }
  1538. ];
  1539. var endRules = [
  1540. {
  1541. token : "support.ruby_tag",
  1542. regex : "%>",
  1543. next : "pop"
  1544. }, {
  1545. token: "comment",
  1546. regex: "#(?:[^%]|%[^>])*"
  1547. }
  1548. ];
  1549. for (var key in this.$rules)
  1550. this.$rules[key].unshift.apply(this.$rules[key], startRules);
  1551. this.embedRules(RubyHighlightRules, "ruby-", endRules, ["start"]);
  1552. this.normalizeRules();
  1553. };
  1554. oop.inherits(HtmlRubyHighlightRules, HtmlHighlightRules);
  1555. exports.HtmlRubyHighlightRules = HtmlRubyHighlightRules;
  1556. });
  1557. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
  1558. "use strict";
  1559. var Range = require("../range").Range;
  1560. var MatchingBraceOutdent = function() {};
  1561. (function() {
  1562. this.checkOutdent = function(line, input) {
  1563. if (! /^\s+$/.test(line))
  1564. return false;
  1565. return /^\s*\}/.test(input);
  1566. };
  1567. this.autoOutdent = function(doc, row) {
  1568. var line = doc.getLine(row);
  1569. var match = line.match(/^(\s*\})/);
  1570. if (!match) return 0;
  1571. var column = match[1].length;
  1572. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  1573. if (!openBracePos || openBracePos.row == row) return 0;
  1574. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  1575. doc.replace(new Range(row, 0, row, column-1), indent);
  1576. };
  1577. this.$getIndent = function(line) {
  1578. return line.match(/^\s*/)[0];
  1579. };
  1580. }).call(MatchingBraceOutdent.prototype);
  1581. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  1582. });
  1583. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
  1584. "use strict";
  1585. var oop = require("../../lib/oop");
  1586. var Range = require("../../range").Range;
  1587. var BaseFoldMode = require("./fold_mode").FoldMode;
  1588. var FoldMode = exports.FoldMode = function(commentRegex) {
  1589. if (commentRegex) {
  1590. this.foldingStartMarker = new RegExp(
  1591. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  1592. );
  1593. this.foldingStopMarker = new RegExp(
  1594. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  1595. );
  1596. }
  1597. };
  1598. oop.inherits(FoldMode, BaseFoldMode);
  1599. (function() {
  1600. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  1601. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  1602. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  1603. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  1604. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  1605. this._getFoldWidgetBase = this.getFoldWidget;
  1606. this.getFoldWidget = function(session, foldStyle, row) {
  1607. var line = session.getLine(row);
  1608. if (this.singleLineBlockCommentRe.test(line)) {
  1609. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  1610. return "";
  1611. }
  1612. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  1613. if (!fw && this.startRegionRe.test(line))
  1614. return "start"; // lineCommentRegionStart
  1615. return fw;
  1616. };
  1617. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  1618. var line = session.getLine(row);
  1619. if (this.startRegionRe.test(line))
  1620. return this.getCommentRegionBlock(session, line, row);
  1621. var match = line.match(this.foldingStartMarker);
  1622. if (match) {
  1623. var i = match.index;
  1624. if (match[1])
  1625. return this.openingBracketBlock(session, match[1], row, i);
  1626. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  1627. if (range && !range.isMultiLine()) {
  1628. if (forceMultiline) {
  1629. range = this.getSectionRange(session, row);
  1630. } else if (foldStyle != "all")
  1631. range = null;
  1632. }
  1633. return range;
  1634. }
  1635. if (foldStyle === "markbegin")
  1636. return;
  1637. var match = line.match(this.foldingStopMarker);
  1638. if (match) {
  1639. var i = match.index + match[0].length;
  1640. if (match[1])
  1641. return this.closingBracketBlock(session, match[1], row, i);
  1642. return session.getCommentFoldRange(row, i, -1);
  1643. }
  1644. };
  1645. this.getSectionRange = function(session, row) {
  1646. var line = session.getLine(row);
  1647. var startIndent = line.search(/\S/);
  1648. var startRow = row;
  1649. var startColumn = line.length;
  1650. row = row + 1;
  1651. var endRow = row;
  1652. var maxRow = session.getLength();
  1653. while (++row < maxRow) {
  1654. line = session.getLine(row);
  1655. var indent = line.search(/\S/);
  1656. if (indent === -1)
  1657. continue;
  1658. if (startIndent > indent)
  1659. break;
  1660. var subRange = this.getFoldWidgetRange(session, "all", row);
  1661. if (subRange) {
  1662. if (subRange.start.row <= startRow) {
  1663. break;
  1664. } else if (subRange.isMultiLine()) {
  1665. row = subRange.end.row;
  1666. } else if (startIndent == indent) {
  1667. break;
  1668. }
  1669. }
  1670. endRow = row;
  1671. }
  1672. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  1673. };
  1674. this.getCommentRegionBlock = function(session, line, row) {
  1675. var startColumn = line.search(/\s*$/);
  1676. var maxRow = session.getLength();
  1677. var startRow = row;
  1678. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  1679. var depth = 1;
  1680. while (++row < maxRow) {
  1681. line = session.getLine(row);
  1682. var m = re.exec(line);
  1683. if (!m) continue;
  1684. if (m[1]) depth--;
  1685. else depth++;
  1686. if (!depth) break;
  1687. }
  1688. var endRow = row;
  1689. if (endRow > startRow) {
  1690. return new Range(startRow, startColumn, endRow, line.length);
  1691. }
  1692. };
  1693. }).call(FoldMode.prototype);
  1694. });
  1695. ace.define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
  1696. "use strict";
  1697. var oop = require("../lib/oop");
  1698. var TextMode = require("./text").Mode;
  1699. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1700. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1701. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1702. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  1703. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1704. var Mode = function() {
  1705. this.HighlightRules = JavaScriptHighlightRules;
  1706. this.$outdent = new MatchingBraceOutdent();
  1707. this.$behaviour = new CstyleBehaviour();
  1708. this.foldingRules = new CStyleFoldMode();
  1709. };
  1710. oop.inherits(Mode, TextMode);
  1711. (function() {
  1712. this.lineCommentStart = "//";
  1713. this.blockComment = {start: "/*", end: "*/"};
  1714. this.$quotes = {'"': '"', "'": "'", "`": "`"};
  1715. this.getNextLineIndent = function(state, line, tab) {
  1716. var indent = this.$getIndent(line);
  1717. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  1718. var tokens = tokenizedLine.tokens;
  1719. var endState = tokenizedLine.state;
  1720. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1721. return indent;
  1722. }
  1723. if (state == "start" || state == "no_regex") {
  1724. var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
  1725. if (match) {
  1726. indent += tab;
  1727. }
  1728. } else if (state == "doc-start") {
  1729. if (endState == "start" || endState == "no_regex") {
  1730. return "";
  1731. }
  1732. var match = line.match(/^\s*(\/?)\*/);
  1733. if (match) {
  1734. if (match[1]) {
  1735. indent += " ";
  1736. }
  1737. indent += "* ";
  1738. }
  1739. }
  1740. return indent;
  1741. };
  1742. this.checkOutdent = function(state, line, input) {
  1743. return this.$outdent.checkOutdent(line, input);
  1744. };
  1745. this.autoOutdent = function(state, doc, row) {
  1746. this.$outdent.autoOutdent(doc, row);
  1747. };
  1748. this.createWorker = function(session) {
  1749. var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
  1750. worker.attachToDocument(session.getDocument());
  1751. worker.on("annotate", function(results) {
  1752. session.setAnnotations(results.data);
  1753. });
  1754. worker.on("terminate", function() {
  1755. session.clearAnnotations();
  1756. });
  1757. return worker;
  1758. };
  1759. this.$id = "ace/mode/javascript";
  1760. this.snippetFileId = "ace/snippets/javascript";
  1761. }).call(Mode.prototype);
  1762. exports.Mode = Mode;
  1763. });
  1764. ace.define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module) {
  1765. "use strict";
  1766. var propertyMap = {
  1767. "background": {"#$0": 1},
  1768. "background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
  1769. "background-image": {"url('/$0')": 1},
  1770. "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
  1771. "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2},
  1772. "background-attachment": {"scroll": 1, "fixed": 1},
  1773. "background-size": {"cover": 1, "contain": 1},
  1774. "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
  1775. "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
  1776. "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
  1777. "border-color": {"#$0": 1},
  1778. "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2},
  1779. "border-collapse": {"collapse": 1, "separate": 1},
  1780. "bottom": {"px": 1, "em": 1, "%": 1},
  1781. "clear": {"left": 1, "right": 1, "both": 1, "none": 1},
  1782. "color": {"#$0": 1, "rgb(#$00,0,0)": 1},
  1783. "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},
  1784. "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
  1785. "empty-cells": {"show": 1, "hide": 1},
  1786. "float": {"left": 1, "right": 1, "none": 1},
  1787. "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},
  1788. "font-size": {"px": 1, "em": 1, "%": 1},
  1789. "font-weight": {"bold": 1, "normal": 1},
  1790. "font-style": {"italic": 1, "normal": 1},
  1791. "font-variant": {"normal": 1, "small-caps": 1},
  1792. "height": {"px": 1, "em": 1, "%": 1},
  1793. "left": {"px": 1, "em": 1, "%": 1},
  1794. "letter-spacing": {"normal": 1},
  1795. "line-height": {"normal": 1},
  1796. "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},
  1797. "margin": {"px": 1, "em": 1, "%": 1},
  1798. "margin-right": {"px": 1, "em": 1, "%": 1},
  1799. "margin-left": {"px": 1, "em": 1, "%": 1},
  1800. "margin-top": {"px": 1, "em": 1, "%": 1},
  1801. "margin-bottom": {"px": 1, "em": 1, "%": 1},
  1802. "max-height": {"px": 1, "em": 1, "%": 1},
  1803. "max-width": {"px": 1, "em": 1, "%": 1},
  1804. "min-height": {"px": 1, "em": 1, "%": 1},
  1805. "min-width": {"px": 1, "em": 1, "%": 1},
  1806. "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1807. "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1808. "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1809. "padding": {"px": 1, "em": 1, "%": 1},
  1810. "padding-top": {"px": 1, "em": 1, "%": 1},
  1811. "padding-right": {"px": 1, "em": 1, "%": 1},
  1812. "padding-bottom": {"px": 1, "em": 1, "%": 1},
  1813. "padding-left": {"px": 1, "em": 1, "%": 1},
  1814. "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  1815. "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  1816. "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
  1817. "right": {"px": 1, "em": 1, "%": 1},
  1818. "table-layout": {"fixed": 1, "auto": 1},
  1819. "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
  1820. "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
  1821. "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
  1822. "top": {"px": 1, "em": 1, "%": 1},
  1823. "vertical-align": {"top": 1, "bottom": 1},
  1824. "visibility": {"hidden": 1, "visible": 1},
  1825. "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
  1826. "width": {"px": 1, "em": 1, "%": 1},
  1827. "word-spacing": {"normal": 1},
  1828. "filter": {"alpha(opacity=$0100)": 1},
  1829. "text-shadow": {"$02px 2px 2px #777": 1},
  1830. "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
  1831. "-moz-border-radius": 1,
  1832. "-moz-border-radius-topright": 1,
  1833. "-moz-border-radius-bottomright": 1,
  1834. "-moz-border-radius-topleft": 1,
  1835. "-moz-border-radius-bottomleft": 1,
  1836. "-webkit-border-radius": 1,
  1837. "-webkit-border-top-right-radius": 1,
  1838. "-webkit-border-top-left-radius": 1,
  1839. "-webkit-border-bottom-right-radius": 1,
  1840. "-webkit-border-bottom-left-radius": 1,
  1841. "-moz-box-shadow": 1,
  1842. "-webkit-box-shadow": 1,
  1843. "transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  1844. "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  1845. "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
  1846. };
  1847. var CssCompletions = function() {
  1848. };
  1849. (function() {
  1850. this.completionsDefined = false;
  1851. this.defineCompletions = function() {
  1852. if (document) {
  1853. var style = document.createElement('c').style;
  1854. for (var i in style) {
  1855. if (typeof style[i] !== 'string')
  1856. continue;
  1857. var name = i.replace(/[A-Z]/g, function(x) {
  1858. return '-' + x.toLowerCase();
  1859. });
  1860. if (!propertyMap.hasOwnProperty(name))
  1861. propertyMap[name] = 1;
  1862. }
  1863. }
  1864. this.completionsDefined = true;
  1865. };
  1866. this.getCompletions = function(state, session, pos, prefix) {
  1867. if (!this.completionsDefined) {
  1868. this.defineCompletions();
  1869. }
  1870. if (state==='ruleset' || session.$mode.$id == "ace/mode/scss") {
  1871. var line = session.getLine(pos.row).substr(0, pos.column);
  1872. if (/:[^;]+$/.test(line)) {
  1873. /([\w\-]+):[^:]*$/.test(line);
  1874. return this.getPropertyValueCompletions(state, session, pos, prefix);
  1875. } else {
  1876. return this.getPropertyCompletions(state, session, pos, prefix);
  1877. }
  1878. }
  1879. return [];
  1880. };
  1881. this.getPropertyCompletions = function(state, session, pos, prefix) {
  1882. var properties = Object.keys(propertyMap);
  1883. return properties.map(function(property){
  1884. return {
  1885. caption: property,
  1886. snippet: property + ': $0;',
  1887. meta: "property",
  1888. score: 1000000
  1889. };
  1890. });
  1891. };
  1892. this.getPropertyValueCompletions = function(state, session, pos, prefix) {
  1893. var line = session.getLine(pos.row).substr(0, pos.column);
  1894. var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
  1895. if (!property)
  1896. return [];
  1897. var values = [];
  1898. if (property in propertyMap && typeof propertyMap[property] === "object") {
  1899. values = Object.keys(propertyMap[property]);
  1900. }
  1901. return values.map(function(value){
  1902. return {
  1903. caption: value,
  1904. snippet: value,
  1905. meta: "property value",
  1906. score: 1000000
  1907. };
  1908. });
  1909. };
  1910. }).call(CssCompletions.prototype);
  1911. exports.CssCompletions = CssCompletions;
  1912. });
  1913. 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) {
  1914. "use strict";
  1915. var oop = require("../../lib/oop");
  1916. var Behaviour = require("../behaviour").Behaviour;
  1917. var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
  1918. var TokenIterator = require("../../token_iterator").TokenIterator;
  1919. var CssBehaviour = function () {
  1920. this.inherit(CstyleBehaviour);
  1921. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1922. if (text === ':' && editor.selection.isEmpty()) {
  1923. var cursor = editor.getCursorPosition();
  1924. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1925. var token = iterator.getCurrentToken();
  1926. if (token && token.value.match(/\s+/)) {
  1927. token = iterator.stepBackward();
  1928. }
  1929. if (token && token.type === 'support.type') {
  1930. var line = session.doc.getLine(cursor.row);
  1931. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1932. if (rightChar === ':') {
  1933. return {
  1934. text: '',
  1935. selection: [1, 1]
  1936. };
  1937. }
  1938. if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
  1939. return {
  1940. text: ':;',
  1941. selection: [1, 1]
  1942. };
  1943. }
  1944. }
  1945. }
  1946. });
  1947. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1948. var selected = session.doc.getTextRange(range);
  1949. if (!range.isMultiLine() && selected === ':') {
  1950. var cursor = editor.getCursorPosition();
  1951. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1952. var token = iterator.getCurrentToken();
  1953. if (token && token.value.match(/\s+/)) {
  1954. token = iterator.stepBackward();
  1955. }
  1956. if (token && token.type === 'support.type') {
  1957. var line = session.doc.getLine(range.start.row);
  1958. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1959. if (rightChar === ';') {
  1960. range.end.column ++;
  1961. return range;
  1962. }
  1963. }
  1964. }
  1965. });
  1966. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1967. if (text === ';' && editor.selection.isEmpty()) {
  1968. var cursor = editor.getCursorPosition();
  1969. var line = session.doc.getLine(cursor.row);
  1970. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1971. if (rightChar === ';') {
  1972. return {
  1973. text: '',
  1974. selection: [1, 1]
  1975. };
  1976. }
  1977. }
  1978. });
  1979. this.add("!important", "insertion", function (state, action, editor, session, text) {
  1980. if (text === '!' && editor.selection.isEmpty()) {
  1981. var cursor = editor.getCursorPosition();
  1982. var line = session.doc.getLine(cursor.row);
  1983. if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
  1984. return {
  1985. text: '!important',
  1986. selection: [10, 10]
  1987. };
  1988. }
  1989. }
  1990. });
  1991. };
  1992. oop.inherits(CssBehaviour, CstyleBehaviour);
  1993. exports.CssBehaviour = CssBehaviour;
  1994. });
  1995. 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) {
  1996. "use strict";
  1997. var oop = require("../lib/oop");
  1998. var TextMode = require("./text").Mode;
  1999. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  2000. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  2001. var WorkerClient = require("../worker/worker_client").WorkerClient;
  2002. var CssCompletions = require("./css_completions").CssCompletions;
  2003. var CssBehaviour = require("./behaviour/css").CssBehaviour;
  2004. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  2005. var Mode = function() {
  2006. this.HighlightRules = CssHighlightRules;
  2007. this.$outdent = new MatchingBraceOutdent();
  2008. this.$behaviour = new CssBehaviour();
  2009. this.$completer = new CssCompletions();
  2010. this.foldingRules = new CStyleFoldMode();
  2011. };
  2012. oop.inherits(Mode, TextMode);
  2013. (function() {
  2014. this.foldingRules = "cStyle";
  2015. this.blockComment = {start: "/*", end: "*/"};
  2016. this.getNextLineIndent = function(state, line, tab) {
  2017. var indent = this.$getIndent(line);
  2018. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  2019. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  2020. return indent;
  2021. }
  2022. var match = line.match(/^.*\{\s*$/);
  2023. if (match) {
  2024. indent += tab;
  2025. }
  2026. return indent;
  2027. };
  2028. this.checkOutdent = function(state, line, input) {
  2029. return this.$outdent.checkOutdent(line, input);
  2030. };
  2031. this.autoOutdent = function(state, doc, row) {
  2032. this.$outdent.autoOutdent(doc, row);
  2033. };
  2034. this.getCompletions = function(state, session, pos, prefix) {
  2035. return this.$completer.getCompletions(state, session, pos, prefix);
  2036. };
  2037. this.createWorker = function(session) {
  2038. var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
  2039. worker.attachToDocument(session.getDocument());
  2040. worker.on("annotate", function(e) {
  2041. session.setAnnotations(e.data);
  2042. });
  2043. worker.on("terminate", function() {
  2044. session.clearAnnotations();
  2045. });
  2046. return worker;
  2047. };
  2048. this.$id = "ace/mode/css";
  2049. this.snippetFileId = "ace/snippets/css";
  2050. }).call(Mode.prototype);
  2051. exports.Mode = Mode;
  2052. });
  2053. ace.define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
  2054. "use strict";
  2055. var oop = require("../../lib/oop");
  2056. var Behaviour = require("../behaviour").Behaviour;
  2057. var TokenIterator = require("../../token_iterator").TokenIterator;
  2058. var lang = require("../../lib/lang");
  2059. function is(token, type) {
  2060. return token && token.type.lastIndexOf(type + ".xml") > -1;
  2061. }
  2062. var XmlBehaviour = function () {
  2063. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  2064. if (text == '"' || text == "'") {
  2065. var quote = text;
  2066. var selected = session.doc.getTextRange(editor.getSelectionRange());
  2067. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  2068. return {
  2069. text: quote + selected + quote,
  2070. selection: false
  2071. };
  2072. }
  2073. var cursor = editor.getCursorPosition();
  2074. var line = session.doc.getLine(cursor.row);
  2075. var rightChar = line.substring(cursor.column, cursor.column + 1);
  2076. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  2077. var token = iterator.getCurrentToken();
  2078. if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
  2079. return {
  2080. text: "",
  2081. selection: [1, 1]
  2082. };
  2083. }
  2084. if (!token)
  2085. token = iterator.stepBackward();
  2086. if (!token)
  2087. return;
  2088. while (is(token, "tag-whitespace") || is(token, "whitespace")) {
  2089. token = iterator.stepBackward();
  2090. }
  2091. var rightSpace = !rightChar || rightChar.match(/\s/);
  2092. if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
  2093. return {
  2094. text: quote + quote,
  2095. selection: [1, 1]
  2096. };
  2097. }
  2098. }
  2099. });
  2100. this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
  2101. var selected = session.doc.getTextRange(range);
  2102. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  2103. var line = session.doc.getLine(range.start.row);
  2104. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  2105. if (rightChar == selected) {
  2106. range.end.column++;
  2107. return range;
  2108. }
  2109. }
  2110. });
  2111. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  2112. if (text == '>') {
  2113. var position = editor.getSelectionRange().start;
  2114. var iterator = new TokenIterator(session, position.row, position.column);
  2115. var token = iterator.getCurrentToken() || iterator.stepBackward();
  2116. if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
  2117. return;
  2118. if (is(token, "reference.attribute-value"))
  2119. return;
  2120. if (is(token, "attribute-value")) {
  2121. var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length;
  2122. if (position.column < tokenEndColumn)
  2123. return;
  2124. if (position.column == tokenEndColumn) {
  2125. var nextToken = iterator.stepForward();
  2126. if (nextToken && is(nextToken, "attribute-value"))
  2127. return;
  2128. iterator.stepBackward();
  2129. }
  2130. }
  2131. if (/^\s*>/.test(session.getLine(position.row).slice(position.column)))
  2132. return;
  2133. while (!is(token, "tag-name")) {
  2134. token = iterator.stepBackward();
  2135. if (token.value == "<") {
  2136. token = iterator.stepForward();
  2137. break;
  2138. }
  2139. }
  2140. var tokenRow = iterator.getCurrentTokenRow();
  2141. var tokenColumn = iterator.getCurrentTokenColumn();
  2142. if (is(iterator.stepBackward(), "end-tag-open"))
  2143. return;
  2144. var element = token.value;
  2145. if (tokenRow == position.row)
  2146. element = element.substring(0, position.column - tokenColumn);
  2147. if (this.voidElements.hasOwnProperty(element.toLowerCase()))
  2148. return;
  2149. return {
  2150. text: ">" + "</" + element + ">",
  2151. selection: [1, 1]
  2152. };
  2153. }
  2154. });
  2155. this.add("autoindent", "insertion", function (state, action, editor, session, text) {
  2156. if (text == "\n") {
  2157. var cursor = editor.getCursorPosition();
  2158. var line = session.getLine(cursor.row);
  2159. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  2160. var token = iterator.getCurrentToken();
  2161. if (token && token.type.indexOf("tag-close") !== -1) {
  2162. if (token.value == "/>")
  2163. return;
  2164. while (token && token.type.indexOf("tag-name") === -1) {
  2165. token = iterator.stepBackward();
  2166. }
  2167. if (!token) {
  2168. return;
  2169. }
  2170. var tag = token.value;
  2171. var row = iterator.getCurrentTokenRow();
  2172. token = iterator.stepBackward();
  2173. if (!token || token.type.indexOf("end-tag") !== -1) {
  2174. return;
  2175. }
  2176. if (this.voidElements && !this.voidElements[tag]) {
  2177. var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
  2178. var line = session.getLine(row);
  2179. var nextIndent = this.$getIndent(line);
  2180. var indent = nextIndent + session.getTabString();
  2181. if (nextToken && nextToken.value === "</") {
  2182. return {
  2183. text: "\n" + indent + "\n" + nextIndent,
  2184. selection: [1, indent.length, 1, indent.length]
  2185. };
  2186. } else {
  2187. return {
  2188. text: "\n" + indent
  2189. };
  2190. }
  2191. }
  2192. }
  2193. }
  2194. });
  2195. };
  2196. oop.inherits(XmlBehaviour, Behaviour);
  2197. exports.XmlBehaviour = XmlBehaviour;
  2198. });
  2199. ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module) {
  2200. "use strict";
  2201. var oop = require("../../lib/oop");
  2202. var BaseFoldMode = require("./fold_mode").FoldMode;
  2203. var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
  2204. this.defaultMode = defaultMode;
  2205. this.subModes = subModes;
  2206. };
  2207. oop.inherits(FoldMode, BaseFoldMode);
  2208. (function() {
  2209. this.$getMode = function(state) {
  2210. if (typeof state != "string")
  2211. state = state[0];
  2212. for (var key in this.subModes) {
  2213. if (state.indexOf(key) === 0)
  2214. return this.subModes[key];
  2215. }
  2216. return null;
  2217. };
  2218. this.$tryMode = function(state, session, foldStyle, row) {
  2219. var mode = this.$getMode(state);
  2220. return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
  2221. };
  2222. this.getFoldWidget = function(session, foldStyle, row) {
  2223. return (
  2224. this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
  2225. this.$tryMode(session.getState(row), session, foldStyle, row) ||
  2226. this.defaultMode.getFoldWidget(session, foldStyle, row)
  2227. );
  2228. };
  2229. this.getFoldWidgetRange = function(session, foldStyle, row) {
  2230. var mode = this.$getMode(session.getState(row-1));
  2231. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  2232. mode = this.$getMode(session.getState(row));
  2233. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  2234. mode = this.defaultMode;
  2235. return mode.getFoldWidgetRange(session, foldStyle, row);
  2236. };
  2237. }).call(FoldMode.prototype);
  2238. });
  2239. ace.define("ace/mode/folding/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/range","ace/mode/folding/fold_mode","ace/token_iterator"], function(require, exports, module) {
  2240. "use strict";
  2241. var oop = require("../../lib/oop");
  2242. var lang = require("../../lib/lang");
  2243. var Range = require("../../range").Range;
  2244. var BaseFoldMode = require("./fold_mode").FoldMode;
  2245. var TokenIterator = require("../../token_iterator").TokenIterator;
  2246. var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
  2247. BaseFoldMode.call(this);
  2248. this.voidElements = voidElements || {};
  2249. this.optionalEndTags = oop.mixin({}, this.voidElements);
  2250. if (optionalEndTags)
  2251. oop.mixin(this.optionalEndTags, optionalEndTags);
  2252. };
  2253. oop.inherits(FoldMode, BaseFoldMode);
  2254. var Tag = function() {
  2255. this.tagName = "";
  2256. this.closing = false;
  2257. this.selfClosing = false;
  2258. this.start = {row: 0, column: 0};
  2259. this.end = {row: 0, column: 0};
  2260. };
  2261. function is(token, type) {
  2262. return token.type.lastIndexOf(type + ".xml") > -1;
  2263. }
  2264. (function() {
  2265. this.getFoldWidget = function(session, foldStyle, row) {
  2266. var tag = this._getFirstTagInLine(session, row);
  2267. if (!tag)
  2268. return this.getCommentFoldWidget(session, row);
  2269. if (tag.closing || (!tag.tagName && tag.selfClosing))
  2270. return foldStyle == "markbeginend" ? "end" : "";
  2271. if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
  2272. return "";
  2273. if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
  2274. return "";
  2275. return "start";
  2276. };
  2277. this.getCommentFoldWidget = function(session, row) {
  2278. if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
  2279. return "start";
  2280. return "";
  2281. };
  2282. this._getFirstTagInLine = function(session, row) {
  2283. var tokens = session.getTokens(row);
  2284. var tag = new Tag();
  2285. for (var i = 0; i < tokens.length; i++) {
  2286. var token = tokens[i];
  2287. if (is(token, "tag-open")) {
  2288. tag.end.column = tag.start.column + token.value.length;
  2289. tag.closing = is(token, "end-tag-open");
  2290. token = tokens[++i];
  2291. if (!token)
  2292. return null;
  2293. tag.tagName = token.value;
  2294. tag.end.column += token.value.length;
  2295. for (i++; i < tokens.length; i++) {
  2296. token = tokens[i];
  2297. tag.end.column += token.value.length;
  2298. if (is(token, "tag-close")) {
  2299. tag.selfClosing = token.value == '/>';
  2300. break;
  2301. }
  2302. }
  2303. return tag;
  2304. } else if (is(token, "tag-close")) {
  2305. tag.selfClosing = token.value == '/>';
  2306. return tag;
  2307. }
  2308. tag.start.column += token.value.length;
  2309. }
  2310. return null;
  2311. };
  2312. this._findEndTagInLine = function(session, row, tagName, startColumn) {
  2313. var tokens = session.getTokens(row);
  2314. var column = 0;
  2315. for (var i = 0; i < tokens.length; i++) {
  2316. var token = tokens[i];
  2317. column += token.value.length;
  2318. if (column < startColumn)
  2319. continue;
  2320. if (is(token, "end-tag-open")) {
  2321. token = tokens[i + 1];
  2322. if (token && token.value == tagName)
  2323. return true;
  2324. }
  2325. }
  2326. return false;
  2327. };
  2328. this._readTagForward = function(iterator) {
  2329. var token = iterator.getCurrentToken();
  2330. if (!token)
  2331. return null;
  2332. var tag = new Tag();
  2333. do {
  2334. if (is(token, "tag-open")) {
  2335. tag.closing = is(token, "end-tag-open");
  2336. tag.start.row = iterator.getCurrentTokenRow();
  2337. tag.start.column = iterator.getCurrentTokenColumn();
  2338. } else if (is(token, "tag-name")) {
  2339. tag.tagName = token.value;
  2340. } else if (is(token, "tag-close")) {
  2341. tag.selfClosing = token.value == "/>";
  2342. tag.end.row = iterator.getCurrentTokenRow();
  2343. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  2344. iterator.stepForward();
  2345. return tag;
  2346. }
  2347. } while(token = iterator.stepForward());
  2348. return null;
  2349. };
  2350. this._readTagBackward = function(iterator) {
  2351. var token = iterator.getCurrentToken();
  2352. if (!token)
  2353. return null;
  2354. var tag = new Tag();
  2355. do {
  2356. if (is(token, "tag-open")) {
  2357. tag.closing = is(token, "end-tag-open");
  2358. tag.start.row = iterator.getCurrentTokenRow();
  2359. tag.start.column = iterator.getCurrentTokenColumn();
  2360. iterator.stepBackward();
  2361. return tag;
  2362. } else if (is(token, "tag-name")) {
  2363. tag.tagName = token.value;
  2364. } else if (is(token, "tag-close")) {
  2365. tag.selfClosing = token.value == "/>";
  2366. tag.end.row = iterator.getCurrentTokenRow();
  2367. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  2368. }
  2369. } while(token = iterator.stepBackward());
  2370. return null;
  2371. };
  2372. this._pop = function(stack, tag) {
  2373. while (stack.length) {
  2374. var top = stack[stack.length-1];
  2375. if (!tag || top.tagName == tag.tagName) {
  2376. return stack.pop();
  2377. }
  2378. else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
  2379. stack.pop();
  2380. continue;
  2381. } else {
  2382. return null;
  2383. }
  2384. }
  2385. };
  2386. this.getFoldWidgetRange = function(session, foldStyle, row) {
  2387. var firstTag = this._getFirstTagInLine(session, row);
  2388. if (!firstTag) {
  2389. return this.getCommentFoldWidget(session, row)
  2390. && session.getCommentFoldRange(row, session.getLine(row).length);
  2391. }
  2392. var isBackward = firstTag.closing || firstTag.selfClosing;
  2393. var stack = [];
  2394. var tag;
  2395. if (!isBackward) {
  2396. var iterator = new TokenIterator(session, row, firstTag.start.column);
  2397. var start = {
  2398. row: row,
  2399. column: firstTag.start.column + firstTag.tagName.length + 2
  2400. };
  2401. if (firstTag.start.row == firstTag.end.row)
  2402. start.column = firstTag.end.column;
  2403. while (tag = this._readTagForward(iterator)) {
  2404. if (tag.selfClosing) {
  2405. if (!stack.length) {
  2406. tag.start.column += tag.tagName.length + 2;
  2407. tag.end.column -= 2;
  2408. return Range.fromPoints(tag.start, tag.end);
  2409. } else
  2410. continue;
  2411. }
  2412. if (tag.closing) {
  2413. this._pop(stack, tag);
  2414. if (stack.length == 0)
  2415. return Range.fromPoints(start, tag.start);
  2416. }
  2417. else {
  2418. stack.push(tag);
  2419. }
  2420. }
  2421. }
  2422. else {
  2423. var iterator = new TokenIterator(session, row, firstTag.end.column);
  2424. var end = {
  2425. row: row,
  2426. column: firstTag.start.column
  2427. };
  2428. while (tag = this._readTagBackward(iterator)) {
  2429. if (tag.selfClosing) {
  2430. if (!stack.length) {
  2431. tag.start.column += tag.tagName.length + 2;
  2432. tag.end.column -= 2;
  2433. return Range.fromPoints(tag.start, tag.end);
  2434. } else
  2435. continue;
  2436. }
  2437. if (!tag.closing) {
  2438. this._pop(stack, tag);
  2439. if (stack.length == 0) {
  2440. tag.start.column += tag.tagName.length + 2;
  2441. if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
  2442. tag.start.column = tag.end.column;
  2443. return Range.fromPoints(tag.start, end);
  2444. }
  2445. }
  2446. else {
  2447. stack.push(tag);
  2448. }
  2449. }
  2450. }
  2451. };
  2452. }).call(FoldMode.prototype);
  2453. });
  2454. 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) {
  2455. "use strict";
  2456. var oop = require("../../lib/oop");
  2457. var MixedFoldMode = require("./mixed").FoldMode;
  2458. var XmlFoldMode = require("./xml").FoldMode;
  2459. var CStyleFoldMode = require("./cstyle").FoldMode;
  2460. var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
  2461. MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
  2462. "js-": new CStyleFoldMode(),
  2463. "css-": new CStyleFoldMode()
  2464. });
  2465. };
  2466. oop.inherits(FoldMode, MixedFoldMode);
  2467. });
  2468. ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module) {
  2469. "use strict";
  2470. var TokenIterator = require("../token_iterator").TokenIterator;
  2471. var commonAttributes = [
  2472. "accesskey",
  2473. "class",
  2474. "contenteditable",
  2475. "contextmenu",
  2476. "dir",
  2477. "draggable",
  2478. "dropzone",
  2479. "hidden",
  2480. "id",
  2481. "inert",
  2482. "itemid",
  2483. "itemprop",
  2484. "itemref",
  2485. "itemscope",
  2486. "itemtype",
  2487. "lang",
  2488. "spellcheck",
  2489. "style",
  2490. "tabindex",
  2491. "title",
  2492. "translate"
  2493. ];
  2494. var eventAttributes = [
  2495. "onabort",
  2496. "onblur",
  2497. "oncancel",
  2498. "oncanplay",
  2499. "oncanplaythrough",
  2500. "onchange",
  2501. "onclick",
  2502. "onclose",
  2503. "oncontextmenu",
  2504. "oncuechange",
  2505. "ondblclick",
  2506. "ondrag",
  2507. "ondragend",
  2508. "ondragenter",
  2509. "ondragleave",
  2510. "ondragover",
  2511. "ondragstart",
  2512. "ondrop",
  2513. "ondurationchange",
  2514. "onemptied",
  2515. "onended",
  2516. "onerror",
  2517. "onfocus",
  2518. "oninput",
  2519. "oninvalid",
  2520. "onkeydown",
  2521. "onkeypress",
  2522. "onkeyup",
  2523. "onload",
  2524. "onloadeddata",
  2525. "onloadedmetadata",
  2526. "onloadstart",
  2527. "onmousedown",
  2528. "onmousemove",
  2529. "onmouseout",
  2530. "onmouseover",
  2531. "onmouseup",
  2532. "onmousewheel",
  2533. "onpause",
  2534. "onplay",
  2535. "onplaying",
  2536. "onprogress",
  2537. "onratechange",
  2538. "onreset",
  2539. "onscroll",
  2540. "onseeked",
  2541. "onseeking",
  2542. "onselect",
  2543. "onshow",
  2544. "onstalled",
  2545. "onsubmit",
  2546. "onsuspend",
  2547. "ontimeupdate",
  2548. "onvolumechange",
  2549. "onwaiting"
  2550. ];
  2551. var globalAttributes = commonAttributes.concat(eventAttributes);
  2552. var attributeMap = {
  2553. "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},
  2554. "abbr": {},
  2555. "address": {},
  2556. "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1},
  2557. "article": {"pubdate": 1},
  2558. "aside": {},
  2559. "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }},
  2560. "b": {},
  2561. "base": {"href": 1, "target": 1},
  2562. "bdi": {},
  2563. "bdo": {},
  2564. "blockquote": {"cite": 1},
  2565. "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},
  2566. "br": {},
  2567. "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}},
  2568. "canvas": {"width": 1, "height": 1},
  2569. "caption": {},
  2570. "cite": {},
  2571. "code": {},
  2572. "col": {"span": 1},
  2573. "colgroup": {"span": 1},
  2574. "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1},
  2575. "data": {},
  2576. "datalist": {},
  2577. "dd": {},
  2578. "del": {"cite": 1, "datetime": 1},
  2579. "details": {"open": 1},
  2580. "dfn": {},
  2581. "dialog": {"open": 1},
  2582. "div": {},
  2583. "dl": {},
  2584. "dt": {},
  2585. "em": {},
  2586. "embed": {"src": 1, "height": 1, "width": 1, "type": 1},
  2587. "fieldset": {"disabled": 1, "form": 1, "name": 1},
  2588. "figcaption": {},
  2589. "figure": {},
  2590. "footer": {},
  2591. "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}},
  2592. "h1": {},
  2593. "h2": {},
  2594. "h3": {},
  2595. "h4": {},
  2596. "h5": {},
  2597. "h6": {},
  2598. "head": {},
  2599. "header": {},
  2600. "hr": {},
  2601. "html": {"manifest": 1},
  2602. "i": {},
  2603. "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}},
  2604. "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1},
  2605. "input": {
  2606. "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},
  2607. "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},
  2608. "ins": {"cite": 1, "datetime": 1},
  2609. "kbd": {},
  2610. "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1},
  2611. "label": {"form": 1, "for": 1},
  2612. "legend": {},
  2613. "li": {"value": 1},
  2614. "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},
  2615. "main": {},
  2616. "map": {"name": 1},
  2617. "mark": {},
  2618. "math": {},
  2619. "menu": {"type": 1, "label": 1},
  2620. "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1},
  2621. "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1},
  2622. "nav": {},
  2623. "noscript": {"href": 1},
  2624. "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1},
  2625. "ol": {"start": 1, "reversed": 1},
  2626. "optgroup": {"disabled": 1, "label": 1},
  2627. "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1},
  2628. "output": {"for": 1, "form": 1, "name": 1},
  2629. "p": {},
  2630. "param": {"name": 1, "value": 1},
  2631. "pre": {},
  2632. "progress": {"value": 1, "max": 1},
  2633. "q": {"cite": 1},
  2634. "rp": {},
  2635. "rt": {},
  2636. "ruby": {},
  2637. "s": {},
  2638. "samp": {},
  2639. "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1},
  2640. "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}},
  2641. "small": {},
  2642. "source": {"src": 1, "type": 1, "media": 1},
  2643. "span": {},
  2644. "strong": {},
  2645. "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1},
  2646. "sub": {},
  2647. "sup": {},
  2648. "svg": {},
  2649. "table": {"summary": 1},
  2650. "tbody": {},
  2651. "td": {"headers": 1, "rowspan": 1, "colspan": 1},
  2652. "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}},
  2653. "tfoot": {},
  2654. "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1},
  2655. "thead": {},
  2656. "time": {"datetime": 1},
  2657. "title": {},
  2658. "tr": {},
  2659. "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1},
  2660. "section": {},
  2661. "summary": {},
  2662. "u": {},
  2663. "ul": {},
  2664. "var": {},
  2665. "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}},
  2666. "wbr": {}
  2667. };
  2668. var elements = Object.keys(attributeMap);
  2669. function is(token, type) {
  2670. return token.type.lastIndexOf(type + ".xml") > -1;
  2671. }
  2672. function findTagName(session, pos) {
  2673. var iterator = new TokenIterator(session, pos.row, pos.column);
  2674. var token = iterator.getCurrentToken();
  2675. while (token && !is(token, "tag-name")){
  2676. token = iterator.stepBackward();
  2677. }
  2678. if (token)
  2679. return token.value;
  2680. }
  2681. function findAttributeName(session, pos) {
  2682. var iterator = new TokenIterator(session, pos.row, pos.column);
  2683. var token = iterator.getCurrentToken();
  2684. while (token && !is(token, "attribute-name")){
  2685. token = iterator.stepBackward();
  2686. }
  2687. if (token)
  2688. return token.value;
  2689. }
  2690. var HtmlCompletions = function() {
  2691. };
  2692. (function() {
  2693. this.getCompletions = function(state, session, pos, prefix) {
  2694. var token = session.getTokenAt(pos.row, pos.column);
  2695. if (!token)
  2696. return [];
  2697. if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
  2698. return this.getTagCompletions(state, session, pos, prefix);
  2699. if (is(token, "tag-whitespace") || is(token, "attribute-name"))
  2700. return this.getAttributeCompletions(state, session, pos, prefix);
  2701. if (is(token, "attribute-value"))
  2702. return this.getAttributeValueCompletions(state, session, pos, prefix);
  2703. var line = session.getLine(pos.row).substr(0, pos.column);
  2704. if (/&[a-z]*$/i.test(line))
  2705. return this.getHTMLEntityCompletions(state, session, pos, prefix);
  2706. return [];
  2707. };
  2708. this.getTagCompletions = function(state, session, pos, prefix) {
  2709. return elements.map(function(element){
  2710. return {
  2711. value: element,
  2712. meta: "tag",
  2713. score: 1000000
  2714. };
  2715. });
  2716. };
  2717. this.getAttributeCompletions = function(state, session, pos, prefix) {
  2718. var tagName = findTagName(session, pos);
  2719. if (!tagName)
  2720. return [];
  2721. var attributes = globalAttributes;
  2722. if (tagName in attributeMap) {
  2723. attributes = attributes.concat(Object.keys(attributeMap[tagName]));
  2724. }
  2725. return attributes.map(function(attribute){
  2726. return {
  2727. caption: attribute,
  2728. snippet: attribute + '="$0"',
  2729. meta: "attribute",
  2730. score: 1000000
  2731. };
  2732. });
  2733. };
  2734. this.getAttributeValueCompletions = function(state, session, pos, prefix) {
  2735. var tagName = findTagName(session, pos);
  2736. var attributeName = findAttributeName(session, pos);
  2737. if (!tagName)
  2738. return [];
  2739. var values = [];
  2740. if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
  2741. values = Object.keys(attributeMap[tagName][attributeName]);
  2742. }
  2743. return values.map(function(value){
  2744. return {
  2745. caption: value,
  2746. snippet: value,
  2747. meta: "attribute value",
  2748. score: 1000000
  2749. };
  2750. });
  2751. };
  2752. this.getHTMLEntityCompletions = function(state, session, pos, prefix) {
  2753. 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;'];
  2754. return values.map(function(value){
  2755. return {
  2756. caption: value,
  2757. snippet: value,
  2758. meta: "html entity",
  2759. score: 1000000
  2760. };
  2761. });
  2762. };
  2763. }).call(HtmlCompletions.prototype);
  2764. exports.HtmlCompletions = HtmlCompletions;
  2765. });
  2766. 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) {
  2767. "use strict";
  2768. var oop = require("../lib/oop");
  2769. var lang = require("../lib/lang");
  2770. var TextMode = require("./text").Mode;
  2771. var JavaScriptMode = require("./javascript").Mode;
  2772. var CssMode = require("./css").Mode;
  2773. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2774. var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
  2775. var HtmlFoldMode = require("./folding/html").FoldMode;
  2776. var HtmlCompletions = require("./html_completions").HtmlCompletions;
  2777. var WorkerClient = require("../worker/worker_client").WorkerClient;
  2778. var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
  2779. var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
  2780. var Mode = function(options) {
  2781. this.fragmentContext = options && options.fragmentContext;
  2782. this.HighlightRules = HtmlHighlightRules;
  2783. this.$behaviour = new XmlBehaviour();
  2784. this.$completer = new HtmlCompletions();
  2785. this.createModeDelegates({
  2786. "js-": JavaScriptMode,
  2787. "css-": CssMode
  2788. });
  2789. this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
  2790. };
  2791. oop.inherits(Mode, TextMode);
  2792. (function() {
  2793. this.blockComment = {start: "<!--", end: "-->"};
  2794. this.voidElements = lang.arrayToMap(voidElements);
  2795. this.getNextLineIndent = function(state, line, tab) {
  2796. return this.$getIndent(line);
  2797. };
  2798. this.checkOutdent = function(state, line, input) {
  2799. return false;
  2800. };
  2801. this.getCompletions = function(state, session, pos, prefix) {
  2802. return this.$completer.getCompletions(state, session, pos, prefix);
  2803. };
  2804. this.createWorker = function(session) {
  2805. if (this.constructor != Mode)
  2806. return;
  2807. var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
  2808. worker.attachToDocument(session.getDocument());
  2809. if (this.fragmentContext)
  2810. worker.call("setOptions", [{context: this.fragmentContext}]);
  2811. worker.on("error", function(e) {
  2812. session.setAnnotations(e.data);
  2813. });
  2814. worker.on("terminate", function() {
  2815. session.clearAnnotations();
  2816. });
  2817. return worker;
  2818. };
  2819. this.$id = "ace/mode/html";
  2820. this.snippetFileId = "ace/snippets/html";
  2821. }).call(Mode.prototype);
  2822. exports.Mode = Mode;
  2823. });
  2824. ace.define("ace/mode/folding/ruby",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range","ace/token_iterator"], function (require, exports, module) {
  2825. "use strict";
  2826. var oop = require("../../lib/oop");
  2827. var BaseFoldMode = require("./fold_mode").FoldMode;
  2828. var Range = require("../../range").Range;
  2829. var TokenIterator = require("../../token_iterator").TokenIterator;
  2830. var FoldMode = exports.FoldMode = function () {
  2831. };
  2832. oop.inherits(FoldMode, BaseFoldMode);
  2833. (function () {
  2834. this.indentKeywords = {
  2835. "class": 1,
  2836. "def": 1,
  2837. "module": 1,
  2838. "do": 1,
  2839. "unless": 1,
  2840. "if": 1,
  2841. "while": 1,
  2842. "for": 1,
  2843. "until": 1,
  2844. "begin": 1,
  2845. "else": 0,
  2846. "elsif": 0,
  2847. "rescue": 0,
  2848. "ensure": 0,
  2849. "when": 0,
  2850. "end": -1,
  2851. "case": 1,
  2852. "=begin": 1,
  2853. "=end": -1
  2854. };
  2855. this.foldingStartMarker = /(?:\s|^)(def|do|while|class|unless|module|if|for|until|begin|else|elsif|case|rescue|ensure|when)\b|({\s*$)|(=begin)/;
  2856. this.foldingStopMarker = /(=end(?=$|\s.*$))|(^\s*})|\b(end)\b/;
  2857. this.getFoldWidget = function (session, foldStyle, row) {
  2858. var line = session.getLine(row);
  2859. var isStart = this.foldingStartMarker.test(line);
  2860. var isEnd = this.foldingStopMarker.test(line);
  2861. if (isStart && !isEnd) {
  2862. var match = line.match(this.foldingStartMarker);
  2863. if (match[1]) {
  2864. if (match[1] == "if" || match[1] == "else" || match[1] == "while" || match[1] == "until" || match[1] == "unless") {
  2865. if (match[1] == "else" && /^\s*else\s*$/.test(line) === false) {
  2866. return;
  2867. }
  2868. if (/^\s*(?:if|else|while|until|unless)\s*/.test(line) === false) {
  2869. return;
  2870. }
  2871. }
  2872. if (match[1] == "when") {
  2873. if (/\sthen\s/.test(line) === true) {
  2874. return;
  2875. }
  2876. }
  2877. if (session.getTokenAt(row, match.index + 2).type === "keyword")
  2878. return "start";
  2879. } else if (match[3]) {
  2880. if (session.getTokenAt(row, match.index + 1).type === "comment.multiline")
  2881. return "start";
  2882. } else {
  2883. return "start";
  2884. }
  2885. }
  2886. if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd)
  2887. return "";
  2888. var match = line.match(this.foldingStopMarker);
  2889. if (match[3] === "end") {
  2890. if (session.getTokenAt(row, match.index + 1).type === "keyword")
  2891. return "end";
  2892. } else if (match[1]) {
  2893. if (session.getTokenAt(row, match.index + 1).type === "comment.multiline")
  2894. return "end";
  2895. } else
  2896. return "end";
  2897. };
  2898. this.getFoldWidgetRange = function (session, foldStyle, row) {
  2899. var line = session.doc.getLine(row);
  2900. var match = this.foldingStartMarker.exec(line);
  2901. if (match) {
  2902. if (match[1] || match[3])
  2903. return this.rubyBlock(session, row, match.index + 2);
  2904. return this.openingBracketBlock(session, "{", row, match.index);
  2905. }
  2906. var match = this.foldingStopMarker.exec(line);
  2907. if (match) {
  2908. if (match[3] === "end") {
  2909. if (session.getTokenAt(row, match.index + 1).type === "keyword")
  2910. return this.rubyBlock(session, row, match.index + 1);
  2911. }
  2912. if (match[1] === "=end") {
  2913. if (session.getTokenAt(row, match.index + 1).type === "comment.multiline")
  2914. return this.rubyBlock(session, row, match.index + 1);
  2915. }
  2916. return this.closingBracketBlock(session, "}", row, match.index + match[0].length);
  2917. }
  2918. };
  2919. this.rubyBlock = function (session, row, column, tokenRange) {
  2920. var stream = new TokenIterator(session, row, column);
  2921. var token = stream.getCurrentToken();
  2922. if (!token || (token.type != "keyword" && token.type != "comment.multiline"))
  2923. return;
  2924. var val = token.value;
  2925. var line = session.getLine(row);
  2926. switch (token.value) {
  2927. case "if":
  2928. case "unless":
  2929. case "while":
  2930. case "until":
  2931. var checkToken = new RegExp("^\\s*" + token.value);
  2932. if (!checkToken.test(line)) {
  2933. return;
  2934. }
  2935. var dir = this.indentKeywords[val];
  2936. break;
  2937. case "when":
  2938. if (/\sthen\s/.test(line)) {
  2939. return;
  2940. }
  2941. case "elsif":
  2942. case "rescue":
  2943. case "ensure":
  2944. var dir = 1;
  2945. break;
  2946. case "else":
  2947. var checkToken = new RegExp("^\\s*" + token.value + "\\s*$");
  2948. if (!checkToken.test(line)) {
  2949. return;
  2950. }
  2951. var dir = 1;
  2952. break;
  2953. default:
  2954. var dir = this.indentKeywords[val];
  2955. break;
  2956. }
  2957. var stack = [val];
  2958. if (!dir)
  2959. return;
  2960. var startColumn = dir === -1 ? session.getLine(row - 1).length : session.getLine(row).length;
  2961. var startRow = row;
  2962. var ranges = [];
  2963. ranges.push(stream.getCurrentTokenRange());
  2964. stream.step = dir === -1 ? stream.stepBackward : stream.stepForward;
  2965. if (token.type == "comment.multiline") {
  2966. while (token = stream.step()) {
  2967. if (token.type !== "comment.multiline")
  2968. continue;
  2969. if (dir == 1) {
  2970. startColumn = 6;
  2971. if (token.value == "=end") {
  2972. break;
  2973. }
  2974. } else {
  2975. if (token.value == "=begin") {
  2976. break;
  2977. }
  2978. }
  2979. }
  2980. } else {
  2981. while (token = stream.step()) {
  2982. var ignore = false;
  2983. if (token.type !== "keyword")
  2984. continue;
  2985. var level = dir * this.indentKeywords[token.value];
  2986. line = session.getLine(stream.getCurrentTokenRow());
  2987. switch (token.value) {
  2988. case "do":
  2989. for (var i = stream.$tokenIndex - 1; i >= 0; i--) {
  2990. var prevToken = stream.$rowTokens[i];
  2991. if (prevToken && (prevToken.value == "while" || prevToken.value == "until" || prevToken.value == "for")) {
  2992. level = 0;
  2993. break;
  2994. }
  2995. }
  2996. break;
  2997. case "else":
  2998. var checkToken = new RegExp("^\\s*" + token.value + "\\s*$");
  2999. if (!checkToken.test(line) || val == "case") {
  3000. level = 0;
  3001. ignore = true;
  3002. }
  3003. break;
  3004. case "if":
  3005. case "unless":
  3006. case "while":
  3007. case "until":
  3008. var checkToken = new RegExp("^\\s*" + token.value);
  3009. if (!checkToken.test(line)) {
  3010. level = 0;
  3011. ignore = true;
  3012. }
  3013. break;
  3014. case "when":
  3015. if (/\sthen\s/.test(line) || val == "case") {
  3016. level = 0;
  3017. ignore = true;
  3018. }
  3019. break;
  3020. }
  3021. if (level > 0) {
  3022. stack.unshift(token.value);
  3023. } else if (level <= 0 && ignore === false) {
  3024. stack.shift();
  3025. if (!stack.length) {
  3026. if ((val == "while" || val == "until" || val == "for") && token.value != "do") {
  3027. break;
  3028. }
  3029. if (token.value == "do" && dir == -1 && level != 0)
  3030. break;
  3031. if (token.value != "do")
  3032. break;
  3033. }
  3034. if (level === 0) {
  3035. stack.unshift(token.value);
  3036. }
  3037. }
  3038. }
  3039. }
  3040. if (!token)
  3041. return null;
  3042. if (tokenRange) {
  3043. ranges.push(stream.getCurrentTokenRange());
  3044. return ranges;
  3045. }
  3046. var row = stream.getCurrentTokenRow();
  3047. if (dir === -1) {
  3048. if (token.type === "comment.multiline") {
  3049. var endColumn = 6;
  3050. } else {
  3051. var endColumn = session.getLine(row).length;
  3052. }
  3053. return new Range(row, endColumn, startRow - 1, startColumn);
  3054. } else
  3055. return new Range(startRow, startColumn, row - 1, session.getLine(row - 1).length);
  3056. };
  3057. }).call(FoldMode.prototype);
  3058. });
  3059. ace.define("ace/mode/ruby",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ruby_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/ruby"], function(require, exports, module) {
  3060. "use strict";
  3061. var oop = require("../lib/oop");
  3062. var TextMode = require("./text").Mode;
  3063. var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
  3064. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  3065. var Range = require("../range").Range;
  3066. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  3067. var FoldMode = require("./folding/ruby").FoldMode;
  3068. var Mode = function() {
  3069. this.HighlightRules = RubyHighlightRules;
  3070. this.$outdent = new MatchingBraceOutdent();
  3071. this.$behaviour = new CstyleBehaviour();
  3072. this.foldingRules = new FoldMode();
  3073. this.indentKeywords = this.foldingRules.indentKeywords;
  3074. };
  3075. oop.inherits(Mode, TextMode);
  3076. (function() {
  3077. this.lineCommentStart = "#";
  3078. this.getNextLineIndent = function(state, line, tab) {
  3079. var indent = this.$getIndent(line);
  3080. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  3081. var tokens = tokenizedLine.tokens;
  3082. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  3083. return indent;
  3084. }
  3085. if (state == "start") {
  3086. var match = line.match(/^.*[\{\(\[]\s*$/);
  3087. var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/);
  3088. var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/);
  3089. var startingConditional = line.match(/^\s*(if|else|when|elsif|unless|while|for|begin|rescue|ensure)\s*/);
  3090. if (match || startingClassOrMethod || startingDoBlock || startingConditional) {
  3091. indent += tab;
  3092. }
  3093. }
  3094. return indent;
  3095. };
  3096. this.checkOutdent = function(state, line, input) {
  3097. return /^\s+(end|else|rescue|ensure)$/.test(line + input) || this.$outdent.checkOutdent(line, input);
  3098. };
  3099. this.autoOutdent = function(state, session, row) {
  3100. var line = session.getLine(row);
  3101. if (/}/.test(line))
  3102. return this.$outdent.autoOutdent(session, row);
  3103. var indent = this.$getIndent(line);
  3104. var prevLine = session.getLine(row - 1);
  3105. var prevIndent = this.$getIndent(prevLine);
  3106. var tab = session.getTabString();
  3107. if (prevIndent.length <= indent.length) {
  3108. if (indent.slice(-tab.length) == tab)
  3109. session.remove(new Range(row, indent.length - tab.length, row, indent.length));
  3110. }
  3111. };
  3112. this.getMatching = function(session, row, column) {
  3113. if (row == undefined) {
  3114. var pos = session.selection.lead;
  3115. column = pos.column;
  3116. row = pos.row;
  3117. }
  3118. var startToken = session.getTokenAt(row, column);
  3119. if (startToken && startToken.value in this.indentKeywords)
  3120. return this.foldingRules.rubyBlock(session, row, column, true);
  3121. };
  3122. this.$id = "ace/mode/ruby";
  3123. this.snippetFileId = "ace/snippets/ruby";
  3124. }).call(Mode.prototype);
  3125. exports.Mode = Mode;
  3126. });
  3127. ace.define("ace/mode/html_ruby",["require","exports","module","ace/lib/oop","ace/mode/html_ruby_highlight_rules","ace/mode/html","ace/mode/javascript","ace/mode/css","ace/mode/ruby"], function(require, exports, module) {
  3128. "use strict";
  3129. var oop = require("../lib/oop");
  3130. var HtmlRubyHighlightRules = require("./html_ruby_highlight_rules").HtmlRubyHighlightRules;
  3131. var HtmlMode = require("./html").Mode;
  3132. var JavaScriptMode = require("./javascript").Mode;
  3133. var CssMode = require("./css").Mode;
  3134. var RubyMode = require("./ruby").Mode;
  3135. var Mode = function() {
  3136. HtmlMode.call(this);
  3137. this.HighlightRules = HtmlRubyHighlightRules;
  3138. this.createModeDelegates({
  3139. "js-": JavaScriptMode,
  3140. "css-": CssMode,
  3141. "ruby-": RubyMode
  3142. });
  3143. };
  3144. oop.inherits(Mode, HtmlMode);
  3145. (function() {
  3146. this.$id = "ace/mode/html_ruby";
  3147. }).call(Mode.prototype);
  3148. exports.Mode = Mode;
  3149. }); (function() {
  3150. ace.require(["ace/mode/html_ruby"], function(m) {
  3151. if (typeof module == "object" && typeof exports == "object" && module) {
  3152. module.exports = m;
  3153. }
  3154. });
  3155. })();