mode-html_ruby.js 115 KB

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