Change spans to use byte offsets instead of char offsets
This commit is contained in:
parent
8cba337cce
commit
81d20156cd
12 changed files with 161 additions and 89 deletions
|
@ -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| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue