about summary refs log tree commit diff
path: root/src/comp/syntax/parse
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-07-11 21:30:33 -0700
committerBrian Anderson <banderson@mozilla.com>2011-07-11 21:31:14 -0700
commita5ec51d6a1f86c6fda69edd6b2f98483ab99ac0a (patch)
tree8102344b92477404d550a786dfad01252909428c /src/comp/syntax/parse
parenta8b1ea159c1159d4b7e7f41d45c1f9e933e85e93 (diff)
downloadrust-a5ec51d6a1f86c6fda69edd6b2f98483ab99ac0a.tar.gz
rust-a5ec51d6a1f86c6fda69edd6b2f98483ab99ac0a.zip
Fix pretty-printing of literals again. Issue #672
The pos variable is one character beyond where I thought it was.
Diffstat (limited to 'src/comp/syntax/parse')
-rw-r--r--src/comp/syntax/parse/lexer.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs
index 733faaf4f09..93e67e64fa2 100644
--- a/src/comp/syntax/parse/lexer.rs
+++ b/src/comp/syntax/parse/lexer.rs
@@ -45,7 +45,12 @@ fn new_reader(&codemap::codemap cm, str src, codemap::filemap filemap,
                @interner::interner[str] itr) {
         fn is_eof() -> bool { ret ch == -1 as char; }
         fn mark() { mark_pos = pos; mark_chpos = chpos; }
-        fn get_mark_str() -> str { ret str::slice(src, mark_pos, pos); }
+        fn get_mark_str() -> str {
+            // I'm pretty skeptical about this subtraction. What if there's a
+            // multi-byte character before the mark?
+            ret str::slice(src, mark_pos - 1u,
+                           pos - 1u);
+        }
         fn get_mark_chpos() -> uint { ret mark_chpos; }
         fn get_chpos() -> uint { ret chpos; }
         fn curr() -> char { ret ch; }