mode-html_ruby.js 117 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042
  1. ace.define("ace/mode/css_highlight_rules",[], function(require, exports, module) {
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var lang = require("../lib/lang");
  5. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  6. var supportType = exports.supportType = "align-content|align-items|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|border|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|bottom|box-shadow|box-sizing|caption-side|clear|clip|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|cursor|direction|display|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|font|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|hanging-punctuation|height|justify-content|left|letter-spacing|line-height|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|max-height|max-width|max-zoom|min-height|min-width|min-zoom|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|order|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page-break-after|page-break-before|page-break-inside|perspective|perspective-origin|position|quotes|resize|right|tab-size|table-layout|text-align|text-align-last|text-decoration|text-decoration-color|text-decoration-line|text-decoration-style|text-indent|text-justify|text-overflow|text-shadow|text-transform|top|transform|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|user-select|user-zoom|vertical-align|visibility|white-space|width|word-break|word-spacing|word-wrap|z-index";
  7. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  8. var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero|zoom";
  9. var supportConstantColor = exports.supportConstantColor = "aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen";
  10. var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
  11. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
  12. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  13. var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
  14. var CssHighlightRules = function() {
  15. var keywordMapper = this.createKeywordMapper({
  16. "support.function": supportFunction,
  17. "support.constant": supportConstant,
  18. "support.type": supportType,
  19. "support.constant.color": supportConstantColor,
  20. "support.constant.fonts": supportConstantFonts
  21. }, "text", true);
  22. this.$rules = {
  23. "start" : [{
  24. include : ["strings", "url", "comments"]
  25. }, {
  26. token: "paren.lparen",
  27. regex: "\\{",
  28. next: "ruleset"
  29. }, {
  30. token: "paren.rparen",
  31. regex: "\\}"
  32. }, {
  33. token: "string",
  34. regex: "@(?!viewport)",
  35. next: "media"
  36. }, {
  37. token: "keyword",
  38. regex: "#[a-z0-9-_]+"
  39. }, {
  40. token: "keyword",
  41. regex: "%"
  42. }, {
  43. token: "variable",
  44. regex: "\\.[a-z0-9-_]+"
  45. }, {
  46. token: "string",
  47. regex: ":[a-z0-9-_]+"
  48. }, {
  49. token : "constant.numeric",
  50. regex : numRe
  51. }, {
  52. token: "constant",
  53. regex: "[a-z0-9-_]+"
  54. }, {
  55. caseInsensitive: true
  56. }],
  57. "media": [{
  58. include : ["strings", "url", "comments"]
  59. }, {
  60. token: "paren.lparen",
  61. regex: "\\{",
  62. next: "start"
  63. }, {
  64. token: "paren.rparen",
  65. regex: "\\}",
  66. next: "start"
  67. }, {
  68. token: "string",
  69. regex: ";",
  70. next: "start"
  71. }, {
  72. token: "keyword",
  73. regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
  74. + "|page|font|keyframes|viewport|counter-style|font-feature-values"
  75. + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
  76. }],
  77. "comments" : [{
  78. token: "comment", // multi line comment
  79. regex: "\\/\\*",
  80. push: [{
  81. token : "comment",
  82. regex : "\\*\\/",
  83. next : "pop"
  84. }, {
  85. defaultToken : "comment"
  86. }]
  87. }],
  88. "ruleset" : [{
  89. regex : "-(webkit|ms|moz|o)-",
  90. token : "text"
  91. }, {
  92. token : "punctuation.operator",
  93. regex : "[:;]"
  94. }, {
  95. token : "paren.rparen",
  96. regex : "\\}",
  97. next : "start"
  98. }, {
  99. include : ["strings", "url", "comments"]
  100. }, {
  101. token : ["constant.numeric", "keyword"],
  102. regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vmax|vmin|vm|vw|%)"
  103. }, {
  104. token : "constant.numeric",
  105. regex : numRe
  106. }, {
  107. token : "constant.numeric", // hex6 color
  108. regex : "#[a-f0-9]{6}"
  109. }, {
  110. token : "constant.numeric", // hex3 color
  111. regex : "#[a-f0-9]{3}"
  112. }, {
  113. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  114. regex : pseudoElements
  115. }, {
  116. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  117. regex : pseudoClasses
  118. }, {
  119. include: "url"
  120. }, {
  121. token : keywordMapper,
  122. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  123. }, {
  124. caseInsensitive: true
  125. }],
  126. url: [{
  127. token : "support.function",
  128. regex : "(?:url(:?-prefix)?|domain|regexp)\\(",
  129. push: [{
  130. token : "support.function",
  131. regex : "\\)",
  132. next : "pop"
  133. }, {
  134. defaultToken: "string"
  135. }]
  136. }],
  137. strings: [{
  138. token : "string.start",
  139. regex : "'",
  140. push : [{
  141. token : "string.end",
  142. regex : "'|$",
  143. next: "pop"
  144. }, {
  145. include : "escapes"
  146. }, {
  147. token : "constant.language.escape",
  148. regex : /\\$/,
  149. consumeLineEnd: true
  150. }, {
  151. defaultToken: "string"
  152. }]
  153. }, {
  154. token : "string.start",
  155. regex : '"',
  156. push : [{
  157. token : "string.end",
  158. regex : '"|$',
  159. next: "pop"
  160. }, {
  161. include : "escapes"
  162. }, {
  163. token : "constant.language.escape",
  164. regex : /\\$/,
  165. consumeLineEnd: true
  166. }, {
  167. defaultToken: "string"
  168. }]
  169. }],
  170. escapes: [{
  171. token : "constant.language.escape",
  172. regex : /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
  173. }]
  174. };
  175. this.normalizeRules();
  176. };
  177. oop.inherits(CssHighlightRules, TextHighlightRules);
  178. exports.CssHighlightRules = CssHighlightRules;
  179. });
  180. ace.define("ace/mode/doc_comment_highlight_rules",[], function(require, exports, module) {
  181. "use strict";
  182. var oop = require("../lib/oop");
  183. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  184. var DocCommentHighlightRules = function() {
  185. this.$rules = {
  186. "start" : [ {
  187. token : "comment.doc.tag",
  188. regex : "@[\\w\\d_]+" // TODO: fix email addresses
  189. },
  190. DocCommentHighlightRules.getTagRule(),
  191. {
  192. defaultToken : "comment.doc",
  193. caseInsensitive: true
  194. }]
  195. };
  196. };
  197. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  198. DocCommentHighlightRules.getTagRule = function(start) {
  199. return {
  200. token : "comment.doc.tag.storage.type",
  201. regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  202. };
  203. };
  204. DocCommentHighlightRules.getStartRule = function(start) {
  205. return {
  206. token : "comment.doc", // doc comment
  207. regex : "\\/\\*(?=\\*)",
  208. next : start
  209. };
  210. };
  211. DocCommentHighlightRules.getEndRule = function (start) {
  212. return {
  213. token : "comment.doc", // closing comment
  214. regex : "\\*\\/",
  215. next : start
  216. };
  217. };
  218. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  219. });
  220. ace.define("ace/mode/javascript_highlight_rules",[], function(require, exports, module) {
  221. "use strict";
  222. var oop = require("../lib/oop");
  223. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  224. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  225. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
  226. var JavaScriptHighlightRules = function(options) {
  227. var keywordMapper = this.createKeywordMapper({
  228. "variable.language":
  229. "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
  230. "Namespace|QName|XML|XMLList|" + // E4X
  231. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  232. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  233. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
  234. "SyntaxError|TypeError|URIError|" +
  235. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
  236. "isNaN|parseFloat|parseInt|" +
  237. "JSON|Math|" + // Other
  238. "this|arguments|prototype|window|document" , // Pseudo
  239. "keyword":
  240. "const|yield|import|get|set|async|await|" +
  241. "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  242. "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  243. "__parent__|__count__|escape|unescape|with|__proto__|" +
  244. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
  245. "storage.type":
  246. "const|let|var|function",
  247. "constant.language":
  248. "null|Infinity|NaN|undefined",
  249. "support.function":
  250. "alert",
  251. "constant.language.boolean": "true|false"
  252. }, "identifier");
  253. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
  254. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  255. "u[0-9a-fA-F]{4}|" + // unicode
  256. "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
  257. "[0-2][0-7]{0,2}|" + // oct
  258. "3[0-7][0-7]?|" + // oct
  259. "[4-7][0-7]?|" + //oct
  260. ".)";
  261. this.$rules = {
  262. "no_regex" : [
  263. DocCommentHighlightRules.getStartRule("doc-start"),
  264. comments("no_regex"),
  265. {
  266. token : "string",
  267. regex : "'(?=.)",
  268. next : "qstring"
  269. }, {
  270. token : "string",
  271. regex : '"(?=.)',
  272. next : "qqstring"
  273. }, {
  274. token : "constant.numeric", // hexadecimal, octal and binary
  275. regex : /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
  276. }, {
  277. token : "constant.numeric", // decimal integers and floats
  278. regex : /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
  279. }, {
  280. token : [
  281. "storage.type", "punctuation.operator", "support.function",
  282. "punctuation.operator", "entity.name.function", "text","keyword.operator"
  283. ],
  284. regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
  285. next: "function_arguments"
  286. }, {
  287. token : [
  288. "storage.type", "punctuation.operator", "entity.name.function", "text",
  289. "keyword.operator", "text", "storage.type", "text", "paren.lparen"
  290. ],
  291. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  292. next: "function_arguments"
  293. }, {
  294. token : [
  295. "entity.name.function", "text", "keyword.operator", "text", "storage.type",
  296. "text", "paren.lparen"
  297. ],
  298. regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  299. next: "function_arguments"
  300. }, {
  301. token : [
  302. "storage.type", "punctuation.operator", "entity.name.function", "text",
  303. "keyword.operator", "text",
  304. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  305. ],
  306. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
  307. next: "function_arguments"
  308. }, {
  309. token : [
  310. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  311. ],
  312. regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
  313. next: "function_arguments"
  314. }, {
  315. token : [
  316. "entity.name.function", "text", "punctuation.operator",
  317. "text", "storage.type", "text", "paren.lparen"
  318. ],
  319. regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
  320. next: "function_arguments"
  321. }, {
  322. token : [
  323. "text", "text", "storage.type", "text", "paren.lparen"
  324. ],
  325. regex : "(:)(\\s*)(function)(\\s*)(\\()",
  326. next: "function_arguments"
  327. }, {
  328. token : "keyword",
  329. regex : "from(?=\\s*('|\"))"
  330. }, {
  331. token : "keyword",
  332. regex : "(?:" + kwBeforeRe + ")\\b",
  333. next : "start"
  334. }, {
  335. token : ["support.constant"],
  336. regex : /that\b/
  337. }, {
  338. token : ["storage.type", "punctuation.operator", "support.function.firebug"],
  339. regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
  340. }, {
  341. token : keywordMapper,
  342. regex : identifierRe
  343. }, {
  344. token : "punctuation.operator",
  345. regex : /[.](?![.])/,
  346. next : "property"
  347. }, {
  348. token : "storage.type",
  349. regex : /=>/
  350. }, {
  351. token : "keyword.operator",
  352. regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
  353. next : "start"
  354. }, {
  355. token : "punctuation.operator",
  356. regex : /[?:,;.]/,
  357. next : "start"
  358. }, {
  359. token : "paren.lparen",
  360. regex : /[\[({]/,
  361. next : "start"
  362. }, {
  363. token : "paren.rparen",
  364. regex : /[\])}]/
  365. }, {
  366. token: "comment",
  367. regex: /^#!.*$/
  368. }
  369. ],
  370. property: [{
  371. token : "text",
  372. regex : "\\s+"
  373. }, {
  374. token : [
  375. "storage.type", "punctuation.operator", "entity.name.function", "text",
  376. "keyword.operator", "text",
  377. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  378. ],
  379. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
  380. next: "function_arguments"
  381. }, {
  382. token : "punctuation.operator",
  383. regex : /[.](?![.])/
  384. }, {
  385. token : "support.function",
  386. 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(?=\()/
  387. }, {
  388. token : "support.function.dom",
  389. 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(?=\()/
  390. }, {
  391. token : "support.constant",
  392. 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/
  393. }, {
  394. token : "identifier",
  395. regex : identifierRe
  396. }, {
  397. regex: "",
  398. token: "empty",
  399. next: "no_regex"
  400. }
  401. ],
  402. "start": [
  403. DocCommentHighlightRules.getStartRule("doc-start"),
  404. comments("start"),
  405. {
  406. token: "string.regexp",
  407. regex: "\\/",
  408. next: "regex"
  409. }, {
  410. token : "text",
  411. regex : "\\s+|^$",
  412. next : "start"
  413. }, {
  414. token: "empty",
  415. regex: "",
  416. next: "no_regex"
  417. }
  418. ],
  419. "regex": [
  420. {
  421. token: "regexp.keyword.operator",
  422. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  423. }, {
  424. token: "string.regexp",
  425. regex: "/[sxngimy]*",
  426. next: "no_regex"
  427. }, {
  428. token : "invalid",
  429. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  430. }, {
  431. token : "constant.language.escape",
  432. regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  433. }, {
  434. token : "constant.language.delimiter",
  435. regex: /\|/
  436. }, {
  437. token: "constant.language.escape",
  438. regex: /\[\^?/,
  439. next: "regex_character_class"
  440. }, {
  441. token: "empty",
  442. regex: "$",
  443. next: "no_regex"
  444. }, {
  445. defaultToken: "string.regexp"
  446. }
  447. ],
  448. "regex_character_class": [
  449. {
  450. token: "regexp.charclass.keyword.operator",
  451. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  452. }, {
  453. token: "constant.language.escape",
  454. regex: "]",
  455. next: "regex"
  456. }, {
  457. token: "constant.language.escape",
  458. regex: "-"
  459. }, {
  460. token: "empty",
  461. regex: "$",
  462. next: "no_regex"
  463. }, {
  464. defaultToken: "string.regexp.charachterclass"
  465. }
  466. ],
  467. "function_arguments": [
  468. {
  469. token: "variable.parameter",
  470. regex: identifierRe
  471. }, {
  472. token: "punctuation.operator",
  473. regex: "[, ]+"
  474. }, {
  475. token: "punctuation.operator",
  476. regex: "$"
  477. }, {
  478. token: "empty",
  479. regex: "",
  480. next: "no_regex"
  481. }
  482. ],
  483. "qqstring" : [
  484. {
  485. token : "constant.language.escape",
  486. regex : escapedRe
  487. }, {
  488. token : "string",
  489. regex : "\\\\$",
  490. consumeLineEnd : true
  491. }, {
  492. token : "string",
  493. regex : '"|$',
  494. next : "no_regex"
  495. }, {
  496. defaultToken: "string"
  497. }
  498. ],
  499. "qstring" : [
  500. {
  501. token : "constant.language.escape",
  502. regex : escapedRe
  503. }, {
  504. token : "string",
  505. regex : "\\\\$",
  506. consumeLineEnd : true
  507. }, {
  508. token : "string",
  509. regex : "'|$",
  510. next : "no_regex"
  511. }, {
  512. defaultToken: "string"
  513. }
  514. ]
  515. };
  516. if (!options || !options.noES6) {
  517. this.$rules.no_regex.unshift({
  518. regex: "[{}]", onMatch: function(val, state, stack) {
  519. this.next = val == "{" ? this.nextState : "";
  520. if (val == "{" && stack.length) {
  521. stack.unshift("start", state);
  522. }
  523. else if (val == "}" && stack.length) {
  524. stack.shift();
  525. this.next = stack.shift();
  526. if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
  527. return "paren.quasi.end";
  528. }
  529. return val == "{" ? "paren.lparen" : "paren.rparen";
  530. },
  531. nextState: "start"
  532. }, {
  533. token : "string.quasi.start",
  534. regex : /`/,
  535. push : [{
  536. token : "constant.language.escape",
  537. regex : escapedRe
  538. }, {
  539. token : "paren.quasi.start",
  540. regex : /\${/,
  541. push : "start"
  542. }, {
  543. token : "string.quasi.end",
  544. regex : /`/,
  545. next : "pop"
  546. }, {
  547. defaultToken: "string.quasi"
  548. }]
  549. });
  550. if (!options || options.jsx != false)
  551. JSX.call(this);
  552. }
  553. this.embedRules(DocCommentHighlightRules, "doc-",
  554. [ DocCommentHighlightRules.getEndRule("no_regex") ]);
  555. this.normalizeRules();
  556. };
  557. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  558. function JSX() {
  559. var tagRegex = identifierRe.replace("\\d", "\\d\\-");
  560. var jsxTag = {
  561. onMatch : function(val, state, stack) {
  562. var offset = val.charAt(1) == "/" ? 2 : 1;
  563. if (offset == 1) {
  564. if (state != this.nextState)
  565. stack.unshift(this.next, this.nextState, 0);
  566. else
  567. stack.unshift(this.next);
  568. stack[2]++;
  569. } else if (offset == 2) {
  570. if (state == this.nextState) {
  571. stack[1]--;
  572. if (!stack[1] || stack[1] < 0) {
  573. stack.shift();
  574. stack.shift();
  575. }
  576. }
  577. }
  578. return [{
  579. type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
  580. value: val.slice(0, offset)
  581. }, {
  582. type: "meta.tag.tag-name.xml",
  583. value: val.substr(offset)
  584. }];
  585. },
  586. regex : "</?" + tagRegex + "",
  587. next: "jsxAttributes",
  588. nextState: "jsx"
  589. };
  590. this.$rules.start.unshift(jsxTag);
  591. var jsxJsRule = {
  592. regex: "{",
  593. token: "paren.quasi.start",
  594. push: "start"
  595. };
  596. this.$rules.jsx = [
  597. jsxJsRule,
  598. jsxTag,
  599. {include : "reference"},
  600. {defaultToken: "string"}
  601. ];
  602. this.$rules.jsxAttributes = [{
  603. token : "meta.tag.punctuation.tag-close.xml",
  604. regex : "/?>",
  605. onMatch : function(value, currentState, stack) {
  606. if (currentState == stack[0])
  607. stack.shift();
  608. if (value.length == 2) {
  609. if (stack[0] == this.nextState)
  610. stack[1]--;
  611. if (!stack[1] || stack[1] < 0) {
  612. stack.splice(0, 2);
  613. }
  614. }
  615. this.next = stack[0] || "start";
  616. return [{type: this.token, value: value}];
  617. },
  618. nextState: "jsx"
  619. },
  620. jsxJsRule,
  621. comments("jsxAttributes"),
  622. {
  623. token : "entity.other.attribute-name.xml",
  624. regex : tagRegex
  625. }, {
  626. token : "keyword.operator.attribute-equals.xml",
  627. regex : "="
  628. }, {
  629. token : "text.tag-whitespace.xml",
  630. regex : "\\s+"
  631. }, {
  632. token : "string.attribute-value.xml",
  633. regex : "'",
  634. stateName : "jsx_attr_q",
  635. push : [
  636. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  637. {include : "reference"},
  638. {defaultToken : "string.attribute-value.xml"}
  639. ]
  640. }, {
  641. token : "string.attribute-value.xml",
  642. regex : '"',
  643. stateName : "jsx_attr_qq",
  644. push : [
  645. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  646. {include : "reference"},
  647. {defaultToken : "string.attribute-value.xml"}
  648. ]
  649. },
  650. jsxTag
  651. ];
  652. this.$rules.reference = [{
  653. token : "constant.language.escape.reference.xml",
  654. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  655. }];
  656. }
  657. function comments(next) {
  658. return [
  659. {
  660. token : "comment", // multi line comment
  661. regex : /\/\*/,
  662. next: [
  663. DocCommentHighlightRules.getTagRule(),
  664. {token : "comment", regex : "\\*\\/", next : next || "pop"},
  665. {defaultToken : "comment", caseInsensitive: true}
  666. ]
  667. }, {
  668. token : "comment",
  669. regex : "\\/\\/",
  670. next: [
  671. DocCommentHighlightRules.getTagRule(),
  672. {token : "comment", regex : "$|^", next : next || "pop"},
  673. {defaultToken : "comment", caseInsensitive: true}
  674. ]
  675. }
  676. ];
  677. }
  678. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  679. });
  680. ace.define("ace/mode/xml_highlight_rules",[], function(require, exports, module) {
  681. "use strict";
  682. var oop = require("../lib/oop");
  683. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  684. var XmlHighlightRules = function(normalize) {
  685. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  686. this.$rules = {
  687. start : [
  688. {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
  689. {
  690. token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
  691. regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction"
  692. },
  693. {token : "comment.start.xml", regex : "<\\!--", next : "comment"},
  694. {
  695. token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  696. regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
  697. },
  698. {include : "tag"},
  699. {token : "text.end-tag-open.xml", regex: "</"},
  700. {token : "text.tag-open.xml", regex: "<"},
  701. {include : "reference"},
  702. {defaultToken : "text.xml"}
  703. ],
  704. processing_instruction : [{
  705. token : "entity.other.attribute-name.decl-attribute-name.xml",
  706. regex : tagRegex
  707. }, {
  708. token : "keyword.operator.decl-attribute-equals.xml",
  709. regex : "="
  710. }, {
  711. include: "whitespace"
  712. }, {
  713. include: "string"
  714. }, {
  715. token : "punctuation.xml-decl.xml",
  716. regex : "\\?>",
  717. next : "start"
  718. }],
  719. doctype : [
  720. {include : "whitespace"},
  721. {include : "string"},
  722. {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
  723. {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
  724. {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
  725. ],
  726. int_subset : [{
  727. token : "text.xml",
  728. regex : "\\s+"
  729. }, {
  730. token: "punctuation.int-subset.xml",
  731. regex: "]",
  732. next: "pop"
  733. }, {
  734. token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  735. regex : "(<\\!)(" + tagRegex + ")",
  736. push : [{
  737. token : "text",
  738. regex : "\\s+"
  739. },
  740. {
  741. token : "punctuation.markup-decl.xml",
  742. regex : ">",
  743. next : "pop"
  744. },
  745. {include : "string"}]
  746. }],
  747. cdata : [
  748. {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
  749. {token : "text.xml", regex : "\\s+"},
  750. {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
  751. ],
  752. comment : [
  753. {token : "comment.end.xml", regex : "-->", next : "start"},
  754. {defaultToken : "comment.xml"}
  755. ],
  756. reference : [{
  757. token : "constant.language.escape.reference.xml",
  758. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  759. }],
  760. attr_reference : [{
  761. token : "constant.language.escape.reference.attribute-value.xml",
  762. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  763. }],
  764. tag : [{
  765. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  766. regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  767. next: [
  768. {include : "attributes"},
  769. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  770. ]
  771. }],
  772. tag_whitespace : [
  773. {token : "text.tag-whitespace.xml", regex : "\\s+"}
  774. ],
  775. whitespace : [
  776. {token : "text.whitespace.xml", regex : "\\s+"}
  777. ],
  778. string: [{
  779. token : "string.xml",
  780. regex : "'",
  781. push : [
  782. {token : "string.xml", regex: "'", next: "pop"},
  783. {defaultToken : "string.xml"}
  784. ]
  785. }, {
  786. token : "string.xml",
  787. regex : '"',
  788. push : [
  789. {token : "string.xml", regex: '"', next: "pop"},
  790. {defaultToken : "string.xml"}
  791. ]
  792. }],
  793. attributes: [{
  794. token : "entity.other.attribute-name.xml",
  795. regex : tagRegex
  796. }, {
  797. token : "keyword.operator.attribute-equals.xml",
  798. regex : "="
  799. }, {
  800. include: "tag_whitespace"
  801. }, {
  802. include: "attribute_value"
  803. }],
  804. attribute_value: [{
  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. token : "string.attribute-value.xml",
  814. regex : '"',
  815. push : [
  816. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  817. {include : "attr_reference"},
  818. {defaultToken : "string.attribute-value.xml"}
  819. ]
  820. }]
  821. };
  822. if (this.constructor === XmlHighlightRules)
  823. this.normalizeRules();
  824. };
  825. (function() {
  826. this.embedTagRules = function(HighlightRules, prefix, tag){
  827. this.$rules.tag.unshift({
  828. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  829. regex : "(<)(" + tag + "(?=\\s|>|$))",
  830. next: [
  831. {include : "attributes"},
  832. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
  833. ]
  834. });
  835. this.$rules[tag + "-end"] = [
  836. {include : "attributes"},
  837. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
  838. onMatch : function(value, currentState, stack) {
  839. stack.splice(0);
  840. return this.token;
  841. }}
  842. ];
  843. this.embedRules(HighlightRules, prefix, [{
  844. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  845. regex : "(</)(" + tag + "(?=\\s|>|$))",
  846. next: tag + "-end"
  847. }, {
  848. token: "string.cdata.xml",
  849. regex : "<\\!\\[CDATA\\["
  850. }, {
  851. token: "string.cdata.xml",
  852. regex : "\\]\\]>"
  853. }]);
  854. };
  855. }).call(TextHighlightRules.prototype);
  856. oop.inherits(XmlHighlightRules, TextHighlightRules);
  857. exports.XmlHighlightRules = XmlHighlightRules;
  858. });
  859. ace.define("ace/mode/html_highlight_rules",[], function(require, exports, module) {
  860. "use strict";
  861. var oop = require("../lib/oop");
  862. var lang = require("../lib/lang");
  863. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  864. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  865. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  866. var tagMap = lang.createMap({
  867. a : 'anchor',
  868. button : 'form',
  869. form : 'form',
  870. img : 'image',
  871. input : 'form',
  872. label : 'form',
  873. option : 'form',
  874. script : 'script',
  875. select : 'form',
  876. textarea : 'form',
  877. style : 'style',
  878. table : 'table',
  879. tbody : 'table',
  880. td : 'table',
  881. tfoot : 'table',
  882. th : 'table',
  883. tr : 'table'
  884. });
  885. var HtmlHighlightRules = function() {
  886. XmlHighlightRules.call(this);
  887. this.addRules({
  888. attributes: [{
  889. include : "tag_whitespace"
  890. }, {
  891. token : "entity.other.attribute-name.xml",
  892. regex : "[-_a-zA-Z0-9:.]+"
  893. }, {
  894. token : "keyword.operator.attribute-equals.xml",
  895. regex : "=",
  896. push : [{
  897. include: "tag_whitespace"
  898. }, {
  899. token : "string.unquoted.attribute-value.html",
  900. regex : "[^<>='\"`\\s]+",
  901. next : "pop"
  902. }, {
  903. token : "empty",
  904. regex : "",
  905. next : "pop"
  906. }]
  907. }, {
  908. include : "attribute_value"
  909. }],
  910. tag: [{
  911. token : function(start, tag) {
  912. var group = tagMap[tag];
  913. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  914. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  915. },
  916. regex : "(</?)([-_a-zA-Z0-9:.]+)",
  917. next: "tag_stuff"
  918. }],
  919. tag_stuff: [
  920. {include : "attributes"},
  921. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  922. ]
  923. });
  924. this.embedTagRules(CssHighlightRules, "css-", "style");
  925. this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "js-", "script");
  926. if (this.constructor === HtmlHighlightRules)
  927. this.normalizeRules();
  928. };
  929. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  930. exports.HtmlHighlightRules = HtmlHighlightRules;
  931. });
  932. ace.define("ace/mode/ruby_highlight_rules",[], function(require, exports, module) {
  933. "use strict";
  934. var oop = require("../lib/oop");
  935. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  936. var constantOtherSymbol = exports.constantOtherSymbol = {
  937. token : "constant.other.symbol.ruby", // symbol
  938. regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"
  939. };
  940. var qString = exports.qString = {
  941. token : "string", // single line
  942. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  943. };
  944. var qqString = exports.qqString = {
  945. token : "string", // single line
  946. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  947. };
  948. var tString = exports.tString = {
  949. token : "string", // backtick string
  950. regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"
  951. };
  952. var constantNumericHex = exports.constantNumericHex = {
  953. token : "constant.numeric", // hex
  954. regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b"
  955. };
  956. var constantNumericFloat = exports.constantNumericFloat = {
  957. token : "constant.numeric", // float
  958. regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b"
  959. };
  960. var instanceVariable = exports.instanceVariable = {
  961. token : "variable.instance", // instance variable
  962. regex : "@{1,2}[a-zA-Z_\\d]+"
  963. };
  964. var RubyHighlightRules = function() {
  965. var builtinFunctions = (
  966. "abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
  967. "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
  968. "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" +
  969. "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" +
  970. "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" +
  971. "assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" +
  972. "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" +
  973. "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" +
  974. "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" +
  975. "gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" +
  976. "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" +
  977. "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" +
  978. "raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|" +
  979. "set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" +
  980. "throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" +
  981. "render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" +
  982. "content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" +
  983. "fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" +
  984. "time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" +
  985. "select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" +
  986. "file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" +
  987. "protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" +
  988. "send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" +
  989. "validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" +
  990. "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" +
  991. "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" +
  992. "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" +
  993. "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" +
  994. "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" +
  995. "has_many|has_one|belongs_to|has_and_belongs_to_many"
  996. );
  997. var keywords = (
  998. "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" +
  999. "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" +
  1000. "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield"
  1001. );
  1002. var buildinConstants = (
  1003. "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
  1004. "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING"
  1005. );
  1006. var builtinVariables = (
  1007. "$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE|" +
  1008. "$!|root_url|flash|session|cookies|params|request|response|logger|self"
  1009. );
  1010. var keywordMapper = this.$keywords = this.createKeywordMapper({
  1011. "keyword": keywords,
  1012. "constant.language": buildinConstants,
  1013. "variable.language": builtinVariables,
  1014. "support.function": builtinFunctions,
  1015. "invalid.deprecated": "debugger" // TODO is this a remnant from js mode?
  1016. }, "identifier");
  1017. this.$rules = {
  1018. "start" : [
  1019. {
  1020. token : "comment",
  1021. regex : "#.*$"
  1022. }, {
  1023. token : "comment", // multi line comment
  1024. regex : "^=begin(?:$|\\s.*$)",
  1025. next : "comment"
  1026. }, {
  1027. token : "string.regexp",
  1028. regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
  1029. },
  1030. [{
  1031. regex: "[{}]", onMatch: function(val, state, stack) {
  1032. this.next = val == "{" ? this.nextState : "";
  1033. if (val == "{" && stack.length) {
  1034. stack.unshift("start", state);
  1035. return "paren.lparen";
  1036. }
  1037. if (val == "}" && stack.length) {
  1038. stack.shift();
  1039. this.next = stack.shift();
  1040. if (this.next.indexOf("string") != -1)
  1041. return "paren.end";
  1042. }
  1043. return val == "{" ? "paren.lparen" : "paren.rparen";
  1044. },
  1045. nextState: "start"
  1046. }, {
  1047. token : "string.start",
  1048. regex : /"/,
  1049. push : [{
  1050. token : "constant.language.escape",
  1051. regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
  1052. }, {
  1053. token : "paren.start",
  1054. regex : /#{/,
  1055. push : "start"
  1056. }, {
  1057. token : "string.end",
  1058. regex : /"/,
  1059. next : "pop"
  1060. }, {
  1061. defaultToken: "string"
  1062. }]
  1063. }, {
  1064. token : "string.start",
  1065. regex : /`/,
  1066. push : [{
  1067. token : "constant.language.escape",
  1068. regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
  1069. }, {
  1070. token : "paren.start",
  1071. regex : /#{/,
  1072. push : "start"
  1073. }, {
  1074. token : "string.end",
  1075. regex : /`/,
  1076. next : "pop"
  1077. }, {
  1078. defaultToken: "string"
  1079. }]
  1080. }, {
  1081. token : "string.start",
  1082. regex : /'/,
  1083. push : [{
  1084. token : "constant.language.escape",
  1085. regex : /\\['\\]/
  1086. }, {
  1087. token : "string.end",
  1088. regex : /'/,
  1089. next : "pop"
  1090. }, {
  1091. defaultToken: "string"
  1092. }]
  1093. }],
  1094. {
  1095. token : "text", // namespaces aren't symbols
  1096. regex : "::"
  1097. }, {
  1098. token : "variable.instance", // instance variable
  1099. regex : "@{1,2}[a-zA-Z_\\d]+"
  1100. }, {
  1101. token : "support.class", // class name
  1102. regex : "[A-Z][a-zA-Z_\\d]+"
  1103. },
  1104. constantOtherSymbol,
  1105. constantNumericHex,
  1106. constantNumericFloat,
  1107. {
  1108. token : "constant.language.boolean",
  1109. regex : "(?:true|false)\\b"
  1110. }, {
  1111. token : keywordMapper,
  1112. regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  1113. }, {
  1114. token : "punctuation.separator.key-value",
  1115. regex : "=>"
  1116. }, {
  1117. stateName: "heredoc",
  1118. onMatch : function(value, currentState, stack) {
  1119. var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
  1120. var tokens = value.split(this.splitRegex);
  1121. stack.push(next, tokens[3]);
  1122. return [
  1123. {type:"constant", value: tokens[1]},
  1124. {type:"string", value: tokens[2]},
  1125. {type:"support.class", value: tokens[3]},
  1126. {type:"string", value: tokens[4]}
  1127. ];
  1128. },
  1129. regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)",
  1130. rules: {
  1131. heredoc: [{
  1132. onMatch: function(value, currentState, stack) {
  1133. if (value === stack[1]) {
  1134. stack.shift();
  1135. stack.shift();
  1136. this.next = stack[0] || "start";
  1137. return "support.class";
  1138. }
  1139. this.next = "";
  1140. return "string";
  1141. },
  1142. regex: ".*$",
  1143. next: "start"
  1144. }],
  1145. indentedHeredoc: [{
  1146. token: "string",
  1147. regex: "^ +"
  1148. }, {
  1149. onMatch: function(value, currentState, stack) {
  1150. if (value === stack[1]) {
  1151. stack.shift();
  1152. stack.shift();
  1153. this.next = stack[0] || "start";
  1154. return "support.class";
  1155. }
  1156. this.next = "";
  1157. return "string";
  1158. },
  1159. regex: ".*$",
  1160. next: "start"
  1161. }]
  1162. }
  1163. }, {
  1164. regex : "$",
  1165. token : "empty",
  1166. next : function(currentState, stack) {
  1167. if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
  1168. return stack[0];
  1169. return currentState;
  1170. }
  1171. }, {
  1172. token : "string.character",
  1173. regex : "\\B\\?."
  1174. }, {
  1175. token : "keyword.operator",
  1176. regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
  1177. }, {
  1178. token : "paren.lparen",
  1179. regex : "[[({]"
  1180. }, {
  1181. token : "paren.rparen",
  1182. regex : "[\\])}]"
  1183. }, {
  1184. token : "text",
  1185. regex : "\\s+"
  1186. }
  1187. ],
  1188. "comment" : [
  1189. {
  1190. token : "comment", // closing comment
  1191. regex : "^=end(?:$|\\s.*$)",
  1192. next : "start"
  1193. }, {
  1194. token : "comment", // comment spanning whole line
  1195. regex : ".+"
  1196. }
  1197. ]
  1198. };
  1199. this.normalizeRules();
  1200. };
  1201. oop.inherits(RubyHighlightRules, TextHighlightRules);
  1202. exports.RubyHighlightRules = RubyHighlightRules;
  1203. });
  1204. ace.define("ace/mode/html_ruby_highlight_rules",[], function(require, exports, module) {
  1205. "use strict";
  1206. var oop = require("../lib/oop");
  1207. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  1208. var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
  1209. var HtmlRubyHighlightRules = function() {
  1210. HtmlHighlightRules.call(this);
  1211. var startRules = [
  1212. {
  1213. regex: "<%%|%%>",
  1214. token: "constant.language.escape"
  1215. }, {
  1216. token : "comment.start.erb",
  1217. regex : "<%#",
  1218. push : [{
  1219. token : "comment.end.erb",
  1220. regex: "%>",
  1221. next: "pop",
  1222. defaultToken:"comment"
  1223. }]
  1224. }, {
  1225. token : "support.ruby_tag",
  1226. regex : "<%+(?!>)[-=]?",
  1227. push : "ruby-start"
  1228. }
  1229. ];
  1230. var endRules = [
  1231. {
  1232. token : "support.ruby_tag",
  1233. regex : "%>",
  1234. next : "pop"
  1235. }, {
  1236. token: "comment",
  1237. regex: "#(?:[^%]|%[^>])*"
  1238. }
  1239. ];
  1240. for (var key in this.$rules)
  1241. this.$rules[key].unshift.apply(this.$rules[key], startRules);
  1242. this.embedRules(RubyHighlightRules, "ruby-", endRules, ["start"]);
  1243. this.normalizeRules();
  1244. };
  1245. oop.inherits(HtmlRubyHighlightRules, HtmlHighlightRules);
  1246. exports.HtmlRubyHighlightRules = HtmlRubyHighlightRules;
  1247. });
  1248. ace.define("ace/mode/matching_brace_outdent",[], function(require, exports, module) {
  1249. "use strict";
  1250. var Range = require("../range").Range;
  1251. var MatchingBraceOutdent = function() {};
  1252. (function() {
  1253. this.checkOutdent = function(line, input) {
  1254. if (! /^\s+$/.test(line))
  1255. return false;
  1256. return /^\s*\}/.test(input);
  1257. };
  1258. this.autoOutdent = function(doc, row) {
  1259. var line = doc.getLine(row);
  1260. var match = line.match(/^(\s*\})/);
  1261. if (!match) return 0;
  1262. var column = match[1].length;
  1263. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  1264. if (!openBracePos || openBracePos.row == row) return 0;
  1265. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  1266. doc.replace(new Range(row, 0, row, column-1), indent);
  1267. };
  1268. this.$getIndent = function(line) {
  1269. return line.match(/^\s*/)[0];
  1270. };
  1271. }).call(MatchingBraceOutdent.prototype);
  1272. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  1273. });
  1274. ace.define("ace/mode/folding/cstyle",[], function(require, exports, module) {
  1275. "use strict";
  1276. var oop = require("../../lib/oop");
  1277. var Range = require("../../range").Range;
  1278. var BaseFoldMode = require("./fold_mode").FoldMode;
  1279. var FoldMode = exports.FoldMode = function(commentRegex) {
  1280. if (commentRegex) {
  1281. this.foldingStartMarker = new RegExp(
  1282. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  1283. );
  1284. this.foldingStopMarker = new RegExp(
  1285. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  1286. );
  1287. }
  1288. };
  1289. oop.inherits(FoldMode, BaseFoldMode);
  1290. (function() {
  1291. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  1292. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  1293. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  1294. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  1295. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  1296. this._getFoldWidgetBase = this.getFoldWidget;
  1297. this.getFoldWidget = function(session, foldStyle, row) {
  1298. var line = session.getLine(row);
  1299. if (this.singleLineBlockCommentRe.test(line)) {
  1300. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  1301. return "";
  1302. }
  1303. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  1304. if (!fw && this.startRegionRe.test(line))
  1305. return "start"; // lineCommentRegionStart
  1306. return fw;
  1307. };
  1308. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  1309. var line = session.getLine(row);
  1310. if (this.startRegionRe.test(line))
  1311. return this.getCommentRegionBlock(session, line, row);
  1312. var match = line.match(this.foldingStartMarker);
  1313. if (match) {
  1314. var i = match.index;
  1315. if (match[1])
  1316. return this.openingBracketBlock(session, match[1], row, i);
  1317. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  1318. if (range && !range.isMultiLine()) {
  1319. if (forceMultiline) {
  1320. range = this.getSectionRange(session, row);
  1321. } else if (foldStyle != "all")
  1322. range = null;
  1323. }
  1324. return range;
  1325. }
  1326. if (foldStyle === "markbegin")
  1327. return;
  1328. var match = line.match(this.foldingStopMarker);
  1329. if (match) {
  1330. var i = match.index + match[0].length;
  1331. if (match[1])
  1332. return this.closingBracketBlock(session, match[1], row, i);
  1333. return session.getCommentFoldRange(row, i, -1);
  1334. }
  1335. };
  1336. this.getSectionRange = function(session, row) {
  1337. var line = session.getLine(row);
  1338. var startIndent = line.search(/\S/);
  1339. var startRow = row;
  1340. var startColumn = line.length;
  1341. row = row + 1;
  1342. var endRow = row;
  1343. var maxRow = session.getLength();
  1344. while (++row < maxRow) {
  1345. line = session.getLine(row);
  1346. var indent = line.search(/\S/);
  1347. if (indent === -1)
  1348. continue;
  1349. if (startIndent > indent)
  1350. break;
  1351. var subRange = this.getFoldWidgetRange(session, "all", row);
  1352. if (subRange) {
  1353. if (subRange.start.row <= startRow) {
  1354. break;
  1355. } else if (subRange.isMultiLine()) {
  1356. row = subRange.end.row;
  1357. } else if (startIndent == indent) {
  1358. break;
  1359. }
  1360. }
  1361. endRow = row;
  1362. }
  1363. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  1364. };
  1365. this.getCommentRegionBlock = function(session, line, row) {
  1366. var startColumn = line.search(/\s*$/);
  1367. var maxRow = session.getLength();
  1368. var startRow = row;
  1369. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  1370. var depth = 1;
  1371. while (++row < maxRow) {
  1372. line = session.getLine(row);
  1373. var m = re.exec(line);
  1374. if (!m) continue;
  1375. if (m[1]) depth--;
  1376. else depth++;
  1377. if (!depth) break;
  1378. }
  1379. var endRow = row;
  1380. if (endRow > startRow) {
  1381. return new Range(startRow, startColumn, endRow, line.length);
  1382. }
  1383. };
  1384. }).call(FoldMode.prototype);
  1385. });
  1386. ace.define("ace/mode/javascript",[], function(require, exports, module) {
  1387. "use strict";
  1388. var oop = require("../lib/oop");
  1389. var TextMode = require("./text").Mode;
  1390. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1391. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1392. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1393. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  1394. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1395. var Mode = function() {
  1396. this.HighlightRules = JavaScriptHighlightRules;
  1397. this.$outdent = new MatchingBraceOutdent();
  1398. this.$behaviour = new CstyleBehaviour();
  1399. this.foldingRules = new CStyleFoldMode();
  1400. };
  1401. oop.inherits(Mode, TextMode);
  1402. (function() {
  1403. this.lineCommentStart = "//";
  1404. this.blockComment = {start: "/*", end: "*/"};
  1405. this.$quotes = {'"': '"', "'": "'", "`": "`"};
  1406. this.getNextLineIndent = function(state, line, tab) {
  1407. var indent = this.$getIndent(line);
  1408. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  1409. var tokens = tokenizedLine.tokens;
  1410. var endState = tokenizedLine.state;
  1411. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1412. return indent;
  1413. }
  1414. if (state == "start" || state == "no_regex") {
  1415. var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
  1416. if (match) {
  1417. indent += tab;
  1418. }
  1419. } else if (state == "doc-start") {
  1420. if (endState == "start" || endState == "no_regex") {
  1421. return "";
  1422. }
  1423. var match = line.match(/^\s*(\/?)\*/);
  1424. if (match) {
  1425. if (match[1]) {
  1426. indent += " ";
  1427. }
  1428. indent += "* ";
  1429. }
  1430. }
  1431. return indent;
  1432. };
  1433. this.checkOutdent = function(state, line, input) {
  1434. return this.$outdent.checkOutdent(line, input);
  1435. };
  1436. this.autoOutdent = function(state, doc, row) {
  1437. this.$outdent.autoOutdent(doc, row);
  1438. };
  1439. this.createWorker = function(session) {
  1440. var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
  1441. worker.attachToDocument(session.getDocument());
  1442. worker.on("annotate", function(results) {
  1443. session.setAnnotations(results.data);
  1444. });
  1445. worker.on("terminate", function() {
  1446. session.clearAnnotations();
  1447. });
  1448. return worker;
  1449. };
  1450. this.$id = "ace/mode/javascript";
  1451. }).call(Mode.prototype);
  1452. exports.Mode = Mode;
  1453. });
  1454. ace.define("ace/mode/css_completions",[], function(require, exports, module) {
  1455. "use strict";
  1456. var propertyMap = {
  1457. "background": {"#$0": 1},
  1458. "background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
  1459. "background-image": {"url('/$0')": 1},
  1460. "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
  1461. "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2},
  1462. "background-attachment": {"scroll": 1, "fixed": 1},
  1463. "background-size": {"cover": 1, "contain": 1},
  1464. "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
  1465. "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
  1466. "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
  1467. "border-color": {"#$0": 1},
  1468. "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2},
  1469. "border-collapse": {"collapse": 1, "separate": 1},
  1470. "bottom": {"px": 1, "em": 1, "%": 1},
  1471. "clear": {"left": 1, "right": 1, "both": 1, "none": 1},
  1472. "color": {"#$0": 1, "rgb(#$00,0,0)": 1},
  1473. "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},
  1474. "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
  1475. "empty-cells": {"show": 1, "hide": 1},
  1476. "float": {"left": 1, "right": 1, "none": 1},
  1477. "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},
  1478. "font-size": {"px": 1, "em": 1, "%": 1},
  1479. "font-weight": {"bold": 1, "normal": 1},
  1480. "font-style": {"italic": 1, "normal": 1},
  1481. "font-variant": {"normal": 1, "small-caps": 1},
  1482. "height": {"px": 1, "em": 1, "%": 1},
  1483. "left": {"px": 1, "em": 1, "%": 1},
  1484. "letter-spacing": {"normal": 1},
  1485. "line-height": {"normal": 1},
  1486. "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},
  1487. "margin": {"px": 1, "em": 1, "%": 1},
  1488. "margin-right": {"px": 1, "em": 1, "%": 1},
  1489. "margin-left": {"px": 1, "em": 1, "%": 1},
  1490. "margin-top": {"px": 1, "em": 1, "%": 1},
  1491. "margin-bottom": {"px": 1, "em": 1, "%": 1},
  1492. "max-height": {"px": 1, "em": 1, "%": 1},
  1493. "max-width": {"px": 1, "em": 1, "%": 1},
  1494. "min-height": {"px": 1, "em": 1, "%": 1},
  1495. "min-width": {"px": 1, "em": 1, "%": 1},
  1496. "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1497. "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1498. "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1499. "padding": {"px": 1, "em": 1, "%": 1},
  1500. "padding-top": {"px": 1, "em": 1, "%": 1},
  1501. "padding-right": {"px": 1, "em": 1, "%": 1},
  1502. "padding-bottom": {"px": 1, "em": 1, "%": 1},
  1503. "padding-left": {"px": 1, "em": 1, "%": 1},
  1504. "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  1505. "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  1506. "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
  1507. "right": {"px": 1, "em": 1, "%": 1},
  1508. "table-layout": {"fixed": 1, "auto": 1},
  1509. "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
  1510. "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
  1511. "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
  1512. "top": {"px": 1, "em": 1, "%": 1},
  1513. "vertical-align": {"top": 1, "bottom": 1},
  1514. "visibility": {"hidden": 1, "visible": 1},
  1515. "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
  1516. "width": {"px": 1, "em": 1, "%": 1},
  1517. "word-spacing": {"normal": 1},
  1518. "filter": {"alpha(opacity=$0100)": 1},
  1519. "text-shadow": {"$02px 2px 2px #777": 1},
  1520. "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
  1521. "-moz-border-radius": 1,
  1522. "-moz-border-radius-topright": 1,
  1523. "-moz-border-radius-bottomright": 1,
  1524. "-moz-border-radius-topleft": 1,
  1525. "-moz-border-radius-bottomleft": 1,
  1526. "-webkit-border-radius": 1,
  1527. "-webkit-border-top-right-radius": 1,
  1528. "-webkit-border-top-left-radius": 1,
  1529. "-webkit-border-bottom-right-radius": 1,
  1530. "-webkit-border-bottom-left-radius": 1,
  1531. "-moz-box-shadow": 1,
  1532. "-webkit-box-shadow": 1,
  1533. "transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  1534. "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  1535. "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
  1536. };
  1537. var CssCompletions = function() {
  1538. };
  1539. (function() {
  1540. this.completionsDefined = false;
  1541. this.defineCompletions = function() {
  1542. if (document) {
  1543. var style = document.createElement('c').style;
  1544. for (var i in style) {
  1545. if (typeof style[i] !== 'string')
  1546. continue;
  1547. var name = i.replace(/[A-Z]/g, function(x) {
  1548. return '-' + x.toLowerCase();
  1549. });
  1550. if (!propertyMap.hasOwnProperty(name))
  1551. propertyMap[name] = 1;
  1552. }
  1553. }
  1554. this.completionsDefined = true;
  1555. };
  1556. this.getCompletions = function(state, session, pos, prefix) {
  1557. if (!this.completionsDefined) {
  1558. this.defineCompletions();
  1559. }
  1560. var token = session.getTokenAt(pos.row, pos.column);
  1561. if (!token)
  1562. return [];
  1563. if (state==='ruleset'){
  1564. var line = session.getLine(pos.row).substr(0, pos.column);
  1565. if (/:[^;]+$/.test(line)) {
  1566. /([\w\-]+):[^:]*$/.test(line);
  1567. return this.getPropertyValueCompletions(state, session, pos, prefix);
  1568. } else {
  1569. return this.getPropertyCompletions(state, session, pos, prefix);
  1570. }
  1571. }
  1572. return [];
  1573. };
  1574. this.getPropertyCompletions = function(state, session, pos, prefix) {
  1575. var properties = Object.keys(propertyMap);
  1576. return properties.map(function(property){
  1577. return {
  1578. caption: property,
  1579. snippet: property + ': $0;',
  1580. meta: "property",
  1581. score: Number.MAX_VALUE
  1582. };
  1583. });
  1584. };
  1585. this.getPropertyValueCompletions = function(state, session, pos, prefix) {
  1586. var line = session.getLine(pos.row).substr(0, pos.column);
  1587. var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
  1588. if (!property)
  1589. return [];
  1590. var values = [];
  1591. if (property in propertyMap && typeof propertyMap[property] === "object") {
  1592. values = Object.keys(propertyMap[property]);
  1593. }
  1594. return values.map(function(value){
  1595. return {
  1596. caption: value,
  1597. snippet: value,
  1598. meta: "property value",
  1599. score: Number.MAX_VALUE
  1600. };
  1601. });
  1602. };
  1603. }).call(CssCompletions.prototype);
  1604. exports.CssCompletions = CssCompletions;
  1605. });
  1606. ace.define("ace/mode/behaviour/css",[], function(require, exports, module) {
  1607. "use strict";
  1608. var oop = require("../../lib/oop");
  1609. var Behaviour = require("../behaviour").Behaviour;
  1610. var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
  1611. var TokenIterator = require("../../token_iterator").TokenIterator;
  1612. var CssBehaviour = function () {
  1613. this.inherit(CstyleBehaviour);
  1614. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1615. if (text === ':' && editor.selection.isEmpty()) {
  1616. var cursor = editor.getCursorPosition();
  1617. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1618. var token = iterator.getCurrentToken();
  1619. if (token && token.value.match(/\s+/)) {
  1620. token = iterator.stepBackward();
  1621. }
  1622. if (token && token.type === 'support.type') {
  1623. var line = session.doc.getLine(cursor.row);
  1624. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1625. if (rightChar === ':') {
  1626. return {
  1627. text: '',
  1628. selection: [1, 1]
  1629. };
  1630. }
  1631. if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
  1632. return {
  1633. text: ':;',
  1634. selection: [1, 1]
  1635. };
  1636. }
  1637. }
  1638. }
  1639. });
  1640. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1641. var selected = session.doc.getTextRange(range);
  1642. if (!range.isMultiLine() && selected === ':') {
  1643. var cursor = editor.getCursorPosition();
  1644. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1645. var token = iterator.getCurrentToken();
  1646. if (token && token.value.match(/\s+/)) {
  1647. token = iterator.stepBackward();
  1648. }
  1649. if (token && token.type === 'support.type') {
  1650. var line = session.doc.getLine(range.start.row);
  1651. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1652. if (rightChar === ';') {
  1653. range.end.column ++;
  1654. return range;
  1655. }
  1656. }
  1657. }
  1658. });
  1659. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1660. if (text === ';' && editor.selection.isEmpty()) {
  1661. var cursor = editor.getCursorPosition();
  1662. var line = session.doc.getLine(cursor.row);
  1663. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1664. if (rightChar === ';') {
  1665. return {
  1666. text: '',
  1667. selection: [1, 1]
  1668. };
  1669. }
  1670. }
  1671. });
  1672. this.add("!important", "insertion", function (state, action, editor, session, text) {
  1673. if (text === '!' && editor.selection.isEmpty()) {
  1674. var cursor = editor.getCursorPosition();
  1675. var line = session.doc.getLine(cursor.row);
  1676. if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
  1677. return {
  1678. text: '!important',
  1679. selection: [10, 10]
  1680. };
  1681. }
  1682. }
  1683. });
  1684. };
  1685. oop.inherits(CssBehaviour, CstyleBehaviour);
  1686. exports.CssBehaviour = CssBehaviour;
  1687. });
  1688. ace.define("ace/mode/css",[], function(require, exports, module) {
  1689. "use strict";
  1690. var oop = require("../lib/oop");
  1691. var TextMode = require("./text").Mode;
  1692. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1693. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1694. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1695. var CssCompletions = require("./css_completions").CssCompletions;
  1696. var CssBehaviour = require("./behaviour/css").CssBehaviour;
  1697. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1698. var Mode = function() {
  1699. this.HighlightRules = CssHighlightRules;
  1700. this.$outdent = new MatchingBraceOutdent();
  1701. this.$behaviour = new CssBehaviour();
  1702. this.$completer = new CssCompletions();
  1703. this.foldingRules = new CStyleFoldMode();
  1704. };
  1705. oop.inherits(Mode, TextMode);
  1706. (function() {
  1707. this.foldingRules = "cStyle";
  1708. this.blockComment = {start: "/*", end: "*/"};
  1709. this.getNextLineIndent = function(state, line, tab) {
  1710. var indent = this.$getIndent(line);
  1711. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1712. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1713. return indent;
  1714. }
  1715. var match = line.match(/^.*\{\s*$/);
  1716. if (match) {
  1717. indent += tab;
  1718. }
  1719. return indent;
  1720. };
  1721. this.checkOutdent = function(state, line, input) {
  1722. return this.$outdent.checkOutdent(line, input);
  1723. };
  1724. this.autoOutdent = function(state, doc, row) {
  1725. this.$outdent.autoOutdent(doc, row);
  1726. };
  1727. this.getCompletions = function(state, session, pos, prefix) {
  1728. return this.$completer.getCompletions(state, session, pos, prefix);
  1729. };
  1730. this.createWorker = function(session) {
  1731. var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
  1732. worker.attachToDocument(session.getDocument());
  1733. worker.on("annotate", function(e) {
  1734. session.setAnnotations(e.data);
  1735. });
  1736. worker.on("terminate", function() {
  1737. session.clearAnnotations();
  1738. });
  1739. return worker;
  1740. };
  1741. this.$id = "ace/mode/css";
  1742. }).call(Mode.prototype);
  1743. exports.Mode = Mode;
  1744. });
  1745. ace.define("ace/mode/behaviour/xml",[], function(require, exports, module) {
  1746. "use strict";
  1747. var oop = require("../../lib/oop");
  1748. var Behaviour = require("../behaviour").Behaviour;
  1749. var TokenIterator = require("../../token_iterator").TokenIterator;
  1750. var lang = require("../../lib/lang");
  1751. function is(token, type) {
  1752. return token && token.type.lastIndexOf(type + ".xml") > -1;
  1753. }
  1754. var XmlBehaviour = function () {
  1755. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  1756. if (text == '"' || text == "'") {
  1757. var quote = text;
  1758. var selected = session.doc.getTextRange(editor.getSelectionRange());
  1759. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  1760. return {
  1761. text: quote + selected + quote,
  1762. selection: false
  1763. };
  1764. }
  1765. var cursor = editor.getCursorPosition();
  1766. var line = session.doc.getLine(cursor.row);
  1767. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1768. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1769. var token = iterator.getCurrentToken();
  1770. if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
  1771. return {
  1772. text: "",
  1773. selection: [1, 1]
  1774. };
  1775. }
  1776. if (!token)
  1777. token = iterator.stepBackward();
  1778. if (!token)
  1779. return;
  1780. while (is(token, "tag-whitespace") || is(token, "whitespace")) {
  1781. token = iterator.stepBackward();
  1782. }
  1783. var rightSpace = !rightChar || rightChar.match(/\s/);
  1784. if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
  1785. return {
  1786. text: quote + quote,
  1787. selection: [1, 1]
  1788. };
  1789. }
  1790. }
  1791. });
  1792. this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
  1793. var selected = session.doc.getTextRange(range);
  1794. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  1795. var line = session.doc.getLine(range.start.row);
  1796. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  1797. if (rightChar == selected) {
  1798. range.end.column++;
  1799. return range;
  1800. }
  1801. }
  1802. });
  1803. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  1804. if (text == '>') {
  1805. var position = editor.getSelectionRange().start;
  1806. var iterator = new TokenIterator(session, position.row, position.column);
  1807. var token = iterator.getCurrentToken() || iterator.stepBackward();
  1808. if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
  1809. return;
  1810. if (is(token, "reference.attribute-value"))
  1811. return;
  1812. if (is(token, "attribute-value")) {
  1813. var tokenEndColumn = iterator.getCurrentTokenColumn() + token.value.length;
  1814. if (position.column < tokenEndColumn)
  1815. return;
  1816. if (position.column == tokenEndColumn) {
  1817. var nextToken = iterator.stepForward();
  1818. if (nextToken && is(nextToken, "attribute-value"))
  1819. return;
  1820. iterator.stepBackward();
  1821. }
  1822. }
  1823. if (/^\s*>/.test(session.getLine(position.row).slice(position.column)))
  1824. return;
  1825. while (!is(token, "tag-name")) {
  1826. token = iterator.stepBackward();
  1827. if (token.value == "<") {
  1828. token = iterator.stepForward();
  1829. break;
  1830. }
  1831. }
  1832. var tokenRow = iterator.getCurrentTokenRow();
  1833. var tokenColumn = iterator.getCurrentTokenColumn();
  1834. if (is(iterator.stepBackward(), "end-tag-open"))
  1835. return;
  1836. var element = token.value;
  1837. if (tokenRow == position.row)
  1838. element = element.substring(0, position.column - tokenColumn);
  1839. if (this.voidElements.hasOwnProperty(element.toLowerCase()))
  1840. return;
  1841. return {
  1842. text: ">" + "</" + element + ">",
  1843. selection: [1, 1]
  1844. };
  1845. }
  1846. });
  1847. this.add("autoindent", "insertion", function (state, action, editor, session, text) {
  1848. if (text == "\n") {
  1849. var cursor = editor.getCursorPosition();
  1850. var line = session.getLine(cursor.row);
  1851. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1852. var token = iterator.getCurrentToken();
  1853. if (token && token.type.indexOf("tag-close") !== -1) {
  1854. if (token.value == "/>")
  1855. return;
  1856. while (token && token.type.indexOf("tag-name") === -1) {
  1857. token = iterator.stepBackward();
  1858. }
  1859. if (!token) {
  1860. return;
  1861. }
  1862. var tag = token.value;
  1863. var row = iterator.getCurrentTokenRow();
  1864. token = iterator.stepBackward();
  1865. if (!token || token.type.indexOf("end-tag") !== -1) {
  1866. return;
  1867. }
  1868. if (this.voidElements && !this.voidElements[tag]) {
  1869. var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
  1870. var line = session.getLine(row);
  1871. var nextIndent = this.$getIndent(line);
  1872. var indent = nextIndent + session.getTabString();
  1873. if (nextToken && nextToken.value === "</") {
  1874. return {
  1875. text: "\n" + indent + "\n" + nextIndent,
  1876. selection: [1, indent.length, 1, indent.length]
  1877. };
  1878. } else {
  1879. return {
  1880. text: "\n" + indent
  1881. };
  1882. }
  1883. }
  1884. }
  1885. }
  1886. });
  1887. };
  1888. oop.inherits(XmlBehaviour, Behaviour);
  1889. exports.XmlBehaviour = XmlBehaviour;
  1890. });
  1891. ace.define("ace/mode/folding/mixed",[], function(require, exports, module) {
  1892. "use strict";
  1893. var oop = require("../../lib/oop");
  1894. var BaseFoldMode = require("./fold_mode").FoldMode;
  1895. var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
  1896. this.defaultMode = defaultMode;
  1897. this.subModes = subModes;
  1898. };
  1899. oop.inherits(FoldMode, BaseFoldMode);
  1900. (function() {
  1901. this.$getMode = function(state) {
  1902. if (typeof state != "string")
  1903. state = state[0];
  1904. for (var key in this.subModes) {
  1905. if (state.indexOf(key) === 0)
  1906. return this.subModes[key];
  1907. }
  1908. return null;
  1909. };
  1910. this.$tryMode = function(state, session, foldStyle, row) {
  1911. var mode = this.$getMode(state);
  1912. return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
  1913. };
  1914. this.getFoldWidget = function(session, foldStyle, row) {
  1915. return (
  1916. this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
  1917. this.$tryMode(session.getState(row), session, foldStyle, row) ||
  1918. this.defaultMode.getFoldWidget(session, foldStyle, row)
  1919. );
  1920. };
  1921. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1922. var mode = this.$getMode(session.getState(row-1));
  1923. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1924. mode = this.$getMode(session.getState(row));
  1925. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1926. mode = this.defaultMode;
  1927. return mode.getFoldWidgetRange(session, foldStyle, row);
  1928. };
  1929. }).call(FoldMode.prototype);
  1930. });
  1931. ace.define("ace/mode/folding/xml",[], function(require, exports, module) {
  1932. "use strict";
  1933. var oop = require("../../lib/oop");
  1934. var lang = require("../../lib/lang");
  1935. var Range = require("../../range").Range;
  1936. var BaseFoldMode = require("./fold_mode").FoldMode;
  1937. var TokenIterator = require("../../token_iterator").TokenIterator;
  1938. var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
  1939. BaseFoldMode.call(this);
  1940. this.voidElements = voidElements || {};
  1941. this.optionalEndTags = oop.mixin({}, this.voidElements);
  1942. if (optionalEndTags)
  1943. oop.mixin(this.optionalEndTags, optionalEndTags);
  1944. };
  1945. oop.inherits(FoldMode, BaseFoldMode);
  1946. var Tag = function() {
  1947. this.tagName = "";
  1948. this.closing = false;
  1949. this.selfClosing = false;
  1950. this.start = {row: 0, column: 0};
  1951. this.end = {row: 0, column: 0};
  1952. };
  1953. function is(token, type) {
  1954. return token.type.lastIndexOf(type + ".xml") > -1;
  1955. }
  1956. (function() {
  1957. this.getFoldWidget = function(session, foldStyle, row) {
  1958. var tag = this._getFirstTagInLine(session, row);
  1959. if (!tag)
  1960. return this.getCommentFoldWidget(session, row);
  1961. if (tag.closing || (!tag.tagName && tag.selfClosing))
  1962. return foldStyle == "markbeginend" ? "end" : "";
  1963. if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
  1964. return "";
  1965. if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
  1966. return "";
  1967. return "start";
  1968. };
  1969. this.getCommentFoldWidget = function(session, row) {
  1970. if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
  1971. return "start";
  1972. return "";
  1973. };
  1974. this._getFirstTagInLine = function(session, row) {
  1975. var tokens = session.getTokens(row);
  1976. var tag = new Tag();
  1977. for (var i = 0; i < tokens.length; i++) {
  1978. var token = tokens[i];
  1979. if (is(token, "tag-open")) {
  1980. tag.end.column = tag.start.column + token.value.length;
  1981. tag.closing = is(token, "end-tag-open");
  1982. token = tokens[++i];
  1983. if (!token)
  1984. return null;
  1985. tag.tagName = token.value;
  1986. tag.end.column += token.value.length;
  1987. for (i++; i < tokens.length; i++) {
  1988. token = tokens[i];
  1989. tag.end.column += token.value.length;
  1990. if (is(token, "tag-close")) {
  1991. tag.selfClosing = token.value == '/>';
  1992. break;
  1993. }
  1994. }
  1995. return tag;
  1996. } else if (is(token, "tag-close")) {
  1997. tag.selfClosing = token.value == '/>';
  1998. return tag;
  1999. }
  2000. tag.start.column += token.value.length;
  2001. }
  2002. return null;
  2003. };
  2004. this._findEndTagInLine = function(session, row, tagName, startColumn) {
  2005. var tokens = session.getTokens(row);
  2006. var column = 0;
  2007. for (var i = 0; i < tokens.length; i++) {
  2008. var token = tokens[i];
  2009. column += token.value.length;
  2010. if (column < startColumn)
  2011. continue;
  2012. if (is(token, "end-tag-open")) {
  2013. token = tokens[i + 1];
  2014. if (token && token.value == tagName)
  2015. return true;
  2016. }
  2017. }
  2018. return false;
  2019. };
  2020. this._readTagForward = function(iterator) {
  2021. var token = iterator.getCurrentToken();
  2022. if (!token)
  2023. return null;
  2024. var tag = new Tag();
  2025. do {
  2026. if (is(token, "tag-open")) {
  2027. tag.closing = is(token, "end-tag-open");
  2028. tag.start.row = iterator.getCurrentTokenRow();
  2029. tag.start.column = iterator.getCurrentTokenColumn();
  2030. } else if (is(token, "tag-name")) {
  2031. tag.tagName = token.value;
  2032. } else if (is(token, "tag-close")) {
  2033. tag.selfClosing = token.value == "/>";
  2034. tag.end.row = iterator.getCurrentTokenRow();
  2035. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  2036. iterator.stepForward();
  2037. return tag;
  2038. }
  2039. } while(token = iterator.stepForward());
  2040. return null;
  2041. };
  2042. this._readTagBackward = function(iterator) {
  2043. var token = iterator.getCurrentToken();
  2044. if (!token)
  2045. return null;
  2046. var tag = new Tag();
  2047. do {
  2048. if (is(token, "tag-open")) {
  2049. tag.closing = is(token, "end-tag-open");
  2050. tag.start.row = iterator.getCurrentTokenRow();
  2051. tag.start.column = iterator.getCurrentTokenColumn();
  2052. iterator.stepBackward();
  2053. return tag;
  2054. } else if (is(token, "tag-name")) {
  2055. tag.tagName = token.value;
  2056. } else if (is(token, "tag-close")) {
  2057. tag.selfClosing = token.value == "/>";
  2058. tag.end.row = iterator.getCurrentTokenRow();
  2059. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  2060. }
  2061. } while(token = iterator.stepBackward());
  2062. return null;
  2063. };
  2064. this._pop = function(stack, tag) {
  2065. while (stack.length) {
  2066. var top = stack[stack.length-1];
  2067. if (!tag || top.tagName == tag.tagName) {
  2068. return stack.pop();
  2069. }
  2070. else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
  2071. stack.pop();
  2072. continue;
  2073. } else {
  2074. return null;
  2075. }
  2076. }
  2077. };
  2078. this.getFoldWidgetRange = function(session, foldStyle, row) {
  2079. var firstTag = this._getFirstTagInLine(session, row);
  2080. if (!firstTag) {
  2081. return this.getCommentFoldWidget(session, row)
  2082. && session.getCommentFoldRange(row, session.getLine(row).length);
  2083. }
  2084. var isBackward = firstTag.closing || firstTag.selfClosing;
  2085. var stack = [];
  2086. var tag;
  2087. if (!isBackward) {
  2088. var iterator = new TokenIterator(session, row, firstTag.start.column);
  2089. var start = {
  2090. row: row,
  2091. column: firstTag.start.column + firstTag.tagName.length + 2
  2092. };
  2093. if (firstTag.start.row == firstTag.end.row)
  2094. start.column = firstTag.end.column;
  2095. while (tag = this._readTagForward(iterator)) {
  2096. if (tag.selfClosing) {
  2097. if (!stack.length) {
  2098. tag.start.column += tag.tagName.length + 2;
  2099. tag.end.column -= 2;
  2100. return Range.fromPoints(tag.start, tag.end);
  2101. } else
  2102. continue;
  2103. }
  2104. if (tag.closing) {
  2105. this._pop(stack, tag);
  2106. if (stack.length == 0)
  2107. return Range.fromPoints(start, tag.start);
  2108. }
  2109. else {
  2110. stack.push(tag);
  2111. }
  2112. }
  2113. }
  2114. else {
  2115. var iterator = new TokenIterator(session, row, firstTag.end.column);
  2116. var end = {
  2117. row: row,
  2118. column: firstTag.start.column
  2119. };
  2120. while (tag = this._readTagBackward(iterator)) {
  2121. if (tag.selfClosing) {
  2122. if (!stack.length) {
  2123. tag.start.column += tag.tagName.length + 2;
  2124. tag.end.column -= 2;
  2125. return Range.fromPoints(tag.start, tag.end);
  2126. } else
  2127. continue;
  2128. }
  2129. if (!tag.closing) {
  2130. this._pop(stack, tag);
  2131. if (stack.length == 0) {
  2132. tag.start.column += tag.tagName.length + 2;
  2133. if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
  2134. tag.start.column = tag.end.column;
  2135. return Range.fromPoints(tag.start, end);
  2136. }
  2137. }
  2138. else {
  2139. stack.push(tag);
  2140. }
  2141. }
  2142. }
  2143. };
  2144. }).call(FoldMode.prototype);
  2145. });
  2146. ace.define("ace/mode/folding/html",[], function(require, exports, module) {
  2147. "use strict";
  2148. var oop = require("../../lib/oop");
  2149. var MixedFoldMode = require("./mixed").FoldMode;
  2150. var XmlFoldMode = require("./xml").FoldMode;
  2151. var CStyleFoldMode = require("./cstyle").FoldMode;
  2152. var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
  2153. MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
  2154. "js-": new CStyleFoldMode(),
  2155. "css-": new CStyleFoldMode()
  2156. });
  2157. };
  2158. oop.inherits(FoldMode, MixedFoldMode);
  2159. });
  2160. ace.define("ace/mode/html_completions",[], function(require, exports, module) {
  2161. "use strict";
  2162. var TokenIterator = require("../token_iterator").TokenIterator;
  2163. var commonAttributes = [
  2164. "accesskey",
  2165. "class",
  2166. "contenteditable",
  2167. "contextmenu",
  2168. "dir",
  2169. "draggable",
  2170. "dropzone",
  2171. "hidden",
  2172. "id",
  2173. "inert",
  2174. "itemid",
  2175. "itemprop",
  2176. "itemref",
  2177. "itemscope",
  2178. "itemtype",
  2179. "lang",
  2180. "spellcheck",
  2181. "style",
  2182. "tabindex",
  2183. "title",
  2184. "translate"
  2185. ];
  2186. var eventAttributes = [
  2187. "onabort",
  2188. "onblur",
  2189. "oncancel",
  2190. "oncanplay",
  2191. "oncanplaythrough",
  2192. "onchange",
  2193. "onclick",
  2194. "onclose",
  2195. "oncontextmenu",
  2196. "oncuechange",
  2197. "ondblclick",
  2198. "ondrag",
  2199. "ondragend",
  2200. "ondragenter",
  2201. "ondragleave",
  2202. "ondragover",
  2203. "ondragstart",
  2204. "ondrop",
  2205. "ondurationchange",
  2206. "onemptied",
  2207. "onended",
  2208. "onerror",
  2209. "onfocus",
  2210. "oninput",
  2211. "oninvalid",
  2212. "onkeydown",
  2213. "onkeypress",
  2214. "onkeyup",
  2215. "onload",
  2216. "onloadeddata",
  2217. "onloadedmetadata",
  2218. "onloadstart",
  2219. "onmousedown",
  2220. "onmousemove",
  2221. "onmouseout",
  2222. "onmouseover",
  2223. "onmouseup",
  2224. "onmousewheel",
  2225. "onpause",
  2226. "onplay",
  2227. "onplaying",
  2228. "onprogress",
  2229. "onratechange",
  2230. "onreset",
  2231. "onscroll",
  2232. "onseeked",
  2233. "onseeking",
  2234. "onselect",
  2235. "onshow",
  2236. "onstalled",
  2237. "onsubmit",
  2238. "onsuspend",
  2239. "ontimeupdate",
  2240. "onvolumechange",
  2241. "onwaiting"
  2242. ];
  2243. var globalAttributes = commonAttributes.concat(eventAttributes);
  2244. var attributeMap = {
  2245. "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},
  2246. "abbr": {},
  2247. "address": {},
  2248. "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1},
  2249. "article": {"pubdate": 1},
  2250. "aside": {},
  2251. "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }},
  2252. "b": {},
  2253. "base": {"href": 1, "target": 1},
  2254. "bdi": {},
  2255. "bdo": {},
  2256. "blockquote": {"cite": 1},
  2257. "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},
  2258. "br": {},
  2259. "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}},
  2260. "canvas": {"width": 1, "height": 1},
  2261. "caption": {},
  2262. "cite": {},
  2263. "code": {},
  2264. "col": {"span": 1},
  2265. "colgroup": {"span": 1},
  2266. "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1},
  2267. "data": {},
  2268. "datalist": {},
  2269. "dd": {},
  2270. "del": {"cite": 1, "datetime": 1},
  2271. "details": {"open": 1},
  2272. "dfn": {},
  2273. "dialog": {"open": 1},
  2274. "div": {},
  2275. "dl": {},
  2276. "dt": {},
  2277. "em": {},
  2278. "embed": {"src": 1, "height": 1, "width": 1, "type": 1},
  2279. "fieldset": {"disabled": 1, "form": 1, "name": 1},
  2280. "figcaption": {},
  2281. "figure": {},
  2282. "footer": {},
  2283. "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}},
  2284. "h1": {},
  2285. "h2": {},
  2286. "h3": {},
  2287. "h4": {},
  2288. "h5": {},
  2289. "h6": {},
  2290. "head": {},
  2291. "header": {},
  2292. "hr": {},
  2293. "html": {"manifest": 1},
  2294. "i": {},
  2295. "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}},
  2296. "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1},
  2297. "input": {
  2298. "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},
  2299. "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},
  2300. "ins": {"cite": 1, "datetime": 1},
  2301. "kbd": {},
  2302. "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1},
  2303. "label": {"form": 1, "for": 1},
  2304. "legend": {},
  2305. "li": {"value": 1},
  2306. "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},
  2307. "main": {},
  2308. "map": {"name": 1},
  2309. "mark": {},
  2310. "math": {},
  2311. "menu": {"type": 1, "label": 1},
  2312. "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1},
  2313. "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1},
  2314. "nav": {},
  2315. "noscript": {"href": 1},
  2316. "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1},
  2317. "ol": {"start": 1, "reversed": 1},
  2318. "optgroup": {"disabled": 1, "label": 1},
  2319. "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1},
  2320. "output": {"for": 1, "form": 1, "name": 1},
  2321. "p": {},
  2322. "param": {"name": 1, "value": 1},
  2323. "pre": {},
  2324. "progress": {"value": 1, "max": 1},
  2325. "q": {"cite": 1},
  2326. "rp": {},
  2327. "rt": {},
  2328. "ruby": {},
  2329. "s": {},
  2330. "samp": {},
  2331. "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1},
  2332. "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}},
  2333. "small": {},
  2334. "source": {"src": 1, "type": 1, "media": 1},
  2335. "span": {},
  2336. "strong": {},
  2337. "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1},
  2338. "sub": {},
  2339. "sup": {},
  2340. "svg": {},
  2341. "table": {"summary": 1},
  2342. "tbody": {},
  2343. "td": {"headers": 1, "rowspan": 1, "colspan": 1},
  2344. "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}},
  2345. "tfoot": {},
  2346. "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1},
  2347. "thead": {},
  2348. "time": {"datetime": 1},
  2349. "title": {},
  2350. "tr": {},
  2351. "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1},
  2352. "section": {},
  2353. "summary": {},
  2354. "u": {},
  2355. "ul": {},
  2356. "var": {},
  2357. "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}},
  2358. "wbr": {}
  2359. };
  2360. var elements = Object.keys(attributeMap);
  2361. function is(token, type) {
  2362. return token.type.lastIndexOf(type + ".xml") > -1;
  2363. }
  2364. function findTagName(session, pos) {
  2365. var iterator = new TokenIterator(session, pos.row, pos.column);
  2366. var token = iterator.getCurrentToken();
  2367. while (token && !is(token, "tag-name")){
  2368. token = iterator.stepBackward();
  2369. }
  2370. if (token)
  2371. return token.value;
  2372. }
  2373. function findAttributeName(session, pos) {
  2374. var iterator = new TokenIterator(session, pos.row, pos.column);
  2375. var token = iterator.getCurrentToken();
  2376. while (token && !is(token, "attribute-name")){
  2377. token = iterator.stepBackward();
  2378. }
  2379. if (token)
  2380. return token.value;
  2381. }
  2382. var HtmlCompletions = function() {
  2383. };
  2384. (function() {
  2385. this.getCompletions = function(state, session, pos, prefix) {
  2386. var token = session.getTokenAt(pos.row, pos.column);
  2387. if (!token)
  2388. return [];
  2389. if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
  2390. return this.getTagCompletions(state, session, pos, prefix);
  2391. if (is(token, "tag-whitespace") || is(token, "attribute-name"))
  2392. return this.getAttributeCompletions(state, session, pos, prefix);
  2393. if (is(token, "attribute-value"))
  2394. return this.getAttributeValueCompletions(state, session, pos, prefix);
  2395. var line = session.getLine(pos.row).substr(0, pos.column);
  2396. if (/&[a-z]*$/i.test(line))
  2397. return this.getHTMLEntityCompletions(state, session, pos, prefix);
  2398. return [];
  2399. };
  2400. this.getTagCompletions = function(state, session, pos, prefix) {
  2401. return elements.map(function(element){
  2402. return {
  2403. value: element,
  2404. meta: "tag",
  2405. score: Number.MAX_VALUE
  2406. };
  2407. });
  2408. };
  2409. this.getAttributeCompletions = function(state, session, pos, prefix) {
  2410. var tagName = findTagName(session, pos);
  2411. if (!tagName)
  2412. return [];
  2413. var attributes = globalAttributes;
  2414. if (tagName in attributeMap) {
  2415. attributes = attributes.concat(Object.keys(attributeMap[tagName]));
  2416. }
  2417. return attributes.map(function(attribute){
  2418. return {
  2419. caption: attribute,
  2420. snippet: attribute + '="$0"',
  2421. meta: "attribute",
  2422. score: Number.MAX_VALUE
  2423. };
  2424. });
  2425. };
  2426. this.getAttributeValueCompletions = function(state, session, pos, prefix) {
  2427. var tagName = findTagName(session, pos);
  2428. var attributeName = findAttributeName(session, pos);
  2429. if (!tagName)
  2430. return [];
  2431. var values = [];
  2432. if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
  2433. values = Object.keys(attributeMap[tagName][attributeName]);
  2434. }
  2435. return values.map(function(value){
  2436. return {
  2437. caption: value,
  2438. snippet: value,
  2439. meta: "attribute value",
  2440. score: Number.MAX_VALUE
  2441. };
  2442. });
  2443. };
  2444. this.getHTMLEntityCompletions = function(state, session, pos, prefix) {
  2445. 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;'];
  2446. return values.map(function(value){
  2447. return {
  2448. caption: value,
  2449. snippet: value,
  2450. meta: "html entity",
  2451. score: Number.MAX_VALUE
  2452. };
  2453. });
  2454. };
  2455. }).call(HtmlCompletions.prototype);
  2456. exports.HtmlCompletions = HtmlCompletions;
  2457. });
  2458. ace.define("ace/mode/html",[], function(require, exports, module) {
  2459. "use strict";
  2460. var oop = require("../lib/oop");
  2461. var lang = require("../lib/lang");
  2462. var TextMode = require("./text").Mode;
  2463. var JavaScriptMode = require("./javascript").Mode;
  2464. var CssMode = require("./css").Mode;
  2465. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2466. var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
  2467. var HtmlFoldMode = require("./folding/html").FoldMode;
  2468. var HtmlCompletions = require("./html_completions").HtmlCompletions;
  2469. var WorkerClient = require("../worker/worker_client").WorkerClient;
  2470. var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
  2471. var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
  2472. var Mode = function(options) {
  2473. this.fragmentContext = options && options.fragmentContext;
  2474. this.HighlightRules = HtmlHighlightRules;
  2475. this.$behaviour = new XmlBehaviour();
  2476. this.$completer = new HtmlCompletions();
  2477. this.createModeDelegates({
  2478. "js-": JavaScriptMode,
  2479. "css-": CssMode
  2480. });
  2481. this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
  2482. };
  2483. oop.inherits(Mode, TextMode);
  2484. (function() {
  2485. this.blockComment = {start: "<!--", end: "-->"};
  2486. this.voidElements = lang.arrayToMap(voidElements);
  2487. this.getNextLineIndent = function(state, line, tab) {
  2488. return this.$getIndent(line);
  2489. };
  2490. this.checkOutdent = function(state, line, input) {
  2491. return false;
  2492. };
  2493. this.getCompletions = function(state, session, pos, prefix) {
  2494. return this.$completer.getCompletions(state, session, pos, prefix);
  2495. };
  2496. this.createWorker = function(session) {
  2497. if (this.constructor != Mode)
  2498. return;
  2499. var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
  2500. worker.attachToDocument(session.getDocument());
  2501. if (this.fragmentContext)
  2502. worker.call("setOptions", [{context: this.fragmentContext}]);
  2503. worker.on("error", function(e) {
  2504. session.setAnnotations(e.data);
  2505. });
  2506. worker.on("terminate", function() {
  2507. session.clearAnnotations();
  2508. });
  2509. return worker;
  2510. };
  2511. this.$id = "ace/mode/html";
  2512. }).call(Mode.prototype);
  2513. exports.Mode = Mode;
  2514. });
  2515. ace.define("ace/mode/folding/coffee",[], function(require, exports, module) {
  2516. "use strict";
  2517. var oop = require("../../lib/oop");
  2518. var BaseFoldMode = require("./fold_mode").FoldMode;
  2519. var Range = require("../../range").Range;
  2520. var FoldMode = exports.FoldMode = function() {};
  2521. oop.inherits(FoldMode, BaseFoldMode);
  2522. (function() {
  2523. this.getFoldWidgetRange = function(session, foldStyle, row) {
  2524. var range = this.indentationBlock(session, row);
  2525. if (range)
  2526. return range;
  2527. var re = /\S/;
  2528. var line = session.getLine(row);
  2529. var startLevel = line.search(re);
  2530. if (startLevel == -1 || line[startLevel] != "#")
  2531. return;
  2532. var startColumn = line.length;
  2533. var maxRow = session.getLength();
  2534. var startRow = row;
  2535. var endRow = row;
  2536. while (++row < maxRow) {
  2537. line = session.getLine(row);
  2538. var level = line.search(re);
  2539. if (level == -1)
  2540. continue;
  2541. if (line[level] != "#")
  2542. break;
  2543. endRow = row;
  2544. }
  2545. if (endRow > startRow) {
  2546. var endColumn = session.getLine(endRow).length;
  2547. return new Range(startRow, startColumn, endRow, endColumn);
  2548. }
  2549. };
  2550. this.getFoldWidget = function(session, foldStyle, row) {
  2551. var line = session.getLine(row);
  2552. var indent = line.search(/\S/);
  2553. var next = session.getLine(row + 1);
  2554. var prev = session.getLine(row - 1);
  2555. var prevIndent = prev.search(/\S/);
  2556. var nextIndent = next.search(/\S/);
  2557. if (indent == -1) {
  2558. session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
  2559. return "";
  2560. }
  2561. if (prevIndent == -1) {
  2562. if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
  2563. session.foldWidgets[row - 1] = "";
  2564. session.foldWidgets[row + 1] = "";
  2565. return "start";
  2566. }
  2567. } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
  2568. if (session.getLine(row - 2).search(/\S/) == -1) {
  2569. session.foldWidgets[row - 1] = "start";
  2570. session.foldWidgets[row + 1] = "";
  2571. return "";
  2572. }
  2573. }
  2574. if (prevIndent!= -1 && prevIndent < indent)
  2575. session.foldWidgets[row - 1] = "start";
  2576. else
  2577. session.foldWidgets[row - 1] = "";
  2578. if (indent < nextIndent)
  2579. return "start";
  2580. else
  2581. return "";
  2582. };
  2583. }).call(FoldMode.prototype);
  2584. });
  2585. ace.define("ace/mode/ruby",[], function(require, exports, module) {
  2586. "use strict";
  2587. var oop = require("../lib/oop");
  2588. var TextMode = require("./text").Mode;
  2589. var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
  2590. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  2591. var Range = require("../range").Range;
  2592. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  2593. var FoldMode = require("./folding/coffee").FoldMode;
  2594. var Mode = function() {
  2595. this.HighlightRules = RubyHighlightRules;
  2596. this.$outdent = new MatchingBraceOutdent();
  2597. this.$behaviour = new CstyleBehaviour();
  2598. this.foldingRules = new FoldMode();
  2599. };
  2600. oop.inherits(Mode, TextMode);
  2601. (function() {
  2602. this.lineCommentStart = "#";
  2603. this.getNextLineIndent = function(state, line, tab) {
  2604. var indent = this.$getIndent(line);
  2605. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  2606. var tokens = tokenizedLine.tokens;
  2607. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  2608. return indent;
  2609. }
  2610. if (state == "start") {
  2611. var match = line.match(/^.*[\{\(\[]\s*$/);
  2612. var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/);
  2613. var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/);
  2614. var startingConditional = line.match(/^\s*(if|else|when)\s*/);
  2615. if (match || startingClassOrMethod || startingDoBlock || startingConditional) {
  2616. indent += tab;
  2617. }
  2618. }
  2619. return indent;
  2620. };
  2621. this.checkOutdent = function(state, line, input) {
  2622. return /^\s+(end|else)$/.test(line + input) || this.$outdent.checkOutdent(line, input);
  2623. };
  2624. this.autoOutdent = function(state, session, row) {
  2625. var line = session.getLine(row);
  2626. if (/}/.test(line))
  2627. return this.$outdent.autoOutdent(session, row);
  2628. var indent = this.$getIndent(line);
  2629. var prevLine = session.getLine(row - 1);
  2630. var prevIndent = this.$getIndent(prevLine);
  2631. var tab = session.getTabString();
  2632. if (prevIndent.length <= indent.length) {
  2633. if (indent.slice(-tab.length) == tab)
  2634. session.remove(new Range(row, indent.length-tab.length, row, indent.length));
  2635. }
  2636. };
  2637. this.$id = "ace/mode/ruby";
  2638. }).call(Mode.prototype);
  2639. exports.Mode = Mode;
  2640. });
  2641. ace.define("ace/mode/html_ruby",[], function(require, exports, module) {
  2642. "use strict";
  2643. var oop = require("../lib/oop");
  2644. var HtmlRubyHighlightRules = require("./html_ruby_highlight_rules").HtmlRubyHighlightRules;
  2645. var HtmlMode = require("./html").Mode;
  2646. var JavaScriptMode = require("./javascript").Mode;
  2647. var CssMode = require("./css").Mode;
  2648. var RubyMode = require("./ruby").Mode;
  2649. var Mode = function() {
  2650. HtmlMode.call(this);
  2651. this.HighlightRules = HtmlRubyHighlightRules;
  2652. this.createModeDelegates({
  2653. "js-": JavaScriptMode,
  2654. "css-": CssMode,
  2655. "ruby-": RubyMode
  2656. });
  2657. };
  2658. oop.inherits(Mode, HtmlMode);
  2659. (function() {
  2660. this.$id = "ace/mode/html_ruby";
  2661. }).call(Mode.prototype);
  2662. exports.Mode = Mode;
  2663. });
  2664. (function() {
  2665. ace.require(["ace/mode/html_ruby"], function(m) {
  2666. if (typeof module == "object" && typeof exports == "object" && module) {
  2667. module.exports = m;
  2668. }
  2669. });
  2670. })();