Commit c6574e6b721d593d0c0047305ac852b5de0828b4

Michael Schmidt 2021-10-05T23:33:31

Maxscript: Fixed booleans not being highlighted (#3134)

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", ";"],