diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-11-12 19:32:48 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-11-14 15:18:29 -0800 |
| commit | f67bfe97389a256fc95216c29a2b8a066ee16a2c (patch) | |
| tree | a638c4c480ceb60138a39a05c5b04967ac814eb6 /src/libsyntax/ext/tt | |
| parent | 9ecf86343a136c71cbb2bb8da9bfd1734fec37f4 (diff) | |
| download | rust-f67bfe97389a256fc95216c29a2b8a066ee16a2c.tar.gz rust-f67bfe97389a256fc95216c29a2b8a066ee16a2c.zip | |
Add types for character position and byte position in the codemap
Diffstat (limited to 'src/libsyntax/ext/tt')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 5 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/transcribe.rs | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 76814a688f5..2f371e1f8c5 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -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| { diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index 238f9db6ac5..78f0e4fc8f8 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -53,7 +53,7 @@ fn new_tt_reader(sp_diag: span_handler, itr: @ident_interner, mut repeat_len: ~[], /* dummy values, never read: */ mut cur_tok: EOF, - mut cur_span: ast_util::mk_sp(0u,0u) + mut cur_span: ast_util::dummy_sp() }; tt_next_token(r); /* get cur_tok and cur_span set up */ return r; |
