@@ -77,7 +77,7 @@ pub struct TokenAndSpan {
77
77
pub struct StringReader < ' a > {
78
78
pub span_diagnostic : & ' a Handler ,
79
79
/// The absolute offset within the codemap of the next character to read
80
- pub pos : BytePos ,
80
+ pub next_pos : BytePos ,
81
81
/// The absolute offset within the codemap of the last character read(curr)
82
82
pub last_pos : BytePos ,
83
83
/// The column of the next character to read
@@ -107,7 +107,7 @@ impl<'a> Reader for StringReader<'a> {
107
107
}
108
108
109
109
match self . terminator {
110
- Some ( t) => self . pos > t,
110
+ Some ( t) => self . next_pos > t,
111
111
None => false ,
112
112
}
113
113
}
@@ -173,7 +173,7 @@ impl<'a> Reader for TtReader<'a> {
173
173
}
174
174
175
175
impl < ' a > StringReader < ' a > {
176
- /// For comments.rs, which hackily pokes into pos and curr
176
+ /// For comments.rs, which hackily pokes into next_pos and curr
177
177
pub fn new_raw < ' b > ( span_diagnostic : & ' b Handler ,
178
178
filemap : Rc < syntax_pos:: FileMap > )
179
179
-> StringReader < ' b > {
@@ -195,7 +195,7 @@ impl<'a> StringReader<'a> {
195
195
196
196
StringReader {
197
197
span_diagnostic : span_diagnostic,
198
- pos : filemap. start_pos ,
198
+ next_pos : filemap. start_pos ,
199
199
last_pos : filemap. start_pos ,
200
200
col : CharPos ( 0 ) ,
201
201
curr : Some ( '\n' ) ,
@@ -414,13 +414,13 @@ impl<'a> StringReader<'a> {
414
414
/// Advance the StringReader by one character. If a newline is
415
415
/// discovered, add it to the FileMap's list of line start offsets.
416
416
pub fn bump ( & mut self ) {
417
- self . last_pos = self . pos ;
418
- let current_byte_offset = self . byte_offset ( self . pos ) . to_usize ( ) ;
417
+ self . last_pos = self . next_pos ;
418
+ let current_byte_offset = self . byte_offset ( self . next_pos ) . to_usize ( ) ;
419
419
if current_byte_offset < self . source_text . len ( ) {
420
420
let last_char = self . curr . unwrap ( ) ;
421
421
let ch = char_at ( & self . source_text , current_byte_offset) ;
422
422
let byte_offset_diff = ch. len_utf8 ( ) ;
423
- self . pos = self . pos + Pos :: from_usize ( byte_offset_diff) ;
423
+ self . next_pos = self . next_pos + Pos :: from_usize ( byte_offset_diff) ;
424
424
self . curr = Some ( ch) ;
425
425
self . col = self . col + CharPos ( 1 ) ;
426
426
if last_char == '\n' {
@@ -439,7 +439,7 @@ impl<'a> StringReader<'a> {
439
439
}
440
440
441
441
pub fn nextch ( & self ) -> Option < char > {
442
- let offset = self . byte_offset ( self . pos ) . to_usize ( ) ;
442
+ let offset = self . byte_offset ( self . next_pos ) . to_usize ( ) ;
443
443
if offset < self . source_text . len ( ) {
444
444
Some ( char_at ( & self . source_text , offset) )
445
445
} else {
@@ -452,7 +452,7 @@ impl<'a> StringReader<'a> {
452
452
}
453
453
454
454
pub fn nextnextch ( & self ) -> Option < char > {
455
- let offset = self . byte_offset ( self . pos ) . to_usize ( ) ;
455
+ let offset = self . byte_offset ( self . next_pos ) . to_usize ( ) ;
456
456
let s = & self . source_text [ ..] ;
457
457
if offset >= s. len ( ) {
458
458
return None ;
@@ -518,7 +518,7 @@ impl<'a> StringReader<'a> {
518
518
break ;
519
519
} else if doc_comment {
520
520
self . err_span_ ( self . last_pos ,
521
- self . pos ,
521
+ self . next_pos ,
522
522
"bare CR not allowed in doc-comment" ) ;
523
523
}
524
524
}
@@ -695,7 +695,7 @@ impl<'a> StringReader<'a> {
695
695
// in range for the true radix
696
696
if c. unwrap ( ) . to_digit ( real_radix) . is_none ( ) {
697
697
self . err_span_ ( self . last_pos ,
698
- self . pos ,
698
+ self . next_pos ,
699
699
& format ! ( "invalid digit for a base {} literal" , real_radix) ) ;
700
700
}
701
701
len += 1 ;
@@ -809,7 +809,7 @@ impl<'a> StringReader<'a> {
809
809
accum_int *= 16 ;
810
810
accum_int += c. to_digit ( 16 ) . unwrap_or_else ( || {
811
811
self . err_span_char ( self . last_pos ,
812
- self . pos ,
812
+ self . next_pos ,
813
813
"invalid character in numeric character escape" ,
814
814
c) ;
815
815
@@ -980,11 +980,11 @@ impl<'a> StringReader<'a> {
980
980
accum_int += c. to_digit ( 16 ) . unwrap_or_else ( || {
981
981
if c == delim {
982
982
panic ! ( self . fatal_span_( self . last_pos,
983
- self . pos ,
983
+ self . next_pos ,
984
984
"unterminated unicode escape (needed a `}`)" ) ) ;
985
985
} else {
986
986
self . err_span_char ( self . last_pos ,
987
- self . pos ,
987
+ self . next_pos ,
988
988
"invalid character in unicode escape" ,
989
989
c) ;
990
990
}
@@ -1022,7 +1022,7 @@ impl<'a> StringReader<'a> {
1022
1022
}
1023
1023
if self . scan_digits ( 10 , 10 ) == 0 {
1024
1024
self . err_span_ ( self . last_pos ,
1025
- self . pos ,
1025
+ self . next_pos ,
1026
1026
"expected at least one digit in exponent" )
1027
1027
}
1028
1028
}
@@ -1259,7 +1259,7 @@ impl<'a> StringReader<'a> {
1259
1259
// if we find one, then this is an invalid character literal
1260
1260
if self . curr_is ( '\'' ) {
1261
1261
panic ! ( self . fatal_span_verbose(
1262
- start_with_quote, self . pos ,
1262
+ start_with_quote, self . next_pos ,
1263
1263
String :: from( "character literal may only contain one codepoint" ) ) ) ;
1264
1264
1265
1265
}
@@ -1467,7 +1467,7 @@ impl<'a> StringReader<'a> {
1467
1467
}
1468
1468
c => {
1469
1469
let last_bpos = self . last_pos ;
1470
- let bpos = self . pos ;
1470
+ let bpos = self . next_pos ;
1471
1471
let mut err = self . struct_fatal_span_char ( last_bpos,
1472
1472
bpos,
1473
1473
"unknown start of token" ,
0 commit comments