7bdcb2c0abebee28dea0752a4a53ec8d.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. ace.define("ace/mode/elixir_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){/* This file was autogenerated from https://raw.githubusercontent.com/elixir-lang/elixir-tmbundle/master/Syntaxes/Elixir.tmLanguage (uuid: ) */
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  5. var ElixirHighlightRules = function () {
  6. this.$rules = { start: [{ token: ['meta.module.elixir',
  7. 'keyword.control.module.elixir',
  8. 'meta.module.elixir',
  9. 'entity.name.type.module.elixir'],
  10. regex: '^(\\s*)(defmodule)(\\s+)((?:[A-Z]\\w*\\s*\\.\\s*)*[A-Z]\\w*)' },
  11. { token: 'comment.documentation.heredoc',
  12. regex: '@(?:module|type)?doc (?:~[a-z])?"""',
  13. push: [{ token: 'comment.documentation.heredoc',
  14. regex: '\\s*"""',
  15. next: 'pop' },
  16. { include: '#interpolated_elixir' },
  17. { include: '#escaped_char' },
  18. { defaultToken: 'comment.documentation.heredoc' }],
  19. comment: '@doc with heredocs is treated as documentation' },
  20. { token: 'comment.documentation.heredoc',
  21. regex: '@(?:module|type)?doc ~[A-Z]"""',
  22. push: [{ token: 'comment.documentation.heredoc',
  23. regex: '\\s*"""',
  24. next: 'pop' },
  25. { defaultToken: 'comment.documentation.heredoc' }],
  26. comment: '@doc with heredocs is treated as documentation' },
  27. { token: 'comment.documentation.heredoc',
  28. regex: '@(?:module|type)?doc (?:~[a-z])?\'\'\'',
  29. push: [{ token: 'comment.documentation.heredoc',
  30. regex: '\\s*\'\'\'',
  31. next: 'pop' },
  32. { include: '#interpolated_elixir' },
  33. { include: '#escaped_char' },
  34. { defaultToken: 'comment.documentation.heredoc' }],
  35. comment: '@doc with heredocs is treated as documentation' },
  36. { token: 'comment.documentation.heredoc',
  37. regex: '@(?:module|type)?doc ~[A-Z]\'\'\'',
  38. push: [{ token: 'comment.documentation.heredoc',
  39. regex: '\\s*\'\'\'',
  40. next: 'pop' },
  41. { defaultToken: 'comment.documentation.heredoc' }],
  42. comment: '@doc with heredocs is treated as documentation' },
  43. { token: 'comment.documentation.false',
  44. regex: '@(?:module|type)?doc false',
  45. comment: '@doc false is treated as documentation' },
  46. { token: 'comment.documentation.string',
  47. regex: '@(?:module|type)?doc "',
  48. push: [{ token: 'comment.documentation.string',
  49. regex: '"',
  50. next: 'pop' },
  51. { include: '#interpolated_elixir' },
  52. { include: '#escaped_char' },
  53. { defaultToken: 'comment.documentation.string' }],
  54. comment: '@doc with string is treated as documentation' },
  55. { token: 'keyword.control.elixir',
  56. regex: '\\b(?:do|end|case|bc|lc|for|if|cond|unless|try|receive|fn|defmodule|defp?|defprotocol|defimpl|defrecord|defstruct|defmacrop?|defdelegate|defcallback|defmacrocallback|defexception|defoverridable|exit|after|rescue|catch|else|raise|throw|import|require|alias|use|quote|unquote|super)\\b(?![?!])',
  57. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  58. originalRegex: '(?<!\\.)\\b(do|end|case|bc|lc|for|if|cond|unless|try|receive|fn|defmodule|defp?|defprotocol|defimpl|defrecord|defstruct|defmacrop?|defdelegate|defcallback|defmacrocallback|defexception|defoverridable|exit|after|rescue|catch|else|raise|throw|import|require|alias|use|quote|unquote|super)\\b(?![?!])' },
  59. { token: 'keyword.operator.elixir',
  60. regex: '\\b(?:and|not|or|when|xor|in|inlist|inbits)\\b',
  61. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  62. originalRegex: '(?<!\\.)\\b(and|not|or|when|xor|in|inlist|inbits)\\b',
  63. comment: ' as above, just doesn\'t need a \'end\' and does a logic operation' },
  64. { token: 'constant.language.elixir',
  65. regex: '\\b(?:nil|true|false)\\b(?![?!])' },
  66. { token: 'variable.language.elixir',
  67. regex: '\\b__(?:CALLER|ENV|MODULE|DIR)__\\b(?![?!])' },
  68. { token: ['punctuation.definition.variable.elixir',
  69. 'variable.other.readwrite.module.elixir'],
  70. regex: '(@)([a-zA-Z_]\\w*)' },
  71. { token: ['punctuation.definition.variable.elixir',
  72. 'variable.other.anonymous.elixir'],
  73. regex: '(&)(\\d*)' },
  74. { token: 'variable.other.constant.elixir',
  75. regex: '\\b[A-Z]\\w*\\b' },
  76. { token: 'constant.numeric.elixir',
  77. regex: '\\b(?:0x[\\da-fA-F](?:_?[\\da-fA-F])*|\\d(?:_?\\d)*(?:\\.(?![^[:space:][:digit:]])(?:_?\\d)*)?(?:[eE][-+]?\\d(?:_?\\d)*)?|0b[01]+|0o[0-7]+)\\b',
  78. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  79. originalRegex: '\\b(0x\\h(?>_?\\h)*|\\d(?>_?\\d)*(\\.(?![^[:space:][:digit:]])(?>_?\\d)*)?([eE][-+]?\\d(?>_?\\d)*)?|0b[01]+|0o[0-7]+)\\b' },
  80. { token: 'punctuation.definition.constant.elixir',
  81. regex: ':\'',
  82. push: [{ token: 'punctuation.definition.constant.elixir',
  83. regex: '\'',
  84. next: 'pop' },
  85. { include: '#interpolated_elixir' },
  86. { include: '#escaped_char' },
  87. { defaultToken: 'constant.other.symbol.single-quoted.elixir' }] },
  88. { token: 'punctuation.definition.constant.elixir',
  89. regex: ':"',
  90. push: [{ token: 'punctuation.definition.constant.elixir',
  91. regex: '"',
  92. next: 'pop' },
  93. { include: '#interpolated_elixir' },
  94. { include: '#escaped_char' },
  95. { defaultToken: 'constant.other.symbol.double-quoted.elixir' }] },
  96. { token: 'punctuation.definition.string.begin.elixir',
  97. regex: '(?:\'\'\')',
  98. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  99. originalRegex: '(?>\'\'\')',
  100. push: [{ token: 'punctuation.definition.string.end.elixir',
  101. regex: '^\\s*\'\'\'',
  102. next: 'pop' },
  103. { include: '#interpolated_elixir' },
  104. { include: '#escaped_char' },
  105. { defaultToken: 'support.function.variable.quoted.single.heredoc.elixir' }],
  106. comment: 'Single-quoted heredocs' },
  107. { token: 'punctuation.definition.string.begin.elixir',
  108. regex: '\'',
  109. push: [{ token: 'punctuation.definition.string.end.elixir',
  110. regex: '\'',
  111. next: 'pop' },
  112. { include: '#interpolated_elixir' },
  113. { include: '#escaped_char' },
  114. { defaultToken: 'support.function.variable.quoted.single.elixir' }],
  115. comment: 'single quoted string (allows for interpolation)' },
  116. { token: 'punctuation.definition.string.begin.elixir',
  117. regex: '(?:""")',
  118. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  119. originalRegex: '(?>""")',
  120. push: [{ token: 'punctuation.definition.string.end.elixir',
  121. regex: '^\\s*"""',
  122. next: 'pop' },
  123. { include: '#interpolated_elixir' },
  124. { include: '#escaped_char' },
  125. { defaultToken: 'string.quoted.double.heredoc.elixir' }],
  126. comment: 'Double-quoted heredocs' },
  127. { token: 'punctuation.definition.string.begin.elixir',
  128. regex: '"',
  129. push: [{ token: 'punctuation.definition.string.end.elixir',
  130. regex: '"',
  131. next: 'pop' },
  132. { include: '#interpolated_elixir' },
  133. { include: '#escaped_char' },
  134. { defaultToken: 'string.quoted.double.elixir' }],
  135. comment: 'double quoted string (allows for interpolation)' },
  136. { token: 'punctuation.definition.string.begin.elixir',
  137. regex: '~[a-z](?:""")',
  138. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  139. originalRegex: '~[a-z](?>""")',
  140. push: [{ token: 'punctuation.definition.string.end.elixir',
  141. regex: '^\\s*"""',
  142. next: 'pop' },
  143. { include: '#interpolated_elixir' },
  144. { include: '#escaped_char' },
  145. { defaultToken: 'string.quoted.double.heredoc.elixir' }],
  146. comment: 'Double-quoted heredocs sigils' },
  147. { token: 'punctuation.definition.string.begin.elixir',
  148. regex: '~[a-z]\\{',
  149. push: [{ token: 'punctuation.definition.string.end.elixir',
  150. regex: '\\}[a-z]*',
  151. next: 'pop' },
  152. { include: '#interpolated_elixir' },
  153. { include: '#escaped_char' },
  154. { defaultToken: 'string.interpolated.elixir' }],
  155. comment: 'sigil (allow for interpolation)' },
  156. { token: 'punctuation.definition.string.begin.elixir',
  157. regex: '~[a-z]\\[',
  158. push: [{ token: 'punctuation.definition.string.end.elixir',
  159. regex: '\\][a-z]*',
  160. next: 'pop' },
  161. { include: '#interpolated_elixir' },
  162. { include: '#escaped_char' },
  163. { defaultToken: 'string.interpolated.elixir' }],
  164. comment: 'sigil (allow for interpolation)' },
  165. { token: 'punctuation.definition.string.begin.elixir',
  166. regex: '~[a-z]\\<',
  167. push: [{ token: 'punctuation.definition.string.end.elixir',
  168. regex: '\\>[a-z]*',
  169. next: 'pop' },
  170. { include: '#interpolated_elixir' },
  171. { include: '#escaped_char' },
  172. { defaultToken: 'string.interpolated.elixir' }],
  173. comment: 'sigil (allow for interpolation)' },
  174. { token: 'punctuation.definition.string.begin.elixir',
  175. regex: '~[a-z]\\(',
  176. push: [{ token: 'punctuation.definition.string.end.elixir',
  177. regex: '\\)[a-z]*',
  178. next: 'pop' },
  179. { include: '#interpolated_elixir' },
  180. { include: '#escaped_char' },
  181. { defaultToken: 'string.interpolated.elixir' }],
  182. comment: 'sigil (allow for interpolation)' },
  183. { token: 'punctuation.definition.string.begin.elixir',
  184. regex: '~[a-z][^\\w]',
  185. push: [{ token: 'punctuation.definition.string.end.elixir',
  186. regex: '[^\\w][a-z]*',
  187. next: 'pop' },
  188. { include: '#interpolated_elixir' },
  189. { include: '#escaped_char' },
  190. { include: '#escaped_char' },
  191. { defaultToken: 'string.interpolated.elixir' }],
  192. comment: 'sigil (allow for interpolation)' },
  193. { token: 'punctuation.definition.string.begin.elixir',
  194. regex: '~[A-Z](?:""")',
  195. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  196. originalRegex: '~[A-Z](?>""")',
  197. push: [{ token: 'punctuation.definition.string.end.elixir',
  198. regex: '^\\s*"""',
  199. next: 'pop' },
  200. { defaultToken: 'string.quoted.other.literal.upper.elixir' }],
  201. comment: 'Double-quoted heredocs sigils' },
  202. { token: 'punctuation.definition.string.begin.elixir',
  203. regex: '~[A-Z]\\{',
  204. push: [{ token: 'punctuation.definition.string.end.elixir',
  205. regex: '\\}[a-z]*',
  206. next: 'pop' },
  207. { defaultToken: 'string.quoted.other.literal.upper.elixir' }],
  208. comment: 'sigil (without interpolation)' },
  209. { token: 'punctuation.definition.string.begin.elixir',
  210. regex: '~[A-Z]\\[',
  211. push: [{ token: 'punctuation.definition.string.end.elixir',
  212. regex: '\\][a-z]*',
  213. next: 'pop' },
  214. { defaultToken: 'string.quoted.other.literal.upper.elixir' }],
  215. comment: 'sigil (without interpolation)' },
  216. { token: 'punctuation.definition.string.begin.elixir',
  217. regex: '~[A-Z]\\<',
  218. push: [{ token: 'punctuation.definition.string.end.elixir',
  219. regex: '\\>[a-z]*',
  220. next: 'pop' },
  221. { defaultToken: 'string.quoted.other.literal.upper.elixir' }],
  222. comment: 'sigil (without interpolation)' },
  223. { token: 'punctuation.definition.string.begin.elixir',
  224. regex: '~[A-Z]\\(',
  225. push: [{ token: 'punctuation.definition.string.end.elixir',
  226. regex: '\\)[a-z]*',
  227. next: 'pop' },
  228. { defaultToken: 'string.quoted.other.literal.upper.elixir' }],
  229. comment: 'sigil (without interpolation)' },
  230. { token: 'punctuation.definition.string.begin.elixir',
  231. regex: '~[A-Z][^\\w]',
  232. push: [{ token: 'punctuation.definition.string.end.elixir',
  233. regex: '[^\\w][a-z]*',
  234. next: 'pop' },
  235. { defaultToken: 'string.quoted.other.literal.upper.elixir' }],
  236. comment: 'sigil (without interpolation)' },
  237. { token: ['punctuation.definition.constant.elixir', 'constant.other.symbol.elixir'],
  238. regex: '(:)([a-zA-Z_][\\w@]*(?:[?!]|=(?![>=]))?|\\<\\>|===?|!==?|<<>>|<<<|>>>|~~~|::|<\\-|\\|>|=>|~|~=|=|/|\\\\\\\\|\\*\\*?|\\.\\.?\\.?|>=?|<=?|&&?&?|\\+\\+?|\\-\\-?|\\|\\|?\\|?|\\!|@|\\%?\\{\\}|%|\\[\\]|\\^(?:\\^\\^)?)',
  239. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  240. originalRegex: '(?<!:)(:)(?>[a-zA-Z_][\\w@]*(?>[?!]|=(?![>=]))?|\\<\\>|===?|!==?|<<>>|<<<|>>>|~~~|::|<\\-|\\|>|=>|~|~=|=|/|\\\\\\\\|\\*\\*?|\\.\\.?\\.?|>=?|<=?|&&?&?|\\+\\+?|\\-\\-?|\\|\\|?\\|?|\\!|@|\\%?\\{\\}|%|\\[\\]|\\^(\\^\\^)?)',
  241. comment: 'symbols' },
  242. { token: 'punctuation.definition.constant.elixir',
  243. regex: '(?:[a-zA-Z_][\\w@]*(?:[?!])?):(?!:)',
  244. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  245. originalRegex: '(?>[a-zA-Z_][\\w@]*(?>[?!])?)(:)(?!:)',
  246. comment: 'symbols' },
  247. { token: ['punctuation.definition.comment.elixir',
  248. 'comment.line.number-sign.elixir'],
  249. regex: '(#)(.*)' },
  250. { token: 'constant.numeric.elixir',
  251. regex: '\\?(?:\\\\(?:x[\\da-fA-F]{1,2}(?![\\da-fA-F])\\b|[^xMC])|[^\\s\\\\])',
  252. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  253. originalRegex: '(?<!\\w)\\?(\\\\(x\\h{1,2}(?!\\h)\\b|[^xMC])|[^\\s\\\\])',
  254. comment: '\n\t\t\tmatches questionmark-letters.\n\n\t\t\texamples (1st alternation = hex):\n\t\t\t?\\x1 ?\\x61\n\n\t\t\texamples (2rd alternation = escaped):\n\t\t\t?\\n ?\\b\n\n\t\t\texamples (3rd alternation = normal):\n\t\t\t?a ?A ?0 \n\t\t\t?* ?" ?( \n\t\t\t?. ?#\n\t\t\t\n\t\t\tthe negative lookbehind prevents against matching\n\t\t\tp(42.tainted?)\n\t\t\t' },
  255. { token: 'keyword.operator.assignment.augmented.elixir',
  256. regex: '\\+=|\\-=|\\|\\|=|~=|&&=' },
  257. { token: 'keyword.operator.comparison.elixir',
  258. regex: '===?|!==?|<=?|>=?' },
  259. { token: 'keyword.operator.bitwise.elixir',
  260. regex: '\\|{3}|&{3}|\\^{3}|<{3}|>{3}|~{3}' },
  261. { token: 'keyword.operator.logical.elixir',
  262. regex: '!+|\\bnot\\b|&&|\\band\\b|\\|\\||\\bor\\b|\\bxor\\b',
  263. originalRegex: '(?<=[ \\t])!+|\\bnot\\b|&&|\\band\\b|\\|\\||\\bor\\b|\\bxor\\b' },
  264. { token: 'keyword.operator.arithmetic.elixir',
  265. regex: '\\*|\\+|\\-|/' },
  266. { token: 'keyword.operator.other.elixir',
  267. regex: '\\||\\+\\+|\\-\\-|\\*\\*|\\\\\\\\|\\<\\-|\\<\\>|\\<\\<|\\>\\>|\\:\\:|\\.\\.|\\|>|~|=>' },
  268. { token: 'keyword.operator.assignment.elixir', regex: '=' },
  269. { token: 'punctuation.separator.other.elixir', regex: ':' },
  270. { token: 'punctuation.separator.statement.elixir',
  271. regex: '\\;' },
  272. { token: 'punctuation.separator.object.elixir', regex: ',' },
  273. { token: 'punctuation.separator.method.elixir', regex: '\\.' },
  274. { token: 'punctuation.section.scope.elixir', regex: '\\{|\\}' },
  275. { token: 'punctuation.section.array.elixir', regex: '\\[|\\]' },
  276. { token: 'punctuation.section.function.elixir',
  277. regex: '\\(|\\)' }],
  278. '#escaped_char': [{ token: 'constant.character.escape.elixir',
  279. regex: '\\\\(?:x[\\da-fA-F]{1,2}|.)' }],
  280. '#interpolated_elixir': [{ token: ['source.elixir.embedded.source',
  281. 'source.elixir.embedded.source.empty'],
  282. regex: '(#\\{)(\\})' },
  283. { todo: { token: 'punctuation.section.embedded.elixir',
  284. regex: '#\\{',
  285. push: [{ token: 'punctuation.section.embedded.elixir',
  286. regex: '\\}',
  287. next: 'pop' },
  288. { include: '#nest_curly_and_self' },
  289. { include: '$self' },
  290. { defaultToken: 'source.elixir.embedded.source' }] } }],
  291. '#nest_curly_and_self': [{ token: 'punctuation.section.scope.elixir',
  292. regex: '\\{',
  293. push: [{ token: 'punctuation.section.scope.elixir',
  294. regex: '\\}',
  295. next: 'pop' },
  296. { include: '#nest_curly_and_self' }] },
  297. { include: '$self' }],
  298. '#regex_sub': [{ include: '#interpolated_elixir' },
  299. { include: '#escaped_char' },
  300. { token: ['punctuation.definition.arbitrary-repitition.elixir',
  301. 'string.regexp.arbitrary-repitition.elixir',
  302. 'string.regexp.arbitrary-repitition.elixir',
  303. 'punctuation.definition.arbitrary-repitition.elixir'],
  304. regex: '(\\{)(\\d+)((?:,\\d+)?)(\\})' },
  305. { token: 'punctuation.definition.character-class.elixir',
  306. regex: '\\[(?:\\^?\\])?',
  307. push: [{ token: 'punctuation.definition.character-class.elixir',
  308. regex: '\\]',
  309. next: 'pop' },
  310. { include: '#escaped_char' },
  311. { defaultToken: 'string.regexp.character-class.elixir' }] },
  312. { token: 'punctuation.definition.group.elixir',
  313. regex: '\\(',
  314. push: [{ token: 'punctuation.definition.group.elixir',
  315. regex: '\\)',
  316. next: 'pop' },
  317. { include: '#regex_sub' },
  318. { defaultToken: 'string.regexp.group.elixir' }] },
  319. { token: ['punctuation.definition.comment.elixir',
  320. 'comment.line.number-sign.elixir'],
  321. regex: '(?:^|\\s)(#)(\\s[[a-zA-Z0-9,. \\t?!-][^\\x00-\\x7F]]*$)',
  322. originalRegex: '(?<=^|\\s)(#)\\s[[a-zA-Z0-9,. \\t?!-][^\\x{00}-\\x{7F}]]*$',
  323. comment: 'We are restrictive in what we allow to go after the comment character to avoid false positives, since the availability of comments depend on regexp flags.' }] };
  324. this.normalizeRules();
  325. };
  326. ElixirHighlightRules.metaData = { comment: 'Textmate bundle for Elixir Programming Language.',
  327. fileTypes: ['ex', 'exs'],
  328. firstLineMatch: '^#!/.*\\belixir',
  329. foldingStartMarker: '(after|else|catch|rescue|\\-\\>|\\{|\\[|do)\\s*$',
  330. foldingStopMarker: '^\\s*((\\}|\\]|after|else|catch|rescue)\\s*$|end\\b)',
  331. keyEquivalent: '^~E',
  332. name: 'Elixir',
  333. scopeName: 'source.elixir' };
  334. oop.inherits(ElixirHighlightRules, TextHighlightRules);
  335. exports.ElixirHighlightRules = ElixirHighlightRules;
  336. });
  337. ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module){"use strict";
  338. var oop = require("../../lib/oop");
  339. var BaseFoldMode = require("./fold_mode").FoldMode;
  340. var Range = require("../../range").Range;
  341. var FoldMode = exports.FoldMode = function () { };
  342. oop.inherits(FoldMode, BaseFoldMode);
  343. (function () {
  344. this.getFoldWidgetRange = function (session, foldStyle, row) {
  345. var range = this.indentationBlock(session, row);
  346. if (range)
  347. return range;
  348. var re = /\S/;
  349. var line = session.getLine(row);
  350. var startLevel = line.search(re);
  351. if (startLevel == -1 || line[startLevel] != "#")
  352. return;
  353. var startColumn = line.length;
  354. var maxRow = session.getLength();
  355. var startRow = row;
  356. var endRow = row;
  357. while (++row < maxRow) {
  358. line = session.getLine(row);
  359. var level = line.search(re);
  360. if (level == -1)
  361. continue;
  362. if (line[level] != "#")
  363. break;
  364. endRow = row;
  365. }
  366. if (endRow > startRow) {
  367. var endColumn = session.getLine(endRow).length;
  368. return new Range(startRow, startColumn, endRow, endColumn);
  369. }
  370. };
  371. this.getFoldWidget = function (session, foldStyle, row) {
  372. var line = session.getLine(row);
  373. var indent = line.search(/\S/);
  374. var next = session.getLine(row + 1);
  375. var prev = session.getLine(row - 1);
  376. var prevIndent = prev.search(/\S/);
  377. var nextIndent = next.search(/\S/);
  378. if (indent == -1) {
  379. session.foldWidgets[row - 1] = prevIndent != -1 && prevIndent < nextIndent ? "start" : "";
  380. return "";
  381. }
  382. if (prevIndent == -1) {
  383. if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
  384. session.foldWidgets[row - 1] = "";
  385. session.foldWidgets[row + 1] = "";
  386. return "start";
  387. }
  388. }
  389. else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
  390. if (session.getLine(row - 2).search(/\S/) == -1) {
  391. session.foldWidgets[row - 1] = "start";
  392. session.foldWidgets[row + 1] = "";
  393. return "";
  394. }
  395. }
  396. if (prevIndent != -1 && prevIndent < indent)
  397. session.foldWidgets[row - 1] = "start";
  398. else
  399. session.foldWidgets[row - 1] = "";
  400. if (indent < nextIndent)
  401. return "start";
  402. else
  403. return "";
  404. };
  405. }).call(FoldMode.prototype);
  406. });
  407. ace.define("ace/mode/elixir",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/elixir_highlight_rules","ace/mode/folding/coffee"], function(require, exports, module){/*
  408. THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
  409. */
  410. "use strict";
  411. var oop = require("../lib/oop");
  412. var TextMode = require("./text").Mode;
  413. var ElixirHighlightRules = require("./elixir_highlight_rules").ElixirHighlightRules;
  414. var FoldMode = require("./folding/coffee").FoldMode;
  415. var Mode = function () {
  416. this.HighlightRules = ElixirHighlightRules;
  417. this.foldingRules = new FoldMode();
  418. this.$behaviour = this.$defaultBehaviour;
  419. };
  420. oop.inherits(Mode, TextMode);
  421. (function () {
  422. this.lineCommentStart = "#";
  423. this.$id = "ace/mode/elixir";
  424. }).call(Mode.prototype);
  425. exports.Mode = Mode;
  426. }); (function() {
  427. ace.require(["ace/mode/elixir"], function(m) {
  428. if (typeof module == "object" && typeof exports == "object" && module) {
  429. module.exports = m;
  430. }
  431. });
  432. })();