1+ use std:: fmt;
2+
13use crate :: errors:: { json_err, JsonResult , LinePosition } ;
24use crate :: number_decoder:: AbstractNumberDecoder ;
35use crate :: string_decoder:: { AbstractStringDecoder , Tape } ;
46
5- #[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
7+ #[ derive( Copy , Clone , PartialEq , Eq ) ]
68pub struct Peek ( u8 ) ;
79
810#[ allow( non_upper_case_globals) ] // while testing
@@ -18,6 +20,23 @@ impl Peek {
1820 pub const Object : Self = Self ( b'{' ) ;
1921}
2022
23+ impl fmt:: Debug for Peek {
24+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
25+ match self . 0 {
26+ b'n' => write ! ( f, "Null" ) ,
27+ b't' => write ! ( f, "True" ) ,
28+ b'f' => write ! ( f, "False" ) ,
29+ b'-' => write ! ( f, "Minus" ) ,
30+ b'I' => write ! ( f, "Infinity" ) ,
31+ b'N' => write ! ( f, "NaN" ) ,
32+ b'"' => write ! ( f, "String" ) ,
33+ b'[' => write ! ( f, "Array" ) ,
34+ b'{' => write ! ( f, "Object" ) ,
35+ _ => write ! ( f, "Peek({:?})" , self . 0 as char ) ,
36+ }
37+ }
38+ }
39+
2140impl Peek {
2241 pub const fn new ( next : u8 ) -> Self {
2342 Self ( next)
0 commit comments