Maxscript: Fixed booleans not being highlighted (#3134)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
diff --git a/components/prism-maxscript.js b/components/prism-maxscript.js
index d5e58e0..0c775aa 100644
--- a/components/prism-maxscript.js
+++ b/components/prism-maxscript.js
@@ -25,7 +25,7 @@ Prism.languages.maxscript = {
alias: 'attr-name'
},
- '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|off|on|or|parameters|persistent|plugin|rcmenu|return|rollout|set|struct|then|throw|to|tool|try|undo|utility|when|where|while|with)\b/i,
+ '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,
'boolean': /\b(?:false|off|on|true)\b/,
'time': {
diff --git a/components/prism-maxscript.min.js b/components/prism-maxscript.min.js
index 7502744..4716930 100644
--- a/components/prism-maxscript.min.js
+++ b/components/prism-maxscript.min.js
@@ -1 +1 @@
-Prism.languages.maxscript={comment:{pattern:/\/\*[\s\S]*?(?:\*\/|$)|--.*/,greedy:!0},string:{pattern:/(^|[^"\\@])(?:"(?:[^"\\]|\\[\s\S])*"|@"[^"]*")/,lookbehind:!0,greedy:!0},path:{pattern:/\$(?:[\w/\\.*?]|'[^']*')*/,greedy:!0,alias:"string"},"function-definition":{pattern:/(\b(?:fn|function)\s+)\w+\b/,lookbehind:!0,alias:"function"},argument:{pattern:/\b[a-z_]\w*(?=:)/i,alias:"attr-name"},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|off|on|or|parameters|persistent|plugin|rcmenu|return|rollout|set|struct|then|throw|to|tool|try|undo|utility|when|where|while|with)\b/i,boolean:/\b(?:false|off|on|true)\b/,time:{pattern:/(^|[^\w.])(?:(?:(?:\d+(?:\.\d*)?|\.\d+)(?:[eEdD][+-]\d+|[LP])?[msft])+|\d+:\d+(?:\.\d*)?)(?![\w.:])/,lookbehind:!0,alias:"number"},number:[{pattern:/(^|[^\w.])(?:(?:\d+(?:\.\d*)?|\.\d+)(?:[eEdD][+-]\d+|[LP])?|0x[a-fA-F0-9]+)(?![\w.:])/,lookbehind:!0},/\b(?:e|pi)\b/],constant:/\b(?:black|blue|brown|gray|green|orange|red|white|yellow)\b/,color:{pattern:/\b(?:dontcollect|ok|silentValue|undefined|unsupplied)\b/i,alias:"constant"},operator:/[-+*/<>=!]=?|[&^]|#(?!\()/,punctuation:/[()\[\]{}.:,;]|#(?=\()|\\$/m};
\ No newline at end of file
+Prism.languages.maxscript={comment:{pattern:/\/\*[\s\S]*?(?:\*\/|$)|--.*/,greedy:!0},string:{pattern:/(^|[^"\\@])(?:"(?:[^"\\]|\\[\s\S])*"|@"[^"]*")/,lookbehind:!0,greedy:!0},path:{pattern:/\$(?:[\w/\\.*?]|'[^']*')*/,greedy:!0,alias:"string"},"function-definition":{pattern:/(\b(?:fn|function)\s+)\w+\b/,lookbehind:!0,alias:"function"},argument:{pattern:/\b[a-z_]\w*(?=:)/i,alias:"attr-name"},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,boolean:/\b(?:false|off|on|true)\b/,time:{pattern:/(^|[^\w.])(?:(?:(?:\d+(?:\.\d*)?|\.\d+)(?:[eEdD][+-]\d+|[LP])?[msft])+|\d+:\d+(?:\.\d*)?)(?![\w.:])/,lookbehind:!0,alias:"number"},number:[{pattern:/(^|[^\w.])(?:(?:\d+(?:\.\d*)?|\.\d+)(?:[eEdD][+-]\d+|[LP])?|0x[a-fA-F0-9]+)(?![\w.:])/,lookbehind:!0},/\b(?:e|pi)\b/],constant:/\b(?:black|blue|brown|gray|green|orange|red|white|yellow)\b/,color:{pattern:/\b(?:dontcollect|ok|silentValue|undefined|unsupplied)\b/i,alias:"constant"},operator:/[-+*/<>=!]=?|[&^]|#(?!\()/,punctuation:/[()\[\]{}.:,;]|#(?=\()|\\$/m};
\ No newline at end of file
diff --git a/tests/languages/maxscript/boolean_feature.test b/tests/languages/maxscript/boolean_feature.test
index 6d7dfb5..42f44fd 100644
--- a/tests/languages/maxscript/boolean_feature.test
+++ b/tests/languages/maxscript/boolean_feature.test
@@ -1,7 +1,9 @@
true false
+on off
----------------------------------------------------
[
- ["boolean", "true"], ["boolean", "false"]
+ ["boolean", "true"], ["boolean", "false"],
+ ["boolean", "on"], ["boolean", "off"]
]
diff --git a/tests/languages/maxscript/keyword_feature.test b/tests/languages/maxscript/keyword_feature.test
index 200aac3..1df37aa 100644
--- a/tests/languages/maxscript/keyword_feature.test
+++ b/tests/languages/maxscript/keyword_feature.test
@@ -26,8 +26,6 @@ mapped;
max;
not;
of;
-off;
-on;
or;
parameters;
persistent;
@@ -80,8 +78,6 @@ with;
["keyword", "max"], ["punctuation", ";"],
["keyword", "not"], ["punctuation", ";"],
["keyword", "of"], ["punctuation", ";"],
- ["keyword", "off"], ["punctuation", ";"],
- ["keyword", "on"], ["punctuation", ";"],
["keyword", "or"], ["punctuation", ";"],
["keyword", "parameters"], ["punctuation", ";"],
["keyword", "persistent"], ["punctuation", ";"],