diff options
-rw-r--r-- | src/tokenizer.rs | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/tokenizer.rs b/src/tokenizer.rs index 0ab8784..8843e47 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -13,7 +13,14 @@ use crate::parser::ParseState; use crate::resolve::{call as call_resolve, Name as ResolveName}; use crate::state::{call, State}; use crate::util::{constant::TAB_SIZE, edit_map::EditMap}; -use alloc::{boxed::Box, string::String, vec, vec::Vec}; +use alloc::{ + boxed::Box, + format, + string::{String, ToString}, + vec, + vec::Vec, +}; +use core::str; /// Containers. /// @@ -714,7 +721,14 @@ fn push_impl( None }; - log::debug!("feed: `{:?}` to {:?}", byte, name); + let visible = byte.map(|d| { + if (b' '..=b'~').contains(&d) { + str::from_utf8(&[d]).unwrap().to_string() + } else { + format!("0x{:x}", d) + } + }); + log::debug!("feed: `{:?}` to {:?}", visible, name); tokenizer.expect(byte); state = call(tokenizer, name); }; |