@@ -13,7 +13,11 @@ use crate::parser::ParseState;
13
13
use crate :: resolve:: { call as call_resolve, Name as ResolveName } ;
14
14
use crate :: state:: { call, State } ;
15
15
use crate :: subtokenize:: Subresult ;
16
- use crate :: util:: { char:: format_byte_opt, constant:: TAB_SIZE , edit_map:: EditMap } ;
16
+
17
+ #[ cfg( feature = "log" ) ]
18
+ use crate :: util:: char:: format_byte_opt;
19
+
20
+ use crate :: util:: { constant:: TAB_SIZE , edit_map:: EditMap } ;
17
21
use alloc:: { boxed:: Box , string:: String , vec, vec:: Vec } ;
18
22
19
23
/// Containers.
@@ -405,7 +409,10 @@ impl<'a> Tokenizer<'a> {
405
409
move_point_back ( self , & mut point) ;
406
410
407
411
let info = ( point. index , point. vs ) ;
412
+
413
+ #[ cfg( feature = "log" ) ]
408
414
log:: debug!( "position: define skip: {:?} -> ({:?})" , point. line, info) ;
415
+
409
416
let at = point. line - self . first_line ;
410
417
411
418
if at >= self . column_start . len ( ) {
@@ -476,6 +483,8 @@ impl<'a> Tokenizer<'a> {
476
483
self . line_start = self . point . clone ( ) ;
477
484
478
485
self . account_for_potential_skip ( ) ;
486
+
487
+ #[ cfg( feature = "log" ) ]
479
488
log:: debug!( "position: after eol: `{:?}`" , self . point) ;
480
489
} else {
481
490
self . point . column += 1 ;
@@ -533,7 +542,9 @@ impl<'a> Tokenizer<'a> {
533
542
move_point_back ( self , & mut point) ;
534
543
}
535
544
545
+ #[ cfg( feature = "log" ) ]
536
546
log:: debug!( "exit: `{:?}`" , name) ;
547
+
537
548
let event = Event {
538
549
kind : Kind :: Exit ,
539
550
name,
@@ -663,7 +674,9 @@ fn enter_impl(tokenizer: &mut Tokenizer, name: Name, link: Option<Link>) {
663
674
let mut point = tokenizer. point . clone ( ) ;
664
675
move_point_back ( tokenizer, & mut point) ;
665
676
677
+ #[ cfg( feature = "log" ) ]
666
678
log:: debug!( "enter: `{:?}`" , name) ;
679
+
667
680
tokenizer. stack . push ( name. clone ( ) ) ;
668
681
tokenizer. events . push ( Event {
669
682
kind : Kind :: Enter ,
@@ -708,7 +721,9 @@ fn push_impl(
708
721
attempt. nok
709
722
} ;
710
723
724
+ #[ cfg( feature = "log" ) ]
711
725
log:: debug!( "attempt: `{:?}` -> `{:?}`" , state, next) ;
726
+
712
727
state = next;
713
728
} else {
714
729
break ;
@@ -735,13 +750,17 @@ fn push_impl(
735
750
None
736
751
} ;
737
752
753
+ #[ cfg( feature = "log" ) ]
738
754
log:: debug!( "feed: {} to {:?}" , format_byte_opt( byte) , name) ;
755
+
739
756
tokenizer. expect ( byte) ;
740
757
state = call ( tokenizer, name) ;
741
758
} ;
742
759
}
743
760
State :: Retry ( name) => {
761
+ #[ cfg( feature = "log" ) ]
744
762
log:: debug!( "retry: `{:?}`" , name) ;
763
+
745
764
state = call ( tokenizer, name) ;
746
765
}
747
766
}
0 commit comments