1f33899bba9efc8a9dc527f39ce8fe9a.js 48 KB

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