rustdoc: Move parse module to its own file

This commit is contained in:
Brian Anderson 2012-01-15 14:56:58 -08:00
parent 377316d8f6
commit c59a0ec774
3 changed files with 23 additions and 24 deletions

21
src/rustdoc/parse.rs Normal file
View File

@ -0,0 +1,21 @@
export from_file, from_str;
fn new_parse_sess() -> parser::parse_sess {
let cm = codemap::new_codemap();
let sess = @{
cm: cm,
mutable next_id: 0,
diagnostic: diagnostic::mk_handler(cm, none)
};
ret sess;
}
fn from_file(file: str) -> @ast::crate {
parser::parse_crate_from_source_file(
file, [], new_parse_sess())
}
fn from_str(source: str) -> @ast::crate {
parser::parse_crate_from_source_str(
"-", source, [], new_parse_sess())
}

View File

@ -6,3 +6,5 @@
#[desc = "The Rust documentation generator"];
#[license = "MIT"];
#[crate_type = "bin"];
mod parse;

View File

@ -177,30 +177,6 @@ fn doc_header(rd: rustdoc, name: str) {
rd.w.write_line("# Crate " + name);
}
mod parse {
export from_file, from_str;
fn new_parse_sess() -> parser::parse_sess {
let cm = codemap::new_codemap();
let sess = @{
cm: cm,
mutable next_id: 0,
diagnostic: diagnostic::mk_handler(cm, none)
};
ret sess;
}
fn from_file(file: str) -> @ast::crate {
parser::parse_crate_from_source_file(
file, [], new_parse_sess())
}
fn from_str(source: str) -> @ast::crate {
parser::parse_crate_from_source_str(
"-", source, [], new_parse_sess())
}
}
#[doc(
brief = "Main function.",
desc = "Command-line arguments: