MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / read_name

Function read_name

src/classmap_scanner.rs:1685–1717  ·  view source on GitHub ↗
(content: &'a [u8], i: &mut usize)

Source from the content-addressed store, hash-verified

1683/// anonymous class expressions (`new class extends Foo {}`).
1684#[inline]
1685fn read_name<'a>(content: &'a [u8], i: &mut usize) -> Option<&'a str> {
1686 let len = content.len();
1687
1688 // Skip whitespace
1689 while *i < len && content[*i].is_ascii_whitespace() {
1690 *i += 1;
1691 }
1692
1693 let start = *i;
1694
1695 // Read identifier characters
1696 while *i < len {
1697 let c = content[*i];
1698 if c.is_ascii_alphanumeric() || c == b'_' {
1699 *i += 1;
1700 } else {
1701 break;
1702 }
1703 }
1704
1705 if *i == start {
1706 return None;
1707 }
1708
1709 let name = &content[start..*i];
1710
1711 // Skip keywords that appear in anonymous class expressions
1712 if name == b"extends" || name == b"implements" {
1713 return None;
1714 }
1715
1716 std::str::from_utf8(name).ok()
1717}
1718
1719/// Normalise a PSR-4 prefix: ensure it ends with `\`.
1720fn normalise_prefix(prefix: &str) -> String {

Callers 2

find_symbolsFunction · 0.85
find_classesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected