mode-ejs.js 117 KB

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