mode-ejs.js 116 KB

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