| | 'string_interp' => '/(".*?")/', |
| | 'string' => '/(\'.*?\')/', |
| | - 'comment' => '/((?-s:\/\/.*$)|(?-s:#.*$)|(?s:\/\*.*?\*\/))/m', |
| | + 'comment' => '/(\/\/.*$|#.*$|\/\*.*?\*\/)/ms', |
| | '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/', |
| | 'function' => '/\b([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\s*(?=\()/', |
| | 'variable' => '/(\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)/', |
| | 'number' => '/' . $int . '/', |
| | ], |
| | 'bash' => [ |
| | 'string_interp' => '/(".*?")/', |
| | 'string' => '/(\'.*?\')/', |
| | - 'comment' => '/((?-s:#.*$))/m', |
| | + 'comment' => '/(#.*$)/m', |
| | 'keyword' => '/\b(if|then|else|elif|fi|case|esac|for|while|until|do|done|function|local|return|exit|break|continue|export|source|alias|eval|exec)\b/', |
| | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| | 'variable' => '/(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{[^}]+\})/', |
| | 'number' => '/' . $int . '/', |
| | ], |
| | 'c' => [ |
| | - 'string' => '/' . $str . '/', |
| | - 'comment' => '/((?-s:\/\/.*$)|(?s:\/\*.*?\*\/))/m', |
| | - 'keyword' => '/\b(auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/', |
| | + 'string' => '/' . $str . '/', |
| | + 'comment' => '/(\/\/.*$|\/\*.*?\*\/)/ms', |
| | + 'keyword' => '/\b(auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/', |
| | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| | - 'number' => '/' . $int . '/', |
| | + 'number' => '/' . $int . '/', |
| | ], |
| | 'cpp' => [ |
| | - 'string' => '/' . $str . '/', |
| | - 'comment' => '/((?-s:\/\/.*$)|(?s:\/\*.*?\*\/))/m', |
| | - 'keyword' => '/\b(alignas|alignof|and|and_eq|asm|auto|bitand|bitor|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|false|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|noexcept|not|not_eq|nullptr|operator|or|or_eq|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|true|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while|xor|xor_eq)\b/', |
| | + 'string' => '/' . $str . '/', |
| | + 'comment' => '/(\/\/.*$|\/\*.*?\*\/)/ms', |
| | + 'keyword' => '/\b(alignas|alignof|and|and_eq|asm|auto|bitand|bitor|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|false|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|noexcept|not|not_eq|nullptr|operator|or|or_eq|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|true|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while|xor|xor_eq)\b/', |
| | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| | - 'number' => '/' . $int . '/', |
| | + 'number' => '/' . $int . '/', |
| | ], |
| | 'java' => [ |
| | - 'string' => '/' . $str . '/', |
| | - 'comment' => '/((?-s:\/\/.*$)|(?s:\/\*.*?\*\/))/m', |
| | - 'keyword' => '/\b(abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|transient|try|void|volatile|while)\b/', |
| | + 'string' => '/' . $str . '/', |
| | + 'comment' => '/(\/\/.*$|\/\*.*?\*\/)/ms', |
| | + 'keyword' => '/\b(abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|transient|try|void|volatile|while)\b/', |
| | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| | - 'number' => '/' . $int . '/', |
| | + 'number' => '/' . $int . '/', |
| | ], |
| | 'go' => [ |
| | - 'string' => '/(".*?"|`.*?`)/s', |
| | - 'comment' => '/((?-s:\/\/.*$)|(?s:\/\*.*?\*\/))/m', |
| | - '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/', |
| | + 'string' => '/(".*?"|`.*?`)/s', |
| | + 'comment' => '/(\/\/.*$|\/\*.*?\*\/)/ms', |
| | + '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/', |
| | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| | - 'number' => '/' . $int . '/', |
| | + 'number' => '/' . $int . '/', |
| | ], |
| | 'rust' => [ |
| | - 'string' => '/(".*?"|\'.*?\')/', |
| | - 'comment' => '/((?-s:\/\/.*$)|(?s:\/\*.*?\*\/))/m', |
| | - 'keyword' => '/\b(as|break|const|continue|crate|else|enum|extern|false|fn|for|if|impl|in|let|loop|match|mod|move|mut|pub|ref|return|self|Self|static|struct|super|trait|true|type|unsafe|use|where|while|async|await|dyn)\b/', |
| | + 'string' => '/(".*?"|\'.*?\')/', |
| | + 'comment' => '/(\/\/.*$|\/\*.*?\*\/)/ms', |
| | + 'keyword' => '/\b(as|break|const|continue|crate|else|enum|extern|false|fn|for|if|impl|in|let|loop|match|mod|move|mut|pub|ref|return|self|Self|static|struct|super|trait|true|type|unsafe|use|where|while|async|await|dyn)\b/', |
| | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| | - 'number' => '/' . $int . '/', |
| | + 'number' => '/' . $int . '/', |
| | ], |
| | 'python' => [ |
| | - 'string' => '/(\'\'\'.*?\'\'\'|""".*?"""|".*?"|\'.*?\')/s', |
| | - 'comment' => '/((?-s:#.*$))/m', |
| | - 'keyword' => '/\b(False|None|True|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/', |
| | + 'string' => '/(\'\'\'.*?\'\'\'|""".*?"""|".*?"|\'.*?\')/s', |
| | + 'comment' => '/(#.*$)/m', |
| | + 'keyword' => '/\b(False|None|True|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/', |
| | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| | - 'number' => '/' . $int . '/', |
| | + 'number' => '/' . $int . '/', |
| | ], |
| | 'ruby' => [ |
| | 'string_interp' => '/(".*?")/', |
| | 'string' => '/(\'.*?\')/', |
| | - 'comment' => '/((?-s:#.*$))/m', |
| | + 'comment' => '/(#.*$)/m', |
| | 'keyword' => '/\b(alias|and|begin|break|case|class|def|defined|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\b/', |
| | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*[?!]?)\s*(?=\()/', |
| | 'variable' => '/(@[a-zA-Z_]\w*|\$[a-zA-Z_]\w*)/', |
| | 'number' => '/' . $int . '/', |
| | ], |
| | 'lua' => [ |
| | - 'string' => '/' . $str . '/', |
| | - 'comment' => '/((?-s:--.*$))/m', |
| | - 'keyword' => '/\b(and|break|do|else|elseif|end|false|for|function|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/', |
| | + 'string' => '/(".*?"|\'.*?\'|\[\[.*?\]\])/s', |
| | + 'comment' => '/(--\[\[.*?\]\]|--.*$)/ms', |
| | + 'keyword' => '/\b(and|break|do|else|elseif|end|false|for|function|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/', |
| | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| | - 'number' => '/' . $int . '/', |
| | + 'number' => '/' . $int . '/', |
| | ], |
| | 'javascript' => [ |
| | - 'string' => '/(".*?"|\'.*?\'|`.*?`)/s', |
| | - 'comment' => '/((?-s:\/\/.*$)|(?s:\/\*.*?\*\/))/m', |
| | - 'keyword' => '/\b(async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|export|extends|false|finally|for|function|if|import|in|instanceof|new|null|return|super|switch|this|throw|true|try|typeof|var|void|while|with|yield|let|static|enum)\b/', |
| | + 'string' => '/(".*?"|\'.*?\'|`.*?`)/s', |
| | + 'comment' => '/(\/\/.*$|\/\*.*?\*\/)/ms', |
| | + 'keyword' => '/\b(async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|export|extends|false|finally|for|function|if|import|in|instanceof|new|null|return|super|switch|this|throw|true|try|typeof|var|void|while|with|yield|let|static|enum)\b/', |
| | 'function' => '/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?=\()/', |
| | - 'number' => '/' . $int . '/', |
| | + 'number' => '/' . $int . '/', |
| | ], |
| | 'typescript' => [ |
| | - 'string' => '/(".*?"|\'.*?\'|`.*?`)/s', |
| | - 'comment' => '/((?-s:\/\/.*$)|(?s:\/\*.*?\*\/))/m', |
| | - 'keyword' => '/\b(any|as|boolean|break|case|catch|class|const|continue|debugger|declare|default|delete|do|else|enum|export|extends|false|finally|for|from|function|if|implements|import|in|instanceof|interface|let|module|namespace|new|null|number|of|package|private|protected|public|require|return|static|string|super|switch|this|throw|true|try|type|typeof|var|void|while|with|yield)\b/', |
| | + 'string' => '/(".*?"|\'.*?\'|`.*?`)/s', |
| | + 'comment' => '/(\/\/.*$|\/\*.*?\*\/)/ms', |
| | + 'keyword' => '/\b(any|as|boolean|break|case|catch|class|const|continue|debugger|declare|default|delete|do|else|enum|export|extends|false|finally|for|from|function|if|implements|import|in|instanceof|interface|let|module|namespace|new|null|number|of|package|private|protected|public|require|return|static|string|super|switch|this|throw|true|try|type|typeof|var|void|while|with|yield)\b/', |
| | 'function' => '/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?=\()/', |
| | - 'number' => '/' . $int . '/', |
| | + 'number' => '/' . $int . '/', |
| | ], |
| | 'xml' => [ |
| | 'comment' => '/()/s', |
| | 'string' => '/' . $str . '/', |
| | - 'keyword' => '/(<\/?[a-zA-Z0-9:-]+)/', |
| | + 'keyword' => '/(<\/?[a-zA-Z0-9:-]+\s*\/?>|<\?xml.*?\?>)/', |
| | 'variable' => '/([a-zA-Z0-9:-]+=)/', |
| | ], |
| | 'html' => [ |
| | 'comment' => '/()/s', |
| | 'string' => '/' . $str . '/', |
| | - 'keyword' => '/(<\/?[a-zA-Z0-9:-]+)/', |
| | + 'keyword' => '/(<\/?[a-zA-Z0-9:-]+\s*\/?>)/', |
| | 'variable' => '/([a-zA-Z0-9:-]+=)/', |
| | ], |
| | 'css' => [ |
| | 'comment' => '/(\/\*.*?\*\/)/s', |
| | - 'keyword' => '/(@[a-zA-Z-]+)/', |
| | + 'keyword' => '/(@[a-zA-Z-]+|[a-zA-Z-]+\s*(?=:))/', |
| | 'string' => '/' . $str . '/', |
| | 'variable' => '/(\.|#)[a-zA-Z0-9_-]+/', |
 |
| | 'sql' => [ |
| | 'string' => '/(\'.*?\')/', |
| | - 'comment' => '/((?-s:--.*$)|(?s:\/\*.*?\*\/))/m', |
| | + 'comment' => '/(--.*$|\/\*.*?\*\/)/ms', |
| | 'keyword' => '/\b(SELECT|FROM|WHERE|INSERT|UPDATE|DELETE|JOIN|LEFT|RIGHT|INNER|OUTER|ON|GROUP|BY|ORDER|HAVING|LIMIT|OFFSET|CREATE|TABLE|DROP|ALTER|INDEX|KEY|PRIMARY|FOREIGN|CONSTRAINT|DEFAULT|NULL|NOT|AND|OR|IN|VALUES|SET|AS|DISTINCT|UNION|ALL|CASE|WHEN|THEN|ELSE|END)\b/i', |
| | 'number' => '/' . $int . '/', |
| | ], |
| | 'yaml' => [ |
| | 'string' => '/' . $str . '/', |
| | - 'comment' => '/((?-s:#.*$))/m', |
| | + 'comment' => '/(#.*$)/m', |
| | 'keyword' => '/^(\s*[a-zA-Z0-9_-]+:)/m', |
| | 'number' => '/' . $float . '/', |
 |
| | ], |
| | 'r' => [ |
| | - 'string' => '/' . $str . '/', |
| | - 'comment' => '/((?-s:#.*$))/m', |
| | - 'keyword' => '/\b(if|else|repeat|while|function|for|in|next|break|TRUE|FALSE|NULL|Inf|NaN|NA)\b/', |
| | + 'string' => '/' . $str . '/', |
| | + 'comment' => '/(#.*$)/m', |
| | + 'keyword' => '/\b(if|else|repeat|while|function|for|in|next|break|TRUE|FALSE|NULL|Inf|NaN|NA)\b/', |
| | 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\()/', |
| | - 'number' => '/' . $float . '/', |
| | + 'number' => '/' . $float . '/', |
| | ] |
| | ]; |