fn parse_string_lit(&mut self) -> PResult<Vec<u8>> {
        trace!("parse_string_lit");
        // Grammar:
        //
        // ```
        // string_lit             = raw_string_lit | interpreted_string_lit .
        // raw_string_lit         = "`" { unicode_char | newline } "`" .
        // interpreted_string_lit = `"` { unicode_value | byte_value } `"` .
        // ```

        match self.token.kind {
            TokenKind::Str => {
                // Interpret the string.
                let raw_val = self.bump_and_get().value.expect("BUG: missing Str value");
                Ok(try!(self.interpret_string_lit(raw_val)))
            }
            TokenKind::StrRaw => {
                // Only interpreting that needs to be done is removing carriage returns.
                let raw_val = self.bump_and_get().value.expect("BUG: missing StrRaw value");
                let mut byte_vec = raw_val.into_bytes();
                byte_vec.retain(|&c| c != b'\r');
                Ok(byte_vec)
            }
            _ => {
                Err(self.err(ErrorKind::unexpected_token(vec![TokenKind::Str, TokenKind::StrRaw],
                                                         self.token.clone())))
            }
        }
    }
/// Parse a string literal, whether interpreted or raw.
/// This is useful because one will often expect a string literal without caring about its
/// kind.
Parse a string literal, whether interpreted or raw.
This is useful because one will often expect a string literal without caring about its
kind.
Parse a string literal whether interpreted or raw . This is useful because one will often expect a string literal without caring about its kind .
fn parse_string_lit(&mut self) -> PResult<Vec<u8>> {
        trace!("parse_string_lit");
        // Grammar:
        //
        // ```
        // string_lit             = raw_string_lit | interpreted_string_lit .
        // raw_string_lit         = "`" { unicode_char | newline } "`" .
        // interpreted_string_lit = `"` { unicode_value | byte_value } `"` .
        // ```
        match self.token.kind {
            TokenKind::Str => {
                // Interpret the string.
                let raw_val = self.bump_and_get().value.expect("BUG: missing Str value");
                Ok(try!(self.interpret_string_lit(raw_val)))
            }
            TokenKind::StrRaw => {
                // Only interpreting that needs to be done is removing carriage returns.
                let raw_val = self.bump_and_get().value.expect("BUG: missing StrRaw value");
                let mut byte_vec = raw_val.into_bytes();
                byte_vec.retain(|&c| c != b'\r');
                Ok(byte_vec)
            }
            _ => {
                Err(self.err(ErrorKind::unexpected_token(vec![TokenKind::Str, TokenKind::StrRaw],
                                                         self.token.clone())))
            }
        }
    }
fn parse_string_lit ( & mut self ) -> PResult < Vec < u8 > > { trace ! ( " " ) ; // Grammar: // // ``` // string_lit             = raw_string_lit | interpreted_string_lit . // raw_string_lit         = "`" { unicode_char | newline } "`" . // interpreted_string_lit = `"` { unicode_value | byte_value } `"` . // ``` match self . token . kind { TokenKind :: Str => { // Interpret the string. let raw_val = self . bump_and_get ( ) . value . expect ( " " ) ; Ok ( try ! ( self interpret_string_lit ( raw_val ) ) ) } TokenKind :: StrRaw => { // Only interpreting that needs to be done is removing carriage returns. let raw_val = self . bump_and_get ( ) . value . expect ( " " ) ; let mut byte_vec = raw_val . into_bytes ( ) ; byte_vec . retain ( | & c | c != b'\r' ) ; Ok ( byte_vec ) } _ => { Err ( self . err ( ErrorKind :: unexpected_token ( vec ! [ TokenKind Str TokenKind StrRaw ] , self . token . clone ( ) ) ) ) } } }
Parse a string literal, whether interpreted or raw.
Parse a string literal whether interpreted or raw .
&mut self