优化着色

master
yutent 2024-06-04 11:35:45 +08:00
parent 428261416c
commit 87c7877a81
1 changed files with 3 additions and 3 deletions

View File

@ -16,12 +16,12 @@ const IMPORT_2 = /import ([\w\W]*?) from (['"])([^'"]*?)\2/g
const IMPORT_3 = /import\((['"])([^'"]*?)\1\)/g const IMPORT_3 = /import\((['"])([^'"]*?)\1\)/g
const KEYWOWRD1 = const KEYWOWRD1 =
/\b(var|const|let|function|for|switch|with|if|else|export|import|assert|as|from|async|await|break|continue|return|class|extends|try|catch|throw|new|while|this|super|default|case|debugger|delete|do|goto|in|static|get|set|public|private|protected|package|typeof|void)\b/g /\b(var|const|let|function|for|switch|with|if|else|export|import|assert|as|from|async|await|break|continue|return|class|extends|try|catch|throw|new|while|this|super|default|case|debugger|delete|do|goto|in|static|get|set|public|private|protected|package|typeof|void)\b/g
const KEYWOWRD2 = /\s(=|-|\+|\/|\*|<|>|%)\s/g const KEYWOWRD2 = /\s(=|-|\+|\/|\*|<|<=|>|>=|%)\s/g
const KEYWOWRD3 = const KEYWOWRD3 =
/(\+\=|-=|\/=|\*=|--|\+\+|===|==|=>|\.\.\.|\.|\?\.|\?\?|&&|\|\|)/g /(\+=|-=|\/=|\*=|\?\?=|--|\+\+|===|==|!==|!=|=>|\.\.\.|\.|\?\.|\?\?|&&|\|\|)/g
const BUILDIN1 = /\b(null|undefined|true|false|NaN|Infinity)\b/g const BUILDIN1 = /\b(null|undefined|true|false|NaN|Infinity)\b/g
const BUILDIN2 = const BUILDIN2 =
/\b(Object|String|Array|Boolean|Number|Function|Promise|Map|Set|WeakMap|WeakSet|URL)\b/g /\b(Object|String|Array|Boolean|Number|Function|Promise|Proxy|Reflect|Map|Set|WeakMap|WeakSet|URL)\b/g
const STR = /(['"`])(.*?)(?<!\\)\1/g const STR = /(['"`])(.*?)(?<!\\)\1/g
const NUM = /\b(\d+)\b/g const NUM = /\b(\d+)\b/g
const FN = /([\.\s])((?!if|for)[a-zA-Z$_#][\da-zA-Z_]*)\s?(\(.*?\)?)/g const FN = /([\.\s])((?!if|for)[a-zA-Z$_#][\da-zA-Z_]*)\s?(\(.*?\)?)/g