@@ -59,24 +59,33 @@ pub enum PpMode {
5959 PpmFlowGraph ,
6060}
6161
62- pub fn parse_pretty ( sess : & Session , name : & str ) -> ( PpMode , Option < UserIdentifiedItem > ) {
62+ pub fn parse_pretty ( sess : & Session ,
63+ name : & str ,
64+ extended : bool ) -> ( PpMode , Option < UserIdentifiedItem > ) {
6365 let mut split = name. splitn ( 1 , '=' ) ;
6466 let first = split. next ( ) . unwrap ( ) ;
6567 let opt_second = split. next ( ) ;
66- let first = match first {
67- "normal" => PpmSource ( PpmNormal ) ,
68- "everybody_loops" => PpmSource ( PpmEveryBodyLoops ) ,
69- "expanded" => PpmSource ( PpmExpanded ) ,
70- "typed" => PpmSource ( PpmTyped ) ,
71- "expanded,identified" => PpmSource ( PpmExpandedIdentified ) ,
72- "expanded,hygiene" => PpmSource ( PpmExpandedHygiene ) ,
73- "identified" => PpmSource ( PpmIdentified ) ,
74- "flowgraph" => PpmFlowGraph ,
68+ let first = match ( first, extended ) {
69+ ( "normal" , _ ) => PpmSource ( PpmNormal ) ,
70+ ( "everybody_loops" , true ) => PpmSource ( PpmEveryBodyLoops ) ,
71+ ( "expanded" , _ ) => PpmSource ( PpmExpanded ) ,
72+ ( "typed" , _ ) => PpmSource ( PpmTyped ) ,
73+ ( "expanded,identified" , _ ) => PpmSource ( PpmExpandedIdentified ) ,
74+ ( "expanded,hygiene" , _ ) => PpmSource ( PpmExpandedHygiene ) ,
75+ ( "identified" , _ ) => PpmSource ( PpmIdentified ) ,
76+ ( "flowgraph" , true ) => PpmFlowGraph ,
7577 _ => {
76- sess. fatal ( format ! (
77- "argument to `pretty` must be one of `normal`, \
78- `expanded`, `flowgraph=<nodeid>`, `typed`, `identified`, \
79- or `expanded,identified`; got {}", name) . as_slice ( ) ) ;
78+ if extended {
79+ sess. fatal ( format ! (
80+ "argument to `xpretty` must be one of `normal`, \
81+ `expanded`, `flowgraph=<nodeid>`, `typed`, `identified`, \
82+ `expanded,identified`, or `everybody_loops`; got {}", name) . as_slice ( ) ) ;
83+ } else {
84+ sess. fatal ( format ! (
85+ "argument to `pretty` must be one of `normal`, \
86+ `expanded`, `typed`, `identified`, \
87+ or `expanded,identified`; got {}", name) . as_slice ( ) ) ;
88+ }
8089 }
8190 } ;
8291 let opt_second = opt_second. and_then :: < UserIdentifiedItem , _ > ( from_str) ;
0 commit comments