Add types for character position and byte position in the codemap

This commit is contained in:
Brian Anderson 2012-11-12 19:32:48 -08:00
parent 9ecf86343a
commit f67bfe9738
22 changed files with 285 additions and 161 deletions

View file

@ -11,6 +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;
/* 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
@ -102,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: uint,
sp_lo: CharPos,
};
fn copy_up(&& mpu: matcher_pos_up) -> matcher_pos {
@ -122,7 +123,7 @@ fn count_names(ms: &[matcher]) -> uint {
}
#[allow(non_implicitly_copyable_typarams)]
fn initial_matcher_pos(ms: ~[matcher], sep: Option<Token>, lo: uint)
fn initial_matcher_pos(ms: ~[matcher], sep: Option<Token>, lo: CharPos)
-> matcher_pos {
let mut match_idx_hi = 0u;
for ms.each() |elt| {