From c6574e6b721d593d0c0047305ac852b5de0828b4 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Tue, 5 Oct 2021 23:33:31 +0200 Subject: [PATCH] Maxscript: Fixed booleans not being highlighted (#3134) --- components/prism-maxscript.js | 2 +- components/prism-maxscript.min.js | 2 +- tests/languages/maxscript/boolean_feature.test | 4 +++- tests/languages/maxscript/keyword_feature.test | 4 ---- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/components/prism-maxscript.js b/components/prism-maxscript.js index d5e58e009f..0c775aa88a 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 7502744b1c..4716930cf5 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 6d7dfb5191..42f44fd639 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 200aac37ca..1df37aacac 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", ";"],