fn string(&mut self) {
        while let Some(c) = self.current_char {
            // check if the next character is escaped and only allow those not in self.esc
            if c == '\\' {
                match self.peek() {
                    None => panic!("Invalid end of string at pos {}", self.pos),
                    Some(p) => {
                        if p == 'u' {
                            // if the next char is unicode advance twice to skip the '\' and 'u'
                            self.advance();
                            self.advance();
                            // parse the hex num
                            self.hex_num();
                        } else if !self.esc.contains(&p) {
                            // If the value isnt in our accepted escapable characters, crash
                            panic!("Invalid escaped character : {} at pos {}", p, self.pos)
                        } else {
                            // If we find a valid escaped character, advance to the next one
                            self.advance();
                        }
                    }
                }
            } else if self.unsafe_code_point.contains(&c) || c.is_control() {
                // if c is not a safe character, return (used if we find the final " otherwise the json isnt valid)
                return
            }
            // loop through characters
            self.advance();
        }
        panic!("Invalid end of string at pos {}", self.pos)
    }
// A function to handle string tokens (i.e. "*+")
A function to handle string tokens
A function to handle string tokens
fn string(&mut self) {
        while let Some(c) = self.current_char {
            // check if the next character is escaped and only allow those not in self.esc
            if c == '\\' {
                match self.peek() {
                    None => panic!("Invalid end of string at pos {}", self.pos),
                    Some(p) => {
                        if p == 'u' {
                            // if the next char is unicode advance twice to skip the '\' and 'u'
                            self.advance();
                            self.advance();
                            // parse the hex num
                            self.hex_num();
                        } else if !self.esc.contains(&p) {
                            // If the value isnt in our accepted escapable characters, crash
                            panic!("Invalid escaped character : {} at pos {}", p, self.pos)
                        } else {
                            // If we find a valid escaped character, advance to the next one
                            self.advance();
                        }
                    }
                }
            } else if self.unsafe_code_point.contains(&c) || c.is_control() {
                // if c is not a safe character, return (used if we find the final " otherwise the json isnt valid)
                return
            }
            // loop through characters
            self.advance();
        }
        panic!("Invalid end of string at pos {}", self.pos)
    }
fn string ( & mut self ) { while let Some ( c ) = self . current_char { // check if the next character is escaped and only allow those not in self.esc if c == '\\' { match self . peek ( ) { None => panic ! ( " " self pos ) , Some ( p ) => { if p == 'u' { // if the next char is unicode advance twice to skip the '\' and 'u' self . advance ( ) ; self . advance ( ) ; // parse the hex num self . hex_num ( ) ; } else if ! self . esc . contains ( & p ) { // If the value isnt in our accepted escapable characters, crash panic ! ( " " p self pos ) } else { // If we find a valid escaped character, advance to the next one self . advance ( ) ; } } } } else if self . unsafe_code_point . contains ( & c ) || c . is_control ( ) { // if c is not a safe character, return (used if we find the final " otherwise the json isnt valid) return } // loop through characters self . advance ( ) ; } panic ! ( " " self pos ) }
A function to handle string tokens (i.e.
A function to handle string tokens ( i . e .
&mut self
&mut self