8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
- #![ feature( globs , plugin) ]
11
+ #![ feature( plugin) ]
12
12
13
13
extern crate syntax;
14
14
extern crate rustc;
@@ -107,13 +107,14 @@ fn parse_token_list(file: &str) -> HashMap<String, token::Token> {
107
107
"LE" => token:: Le ,
108
108
"LIT_BINARY" => token:: Literal ( token:: Binary ( Name ( 0 ) ) , None ) ,
109
109
"LIT_BINARY_RAW" => token:: Literal ( token:: BinaryRaw ( Name ( 0 ) , 0 ) , None ) ,
110
+ "QUESTION" => token:: Question ,
110
111
_ => continue ,
111
112
} ;
112
113
113
114
res. insert ( num. to_string ( ) , tok) ;
114
115
}
115
116
116
- debug ! ( "Token map: {}" , res) ;
117
+ debug ! ( "Token map: {:? }" , res) ;
117
118
res
118
119
}
119
120
@@ -161,7 +162,7 @@ fn fixchar(mut lit: &str) -> ast::Name {
161
162
parse:: token:: intern ( lit. slice ( 1 , lit. len ( ) - 1 ) )
162
163
}
163
164
164
- fn count ( lit : & str ) -> uint {
165
+ fn count ( lit : & str ) -> usize {
165
166
lit. chars ( ) . take_while ( |c| * c == '#' ) . count ( )
166
167
}
167
168
@@ -176,12 +177,12 @@ fn parse_antlr_token(s: &str, tokens: &HashMap<String, token::Token>) -> TokenAn
176
177
let toknum = m. name ( "toknum" ) . unwrap_or ( "" ) ;
177
178
let content = m. name ( "content" ) . unwrap_or ( "" ) ;
178
179
179
- let proto_tok = tokens. get ( toknum) . expect ( format ! ( "didn't find token {} in the map" ,
180
+ let proto_tok = tokens. get ( toknum) . expect ( format ! ( "didn't find token {:? } in the map" ,
180
181
toknum) . as_slice ( ) ) ;
181
182
182
183
let nm = parse:: token:: intern ( content) ;
183
184
184
- debug ! ( "What we got: content (`{}`), proto: {}" , content, proto_tok) ;
185
+ debug ! ( "What we got: content (`{}`), proto: {:? }" , content, proto_tok) ;
185
186
186
187
let real_tok = match * proto_tok {
187
188
token:: BinOp ( ..) => token:: BinOp ( str_to_binop ( content) ) ,
@@ -265,7 +266,7 @@ fn main() {
265
266
continue
266
267
}
267
268
268
- assert ! ( rustc_tok. sp == antlr_tok. sp, "{} and {} have different spans" , rustc_tok,
269
+ assert ! ( rustc_tok. sp == antlr_tok. sp, "{:? } and {:? } have different spans" , rustc_tok,
269
270
antlr_tok) ;
270
271
271
272
macro_rules! matches {
@@ -276,12 +277,12 @@ fn main() {
276
277
if !tok_cmp( & rustc_tok. tok, & antlr_tok. tok) {
277
278
// FIXME #15677: needs more robust escaping in
278
279
// antlr
279
- warn!( "Different names for {} and {}" , rustc_tok, antlr_tok) ;
280
+ warn!( "Different names for {:? } and {:? }" , rustc_tok, antlr_tok) ;
280
281
}
281
282
}
282
- _ => panic!( "{} is not {}" , antlr_tok, rustc_tok)
283
+ _ => panic!( "{:? } is not {:? }" , antlr_tok, rustc_tok)
283
284
} , ) *
284
- ref c => assert!( c == & antlr_tok. tok, "{} is not {}" , rustc_tok, antlr_tok)
285
+ ref c => assert!( c == & antlr_tok. tok, "{:? } is not {:? }" , rustc_tok, antlr_tok)
285
286
}
286
287
)
287
288
}
0 commit comments