| 11 | 11 | 'string_interp' => '/("(?:\\\\.|[^"\\\\])*"|""".*?""")/', |
| 12 | 12 | 'string' => '/(\'(?:\\\\.|[^\'\\\\])*\'|\'\'\'.*?\'\'\'|\/.*?\/)/', |
| 13 | | 'keyword' => '/\b(def|task|group|version|ext|return|if|else)\b/', |
| 13 | 'keyword' => '/\b(?:def|task|group|version|ext|return|if|else)\b/', |
| 14 | 14 | 'function' => '/\b(apply|plugin|sourceCompatibility|targetCompatibility|repositories|dependencies|test|plugins|buildscript|allprojects|subprojects|project|implementation|api|compileOnly|runtimeOnly|testImplementation|testRuntimeOnly|mavenCentral|google|jcenter|classpath)\b|\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\(|{)/', |
| 15 | 15 | 'variable' => '/(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{[^}]+\})/', |
| 16 | | 'boolean' => '/\b(true|false|null)\b/', |
| 16 | 'boolean' => '/\b(?:true|false|null)\b/', |
| 17 | 17 | 'number' => '/' . $int . '/', |
| 18 | 18 | ], |
| ... |
| 29 | 29 | 'string' => '/(\'(?:\\\\.|[^\'\\\\])*\')/', |
| 30 | 30 | 'comment' => '/(\/\/[^\r\n]*|#[^\r\n]*|\/\*.*?\*\/)/ms', |
| 31 | | 'keyword' => '/\b(class|abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|new|or|print|private|protected|public|require|require_once|return|static|switch|throw|trait|try|unset|use|var|while|xor|yield)\b/', |
| 31 | 'keyword' => '/\b(?:abstract|and|array|as|break|callable|case|catch|class|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|new|or|print|private|protected|public|readonly|require|require_once|return|static|switch|throw|trait|try|unset|use|var|while|xor|yield)\b/', |
| 32 | 32 | 'function' => '/\b([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\s*(?=\()/', |
| 33 | 33 | 'variable' => '/(\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)/', |
| 34 | 34 | 'number' => '/' . $int . '/', |
| 35 | 35 | 'boolean' => '/\b(true|false|null)\b/i', |
| 36 | 36 | ], |
| 37 | 37 | 'bash' => [ |
| 38 | 38 | 'string_interp' => '/("(?:\\\\.|[^"\\\\])*")/', |
| 39 | 39 | 'string' => '/(\'.*?\')/', |
| 40 | 40 | 'comment' => '/(#[^\n]*)/', |
| 41 | | 'keyword' => '/(?<!-)\b(alias|bg|bind|break|builtin|case|cd|command|compgen|complete|continue|declare|dirs|disown|do|done|echo|elif|else|enable|esac|eval|exec|exit|export|fc|fg|fi|for|function|getopts|hash|help|history|if|jobs|kill|let|local|logout|popd|printf|pushd|pwd|read|readonly|return|set|shift|shopt|source|suspend|test|then|times|trap|type|typeset|ulimit|umask|unalias|unset|until|wait|while)\b/', |
| 41 | 'keyword' => '/(?<!-)\b(?:alias|bg|bind|break|builtin|case|cd|command|compgen|complete|continue|coproc|declare|dirs|disown|do|done|echo|elif|else|enable|esac|eval|exec|exit|export|fc|fg|fi|for|function|getopts|hash|help|history|if|jobs|kill|let|local|logout|popd|printf|pushd|pwd|read|readonly|return|select|set|shift|shopt|source|suspend|test|then|time|times|trap|type|typeset|ulimit|umask|unalias|unset|until|wait|while)\b/', |
| 42 | 42 | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| 43 | 43 | 'variable' => '/(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{[^}]+\})/', |
| 44 | 44 | 'number' => '/' . $int . '/', |
| 45 | 45 | ], |
| 46 | 46 | 'batch' => [ |
| 47 | 47 | 'comment' => '/((?i:rem)\b[^\n]*|::[^\n]*)/', |
| 48 | 48 | 'string' => '/("[^"]*")/', |
| 49 | | 'keyword' => '/(?i)\b(if|else|goto|for|in|do|exit|echo|pause|set|shift|start|cd|dir|copy|del|md|rd|cls|setlocal|endlocal|enabledelayedexpansion|defined|exist|not|errorlevel|setx|findstr|reg|nul|tokens|usebackq|equ|neq|lss|leq|gtr|geq)\b/', |
| 49 | 'keyword' => '/(?i)\b(?:if|else|goto|for|in|do|exit|echo|pause|set|shift|start|cd|dir|copy|del|md|rd|cls|setlocal|endlocal|enabledelayedexpansion|defined|exist|not|errorlevel|setx|findstr|reg|nul|tokens|usebackq|equ|neq|lss|leq|gtr|geq)\b/', |
| 50 | 50 | 'function' => '/(?i)\b(call)\b/', |
| 51 | 51 | 'variable' => '/(![\w-]+!|%[\w\(\)-]+%|%%[~a-zA-Z]+|%[~a-zA-Z0-9]+)/', |
| ... |
| 58 | 58 | 'include' => '/(^\s*#include[^\r\n]*)/m', |
| 59 | 59 | 'preprocessor' => '/(^\s*#(?!include\b)[^\r\n]*)/m', |
| 60 | | 'keyword' => '/\b(auto|break|case|const|continue|default|do|else|enum|extern|for|goto|if|noreturn|register|return|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/', |
| 61 | | 'type' => '/\b(char|double|float|int|long|short|void)\b/', |
| 60 | 'keyword' => '/\b(?:auto|break|case|const|continue|default|do|else|enum|extern|for|goto|if|noreturn|register|return|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/', |
| 61 | 'type' => '/\b(?:char|double|float|int|long|short|void)\b/', |
| 62 | 62 | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| 63 | 63 | 'number' => '/' . $int . '/', |
| 64 | 64 | ], |
| 65 | 65 | 'cpp' => [ |
| 66 | 66 | 'string' => '/' . $str . '/', |
| 67 | 67 | 'comment' => '/(\/\/[^\r\n]*|\/\*.*?\*\/)/ms', |
| 68 | 68 | 'include' => '/(^\s*#include[^\r\n]*)/m', |
| 69 | 69 | 'preprocessor' => '/(^\s*#(?!include\b)[^\r\n]*)/m', |
| 70 | | 'keyword' => '/\b(alignas|alignof|and|and_eq|asm|auto|bitand|bitor|break|case|catch|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|dynamic_cast|else|enum|explicit|export|extern|for|friend|goto|if|inline|mutable|namespace|new|noexcept|noreturn|not|not_eq|nullptr|operator|or|or_eq|private|protected|public|register|reinterpret_cast|return|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|using|virtual|volatile|while|xor|xor_eq)\b/', |
| 71 | | 'type' => '/\b(bool|char|char16_t|char32_t|double|float|int|long|short|signed|unsigned|void|wchar_t)\b/', |
| 72 | | 'boolean' => '/\b(true|false)\b/', |
| 70 | 'keyword' => '/\b(?:alignas|alignof|and|and_eq|asm|auto|bitand|bitor|break|case|catch|class|co_await|co_return|co_yield|compl|concept|const|consteval|constexpr|constinit|const_cast|continue|decltype|default|delete|do|dynamic_cast|else|enum|explicit|export|extern|for|friend|goto|if|inline|mutable|namespace|new|noexcept|noreturn|not|not_eq|nullptr|operator|or|or_eq|private|protected|public|register|reinterpret_cast|requires|return|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|using|virtual|volatile|while|xor|xor_eq)\b/', |
| 71 | 'type' => '/\b(?:bool|char|char16_t|char32_t|double|float|int|long|short|signed|unsigned|void|wchar_t)\b/', |
| 72 | 'boolean' => '/\b(?:true|false)\b/', |
| 73 | 73 | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| 74 | 74 | 'number' => '/' . $int . '/', |
| 75 | 75 | ], |
| 76 | 76 | 'java' => [ |
| 77 | 77 | 'class' => '/(@[a-zA-Z_][a-zA-Z0-9_]*)/', |
| 78 | 78 | 'string' => '/' . $str . '/', |
| 79 | 79 | 'comment' => '/(\/\/[^\r\n]*|\/\*.*?\*\/)/ms', |
| 80 | | 'keyword' => '/\b(abstract|assert|break|case|catch|class|const|continue|default|do|else|enum|extends|final|finally|for|goto|if|implements|import|instanceof|interface|native|new|package|private|protected|public|return|static|strictfp|super|switch|synchronized|this|throw|throws|transient|try|void|volatile|while)\b/', |
| 81 | | 'type' => '/\b(boolean|byte|char|double|float|int|long|short|void)\b/', |
| 82 | | 'boolean' => '/\b(true|false|null)\b/', |
| 80 | 'keyword' => '/\b(?:abstract|assert|break|case|catch|class|const|continue|default|do|else|enum|extends|final|finally|for|goto|if|implements|import|instanceof|interface|native|new|non-sealed|package|permits|private|protected|public|record|return|sealed|static|strictfp|super|switch|synchronized|this|throw|throws|transient|try|var|void|volatile|while|yield)\b/', |
| 81 | 'type' => '/\b(?:boolean|byte|char|double|float|int|long|short|void)\b/', |
| 82 | 'boolean' => '/\b(?:true|false|null)\b/', |
| 83 | 83 | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| 84 | 84 | 'number' => '/' . $int . '/', |
| 85 | 85 | ], |
| 86 | 86 | 'go' => [ |
| 87 | 87 | 'string' => '/("(?:\\\\.|[^"\\\\])*"|`.*?`)/s', |
| 88 | 88 | 'comment' => '/(\/\/[^\r\n]*|\/\*.*?\*\/)/ms', |
| 89 | | 'keyword' => '/\b(break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go|goto|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/', |
| 90 | | 'boolean' => '/\b(true|false|nil|iota)\b/', |
| 89 | 'keyword' => '/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go|goto|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/', |
| 90 | 'boolean' => '/\b(?:true|false|nil|iota)\b/', |
| 91 | 91 | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| 92 | 92 | 'number' => '/' . $int . '/', |
| 93 | 93 | ], |
| 94 | 94 | 'rust' => [ |
| 95 | 95 | 'string' => '/' . $str . '/', |
| 96 | 96 | 'comment' => '/(\/\/[^\r\n]*|\/\*.*?\*\/)/ms', |
| 97 | | 'keyword' => '/\b(as|break|const|continue|crate|else|enum|extern|fn|for|if|impl|in|let|loop|match|mod|move|mut|pub|ref|return|self|Self|static|struct|super|trait|type|unsafe|use|where|while|async|await|dyn)\b/', |
| 98 | | 'boolean' => '/\b(true|false)\b/', |
| 97 | 'keyword' => '/\b(?:as|async|await|break|const|continue|crate|dyn|else|enum|extern|fn|for|if|impl|in|let|loop|match|mod|move|mut|pub|ref|return|self|Self|static|struct|super|trait|type|union|unsafe|use|where|while)\b/', |
| 98 | 'boolean' => '/\b(?:true|false)\b/', |
| 99 | 99 | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| 100 | 100 | 'number' => '/' . $int . '/', |
| 101 | 101 | ], |
| 102 | 102 | 'python' => [ |
| 103 | 103 | 'string' => '/(\'\'\'.*?\'\'\'|""".*?"""|"(?:\\\\.|[^"\\\\])*"|\'(?:\\\\.|[^\'\\\\])*\')/s', |
| 104 | 104 | 'comment' => '/(#[^\r\n]*)/m', |
| 105 | | 'keyword' => '/\b(and|as|assert|async|await|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|raise|return|try|while|with|yield)\b/', |
| 106 | | 'boolean' => '/\b(False|None|True)\b/', |
| 105 | 'keyword' => '/\b(?:and|as|assert|async|await|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|raise|return|try|while|with|yield)\b/', |
| 106 | 'boolean' => '/\b(?:False|None|True)\b/', |
| 107 | 107 | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| 108 | 108 | 'number' => '/' . $int . '/', |
| 109 | 109 | ], |
| 110 | 110 | 'ruby' => [ |
| 111 | 111 | 'string_interp' => '/("(?:\\\\.|[^"\\\\])*")/', |
| 112 | 112 | 'string' => '/(\'(?:\\\\.|[^\'\\\\])*\')/', |
| 113 | 113 | 'comment' => '/(#[^\r\n]*)/m', |
| 114 | | 'keyword' => '/\b(alias|and|begin|break|case|class|def|defined|do|else|elsif|end|ensure|for|if|in|module|next|not|or|redo|rescue|retry|return|self|super|then|undef|unless|until|when|while|yield)\b/', |
| 115 | | 'boolean' => '/\b(true|false|nil)\b/', |
| 114 | 'keyword' => '/\b(?:alias|and|begin|break|case|class|def|defined|do|else|elsif|end|ensure|for|if|in|module|next|not|or|redo|rescue|retry|return|self|super|then|undef|unless|until|when|while|yield)\b/', |
| 115 | 'boolean' => '/\b(?:true|false|nil)\b/', |
| 116 | 116 | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*[?!]?)\s*(?=\()/', |
| 117 | 117 | 'variable' => '/(@[a-zA-Z_]\w*|\$[a-zA-Z_]\w*)/', |
| 118 | 118 | 'number' => '/' . $int . '/', |
| 119 | 119 | ], |
| 120 | 120 | 'lua' => [ |
| 121 | 121 | 'string' => '/("(?:\\\\.|[^"\\\\])*"|\'(?:\\\\.|[^\'\\\\])*\'|\[\[.*?\]\])/s', |
| 122 | 122 | 'comment' => '/(--\[\[.*?\]\]|--[^\r\n]*)/ms', |
| 123 | | 'keyword' => '/\b(and|break|do|else|elseif|end|for|function|if|in|local|not|or|repeat|return|then|until|while)\b/', |
| 124 | | 'boolean' => '/\b(false|nil|true)\b/', |
| 123 | 'keyword' => '/\b(?:and|break|do|else|elseif|end|for|function|if|in|local|not|or|repeat|return|then|until|while)\b/', |
| 124 | 'boolean' => '/\b(?:false|nil|true)\b/', |
| 125 | 125 | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| 126 | 126 | 'number' => '/' . $int . '/', |
| 127 | 127 | ], |
| 128 | 128 | 'javascript' => [ |
| 129 | 129 | 'string' => '/("(?:\\\\.|[^"\\\\])*"|\'(?:\\\\.|[^\'\\\\])*\'|`(?:\\\\.|[^`\\\\])*`)/s', |
| 130 | 130 | 'comment' => '/(\/\/[^\r\n]*|\/\*.*?\*\/)/ms', |
| 131 | | 'keyword' => '/\b(async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|export|extends|finally|for|function|if|import|in|instanceof|new|return|super|switch|this|throw|try|typeof|var|void|while|with|yield|let|static|enum)\b/', |
| 132 | | 'boolean' => '/\b(true|false|null|undefined)\b/', |
| 131 | 'keyword' => '/\b(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|if|import|in|instanceof|let|new|of|return|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/', |
| 132 | 'boolean' => '/\b(?:true|false|null|undefined)\b/', |
| 133 | 133 | 'function' => '/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?=\()/', |
| 134 | 134 | 'number' => '/' . $int . '/', |
| 135 | 135 | ], |
| 136 | 136 | 'typescript' => [ |
| 137 | 137 | 'string' => '/("(?:\\\\.|[^"\\\\])*"|\'(?:\\\\.|[^\'\\\\])*\'|`(?:\\\\.|[^`\\\\])*`)/s', |
| 138 | 138 | 'comment' => '/(\/\/[^\r\n]*|\/\*.*?\*\/)/ms', |
| 139 | | 'keyword' => '/\b(any|as|break|case|catch|class|const|continue|debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from|function|if|implements|import|in|instanceof|interface|let|module|namespace|new|of|package|private|protected|public|require|return|static|super|switch|this|throw|try|type|typeof|var|void|while|with|yield)\b/', |
| 140 | | 'type' => '/\b(boolean|number|string|void|any)\b/', |
| 141 | | 'boolean' => '/\b(true|false|null|undefined)\b/', |
| 139 | 'keyword' => '/\b(?:abstract|any|as|break|case|catch|class|const|continue|debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from|function|if|implements|import|in|instanceof|interface|is|let|module|namespace|new|of|package|private|protected|public|readonly|require|return|static|super|switch|this|throw|try|type|typeof|var|void|while|with|yield)\b/', |
| 140 | 'type' => '/\b(?:boolean|number|string|void|any)\b/', |
| 141 | 'boolean' => '/\b(?:true|false|null|undefined)\b/', |
| 142 | 142 | 'function' => '/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?=\()/', |
| 143 | 143 | 'number' => '/' . $int . '/', |
| ... |
| 171 | 171 | 'string' => '/(\'.*?\')/', |
| 172 | 172 | 'comment' => '/(--[^\r\n]*|\/\*.*?\*\/)/ms', |
| 173 | | 'keyword' => '/(?i)\b(SELECT|FROM|WHERE|INSERT|INTO|UPDATE|DELETE|JOIN|LEFT|RIGHT|INNER|OUTER|ON|GROUP|BY|ORDER|HAVING|LIMIT|OFFSET|CREATE|TABLE|DROP|ALTER|INDEX|KEY|PRIMARY|FOREIGN|CONSTRAINT|DEFAULT|NOT|AND|OR|IN|VALUES|SET|AS|DISTINCT|UNION|ALL|CASE|WHEN|THEN|ELSE|END)\b/', |
| 173 | 'keyword' => '/(?i)\b(ADD|ALTER|AND|AS|ASC|BEGIN|BETWEEN|BY|CASE|CHECK|COLUMN|COMMIT|CONSTRAINT|CREATE|DATABASE|DEFAULT|DELETE|DESC|DISTINCT|DROP|ELSE|END|EXISTS|FOREIGN|FROM|FULL|FUNCTION|GRANT|GROUP|HAVING|IF|IN|INDEX|INNER|INSERT|INTO|IS|JOIN|KEY|LEFT|LIKE|LIMIT|NOT|NULL|OFFSET|ON|OR|ORDER|OUTER|PRIMARY|PROCEDURE|REFERENCES|REVOKE|RIGHT|ROLLBACK|SCHEMA|SELECT|SET|TABLE|THEN|TRANSACTION|TRIGGER|TRUNCATE|UNION|UNIQUE|UPDATE|VALUES|VIEW|WHEN|WHERE)\b/', |
| 174 | 174 | 'boolean' => '/(?i)\b(NULL|TRUE|FALSE)\b/', |
| 175 | 175 | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| 176 | 176 | 'number' => '/' . $int . '/', |
| 177 | 177 | ], |
| 178 | 178 | 'yaml' => [ |
| 179 | | 'string' => '/' . $str . '/', |
| 180 | | 'comment' => '/(#[^\r\n]*)/m', |
| 181 | | 'attribute' => '/^(\s*[a-zA-Z0-9_-]+:)/m', |
| 179 | 'comment' => '/(#[^\r\n]*)/m', |
| 180 | 'variable' => '/^(\s*[a-zA-Z0-9_-]+:)/m', |
| 181 | 'string_interp' => '/((?<=:)\s*[^\r\n]*)/', |
| 182 | 'number' => '/' . $float . '/', |
| 183 | ], |
| 184 | 'properties' => [ |
| 185 | 'comment' => '/(^[ \t]*[#!][^\r\n]*)/m', |
| 186 | 'variable' => '/(^[ \t]*[^:=\s]+)(?=[ \t]*[:=])/m', |
| 187 | 'string_interp' => '/((?<=[=:])\s*[^\r\n]*)/', |
| 188 | ], |
| 189 | 'ini' => [ |
| 190 | 'comment' => '/(^[ \t]*[;#][^\r\n]*)/m', |
| 191 | 'keyword' => '/(^\[[^\]\r\n]+\])/m', |
| 192 | 'variable' => '/(^[ \t]*[a-zA-Z0-9_\.\-]+)(?=\s*=)/m', |
| 193 | 'string' => '/((?<==)\s*[^\r\n]*)/', |
| 194 | ], |
| 195 | 'toml' => [ |
| 196 | 'comment' => '/(#[^\r\n]*)/', |
| 197 | 'keyword' => '/(^\[[^\]\r\n]+\])/m', |
| 198 | 'variable' => '/(\b[a-zA-Z0-9_-]+\b)(?=\s*=)/', |
| 199 | 'string' => '/(' . $str . '|"""[\s\S]*?"""|\'\'\'[\s\S]*?\'\'\')/', |
| 200 | 'boolean' => '/\b(true|false)\b/', |
| 201 | 'date' => '/(\d{4}-\d{2}-\d{2}(?:[Tt ]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?)?)/', |
| 182 | 202 | 'number' => '/' . $float . '/', |
| 183 | 203 | ], |
| 184 | 204 | 'markdown' => [ |
| 185 | | 'code' => '/(^(?: |\t)[^\n]*(?:\n(?: |\t)[^\n]*)*)/', |
| 186 | | 'comment' => '/(```[\s\S]*?```|~~~[\s\S]*?~~~)/', |
| 187 | | 'math' => '/(\$((?:[^`\n$]|`[^`\n]*`)+)\$)/', |
| 188 | | 'keyword' => '/^(#{1,6})(?=\s)/m', |
| 189 | | 'string' => '/(\*\*[^\n*]+\*\*|__[^\n_]+__)/', |
| 205 | 'code' => '/(^(?: |\t)[^\n]*(?:\n(?: |\t)[^\n]*)*)/', |
| 206 | 'comment' => '/(```[\s\S]*?```|~~~[\s\S]*?~~~)/', |
| 207 | 'math' => '/(\$((?:[^`\n$]|`[^`\n]*`)+)\$)/', |
| 208 | 'keyword' => '/^(#{1,6})(?=\s)/m', |
| 209 | 'string' => '/(\*\*[^\n*]+\*\*|__[^\n_]+__)/', |
| 190 | 210 | 'attribute' => '/(?<!\*)(\*[^\n*]+\*)(?!\*)|(?<!_)(_[^\n_]+_)(?!_)/', |
| 191 | | 'function' => '/(`[^`\n]+`)/', |
| 192 | | 'variable' => '/(\[[^\]]+\]\([^\)]+\))/', |
| 193 | | 'operator' => '/^(\s*[-*+](?=\s)|\s*\d+\.(?=\s))/m', |
| 211 | 'function' => '/(`[^`\n]+`)/', |
| 212 | 'variable' => '/(\[[^\]]+\]\([^\)]+\))/', |
| 213 | 'operator' => '/^(\s*[-*+](?=\s)|\s*\d+\.(?=\s))/m', |
| 194 | 214 | ], |
| 195 | 215 | 'rmd' => [ |
| 196 | | 'code' => '/(^(?: |\t)[^\n]*(?:\n(?: |\t)[^\n]*)*)/', |
| 197 | | 'comment' => '/(```\{r[^\}]*\}[\s\S]*?```)/', |
| 198 | | 'math' => '/(\$((?:[^`\n$]|`[^`\n]*`)+)\$)/', |
| 199 | | 'keyword' => '/^(#{1,6})(?=\s)/m', |
| 200 | | 'string' => '/(\*\*[^\n*]+\*\*|__[^\n_]+__)/', |
| 216 | 'code' => '/(^(?: |\t)[^\n]*(?:\n(?: |\t)[^\n]*)*)/', |
| 217 | 'comment' => '/(```\{r[^\}]*\}[\s\S]*?```)/', |
| 218 | 'math' => '/(\$((?:[^`\n$]|`[^`\n]*`)+)\$)/', |
| 219 | 'keyword' => '/^(#{1,6})(?=\s)/m', |
| 220 | 'string' => '/(\*\*[^\n*]+\*\*|__[^\n_]+__)/', |
| 201 | 221 | 'attribute' => '/(?<!\*)(\*[^\n*]+\*)(?!\*)|(?<!_)(_[^\n_]+_)(?!_)/', |
| 202 | | 'function' => '/(`[^`\n]+`)/', |
| 203 | | 'variable' => '/(\[[^\]]+\]\([^\)]+\))/', |
| 204 | | 'operator' => '/^(\s*[-*+](?=\s)|\s*\d+\.(?=\s))/m', |
| 222 | 'function' => '/(`[^`\n]+`)/', |
| 223 | 'variable' => '/(\[[^\]]+\]\([^\)]+\))/', |
| 224 | 'operator' => '/^(\s*[-*+](?=\s)|\s*\d+\.(?=\s))/m', |
| 205 | 225 | ], |
| 206 | 226 | 'r' => [ |
| 207 | 227 | 'string' => '/' . $str . '/', |
| 208 | 228 | 'comment' => '/(#[^\r\n]*)/m', |
| 209 | | 'keyword' => '/\b(if|else|repeat|while|function|for|in|next|break)\b/', |
| 210 | | 'boolean' => '/\b(TRUE|FALSE|NULL|Inf|NaN|NA)\b/', |
| 229 | 'keyword' => '/\b(?:if|else|repeat|while|function|for|in|next|break)\b/', |
| 230 | 'boolean' => '/\b(?:TRUE|FALSE|NULL|Inf|NaN|NA)\b/', |
| 211 | 231 | 'function' => '/\b([a-zA-Z_.][a-zA-Z0-9_.]*)\s*(?=\()/', |
| 232 | 'number' => '/' . $float . '/', |
| 233 | ], |
| 234 | 'csharp' => [ |
| 235 | 'string' => '/(@"(?:""|[^"])*"|' . $str . ')/', |
| 236 | 'comment' => '/(\/\/[^\r\n]*|\/\*.*?\*\/)/ms', |
| 237 | 'preprocessor' => '/(^\s*#[^\r\n]*)/m', |
| 238 | 'keyword' => '/\b(?:abstract|as|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|virtual|void|volatile|while)\b/', |
| 239 | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| 240 | 'number' => '/' . $int . '/', |
| 241 | ], |
| 242 | 'kotlin' => [ |
| 243 | 'string' => '/("""[\s\S]*?"""|' . $str . ')/', |
| 244 | 'comment' => '/(\/\/[^\r\n]*|\/\*.*?\*\/)/ms', |
| 245 | 'keyword' => '/\b(?:as|break|class|continue|do|else|false|for|fun|if|in|interface|is|null|object|package|return|super|this|throw|true|try|typealias|typeof|val|var|when|while)\b/', |
| 246 | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| 247 | 'number' => '/' . $int . '/', |
| 248 | ], |
| 249 | 'scala' => [ |
| 250 | 'string' => '/("""[\s\S]*?"""|' . $str . ')/', |
| 251 | 'comment' => '/(\/\/[^\r\n]*|\/\*.*?\*\/)/ms', |
| 252 | 'keyword' => '/\b(?:abstract|case|catch|class|def|do|else|extends|false|final|finally|for|forSome|if|implicit|import|lazy|match|new|null|object|override|package|private|protected|return|sealed|super|this|throw|trait|try|true|type|val|var|while|with|yield)\b/', |
| 253 | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| 254 | 'number' => '/' . $int . '/', |
| 255 | ], |
| 256 | 'groovy' => [ |
| 257 | 'string' => '/(\'\'\'[\s\S]*?\'\'\'|""".*?"""|"(?:\\\\.|[^"\\\\])*"|\'(?:\\\\.|[^\'\\\\])*\'|\/[^\/]+\/)/', |
| 258 | 'comment' => '/(\/\/[^\r\n]*|\/\*.*?\*\/)/ms', |
| 259 | 'keyword' => '/\b(?:def|as|assert|break|case|catch|class|const|continue|default|do|else|enum|extends|false|finally|for|goto|if|implements|import|in|instanceof|interface|new|null|package|return|super|switch|this|throw|throws|trait|true|try|var|void|while)\b/', |
| 260 | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| 261 | 'number' => '/' . $int . '/', |
| 262 | ], |
| 263 | 'dart' => [ |
| 264 | 'string' => '/(r?\'\'\'[\s\S]*?\'\'\'|r?"""[\s\S]*?"""|"(?:\\\\.|[^"\\\\])*"|\'(?:\\\\.|[^\'\\\\])*\')/', |
| 265 | 'comment' => '/(\/\/[^\r\n]*|\/\*.*?\*\/)/ms', |
| 266 | 'keyword' => '/\b(?:abstract|as|assert|async|await|break|case|catch|class|const|continue|default|do|else|enum|export|extends|extension|external|factory|false|final|finally|for|get|if|implements|import|in|interface|is|library|mixin|new|null|on|operator|part|rethrow|return|set|static|super|switch|sync|this|throw|true|try|typedef|var|void|while|with|yield)\b/', |
| 267 | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| 268 | 'number' => '/' . $int . '/', |
| 269 | ], |
| 270 | 'swift' => [ |
| 271 | 'string' => '/("""[\s\S]*?"""|' . $str . ')/', |
| 272 | 'comment' => '/(\/\/[^\r\n]*|\/\*.*?\*\/)/ms', |
| 273 | 'keyword' => '/\b(?:associatedtype|class|deinit|enum|extension|fileprivate|func|import|init|inout|internal|let|open|operator|private|protocol|public|rethrows|static|struct|subscript|typealias|var|break|case|continue|default|defer|do|else|fallthrough|for|guard|if|in|repeat|return|switch|where|while|as|Any|catch|false|is|nil|super|self|Self|throw|throws|true|try)\b/', |
| 274 | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| 275 | 'number' => '/' . $int . '/', |
| 276 | ], |
| 277 | 'perl' => [ |
| 278 | 'comment' => '/(#[^\r\n]*)/', |
| 279 | 'string' => '/(' . $str . '|`[^`]*`)/', |
| 280 | 'variable' => '/([$@%](?:\{[a-zA-Z_]\w*\}|[a-zA-Z_]\w*))/', |
| 281 | 'keyword' => '/\b(?:my|local|our|state|use|sub|package|if|else|elsif|unless|while|until|for|foreach|do|last|next|redo|goto|continue|return|print|printf|say|die|warn|eval|try|catch)\b/', |
| 212 | 282 | 'number' => '/' . $float . '/', |
| 283 | ], |
| 284 | 'powershell' => [ |
| 285 | 'comment' => '/(<#[\s\S]*?#>|#[^\r\n]*)/', |
| 286 | 'string' => '/(@"(?:""|[^"])*"@|@\'(?:[^[\'])*\'@|"(?:`.|[^"`])*"|\'(?:[^[\'])*\')/', |
| 287 | 'variable' => '/(\$[a-zA-Z0-9_]+)/', |
| 288 | 'keyword' => '/(?i)\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|In|InlineScript|Hidden|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/', |
| 289 | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_-]*)\s*(?=\()/', |
| 290 | 'number' => '/' . $int . '/', |
| 291 | ], |
| 292 | 'dockerfile' => [ |
| 293 | 'comment' => '/(#[^\r\n]*)/', |
| 294 | 'string' => '/' . $str . '/', |
| 295 | 'keyword' => '/(?i)^\s*(?:FROM|MAINTAINER|RUN|CMD|LABEL|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR|ARG|ONBUILD|STOPSIGNAL|HEALTHCHECK|SHELL)\b/m', |
| 296 | ], |
| 297 | 'containerfile' => [ |
| 298 | 'comment' => '/(#[^\r\n]*)/', |
| 299 | 'string' => '/' . $str . '/', |
| 300 | 'keyword' => '/(?i)^\s*(?:FROM|MAINTAINER|RUN|CMD|LABEL|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR|ARG|ONBUILD|STOPSIGNAL|HEALTHCHECK|SHELL)\b/m', |
| 301 | ], |
| 302 | 'makefile' => [ |
| 303 | 'comment' => '/(#[^\r\n]*)/', |
| 304 | 'variable' => '/(\$+[{(][^})]+[})])/', |
| 305 | 'keyword' => '/(?i)\b(?:include|define|endef|export|override|ifdef|ifndef|ifeq|ifneq|else|endif|vpath)\b/', |
| 306 | 'function' => '/^([a-zA-Z0-9._-]+):/m', |
| 307 | ], |
| 308 | 'diff' => [ |
| 309 | 'comment' => '/^(?:---| \+\+\+|index|diff).*/m', |
| 310 | 'meta' => '/^(?:@@).*/m', |
| 311 | 'inserted' => '/(^\+.*)/m', |
| 312 | 'deleted' => '/(^-.*)/m', |
| 213 | 313 | ] |
| 214 | 314 | ]; |