about summary refs log tree commit diff
path: root/src/comp/syntax/parse
diff options
context:
space:
mode:
authorKevin Atkinson <kevina@cs.utah.edu>2012-02-08 17:45:02 -0700
committerKevin Atkinson <kevina@cs.utah.edu>2012-02-10 12:32:51 -0700
commitf9a63efb8214a36b13545b158bf27c1b6540b650 (patch)
tree4cc907f8c18a43f8411d466462e776b9af264fb2 /src/comp/syntax/parse
parentd808df893a085205cb6e113ce98ac09accbc595a (diff)
downloadrust-f9a63efb8214a36b13545b158bf27c1b6540b650.tar.gz
rust-f9a63efb8214a36b13545b158bf27c1b6540b650.zip
Correctly handle the character position at the EOF.
Fixes issue #1785.
Diffstat (limited to 'src/comp/syntax/parse')
-rw-r--r--src/comp/syntax/parse/lexer.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs
index 42cc5400b0c..2902ad513a1 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(