source: node_modules/refractor/lang/concurnas.js@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 2.5 KB
Line 
1'use strict'
2
3module.exports = concurnas
4concurnas.displayName = 'concurnas'
5concurnas.aliases = ['conc']
6function concurnas(Prism) {
7 Prism.languages.concurnas = {
8 comment: {
9 pattern: /(^|[^\\])(?:\/\*[\s\S]*?(?:\*\/|$)|\/\/.*)/,
10 lookbehind: true,
11 greedy: true
12 },
13 langext: {
14 pattern: /\b\w+\s*\|\|[\s\S]+?\|\|/,
15 greedy: true,
16 inside: {
17 'class-name': /^\w+/,
18 string: {
19 pattern: /(^\s*\|\|)[\s\S]+(?=\|\|$)/,
20 lookbehind: true
21 },
22 punctuation: /\|\|/
23 }
24 },
25 function: {
26 pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/,
27 lookbehind: true
28 },
29 keyword:
30 /\b(?:abstract|actor|also|annotation|assert|async|await|bool|boolean|break|byte|case|catch|changed|char|class|closed|constant|continue|def|default|del|double|elif|else|enum|every|extends|false|finally|float|for|from|global|gpudef|gpukernel|if|import|in|init|inject|int|lambda|local|long|loop|match|new|nodefault|null|of|onchange|open|out|override|package|parfor|parforsync|post|pre|private|protected|provide|provider|public|return|shared|short|single|size_t|sizeof|super|sync|this|throw|trait|trans|transient|true|try|typedef|unchecked|using|val|var|void|while|with)\b/,
31 boolean: /\b(?:false|true)\b/,
32 number:
33 /\b0b[01][01_]*L?\b|\b0x(?:[\da-f_]*\.)?[\da-f_p+-]+\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfls]?/i,
34 punctuation: /[{}[\];(),.:]/,
35 operator:
36 /<==|>==|=>|->|<-|<>|&==|&<>|\?:?|\.\?|\+\+|--|[-+*/=<>]=?|[!^~]|\b(?:and|as|band|bor|bxor|comp|is|isnot|mod|or)\b=?/,
37 annotation: {
38 pattern: /@(?:\w+:)?(?:\w+|\[[^\]]+\])?/,
39 alias: 'builtin'
40 }
41 }
42 Prism.languages.insertBefore('concurnas', 'langext', {
43 'regex-literal': {
44 pattern: /\br("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
45 greedy: true,
46 inside: {
47 interpolation: {
48 pattern:
49 /((?:^|[^\\])(?:\\{2})*)\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
50 lookbehind: true,
51 inside: Prism.languages.concurnas
52 },
53 regex: /[\s\S]+/
54 }
55 },
56 'string-literal': {
57 pattern: /(?:\B|\bs)("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
58 greedy: true,
59 inside: {
60 interpolation: {
61 pattern:
62 /((?:^|[^\\])(?:\\{2})*)\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
63 lookbehind: true,
64 inside: Prism.languages.concurnas
65 },
66 string: /[\s\S]+/
67 }
68 }
69 })
70 Prism.languages.conc = Prism.languages.concurnas
71}
Note: See TracBrowser for help on using the repository browser.