[d24f17c] | 1 | 'use strict'
|
---|
| 2 |
|
---|
| 3 | module.exports = maxscript
|
---|
| 4 | maxscript.displayName = 'maxscript'
|
---|
| 5 | maxscript.aliases = []
|
---|
| 6 | function maxscript(Prism) {
|
---|
| 7 | ;(function (Prism) {
|
---|
| 8 | var keywords =
|
---|
| 9 | /\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
|
---|
| 10 | Prism.languages.maxscript = {
|
---|
| 11 | comment: {
|
---|
| 12 | pattern: /\/\*[\s\S]*?(?:\*\/|$)|--.*/,
|
---|
| 13 | greedy: true
|
---|
| 14 | },
|
---|
| 15 | string: {
|
---|
| 16 | pattern: /(^|[^"\\@])(?:"(?:[^"\\]|\\[\s\S])*"|@"[^"]*")/,
|
---|
| 17 | lookbehind: true,
|
---|
| 18 | greedy: true
|
---|
| 19 | },
|
---|
| 20 | path: {
|
---|
| 21 | pattern: /\$(?:[\w/\\.*?]|'[^']*')*/,
|
---|
| 22 | greedy: true,
|
---|
| 23 | alias: 'string'
|
---|
| 24 | },
|
---|
| 25 | 'function-call': {
|
---|
| 26 | pattern: RegExp(
|
---|
| 27 | '((?:' + // start of line
|
---|
| 28 | (/^/.source +
|
---|
| 29 | '|' + // operators and other language constructs
|
---|
| 30 | /[;=<>+\-*/^({\[]/.source +
|
---|
| 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/
|
---|
| 33 | .source) +
|
---|
| 34 | ')[ \t]*)' +
|
---|
| 35 | '(?!' +
|
---|
| 36 | keywords.source +
|
---|
| 37 | ')' +
|
---|
| 38 | /[a-z_]\w*\b/.source +
|
---|
| 39 | '(?=[ \t]*(?:' + // variable
|
---|
| 40 | ('(?!' +
|
---|
| 41 | keywords.source +
|
---|
| 42 | ')' +
|
---|
| 43 | /[a-z_]/.source +
|
---|
| 44 | '|' + // number
|
---|
| 45 | /\d|-\.?\d/.source +
|
---|
| 46 | '|' + // other expressions or literals
|
---|
| 47 | /[({'"$@#?]/.source) +
|
---|
| 48 | '))',
|
---|
| 49 | 'im'
|
---|
| 50 | ),
|
---|
| 51 | lookbehind: true,
|
---|
| 52 | greedy: true,
|
---|
| 53 | alias: 'function'
|
---|
| 54 | },
|
---|
| 55 | 'function-definition': {
|
---|
| 56 | pattern: /(\b(?:fn|function)\s+)\w+\b/i,
|
---|
| 57 | lookbehind: true,
|
---|
| 58 | alias: 'function'
|
---|
| 59 | },
|
---|
| 60 | argument: {
|
---|
| 61 | pattern: /\b[a-z_]\w*(?=:)/i,
|
---|
| 62 | alias: 'attr-name'
|
---|
| 63 | },
|
---|
| 64 | keyword: keywords,
|
---|
| 65 | boolean: /\b(?:false|true)\b/,
|
---|
| 66 | time: {
|
---|
| 67 | pattern:
|
---|
| 68 | /(^|[^\w.])(?:(?:(?:\d+(?:\.\d*)?|\.\d+)(?:[eEdD][+-]\d+|[LP])?[msft])+|\d+:\d+(?:\.\d*)?)(?![\w.:])/,
|
---|
| 69 | lookbehind: true,
|
---|
| 70 | alias: 'number'
|
---|
| 71 | },
|
---|
| 72 | number: [
|
---|
| 73 | {
|
---|
| 74 | pattern:
|
---|
| 75 | /(^|[^\w.])(?:(?:\d+(?:\.\d*)?|\.\d+)(?:[eEdD][+-]\d+|[LP])?|0x[a-fA-F0-9]+)(?![\w.:])/,
|
---|
| 76 | lookbehind: true
|
---|
| 77 | },
|
---|
| 78 | /\b(?:e|pi)\b/
|
---|
| 79 | ],
|
---|
| 80 | constant: /\b(?:dontcollect|ok|silentValue|undefined|unsupplied)\b/,
|
---|
| 81 | color: {
|
---|
| 82 | pattern: /\b(?:black|blue|brown|gray|green|orange|red|white|yellow)\b/i,
|
---|
| 83 | alias: 'constant'
|
---|
| 84 | },
|
---|
| 85 | operator: /[-+*/<>=!]=?|[&^?]|#(?!\()/,
|
---|
| 86 | punctuation: /[()\[\]{}.:,;]|#(?=\()|\\$/m
|
---|
| 87 | }
|
---|
| 88 | })(Prism)
|
---|
| 89 | }
|
---|