6b629d333bc2c38dcef6029ad91a1b40.js 146 KB

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