pub fn lookup_char_pos(&self, pos: BytePos) -> Loc {
        let chpos = self.bytepos_to_file_charpos(pos);
        match self.lookup_line(pos) {
            Ok(FileMapAndLine { fm: f, line: a }) => {
                let line = a + 1; // Line numbers start at 1
                let linebpos = (*f.lines.borrow())[a];
                let linechpos = self.bytepos_to_file_charpos(linebpos);
                debug!("byte pos {:?} is on the line at byte pos {:?}",
                       pos, linebpos);
                debug!("char pos {:?} is on the line at char pos {:?}",
                       chpos, linechpos);
                debug!("byte is on line: {}", line);
                assert!(chpos >= linechpos);
                Loc {
                    file: f,
                    line: line,
                    col: chpos - linechpos,
                }
            }
            Err(f) => {
                Loc {
                    file: f,
                    line: 0,
                    col: chpos,
                }
            }
        }
    }
/// Lookup source information about a BytePos
Lookup source information about a BytePos
Lookup source information about a BytePos
pub fn lookup_char_pos(&self, pos: BytePos) -> Loc {
        let chpos = self.bytepos_to_file_charpos(pos);
        match self.lookup_line(pos) {
            Ok(FileMapAndLine { fm: f, line: a }) => {
                let line = a + 1; // Line numbers start at 1
                let linebpos = (*f.lines.borrow())[a];
                let linechpos = self.bytepos_to_file_charpos(linebpos);
                debug!("byte pos {:?} is on the line at byte pos {:?}",
                       pos, linebpos);
                debug!("char pos {:?} is on the line at char pos {:?}",
                       chpos, linechpos);
                debug!("byte is on line: {}", line);
                assert!(chpos >= linechpos);
                Loc {
                    file: f,
                    line: line,
                    col: chpos - linechpos,
                }
            }
            Err(f) => {
                Loc {
                    file: f,
                    line: 0,
                    col: chpos,
                }
            }
        }
    }
pub fn lookup_char_pos ( & self , pos : BytePos ) -> Loc { let chpos = self . bytepos_to_file_charpos ( pos ) ; match self . lookup_line ( pos ) { Ok ( FileMapAndLine { fm : f , line : a } ) => { let line = a + 1 ; // Line numbers start at 1 let linebpos = ( * f . lines . borrow ( ) ) [ a ] ; let linechpos = self . bytepos_to_file_charpos ( linebpos ) ; debug ! ( " " pos linebpos ) ; debug ! ( " " chpos linechpos ) ; debug ! ( " " line ) ; assert ! ( chpos linechpos ) ; Loc { file : f , line : line , col : chpos - linechpos , } } Err ( f ) => { Loc { file : f , line : 0 , col : chpos , } } } }
Lookup source information about a BytePos
Lookup source information about a BytePos
&self
pos
BytePos
&self
pos
BytePos