d59d13db0f151770597f301a137ee206.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. ace.define("ace/mode/vala_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/technosophos/Vala-TMBundle/master/Syntaxes/Vala.tmLanguage (uuid: ) */
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  5. var ValaHighlightRules = function () {
  6. this.$rules = { start: [{ token: ['meta.using.vala',
  7. 'keyword.other.using.vala',
  8. 'meta.using.vala',
  9. 'storage.modifier.using.vala',
  10. 'meta.using.vala',
  11. 'punctuation.terminator.vala'],
  12. regex: '^(\\s*)(using)\\b(?:(\\s*)([^ ;$]+)(\\s*)((?:;)?))?' },
  13. { include: '#code' }],
  14. '#all-types': [{ include: '#primitive-arrays' },
  15. { include: '#primitive-types' },
  16. { include: '#object-types' }],
  17. '#annotations': [{ token: ['storage.type.annotation.vala',
  18. 'punctuation.definition.annotation-arguments.begin.vala'],
  19. regex: '(@[^ (]+)(\\()',
  20. push: [{ token: 'punctuation.definition.annotation-arguments.end.vala',
  21. regex: '\\)',
  22. next: 'pop' },
  23. { token: ['constant.other.key.vala',
  24. 'text',
  25. 'keyword.operator.assignment.vala'],
  26. regex: '(\\w*)(\\s*)(=)' },
  27. { include: '#code' },
  28. { token: 'punctuation.seperator.property.vala', regex: ',' },
  29. { defaultToken: 'meta.declaration.annotation.vala' }] },
  30. { token: 'storage.type.annotation.vala', regex: '@\\w*' }],
  31. '#anonymous-classes-and-new': [{ token: 'keyword.control.new.vala',
  32. regex: '\\bnew\\b',
  33. push_disabled: [{ token: 'text',
  34. regex: '(?<=\\)|\\])(?!\\s*{)|(?<=})|(?=;)',
  35. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  36. originalRegex: '(?<=\\)|\\])(?!\\s*{)|(?<=})|(?=;)',
  37. next: 'pop' },
  38. { token: ['storage.type.vala', 'text'],
  39. regex: '(\\w+)(\\s*)(?=\\[)',
  40. push: [{ token: 'text', regex: '}|(?=;|\\))', next: 'pop' },
  41. { token: 'text',
  42. regex: '\\[',
  43. push: [{ token: 'text', regex: '\\]', next: 'pop' },
  44. { include: '#code' }] },
  45. { token: 'text',
  46. regex: '{',
  47. push: [{ token: 'text', regex: '(?=})', next: 'pop' },
  48. { include: '#code' }] }] },
  49. { token: 'text',
  50. regex: '(?=\\w.*\\()',
  51. push: [{ token: 'text',
  52. regex: '(?<=\\))',
  53. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  54. originalRegex: '(?<=\\))',
  55. next: 'pop' },
  56. { include: '#object-types' },
  57. { token: 'text',
  58. regex: '\\(',
  59. push: [{ token: 'text', regex: '\\)', next: 'pop' },
  60. { include: '#code' }] }] },
  61. { token: 'meta.inner-class.vala',
  62. regex: '{',
  63. push: [{ token: 'meta.inner-class.vala', regex: '}', next: 'pop' },
  64. { include: '#class-body' },
  65. { defaultToken: 'meta.inner-class.vala' }] }] }],
  66. '#assertions': [{ token: ['keyword.control.assert.vala',
  67. 'meta.declaration.assertion.vala'],
  68. regex: '\\b(assert|requires|ensures)(\\s)',
  69. push: [{ token: 'meta.declaration.assertion.vala',
  70. regex: '$',
  71. next: 'pop' },
  72. { token: 'keyword.operator.assert.expression-seperator.vala',
  73. regex: ':' },
  74. { include: '#code' },
  75. { defaultToken: 'meta.declaration.assertion.vala' }] }],
  76. '#class': [{ token: 'meta.class.vala',
  77. regex: '(?=\\w?[\\w\\s]*(?:class|(?:@)?interface|enum|struct|namespace)\\s+\\w+)',
  78. push: [{ token: 'paren.vala',
  79. regex: '}',
  80. next: 'pop' },
  81. { include: '#storage-modifiers' },
  82. { include: '#comments' },
  83. { token: ['storage.modifier.vala',
  84. 'meta.class.identifier.vala',
  85. 'entity.name.type.class.vala'],
  86. regex: '(class|(?:@)?interface|enum|struct|namespace)(\\s+)([\\w\\.]+)' },
  87. { token: 'storage.modifier.extends.vala',
  88. regex: ':',
  89. push: [{ token: 'meta.definition.class.inherited.classes.vala',
  90. regex: '(?={|,)',
  91. next: 'pop' },
  92. { include: '#object-types-inherited' },
  93. { include: '#comments' },
  94. { defaultToken: 'meta.definition.class.inherited.classes.vala' }] },
  95. { token: ['storage.modifier.implements.vala',
  96. 'meta.definition.class.implemented.interfaces.vala'],
  97. regex: '(,)(\\s)',
  98. push: [{ token: 'meta.definition.class.implemented.interfaces.vala',
  99. regex: '(?=\\{)',
  100. next: 'pop' },
  101. { include: '#object-types-inherited' },
  102. { include: '#comments' },
  103. { defaultToken: 'meta.definition.class.implemented.interfaces.vala' }] },
  104. { token: 'paren.vala',
  105. regex: '{',
  106. push: [{ token: 'paren.vala', regex: '(?=})', next: 'pop' },
  107. { include: '#class-body' },
  108. { defaultToken: 'meta.class.body.vala' }] },
  109. { defaultToken: 'meta.class.vala' }],
  110. comment: 'attempting to put namespace in here.' }],
  111. '#class-body': [{ include: '#comments' },
  112. { include: '#class' },
  113. { include: '#enums' },
  114. { include: '#methods' },
  115. { include: '#annotations' },
  116. { include: '#storage-modifiers' },
  117. { include: '#code' }],
  118. '#code': [{ include: '#comments' },
  119. { include: '#class' },
  120. { token: 'text',
  121. regex: '{',
  122. push: [{ token: 'text', regex: '}', next: 'pop' },
  123. { include: '#code' }] },
  124. { include: '#assertions' },
  125. { include: '#parens' },
  126. { include: '#constants-and-special-vars' },
  127. { include: '#anonymous-classes-and-new' },
  128. { include: '#keywords' },
  129. { include: '#storage-modifiers' },
  130. { include: '#strings' },
  131. { include: '#all-types' }],
  132. '#comments': [{ token: 'punctuation.definition.comment.vala',
  133. regex: '/\\*\\*/' },
  134. { include: 'text.html.javadoc' },
  135. { include: '#comments-inline' }],
  136. '#comments-inline': [{ token: 'punctuation.definition.comment.vala',
  137. regex: '/\\*',
  138. push: [{ token: 'punctuation.definition.comment.vala',
  139. regex: '\\*/',
  140. next: 'pop' },
  141. { defaultToken: 'comment.block.vala' }] },
  142. { token: ['text',
  143. 'punctuation.definition.comment.vala',
  144. 'comment.line.double-slash.vala'],
  145. regex: '(\\s*)(//)(.*$)' }],
  146. '#constants-and-special-vars': [{ token: 'constant.language.vala',
  147. regex: '\\b(?:true|false|null)\\b' },
  148. { token: 'variable.language.vala',
  149. regex: '\\b(?:this|base)\\b' },
  150. { token: 'constant.numeric.vala',
  151. regex: '\\b(?:0(?:x|X)[0-9a-fA-F]*|(?:[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:(?:e|E)(?:\\+|-)?[0-9]+)?)(?:[LlFfUuDd]|UL|ul)?\\b' },
  152. { token: ['keyword.operator.dereference.vala', 'constant.other.vala'],
  153. regex: '((?:\\.)?)\\b([A-Z][A-Z0-9_]+)(?!<|\\.class|\\s*\\w+\\s*=)\\b' }],
  154. '#enums': [{ token: 'text',
  155. regex: '^(?=\\s*[A-Z0-9_]+\\s*(?:{|\\(|,))',
  156. push: [{ token: 'text', regex: '(?=;|})', next: 'pop' },
  157. { token: 'constant.other.enum.vala',
  158. regex: '\\w+',
  159. push: [{ token: 'meta.enum.vala', regex: '(?=,|;|})', next: 'pop' },
  160. { include: '#parens' },
  161. { token: 'text',
  162. regex: '{',
  163. push: [{ token: 'text', regex: '}', next: 'pop' },
  164. { include: '#class-body' }] },
  165. { defaultToken: 'meta.enum.vala' }] }] }],
  166. '#keywords': [{ token: 'keyword.control.catch-exception.vala',
  167. regex: '\\b(?:try|catch|finally|throw)\\b' },
  168. { token: 'keyword.control.vala', regex: '\\?|:|\\?\\?' },
  169. { token: 'keyword.control.vala',
  170. regex: '\\b(?:return|break|case|continue|default|do|while|for|foreach|switch|if|else|in|yield|get|set|value)\\b' },
  171. { token: 'keyword.operator.vala',
  172. regex: '\\b(?:typeof|is|as)\\b' },
  173. { token: 'keyword.operator.comparison.vala',
  174. regex: '==|!=|<=|>=|<>|<|>' },
  175. { token: 'keyword.operator.assignment.vala', regex: '=' },
  176. { token: 'keyword.operator.increment-decrement.vala',
  177. regex: '\\-\\-|\\+\\+' },
  178. { token: 'keyword.operator.arithmetic.vala',
  179. regex: '\\-|\\+|\\*|\\/|%' },
  180. { token: 'keyword.operator.logical.vala', regex: '!|&&|\\|\\|' },
  181. { token: 'keyword.operator.dereference.vala',
  182. regex: '\\.(?=\\S)',
  183. originalRegex: '(?<=\\S)\\.(?=\\S)' },
  184. { token: 'punctuation.terminator.vala', regex: ';' },
  185. { token: 'keyword.operator.ownership', regex: 'owned|unowned' }],
  186. '#methods': [{ token: 'meta.method.vala',
  187. regex: '(?!new)(?=\\w.*\\s+)(?=[^=]+\\()',
  188. push: [{ token: 'paren.vala', regex: '}|(?=;)', next: 'pop' },
  189. { include: '#storage-modifiers' },
  190. { token: ['entity.name.function.vala', 'meta.method.identifier.vala'],
  191. regex: '([\\~\\w\\.]+)(\\s*\\()',
  192. push: [{ token: 'meta.method.identifier.vala',
  193. regex: '\\)',
  194. next: 'pop' },
  195. { include: '#parameters' },
  196. { defaultToken: 'meta.method.identifier.vala' }] },
  197. { token: 'meta.method.return-type.vala',
  198. regex: '(?=\\w.*\\s+\\w+\\s*\\()',
  199. push: [{ token: 'meta.method.return-type.vala',
  200. regex: '(?=\\w+\\s*\\()',
  201. next: 'pop' },
  202. { include: '#all-types' },
  203. { defaultToken: 'meta.method.return-type.vala' }] },
  204. { include: '#throws' },
  205. { token: 'paren.vala',
  206. regex: '{',
  207. push: [{ token: 'paren.vala', regex: '(?=})', next: 'pop' },
  208. { include: '#code' },
  209. { defaultToken: 'meta.method.body.vala' }] },
  210. { defaultToken: 'meta.method.vala' }] }],
  211. '#namespace': [{ token: 'text',
  212. regex: '^(?=\\s*[A-Z0-9_]+\\s*(?:{|\\(|,))',
  213. push: [{ token: 'text', regex: '(?=;|})', next: 'pop' },
  214. { token: 'constant.other.namespace.vala',
  215. regex: '\\w+',
  216. push: [{ token: 'meta.namespace.vala', regex: '(?=,|;|})', next: 'pop' },
  217. { include: '#parens' },
  218. { token: 'text',
  219. regex: '{',
  220. push: [{ token: 'text', regex: '}', next: 'pop' },
  221. { include: '#code' }] },
  222. { defaultToken: 'meta.namespace.vala' }] }],
  223. comment: 'This is not quite right. See the class grammar right now' }],
  224. '#object-types': [{ token: 'storage.type.generic.vala',
  225. regex: '\\b(?:[a-z]\\w*\\.)*[A-Z]+\\w*<',
  226. push: [{ token: 'storage.type.generic.vala',
  227. regex: '>|[^\\w\\s,\\?<\\[()\\]]',
  228. TODO: 'FIXME: regexp doesn\'t have js equivalent',
  229. originalRegex: '>|[^\\w\\s,\\?<\\[(?:[,]+)\\]]',
  230. next: 'pop' },
  231. { include: '#object-types' },
  232. { token: 'storage.type.generic.vala',
  233. regex: '<',
  234. push: [{ token: 'storage.type.generic.vala',
  235. regex: '>|[^\\w\\s,\\[\\]<]',
  236. next: 'pop' },
  237. { defaultToken: 'storage.type.generic.vala' }],
  238. comment: 'This is just to support <>\'s with no actual type prefix' },
  239. { defaultToken: 'storage.type.generic.vala' }] },
  240. { token: 'storage.type.object.array.vala',
  241. regex: '\\b(?:[a-z]\\w*\\.)*[A-Z]+\\w*(?=\\[)',
  242. push: [{ token: 'storage.type.object.array.vala',
  243. regex: '(?=[^\\]\\s])',
  244. next: 'pop' },
  245. { token: 'text',
  246. regex: '\\[',
  247. push: [{ token: 'text', regex: '\\]', next: 'pop' },
  248. { include: '#code' }] },
  249. { defaultToken: 'storage.type.object.array.vala' }] },
  250. { token: ['storage.type.vala',
  251. 'keyword.operator.dereference.vala',
  252. 'storage.type.vala'],
  253. regex: '\\b(?:([a-z]\\w*)(\\.))*([A-Z]+\\w*\\b)' }],
  254. '#object-types-inherited': [{ token: 'entity.other.inherited-class.vala',
  255. regex: '\\b(?:[a-z]\\w*\\.)*[A-Z]+\\w*<',
  256. push: [{ token: 'entity.other.inherited-class.vala',
  257. regex: '>|[^\\w\\s,<]',
  258. next: 'pop' },
  259. { include: '#object-types' },
  260. { token: 'storage.type.generic.vala',
  261. regex: '<',
  262. push: [{ token: 'storage.type.generic.vala',
  263. regex: '>|[^\\w\\s,<]',
  264. next: 'pop' },
  265. { defaultToken: 'storage.type.generic.vala' }],
  266. comment: 'This is just to support <>\'s with no actual type prefix' },
  267. { defaultToken: 'entity.other.inherited-class.vala' }] },
  268. { token: ['entity.other.inherited-class.vala',
  269. 'keyword.operator.dereference.vala',
  270. 'entity.other.inherited-class.vala'],
  271. regex: '\\b(?:([a-z]\\w*)(\\.))*([A-Z]+\\w*)' }],
  272. '#parameters': [{ token: 'storage.modifier.vala', regex: 'final' },
  273. { include: '#primitive-arrays' },
  274. { include: '#primitive-types' },
  275. { include: '#object-types' },
  276. { token: 'variable.parameter.vala', regex: '\\w+' }],
  277. '#parens': [{ token: 'text',
  278. regex: '\\(',
  279. push: [{ token: 'text', regex: '\\)', next: 'pop' },
  280. { include: '#code' }] }],
  281. '#primitive-arrays': [{ token: 'storage.type.primitive.array.vala',
  282. regex: '\\b(?:bool|byte|sbyte|char|decimal|double|float|int|uint|long|ulong|object|short|ushort|string|void|int8|int16|int32|int64|uint8|uint16|uint32|uint64)(?:\\[\\])*\\b' }],
  283. '#primitive-types': [{ token: 'storage.type.primitive.vala',
  284. regex: '\\b(?:var|bool|byte|sbyte|char|decimal|double|float|int|uint|long|ulong|object|short|ushort|string|void|signal|int8|int16|int32|int64|uint8|uint16|uint32|uint64)\\b',
  285. comment: 'var is not really a primitive, but acts like one in most cases' }],
  286. '#storage-modifiers': [{ token: 'storage.modifier.vala',
  287. regex: '\\b(?:public|private|protected|internal|static|final|sealed|virtual|override|abstract|readonly|volatile|dynamic|async|unsafe|out|ref|weak|owned|unowned|const)\\b',
  288. comment: 'Not sure about unsafe and readonly' }],
  289. '#strings': [{ token: 'punctuation.definition.string.begin.vala',
  290. regex: '@"',
  291. push: [{ token: 'punctuation.definition.string.end.vala',
  292. regex: '"',
  293. next: 'pop' },
  294. { token: 'constant.character.escape.vala',
  295. regex: '\\\\.|%[\\w\\.\\-]+|\\$(?:\\w+|\\([\\w\\s\\+\\-\\*\\/]+\\))' },
  296. { defaultToken: 'string.quoted.interpolated.vala' }] },
  297. { token: 'punctuation.definition.string.begin.vala',
  298. regex: '"',
  299. push: [{ token: 'punctuation.definition.string.end.vala',
  300. regex: '"',
  301. next: 'pop' },
  302. { token: 'constant.character.escape.vala', regex: '\\\\.' },
  303. { token: 'constant.character.escape.vala',
  304. regex: '%[\\w\\.\\-]+' },
  305. { defaultToken: 'string.quoted.double.vala' }] },
  306. { token: 'punctuation.definition.string.begin.vala',
  307. regex: '\'',
  308. push: [{ token: 'punctuation.definition.string.end.vala',
  309. regex: '\'',
  310. next: 'pop' },
  311. { token: 'constant.character.escape.vala', regex: '\\\\.' },
  312. { defaultToken: 'string.quoted.single.vala' }] },
  313. { token: 'punctuation.definition.string.begin.vala',
  314. regex: '"""',
  315. push: [{ token: 'punctuation.definition.string.end.vala',
  316. regex: '"""',
  317. next: 'pop' },
  318. { token: 'constant.character.escape.vala',
  319. regex: '%[\\w\\.\\-]+' },
  320. { defaultToken: 'string.quoted.triple.vala' }] }],
  321. '#throws': [{ token: 'storage.modifier.vala',
  322. regex: 'throws',
  323. push: [{ token: 'meta.throwables.vala', regex: '(?={|;)', next: 'pop' },
  324. { include: '#object-types' },
  325. { defaultToken: 'meta.throwables.vala' }] }],
  326. '#values': [{ include: '#strings' },
  327. { include: '#object-types' },
  328. { include: '#constants-and-special-vars' }] };
  329. this.normalizeRules();
  330. };
  331. ValaHighlightRules.metaData = {
  332. comment: 'Based heavily on the Java bundle\'s language syntax. TODO:\n* Closures\n* Delegates\n* Properties: Better support for properties.\n* Annotations\n* Error domains\n* Named arguments\n* Array slicing, negative indexes, multidimensional\n* construct blocks\n* lock blocks?\n* regex literals\n* DocBlock syntax highlighting. (Currently importing javadoc)\n* Folding rule for comments.\n',
  333. fileTypes: ['vala'],
  334. foldingStartMarker: '(\\{\\s*(//.*)?$|^\\s*// \\{\\{\\{)',
  335. foldingStopMarker: '^\\s*(\\}|// \\}\\}\\}$)',
  336. name: 'Vala',
  337. scopeName: 'source.vala'
  338. };
  339. oop.inherits(ValaHighlightRules, TextHighlightRules);
  340. exports.ValaHighlightRules = ValaHighlightRules;
  341. });
  342. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict";
  343. var oop = require("../../lib/oop");
  344. var Range = require("../../range").Range;
  345. var BaseFoldMode = require("./fold_mode").FoldMode;
  346. var FoldMode = exports.FoldMode = function (commentRegex) {
  347. if (commentRegex) {
  348. this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
  349. this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
  350. }
  351. };
  352. oop.inherits(FoldMode, BaseFoldMode);
  353. (function () {
  354. this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
  355. this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
  356. this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
  357. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  358. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  359. this._getFoldWidgetBase = this.getFoldWidget;
  360. this.getFoldWidget = function (session, foldStyle, row) {
  361. var line = session.getLine(row);
  362. if (this.singleLineBlockCommentRe.test(line)) {
  363. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  364. return "";
  365. }
  366. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  367. if (!fw && this.startRegionRe.test(line))
  368. return "start"; // lineCommentRegionStart
  369. return fw;
  370. };
  371. this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) {
  372. var line = session.getLine(row);
  373. if (this.startRegionRe.test(line))
  374. return this.getCommentRegionBlock(session, line, row);
  375. var match = line.match(this.foldingStartMarker);
  376. if (match) {
  377. var i = match.index;
  378. if (match[1])
  379. return this.openingBracketBlock(session, match[1], row, i);
  380. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  381. if (range && !range.isMultiLine()) {
  382. if (forceMultiline) {
  383. range = this.getSectionRange(session, row);
  384. }
  385. else if (foldStyle != "all")
  386. range = null;
  387. }
  388. return range;
  389. }
  390. if (foldStyle === "markbegin")
  391. return;
  392. var match = line.match(this.foldingStopMarker);
  393. if (match) {
  394. var i = match.index + match[0].length;
  395. if (match[1])
  396. return this.closingBracketBlock(session, match[1], row, i);
  397. return session.getCommentFoldRange(row, i, -1);
  398. }
  399. };
  400. this.getSectionRange = function (session, row) {
  401. var line = session.getLine(row);
  402. var startIndent = line.search(/\S/);
  403. var startRow = row;
  404. var startColumn = line.length;
  405. row = row + 1;
  406. var endRow = row;
  407. var maxRow = session.getLength();
  408. while (++row < maxRow) {
  409. line = session.getLine(row);
  410. var indent = line.search(/\S/);
  411. if (indent === -1)
  412. continue;
  413. if (startIndent > indent)
  414. break;
  415. var subRange = this.getFoldWidgetRange(session, "all", row);
  416. if (subRange) {
  417. if (subRange.start.row <= startRow) {
  418. break;
  419. }
  420. else if (subRange.isMultiLine()) {
  421. row = subRange.end.row;
  422. }
  423. else if (startIndent == indent) {
  424. break;
  425. }
  426. }
  427. endRow = row;
  428. }
  429. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  430. };
  431. this.getCommentRegionBlock = function (session, line, row) {
  432. var startColumn = line.search(/\s*$/);
  433. var maxRow = session.getLength();
  434. var startRow = row;
  435. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  436. var depth = 1;
  437. while (++row < maxRow) {
  438. line = session.getLine(row);
  439. var m = re.exec(line);
  440. if (!m)
  441. continue;
  442. if (m[1])
  443. depth--;
  444. else
  445. depth++;
  446. if (!depth)
  447. break;
  448. }
  449. var endRow = row;
  450. if (endRow > startRow) {
  451. return new Range(startRow, startColumn, endRow, line.length);
  452. }
  453. };
  454. }).call(FoldMode.prototype);
  455. });
  456. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module){"use strict";
  457. var Range = require("../range").Range;
  458. var MatchingBraceOutdent = function () { };
  459. (function () {
  460. this.checkOutdent = function (line, input) {
  461. if (!/^\s+$/.test(line))
  462. return false;
  463. return /^\s*\}/.test(input);
  464. };
  465. this.autoOutdent = function (doc, row) {
  466. var line = doc.getLine(row);
  467. var match = line.match(/^(\s*\})/);
  468. if (!match)
  469. return 0;
  470. var column = match[1].length;
  471. var openBracePos = doc.findMatchingBracket({ row: row, column: column });
  472. if (!openBracePos || openBracePos.row == row)
  473. return 0;
  474. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  475. doc.replace(new Range(row, 0, row, column - 1), indent);
  476. };
  477. this.$getIndent = function (line) {
  478. return line.match(/^\s*/)[0];
  479. };
  480. }).call(MatchingBraceOutdent.prototype);
  481. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  482. });
  483. ace.define("ace/mode/vala",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/vala_highlight_rules","ace/mode/folding/cstyle","ace/mode/matching_brace_outdent"], function(require, exports, module){/*
  484. THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
  485. */
  486. "use strict";
  487. var oop = require("../lib/oop");
  488. var TextMode = require("./text").Mode;
  489. var ValaHighlightRules = require("./vala_highlight_rules").ValaHighlightRules;
  490. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  491. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  492. var Mode = function () {
  493. this.HighlightRules = ValaHighlightRules;
  494. this.$outdent = new MatchingBraceOutdent();
  495. this.$behaviour = this.$defaultBehaviour;
  496. this.foldingRules = new CStyleFoldMode();
  497. };
  498. oop.inherits(Mode, TextMode);
  499. (function () {
  500. this.lineCommentStart = "//";
  501. this.blockComment = { start: "/*", end: "*/" };
  502. this.getNextLineIndent = function (state, line, tab) {
  503. var indent = this.$getIndent(line);
  504. var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
  505. var tokens = tokenizedLine.tokens;
  506. var endState = tokenizedLine.state;
  507. if (tokens.length && tokens[tokens.length - 1].type == "comment") {
  508. return indent;
  509. }
  510. if (state == "start" || state == "no_regex") {
  511. var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
  512. if (match) {
  513. indent += tab;
  514. }
  515. }
  516. else if (state == "doc-start") {
  517. if (endState == "start" || endState == "no_regex") {
  518. return "";
  519. }
  520. var match = line.match(/^\s*(\/?)\*/);
  521. if (match) {
  522. if (match[1]) {
  523. indent += " ";
  524. }
  525. indent += "* ";
  526. }
  527. }
  528. return indent;
  529. };
  530. this.checkOutdent = function (state, line, input) {
  531. return this.$outdent.checkOutdent(line, input);
  532. };
  533. this.autoOutdent = function (state, doc, row) {
  534. this.$outdent.autoOutdent(doc, row);
  535. };
  536. this.$id = "ace/mode/vala";
  537. this.snippetFileId = "ace/snippets/vala";
  538. }).call(Mode.prototype);
  539. exports.Mode = Mode;
  540. }); (function() {
  541. ace.require(["ace/mode/vala"], function(m) {
  542. if (typeof module == "object" && typeof exports == "object" && module) {
  543. module.exports = m;
  544. }
  545. });
  546. })();