main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.7 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | /**
|
---|
| 2 | * @param {string} value
|
---|
| 3 | * @returns {RegExp}
|
---|
| 4 | * */
|
---|
| 5 |
|
---|
| 6 | /**
|
---|
| 7 | * @param {RegExp | string } re
|
---|
| 8 | * @returns {string}
|
---|
| 9 | */
|
---|
| 10 | function source(re) {
|
---|
| 11 | if (!re) return null;
|
---|
| 12 | if (typeof re === "string") return re;
|
---|
| 13 |
|
---|
| 14 | return re.source;
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | /**
|
---|
| 18 | * @param {...(RegExp | string) } args
|
---|
| 19 | * @returns {string}
|
---|
| 20 | */
|
---|
| 21 | function concat(...args) {
|
---|
| 22 | const joined = args.map((x) => source(x)).join("");
|
---|
| 23 | return joined;
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | /*
|
---|
| 27 | Language: Erlang REPL
|
---|
| 28 | Author: Sergey Ignatov <sergey@ignatov.spb.su>
|
---|
| 29 | Website: https://www.erlang.org
|
---|
| 30 | Category: functional
|
---|
| 31 | */
|
---|
| 32 |
|
---|
| 33 | /** @type LanguageFn */
|
---|
| 34 | function erlangRepl(hljs) {
|
---|
| 35 | return {
|
---|
| 36 | name: 'Erlang REPL',
|
---|
| 37 | keywords: {
|
---|
| 38 | built_in:
|
---|
| 39 | 'spawn spawn_link self',
|
---|
| 40 | keyword:
|
---|
| 41 | 'after and andalso|10 band begin bnot bor bsl bsr bxor case catch cond div end fun if ' +
|
---|
| 42 | 'let not of or orelse|10 query receive rem try when xor'
|
---|
| 43 | },
|
---|
| 44 | contains: [
|
---|
| 45 | {
|
---|
| 46 | className: 'meta',
|
---|
| 47 | begin: '^[0-9]+> ',
|
---|
| 48 | relevance: 10
|
---|
| 49 | },
|
---|
| 50 | hljs.COMMENT('%', '$'),
|
---|
| 51 | {
|
---|
| 52 | className: 'number',
|
---|
| 53 | begin: '\\b(\\d+(_\\d+)*#[a-fA-F0-9]+(_[a-fA-F0-9]+)*|\\d+(_\\d+)*(\\.\\d+(_\\d+)*)?([eE][-+]?\\d+)?)',
|
---|
| 54 | relevance: 0
|
---|
| 55 | },
|
---|
| 56 | hljs.APOS_STRING_MODE,
|
---|
| 57 | hljs.QUOTE_STRING_MODE,
|
---|
| 58 | {
|
---|
| 59 | begin: concat(
|
---|
| 60 | /\?(::)?/,
|
---|
| 61 | /([A-Z]\w*)/, // at least one identifier
|
---|
| 62 | /((::)[A-Z]\w*)*/ // perhaps more
|
---|
| 63 | )
|
---|
| 64 | },
|
---|
| 65 | {
|
---|
| 66 | begin: '->'
|
---|
| 67 | },
|
---|
| 68 | {
|
---|
| 69 | begin: 'ok'
|
---|
| 70 | },
|
---|
| 71 | {
|
---|
| 72 | begin: '!'
|
---|
| 73 | },
|
---|
| 74 | {
|
---|
| 75 | begin: '(\\b[a-z\'][a-zA-Z0-9_\']*:[a-z\'][a-zA-Z0-9_\']*)|(\\b[a-z\'][a-zA-Z0-9_\']*)',
|
---|
| 76 | relevance: 0
|
---|
| 77 | },
|
---|
| 78 | {
|
---|
| 79 | begin: '[A-Z][a-zA-Z0-9_\']*',
|
---|
| 80 | relevance: 0
|
---|
| 81 | }
|
---|
| 82 | ]
|
---|
| 83 | };
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | module.exports = erlangRepl;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.