MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / php_own_directory_re

Function php_own_directory_re

codegraph-kernel/src/php.rs:1676–1682  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

1674/// (`0` throws in PHP, `010` is octal), and a trailing comma is allowed.
1675/// ASCII case-insensitive, as JS `/i` without `u` is.
1676fn 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

Callers 1

Calls 1

unwrapMethod · 0.60

Tested by

no test coverage detected