Skip to content

Commit 683cbc9

Browse files
committed
Add new keyword highlighting rules
1 parent 3e5eba2 commit 683cbc9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/KeywordEnhancer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ class KeywordEnhancer {
1414
'/\b(?<![`\\\\])[A-Z][A-Z\\\\a-z]+::[a-z][A-Za-z_\d]+\b(?![`\/(])/', // Class::constants
1515
'/\b(?<!`-)[a-z]+_[a-z]+(?:_[a-z_]+)?\(\)(?![`\/])/', // Functions with underscores and ()
1616
'/\b(?<![`>])[a-z_][a-z][a-z\d_]+\(\)(?![`.>\/-])/', // Functions with underscores and ()
17-
'/\b(?<!`)(?:ldap|ftp|array|mb|stream|open|hash|xml|proc|pcntl)_[a-z_]+\d?\b(?![`\/])/', // Functions with underscores and no ()
17+
'/\b(?<!`)(?:ldap|ftp|array|mb|stream|open|hash|xml|proc|pcntl|curl|intl|date|grapheme|socket|stream)_[a-z_]+\d?\b(?![`\/])/', // Functions with underscores and no ()
1818
'/\b(?<!`)(xleak|xfail|skipif)\b(?![`\/])/i', // xleak
1919
'/(?<![`>()-])--[a-z][a-z-]+(?![`])/i', // --flags, --flags-and-more
2020
'/(?<![`>()-])\bext\/[a-z_\d\/-]+\.phpt\b(?![`])/i', // ext/test/test/test.phpt
2121
'/\b(?<![`>:-])__[A-Z\d_]+(?![`])/i', // __PROPERTY__
2222
'/(?<=\s)(?<![`>-])\\\\[A-Z][a-z]+\\\\[A-Z][A-Za-z]+(?![`])\b/', // Stricter, class name like \Dom\HTMLDocument
23-
'/\b(?<![`>()-])(?:(main|ext|Zend|tests|win32|scripts|sapi|pear|docs|build)\/(?:[a-z\/_]+))(?:\.(c|php|phpt|yml|yaml|cpp|m4|txt|w32|h))(?::\d+)?(?![`])/i', // files in php-src
24-
'/\b(?<!`)(?:(SOAP|SO|TCP|SOCK|FILTER|XML|FTP|CURL|GREP))_[A-Z_]+\b(?![`\/(])/', // CONSTANTS (with fixed prefixes)
23+
'/\b(?<![`>()-])(?:(main|ext|Zend|tests|win32|scripts|sapi|pear|docs|build)\/(?:[a-z\d\/_]+))(?:\.(c|php|phpt|yml|yaml|cpp|m4|txt|w32|h))(?::\d+)?(?![`])/i', // files in php-src
24+
'/\b(?<!`)(?:(SOAP|SO|TCP|SOCK|FILTER|XML|FTP|CURL|CURLOPT|CURLE|CURLINFO|GREP|X509|ZEND|USE_ZEND))_[A-Z_]+\b(?![`\/(])/', // CONSTANTS (with fixed prefixes)
2525
];
2626

2727
public static function enhance(string $inputText): string {

0 commit comments

Comments
 (0)