mode-mask.js 70 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803
  1. ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  5. var DocCommentHighlightRules = function() {
  6. this.$rules = {
  7. "start" : [ {
  8. token : "comment.doc.tag",
  9. regex : "@[\\w\\d_]+" // TODO: fix email addresses
  10. },
  11. DocCommentHighlightRules.getTagRule(),
  12. {
  13. defaultToken : "comment.doc",
  14. caseInsensitive: true
  15. }]
  16. };
  17. };
  18. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  19. DocCommentHighlightRules.getTagRule = function(start) {
  20. return {
  21. token : "comment.doc.tag.storage.type",
  22. regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  23. };
  24. };
  25. DocCommentHighlightRules.getStartRule = function(start) {
  26. return {
  27. token : "comment.doc", // doc comment
  28. regex : "\\/\\*(?=\\*)",
  29. next : start
  30. };
  31. };
  32. DocCommentHighlightRules.getEndRule = function (start) {
  33. return {
  34. token : "comment.doc", // closing comment
  35. regex : "\\*\\/",
  36. next : start
  37. };
  38. };
  39. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  40. });
  41. ace.define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
  42. "use strict";
  43. var oop = require("../lib/oop");
  44. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  45. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  46. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
  47. var JavaScriptHighlightRules = function(options) {
  48. var keywordMapper = this.createKeywordMapper({
  49. "variable.language":
  50. "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
  51. "Namespace|QName|XML|XMLList|" + // E4X
  52. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  53. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  54. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
  55. "SyntaxError|TypeError|URIError|" +
  56. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
  57. "isNaN|parseFloat|parseInt|" +
  58. "JSON|Math|" + // Other
  59. "this|arguments|prototype|window|document" , // Pseudo
  60. "keyword":
  61. "const|yield|import|get|set|async|await|" +
  62. "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  63. "if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  64. "__parent__|__count__|escape|unescape|with|__proto__|" +
  65. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
  66. "storage.type":
  67. "const|let|var|function",
  68. "constant.language":
  69. "null|Infinity|NaN|undefined",
  70. "support.function":
  71. "alert",
  72. "constant.language.boolean": "true|false"
  73. }, "identifier");
  74. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
  75. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  76. "u[0-9a-fA-F]{4}|" + // unicode
  77. "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
  78. "[0-2][0-7]{0,2}|" + // oct
  79. "3[0-7][0-7]?|" + // oct
  80. "[4-7][0-7]?|" + //oct
  81. ".)";
  82. this.$rules = {
  83. "no_regex" : [
  84. DocCommentHighlightRules.getStartRule("doc-start"),
  85. comments("no_regex"),
  86. {
  87. token : "string",
  88. regex : "'(?=.)",
  89. next : "qstring"
  90. }, {
  91. token : "string",
  92. regex : '"(?=.)',
  93. next : "qqstring"
  94. }, {
  95. token : "constant.numeric", // hexadecimal, octal and binary
  96. regex : /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
  97. }, {
  98. token : "constant.numeric", // decimal integers and floats
  99. regex : /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
  100. }, {
  101. token : [
  102. "storage.type", "punctuation.operator", "support.function",
  103. "punctuation.operator", "entity.name.function", "text","keyword.operator"
  104. ],
  105. regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
  106. next: "function_arguments"
  107. }, {
  108. token : [
  109. "storage.type", "punctuation.operator", "entity.name.function", "text",
  110. "keyword.operator", "text", "storage.type", "text", "paren.lparen"
  111. ],
  112. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  113. next: "function_arguments"
  114. }, {
  115. token : [
  116. "entity.name.function", "text", "keyword.operator", "text", "storage.type",
  117. "text", "paren.lparen"
  118. ],
  119. regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  120. next: "function_arguments"
  121. }, {
  122. token : [
  123. "storage.type", "punctuation.operator", "entity.name.function", "text",
  124. "keyword.operator", "text",
  125. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  126. ],
  127. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
  128. next: "function_arguments"
  129. }, {
  130. token : [
  131. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  132. ],
  133. regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
  134. next: "function_arguments"
  135. }, {
  136. token : [
  137. "entity.name.function", "text", "punctuation.operator",
  138. "text", "storage.type", "text", "paren.lparen"
  139. ],
  140. regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
  141. next: "function_arguments"
  142. }, {
  143. token : [
  144. "text", "text", "storage.type", "text", "paren.lparen"
  145. ],
  146. regex : "(:)(\\s*)(function)(\\s*)(\\()",
  147. next: "function_arguments"
  148. }, {
  149. token : "keyword",
  150. regex : "from(?=\\s*('|\"))"
  151. }, {
  152. token : "keyword",
  153. regex : "(?:" + kwBeforeRe + ")\\b",
  154. next : "start"
  155. }, {
  156. token : ["support.constant"],
  157. regex : /that\b/
  158. }, {
  159. token : ["storage.type", "punctuation.operator", "support.function.firebug"],
  160. regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
  161. }, {
  162. token : keywordMapper,
  163. regex : identifierRe
  164. }, {
  165. token : "punctuation.operator",
  166. regex : /[.](?![.])/,
  167. next : "property"
  168. }, {
  169. token : "storage.type",
  170. regex : /=>/,
  171. next : "start"
  172. }, {
  173. token : "keyword.operator",
  174. regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
  175. next : "start"
  176. }, {
  177. token : "punctuation.operator",
  178. regex : /[?:,;.]/,
  179. next : "start"
  180. }, {
  181. token : "paren.lparen",
  182. regex : /[\[({]/,
  183. next : "start"
  184. }, {
  185. token : "paren.rparen",
  186. regex : /[\])}]/
  187. }, {
  188. token: "comment",
  189. regex: /^#!.*$/
  190. }
  191. ],
  192. property: [{
  193. token : "text",
  194. regex : "\\s+"
  195. }, {
  196. token : [
  197. "storage.type", "punctuation.operator", "entity.name.function", "text",
  198. "keyword.operator", "text",
  199. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  200. ],
  201. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
  202. next: "function_arguments"
  203. }, {
  204. token : "punctuation.operator",
  205. regex : /[.](?![.])/
  206. }, {
  207. token : "support.function",
  208. 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(?=\()/
  209. }, {
  210. token : "support.function.dom",
  211. 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(?=\()/
  212. }, {
  213. token : "support.constant",
  214. 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/
  215. }, {
  216. token : "identifier",
  217. regex : identifierRe
  218. }, {
  219. regex: "",
  220. token: "empty",
  221. next: "no_regex"
  222. }
  223. ],
  224. "start": [
  225. DocCommentHighlightRules.getStartRule("doc-start"),
  226. comments("start"),
  227. {
  228. token: "string.regexp",
  229. regex: "\\/",
  230. next: "regex"
  231. }, {
  232. token : "text",
  233. regex : "\\s+|^$",
  234. next : "start"
  235. }, {
  236. token: "empty",
  237. regex: "",
  238. next: "no_regex"
  239. }
  240. ],
  241. "regex": [
  242. {
  243. token: "regexp.keyword.operator",
  244. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  245. }, {
  246. token: "string.regexp",
  247. regex: "/[sxngimy]*",
  248. next: "no_regex"
  249. }, {
  250. token : "invalid",
  251. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  252. }, {
  253. token : "constant.language.escape",
  254. regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  255. }, {
  256. token : "constant.language.delimiter",
  257. regex: /\|/
  258. }, {
  259. token: "constant.language.escape",
  260. regex: /\[\^?/,
  261. next: "regex_character_class"
  262. }, {
  263. token: "empty",
  264. regex: "$",
  265. next: "no_regex"
  266. }, {
  267. defaultToken: "string.regexp"
  268. }
  269. ],
  270. "regex_character_class": [
  271. {
  272. token: "regexp.charclass.keyword.operator",
  273. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  274. }, {
  275. token: "constant.language.escape",
  276. regex: "]",
  277. next: "regex"
  278. }, {
  279. token: "constant.language.escape",
  280. regex: "-"
  281. }, {
  282. token: "empty",
  283. regex: "$",
  284. next: "no_regex"
  285. }, {
  286. defaultToken: "string.regexp.charachterclass"
  287. }
  288. ],
  289. "function_arguments": [
  290. {
  291. token: "variable.parameter",
  292. regex: identifierRe
  293. }, {
  294. token: "punctuation.operator",
  295. regex: "[, ]+"
  296. }, {
  297. token: "punctuation.operator",
  298. regex: "$"
  299. }, {
  300. token: "empty",
  301. regex: "",
  302. next: "no_regex"
  303. }
  304. ],
  305. "qqstring" : [
  306. {
  307. token : "constant.language.escape",
  308. regex : escapedRe
  309. }, {
  310. token : "string",
  311. regex : "\\\\$",
  312. consumeLineEnd : true
  313. }, {
  314. token : "string",
  315. regex : '"|$',
  316. next : "no_regex"
  317. }, {
  318. defaultToken: "string"
  319. }
  320. ],
  321. "qstring" : [
  322. {
  323. token : "constant.language.escape",
  324. regex : escapedRe
  325. }, {
  326. token : "string",
  327. regex : "\\\\$",
  328. consumeLineEnd : true
  329. }, {
  330. token : "string",
  331. regex : "'|$",
  332. next : "no_regex"
  333. }, {
  334. defaultToken: "string"
  335. }
  336. ]
  337. };
  338. if (!options || !options.noES6) {
  339. this.$rules.no_regex.unshift({
  340. regex: "[{}]", onMatch: function(val, state, stack) {
  341. this.next = val == "{" ? this.nextState : "";
  342. if (val == "{" && stack.length) {
  343. stack.unshift("start", state);
  344. }
  345. else if (val == "}" && stack.length) {
  346. stack.shift();
  347. this.next = stack.shift();
  348. if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
  349. return "paren.quasi.end";
  350. }
  351. return val == "{" ? "paren.lparen" : "paren.rparen";
  352. },
  353. nextState: "start"
  354. }, {
  355. token : "string.quasi.start",
  356. regex : /`/,
  357. push : [{
  358. token : "constant.language.escape",
  359. regex : escapedRe
  360. }, {
  361. token : "paren.quasi.start",
  362. regex : /\${/,
  363. push : "start"
  364. }, {
  365. token : "string.quasi.end",
  366. regex : /`/,
  367. next : "pop"
  368. }, {
  369. defaultToken: "string.quasi"
  370. }]
  371. });
  372. if (!options || options.jsx != false)
  373. JSX.call(this);
  374. }
  375. this.embedRules(DocCommentHighlightRules, "doc-",
  376. [ DocCommentHighlightRules.getEndRule("no_regex") ]);
  377. this.normalizeRules();
  378. };
  379. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  380. function JSX() {
  381. var tagRegex = identifierRe.replace("\\d", "\\d\\-");
  382. var jsxTag = {
  383. onMatch : function(val, state, stack) {
  384. var offset = val.charAt(1) == "/" ? 2 : 1;
  385. if (offset == 1) {
  386. if (state != this.nextState)
  387. stack.unshift(this.next, this.nextState, 0);
  388. else
  389. stack.unshift(this.next);
  390. stack[2]++;
  391. } else if (offset == 2) {
  392. if (state == this.nextState) {
  393. stack[1]--;
  394. if (!stack[1] || stack[1] < 0) {
  395. stack.shift();
  396. stack.shift();
  397. }
  398. }
  399. }
  400. return [{
  401. type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
  402. value: val.slice(0, offset)
  403. }, {
  404. type: "meta.tag.tag-name.xml",
  405. value: val.substr(offset)
  406. }];
  407. },
  408. regex : "</?" + tagRegex + "",
  409. next: "jsxAttributes",
  410. nextState: "jsx"
  411. };
  412. this.$rules.start.unshift(jsxTag);
  413. var jsxJsRule = {
  414. regex: "{",
  415. token: "paren.quasi.start",
  416. push: "start"
  417. };
  418. this.$rules.jsx = [
  419. jsxJsRule,
  420. jsxTag,
  421. {include : "reference"},
  422. {defaultToken: "string"}
  423. ];
  424. this.$rules.jsxAttributes = [{
  425. token : "meta.tag.punctuation.tag-close.xml",
  426. regex : "/?>",
  427. onMatch : function(value, currentState, stack) {
  428. if (currentState == stack[0])
  429. stack.shift();
  430. if (value.length == 2) {
  431. if (stack[0] == this.nextState)
  432. stack[1]--;
  433. if (!stack[1] || stack[1] < 0) {
  434. stack.splice(0, 2);
  435. }
  436. }
  437. this.next = stack[0] || "start";
  438. return [{type: this.token, value: value}];
  439. },
  440. nextState: "jsx"
  441. },
  442. jsxJsRule,
  443. comments("jsxAttributes"),
  444. {
  445. token : "entity.other.attribute-name.xml",
  446. regex : tagRegex
  447. }, {
  448. token : "keyword.operator.attribute-equals.xml",
  449. regex : "="
  450. }, {
  451. token : "text.tag-whitespace.xml",
  452. regex : "\\s+"
  453. }, {
  454. token : "string.attribute-value.xml",
  455. regex : "'",
  456. stateName : "jsx_attr_q",
  457. push : [
  458. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  459. {include : "reference"},
  460. {defaultToken : "string.attribute-value.xml"}
  461. ]
  462. }, {
  463. token : "string.attribute-value.xml",
  464. regex : '"',
  465. stateName : "jsx_attr_qq",
  466. push : [
  467. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  468. {include : "reference"},
  469. {defaultToken : "string.attribute-value.xml"}
  470. ]
  471. },
  472. jsxTag
  473. ];
  474. this.$rules.reference = [{
  475. token : "constant.language.escape.reference.xml",
  476. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  477. }];
  478. }
  479. function comments(next) {
  480. return [
  481. {
  482. token : "comment", // multi line comment
  483. regex : /\/\*/,
  484. next: [
  485. DocCommentHighlightRules.getTagRule(),
  486. {token : "comment", regex : "\\*\\/", next : next || "pop"},
  487. {defaultToken : "comment", caseInsensitive: true}
  488. ]
  489. }, {
  490. token : "comment",
  491. regex : "\\/\\/",
  492. next: [
  493. DocCommentHighlightRules.getTagRule(),
  494. {token : "comment", regex : "$|^", next : next || "pop"},
  495. {defaultToken : "comment", caseInsensitive: true}
  496. ]
  497. }
  498. ];
  499. }
  500. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  501. });
  502. ace.define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) {
  503. "use strict";
  504. var oop = require("../lib/oop");
  505. var lang = require("../lib/lang");
  506. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  507. 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";
  508. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  509. 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";
  510. 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";
  511. 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";
  512. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+))";
  513. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  514. 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";
  515. var CssHighlightRules = function() {
  516. var keywordMapper = this.createKeywordMapper({
  517. "support.function": supportFunction,
  518. "support.constant": supportConstant,
  519. "support.type": supportType,
  520. "support.constant.color": supportConstantColor,
  521. "support.constant.fonts": supportConstantFonts
  522. }, "text", true);
  523. this.$rules = {
  524. "start" : [{
  525. include : ["strings", "url", "comments"]
  526. }, {
  527. token: "paren.lparen",
  528. regex: "\\{",
  529. next: "ruleset"
  530. }, {
  531. token: "paren.rparen",
  532. regex: "\\}"
  533. }, {
  534. token: "string",
  535. regex: "@(?!viewport)",
  536. next: "media"
  537. }, {
  538. token: "keyword",
  539. regex: "#[a-z0-9-_]+"
  540. }, {
  541. token: "keyword",
  542. regex: "%"
  543. }, {
  544. token: "variable",
  545. regex: "\\.[a-z0-9-_]+"
  546. }, {
  547. token: "string",
  548. regex: ":[a-z0-9-_]+"
  549. }, {
  550. token : "constant.numeric",
  551. regex : numRe
  552. }, {
  553. token: "constant",
  554. regex: "[a-z0-9-_]+"
  555. }, {
  556. caseInsensitive: true
  557. }],
  558. "media": [{
  559. include : ["strings", "url", "comments"]
  560. }, {
  561. token: "paren.lparen",
  562. regex: "\\{",
  563. next: "start"
  564. }, {
  565. token: "paren.rparen",
  566. regex: "\\}",
  567. next: "start"
  568. }, {
  569. token: "string",
  570. regex: ";",
  571. next: "start"
  572. }, {
  573. token: "keyword",
  574. regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
  575. + "|page|font|keyframes|viewport|counter-style|font-feature-values"
  576. + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
  577. }],
  578. "comments" : [{
  579. token: "comment", // multi line comment
  580. regex: "\\/\\*",
  581. push: [{
  582. token : "comment",
  583. regex : "\\*\\/",
  584. next : "pop"
  585. }, {
  586. defaultToken : "comment"
  587. }]
  588. }],
  589. "ruleset" : [{
  590. regex : "-(webkit|ms|moz|o)-",
  591. token : "text"
  592. }, {
  593. token : "punctuation.operator",
  594. regex : "[:;]"
  595. }, {
  596. token : "paren.rparen",
  597. regex : "\\}",
  598. next : "start"
  599. }, {
  600. include : ["strings", "url", "comments"]
  601. }, {
  602. token : ["constant.numeric", "keyword"],
  603. 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|%)"
  604. }, {
  605. token : "constant.numeric",
  606. regex : numRe
  607. }, {
  608. token : "constant.numeric", // hex6 color
  609. regex : "#[a-f0-9]{6}"
  610. }, {
  611. token : "constant.numeric", // hex3 color
  612. regex : "#[a-f0-9]{3}"
  613. }, {
  614. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  615. regex : pseudoElements
  616. }, {
  617. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  618. regex : pseudoClasses
  619. }, {
  620. include: "url"
  621. }, {
  622. token : keywordMapper,
  623. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  624. }, {
  625. caseInsensitive: true
  626. }],
  627. url: [{
  628. token : "support.function",
  629. regex : "(?:url(:?-prefix)?|domain|regexp)\\(",
  630. push: [{
  631. token : "support.function",
  632. regex : "\\)",
  633. next : "pop"
  634. }, {
  635. defaultToken: "string"
  636. }]
  637. }],
  638. strings: [{
  639. token : "string.start",
  640. regex : "'",
  641. push : [{
  642. token : "string.end",
  643. regex : "'|$",
  644. next: "pop"
  645. }, {
  646. include : "escapes"
  647. }, {
  648. token : "constant.language.escape",
  649. regex : /\\$/,
  650. consumeLineEnd: true
  651. }, {
  652. defaultToken: "string"
  653. }]
  654. }, {
  655. token : "string.start",
  656. regex : '"',
  657. push : [{
  658. token : "string.end",
  659. regex : '"|$',
  660. next: "pop"
  661. }, {
  662. include : "escapes"
  663. }, {
  664. token : "constant.language.escape",
  665. regex : /\\$/,
  666. consumeLineEnd: true
  667. }, {
  668. defaultToken: "string"
  669. }]
  670. }],
  671. escapes: [{
  672. token : "constant.language.escape",
  673. regex : /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
  674. }]
  675. };
  676. this.normalizeRules();
  677. };
  678. oop.inherits(CssHighlightRules, TextHighlightRules);
  679. exports.CssHighlightRules = CssHighlightRules;
  680. });
  681. ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  682. "use strict";
  683. var oop = require("../lib/oop");
  684. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  685. var XmlHighlightRules = function(normalize) {
  686. var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
  687. this.$rules = {
  688. start : [
  689. {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
  690. {
  691. token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
  692. regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction"
  693. },
  694. {token : "comment.start.xml", regex : "<\\!--", next : "comment"},
  695. {
  696. token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  697. regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
  698. },
  699. {include : "tag"},
  700. {token : "text.end-tag-open.xml", regex: "</"},
  701. {token : "text.tag-open.xml", regex: "<"},
  702. {include : "reference"},
  703. {defaultToken : "text.xml"}
  704. ],
  705. processing_instruction : [{
  706. token : "entity.other.attribute-name.decl-attribute-name.xml",
  707. regex : tagRegex
  708. }, {
  709. token : "keyword.operator.decl-attribute-equals.xml",
  710. regex : "="
  711. }, {
  712. include: "whitespace"
  713. }, {
  714. include: "string"
  715. }, {
  716. token : "punctuation.xml-decl.xml",
  717. regex : "\\?>",
  718. next : "start"
  719. }],
  720. doctype : [
  721. {include : "whitespace"},
  722. {include : "string"},
  723. {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
  724. {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
  725. {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
  726. ],
  727. int_subset : [{
  728. token : "text.xml",
  729. regex : "\\s+"
  730. }, {
  731. token: "punctuation.int-subset.xml",
  732. regex: "]",
  733. next: "pop"
  734. }, {
  735. token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  736. regex : "(<\\!)(" + tagRegex + ")",
  737. push : [{
  738. token : "text",
  739. regex : "\\s+"
  740. },
  741. {
  742. token : "punctuation.markup-decl.xml",
  743. regex : ">",
  744. next : "pop"
  745. },
  746. {include : "string"}]
  747. }],
  748. cdata : [
  749. {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
  750. {token : "text.xml", regex : "\\s+"},
  751. {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
  752. ],
  753. comment : [
  754. {token : "comment.end.xml", regex : "-->", next : "start"},
  755. {defaultToken : "comment.xml"}
  756. ],
  757. reference : [{
  758. token : "constant.language.escape.reference.xml",
  759. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  760. }],
  761. attr_reference : [{
  762. token : "constant.language.escape.reference.attribute-value.xml",
  763. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  764. }],
  765. tag : [{
  766. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  767. regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
  768. next: [
  769. {include : "attributes"},
  770. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  771. ]
  772. }],
  773. tag_whitespace : [
  774. {token : "text.tag-whitespace.xml", regex : "\\s+"}
  775. ],
  776. whitespace : [
  777. {token : "text.whitespace.xml", regex : "\\s+"}
  778. ],
  779. string: [{
  780. token : "string.xml",
  781. regex : "'",
  782. push : [
  783. {token : "string.xml", regex: "'", next: "pop"},
  784. {defaultToken : "string.xml"}
  785. ]
  786. }, {
  787. token : "string.xml",
  788. regex : '"',
  789. push : [
  790. {token : "string.xml", regex: '"', next: "pop"},
  791. {defaultToken : "string.xml"}
  792. ]
  793. }],
  794. attributes: [{
  795. token : "entity.other.attribute-name.xml",
  796. regex : tagRegex
  797. }, {
  798. token : "keyword.operator.attribute-equals.xml",
  799. regex : "="
  800. }, {
  801. include: "tag_whitespace"
  802. }, {
  803. include: "attribute_value"
  804. }],
  805. attribute_value: [{
  806. token : "string.attribute-value.xml",
  807. regex : "'",
  808. push : [
  809. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  810. {include : "attr_reference"},
  811. {defaultToken : "string.attribute-value.xml"}
  812. ]
  813. }, {
  814. token : "string.attribute-value.xml",
  815. regex : '"',
  816. push : [
  817. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  818. {include : "attr_reference"},
  819. {defaultToken : "string.attribute-value.xml"}
  820. ]
  821. }]
  822. };
  823. if (this.constructor === XmlHighlightRules)
  824. this.normalizeRules();
  825. };
  826. (function() {
  827. this.embedTagRules = function(HighlightRules, prefix, tag){
  828. this.$rules.tag.unshift({
  829. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  830. regex : "(<)(" + tag + "(?=\\s|>|$))",
  831. next: [
  832. {include : "attributes"},
  833. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
  834. ]
  835. });
  836. this.$rules[tag + "-end"] = [
  837. {include : "attributes"},
  838. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
  839. onMatch : function(value, currentState, stack) {
  840. stack.splice(0);
  841. return this.token;
  842. }}
  843. ];
  844. this.embedRules(HighlightRules, prefix, [{
  845. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  846. regex : "(</)(" + tag + "(?=\\s|>|$))",
  847. next: tag + "-end"
  848. }, {
  849. token: "string.cdata.xml",
  850. regex : "<\\!\\[CDATA\\["
  851. }, {
  852. token: "string.cdata.xml",
  853. regex : "\\]\\]>"
  854. }]);
  855. };
  856. }).call(TextHighlightRules.prototype);
  857. oop.inherits(XmlHighlightRules, TextHighlightRules);
  858. exports.XmlHighlightRules = XmlHighlightRules;
  859. });
  860. ace.define("ace/mode/html_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/css_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"], function(require, exports, module) {
  861. "use strict";
  862. var oop = require("../lib/oop");
  863. var lang = require("../lib/lang");
  864. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  865. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  866. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  867. var tagMap = lang.createMap({
  868. a : 'anchor',
  869. button : 'form',
  870. form : 'form',
  871. img : 'image',
  872. input : 'form',
  873. label : 'form',
  874. option : 'form',
  875. script : 'script',
  876. select : 'form',
  877. textarea : 'form',
  878. style : 'style',
  879. table : 'table',
  880. tbody : 'table',
  881. td : 'table',
  882. tfoot : 'table',
  883. th : 'table',
  884. tr : 'table'
  885. });
  886. var HtmlHighlightRules = function() {
  887. XmlHighlightRules.call(this);
  888. this.addRules({
  889. attributes: [{
  890. include : "tag_whitespace"
  891. }, {
  892. token : "entity.other.attribute-name.xml",
  893. regex : "[-_a-zA-Z0-9:.]+"
  894. }, {
  895. token : "keyword.operator.attribute-equals.xml",
  896. regex : "=",
  897. push : [{
  898. include: "tag_whitespace"
  899. }, {
  900. token : "string.unquoted.attribute-value.html",
  901. regex : "[^<>='\"`\\s]+",
  902. next : "pop"
  903. }, {
  904. token : "empty",
  905. regex : "",
  906. next : "pop"
  907. }]
  908. }, {
  909. include : "attribute_value"
  910. }],
  911. tag: [{
  912. token : function(start, tag) {
  913. var group = tagMap[tag];
  914. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  915. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  916. },
  917. regex : "(</?)([-_a-zA-Z0-9:.]+)",
  918. next: "tag_stuff"
  919. }],
  920. tag_stuff: [
  921. {include : "attributes"},
  922. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  923. ]
  924. });
  925. this.embedTagRules(CssHighlightRules, "css-", "style");
  926. this.embedTagRules(new JavaScriptHighlightRules({jsx: false}).getRules(), "js-", "script");
  927. if (this.constructor === HtmlHighlightRules)
  928. this.normalizeRules();
  929. };
  930. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  931. exports.HtmlHighlightRules = HtmlHighlightRules;
  932. });
  933. ace.define("ace/mode/markdown_highlight_rules",["require","exports","module","ace/config","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/html_highlight_rules"], function(require, exports, module) {
  934. "use strict";
  935. var modes = require("../config").$modes;
  936. var oop = require("../lib/oop");
  937. var lang = require("../lib/lang");
  938. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  939. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  940. var escaped = function(ch) {
  941. return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*";
  942. };
  943. var MarkdownHighlightRules = function() {
  944. HtmlHighlightRules.call(this);
  945. var codeBlockStartRule = {
  946. token : "support.function",
  947. regex : /^\s*(```+[^`]*|~~~+[^~]*)$/,
  948. onMatch: function(value, state, stack, line) {
  949. var m = value.match(/^(\s*)([`~]+)(.*)/);
  950. var language = /[\w-]+|$/.exec(m[3])[0];
  951. if (!modes[language])
  952. language = "";
  953. stack.unshift("githubblock", [], [m[1], m[2], language], state);
  954. return this.token;
  955. },
  956. next : "githubblock"
  957. };
  958. var codeBlockRules = [{
  959. token : "support.function",
  960. regex : ".*",
  961. onMatch: function(value, state, stack, line) {
  962. var embedState = stack[1];
  963. var indent = stack[2][0];
  964. var endMarker = stack[2][1];
  965. var language = stack[2][2];
  966. var m = /^(\s*)(`+|~+)\s*$/.exec(value);
  967. if (
  968. m && m[1].length < indent.length + 3
  969. && m[2].length >= endMarker.length && m[2][0] == endMarker[0]
  970. ) {
  971. stack.splice(0, 3);
  972. this.next = stack.shift();
  973. return this.token;
  974. }
  975. this.next = "";
  976. if (language && modes[language]) {
  977. var data = modes[language].getTokenizer().getLineTokens(value, embedState.slice(0));
  978. stack[1] = data.state;
  979. return data.tokens;
  980. }
  981. return this.token;
  982. }
  983. }];
  984. this.$rules["start"].unshift({
  985. token : "empty_line",
  986. regex : '^$',
  987. next: "allowBlock"
  988. }, { // h1
  989. token: "markup.heading.1",
  990. regex: "^=+(?=\\s*$)"
  991. }, { // h2
  992. token: "markup.heading.2",
  993. regex: "^\\-+(?=\\s*$)"
  994. }, {
  995. token : function(value) {
  996. return "markup.heading." + value.length;
  997. },
  998. regex : /^#{1,6}(?=\s|$)/,
  999. next : "header"
  1000. },
  1001. codeBlockStartRule,
  1002. { // block quote
  1003. token : "string.blockquote",
  1004. regex : "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  1005. next : "blockquote"
  1006. }, { // HR * - _
  1007. token : "constant",
  1008. regex : "^ {0,3}(?:(?:\\* ?){3,}|(?:\\- ?){3,}|(?:\\_ ?){3,})\\s*$",
  1009. next: "allowBlock"
  1010. }, { // list
  1011. token : "markup.list",
  1012. regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  1013. next : "listblock-start"
  1014. }, {
  1015. include : "basic"
  1016. });
  1017. this.addRules({
  1018. "basic" : [{
  1019. token : "constant.language.escape",
  1020. regex : /\\[\\`*_{}\[\]()#+\-.!]/
  1021. }, { // code span `
  1022. token : "support.function",
  1023. regex : "(`+)(.*?[^`])(\\1)"
  1024. }, { // reference
  1025. token : ["text", "constant", "text", "url", "string", "text"],
  1026. regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
  1027. }, { // link by reference
  1028. token : ["text", "string", "text", "constant", "text"],
  1029. regex : "(\\[)(" + escaped("]") + ")(\\]\\s*\\[)("+ escaped("]") + ")(\\])"
  1030. }, { // link by url
  1031. token : ["text", "string", "text", "markup.underline", "string", "text"],
  1032. regex : "(\\!?\\[)(" + // [
  1033. escaped("]") + // link text or alt text
  1034. ")(\\]\\()"+ // ](
  1035. '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + // href or image
  1036. '(\\s*"' + escaped('"') + '"\\s*)?' + // "title"
  1037. "(\\))" // )
  1038. }, { // strong ** __
  1039. token : "string.strong",
  1040. regex : "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)"
  1041. }, { // emphasis * _
  1042. token : "string.emphasis",
  1043. regex : "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)"
  1044. }, { //
  1045. token : ["text", "url", "text"],
  1046. regex : "(<)("+
  1047. "(?:https?|ftp|dict):[^'\">\\s]+"+
  1048. "|"+
  1049. "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+"+
  1050. ")(>)"
  1051. }],
  1052. "allowBlock": [
  1053. {token : "support.function", regex : "^ {4}.+", next : "allowBlock"},
  1054. {token : "empty_line", regex : '^$', next: "allowBlock"},
  1055. {token : "empty", regex : "", next : "start"}
  1056. ],
  1057. "header" : [{
  1058. regex: "$",
  1059. next : "start"
  1060. }, {
  1061. include: "basic"
  1062. }, {
  1063. defaultToken : "heading"
  1064. } ],
  1065. "listblock-start" : [{
  1066. token : "support.variable",
  1067. regex : /(?:\[[ x]\])?/,
  1068. next : "listblock"
  1069. }],
  1070. "listblock" : [ { // Lists only escape on completely blank lines.
  1071. token : "empty_line",
  1072. regex : "^$",
  1073. next : "start"
  1074. }, { // list
  1075. token : "markup.list",
  1076. regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
  1077. next : "listblock-start"
  1078. }, {
  1079. include : "basic", noEscape: true
  1080. },
  1081. codeBlockStartRule,
  1082. {
  1083. defaultToken : "list" //do not use markup.list to allow stling leading `*` differntly
  1084. } ],
  1085. "blockquote" : [ { // Blockquotes only escape on blank lines.
  1086. token : "empty_line",
  1087. regex : "^\\s*$",
  1088. next : "start"
  1089. }, { // block quote
  1090. token : "string.blockquote",
  1091. regex : "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
  1092. next : "blockquote"
  1093. }, {
  1094. include : "basic", noEscape: true
  1095. }, {
  1096. defaultToken : "string.blockquote"
  1097. } ],
  1098. "githubblock" : codeBlockRules
  1099. });
  1100. this.normalizeRules();
  1101. };
  1102. oop.inherits(MarkdownHighlightRules, TextHighlightRules);
  1103. exports.MarkdownHighlightRules = MarkdownHighlightRules;
  1104. });
  1105. ace.define("ace/mode/mask_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/css_highlight_rules","ace/mode/markdown_highlight_rules","ace/mode/html_highlight_rules"], function(require, exports, module) {
  1106. "use strict";
  1107. exports.MaskHighlightRules = MaskHighlightRules;
  1108. var oop = require("../lib/oop");
  1109. var lang = require("../lib/lang");
  1110. var TextRules = require("./text_highlight_rules").TextHighlightRules;
  1111. var JSRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  1112. var CssRules = require("./css_highlight_rules").CssHighlightRules;
  1113. var MDRules = require("./markdown_highlight_rules").MarkdownHighlightRules;
  1114. var HTMLRules = require("./html_highlight_rules").HtmlHighlightRules;
  1115. var token_TAG = "keyword.support.constant.language",
  1116. token_COMPO = "support.function.markup.bold",
  1117. token_KEYWORD = "keyword",
  1118. token_LANG = "constant.language",
  1119. token_UTIL = "keyword.control.markup.italic",
  1120. token_ATTR = "support.variable.class",
  1121. token_PUNKT = "keyword.operator",
  1122. token_ITALIC = "markup.italic",
  1123. token_BOLD = "markup.bold",
  1124. token_LPARE = "paren.lparen",
  1125. token_RPARE = "paren.rparen";
  1126. var const_FUNCTIONS,
  1127. const_KEYWORDS,
  1128. const_CONST,
  1129. const_TAGS;
  1130. (function(){
  1131. const_FUNCTIONS = lang.arrayToMap(
  1132. ("log").split("|")
  1133. );
  1134. const_CONST = lang.arrayToMap(
  1135. (":dualbind|:bind|:import|slot|event|style|html|markdown|md").split("|")
  1136. );
  1137. const_KEYWORDS = lang.arrayToMap(
  1138. ("debugger|define|var|if|each|for|of|else|switch|case|with|visible|+if|+each|+for|+switch|+with|+visible|include|import").split("|")
  1139. );
  1140. const_TAGS = lang.arrayToMap(
  1141. ("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" +
  1142. "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" +
  1143. "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" +
  1144. "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" +
  1145. "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" +
  1146. "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" +
  1147. "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" +
  1148. "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" +
  1149. "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
  1150. );
  1151. }());
  1152. function MaskHighlightRules () {
  1153. this.$rules = {
  1154. "start" : [
  1155. Token("comment", "\\/\\/.*$"),
  1156. Token("comment", "\\/\\*", [
  1157. Token("comment", ".*?\\*\\/", "start"),
  1158. Token("comment", ".+")
  1159. ]),
  1160. Blocks.string("'''"),
  1161. Blocks.string('"""'),
  1162. Blocks.string('"'),
  1163. Blocks.string("'"),
  1164. Blocks.syntax(/(markdown|md)\b/, "md-multiline", "multiline"),
  1165. Blocks.syntax(/html\b/, "html-multiline", "multiline"),
  1166. Blocks.syntax(/(slot|event)\b/, "js-block", "block"),
  1167. Blocks.syntax(/style\b/, "css-block", "block"),
  1168. Blocks.syntax(/var\b/, "js-statement", "attr"),
  1169. Blocks.tag(),
  1170. Token(token_LPARE, "[[({>]"),
  1171. Token(token_RPARE, "[\\])};]", "start"),
  1172. {
  1173. caseInsensitive: true
  1174. }
  1175. ]
  1176. };
  1177. var rules = this;
  1178. addJavaScript("interpolation", /\]/, token_RPARE + "." + token_ITALIC);
  1179. addJavaScript("statement", /\)|}|;/);
  1180. addJavaScript("block", /\}/);
  1181. addCss();
  1182. addMarkdown();
  1183. addHtml();
  1184. function addJavaScript(name, escape, closeType) {
  1185. var prfx = "js-" + name + "-",
  1186. rootTokens = name === "block" ? ["start"] : ["start", "no_regex"];
  1187. add(
  1188. JSRules
  1189. , prfx
  1190. , escape
  1191. , rootTokens
  1192. , closeType
  1193. );
  1194. }
  1195. function addCss() {
  1196. add(CssRules, "css-block-", /\}/);
  1197. }
  1198. function addMarkdown() {
  1199. add(MDRules, "md-multiline-", /("""|''')/, []);
  1200. }
  1201. function addHtml() {
  1202. add(HTMLRules, "html-multiline-", /("""|''')/);
  1203. }
  1204. function add(Rules, strPrfx, rgxEnd, rootTokens, closeType) {
  1205. var next = "pop";
  1206. var tokens = rootTokens || [ "start" ];
  1207. if (tokens.length === 0) {
  1208. tokens = null;
  1209. }
  1210. if (/block|multiline/.test(strPrfx)) {
  1211. next = strPrfx + "end";
  1212. rules.$rules[next] = [
  1213. Token("empty", "", "start")
  1214. ];
  1215. }
  1216. rules.embedRules(
  1217. Rules
  1218. , strPrfx
  1219. , [ Token(closeType || token_RPARE, rgxEnd, next) ]
  1220. , tokens
  1221. , tokens == null ? true : false
  1222. );
  1223. }
  1224. this.normalizeRules();
  1225. }
  1226. oop.inherits(MaskHighlightRules, TextRules);
  1227. var Blocks = {
  1228. string: function(str, next){
  1229. var token = Token(
  1230. "string.start"
  1231. , str
  1232. , [
  1233. Token(token_LPARE + "." + token_ITALIC, /~\[/, Blocks.interpolation()),
  1234. Token("string.end", str, "pop"),
  1235. {
  1236. defaultToken: "string"
  1237. }
  1238. ]
  1239. , next
  1240. );
  1241. if (str.length === 1){
  1242. var escaped = Token("string.escape", "\\\\" + str);
  1243. token.push.unshift(escaped);
  1244. }
  1245. return token;
  1246. },
  1247. interpolation: function(){
  1248. return [
  1249. Token(token_UTIL, /\s*\w*\s*:/),
  1250. "js-interpolation-start"
  1251. ];
  1252. },
  1253. tagHead: function (rgx) {
  1254. return Token(token_ATTR, rgx, [
  1255. Token(token_ATTR, /[\w\-_]+/),
  1256. Token(token_LPARE + "." + token_ITALIC, /~\[/, Blocks.interpolation()),
  1257. Blocks.goUp()
  1258. ]);
  1259. },
  1260. tag: function () {
  1261. return {
  1262. token: 'tag',
  1263. onMatch : function(value) {
  1264. if (void 0 !== const_KEYWORDS[value])
  1265. return token_KEYWORD;
  1266. if (void 0 !== const_CONST[value])
  1267. return token_LANG;
  1268. if (void 0 !== const_FUNCTIONS[value])
  1269. return "support.function";
  1270. if (void 0 !== const_TAGS[value.toLowerCase()])
  1271. return token_TAG;
  1272. return token_COMPO;
  1273. },
  1274. regex : /([@\w\-_:+]+)|((^|\s)(?=\s*(\.|#)))/,
  1275. push: [
  1276. Blocks.tagHead(/\./) ,
  1277. Blocks.tagHead(/#/) ,
  1278. Blocks.expression(),
  1279. Blocks.attribute(),
  1280. Token(token_LPARE, /[;>{]/, "pop")
  1281. ]
  1282. };
  1283. },
  1284. syntax: function(rgx, next, type){
  1285. return {
  1286. token: token_LANG,
  1287. regex : rgx,
  1288. push: ({
  1289. "attr": [
  1290. next + "-start",
  1291. Token(token_PUNKT, /;/, "start")
  1292. ],
  1293. "multiline": [
  1294. Blocks.tagHead(/\./) ,
  1295. Blocks.tagHead(/#/) ,
  1296. Blocks.attribute(),
  1297. Blocks.expression(),
  1298. Token(token_LPARE, /[>\{]/),
  1299. Token(token_PUNKT, /;/, "start"),
  1300. Token(token_LPARE, /'''|"""/, [ next + "-start" ])
  1301. ],
  1302. "block": [
  1303. Blocks.tagHead(/\./) ,
  1304. Blocks.tagHead(/#/) ,
  1305. Blocks.attribute(),
  1306. Blocks.expression(),
  1307. Token(token_LPARE, /\{/, [ next + "-start" ])
  1308. ]
  1309. })[type]
  1310. };
  1311. },
  1312. attribute: function(){
  1313. return Token(function(value){
  1314. return /^x\-/.test(value)
  1315. ? token_ATTR + "." + token_BOLD
  1316. : token_ATTR;
  1317. }, /[\w_-]+/, [
  1318. Token(token_PUNKT, /\s*=\s*/, [
  1319. Blocks.string('"'),
  1320. Blocks.string("'"),
  1321. Blocks.word(),
  1322. Blocks.goUp()
  1323. ]),
  1324. Blocks.goUp()
  1325. ]);
  1326. },
  1327. expression: function(){
  1328. return Token(token_LPARE, /\(/, [ "js-statement-start" ]);
  1329. },
  1330. word: function(){
  1331. return Token("string", /[\w-_]+/);
  1332. },
  1333. goUp: function(){
  1334. return Token("text", "", "pop");
  1335. },
  1336. goStart: function(){
  1337. return Token("text", "", "start");
  1338. }
  1339. };
  1340. function Token(token, rgx, mix) {
  1341. var push, next, onMatch;
  1342. if (arguments.length === 4) {
  1343. push = mix;
  1344. next = arguments[3];
  1345. }
  1346. else if (typeof mix === "string") {
  1347. next = mix;
  1348. }
  1349. else {
  1350. push = mix;
  1351. }
  1352. if (typeof token === "function") {
  1353. onMatch = token;
  1354. token = "empty";
  1355. }
  1356. return {
  1357. token: token,
  1358. regex: rgx,
  1359. push: push,
  1360. next: next,
  1361. onMatch: onMatch
  1362. };
  1363. }
  1364. });
  1365. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
  1366. "use strict";
  1367. var Range = require("../range").Range;
  1368. var MatchingBraceOutdent = function() {};
  1369. (function() {
  1370. this.checkOutdent = function(line, input) {
  1371. if (! /^\s+$/.test(line))
  1372. return false;
  1373. return /^\s*\}/.test(input);
  1374. };
  1375. this.autoOutdent = function(doc, row) {
  1376. var line = doc.getLine(row);
  1377. var match = line.match(/^(\s*\})/);
  1378. if (!match) return 0;
  1379. var column = match[1].length;
  1380. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  1381. if (!openBracePos || openBracePos.row == row) return 0;
  1382. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  1383. doc.replace(new Range(row, 0, row, column-1), indent);
  1384. };
  1385. this.$getIndent = function(line) {
  1386. return line.match(/^\s*/)[0];
  1387. };
  1388. }).call(MatchingBraceOutdent.prototype);
  1389. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  1390. });
  1391. ace.define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(require, exports, module) {
  1392. "use strict";
  1393. var oop = require("../../lib/oop");
  1394. var Behaviour = require("../behaviour").Behaviour;
  1395. var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
  1396. var TokenIterator = require("../../token_iterator").TokenIterator;
  1397. var CssBehaviour = function () {
  1398. this.inherit(CstyleBehaviour);
  1399. this.add("colon", "insertion", function (state, action, editor, session, text) {
  1400. if (text === ':' && editor.selection.isEmpty()) {
  1401. var cursor = editor.getCursorPosition();
  1402. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1403. var token = iterator.getCurrentToken();
  1404. if (token && token.value.match(/\s+/)) {
  1405. token = iterator.stepBackward();
  1406. }
  1407. if (token && token.type === 'support.type') {
  1408. var line = session.doc.getLine(cursor.row);
  1409. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1410. if (rightChar === ':') {
  1411. return {
  1412. text: '',
  1413. selection: [1, 1]
  1414. };
  1415. }
  1416. if (/^(\s+[^;]|\s*$)/.test(line.substring(cursor.column))) {
  1417. return {
  1418. text: ':;',
  1419. selection: [1, 1]
  1420. };
  1421. }
  1422. }
  1423. }
  1424. });
  1425. this.add("colon", "deletion", function (state, action, editor, session, range) {
  1426. var selected = session.doc.getTextRange(range);
  1427. if (!range.isMultiLine() && selected === ':') {
  1428. var cursor = editor.getCursorPosition();
  1429. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1430. var token = iterator.getCurrentToken();
  1431. if (token && token.value.match(/\s+/)) {
  1432. token = iterator.stepBackward();
  1433. }
  1434. if (token && token.type === 'support.type') {
  1435. var line = session.doc.getLine(range.start.row);
  1436. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1437. if (rightChar === ';') {
  1438. range.end.column ++;
  1439. return range;
  1440. }
  1441. }
  1442. }
  1443. });
  1444. this.add("semicolon", "insertion", function (state, action, editor, session, text) {
  1445. if (text === ';' && editor.selection.isEmpty()) {
  1446. var cursor = editor.getCursorPosition();
  1447. var line = session.doc.getLine(cursor.row);
  1448. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1449. if (rightChar === ';') {
  1450. return {
  1451. text: '',
  1452. selection: [1, 1]
  1453. };
  1454. }
  1455. }
  1456. });
  1457. this.add("!important", "insertion", function (state, action, editor, session, text) {
  1458. if (text === '!' && editor.selection.isEmpty()) {
  1459. var cursor = editor.getCursorPosition();
  1460. var line = session.doc.getLine(cursor.row);
  1461. if (/^\s*(;|}|$)/.test(line.substring(cursor.column))) {
  1462. return {
  1463. text: '!important',
  1464. selection: [10, 10]
  1465. };
  1466. }
  1467. }
  1468. });
  1469. };
  1470. oop.inherits(CssBehaviour, CstyleBehaviour);
  1471. exports.CssBehaviour = CssBehaviour;
  1472. });
  1473. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
  1474. "use strict";
  1475. var oop = require("../../lib/oop");
  1476. var Range = require("../../range").Range;
  1477. var BaseFoldMode = require("./fold_mode").FoldMode;
  1478. var FoldMode = exports.FoldMode = function(commentRegex) {
  1479. if (commentRegex) {
  1480. this.foldingStartMarker = new RegExp(
  1481. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  1482. );
  1483. this.foldingStopMarker = new RegExp(
  1484. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  1485. );
  1486. }
  1487. };
  1488. oop.inherits(FoldMode, BaseFoldMode);
  1489. (function() {
  1490. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  1491. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  1492. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  1493. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  1494. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  1495. this._getFoldWidgetBase = this.getFoldWidget;
  1496. this.getFoldWidget = function(session, foldStyle, row) {
  1497. var line = session.getLine(row);
  1498. if (this.singleLineBlockCommentRe.test(line)) {
  1499. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  1500. return "";
  1501. }
  1502. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  1503. if (!fw && this.startRegionRe.test(line))
  1504. return "start"; // lineCommentRegionStart
  1505. return fw;
  1506. };
  1507. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  1508. var line = session.getLine(row);
  1509. if (this.startRegionRe.test(line))
  1510. return this.getCommentRegionBlock(session, line, row);
  1511. var match = line.match(this.foldingStartMarker);
  1512. if (match) {
  1513. var i = match.index;
  1514. if (match[1])
  1515. return this.openingBracketBlock(session, match[1], row, i);
  1516. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  1517. if (range && !range.isMultiLine()) {
  1518. if (forceMultiline) {
  1519. range = this.getSectionRange(session, row);
  1520. } else if (foldStyle != "all")
  1521. range = null;
  1522. }
  1523. return range;
  1524. }
  1525. if (foldStyle === "markbegin")
  1526. return;
  1527. var match = line.match(this.foldingStopMarker);
  1528. if (match) {
  1529. var i = match.index + match[0].length;
  1530. if (match[1])
  1531. return this.closingBracketBlock(session, match[1], row, i);
  1532. return session.getCommentFoldRange(row, i, -1);
  1533. }
  1534. };
  1535. this.getSectionRange = function(session, row) {
  1536. var line = session.getLine(row);
  1537. var startIndent = line.search(/\S/);
  1538. var startRow = row;
  1539. var startColumn = line.length;
  1540. row = row + 1;
  1541. var endRow = row;
  1542. var maxRow = session.getLength();
  1543. while (++row < maxRow) {
  1544. line = session.getLine(row);
  1545. var indent = line.search(/\S/);
  1546. if (indent === -1)
  1547. continue;
  1548. if (startIndent > indent)
  1549. break;
  1550. var subRange = this.getFoldWidgetRange(session, "all", row);
  1551. if (subRange) {
  1552. if (subRange.start.row <= startRow) {
  1553. break;
  1554. } else if (subRange.isMultiLine()) {
  1555. row = subRange.end.row;
  1556. } else if (startIndent == indent) {
  1557. break;
  1558. }
  1559. }
  1560. endRow = row;
  1561. }
  1562. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  1563. };
  1564. this.getCommentRegionBlock = function(session, line, row) {
  1565. var startColumn = line.search(/\s*$/);
  1566. var maxRow = session.getLength();
  1567. var startRow = row;
  1568. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  1569. var depth = 1;
  1570. while (++row < maxRow) {
  1571. line = session.getLine(row);
  1572. var m = re.exec(line);
  1573. if (!m) continue;
  1574. if (m[1]) depth--;
  1575. else depth++;
  1576. if (!depth) break;
  1577. }
  1578. var endRow = row;
  1579. if (endRow > startRow) {
  1580. return new Range(startRow, startColumn, endRow, line.length);
  1581. }
  1582. };
  1583. }).call(FoldMode.prototype);
  1584. });
  1585. ace.define("ace/mode/mask",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/mask_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module) {
  1586. "use strict";
  1587. var oop = require("../lib/oop");
  1588. var TextMode = require("./text").Mode;
  1589. var MaskHighlightRules = require("./mask_highlight_rules").MaskHighlightRules;
  1590. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1591. var CssBehaviour = require("./behaviour/css").CssBehaviour;
  1592. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1593. var Mode = function() {
  1594. this.HighlightRules = MaskHighlightRules;
  1595. this.$outdent = new MatchingBraceOutdent();
  1596. this.$behaviour = new CssBehaviour();
  1597. this.foldingRules = new CStyleFoldMode();
  1598. };
  1599. oop.inherits(Mode, TextMode);
  1600. (function() {
  1601. this.lineCommentStart = "//";
  1602. this.blockComment = {start: "/*", end: "*/"};
  1603. this.getNextLineIndent = function(state, line, tab) {
  1604. var indent = this.$getIndent(line);
  1605. var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
  1606. if (tokens.length && tokens[tokens.length-1].type == "comment") {
  1607. return indent;
  1608. }
  1609. var match = line.match(/^.*\{\s*$/);
  1610. if (match) {
  1611. indent += tab;
  1612. }
  1613. return indent;
  1614. };
  1615. this.checkOutdent = function(state, line, input) {
  1616. return this.$outdent.checkOutdent(line, input);
  1617. };
  1618. this.autoOutdent = function(state, doc, row) {
  1619. this.$outdent.autoOutdent(doc, row);
  1620. };
  1621. this.$id = "ace/mode/mask";
  1622. }).call(Mode.prototype);
  1623. exports.Mode = Mode;
  1624. }); (function() {
  1625. ace.require(["ace/mode/mask"], function(m) {
  1626. if (typeof module == "object" && typeof exports == "object" && module) {
  1627. module.exports = m;
  1628. }
  1629. });
  1630. })();