mode-html_ruby.js 115 KB

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