From 3eef8d14197d5166286f6a4dbc4b604e52581618 Mon Sep 17 00:00:00 2001 From: Kevin Atkinson Date: Wed, 8 Feb 2012 17:45:02 -0700 Subject: Correctly handle the character position at the EOF. Fixes issue #1785. --- src/comp/syntax/parse/lexer.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/comp/syntax/parse') diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs index 300d0a66f1d..aa989cb0f61 100644 --- a/src/comp/syntax/parse/lexer.rs +++ b/src/comp/syntax/parse/lexer.rs @@ -43,7 +43,13 @@ impl reader for reader { let next = str::char_range_at(*self.src, self.pos); self.pos = next.next; self.curr = next.ch; - } else { self.curr = -1 as char; } + } else { + if (self.curr != -1 as char) { + self.col += 1u; + self.chpos += 1u; + self.curr = -1 as char; + } + } } fn fatal(m: str) -> ! { self.span_diagnostic.span_fatal( -- cgit 1.4.1-3-g733a5