diff options
| author | Lee Jeffery <leejeffery@gmail.com> | 2015-05-14 18:19:51 +0100 |
|---|---|---|
| committer | Lee Jeffery <leejeffery@gmail.com> | 2015-05-14 18:19:51 +0100 |
| commit | 93af5f9b446adfeb95abdd8df76cf961451f9d91 (patch) | |
| tree | 755a8a45e7a0fdf34a44f2dbec41f63d8dd213c8 /src/libsyntax/parse | |
| parent | 4f82c3151b063a4226f33df047d4e748ef5e3f13 (diff) | |
| download | rust-93af5f9b446adfeb95abdd8df76cf961451f9d91.tar.gz rust-93af5f9b446adfeb95abdd8df76cf961451f9d91.zip | |
Make BytePos calculation same as original
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/lexer/mod.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 184f503bbc2..1ca4451d28d 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -406,7 +406,6 @@ impl<'a> StringReader<'a> { // line comments starting with "///" or "//!" are doc-comments let doc_comment = self.curr_is('/') || self.curr_is('!'); - let start_bpos = self.last_pos - BytePos(2); while !self.is_eof() { match self.curr.unwrap() { @@ -426,6 +425,7 @@ impl<'a> StringReader<'a> { } return if doc_comment { + let start_bpos = self.pos - BytePos(3); self.with_str_from(start_bpos, |string| { // comments with only more "/"s are not doc comments let tok = if is_doc_comment(string) { @@ -440,6 +440,7 @@ impl<'a> StringReader<'a> { }) }) } else { + let start_bpos = self.last_pos - BytePos(2); Some(TokenAndSpan { tok: token::Comment, sp: codemap::mk_sp(start_bpos, self.last_pos) |
