@@ -33,6 +33,7 @@ use getopts;
33
33
pub mod driver;
34
34
pub mod session;
35
35
pub mod config;
36
+ pub mod pretty;
36
37
37
38
38
39
pub fn main_args ( args : & [ String ] ) -> int {
@@ -96,11 +97,11 @@ fn run_compiler(args: &[String]) {
96
97
let ofile = matches. opt_str ( "o" ) . map ( |o| Path :: new ( o) ) ;
97
98
98
99
let pretty = matches. opt_default ( "pretty" , "normal" ) . map ( |a| {
99
- parse_pretty ( & sess, a. as_slice ( ) )
100
+ pretty :: parse_pretty ( & sess, a. as_slice ( ) )
100
101
} ) ;
101
102
match pretty {
102
103
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) ;
104
105
return ;
105
106
}
106
107
None => { /* continue */ }
@@ -340,43 +341,6 @@ fn print_crate_info(sess: &Session,
340
341
}
341
342
}
342
343
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
-
380
344
fn parse_crate_attrs ( sess : & Session , input : & Input ) ->
381
345
Vec < ast:: Attribute > {
382
346
let result = match * input {
0 commit comments