phpdoc-parser 0.24.1

Structural PHPDoc parser. Parses doc-comment blocks into a tag/prose AST with accurate spans; tag bodies exposed as raw text.
Documentation

phpdoc-parser

Structural PHPDoc parser. Turns /** ... */ blocks into a summary, description and tag list with accurate spans. Tag-agnostic: tag bodies are exposed as raw text so you can apply your own type parsers.

use phpdoc_parser::{body_text, find_tags, parse};

let doc = parse("/** @param int $x The value */");
for param in find_tags(&doc, "param") {
    println!("{}", body_text(param.body.as_ref()).unwrap_or_default());
}

Part of the rust-php-parser workspace. API reference: docs.rs/phpdoc-parser.

License

BSD 3-Clause