Skip to content

Commit b3bd00f

Browse files
committed
rollup merge of rust-lang#16419 : huonw/pretty-expanded-hygiene
2 parents a2415e0 + d79047e commit b3bd00f

File tree

8 files changed

+680
-558
lines changed

8 files changed

+680
-558
lines changed

src/librustc/driver/driver.rs

Lines changed: 1 addition & 516 deletions
Large diffs are not rendered by default.

src/librustc/driver/mod.rs

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use getopts;
3333
pub mod driver;
3434
pub mod session;
3535
pub mod config;
36+
pub mod pretty;
3637

3738

3839
pub fn main_args(args: &[String]) -> int {
@@ -96,11 +97,11 @@ fn run_compiler(args: &[String]) {
9697
let ofile = matches.opt_str("o").map(|o| Path::new(o));
9798

9899
let pretty = matches.opt_default("pretty", "normal").map(|a| {
99-
parse_pretty(&sess, a.as_slice())
100+
pretty::parse_pretty(&sess, a.as_slice())
100101
});
101102
match pretty {
102103
Some((ppm, opt_uii)) => {
103-
driver::pretty_print_input(sess, cfg, &input, ppm, opt_uii, ofile);
104+
pretty::pretty_print_input(sess, cfg, &input, ppm, opt_uii, ofile);
104105
return;
105106
}
106107
None => {/* continue */ }
@@ -340,43 +341,6 @@ fn print_crate_info(sess: &Session,
340341
}
341342
}
342343

343-
#[deriving(PartialEq, Show)]
344-
pub enum PpSourceMode {
345-
PpmNormal,
346-
PpmExpanded,
347-
PpmTyped,
348-
PpmIdentified,
349-
PpmExpandedIdentified,
350-
}
351-
352-
#[deriving(PartialEq, Show)]
353-
pub enum PpMode {
354-
PpmSource(PpSourceMode),
355-
PpmFlowGraph,
356-
}
357-
358-
fn parse_pretty(sess: &Session, name: &str) -> (PpMode, Option<driver::UserIdentifiedItem>) {
359-
let mut split = name.splitn(1, '=');
360-
let first = split.next().unwrap();
361-
let opt_second = split.next();
362-
let first = match first {
363-
"normal" => PpmSource(PpmNormal),
364-
"expanded" => PpmSource(PpmExpanded),
365-
"typed" => PpmSource(PpmTyped),
366-
"expanded,identified" => PpmSource(PpmExpandedIdentified),
367-
"identified" => PpmSource(PpmIdentified),
368-
"flowgraph" => PpmFlowGraph,
369-
_ => {
370-
sess.fatal(format!(
371-
"argument to `pretty` must be one of `normal`, \
372-
`expanded`, `flowgraph=<nodeid>`, `typed`, `identified`, \
373-
or `expanded,identified`; got {}", name).as_slice());
374-
}
375-
};
376-
let opt_second = opt_second.and_then::<driver::UserIdentifiedItem>(from_str);
377-
(first, opt_second)
378-
}
379-
380344
fn parse_crate_attrs(sess: &Session, input: &Input) ->
381345
Vec<ast::Attribute> {
382346
let result = match *input {

0 commit comments

Comments
 (0)