mode-ejs.js 114 KB

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