rustdoc: Move parse module to its own file
This commit is contained in:
parent
377316d8f6
commit
c59a0ec774
21
src/rustdoc/parse.rs
Normal file
21
src/rustdoc/parse.rs
Normal 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())
|
||||
}
|
@ -6,3 +6,5 @@
|
||||
#[desc = "The Rust documentation generator"];
|
||||
#[license = "MIT"];
|
||||
#[crate_type = "bin"];
|
||||
|
||||
mod parse;
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user