rustdoc: Add extract module for building doc model from AST
This commit is contained in:
parent
555d5aed37
commit
995c50b69b
22
src/rustdoc/extract.rs
Normal file
22
src/rustdoc/extract.rs
Normal file
@ -0,0 +1,22 @@
|
||||
#[doc = "Converting the Rust AST to the rustdoc document model"];
|
||||
|
||||
import rustc::syntax::ast;
|
||||
|
||||
#[doc = "Converts the Rust AST to the rustdoc document model"]
|
||||
fn extract(crate: @ast::crate) -> doc::cratedoc {
|
||||
{
|
||||
mods: []
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
#[test]
|
||||
fn extract_empty_crate() {
|
||||
let source = ""; // empty crate
|
||||
let ast = parse::from_str(source);
|
||||
let doc = extract(ast);
|
||||
assert doc.mods == [];
|
||||
}
|
||||
}
|
@ -8,5 +8,6 @@
|
||||
#[crate_type = "bin"];
|
||||
|
||||
mod parse;
|
||||
mod extract;
|
||||
mod doc;
|
||||
mod gen;
|
Loading…
x
Reference in New Issue
Block a user