@@ -315,7 +315,7 @@ impl Cursor<'_> {
315315 ( '#' , c1) if is_id_start ( c1) => self . raw_ident ( ) ,
316316 ( '#' , _) | ( '"' , _) => {
317317 let res = self . raw_double_quoted_string ( 1 ) ;
318- let suffix_start = self . len_consumed ( ) ;
318+ let suffix_start = self . pos_within_token ( ) ;
319319 if res. is_ok ( ) {
320320 self . eat_literal_suffix ( ) ;
321321 }
@@ -330,7 +330,7 @@ impl Cursor<'_> {
330330 ( '\'' , _) => {
331331 self . bump ( ) ;
332332 let terminated = self . single_quoted_string ( ) ;
333- let suffix_start = self . len_consumed ( ) ;
333+ let suffix_start = self . pos_within_token ( ) ;
334334 if terminated {
335335 self . eat_literal_suffix ( ) ;
336336 }
@@ -340,7 +340,7 @@ impl Cursor<'_> {
340340 ( '"' , _) => {
341341 self . bump ( ) ;
342342 let terminated = self . double_quoted_string ( ) ;
343- let suffix_start = self . len_consumed ( ) ;
343+ let suffix_start = self . pos_within_token ( ) ;
344344 if terminated {
345345 self . eat_literal_suffix ( ) ;
346346 }
@@ -350,7 +350,7 @@ impl Cursor<'_> {
350350 ( 'r' , '"' ) | ( 'r' , '#' ) => {
351351 self . bump ( ) ;
352352 let res = self . raw_double_quoted_string ( 2 ) ;
353- let suffix_start = self . len_consumed ( ) ;
353+ let suffix_start = self . pos_within_token ( ) ;
354354 if res. is_ok ( ) {
355355 self . eat_literal_suffix ( ) ;
356356 }
@@ -367,7 +367,7 @@ impl Cursor<'_> {
367367 // Numeric literal.
368368 c @ '0' ..='9' => {
369369 let literal_kind = self . number ( c) ;
370- let suffix_start = self . len_consumed ( ) ;
370+ let suffix_start = self . pos_within_token ( ) ;
371371 self . eat_literal_suffix ( ) ;
372372 TokenKind :: Literal { kind : literal_kind, suffix_start }
373373 }
@@ -406,7 +406,7 @@ impl Cursor<'_> {
406406 // String literal.
407407 '"' => {
408408 let terminated = self . double_quoted_string ( ) ;
409- let suffix_start = self . len_consumed ( ) ;
409+ let suffix_start = self . pos_within_token ( ) ;
410410 if terminated {
411411 self . eat_literal_suffix ( ) ;
412412 }
@@ -419,8 +419,8 @@ impl Cursor<'_> {
419419 }
420420 _ => Unknown ,
421421 } ;
422- let res = Some ( Token :: new ( token_kind, self . len_consumed ( ) ) ) ;
423- self . reset_len_consumed ( ) ;
422+ let res = Some ( Token :: new ( token_kind, self . pos_within_token ( ) ) ) ;
423+ self . reset_pos_within_token ( ) ;
424424 res
425425 }
426426
@@ -606,7 +606,7 @@ impl Cursor<'_> {
606606
607607 if !can_be_a_lifetime {
608608 let terminated = self . single_quoted_string ( ) ;
609- let suffix_start = self . len_consumed ( ) ;
609+ let suffix_start = self . pos_within_token ( ) ;
610610 if terminated {
611611 self . eat_literal_suffix ( ) ;
612612 }
@@ -631,7 +631,7 @@ impl Cursor<'_> {
631631 if self . first ( ) == '\'' {
632632 self . bump ( ) ;
633633 let kind = Char { terminated : true } ;
634- Literal { kind, suffix_start : self . len_consumed ( ) }
634+ Literal { kind, suffix_start : self . pos_within_token ( ) }
635635 } else {
636636 Lifetime { starts_with_number }
637637 }
@@ -712,7 +712,7 @@ impl Cursor<'_> {
712712
713713 fn raw_string_unvalidated ( & mut self , prefix_len : u32 ) -> Result < u32 , RawStrError > {
714714 debug_assert ! ( self . prev( ) == 'r' ) ;
715- let start_pos = self . len_consumed ( ) ;
715+ let start_pos = self . pos_within_token ( ) ;
716716 let mut possible_terminator_offset = None ;
717717 let mut max_hashes = 0 ;
718718
@@ -766,7 +766,7 @@ impl Cursor<'_> {
766766 // Keep track of possible terminators to give a hint about
767767 // where there might be a missing terminator
768768 possible_terminator_offset =
769- Some ( self . len_consumed ( ) - start_pos - n_end_hashes + prefix_len) ;
769+ Some ( self . pos_within_token ( ) - start_pos - n_end_hashes + prefix_len) ;
770770 max_hashes = n_end_hashes;
771771 }
772772 }
0 commit comments