Commit c1025aa638c40f6f0835162c46b49aae205242ae

Michael Schmidt 2021-12-07T12:51:55

Monkey: Use standard tokens correctly (#3228)

diff --git a/components/prism-monkey.js b/components/prism-monkey.js
index 88f9b0b..c5b7f61 100644
--- a/components/prism-monkey.js
+++ b/components/prism-monkey.js
@@ -1,25 +1,23 @@
 Prism.languages.monkey = {
-	'string': /"[^"\r\n]*"/,
-	'comment': [
-		{
-			pattern: /^#Rem\s[\s\S]*?^#End/im,
-			greedy: true
-		},
-		{
-			pattern: /'.+/,
-			greedy: true
-		}
-	],
+	'comment': {
+		pattern: /^#Rem\s[\s\S]*?^#End|'.+/im,
+		greedy: true
+	},
+	'string': {
+		pattern: /"[^"\r\n]*"/,
+		greedy: true,
+	},
 	'preprocessor': {
 		pattern: /(^[ \t]*)#.+/m,
 		lookbehind: true,
-		alias: 'comment'
+		greedy: true,
+		alias: 'property'
 	},
+
 	'function': /\b\w+(?=\()/,
 	'type-char': {
-		pattern: /(\w)[?%#$]/,
-		lookbehind: true,
-		alias: 'variable'
+		pattern: /\b[?%#$]/,
+		alias: 'class-name'
 	},
 	'number': {
 		pattern: /((?:\.\.)?)(?:(?:\b|\B-\.?|\B\.)\d+(?:(?!\.\.)\.\d*)?|\$[\da-f]+)/i,
diff --git a/components/prism-monkey.min.js b/components/prism-monkey.min.js
index 00ab56d..5908950 100644
--- a/components/prism-monkey.min.js
+++ b/components/prism-monkey.min.js
@@ -1 +1 @@
-Prism.languages.monkey={string:/"[^"\r\n]*"/,comment:[{pattern:/^#Rem\s[\s\S]*?^#End/im,greedy:!0},{pattern:/'.+/,greedy:!0}],preprocessor:{pattern:/(^[ \t]*)#.+/m,lookbehind:!0,alias:"comment"},function:/\b\w+(?=\()/,"type-char":{pattern:/(\w)[?%#$]/,lookbehind:!0,alias:"variable"},number:{pattern:/((?:\.\.)?)(?:(?:\b|\B-\.?|\B\.)\d+(?:(?!\.\.)\.\d*)?|\$[\da-f]+)/i,lookbehind:!0},keyword:/\b(?:Abstract|Array|Bool|Case|Catch|Class|Const|Continue|Default|Eachin|Else|ElseIf|End|EndIf|Exit|Extends|Extern|False|Field|Final|Float|For|Forever|Function|Global|If|Implements|Import|Inline|Int|Interface|Local|Method|Module|New|Next|Null|Object|Private|Property|Public|Repeat|Return|Select|Self|Step|Strict|String|Super|Then|Throw|To|True|Try|Until|Void|Wend|While)\b/i,operator:/\.\.|<[=>]?|>=?|:?=|(?:[+\-*\/&~|]|\b(?:Mod|Shl|Shr)\b)=?|\b(?:And|Not|Or)\b/i,punctuation:/[.,:;()\[\]]/};
\ No newline at end of file
+Prism.languages.monkey={comment:{pattern:/^#Rem\s[\s\S]*?^#End|'.+/im,greedy:!0},string:{pattern:/"[^"\r\n]*"/,greedy:!0},preprocessor:{pattern:/(^[ \t]*)#.+/m,lookbehind:!0,greedy:!0,alias:"property"},function:/\b\w+(?=\()/,"type-char":{pattern:/\b[?%#$]/,alias:"class-name"},number:{pattern:/((?:\.\.)?)(?:(?:\b|\B-\.?|\B\.)\d+(?:(?!\.\.)\.\d*)?|\$[\da-f]+)/i,lookbehind:!0},keyword:/\b(?:Abstract|Array|Bool|Case|Catch|Class|Const|Continue|Default|Eachin|Else|ElseIf|End|EndIf|Exit|Extends|Extern|False|Field|Final|Float|For|Forever|Function|Global|If|Implements|Import|Inline|Int|Interface|Local|Method|Module|New|Next|Null|Object|Private|Property|Public|Repeat|Return|Select|Self|Step|Strict|String|Super|Then|Throw|To|True|Try|Until|Void|Wend|While)\b/i,operator:/\.\.|<[=>]?|>=?|:?=|(?:[+\-*\/&~|]|\b(?:Mod|Shl|Shr)\b)=?|\b(?:And|Not|Or)\b/i,punctuation:/[.,:;()\[\]]/};
\ No newline at end of file