mode-ejs.js 138 KB

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