@@ -51,16 +51,16 @@ pub struct StringReader<'a> {
5151 pub ch : Option < char > ,
5252 pub filemap : Lrc < syntax_pos:: FileMap > ,
5353 /// Stop reading src at this index.
54- pub end_src_index : usize ,
54+ end_src_index : usize ,
5555 /// Whether to record new-lines and multibyte chars in filemap.
5656 /// This is only necessary the first time a filemap is lexed.
5757 /// If part of a filemap is being re-lexed, this should be set to false.
58- pub save_new_lines_and_multibyte : bool ,
58+ save_new_lines_and_multibyte : bool ,
5959 // cached:
6060 peek_tok : token:: Token ,
6161 peek_span : Span ,
6262 peek_span_src_raw : Span ,
63- pub fatal_errs : Vec < DiagnosticBuilder < ' a > > ,
63+ fatal_errs : Vec < DiagnosticBuilder < ' a > > ,
6464 // cache a direct reference to the source text, so that we don't have to
6565 // retrieve it via `self.filemap.src.as_ref().unwrap()` all the time.
6666 src : Lrc < String > ,
@@ -70,7 +70,7 @@ pub struct StringReader<'a> {
7070 /// The raw source span which *does not* take `override_span` into account
7171 span_src_raw : Span ,
7272 open_braces : Vec < ( token:: DelimToken , Span ) > ,
73- pub override_span : Option < Span > ,
73+ crate override_span : Option < Span > ,
7474}
7575
7676impl < ' a > StringReader < ' a > {
@@ -163,11 +163,9 @@ impl<'a> StringReader<'a> {
163163 sp : self . peek_span ,
164164 }
165165 }
166- }
167166
168- impl < ' a > StringReader < ' a > {
169167 /// For comments.rs, which hackily pokes into next_pos and ch
170- pub fn new_raw ( sess : & ' a ParseSess , filemap : Lrc < syntax_pos:: FileMap > ,
168+ fn new_raw ( sess : & ' a ParseSess , filemap : Lrc < syntax_pos:: FileMap > ,
171169 override_span : Option < Span > ) -> Self {
172170 let mut sr = StringReader :: new_raw_internal ( sess, filemap, override_span) ;
173171 sr. bump ( ) ;
@@ -240,17 +238,17 @@ impl<'a> StringReader<'a> {
240238 sr
241239 }
242240
243- pub fn ch_is ( & self , c : char ) -> bool {
241+ fn ch_is ( & self , c : char ) -> bool {
244242 self . ch == Some ( c)
245243 }
246244
247245 /// Report a fatal lexical error with a given span.
248- pub fn fatal_span ( & self , sp : Span , m : & str ) -> FatalError {
246+ fn fatal_span ( & self , sp : Span , m : & str ) -> FatalError {
249247 self . sess . span_diagnostic . span_fatal ( sp, m)
250248 }
251249
252250 /// Report a lexical error with a given span.
253- pub fn err_span ( & self , sp : Span , m : & str ) {
251+ fn err_span ( & self , sp : Span , m : & str ) {
254252 self . sess . span_diagnostic . span_err ( sp, m)
255253 }
256254
@@ -375,7 +373,7 @@ impl<'a> StringReader<'a> {
375373 /// Calls `f` with a string slice of the source text spanning from `start`
376374 /// up to but excluding `self.pos`, meaning the slice does not include
377375 /// the character `self.ch`.
378- pub fn with_str_from < T , F > ( & self , start : BytePos , f : F ) -> T
376+ fn with_str_from < T , F > ( & self , start : BytePos , f : F ) -> T
379377 where F : FnOnce ( & str ) -> T
380378 {
381379 self . with_str_from_to ( start, self . pos , f)
@@ -384,13 +382,13 @@ impl<'a> StringReader<'a> {
384382 /// Create a Name from a given offset to the current offset, each
385383 /// adjusted 1 towards each other (assumes that on either side there is a
386384 /// single-byte delimiter).
387- pub fn name_from ( & self , start : BytePos ) -> ast:: Name {
385+ fn name_from ( & self , start : BytePos ) -> ast:: Name {
388386 debug ! ( "taking an ident from {:?} to {:?}" , start, self . pos) ;
389387 self . with_str_from ( start, Symbol :: intern)
390388 }
391389
392390 /// As name_from, with an explicit endpoint.
393- pub fn name_from_to ( & self , start : BytePos , end : BytePos ) -> ast:: Name {
391+ fn name_from_to ( & self , start : BytePos , end : BytePos ) -> ast:: Name {
394392 debug ! ( "taking an ident from {:?} to {:?}" , start, end) ;
395393 self . with_str_from_to ( start, end, Symbol :: intern)
396394 }
@@ -454,7 +452,7 @@ impl<'a> StringReader<'a> {
454452
455453 /// Advance the StringReader by one character. If a newline is
456454 /// discovered, add it to the FileMap's list of line start offsets.
457- pub fn bump ( & mut self ) {
455+ crate fn bump ( & mut self ) {
458456 let next_src_index = self . src_index ( self . next_pos ) ;
459457 if next_src_index < self . end_src_index {
460458 let next_ch = char_at ( & self . src , next_src_index) ;
@@ -481,7 +479,7 @@ impl<'a> StringReader<'a> {
481479 }
482480 }
483481
484- pub fn nextch ( & self ) -> Option < char > {
482+ fn nextch ( & self ) -> Option < char > {
485483 let next_src_index = self . src_index ( self . next_pos ) ;
486484 if next_src_index < self . end_src_index {
487485 Some ( char_at ( & self . src , next_src_index) )
@@ -490,11 +488,11 @@ impl<'a> StringReader<'a> {
490488 }
491489 }
492490
493- pub fn nextch_is ( & self , c : char ) -> bool {
491+ fn nextch_is ( & self , c : char ) -> bool {
494492 self . nextch ( ) == Some ( c)
495493 }
496494
497- pub fn nextnextch ( & self ) -> Option < char > {
495+ fn nextnextch ( & self ) -> Option < char > {
498496 let next_src_index = self . src_index ( self . next_pos ) ;
499497 if next_src_index < self . end_src_index {
500498 let next_next_src_index =
@@ -506,7 +504,7 @@ impl<'a> StringReader<'a> {
506504 None
507505 }
508506
509- pub fn nextnextch_is ( & self , c : char ) -> bool {
507+ fn nextnextch_is ( & self , c : char ) -> bool {
510508 self . nextnextch ( ) == Some ( c)
511509 }
512510
@@ -1732,7 +1730,7 @@ impl<'a> StringReader<'a> {
17321730
17331731// This tests the character for the unicode property 'PATTERN_WHITE_SPACE' which
17341732// is guaranteed to be forward compatible. http://unicode.org/reports/tr31/#R3
1735- pub fn is_pattern_whitespace ( c : Option < char > ) -> bool {
1733+ crate fn is_pattern_whitespace ( c : Option < char > ) -> bool {
17361734 c. map_or ( false , Pattern_White_Space )
17371735}
17381736
@@ -1747,14 +1745,14 @@ fn is_dec_digit(c: Option<char>) -> bool {
17471745 in_range ( c, '0' , '9' )
17481746}
17491747
1750- pub fn is_doc_comment ( s : & str ) -> bool {
1748+ fn is_doc_comment ( s : & str ) -> bool {
17511749 let res = ( s. starts_with ( "///" ) && * s. as_bytes ( ) . get ( 3 ) . unwrap_or ( & b' ' ) != b'/' ) ||
17521750 s. starts_with ( "//!" ) ;
17531751 debug ! ( "is {:?} a doc comment? {}" , s, res) ;
17541752 res
17551753}
17561754
1757- pub fn is_block_doc_comment ( s : & str ) -> bool {
1755+ fn is_block_doc_comment ( s : & str ) -> bool {
17581756 // Prevent `/**/` from being parsed as a doc comment
17591757 let res = ( ( s. starts_with ( "/**" ) && * s. as_bytes ( ) . get ( 3 ) . unwrap_or ( & b' ' ) != b'*' ) ||
17601758 s. starts_with ( "/*!" ) ) && s. len ( ) >= 5 ;
0 commit comments