@@ -315,7 +315,7 @@ impl Cursor<'_> {
315
315
( '#' , c1) if is_id_start ( c1) => self . raw_ident ( ) ,
316
316
( '#' , _) | ( '"' , _) => {
317
317
let res = self . raw_double_quoted_string ( 1 ) ;
318
- let suffix_start = self . len_consumed ( ) ;
318
+ let suffix_start = self . pos_within_token ( ) ;
319
319
if res. is_ok ( ) {
320
320
self . eat_literal_suffix ( ) ;
321
321
}
@@ -330,7 +330,7 @@ impl Cursor<'_> {
330
330
( '\'' , _) => {
331
331
self . bump ( ) ;
332
332
let terminated = self . single_quoted_string ( ) ;
333
- let suffix_start = self . len_consumed ( ) ;
333
+ let suffix_start = self . pos_within_token ( ) ;
334
334
if terminated {
335
335
self . eat_literal_suffix ( ) ;
336
336
}
@@ -340,7 +340,7 @@ impl Cursor<'_> {
340
340
( '"' , _) => {
341
341
self . bump ( ) ;
342
342
let terminated = self . double_quoted_string ( ) ;
343
- let suffix_start = self . len_consumed ( ) ;
343
+ let suffix_start = self . pos_within_token ( ) ;
344
344
if terminated {
345
345
self . eat_literal_suffix ( ) ;
346
346
}
@@ -350,7 +350,7 @@ impl Cursor<'_> {
350
350
( 'r' , '"' ) | ( 'r' , '#' ) => {
351
351
self . bump ( ) ;
352
352
let res = self . raw_double_quoted_string ( 2 ) ;
353
- let suffix_start = self . len_consumed ( ) ;
353
+ let suffix_start = self . pos_within_token ( ) ;
354
354
if res. is_ok ( ) {
355
355
self . eat_literal_suffix ( ) ;
356
356
}
@@ -367,7 +367,7 @@ impl Cursor<'_> {
367
367
// Numeric literal.
368
368
c @ '0' ..='9' => {
369
369
let literal_kind = self . number ( c) ;
370
- let suffix_start = self . len_consumed ( ) ;
370
+ let suffix_start = self . pos_within_token ( ) ;
371
371
self . eat_literal_suffix ( ) ;
372
372
TokenKind :: Literal { kind : literal_kind, suffix_start }
373
373
}
@@ -406,7 +406,7 @@ impl Cursor<'_> {
406
406
// String literal.
407
407
'"' => {
408
408
let terminated = self . double_quoted_string ( ) ;
409
- let suffix_start = self . len_consumed ( ) ;
409
+ let suffix_start = self . pos_within_token ( ) ;
410
410
if terminated {
411
411
self . eat_literal_suffix ( ) ;
412
412
}
@@ -419,8 +419,8 @@ impl Cursor<'_> {
419
419
}
420
420
_ => Unknown ,
421
421
} ;
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 ( ) ;
424
424
res
425
425
}
426
426
@@ -606,7 +606,7 @@ impl Cursor<'_> {
606
606
607
607
if !can_be_a_lifetime {
608
608
let terminated = self . single_quoted_string ( ) ;
609
- let suffix_start = self . len_consumed ( ) ;
609
+ let suffix_start = self . pos_within_token ( ) ;
610
610
if terminated {
611
611
self . eat_literal_suffix ( ) ;
612
612
}
@@ -631,7 +631,7 @@ impl Cursor<'_> {
631
631
if self . first ( ) == '\'' {
632
632
self . bump ( ) ;
633
633
let kind = Char { terminated : true } ;
634
- Literal { kind, suffix_start : self . len_consumed ( ) }
634
+ Literal { kind, suffix_start : self . pos_within_token ( ) }
635
635
} else {
636
636
Lifetime { starts_with_number }
637
637
}
@@ -712,7 +712,7 @@ impl Cursor<'_> {
712
712
713
713
fn raw_string_unvalidated ( & mut self , prefix_len : u32 ) -> Result < u32 , RawStrError > {
714
714
debug_assert ! ( self . prev( ) == 'r' ) ;
715
- let start_pos = self . len_consumed ( ) ;
715
+ let start_pos = self . pos_within_token ( ) ;
716
716
let mut possible_terminator_offset = None ;
717
717
let mut max_hashes = 0 ;
718
718
@@ -766,7 +766,7 @@ impl Cursor<'_> {
766
766
// Keep track of possible terminators to give a hint about
767
767
// where there might be a missing terminator
768
768
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) ;
770
770
max_hashes = n_end_hashes;
771
771
}
772
772
}
0 commit comments