Monkey: Use standard tokens correctly (#3228)
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
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