syntax: Some minor lexer refactoring
This commit is contained in:
parent
4b4f064315
commit
34ba1850b9
@ -47,7 +47,7 @@ fn mk_substr_filename(cm: codemap, sp: span) -> str
|
||||
}
|
||||
|
||||
fn next_line(file: filemap, chpos: uint, byte_pos: uint) {
|
||||
file.lines += [{ch: chpos, byte: byte_pos}];
|
||||
file.lines += [{ch: chpos, byte: byte_pos + file.start_pos.byte}];
|
||||
}
|
||||
|
||||
type lookup_fn = fn@(file_pos) -> uint;
|
||||
|
@ -33,8 +33,7 @@ impl reader for reader {
|
||||
self.col += 1u;
|
||||
self.chpos += 1u;
|
||||
if self.curr == '\n' {
|
||||
codemap::next_line(self.filemap, self.chpos, self.pos +
|
||||
self.filemap.start_pos.byte);
|
||||
codemap::next_line(self.filemap, self.chpos, self.pos);
|
||||
self.col = 0u;
|
||||
}
|
||||
let next = str::char_range_at(*self.src, self.pos);
|
||||
|
Loading…
Reference in New Issue
Block a user