summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-11-15 19:37:29 -0800
committerBrian Anderson <banderson@mozilla.com>2012-11-16 12:06:44 -0800
commit81d20156cd44358e47e5081635f28ea31c01a757 (patch)
tree000e99c48bf31156f8574e9ea2d6830722503328 /src/libsyntax/ext
parent8cba337cce19c71c4030f26fba2b00842172b99e (diff)
downloadrust-81d20156cd44358e47e5081635f28ea31c01a757.tar.gz
rust-81d20156cd44358e47e5081635f28ea31c01a757.zip
Change spans to use byte offsets instead of char offsets
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/qquote.rs14
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs6
2 files changed, 10 insertions, 10 deletions
diff --git a/src/libsyntax/ext/qquote.rs b/src/libsyntax/ext/qquote.rs
index 50d1e0033e2..888932e58e7 100644
--- a/src/libsyntax/ext/qquote.rs
+++ b/src/libsyntax/ext/qquote.rs
@@ -4,7 +4,7 @@ use parse::parser;
 use parse::parser::{Parser, parse_from_source_str};
 use dvec::DVec;
 use parse::token::ident_interner;
-use codemap::CharPos;
+use codemap::{CharPos, BytePos};
 
 use fold::*;
 use visit::*;
@@ -16,13 +16,13 @@ use io::*;
 use codemap::span;
 
 struct gather_item {
-    lo: CharPos,
-    hi: CharPos,
+    lo: BytePos,
+    hi: BytePos,
     e: @ast::expr,
     constr: ~str
 }
 
-type aq_ctxt = @{lo: CharPos, gather: DVec<gather_item>};
+type aq_ctxt = @{lo: BytePos, gather: DVec<gather_item>};
 enum fragment {
     from_expr(@ast::expr),
     from_ty(@ast::Ty)
@@ -115,7 +115,7 @@ impl @ast::pat: qq_helper {
     fn get_fold_fn() -> ~str {~"fold_pat"}
 }
 
-fn gather_anti_quotes<N: qq_helper>(lo: CharPos, node: N) -> aq_ctxt
+fn gather_anti_quotes<N: qq_helper>(lo: BytePos, node: N) -> aq_ctxt
 {
     let v = @{visit_expr: |node, &&cx, v| visit_aq(node, ~"from_expr", cx, v),
               visit_ty: |node, &&cx, v| visit_aq(node, ~"from_ty", cx, v),
@@ -227,7 +227,7 @@ fn finish<T: qq_helper>
     let mut str2 = ~"";
     enum state {active, skip(uint), blank};
     let mut state = active;
-    let mut i = CharPos(0u);
+    let mut i = BytePos(0u);
     let mut j = 0u;
     let g_len = cx.gather.len();
     for str::chars_each(*str) |ch| {
@@ -244,7 +244,7 @@ fn finish<T: qq_helper>
           blank if is_space(ch) => str::push_char(&mut str2, ch),
           blank => str::push_char(&mut str2, ' ')
         }
-        i += CharPos(1u);
+        i += BytePos(1u);
         if (j < g_len && i == cx.gather[j].hi) {
             assert ch == ')';
             state = active;
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 2f371e1f8c5..6779ed263d5 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -11,7 +11,7 @@ use dvec::DVec;
 use ast::{matcher, match_tok, match_seq, match_nonterminal, ident};
 use ast_util::mk_sp;
 use std::map::HashMap;
-use codemap::CharPos;
+use codemap::BytePos;
 
 /* This is an Earley-like parser, without support for in-grammar nonterminals,
 only by calling out to the main rust parser for named nonterminals (which it
@@ -103,7 +103,7 @@ type matcher_pos = ~{
     mut up: matcher_pos_up, // mutable for swapping only
     matches: ~[DVec<@named_match>],
     match_lo: uint, match_hi: uint,
-    sp_lo: CharPos,
+    sp_lo: BytePos,
 };
 
 fn copy_up(&& mpu: matcher_pos_up) -> matcher_pos {
@@ -123,7 +123,7 @@ fn count_names(ms: &[matcher]) -> uint {
 }
 
 #[allow(non_implicitly_copyable_typarams)]
-fn initial_matcher_pos(ms: ~[matcher], sep: Option<Token>, lo: CharPos)
+fn initial_matcher_pos(ms: ~[matcher], sep: Option<Token>, lo: BytePos)
     -> matcher_pos {
     let mut match_idx_hi = 0u;
     for ms.each() |elt| {