f98e517a58463a02f8346f124363b909.js 139 KB

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