1+ // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
111#![ feature( globs, phase, macro_rules) ]
212
313extern crate syntax;
@@ -158,15 +168,18 @@ fn count(lit: &str) -> uint {
158168}
159169
160170fn parse_antlr_token ( s : & str , tokens : & HashMap < String , Token > ) -> TokenAndSpan {
161- let re = regex ! ( r"\[@(?P<seq>\d+),(?P<start>\d+):(?P<end>\d+)='(?P<content>.+?)',<(?P<toknum>-?\d+)>,\d+:\d+]" ) ;
171+ let re = regex ! (
172+ r"\[@(?P<seq>\d+),(?P<start>\d+):(?P<end>\d+)='(?P<content>.+?)',<(?P<toknum>-?\d+)>,\d+:\d+]"
173+ ) ;
162174
163175 let m = re. captures ( s) . expect ( format ! ( "The regex didn't match {}" , s) . as_slice ( ) ) ;
164176 let start = m. name ( "start" ) ;
165177 let end = m. name ( "end" ) ;
166178 let toknum = m. name ( "toknum" ) ;
167179 let content = m. name ( "content" ) ;
168180
169- let proto_tok = tokens. find_equiv ( & toknum) . expect ( format ! ( "didn't find token {} in the map" , toknum) . as_slice ( ) ) ;
181+ let proto_tok = tokens. find_equiv ( & toknum) . expect ( format ! ( "didn't find token {} in the map" ,
182+ toknum) . as_slice ( ) ) ;
170183
171184 let nm = parse:: token:: intern ( content) ;
172185
@@ -229,7 +242,8 @@ fn main() {
229242 let token_map = parse_token_list ( token_file. read_to_string ( ) . unwrap ( ) . as_slice ( ) ) ;
230243
231244 let mut stdin = std:: io:: stdin ( ) ;
232- let mut antlr_tokens = stdin. lines ( ) . map ( |l| parse_antlr_token ( l. unwrap ( ) . as_slice ( ) . trim ( ) , & token_map) ) ;
245+ let mut antlr_tokens = stdin. lines ( ) . map ( |l| parse_antlr_token ( l. unwrap ( ) . as_slice ( ) . trim ( ) ,
246+ & token_map) ) ;
233247
234248 let code = File :: open ( & Path :: new ( args. get ( 1 ) . as_slice ( ) ) ) . unwrap ( ) . read_to_string ( ) . unwrap ( ) ;
235249 let options = config:: basic_options ( ) ;
@@ -246,7 +260,8 @@ fn main() {
246260 continue
247261 }
248262
249- assert ! ( rustc_tok. sp == antlr_tok. sp, "{} and {} have different spans" , rustc_tok, antlr_tok) ;
263+ assert ! ( rustc_tok. sp == antlr_tok. sp, "{} and {} have different spans" , rustc_tok,
264+ antlr_tok) ;
250265
251266 macro_rules! matches (
252267 ( $( $x: pat) ,+ ) => (
0 commit comments