pub fn advance_bytes(&mut self, n: usize) -> &str {
        let slice = &self.source[self.index..self.index + n];
        
        let mut newlines = 0;
        let mut last_newline_index = None;
        for (i, c) in slice.char_indices() {
            if c == '\n' {
                newlines += 1;
                last_newline_index = Some(i);
            }
        }

        // note: using slice.len() here instead of n because it's possible that
        // the slice is shorter than n bytes.
        self.index += slice.len();
        self.position.line += newlines;
        if let Some(i) = last_newline_index {
            self.position.column = slice.len() - i;
        } else {
            self.position.column += slice.len();
        }

        slice
    }
/// Advances the lexer by the given amount of bytes.
/// If not enough bytes are available, will return as many as possible.
Advances the lexer by the given amount of bytes.
If not enough bytes are available, will return as many as possible.
Advances the lexer by the given amount of bytes . If not enough bytes are available will return as many as possible .
pub fn advance_bytes(&mut self, n: usize) -> &str {
        let slice = &self.source[self.index..self.index + n];
        let mut newlines = 0;
        let mut last_newline_index = None;
        for (i, c) in slice.char_indices() {
            if c == '\n' {
                newlines += 1;
                last_newline_index = Some(i);
            }
        }
        // note: using slice.len() here instead of n because it's possible that
        // the slice is shorter than n bytes.
        self.index += slice.len();
        self.position.line += newlines;
        if let Some(i) = last_newline_index {
            self.position.column = slice.len() - i;
        } else {
            self.position.column += slice.len();
        }
        slice
    }
pub fn advance_bytes ( & mut self , n : usize ) -> & str { let slice = & self . source [ self . index .. self . index + n ] ; let mut newlines = 0 ; let mut last_newline_index = None ; for ( i , c ) in slice . char_indices ( ) { if c == '\n' { newlines += 1 ; last_newline_index = Some ( i ) ; } } // note: using slice.len() here instead of n because it's possible that // the slice is shorter than n bytes. self . index += slice . len ( ) ; self . position . line += newlines ; if let Some ( i ) = last_newline_index { self . position . column = slice . len ( ) - i ; } else { self . position . column += slice . len ( ) ; } slice }
Advances the lexer by the given amount of bytes.
Advances the lexer by the given amount of bytes .
&mut self
n
usize