PHP_OWN_DIRECTORY (languages/php.ts), matched on the head's text with JS whitespace removed: `__DIR__`, `dirname(__FILE__)`, `\dirname(__DIR__)`, `dirname(__FILE__, 2)`. A levels argument is a plain decimal of at least 1 (`0` throws in PHP, `010` is octal), and a trailing comma is allowed. ASCII case-insensitive, as JS `/i` without `u` is.
()
| 1674 | /// (`0` throws in PHP, `010` is octal), and a trailing comma is allowed. |
| 1675 | /// ASCII case-insensitive, as JS `/i` without `u` is. |
| 1676 | fn php_own_directory_re() -> &'static Regex { |
| 1677 | static RE: OnceLock<Regex> = OnceLock::new(); |
| 1678 | RE.get_or_init(|| { |
| 1679 | Regex::new(r"(?i-u)^(?:__DIR__|\\?dirname\((__FILE__|__DIR__)(?:,([1-9][0-9]*))?,?\))$") |
| 1680 | .unwrap() |
| 1681 | }) |
| 1682 | } |
| 1683 | |
| 1684 | /// `/\s+as\s+/i`, the alias split of a `use` clause. The text is collapsed |
| 1685 | /// to single spaces first, so ASCII `\s` reads it the same; ASCII |
no test coverage detected