mode-erlang.js 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002
  1. ace.define("ace/mode/erlang_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 ErlangHighlightRules = function() {
  6. this.$rules = { start:
  7. [ { include: '#module-directive' },
  8. { include: '#import-export-directive' },
  9. { include: '#behaviour-directive' },
  10. { include: '#record-directive' },
  11. { include: '#define-directive' },
  12. { include: '#macro-directive' },
  13. { include: '#directive' },
  14. { include: '#function' },
  15. { include: '#everything-else' } ],
  16. '#atom':
  17. [ { token: 'punctuation.definition.symbol.begin.erlang',
  18. regex: '\'',
  19. push:
  20. [ { token: 'punctuation.definition.symbol.end.erlang',
  21. regex: '\'',
  22. next: 'pop' },
  23. { token:
  24. [ 'punctuation.definition.escape.erlang',
  25. 'constant.other.symbol.escape.erlang',
  26. 'punctuation.definition.escape.erlang',
  27. 'constant.other.symbol.escape.erlang',
  28. 'constant.other.symbol.escape.erlang' ],
  29. regex: '(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' },
  30. { token: 'invalid.illegal.atom.erlang', regex: '\\\\\\^?.?' },
  31. { defaultToken: 'constant.other.symbol.quoted.single.erlang' } ] },
  32. { token: 'constant.other.symbol.unquoted.erlang',
  33. regex: '[a-z][a-zA-Z\\d@_]*' } ],
  34. '#behaviour-directive':
  35. [ { token:
  36. [ 'meta.directive.behaviour.erlang',
  37. 'punctuation.section.directive.begin.erlang',
  38. 'meta.directive.behaviour.erlang',
  39. 'keyword.control.directive.behaviour.erlang',
  40. 'meta.directive.behaviour.erlang',
  41. 'punctuation.definition.parameters.begin.erlang',
  42. 'meta.directive.behaviour.erlang',
  43. 'entity.name.type.class.behaviour.definition.erlang',
  44. 'meta.directive.behaviour.erlang',
  45. 'punctuation.definition.parameters.end.erlang',
  46. 'meta.directive.behaviour.erlang',
  47. 'punctuation.section.directive.end.erlang' ],
  48. regex: '^(\\s*)(-)(\\s*)(behaviour)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\))(\\s*)(\\.)' } ],
  49. '#binary':
  50. [ { token: 'punctuation.definition.binary.begin.erlang',
  51. regex: '<<',
  52. push:
  53. [ { token: 'punctuation.definition.binary.end.erlang',
  54. regex: '>>',
  55. next: 'pop' },
  56. { token:
  57. [ 'punctuation.separator.binary.erlang',
  58. 'punctuation.separator.value-size.erlang' ],
  59. regex: '(,)|(:)' },
  60. { include: '#internal-type-specifiers' },
  61. { include: '#everything-else' },
  62. { defaultToken: 'meta.structure.binary.erlang' } ] } ],
  63. '#character':
  64. [ { token:
  65. [ 'punctuation.definition.character.erlang',
  66. 'punctuation.definition.escape.erlang',
  67. 'constant.character.escape.erlang',
  68. 'punctuation.definition.escape.erlang',
  69. 'constant.character.escape.erlang',
  70. 'constant.character.escape.erlang' ],
  71. regex: '(\\$)(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' },
  72. { token: 'invalid.illegal.character.erlang',
  73. regex: '\\$\\\\\\^?.?' },
  74. { token:
  75. [ 'punctuation.definition.character.erlang',
  76. 'constant.character.erlang' ],
  77. regex: '(\\$)(\\S)' },
  78. { token: 'invalid.illegal.character.erlang', regex: '\\$.?' } ],
  79. '#comment':
  80. [ { token: 'punctuation.definition.comment.erlang',
  81. regex: '%.*$',
  82. push_:
  83. [ { token: 'comment.line.percentage.erlang',
  84. regex: '$',
  85. next: 'pop' },
  86. { defaultToken: 'comment.line.percentage.erlang' } ] } ],
  87. '#define-directive':
  88. [ { token:
  89. [ 'meta.directive.define.erlang',
  90. 'punctuation.section.directive.begin.erlang',
  91. 'meta.directive.define.erlang',
  92. 'keyword.control.directive.define.erlang',
  93. 'meta.directive.define.erlang',
  94. 'punctuation.definition.parameters.begin.erlang',
  95. 'meta.directive.define.erlang',
  96. 'entity.name.function.macro.definition.erlang',
  97. 'meta.directive.define.erlang',
  98. 'punctuation.separator.parameters.erlang' ],
  99. regex: '^(\\s*)(-)(\\s*)(define)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(,)',
  100. push:
  101. [ { token:
  102. [ 'punctuation.definition.parameters.end.erlang',
  103. 'meta.directive.define.erlang',
  104. 'punctuation.section.directive.end.erlang' ],
  105. regex: '(\\))(\\s*)(\\.)',
  106. next: 'pop' },
  107. { include: '#everything-else' },
  108. { defaultToken: 'meta.directive.define.erlang' } ] },
  109. { token: 'meta.directive.define.erlang',
  110. regex: '(?=^\\s*-\\s*define\\s*\\(\\s*[a-zA-Z\\d@_]+\\s*\\()',
  111. push:
  112. [ { token:
  113. [ 'punctuation.definition.parameters.end.erlang',
  114. 'meta.directive.define.erlang',
  115. 'punctuation.section.directive.end.erlang' ],
  116. regex: '(\\))(\\s*)(\\.)',
  117. next: 'pop' },
  118. { token:
  119. [ 'text',
  120. 'punctuation.section.directive.begin.erlang',
  121. 'text',
  122. 'keyword.control.directive.define.erlang',
  123. 'text',
  124. 'punctuation.definition.parameters.begin.erlang',
  125. 'text',
  126. 'entity.name.function.macro.definition.erlang',
  127. 'text',
  128. 'punctuation.definition.parameters.begin.erlang' ],
  129. regex: '^(\\s*)(-)(\\s*)(define)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(\\()',
  130. push:
  131. [ { token:
  132. [ 'punctuation.definition.parameters.end.erlang',
  133. 'text',
  134. 'punctuation.separator.parameters.erlang' ],
  135. regex: '(\\))(\\s*)(,)',
  136. next: 'pop' },
  137. { token: 'punctuation.separator.parameters.erlang', regex: ',' },
  138. { include: '#everything-else' } ] },
  139. { token: 'punctuation.separator.define.erlang',
  140. regex: '\\|\\||\\||:|;|,|\\.|->' },
  141. { include: '#everything-else' },
  142. { defaultToken: 'meta.directive.define.erlang' } ] } ],
  143. '#directive':
  144. [ { token:
  145. [ 'meta.directive.erlang',
  146. 'punctuation.section.directive.begin.erlang',
  147. 'meta.directive.erlang',
  148. 'keyword.control.directive.erlang',
  149. 'meta.directive.erlang',
  150. 'punctuation.definition.parameters.begin.erlang' ],
  151. regex: '^(\\s*)(-)(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\(?)',
  152. push:
  153. [ { token:
  154. [ 'punctuation.definition.parameters.end.erlang',
  155. 'meta.directive.erlang',
  156. 'punctuation.section.directive.end.erlang' ],
  157. regex: '(\\)?)(\\s*)(\\.)',
  158. next: 'pop' },
  159. { include: '#everything-else' },
  160. { defaultToken: 'meta.directive.erlang' } ] },
  161. { token:
  162. [ 'meta.directive.erlang',
  163. 'punctuation.section.directive.begin.erlang',
  164. 'meta.directive.erlang',
  165. 'keyword.control.directive.erlang',
  166. 'meta.directive.erlang',
  167. 'punctuation.section.directive.end.erlang' ],
  168. regex: '^(\\s*)(-)(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\.)' } ],
  169. '#everything-else':
  170. [ { include: '#comment' },
  171. { include: '#record-usage' },
  172. { include: '#macro-usage' },
  173. { include: '#expression' },
  174. { include: '#keyword' },
  175. { include: '#textual-operator' },
  176. { include: '#function-call' },
  177. { include: '#tuple' },
  178. { include: '#list' },
  179. { include: '#binary' },
  180. { include: '#parenthesized-expression' },
  181. { include: '#character' },
  182. { include: '#number' },
  183. { include: '#atom' },
  184. { include: '#string' },
  185. { include: '#symbolic-operator' },
  186. { include: '#variable' } ],
  187. '#expression':
  188. [ { token: 'keyword.control.if.erlang',
  189. regex: '\\bif\\b',
  190. push:
  191. [ { token: 'keyword.control.end.erlang',
  192. regex: '\\bend\\b',
  193. next: 'pop' },
  194. { include: '#internal-expression-punctuation' },
  195. { include: '#everything-else' },
  196. { defaultToken: 'meta.expression.if.erlang' } ] },
  197. { token: 'keyword.control.case.erlang',
  198. regex: '\\bcase\\b',
  199. push:
  200. [ { token: 'keyword.control.end.erlang',
  201. regex: '\\bend\\b',
  202. next: 'pop' },
  203. { include: '#internal-expression-punctuation' },
  204. { include: '#everything-else' },
  205. { defaultToken: 'meta.expression.case.erlang' } ] },
  206. { token: 'keyword.control.receive.erlang',
  207. regex: '\\breceive\\b',
  208. push:
  209. [ { token: 'keyword.control.end.erlang',
  210. regex: '\\bend\\b',
  211. next: 'pop' },
  212. { include: '#internal-expression-punctuation' },
  213. { include: '#everything-else' },
  214. { defaultToken: 'meta.expression.receive.erlang' } ] },
  215. { token:
  216. [ 'keyword.control.fun.erlang',
  217. 'text',
  218. 'entity.name.type.class.module.erlang',
  219. 'text',
  220. 'punctuation.separator.module-function.erlang',
  221. 'text',
  222. 'entity.name.function.erlang',
  223. 'text',
  224. 'punctuation.separator.function-arity.erlang' ],
  225. regex: '\\b(fun)(\\s*)(?:([a-z][a-zA-Z\\d@_]*)(\\s*)(:)(\\s*))?([a-z][a-zA-Z\\d@_]*)(\\s*)(/)' },
  226. { token: 'keyword.control.fun.erlang',
  227. regex: '\\bfun\\b',
  228. push:
  229. [ { token: 'keyword.control.end.erlang',
  230. regex: '\\bend\\b',
  231. next: 'pop' },
  232. { token: 'text',
  233. regex: '(?=\\()',
  234. push:
  235. [ { token: 'punctuation.separator.clauses.erlang',
  236. regex: ';|(?=\\bend\\b)',
  237. next: 'pop' },
  238. { include: '#internal-function-parts' } ] },
  239. { include: '#everything-else' },
  240. { defaultToken: 'meta.expression.fun.erlang' } ] },
  241. { token: 'keyword.control.try.erlang',
  242. regex: '\\btry\\b',
  243. push:
  244. [ { token: 'keyword.control.end.erlang',
  245. regex: '\\bend\\b',
  246. next: 'pop' },
  247. { include: '#internal-expression-punctuation' },
  248. { include: '#everything-else' },
  249. { defaultToken: 'meta.expression.try.erlang' } ] },
  250. { token: 'keyword.control.begin.erlang',
  251. regex: '\\bbegin\\b',
  252. push:
  253. [ { token: 'keyword.control.end.erlang',
  254. regex: '\\bend\\b',
  255. next: 'pop' },
  256. { include: '#internal-expression-punctuation' },
  257. { include: '#everything-else' },
  258. { defaultToken: 'meta.expression.begin.erlang' } ] },
  259. { token: 'keyword.control.query.erlang',
  260. regex: '\\bquery\\b',
  261. push:
  262. [ { token: 'keyword.control.end.erlang',
  263. regex: '\\bend\\b',
  264. next: 'pop' },
  265. { include: '#everything-else' },
  266. { defaultToken: 'meta.expression.query.erlang' } ] } ],
  267. '#function':
  268. [ { token:
  269. [ 'meta.function.erlang',
  270. 'entity.name.function.definition.erlang',
  271. 'meta.function.erlang' ],
  272. regex: '^(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(?=\\()',
  273. push:
  274. [ { token: 'punctuation.terminator.function.erlang',
  275. regex: '\\.',
  276. next: 'pop' },
  277. { token: [ 'text', 'entity.name.function.erlang', 'text' ],
  278. regex: '^(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(?=\\()' },
  279. { token: 'text',
  280. regex: '(?=\\()',
  281. push:
  282. [ { token: 'punctuation.separator.clauses.erlang',
  283. regex: ';|(?=\\.)',
  284. next: 'pop' },
  285. { include: '#parenthesized-expression' },
  286. { include: '#internal-function-parts' } ] },
  287. { include: '#everything-else' },
  288. { defaultToken: 'meta.function.erlang' } ] } ],
  289. '#function-call':
  290. [ { token: 'meta.function-call.erlang',
  291. regex: '(?=(?:[a-z][a-zA-Z\\d@_]*|\'[^\']*\')\\s*(?:\\(|:\\s*(?:[a-z][a-zA-Z\\d@_]*|\'[^\']*\')\\s*\\())',
  292. push:
  293. [ { token: 'punctuation.definition.parameters.end.erlang',
  294. regex: '\\)',
  295. next: 'pop' },
  296. { token:
  297. [ 'entity.name.type.class.module.erlang',
  298. 'text',
  299. 'punctuation.separator.module-function.erlang',
  300. 'text',
  301. 'entity.name.function.guard.erlang',
  302. 'text',
  303. 'punctuation.definition.parameters.begin.erlang' ],
  304. regex: '(?:(erlang)(\\s*)(:)(\\s*))?(is_atom|is_binary|is_constant|is_float|is_function|is_integer|is_list|is_number|is_pid|is_port|is_reference|is_tuple|is_record|abs|element|hd|length|node|round|self|size|tl|trunc)(\\s*)(\\()',
  305. push:
  306. [ { token: 'text', regex: '(?=\\))', next: 'pop' },
  307. { token: 'punctuation.separator.parameters.erlang', regex: ',' },
  308. { include: '#everything-else' } ] },
  309. { token:
  310. [ 'entity.name.type.class.module.erlang',
  311. 'text',
  312. 'punctuation.separator.module-function.erlang',
  313. 'text',
  314. 'entity.name.function.erlang',
  315. 'text',
  316. 'punctuation.definition.parameters.begin.erlang' ],
  317. regex: '(?:([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(:)(\\s*))?([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(\\()',
  318. push:
  319. [ { token: 'text', regex: '(?=\\))', next: 'pop' },
  320. { token: 'punctuation.separator.parameters.erlang', regex: ',' },
  321. { include: '#everything-else' } ] },
  322. { defaultToken: 'meta.function-call.erlang' } ] } ],
  323. '#import-export-directive':
  324. [ { token:
  325. [ 'meta.directive.import.erlang',
  326. 'punctuation.section.directive.begin.erlang',
  327. 'meta.directive.import.erlang',
  328. 'keyword.control.directive.import.erlang',
  329. 'meta.directive.import.erlang',
  330. 'punctuation.definition.parameters.begin.erlang',
  331. 'meta.directive.import.erlang',
  332. 'entity.name.type.class.module.erlang',
  333. 'meta.directive.import.erlang',
  334. 'punctuation.separator.parameters.erlang' ],
  335. regex: '^(\\s*)(-)(\\s*)(import)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(,)',
  336. push:
  337. [ { token:
  338. [ 'punctuation.definition.parameters.end.erlang',
  339. 'meta.directive.import.erlang',
  340. 'punctuation.section.directive.end.erlang' ],
  341. regex: '(\\))(\\s*)(\\.)',
  342. next: 'pop' },
  343. { include: '#internal-function-list' },
  344. { defaultToken: 'meta.directive.import.erlang' } ] },
  345. { token:
  346. [ 'meta.directive.export.erlang',
  347. 'punctuation.section.directive.begin.erlang',
  348. 'meta.directive.export.erlang',
  349. 'keyword.control.directive.export.erlang',
  350. 'meta.directive.export.erlang',
  351. 'punctuation.definition.parameters.begin.erlang' ],
  352. regex: '^(\\s*)(-)(\\s*)(export)(\\s*)(\\()',
  353. push:
  354. [ { token:
  355. [ 'punctuation.definition.parameters.end.erlang',
  356. 'meta.directive.export.erlang',
  357. 'punctuation.section.directive.end.erlang' ],
  358. regex: '(\\))(\\s*)(\\.)',
  359. next: 'pop' },
  360. { include: '#internal-function-list' },
  361. { defaultToken: 'meta.directive.export.erlang' } ] } ],
  362. '#internal-expression-punctuation':
  363. [ { token:
  364. [ 'punctuation.separator.clause-head-body.erlang',
  365. 'punctuation.separator.clauses.erlang',
  366. 'punctuation.separator.expressions.erlang' ],
  367. regex: '(->)|(;)|(,)' } ],
  368. '#internal-function-list':
  369. [ { token: 'punctuation.definition.list.begin.erlang',
  370. regex: '\\[',
  371. push:
  372. [ { token: 'punctuation.definition.list.end.erlang',
  373. regex: '\\]',
  374. next: 'pop' },
  375. { token:
  376. [ 'entity.name.function.erlang',
  377. 'text',
  378. 'punctuation.separator.function-arity.erlang' ],
  379. regex: '([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(/)',
  380. push:
  381. [ { token: 'punctuation.separator.list.erlang',
  382. regex: ',|(?=\\])',
  383. next: 'pop' },
  384. { include: '#everything-else' } ] },
  385. { include: '#everything-else' },
  386. { defaultToken: 'meta.structure.list.function.erlang' } ] } ],
  387. '#internal-function-parts':
  388. [ { token: 'text',
  389. regex: '(?=\\()',
  390. push:
  391. [ { token: 'punctuation.separator.clause-head-body.erlang',
  392. regex: '->',
  393. next: 'pop' },
  394. { token: 'punctuation.definition.parameters.begin.erlang',
  395. regex: '\\(',
  396. push:
  397. [ { token: 'punctuation.definition.parameters.end.erlang',
  398. regex: '\\)',
  399. next: 'pop' },
  400. { token: 'punctuation.separator.parameters.erlang', regex: ',' },
  401. { include: '#everything-else' } ] },
  402. { token: 'punctuation.separator.guards.erlang', regex: ',|;' },
  403. { include: '#everything-else' } ] },
  404. { token: 'punctuation.separator.expressions.erlang',
  405. regex: ',' },
  406. { include: '#everything-else' } ],
  407. '#internal-record-body':
  408. [ { token: 'punctuation.definition.class.record.begin.erlang',
  409. regex: '\\{',
  410. push:
  411. [ { token: 'meta.structure.record.erlang',
  412. regex: '(?=\\})',
  413. next: 'pop' },
  414. { token:
  415. [ 'variable.other.field.erlang',
  416. 'variable.language.omitted.field.erlang',
  417. 'text',
  418. 'keyword.operator.assignment.erlang' ],
  419. regex: '(?:([a-z][a-zA-Z\\d@_]*|\'[^\']*\')|(_))(\\s*)(=|::)',
  420. push:
  421. [ { token: 'punctuation.separator.class.record.erlang',
  422. regex: ',|(?=\\})',
  423. next: 'pop' },
  424. { include: '#everything-else' } ] },
  425. { token:
  426. [ 'variable.other.field.erlang',
  427. 'text',
  428. 'punctuation.separator.class.record.erlang' ],
  429. regex: '([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)((?:,)?)' },
  430. { include: '#everything-else' },
  431. { defaultToken: 'meta.structure.record.erlang' } ] } ],
  432. '#internal-type-specifiers':
  433. [ { token: 'punctuation.separator.value-type.erlang',
  434. regex: '/',
  435. push:
  436. [ { token: 'text', regex: '(?=,|:|>>)', next: 'pop' },
  437. { token:
  438. [ 'storage.type.erlang',
  439. 'storage.modifier.signedness.erlang',
  440. 'storage.modifier.endianness.erlang',
  441. 'storage.modifier.unit.erlang',
  442. 'punctuation.separator.type-specifiers.erlang' ],
  443. regex: '(integer|float|binary|bytes|bitstring|bits)|(signed|unsigned)|(big|little|native)|(unit)|(-)' } ] } ],
  444. '#keyword':
  445. [ { token: 'keyword.control.erlang',
  446. regex: '\\b(?:after|begin|case|catch|cond|end|fun|if|let|of|query|try|receive|when)\\b' } ],
  447. '#list':
  448. [ { token: 'punctuation.definition.list.begin.erlang',
  449. regex: '\\[',
  450. push:
  451. [ { token: 'punctuation.definition.list.end.erlang',
  452. regex: '\\]',
  453. next: 'pop' },
  454. { token: 'punctuation.separator.list.erlang',
  455. regex: '\\||\\|\\||,' },
  456. { include: '#everything-else' },
  457. { defaultToken: 'meta.structure.list.erlang' } ] } ],
  458. '#macro-directive':
  459. [ { token:
  460. [ 'meta.directive.ifdef.erlang',
  461. 'punctuation.section.directive.begin.erlang',
  462. 'meta.directive.ifdef.erlang',
  463. 'keyword.control.directive.ifdef.erlang',
  464. 'meta.directive.ifdef.erlang',
  465. 'punctuation.definition.parameters.begin.erlang',
  466. 'meta.directive.ifdef.erlang',
  467. 'entity.name.function.macro.erlang',
  468. 'meta.directive.ifdef.erlang',
  469. 'punctuation.definition.parameters.end.erlang',
  470. 'meta.directive.ifdef.erlang',
  471. 'punctuation.section.directive.end.erlang' ],
  472. regex: '^(\\s*)(-)(\\s*)(ifdef)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' },
  473. { token:
  474. [ 'meta.directive.ifndef.erlang',
  475. 'punctuation.section.directive.begin.erlang',
  476. 'meta.directive.ifndef.erlang',
  477. 'keyword.control.directive.ifndef.erlang',
  478. 'meta.directive.ifndef.erlang',
  479. 'punctuation.definition.parameters.begin.erlang',
  480. 'meta.directive.ifndef.erlang',
  481. 'entity.name.function.macro.erlang',
  482. 'meta.directive.ifndef.erlang',
  483. 'punctuation.definition.parameters.end.erlang',
  484. 'meta.directive.ifndef.erlang',
  485. 'punctuation.section.directive.end.erlang' ],
  486. regex: '^(\\s*)(-)(\\s*)(ifndef)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' },
  487. { token:
  488. [ 'meta.directive.undef.erlang',
  489. 'punctuation.section.directive.begin.erlang',
  490. 'meta.directive.undef.erlang',
  491. 'keyword.control.directive.undef.erlang',
  492. 'meta.directive.undef.erlang',
  493. 'punctuation.definition.parameters.begin.erlang',
  494. 'meta.directive.undef.erlang',
  495. 'entity.name.function.macro.erlang',
  496. 'meta.directive.undef.erlang',
  497. 'punctuation.definition.parameters.end.erlang',
  498. 'meta.directive.undef.erlang',
  499. 'punctuation.section.directive.end.erlang' ],
  500. regex: '^(\\s*)(-)(\\s*)(undef)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' } ],
  501. '#macro-usage':
  502. [ { token:
  503. [ 'keyword.operator.macro.erlang',
  504. 'meta.macro-usage.erlang',
  505. 'entity.name.function.macro.erlang' ],
  506. regex: '(\\?\\??)(\\s*)([a-zA-Z\\d@_]+)' } ],
  507. '#module-directive':
  508. [ { token:
  509. [ 'meta.directive.module.erlang',
  510. 'punctuation.section.directive.begin.erlang',
  511. 'meta.directive.module.erlang',
  512. 'keyword.control.directive.module.erlang',
  513. 'meta.directive.module.erlang',
  514. 'punctuation.definition.parameters.begin.erlang',
  515. 'meta.directive.module.erlang',
  516. 'entity.name.type.class.module.definition.erlang',
  517. 'meta.directive.module.erlang',
  518. 'punctuation.definition.parameters.end.erlang',
  519. 'meta.directive.module.erlang',
  520. 'punctuation.section.directive.end.erlang' ],
  521. regex: '^(\\s*)(-)(\\s*)(module)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\))(\\s*)(\\.)' } ],
  522. '#number':
  523. [ { token: 'text',
  524. regex: '(?=\\d)',
  525. push:
  526. [ { token: 'text', regex: '(?!\\d)', next: 'pop' },
  527. { token:
  528. [ 'constant.numeric.float.erlang',
  529. 'punctuation.separator.integer-float.erlang',
  530. 'constant.numeric.float.erlang',
  531. 'punctuation.separator.float-exponent.erlang' ],
  532. regex: '(\\d+)(\\.)(\\d+)((?:[eE][\\+\\-]?\\d+)?)' },
  533. { token:
  534. [ 'constant.numeric.integer.binary.erlang',
  535. 'punctuation.separator.base-integer.erlang',
  536. 'constant.numeric.integer.binary.erlang' ],
  537. regex: '(2)(#)([0-1]+)' },
  538. { token:
  539. [ 'constant.numeric.integer.base-3.erlang',
  540. 'punctuation.separator.base-integer.erlang',
  541. 'constant.numeric.integer.base-3.erlang' ],
  542. regex: '(3)(#)([0-2]+)' },
  543. { token:
  544. [ 'constant.numeric.integer.base-4.erlang',
  545. 'punctuation.separator.base-integer.erlang',
  546. 'constant.numeric.integer.base-4.erlang' ],
  547. regex: '(4)(#)([0-3]+)' },
  548. { token:
  549. [ 'constant.numeric.integer.base-5.erlang',
  550. 'punctuation.separator.base-integer.erlang',
  551. 'constant.numeric.integer.base-5.erlang' ],
  552. regex: '(5)(#)([0-4]+)' },
  553. { token:
  554. [ 'constant.numeric.integer.base-6.erlang',
  555. 'punctuation.separator.base-integer.erlang',
  556. 'constant.numeric.integer.base-6.erlang' ],
  557. regex: '(6)(#)([0-5]+)' },
  558. { token:
  559. [ 'constant.numeric.integer.base-7.erlang',
  560. 'punctuation.separator.base-integer.erlang',
  561. 'constant.numeric.integer.base-7.erlang' ],
  562. regex: '(7)(#)([0-6]+)' },
  563. { token:
  564. [ 'constant.numeric.integer.octal.erlang',
  565. 'punctuation.separator.base-integer.erlang',
  566. 'constant.numeric.integer.octal.erlang' ],
  567. regex: '(8)(#)([0-7]+)' },
  568. { token:
  569. [ 'constant.numeric.integer.base-9.erlang',
  570. 'punctuation.separator.base-integer.erlang',
  571. 'constant.numeric.integer.base-9.erlang' ],
  572. regex: '(9)(#)([0-8]+)' },
  573. { token:
  574. [ 'constant.numeric.integer.decimal.erlang',
  575. 'punctuation.separator.base-integer.erlang',
  576. 'constant.numeric.integer.decimal.erlang' ],
  577. regex: '(10)(#)(\\d+)' },
  578. { token:
  579. [ 'constant.numeric.integer.base-11.erlang',
  580. 'punctuation.separator.base-integer.erlang',
  581. 'constant.numeric.integer.base-11.erlang' ],
  582. regex: '(11)(#)([\\daA]+)' },
  583. { token:
  584. [ 'constant.numeric.integer.base-12.erlang',
  585. 'punctuation.separator.base-integer.erlang',
  586. 'constant.numeric.integer.base-12.erlang' ],
  587. regex: '(12)(#)([\\da-bA-B]+)' },
  588. { token:
  589. [ 'constant.numeric.integer.base-13.erlang',
  590. 'punctuation.separator.base-integer.erlang',
  591. 'constant.numeric.integer.base-13.erlang' ],
  592. regex: '(13)(#)([\\da-cA-C]+)' },
  593. { token:
  594. [ 'constant.numeric.integer.base-14.erlang',
  595. 'punctuation.separator.base-integer.erlang',
  596. 'constant.numeric.integer.base-14.erlang' ],
  597. regex: '(14)(#)([\\da-dA-D]+)' },
  598. { token:
  599. [ 'constant.numeric.integer.base-15.erlang',
  600. 'punctuation.separator.base-integer.erlang',
  601. 'constant.numeric.integer.base-15.erlang' ],
  602. regex: '(15)(#)([\\da-eA-E]+)' },
  603. { token:
  604. [ 'constant.numeric.integer.hexadecimal.erlang',
  605. 'punctuation.separator.base-integer.erlang',
  606. 'constant.numeric.integer.hexadecimal.erlang' ],
  607. regex: '(16)(#)([\\da-fA-F]+)' },
  608. { token:
  609. [ 'constant.numeric.integer.base-17.erlang',
  610. 'punctuation.separator.base-integer.erlang',
  611. 'constant.numeric.integer.base-17.erlang' ],
  612. regex: '(17)(#)([\\da-gA-G]+)' },
  613. { token:
  614. [ 'constant.numeric.integer.base-18.erlang',
  615. 'punctuation.separator.base-integer.erlang',
  616. 'constant.numeric.integer.base-18.erlang' ],
  617. regex: '(18)(#)([\\da-hA-H]+)' },
  618. { token:
  619. [ 'constant.numeric.integer.base-19.erlang',
  620. 'punctuation.separator.base-integer.erlang',
  621. 'constant.numeric.integer.base-19.erlang' ],
  622. regex: '(19)(#)([\\da-iA-I]+)' },
  623. { token:
  624. [ 'constant.numeric.integer.base-20.erlang',
  625. 'punctuation.separator.base-integer.erlang',
  626. 'constant.numeric.integer.base-20.erlang' ],
  627. regex: '(20)(#)([\\da-jA-J]+)' },
  628. { token:
  629. [ 'constant.numeric.integer.base-21.erlang',
  630. 'punctuation.separator.base-integer.erlang',
  631. 'constant.numeric.integer.base-21.erlang' ],
  632. regex: '(21)(#)([\\da-kA-K]+)' },
  633. { token:
  634. [ 'constant.numeric.integer.base-22.erlang',
  635. 'punctuation.separator.base-integer.erlang',
  636. 'constant.numeric.integer.base-22.erlang' ],
  637. regex: '(22)(#)([\\da-lA-L]+)' },
  638. { token:
  639. [ 'constant.numeric.integer.base-23.erlang',
  640. 'punctuation.separator.base-integer.erlang',
  641. 'constant.numeric.integer.base-23.erlang' ],
  642. regex: '(23)(#)([\\da-mA-M]+)' },
  643. { token:
  644. [ 'constant.numeric.integer.base-24.erlang',
  645. 'punctuation.separator.base-integer.erlang',
  646. 'constant.numeric.integer.base-24.erlang' ],
  647. regex: '(24)(#)([\\da-nA-N]+)' },
  648. { token:
  649. [ 'constant.numeric.integer.base-25.erlang',
  650. 'punctuation.separator.base-integer.erlang',
  651. 'constant.numeric.integer.base-25.erlang' ],
  652. regex: '(25)(#)([\\da-oA-O]+)' },
  653. { token:
  654. [ 'constant.numeric.integer.base-26.erlang',
  655. 'punctuation.separator.base-integer.erlang',
  656. 'constant.numeric.integer.base-26.erlang' ],
  657. regex: '(26)(#)([\\da-pA-P]+)' },
  658. { token:
  659. [ 'constant.numeric.integer.base-27.erlang',
  660. 'punctuation.separator.base-integer.erlang',
  661. 'constant.numeric.integer.base-27.erlang' ],
  662. regex: '(27)(#)([\\da-qA-Q]+)' },
  663. { token:
  664. [ 'constant.numeric.integer.base-28.erlang',
  665. 'punctuation.separator.base-integer.erlang',
  666. 'constant.numeric.integer.base-28.erlang' ],
  667. regex: '(28)(#)([\\da-rA-R]+)' },
  668. { token:
  669. [ 'constant.numeric.integer.base-29.erlang',
  670. 'punctuation.separator.base-integer.erlang',
  671. 'constant.numeric.integer.base-29.erlang' ],
  672. regex: '(29)(#)([\\da-sA-S]+)' },
  673. { token:
  674. [ 'constant.numeric.integer.base-30.erlang',
  675. 'punctuation.separator.base-integer.erlang',
  676. 'constant.numeric.integer.base-30.erlang' ],
  677. regex: '(30)(#)([\\da-tA-T]+)' },
  678. { token:
  679. [ 'constant.numeric.integer.base-31.erlang',
  680. 'punctuation.separator.base-integer.erlang',
  681. 'constant.numeric.integer.base-31.erlang' ],
  682. regex: '(31)(#)([\\da-uA-U]+)' },
  683. { token:
  684. [ 'constant.numeric.integer.base-32.erlang',
  685. 'punctuation.separator.base-integer.erlang',
  686. 'constant.numeric.integer.base-32.erlang' ],
  687. regex: '(32)(#)([\\da-vA-V]+)' },
  688. { token:
  689. [ 'constant.numeric.integer.base-33.erlang',
  690. 'punctuation.separator.base-integer.erlang',
  691. 'constant.numeric.integer.base-33.erlang' ],
  692. regex: '(33)(#)([\\da-wA-W]+)' },
  693. { token:
  694. [ 'constant.numeric.integer.base-34.erlang',
  695. 'punctuation.separator.base-integer.erlang',
  696. 'constant.numeric.integer.base-34.erlang' ],
  697. regex: '(34)(#)([\\da-xA-X]+)' },
  698. { token:
  699. [ 'constant.numeric.integer.base-35.erlang',
  700. 'punctuation.separator.base-integer.erlang',
  701. 'constant.numeric.integer.base-35.erlang' ],
  702. regex: '(35)(#)([\\da-yA-Y]+)' },
  703. { token:
  704. [ 'constant.numeric.integer.base-36.erlang',
  705. 'punctuation.separator.base-integer.erlang',
  706. 'constant.numeric.integer.base-36.erlang' ],
  707. regex: '(36)(#)([\\da-zA-Z]+)' },
  708. { token: 'invalid.illegal.integer.erlang',
  709. regex: '\\d+#[\\da-zA-Z]+' },
  710. { token: 'constant.numeric.integer.decimal.erlang',
  711. regex: '\\d+' } ] } ],
  712. '#parenthesized-expression':
  713. [ { token: 'punctuation.section.expression.begin.erlang',
  714. regex: '\\(',
  715. push:
  716. [ { token: 'punctuation.section.expression.end.erlang',
  717. regex: '\\)',
  718. next: 'pop' },
  719. { include: '#everything-else' },
  720. { defaultToken: 'meta.expression.parenthesized' } ] } ],
  721. '#record-directive':
  722. [ { token:
  723. [ 'meta.directive.record.erlang',
  724. 'punctuation.section.directive.begin.erlang',
  725. 'meta.directive.record.erlang',
  726. 'keyword.control.directive.import.erlang',
  727. 'meta.directive.record.erlang',
  728. 'punctuation.definition.parameters.begin.erlang',
  729. 'meta.directive.record.erlang',
  730. 'entity.name.type.class.record.definition.erlang',
  731. 'meta.directive.record.erlang',
  732. 'punctuation.separator.parameters.erlang' ],
  733. regex: '^(\\s*)(-)(\\s*)(record)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(,)',
  734. push:
  735. [ { token:
  736. [ 'punctuation.definition.class.record.end.erlang',
  737. 'meta.directive.record.erlang',
  738. 'punctuation.definition.parameters.end.erlang',
  739. 'meta.directive.record.erlang',
  740. 'punctuation.section.directive.end.erlang' ],
  741. regex: '(\\})(\\s*)(\\))(\\s*)(\\.)',
  742. next: 'pop' },
  743. { include: '#internal-record-body' },
  744. { defaultToken: 'meta.directive.record.erlang' } ] } ],
  745. '#record-usage':
  746. [ { token:
  747. [ 'keyword.operator.record.erlang',
  748. 'meta.record-usage.erlang',
  749. 'entity.name.type.class.record.erlang',
  750. 'meta.record-usage.erlang',
  751. 'punctuation.separator.record-field.erlang',
  752. 'meta.record-usage.erlang',
  753. 'variable.other.field.erlang' ],
  754. regex: '(#)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(\\.)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')' },
  755. { token:
  756. [ 'keyword.operator.record.erlang',
  757. 'meta.record-usage.erlang',
  758. 'entity.name.type.class.record.erlang' ],
  759. regex: '(#)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')',
  760. push:
  761. [ { token: 'punctuation.definition.class.record.end.erlang',
  762. regex: '\\}',
  763. next: 'pop' },
  764. { include: '#internal-record-body' },
  765. { defaultToken: 'meta.record-usage.erlang' } ] } ],
  766. '#string':
  767. [ { token: 'punctuation.definition.string.begin.erlang',
  768. regex: '"',
  769. push:
  770. [ { token: 'punctuation.definition.string.end.erlang',
  771. regex: '"',
  772. next: 'pop' },
  773. { token:
  774. [ 'punctuation.definition.escape.erlang',
  775. 'constant.character.escape.erlang',
  776. 'punctuation.definition.escape.erlang',
  777. 'constant.character.escape.erlang',
  778. 'constant.character.escape.erlang' ],
  779. regex: '(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' },
  780. { token: 'invalid.illegal.string.erlang', regex: '\\\\\\^?.?' },
  781. { token:
  782. [ 'punctuation.definition.placeholder.erlang',
  783. 'punctuation.separator.placeholder-parts.erlang',
  784. 'constant.other.placeholder.erlang',
  785. 'punctuation.separator.placeholder-parts.erlang',
  786. 'punctuation.separator.placeholder-parts.erlang',
  787. 'constant.other.placeholder.erlang',
  788. 'punctuation.separator.placeholder-parts.erlang',
  789. 'punctuation.separator.placeholder-parts.erlang',
  790. 'punctuation.separator.placeholder-parts.erlang',
  791. 'constant.other.placeholder.erlang',
  792. 'constant.other.placeholder.erlang' ],
  793. regex: '(~)(?:((?:\\-)?)(\\d+)|(\\*))?(?:(\\.)(?:(\\d+)|(\\*)))?(?:(\\.)(?:(\\*)|(.)))?([~cfegswpWPBX#bx\\+ni])' },
  794. { token:
  795. [ 'punctuation.definition.placeholder.erlang',
  796. 'punctuation.separator.placeholder-parts.erlang',
  797. 'constant.other.placeholder.erlang',
  798. 'constant.other.placeholder.erlang' ],
  799. regex: '(~)((?:\\*)?)((?:\\d+)?)([~du\\-#fsacl])' },
  800. { token: 'invalid.illegal.string.erlang', regex: '~.?' },
  801. { defaultToken: 'string.quoted.double.erlang' } ] } ],
  802. '#symbolic-operator':
  803. [ { token: 'keyword.operator.symbolic.erlang',
  804. regex: '\\+\\+|\\+|--|-|\\*|/=|/|=/=|=:=|==|=<|=|<-|<|>=|>|!|::' } ],
  805. '#textual-operator':
  806. [ { token: 'keyword.operator.textual.erlang',
  807. regex: '\\b(?:andalso|band|and|bxor|xor|bor|orelse|or|bnot|not|bsl|bsr|div|rem)\\b' } ],
  808. '#tuple':
  809. [ { token: 'punctuation.definition.tuple.begin.erlang',
  810. regex: '\\{',
  811. push:
  812. [ { token: 'punctuation.definition.tuple.end.erlang',
  813. regex: '\\}',
  814. next: 'pop' },
  815. { token: 'punctuation.separator.tuple.erlang', regex: ',' },
  816. { include: '#everything-else' },
  817. { defaultToken: 'meta.structure.tuple.erlang' } ] } ],
  818. '#variable':
  819. [ { token: [ 'variable.other.erlang', 'variable.language.omitted.erlang' ],
  820. regex: '(_[a-zA-Z\\d@_]+|[A-Z][a-zA-Z\\d@_]*)|(_)' } ] }
  821. this.normalizeRules();
  822. };
  823. ErlangHighlightRules.metaData = { comment: 'The recognition of function definitions and compiler directives (such as module, record and macro definitions) requires that each of the aforementioned constructs must be the first string inside a line (except for whitespace). Also, the function/module/record/macro names must be given unquoted. -- desp',
  824. fileTypes: [ 'erl', 'hrl' ],
  825. keyEquivalent: '^~E',
  826. name: 'Erlang',
  827. scopeName: 'source.erlang' }
  828. oop.inherits(ErlangHighlightRules, TextHighlightRules);
  829. exports.ErlangHighlightRules = ErlangHighlightRules;
  830. });
  831. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
  832. "use strict";
  833. var oop = require("../../lib/oop");
  834. var Range = require("../../range").Range;
  835. var BaseFoldMode = require("./fold_mode").FoldMode;
  836. var FoldMode = exports.FoldMode = function(commentRegex) {
  837. if (commentRegex) {
  838. this.foldingStartMarker = new RegExp(
  839. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  840. );
  841. this.foldingStopMarker = new RegExp(
  842. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  843. );
  844. }
  845. };
  846. oop.inherits(FoldMode, BaseFoldMode);
  847. (function() {
  848. this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
  849. this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
  850. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  851. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  852. this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
  853. this._getFoldWidgetBase = this.getFoldWidget;
  854. this.getFoldWidget = function(session, foldStyle, row) {
  855. var line = session.getLine(row);
  856. if (this.singleLineBlockCommentRe.test(line)) {
  857. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  858. return "";
  859. }
  860. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  861. if (!fw && this.startRegionRe.test(line))
  862. return "start"; // lineCommentRegionStart
  863. return fw;
  864. };
  865. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  866. var line = session.getLine(row);
  867. if (this.startRegionRe.test(line))
  868. return this.getCommentRegionBlock(session, line, row);
  869. var match = line.match(this.foldingStartMarker);
  870. if (match) {
  871. var i = match.index;
  872. if (match[1])
  873. return this.openingBracketBlock(session, match[1], row, i);
  874. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  875. if (range && !range.isMultiLine()) {
  876. if (forceMultiline) {
  877. range = this.getSectionRange(session, row);
  878. } else if (foldStyle != "all")
  879. range = null;
  880. }
  881. return range;
  882. }
  883. if (foldStyle === "markbegin")
  884. return;
  885. var match = line.match(this.foldingStopMarker);
  886. if (match) {
  887. var i = match.index + match[0].length;
  888. if (match[1])
  889. return this.closingBracketBlock(session, match[1], row, i);
  890. return session.getCommentFoldRange(row, i, -1);
  891. }
  892. };
  893. this.getSectionRange = function(session, row) {
  894. var line = session.getLine(row);
  895. var startIndent = line.search(/\S/);
  896. var startRow = row;
  897. var startColumn = line.length;
  898. row = row + 1;
  899. var endRow = row;
  900. var maxRow = session.getLength();
  901. while (++row < maxRow) {
  902. line = session.getLine(row);
  903. var indent = line.search(/\S/);
  904. if (indent === -1)
  905. continue;
  906. if (startIndent > indent)
  907. break;
  908. var subRange = this.getFoldWidgetRange(session, "all", row);
  909. if (subRange) {
  910. if (subRange.start.row <= startRow) {
  911. break;
  912. } else if (subRange.isMultiLine()) {
  913. row = subRange.end.row;
  914. } else if (startIndent == indent) {
  915. break;
  916. }
  917. }
  918. endRow = row;
  919. }
  920. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  921. };
  922. this.getCommentRegionBlock = function(session, line, row) {
  923. var startColumn = line.search(/\s*$/);
  924. var maxRow = session.getLength();
  925. var startRow = row;
  926. var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
  927. var depth = 1;
  928. while (++row < maxRow) {
  929. line = session.getLine(row);
  930. var m = re.exec(line);
  931. if (!m) continue;
  932. if (m[1]) depth--;
  933. else depth++;
  934. if (!depth) break;
  935. }
  936. var endRow = row;
  937. if (endRow > startRow) {
  938. return new Range(startRow, startColumn, endRow, line.length);
  939. }
  940. };
  941. }).call(FoldMode.prototype);
  942. });
  943. ace.define("ace/mode/erlang",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/erlang_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
  944. "use strict";
  945. var oop = require("../lib/oop");
  946. var TextMode = require("./text").Mode;
  947. var ErlangHighlightRules = require("./erlang_highlight_rules").ErlangHighlightRules;
  948. var FoldMode = require("./folding/cstyle").FoldMode;
  949. var Mode = function() {
  950. this.HighlightRules = ErlangHighlightRules;
  951. this.foldingRules = new FoldMode();
  952. this.$behaviour = this.$defaultBehaviour;
  953. };
  954. oop.inherits(Mode, TextMode);
  955. (function() {
  956. this.lineCommentStart = "%";
  957. this.blockComment = null;
  958. this.$id = "ace/mode/erlang";
  959. }).call(Mode.prototype);
  960. exports.Mode = Mode;
  961. });