mode-ejs.js 114 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940
  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|of|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/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
  887. "use strict";
  888. var Range = require("../range").Range;
  889. var MatchingBraceOutdent = function() {};
  890. (function() {
  891. this.checkOutdent = function(line, input) {
  892. if (! /^\s+$/.test(line))
  893. return false;
  894. return /^\s*\}/.test(input);
  895. };
  896. this.autoOutdent = function(doc, row) {
  897. var line = doc.getLine(row);
  898. var match = line.match(/^(\s*\})/);
  899. if (!match) return 0;
  900. var column = match[1].length;
  901. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  902. if (!openBracePos || openBracePos.row == row) return 0;
  903. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  904. doc.replace(new Range(row, 0, row, column-1), indent);
  905. };
  906. this.$getIndent = function(line) {
  907. return line.match(/^\s*/)[0];
  908. };
  909. }).call(MatchingBraceOutdent.prototype);
  910. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  911. });
  912. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
  913. "use strict";
  914. var oop = require("../../lib/oop");
  915. var Range = require("../../range").Range;
  916. var BaseFoldMode = require("./fold_mode").FoldMode;
  917. var FoldMode = exports.FoldMode = function(commentRegex) {
  918. if (commentRegex) {
  919. this.foldingStartMarker = new RegExp(
  920. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  921. );
  922. this.foldingStopMarker = new RegExp(
  923. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  924. );
  925. }
  926. };
  927. oop.inherits(FoldMode, BaseFoldMode);
  928. (function() {
  929. this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
  930. this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
  931. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  932. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  933. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  934. this._getFoldWidgetBase = this.getFoldWidget;
  935. this.getFoldWidget = function(session, foldStyle, row) {
  936. var line = session.getLine(row);
  937. if (this.singleLineBlockCommentRe.test(line)) {
  938. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  939. return "";
  940. }
  941. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  942. if (!fw && this.startRegionRe.test(line))
  943. return "start"; // lineCommentRegionStart
  944. return fw;
  945. };
  946. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  947. var line = session.getLine(row);
  948. if (this.startRegionRe.test(line))
  949. return this.getCommentRegionBlock(session, line, row);
  950. var match = line.match(this.foldingStartMarker);
  951. if (match) {
  952. var i = match.index;
  953. if (match[1])
  954. return this.openingBracketBlock(session, match[1], row, i);
  955. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  956. if (range && !range.isMultiLine()) {
  957. if (forceMultiline) {
  958. range = this.getSectionRange(session, row);
  959. } else if (foldStyle != "all")
  960. range = null;
  961. }
  962. return range;
  963. }
  964. if (foldStyle === "markbegin")
  965. return;
  966. var match = line.match(this.foldingStopMarker);
  967. if (match) {
  968. var i = match.index + match[0].length;
  969. if (match[1])
  970. return this.closingBracketBlock(session, match[1], row, i);
  971. return session.getCommentFoldRange(row, i, -1);
  972. }
  973. };
  974. this.getSectionRange = function(session, row) {
  975. var line = session.getLine(row);
  976. var startIndent = line.search(/\S/);
  977. var startRow = row;
  978. var startColumn = line.length;
  979. row = row + 1;
  980. var endRow = row;
  981. var maxRow = session.getLength();
  982. while (++row < maxRow) {
  983. line = session.getLine(row);
  984. var indent = line.search(/\S/);
  985. if (indent === -1)
  986. continue;
  987. if (startIndent > indent)
  988. break;
  989. var subRange = this.getFoldWidgetRange(session, "all", row);
  990. if (subRange) {
  991. if (subRange.start.row <= startRow) {
  992. break;
  993. } else if (subRange.isMultiLine()) {
  994. row = subRange.end.row;
  995. } else if (startIndent == indent) {
  996. break;
  997. }
  998. }
  999. endRow = row;
  1000. }
  1001. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  1002. };
  1003. this.getCommentRegionBlock = function(session, line, row) {
  1004. var startColumn = line.search(/\s*$/);
  1005. var maxRow = session.getLength();
  1006. var startRow = row;
  1007. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  1008. var depth = 1;
  1009. while (++row < maxRow) {
  1010. line = session.getLine(row);
  1011. var m = re.exec(line);
  1012. if (!m) continue;
  1013. if (m[1]) depth--;
  1014. else depth++;
  1015. if (!depth) break;
  1016. }
  1017. var endRow = row;
  1018. if (endRow > startRow) {
  1019. return new Range(startRow, startColumn, endRow, line.length);
  1020. }
  1021. };
  1022. }).call(FoldMode.prototype);
  1023. });
  1024. ace.define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
  1025. "use strict";
  1026. var oop = require("../lib/oop");
  1027. var TextMode = require("./text").Mode;
  1028. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1029. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1030. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1031. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  1032. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1033. var Mode = function() {
  1034. this.HighlightRules = JavaScriptHighlightRules;
  1035. this.$outdent = new MatchingBraceOutdent();
  1036. this.$behaviour = new CstyleBehaviour();
  1037. this.foldingRules = new CStyleFoldMode();
  1038. };
  1039. oop.inherits(Mode, TextMode);
  1040. (function() {
  1041. this.lineCommentStart = "//";
  1042. this.blockComment = {start: "/*", end: "*/"};
  1043. this.getNextLineIndent = function(state, line, tab) {
  1044. var indent = this.$getIndent(line);
  1045. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  1046. var tokens = tokenizedLine.tokens;
  1047. var endState = tokenizedLine.state;
  1048. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1049. return indent;
  1050. }
  1051. if (state == "start" || state == "no_regex") {
  1052. var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
  1053. if (match) {
  1054. indent += tab;
  1055. }
  1056. } else if (state == "doc-start") {
  1057. if (endState == "start" || endState == "no_regex") {
  1058. return "";
  1059. }
  1060. var match = line.match(/^\s*(\/?)\*/);
  1061. if (match) {
  1062. if (match[1]) {
  1063. indent += " ";
  1064. }
  1065. indent += "* ";
  1066. }
  1067. }
  1068. return indent;
  1069. };
  1070. this.checkOutdent = function(state, line, input) {
  1071. return this.$outdent.checkOutdent(line, input);
  1072. };
  1073. this.autoOutdent = function(state, doc, row) {
  1074. this.$outdent.autoOutdent(doc, row);
  1075. };
  1076. this.createWorker = function(session) {
  1077. var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
  1078. worker.attachToDocument(session.getDocument());
  1079. worker.on("annotate", function(results) {
  1080. session.setAnnotations(results.data);
  1081. });
  1082. worker.on("terminate", function() {
  1083. session.clearAnnotations();
  1084. });
  1085. return worker;
  1086. };
  1087. this.$id = "ace/mode/javascript";
  1088. }).call(Mode.prototype);
  1089. exports.Mode = Mode;
  1090. });
  1091. ace.define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module) {
  1092. "use strict";
  1093. var propertyMap = {
  1094. "background": {"#$0": 1},
  1095. "background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
  1096. "background-image": {"url('/$0')": 1},
  1097. "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
  1098. "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2},
  1099. "background-attachment": {"scroll": 1, "fixed": 1},
  1100. "background-size": {"cover": 1, "contain": 1},
  1101. "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
  1102. "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
  1103. "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
  1104. "border-color": {"#$0": 1},
  1105. "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2},
  1106. "border-collapse": {"collapse": 1, "separate": 1},
  1107. "bottom": {"px": 1, "em": 1, "%": 1},
  1108. "clear": {"left": 1, "right": 1, "both": 1, "none": 1},
  1109. "color": {"#$0": 1, "rgb(#$00,0,0)": 1},
  1110. "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},
  1111. "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
  1112. "empty-cells": {"show": 1, "hide": 1},
  1113. "float": {"left": 1, "right": 1, "none": 1},
  1114. "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},
  1115. "font-size": {"px": 1, "em": 1, "%": 1},
  1116. "font-weight": {"bold": 1, "normal": 1},
  1117. "font-style": {"italic": 1, "normal": 1},
  1118. "font-variant": {"normal": 1, "small-caps": 1},
  1119. "height": {"px": 1, "em": 1, "%": 1},
  1120. "left": {"px": 1, "em": 1, "%": 1},
  1121. "letter-spacing": {"normal": 1},
  1122. "line-height": {"normal": 1},
  1123. "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},
  1124. "margin": {"px": 1, "em": 1, "%": 1},
  1125. "margin-right": {"px": 1, "em": 1, "%": 1},
  1126. "margin-left": {"px": 1, "em": 1, "%": 1},
  1127. "margin-top": {"px": 1, "em": 1, "%": 1},
  1128. "margin-bottom": {"px": 1, "em": 1, "%": 1},
  1129. "max-height": {"px": 1, "em": 1, "%": 1},
  1130. "max-width": {"px": 1, "em": 1, "%": 1},
  1131. "min-height": {"px": 1, "em": 1, "%": 1},
  1132. "min-width": {"px": 1, "em": 1, "%": 1},
  1133. "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1134. "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1135. "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
  1136. "padding": {"px": 1, "em": 1, "%": 1},
  1137. "padding-top": {"px": 1, "em": 1, "%": 1},
  1138. "padding-right": {"px": 1, "em": 1, "%": 1},
  1139. "padding-bottom": {"px": 1, "em": 1, "%": 1},
  1140. "padding-left": {"px": 1, "em": 1, "%": 1},
  1141. "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  1142. "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
  1143. "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
  1144. "right": {"px": 1, "em": 1, "%": 1},
  1145. "table-layout": {"fixed": 1, "auto": 1},
  1146. "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
  1147. "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
  1148. "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
  1149. "top": {"px": 1, "em": 1, "%": 1},
  1150. "vertical-align": {"top": 1, "bottom": 1},
  1151. "visibility": {"hidden": 1, "visible": 1},
  1152. "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
  1153. "width": {"px": 1, "em": 1, "%": 1},
  1154. "word-spacing": {"normal": 1},
  1155. "filter": {"alpha(opacity=$0100)": 1},
  1156. "text-shadow": {"$02px 2px 2px #777": 1},
  1157. "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
  1158. "-moz-border-radius": 1,
  1159. "-moz-border-radius-topright": 1,
  1160. "-moz-border-radius-bottomright": 1,
  1161. "-moz-border-radius-topleft": 1,
  1162. "-moz-border-radius-bottomleft": 1,
  1163. "-webkit-border-radius": 1,
  1164. "-webkit-border-top-right-radius": 1,
  1165. "-webkit-border-top-left-radius": 1,
  1166. "-webkit-border-bottom-right-radius": 1,
  1167. "-webkit-border-bottom-left-radius": 1,
  1168. "-moz-box-shadow": 1,
  1169. "-webkit-box-shadow": 1,
  1170. "transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  1171. "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
  1172. "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
  1173. };
  1174. var CssCompletions = function() {
  1175. };
  1176. (function() {
  1177. this.completionsDefined = false;
  1178. this.defineCompletions = function() {
  1179. if (document) {
  1180. var style = document.createElement('c').style;
  1181. for (var i in style) {
  1182. if (typeof style[i] !== 'string')
  1183. continue;
  1184. var name = i.replace(/[A-Z]/g, function(x) {
  1185. return '-' + x.toLowerCase();
  1186. });
  1187. if (!propertyMap.hasOwnProperty(name))
  1188. propertyMap[name] = 1;
  1189. }
  1190. }
  1191. this.completionsDefined = true;
  1192. }
  1193. this.getCompletions = function(state, session, pos, prefix) {
  1194. if (!this.completionsDefined) {
  1195. this.defineCompletions();
  1196. }
  1197. var token = session.getTokenAt(pos.row, pos.column);
  1198. if (!token)
  1199. return [];
  1200. if (state==='ruleset'){
  1201. var line = session.getLine(pos.row).substr(0, pos.column);
  1202. if (/:[^;]+$/.test(line)) {
  1203. /([\w\-]+):[^:]*$/.test(line);
  1204. return this.getPropertyValueCompletions(state, session, pos, prefix);
  1205. } else {
  1206. return this.getPropertyCompletions(state, session, pos, prefix);
  1207. }
  1208. }
  1209. return [];
  1210. };
  1211. this.getPropertyCompletions = function(state, session, pos, prefix) {
  1212. var properties = Object.keys(propertyMap);
  1213. return properties.map(function(property){
  1214. return {
  1215. caption: property,
  1216. snippet: property + ': $0',
  1217. meta: "property",
  1218. score: Number.MAX_VALUE
  1219. };
  1220. });
  1221. };
  1222. this.getPropertyValueCompletions = function(state, session, pos, prefix) {
  1223. var line = session.getLine(pos.row).substr(0, pos.column);
  1224. var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
  1225. if (!property)
  1226. return [];
  1227. var values = [];
  1228. if (property in propertyMap && typeof propertyMap[property] === "object") {
  1229. values = Object.keys(propertyMap[property]);
  1230. }
  1231. return values.map(function(value){
  1232. return {
  1233. caption: value,
  1234. snippet: value,
  1235. meta: "property value",
  1236. score: Number.MAX_VALUE
  1237. };
  1238. });
  1239. };
  1240. }).call(CssCompletions.prototype);
  1241. exports.CssCompletions = CssCompletions;
  1242. });
  1243. 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) {
  1244. "use strict";
  1245. var oop = require("../../lib/oop");
  1246. var Behaviour = require("../behaviour").Behaviour;
  1247. var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
  1248. var TokenIterator = require("../../token_iterator").TokenIterator;
  1249. var CssBehaviour = function () {
  1250. this.inherit(CstyleBehaviour);
  1251. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1252. if (text === ':') {
  1253. var cursor = editor.getCursorPosition();
  1254. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1255. var token = iterator.getCurrentToken();
  1256. if (token && token.value.match(/\s+/)) {
  1257. token = iterator.stepBackward();
  1258. }
  1259. if (token && token.type === 'support.type') {
  1260. var line = session.doc.getLine(cursor.row);
  1261. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1262. if (rightChar === ':') {
  1263. return {
  1264. text: '',
  1265. selection: [1, 1]
  1266. }
  1267. }
  1268. if (!line.substring(cursor.column).match(/^\s*;/)) {
  1269. return {
  1270. text: ':;',
  1271. selection: [1, 1]
  1272. }
  1273. }
  1274. }
  1275. }
  1276. });
  1277. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1278. var selected = session.doc.getTextRange(range);
  1279. if (!range.isMultiLine() && selected === ':') {
  1280. var cursor = editor.getCursorPosition();
  1281. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1282. var token = iterator.getCurrentToken();
  1283. if (token && token.value.match(/\s+/)) {
  1284. token = iterator.stepBackward();
  1285. }
  1286. if (token && token.type === 'support.type') {
  1287. var line = session.doc.getLine(range.start.row);
  1288. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1289. if (rightChar === ';') {
  1290. range.end.column ++;
  1291. return range;
  1292. }
  1293. }
  1294. }
  1295. });
  1296. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1297. if (text === ';') {
  1298. var cursor = editor.getCursorPosition();
  1299. var line = session.doc.getLine(cursor.row);
  1300. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1301. if (rightChar === ';') {
  1302. return {
  1303. text: '',
  1304. selection: [1, 1]
  1305. }
  1306. }
  1307. }
  1308. });
  1309. }
  1310. oop.inherits(CssBehaviour, CstyleBehaviour);
  1311. exports.CssBehaviour = CssBehaviour;
  1312. });
  1313. 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) {
  1314. "use strict";
  1315. var oop = require("../lib/oop");
  1316. var TextMode = require("./text").Mode;
  1317. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  1318. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1319. var WorkerClient = require("../worker/worker_client").WorkerClient;
  1320. var CssCompletions = require("./css_completions").CssCompletions;
  1321. var CssBehaviour = require("./behaviour/css").CssBehaviour;
  1322. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1323. var Mode = function() {
  1324. this.HighlightRules = CssHighlightRules;
  1325. this.$outdent = new MatchingBraceOutdent();
  1326. this.$behaviour = new CssBehaviour();
  1327. this.$completer = new CssCompletions();
  1328. this.foldingRules = new CStyleFoldMode();
  1329. };
  1330. oop.inherits(Mode, TextMode);
  1331. (function() {
  1332. this.foldingRules = "cStyle";
  1333. this.blockComment = {start: "/*", end: "*/"};
  1334. this.getNextLineIndent = function(state, line, tab) {
  1335. var indent = this.$getIndent(line);
  1336. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1337. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1338. return indent;
  1339. }
  1340. var match = line.match(/^.*\{\s*$/);
  1341. if (match) {
  1342. indent += tab;
  1343. }
  1344. return indent;
  1345. };
  1346. this.checkOutdent = function(state, line, input) {
  1347. return this.$outdent.checkOutdent(line, input);
  1348. };
  1349. this.autoOutdent = function(state, doc, row) {
  1350. this.$outdent.autoOutdent(doc, row);
  1351. };
  1352. this.getCompletions = function(state, session, pos, prefix) {
  1353. return this.$completer.getCompletions(state, session, pos, prefix);
  1354. };
  1355. this.createWorker = function(session) {
  1356. var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
  1357. worker.attachToDocument(session.getDocument());
  1358. worker.on("annotate", function(e) {
  1359. session.setAnnotations(e.data);
  1360. });
  1361. worker.on("terminate", function() {
  1362. session.clearAnnotations();
  1363. });
  1364. return worker;
  1365. };
  1366. this.$id = "ace/mode/css";
  1367. }).call(Mode.prototype);
  1368. exports.Mode = Mode;
  1369. });
  1370. 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) {
  1371. "use strict";
  1372. var oop = require("../../lib/oop");
  1373. var Behaviour = require("../behaviour").Behaviour;
  1374. var TokenIterator = require("../../token_iterator").TokenIterator;
  1375. var lang = require("../../lib/lang");
  1376. function is(token, type) {
  1377. return token.type.lastIndexOf(type + ".xml") > -1;
  1378. }
  1379. var XmlBehaviour = function () {
  1380. this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
  1381. if (text == '"' || text == "'") {
  1382. var quote = text;
  1383. var selected = session.doc.getTextRange(editor.getSelectionRange());
  1384. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  1385. return {
  1386. text: quote + selected + quote,
  1387. selection: false
  1388. };
  1389. }
  1390. var cursor = editor.getCursorPosition();
  1391. var line = session.doc.getLine(cursor.row);
  1392. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1393. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1394. var token = iterator.getCurrentToken();
  1395. if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) {
  1396. return {
  1397. text: "",
  1398. selection: [1, 1]
  1399. };
  1400. }
  1401. if (!token)
  1402. token = iterator.stepBackward();
  1403. if (!token)
  1404. return;
  1405. while (is(token, "tag-whitespace") || is(token, "whitespace")) {
  1406. token = iterator.stepBackward();
  1407. }
  1408. var rightSpace = !rightChar || rightChar.match(/\s/);
  1409. if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) {
  1410. return {
  1411. text: quote + quote,
  1412. selection: [1, 1]
  1413. };
  1414. }
  1415. }
  1416. });
  1417. this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
  1418. var selected = session.doc.getTextRange(range);
  1419. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  1420. var line = session.doc.getLine(range.start.row);
  1421. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  1422. if (rightChar == selected) {
  1423. range.end.column++;
  1424. return range;
  1425. }
  1426. }
  1427. });
  1428. this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
  1429. if (text == '>') {
  1430. var position = editor.getSelectionRange().start;
  1431. var iterator = new TokenIterator(session, position.row, position.column);
  1432. var token = iterator.getCurrentToken() || iterator.stepBackward();
  1433. if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value")))
  1434. return;
  1435. if (is(token, "reference.attribute-value"))
  1436. return;
  1437. if (is(token, "attribute-value")) {
  1438. var firstChar = token.value.charAt(0);
  1439. if (firstChar == '"' || firstChar == "'") {
  1440. var lastChar = token.value.charAt(token.value.length - 1);
  1441. var tokenEnd = iterator.getCurrentTokenColumn() + token.value.length;
  1442. if (tokenEnd > position.column || tokenEnd == position.column && firstChar != lastChar)
  1443. return;
  1444. }
  1445. }
  1446. while (!is(token, "tag-name")) {
  1447. token = iterator.stepBackward();
  1448. if (token.value == "<") {
  1449. token = iterator.stepForward();
  1450. break;
  1451. }
  1452. }
  1453. var tokenRow = iterator.getCurrentTokenRow();
  1454. var tokenColumn = iterator.getCurrentTokenColumn();
  1455. if (is(iterator.stepBackward(), "end-tag-open"))
  1456. return;
  1457. var element = token.value;
  1458. if (tokenRow == position.row)
  1459. element = element.substring(0, position.column - tokenColumn);
  1460. if (this.voidElements.hasOwnProperty(element.toLowerCase()))
  1461. return;
  1462. return {
  1463. text: ">" + "</" + element + ">",
  1464. selection: [1, 1]
  1465. };
  1466. }
  1467. });
  1468. this.add("autoindent", "insertion", function (state, action, editor, session, text) {
  1469. if (text == "\n") {
  1470. var cursor = editor.getCursorPosition();
  1471. var line = session.getLine(cursor.row);
  1472. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1473. var token = iterator.getCurrentToken();
  1474. if (token && token.type.indexOf("tag-close") !== -1) {
  1475. if (token.value == "/>")
  1476. return;
  1477. while (token && token.type.indexOf("tag-name") === -1) {
  1478. token = iterator.stepBackward();
  1479. }
  1480. if (!token) {
  1481. return;
  1482. }
  1483. var tag = token.value;
  1484. var row = iterator.getCurrentTokenRow();
  1485. token = iterator.stepBackward();
  1486. if (!token || token.type.indexOf("end-tag") !== -1) {
  1487. return;
  1488. }
  1489. if (this.voidElements && !this.voidElements[tag]) {
  1490. var nextToken = session.getTokenAt(cursor.row, cursor.column+1);
  1491. var line = session.getLine(row);
  1492. var nextIndent = this.$getIndent(line);
  1493. var indent = nextIndent + session.getTabString();
  1494. if (nextToken && nextToken.value === "</") {
  1495. return {
  1496. text: "\n" + indent + "\n" + nextIndent,
  1497. selection: [1, indent.length, 1, indent.length]
  1498. };
  1499. } else {
  1500. return {
  1501. text: "\n" + indent
  1502. };
  1503. }
  1504. }
  1505. }
  1506. }
  1507. });
  1508. };
  1509. oop.inherits(XmlBehaviour, Behaviour);
  1510. exports.XmlBehaviour = XmlBehaviour;
  1511. });
  1512. ace.define("ace/mode/folding/mixed",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module) {
  1513. "use strict";
  1514. var oop = require("../../lib/oop");
  1515. var BaseFoldMode = require("./fold_mode").FoldMode;
  1516. var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
  1517. this.defaultMode = defaultMode;
  1518. this.subModes = subModes;
  1519. };
  1520. oop.inherits(FoldMode, BaseFoldMode);
  1521. (function() {
  1522. this.$getMode = function(state) {
  1523. if (typeof state != "string")
  1524. state = state[0];
  1525. for (var key in this.subModes) {
  1526. if (state.indexOf(key) === 0)
  1527. return this.subModes[key];
  1528. }
  1529. return null;
  1530. };
  1531. this.$tryMode = function(state, session, foldStyle, row) {
  1532. var mode = this.$getMode(state);
  1533. return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
  1534. };
  1535. this.getFoldWidget = function(session, foldStyle, row) {
  1536. return (
  1537. this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
  1538. this.$tryMode(session.getState(row), session, foldStyle, row) ||
  1539. this.defaultMode.getFoldWidget(session, foldStyle, row)
  1540. );
  1541. };
  1542. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1543. var mode = this.$getMode(session.getState(row-1));
  1544. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1545. mode = this.$getMode(session.getState(row));
  1546. if (!mode || !mode.getFoldWidget(session, foldStyle, row))
  1547. mode = this.defaultMode;
  1548. return mode.getFoldWidgetRange(session, foldStyle, row);
  1549. };
  1550. }).call(FoldMode.prototype);
  1551. });
  1552. 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) {
  1553. "use strict";
  1554. var oop = require("../../lib/oop");
  1555. var lang = require("../../lib/lang");
  1556. var Range = require("../../range").Range;
  1557. var BaseFoldMode = require("./fold_mode").FoldMode;
  1558. var TokenIterator = require("../../token_iterator").TokenIterator;
  1559. var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
  1560. BaseFoldMode.call(this);
  1561. this.voidElements = voidElements || {};
  1562. this.optionalEndTags = oop.mixin({}, this.voidElements);
  1563. if (optionalEndTags)
  1564. oop.mixin(this.optionalEndTags, optionalEndTags);
  1565. };
  1566. oop.inherits(FoldMode, BaseFoldMode);
  1567. var Tag = function() {
  1568. this.tagName = "";
  1569. this.closing = false;
  1570. this.selfClosing = false;
  1571. this.start = {row: 0, column: 0};
  1572. this.end = {row: 0, column: 0};
  1573. };
  1574. function is(token, type) {
  1575. return token.type.lastIndexOf(type + ".xml") > -1;
  1576. }
  1577. (function() {
  1578. this.getFoldWidget = function(session, foldStyle, row) {
  1579. var tag = this._getFirstTagInLine(session, row);
  1580. if (!tag)
  1581. return "";
  1582. if (tag.closing || (!tag.tagName && tag.selfClosing))
  1583. return foldStyle == "markbeginend" ? "end" : "";
  1584. if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
  1585. return "";
  1586. if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
  1587. return "";
  1588. return "start";
  1589. };
  1590. this._getFirstTagInLine = function(session, row) {
  1591. var tokens = session.getTokens(row);
  1592. var tag = new Tag();
  1593. for (var i = 0; i < tokens.length; i++) {
  1594. var token = tokens[i];
  1595. if (is(token, "tag-open")) {
  1596. tag.end.column = tag.start.column + token.value.length;
  1597. tag.closing = is(token, "end-tag-open");
  1598. token = tokens[++i];
  1599. if (!token)
  1600. return null;
  1601. tag.tagName = token.value;
  1602. tag.end.column += token.value.length;
  1603. for (i++; i < tokens.length; i++) {
  1604. token = tokens[i];
  1605. tag.end.column += token.value.length;
  1606. if (is(token, "tag-close")) {
  1607. tag.selfClosing = token.value == '/>';
  1608. break;
  1609. }
  1610. }
  1611. return tag;
  1612. } else if (is(token, "tag-close")) {
  1613. tag.selfClosing = token.value == '/>';
  1614. return tag;
  1615. }
  1616. tag.start.column += token.value.length;
  1617. }
  1618. return null;
  1619. };
  1620. this._findEndTagInLine = function(session, row, tagName, startColumn) {
  1621. var tokens = session.getTokens(row);
  1622. var column = 0;
  1623. for (var i = 0; i < tokens.length; i++) {
  1624. var token = tokens[i];
  1625. column += token.value.length;
  1626. if (column < startColumn)
  1627. continue;
  1628. if (is(token, "end-tag-open")) {
  1629. token = tokens[i + 1];
  1630. if (token && token.value == tagName)
  1631. return true;
  1632. }
  1633. }
  1634. return false;
  1635. };
  1636. this._readTagForward = function(iterator) {
  1637. var token = iterator.getCurrentToken();
  1638. if (!token)
  1639. return null;
  1640. var tag = new Tag();
  1641. do {
  1642. if (is(token, "tag-open")) {
  1643. tag.closing = is(token, "end-tag-open");
  1644. tag.start.row = iterator.getCurrentTokenRow();
  1645. tag.start.column = iterator.getCurrentTokenColumn();
  1646. } else if (is(token, "tag-name")) {
  1647. tag.tagName = token.value;
  1648. } else if (is(token, "tag-close")) {
  1649. tag.selfClosing = token.value == "/>";
  1650. tag.end.row = iterator.getCurrentTokenRow();
  1651. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1652. iterator.stepForward();
  1653. return tag;
  1654. }
  1655. } while(token = iterator.stepForward());
  1656. return null;
  1657. };
  1658. this._readTagBackward = function(iterator) {
  1659. var token = iterator.getCurrentToken();
  1660. if (!token)
  1661. return null;
  1662. var tag = new Tag();
  1663. do {
  1664. if (is(token, "tag-open")) {
  1665. tag.closing = is(token, "end-tag-open");
  1666. tag.start.row = iterator.getCurrentTokenRow();
  1667. tag.start.column = iterator.getCurrentTokenColumn();
  1668. iterator.stepBackward();
  1669. return tag;
  1670. } else if (is(token, "tag-name")) {
  1671. tag.tagName = token.value;
  1672. } else if (is(token, "tag-close")) {
  1673. tag.selfClosing = token.value == "/>";
  1674. tag.end.row = iterator.getCurrentTokenRow();
  1675. tag.end.column = iterator.getCurrentTokenColumn() + token.value.length;
  1676. }
  1677. } while(token = iterator.stepBackward());
  1678. return null;
  1679. };
  1680. this._pop = function(stack, tag) {
  1681. while (stack.length) {
  1682. var top = stack[stack.length-1];
  1683. if (!tag || top.tagName == tag.tagName) {
  1684. return stack.pop();
  1685. }
  1686. else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
  1687. stack.pop();
  1688. continue;
  1689. } else {
  1690. return null;
  1691. }
  1692. }
  1693. };
  1694. this.getFoldWidgetRange = function(session, foldStyle, row) {
  1695. var firstTag = this._getFirstTagInLine(session, row);
  1696. if (!firstTag)
  1697. return null;
  1698. var isBackward = firstTag.closing || firstTag.selfClosing;
  1699. var stack = [];
  1700. var tag;
  1701. if (!isBackward) {
  1702. var iterator = new TokenIterator(session, row, firstTag.start.column);
  1703. var start = {
  1704. row: row,
  1705. column: firstTag.start.column + firstTag.tagName.length + 2
  1706. };
  1707. if (firstTag.start.row == firstTag.end.row)
  1708. start.column = firstTag.end.column;
  1709. while (tag = this._readTagForward(iterator)) {
  1710. if (tag.selfClosing) {
  1711. if (!stack.length) {
  1712. tag.start.column += tag.tagName.length + 2;
  1713. tag.end.column -= 2;
  1714. return Range.fromPoints(tag.start, tag.end);
  1715. } else
  1716. continue;
  1717. }
  1718. if (tag.closing) {
  1719. this._pop(stack, tag);
  1720. if (stack.length == 0)
  1721. return Range.fromPoints(start, tag.start);
  1722. }
  1723. else {
  1724. stack.push(tag);
  1725. }
  1726. }
  1727. }
  1728. else {
  1729. var iterator = new TokenIterator(session, row, firstTag.end.column);
  1730. var end = {
  1731. row: row,
  1732. column: firstTag.start.column
  1733. };
  1734. while (tag = this._readTagBackward(iterator)) {
  1735. if (tag.selfClosing) {
  1736. if (!stack.length) {
  1737. tag.start.column += tag.tagName.length + 2;
  1738. tag.end.column -= 2;
  1739. return Range.fromPoints(tag.start, tag.end);
  1740. } else
  1741. continue;
  1742. }
  1743. if (!tag.closing) {
  1744. this._pop(stack, tag);
  1745. if (stack.length == 0) {
  1746. tag.start.column += tag.tagName.length + 2;
  1747. if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
  1748. tag.start.column = tag.end.column;
  1749. return Range.fromPoints(tag.start, end);
  1750. }
  1751. }
  1752. else {
  1753. stack.push(tag);
  1754. }
  1755. }
  1756. }
  1757. };
  1758. }).call(FoldMode.prototype);
  1759. });
  1760. 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) {
  1761. "use strict";
  1762. var oop = require("../../lib/oop");
  1763. var MixedFoldMode = require("./mixed").FoldMode;
  1764. var XmlFoldMode = require("./xml").FoldMode;
  1765. var CStyleFoldMode = require("./cstyle").FoldMode;
  1766. var FoldMode = exports.FoldMode = function(voidElements, optionalTags) {
  1767. MixedFoldMode.call(this, new XmlFoldMode(voidElements, optionalTags), {
  1768. "js-": new CStyleFoldMode(),
  1769. "css-": new CStyleFoldMode()
  1770. });
  1771. };
  1772. oop.inherits(FoldMode, MixedFoldMode);
  1773. });
  1774. ace.define("ace/mode/html_completions",["require","exports","module","ace/token_iterator"], function(require, exports, module) {
  1775. "use strict";
  1776. var TokenIterator = require("../token_iterator").TokenIterator;
  1777. var commonAttributes = [
  1778. "accesskey",
  1779. "class",
  1780. "contenteditable",
  1781. "contextmenu",
  1782. "dir",
  1783. "draggable",
  1784. "dropzone",
  1785. "hidden",
  1786. "id",
  1787. "inert",
  1788. "itemid",
  1789. "itemprop",
  1790. "itemref",
  1791. "itemscope",
  1792. "itemtype",
  1793. "lang",
  1794. "spellcheck",
  1795. "style",
  1796. "tabindex",
  1797. "title",
  1798. "translate"
  1799. ];
  1800. var eventAttributes = [
  1801. "onabort",
  1802. "onblur",
  1803. "oncancel",
  1804. "oncanplay",
  1805. "oncanplaythrough",
  1806. "onchange",
  1807. "onclick",
  1808. "onclose",
  1809. "oncontextmenu",
  1810. "oncuechange",
  1811. "ondblclick",
  1812. "ondrag",
  1813. "ondragend",
  1814. "ondragenter",
  1815. "ondragleave",
  1816. "ondragover",
  1817. "ondragstart",
  1818. "ondrop",
  1819. "ondurationchange",
  1820. "onemptied",
  1821. "onended",
  1822. "onerror",
  1823. "onfocus",
  1824. "oninput",
  1825. "oninvalid",
  1826. "onkeydown",
  1827. "onkeypress",
  1828. "onkeyup",
  1829. "onload",
  1830. "onloadeddata",
  1831. "onloadedmetadata",
  1832. "onloadstart",
  1833. "onmousedown",
  1834. "onmousemove",
  1835. "onmouseout",
  1836. "onmouseover",
  1837. "onmouseup",
  1838. "onmousewheel",
  1839. "onpause",
  1840. "onplay",
  1841. "onplaying",
  1842. "onprogress",
  1843. "onratechange",
  1844. "onreset",
  1845. "onscroll",
  1846. "onseeked",
  1847. "onseeking",
  1848. "onselect",
  1849. "onshow",
  1850. "onstalled",
  1851. "onsubmit",
  1852. "onsuspend",
  1853. "ontimeupdate",
  1854. "onvolumechange",
  1855. "onwaiting"
  1856. ];
  1857. var globalAttributes = commonAttributes.concat(eventAttributes);
  1858. var attributeMap = {
  1859. "html": {"manifest": 1},
  1860. "head": {},
  1861. "title": {},
  1862. "base": {"href": 1, "target": 1},
  1863. "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},
  1864. "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1},
  1865. "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1},
  1866. "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1},
  1867. "noscript": {"href": 1},
  1868. "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},
  1869. "section": {},
  1870. "nav": {},
  1871. "article": {"pubdate": 1},
  1872. "aside": {},
  1873. "h1": {},
  1874. "h2": {},
  1875. "h3": {},
  1876. "h4": {},
  1877. "h5": {},
  1878. "h6": {},
  1879. "header": {},
  1880. "footer": {},
  1881. "address": {},
  1882. "main": {},
  1883. "p": {},
  1884. "hr": {},
  1885. "pre": {},
  1886. "blockquote": {"cite": 1},
  1887. "ol": {"start": 1, "reversed": 1},
  1888. "ul": {},
  1889. "li": {"value": 1},
  1890. "dl": {},
  1891. "dt": {},
  1892. "dd": {},
  1893. "figure": {},
  1894. "figcaption": {},
  1895. "div": {},
  1896. "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},
  1897. "em": {},
  1898. "strong": {},
  1899. "small": {},
  1900. "s": {},
  1901. "cite": {},
  1902. "q": {"cite": 1},
  1903. "dfn": {},
  1904. "abbr": {},
  1905. "data": {},
  1906. "time": {"datetime": 1},
  1907. "code": {},
  1908. "var": {},
  1909. "samp": {},
  1910. "kbd": {},
  1911. "sub": {},
  1912. "sup": {},
  1913. "i": {},
  1914. "b": {},
  1915. "u": {},
  1916. "mark": {},
  1917. "ruby": {},
  1918. "rt": {},
  1919. "rp": {},
  1920. "bdi": {},
  1921. "bdo": {},
  1922. "span": {},
  1923. "br": {},
  1924. "wbr": {},
  1925. "ins": {"cite": 1, "datetime": 1},
  1926. "del": {"cite": 1, "datetime": 1},
  1927. "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1},
  1928. "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}},
  1929. "embed": {"src": 1, "height": 1, "width": 1, "type": 1},
  1930. "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1},
  1931. "param": {"name": 1, "value": 1},
  1932. "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}},
  1933. "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }},
  1934. "source": {"src": 1, "type": 1, "media": 1},
  1935. "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1},
  1936. "canvas": {"width": 1, "height": 1},
  1937. "map": {"name": 1},
  1938. "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1},
  1939. "svg": {},
  1940. "math": {},
  1941. "table": {"summary": 1},
  1942. "caption": {},
  1943. "colgroup": {"span": 1},
  1944. "col": {"span": 1},
  1945. "tbody": {},
  1946. "thead": {},
  1947. "tfoot": {},
  1948. "tr": {},
  1949. "td": {"headers": 1, "rowspan": 1, "colspan": 1},
  1950. "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1},
  1951. "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}},
  1952. "fieldset": {"disabled": 1, "form": 1, "name": 1},
  1953. "legend": {},
  1954. "label": {"form": 1, "for": 1},
  1955. "input": {
  1956. "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},
  1957. "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},
  1958. "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}},
  1959. "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}},
  1960. "datalist": {},
  1961. "optgroup": {"disabled": 1, "label": 1},
  1962. "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1},
  1963. "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}},
  1964. "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1},
  1965. "output": {"for": 1, "form": 1, "name": 1},
  1966. "progress": {"value": 1, "max": 1},
  1967. "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1},
  1968. "details": {"open": 1},
  1969. "summary": {},
  1970. "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1},
  1971. "menu": {"type": 1, "label": 1},
  1972. "dialog": {"open": 1}
  1973. };
  1974. var elements = Object.keys(attributeMap);
  1975. function is(token, type) {
  1976. return token.type.lastIndexOf(type + ".xml") > -1;
  1977. }
  1978. function findTagName(session, pos) {
  1979. var iterator = new TokenIterator(session, pos.row, pos.column);
  1980. var token = iterator.getCurrentToken();
  1981. while (token && !is(token, "tag-name")){
  1982. token = iterator.stepBackward();
  1983. }
  1984. if (token)
  1985. return token.value;
  1986. }
  1987. function findAttributeName(session, pos) {
  1988. var iterator = new TokenIterator(session, pos.row, pos.column);
  1989. var token = iterator.getCurrentToken();
  1990. while (token && !is(token, "attribute-name")){
  1991. token = iterator.stepBackward();
  1992. }
  1993. if (token)
  1994. return token.value;
  1995. }
  1996. var HtmlCompletions = function() {
  1997. };
  1998. (function() {
  1999. this.getCompletions = function(state, session, pos, prefix) {
  2000. var token = session.getTokenAt(pos.row, pos.column);
  2001. if (!token)
  2002. return [];
  2003. if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
  2004. return this.getTagCompletions(state, session, pos, prefix);
  2005. if (is(token, "tag-whitespace") || is(token, "attribute-name"))
  2006. return this.getAttributeCompletions(state, session, pos, prefix);
  2007. if (is(token, "attribute-value"))
  2008. return this.getAttributeValueCompletions(state, session, pos, prefix);
  2009. var line = session.getLine(pos.row).substr(0, pos.column);
  2010. if (/&[a-z]*$/i.test(line))
  2011. return this.getHTMLEntityCompletions(state, session, pos, prefix);
  2012. return [];
  2013. };
  2014. this.getTagCompletions = function(state, session, pos, prefix) {
  2015. return elements.map(function(element){
  2016. return {
  2017. value: element,
  2018. meta: "tag",
  2019. score: Number.MAX_VALUE
  2020. };
  2021. });
  2022. };
  2023. this.getAttributeCompletions = function(state, session, pos, prefix) {
  2024. var tagName = findTagName(session, pos);
  2025. if (!tagName)
  2026. return [];
  2027. var attributes = globalAttributes;
  2028. if (tagName in attributeMap) {
  2029. attributes = attributes.concat(Object.keys(attributeMap[tagName]));
  2030. }
  2031. return attributes.map(function(attribute){
  2032. return {
  2033. caption: attribute,
  2034. snippet: attribute + '="$0"',
  2035. meta: "attribute",
  2036. score: Number.MAX_VALUE
  2037. };
  2038. });
  2039. };
  2040. this.getAttributeValueCompletions = function(state, session, pos, prefix) {
  2041. var tagName = findTagName(session, pos);
  2042. var attributeName = findAttributeName(session, pos);
  2043. if (!tagName)
  2044. return [];
  2045. var values = [];
  2046. if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
  2047. values = Object.keys(attributeMap[tagName][attributeName]);
  2048. }
  2049. return values.map(function(value){
  2050. return {
  2051. caption: value,
  2052. snippet: value,
  2053. meta: "attribute value",
  2054. score: Number.MAX_VALUE
  2055. };
  2056. });
  2057. };
  2058. this.getHTMLEntityCompletions = function(state, session, pos, prefix) {
  2059. 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;'];
  2060. return values.map(function(value){
  2061. return {
  2062. caption: value,
  2063. snippet: value,
  2064. meta: "html entity",
  2065. score: Number.MAX_VALUE
  2066. };
  2067. });
  2068. };
  2069. }).call(HtmlCompletions.prototype);
  2070. exports.HtmlCompletions = HtmlCompletions;
  2071. });
  2072. 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) {
  2073. "use strict";
  2074. var oop = require("../lib/oop");
  2075. var lang = require("../lib/lang");
  2076. var TextMode = require("./text").Mode;
  2077. var JavaScriptMode = require("./javascript").Mode;
  2078. var CssMode = require("./css").Mode;
  2079. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2080. var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
  2081. var HtmlFoldMode = require("./folding/html").FoldMode;
  2082. var HtmlCompletions = require("./html_completions").HtmlCompletions;
  2083. var WorkerClient = require("../worker/worker_client").WorkerClient;
  2084. var voidElements = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "menuitem", "param", "source", "track", "wbr"];
  2085. var optionalEndTags = ["li", "dt", "dd", "p", "rt", "rp", "optgroup", "option", "colgroup", "td", "th"];
  2086. var Mode = function(options) {
  2087. this.fragmentContext = options && options.fragmentContext;
  2088. this.HighlightRules = HtmlHighlightRules;
  2089. this.$behaviour = new XmlBehaviour();
  2090. this.$completer = new HtmlCompletions();
  2091. this.createModeDelegates({
  2092. "js-": JavaScriptMode,
  2093. "css-": CssMode
  2094. });
  2095. this.foldingRules = new HtmlFoldMode(this.voidElements, lang.arrayToMap(optionalEndTags));
  2096. };
  2097. oop.inherits(Mode, TextMode);
  2098. (function() {
  2099. this.blockComment = {start: "<!--", end: "-->"};
  2100. this.voidElements = lang.arrayToMap(voidElements);
  2101. this.getNextLineIndent = function(state, line, tab) {
  2102. return this.$getIndent(line);
  2103. };
  2104. this.checkOutdent = function(state, line, input) {
  2105. return false;
  2106. };
  2107. this.getCompletions = function(state, session, pos, prefix) {
  2108. return this.$completer.getCompletions(state, session, pos, prefix);
  2109. };
  2110. this.createWorker = function(session) {
  2111. if (this.constructor != Mode)
  2112. return;
  2113. var worker = new WorkerClient(["ace"], "ace/mode/html_worker", "Worker");
  2114. worker.attachToDocument(session.getDocument());
  2115. if (this.fragmentContext)
  2116. worker.call("setOptions", [{context: this.fragmentContext}]);
  2117. worker.on("error", function(e) {
  2118. session.setAnnotations(e.data);
  2119. });
  2120. worker.on("terminate", function() {
  2121. session.clearAnnotations();
  2122. });
  2123. return worker;
  2124. };
  2125. this.$id = "ace/mode/html";
  2126. }).call(Mode.prototype);
  2127. exports.Mode = Mode;
  2128. });
  2129. ace.define("ace/mode/ruby_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  2130. "use strict";
  2131. var oop = require("../lib/oop");
  2132. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  2133. var constantOtherSymbol = exports.constantOtherSymbol = {
  2134. token : "constant.other.symbol.ruby", // symbol
  2135. regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"
  2136. };
  2137. var qString = exports.qString = {
  2138. token : "string", // single line
  2139. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  2140. };
  2141. var qqString = exports.qqString = {
  2142. token : "string", // single line
  2143. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  2144. };
  2145. var tString = exports.tString = {
  2146. token : "string", // backtick string
  2147. regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"
  2148. };
  2149. var constantNumericHex = exports.constantNumericHex = {
  2150. token : "constant.numeric", // hex
  2151. regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b"
  2152. };
  2153. var constantNumericFloat = exports.constantNumericFloat = {
  2154. token : "constant.numeric", // float
  2155. regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b"
  2156. };
  2157. var RubyHighlightRules = function() {
  2158. var builtinFunctions = (
  2159. "abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
  2160. "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
  2161. "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" +
  2162. "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" +
  2163. "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" +
  2164. "assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" +
  2165. "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" +
  2166. "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" +
  2167. "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" +
  2168. "gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" +
  2169. "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" +
  2170. "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" +
  2171. "raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|" +
  2172. "set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" +
  2173. "throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" +
  2174. "render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" +
  2175. "content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" +
  2176. "fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" +
  2177. "time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" +
  2178. "select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" +
  2179. "file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" +
  2180. "protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" +
  2181. "send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" +
  2182. "validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" +
  2183. "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" +
  2184. "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" +
  2185. "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" +
  2186. "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" +
  2187. "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" +
  2188. "has_many|has_one|belongs_to|has_and_belongs_to_many"
  2189. );
  2190. var keywords = (
  2191. "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" +
  2192. "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" +
  2193. "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield"
  2194. );
  2195. var buildinConstants = (
  2196. "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
  2197. "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING"
  2198. );
  2199. var builtinVariables = (
  2200. "$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE|" +
  2201. "$!|root_url|flash|session|cookies|params|request|response|logger|self"
  2202. );
  2203. var keywordMapper = this.$keywords = this.createKeywordMapper({
  2204. "keyword": keywords,
  2205. "constant.language": buildinConstants,
  2206. "variable.language": builtinVariables,
  2207. "support.function": builtinFunctions,
  2208. "invalid.deprecated": "debugger" // TODO is this a remnant from js mode?
  2209. }, "identifier");
  2210. this.$rules = {
  2211. "start" : [
  2212. {
  2213. token : "comment",
  2214. regex : "#.*$"
  2215. }, {
  2216. token : "comment", // multi line comment
  2217. regex : "^=begin(?:$|\\s.*$)",
  2218. next : "comment"
  2219. }, {
  2220. token : "string.regexp",
  2221. regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
  2222. },
  2223. [{
  2224. regex: "[{}]", onMatch: function(val, state, stack) {
  2225. this.next = val == "{" ? this.nextState : "";
  2226. if (val == "{" && stack.length) {
  2227. stack.unshift("start", state);
  2228. return "paren.lparen";
  2229. }
  2230. if (val == "}" && stack.length) {
  2231. stack.shift();
  2232. this.next = stack.shift();
  2233. if (this.next.indexOf("string") != -1)
  2234. return "paren.end";
  2235. }
  2236. return val == "{" ? "paren.lparen" : "paren.rparen";
  2237. },
  2238. nextState: "start"
  2239. }, {
  2240. token : "string.start",
  2241. regex : /"/,
  2242. push : [{
  2243. token : "constant.language.escape",
  2244. regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
  2245. }, {
  2246. token : "paren.start",
  2247. regex : /#{/,
  2248. push : "start"
  2249. }, {
  2250. token : "string.end",
  2251. regex : /"/,
  2252. next : "pop"
  2253. }, {
  2254. defaultToken: "string"
  2255. }]
  2256. }, {
  2257. token : "string.start",
  2258. regex : /`/,
  2259. push : [{
  2260. token : "constant.language.escape",
  2261. regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
  2262. }, {
  2263. token : "paren.start",
  2264. regex : /#{/,
  2265. push : "start"
  2266. }, {
  2267. token : "string.end",
  2268. regex : /`/,
  2269. next : "pop"
  2270. }, {
  2271. defaultToken: "string"
  2272. }]
  2273. }, {
  2274. token : "string.start",
  2275. regex : /'/,
  2276. push : [{
  2277. token : "constant.language.escape",
  2278. regex : /\\['\\]/
  2279. }, {
  2280. token : "string.end",
  2281. regex : /'/,
  2282. next : "pop"
  2283. }, {
  2284. defaultToken: "string"
  2285. }]
  2286. }],
  2287. {
  2288. token : "text", // namespaces aren't symbols
  2289. regex : "::"
  2290. }, {
  2291. token : "variable.instance", // instance variable
  2292. regex : "@{1,2}[a-zA-Z_\\d]+"
  2293. }, {
  2294. token : "support.class", // class name
  2295. regex : "[A-Z][a-zA-Z_\\d]+"
  2296. },
  2297. constantOtherSymbol,
  2298. constantNumericHex,
  2299. constantNumericFloat,
  2300. {
  2301. token : "constant.language.boolean",
  2302. regex : "(?:true|false)\\b"
  2303. }, {
  2304. token : keywordMapper,
  2305. regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  2306. }, {
  2307. token : "punctuation.separator.key-value",
  2308. regex : "=>"
  2309. }, {
  2310. stateName: "heredoc",
  2311. onMatch : function(value, currentState, stack) {
  2312. var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
  2313. var tokens = value.split(this.splitRegex);
  2314. stack.push(next, tokens[3]);
  2315. return [
  2316. {type:"constant", value: tokens[1]},
  2317. {type:"string", value: tokens[2]},
  2318. {type:"support.class", value: tokens[3]},
  2319. {type:"string", value: tokens[4]}
  2320. ];
  2321. },
  2322. regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)",
  2323. rules: {
  2324. heredoc: [{
  2325. onMatch: function(value, currentState, stack) {
  2326. if (value === stack[1]) {
  2327. stack.shift();
  2328. stack.shift();
  2329. this.next = stack[0] || "start";
  2330. return "support.class";
  2331. }
  2332. this.next = "";
  2333. return "string";
  2334. },
  2335. regex: ".*$",
  2336. next: "start"
  2337. }],
  2338. indentedHeredoc: [{
  2339. token: "string",
  2340. regex: "^ +"
  2341. }, {
  2342. onMatch: function(value, currentState, stack) {
  2343. if (value === stack[1]) {
  2344. stack.shift();
  2345. stack.shift();
  2346. this.next = stack[0] || "start";
  2347. return "support.class";
  2348. }
  2349. this.next = "";
  2350. return "string";
  2351. },
  2352. regex: ".*$",
  2353. next: "start"
  2354. }]
  2355. }
  2356. }, {
  2357. regex : "$",
  2358. token : "empty",
  2359. next : function(currentState, stack) {
  2360. if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
  2361. return stack[0];
  2362. return currentState;
  2363. }
  2364. }, {
  2365. token : "string.character",
  2366. regex : "\\B\\?."
  2367. }, {
  2368. token : "keyword.operator",
  2369. regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
  2370. }, {
  2371. token : "paren.lparen",
  2372. regex : "[[({]"
  2373. }, {
  2374. token : "paren.rparen",
  2375. regex : "[\\])}]"
  2376. }, {
  2377. token : "text",
  2378. regex : "\\s+"
  2379. }
  2380. ],
  2381. "comment" : [
  2382. {
  2383. token : "comment", // closing comment
  2384. regex : "^=end(?:$|\\s.*$)",
  2385. next : "start"
  2386. }, {
  2387. token : "comment", // comment spanning whole line
  2388. regex : ".+"
  2389. }
  2390. ]
  2391. };
  2392. this.normalizeRules();
  2393. };
  2394. oop.inherits(RubyHighlightRules, TextHighlightRules);
  2395. exports.RubyHighlightRules = RubyHighlightRules;
  2396. });
  2397. ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
  2398. "use strict";
  2399. var oop = require("../../lib/oop");
  2400. var BaseFoldMode = require("./fold_mode").FoldMode;
  2401. var Range = require("../../range").Range;
  2402. var FoldMode = exports.FoldMode = function() {};
  2403. oop.inherits(FoldMode, BaseFoldMode);
  2404. (function() {
  2405. this.getFoldWidgetRange = function(session, foldStyle, row) {
  2406. var range = this.indentationBlock(session, row);
  2407. if (range)
  2408. return range;
  2409. var re = /\S/;
  2410. var line = session.getLine(row);
  2411. var startLevel = line.search(re);
  2412. if (startLevel == -1 || line[startLevel] != "#")
  2413. return;
  2414. var startColumn = line.length;
  2415. var maxRow = session.getLength();
  2416. var startRow = row;
  2417. var endRow = row;
  2418. while (++row < maxRow) {
  2419. line = session.getLine(row);
  2420. var level = line.search(re);
  2421. if (level == -1)
  2422. continue;
  2423. if (line[level] != "#")
  2424. break;
  2425. endRow = row;
  2426. }
  2427. if (endRow > startRow) {
  2428. var endColumn = session.getLine(endRow).length;
  2429. return new Range(startRow, startColumn, endRow, endColumn);
  2430. }
  2431. };
  2432. this.getFoldWidget = function(session, foldStyle, row) {
  2433. var line = session.getLine(row);
  2434. var indent = line.search(/\S/);
  2435. var next = session.getLine(row + 1);
  2436. var prev = session.getLine(row - 1);
  2437. var prevIndent = prev.search(/\S/);
  2438. var nextIndent = next.search(/\S/);
  2439. if (indent == -1) {
  2440. session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
  2441. return "";
  2442. }
  2443. if (prevIndent == -1) {
  2444. if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
  2445. session.foldWidgets[row - 1] = "";
  2446. session.foldWidgets[row + 1] = "";
  2447. return "start";
  2448. }
  2449. } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
  2450. if (session.getLine(row - 2).search(/\S/) == -1) {
  2451. session.foldWidgets[row - 1] = "start";
  2452. session.foldWidgets[row + 1] = "";
  2453. return "";
  2454. }
  2455. }
  2456. if (prevIndent!= -1 && prevIndent < indent)
  2457. session.foldWidgets[row - 1] = "start";
  2458. else
  2459. session.foldWidgets[row - 1] = "";
  2460. if (indent < nextIndent)
  2461. return "start";
  2462. else
  2463. return "";
  2464. };
  2465. }).call(FoldMode.prototype);
  2466. });
  2467. 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) {
  2468. "use strict";
  2469. var oop = require("../lib/oop");
  2470. var TextMode = require("./text").Mode;
  2471. var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
  2472. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  2473. var Range = require("../range").Range;
  2474. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  2475. var FoldMode = require("./folding/coffee").FoldMode;
  2476. var Mode = function() {
  2477. this.HighlightRules = RubyHighlightRules;
  2478. this.$outdent = new MatchingBraceOutdent();
  2479. this.$behaviour = new CstyleBehaviour();
  2480. this.foldingRules = new FoldMode();
  2481. };
  2482. oop.inherits(Mode, TextMode);
  2483. (function() {
  2484. this.lineCommentStart = "#";
  2485. this.getNextLineIndent = function(state, line, tab) {
  2486. var indent = this.$getIndent(line);
  2487. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  2488. var tokens = tokenizedLine.tokens;
  2489. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  2490. return indent;
  2491. }
  2492. if (state == "start") {
  2493. var match = line.match(/^.*[\{\(\[]\s*$/);
  2494. var startingClassOrMethod = line.match(/^\s*(class|def|module)\s.*$/);
  2495. var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/);
  2496. var startingConditional = line.match(/^\s*(if|else|when)\s*/)
  2497. if (match || startingClassOrMethod || startingDoBlock || startingConditional) {
  2498. indent += tab;
  2499. }
  2500. }
  2501. return indent;
  2502. };
  2503. this.checkOutdent = function(state, line, input) {
  2504. return /^\s+(end|else)$/.test(line + input) || this.$outdent.checkOutdent(line, input);
  2505. };
  2506. this.autoOutdent = function(state, session, row) {
  2507. var line = session.getLine(row);
  2508. if (/}/.test(line))
  2509. return this.$outdent.autoOutdent(session, row);
  2510. var indent = this.$getIndent(line);
  2511. var prevLine = session.getLine(row - 1);
  2512. var prevIndent = this.$getIndent(prevLine);
  2513. var tab = session.getTabString();
  2514. if (prevIndent.length <= indent.length) {
  2515. if (indent.slice(-tab.length) == tab)
  2516. session.remove(new Range(row, indent.length-tab.length, row, indent.length));
  2517. }
  2518. };
  2519. this.$id = "ace/mode/ruby";
  2520. }).call(Mode.prototype);
  2521. exports.Mode = Mode;
  2522. });
  2523. ace.define("ace/mode/ejs",["require","exports","module","ace/lib/oop","ace/mode/html_highlight_rules","ace/mode/javascript_highlight_rules","ace/lib/oop","ace/mode/html","ace/mode/javascript","ace/mode/css","ace/mode/ruby"], function(require, exports, module) {
  2524. "use strict";
  2525. var oop = require("../lib/oop");
  2526. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  2527. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  2528. var EjsHighlightRules = function(start, end) {
  2529. HtmlHighlightRules.call(this);
  2530. if (!start)
  2531. start = "(?:<%|<\\?|{{)";
  2532. if (!end)
  2533. end = "(?:%>|\\?>|}})";
  2534. for (var i in this.$rules) {
  2535. this.$rules[i].unshift({
  2536. token : "markup.list.meta.tag",
  2537. regex : start + "(?![>}])[-=]?",
  2538. push : "ejs-start"
  2539. });
  2540. }
  2541. this.embedRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "ejs-", [{
  2542. token : "markup.list.meta.tag",
  2543. regex : "-?" + end,
  2544. next : "pop"
  2545. }, {
  2546. token: "comment",
  2547. regex: "//.*?" + end,
  2548. next: "pop"
  2549. }]);
  2550. this.normalizeRules();
  2551. };
  2552. oop.inherits(EjsHighlightRules, HtmlHighlightRules);
  2553. exports.EjsHighlightRules = EjsHighlightRules;
  2554. var oop = require("../lib/oop");
  2555. var HtmlMode = require("./html").Mode;
  2556. var JavaScriptMode = require("./javascript").Mode;
  2557. var CssMode = require("./css").Mode;
  2558. var RubyMode = require("./ruby").Mode;
  2559. var Mode = function() {
  2560. HtmlMode.call(this);
  2561. this.HighlightRules = EjsHighlightRules;
  2562. this.createModeDelegates({
  2563. "js-": JavaScriptMode,
  2564. "css-": CssMode,
  2565. "ejs-": JavaScriptMode
  2566. });
  2567. };
  2568. oop.inherits(Mode, HtmlMode);
  2569. (function() {
  2570. this.$id = "ace/mode/ejs";
  2571. }).call(Mode.prototype);
  2572. exports.Mode = Mode;
  2573. });