libsyntax: De-@mut StringReader::col

This commit is contained in:
Patrick Walton 2013-12-27 12:06:59 -08:00
parent 13b235d1e5
commit aa3527a1a3
2 changed files with 7 additions and 7 deletions

View File

@ -171,7 +171,7 @@ fn push_blank_line_comment(rdr: @mut StringReader, comments: &mut ~[cmnt]) {
fn consume_whitespace_counting_blank_lines(rdr: @mut StringReader,
comments: &mut ~[cmnt]) {
while is_whitespace(rdr.curr) && !is_eof(rdr) {
if rdr.col == CharPos(0u) && rdr.curr == '\n' {
if rdr.col.get() == CharPos(0u) && rdr.curr == '\n' {
push_blank_line_comment(rdr, &mut *comments);
}
bump(rdr);
@ -254,7 +254,7 @@ fn read_block_comment(rdr: @mut StringReader,
debug!(">>> block comment");
let p = rdr.last_pos.get();
let mut lines: ~[~str] = ~[];
let col: CharPos = rdr.col;
let col: CharPos = rdr.col.get();
bump(rdr);
bump(rdr);

View File

@ -48,7 +48,7 @@ pub struct StringReader {
// The absolute offset within the codemap of the last character read(curr)
last_pos: Cell<BytePos>,
// The column of the next character to read
col: CharPos,
col: Cell<CharPos>,
// The last character to be read
curr: char,
filemap: @codemap::FileMap,
@ -76,7 +76,7 @@ pub fn new_low_level_string_reader(span_diagnostic: @mut SpanHandler,
src: filemap.src,
pos: Cell::new(filemap.start_pos),
last_pos: Cell::new(filemap.start_pos),
col: CharPos(0),
col: Cell::new(CharPos(0)),
curr: initial_char,
filemap: filemap,
/* dummy values; not read */
@ -96,7 +96,7 @@ fn dup_string_reader(r: @mut StringReader) -> @mut StringReader {
src: r.src,
pos: Cell::new(r.pos.get()),
last_pos: Cell::new(r.last_pos.get()),
col: r.col,
col: Cell::new(r.col.get()),
curr: r.curr,
filemap: r.filemap,
peek_tok: r.peek_tok.clone(),
@ -249,10 +249,10 @@ pub fn bump(rdr: &mut StringReader) {
let byte_offset_diff = next.next - current_byte_offset;
rdr.pos.set(rdr.pos.get() + Pos::from_uint(byte_offset_diff));
rdr.curr = next.ch;
rdr.col = rdr.col + CharPos(1u);
rdr.col.set(rdr.col.get() + CharPos(1u));
if last_char == '\n' {
rdr.filemap.next_line(rdr.last_pos.get());
rdr.col = CharPos(0u);
rdr.col.set(CharPos(0u));
}
if byte_offset_diff > 1 {