diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 2521bb515f7..469d3d64f24 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -42,7 +42,6 @@ pub struct TokenAndSpan { pub struct StringReader { span_diagnostic: @SpanHandler, - src: @str, // The absolute offset within the codemap of the next character to read pos: Cell, // The absolute offset within the codemap of the last character read(curr) @@ -73,7 +72,6 @@ pub fn new_low_level_string_reader(span_diagnostic: @SpanHandler, let initial_char = '\n'; let r = @StringReader { span_diagnostic: span_diagnostic, - src: filemap.src, pos: Cell::new(filemap.start_pos), last_pos: Cell::new(filemap.start_pos), col: Cell::new(CharPos(0)), @@ -93,7 +91,6 @@ pub fn new_low_level_string_reader(span_diagnostic: @SpanHandler, fn dup_string_reader(r: @StringReader) -> @StringReader { @StringReader { span_diagnostic: r.span_diagnostic, - src: r.src, pos: Cell::new(r.pos.get()), last_pos: Cell::new(r.last_pos.get()), col: Cell::new(r.col.get()), @@ -188,7 +185,7 @@ fn fatal_span_verbose(rdr: @StringReader, -> ! { let mut m = m; m.push_str(": "); - let s = rdr.src.slice( + let s = rdr.filemap.src.slice( byte_offset(rdr, from_pos).to_uint(), byte_offset(rdr, to_pos).to_uint()); m.push_str(s); @@ -239,7 +236,7 @@ fn with_str_from_to( end: BytePos, f: |s: &str| -> T) -> T { - f(rdr.src.slice( + f(rdr.filemap.src.slice( byte_offset(rdr, start).to_uint(), byte_offset(rdr, end).to_uint())) } @@ -249,12 +246,12 @@ fn with_str_from_to( pub fn bump(rdr: &StringReader) { rdr.last_pos.set(rdr.pos.get()); let current_byte_offset = byte_offset(rdr, rdr.pos.get()).to_uint(); - if current_byte_offset < (rdr.src).len() { + if current_byte_offset < (rdr.filemap.src).len() { assert!(rdr.curr.get() != unsafe { transmute(-1u32) }); // FIXME: #8971: unsound let last_char = rdr.curr.get(); - let next = rdr.src.char_range_at(current_byte_offset); + let next = rdr.filemap.src.char_range_at(current_byte_offset); let byte_offset_diff = next.next - current_byte_offset; rdr.pos.set(rdr.pos.get() + Pos::from_uint(byte_offset_diff)); rdr.curr.set(next.ch); @@ -277,8 +274,8 @@ pub fn is_eof(rdr: @StringReader) -> bool { } pub fn nextch(rdr: @StringReader) -> char { let offset = byte_offset(rdr, rdr.pos.get()).to_uint(); - if offset < (rdr.src).len() { - return rdr.src.char_at(offset); + if offset < (rdr.filemap.src).len() { + return rdr.filemap.src.char_at(offset); } else { return unsafe { transmute(-1u32) }; } // FIXME: #8971: unsound }