mode-ejs.js 106 KB

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