diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-07-11 14:38:55 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-07-11 14:41:55 -0700 |
| commit | 7fc7ebd520f16947f8356fdeb9061238e2fb4f0b (patch) | |
| tree | dbadcb7d377fdaf14e5b0c23f0a2c7b4f55cde16 /src/comp/syntax/parse | |
| parent | eef61a527d8d08f57df8309d42ba15d15e391a83 (diff) | |
| download | rust-7fc7ebd520f16947f8356fdeb9061238e2fb4f0b.tar.gz rust-7fc7ebd520f16947f8356fdeb9061238e2fb4f0b.zip | |
The lexer's get_mark_str should slice by byte position, not char. Closes #654
Diffstat (limited to 'src/comp/syntax/parse')
| -rw-r--r-- | src/comp/syntax/parse/lexer.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs index ffc83bcbbea..46c3e0abb52 100644 --- a/src/comp/syntax/parse/lexer.rs +++ b/src/comp/syntax/parse/lexer.rs @@ -37,14 +37,15 @@ fn new_reader(&codemap::codemap cm, io::reader rdr, codemap::filemap filemap, mutable uint col, mutable uint pos, mutable char ch, + mutable uint mark_pos, mutable uint mark_chpos, mutable uint chpos, mutable vec[str] strs, codemap::filemap fm, @interner::interner[str] itr) { fn is_eof() -> bool { ret ch == -1 as char; } - fn mark() { mark_chpos = chpos; } - fn get_mark_str() -> str { ret str::slice(file, mark_chpos, chpos); } + fn mark() { mark_pos = pos; mark_chpos = chpos; } + fn get_mark_str() -> str { ret str::slice(file, mark_pos, pos); } fn get_mark_chpos() -> uint { ret mark_chpos; } fn get_chpos() -> uint { ret chpos; } fn curr() -> char { ret ch; } @@ -80,7 +81,7 @@ fn new_reader(&codemap::codemap cm, io::reader rdr, codemap::filemap filemap, auto file = str::unsafe_from_bytes(rdr.read_whole_stream()); let vec[str] strs = []; auto rd = - reader(cm, file, str::byte_len(file), 0u, 0u, -1 as char, + reader(cm, file, str::byte_len(file), 0u, 0u, -1 as char, 0u, filemap.start_pos, filemap.start_pos, strs, filemap, itr); rd.init(); ret rd; |
