UNPKG

1.37 kBJavaScriptView Raw
1// https://www.gap-system.org/Manuals/doc/ref/chap4.html
2// https://www.gap-system.org/Manuals/doc/ref/chap27.html
3
4Prism.languages.gap = {
5 'shell': {
6 pattern: /^gap>[\s\S]*?(?=^gap>|$(?![\s\S]))/m,
7 greedy: true,
8 inside: {
9 'gap': {
10 pattern: /^(gap>).+(?:(?:\r(?:\n|(?!\n))|\n)>.*)*/,
11 lookbehind: true,
12 inside: null // see below
13 },
14 'punctuation': /^gap>/
15 }
16 },
17
18 'comment': {
19 pattern: /#.*/,
20 greedy: true
21 },
22 'string': {
23 pattern: /(^|[^\\'"])(?:'(?:[^\r\n\\']|\\.){1,10}'|"(?:[^\r\n\\"]|\\.)*"(?!")|"""[\s\S]*?""")/,
24 lookbehind: true,
25 greedy: true,
26 inside: {
27 'continuation': {
28 pattern: /([\r\n])>/,
29 lookbehind: true,
30 alias: 'punctuation'
31 }
32 }
33 },
34
35 'keyword': /\b(?:Assert|Info|IsBound|QUIT|TryNextMethod|Unbind|and|atomic|break|continue|do|elif|else|end|fi|for|function|if|in|local|mod|not|od|or|quit|readonly|readwrite|rec|repeat|return|then|until|while)\b/,
36 'boolean': /\b(?:false|true)\b/,
37
38 'function': /\b[a-z_]\w*(?=\s*\()/i,
39
40 'number': {
41 pattern: /(^|[^\w.]|\.\.)(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?(?:_[a-z]?)?(?=$|[^\w.]|\.\.)/,
42 lookbehind: true
43 },
44
45 'continuation': {
46 pattern: /([\r\n])>/,
47 lookbehind: true,
48 alias: 'punctuation'
49 },
50 'operator': /->|[-+*/^~=!]|<>|[<>]=?|:=|\.\./,
51 'punctuation': /[()[\]{},;.:]/
52};
53
54Prism.languages.gap.shell.inside.gap.inside = Prism.languages.gap;