|
1 |
| -Prism.languages.maxscript = { |
2 |
| - 'comment': { |
3 |
| - pattern: /\/\*[\s\S]*?(?:\*\/|$)|--.*/, |
4 |
| - greedy: true |
5 |
| - }, |
6 |
| - 'string': { |
7 |
| - pattern: /(^|[^"\\@])(?:"(?:[^"\\]|\\[\s\S])*"|@"[^"]*")/, |
8 |
| - lookbehind: true, |
9 |
| - greedy: true |
10 |
| - }, |
11 |
| - 'path': { |
12 |
| - pattern: /\$(?:[\w/\\.*?]|'[^']*')*/, |
13 |
| - greedy: true, |
14 |
| - alias: 'string' |
15 |
| - }, |
16 |
| - |
17 |
| - 'function-definition': { |
18 |
| - pattern: /(\b(?:fn|function)\s+)\w+\b/, |
19 |
| - lookbehind: true, |
20 |
| - alias: 'function' |
21 |
| - }, |
22 |
| - |
23 |
| - 'argument': { |
24 |
| - pattern: /\b[a-z_]\w*(?=:)/i, |
25 |
| - alias: 'attr-name' |
26 |
| - }, |
27 |
| - |
28 |
| - 'keyword': /\b(?:about|and|animate|as|at|attributes|by|case|catch|collect|continue|coordsys|do|else|exit|fn|for|from|function|global|if|in|local|macroscript|mapped|max|not|of|or|parameters|persistent|plugin|rcmenu|return|rollout|set|struct|then|throw|to|tool|try|undo|utility|when|where|while|with)\b/i, |
29 |
| - 'boolean': /\b(?:false|off|on|true)\b/, |
30 |
| - |
31 |
| - 'time': { |
32 |
| - pattern: /(^|[^\w.])(?:(?:(?:\d+(?:\.\d*)?|\.\d+)(?:[eEdD][+-]\d+|[LP])?[msft])+|\d+:\d+(?:\.\d*)?)(?![\w.:])/, |
33 |
| - lookbehind: true, |
34 |
| - alias: 'number' |
35 |
| - }, |
36 |
| - 'number': [ |
37 |
| - { |
38 |
| - pattern: /(^|[^\w.])(?:(?:\d+(?:\.\d*)?|\.\d+)(?:[eEdD][+-]\d+|[LP])?|0x[a-fA-F0-9]+)(?![\w.:])/, |
39 |
| - lookbehind: true |
40 |
| - }, |
41 |
| - /\b(?:e|pi)\b/ |
42 |
| - ], |
43 |
| - |
44 |
| - 'constant': /\b(?:black|blue|brown|gray|green|orange|red|white|yellow)\b/, |
45 |
| - 'color': { |
46 |
| - pattern: /\b(?:dontcollect|ok|silentValue|undefined|unsupplied)\b/i, |
47 |
| - alias: 'constant' |
48 |
| - }, |
49 |
| - |
50 |
| - 'operator': /[-+*/<>=!]=?|[&^]|#(?!\()/, |
51 |
| - 'punctuation': /[()\[\]{}.:,;]|#(?=\()|\\$/m |
52 |
| -}; |
| 1 | +(function (Prism) { |
| 2 | + |
| 3 | + var keywords = /\b(?:about|and|animate|as|at|attributes|by|case|catch|collect|continue|coordsys|do|else|exit|fn|for|from|function|global|if|in|local|macroscript|mapped|max|not|of|off|on|or|parameters|persistent|plugin|rcmenu|return|rollout|set|struct|then|throw|to|tool|try|undo|utility|when|where|while|with)\b/i; |
| 4 | + |
| 5 | + |
| 6 | + Prism.languages.maxscript = { |
| 7 | + 'comment': { |
| 8 | + pattern: /\/\*[\s\S]*?(?:\*\/|$)|--.*/, |
| 9 | + greedy: true |
| 10 | + }, |
| 11 | + 'string': { |
| 12 | + pattern: /(^|[^"\\@])(?:"(?:[^"\\]|\\[\s\S])*"|@"[^"]*")/, |
| 13 | + lookbehind: true, |
| 14 | + greedy: true |
| 15 | + }, |
| 16 | + 'path': { |
| 17 | + pattern: /\$(?:[\w/\\.*?]|'[^']*')*/, |
| 18 | + greedy: true, |
| 19 | + alias: 'string' |
| 20 | + }, |
| 21 | + |
| 22 | + 'function-call': { |
| 23 | + pattern: RegExp( |
| 24 | + '((?:' + ( |
| 25 | + // start of line |
| 26 | + /^/.source + |
| 27 | + '|' + |
| 28 | + // operators and other language constructs |
| 29 | + /[;=<>+\-*/^({\[]/.source + |
| 30 | + '|' + |
| 31 | + // keywords as part of statements |
| 32 | + /\b(?:and|by|case|catch|collect|do|else|if|in|not|or|return|then|to|try|where|while|with)\b/.source |
| 33 | + ) + ')[ \t]*)' + |
| 34 | + |
| 35 | + '(?!' + keywords.source + ')' + /[a-z_]\w*\b/.source + |
| 36 | + |
| 37 | + '(?=[ \t]*(?:' + ( |
| 38 | + // variable |
| 39 | + '(?!' + keywords.source + ')' + /[a-z_]/.source + |
| 40 | + '|' + |
| 41 | + // number |
| 42 | + /\d|-\.?\d/.source + |
| 43 | + '|' + |
| 44 | + // other expressions or literals |
| 45 | + /[({'"$@#?]/.source |
| 46 | + ) + '))', |
| 47 | + 'im' |
| 48 | + ), |
| 49 | + lookbehind: true, |
| 50 | + greedy: true, |
| 51 | + alias: 'function' |
| 52 | + }, |
| 53 | + |
| 54 | + 'function-definition': { |
| 55 | + pattern: /(\b(?:fn|function)\s+)\w+\b/i, |
| 56 | + lookbehind: true, |
| 57 | + alias: 'function' |
| 58 | + }, |
| 59 | + |
| 60 | + 'argument': { |
| 61 | + pattern: /\b[a-z_]\w*(?=:)/i, |
| 62 | + alias: 'attr-name' |
| 63 | + }, |
| 64 | + |
| 65 | + 'keyword': keywords, |
| 66 | + 'boolean': /\b(?:false|true)\b/, |
| 67 | + |
| 68 | + 'time': { |
| 69 | + pattern: /(^|[^\w.])(?:(?:(?:\d+(?:\.\d*)?|\.\d+)(?:[eEdD][+-]\d+|[LP])?[msft])+|\d+:\d+(?:\.\d*)?)(?![\w.:])/, |
| 70 | + lookbehind: true, |
| 71 | + alias: 'number' |
| 72 | + }, |
| 73 | + 'number': [ |
| 74 | + { |
| 75 | + pattern: /(^|[^\w.])(?:(?:\d+(?:\.\d*)?|\.\d+)(?:[eEdD][+-]\d+|[LP])?|0x[a-fA-F0-9]+)(?![\w.:])/, |
| 76 | + lookbehind: true |
| 77 | + }, |
| 78 | + /\b(?:e|pi)\b/ |
| 79 | + ], |
| 80 | + |
| 81 | + 'constant': /\b(?:dontcollect|ok|silentValue|undefined|unsupplied)\b/, |
| 82 | + 'color': { |
| 83 | + pattern: /\b(?:black|blue|brown|gray|green|orange|red|white|yellow)\b/i, |
| 84 | + alias: 'constant' |
| 85 | + }, |
| 86 | + |
| 87 | + 'operator': /[-+*/<>=!]=?|[&^?]|#(?!\()/, |
| 88 | + 'punctuation': /[()\[\]{}.:,;]|#(?=\()|\\$/m |
| 89 | + }; |
| 90 | + |
| 91 | +}(Prism)); |
0 commit comments