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

Method parse_defines

src/parser/mod.rs:1189–1195  ·  view source on GitHub ↗

Parse PHP source text and extract constant names from `define()` calls and top-level `const` statements. Returns a list of `(name, offset, value)` tuples for every `define('NAME', value)` call or `const NAME = value;` statement found at the top level, inside namespace blocks, block statements, or `if` guards.

(&self, content: &str)

Source from the content-addressed store, hash-verified

1187 /// found at the top level, inside namespace blocks, block statements,
1188 /// or `if` guards.
1189 pub fn parse_defines(&self, content: &str) -> Vec<(String, u32, Option<String>)> {
1190 with_parsed_program(content, "parse_defines", |program, content| {
1191 let mut defines = Vec::new();
1192 Self::extract_defines_from_statements(program.statements.iter(), &mut defines, content);
1193 defines
1194 })
1195 }
1196
1197 /// Parse PHP source text and extract `use` statement mappings.
1198 ///

Calls 2

with_parsed_programFunction · 0.85
iterMethod · 0.80